brcm2708: add kernel 4.14 support
[openwrt/staging/lynxis.git] / target / linux / brcm2708 / patches-4.14 / 950-0285-Reduce-log-spam-when-mailbox-call-not-implemented.patch
1 From 785c44fa278b7dd7a4b96c64321dc43fa2220f7d Mon Sep 17 00:00:00 2001
2 From: James Hughes <james.hughes@raspberrypi.org>
3 Date: Fri, 27 Apr 2018 10:13:35 +0100
4 Subject: [PATCH 285/454] Reduce log spam when mailbox call not implemented
5
6 This changes the logging message when a mailbox call
7 fails to the dev_dbg level. In addition, it fixes the
8 low voltage detection logging code so that if the
9 mailbox call doies fails, it logs at error level
10 and flags so the call is no longer attempted.
11
12 Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
13 ---
14 drivers/firmware/raspberrypi.c | 23 ++++++++++++++++++-----
15 1 file changed, 18 insertions(+), 5 deletions(-)
16
17 --- a/drivers/firmware/raspberrypi.c
18 +++ b/drivers/firmware/raspberrypi.c
19 @@ -151,7 +151,7 @@ int rpi_firmware_property_list(struct rp
20 * error, if there were multiple tags in the request.
21 * But single-tag is the most common, so go with it.
22 */
23 - dev_err(fw->cl.dev, "Request 0x%08x returned status 0x%08x\n",
24 + dev_dbg(fw->cl.dev, "Request 0x%08x returned status 0x%08x\n",
25 buf[2], buf[1]);
26 ret = -EINVAL;
27 }
28 @@ -204,6 +204,7 @@ EXPORT_SYMBOL_GPL(rpi_firmware_property)
29
30 static int rpi_firmware_get_throttled(struct rpi_firmware *fw, u32 *value)
31 {
32 + static int old_firmware;
33 static ktime_t old_timestamp;
34 static u32 old_value;
35 u32 new_sticky, old_sticky, new_uv, old_uv;
36 @@ -214,6 +215,9 @@ static int rpi_firmware_get_throttled(st
37 if (!fw)
38 return -EBUSY;
39
40 + if (old_firmware)
41 + return -EINVAL;
42 +
43 /*
44 * We can't run faster than the sticky shift (100ms) since we get
45 * flipping in the sticky bits that are cleared.
46 @@ -232,8 +236,17 @@ static int rpi_firmware_get_throttled(st
47
48 ret = rpi_firmware_property(fw, RPI_FIRMWARE_GET_THROTTLED,
49 value, sizeof(*value));
50 - if (ret)
51 +
52 + if (ret) {
53 + /* If the mailbox call fails once, then it will continue to
54 + * fail in the future, so no point in continuing to call it
55 + * Usual failure reason is older firmware
56 + */
57 + old_firmware = 1;
58 + dev_err(fw->cl.dev, "Get Throttled mailbox call failed");
59 +
60 return ret;
61 + }
62
63 new_sticky = *value >> 16;
64 old_sticky = old_value >> 16;
65 @@ -270,10 +283,10 @@ static void get_throttled_poll(struct wo
66 int ret;
67
68 ret = rpi_firmware_get_throttled(fw, &dummy);
69 - if (ret)
70 - pr_debug("%s: Failed to read value (%d)", __func__, ret);
71
72 - schedule_delayed_work(&fw->get_throttled_poll_work, 2 * HZ);
73 + /* Only reschedule if we are getting valid responses */
74 + if (!ret)
75 + schedule_delayed_work(&fw->get_throttled_poll_work, 2 * HZ);
76 }
77
78 static ssize_t get_throttled_show(struct device *dev,