aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch
diff options
context:
space:
mode:
authorChristian Lamparter <chunkeey@gmail.com>2018-01-07 21:27:48 +0100
committerMathias Kresin <dev@kresin.me>2018-01-12 08:00:04 +0100
commit15faf389ad5159fa8223344029c98a0afca6e5ef (patch)
tree68e652f9cd4ff7753620d9a8882643e3a8a85077 /target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch
parent9a9c7fb4cf8a0483b26b2d9ecc481275173d63f7 (diff)
downloadupstream-15faf389ad5159fa8223344029c98a0afca6e5ef.tar.gz
upstream-15faf389ad5159fa8223344029c98a0afca6e5ef.tar.bz2
upstream-15faf389ad5159fa8223344029c98a0afca6e5ef.zip
apm821xx: add linux 4.14 apm821xx patches
This patch updates the apm821xx target to use the 4.14 kernel. 4.14 finally ships with a driver for the WNDR4700's tc654 fan controller. The custom driver is deprecated in favor of the upstream driver and the thermal cooling definitions in the DTS are updated. Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
Diffstat (limited to 'target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch')
-rw-r--r--target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch65
1 files changed, 65 insertions, 0 deletions
diff --git a/target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch b/target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch
new file mode 100644
index 0000000000..f8b30ae1b3
--- /dev/null
+++ b/target/linux/apm821xx/patches-4.14/803-hwmon-tc654-add-detection-routine.patch
@@ -0,0 +1,65 @@
+From 694f9bfb8efaef8a33e8992015ff9d0866faf4a2 Mon Sep 17 00:00:00 2001
+From: Christian Lamparter <chunkeey@gmail.com>
+Date: Sun, 17 Dec 2017 17:27:15 +0100
+Subject: [PATCH 1/2] hwmon: tc654 add detection routine
+
+This patch adds a detection routine for the TC654/TC655
+chips. Both IDs are listed in the Datasheet.
+
+Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
+---
+ drivers/hwmon/tc654.c | 29 +++++++++++++++++++++++++++++
+ 1 file changed, 29 insertions(+)
+
+--- a/drivers/hwmon/tc654.c
++++ b/drivers/hwmon/tc654.c
+@@ -64,6 +64,11 @@ enum tc654_regs {
+ /* Register data is read (and cached) at most once per second. */
+ #define TC654_UPDATE_INTERVAL HZ
+
++/* Manufacturer and Version Identification Register Values */
++#define TC654_MFR_ID_MICROCHIP 0x84
++#define TC654_VER_ID 0x00
++#define TC655_VER_ID 0x01
++
+ struct tc654_data {
+ struct i2c_client *client;
+
+@@ -497,6 +502,29 @@ static const struct i2c_device_id tc654_
+ {}
+ };
+
++static int
++tc654_detect(struct i2c_client *new_client, struct i2c_board_info *info)
++{
++ struct i2c_adapter *adapter = new_client->adapter;
++ int manufacturer, product;
++
++ if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA))
++ return -ENODEV;
++
++ manufacturer = i2c_smbus_read_byte_data(new_client, TC654_REG_MFR_ID);
++ if (manufacturer != TC654_MFR_ID_MICROCHIP)
++ return -ENODEV;
++
++ product = i2c_smbus_read_byte_data(new_client, TC654_REG_VER_ID);
++ if (!((product == TC654_VER_ID) || (product == TC655_VER_ID)))
++ return -ENODEV;
++
++ strlcpy(info->type, product == TC654_VER_ID ? "tc654" : "tc655",
++ I2C_NAME_SIZE);
++ return 0;
++}
++
++
+ MODULE_DEVICE_TABLE(i2c, tc654_id);
+
+ static struct i2c_driver tc654_driver = {
+@@ -505,6 +533,7 @@ static struct i2c_driver tc654_driver =
+ },
+ .probe = tc654_probe,
+ .id_table = tc654_id,
++ .detect = tc654_detect,
+ };
+
+ module_i2c_driver(tc654_driver);