summaryrefslogtreecommitdiff
path: root/drivers/hwmon/mr75203.c
diff options
context:
space:
mode:
authorEliav Farber <farbere@amazon.com>2022-09-08 15:24:47 +0000
committerGuenter Roeck <linux@roeck-us.net>2022-09-19 06:21:04 -0700
commit27937d6f8eda4ec8179384764fc5a658d4a6060c (patch)
treecda306693dc3692b6888e87eda4f5284392ba5f3 /drivers/hwmon/mr75203.c
parentbf1fdafdbc61c5fcfb12e481fc40b345fbc26814 (diff)
hwmon: (mr75203) parse temperature coefficients from device-tree
Use thermal coefficients from the device tree if they exist. Otherwise, use default values according to the series (5 or 6). All coefficients can be used or only part of them. The coefficients shall be used for fine tuning the default values since coefficients can vary between product and product. Signed-off-by: Eliav Farber <farbere@amazon.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220908152449.35457-20-farbere@amazon.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers/hwmon/mr75203.c')
-rw-r--r--drivers/hwmon/mr75203.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/hwmon/mr75203.c b/drivers/hwmon/mr75203.c
index ce00349ce1d7..e3960fc7198f 100644
--- a/drivers/hwmon/mr75203.c
+++ b/drivers/hwmon/mr75203.c
@@ -709,6 +709,15 @@ static int pvt_set_temp_coeff(struct device *dev, struct pvt_device *pvt)
dev_dbg(dev, "temperature sensor series = %u\n", series);
+ /* Override ts-coeff-h/g/j/cal5 if they are defined. */
+ device_property_read_u32(dev, "moortec,ts-coeff-h", &ts_coeff->h);
+ device_property_read_u32(dev, "moortec,ts-coeff-g", &ts_coeff->g);
+ device_property_read_u32(dev, "moortec,ts-coeff-j", &ts_coeff->j);
+ device_property_read_u32(dev, "moortec,ts-coeff-cal5", &ts_coeff->cal5);
+
+ dev_dbg(dev, "ts-coeff: h = %u, g = %u, j = %d, cal5 = %u\n",
+ ts_coeff->h, ts_coeff->g, ts_coeff->j, ts_coeff->cal5);
+
return 0;
}