mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2025-09-16 09:09:49 +00:00
Changelog: https://cdn.kernel.org/pub/linux/kernel/v6.x/ChangeLog-6.12.43 Removed upstreamed: generic/backport-6.12/612-07-v6.17-net-dsa-b53-prevent-SWITCH_CTRL-access-on-BCM5325.patch[1] generic-backport/612-08-v6.17-net-dsa-b53-fix-IP_MULTICAST_CTRL-on-BCM5325.patch[2] generic-backport/612-09-v6.17-net-dsa-b53-prevent-DIS_LEARNING-access-on-BCM5325.patch[3] generic-backport/612-11-v6.17-net-dsa-b53-prevent-GMII_PORT_OVERRIDE_CTRL-access-on-BCM5325.patch[4] generic-backport/612-14-v6.17-net-dsa-b53-ensure-BCM5325-PHYs-are-enabled.patch[5] generic-backport/830-v6.17-Revert-leds-trigger-netdev-Configure-LED-blink-inter.patch[6] bcm27xx/patches-6.12/950-0100-media-tc358743-Increase-FIFO-level-to-374.patch[7] bcm27xx/patches-6.12/950-0102-media-tc358743-Check-I2C-succeeded-during-probe.patch[8] bcm27xx/patches-6.12/950-0107-media-tc358743-Return-an-appropriate-colorspace-from.patch[9] bcm27xx/patches-6.12/950-0341-Allow-RESET_BRCMSTB-on-ARCH_BCM2835.patch[10] lantiq/patches-6.12/102-11-v6.17-MIPS-lantiq-falcon-sysctrl-fix-request-memory-check-.patch[11] lantiq/patches-6.12/102-12-v6.17-MIPS-vpe-mt-add-missing-prototypes-for-vpe_-alloc-st.patch[12] qualcommax/patches-6.12/0170-clk-qcom-gcc-ipq8074-fix-broken-freq-table-for-nss_port6_tx_clk_src.patch[13] generic/backport-6.12/612-13-v6.17-net-dsa-b53-fix-b53_imp_vlan_setup-for-BCM5325.patch[14] All other patches automatically rebased. 1. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f16f96ccfe56ef2d627c20ba47f6d9d7dea40f5b 2. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=394bd12d1f93ed2fa0fa1d8f31ffd3c344681e85 3. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=9f45e4858f8096bb27f9a2c75fc24a538dffad67 4. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=15cf46cc6ecc7a54b397294675d11c379ddf69ef 5. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=0d250ad617a035904744cef74a5d5dc43d0199b9 6. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=cb9bb872366e10fa42e1e0200a0c2e5d05a27bec 7. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f25d566c5674decd0051a3e624805fc1524729bf 8. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=3e03ee3b65baeac4c253b30650492ffffad9b608 9. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=b42b107293b52ac8d46238815b1071138a47a7e4 10. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=e285cdb9d2e4ba2e4515ae898f92e9f38be64eb3 11. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=1e9079ff83eac962bc3b1e2fbad73b2f7d5256f4 12. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=8520c843d9a2770012f23da08e4e2ccf1bb05ba6 13. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=f1c5c55fb6cda312f5ed15505588caaf05a69043 14. https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v6.12.43&id=757955c80663ac3df7053abaf6fcc75051ef7a7c Build system: x86/64 (Intel N150 based) Build-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64-glibc Run-tested: flogic/xiaomi_redmi-router-ax6000-ubootmod, ramips/tplink_archer-a6-v3, x86/64-glibc Signed-off-by: John Audia <therealgraysky@proton.me> Link: https://github.com/openwrt/openwrt/pull/19618 Signed-off-by: Robert Marko <robimarko@gmail.com>
223 lines
6.8 KiB
Diff
223 lines
6.8 KiB
Diff
From 38798884cb3ccd05b2a82299db865aeb7e7c059b Mon Sep 17 00:00:00 2001
|
|
From: Phil Elwell <phil@raspberrypi.com>
|
|
Date: Thu, 5 May 2022 15:46:07 +0100
|
|
Subject: [PATCH] hwmon: emc2305: fixups for driver submitted to mailing lists
|
|
|
|
The driver had a number of issues, checkpatch warnings/errors,
|
|
and other limitations, so fix these up to make it usable.
|
|
|
|
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
|
|
hwmon: emc2305: Add calls to initialise of cooling maps
|
|
|
|
Commit 46ef9d4ed26b ("hwmon: emc2305: fixups for driver submitted to
|
|
mailing lists") missed adding the call to thermal_of_cooling_device_register
|
|
required to configure any cooling maps for the device, hence stopping it
|
|
from actually ever changing speed.
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
|
|
hwmon: emc2305: Change OF properties pwm-min & pwm-max to u8
|
|
|
|
There is no DT binding for emc2305 as mainline are still
|
|
discussing how to do a generic fan binding.
|
|
The 5.15 driver was reading the "emc2305," properties
|
|
"cooling-levels", "pwm-max", "pwm-min", and "pwm-channel" as u8.
|
|
The overlay was writing them as u16 (;) so it was working.
|
|
|
|
The 6.1 driver was reading as u32, which failed as there is
|
|
insufficient data.
|
|
|
|
As this is all downstream only, revert to u8 to match 5.15.
|
|
|
|
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
|
|
---
|
|
drivers/hwmon/emc2305.c | 95 +++++++++++++++++++++++++++++++++++++----
|
|
1 file changed, 87 insertions(+), 8 deletions(-)
|
|
|
|
--- a/drivers/hwmon/emc2305.c
|
|
+++ b/drivers/hwmon/emc2305.c
|
|
@@ -12,12 +12,13 @@
|
|
#include <linux/platform_data/emc2305.h>
|
|
#include <linux/thermal.h>
|
|
|
|
+#define EMC2305_REG_FAN_STATUS 0x24
|
|
+#define EMC2305_REG_FAN_STALL_STATUS 0x25
|
|
#define EMC2305_REG_DRIVE_FAIL_STATUS 0x27
|
|
#define EMC2305_REG_VENDOR 0xfe
|
|
#define EMC2305_FAN_MAX 0xff
|
|
#define EMC2305_FAN_MIN 0x00
|
|
#define EMC2305_FAN_MAX_STATE 10
|
|
-#define EMC2305_DEVICE 0x34
|
|
#define EMC2305_VENDOR 0x5d
|
|
#define EMC2305_REG_PRODUCT_ID 0xfd
|
|
#define EMC2305_TACH_REGS_UNUSE_BITS 3
|
|
@@ -36,6 +37,7 @@
|
|
#define EMC2305_RPM_FACTOR 3932160
|
|
|
|
#define EMC2305_REG_FAN_DRIVE(n) (0x30 + 0x10 * (n))
|
|
+#define EMC2305_REG_FAN_CFG(n) (0x32 + 0x10 * (n))
|
|
#define EMC2305_REG_FAN_MIN_DRIVE(n) (0x38 + 0x10 * (n))
|
|
#define EMC2305_REG_FAN_TACH(n) (0x3e + 0x10 * (n))
|
|
|
|
@@ -55,6 +57,15 @@ static const struct i2c_device_id emc230
|
|
};
|
|
MODULE_DEVICE_TABLE(i2c, emc2305_ids);
|
|
|
|
+static const struct of_device_id emc2305_dt_ids[] = {
|
|
+ { .compatible = "microchip,emc2305" },
|
|
+ { .compatible = "microchip,emc2303" },
|
|
+ { .compatible = "microchip,emc2302" },
|
|
+ { .compatible = "microchip,emc2301" },
|
|
+ { }
|
|
+};
|
|
+MODULE_DEVICE_TABLE(of, emc2305_dt_ids);
|
|
+
|
|
/**
|
|
* struct emc2305_cdev_data - device-specific cooling device state
|
|
* @cdev: cooling device
|
|
@@ -100,6 +111,7 @@ struct emc2305_data {
|
|
u8 pwm_num;
|
|
bool pwm_separate;
|
|
u8 pwm_min[EMC2305_PWM_MAX];
|
|
+ u8 pwm_max;
|
|
struct emc2305_cdev_data cdev_data[EMC2305_PWM_MAX];
|
|
};
|
|
|
|
@@ -272,7 +284,7 @@ static int emc2305_set_pwm(struct device
|
|
struct i2c_client *client = data->client;
|
|
int ret;
|
|
|
|
- if (val < data->pwm_min[channel] || val > EMC2305_FAN_MAX)
|
|
+ if (val < data->pwm_min[channel] || val > data->pwm_max)
|
|
return -EINVAL;
|
|
|
|
ret = i2c_smbus_write_byte_data(client, EMC2305_REG_FAN_DRIVE(channel), val);
|
|
@@ -283,6 +295,49 @@ static int emc2305_set_pwm(struct device
|
|
return 0;
|
|
}
|
|
|
|
+static int emc2305_get_tz_of(struct device *dev)
|
|
+{
|
|
+ struct device_node *np = dev->of_node;
|
|
+ struct emc2305_data *data = dev_get_drvdata(dev);
|
|
+ int ret = 0;
|
|
+ u8 val;
|
|
+ int i;
|
|
+
|
|
+ /* OF parameters are optional - overwrite default setting
|
|
+ * if some of them are provided.
|
|
+ */
|
|
+
|
|
+ ret = of_property_read_u8(np, "emc2305,cooling-levels", &val);
|
|
+ if (!ret)
|
|
+ data->max_state = val;
|
|
+ else if (ret != -EINVAL)
|
|
+ return ret;
|
|
+
|
|
+ ret = of_property_read_u8(np, "emc2305,pwm-max", &val);
|
|
+ if (!ret)
|
|
+ data->pwm_max = val;
|
|
+ else if (ret != -EINVAL)
|
|
+ return ret;
|
|
+
|
|
+ ret = of_property_read_u8(np, "emc2305,pwm-min", &val);
|
|
+ if (!ret)
|
|
+ for (i = 0; i < EMC2305_PWM_MAX; i++)
|
|
+ data->pwm_min[i] = val;
|
|
+ else if (ret != -EINVAL)
|
|
+ return ret;
|
|
+
|
|
+ /* Not defined or 0 means one thermal zone over all cooling devices.
|
|
+ * Otherwise - separated thermal zones for each PWM channel.
|
|
+ */
|
|
+ ret = of_property_read_u8(np, "emc2305,pwm-channel", &val);
|
|
+ if (!ret)
|
|
+ data->pwm_separate = (val != 0);
|
|
+ else if (ret != -EINVAL)
|
|
+ return ret;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int emc2305_set_single_tz(struct device *dev, int idx)
|
|
{
|
|
struct emc2305_data *data = dev_get_drvdata(dev);
|
|
@@ -292,9 +347,17 @@ static int emc2305_set_single_tz(struct
|
|
cdev_idx = (idx) ? idx - 1 : 0;
|
|
pwm = data->pwm_min[cdev_idx];
|
|
|
|
- data->cdev_data[cdev_idx].cdev =
|
|
- thermal_cooling_device_register(emc2305_fan_name[idx], data,
|
|
- &emc2305_cooling_ops);
|
|
+ if (dev->of_node)
|
|
+ data->cdev_data[cdev_idx].cdev =
|
|
+ devm_thermal_of_cooling_device_register(dev, dev->of_node,
|
|
+ emc2305_fan_name[idx],
|
|
+ data,
|
|
+ &emc2305_cooling_ops);
|
|
+ else
|
|
+ data->cdev_data[cdev_idx].cdev =
|
|
+ thermal_cooling_device_register(emc2305_fan_name[idx],
|
|
+ data,
|
|
+ &emc2305_cooling_ops);
|
|
|
|
if (IS_ERR(data->cdev_data[cdev_idx].cdev)) {
|
|
dev_err(dev, "Failed to register cooling device %s\n", emc2305_fan_name[idx]);
|
|
@@ -353,9 +416,11 @@ static void emc2305_unset_tz(struct devi
|
|
int i;
|
|
|
|
/* Unregister cooling device. */
|
|
- for (i = 0; i < EMC2305_PWM_MAX; i++)
|
|
- if (data->cdev_data[i].cdev)
|
|
- thermal_cooling_device_unregister(data->cdev_data[i].cdev);
|
|
+ if (!dev->of_node) {
|
|
+ for (i = 0; i < EMC2305_PWM_MAX; i++)
|
|
+ if (data->cdev_data[i].cdev)
|
|
+ thermal_cooling_device_unregister(data->cdev_data[i].cdev);
|
|
+ }
|
|
}
|
|
|
|
static umode_t
|
|
@@ -577,11 +642,18 @@ static int emc2305_probe(struct i2c_clie
|
|
data->pwm_separate = pdata->pwm_separate;
|
|
for (i = 0; i < EMC2305_PWM_MAX; i++)
|
|
data->pwm_min[i] = pdata->pwm_min[i];
|
|
+ data->pwm_max = EMC2305_FAN_MAX;
|
|
} else {
|
|
data->max_state = EMC2305_FAN_MAX_STATE;
|
|
data->pwm_separate = false;
|
|
for (i = 0; i < EMC2305_PWM_MAX; i++)
|
|
data->pwm_min[i] = EMC2305_FAN_MIN;
|
|
+ data->pwm_max = EMC2305_FAN_MAX;
|
|
+ if (dev->of_node) {
|
|
+ ret = emc2305_get_tz_of(dev);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+ }
|
|
}
|
|
|
|
data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "emc2305", data,
|
|
@@ -602,6 +674,12 @@ static int emc2305_probe(struct i2c_clie
|
|
return ret;
|
|
}
|
|
|
|
+ /* Acknowledge any existing faults. Stops the device responding on the
|
|
+ * SMBus alert address.
|
|
+ */
|
|
+ i2c_smbus_read_byte_data(client, EMC2305_REG_FAN_STALL_STATUS);
|
|
+ i2c_smbus_read_byte_data(client, EMC2305_REG_FAN_STATUS);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -616,6 +694,7 @@ static void emc2305_remove(struct i2c_cl
|
|
static struct i2c_driver emc2305_driver = {
|
|
.driver = {
|
|
.name = "emc2305",
|
|
+ .of_match_table = emc2305_dt_ids,
|
|
},
|
|
.probe = emc2305_probe,
|
|
.remove = emc2305_remove,
|