Age | Commit message (Collapse) | Author |
|
We want the staging and iio fixes in here to handle the merge issues.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/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.
|
|
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 <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: Heiko Stuebner <heiko@sntech.de>
Cc: linux-iio@vger.kernel.org
Cc: linux-rockchip@lists.infradead.org
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
This adds a helper function to set conversion mode as there are a fair
number of users.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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 <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The ti-ads1015 driver has eight iio voltage channels and each iio channel
can hold own sampling frequency 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 sampling frequency information immediately overwrites the
current data rate setting in the config register.
It breaks the current data rate setting if the different channel's sampling
frequency information is changed because the data rate setting is not
reloaded when the input multiplexer is switched.
This removes the unexpected config register update and correctly load the
data rate setting before getting adc result.
Cc: Daniel Baluta <daniel.baluta@gmail.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
ACPI enabled platforms do not have a mean of regulators. Instead we use
hard coded voltage value for reference pin. When value is 0 (default) we
fall back to request a regulator.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Without the triggered buffer code, we get a link error:
drivers/iio/adc/at91-sama5d2_adc.o: In function `at91_adc_probe':
at91-sama5d2_adc.c:(.text+0x938): undefined reference to `devm_iio_triggered_buffer_setup'
This adds a Kconfig 'select' statement like other ADC
drivers have it already.
Fixes: 5e1a1da0f8c9 ("iio: adc: at91-sama5d2_adc: add hw trigger and buffer support")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
We need it here for iio fixes.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
|
|
This patch fix following checkpatch warnings in xadc driver
1. prefer 'unsigned int' to bare use of 'unsigned'.
2. else is not generally useful after a break or return.
3. fill all function definition arguments with identifier name
Signed-off-by: Sai Krishna Potthuri <lakshmis@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The driver doesn't have a struct of_device_id table but supported devices
are registered via Device Trees. This is working on the assumption that a
SPI device registered via OF will always match a legacy SPI device ID and
that the MODALIAS reported will always be of the form spi:<device>.
There is an ACPI method to enumerate such devices via specific ACPI ID
and use of compatible strings. It will not work for the drivers which
have no OF match ID table present.
Besides this could change in the future so the correct approach is to
have an OF device ID table if the devices are registered via OF.
Tested-by: David Lechner <david@lechnology.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
STM32 ADC allows each channel to be sampled with a different sampling time,
by setting SMPR registers. Basically, value depends on local electrical
properties. Selecting correct value for sampling time highly depends on
analog source impedance. There is a manual that may help in this process:
'How to get the best ADC accuracy in STM32...'
This patch allows to configure minimum sampling time via device tree,
either for:
- all channels at once:
st,min-sample-time-nsecs = <10000>;
- independently for each channel (must match "st,adc-channels" list):
st,adc-channels = <0 1>;
st,min-sample-time-nsecs = <5000 10000>;
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
ADC clock input is provided to internal prescaler (that decreases its
frequency). It's then used as reference clock for conversions.
- Fix common clock rate used then by stm32-adc sub-devices. Take common
prescaler into account. Currently, rate is used to set "boost" mode.
It may unnecessarily be set. This impacts power consumption.
- Fix ADC max clock rate on STM32H7 (fADC from datasheet). Currently,
prescaler may be set too low. This can result in ADC reference
clock used for conversion to exceed max allowed clock frequency.
Fixes: 95e339b6e85d ("iio: adc: stm32: add support for STM32H7")
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Proper support for the INA219 lowered the minimum sampling period from
2*140us to 2*84us. Subtracting 200us later leads to an underflow and
an almost infinite udelay later.
Using a signed int for the sampling period provides sufficient range
(at most 2*8640*1024us), but catches the underflow when comparing with
buffer_us.
Fixes: 18edac2e22f4 ("iio: adc: Fix integration time/averaging for INA219/220")
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
First round of IIO new device support, features and cleanups for the 4.14 cycle.
4 completely new drivers in this set and plenty of other stuff.
One ABI change due to a silly mistake a long time back. Hopefully no
one will notice. It effects the numerical order of consumer device
channels which was the reverse of the obvious. It's going the slow
way to allow us some margin to spot if we have broken userspace or
not (seems unlikely)
New Device Support
* ccs811
- new driver for the Volatile Organic Compounds (VOC) sensor.
* dln2 adc
- new driver for the ADC on this flexible usb board.
* EP93xx
- new driver for this Cirrus logic SoC ADC.
* ltc2471
- new ADC driver support the ltc2471 and ltc2473
* st_accel
- add trivial table entries to support H3LIS331DL, LIS331DL, LIS3LV02DL.
* st_gyro
- add L3GD20H support (again) having fixed the various things that were
broken in the first try. Includes devicetree binding.
* stm32 dac
- add support for the DACs in the STM32F4 series
Features
* Documentation
- add missing power attribute documentation to the ABI docs.
* at91-sama5d2
- add hardware trigger and buffered capture support with bindings.
- suspend and resume functionality.
* bmc150
- support for the BOSC0200 ACPI device id seen on some tablets.
* hdc100x
- devicetree bindings
- document supported devices
- match table and device ids.
* hts221
- support active low interrupts (with bindings)
- open drain mode with bindings.
* htu21
- OF match table and bindings.
* lsm6dsx
- open drain mode with bindings
* ltc2497
- add support for board file based consumer mapping.
* ms5367
- OF match table and bindings.
* mt7622
- binding document and OF match table.
- suspend and resume support.
* rpr0521
- triggered buffer support.
* tsys01
- OF match table and bindings.
Cleanups and minor fixes
* core
- fix ordering of IIO channels to entry numbers when using
iio_map_array_register rather than reversing them.
- use the new %pOF format specifier rather than full name for the
device tree nodes.
* ad7280a
- fix potential issue with macro argument reuse.
* ad7766
- drop a pointless NULL value check as it's done in the gpiod code.
* adis16400
- unsigned -> unsigned int.
* at91 adc
- make some init data static to reduce code size.
* at91-sama5d2 ADC
- make some init data static to reduce code size.
* da311
- make some init data static to reduce code size.
* hid-sensor-rotation
- drop an unnecessary static.
* hts221
- refactor the write_with_mask code.
- move the BDU configuration to probe time as there is no reason for it
to change.
- avoid overwriting reserved data during power-down. This is a fix, but
the infrastructure need was too invasive to send it to mainline except
in a merge window. It's not a regression as it was always wrong.
- avoid reconfigure the sampling frequency multiple times by just
doing it in the write_raw function directly.
- refactor the power_on/off calls into a set_enable.
- move the dry-enable logic into trig_set_state as that is the only
place it was used.
* ina219
- fix polling of ina226 conversion ready flag.
* imx7d
- add vendor name in kconfig for consistency with similar parts.
* mcp3422
- Change initial channel to 0 as it feels more logical.
- Check for some errors in probe.
* meson-saradc
- add a check of of_match_device return value.
* mpu3050
- allow open drain for any interrupt type.
* rockchip adc
- add check on of_match_device return value.
* sca3000
- drop a trailing whitespace.
* stm32 adc
- make array stm32h7_adc_ckmodes_spec static.
* stm32 dac
- fix an error message.
* stm32 timers
- fix clock name in docs to match reality after changes.
* st_accel
- explicit OF table (spi).
- add missing entries to OF table (i2c).
- rename of_device_id table to drop the part name.
- adding missing lis3l02dq entry to bindings.
- rename H3LIS331DL_DRIVER_NAME to line up with similar entries in driver.
* st_gyro
- explicit OF table (spi).
* st_magn
- explicit OF table (spi).
- enable multiread for lis3mdl.
* st_pressure
- explicit OF table (spi).
* st_sensors common.
- move st_sensors_of_i2c_probe and rename to make it available for spi
drivers.
* tsc3472
- don't write an extra byte when writing the ATIME register.
- add a link to the datasheet.
* tsl2x7x - continued staging cleanups
- add of_match_table.
- drop redundant power_state sysfs attribute.
- drop wrapper tsl2x7x_i2c_read.
- clean up i2c calls made in tsl2x7x_als_calibrate.
- refactor the read and write _event_value callbacks to handle additional
elements.
- use usleep_range instead of mdelay.
- check return value from tsl2x7x_invoke_change.
* zpa2326
- add some newline to the end of logging macros.
|
|
New driver adding support for ADC found on Cirrus Logic EP93xx series of SoCs.
Board specific code must take care to create plaform device with all necessary
resources.
Signed-off-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Acked-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-linus
Jonathan writes:
First set of IIO fixes for the 4.13 cycle.
* ad2s1210
- Fix negative angular velocity reads (identified by a gcc 7 warning)
* aspeed-adc
- Wait for initialization sequence to finish before enabling channels.
Without it no channels work.
* axp288
- Revert a patch that dropped some bogus register mods. No one is entirely
sure why but it breaks charging on some devices.
- Fix GPADC pin read returning 0. Turns out a small sleep is needed.
* bmc150
- Make sure device is restored to normal state after suspend / resume
cycle. Otherwise, simple sysfs reads are broken.
* tsl2563
- fix wrong event code.
* st-accel
- add spi 3-wire support. Needed to fix the lsm303agr accelerometer
which only had 3 wires in all cases. Side effect is to enable optional
3-wire support for other devices.
* st-pressure
- disable multiread by default for LPS22HB (only effects SPI)
* sun4i-gpadc-iio
- fix unbalanced irq enable / disable
* vf610
- Fix VALT slection for REFSEL bits - ensures we are using the
right reference pins.
|
|
This patch enables adc engine at initialization time and waits
for the initial sequence completion before enabling adc channels.
Without this code adc channels are not functional and shows
zeros for all connected channels.
Tested on mellanox msn platform.
v1 -> v2:
Pointed by Rick Altherr:
- Wait init sequence code enabled by bool
from OF match table.
Signed-off-by: Mykola Kostenok <c_mykolak@mellanox.com>
Reviewed-by: Rick Altherr <raltherr@google.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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>
|
|
The gpiod API checks for NULL descriptors, so there is no need to
duplicate the check in the driver.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Don't populate array startup_lookup on the stack but instead make
it static. Makes the object code smaller.
Before:
text data bss dec hex filename
21754 5440 128 27322 6aba drivers/iio/adc/at91_adc.o
After:
text data bss dec hex filename
21613 5496 128 27237 6a65 drivers/iio/adc/at91_adc.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
I noticed in its DSDT that one of my tablets actually is using the GPADC
pin for temperature monitoring.
The whole axp288_adc_set_ts() function is a bit weird, in the past it was
removed because it seems to make no sense, then this was reverted because
of regressions.
So I decided to test the special GPADC pin handling on this tablet.
Conclusion: not only is axp288_adc_set_ts() necessary, we need to sleep a
bit after making the AXP288_ADC_TS_PIN_CTRL changes before sampling the
GPADC, otherwise it will often (about 80% of the time) read 0 instead of
its actual value.
It seems that there is only 1 bias current source and to be able to use it
for the GPIO0 pin in GPADC mode it must be temporarily turned off for the
TS pin, but the datasheet does not mention this.
This commit adds a sleep after disabling the TS pin bias current,
fixing the GPADC more often then not wrongly returning 0.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Making the const array startup_lookup static rather having it on the
stack saves 69 bytes. Add in missing int specifier to clean up a
checkpatch warning.
Before:
text data bss dec hex filename
10297 2800 128 13225 33a9 drivers/iio/adc/at91-sama5d2_adc.o
After:
text data bss dec hex filename
10140 2888 128 13156 3364 drivers/iio/adc/at91-sama5d2_adc.o
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
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>
|
|
This patch adds support for Diolan DLN2 ADC via IIO's ADC interface.
ADC is the fourth and final component of the DLN2 for the kernel.
Signed-off-by: Jack Andersen <jackoalan@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
In order to select the alternate voltage reference pair (VALTH/VALTL), the
right value for the REFSEL field in the ADCx_CFG register is "01", leading
to 0x800 as register mask. See section 8.2.6.4 in the reference manual[1].
[1] http://www.nxp.com/docs/en/reference-manual/VFXXXRM.pdf
Fixes: a775427632fd ("iio:adc:imx: add Freescale Vybrid vf610 adc driver")
Signed-off-by: Stefan-Gabriel Mirea <stefan-gabriel.mirea@nxp.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The LTC2741 and LTC2473 are single voltage ADC chips. The LTC2473
is similar to the LTC2471 but outputs a signed differential value.
Datasheet:
http://cds.linear.com/docs/en/datasheet/24713fb.pdf
Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
modifications"
Inheriting the ADC BIAS current settings from the BIOS instead of
hardcoding then causes the AXP288 to disable charging (I think it
mis-detects an overheated battery) on at least one model tablet.
So lets go back to hard coding the values, this reverts
commit fa2849e9649b ("iio: adc: axp288: Drop bogus
AXP288_ADC_TS_PIN_CTRL register modifications"), fixing charging not
working on the model tablet in question.
The exact cause is not fully understood, hence the revert to a known working
state.
Cc: stable@vger.kernel.org
Reported-by: Umberto Ixxo <sfumato1977@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
When initializing interrupts, the devm_request_any_context_irq will
enable them right away. An atomic flag was set in sun4i_irq_init and read
in the interrupt handler to make sure no unwanted interrupts were
handled. If an unwanted interrupt occurred, the handler would disable
the irq and return IRQ_HANDLED. However, at the end of sun4i_irq_init,
the irq would be disabled as well, resulting in an unbalanced enable
(since there are more disables than enables, the code enabling the
interrupt would never be called).
When reading the ADC or the temperature, the respective irq would be
enabled in the read function and disabled in the irq handler. In the
read function, we would wait for a completion (with a timeout) that will
be set in the irq handler. However, if the completion is never set or if
the wait for completion times out, the irq would not be disabled in the
read function resulting in an unbalanced enable once the read function
is called again (since there are 2+ enables for no disable).
Moving disable_irq from the irq handler to the read function get rid of
these two cases of unbalanced enable.
Fixes: d1caa9905538 ("iio: adc: add support for Allwinner SoCs ADC")
Reported-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
Pull hwmon updates from Guenter Roeck:
- Add PMBus client driver for IR35221
- Add support for NCT6795D to nct6775 driver
- Functional improvements to adt7475, aspeed-pwm-tacho, and ibmpowernv
drivers
- Minor fixes and cleanups in various drivers
* tag 'hwmon-for-linus-v4.13-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging: (22 commits)
hwmon: (aspeed-pwm-tacho) Poll with short sleeps.
hwmon: (aspeed-pwm-tacho) reduce fan_tach period
hwmon: (ibmpowernv) Add current(A) sensor
hwmon: (ibmpowernv) introduce a legacy_compatibles array
hwmon: (pwm-fan) Switch to new atomic PWM API
hwmon: (scpi) Fix the scale of SCP sensor readings
hwmon: (aspeed-pwm-tacho) Enable both edge measurement.
hwmon: (ibmpowernv) Add highest/lowest attributes to sensors
hwmon: (pmbus) move header file out of I2C realm
hwmon: (max6639) move header file out of I2C realm
hwmon: (ltc4245) move header file out of I2C realm
hwmon: (ds620) move header file out of I2C realm
hwmon: (ads1015) move header file out of I2C realm
hwmon: (adt7475) temperature smoothing
hwmon: (adt7475) add high frequency support
hwmon: (adt7475) fan stall prevention
hwmon: (adt7475) replace find_nearest() with find_closest()
hwmon: (pmbus) Add client driver for IR35221
hwmon: (nct6775) Add support for NCT6795D
hwmon: (nct6775) Improve fan detection
...
|
|
Add missing hooks in the LTC2497 IIO driver to allow hwmon mapping.
Signed-off-by: Gaurav Gupta <gauragup@cisco.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
The array stm32h7_adc_ckmodes_spec does not need to be in global scope, so
make it static.
Cleans up sparse warning:
"symbol 'stm32h7_adc_ckmodes_spec' was not declared. Should it be static?"
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Some part of the configuration are not touched after the probe
and if something goes wrong on writing the initial one,
the chip will misbehave.
Adding an error checking ensures that the inital configuration will
be written correctly. Moreover ensures that a sensible configuration
will be saved in driver data and used subsequently as intended.
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Reported-by: Maarten Brock <m.brock@vanmierlo.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Initial channel should be the first available channel on
all configurations, so changing to channel 0 available on
all supported chips.
Signed-off-by: Angelo Compagnucci <angelo.compagnucci@gmail.com>
Reported-by: Maarten Brock <m.brock@vanmierlo.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
This commit adds mt7622 compatible node.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
This patch supports auxadc suspend/resume flow.
Disable auxadc clk and power in suspend function.
Enable axuadc clk and power in resume function.
Signed-off-by: Zhiyong Tao <zhiyong.tao@mediatek.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Added support for suspend/resume functionality for the ADC IP
in sama5d2 SoC.
In order to enter Suspend to ram mode (backup + self refresh mode for
memory), in which the ADC IP is no longer powered, we need to reset the
pins to default state, for the scenario when they are also used for I2C
bus to communicate with the PMIC.
On resume, we need to reconfigure the ADC IP registers and reconfigure the
trigger registers in the case when the suspend procedure is done while
sysfs has the buffer and trigger enabled.
In the case the suspend happens exactly during a software triggered
conversion, the request will time out, because we reset and power down
the ADC.
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
While the INA226 has a conversion ready flag (CVRF) in the R/W Mask/Enable
register with read-to-clear semantics, the corresponding bit of the INA219
(CNVR) is part of the bus voltage register. The flag is cleared by reading
the power register.
Signed-off-by: Stefan Brüns <stefan.bruens@rwth-aachen.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
Added support for the external hardware trigger on pin ADTRG,
integrated the three possible edges into the driver
and created buffer management for data retrieval
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
To keep IMX7D_ADC text consistent with other iio/adc entries, add
the vendor name to the driver menu text.
Signed-off-by: Fabio Estevam <fabio.estevam@nxp.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
|
|
git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-next
Jonathan writes:
Second set of IIO new device support, features and cleanups for the 4.13 cycle.
A few reverts here. One was a general failure to notice a device was already
supported by another driver. The second is due to a review comment pointing
out that the original patch was a bad idea and would break existing systems.
Reverts
* bma180
- Revert addition of support for the BMA250E it is already supported by
the bmc150-accel and better supported at that. Oops.
* hi8435
- The fix for cleanup of the reset gpio stuff isn't a good way to go. It
breaks systems where an inverting level convertor is used. The right fix
is to make the original devicetree correct - even if it involves patching
the devicetree in kernel.
New Device Support
* stm32-adc
- STM32H7 support and bindings.
Features
* core
- add a hardware triggered operating mode for systems in which the actual
trigger is never seen by the kernel. This is typically only used when
a device 'can' use other triggers, but if a particular magic one is
enabled the interrupt is effectively handled in hardware and we never see
it.
* st-lsm6dsx
- support active low interrupts.
* stm32-adc
- Make the core adc clock optional as not all hardware supported requires it.
- Make the bus clock optional in the per instance driver as it may be shared
by all instances of the ADC and is handled by the core.
- Rework to have a data structure representing the device type specific
elements.
* stm32-trigger (and counter)
- Use the INDIO_HARDWARE_TRIGGERED_MODE where appropriate.
- Add an attribute to configure device modes for quadrature counting etc.
Clean ups and minor fixes
* IIO core.
- use __sysfs_match_string() helper rather than open coding the same.
* ad7791
- use sysfs_match_string() helper rather than open coding the same.
* aspeed-adc
- handle return value of clk_prepare_enable
* cpcap
- Fix default register values and ensure the battery thermistor is enabled
correctly.
- Fix the reported die temperature where we can - docs are lacking.
- Remove the hung interrupt quirk as no longer happens due to fix in the
mfd driver.
* hi8435
- Remove &s from hi8435_info definition as unneeded and inconsistent.
* hid-sensor-trgger
- Add kconfig depends on IIO_BUFFER (fixes patch in previous series)
* ina2xx
- Make the use of iio_info_mask* elements consistent for all channels.
This doesn't have any visible effect, but acts as clear documentation of
which channels various resulting attributes apply to.
* lpc32xx
- handle the return value of clk_prepare_enable.
* meson-saradc
- NULL instead of 0 for pointer.
* mma9551
- use NULL for GPIO connection ID to aid implementation fo ACPI support.
Here the connection ID doesn't actually tell us anything and it is much
easier to deal with the driver if it's not there.
* mpu6050
- Fix lock issues through use of a local mux.
- Replace sprintf with scnprintf as appropriate.
- Check whoami against all known values. This allows for a small number of
boards where we are really fishing for the part not being present at all.
It is unfortunately common to have undescribed changes to use newer chips.
We paper over this but just emitting a warning for those cases as long as
we know about.
* mxs-lradc
- Fix some non static warnings.
* rcar-adc
- Part of making the naming for this part consistent across the kernel.
* st_accel
- drop some spi_device_id entries for variants with no SPI support
* st_magn
- drop some spi_device_id entries for variants with no SPI support.
* sx9500
- Use devm_gpiod_get instead of indexed value with an index of 0 on all
occasions.
* twl4030
- Drop unused twl4030_get_madc_conversion as callers removed now throughout
kernel.
- Unexport twl4030_madc_conversion() as no used only within this driver.
- Drop twl4030_madc_user_params as not used now.
- Drop twl4030_madc_request.func_cb as not used now.
- Fold the twl4030-madc.h header into the driver as no longer used anywhere
else in the kernel.
* xilinx
- Handle the return value of clk_prepare_enable
|