29 Mar, 2018
1 commit
-
commit 3c3e4b3a708a9d6451052e348981f37d2b3e92b0 upstream.
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
Cc:
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
19 Mar, 2018
1 commit
-
[ Upstream commit 2e64438487697f3f099946edc8acd4ceea6b1ab2 ]
Lower bits of the INA219/220 bus voltage register are conversion
status flags, properly shift the value.When reading via IIO buffer, the value is passed on unaltered,
shifting is the responsibility of the user.Signed-off-by: Stefan Brüns
Signed-off-by: Jonathan Cameron
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
28 Feb, 2018
1 commit
-
commit a3b5655ebdb501a98a45c0d3265dca9f2fe0218a upstream.
Error handling in stm32h7_adc_enable routine doesn't unwind enable
sequence correctly. ADEN can only be cleared by hardware (e.g. by
writing one to ADDIS).
It's also better to clear ADRDY just after it's been set by hardware.Fixes: 95e339b6e85d ("iio: adc: stm32: add support for STM32H7")
Signed-off-by: Fabrice Gasnier
Cc:
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
08 Feb, 2018
1 commit
-
commit 9a0ebbc93547d88f422905c34dcceebe928f3e9e upstream.
The module license checker complains about these two so just fix
it up. They are both GPLv2, both written by me or using code
I extracted while refactoring from the GPLv2 drivers.Cc: Randy Dunlap
Reported-by: Randy Dunlap
Signed-off-by: Linus Walleij
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
04 Feb, 2018
1 commit
-
commit 04e491ca9df60ffe8637d00d68e5ab8bc73b30d5 upstream.
By default, watermark is set to '1'. Watermark is used to fine tune
cyclic dma buffer period. In case watermark is left untouched (e.g. 1)
and several channels are being scanned, buffer period is wrongly set
(e.g. to 1 sample). As a consequence, data is never pushed to upper layer.
Fix buffer period size, by taking scan channels number into account.Fixes: 2763ea0585c9 ("iio: adc: stm32: add optional dma support")
Signed-off-by: Fabrice Gasnier
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
14 Dec, 2017
4 commits
-
commit 96748823c483c6eed8321f78bd128dd33f09c55c upstream.
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
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit d85eed9f576369bc90322659de96b7dbea1f9a57 upstream.
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
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit 7a6b0420d2fe4ce59437bd318826fe468f0d71ae upstream.
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
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman -
commit 81b039ec36a41a5451e1e36f05bb055eceab1dc8 upstream.
Function platform_get_irq_byname() returns a negative error code on
failure, and a zero or positive number on success. However, in function
cpcap_adc_probe(), positive IRQ numbers are also taken as error cases.
Use "if (ddata->irq < 0)" instead of "if (!ddata->irq)" to validate the
return value of platform_get_irq_byname().Signed-off-by: Pan Bian
Fixes: 25ec249632d50 ("iio: adc: cpcap: Add minimal support for CPCAP PMIC ADC")
Reviewed-by: Sebastian Reichel
Acked-by: Tony Lindgren
Signed-off-by: Jonathan Cameron
Signed-off-by: Greg Kroah-Hartman
10 Dec, 2017
1 commit
-
[ Upstream commit fe895ac88b9fbdf2026f0bfd56c82747bb9d7c48 ]
As user's guide "ADS1015EVM, ADS1115EVM, ADS1015EVM-PDK, ADS1115EVM-PDK
User Guide (Rev. B)" (http://www.ti.com/lit/ug/sbau157b/sbau157b.pdf)
states at page 16:
"Note that both the ADS1115 and ADS1015 have internal clocks with a ±10%
accuracy. If performing FFT tests, frequencies may appear to be incorrect
as a result of this tolerance range.", add those 10% to converion wait
time.Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Ladislav Michl
Reviewed-by: Akinobu Mita
Signed-off-by: Jonathan Cameron
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
15 Oct, 2017
1 commit
-
This fix allows platforms to probe correctly even if the
trigger edge property is missing. The hardware trigger
will no longer be registered in the sybsystem
Preserves backwards compatibility with the support that
was in the driver before the hardware trigger.https://storage.kernelci.org/mainline/master/v4.14-rc2-255-g74d83ec2b734/arm/sama5_defconfig/lab-free-electrons/boot-at91-sama5d2_xplained.txt
Signed-off-by: Eugen Hristev
Fixes: 5e1a1da0f ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Jonathan Cameron
08 Oct, 2017
1 commit
-
The dln2-adc driver uses interface(s) that are controlled by the
IIO_TRIGGERED_BUFFER Kconfig symbol, so the driver needs to select
that symbol to prevent the build error.drivers/iio/adc/dln2-adc.o: In function `dln2_adc_probe':
dln2-adc.c:(.text+0x528): undefined reference to `devm_iio_triggered_buffer_setup'Signed-off-by: Randy Dunlap
Reported-by: kbuild test robot
Cc: Jonathan Cameron
Cc: linux-iio@vger.kernel.org
Cc: Jack Andersen
Signed-off-by: Jonathan Cameron
25 Sep, 2017
1 commit
-
…/jic23/iio into staging-linus
Jonathan writes:
First round of IIO fixes for the 4.14 cycle
Note this includes fixes from recent merge window. As such the tree
is based on top of a prior staging/staging-next tree.* iio core
- return and error for a failed read_reg debugfs call rather than
eating the error.
* ad7192
- Use the dedicated reset function in the ad_sigma_delta library
instead of an spi transfer with the data on the stack which
could cause problems with DMA.
* ad7793
- Implement a dedicate reset function in the ad_sigma_delta library
and use it to correctly reset this part.
* bme280
- ctrl_reg write must occur after any register writes
for updates to take effect.
* mcp320x
- negative voltage readout was broken.
- Fix an oops on module unload due to spi_set_drvdata not being called
in probe.
* st_magn
- Fix the data ready line configuration for the lis3mdl. It is not
configurable so the st_magn core was assuming it didn't exist
and so wasn't consuming interrupts resulting in an unhandled
interrupt.
* stm32-adc
- off by one error on max channels checking.
* stm32-timer
- preset should not be buffered - reorganising register writes avoids
this.
- fix a corner case in which write preset goes wrong when a timer is
used first as a trigger then as a counter with preset. Odd case but
you never know.
* ti-ads1015
- Fix setting of comparator polarity by fixing bitfield definition.
* twl4030
- Error path handling fix to cleanup in event of regulator
registration failure.
- Disable the vusb3v1 regulator correctly in error handling
- Don't paper over a regulator enable failure.
24 Sep, 2017
8 commits
-
The serial interface can be reset by writing 32 consecutive 1s to the device.
'ret' was initialized correctly but its value was overwritten when
ad7793_check_platform_data() was called. Since a dedicated reset function
is present now, it should be used instead.Fixes: 2edb769d246e ("iio:ad7793: Add support for the ad7798 and ad7799")
Signed-off-by: Dragos Bogdan
Acked-by: Lars-Peter Clausen
Cc:
Signed-off-by: Jonathan Cameron -
Since most of the SD ADCs have the option of reseting the serial
interface by sending a number of SCLKs with CS = 0 and DIN = 1,
a dedicated function that can do this is usefull.Needed for the patch: iio: ad7793: Fix the serial interface reset
Signed-off-by: Dragos Bogdan
Acked-by: Lars-Peter Clausen
Cc:
Signed-off-by: Jonathan Cameron -
Commit f686a36b4b79 ("iio: adc: mcp320x: Add support for mcp3301")
returns a signed voltage from mcp320x_adc_conversion() but neglects that
the caller interprets a negative return value as failure. Only mcp3301
(and the upcoming mcp3550/1/3) is affected as the other chips are
incapable of measuring negative voltages.Fix and while at it, add mcp3301 to the list of supported chips at the
top of the file.Fixes: f686a36b4b79 ("iio: adc: mcp320x: Add support for mcp3301")
Cc: Andrea Galbusera
Signed-off-by: Lukas Wunner
Cc:
Signed-off-by: Jonathan Cameron -
The driver calls spi_get_drvdata() in its ->remove hook even though it
has never called spi_set_drvdata(). Stack trace for posterity:Unable to handle kernel NULL pointer dereference at virtual address 00000220
Internal error: Oops: 5 [#1] SMP ARM
[] (mutex_lock) from [] (iio_device_unregister+0x24/0x7c [industrialio])
[] (iio_device_unregister [industrialio]) from [] (mcp320x_remove+0x20/0x30 [mcp320x])
[] (mcp320x_remove [mcp320x]) from [] (spi_drv_remove+0x2c/0x44)
[] (spi_drv_remove) from [] (__device_release_driver+0x98/0x134)
[] (__device_release_driver) from [] (driver_detach+0xdc/0xe0)
[] (driver_detach) from [] (bus_remove_driver+0x5c/0xb0)
[] (bus_remove_driver) from [] (driver_unregister+0x38/0x58)
[] (driver_unregister) from [] (mcp320x_driver_exit+0x14/0x1c [mcp320x])
[] (mcp320x_driver_exit [mcp320x]) from [] (SyS_delete_module+0x184/0x1d0)
[] (SyS_delete_module) from [] (ret_fast_syscall+0x0/0x1c)Fixes: f5ce4a7a9291 ("iio: adc: add driver for MCP3204/08 12-bit ADC")
Cc: Oskar Andero
Signed-off-by: Lukas Wunner
Cc:
Signed-off-by: Jonathan Cameron -
Fix a bad error check when counting 'st,adc-channels' array elements.
This is seen when all channels are in use simultaneously.Fixes: 64ad7f643 ("iio: adc: stm32: introduce compatible data cfg")
Signed-off-by: Fabrice Gasnier
Cc:
Signed-off-by: Jonathan Cameron -
… 'twl4030_madc_probe()'
If we can not enable the regulator, go through the error handling path
instead of silently continuing.Fixes: 7cc97d77ee8a ("iio: adc: twl4030: Fix ADC[3:6] readings")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> -
…twl4030_madc_probe()'
Commit 7cc97d77ee8a has introduced a call to 'regulator_disable()' in the
.remove function.
So we should also have such a call in the .probe function in case of
error after a successful 'regulator_enable()' call.Add a new label for that and use it.
Fixes: 7cc97d77ee8a ("iio: adc: twl4030: Fix ADC[3:6] readings")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> -
If 'devm_regulator_get()' fails, we should go through the existing error
handling path instead of returning directly, as done is all the other
error handling paths in this function.Fixes: 7cc97d77ee8a ("iio: adc: twl4030: Fix ADC[3:6] readings")
Signed-off-by: Christophe JAILLET
Cc:
Signed-off-by: Jonathan Cameron
08 Sep, 2017
1 commit
-
Pull MFD updates from Lee Jones:
"New Drivers
- RK805 Power Management IC (PMIC)
- ROHM BD9571MWV-M MFD Power Management IC (PMIC)
- Texas Instruments TPS68470 Power Management IC (PMIC) & LEDsNew Device Support:
- Add support for HiSilicon Hi6421v530 to hi6421-pmic-core
- Add support for X-Powers AXP806 to axp20x
- Add support for X-Powers AXP813 to axp20x
- Add support for Intel Sunrise Point LPSS to intel-lpss-pciNew Functionality:
- Amend API to provide register layout; atmel-smcFix-ups:
- DT re-work; omap, nokia
- Header file location change {I2C => MFD}; dm355evm_msp, tps65010
- Fix chip ID formatting issue(s); rk808
- Optionally register touchscreen devices; da9052-core
- Documentation improvements; twl-core
- Constification; rtsx_pcr, ab8500-core, da9055-i2c, da9052-spi
- Drop unnecessary static declaration; max8925-i2c
- Kconfig changes (missing deps and remove module support)
- Slim down oversized licence statement; hi6421-pmic-core
- Use managed resources (devm_*); lp87565
- Supply proper error checking/handling; t7l66xbBug Fixes:
- Fix counter duplication issue; da9052-core
- Fix potential NULL deference issue; max8998
- Leave SPI-NOR write-protection bit alone; lpc_ich
- Ensure device is put into reset during suspend; intel-lpss
- Correct register offset variable size; omap-usb-tll"* tag 'mfd-next-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd: (61 commits)
mfd: intel_soc_pmic: Differentiate between Bay and Cherry Trail CRC variants
mfd: intel_soc_pmic: Export separate mfd-cell configs for BYT and CHT
dt-bindings: mfd: Add bindings for ZII RAVE devices
mfd: omap-usb-tll: Fix register offsets
mfd: da9052: Constify spi_device_id
mfd: intel-lpss: Put I2C and SPI controllers into reset state on suspend
mfd: da9055: Constify i2c_device_id
mfd: intel-lpss: Add missing PCI ID for Intel Sunrise Point LPSS devices
mfd: t7l66xb: Handle return value of clk_prepare_enable
mfd: Add ROHM BD9571MWV-M PMIC DT bindings
mfd: intel_soc_pmic_chtwc: Turn Kconfig option into a bool
mfd: lp87565: Convert to use devm_mfd_add_devices()
mfd: Add support for TPS68470 device
mfd: lpc_ich: Do not touch SPI-NOR write protection bit on Haswell/Broadwell
mfd: syscon: atmel-smc: Add helper to retrieve register layout
mfd: axp20x: Use correct platform device ID for many PEK
dt-bindings: mfd: axp20x: Introduce bindings for AXP813
mfd: axp20x: Add support for AXP813 PMIC
dt-bindings: mfd: axp20x: Add AXP806 to supported list of chips
mfd: Add ROHM BD9571MWV-M MFD PMIC driver
...
05 Sep, 2017
1 commit
-
…-4.14', 'ib-mfd-iio-pwm-4.14', 'ib-mfd-input-rtc-4.14', 'ib-mfd-many-4.14' and 'ib-mfd-pinctrl-regulator-4.14' into ibs-for-mfd-merged
04 Sep, 2017
3 commits
-
STM32 ADC supports hardware triggers like STM32 Low-Power Timer.
For instance, STM32H7 ADC may be triggered by instances 1, 2 or 3.
Add hardware triggered mode so Low-Power Timer Trigger driver can
validate device.Signed-off-by: Fabrice Gasnier
Acked-by: Jonathan Cameron
Signed-off-by: Lee Jones -
include/linux/i2c is not for client devices. Move the header file to a
more appropriate location.Signed-off-by: Wolfram Sang
Acked-by: Greg Kroah-Hartman
Acked-by: Alexandre Belloni
Acked-by: Mark Brown
Acked-by: Sebastian Reichel
Acked-by: Jonathan Cameron
Acked-by: Dmitry Torokhov
Acked-by: Kishon Vijay Abraham I
Acked-by: Bartlomiej Zolnierkiewicz
Acked-by: Thierry Reding
Acked-by: Tony Lindgren
Acked-by: Daniel Thompson
Acked-by: Linus Walleij
Acked-by: Guenter Roeck
Signed-off-by: Lee Jones -
The comparator polarity field in config register is not correctly
initialized as per the interrupt trigger setting. Because the bitfield
definision is wrong and bit shifting is missed.Fixes: d9f39babd8ba ("iio: adc: ti-ads1015: add threshold event support")
Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Akinobu Mita
Signed-off-by: Jonathan Cameron
28 Aug, 2017
1 commit
-
We want the staging and iio fixes in here to handle the merge issues.
Signed-off-by: Greg Kroah-Hartman
21 Aug, 2017
1 commit
-
…/iio into staging-next
Jonathan writes:
Second set of IIO new device support, features and cleanup for the 4.14 cycle.
New device support:
* ak8974
- support the AMI306.
* st_magnetometer
- add support for the LIS2MDL with bindings.
* rockchip-saradc
- add binding for rv1108 SoC (no driver change).
* srf08
- add srf02 (i2c only) and srf10 support.
* stm32-timer
- support for the STM32H7 to existing driver.Features:
* tools
- move over to the tools buildsystem rather than hand rolling.
- add an install section to the build.
* ak8974
- use serial number to add device randomness.
- add AMI306 calibration data output.
* ccs811
- triggered buffer support.
* srf08
- add a device tree table as the old style i2c probing is going away,
- add triggered buffer support
* st32-adc
- add optional st,min-sample-time-nsecs binding to allow control of
sampling against analog circuitry.
* stm32-timer
- add output compare triggers.
* ti-ads1015
- add threshold event support.
* ti-ads7950
- Allow use on ACPI platforms including providing a default reference
voltage as there is no way to obtain this on ACPI currently.Cleanup and fixes:
* ad7606
- fix an error return code in probe.
* ads1015
- fix incorrect data rate setting update when capture in progress,
- fix wrong scale information for the ADS1115,
- make conversions work when CONFIG_PM is not set,
- make sure we don't get a stale result after a runtime resume by
ensuring we wait long enough,
- avoid returning a false error form the buffer setup callbacks,
- add enough wait time to get the correct conversion,
- remove an unnecessary config register update,
- add a helper to set conversion mode reducing repeated boilerplate,
- use devm_iio_triggered_buffer_setup to simplify error and remove
paths,
- use iio_device_claim_direct_mode instead of opencoding the same.
* ak8974
- mark the INT_CLEAR register as precious to prevent debugfs access.
* apds9300
- constify the i2c_device_id.
* at91-sama5 adc
- add missing Kconfig dependency.
* bma180 accel
- constify the i2c_device_id.
* rockchip_saradc
- explicitly request exclusive reset control as part of the reset rework
on going throughout the kernel.
* st_accel
- fix drdy configuration for a load of accelerometers that only have
the int1 line. Fix is unimportant as presumably no deviec tree actually
used the non existent hardware line.
* st_pressure
- fix drdy configuration for LPS22HB and LPS25H by dropping int2 support
as they don't have this. Fix is unimportant as presumably no device tree
actually used the non existent hardware line.
* stm32-dac
- explicitly request exclusive reset control (part of reset being reworked).
* tsl2583
- constify the i2c_device_id.
* xadc
- coding style fixes.
20 Aug, 2017
11 commits
-
Commit a53e35db70d1 ("reset: Ensure drivers are explicit when requesting
reset lines") started to transition the reset control request API calls
to explicitly state whether the driver needs exclusive or shared reset
control behavior. Convert all drivers requesting exclusive resets to the
explicit API call so the temporary transition helpers can be removed.No functional changes.
Cc: Jonathan Cameron
Cc: Hartmut Knaack
Cc: Lars-Peter Clausen
Cc: Peter Meerwald-Stadler
Cc: Heiko Stuebner
Cc: linux-iio@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Philipp Zabel
Signed-off-by: Jonathan Cameron -
The ADS1015 device provides programmable comparator that can issue an
interrupt on the ALERT pin. This change adds the iio threshold event
support for that feature.The ADS1015 device only have a single config register which contains an
input multiplexer selection, comparator settings, and etc. So only a
single event channel can be enabled at a time. Also enabling both buffer
and event are prohibited for simplicity.Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Akinobu Mita
Signed-off-by: Jonathan Cameron -
While the iio buffer for the ti-ads1015 driver is enabled, reading the
raw ADC channel data is restricted. We usually use the
iio_device_claim_direct_mode()/iio_device_release_direct_mode() pair for
that.This change consequently reverses the locking order for the driver's
private lock and indio_dev->mlock which acquired by
iio_device_claim_direct_mode() internally. But it's safe because there is
no other dependency between these locks.Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Akinobu Mita
Signed-off-by: Jonathan Cameron -
Use devm_iio_triggered_buffer_setup to simplify the error path in the
probe() and remove() function.This changes the remove order, but the end result of remove function
actually does the reverse of probe.Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Akinobu Mita
Signed-off-by: Jonathan Cameron -
This adds a helper function to set conversion mode as there are a fair
number of users.Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Akinobu Mita
Signed-off-by: Jonathan Cameron -
The ti-ads1015 driver has eight iio voltage channels and each iio channel
can hold own scale information.The ADS1015 device only have a single config register which contains an
input multiplexer selection, PGA and data rate settings. So the driver
should load the correct settings when the input multiplexer selection is
changed.However, regardless of which channlel is currently selected, changing any
iio channel's scale information immediately overwrites the current PGA
setting in the config register.It is harmless because the correct PGA settings are reloaded just before
getting adc result anyway. But it is unnecessary register update and
should be removed.Cc: Daniel Baluta
Cc: Jonathan Cameron
Signed-off-by: Akinobu Mita
Signed-off-by: Jonathan Cameron -
This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously. So this driver
inserts a wait time before reading the conversion register if the
configuration is changed from a previous request.Currently, the wait time is only the period required for a single
conversion that is calculated as the reciprocal of the sampling frequency.
However we also need to wait for the the previous conversion to complete.
Otherwise we probably get the conversion result for the previous
configuration when the sampling frequency is lower.Cc: Daniel Baluta
Signed-off-by: Akinobu Mita
Cc:
Signed-off-by: Jonathan Cameron -
pm_runtime_get_sync() and pm_runtime_put_autosuspend() return 0 on
success, 1 if the device's runtime PM status was already requested status
or error code on failure. So a positive return value doesn't indicate an
error condition.However, any non-zero return values from buffer preenable and postdisable
callbacks are recognized as an error and this driver reuses the return
value from pm_runtime_get_sync() and pm_runtime_put_autosuspend() in
these callbacks. This change fixes the false error detections.Cc: Daniel Baluta
Signed-off-by: Akinobu Mita
Cc:
Signed-off-by: Jonathan Cameron -
This driver assumes that the device is operating in the continuous
conversion mode which performs the conversion continuously. So this driver
doesn't insert a wait time before reading the conversion register if the
configuration is not changed from a previous request.This assumption is broken if the device is runtime suspended and entered
a power-down state. The forthcoming request causes reading a stale result
from the conversion register as the device is runtime resumed just before.Fix it by adding a flag to detect that condition and insert a necessary
wait time.Cc: Daniel Baluta
Signed-off-by: Akinobu Mita
Cc:
Signed-off-by: Jonathan Cameron -
The ADS1015 device have two operating modes, continuous conversion mode
and single-shot mode. This driver assumes that the continuous conversion
mode is selected by runtime resume callback when the ADC result is
requested.If CONFIG_PM is disabled, the device is always in the default single-shot
mode and no one begins a single conversion. So the conversion register
doesn't contain valid ADC result. Fix it by changing the continuous mode
in probe function.Cc: Daniel Baluta
Signed-off-by: Akinobu Mita
Cc:
Signed-off-by: Jonathan Cameron -
The ti-ads1015 driver supports ADS1015 and ADS1115 devices. The same
scale information is used for both devices in this driver, however they
have actually different values and the ADS1115's one is not correct.These devices have the same full-scale input voltage range for each PGA
selection. So instead of adding another hardcoded scale information,
compute a correct scale on demand from each device's resolution.Cc: Daniel Baluta
Signed-off-by: Akinobu Mita
Cc:
Signed-off-by: Jonathan Cameron