Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-21 Thread Guenter Roeck
On Mon, Apr 22, 2013 at 01:14:26AM +, Opensource [Anthony Olech] wrote:
> > -Original Message-
> > From: Guenter Roeck [mailto:li...@roeck-us.net]
> > Sent: 20 April 2013 18:35
> > To: Lars-Peter Clausen
> > Cc: Opensource [Anthony Olech]; Jean Delvare; Mark Brown; Randy Dunlap;
> > lm-sens...@lm-sensors.org; LKML; David Dajun Chen
> > Subject: Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver
> > On Fri, Apr 19, 2013 at 08:25:02PM +0200, Lars-Peter Clausen wrote:
> > > Same comment as before, I'd like to see this using the generic IIO to
> > > HWMON bridge instead of recreating it.
> > ... and I agree. Seems we are getting more and more of those, and at some
> > point it makes really sense to find a generic solution.
> > Anthony, can you please look into that ?
> > Thanks,
> > Guenter
> 
> OK -- generic IIO to HWMON bridge
> 
> I will investigate - but if you know any prototypes or any useful starting 
> point could you let me know as I don't want to re-invent the wheel.
> 
The idea is that you would implement an IIO ADC driver (drivers/iio/adc has lots
of examples). The IIO to HWMON bridge already exists (drivers/hwmon/iio_hwmon.c
in linux-next or drivers/staging/iio/iio_hwmon.c in mainline). Setting it up
would then then a matter of platform data or device tree data.

Thanks,
Guenter
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-21 Thread Opensource [Anthony Olech]
> -Original Message-
> From: Guenter Roeck [mailto:li...@roeck-us.net]
> Sent: 20 April 2013 18:35
> To: Lars-Peter Clausen
> Cc: Opensource [Anthony Olech]; Jean Delvare; Mark Brown; Randy Dunlap;
> lm-sens...@lm-sensors.org; LKML; David Dajun Chen
> Subject: Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver
> On Fri, Apr 19, 2013 at 08:25:02PM +0200, Lars-Peter Clausen wrote:
> > Same comment as before, I'd like to see this using the generic IIO to
> > HWMON bridge instead of recreating it.
> ... and I agree. Seems we are getting more and more of those, and at some
> point it makes really sense to find a generic solution.
> Anthony, can you please look into that ?
> Thanks,
> Guenter

OK -- generic IIO to HWMON bridge

I will investigate - but if you know any prototypes or any useful starting 
point could you let me know as I don't want to re-invent the wheel.

Thanks,

Anthony Olech
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-21 Thread Opensource [Anthony Olech]
 -Original Message-
 From: Guenter Roeck [mailto:li...@roeck-us.net]
 Sent: 20 April 2013 18:35
 To: Lars-Peter Clausen
 Cc: Opensource [Anthony Olech]; Jean Delvare; Mark Brown; Randy Dunlap;
 lm-sens...@lm-sensors.org; LKML; David Dajun Chen
 Subject: Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver
 On Fri, Apr 19, 2013 at 08:25:02PM +0200, Lars-Peter Clausen wrote:
  Same comment as before, I'd like to see this using the generic IIO to
  HWMON bridge instead of recreating it.
 ... and I agree. Seems we are getting more and more of those, and at some
 point it makes really sense to find a generic solution.
 Anthony, can you please look into that ?
 Thanks,
 Guenter

OK -- generic IIO to HWMON bridge

I will investigate - but if you know any prototypes or any useful starting 
point could you let me know as I don't want to re-invent the wheel.

Thanks,

Anthony Olech
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-21 Thread Guenter Roeck
On Mon, Apr 22, 2013 at 01:14:26AM +, Opensource [Anthony Olech] wrote:
  -Original Message-
  From: Guenter Roeck [mailto:li...@roeck-us.net]
  Sent: 20 April 2013 18:35
  To: Lars-Peter Clausen
  Cc: Opensource [Anthony Olech]; Jean Delvare; Mark Brown; Randy Dunlap;
  lm-sens...@lm-sensors.org; LKML; David Dajun Chen
  Subject: Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver
  On Fri, Apr 19, 2013 at 08:25:02PM +0200, Lars-Peter Clausen wrote:
   Same comment as before, I'd like to see this using the generic IIO to
   HWMON bridge instead of recreating it.
  ... and I agree. Seems we are getting more and more of those, and at some
  point it makes really sense to find a generic solution.
  Anthony, can you please look into that ?
  Thanks,
  Guenter
 
 OK -- generic IIO to HWMON bridge
 
 I will investigate - but if you know any prototypes or any useful starting 
 point could you let me know as I don't want to re-invent the wheel.
 
The idea is that you would implement an IIO ADC driver (drivers/iio/adc has lots
of examples). The IIO to HWMON bridge already exists (drivers/hwmon/iio_hwmon.c
in linux-next or drivers/staging/iio/iio_hwmon.c in mainline). Setting it up
would then then a matter of platform data or device tree data.

Thanks,
Guenter
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-20 Thread Guenter Roeck
On Fri, Apr 19, 2013 at 08:25:02PM +0200, Lars-Peter Clausen wrote:
> Same comment as before, I'd like to see this using the generic IIO to HWMON
> bridge instead of recreating it.
> 
... and I agree. Seems we are getting more and more of those, and at some point
it makes really sense to find a generic solution.

Anthony, can you please look into that ?

Thanks,
Guenter


> On 04/19/2013 06:56 PM, Anthony Olech wrote:
> > This patch is relative to next-20130419 of linux-next
> > 
> > This is the HWMON component driver of the Dialog DA9058 PMIC.
> > This driver is just one component of the whole DA9058 PMIC driver.
> > It depends on the CORE and ADC component drivers of the DA9058 MFD.
> > 
> > Please note that this driver does use regmap via the CORE and ADC
> > component drivers of the DA9058 MFD.
> > 
> > Changes relative to V5 of this patch:
> > - rebased to next-20130419 in 
> > git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> > - removed redundant #include 
> > - corrected dates on copyright statements
> > Documentation/hwmon/da9058
> > - removed trailing blank line to prevent 'git apply' warning
> > drivers/hwmon/da9058-hwmon.c
> > - put spaces aount the '*' multiply operator
> > - use the word 'extract' rather than 'recover' in a comment
> > - use da9058_labels[] in show_label instead of switch case
> > - use multiple exit points in functions when no common code
> >   is to be executed.
> > - aligned continuation lines to preceeding '(' or indent + 2 tabs
> > - removed redundant mutex hwmon_lock
> > - merged 6 duplicate lines from 2 branches of if statement
> > 
> > Signed-off-by: Anthony Olech 
> > Signed-off-by: David Dajun Chen 
> > ---
> >  Documentation/hwmon/da9058   |   38 +
> >  drivers/hwmon/Kconfig|   10 ++
> >  drivers/hwmon/Makefile   |3 +-
> >  drivers/hwmon/da9058-hwmon.c |  330 
> > ++
> >  4 files changed, 380 insertions(+), 1 deletion(-)
> >  create mode 100644 Documentation/hwmon/da9058
> >  create mode 100644 drivers/hwmon/da9058-hwmon.c
> > 
> > diff --git a/Documentation/hwmon/da9058 b/Documentation/hwmon/da9058
> > new file mode 100644
> > index 000..841148f
> > --- /dev/null
> > +++ b/Documentation/hwmon/da9058
> > @@ -0,0 +1,38 @@
> > +Kernel driver da9058-hwmon
> > +==
> > +
> > +Supported chips:
> > +  * Dialog Semiconductor DA9058 PMIC
> > +Prefix: 'da9058'
> > +Datasheet:
> > +   http://www.dialog-semiconductor.com/products/power-management/da9058
> > +
> > +Authors: Opensource [Anthony Olech] 
> > +
> > +Description
> > +---
> > +
> > +The DA9058 PMIC contains a 5 channel ADC which can be used to monitor a
> > +range of system operating parameters, including the battery voltage and
> > +temperature.  The ADC measures voltage, but two of the ADC channels can
> > +be configured to supply a current, so that if an NTC termister is connected
> > +then the voltage reading can be converted to a temperature. Currently the
> > +driver provides reporting of all the input values but does not provide any
> > +alarms.
> > +
> > +Voltage Monitoring
> > +--
> > +
> > +Voltages are sampled in either 'automatic' or 'manual' mode, which is an
> > +initialization parameter set in the platform data by the machine driver.
> > +In manual mode the ADC conversion is 12 bit and in automatic mode it is
> > +10 bit. However all the raw readings are reported as 12 bit numbers.
> > +
> > +Physical Limits
> > +---
> > +
> > +vbat   2500 - 4500 milliVolts
> > +tbat   0- 2500 milliVolts
> > +adc0- 2500 milliVolts
> > +vfpin  0- 4095 milliVolts
> > +tjunc  there is a correction factor programmed during manufacturing
> > diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> > index 79bc431..cb074c4 100644
> > --- a/drivers/hwmon/Kconfig
> > +++ b/drivers/hwmon/Kconfig
> > @@ -337,6 +337,16 @@ config SENSORS_ATXP1
> >   This driver can also be built as a module.  If so, the module
> >   will be called atxp1.
> >  
> > +config SENSORS_DA9058
> > +   tristate "Dialog Semiconductor DA9058 ADC"
> > +   depends on MFD_DA9058 && DA9058_ADC
> > +   help
> > + If you say yes here you get support for the hardware monitoring
> > + functionality of the Dialog Semiconductor DA9058 PMIC.
> > +
> > + This driver can also be built as a module.  If so, the module
> > + will be called da9058-hwmon.
> > +
> >  config SENSORS_DS620
> > tristate "Dallas Semiconductor DS620"
> > depends on I2C
> > diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> > index d17d3e6..6001549 100644
> > --- a/drivers/hwmon/Makefile
> > +++ b/drivers/hwmon/Makefile
> > @@ -47,7 +47,8 @@ obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o
> >  obj-$(CONFIG_SENSORS_ATXP1)+= atxp1.o
> >  obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o
> >  obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
> > -obj-$(CONFIG_SENSORS_DA9055)+= 

Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-20 Thread Guenter Roeck
On Fri, Apr 19, 2013 at 08:25:02PM +0200, Lars-Peter Clausen wrote:
 Same comment as before, I'd like to see this using the generic IIO to HWMON
 bridge instead of recreating it.
 
... and I agree. Seems we are getting more and more of those, and at some point
it makes really sense to find a generic solution.

Anthony, can you please look into that ?

Thanks,
Guenter


 On 04/19/2013 06:56 PM, Anthony Olech wrote:
  This patch is relative to next-20130419 of linux-next
  
  This is the HWMON component driver of the Dialog DA9058 PMIC.
  This driver is just one component of the whole DA9058 PMIC driver.
  It depends on the CORE and ADC component drivers of the DA9058 MFD.
  
  Please note that this driver does use regmap via the CORE and ADC
  component drivers of the DA9058 MFD.
  
  Changes relative to V5 of this patch:
  - rebased to next-20130419 in 
  git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
  - removed redundant #include linux/mfd/da9058/version.h
  - corrected dates on copyright statements
  Documentation/hwmon/da9058
  - removed trailing blank line to prevent 'git apply' warning
  drivers/hwmon/da9058-hwmon.c
  - put spaces aount the '*' multiply operator
  - use the word 'extract' rather than 'recover' in a comment
  - use da9058_labels[] in show_label instead of switch case
  - use multiple exit points in functions when no common code
is to be executed.
  - aligned continuation lines to preceeding '(' or indent + 2 tabs
  - removed redundant mutex hwmon_lock
  - merged 6 duplicate lines from 2 branches of if statement
  
  Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
  Signed-off-by: David Dajun Chen david.c...@diasemi.com
  ---
   Documentation/hwmon/da9058   |   38 +
   drivers/hwmon/Kconfig|   10 ++
   drivers/hwmon/Makefile   |3 +-
   drivers/hwmon/da9058-hwmon.c |  330 
  ++
   4 files changed, 380 insertions(+), 1 deletion(-)
   create mode 100644 Documentation/hwmon/da9058
   create mode 100644 drivers/hwmon/da9058-hwmon.c
  
  diff --git a/Documentation/hwmon/da9058 b/Documentation/hwmon/da9058
  new file mode 100644
  index 000..841148f
  --- /dev/null
  +++ b/Documentation/hwmon/da9058
  @@ -0,0 +1,38 @@
  +Kernel driver da9058-hwmon
  +==
  +
  +Supported chips:
  +  * Dialog Semiconductor DA9058 PMIC
  +Prefix: 'da9058'
  +Datasheet:
  +   http://www.dialog-semiconductor.com/products/power-management/da9058
  +
  +Authors: Opensource [Anthony Olech] anthony.olech.opensou...@diasemi.com
  +
  +Description
  +---
  +
  +The DA9058 PMIC contains a 5 channel ADC which can be used to monitor a
  +range of system operating parameters, including the battery voltage and
  +temperature.  The ADC measures voltage, but two of the ADC channels can
  +be configured to supply a current, so that if an NTC termister is connected
  +then the voltage reading can be converted to a temperature. Currently the
  +driver provides reporting of all the input values but does not provide any
  +alarms.
  +
  +Voltage Monitoring
  +--
  +
  +Voltages are sampled in either 'automatic' or 'manual' mode, which is an
  +initialization parameter set in the platform data by the machine driver.
  +In manual mode the ADC conversion is 12 bit and in automatic mode it is
  +10 bit. However all the raw readings are reported as 12 bit numbers.
  +
  +Physical Limits
  +---
  +
  +vbat   2500 - 4500 milliVolts
  +tbat   0- 2500 milliVolts
  +adc0- 2500 milliVolts
  +vfpin  0- 4095 milliVolts
  +tjunc  there is a correction factor programmed during manufacturing
  diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
  index 79bc431..cb074c4 100644
  --- a/drivers/hwmon/Kconfig
  +++ b/drivers/hwmon/Kconfig
  @@ -337,6 +337,16 @@ config SENSORS_ATXP1
This driver can also be built as a module.  If so, the module
will be called atxp1.
   
  +config SENSORS_DA9058
  +   tristate Dialog Semiconductor DA9058 ADC
  +   depends on MFD_DA9058  DA9058_ADC
  +   help
  + If you say yes here you get support for the hardware monitoring
  + functionality of the Dialog Semiconductor DA9058 PMIC.
  +
  + This driver can also be built as a module.  If so, the module
  + will be called da9058-hwmon.
  +
   config SENSORS_DS620
  tristate Dallas Semiconductor DS620
  depends on I2C
  diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
  index d17d3e6..6001549 100644
  --- a/drivers/hwmon/Makefile
  +++ b/drivers/hwmon/Makefile
  @@ -47,7 +47,8 @@ obj-$(CONFIG_SENSORS_ASC7621) += asc7621.o
   obj-$(CONFIG_SENSORS_ATXP1)+= atxp1.o
   obj-$(CONFIG_SENSORS_CORETEMP) += coretemp.o
   obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
  -obj-$(CONFIG_SENSORS_DA9055)+= da9055-hwmon.o
  +obj-$(CONFIG_SENSORS_DA9055)   += da9055-hwmon.o
  +obj-$(CONFIG_SENSORS_DA9058)   += 

Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-19 Thread Lars-Peter Clausen
Same comment as before, I'd like to see this using the generic IIO to HWMON
bridge instead of recreating it.

On 04/19/2013 06:56 PM, Anthony Olech wrote:
> This patch is relative to next-20130419 of linux-next
> 
> This is the HWMON component driver of the Dialog DA9058 PMIC.
> This driver is just one component of the whole DA9058 PMIC driver.
> It depends on the CORE and ADC component drivers of the DA9058 MFD.
> 
> Please note that this driver does use regmap via the CORE and ADC
> component drivers of the DA9058 MFD.
> 
> Changes relative to V5 of this patch:
> - rebased to next-20130419 in 
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
> - removed redundant #include 
> - corrected dates on copyright statements
> Documentation/hwmon/da9058
> - removed trailing blank line to prevent 'git apply' warning
> drivers/hwmon/da9058-hwmon.c
> - put spaces aount the '*' multiply operator
> - use the word 'extract' rather than 'recover' in a comment
> - use da9058_labels[] in show_label instead of switch case
> - use multiple exit points in functions when no common code
>   is to be executed.
> - aligned continuation lines to preceeding '(' or indent + 2 tabs
> - removed redundant mutex hwmon_lock
> - merged 6 duplicate lines from 2 branches of if statement
> 
> Signed-off-by: Anthony Olech 
> Signed-off-by: David Dajun Chen 
> ---
>  Documentation/hwmon/da9058   |   38 +
>  drivers/hwmon/Kconfig|   10 ++
>  drivers/hwmon/Makefile   |3 +-
>  drivers/hwmon/da9058-hwmon.c |  330 
> ++
>  4 files changed, 380 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/hwmon/da9058
>  create mode 100644 drivers/hwmon/da9058-hwmon.c
> 
> diff --git a/Documentation/hwmon/da9058 b/Documentation/hwmon/da9058
> new file mode 100644
> index 000..841148f
> --- /dev/null
> +++ b/Documentation/hwmon/da9058
> @@ -0,0 +1,38 @@
> +Kernel driver da9058-hwmon
> +==
> +
> +Supported chips:
> +  * Dialog Semiconductor DA9058 PMIC
> +Prefix: 'da9058'
> +Datasheet:
> + http://www.dialog-semiconductor.com/products/power-management/da9058
> +
> +Authors: Opensource [Anthony Olech] 
> +
> +Description
> +---
> +
> +The DA9058 PMIC contains a 5 channel ADC which can be used to monitor a
> +range of system operating parameters, including the battery voltage and
> +temperature.  The ADC measures voltage, but two of the ADC channels can
> +be configured to supply a current, so that if an NTC termister is connected
> +then the voltage reading can be converted to a temperature. Currently the
> +driver provides reporting of all the input values but does not provide any
> +alarms.
> +
> +Voltage Monitoring
> +--
> +
> +Voltages are sampled in either 'automatic' or 'manual' mode, which is an
> +initialization parameter set in the platform data by the machine driver.
> +In manual mode the ADC conversion is 12 bit and in automatic mode it is
> +10 bit. However all the raw readings are reported as 12 bit numbers.
> +
> +Physical Limits
> +---
> +
> +vbat   2500 - 4500 milliVolts
> +tbat   0- 2500 milliVolts
> +adc0- 2500 milliVolts
> +vfpin  0- 4095 milliVolts
> +tjunc  there is a correction factor programmed during manufacturing
> diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
> index 79bc431..cb074c4 100644
> --- a/drivers/hwmon/Kconfig
> +++ b/drivers/hwmon/Kconfig
> @@ -337,6 +337,16 @@ config SENSORS_ATXP1
> This driver can also be built as a module.  If so, the module
> will be called atxp1.
>  
> +config SENSORS_DA9058
> + tristate "Dialog Semiconductor DA9058 ADC"
> + depends on MFD_DA9058 && DA9058_ADC
> + help
> +   If you say yes here you get support for the hardware monitoring
> +   functionality of the Dialog Semiconductor DA9058 PMIC.
> +
> +   This driver can also be built as a module.  If so, the module
> +   will be called da9058-hwmon.
> +
>  config SENSORS_DS620
>   tristate "Dallas Semiconductor DS620"
>   depends on I2C
> diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
> index d17d3e6..6001549 100644
> --- a/drivers/hwmon/Makefile
> +++ b/drivers/hwmon/Makefile
> @@ -47,7 +47,8 @@ obj-$(CONFIG_SENSORS_ASC7621)   += asc7621.o
>  obj-$(CONFIG_SENSORS_ATXP1)  += atxp1.o
>  obj-$(CONFIG_SENSORS_CORETEMP)   += coretemp.o
>  obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
> -obj-$(CONFIG_SENSORS_DA9055)+= da9055-hwmon.o
> +obj-$(CONFIG_SENSORS_DA9055) += da9055-hwmon.o
> +obj-$(CONFIG_SENSORS_DA9058) += da9058-hwmon.o
>  obj-$(CONFIG_SENSORS_DME1737)+= dme1737.o
>  obj-$(CONFIG_SENSORS_DS620)  += ds620.o
>  obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
> diff --git a/drivers/hwmon/da9058-hwmon.c b/drivers/hwmon/da9058-hwmon.c
> new file mode 100644
> index 000..ff3fcbf
> --- /dev/null
> +++ b/drivers/hwmon/da9058-hwmon.c
> @@ -0,0 +1,330 @@
> +/*
> + *  Copyright 

Re: [NEW DRIVER V6 6/7] drivers/hwmon: DA9058 HWMON driver

2013-04-19 Thread Lars-Peter Clausen
Same comment as before, I'd like to see this using the generic IIO to HWMON
bridge instead of recreating it.

On 04/19/2013 06:56 PM, Anthony Olech wrote:
 This patch is relative to next-20130419 of linux-next
 
 This is the HWMON component driver of the Dialog DA9058 PMIC.
 This driver is just one component of the whole DA9058 PMIC driver.
 It depends on the CORE and ADC component drivers of the DA9058 MFD.
 
 Please note that this driver does use regmap via the CORE and ADC
 component drivers of the DA9058 MFD.
 
 Changes relative to V5 of this patch:
 - rebased to next-20130419 in 
 git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
 - removed redundant #include linux/mfd/da9058/version.h
 - corrected dates on copyright statements
 Documentation/hwmon/da9058
 - removed trailing blank line to prevent 'git apply' warning
 drivers/hwmon/da9058-hwmon.c
 - put spaces aount the '*' multiply operator
 - use the word 'extract' rather than 'recover' in a comment
 - use da9058_labels[] in show_label instead of switch case
 - use multiple exit points in functions when no common code
   is to be executed.
 - aligned continuation lines to preceeding '(' or indent + 2 tabs
 - removed redundant mutex hwmon_lock
 - merged 6 duplicate lines from 2 branches of if statement
 
 Signed-off-by: Anthony Olech anthony.olech.opensou...@diasemi.com
 Signed-off-by: David Dajun Chen david.c...@diasemi.com
 ---
  Documentation/hwmon/da9058   |   38 +
  drivers/hwmon/Kconfig|   10 ++
  drivers/hwmon/Makefile   |3 +-
  drivers/hwmon/da9058-hwmon.c |  330 
 ++
  4 files changed, 380 insertions(+), 1 deletion(-)
  create mode 100644 Documentation/hwmon/da9058
  create mode 100644 drivers/hwmon/da9058-hwmon.c
 
 diff --git a/Documentation/hwmon/da9058 b/Documentation/hwmon/da9058
 new file mode 100644
 index 000..841148f
 --- /dev/null
 +++ b/Documentation/hwmon/da9058
 @@ -0,0 +1,38 @@
 +Kernel driver da9058-hwmon
 +==
 +
 +Supported chips:
 +  * Dialog Semiconductor DA9058 PMIC
 +Prefix: 'da9058'
 +Datasheet:
 + http://www.dialog-semiconductor.com/products/power-management/da9058
 +
 +Authors: Opensource [Anthony Olech] anthony.olech.opensou...@diasemi.com
 +
 +Description
 +---
 +
 +The DA9058 PMIC contains a 5 channel ADC which can be used to monitor a
 +range of system operating parameters, including the battery voltage and
 +temperature.  The ADC measures voltage, but two of the ADC channels can
 +be configured to supply a current, so that if an NTC termister is connected
 +then the voltage reading can be converted to a temperature. Currently the
 +driver provides reporting of all the input values but does not provide any
 +alarms.
 +
 +Voltage Monitoring
 +--
 +
 +Voltages are sampled in either 'automatic' or 'manual' mode, which is an
 +initialization parameter set in the platform data by the machine driver.
 +In manual mode the ADC conversion is 12 bit and in automatic mode it is
 +10 bit. However all the raw readings are reported as 12 bit numbers.
 +
 +Physical Limits
 +---
 +
 +vbat   2500 - 4500 milliVolts
 +tbat   0- 2500 milliVolts
 +adc0- 2500 milliVolts
 +vfpin  0- 4095 milliVolts
 +tjunc  there is a correction factor programmed during manufacturing
 diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
 index 79bc431..cb074c4 100644
 --- a/drivers/hwmon/Kconfig
 +++ b/drivers/hwmon/Kconfig
 @@ -337,6 +337,16 @@ config SENSORS_ATXP1
 This driver can also be built as a module.  If so, the module
 will be called atxp1.
  
 +config SENSORS_DA9058
 + tristate Dialog Semiconductor DA9058 ADC
 + depends on MFD_DA9058  DA9058_ADC
 + help
 +   If you say yes here you get support for the hardware monitoring
 +   functionality of the Dialog Semiconductor DA9058 PMIC.
 +
 +   This driver can also be built as a module.  If so, the module
 +   will be called da9058-hwmon.
 +
  config SENSORS_DS620
   tristate Dallas Semiconductor DS620
   depends on I2C
 diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
 index d17d3e6..6001549 100644
 --- a/drivers/hwmon/Makefile
 +++ b/drivers/hwmon/Makefile
 @@ -47,7 +47,8 @@ obj-$(CONFIG_SENSORS_ASC7621)   += asc7621.o
  obj-$(CONFIG_SENSORS_ATXP1)  += atxp1.o
  obj-$(CONFIG_SENSORS_CORETEMP)   += coretemp.o
  obj-$(CONFIG_SENSORS_DA9052_ADC)+= da9052-hwmon.o
 -obj-$(CONFIG_SENSORS_DA9055)+= da9055-hwmon.o
 +obj-$(CONFIG_SENSORS_DA9055) += da9055-hwmon.o
 +obj-$(CONFIG_SENSORS_DA9058) += da9058-hwmon.o
  obj-$(CONFIG_SENSORS_DME1737)+= dme1737.o
  obj-$(CONFIG_SENSORS_DS620)  += ds620.o
  obj-$(CONFIG_SENSORS_DS1621) += ds1621.o
 diff --git a/drivers/hwmon/da9058-hwmon.c b/drivers/hwmon/da9058-hwmon.c
 new file mode 100644
 index 000..ff3fcbf
 --- /dev/null
 +++ b/drivers/hwmon/da9058-hwmon.c
 @@ -0,0 +1,330 @@
 +/*
 + *  Copyright (C) 2012,