aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch
diff options
context:
space:
mode:
authorÁlvaro Fernández Rojas <noltari@gmail.com>2021-08-21 10:54:34 +0200
committerÁlvaro Fernández Rojas <noltari@gmail.com>2021-08-21 19:07:07 +0200
commit8299d1f057439f94c6a4412e2e5c5082b82a30c9 (patch)
tree1bf678d61f11f7394493be464c7876e496f7faed /target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch
parent33b6885975ce376ff075362b7f0890326043111b (diff)
downloadupstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.tar.gz
upstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.tar.bz2
upstream-8299d1f057439f94c6a4412e2e5c5082b82a30c9.zip
bcm27xx: add kernel 5.10 support
Rebased RPi foundation patches on linux 5.10.59, removed applied and reverted patches, wireless patches and defconfig patches. bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 4B v1.1 4G bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
Diffstat (limited to 'target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch')
-rw-r--r--target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch79
1 files changed, 79 insertions, 0 deletions
diff --git a/target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch b/target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch
new file mode 100644
index 0000000000..ac331f34dc
--- /dev/null
+++ b/target/linux/bcm27xx/patches-5.10/950-0087-firmware-raspberrypi-Add-backward-compatible-get_thr.patch
@@ -0,0 +1,79 @@
+From 1910584831fe065c50efc3c07b8ea08ff90e6f31 Mon Sep 17 00:00:00 2001
+From: Stefan Wahren <stefan.wahren@i2se.com>
+Date: Sat, 13 Oct 2018 13:31:21 +0200
+Subject: [PATCH] firmware: raspberrypi: Add backward compatible
+ get_throttled
+
+Avoid a hard userspace ABI change by adding a compatible get_throttled
+sysfs entry. Its value is now feed by the GET_THROTTLED requests of the
+new hwmon driver. The first access to get_throttled will generate
+a warning.
+
+Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
+---
+ drivers/firmware/raspberrypi.c | 33 +++++++++++++++++++++++++++++++++
+ 1 file changed, 33 insertions(+)
+
+--- a/drivers/firmware/raspberrypi.c
++++ b/drivers/firmware/raspberrypi.c
+@@ -28,6 +28,7 @@ struct rpi_firmware {
+ struct mbox_chan *chan; /* The property channel. */
+ struct completion c;
+ u32 enabled;
++ u32 get_throttled;
+ };
+
+ static struct platform_device *g_pdev;
+@@ -174,6 +175,12 @@ int rpi_firmware_property(struct rpi_fir
+
+ kfree(data);
+
++ if ((tag == RPI_FIRMWARE_GET_THROTTLED) &&
++ memcmp(&fw->get_throttled, tag_data, sizeof(fw->get_throttled))) {
++ memcpy(&fw->get_throttled, tag_data, sizeof(fw->get_throttled));
++ sysfs_notify(&fw->cl.dev->kobj, NULL, "get_throttled");
++ }
++
+ return ret;
+ }
+ EXPORT_SYMBOL_GPL(rpi_firmware_property);
+@@ -198,6 +205,27 @@ static int rpi_firmware_notify_reboot(st
+ return 0;
+ }
+
++static ssize_t get_throttled_show(struct device *dev,
++ struct device_attribute *attr, char *buf)
++{
++ struct rpi_firmware *fw = dev_get_drvdata(dev);
++
++ WARN_ONCE(1, "deprecated, use hwmon sysfs instead\n");
++
++ return sprintf(buf, "%x\n", fw->get_throttled);
++}
++
++static DEVICE_ATTR_RO(get_throttled);
++
++static struct attribute *rpi_firmware_dev_attrs[] = {
++ &dev_attr_get_throttled.attr,
++ NULL,
++};
++
++static const struct attribute_group rpi_firmware_dev_group = {
++ .attrs = rpi_firmware_dev_attrs,
++};
++
+ static void
+ rpi_firmware_print_firmware_revision(struct rpi_firmware *fw)
+ {
+@@ -227,6 +255,11 @@ rpi_register_hwmon_driver(struct device
+
+ rpi_hwmon = platform_device_register_data(dev, "raspberrypi-hwmon",
+ -1, NULL, 0);
++
++ if (!IS_ERR_OR_NULL(rpi_hwmon)) {
++ if (devm_device_add_group(dev, &rpi_firmware_dev_group))
++ dev_err(dev, "Failed to create get_trottled attr\n");
++ }
+ }
+
+ static void rpi_register_clk_driver(struct device *dev)