aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ntc_thermistor.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-02-19hwmon: (ntc_thermistor) Underscore Samsung thermistorLinus Walleij1-1/+1
The sysfs does not like that we name the thermistor something that contains a dash: ntc-thermistor thermistor: hwmon: 'ssg1404-001221' is not a valid name attribute, please fix Fix it up by switching to an underscore. Fixes: e13e979b2b3d ("hwmon: (ntc_thermistor) Add Samsung 1404-001221 NTC") Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20220205005804.123245-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Add Samsung 1404-001221 NTCLinus Walleij1-0/+4
This adds the Samsung 1404-001221 NTC thermistor to the NTC thermistor driver. As far as I can tell it is electrically compatible with the Murata 47K NTC thermistor. This thermistor is mounted in a variety of Samsung products. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Cc: devicetree@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Acked-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20211215174241.1496169-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Move DT matches to the driver blockLinus Walleij1-35/+35
This moves the device tree match data toward the end of the driver which is the convention, here we can also add ACPI and similar match data in a conforming manner. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211205235948.4167075-3-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Switch to generic firmware propsLinus Walleij1-17/+19
This switches to retrieveing the configuration of the NTC from generic firmware properties so that we get neutral from device tree: now ACPI or, more importantly, software nodes can be used to spawn NTC devices provided they have the required properties. This was inspired by the similar changes made to the IIO drivers. This was tested on the Ux500 HREF with the NTC devices probing from device tree just as fine after this as before. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211206020423.62402-2-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Move and refactor DT parsingLinus Walleij1-50/+43
Move the parsing of the DT config right above probe(). Allocate the state container for the driver in probe() instead of inside the DT config parsing function: as a result return an int instead of a pointer. Drop the check for !np: we can only probe from DT right now so no risk of ending up here. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211206020423.62402-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Merge platform dataLinus Walleij1-61/+48
Allocate one state container for the device: struct ntc_data. Move all items from struct ntc_thermistor_platform_data into this struct and simplify. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-5-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Drop read_uv() depend on OF and IIOLinus Walleij1-36/+13
The only possible assignment of a function to get a voltage to convert to a resistance is to use the internal function ntc_adc_iio_read() which is only available when using IIO and OF. Bite the bullet and mandate OF and IIO, drop the read_uv() callback abstraction and some ifdefs. As no board is using the platform data, all users are using OF and IIO anyway. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-4-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Drop get_ohm()Linus Walleij1-19/+2
Nothing in the kernel (this driver) is using the callback to read ohms directly. We always read a voltage and convert it to a resistance. Drop this callback. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-3-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-12-26hwmon: (ntc_thermistor) Merge platform data into driverLinus Walleij1-5/+36
Platform data is supposed to be used with "board files", device descriptions in C. Since the introduction of the NTC driver in 2011, no such platforms have been submitted to the Linux kernel, and their use is strongly discouraged in favor of Device Tree, ACPI or as last resort software firmware nodes. Drop the external header and copy the platform data into the driver file. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20211125020841.3616359-2-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-08-17hwmon: (ntc_thermistor) Use library interpolationLinus Walleij1-9/+11
The kernel has a helper function for linear interpolation so use it. It incidentally makes the code easier to read as well. Tested on the ST-Ericsson HREFv60plus hardware reference design with two thermistors forming a thermal zone. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Cc: linux-iio@vger.kernel.org Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20210704222014.12058-1-linus.walleij@linaro.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-06-17hwmon: (ntc_thermistor) Drop unused headers.Jonathan Cameron1-4/+0
The IIO usage in this driver is purely consumer so it should only be including linux/iio/consumer.h Whilst here drop pm_runtime.h as there is no runtime power management in the driver. Found using include-what-you-use and manual inspection of the suggestions. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210611142257.103094-1-jic23@kernel.org Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2021-03-25hwmon: (ntc_thermistor): try reading processedLinus Walleij1-9/+18
Before trying the custom method of reading the sensor as raw and then converting, we want to use iio_read_channel_processed_scale() which first tries to see if the ADC can provide a processed value directly, else reads raw and applies scaling inside of IIO using the scale attributes of the ADC. We need to multiply the scaled value with 1000 to get to microvolts from millivolts which is what processed IIO channels returns. Keep the code that assumes 12bit ADC around as a fallback. This gives correct readings on the AB8500 thermistor inputs used in the Ux500 HREFP520 platform for reading battery and board temperature. Cc: Peter Rosin <peda@axentia.se> Cc: Chris Lesiak <chris.lesiak@licor.com> Cc: Jonathan Cameron <jic23@kernel.org> Cc: linux-iio@vger.kernel.org Link: https://lore.kernel.org/linux-iio/20201224011607.1059534-1-linus.walleij@linaro.org/ Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Chris Lesiak <chris.lesiak@licor.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20210308100219.2732156-2-linus.walleij@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2019-05-30treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156Thomas Gleixner1-15/+1
Based on 1 normalized pattern(s): 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 if not write to the free software foundation inc 59 temple place suite 330 boston ma 02111 1307 usa extracted by the scancode license scanner the SPDX license identifier GPL-2.0-or-later has been chosen to replace the boilerplate/reference in 1334 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Richard Fontana <rfontana@redhat.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190527070033.113240726@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-04-15hwmon: (ntc_thermistor) Use new HWMON_CHANNEL_INFO() macroGuenter Roeck1-22/+2
The new macro is indeed quite useful. Let's use it. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-03-29hwmon: (ntc_thermistor) Fix temperature type reportingGuenter Roeck1-1/+1
Commit 7cc7de93fad4 ("hwmon: (ntc_thermistor) Convert to new hwmon API") converted the driver to use the new hwmon API, but introduced a subtle error: The temperature type is no longer reported as temp1_type, but as temp2_type. Fixes: 7cc7de93fad4 ("hwmon: (ntc_thermistor) Convert to new hwmon API") Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2019-02-23hwmon: (ntc_thermistor) Convert to new hwmon APIGuenter Roeck1-40/+66
Use devm_hwmon_device_register_with_info() instead of devm_hwmon_device_register_with_groups() to register the hwmon device to simplify the code and make it easier to maintain. As part of this change, thermal device registration is moved into the hwmon core. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16hwmon: (ntc_thermistor) Auto-convert to use SENSOR_DEVICE_ATTR_{RO, RW, WO}Guenter Roeck1-6/+6
Conversion was done done using the coccinelle script at https://github.com/groeck/coccinelle-patches/raw/master/hwmon/sensor-devattr-w6.cocci Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16hwmon: (ntc_thermistor) use a table to lookup the thermistor typePeter Rosin1-26/+21
Sort the entries while at it. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16hwmon: (ntc_thermistor) sort thermistor id lists alphabeticallyPeter Rosin1-33/+49
Use an enum to index the array, so that it is possible to add sorted entries without causing churn. Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2018-12-16hwmon: (ntc_thermistor): add support for B57891S0103 from EpcosPeter Rosin1-2/+55
More of the same... Signed-off-by: Peter Rosin <peda@axentia.se> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-09-08hwmon: (ntc_thermistor) Use devm_hwmon_device_register_with_groupsGuenter Roeck1-48/+9
Simplify code, reduce code size, and drop remove function as no longer needed. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-09-08hwmon: (ntc_thermistor) Use dev instead of &pdev->dev where possibleGuenter Roeck1-27/+25
Instead of repeatedly accessing &pdev->dev, use a local variable dev instead where possible. Also drop 'dev' from private data since it is unnecessary. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-09-08hwmon: (ntc_thermistor) Use devm_iio_channel_getGuenter Roeck1-11/+1
Use devm_iio_channel_get() instead of iio_channel_get to simplify error handling and device removal. Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2016-05-17hwmon: convert ntc_thermistor to use devm_thermal_zone_of_sensor_registerEduardo Valentin1-8/+4
This changes the driver to use the devm_ version of thermal_zone_of_sensor_register and cleans up the local points and unregister calls. Cc: Jean Delvare <jdelvare@suse.com> Cc: Guenter Roeck <linux@roeck-us.net> Cc: lm-sensors@lm-sensors.org Cc: linux-kernel@vger.kernel.org Acked-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2016-03-05hwmon: (ntc_thermistor) Add support for ncpXXxh103Joseph McNally1-0/+44
This patch adds support for the Murata NCP15XH103 thermistor series. Signed-off-by: Joseph McNally <jmcna06@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-08-03thermal: consistently use int for temperaturesSascha Hauer1-1/+1
The thermal code uses int, long and unsigned long for temperatures in different places. Using an unsigned type limits the thermal framework to positive temperatures without need. Also several drivers currently will report temperatures near UINT_MAX for temperatures below 0°C. This will probably immediately shut the machine down due to overtemperature if started below 0°C. 'long' is 64bit on several architectures. This is not needed since INT_MAX °mC is above the melting point of all known materials. Consistently use a plain 'int' for temperatures throughout the thermal code and the drivers. This only changes the places in the drivers where the temperature is passed around as pointer, when drivers internally use another type this is not changed. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Reviewed-by: Darren Hart <dvhart@linux.intel.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Reviewed-by: Peter Feuerer <peter@piie.net> Cc: Punit Agrawal <punit.agrawal@arm.com> Cc: Zhang Rui <rui.zhang@intel.com> Cc: Eduardo Valentin <edubezval@gmail.com> Cc: linux-pm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Jean Delvare <jdelvare@suse.de> Cc: Peter Feuerer <peter@piie.net> Cc: Heiko Stuebner <heiko@sntech.de> Cc: Lukasz Majewski <l.majewski@samsung.com> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: linux-acpi@vger.kernel.org Cc: platform-driver-x86@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-omap@vger.kernel.org Cc: linux-samsung-soc@vger.kernel.org Cc: Guenter Roeck <linux@roeck-us.net> Cc: Rafael J. Wysocki <rjw@rjwysocki.net> Cc: Maxime Ripard <maxime.ripard@free-electrons.com> Cc: Darren Hart <dvhart@infradead.org> Cc: lm-sensors@lm-sensors.org Signed-off-by: Zhang Rui <rui.zhang@intel.com>
2015-06-03hwmon: (ntc_thermistor) Improve precision of resistance calculationChris Lesiak1-13/+10
The function get_ohm_of_thermistor has both the measured voltage and the pullup voltage available in microvolts. But it was promptly converting both to millivolts before using them to calculate the thermistor resistance. That conversion unnecessarily hurt the precision of the calculation. For example, take the ncpXXwb473 connected to 5000 mV and pulled down through a 47000 ohm resistor. At 25 C, the resistance of the thermistor is 47000 ohms. The measured voltage will be 2500 mV. If we measure instead 2501 mV, then the calculated resistance will be 46962 ohms -- a difference of 38 ohms. So the precision of the resistance estimate could be increased by 38X by doing the calculations in microvolts. Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-06-02hwmon: (ntc_thermistor) fix iio raw to microvolts conversionChris Lesiak1-7/+8
The function ntc_adc_iio_read was assuming both a 12 bit ADC and that pullup_uv is the same as the ADC reference voltage. If either assumption is false, then the result is incorrect. Attempt to use iio_convert_raw_to_processed to convert the raw value to microvolts. It will fail for iio channels that don't support support IIO_CHAN_INFO_SCALE; in that case fall back to the assumptions. Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-31hwmon: (ntc_thermistor) Add support for ncpXXwf104Beomho Seo1-0/+44
This patch adds support for the ntc thermistor NCPXXWF104 series. Cc: Jean Delvare <jdelvare@suse.de> Cc: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Beomho Seo <beomho.seo@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2015-05-26hwmon: (ntc_thermistor) Ensure iio channel is of type IIO_VOLTAGEChris Lesiak1-0/+9
When configured via device tree, the associated iio device needs to be measuring voltage for the conversion to resistance to be correct. Return -EINVAL if that is not the case. Signed-off-by: Chris Lesiak <chris.lesiak@licor.com> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-12-17Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linuxLinus Torvalds1-1/+5
Pull thermal management update from Zhang Rui: "Summary: - of-thermal extension to allow drivers to register and use its functionality in a better way, without exploiting thermal core. From Lukasz Majewski. - Fix a bug in intel_soc_dts_thermal driver which calls a sleep function in interrupt handler. From Maurice Petallo. - add a thermal UAPI header file for exporting the thermal generic netlink information to user-space. From Florian Fainelli. - First round of refactoring in Exynos driver. Bartlomiej and Lukasz are attempting to make it lean and easier to understand. - New thermal driver for Rockchip (rk3288), with support for DT thermal. From Caesar Wang. - New thermal driver for Nvidia, Tegra124 SOCTHERM driver, with support for DT thermal. From Mikko Perttunen. - New cooling device, based on common clock framework. From Eduardo Valentin. - a couple of small fixes in thermal core framework. From Srinivas Pandruvada, Javi Merino, Luis Henriques. - Dropping Armada A375-Z1 SoC thermal support as the chip is not in the market, armada folks decided to drop its support. - a couple of small fixes and cleanups in int340x thermal driver" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (58 commits) thermal: provide an UAPI header file Thermal/int340x: Clear the error value of the last acpi_bus_get_device() call thermal/powerclamp: add id for braswell cpu thermal: Intel SoC DTS: Don't do thermal zone update inside spin_lock Thermal: fix platform_no_drv_owner.cocci warnings Thermal/int340x: avoid unnecessary pointer casting thermal: int3403: Delete a check before thermal_zone_device_unregister() thermal/int3400: export uuids thermal: of: Extend current of-thermal.c code to allow setting emulated temp thermal: of: Extend of-thermal to export table of trip points thermal: of: Rename struct __thermal_trip to struct thermal_trip thermal: of: Extend of-thermal.c to provide check if trip point is valid thermal: of: Extend of-thermal.c to provide number of trip points thermal: Fix error path in thermal_init() thermal: lock the thermal zone when switching governors thermal: core: ignore invalid trip temperature thermal: armada: Remove support for A375-Z1 SoC thermal: rockchip: add driver for thermal dt-bindings: document Rockchip thermal thermal: exynos: remove exynos_tmu_data.h include ...
2014-11-20thermal: of: improve of-thermal sensor registration APIEduardo Valentin1-1/+5
Different drivers request API extensions in of-thermal. For this reason, additional callbacks are required to fit the new drivers needs. The current API implementation expects the registering sensor driver to provide a get_temp and get_trend callbacks as function parameters. As the amount of callbacks is growing, this patch changes the existing implementation to use a .ops field to hold all the of thermal callbacks to sensor drivers. This patch also changes the existing of-thermal users to fit the new API design. No functional change is introduced in this patch. Cc: Alexandre Courbot <gnurou@gmail.com> Cc: devicetree@vger.kernel.org Cc: Grant Likely <grant.likely@linaro.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jean Delvare <jdelvare@suse.de> Cc: linux-kernel@vger.kernel.org Cc: linux-pm@vger.kernel.org Cc: linux-tegra@vger.kernel.org Cc: lm-sensors@lm-sensors.org Cc: Rob Herring <robh+dt@kernel.org> Cc: Stephen Warren <swarren@wwwdotorg.org> Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Zhang Rui <rui.zhang@intel.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Tested-by: Mikko Perttunen <mikko.perttunen@kapsi.fi> Reviewed-by: Mikko Perttunen <mikko.perttunen@kapsi.fi> Reviewed-by: Alexandre Courbot <acourbot@nvidia.com> Reviewed-by: Lukasz Majewski <l.majewski@samsung.com> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
2014-10-20hwmon: drop owner assignment from platform_driversWolfram Sang1-1/+0
A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
2014-09-22hwmon: (ntc_thermistor) Add ntc thermistor to thermal subsystem as a sensor.Jonghwa Lee1-0/+25
To get more comprehensive and integrated thermal management, it adds ntc thermistor to thermal framework as a thermal sensor. It's governed thermal susbsystem only if it is described in DT node. Otherwise, it just notifies temperature to userspace via sysfs as it used to be. Signed-off-by: Jonghwa Lee <jonghwa3.lee@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-08-04hwmon: (ntc_thermistor) Support B57330V2103 from EPCOSJohannes Pointner1-1/+49
This patch adds support for the ntc thermistor B57330V2103 from EPCOS. Signed-off-by: Johannes Pointner <johannes.pointner@gmail.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-06-29hwmon: (ntc_thermistor) Correct information printed during probeNaveen Krishna Chatradhi1-1/+1
Currently, dev_info() at the end of the probe says "type:%s ". But, prints pdev->name. This patch uses "pdev_id->name" which prints the thermistor type. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-06-25hwmon: (ntc_thermistor) Use the manufacturer name properlyNaveen Krishna Chatradhi1-1/+13
Murata Manufacturing Co., Ltd is the vendor for NTC (Negative Temperature coefficient) based Thermistors. But, the driver extensively uses "NTC" as the vendor name. This patch corrects the vendor name also updates the compatibility strings according to the vendor-prefix.txt Note: Drivers continue to support the previous compatible strings but further addition of these compatible strings in device tree is deprecated. Signed-off-by: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Reviewed-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2014-05-25hwmon: (ntc_thermistor) Fix OF device ID mappingJean Delvare1-5/+6
The mapping from OF device IDs to platform device IDs is wrong. TYPE_NCPXXWB473 is 0, TYPE_NCPXXWL333 is 1, so ntc_thermistor_id[TYPE_NCPXXWB473] is { "ncp15wb473", TYPE_NCPXXWB473 } while ntc_thermistor_id[TYPE_NCPXXWL333] is { "ncp18wb473", TYPE_NCPXXWB473 }. So the name is wrong for all but the "ntc,ncp15wb473" entry, and the type is wrong for the "ntc,ncp15wl333" entry. So map the entries by index, it is neither elegant nor robust but at least it is correct. Signed-off-by: Jean Delvare <jdelvare@suse.de> Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver Reviewed-by: Guenter Roeck <linux@roeck-us.net> Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Cc: Doug Anderson <dianders@chromium.org>
2014-05-25hwmon: (ntc_thermistor) Fix dependenciesJean Delvare1-1/+3
In commit 9e8269de, support was added for ntc_thermistor devices being declared in the device tree and implemented on top of IIO. With that change, a dependency was added to the ntc_thermistor driver: depends on (!OF && !IIO) || (OF && IIO) This construct has the drawback that the driver can no longer be selected when OF is set and IIO isn't, nor when IIO is set and OF is not. This is a regression for the original users of the driver. As the new code depends on IIO and is useless without OF, include it only if both are enabled, and set the dependencies accordingly. This is clearer, more simple and more correct. Signed-off-by: Jean Delvare <jdelvare@suse.de> Fixes: 9e8269de hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driver Reviewed-by: Guenter Roeck <linux@roeck-us.net> Cc: Naveen Krishna Chatradhi <ch.naveen@samsung.com> Cc: Doug Anderson <dianders@chromium.org>
2014-02-13hwmon: (ntc_thermistor) Avoid math overflowDoug Anderson1-3/+3
The ntc thermistor code was doing math whose temporary result might have overflowed 32-bits. We need some casts in there to make it safe. In one example I found: - pullup_uV: 1800000 - result of iio_read_channel_raw: 3226 - 1800000 * 3226 => 0x15a1cbc80 Signed-off-by: Doug Anderson <dianders@chromium.org> Cc: stable@vger.kernel.org # 3.10+ Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-08-11hwmon: use dev_get_platdata()Jingoo Han1-1/+1
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 Kamat1-1/+0
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 Roeck1-108/+108
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
2013-04-07hwmon: (ntc_thermistor) Add DT with IIO support to NTC thermistor driverNaveen Krishna Chatradhi1-19/+126
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 Kamat1-2/+2
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 Pemberton1-1/+1
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 Pemberton1-1/+1
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 Pemberton1-1/+1
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 Roeck1-1/+1
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 Roeck1-6/+6
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>