summaryrefslogtreecommitdiff
path: root/drivers/iio/adc/lp8788_adc.c
AgeCommit message (Collapse)Author
2013-08-03iio: adc: lp8788_adc: Use devm_* APIsSachin Kamat
devm_* APIs are device managed and make code simpler. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Milo Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-03-17iio:adc:lp8778_adc move to info_mask_(shared_by_type/separate)Jonathan Cameron
The original info_mask is going away in favour of the broken out versions. Signed-off-by: Jonathan Cameron <jic23@kernel.org> cc: Milo(Woogyom) Kim <milo.kim@ti.com>
2013-02-02iio: Simplify iio_map_array_unregister APIiio-for-3.9cGuenter Roeck
Instead of requiring the map to unregister, simply unregister all map entries associated with the given iio device. This simplifies map removal and also works for maps generated through devicetree. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-02-02iio/adc: (lp8788) Provide OF node information to iio deviceGuenter Roeck
Signed-off-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-25Merge 3.8-rc5 into staging-nextGreg Kroah-Hartman
This resolves a merge issue with a iio driver, and the zram code. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-01-06iio: lp8788_adc: fix parent device in kernel messageKim, Milo
Use 'dev' of iio device in a kernel message rather than i2c client device node. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-06iio: lp8788_adc: fix a parent device in _probe()Kim, Milo
The lp8788-adc is a platform driver of lp8788-mfd. The platform device is allocated when mfd_add_devices() is called in lp8788-mfd. On the other hand, 'lp->dev' is the i2c client device. Therefore, this 'platform_device' is a proper parent device of iio device and device kernel message. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2013-01-03Drivers: iio: remove __dev* attributes.Greg Kroah-Hartman
CONFIG_HOTPLUG is going away as an option. As a result, the __dev* markings need to be removed. This change removes the use of __devinit, __devexit_p, and __devexit from these drivers. Based on patches originally written by Bill Pemberton, but redone by me in order to handle some of the coding style issues better, by hand. Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2012-09-22iio: adc: add new lp8788 adc driverKim, Milo
TI LP8788 PMU provides regulators, battery charger, ADC, RTC, backlight driver and current sinks. This patch enables the LP8788 ADC functions. The LP8788 ADC has several ADC input selection and supports 12bit resolution. Internal operation of getting ADC is access to registers of LP8788. The LP8788 ADC uses exported functions for accessing these registers. (exported by LP8788 MFD device driver) This driver supports IIO_CHAN_INFO_RAW and SCALE. So the IIO consumer can calculate the value with raw and scale. The unit of scale is micro. (ADC Input Selection) Voltage: battery voltage (MAX 5.0, 5.5 and 6.0V) charger input voltage four general ADC inputs coin cell voltage Current: battery charging current Temperature: IC temperature (The IIO map for the IIO consumer) The ADC input is configurable in the platform side. Even though this platform data is not defined, the default IIO map is created for supporting the power supply driver. The battery voltage and temperature are used inside this driver. (History) Patch v6. (a) Fix scale value for each ADC input selection Voltage and current type are mili unit and temperature is degree. To calculate the IC temperature, temp = raw * scaleint + (raw * scalepart)/ 1000000, scaleint is always 0. = raw * 0.061050, raw: 0 ~ 4095 Then range of IC temperature(ADC result) is 0 ~ 250'C (b) Reorganization of the IIO channel Spec Remove address, scan_type and scan_index and rollback the datasheet name. The reason why 'address' field is unnecessary is no relation with each channel. Moreover, to get the raw ADC value, the address info is not only one register but also several registers. Therefore specific function(lp8788_get_adc_result) is called rather than using one 'address' field. (c) Fix coding style Remove duplicated checking routine while unregistering the IIO map. Fix code for space and parenthesis. Patch v5. Fix default consumer name as 'lp8788-charger'. Add mutex for ADC read operation. Reorganization on lp8788_adc_read_raw(). Patch v4. Fix adc_raw function: support RAW and SCALE channel info. Change LP8788 ADC platform data - iio map. Enables the default IIO map. Patch v3. Fix wrong size of allocating iio private data. Fix coding styles. Patch v2. Support RAW and SCALE interface for IIO consumer. Clean up the iio channel spec macro. Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>