Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-06-18 Thread Guenter Roeck

On 06/18/2014 01:43 AM, Neelesh Gupta wrote:



+}
+
+static void __init get_sensor_index_attr(const char *name, u32 *index, char 
*attr)
+{
+char *hash_pos = strchr(name, '#');
+char *dash_pos;
+u32 copy_len;
+char buf[8];
+
+memset(buf, 0, sizeof(buf));
+*index = 0;
+*attr = '\0';
+
+if (hash_pos) {
+dash_pos = strchr(hash_pos, '-');
+if (dash_pos) {
+copy_len = dash_pos - hash_pos - 1;
+if (copy_len < sizeof(buf)) {
+strncpy(buf, hash_pos + 1, copy_len);
+sscanf(buf, "%d", index);


What if sscanf fails ? Might be an interesting exercise to try and create
multiple sensors with index 0 (or, for that matter, with the same index value).
Do you have any protection against bad input data ? Guess not; did you test
what happens if you pass bad data to the driver (such as duplicate sensor
entries) ?


We can't have duplicate entries in the device tree under the same node ?
But yes, rest other scenarios must be validated.



Was this a serious question ? Sorry, I wonder. It seems quite unlikely for a 
file
system to accept two files with the same name in the same directory.

Guenter

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-06-18 Thread Neelesh Gupta



+}
+
+static void __init get_sensor_index_attr(const char *name, u32 
*index, char *attr)

+{
+char *hash_pos = strchr(name, '#');
+char *dash_pos;
+u32 copy_len;
+char buf[8];
+
+memset(buf, 0, sizeof(buf));
+*index = 0;
+*attr = '\0';
+
+if (hash_pos) {
+dash_pos = strchr(hash_pos, '-');
+if (dash_pos) {
+copy_len = dash_pos - hash_pos - 1;
+if (copy_len < sizeof(buf)) {
+strncpy(buf, hash_pos + 1, copy_len);
+sscanf(buf, "%d", index);


What if sscanf fails ? Might be an interesting exercise to try and create
multiple sensors with index 0 (or, for that matter, with the same 
index value).
Do you have any protection against bad input data ? Guess not; did you 
test

what happens if you pass bad data to the driver (such as duplicate sensor
entries) ?


We can't have duplicate entries in the device tree under the same node ?
But yes, rest other scenarios must be validated.

- Neelesh




+}
+
+strncpy(attr, dash_pos + 1, MAX_ATTR_LEN);
+}
+}
+}
+
+



___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-06-09 Thread Neelesh Gupta


On 05/28/2014 12:53 PM, Guenter Roeck wrote:

On 05/19/2014 07:26 AM, Neelesh Gupta wrote:

This patch adds basic kernel enablement for reading power values, fan
speed rpm and temperature values on powernv platforms which will
be exported to user space through sysfs interface.

Test results:
-
[root@tul163p1 ~]# sensors
ibmpowernv-isa-
Adapter: ISA adapter
fan1:5487 RPM  (min =0 RPM)
fan2:5152 RPM  (min =0 RPM)
fan3:5590 RPM  (min =0 RPM)
fan4:4963 RPM  (min =0 RPM)
fan5:   0 RPM  (min =0 RPM)
fan6:   0 RPM  (min =0 RPM)
fan7:7488 RPM  (min =0 RPM)
fan8:7944 RPM  (min =0 RPM)
temp1:+39.0°C  (high =  +0.0°C)
power1:  192.00 W

[root@tul163p1 ~]# ls /sys/devices/platform/
alarmtimer  ibmpowernv.0  rtc-generic  serial8250  uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/
driver/hwmon/ modalias   subsystem/ uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/hwmon/hwmon0/
devicefan2_minfan4_minfan6_minfan8_min power1_input
fan1_fault  fan3_faultfan5_fault  fan7_faultin1_fault subsystem
fan1_input  fan3_inputfan5_input  fan7_inputin2_fault 
temp1_input

fan1_minfan3_minfan5_minfan7_minin3_fault temp1_max
fan2_fault  fan4_faultfan6_fault  fan8_faultin4_fault uevent
fan2_input  fan4_inputfan6_input  fan8_inputname
[root@tul163p1 ~]#
[root@tul163p1 ~]# ls /sys/class/hwmon/hwmon0/
devicefan2_minfan4_minfan6_minfan8_min power1_input
fan1_fault  fan3_faultfan5_fault  fan7_faultin1_fault subsystem
fan1_input  fan3_inputfan5_input  fan7_inputin2_fault 
temp1_input

fan1_minfan3_minfan5_minfan7_minin3_fault temp1_max
fan2_fault  fan4_faultfan6_fault  fan8_faultin4_fault uevent
fan2_input  fan4_inputfan6_input  fan8_inputname
[root@tul163p1 ~]#




The inX_fault attributes don't really make much sense. _fault 
attributes without
_input attributes don't have any value and are, as you noticed, not 
displayed
with the sensors command. Is this a problem in teh devicetree data or 
do you

really have voltage faults without voltages ?


There is no issue with the device data, somehow I'm getting only the 
_fault attribute

for the inX_ (power-supply) attributes.




Signed-off-by: Neelesh Gupta 
---


Checkpatch says:

total: 8 errors, 11 warnings, 389 lines checked

NOTE: whitespace errors detected, you may wish to use 
scripts/cleanpatch or

  scripts/cleanfile

which should really not happen at this point.

Please make sure you follow CodingStyle. checkpatch --strict points to 
a number

of additional violations.

More comments inline.


Fixed all of these issues related to coding style.




Changes in v2
=
- Generic use of devm_* functions in hwmon like using devm_kzalloc() 
for dynamic

   memory request, avoiding the need to explicit free of memory.
   Adding 'struct attribute_group' as member of platform data 
structure to be
   populated and then passed to 
devm_hwmon_device_register_with_groups().


   Note: Having an array of pointers of 'attribute_group' and each group
   corresponds to 'enum sensors' type. Not completely sure, if it's 
ideal or

   could have just one group populated with attributes of sensor types?

Your call, really; whatever is easier for you. I won't dictate one or 
the other.


Question though is what happens if one group is not populated. If I 
understand
the code correctly this will result in the remaining groups to be 
'dropped',

ie not displayed at all.


Yes, should be fixed.



- 'ibmpowernv' is not hot-pluggable device so moving 
'platform_driver' callback

   function (probe) as part of __init code.
- Fixed issues related to coding style.
- Other general comments in v1.

  drivers/hwmon/Kconfig  |8 +
  drivers/hwmon/Makefile |1
  drivers/hwmon/ibmpowernv.c |  368 



You'll also need Documentation/hwmon/ibmpowernv and
Documentation/devicetree/bindings/hwmon/ibmpowernv.

The latter will need to get an Ack from the devicetree maintainers.


I'll do as required.


  3 files changed, 377 insertions(+)
  create mode 100644 drivers/hwmon/ibmpowernv.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index bc196f4..3e308fa 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -554,6 +554,14 @@ config SENSORS_IBMPEX
This driver can also be built as a module.  If so, the module
will be called ibmpex.

+config SENSORS_IBMPOWERNV
+tristate "IBM POWERNV platform sensors"
+depends on PPC_POWERNV
+default y
+help
+  If you say yes here you get support for the temperature/fan/power
+  sensors on your platform.
+
  config SENSORS_IIO_HWMON
  tristate "Hwmon driver that uses channels specified via iio maps"
  depends on IIO
diff --git a/drivers/hwmon/Makefile b/driv

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-05-30 Thread Neelesh Gupta


On 05/28/2014 01:11 PM, Benjamin Herrenschmidt wrote:

On Wed, 2014-05-28 at 00:23 -0700, Guenter Roeck wrote:

Consider using of_property_read_u32().


+ sdata[count].id = *sensor_id;
+ sdata[count].type = type;

Especially since this is broken for Little Endian !

Neelesh, please make sure you test your patch on LE.

Cheers,
Ben.


Fixing it and will surely test on LE as well before posting.

- Neelesh

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-05-28 Thread Benjamin Herrenschmidt
On Wed, 2014-05-28 at 00:23 -0700, Guenter Roeck wrote:
> Consider using of_property_read_u32().
> 
> > + sdata[count].id = *sensor_id;
> > + sdata[count].type = type;

Especially since this is broken for Little Endian !

Neelesh, please make sure you test your patch on LE.

Cheers,
Ben.


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-05-28 Thread Guenter Roeck

On 05/19/2014 07:26 AM, Neelesh Gupta wrote:

This patch adds basic kernel enablement for reading power values, fan
speed rpm and temperature values on powernv platforms which will
be exported to user space through sysfs interface.

Test results:
-
[root@tul163p1 ~]# sensors
ibmpowernv-isa-
Adapter: ISA adapter
fan1:5487 RPM  (min =0 RPM)
fan2:5152 RPM  (min =0 RPM)
fan3:5590 RPM  (min =0 RPM)
fan4:4963 RPM  (min =0 RPM)
fan5:   0 RPM  (min =0 RPM)
fan6:   0 RPM  (min =0 RPM)
fan7:7488 RPM  (min =0 RPM)
fan8:7944 RPM  (min =0 RPM)
temp1:+39.0°C  (high =  +0.0°C)
power1:  192.00 W

[root@tul163p1 ~]# ls /sys/devices/platform/
alarmtimer  ibmpowernv.0  rtc-generic  serial8250  uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/
driver/hwmon/ modalias   subsystem/ uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/hwmon/hwmon0/
device  fan2_minfan4_minfan6_minfan8_min   power1_input
fan1_fault  fan3_fault  fan5_fault  fan7_fault  in1_fault  subsystem
fan1_input  fan3_input  fan5_input  fan7_input  in2_fault  temp1_input
fan1_minfan3_minfan5_minfan7_minin3_fault  temp1_max
fan2_fault  fan4_fault  fan6_fault  fan8_fault  in4_fault  uevent
fan2_input  fan4_input  fan6_input  fan8_input  name
[root@tul163p1 ~]#
[root@tul163p1 ~]# ls /sys/class/hwmon/hwmon0/
device  fan2_minfan4_minfan6_minfan8_min   power1_input
fan1_fault  fan3_fault  fan5_fault  fan7_fault  in1_fault  subsystem
fan1_input  fan3_input  fan5_input  fan7_input  in2_fault  temp1_input
fan1_minfan3_minfan5_minfan7_minin3_fault  temp1_max
fan2_fault  fan4_fault  fan6_fault  fan8_fault  in4_fault  uevent
fan2_input  fan4_input  fan6_input  fan8_input  name
[root@tul163p1 ~]#




The inX_fault attributes don't really make much sense. _fault attributes without
_input attributes don't have any value and are, as you noticed, not displayed
with the sensors command. Is this a problem in teh devicetree data or do you
really have voltage faults without voltages ?


Signed-off-by: Neelesh Gupta 
---


Checkpatch says:

total: 8 errors, 11 warnings, 389 lines checked

NOTE: whitespace errors detected, you may wish to use scripts/cleanpatch or
  scripts/cleanfile

which should really not happen at this point.

Please make sure you follow CodingStyle. checkpatch --strict points to a number
of additional violations.

More comments inline.


Changes in v2
=
- Generic use of devm_* functions in hwmon like using devm_kzalloc() for dynamic
   memory request, avoiding the need to explicit free of memory.
   Adding 'struct attribute_group' as member of platform data structure to be
   populated and then passed to devm_hwmon_device_register_with_groups().

   Note: Having an array of pointers of 'attribute_group' and each group
   corresponds to 'enum sensors' type. Not completely sure, if it's ideal or
   could have just one group populated with attributes of sensor types?


Your call, really; whatever is easier for you. I won't dictate one or the other.

Question though is what happens if one group is not populated. If I understand
the code correctly this will result in the remaining groups to be 'dropped',
ie not displayed at all.


- 'ibmpowernv' is not hot-pluggable device so moving 'platform_driver' callback
   function (probe) as part of __init code.
- Fixed issues related to coding style.
- Other general comments in v1.

  drivers/hwmon/Kconfig  |8 +
  drivers/hwmon/Makefile |1
  drivers/hwmon/ibmpowernv.c |  368 


You'll also need Documentation/hwmon/ibmpowernv and
Documentation/devicetree/bindings/hwmon/ibmpowernv.

The latter will need to get an Ack from the devicetree maintainers.


  3 files changed, 377 insertions(+)
  create mode 100644 drivers/hwmon/ibmpowernv.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index bc196f4..3e308fa 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -554,6 +554,14 @@ config SENSORS_IBMPEX
  This driver can also be built as a module.  If so, the module
  will be called ibmpex.

+config SENSORS_IBMPOWERNV
+   tristate "IBM POWERNV platform sensors"
+   depends on PPC_POWERNV
+   default y
+   help
+ If you say yes here you get support for the temperature/fan/power
+ sensors on your platform.
+
  config SENSORS_IIO_HWMON
tristate "Hwmon driver that uses channels specified via iio maps"
depends on IIO
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index c48f987..199c401 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o
  obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
  obj-$(CONFIG_SENSORS_IBMAEM)  += ibmaem.o
  obj-$(CONFIG_SENSORS_IBMPEX)  += ibmpex.o
+

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-05-26 Thread Guenter Roeck

On 05/25/2014 11:22 PM, Neelesh Gupta wrote:

Any updates on the patch.


Not yet, I have been too busy with other stuff. That happens, unfortunately.

Guenter

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-05-26 Thread Neelesh Gupta

Any updates on the patch.

- Neelesh

On 05/19/2014 07:56 PM, Neelesh Gupta wrote:

This patch adds basic kernel enablement for reading power values, fan
speed rpm and temperature values on powernv platforms which will
be exported to user space through sysfs interface.

Test results:
-
[root@tul163p1 ~]# sensors
ibmpowernv-isa-
Adapter: ISA adapter
fan1:5487 RPM  (min =0 RPM)
fan2:5152 RPM  (min =0 RPM)
fan3:5590 RPM  (min =0 RPM)
fan4:4963 RPM  (min =0 RPM)
fan5:   0 RPM  (min =0 RPM)
fan6:   0 RPM  (min =0 RPM)
fan7:7488 RPM  (min =0 RPM)
fan8:7944 RPM  (min =0 RPM)
temp1:+39.0°C  (high =  +0.0°C)
power1:  192.00 W

[root@tul163p1 ~]# ls /sys/devices/platform/
alarmtimer  ibmpowernv.0  rtc-generic  serial8250  uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/
driver/hwmon/ modalias   subsystem/ uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/hwmon/hwmon0/
device  fan2_minfan4_minfan6_minfan8_min   power1_input
fan1_fault  fan3_fault  fan5_fault  fan7_fault  in1_fault  subsystem
fan1_input  fan3_input  fan5_input  fan7_input  in2_fault  temp1_input
fan1_minfan3_minfan5_minfan7_minin3_fault  temp1_max
fan2_fault  fan4_fault  fan6_fault  fan8_fault  in4_fault  uevent
fan2_input  fan4_input  fan6_input  fan8_input  name
[root@tul163p1 ~]#
[root@tul163p1 ~]# ls /sys/class/hwmon/hwmon0/
device  fan2_minfan4_minfan6_minfan8_min   power1_input
fan1_fault  fan3_fault  fan5_fault  fan7_fault  in1_fault  subsystem
fan1_input  fan3_input  fan5_input  fan7_input  in2_fault  temp1_input
fan1_minfan3_minfan5_minfan7_minin3_fault  temp1_max
fan2_fault  fan4_fault  fan6_fault  fan8_fault  in4_fault  uevent
fan2_input  fan4_input  fan6_input  fan8_input  name
[root@tul163p1 ~]#

Signed-off-by: Neelesh Gupta 
---

Changes in v2
=
- Generic use of devm_* functions in hwmon like using devm_kzalloc() for dynamic
   memory request, avoiding the need to explicit free of memory.
   Adding 'struct attribute_group' as member of platform data structure to be
   populated and then passed to devm_hwmon_device_register_with_groups().

   Note: Having an array of pointers of 'attribute_group' and each group
   corresponds to 'enum sensors' type. Not completely sure, if it's ideal or
   could have just one group populated with attributes of sensor types?

- 'ibmpowernv' is not hot-pluggable device so moving 'platform_driver' callback
   function (probe) as part of __init code.
- Fixed issues related to coding style.
- Other general comments in v1.

  drivers/hwmon/Kconfig  |8 +
  drivers/hwmon/Makefile |1
  drivers/hwmon/ibmpowernv.c |  368 
  3 files changed, 377 insertions(+)
  create mode 100644 drivers/hwmon/ibmpowernv.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index bc196f4..3e308fa 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -554,6 +554,14 @@ config SENSORS_IBMPEX
  This driver can also be built as a module.  If so, the module
  will be called ibmpex.
  
+config SENSORS_IBMPOWERNV

+   tristate "IBM POWERNV platform sensors"
+   depends on PPC_POWERNV
+   default y
+   help
+ If you say yes here you get support for the temperature/fan/power
+ sensors on your platform.
+
  config SENSORS_IIO_HWMON
tristate "Hwmon driver that uses channels specified via iio maps"
depends on IIO
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index c48f987..199c401 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o
  obj-$(CONFIG_SENSORS_I5K_AMB) += i5k_amb.o
  obj-$(CONFIG_SENSORS_IBMAEM)  += ibmaem.o
  obj-$(CONFIG_SENSORS_IBMPEX)  += ibmpex.o
+obj-$(CONFIG_SENSORS_IBMPOWERNV)+= ibmpowernv.o
  obj-$(CONFIG_SENSORS_IIO_HWMON) += iio_hwmon.o
  obj-$(CONFIG_SENSORS_INA209)  += ina209.o
  obj-$(CONFIG_SENSORS_INA2XX)  += ina2xx.o
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
new file mode 100644
index 000..afce620
--- /dev/null
+++ b/drivers/hwmon/ibmpowernv.c
@@ -0,0 +1,368 @@
+/*
+ * IBM PowerNV platform sensors for temperature/fan/power
+ * Copyright (C) 2014 IBM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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 Lic

[PATCH v2] powerpc/powernv: hwmon driver for power values, fan rpm and temperature

2014-05-19 Thread Neelesh Gupta
This patch adds basic kernel enablement for reading power values, fan
speed rpm and temperature values on powernv platforms which will
be exported to user space through sysfs interface.

Test results:
-
[root@tul163p1 ~]# sensors
ibmpowernv-isa-
Adapter: ISA adapter
fan1:5487 RPM  (min =0 RPM)
fan2:5152 RPM  (min =0 RPM)
fan3:5590 RPM  (min =0 RPM)
fan4:4963 RPM  (min =0 RPM)
fan5:   0 RPM  (min =0 RPM)
fan6:   0 RPM  (min =0 RPM)
fan7:7488 RPM  (min =0 RPM)
fan8:7944 RPM  (min =0 RPM)
temp1:+39.0°C  (high =  +0.0°C)
power1:  192.00 W  

[root@tul163p1 ~]# ls /sys/devices/platform/
alarmtimer  ibmpowernv.0  rtc-generic  serial8250  uevent
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/
driver/hwmon/ modalias   subsystem/ uevent 
[root@tul163p1 ~]# ls /sys/devices/platform/ibmpowernv.0/hwmon/hwmon0/
device  fan2_minfan4_minfan6_minfan8_min   power1_input
fan1_fault  fan3_fault  fan5_fault  fan7_fault  in1_fault  subsystem
fan1_input  fan3_input  fan5_input  fan7_input  in2_fault  temp1_input
fan1_minfan3_minfan5_minfan7_minin3_fault  temp1_max
fan2_fault  fan4_fault  fan6_fault  fan8_fault  in4_fault  uevent
fan2_input  fan4_input  fan6_input  fan8_input  name
[root@tul163p1 ~]# 
[root@tul163p1 ~]# ls /sys/class/hwmon/hwmon0/
device  fan2_minfan4_minfan6_minfan8_min   power1_input
fan1_fault  fan3_fault  fan5_fault  fan7_fault  in1_fault  subsystem
fan1_input  fan3_input  fan5_input  fan7_input  in2_fault  temp1_input
fan1_minfan3_minfan5_minfan7_minin3_fault  temp1_max
fan2_fault  fan4_fault  fan6_fault  fan8_fault  in4_fault  uevent
fan2_input  fan4_input  fan6_input  fan8_input  name
[root@tul163p1 ~]#

Signed-off-by: Neelesh Gupta 
---

Changes in v2
=
- Generic use of devm_* functions in hwmon like using devm_kzalloc() for dynamic
  memory request, avoiding the need to explicit free of memory.
  Adding 'struct attribute_group' as member of platform data structure to be
  populated and then passed to devm_hwmon_device_register_with_groups().

  Note: Having an array of pointers of 'attribute_group' and each group
  corresponds to 'enum sensors' type. Not completely sure, if it's ideal or
  could have just one group populated with attributes of sensor types?

- 'ibmpowernv' is not hot-pluggable device so moving 'platform_driver' callback
  function (probe) as part of __init code.
- Fixed issues related to coding style.
- Other general comments in v1.

 drivers/hwmon/Kconfig  |8 +
 drivers/hwmon/Makefile |1 
 drivers/hwmon/ibmpowernv.c |  368 
 3 files changed, 377 insertions(+)
 create mode 100644 drivers/hwmon/ibmpowernv.c

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index bc196f4..3e308fa 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -554,6 +554,14 @@ config SENSORS_IBMPEX
  This driver can also be built as a module.  If so, the module
  will be called ibmpex.
 
+config SENSORS_IBMPOWERNV
+   tristate "IBM POWERNV platform sensors"
+   depends on PPC_POWERNV
+   default y
+   help
+ If you say yes here you get support for the temperature/fan/power
+ sensors on your platform.
+
 config SENSORS_IIO_HWMON
tristate "Hwmon driver that uses channels specified via iio maps"
depends on IIO
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
index c48f987..199c401 100644
--- a/drivers/hwmon/Makefile
+++ b/drivers/hwmon/Makefile
@@ -71,6 +71,7 @@ obj-$(CONFIG_SENSORS_ULTRA45) += ultra45_env.o
 obj-$(CONFIG_SENSORS_I5K_AMB)  += i5k_amb.o
 obj-$(CONFIG_SENSORS_IBMAEM)   += ibmaem.o
 obj-$(CONFIG_SENSORS_IBMPEX)   += ibmpex.o
+obj-$(CONFIG_SENSORS_IBMPOWERNV)+= ibmpowernv.o
 obj-$(CONFIG_SENSORS_IIO_HWMON) += iio_hwmon.o
 obj-$(CONFIG_SENSORS_INA209)   += ina209.o
 obj-$(CONFIG_SENSORS_INA2XX)   += ina2xx.o
diff --git a/drivers/hwmon/ibmpowernv.c b/drivers/hwmon/ibmpowernv.c
new file mode 100644
index 000..afce620
--- /dev/null
+++ b/drivers/hwmon/ibmpowernv.c
@@ -0,0 +1,368 @@
+/*
+ * IBM PowerNV platform sensors for temperature/fan/power
+ * Copyright (C) 2014 IBM
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+#inclu