aboutsummaryrefslogtreecommitdiff
path: root/drivers/iio/adc/qcom-spmi-vadc.c
AgeCommit message (Collapse)Author
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 284Thomas Gleixner
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 version 2 and only version 2 as published by the free software foundation 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 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 294 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190529141900.825281744@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-22iio:adc: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron
The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
2017-04-08iio: adc: break out common code from SPMI VADCLinus Walleij
The SPMI VADC and the earlier XOADC share a subset of common code, so to be able to use the same code in both drivers, we break out a separate file with the common code, prefix exported functions that are no longer static with qcom_* and bake an object qcom-spmi-vadc.o that contains both files: qcom-vadc-common.o and qcom-spmi-vadc-core.o. As we need to follow the procedure for making a kernel module or compiled in object from several files, but still want to produce the same module name, rename the qcom-spmi-vadc.c file to qcom-spmi-vadc-core.c so we can bake the two objects into qcom-spmi-vadc.o Cc: linux-arm-kernel@lists.infradead.org Cc: linux-arm-msm@vger.kernel.org Cc: Ivan T. Ivanov <iivanov.xz@gmail.com> Cc: Andy Gross <andy.gross@linaro.org> Cc: Bjorn Andersson <bjorn.andersson@linaro.org> Cc: Stephen Boyd <sboyd@codeaurora.org> Cc: Srinivas Kandagatla <srinivas.kandagatla@linaro.org> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-10iio:adc:qcom-spmi-vadc: use div64_s64 instead of direct 64 bit division.Jonathan Cameron
Another one of these that we missed previously which prevents test builds of this driver on 32 bit platforms as it gives an undefined __divdi3 warning. Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-10iio:adc:qcom-spmi-vadc silence a long constant warning.Jonathan Cameron
It is meant to be long and is only added to an s64. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-10iio:adc:qcom-spmi-vadc : fix undefined __divdi3Jonathan Cameron
A simple do_div call works here as all the signed 64 bit is actually small and unsigned at this point, and the numerator is u32. Introduce a temporary u64 variable to avoid type comparison warnings on some architectures. Signed-off-by: Jonathan Cameron <jic23@kernel.org> Reported-by: kbuild test robot <fengguang.wu@intel.com> Cc: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-10iio: adc: spmi-vadc: Changes to support different scalingRama Krishna Phani A
Several ADC channels are supported in PMIC which can be used to measure voltage, temperature, current etc. Different scaling can be applied on the obtained voltage to report in physical units. Scaling functionality can be different per channel. Add scaling support per channel. Every channel present in adc has an unique conversion formula for obtained voltage. Add support to report in Raw as well as in processed format. Scaling is applied when processed read is requested and is not applied when a Raw read is requested. Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2016-12-10iio: adc: spmi-vadc: Update function for generic voltage conversionRama Krishna Phani A
Several channels are supported in ADC of PMIC which can be used to measure voltage, temperature, current etc., Hardware provides readings for all channels in adc code. That adc code needs to be converted to voltage. Logic for conversion of adc code to voltage is common for all ADC channels(voltage, temperature, current .,etc). Implement separate function for generic conversion logic. Signed-off-by: Rama Krishna Phani A <rphani@codeaurora.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-21iio: adc: spmi-vadc: add missing of_node_putJulia Lawall
for_each_available_child_of_node performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. A simplified version of the semantic patch that fixes this problem is as follows (http://coccinelle.lip6.fr): // <smpl> @@ expression root,e; local idexpression child; @@ for_each_available_child_of_node(root, child) { ... when != of_node_put(child) when != e = child ( return child; | + of_node_put(child); ? return ...; ) ... } // </smpl> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-04-18iio: adc: spmi-vadc: Fix overflow in output value normalizationIvan T. Ivanov
With 'dx' equal to 0.625V and 15 bit ADC, calculations overflow when difference against GND is ~20% of the ADC range. Fix this. Signed-off-by: Ivan T. Ivanov <ivan.ivanov@linaro.org> Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-01-28iio: vadc: Qualcomm SPMI PMIC voltage ADC driverStanimir Varbanov
The voltage ADC is peripheral of Qualcomm SPMI PMIC chips. It has 15bits resolution and register space inside PMIC accessible across SPMI bus. The vadc driver registers itself through IIO interface. Signed-off-by: Stanimir Varbanov <svarbanov@mm-sol.com> Signed-off-by: Ivan T. Ivanov <iivanov@mm-sol.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>