hwmon: Add WM835x PMIC hardware monitoring
PATCH 1/1 hwmon: Add WM835x PMIC hardware monitoring
This driver provides reporting of the status supply voltage rails of the WM835x series of PMICs via the hwmon API.
--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm8350-hwmon.c | 155 +++++++++++++++++++++++++++++++++++++++ drivers/mfd/wm8350-core.c | 3 + include/linux/mfd/wm8350/core.h | 6 ++ 5 files changed, 175 insertions(+), 0 deletions(-) create mode 100644 drivers/hwmon/wm8350-hwmon.c
drivers/hwmon/Kconfig +10 -0
@@ -910,6 +910,16 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM8350 + tristate "Wolfson Microelectronics WM835x" + depends on MFD_WM8350 + help + If you say yes here you get support for the hardware + monitoring features of the WM835x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm8350-hwmon. + config SENSORS_ULTRA45 tristate "Sun Ultra45 PIC16F747" depends on SPARC64
drivers/hwmon/Makefile +1 -0
@@ -88,6 +88,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG
drivers/hwmon/wm8350-hwmon.c new file +155 -0
155 lines not on this page · raw message
drivers/mfd/wm8350-core.c +3 -0
@@ -1472,6 +1472,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, &(wm8350->codec.pdev));wm8350_client_dev_register (wm8350,"wm8350-gpio" , &(wm8350->gpio.pdev)); +wm8350_client_dev_register (wm8350,"wm8350-hwmon" , + &(wm8350->hwmon.pdev));wm8350_client_dev_register (wm8350,"wm8350-power" , &(wm8350->power.pdev));wm8350_client_dev_register (wm8350,"wm8350-rtc" , &(wm8350->rtc.pdev));
@@ -1498,6 +1500,7 @@ void wm8350_device_exit(struct wm8350 *wm8350)platform_device_unregister (wm8350->wdt.pdev);platform_device_unregister (wm8350->rtc.pdev);platform_device_unregister (wm8350->power.pdev); +platform_device_unregister (wm8350->hwmon.pdev);platform_device_unregister (wm8350->gpio.pdev);platform_device_unregister (wm8350->codec.pdev);
include/linux/mfd/wm8350/core.h +6 -0
@@ -605,6 +605,11 @@ struct wm8350_irq {void *data; }; +struct wm8350_hwmon { +struct platform_device pdev; +struct device *classdev; +}; +struct wm8350 {struct device *dev;
@@ -629,6 +634,7 @@ struct wm8350 {/* Client devices */ struct wm8350_codec codec;struct wm8350_gpio gpio; +struct wm8350_hwmon hwmon;struct wm8350_pmic pmic;struct wm8350_power power;struct wm8350_rtc rtc;
Signature · 7 lines
1.6.3.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Mark,
Quoted 4 lines · Mark Brown
This driver provides reporting of the status supply voltage rails of the WM835x series of PMICs via the hwmon API.
Signed-off-by Mark Brown <[email protected]>
Quoted 8 lines
--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm8350-hwmon.c | 155 +++++++++++++++++++++++++++++++++++++++ drivers/mfd/wm8350-core.c | 3 + include/linux/mfd/wm8350/core.h | 6 ++ 5 files changed, 175 insertions(+), 0 deletions(-) create mode 100644 drivers/hwmon/wm8350-hwmon.c
I'm pretty busy at the moment and normally I wouldn't go for a driver review, but this one seems simple enough and as I recall, I owe you one. So I'll review your code as my time permits, stay tuned.
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 10 lines · Mark Brown
Quoted 3 lines · Jean Delvare
I'm pretty busy at the moment and normally I wouldn't go for a driver review, but this one seems simple enough and as I recall, I owe you one. So I'll review your code as my time permits, stay tuned.
Thanks. I just realised that I sent you the wrong version of the patch (got confused juggling a fairly large patch queue) - I'll follow up later tonight or tomorrow with a fixed one, please wait for that. Apologies for the noise.
OK, no problem.
Quoted 2 lines
Is there someone else I should send hwmon stuff to instead if you don't normally review this? There is no entry in
MAINTAINERS.
You'd send the patch to the list and hope that someone will pick it and review it. But chances are thin. Other possibilities are finding someone else interested in support for that specific chip and have him/her review and test your driver. Then usually Andrew Morton can pick the patch and push it upstream.
Or you can volunteer to be the new hwmon subsystem maintainer and send the patch to Linus yourself ;)
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
PATCH 1/1 hwmon: Add WM835x PMIC hardware monitoring
In reply to Mark BrownThis driver provides reporting of the status supply voltage rails of the WM835x series of PMICs via the hwmon API.
--- drivers/hwmon/Kconfig | 10 +++ drivers/hwmon/Makefile | 1 + drivers/hwmon/wm8350-hwmon.c | 154 +++++++++++++++++++++++++++++++++++++++ drivers/mfd/wm8350-core.c | 3 + include/linux/mfd/wm8350/core.h | 6 ++ 5 files changed, 174 insertions(+), 0 deletions(-) create mode 100644 drivers/hwmon/wm8350-hwmon.c
drivers/hwmon/Kconfig +10 -0
@@ -910,6 +910,16 @@ config SENSORS_W83627EHF This driver can also be built as a module. If so, the module will be called w83627ehf. +config SENSORS_WM8350 + tristate "Wolfson Microelectronics WM835x" + depends on MFD_WM8350 + help + If you say yes here you get support for the hardware + monitoring features of the WM835x series of PMICs. + + This driver can also be built as a module. If so, the module + will be called wm8350-hwmon. + config SENSORS_ULTRA45 tristate "Sun Ultra45 PIC16F747" depends on SPARC64
drivers/hwmon/Makefile +1 -0
@@ -88,6 +88,7 @@ obj-$(CONFIG_SENSORS_VT8231) += vt8231.o obj-$(CONFIG_SENSORS_W83627EHF) += w83627ehf.o obj-$(CONFIG_SENSORS_W83L785TS) += w83l785ts.o obj-$(CONFIG_SENSORS_W83L786NG) += w83l786ng.o +obj-$(CONFIG_SENSORS_WM8350) += wm8350-hwmon.o ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y) EXTRA_CFLAGS += -DDEBUG
drivers/hwmon/wm8350-hwmon.c new file +154 -0
154 lines not on this page · raw message
drivers/mfd/wm8350-core.c +3 -0
@@ -1472,6 +1472,8 @@ int wm8350_device_init(struct wm8350 *wm8350, int irq, &(wm8350->codec.pdev));wm8350_client_dev_register (wm8350,"wm8350-gpio" , &(wm8350->gpio.pdev)); +wm8350_client_dev_register (wm8350,"wm8350-hwmon" , + &(wm8350->hwmon.pdev));wm8350_client_dev_register (wm8350,"wm8350-power" , &(wm8350->power.pdev));wm8350_client_dev_register (wm8350,"wm8350-rtc" , &(wm8350->rtc.pdev));
@@ -1498,6 +1500,7 @@ void wm8350_device_exit(struct wm8350 *wm8350)platform_device_unregister (wm8350->wdt.pdev);platform_device_unregister (wm8350->rtc.pdev);platform_device_unregister (wm8350->power.pdev); +platform_device_unregister (wm8350->hwmon.pdev);platform_device_unregister (wm8350->gpio.pdev);platform_device_unregister (wm8350->codec.pdev);
include/linux/mfd/wm8350/core.h +6 -0
@@ -605,6 +605,11 @@ struct wm8350_irq {void *data; }; +struct wm8350_hwmon { +struct platform_device *pdev; +struct device *classdev; +}; +struct wm8350 {struct device *dev;
@@ -629,6 +634,7 @@ struct wm8350 {/* Client devices */ struct wm8350_codec codec;struct wm8350_gpio gpio; +struct wm8350_hwmon hwmon;struct wm8350_pmic pmic;struct wm8350_power power;struct wm8350_rtc rtc;
Signature · 7 lines
1.6.3.3 _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Hi Mark,
Few queries below (all nit picky)
Quoted 3 lines
drivers/hwmon/wm8350-hwmon.c new file +0
-0@@ -0,0 +1,154 @@
...
drivers/hwmon/wm8350-hwmon.c line 22
Quoted 2 lines
drivers/hwmon/wm8350-hwmon.c new file +2
-0+#include <linux/delay.h> +#include <linux/platform_device.h>
Why input-polldev? or for that matter delay.h, mutex.h, dmi.h Can't immediately see any use of things from them, but I haven't build tested without to check.
Quoted 1 line
+#include <
linux/input-polldev.h>
...
drivers/hwmon/wm8350-hwmon.c line 57
Quoted 10 lines
drivers/hwmon/wm8350-hwmon.c new file +10
-0+ +static ssize_t show_voltage (struct device *dev, +struct device_attribute *attr,char *buf) +{ +struct wm8350 *wm8350 =dev_get_drvdata (dev); +int channel =to_sensor_dev_attr (attr)->index; +int val; + + val =wm8350_read_auxadc (wm8350, channel,0 ,0 ) + *WM8350_AUX_COEFF /1000 ;
I'd normally be a bit dubious about the lack of error handling here, but having taken a look in at the wm8350-core it doesn't look like any errors that occur can get through anyway (now whether they would ideally be passed up to here is a different question!)
drivers/hwmon/wm8350-hwmon.c line 60
Quoted 3 lines
drivers/hwmon/wm8350-hwmon.c new file +3
-0+ +return sprintf (buf,"%d\n" , val); +}
The rest looks fine to me. Get rid of (or justify) the headers and you have my ack.
--
Jonathan Cameron
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 10 lines · Jonathan Cameron
Quoted 3 lines
drivers/hwmon/wm8350-hwmon.c new file +0
-0@@ -0,0 +1,154 @@...
drivers/hwmon/wm8350-hwmon.c line 22
Quoted 2 lines
drivers/hwmon/wm8350-hwmon.c new file +2
-0+#include <linux/delay.h> +#include <linux/platform_device.h> Why input-polldev? or for that matter
delay.h,mutex.h,dmi.hCan't immediately see any use of things from them, but I haven't build tested without to check.
TBH I templated the headers off another driver and never rechecked them
- obviously I've got far too much stuff in there.
Quoted 7 lines
drivers/hwmon/wm8350-hwmon.c line 57
Quoted 2 lines
drivers/hwmon/wm8350-hwmon.c new file +2
-0+ val =wm8350_read_auxadc (wm8350, channel,0 ,0 ) + *WM8350_AUX_COEFF /1000 ;I'd normally be a bit dubious about the lack of error handling here, but having taken a look in at the wm8350-core it doesn't look like any errors that occur can get through anyway (now whether they would ideally be passed up to here is a different question!)
Yeah, and if it were being changed it'd probably be easier to merge the driver and then do cross-subsystem patches fixing up the readback function and its users in one fell swoop. Realistically if the AUXADC starts failing inaccurate supply voltage readings are probably the least of your worries, though.
Quoted 2 lines
The rest looks fine to me. Get rid of (or justify) the headers and you have my ack.
I'll prune the headers next time I submit.
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Quoted 23 lines · Mark Brown
Quoted 10 lines · Jonathan Cameron
Quoted 3 lines
drivers/hwmon/wm8350-hwmon.c new file +0
-0@@ -0,0 +1,154 @@...
drivers/hwmon/wm8350-hwmon.c line 22
Quoted 2 lines
drivers/hwmon/wm8350-hwmon.c new file +2
-0+#include <linux/delay.h> +#include <linux/platform_device.h> Why input-polldev? or for that matter
delay.h,mutex.h,dmi.hCan't immediately see any use of things from them, but I haven't build tested without to check.TBH I templated the headers off another driver and never rechecked them
- obviously I've got far too much stuff in there.Quoted 7 lines
drivers/hwmon/wm8350-hwmon.c line 57
Quoted 2 lines
drivers/hwmon/wm8350-hwmon.c new file +2
-0+ val =wm8350_read_auxadc (wm8350, channel,0 ,0 ) + *WM8350_AUX_COEFF /1000 ;I'd normally be a bit dubious about the lack of error handling here, but having taken a look in at the wm8350-core it doesn't look like any errors that occur can get through anyway (now whether they would ideally be passed up to here is a different question!)
Quoted 5 lines
Yeah, and if it were being changed it'd probably be easier to merge the driver and then do cross-subsystem patches fixing up the readback function and its users in one fell swoop. Realistically if the AUXADC starts failing inaccurate supply voltage readings are probably the least of your worries, though.
Indeed. Not exactly high priority work. Certainly something to do at a later date if anyone is feeling tidy ;)
Quoted 5 lines
Quoted 3 lines
The rest looks fine to me. Get rid of (or justify) the headers and you have my ack.
I'll prune the headers next time I submit.
Great,
Jonathan
_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors