aboutsummaryrefslogtreecommitdiff
path: root/drivers/hwmon/ntc_thermistor.c
AgeCommit message (Collapse)Author
2013-08-11hwmon: use dev_get_platdata()Jingoo Han
Use the wrapper function for retrieving the platform data instead of accessing dev->platform_data directly. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-06-21hwmon: (ntc_thermistor) Remove redundant platform_set_drvdata()Sachin Kamat
Commit 0998d06310 (device-core: Ensure drvdata = NULL when no driver is bound) removes the need to set driver data field to NULL. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07hwmon: Fix CamelCase checkpatch warningsGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driverNaveen Krishna Chatradhi
This patch adds DT support to NTC driver to parse the platform data. Also adds the support to work as an iio device client. During the probe ntc driver gets the respective channels of ADC and uses iio_raw_read calls to get the ADC converted value. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> [Guenter Roeck: fixed Kconfig dependencies; use ERR_CAST] Tested-by: Doug Anderson <dianders@chromium.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-02-19hwmon: (ntc_thermistor): Fix sparse warningsSachin Kamat
Fixes the following sparse warnings: drivers/hwmon/ntc_thermistor.c:46:31: warning: symbol 'ncpXXwb473' was not declared. Should it be static? drivers/hwmon/ntc_thermistor.c:82:31: warning: symbol 'ncpXXwl333' was not declared. Should it be static? Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2012-11-28hwmon: remove use of __devexitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devinitBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-11-28hwmon: remove use of __devexit_pBill Pemberton
CONFIG_HOTPLUG is going away as an option so __devexit_p is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Hans de Goede <hdegoede@redhat.com> Cc: Jean Delvare <khali@linux-fr.org> Cc: Alistair John Strachan <alistair@devzero.co.uk> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Juerg Haefliger <juergh@gmail.com> Cc: Andreas Herrmann <herrmann.der.user@googlemail.com> Cc: Clemens Ladisch <clemens@ladisch.de> Cc: Rudolf Marek <r.marek@assembler.cz> Cc: Jim Cromie <jim.cromie@gmail.com> Cc: "Mark M. Hoffman" <mhoffman@lightlink.com> Cc: Roger Lucas <vt8231@hiddenengine.co.uk> Acked-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-07-21hwmon: (ntc_thermistor) Ensure that data->name string is terminatedGuenter Roeck
Fix Coverity warning: Calling strncpy with a maximum size argument of 20 bytes on destination array "data->name" of size 20 bytes might leave the destination string unterminated. Fix by replacing strncpy() with strlcpy() and by using sizeof() to determine the maximum string length. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Acked-by: Jean Delvare <khali@linux-fr.org>
2012-05-20hwmon: (ntc_thermistor) Fix checkpatch warningGuenter Roeck
Fix checkpatch WARNING: quoted string split across lines Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-05-20hwmon: (ntc_thermistor) Optimize and fix build warningGuenter Roeck
The following build warning is seen in some configurations: drivers/hwmon/ntc_thermistor.c: In function 'ntc_show_temp': drivers/hwmon/ntc_thermistor.c:293: warning: 'temp' may be used uninitialized in this function Fix the problem by re-arranging the code to overload return values with error codes, and by avoiding error returns whenever possible. Specifically, Simplify lookup_comp() to not return an error. Instead, return i_low == i_high if there is an exact match, or if the ohm value is outside the lookup table range. Modify get_temp_mC() to not return an error. Since it only returns an error after lookup_comp() returned an error, this is quite straightforward after above change. Separate ntc_thermistor_read() into a function to read the resistor value (which can return an error), and the call to get_temp_mC() which doesn't. Call the functions directly from ntc_show_temp(). Code was tested using a test program, comparing the result of the old and new versions of get_temp_mC() for resistor values between 0 and 2,000,000 ohm. As a side effect, this patch reduces code size by approximately 400 bytes on x86_64. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Cc: Donggeun Kim <dg77.kim@samsung.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-05-20hwmon: (ntc_thermistor) Return error code from hwmon_device_registerGuenter Roeck
hwmon_device_register() never returns a NULL pointer in case of errors, but an error value. Use it. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2012-05-20hwmon: (ntc_thermistor) Convert to devm_kzallocGuenter Roeck
This avoids memory leaks, and makes the code a bit simpler and smaller. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Reviewed-by: Robert Coulson <robert.coulson@ericsson.com>
2011-11-26hwmon: convert drivers/hwmon/* to use module_platform_driver()Axel Lin
This patch converts the drivers in drivers/hwmon/* to use the module_platform_driver() macro which makes the code smaller and a bit simpler. Cc: Donggeun Kim <dg77.kim@samsung.com> Cc: Simon Guinot <sguinot@lacie.com> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: MyungJoo Ham <myungjoo.ham@samsung.com> Cc: Ben Dooks <ben@simtec.co.uk> Cc: Hans de Goede <hdegoede@redhat.com> Cc: J Keerthy <j-keerthy@ti.com> Cc: David S. Miller <davem@davemloft.net> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Axel Lin <axel.lin@gmail.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
2011-08-22hwmon: (ntc_thermistor) Simplify if sequenceGuenter Roeck
Replace unnecessary if with else statement. This fixes the following (false) compile warning reported with some combinations of C compiler version and configuration. drivers/hwmon/ntc_thermistor.c: In function 'ntc_show_temp': drivers/hwmon/ntc_thermistor.c:225: warning: 'low' may be used uninitialized in this function drivers/hwmon/ntc_thermistor.c:225: note: 'low' was declared here drivers/hwmon/ntc_thermistor.c:225: warning: 'high' may be used uninitialized in this function drivers/hwmon/ntc_thermistor.c:225: note: 'high' was declared here drivers/hwmon/ntc_thermistor.c:294: warning: 'temp' may be used uninitialized in this function Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com> Acked-by: Jean Delvare <khali@linux-fr.org>
2011-07-28hwmon: Driver for NTC ThermistorsDonggeun Kim
Add support for NTC Thermistor series. In this release, the following thermistors are supported: NCP15WB473, NCP18WB473, NCP03WB473, and NCP15WL333. This driver is based on the datasheet of MURATA. The driver in the patch does conversion from the raw ADC value (either voltage or resistence) to temperature. In order to use voltage values as input, the circuit schematics should be provided with the platform data. A compensation table for each type of thermistor is provided for the conversion. Signed-off-by: Donggeun Kim <dg77.kim@samsung.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: KyungMin Park <kyungmin.park@samsung.com> Reviewed-by: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>