Age | Commit message (Collapse) | Author | Files | Lines |
|
When building with CONFIG_GPIOLIB is not set
gcc warns this:
drivers/iio/adc/ti-ads7950.c:75:19: error: field chip has incomplete type
struct gpio_chip chip;
^~~~
drivers/iio/adc/ti-ads7950.c: In function ti_ads7950_set:
drivers/iio/adc/ti-ads7950.c:409:32: error: implicit declaration of function gpiochip_get_data; did you mean acpi_get_data? [-Werror=implicit-function-declaration]
struct ti_ads7950_state *st = gpiochip_get_data(chip);
^~~~~~~~~~~~~~~~~
acpi_get_data
Reported-by: Hulk Robot <hulkci@huawei.com>
Fixes: c97dce792dc8 ("iio: adc: ti-ads7950: add GPIO support")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Justin Chen <justinpopo6@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Currently if mask is neither CHAN_INFO_RAW or CHAN_INFO_SCALE then
then an uninitialized error return 'ret' is returned. Fix this by
adding a default case that ensures -EINVAL is returned for this
specific case.
Addresses-Coverity: ("Uninitialized scalar variable")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
'gyro_sensor'
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c: In function 'st_lsm6dsx_read_tagged_fifo':
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:520:41: warning:
variable 'gyro_sensor' set but not used [-Wunused-but-set-variable]
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c:520:28: warning:
variable 'acc_sensor' set but not used [-Wunused-but-set-variable]
They are not used since commit 14c7c6e1a860 ("iio: imu: st_lsm6dsx: add
st_lsm6dsx_push_tagged_data routine")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Add support to STMicroelectronics LIS2DE12 accelerometer in
st_accel framework.
http://www.st.com/resource/en/datasheet/lis2de12.pdf
Signed-off-by: Robert Jones <rjones@gateworks.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Signed-off-by: Robert Jones <rjones@gateworks.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Add the ACPI ID for KXCJ9 sensor seen on the a Teclast X80 Power
tablet.
Signed-off-by: Valentin Manea <linux-iio@mrs.ro>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Previously external clock were set through platform_data struct.
Now device uses clk struct defined in include/linux/clk.h to handle
external clock source.
It also removes mclk from platform_data struct.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Organize includes to list them in lexicographic order.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
use bmp085.txt and change it into yaml format
fix links to datasheets in replaced documentation
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
replace avia-hx711.txt by avia-hx711.yaml as yaml devicetree
documentation for avia hx711 iio adc sensor
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Use devm_platform_ioremap_resource() to be able to drop a bit of
explicit boilerplate code.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
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: Chris Healy <cphealy@gmail.com>
Cc: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Replace combination of pr_err()/dev_name() with an equivalent call for
dev_err().
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
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: Chris Healy <cphealy@gmail.com>
Cc: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Use a local "struct device *dev" in imx7d_adc_probe() for brevity. No
functional change intended.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
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: Chris Healy <cphealy@gmail.com>
Cc: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Document support for AD7616 Analog to Digital Converter.
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The AD7616 is a 12-bit ADC with 16 channels.
The AD7616 can be configured to work in hardware mode by controlling it via
gpio pins and read data via spi. No support for software mode yet, but it
is a work in progress.
This device requires a reset in order to update oversampling, so chip info
has got a new attribute to mark this.
The current assumption that this driver makes for AD7616, is that it's
working in Hardware Mode with Serial, Burst and Sequencer modes activated.
To activate them, following pins must be pulled high:
-SER/PAR
-SEQEN
And following must be pulled low:
-WR/BURST
-DB4/SEQEN
Datasheets:
Link: https://www.analog.com/media/en/technical-documentation/data-sheets/ad7616.pdf
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
attributes
Available oversampling ratios and scales can be shown by calling a
common ad7606_show_avail function which takes as parameters the array
which stores the values, together with the size of the array.
Oversampling options are now defined in chip info
structure and they are loaded at probe.
Has_Oversampling attribute was removed because oversampling_num was added
and it is not needed anymore.
The purpose of this patch is to deal with the scale_avail and
oversampling_avail arrays in a generic way. This makes it easier to add
support for new devices which will work with different scales and
oversampling ratios. It is also an intermediate step for adding support
for ad7616 which has different oversampling sampling ratios available.
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Signed-off-by: Beniamin Bia <beniamin.bia@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Remove unneeded parentheses around the arguments of ||. This reduces
clutter and code behave in the same way. Change suggested by
checkpatch.pl.
CHECK: Unnecessary parentheses around 'st->devid == ID_AD9833'
CHECK: Unnecessary parentheses around 'st->devid == ID_AD9837'
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Between "config" and "MAX9611" there is a tab, replace it
with a space.
Signed-off-by: Fabrizio Castro <fabrizio.castro@bp.renesas.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Add support to STM LSM6DSR 6-axis (acc + gyro) Mems sensor
https://www.st.com/resource/en/datasheet/lsm6dsr.pdf
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
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 set of new device support, features and fixes for IIO in the 5.2 cycle
Staging graduations
* ad7780
- Move this ADC driver out of staging. Included adding some new features
along the way (see below). Also added DT bindings.
New device support
* adis16480
- Support the ADIS16495 and ADIS16497 IMU devices making
heavy use of refactoring of various aspects of the driver in precursor
patches.
* lsm6dsx
- Support for the ASM330LHH 6-axis (accelerometer + gyro) sensor.
- Support for the LSM6DS0X
* matbotix mb1232
- New driver for this ultrasound ranging device family. Including bindings.
- Supports mb1202, mb1212, mb1222, mb1232, mb1242, mb7040 and mb7137.
* max31856
- New driver for this thermocouple temperature sensor.
* meson saradc
- Support the Meson-G12A (ID addition only).
* stmpe-adc
- New driver supporting generic ADC alongside touchscreen support which
previously existed. Includes DT bindings.
* vcnl4000
- Support for the vcln4040 proximity and light sensor, including adding
DT bindings for this and parts previously supported.
Features
* core
- Allow reading of mount matrices from ACPI in addition to DT.
- Common binding for theromcouple types.
* ad5933
- Add ABI docs as there are a few 'unsual' elements about this
device - perhaps because it's our only impedance analyser.
* ad7780
- Add gain and filter gpio support + readback of current gain and filter.
* adis16480
- Allow selection fo the dataready pin to be used.
- Device tree ID table and binding documentation.
- Support external clock modes, including new bindings.
* bma180
- Mount matrix support.
* bmc150
- Mount matrix support.
* bmg160
- Mount matrix support.
- DT id table and bindings doc.
* bmp280
- Put calibration data into the entropy pool.
* hmc5843
- Mount matrix support.
* itg3200
- Mount matrix support.
* kxcjk1013
- Device tree id table, and binding docs.
* lpc32xx
- Add scale when regulator specified including DT docs for regulator.
* pms7003
- Add device IDs for all supported parts to driver and binding.
* stm32-dfsdm
- Enable hw consumer support, scan mode control and a complex set of
triggered buffer modes.
- Power management.
* stm32-lptimer-counter
- power management.
- Document the pinctrl sleep state binding.
* ti-ads7950
- GPIO pin support.
Cleanups, minor fixes
* core
- Use bitmap_zalloc to make it explicit that is what we are doing.
- Tidy up all the Kconfig files (which had slowly gotten messy)
- Fix a forwards definition missing issue in iio/driver.h
* ad sigma delta core
- Improve handling of SPI bus locking vs CS assertion. This has been
wrong a long time so not rushing this in.
* ad5064
- Mlock to local lock.
* ad5933 (staging cleanup)
- Multiline comment fixes.
- Include ordering.
- SPDX.
- Tidy up Kconfig help which was a bit missleading.
- Change some non standard attributes to ABI defined ones.
* ad7124
- White space fix.
* ad7192
- White space.
- Use DT clock binding.
- Improve error reporting.
- Platform data to DT conversion.
- Use read_avail callback, mostly to avoid the endless series of
patches from new contributors trying to falsely put spaces around
the negative sign.
* ad7280a
- Add brackets to macros to avoid potential precedence isseus.
- Add temp vars for event codes to reduce indent and improved readability.
- Clean out som CamelCase notation.
- White space.
* ad7606
- Fix broken file naming in MAINTAINERS.
* ad7780
- Missing switch defaults to supress warnings and harden the code slightly.
- Set pattern masks more directly.
- Add ID values and masks for all supported chips.
- SPDX + add Renato as a copyright holder as he has done a lot of work on
this driver.
- Add brackets to macros to avoid potential precedence issues.
* ad7923
- White space fixes.
- Use BIT macro to improve readability.
- Add brackets to macros to avoid potential precedence issues.
- Tidy up a null comparisom.
* ad9523
- Fix a typo in naming of variables.
* adis16400
- Combine trigger file into main code as no advantage in separate files.
Rename core file to just adis16400.
- Squash the header into the c file now there is only one file.
- Generalize burst mode to support new variants.
* ak8975
- Local variable to improve readability around mount matrix support.
* as3935
- Avoid potential race by ensuring remove does exact opposite of
probe rather than a slightly different order.
* cross_ec
- Drop some unnecessary includes.
- Fix some warning and the slightly 'unusual' code.
- Add some docs for non obvious function.
- SPDX
* hmc5843
- Potential unhandled error case.
* iio trigger core
- Print an error if there is no available irq due to max consumers per
trigger being set to low.
* iio loop trigger
- Drop an unlikely on IS_ERR as IS_ERR already has the annotation.
* ingenic-adc
- Drop a redundant dev_err call as devm_ioremap_resource reports the same
internally.
* lmp91000
- Drop some unncessary parentheses and white space tidy up.
- Invert and if statement to improve readability.
- Fix a wrong error message.
* lpc32xx
- Header sorting + drop some unused ones.
* mma8542
- Mark a switch fallthrough.
* mpu6050
- Add a local variable to improve code readability around mount matrix
support.
* mxs-lradc-adc
- Handle devm_iio_trigger_alloc failure.
* sps30
- Fix up a kernel version in the ABI docs.
* srf04
- DT binding doc converted to yaml.
* ssp_sensors
- Supress a clang build warning due to lack of visibility of conditional
within a iio_push_to_buffers_with_timestamp. (reasonable false warning!)
* st_accel
- Drop pointless less than 0 comparisom of unsigned int.
* stm32-dfsdm
- Improve accuracy of spi_master_frequency calculation.
- Improve calculation fo sampling frequency.
- Rework various internals to simplify adding triggered buffer support.
- Claim direct mode to avoid racing around read_raw and being in buffered
mode.
* stmpe
- Fix a clang false positive warning.
* ti-ads7950
- Use local lock rather than using the core mlock when not locking around
the device mode.
* vcnl4000
- Use word writes instead of byte writes. It seems byte writes are fine
for some parts (undocument) but not others that the driver will shortly
support.
Other
* mailmap
- Add email address change for Sean Nyekjaer. Update in relevant drivers
* tag 'iio-for-5.2a-2' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (129 commits)
iio: ad_sigma_delta: Properly handle SPI bus locking vs CS assertion
iio: adc: stm32-dfsdm: add PM support
iio: adc: stm32-dfsdm: improve sampling frequency accuracy
staging: iio: adc: ad7280a: Tab alignment
MAINTAINERS: Fix the link to ad7606 dt-bindings
iio:temperature: Add MAX31856 thermocouple support
iio:temperature:max31856:Add device tree bind info
dt-bindings: iio/temperature: Add thermocouple types (and doc)
devantech-srf04.yaml: transform DT binding to YAML
iio: frequency: ad9523: Fix typo in ad9523_platform_data
iio: Make possible to include driver.h first
dt-bindings: iio: add Bosch BMG160 gyroscope sensor
iio: gyro: bmg160: add device tree compatibility table
staging: iio: adc: ad7192: Use read_avail for available attributes
dt-bindings: iio: light: add vcnl4040 devicetree bindings
iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor
dt-bindings: iio: light: add vcnl4000 devicetree bindings
iio: light: vcnl4000 add devicetree hooks
iio: light: vcnl4000 use word writes instead of byte writes
iio: adc: stm32-dfsdm: claim direct mode for raw read and settings
...
|
|
For devices from the SigmaDelta family we need to keep CS low when doing a
conversion, since the device will use the MISO line as a interrupt to
indicate that the conversion is complete.
This is why the driver locks the SPI bus and when the SPI bus is locked
keeps as long as a conversion is going on. The current implementation gets
one small detail wrong though. CS is only de-asserted after the SPI bus is
unlocked. This means it is possible for a different SPI device on the same
bus to send a message which would be wrongfully be addressed to the
SigmaDelta device as well. Make sure that the last SPI transfer that is
done while holding the SPI bus lock de-asserts the CS signal.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <Alexandru.Ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Add PM and runtime PM support to STM32 DFSDM drivers:
- stm32-dfsdm-core: manage clocks.
- stm32-dfsdm-adc: restore channels configuration upon resume. Also stop
restart everything in case of buffer mode.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The sample frequency is driven using the oversampling ratio depending
on the SPI bus frequency.
Currently, oversampling ratio is computed by an entire division:
- spi_freq / sample_freq. This may result in inaccurate value.
Using DIV_ROUND_CLOSEST improves resulting sample frequency, which is
useful for audio that requests fixed rates (such as: 8, 16 or 32 kHz).
BTW, introduce new routine to re-factor sample frequency setting, and
move frequency accuracy message from warning to debug level.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Aligned some parameters.
Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The devicetree bindings documentation for ad7606 should also include
the vendor prefix: ad7606.txt -> adi,ad7606.txt
Fixes: 6e33a125df66 ("dt-bindings: iio: adc: Add docs for AD7606 ADC")
Signed-off-by: Stefan Popa <stefan.popa@analog.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
This patch adds support for Maxim MAX31856 thermocouple
temperature sensor support.
More information can be found in:
https://www.maximintegrated.com/en/ds/MAX31856.pdf
NOTE: Driver support only Comparator Mode.
Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
This patch added device tree binding info for MAX31856 driver.
Signed-off-by: Paresh Chaudhary <paresh.chaudhary@rockwellcollins.com>
Signed-off-by: Matt Weber <matthew.weber@rockwellcollins.com>
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
This patch introduces common thermocouple types used by various
temperature sensors. Also a brief documentation explaining this
"thermocouple-type" property.
Signed-off-by: Patrick Havelange <patrick.havelange@essensium.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
devantech-srf04.yaml: yaml devicetree binding for iio ultrasonic
proximity driver of devantech srf04
use devantech-srf04.txt, transform binding into yaml and remove the
outdated DT documentation
Signed-off-by: Andreas Klinger <ak@it-klinger.de>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Replace diff_{m1,m2} with div_{m1,m2} since they are dividers and not a
differential settings.
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
If we put headers alphabetically sorted in the IIO driver,
the compilation will abort because of unknown type to handle.
Simple add a forward declaration of opaque struct iio_dev.
Suggested-by: Jonathan Cameron <jic23@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Define bindings for "bosch,bmg160" and "bosch,bmi055_gyro".
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Add of_match_table.
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
This patch removes the in_voltage-voltage_scale_available and
in_voltage_scale_available attributes. These are replaced with available
attributes added in info_mask_shared_by_type_available.
With this modification the iio core will be responsible with naming the
attributes thus removing the checkpatch warning related to
in_voltage-voltage_scale_available naming.
Signed-off-by: Mircea Caprioru <mircea.caprioru@analog.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Document the vishay VCNL4040 devicetree bindings.
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The VCNL4040 is almost identical to the VCNL4200 as far as register
layout goes but just need to check a different ID register location.
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Document the vishay VCNL4000 devicetree bindings.
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Reviewed-by: Rob Herring <robh@kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Add an of_match table for devicetree probing.
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
The VCNL4200 datasheet says that word read and writes should be used
to access the registers.
Signed-off-by: Angus Ainslie (Purism) <angus@akkea.ca>
Tested-by: Tomas Novotny <tomas@novotny.cz>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Claim direct mode to ensure no buffer mode is in use for:
- single conversion
- sample rate setting (must be set when filter isn't enabled).
- oversampling ratio (must be set when filter isn't enabled).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
DFSDM conversions can be launched continuously, or using various
triggers:
- by software
- hardware triggers (e.g. like in stm32-adc: TIM, LPTIM, EXTI)
- synchronously with DFSDM filter 0. e.g. for filters 1, 2
Launching conversions can be done using two methods:
a - injected:
- scan mode can be used to convert several channels each time a
trigger occurs.
- When not is scan mode, channels are converted in sequence, one upon
each trigger.
b - regular:
- supports software triggers or synchronous with filter 0
- single or continuous conversions
This patch finalizes DFSDM operating modes using IIO buffer modes:
- INDIO_BUFFER_SOFTWARE: regular continuous conversions (no trigger)
but limited to 1 channel. Users must set sampling frequency in this case.
For filters > 1, conversions can be started synchronously with filter 0.
- INDIO_BUFFER_TRIGGERED: triggered conversions uses injected mode for
launching conversions. DFSDM can use hardware triggers (e.g. STM32 timer
or lptimer), so add INDIO_HARDWARE_TRIGGERED to supported modes.
- INDIO_DIRECT_MODE: Only support DMA-based buffer modes. In case no DMA is
available, only support single conversions.
From userland perspective, to summarize various use cases:
1 - single conversion on any filter:
$ cd iio:deviceX
$ cat in_voltageY_raw
This uses regular a conversion (not continuous)
2 - Using sampling frequency without trigger (single channel, buffer)
$ cd iio:deviceX
$ echo 100 > sampling_frequency
$ echo "" > trigger/current_trigger
$ echo 1 > scan_elements/in_voltageY_en
$ echo 1 > buffer/enable
This uses regular conversion in continuous mode (Frequency is achieved
by tuning filter parameters)
3 - sync mode with filter 0: other filters can be converted when using
"st,filter0-sync" dt property. The conversions will get started at the
same time as filter 0. So for any filters > 1:
$ cd iio:deviceX
$ echo 100 > sampling_frequency
$ echo "" > trigger/current_trigger
$ echo 1 > scan_elements/in_voltageY_en
$ echo 1 > buffer/enable
Then start filter 0 as in 2 above.
4 - Using a hardware trigger (with one channel):
- check trigger, configure it:
$ cat /sys/bus/iio/devices/trigger1/name
tim6_trgo
$ echo 100 > /sys/bus/iio/devices/trigger1/sampling_frequency
- go to any filter:
$ echo 1 > scan_elements/in_voltageY_en
$ echo tim6_trgo > trigger/current_trigger
$ echo 1 > buffer/enable
This uses injected conversion as it uses a hardware trigger (without scan)
5 - Using a hardware trigger (with 2+ channel):
Same as in 4/ above, but enable two or more channels in scan_elements.
This uses injected conversion as it uses a hardware trigger (with scan mode)
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
In order to support multiple channels in buffer mode, add support for scan
mode. This is precursor patch to ease support of triggered buffer mode.
Currently, only audio uses buffer mode: Regular continuous conversions
with a single channel (per filter).
DFSDM hardware supports scan mode (only) with injected conversions.
Conversions can be launched by software (JSWSTART), trigger or
synchronously with filter 0 (e.g. JSYNC). Continuous conversion mode isn't
available for injected.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Optionally enable IIO hw consumer, when provided (e.g. for DFSDM_IIO type).
This is precursor patch to introduce buffer modes.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Move DMA slave configuration to start routine: depending on regular or
injected mode is in use, DMA needs to read resp. RDATAR or JDATAR.
This is precursor patch to introduce injected mode (used for scan).
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Move DMA enable (e.g. set RDMAEN bit) away from start_conv() that is used
for both buffer and single conversions. Thus, single conv rely on
interrupt, not dma.
Note: take care to prepare all DMA stuff and set RDMAEN before starting
filter (can be set only when DFEN=0).
This is precursor patch to ease support of triggered buffer mode.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
DFSDM regular continuous mode usage depends on current mode (not DMA):
- for single conversion, RCONT doesn't need to be set.
- for buffer mode, RCONT has to be set (e.g. INDIO_BUFFER_SOFTWARE
used by audio currently).
This is related to filter configuration, move it to relevant routine.
This is precursor patch to ease support of triggered buffer mode.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Current ckout divider may be set to a value that makes ckout to exceed
spi-max-frequency. Rather use lower value (e.g. round up divider when
ckout isn't accurate).
Also when the SPI clock isn't accurate, 'spi_master_freq' is filled in
with expected frequency. Use computed value instead to be more accurate:
- e.g. source clock / (CKOUTDIV + 1)
Enforce checks on the divider: ckoutdiv range can be from 1-255 to provide
divider of 2-256.
Signed-off-by: Fabrice Gasnier <fabrice.gasnier@st.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
Change device attributes' names to match ABI documentation. Names were
chosen such that they tend to be similar to existing ABI so it should
be easier to standardize them when necessary.
Signed-off-by: Marcelo Schmitt <marcelo.schmitt1@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|
|
- Fix CHECK Macro argument 'wordsize' may be better as '(wordsize)' to avoid precedence issues
Slightly modified by Jonathan to take into account the staging graduation
and a copy and paste version of the same item on the following line.
Signed-off-by: Vladimir Petrigo <vladimir.petrigo@gmail.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
|