aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/meson_saradc.c
AgeCommit message (Collapse)Author
2023-08-11meson saradc: fix clock divider mask lengthGeorge Stark
commit c57fa0037024c92c2ca34243e79e857da5d2c0a9 upstream. According to the datasheets of supported meson SoCs length of ADC_CLK_DIV field is 6-bit. Although all supported SoCs have the register with that field documented later SoCs use external clock rather than ADC internal clock so this patch affects only meson8 family (S8* SoCs). Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Signed-off-by: George Stark <GNStark@sberdevices.ru> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Link: https://lore.kernel.org/r/20230606165357.42417-1-gnstark@sberdevices.ru Cc: <stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-11-06iio: adc: meson_saradc: Fix memory allocation orderRemi Pommarel
[ Upstream commit de10ac47597e7a3596b27631d0d5ce5f48d2c099 ] meson_saradc's irq handler uses priv->regmap so make sure that it is allocated before the irq get enabled. This also fixes crash when CONFIG_DEBUG_SHIRQ is enabled, as device managed resources are freed in the inverted order they had been allocated, priv->regmap was freed before the spurious fake irq that CONFIG_DEBUG_SHIRQ adds called the handler. Fixes: 3af109131b7eb8 ("iio: adc: meson-saradc: switch from polling to interrupt mode") Reported-by: Elie Roudninski <xademax@gmail.com> Signed-off-by: Remi Pommarel <repk@triplefau.lt> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Elie ROUDNINSKI <xademax@gmail.com> Reviewed-by: Kevin Hilman <khilman@baylibre.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12iio: adc: meson-saradc: fix internal clock namesMartin Blumenstingl
[ Upstream commit 50314f98b0ac468218e7c9af8c99f215a35436df ] Before this patch we are registering the internal clocks (for example on Meson8b, where the SAR ADC IP block implements the divider and gate clocks) with the following names: - /soc/cbus@c1100000/adc@8680#adc_div - /soc/cbus@c1100000/adc@8680#adc_en This is bad because the common clock framework uses the clock to create a directory in <debugfs>/clk. With such name, the directory creation (silently) fails and the debugfs entry ends up being created at the debugfs root. With this change, the new clock names are: - c1108680.adc#adc_div - c1108680.adc#adc_en This matches the clock naming scheme used in the PWM, Ethernet and MMC drivers. It also fixes the problem with debugfs. The idea is shamelessly taken from commit b96e9eb62841c5 ("pwm: meson: Fix mux clock names"). Fixes: 3921db46a8c5bc ("iio: Convert to using %pOF instead of full_name") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-02-12iio: adc: meson-saradc: check for devm_kasprintf failureNicholas Mc Guire
[ Upstream commit aad172b017617994343e36d8659c69e14cd694fd ] devm_kasprintf() may return NULL on failure of internal allocation thus the assignments to init.name are not safe if not checked. On error meson_sar_adc_clk_init() returns negative values so -ENOMEM in the (unlikely) failure case of devm_kasprintf() should be fine here. Signed-off-by: Nicholas Mc Guire <hofrat@osadl.org> Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
2018-07-23iio: adc: meson-saradc: add support for the Meson8m2 SoCsMartin Blumenstingl
The SAR ADC on Meson8m2 behaves identical to the one found in the Meson8b SoCs. Add a separate compatible string because the temperature sensor logic (not supported yet) differs between Meson8 and Meson8m2 (however, it's the same for Meson8b and Meson8m2). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-05-11Merge tag 'iio-for-4.18a' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next Jonathan writes: 1st round of IIO new device support, features and cleanup for the 4.18 cycle A nice mix this time of excellent cleanups (many to send drivers speeding toward staging graduations) and new drivers / device support. A good part of this is Brian Masney's never ending task on the tsl2x7x driver. The end is in sight so hopefully we'll get that one out of staging very soon! New device support * AD5686 - Support AD5685R (was wrongly present as AD5685) - Support AD5672R, AD5676, AD5676, AD5684R and AD5686R 4 and 8 channel SPI DACs with various precisions. - Support AD5671R, AD5675R, AD5694, AD5694R, AD5695R, AD5696 and AD5696R I2C DACs with various percisions and numbers of channels. * Analog front end rescale driver - New driver. - Support current sensing usings a shunt resistor. - Support simple voltage dividers. - support simple current sense amplifiers. * TI dac5571 - New driver and device bindings supporting: dac5571, dac6571, dac7571, dac5574, dac6574, dac7574, dac5573, dac6573 and dac7573 * Meson-adc - Support for Meson AXG with DT bindings. * mpu6050 - Support the mpu9255 which only requires additional WHOAMI entry and compatible string. * st_lsm6dsx - Support for lsm330dlc combinded accelerometer and gyro sensors with DT bindings. * stm32_adc - Add support for STM32MP1 with bindings. Staging graduations * adis16201 after some excelent cleanup by Himanshu Jha. * adis16029 after some excelent cleanup by Shreeya Patel. New features: * ABI docs - Add core ABI docs for angle channels. * inv_mpu6050 - Provide support for the full range of interrupts the device supports. * st_accel - Add SMO8840 ACPI ID seen in the wild on some Lenovo machines. * stx104 - Provide a multiple gpio get function. Cleanups / Minor fixes * core - Use new nested structure support to improve kernel-doc. * ad2s1200 - Use be16_to_cpup instead of opencoding. * ad5686 - Indentation tidy up. - Switch to SPDX - Refactor to allow various numbers of channels. - Refactor to separate core and SPI specific support, prior to addition of i2c equivalent devices. * ad7606 - Use drvdata directly from device rather than boucing via the platform_device structure. * ad7746 - Replace opencoded byte swapped i2c calls with _swapped variants. - White space and line break readability improvements. - Reorder includes and variable declarations where appropriate. * ad7791 - Changes to the AD ADC library used by this driver took in the sampling frequency. This lead to be the wrong path being the one tied to the resulting attribute, so it didn't work, and a warning to be printed. * ad7780 - Remove apparent support for sampling frequency control on devices that don't support changing the sampling attributes. * ade7854 - Fix a read of the wrong number of bits. - Improve error handling on i2c read/write errors. - Rework i2c and spi code to reduce duplication. * adis16201 (staging) - Improve meaning inherent in some macro names by adding units etc where relevant. - Adjust comments to improve detail and drop the irrelevant. - Rename register address definitions definitions to add a _REG postfix, clearly separating them from field definitions. Reorganize the definitions to group register address and fields. - Use sign_extend32 rather than open coding. - Reverse Xmas tree ordering where appropriate and align function args. - Remove unused headers. - Use GENMASK where appropriate instead of open coding. * adis16209 (staging) - Indent field definitions to visually separate them from register address definitions. - Use reverse xmas tree ordering where appropriate. - Add some whitespace where it will help readability. - Drop some unused headers. - Use GENMASK where appropriate. * ad2s1200 - Drop unnecessary includes and reorder alphabetically. - Reverse xmas tree and blank line cleanups. * atlas-ph-sensor - Use msleep instead of usleep_range where the precise value doesn't matter and the delays are long. * bcm150 - Drop transaction splitting as core now handles it. * cros_ec - Move the shared header to the include/iio/common directory. This brings it inline with the other multiple type devices. - Use drvdata directly from device rather than boucing via the platform_device structure. * hid-sensors - Use drvdata directly from device rather than boucing via the platform_device structure. * inv_mpu6050 - Clear out a second function definition for the same function. - Don't flush fifo when the iio buffer is full but just drop excess data. - Tidy up set_power_itg and ensure it is used in the right places. - Use set_power_itg rather than opencoding it again in the i2c mux control. - Make sure error paths disable the power if undoing power on. - Used managed devm_ functions during probe. Delete remove function. - Refactor to pull raw data read out of read_raw function. - Simplify data reading error paths. - Only enable the i2c mux for chips with the i2c aux bus (not icm20608) - Fix a potential deadlock due to varying lock ordering. - Fix an issue where first sample from gyro after enabling is unstable by dropping the first sample. - Fix an issue where the user_ctrl register is incorrectly overwritten. - Tidy up some grammar and spelling minor issus. * mcp320x - Use vendor compatible strings. * mcp4018 - Switch to using i2c .probe_new. * mcp4351 - switch to using i2c .probe_new. * meson-adc - rework handing on common ADC platform data so it can be shared across multiple families of SoCs. * sca3000 - Fix an error handling path if the ring configure fails. * st_lsm6dsx - Fix a wrong fifo threshold mask (no actual effect) * stm32-dfsdm - Style fixes and cleanups. - Check filter ID is in range and check spi-max-frequency. * tsl2x7x (staging) - Drop some unnecessary function calls, unused variables and unnecessary local variables. - Fix wrong interrupt type. - Avoid unnecessary double clear of interrupt. - Simplify proximity calibration call which did various things unrelated to actually calibrating. - Separate control of the proximity and ALS interrupts. - Improve consistency of logging. - Separate ALS and proximity persistence settings as they have separate hardware controls. - Tidy up variable ordering. - Add Brian to copyright notice given consider work on this driver. - Take advantage of hardware support for I2C address auto increment. - Combine individuaal enable and period attributes for the two directions on the threshold events into a single value as the hardware doesn't separate them. - Move integration_time* attributes from light channel to intensity value as they effect the intensity readings directly and the light reading only indirectly. Hence this better reflects reality. Also move the calibscale_available. - Avoid returning an error in the IRQ handler. - Hard code the reg value in _clear_interrupts as it only takes one value in the code. Result is the function has little purpose so opencode the two remaining i2c_smbus_write_byte calls. - Drop some unnecessary checking of the chip status register. - Tidy up return path in _write_interrupt_config. - Tidy up the ID verification code. - Move the power and diode settings defines into the header as these are needed for platform data configuration. - Various renames and comment cleanups for consistency and clarity. - Use actual device defaults for default startup settings. - SPDX - Add some range sanity checking to sysfs attribute writes. - Don't provide event interfaces if the interrupt line isn't available. - Use IIO_CONST_ATTR macro for calibscale_available as it's a constant string. - Fix the integration time and lux equations. - Make device IDs explicit index values in the device_channel_config array.
2018-03-30iio: adc: meson-saradc: add support for Meson AXGXingyu Chen
Add the SAR ADC driver for the Amlogic Meson-AXG SoC. Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-30iio: adc: meson-saradc: squash and share the common adc platform dataYixun Lan
Extract and promote common adc platform data into a new structure, to make it better share the info between several SoCs, this will avoid duplicating the code all over the place, Save a few memory and make the code more maintainable. Signed-off-by: Yixun Lan <yixun.lan@amlogic.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-03-10iio: adc: meson-saradc: unlock on error in meson_sar_adc_lock()Dan Carpenter
The meson_sar_adc_lock() function is not supposed to hold the "indio_dev->mlock" on the error path. Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2018-01-08iio: adc: meson-saradc: program the channel muxes during initializationMartin Blumenstingl
On some Meson8 devices the channel muxes are not programmed. This results in garbage values when trying to read channels that are not set up. Fix this by initializing the channel 0 and 1 muxes in MESON_SAR_ADC_CHAN_10_SW as well as the muxes for all other channels in MESON_SAR_ADC_AUX_SW based on what the vendor driver does (which is simply a 1:1 mapping of channel number and channel mux). This only showed up on Meson8 devices, because for GXBB and newer BL30 is taking care of initializing the channel muxes. This additionally fixes a typo in the MESON_SAR_ADC_AUX_SW_MUX_SEL_CHAN_MASK macro because the old definition assumed that the register fields were 2 bit wide, while they are actually 3 bit wide. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-01-08iio: adc: meson-saradc: fix the clock frequency on Meson8 and Meson8bMartin Blumenstingl
GX SoCs use a 1.2 MHz ADC clock, while the older SoCs use a 1.14 MHz clock. A comment in the driver from Amlogic's GPL kernel says that it's running at 1.28 MHz. However, it's actually programming a divider of 20 + 1. With a XTAL clock of 24 MHz this results in a frequency of 1.14 MHz. (their calculation might be based on a 27 MHz XTAL clock, but this is not what we have on the Meson8 and Meson8b SoCs). The ADC was still working with the 1.2MHz clock. In my own tests I did not see a difference between 1.2 and 1.14 MHz (regardless of the clock frequency used, the ADC results were identical). Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-06Merge Linus's staging merge point into staging-nextGreg Kroah-Hartman
This resolves the merge issue pointed out by Stephen in drivers/iio/adc/meson_saradc.c. Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-12-02iio: adc: meson-saradc: remove irrelevant clock "sana"Xingyu Chen
The "sana" clock is not used at SAR ADC module in Amlogic Meson SoC, it is irrelevant for the SAR ADC. Signed-off-by: Xingyu Chen <xingyu.chen@amlogic.com> Signed-off-by: Yixun Lan <yixun.lan@amlogic.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02iio: adc: meson-saradc: Meson8 and Meson8b do not have REG11 and REG13Martin Blumenstingl
The Meson GXBB and newer SoCs have a few more registers than the older Meson8 and Meson8b SoCs. Use a separate regmap config to limit the older SoCs to the DELTA_10 register. Fixes: 6c76ed31cd05 ("iio: adc: meson-saradc: add Meson8b SoC compatibility") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02iio: adc: meson-saradc: initialize the bandgap correctly on older SoCsMartin Blumenstingl
Meson8 and Meson8b do not have the MESON_SAR_ADC_REG11 register. The bandgap setting for these SoCs is configured in the MESON_SAR_ADC_DELTA_10 register instead. Make the driver aware of this difference and use the correct bandgap register depending on the SoC. This has worked fine on Meson8 and Meson8b because the bootloader is already initializing the bandgap setting. Fixes: 6c76ed31cd05 ("iio: adc: meson-saradc: add Meson8b SoC compatibility") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-12-02iio: adc: meson-saradc: fix the bit_idx of the adc_en clockMartin Blumenstingl
Meson8 and Meson8b SoCs use the the SAR ADC gate clock provided by the MESON_SAR_ADC_REG3 register within the SAR ADC register area. According to the datasheet (and the existing MESON_SAR_ADC_REG3_CLK_EN definition) the gate is on bit 30. The fls() function returns the last set bit, which is "bit index + 1" (fls(MESON_SAR_ADC_REG3_CLK_EN) returns 31). Fix this by switching to __ffs() which returns the first set bit, which is bit 30 in our case. This off by one error results in the ADC not being usable on devices where the bootloader did not enable the clock. Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
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-07-22iio: Convert to using %pOF instead of full_nameRob Herring
Now that we have a custom printf format specifier, convert users of full_name to use %pOF instead. This is preparation to remove storing of the full path string for each node. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Jonathan Cameron <jic23@kernel.org> Cc: Hartmut Knaack <knaack.h@gmx.de> Cc: Lars-Peter Clausen <lars@metafoo.de> Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net> Cc: Carlo Caione <carlo@caione.org> Cc: Kevin Hilman <khilman@baylibre.com> Cc: linux-iio@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-amlogic@lists.infradead.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-07-09iio: adc: meson-saradc: add NULL check on of_match_device() return valueGustavo A. R. Silva
Check return value from call to of_match_device() in order to prevent a NULL pointer dereference. In case of NULL print error message and return -ENODEV Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-06-20Merge 4.12-rc6 into staging-nextGreg Kroah-Hartman
We want the staging fixes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-06-11iio: adc: meson-saradc: fix potential crash in meson_sar_adc_clear_fifoMartin Blumenstingl
meson_sar_adc_clear_fifo passes a 0 as value-pointer to regmap_read(). In case of the meson-saradc driver this ends up in regmap_mmio_read(), where the value-pointer is de-referenced unconditionally to assign the value which was read. Fix this by passing an actual pointer, even though all we want to do is to discard the value. As a side-effect this fixes a sparse warning ("Using plain integer as NULL pointer") as reported by Paolo Cretaro. Fixes: 3adbf3427330 ("iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCs") Reported-by: Paolo Cretaro <paolocretaro@gmail.com> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-07iio: adc: meson-saradc: add Meson8b SoC compatibilityMartin Blumenstingl
Meson GX SoCs however use some magic bits to prevent simultaneous (= conflicting, because only consumer should use the FIFO buffer with the ADC results) usage by the Linux kernel and the bootloader (the BL30 bootloader uses the SAR ADC to read the CPU temperature). This patch changes guards all BL30 functionality so it is skipped on SoCs which don't have it. Since the hardware itself doesn't know whether BL30 is available the internal meson_sar_adc_data is extended so this information can be provided per of_device_id.data inside the driver. Additionally the clocks "adc_clk" and "adc_sel" are not provided by the clock-controller itself. "adc_sel" is not available at all. "adc_clk" is provided by the SAR ADC IP block itself on Meson8b (and earlier). This is already supported by the meson_saradc driver. Finally this introduces new of_device_ids for the Meson8 and Meson8b SoCs so the driver can be wired up in the corresponding DT. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-07iio: adc: meson-saradc: mark all meson_sar_adc_data static and constMartin Blumenstingl
These are only passed as of_device_id.data and never modified. Thus we can mark them as static const, just like the of_device_id instances where they are used. Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-03-25iio: adc: meson-saradc: add calibrationHeiner Kallweit
This patch adds calibration for the Meson SAR ADC. Points 25% vref and 75% vref are used for calibration. It uses a simple linear calibration function: SCALE * val + BIAS Successfully tested on a Odroid C2. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-19iio: adc: meson-saradc: improve meson_sar_adc_read_raw_sampleHeiner Kallweit
After sampling there should always be only one value in the FIFO. This also applies to averaging mode as the averaging is done chip-internally. So we don't have to loop and let the driver complain if there's not exactly one value in the FIFO. If the value belongs to a different channel then don't silently swallow the value but complain. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-02-19iio: adc: meson-saradc: switch from polling to interrupt modeHeiner Kallweit
Switch from polling to interrupt mode. Successfully tested on a S905GXBB-based Odroid C2. Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com> Acked-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-01-28iio: adc: add a driver for the SAR ADC found in Amlogic Meson SoCsMartin Blumenstingl
This adds support for the SAR (Successive Approximation Register) ADC on the Amlogic Meson SoCs. The code is based on the public S805 (Meson8b) and S905 (GXBB) datasheets (see [0] and [1]), as well as by reading (various versions of) the vendor driver and by inspecting the registers on the vendor kernels of my testing-hardware. Currently the GXBB, GXL and GXM SoCs are supported. GXBB hardware has 10-bit ADC resolution, while GXL and GXM have 12-bit ADC resolution. The code was written to support older SoCs (Meson8 and Meson8b) as well, but due to lack of actual testing-hardware no of_device_id was added for these. Two "features" from the vendor driver are currently missing: - the vendor driver uses channel #7 for calibration (this improves the accuracy of the results - in my tests the results were less than 3% off without calibration compared to the vendor driver). Adding support for this should be easy, but is not required for most applications. - channel #6 is connected to the SoCs internal temperature sensor. Adding support for this is probably not so easy since (based on the u-boot sources) most SoC versions are using different registers and algorithms for the conversion from "ADC value" to temperature. Supported by the hardware but currently not supported by the driver: - reading multiple channels at the same time (the hardware has a FIFO buffer which stores multiple results) - continuous sampling (this would require a way to enable this individually because otherwise the ADC would be drawing power constantly) - interrupt support (similar to the vendor driver this new driver is polling the results. It is unclear if the IRQ-mode is supported on older (Meson6 or Meson8) hardware as well or if there are any errata) [0] http://dn.odroid.com/S805/Datasheet/S805_Datasheet%20V0.8%2020150126.pdf [1] http://dn.odroid.com/S905/DataSheet/S905_Public_Datasheet_V1.1.4.pdf Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Tested-by: Neil Armstrong <narmstrong@baylibre.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>