* [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
@ 2009-07-15 15:29 Mark Brown
2009-07-15 20:09 ` Jean Delvare
` (7 more replies)
0 siblings, 8 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-15 15:29 UTC (permalink / raw)
To: lm-sensors
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 <broonie@opensource.wolfsonmicro.com>
---
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
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index d73f5f4..c5dd718 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 0ae2698..9851f2f 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -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
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
new file mode 100644
index 0000000..3a35e34
--- /dev/null
+++ b/drivers/hwmon/wm8350-hwmon.c
@@ -0,0 +1,155 @@
+/*
+ * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectroncis WM8350 PMIC
+ * hardware monitoring features.
+ *
+ * Copyright (C) 2009 Wolfson Microelectronics plc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License v2 as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/input-polldev.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/timer.h>
+#include <linux/dmi.h>
+#include <linux/mutex.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/comparator.h>
+
+static ssize_t show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "wm8350\n");
+}
+
+static const char *input_names[] = {
+ [WM8350_AUXADC_USB] = "USB" ,
+ [WM8350_AUXADC_LINE] = "Line" ,
+ [WM8350_AUXADC_BATT] = "Battery",
+ [WM8350_AUXADC_TEMP] = "PMIC",
+};
+
+
+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;
+
+ return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t show_label(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int channel = to_sensor_dev_attr(attr)->index;
+
+ return sprintf(buf, "%s\n", input_names[channel]);
+}
+
+#define WM8350_NAMED_VOLTAGE(id, name) \
+ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
+ NULL, WM8350_AUXADC_##name); \
+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
+ NULL, WM8350_AUXADC_##name)
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+
+WM8350_NAMED_VOLTAGE(0, USB);
+WM8350_NAMED_VOLTAGE(1, BATT);
+WM8350_NAMED_VOLTAGE(2, LINE);
+
+static struct attribute *wm8350_attributes[] = {
+ &dev_attr_name.attr,
+
+ &sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in0_label.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in1_label.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in2_label.dev_attr.attr,
+
+ NULL,
+};
+
+static const struct attribute_group wm8350_attr_group = {
+ .attrs = wm8350_attributes,
+};
+
+static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
+ if (ret)
+ goto err;
+
+ wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
+ if (IS_ERR(wm8350->hwmon.classdev)) {
+ ret = PTR_ERR(wm8350->hwmon.classdev);
+ goto err_group;
+ }
+
+ return 0;
+
+err_group:
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+err:
+ return ret;
+}
+
+static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+
+ hwmon_device_unregister(wm8350->hwmon.classdev);
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+
+ return 0;
+}
+
+static struct platform_driver wm8350_hwmon_driver = {
+ .probe = wm8350_hwmon_probe,
+ .remove = __devexit_p(wm8350_hwmon_remove),
+ .driver = {
+ .name = "wm8350-hwmon",
+ },
+};
+
+static int __init wm8350_hwmon_init(void)
+{
+ return platform_driver_register(&wm8350_hwmon_driver);
+}
+module_init(wm8350_hwmon_init);
+
+static void __exit wm8350_hwmon_exit(void)
+{
+ platform_driver_unregister(&wm8350_hwmon_driver);
+}
+module_exit(wm8350_hwmon_exit);
+
+MODULE_AUTHOR("Mark Brown");
+MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:wm8350-hwmon");
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index fe24079..9d662a5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca67..a18f203 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -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;
--
1.6.3.3
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
@ 2009-07-15 20:09 ` Jean Delvare
2009-07-15 20:32 ` Jean Delvare
` (6 subsequent siblings)
7 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-15 20:09 UTC (permalink / raw)
To: lm-sensors
Hi Mark,
On Wed, 15 Jul 2009 16:29:22 +0100, Mark Brown wrote:
> 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 <broonie@opensource.wolfsonmicro.com>
> ---
> 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.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
@ 2009-07-15 20:27 Mark Brown
2009-07-15 20:37 ` Mark Brown
0 siblings, 1 reply; 25+ messages in thread
From: Mark Brown @ 2009-07-15 20:27 UTC (permalink / raw)
To: lm-sensors
On Wed, Jul 15, 2009 at 10:09:37PM +0200, Jean Delvare wrote:
> 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.
Is there someone else I should send hwmon stuff to instead if you don't
normally review this? There is no entry in MAINTAINERS.
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-15 20:09 ` Jean Delvare
@ 2009-07-15 20:32 ` Jean Delvare
2009-07-15 21:30 ` Mark Brown
` (5 subsequent siblings)
7 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-15 20:32 UTC (permalink / raw)
To: lm-sensors
On Wed, 15 Jul 2009 21:27:44 +0100, Mark Brown wrote:
> On Wed, Jul 15, 2009 at 10:09:37PM +0200, Jean Delvare wrote:
>
> > 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.
> 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 ;)
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 20:27 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
@ 2009-07-15 20:37 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-15 20:37 UTC (permalink / raw)
To: lm-sensors
On Wed, Jul 15, 2009 at 10:32:02PM +0200, Jean Delvare wrote:
> On Wed, 15 Jul 2009 21:27:44 +0100, Mark Brown wrote:
> > 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.
In this case (if you find you don't have time after all) Samuel Ortiz
might be a likely victim as MFD maintainer. Thanks, I'll bear that in
mind in future.
> Or you can volunteer to be the new hwmon subsystem maintainer and send
> the patch to Linus yourself ;)
Heh. Sadly the devices I'm working with are nowhere near being able to
get any kind of coverage of the API but nice try :)
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-15 20:09 ` Jean Delvare
2009-07-15 20:32 ` Jean Delvare
@ 2009-07-15 21:30 ` Mark Brown
2009-07-16 11:18 ` Jonathan Cameron
` (4 subsequent siblings)
7 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-15 21:30 UTC (permalink / raw)
To: lm-sensors
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 <broonie@opensource.wolfsonmicro.com>
---
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
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index d73f5f4..c5dd718 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index 0ae2698..9851f2f 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -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
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
new file mode 100644
index 0000000..78f407a
--- /dev/null
+++ b/drivers/hwmon/wm8350-hwmon.c
@@ -0,0 +1,154 @@
+/*
+ * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectroncis WM8350 PMIC
+ * hardware monitoring features.
+ *
+ * Copyright (C) 2009 Wolfson Microelectronics plc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License v2 as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/delay.h>
+#include <linux/platform_device.h>
+#include <linux/input-polldev.h>
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/timer.h>
+#include <linux/dmi.h>
+#include <linux/mutex.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/comparator.h>
+
+static ssize_t show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "wm8350\n");
+}
+
+static const char *input_names[] = {
+ [WM8350_AUXADC_USB] = "USB" ,
+ [WM8350_AUXADC_LINE] = "Line" ,
+ [WM8350_AUXADC_BATT] = "Battery",
+};
+
+
+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;
+
+ return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t show_label(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int channel = to_sensor_dev_attr(attr)->index;
+
+ return sprintf(buf, "%s\n", input_names[channel]);
+}
+
+#define WM8350_NAMED_VOLTAGE(id, name) \
+ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
+ NULL, WM8350_AUXADC_##name); \
+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
+ NULL, WM8350_AUXADC_##name)
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+
+WM8350_NAMED_VOLTAGE(0, USB);
+WM8350_NAMED_VOLTAGE(1, BATT);
+WM8350_NAMED_VOLTAGE(2, LINE);
+
+static struct attribute *wm8350_attributes[] = {
+ &dev_attr_name.attr,
+
+ &sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in0_label.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in1_label.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in2_label.dev_attr.attr,
+
+ NULL,
+};
+
+static const struct attribute_group wm8350_attr_group = {
+ .attrs = wm8350_attributes,
+};
+
+static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
+ if (ret)
+ goto err;
+
+ wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
+ if (IS_ERR(wm8350->hwmon.classdev)) {
+ ret = PTR_ERR(wm8350->hwmon.classdev);
+ goto err_group;
+ }
+
+ return 0;
+
+err_group:
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+err:
+ return ret;
+}
+
+static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+
+ hwmon_device_unregister(wm8350->hwmon.classdev);
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+
+ return 0;
+}
+
+static struct platform_driver wm8350_hwmon_driver = {
+ .probe = wm8350_hwmon_probe,
+ .remove = __devexit_p(wm8350_hwmon_remove),
+ .driver = {
+ .name = "wm8350-hwmon",
+ },
+};
+
+static int __init wm8350_hwmon_init(void)
+{
+ return platform_driver_register(&wm8350_hwmon_driver);
+}
+module_init(wm8350_hwmon_init);
+
+static void __exit wm8350_hwmon_exit(void)
+{
+ platform_driver_unregister(&wm8350_hwmon_driver);
+}
+module_exit(wm8350_hwmon_exit);
+
+MODULE_AUTHOR("Mark Brown");
+MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:wm8350-hwmon");
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index fe24079..9d662a5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca67..969b0b5 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -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;
--
1.6.3.3
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
` (2 preceding siblings ...)
2009-07-15 21:30 ` Mark Brown
@ 2009-07-16 11:18 ` Jonathan Cameron
2009-07-16 11:47 ` Mark Brown
` (3 subsequent siblings)
7 siblings, 0 replies; 25+ messages in thread
From: Jonathan Cameron @ 2009-07-16 11:18 UTC (permalink / raw)
To: lm-sensors
Hi Mark,
Few queries below (all nit picky)
> --- /dev/null
> +++ b/drivers/hwmon/wm8350-hwmon.c
> @@ -0,0 +1,154 @@
...
> +#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.
> +#include <linux/input-polldev.h>
...
> +
> +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!)
> +
> + 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
` (3 preceding siblings ...)
2009-07-16 11:18 ` Jonathan Cameron
@ 2009-07-16 11:47 ` Mark Brown
2009-07-16 14:12 ` Jonathan Cameron
` (2 subsequent siblings)
7 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-16 11:47 UTC (permalink / raw)
To: lm-sensors
On Thu, Jul 16, 2009 at 11:18:02AM +0000, Jonathan Cameron wrote:
> > --- /dev/null
> > +++ b/drivers/hwmon/wm8350-hwmon.c
> > @@ -0,0 +1,154 @@
> ...
> > +#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.
TBH I templated the headers off another driver and never rechecked them
- obviously I've got far too much stuff in there.
> > + 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.
> 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
` (4 preceding siblings ...)
2009-07-16 11:47 ` Mark Brown
@ 2009-07-16 14:12 ` Jonathan Cameron
2009-07-17 20:33 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
2009-07-20 11:43 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
7 siblings, 0 replies; 25+ messages in thread
From: Jonathan Cameron @ 2009-07-16 14:12 UTC (permalink / raw)
To: lm-sensors
Mark Brown wrote:
> On Thu, Jul 16, 2009 at 11:18:02AM +0000, Jonathan Cameron wrote:
>>> --- /dev/null
>>> +++ b/drivers/hwmon/wm8350-hwmon.c
>>> @@ -0,0 +1,154 @@
>> ...
>>> +#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.
>
> TBH I templated the headers off another driver and never rechecked them
> - obviously I've got far too much stuff in there.
>
>>> + 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.
Indeed. Not exactly high priority work. Certainly something to do at a
later date if anyone is feeling tidy ;)
>
>> 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
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
@ 2009-07-17 20:33 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-17 20:33 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: lm-sensors, linux-kernel, Jonathan Cameron, 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 <broonie@opensource.wolfsonmicro.com>
---
drivers/hwmon/Kconfig | 10 +++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/wm8350-hwmon.c | 149 +++++++++++++++++++++++++++++++++++++++
drivers/mfd/wm8350-core.c | 3 +
include/linux/mfd/wm8350/core.h | 6 ++
5 files changed, 169 insertions(+), 0 deletions(-)
create mode 100644 drivers/hwmon/wm8350-hwmon.c
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 2d50166..c94d708 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -920,6 +920,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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index b793dce..c02e90e 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -89,6 +89,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
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
new file mode 100644
index 0000000..7387620
--- /dev/null
+++ b/drivers/hwmon/wm8350-hwmon.c
@@ -0,0 +1,149 @@
+/*
+ * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectroncis WM8350 PMIC
+ * hardware monitoring features.
+ *
+ * Copyright (C) 2009 Wolfson Microelectronics plc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License v2 as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/comparator.h>
+
+static ssize_t show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "wm8350\n");
+}
+
+static const char *input_names[] = {
+ [WM8350_AUXADC_USB] = "USB" ,
+ [WM8350_AUXADC_LINE] = "Line" ,
+ [WM8350_AUXADC_BATT] = "Battery",
+};
+
+
+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;
+
+ return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t show_label(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int channel = to_sensor_dev_attr(attr)->index;
+
+ return sprintf(buf, "%s\n", input_names[channel]);
+}
+
+#define WM8350_NAMED_VOLTAGE(id, name) \
+ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
+ NULL, WM8350_AUXADC_##name); \
+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
+ NULL, WM8350_AUXADC_##name)
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+
+WM8350_NAMED_VOLTAGE(0, USB);
+WM8350_NAMED_VOLTAGE(1, BATT);
+WM8350_NAMED_VOLTAGE(2, LINE);
+
+static struct attribute *wm8350_attributes[] = {
+ &dev_attr_name.attr,
+
+ &sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in0_label.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in1_label.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in2_label.dev_attr.attr,
+
+ NULL,
+};
+
+static const struct attribute_group wm8350_attr_group = {
+ .attrs = wm8350_attributes,
+};
+
+static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
+ if (ret)
+ goto err;
+
+ wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
+ if (IS_ERR(wm8350->hwmon.classdev)) {
+ ret = PTR_ERR(wm8350->hwmon.classdev);
+ goto err_group;
+ }
+
+ return 0;
+
+err_group:
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+err:
+ return ret;
+}
+
+static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+
+ hwmon_device_unregister(wm8350->hwmon.classdev);
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+
+ return 0;
+}
+
+static struct platform_driver wm8350_hwmon_driver = {
+ .probe = wm8350_hwmon_probe,
+ .remove = __devexit_p(wm8350_hwmon_remove),
+ .driver = {
+ .name = "wm8350-hwmon",
+ },
+};
+
+static int __init wm8350_hwmon_init(void)
+{
+ return platform_driver_register(&wm8350_hwmon_driver);
+}
+module_init(wm8350_hwmon_init);
+
+static void __exit wm8350_hwmon_exit(void)
+{
+ platform_driver_unregister(&wm8350_hwmon_driver);
+}
+module_exit(wm8350_hwmon_exit);
+
+MODULE_AUTHOR("Mark Brown");
+MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:wm8350-hwmon");
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index fe24079..9d662a5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca67..969b0b5 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -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;
--
1.6.3.3
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-17 20:33 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-17 20:33 UTC (permalink / raw)
To: Samuel Ortiz; +Cc: lm-sensors, linux-kernel, Jonathan Cameron, 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 <broonie@opensource.wolfsonmicro.com>
---
drivers/hwmon/Kconfig | 10 +++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/wm8350-hwmon.c | 149 +++++++++++++++++++++++++++++++++++++++
drivers/mfd/wm8350-core.c | 3 +
include/linux/mfd/wm8350/core.h | 6 ++
5 files changed, 169 insertions(+), 0 deletions(-)
create mode 100644 drivers/hwmon/wm8350-hwmon.c
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 2d50166..c94d708 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -920,6 +920,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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index b793dce..c02e90e 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -89,6 +89,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
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
new file mode 100644
index 0000000..7387620
--- /dev/null
+++ b/drivers/hwmon/wm8350-hwmon.c
@@ -0,0 +1,149 @@
+/*
+ * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectroncis WM8350 PMIC
+ * hardware monitoring features.
+ *
+ * Copyright (C) 2009 Wolfson Microelectronics plc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License v2 as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/comparator.h>
+
+static ssize_t show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "wm8350\n");
+}
+
+static const char *input_names[] = {
+ [WM8350_AUXADC_USB] = "USB" ,
+ [WM8350_AUXADC_LINE] = "Line" ,
+ [WM8350_AUXADC_BATT] = "Battery",
+};
+
+
+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;
+
+ return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t show_label(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int channel = to_sensor_dev_attr(attr)->index;
+
+ return sprintf(buf, "%s\n", input_names[channel]);
+}
+
+#define WM8350_NAMED_VOLTAGE(id, name) \
+ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
+ NULL, WM8350_AUXADC_##name); \
+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
+ NULL, WM8350_AUXADC_##name)
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+
+WM8350_NAMED_VOLTAGE(0, USB);
+WM8350_NAMED_VOLTAGE(1, BATT);
+WM8350_NAMED_VOLTAGE(2, LINE);
+
+static struct attribute *wm8350_attributes[] = {
+ &dev_attr_name.attr,
+
+ &sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in0_label.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in1_label.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in2_label.dev_attr.attr,
+
+ NULL,
+};
+
+static const struct attribute_group wm8350_attr_group = {
+ .attrs = wm8350_attributes,
+};
+
+static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
+ if (ret)
+ goto err;
+
+ wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
+ if (IS_ERR(wm8350->hwmon.classdev)) {
+ ret = PTR_ERR(wm8350->hwmon.classdev);
+ goto err_group;
+ }
+
+ return 0;
+
+err_group:
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+err:
+ return ret;
+}
+
+static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+
+ hwmon_device_unregister(wm8350->hwmon.classdev);
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+
+ return 0;
+}
+
+static struct platform_driver wm8350_hwmon_driver = {
+ .probe = wm8350_hwmon_probe,
+ .remove = __devexit_p(wm8350_hwmon_remove),
+ .driver = {
+ .name = "wm8350-hwmon",
+ },
+};
+
+static int __init wm8350_hwmon_init(void)
+{
+ return platform_driver_register(&wm8350_hwmon_driver);
+}
+module_init(wm8350_hwmon_init);
+
+static void __exit wm8350_hwmon_exit(void)
+{
+ platform_driver_unregister(&wm8350_hwmon_driver);
+}
+module_exit(wm8350_hwmon_exit);
+
+MODULE_AUTHOR("Mark Brown");
+MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:wm8350-hwmon");
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index fe24079..9d662a5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca67..969b0b5 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -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;
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-17 20:33 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
@ 2009-07-18 9:17 ` Jean Delvare
-1 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-18 9:17 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
Hi Mark,
Sorry for the delay. Thanks Jonathan for the 1st review!
On Fri, 17 Jul 2009 21:33:15 +0100, Mark Brown wrote:
> 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 <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/hwmon/Kconfig | 10 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/wm8350-hwmon.c | 149 +++++++++++++++++++++++++++++++++++++++
> drivers/mfd/wm8350-core.c | 3 +
> include/linux/mfd/wm8350/core.h | 6 ++
> 5 files changed, 169 insertions(+), 0 deletions(-)
> create mode 100644 drivers/hwmon/wm8350-hwmon.c
Overall it looks very good and I really don't have much to say. Only
minor things, see below.
>
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 2d50166..c94d708 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -920,6 +920,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
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index b793dce..c02e90e 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -89,6 +89,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
> diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
> new file mode 100644
> index 0000000..7387620
> --- /dev/null
> +++ b/drivers/hwmon/wm8350-hwmon.c
> @@ -0,0 +1,149 @@
> +/*
> + * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectroncis WM8350 PMIC
Typo: Microelectronics.
> + * hardware monitoring features.
> + *
> + * Copyright (C) 2009 Wolfson Microelectronics plc
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License v2 as published by the
> + * Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/hwmon.h>
> +#include <linux/hwmon-sysfs.h>
> +
> +#include <linux/mfd/wm8350/core.h>
> +#include <linux/mfd/wm8350/comparator.h>
> +
> +static ssize_t show_name(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "wm8350\n");
> +}
> +
> +static const char *input_names[] = {
> + [WM8350_AUXADC_USB] = "USB" ,
> + [WM8350_AUXADC_LINE] = "Line" ,
Coding-style: extra spaces before commas.
> + [WM8350_AUXADC_BATT] = "Battery",
> +};
> +
> +
> +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;
You may obtain more accurate values with DIV_ROUND_CLOSEST().
> +
> + return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t show_label(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + int channel = to_sensor_dev_attr(attr)->index;
> +
> + return sprintf(buf, "%s\n", input_names[channel]);
> +}
> +
> +#define WM8350_NAMED_VOLTAGE(id, name) \
> + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
> + NULL, WM8350_AUXADC_##name); \
> + static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
> + NULL, WM8350_AUXADC_##name)
> +
> +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
> +
> +WM8350_NAMED_VOLTAGE(0, USB);
> +WM8350_NAMED_VOLTAGE(1, BATT);
> +WM8350_NAMED_VOLTAGE(2, LINE);
I would suggest passing the whole WM8350_AUXADC_USB, etc. string as the
2nd parameter. This makes grepping the source code for users (as LXR
does for example) possible.
> +
> +static struct attribute *wm8350_attributes[] = {
> + &dev_attr_name.attr,
> +
> + &sensor_dev_attr_in0_input.dev_attr.attr,
> + &sensor_dev_attr_in0_label.dev_attr.attr,
> + &sensor_dev_attr_in1_input.dev_attr.attr,
> + &sensor_dev_attr_in1_label.dev_attr.attr,
> + &sensor_dev_attr_in2_input.dev_attr.attr,
> + &sensor_dev_attr_in2_label.dev_attr.attr,
> +
> + NULL,
> +};
> +
> +static const struct attribute_group wm8350_attr_group = {
> + .attrs = wm8350_attributes,
> +};
> +
> +static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> + int ret;
> +
> + ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
> + if (ret)
> + goto err;
> +
> + wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
> + if (IS_ERR(wm8350->hwmon.classdev)) {
> + ret = PTR_ERR(wm8350->hwmon.classdev);
> + goto err_group;
> + }
> +
> + return 0;
> +
> +err_group:
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +err:
> + return ret;
> +}
> +
> +static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> +
> + hwmon_device_unregister(wm8350->hwmon.classdev);
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +
> + return 0;
> +}
> +
> +static struct platform_driver wm8350_hwmon_driver = {
> + .probe = wm8350_hwmon_probe,
> + .remove = __devexit_p(wm8350_hwmon_remove),
> + .driver = {
> + .name = "wm8350-hwmon",
I think you are supposed to set .owner to THIS_MODULE?
> + },
> +};
> +
> +static int __init wm8350_hwmon_init(void)
> +{
> + return platform_driver_register(&wm8350_hwmon_driver);
> +}
> +module_init(wm8350_hwmon_init);
> +
> +static void __exit wm8350_hwmon_exit(void)
> +{
> + platform_driver_unregister(&wm8350_hwmon_driver);
> +}
> +module_exit(wm8350_hwmon_exit);
> +
> +MODULE_AUTHOR("Mark Brown");
No e-mail address?
> +MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:wm8350-hwmon");
> diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
> index fe24079..9d662a5 100644
> --- a/drivers/mfd/wm8350-core.c
> +++ b/drivers/mfd/wm8350-core.c
> @@ -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);
>
> diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
> index 42cca67..969b0b5 100644
> --- a/include/linux/mfd/wm8350/core.h
> +++ b/include/linux/mfd/wm8350/core.h
> @@ -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;
Bonus points if you also add a short text file at
Documentation/hwmon/wm8350-hwmon, using the same format as the other
files there, shortly explaining what hardware the driver is for, what
it is capable of (e.g. measurement resolution, accuracy and range) and,
if applicable, its limitations.
When you are done, what is your merge plan? I would be happy to take
the patch in my unofficial hwmon tree and push it in 2.6.32, but due to
wm8350-core dependencies, you may prefer it to be merged differently?
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-18 9:17 ` Jean Delvare
0 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-18 9:17 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
Hi Mark,
Sorry for the delay. Thanks Jonathan for the 1st review!
On Fri, 17 Jul 2009 21:33:15 +0100, Mark Brown wrote:
> 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 <broonie@opensource.wolfsonmicro.com>
> ---
> drivers/hwmon/Kconfig | 10 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/wm8350-hwmon.c | 149 +++++++++++++++++++++++++++++++++++++++
> drivers/mfd/wm8350-core.c | 3 +
> include/linux/mfd/wm8350/core.h | 6 ++
> 5 files changed, 169 insertions(+), 0 deletions(-)
> create mode 100644 drivers/hwmon/wm8350-hwmon.c
Overall it looks very good and I really don't have much to say. Only
minor things, see below.
>
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 2d50166..c94d708 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -920,6 +920,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
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index b793dce..c02e90e 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -89,6 +89,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
> diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
> new file mode 100644
> index 0000000..7387620
> --- /dev/null
> +++ b/drivers/hwmon/wm8350-hwmon.c
> @@ -0,0 +1,149 @@
> +/*
> + * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectroncis WM8350 PMIC
Typo: Microelectronics.
> + * hardware monitoring features.
> + *
> + * Copyright (C) 2009 Wolfson Microelectronics plc
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License v2 as published by the
> + * Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/hwmon.h>
> +#include <linux/hwmon-sysfs.h>
> +
> +#include <linux/mfd/wm8350/core.h>
> +#include <linux/mfd/wm8350/comparator.h>
> +
> +static ssize_t show_name(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "wm8350\n");
> +}
> +
> +static const char *input_names[] = {
> + [WM8350_AUXADC_USB] = "USB" ,
> + [WM8350_AUXADC_LINE] = "Line" ,
Coding-style: extra spaces before commas.
> + [WM8350_AUXADC_BATT] = "Battery",
> +};
> +
> +
> +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;
You may obtain more accurate values with DIV_ROUND_CLOSEST().
> +
> + return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t show_label(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + int channel = to_sensor_dev_attr(attr)->index;
> +
> + return sprintf(buf, "%s\n", input_names[channel]);
> +}
> +
> +#define WM8350_NAMED_VOLTAGE(id, name) \
> + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
> + NULL, WM8350_AUXADC_##name); \
> + static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
> + NULL, WM8350_AUXADC_##name)
> +
> +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
> +
> +WM8350_NAMED_VOLTAGE(0, USB);
> +WM8350_NAMED_VOLTAGE(1, BATT);
> +WM8350_NAMED_VOLTAGE(2, LINE);
I would suggest passing the whole WM8350_AUXADC_USB, etc. string as the
2nd parameter. This makes grepping the source code for users (as LXR
does for example) possible.
> +
> +static struct attribute *wm8350_attributes[] = {
> + &dev_attr_name.attr,
> +
> + &sensor_dev_attr_in0_input.dev_attr.attr,
> + &sensor_dev_attr_in0_label.dev_attr.attr,
> + &sensor_dev_attr_in1_input.dev_attr.attr,
> + &sensor_dev_attr_in1_label.dev_attr.attr,
> + &sensor_dev_attr_in2_input.dev_attr.attr,
> + &sensor_dev_attr_in2_label.dev_attr.attr,
> +
> + NULL,
> +};
> +
> +static const struct attribute_group wm8350_attr_group = {
> + .attrs = wm8350_attributes,
> +};
> +
> +static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> + int ret;
> +
> + ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
> + if (ret)
> + goto err;
> +
> + wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
> + if (IS_ERR(wm8350->hwmon.classdev)) {
> + ret = PTR_ERR(wm8350->hwmon.classdev);
> + goto err_group;
> + }
> +
> + return 0;
> +
> +err_group:
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +err:
> + return ret;
> +}
> +
> +static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> +
> + hwmon_device_unregister(wm8350->hwmon.classdev);
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +
> + return 0;
> +}
> +
> +static struct platform_driver wm8350_hwmon_driver = {
> + .probe = wm8350_hwmon_probe,
> + .remove = __devexit_p(wm8350_hwmon_remove),
> + .driver = {
> + .name = "wm8350-hwmon",
I think you are supposed to set .owner to THIS_MODULE?
> + },
> +};
> +
> +static int __init wm8350_hwmon_init(void)
> +{
> + return platform_driver_register(&wm8350_hwmon_driver);
> +}
> +module_init(wm8350_hwmon_init);
> +
> +static void __exit wm8350_hwmon_exit(void)
> +{
> + platform_driver_unregister(&wm8350_hwmon_driver);
> +}
> +module_exit(wm8350_hwmon_exit);
> +
> +MODULE_AUTHOR("Mark Brown");
No e-mail address?
> +MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:wm8350-hwmon");
> diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
> index fe24079..9d662a5 100644
> --- a/drivers/mfd/wm8350-core.c
> +++ b/drivers/mfd/wm8350-core.c
> @@ -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);
>
> diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
> index 42cca67..969b0b5 100644
> --- a/include/linux/mfd/wm8350/core.h
> +++ b/include/linux/mfd/wm8350/core.h
> @@ -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;
Bonus points if you also add a short text file at
Documentation/hwmon/wm8350-hwmon, using the same format as the other
files there, shortly explaining what hardware the driver is for, what
it is capable of (e.g. measurement resolution, accuracy and range) and,
if applicable, its limitations.
When you are done, what is your merge plan? I would be happy to take
the patch in my unofficial hwmon tree and push it in 2.6.32, but due to
wm8350-core dependencies, you may prefer it to be merged differently?
--
Jean Delvare
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-18 9:17 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Jean Delvare
@ 2009-07-18 9:59 ` Mark Brown
-1 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-18 9:59 UTC (permalink / raw)
To: Jean Delvare; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
On Sat, Jul 18, 2009 at 11:17:12AM +0200, Jean Delvare wrote:
> > +WM8350_NAMED_VOLTAGE(0, USB);
> > +WM8350_NAMED_VOLTAGE(1, BATT);
> > +WM8350_NAMED_VOLTAGE(2, LINE);
> I would suggest passing the whole WM8350_AUXADC_USB, etc. string as the
> 2nd parameter. This makes grepping the source code for users (as LXR
> does for example) possible.
The reason it's formatted like that is that the AUXADC input names match
the names of the supplies that are being monitored so the second parameter
is also used to provide a label to userspace.
> > +static struct platform_driver wm8350_hwmon_driver = {
> > + .probe = wm8350_hwmon_probe,
> > + .remove = __devexit_p(wm8350_hwmon_remove),
> > + .driver = {
> > + .name = "wm8350-hwmon",
> I think you are supposed to set .owner to THIS_MODULE?
Hrm, yeah. I need to figure out where I cut'n'pasted this from since I
suspect the error came along with that.
> When you are done, what is your merge plan? I would be happy to take
> the patch in my unofficial hwmon tree and push it in 2.6.32, but due to
> wm8350-core dependencies, you may prefer it to be merged differently?
I'm happy to go with whatever is easiest for the people actually doing
the merging. wm8350 is fairly static at the minute - it's much more
likely that there would be merge issues from the build infrastructure.
It might be a little easier to merge via mfd.
I'll fix the rest of your comments, thanks.
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-18 9:59 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-18 9:59 UTC (permalink / raw)
To: Jean Delvare; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
On Sat, Jul 18, 2009 at 11:17:12AM +0200, Jean Delvare wrote:
> > +WM8350_NAMED_VOLTAGE(0, USB);
> > +WM8350_NAMED_VOLTAGE(1, BATT);
> > +WM8350_NAMED_VOLTAGE(2, LINE);
> I would suggest passing the whole WM8350_AUXADC_USB, etc. string as the
> 2nd parameter. This makes grepping the source code for users (as LXR
> does for example) possible.
The reason it's formatted like that is that the AUXADC input names match
the names of the supplies that are being monitored so the second parameter
is also used to provide a label to userspace.
> > +static struct platform_driver wm8350_hwmon_driver = {
> > + .probe = wm8350_hwmon_probe,
> > + .remove = __devexit_p(wm8350_hwmon_remove),
> > + .driver = {
> > + .name = "wm8350-hwmon",
> I think you are supposed to set .owner to THIS_MODULE?
Hrm, yeah. I need to figure out where I cut'n'pasted this from since I
suspect the error came along with that.
> When you are done, what is your merge plan? I would be happy to take
> the patch in my unofficial hwmon tree and push it in 2.6.32, but due to
> wm8350-core dependencies, you may prefer it to be merged differently?
I'm happy to go with whatever is easiest for the people actually doing
the merging. wm8350 is fairly static at the minute - it's much more
likely that there would be merge issues from the build infrastructure.
It might be a little easier to merge via mfd.
I'll fix the rest of your comments, thanks.
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-18 9:59 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
@ 2009-07-18 10:39 ` Jean Delvare
-1 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-18 10:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
On Sat, 18 Jul 2009 10:59:17 +0100, Mark Brown wrote:
> On Sat, Jul 18, 2009 at 11:17:12AM +0200, Jean Delvare wrote:
>
> > > +WM8350_NAMED_VOLTAGE(0, USB);
> > > +WM8350_NAMED_VOLTAGE(1, BATT);
> > > +WM8350_NAMED_VOLTAGE(2, LINE);
>
> > I would suggest passing the whole WM8350_AUXADC_USB, etc. string as the
> > 2nd parameter. This makes grepping the source code for users (as LXR
> > does for example) possible.
>
> The reason it's formatted like that is that the AUXADC input names match
> the names of the supplies that are being monitored so the second parameter
> is also used to provide a label to userspace.
This isn't how I read the code. I see a look-up table for labels, so the
macro implementation is just a detail which shouldn't matter.
> > > +static struct platform_driver wm8350_hwmon_driver = {
> > > + .probe = wm8350_hwmon_probe,
> > > + .remove = __devexit_p(wm8350_hwmon_remove),
> > > + .driver = {
> > > + .name = "wm8350-hwmon",
>
> > I think you are supposed to set .owner to THIS_MODULE?
>
> Hrm, yeah. I need to figure out where I cut'n'pasted this from since I
> suspect the error came along with that.
Maybe from an i2c driver, where the owner is set at run-time. Back when
this was implemented, I did object that it would cause confusion
because it would make different subsystems have different
requirements... Looks like I was right.
> > When you are done, what is your merge plan? I would be happy to take
> > the patch in my unofficial hwmon tree and push it in 2.6.32, but due to
> > wm8350-core dependencies, you may prefer it to be merged differently?
>
> I'm happy to go with whatever is easiest for the people actually doing
> the merging. wm8350 is fairly static at the minute - it's much more
> likely that there would be merge issues from the build infrastructure.
> It might be a little easier to merge via mfd.
Fine with me.
> I'll fix the rest of your comments, thanks.
OK.
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-18 10:39 ` Jean Delvare
0 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-18 10:39 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
On Sat, 18 Jul 2009 10:59:17 +0100, Mark Brown wrote:
> On Sat, Jul 18, 2009 at 11:17:12AM +0200, Jean Delvare wrote:
>
> > > +WM8350_NAMED_VOLTAGE(0, USB);
> > > +WM8350_NAMED_VOLTAGE(1, BATT);
> > > +WM8350_NAMED_VOLTAGE(2, LINE);
>
> > I would suggest passing the whole WM8350_AUXADC_USB, etc. string as the
> > 2nd parameter. This makes grepping the source code for users (as LXR
> > does for example) possible.
>
> The reason it's formatted like that is that the AUXADC input names match
> the names of the supplies that are being monitored so the second parameter
> is also used to provide a label to userspace.
This isn't how I read the code. I see a look-up table for labels, so the
macro implementation is just a detail which shouldn't matter.
> > > +static struct platform_driver wm8350_hwmon_driver = {
> > > + .probe = wm8350_hwmon_probe,
> > > + .remove = __devexit_p(wm8350_hwmon_remove),
> > > + .driver = {
> > > + .name = "wm8350-hwmon",
>
> > I think you are supposed to set .owner to THIS_MODULE?
>
> Hrm, yeah. I need to figure out where I cut'n'pasted this from since I
> suspect the error came along with that.
Maybe from an i2c driver, where the owner is set at run-time. Back when
this was implemented, I did object that it would cause confusion
because it would make different subsystems have different
requirements... Looks like I was right.
> > When you are done, what is your merge plan? I would be happy to take
> > the patch in my unofficial hwmon tree and push it in 2.6.32, but due to
> > wm8350-core dependencies, you may prefer it to be merged differently?
>
> I'm happy to go with whatever is easiest for the people actually doing
> the merging. wm8350 is fairly static at the minute - it's much more
> likely that there would be merge issues from the build infrastructure.
> It might be a little easier to merge via mfd.
Fine with me.
> I'll fix the rest of your comments, thanks.
OK.
--
Jean Delvare
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-18 10:39 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Jean Delvare
@ 2009-07-18 10:47 ` Mark Brown
-1 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-18 10:47 UTC (permalink / raw)
To: Jean Delvare; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
On Sat, Jul 18, 2009 at 12:39:51PM +0200, Jean Delvare wrote:
> On Sat, 18 Jul 2009 10:59:17 +0100, Mark Brown wrote:
> > The reason it's formatted like that is that the AUXADC input names match
> > the names of the supplies that are being monitored so the second parameter
> > is also used to provide a label to userspace.
> This isn't how I read the code. I see a look-up table for labels, so the
> macro implementation is just a detail which shouldn't matter.
Oh, yes, you're right. Originally I'd implemented it the way I describe
but changed the code later - I'd forgotten that I'd done so when
replying to your mail.
I'll send a revised version out on Monday.
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-18 10:47 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-18 10:47 UTC (permalink / raw)
To: Jean Delvare; +Cc: Samuel Ortiz, Jonathan Cameron, linux-kernel, lm-sensors
On Sat, Jul 18, 2009 at 12:39:51PM +0200, Jean Delvare wrote:
> On Sat, 18 Jul 2009 10:59:17 +0100, Mark Brown wrote:
> > The reason it's formatted like that is that the AUXADC input names match
> > the names of the supplies that are being monitored so the second parameter
> > is also used to provide a label to userspace.
> This isn't how I read the code. I see a look-up table for labels, so the
> macro implementation is just a detail which shouldn't matter.
Oh, yes, you're right. Originally I'd implemented it the way I describe
but changed the code later - I'd forgotten that I'd done so when
replying to your mail.
I'll send a revised version out on Monday.
^ permalink raw reply [flat|nested] 25+ messages in thread
* [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
@ 2009-07-20 11:43 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-20 11:43 UTC (permalink / raw)
To: Samuel Ortiz
Cc: Jean Delvare, lm-sensors, linux-kernel, Jonathan Cameron,
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 <broonie@opensource.wolfsonmicro.com>
---
This should address all the issues Jean raised:
- Add a brief document to the hwmon directory.
- Use full constant names as arguments for template macro.
- Use DIV_ROUND_CLOSEST()
- Set driver owner.
- Fix typos.
Thanks to Jonathan and Jean for their reviews.
Documentation/hwmon/wm8350 | 26 +++++++
drivers/hwmon/Kconfig | 10 +++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++
drivers/mfd/wm8350-core.c | 3 +
include/linux/mfd/wm8350/core.h | 6 ++
6 files changed, 197 insertions(+), 0 deletions(-)
create mode 100644 Documentation/hwmon/wm8350
create mode 100644 drivers/hwmon/wm8350-hwmon.c
diff --git a/Documentation/hwmon/wm8350 b/Documentation/hwmon/wm8350
new file mode 100644
index 0000000..98f923b
--- /dev/null
+++ b/Documentation/hwmon/wm8350
@@ -0,0 +1,26 @@
+Kernel driver wm8350-hwmon
+=============
+
+Supported chips:
+ * Wolfson Microelectronics WM835x PMICs
+ Prefix: 'wm8350'
+ Datasheet:
+ http://www.wolfsonmicro.com/products/WM8350
+ http://www.wolfsonmicro.com/products/WM8351
+ http://www.wolfsonmicro.com/products/WM8352
+
+Authors: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+Description
+-----------
+
+The WM835x series of PMICs include an AUXADC which can be used to
+monitor a range of system operating parameters, including the voltages
+of the major supplies within the system. Currently the driver provides
+simple access to these major supplies.
+
+Voltage Monitoring
+------------------
+
+Voltages are sampled by a 12 bit ADC. For the internal supplies the ADC
+is referenced to the system VRTC.
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 2d50166..c94d708 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -920,6 +920,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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index b793dce..c02e90e 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -89,6 +89,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
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
new file mode 100644
index 0000000..1329059
--- /dev/null
+++ b/drivers/hwmon/wm8350-hwmon.c
@@ -0,0 +1,151 @@
+/*
+ * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectronics WM8350 PMIC
+ * hardware monitoring features.
+ *
+ * Copyright (C) 2009 Wolfson Microelectronics plc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License v2 as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/comparator.h>
+
+static ssize_t show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "wm8350\n");
+}
+
+static const char *input_names[] = {
+ [WM8350_AUXADC_USB] = "USB",
+ [WM8350_AUXADC_LINE] = "Line",
+ [WM8350_AUXADC_BATT] = "Battery",
+};
+
+
+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;
+ val = DIV_ROUND_CLOSEST(val, 1000);
+
+ return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t show_label(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int channel = to_sensor_dev_attr(attr)->index;
+
+ return sprintf(buf, "%s\n", input_names[channel]);
+}
+
+#define WM8350_NAMED_VOLTAGE(id, name) \
+ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
+ NULL, name); \
+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
+ NULL, name)
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+
+WM8350_NAMED_VOLTAGE(0, WM8350_AUXADC_USB);
+WM8350_NAMED_VOLTAGE(1, WM8350_AUXADC_BATT);
+WM8350_NAMED_VOLTAGE(2, WM8350_AUXADC_LINE);
+
+static struct attribute *wm8350_attributes[] = {
+ &dev_attr_name.attr,
+
+ &sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in0_label.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in1_label.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in2_label.dev_attr.attr,
+
+ NULL,
+};
+
+static const struct attribute_group wm8350_attr_group = {
+ .attrs = wm8350_attributes,
+};
+
+static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
+ if (ret)
+ goto err;
+
+ wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
+ if (IS_ERR(wm8350->hwmon.classdev)) {
+ ret = PTR_ERR(wm8350->hwmon.classdev);
+ goto err_group;
+ }
+
+ return 0;
+
+err_group:
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+err:
+ return ret;
+}
+
+static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+
+ hwmon_device_unregister(wm8350->hwmon.classdev);
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+
+ return 0;
+}
+
+static struct platform_driver wm8350_hwmon_driver = {
+ .probe = wm8350_hwmon_probe,
+ .remove = __devexit_p(wm8350_hwmon_remove),
+ .driver = {
+ .name = "wm8350-hwmon",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init wm8350_hwmon_init(void)
+{
+ return platform_driver_register(&wm8350_hwmon_driver);
+}
+module_init(wm8350_hwmon_init);
+
+static void __exit wm8350_hwmon_exit(void)
+{
+ platform_driver_unregister(&wm8350_hwmon_driver);
+}
+module_exit(wm8350_hwmon_exit);
+
+MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
+MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:wm8350-hwmon");
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index fe24079..9d662a5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca67..969b0b5 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -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;
--
1.6.3.3
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply related [flat|nested] 25+ messages in thread
* [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-20 11:43 ` Mark Brown
0 siblings, 0 replies; 25+ messages in thread
From: Mark Brown @ 2009-07-20 11:43 UTC (permalink / raw)
To: Samuel Ortiz
Cc: Jean Delvare, lm-sensors, linux-kernel, Jonathan Cameron,
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 <broonie@opensource.wolfsonmicro.com>
---
This should address all the issues Jean raised:
- Add a brief document to the hwmon directory.
- Use full constant names as arguments for template macro.
- Use DIV_ROUND_CLOSEST()
- Set driver owner.
- Fix typos.
Thanks to Jonathan and Jean for their reviews.
Documentation/hwmon/wm8350 | 26 +++++++
drivers/hwmon/Kconfig | 10 +++
drivers/hwmon/Makefile | 1 +
drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++
drivers/mfd/wm8350-core.c | 3 +
include/linux/mfd/wm8350/core.h | 6 ++
6 files changed, 197 insertions(+), 0 deletions(-)
create mode 100644 Documentation/hwmon/wm8350
create mode 100644 drivers/hwmon/wm8350-hwmon.c
diff --git a/Documentation/hwmon/wm8350 b/Documentation/hwmon/wm8350
new file mode 100644
index 0000000..98f923b
--- /dev/null
+++ b/Documentation/hwmon/wm8350
@@ -0,0 +1,26 @@
+Kernel driver wm8350-hwmon
+==========================
+
+Supported chips:
+ * Wolfson Microelectronics WM835x PMICs
+ Prefix: 'wm8350'
+ Datasheet:
+ http://www.wolfsonmicro.com/products/WM8350
+ http://www.wolfsonmicro.com/products/WM8351
+ http://www.wolfsonmicro.com/products/WM8352
+
+Authors: Mark Brown <broonie@opensource.wolfsonmicro.com>
+
+Description
+-----------
+
+The WM835x series of PMICs include an AUXADC which can be used to
+monitor a range of system operating parameters, including the voltages
+of the major supplies within the system. Currently the driver provides
+simple access to these major supplies.
+
+Voltage Monitoring
+------------------
+
+Voltages are sampled by a 12 bit ADC. For the internal supplies the ADC
+is referenced to the system VRTC.
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index 2d50166..c94d708 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -920,6 +920,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
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index b793dce..c02e90e 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -89,6 +89,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
diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
new file mode 100644
index 0000000..1329059
--- /dev/null
+++ b/drivers/hwmon/wm8350-hwmon.c
@@ -0,0 +1,151 @@
+/*
+ * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectronics WM8350 PMIC
+ * hardware monitoring features.
+ *
+ * Copyright (C) 2009 Wolfson Microelectronics plc
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License v2 as published by the
+ * Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+
+#include <linux/mfd/wm8350/core.h>
+#include <linux/mfd/wm8350/comparator.h>
+
+static ssize_t show_name(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ return sprintf(buf, "wm8350\n");
+}
+
+static const char *input_names[] = {
+ [WM8350_AUXADC_USB] = "USB",
+ [WM8350_AUXADC_LINE] = "Line",
+ [WM8350_AUXADC_BATT] = "Battery",
+};
+
+
+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;
+ val = DIV_ROUND_CLOSEST(val, 1000);
+
+ return sprintf(buf, "%d\n", val);
+}
+
+static ssize_t show_label(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ int channel = to_sensor_dev_attr(attr)->index;
+
+ return sprintf(buf, "%s\n", input_names[channel]);
+}
+
+#define WM8350_NAMED_VOLTAGE(id, name) \
+ static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
+ NULL, name); \
+ static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
+ NULL, name)
+
+static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
+
+WM8350_NAMED_VOLTAGE(0, WM8350_AUXADC_USB);
+WM8350_NAMED_VOLTAGE(1, WM8350_AUXADC_BATT);
+WM8350_NAMED_VOLTAGE(2, WM8350_AUXADC_LINE);
+
+static struct attribute *wm8350_attributes[] = {
+ &dev_attr_name.attr,
+
+ &sensor_dev_attr_in0_input.dev_attr.attr,
+ &sensor_dev_attr_in0_label.dev_attr.attr,
+ &sensor_dev_attr_in1_input.dev_attr.attr,
+ &sensor_dev_attr_in1_label.dev_attr.attr,
+ &sensor_dev_attr_in2_input.dev_attr.attr,
+ &sensor_dev_attr_in2_label.dev_attr.attr,
+
+ NULL,
+};
+
+static const struct attribute_group wm8350_attr_group = {
+ .attrs = wm8350_attributes,
+};
+
+static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+ int ret;
+
+ ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
+ if (ret)
+ goto err;
+
+ wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
+ if (IS_ERR(wm8350->hwmon.classdev)) {
+ ret = PTR_ERR(wm8350->hwmon.classdev);
+ goto err_group;
+ }
+
+ return 0;
+
+err_group:
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+err:
+ return ret;
+}
+
+static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
+{
+ struct wm8350 *wm8350 = platform_get_drvdata(pdev);
+
+ hwmon_device_unregister(wm8350->hwmon.classdev);
+ sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
+
+ return 0;
+}
+
+static struct platform_driver wm8350_hwmon_driver = {
+ .probe = wm8350_hwmon_probe,
+ .remove = __devexit_p(wm8350_hwmon_remove),
+ .driver = {
+ .name = "wm8350-hwmon",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init wm8350_hwmon_init(void)
+{
+ return platform_driver_register(&wm8350_hwmon_driver);
+}
+module_init(wm8350_hwmon_init);
+
+static void __exit wm8350_hwmon_exit(void)
+{
+ platform_driver_unregister(&wm8350_hwmon_driver);
+}
+module_exit(wm8350_hwmon_exit);
+
+MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
+MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:wm8350-hwmon");
diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
index fe24079..9d662a5 100644
--- a/drivers/mfd/wm8350-core.c
+++ b/drivers/mfd/wm8350-core.c
@@ -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);
diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
index 42cca67..969b0b5 100644
--- a/include/linux/mfd/wm8350/core.h
+++ b/include/linux/mfd/wm8350/core.h
@@ -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;
--
1.6.3.3
^ permalink raw reply related [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-20 11:43 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
@ 2009-07-20 13:19 ` Jean Delvare
-1 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-20 13:19 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, lm-sensors, linux-kernel, Jonathan Cameron
On Mon, 20 Jul 2009 12:43:45 +0100, Mark Brown wrote:
> 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 <broonie@opensource.wolfsonmicro.com>
> ---
>
> This should address all the issues Jean raised:
> - Add a brief document to the hwmon directory.
> - Use full constant names as arguments for template macro.
> - Use DIV_ROUND_CLOSEST()
> - Set driver owner.
> - Fix typos.
>
> Thanks to Jonathan and Jean for their reviews.
>
> Documentation/hwmon/wm8350 | 26 +++++++
> drivers/hwmon/Kconfig | 10 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++
> drivers/mfd/wm8350-core.c | 3 +
> include/linux/mfd/wm8350/core.h | 6 ++
> 6 files changed, 197 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/hwmon/wm8350
> create mode 100644 drivers/hwmon/wm8350-hwmon.c
Good work.
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-07-20 13:19 ` Jean Delvare
0 siblings, 0 replies; 25+ messages in thread
From: Jean Delvare @ 2009-07-20 13:19 UTC (permalink / raw)
To: Mark Brown; +Cc: Samuel Ortiz, lm-sensors, linux-kernel, Jonathan Cameron
On Mon, 20 Jul 2009 12:43:45 +0100, Mark Brown wrote:
> 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 <broonie@opensource.wolfsonmicro.com>
> ---
>
> This should address all the issues Jean raised:
> - Add a brief document to the hwmon directory.
> - Use full constant names as arguments for template macro.
> - Use DIV_ROUND_CLOSEST()
> - Set driver owner.
> - Fix typos.
>
> Thanks to Jonathan and Jean for their reviews.
>
> Documentation/hwmon/wm8350 | 26 +++++++
> drivers/hwmon/Kconfig | 10 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++
> drivers/mfd/wm8350-core.c | 3 +
> include/linux/mfd/wm8350/core.h | 6 ++
> 6 files changed, 197 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/hwmon/wm8350
> create mode 100644 drivers/hwmon/wm8350-hwmon.c
Good work.
Acked-by: Jean Delvare <khali@linux-fr.org>
--
Jean Delvare
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring
2009-07-20 11:43 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
@ 2009-08-03 16:40 ` Samuel Ortiz
-1 siblings, 0 replies; 25+ messages in thread
From: Samuel Ortiz @ 2009-08-03 16:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Jean Delvare, lm-sensors, linux-kernel, Jonathan Cameron
Hi Mark,
On Mon, Jul 20, 2009 at 12:43:45PM +0100, Mark Brown wrote:
> This driver provides reporting of the status supply voltage rails
> of the WM835x series of PMICs via the hwmon API.
Applied to my for-next branch, thanks.
Cheers,
Samuel.
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>
> This should address all the issues Jean raised:
> - Add a brief document to the hwmon directory.
> - Use full constant names as arguments for template macro.
> - Use DIV_ROUND_CLOSEST()
> - Set driver owner.
> - Fix typos.
>
> Thanks to Jonathan and Jean for their reviews.
>
> Documentation/hwmon/wm8350 | 26 +++++++
> drivers/hwmon/Kconfig | 10 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++
> drivers/mfd/wm8350-core.c | 3 +
> include/linux/mfd/wm8350/core.h | 6 ++
> 6 files changed, 197 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/hwmon/wm8350
> create mode 100644 drivers/hwmon/wm8350-hwmon.c
>
> diff --git a/Documentation/hwmon/wm8350 b/Documentation/hwmon/wm8350
> new file mode 100644
> index 0000000..98f923b
> --- /dev/null
> +++ b/Documentation/hwmon/wm8350
> @@ -0,0 +1,26 @@
> +Kernel driver wm8350-hwmon
> +=============
> +
> +Supported chips:
> + * Wolfson Microelectronics WM835x PMICs
> + Prefix: 'wm8350'
> + Datasheet:
> + http://www.wolfsonmicro.com/products/WM8350
> + http://www.wolfsonmicro.com/products/WM8351
> + http://www.wolfsonmicro.com/products/WM8352
> +
> +Authors: Mark Brown <broonie@opensource.wolfsonmicro.com>
> +
> +Description
> +-----------
> +
> +The WM835x series of PMICs include an AUXADC which can be used to
> +monitor a range of system operating parameters, including the voltages
> +of the major supplies within the system. Currently the driver provides
> +simple access to these major supplies.
> +
> +Voltage Monitoring
> +------------------
> +
> +Voltages are sampled by a 12 bit ADC. For the internal supplies the ADC
> +is referenced to the system VRTC.
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 2d50166..c94d708 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -920,6 +920,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
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index b793dce..c02e90e 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -89,6 +89,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
> diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
> new file mode 100644
> index 0000000..1329059
> --- /dev/null
> +++ b/drivers/hwmon/wm8350-hwmon.c
> @@ -0,0 +1,151 @@
> +/*
> + * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectronics WM8350 PMIC
> + * hardware monitoring features.
> + *
> + * Copyright (C) 2009 Wolfson Microelectronics plc
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License v2 as published by the
> + * Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +#include <linux/hwmon.h>
> +#include <linux/hwmon-sysfs.h>
> +
> +#include <linux/mfd/wm8350/core.h>
> +#include <linux/mfd/wm8350/comparator.h>
> +
> +static ssize_t show_name(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "wm8350\n");
> +}
> +
> +static const char *input_names[] = {
> + [WM8350_AUXADC_USB] = "USB",
> + [WM8350_AUXADC_LINE] = "Line",
> + [WM8350_AUXADC_BATT] = "Battery",
> +};
> +
> +
> +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;
> + val = DIV_ROUND_CLOSEST(val, 1000);
> +
> + return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t show_label(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + int channel = to_sensor_dev_attr(attr)->index;
> +
> + return sprintf(buf, "%s\n", input_names[channel]);
> +}
> +
> +#define WM8350_NAMED_VOLTAGE(id, name) \
> + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
> + NULL, name); \
> + static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
> + NULL, name)
> +
> +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
> +
> +WM8350_NAMED_VOLTAGE(0, WM8350_AUXADC_USB);
> +WM8350_NAMED_VOLTAGE(1, WM8350_AUXADC_BATT);
> +WM8350_NAMED_VOLTAGE(2, WM8350_AUXADC_LINE);
> +
> +static struct attribute *wm8350_attributes[] = {
> + &dev_attr_name.attr,
> +
> + &sensor_dev_attr_in0_input.dev_attr.attr,
> + &sensor_dev_attr_in0_label.dev_attr.attr,
> + &sensor_dev_attr_in1_input.dev_attr.attr,
> + &sensor_dev_attr_in1_label.dev_attr.attr,
> + &sensor_dev_attr_in2_input.dev_attr.attr,
> + &sensor_dev_attr_in2_label.dev_attr.attr,
> +
> + NULL,
> +};
> +
> +static const struct attribute_group wm8350_attr_group = {
> + .attrs = wm8350_attributes,
> +};
> +
> +static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> + int ret;
> +
> + ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
> + if (ret)
> + goto err;
> +
> + wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
> + if (IS_ERR(wm8350->hwmon.classdev)) {
> + ret = PTR_ERR(wm8350->hwmon.classdev);
> + goto err_group;
> + }
> +
> + return 0;
> +
> +err_group:
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +err:
> + return ret;
> +}
> +
> +static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> +
> + hwmon_device_unregister(wm8350->hwmon.classdev);
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +
> + return 0;
> +}
> +
> +static struct platform_driver wm8350_hwmon_driver = {
> + .probe = wm8350_hwmon_probe,
> + .remove = __devexit_p(wm8350_hwmon_remove),
> + .driver = {
> + .name = "wm8350-hwmon",
> + .owner = THIS_MODULE,
> + },
> +};
> +
> +static int __init wm8350_hwmon_init(void)
> +{
> + return platform_driver_register(&wm8350_hwmon_driver);
> +}
> +module_init(wm8350_hwmon_init);
> +
> +static void __exit wm8350_hwmon_exit(void)
> +{
> + platform_driver_unregister(&wm8350_hwmon_driver);
> +}
> +module_exit(wm8350_hwmon_exit);
> +
> +MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
> +MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:wm8350-hwmon");
> diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
> index fe24079..9d662a5 100644
> --- a/drivers/mfd/wm8350-core.c
> +++ b/drivers/mfd/wm8350-core.c
> @@ -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);
>
> diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
> index 42cca67..969b0b5 100644
> --- a/include/linux/mfd/wm8350/core.h
> +++ b/include/linux/mfd/wm8350/core.h
> @@ -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;
> --
> 1.6.3.3
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
_______________________________________________
lm-sensors mailing list
lm-sensors@lm-sensors.org
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
^ permalink raw reply [flat|nested] 25+ messages in thread
* Re: [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver
@ 2009-08-03 16:40 ` Samuel Ortiz
0 siblings, 0 replies; 25+ messages in thread
From: Samuel Ortiz @ 2009-08-03 16:40 UTC (permalink / raw)
To: Mark Brown; +Cc: Jean Delvare, lm-sensors, linux-kernel, Jonathan Cameron
Hi Mark,
On Mon, Jul 20, 2009 at 12:43:45PM +0100, Mark Brown wrote:
> This driver provides reporting of the status supply voltage rails
> of the WM835x series of PMICs via the hwmon API.
Applied to my for-next branch, thanks.
Cheers,
Samuel.
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>
> This should address all the issues Jean raised:
> - Add a brief document to the hwmon directory.
> - Use full constant names as arguments for template macro.
> - Use DIV_ROUND_CLOSEST()
> - Set driver owner.
> - Fix typos.
>
> Thanks to Jonathan and Jean for their reviews.
>
> Documentation/hwmon/wm8350 | 26 +++++++
> drivers/hwmon/Kconfig | 10 +++
> drivers/hwmon/Makefile | 1 +
> drivers/hwmon/wm8350-hwmon.c | 151 +++++++++++++++++++++++++++++++++++++++
> drivers/mfd/wm8350-core.c | 3 +
> include/linux/mfd/wm8350/core.h | 6 ++
> 6 files changed, 197 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/hwmon/wm8350
> create mode 100644 drivers/hwmon/wm8350-hwmon.c
>
> diff --git a/Documentation/hwmon/wm8350 b/Documentation/hwmon/wm8350
> new file mode 100644
> index 0000000..98f923b
> --- /dev/null
> +++ b/Documentation/hwmon/wm8350
> @@ -0,0 +1,26 @@
> +Kernel driver wm8350-hwmon
> +==========================
> +
> +Supported chips:
> + * Wolfson Microelectronics WM835x PMICs
> + Prefix: 'wm8350'
> + Datasheet:
> + http://www.wolfsonmicro.com/products/WM8350
> + http://www.wolfsonmicro.com/products/WM8351
> + http://www.wolfsonmicro.com/products/WM8352
> +
> +Authors: Mark Brown <broonie@opensource.wolfsonmicro.com>
> +
> +Description
> +-----------
> +
> +The WM835x series of PMICs include an AUXADC which can be used to
> +monitor a range of system operating parameters, including the voltages
> +of the major supplies within the system. Currently the driver provides
> +simple access to these major supplies.
> +
> +Voltage Monitoring
> +------------------
> +
> +Voltages are sampled by a 12 bit ADC. For the internal supplies the ADC
> +is referenced to the system VRTC.
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 2d50166..c94d708 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -920,6 +920,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
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index b793dce..c02e90e 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -89,6 +89,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
> diff --git a/drivers/hwmon/wm8350-hwmon.c b/drivers/hwmon/wm8350-hwmon.c
> new file mode 100644
> index 0000000..1329059
> --- /dev/null
> +++ b/drivers/hwmon/wm8350-hwmon.c
> @@ -0,0 +1,151 @@
> +/*
> + * drivers/hwmon/wm8350-hwmon.c - Wolfson Microelectronics WM8350 PMIC
> + * hardware monitoring features.
> + *
> + * Copyright (C) 2009 Wolfson Microelectronics plc
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License v2 as published by the
> + * Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
> + * more details.
> + *
> + * You should have received a copy of the GNU General Public License along with
> + * this program; if not, write to the Free Software Foundation, Inc.,
> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
> + */
> +
> +#include <linux/kernel.h>
> +#include <linux/module.h>
> +#include <linux/err.h>
> +#include <linux/platform_device.h>
> +#include <linux/hwmon.h>
> +#include <linux/hwmon-sysfs.h>
> +
> +#include <linux/mfd/wm8350/core.h>
> +#include <linux/mfd/wm8350/comparator.h>
> +
> +static ssize_t show_name(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + return sprintf(buf, "wm8350\n");
> +}
> +
> +static const char *input_names[] = {
> + [WM8350_AUXADC_USB] = "USB",
> + [WM8350_AUXADC_LINE] = "Line",
> + [WM8350_AUXADC_BATT] = "Battery",
> +};
> +
> +
> +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;
> + val = DIV_ROUND_CLOSEST(val, 1000);
> +
> + return sprintf(buf, "%d\n", val);
> +}
> +
> +static ssize_t show_label(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + int channel = to_sensor_dev_attr(attr)->index;
> +
> + return sprintf(buf, "%s\n", input_names[channel]);
> +}
> +
> +#define WM8350_NAMED_VOLTAGE(id, name) \
> + static SENSOR_DEVICE_ATTR(in##id##_input, S_IRUGO, show_voltage,\
> + NULL, name); \
> + static SENSOR_DEVICE_ATTR(in##id##_label, S_IRUGO, show_label, \
> + NULL, name)
> +
> +static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
> +
> +WM8350_NAMED_VOLTAGE(0, WM8350_AUXADC_USB);
> +WM8350_NAMED_VOLTAGE(1, WM8350_AUXADC_BATT);
> +WM8350_NAMED_VOLTAGE(2, WM8350_AUXADC_LINE);
> +
> +static struct attribute *wm8350_attributes[] = {
> + &dev_attr_name.attr,
> +
> + &sensor_dev_attr_in0_input.dev_attr.attr,
> + &sensor_dev_attr_in0_label.dev_attr.attr,
> + &sensor_dev_attr_in1_input.dev_attr.attr,
> + &sensor_dev_attr_in1_label.dev_attr.attr,
> + &sensor_dev_attr_in2_input.dev_attr.attr,
> + &sensor_dev_attr_in2_label.dev_attr.attr,
> +
> + NULL,
> +};
> +
> +static const struct attribute_group wm8350_attr_group = {
> + .attrs = wm8350_attributes,
> +};
> +
> +static int __devinit wm8350_hwmon_probe(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> + int ret;
> +
> + ret = sysfs_create_group(&pdev->dev.kobj, &wm8350_attr_group);
> + if (ret)
> + goto err;
> +
> + wm8350->hwmon.classdev = hwmon_device_register(&pdev->dev);
> + if (IS_ERR(wm8350->hwmon.classdev)) {
> + ret = PTR_ERR(wm8350->hwmon.classdev);
> + goto err_group;
> + }
> +
> + return 0;
> +
> +err_group:
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +err:
> + return ret;
> +}
> +
> +static int __devexit wm8350_hwmon_remove(struct platform_device *pdev)
> +{
> + struct wm8350 *wm8350 = platform_get_drvdata(pdev);
> +
> + hwmon_device_unregister(wm8350->hwmon.classdev);
> + sysfs_remove_group(&pdev->dev.kobj, &wm8350_attr_group);
> +
> + return 0;
> +}
> +
> +static struct platform_driver wm8350_hwmon_driver = {
> + .probe = wm8350_hwmon_probe,
> + .remove = __devexit_p(wm8350_hwmon_remove),
> + .driver = {
> + .name = "wm8350-hwmon",
> + .owner = THIS_MODULE,
> + },
> +};
> +
> +static int __init wm8350_hwmon_init(void)
> +{
> + return platform_driver_register(&wm8350_hwmon_driver);
> +}
> +module_init(wm8350_hwmon_init);
> +
> +static void __exit wm8350_hwmon_exit(void)
> +{
> + platform_driver_unregister(&wm8350_hwmon_driver);
> +}
> +module_exit(wm8350_hwmon_exit);
> +
> +MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
> +MODULE_DESCRIPTION("WM8350 Hardware Monitoring");
> +MODULE_LICENSE("GPL");
> +MODULE_ALIAS("platform:wm8350-hwmon");
> diff --git a/drivers/mfd/wm8350-core.c b/drivers/mfd/wm8350-core.c
> index fe24079..9d662a5 100644
> --- a/drivers/mfd/wm8350-core.c
> +++ b/drivers/mfd/wm8350-core.c
> @@ -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);
>
> diff --git a/include/linux/mfd/wm8350/core.h b/include/linux/mfd/wm8350/core.h
> index 42cca67..969b0b5 100644
> --- a/include/linux/mfd/wm8350/core.h
> +++ b/include/linux/mfd/wm8350/core.h
> @@ -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;
> --
> 1.6.3.3
>
--
Intel Open Source Technology Centre
http://oss.intel.com/
^ permalink raw reply [flat|nested] 25+ messages in thread
end of thread, other threads:[~2009-08-03 16:40 UTC | newest]
Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 15:29 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-15 20:09 ` Jean Delvare
2009-07-15 20:32 ` Jean Delvare
2009-07-15 21:30 ` Mark Brown
2009-07-16 11:18 ` Jonathan Cameron
2009-07-16 11:47 ` Mark Brown
2009-07-16 14:12 ` Jonathan Cameron
2009-07-17 20:33 ` Mark Brown
2009-07-17 20:33 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
2009-07-18 9:17 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Jean Delvare
2009-07-18 9:17 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Jean Delvare
2009-07-18 9:59 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-18 9:59 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
2009-07-18 10:39 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Jean Delvare
2009-07-18 10:39 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Jean Delvare
2009-07-18 10:47 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-18 10:47 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
2009-07-20 11:43 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-20 11:43 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Mark Brown
2009-07-20 13:19 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Jean Delvare
2009-07-20 13:19 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Jean Delvare
2009-08-03 16:40 ` [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Samuel Ortiz
2009-08-03 16:40 ` [PATCH] hwmon: Add WM835x PMIC hardware monitoring driver Samuel Ortiz
-- strict thread matches above, loose matches on Subject: below --
2009-07-15 20:27 [lm-sensors] [PATCH] hwmon: Add WM835x PMIC hardware monitoring Mark Brown
2009-07-15 20:37 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.