aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/chemical (follow)
AgeCommit message (Collapse)AuthorFilesLines
2022-02-21iio:chemical:atlas: Switch from CONFIG_PM guards to pm_ptr() etcJonathan Cameron1-5/+2
Letting the compiler remove these functions when the kernel is built without CONFIG_PM support is simpler and less error prone than the use of #ifdef based config guards. Removing instances of this approach from IIO also stops them being copied into new drivers. Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Paul Cercueil <paul@crapouillou.net> Link: https://lore.kernel.org/r/20220130193147.279148-49-jic23@kernel.org
2022-02-18iio:chemical:bme680: Move exports to IIO_BME680 namespaceJonathan Cameron3-2/+4
In order to avoid unnecessary pollution of the global symbol namespace move the common/library functions into a specific namespace and import that into the bus specific device drivers that use them. For more information see https://lwn.net/Articles/760045/ Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Himanshu Jha <himanshujha199640@gmail.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20220130205701.334592-17-jic23@kernel.org
2022-02-13iio: chemical: atlas-ezo-sensor: Make use of device propertiesAndy Shevchenko1-15/+17
Convert the module to be property provider agnostic and allow it to be used on non-OF platforms. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220207124204.11658-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-02-06iio: chemical: bme680: Switch from of headers to mod_devicetable.hAndy Shevchenko1-1/+1
There is nothing directly using of specific interfaces in this driver, so lets not include the headers. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20220203122725.75939-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-01-23iio: sps30: Use sysfs_emit()Lars-Peter Clausen1-1/+1
sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `cleaning_period` device attribute of the sps30 driver. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20211216185217.1054495-14-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-01-23iio: scd4x: Use sysfs_emit()Lars-Peter Clausen1-1/+1
sysfs_emit() is preferred over raw s*printf() for sysfs attributes since it knows about the sysfs buffer specifics and has some built-in checks for size and alignment. Use sysfs_emit() to format the custom `calibration_auto_enable` device attribute of the scd4x driver. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20211216185217.1054495-13-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-01-23iio:chemical:atlas: Trivial white space cleanup to add space before }Jonathan Cameron1-5/+5
Having a space after the { and not one before the } is inconsistent and good to remove examples that might get copied into new drivers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Matt Ranostay <matt.ranostay@konsulko.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Link: https://lore.kernel.org/r/20211230174911.78291-2-jic23@kernel.org
2021-12-28iio: chemical: sunrise_co2: set val parameter only on successTom Rix1-2/+2
Clang static analysis reports this representative warning sunrise_co2.c:410:9: warning: Assigned value is garbage or undefined *val = value; ^ ~~~~~ The ealier call to sunrise_read_word can fail without setting value. So defer setting val until we know the read was successful. Fixes: c397894e24f1 ("iio: chemical: Add Senseair Sunrise 006-0-007 driver") Signed-off-by: Tom Rix <trix@redhat.com> Link: https://lore.kernel.org/r/20211224150833.3278236-1-trix@redhat.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-12-16iio: vz89x: Remove unnecessary castLars-Peter Clausen1-1/+1
The case to u8 * is unnecessary here since the expression is already of type u8 *. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-11-17iio: atlas-sensor: Remove no-op trigger opsLars-Peter Clausen1-4/+0
The IIO core handles a trigger ops with all NULL callbacks the same as if the trigger ops itself was NULL. Remove the empty trigger ops from the interrupt trigger driver to slightly reduce the boilerplate code. Object size of the driver module is also slightly reduced. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20211031142130.20791-7-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-21iio: chemical: scd4x: Add a scale for the co2 concentration readingRoan van Dijk1-2/+7
This patch adds a scale for the co2 concentration reading. The reading is expressed in percent after applying the scale to the raw value. Signed-off-by: Roan van Dijk <roan@protonic.nl> Link: https://lore.kernel.org/r/20211021140018.3051213-1-roan@protonic.nl Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19drivers: iio: chemical: Add support for Sensirion SCD4x CO2 sensorRoan van Dijk3-0/+705
This is a driver for the SCD4x CO2 sensor from Sensirion. The sensor is able to measure CO2 concentration, temperature and relative humdity. The sensor uses a photoacoustic principle for measuring CO2 concentration. An I2C interface is supported by this driver in order to communicate with the sensor. Signed-off-by: Roan van Dijk <roan@protonic.nl> Link: https://lore.kernel.org/r/20211008101706.755942-4-roan@protonic.nl Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19iio: chemical: SENSEAIR_SUNRISE_CO2 depends on I2CRandy Dunlap1-0/+1
Fix kconfig symbol dependency warning: WARNING: unmet direct dependencies detected for REGMAP_I2C Depends on [n]: I2C [=n] Selected by [y]: - SENSEAIR_SUNRISE_CO2 [=y] && IIO [=y] Fixes: c397894e24f1 ("iio: chemical: Add Senseair Sunrise 006-0-007 drive") Signed-off-by: Randy Dunlap <rdunlap@infradead.org> Cc: Jacopo Mondi <jacopo@jmondi.org> Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: linux-iio@vger.kernel.org Link: https://lore.kernel.org/r/20211002232803.5108-1-rdunlap@infradead.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-10-19iio: chemical: Add Senseair Sunrise 006-0-007 driverJacopo Mondi3-0/+548
Add support for the Senseair Sunrise 006-0-0007 driver through the IIO subsystem. Datasheet: https://rmtplusstoragesenseair.blob.core.windows.net/docs/Dev/publicerat/TDE5531.pdf Signed-off-by: Jacopo Mondi <jacopo@jmondi.org> Link: https://lore.kernel.org/r/20210920135413.140310-4-jacopo+renesas@jmondi.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-08-08iio: chemical: Add driver support for sgp40Andreas Klinger3-0/+390
sgp40 is a gas sensor used for measuring the air quality. This driver is reading the raw resistance value which can be passed to an userspace algorithm for further calculation. The raw value is also used to calculate an estimated absolute voc index in the range from 0 to 500. For this purpose the raw_mean value of the resistance for which the index value is 250 might be set up as a calibration step. This can be done with in_resistance_calibbias. Compensation of relative humidity and temperature is supported and can be used by writing to output values of out_humidityrelative_raw and out_temp_raw. There is a predecesor sensor type (sgp30) already existing. This driver module was not extended because the new sensor is quite different in its i2c telegrams. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Reported-by: kernel test robot <lkp@intel.com> Link: https://lore.kernel.org/r/20210804154641.GA3237@arbad Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-06-16iio: chemical: atlas-sensor: Balance runtime pm + pm_runtime_resume_and_get()Jonathan Cameron1-9/+4
The pm_runtime_put_noidle() call in remove isn't balanced with any get, so drop it. Note this isn't a bug as the runtime pm core will not allow the reference count to go negative, making this a noop. However, it is confusing to the reader so let's drop it. pm_runtime_resume_and_get() replacement found using the coccicheck script under review at: https://lore.kernel.org/lkml/20210427141946.2478411-1-Julia.Lawall@inria.fr/ As pm_runtime_resume_and_get() returns <= 0 take advantage of that to change the error checking to if (ret) which is more in keeping with the rest of this driver. This is a prequel to taking a closer look at the runtime pm in IIO drivers in general. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Matt Ranostay <matt.ranostay@konsulko.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Reviewed-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org> Link: https://lore.kernel.org/r/20210516162103.1332291-4-jic23@kernel.org
2021-06-03iio: chemical: sgp30: Drop use of %hx in format string.Jonathan Cameron1-1/+1
Since: commit cbacb5ab0aa0 ("docs: printk-formats: Stop encouraging use of unnecessary %h[xudi] and %hh[xudi]") use of these format strings has been discouraged. As there are only a few such uses in IIO, lets clear them all out and avoid chance of them getting copied into new drivers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Nathan Chancellor <nathan@kernel.org> Cc: Andreas Brauchli <andreas.brauchli@sensirion.com> Reviewed-by: Nathan Chancellor <nathan@kernel.org> Link: https://lore.kernel.org/r/20210517125554.1463156-5-jic23@kernel.org
2021-05-17iio: chemical: atlas: Fix buffer alignment in iio_push_to_buffers_with_timestamp()Jonathan Cameron1-2/+2
Variable location for the timestamp, so just use __aligned(8) to ensure it is always possible to naturally align it. Found during an audit of all calls of uses of iio_push_to_buffers_with_timestamp() Fixes tag is not accurate, but it will need manual backporting beyond that point if anyone cares. Fixes: 0d15190f53b4 ("iio: chemical: atlas-ph-sensor: rename atlas-ph-sensor to atlas-sensor") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Matt Ranostay <matt.ranostay@konsulko.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20210501171352.512953-6-jic23@kernel.org
2021-05-17iio: bme680_i2c: Remove acpi_device_id tableGuenter Roeck1-8/+0
With CONFIG_ACPI=n and -Werror, 0-day reports: drivers/iio/chemical/bme680_i2c.c:46:36: error: 'bme680_acpi_match' defined but not used Apparently BME0680 is not a valid ACPI ID. Remove the ID. Note the driver will still work with ACPI bindings that use the PRP0001 mechanism as that uses the of_device_id table instead. Reported-by: kernel test robot <lkp@intel.com> Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-17iio: bme680_spi: Remove acpi_device_id tableGuenter Roeck1-8/+0
BME0680 is not an official ACPI ID, so let's remove it before someone starts using it. Note that ACPI can still be used with this driver via the PRP0001 method which will use the of_device_id table to match. Signed-off-by: Guenter Roeck <linux@roeck-us.net> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-17iio: core: move @id from struct iio_dev to struct iio_dev_opaqueJonathan Cameron3-3/+4
Continuing from Alexandru Ardelean's introduction of the split between driver modifiable fields and those that should only be set by the core. This could have been done in two steps to make the actual move after introducing iio_device_id() but there seemed limited point to that given how mechanical the majority of the patch is. Includes fixup from Alex for missing mxs-lradc-adc conversion. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Alexandru Ardelean <ardeleanalex@gmail.com> Link: https://lore.kernel.org/r/20210426174911.397061-2-jic23@kernel.org
2021-05-17iio: sps30: add support for serial interfaceTomasz Duszynski3-0/+443
Sensor has support for both i2c and serial communication interfaces. Both offer very similar set of features. Minor differences don't impact overall functionality like doing measurements, etc. Support for i2c have already been added, this patch adds support for the latter ie. serial interface. Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-17iio: sps30: separate core and interface specific codeTomasz Duszynski5-226/+353
Move code responsible for handling i2c communication to a separate file. Rationale for this change is preparation for adding support for serial communication. Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-05-17iio:chemical:sps30: Convert sysfs sprintf/snprintf family to sysfs_emitTian Tao1-3/+3
Fix the following coccicheck warning: ./drivers/iio/chemical/sps30.c:414:8-16: WARNING: use scnprintf or sprintf Signed-off-by: Tian Tao <tiantao6@hisilicon.com> Link: https://lore.kernel.org/r/1618216751-1678-2-git-send-email-tiantao6@hisilicon.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-04-07iio:chemical:scd30: Use IRQF_NO_AUTOEN to avoid irq request then disableJonathan Cameron1-8/+8
This new flag cleanly avoids the need for a dance where we request the interrupt only to immediately disabling it by ensuring it is not auto-enabled in the first place. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Tomasz Duszynski <tomasz.duszynski@octakon.com> Reviewed-by: Barry Song <song.bao.hua@hisilicon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20210402184544.488862-6-jic23@kernel.org
2021-03-25iio: chemical: atlas: Remove code to set trigger parentGwendal Grignou1-1/+0
iio_trigger_set_drvdata() sets the trigger device parent to first argument of viio_trigger_alloc(), no need to do it again in the driver code. Given we call devm_iio_trigger_alloc() and devm_iio_device_alloc() with &client->dev as parent, we do not have to set data->trig->dev.parent to indio_dev->dev.parent anymore. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20210309193620.2176163-7-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-25iio: fix devm_iio_trigger_alloc with parent.cocciGwendal Grignou2-2/+0
Use cocci semantic patch: @@ expression trigger, P; @@ trigger = devm_iio_trigger_alloc(P, ...); ... - trigger->dev.parent = P; To remove trigger->dev.parent, since it is set by default. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210309193620.2176163-3-gwendal@chromium.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-25iio: chemical: bmp680: Drop unneeded explicit castingsAndy Shevchenko2-4/+2
In few places the unnecessary explicit castings are being used. Drop them for good. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20210312134349.3472-1-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-03-11iio: use getter/setter functionsJulia Lawall1-1/+1
Use getter and setter functions, for a variety of data types. Signed-off-by: Julia Lawall <Julia.Lawall@inria.fr> Link: https://lore.kernel.org/r/20210209211315.1261791-1-Julia.Lawall@inria.fr Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-01-09iio: bme680: Use DIV_ROUND_CLOSEST() instead of open-coding itLars-Peter Clausen1-1/+1
Use DIV_ROUND_CLOSEST() instead of open-coding it. This documents intent and makes it more clear what is going on for the casual reviewer. Generated using the following the Coccinelle semantic patch. // <smpl> @r1@ expression x; constant C1; constant C2; @@ ((x) + C1) / C2 @script:python@ C1 << r1.C1; C2 << r1.C2; @@ try: if int(C1) * 2 != int(C2): cocci.include_match(False) except: cocci.include_match(False) @@ expression r1.x; constant r1.C1; constant r1.C2; @@ -(((x) + C1) / C2) +DIV_ROUND_CLOSEST(x, C2) // </smpl> Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Link: https://lore.kernel.org/r/20201227171126.28216-2-lars@metafoo.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2021-01-09iio: chemical: pms7003: convert comma to semicolonZheng Yongjun1-1/+1
Replace a comma between expression statements by a semicolon. Signed-off-by: Zheng Yongjun <zhengyongjun3@huawei.com> Link: https://lore.kernel.org/r/20201211085700.3037-1-zhengyongjun3@huawei.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-22Merge tag 'iio-for-5.10b-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-nextGreg Kroah-Hartman4-32/+28
Jonathan writes: Second set of features and cleanups for IIO in 5.10 We have a couple of changes that apply to large sets of drivers, so I have grouped those to keep this short. There are a few late breaking fixes in here that can wait for the merge window. dt yaml conversions ------------------- * adi,ad7768-1 * adi,ad7949 * aspeed,ast2400 * cosmic,10001-adc * dlg,da9150-gpadc * fsl,imx25-gcq * fsl,imx7d-adc * fsl,vf610 * holt,hi8435 * marvell,berlin2-adc * motorola,cpcap-adc * nuvoton,nau7802 * nuvoton,npcm750-adc * nxp,lpc1850-adc * nxp,lpc3220 * sprd,sc2720-adc * st,stmpe-adc * ti,adc12138 * ti,ads1015 * ti,ads7950 * ti,twl4030-madc Features -------- * adxrs290 - Add triggered buffer support and expose data ready signal as a possible trigger. Includes updating bindings. - Add debugfs hooks for register access. * mlx90632 - Add a clear user interface to override the measured ambient temperature. * vl53l0x - Add IRQ support including dt bindings. Cleanups and minor fixes ------------------------ (groups) Replace mlock with local lock: * adf4350 * exynos-adc * fls-imx25-gcq * stm32-dac devm use to simplify probe error handling and remove functions. * adis16201 * adis16203 * adis16209 * adis16240 * adis16136 * adis16260 * adis16400 * adis16460 * adis16480 * adis library - drop unused adis_setup_buffer_and_trigger() of_match_ptr removal and incorrect ACPI binding removal of_match_ptr() rarely makes sense in an IIO driver as space saving is trivial and it breaks ACPI PRP0001 based instantiation. Mostly this series is about removing examples that get copied into new drivers. * ad2s1200 * ad5272 * ad5446 * ad5592r * ad5593r * ad5703 * ak8974 * ak8975 * ams-iaq-core * as3935 * atlas-sensor * ds1803 * hdc100x * htu21 * icp10100 * lmp91000 * pulsedlight * max30102 * max5432 * max5481 * mcp4018 * mcp4131 * mcp4531 * mcp4725 * ms5611 * ms5637 * si7020 * sgp30 * ti-dac082s085 * ti-dac5571 * tmp007 * tsys01 * vz89x * zpa2326 kernel-doc fixes * iio-core * ad7303 * ad7947 * adis16080 * adis16400 * iio_dummy_evgen * sgp30 Fixes for buffer alignment when passed to iio_push_to_buffers_with_timestamp() This is a long running effort. There are a few more drivers to come. * inv_mpu6050 * itg3200 * si1145 * st_lsm6dsx * ti-adc0832 * ti-adc12138 (not driver focused) * MAINTAINERS - Consolidate Analog Device IIO entries whilst removing Beniamin Bia. - Remove Hartmut Knaack as a listed IIO maintainer as he hasn't been active for a long time and people are getting intermitted bounces. * Add __printf() markings to a few functions that were missing them. * drop some rotted documentation from staging. * rework buffer sysfs file creation (precursor to multiple buffer support) (individual drivers) * ad5592r - Fix use of true for IIO_SHARED_BY_TYPE - Tidy up locking and indentation. * ad9467 - Improve error message on chip-id missmatch. - Use more appropriate error value if chip-id not recognised. * adis-library - Simplify burst mode handling. * adxrs290 - Make sure to switch device to standby mode during remove. * as73211 - Increase measurement timeout as seems some devices are slower. * bma180 - Fix use of true fo IIO_SHARED_BY_TYPE * exynos_adc - Update binding to require second interrut with touch screen. - Update binding to not require syscon on S5Pv210 * hmc5843 - Fix use of true for IIO_SHARED_BY_TYPE * inv_mpu6050 - Use regmap_noinc_read() for fifo reading. * palmas_gpadc - Use module_platform_driver() to remove boilerplate. * meson-saradc - style consistency fixes * rockchip_saradc - Allow compile testing with !ARM. * st_lsm6dsx - Changing scaling factor to use IIO_VAL_INT_PLUS_NANO to improve precision. - Fix an issue with unchecked return value. * stm32-adc - Fix a missing return introduced in dev_err_probe() patch earlier in cycle. * sx9310 - Prefer async mode for probe as paticularly slow startup. * vcnl4000 - Add missing interrupt property to dt binding. * tag 'iio-for-5.10b-take2' of https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio: (126 commits) dt-bindings: iio: vishay,vcnl4000: add interrupts property iio:imu:inv_mpu6050: Use regmap_noinc_read for fifo reads. iio:imu:inv_mpu6050 Fix dma and ts alignment and data leak issues. iio:adc:ti-adc12138 Fix alignment issue with timestamp iio:adc:ti-adc0832 Fix alignment issue with timestamp iio:imu:st_lsm6dsx Fix alignment and data leak issues iio:light:si1145: Fix timestamp alignment and prevent data leak. iio:gyro:itg3200: Fix timestamp alignment and prevent data leak. iio:imu:st_lsm6dsx: check st_lsm6dsx_shub_read_output return iio: adc: exynos_adc: Replace indio_dev->mlock with own device lock dt-bindings:iio:adc:holt,hi8435 yaml conversion dt-bindings:iio:adc:adi,ad7768-1 yaml conversion dt-bindings:iio:adc:adi,ad7949 yaml conversion dt-bindings:iio:adc:dlg,da9150-gpadc yaml conversion dt-bindings:iio:adc:motorola,cpcap-adc yaml conversion dt-bindings:iio:adc:nxp,lpc3220-adc yaml conversion dt-bindings:iio:adc:nxp,lpc1850-adc yaml conversion dt-bindings:iio:adc:fsl,imx25-gcq yaml conversion dt-bindings:iio:adc:fsl,imx7d-adc yaml conversion dt-bindings:iio:adc:ti,ads1015 yaml conversion ...
2020-09-21iio: chemical: sgp30: Add description for sgp_read_cmd()'s 'duration_us'Lee Jones1-0/+1
Fixes the following W=1 kernel build warning(s): drivers/iio/chemical/sgp30.c:236: warning: Function parameter or member 'duration_us' not described in 'sgp_read_cmd' Signed-off-by: Lee Jones <lee.jones@linaro.org> Cc: Andreas Brauchli <a.brauchli@elementarea.net> Cc: Pascal Sachs <pascal.sachs@sensirion.com> Link: https://lore.kernel.org/r/20200716135928.1456727-6-lee.jones@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-21iio:chemical:vz89x: Drop of_match_ptr protection and use generic fw accessorsJonathan Cameron1-7/+4
This change allow the driver to be used with ACPI PRP0001 and removes an antipattern that I want to avoid being copied into new IIO drivers. The handling of match_data uses a different approach as device_get_match_data() doesn't distinguish between no match, and a match but with NULL data. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20200910173242.621168-30-jic23@kernel.org
2020-09-21iio:chemical:vz89x: Introduce local struct device pointer.Jonathan Cameron1-4/+5
Avoids lots of repetition of &client->dev and will make the next patch tidier. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20200910173242.621168-29-jic23@kernel.org
2020-09-21iio:chemical:sgp30: Drop of_match_ptr and use generic fw accessorsJonathan Cameron1-6/+4
This change allow the driver to be used with ACPI PRP0001 and removes an antipattern that I want to avoid being copied into new IIO drivers. The handling of match_data uses a different approach as device_get_match_data doesn't distinguish between no match, and a match but with NULL data. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Andreas Brauchli <andreas.brauchli@sensirion.com> Link: https://lore.kernel.org/r/20200910173242.621168-28-jic23@kernel.org
2020-09-21iio:chemical:sgp30: Use local variable dev to simplify codeJonathan Cameron1-10/+10
This cleans up the code at bit, but is primarily here as a precusor to the next patch. I've only done this for the two functions which use the dev pointer repeatedly. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: Andreas Brauchli <andreas.brauchli@sensirion.com> Link: https://lore.kernel.org/r/20200910173242.621168-27-jic23@kernel.org
2020-09-21iio:chemical:atlas-sensor: Drop of_match_ptr and use generic fw accessorsJonathan Cameron1-6/+4
of_match_ptr() prevents use of this driver with ACPI via PRP0001 and is an example of an anti pattern I'm trying to remove from IIO. Hence drop from this driver and use generic fw accessors to check if there is a fw_node and get the id. It might be neater to use pointers rather than indexes for the device_data but that is another issue and should be handled separately. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20200910173242.621168-26-jic23@kernel.org
2020-09-21iio:chemical:ams-iaq-core: Drop of_match_ptr protectionJonathan Cameron1-1/+2
This prevents use of this driver with ACPI via PRP0001 and is an example of an anti pattern I'm trying to remove from IIO. Hence drop from this driver. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20200910173242.621168-25-jic23@kernel.org
2020-09-14Merge 5.9-rc5 into staging-nextGreg Kroah-Hartman2-5/+10
We want the staging/iio changes in here as well. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-09-13Merge tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/stagingLinus Torvalds1-4/+9
Pull staging/IIO driver fixes from Greg KH: "Here are a number of staging and IIO driver fixes for 5.9-rc5. The majority of these are IIO driver fixes, to resolve a timestamp issue that was recently found to affect a bunch of IIO drivers. The other fixes in here are: - small IIO driver fixes - greybus driver fix - counter driver fix (came in through the IIO fixes tree) All of these have been in linux-next for a while with no reported issues" * tag 'staging-5.9-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (23 commits) iio: adc: mcp3422: fix locking on error path iio: adc: mcp3422: fix locking scope iio: adc: meson-saradc: Use the parent device to look up the calib data iio:adc:max1118 Fix alignment of timestamp and data leak issues iio:adc:ina2xx Fix timestamp alignment issue. iio:adc:ti-adc084s021 Fix alignment and data leak issues. iio:adc:ti-adc081c Fix alignment and data leak issues iio:magnetometer:ak8975 Fix alignment and data leak issues. iio:light:ltr501 Fix timestamp alignment issue. iio:light:max44000 Fix timestamp alignment and prevent data leak. iio:chemical:ccs811: Fix timestamp alignment and prevent data leak. iio:proximity:mb1232: Fix timestamp alignment and prevent data leak. iio:accel:mma7455: Fix timestamp alignment and prevent data leak. iio:accel:bmc150-accel: Fix timestamp alignment and prevent data leak. iio:accel:mma8452: Fix timestamp alignment and prevent data leak. iio: accel: kxsd9: Fix alignment of local buffer. iio: adc: rockchip_saradc: select IIO_TRIGGERED_BUFFER iio: adc: ti-ads1015: fix conversion when CONFIG_PM is not set counter: microchip-tcb-capture: check the correct variable iio: cros_ec: Set Gyroscope default frequency to 25Hz ...
2020-09-03iio: chemical: scd30: Simplify with dev_err_probe()Krzysztof Kozlowski1-7/+2
Common pattern of handling deferred probe can be simplified with dev_err_probe(). Less code and also it prints the error value. Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Acked-by: Tomasz Duszynski <tomasz.duszynski@octakon.com> Link: https://lore.kernel.org/r/20200829064726.26268-11-krzk@kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-09-03iio: chemical: atlas-ezo-sensor: add humidity sensor supportMatt Ranostay1-1/+36
Add support for atlas,hum-ezo / humidity sensor which with scaling provides respective data in millipercent Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-08-23treewide: Use fallthrough pseudo-keywordGustavo A. R. Silva1-1/+1
Replace the existing /* fall through */ comments and its variants with the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary fall-through markings when it is the case. [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
2020-08-22iio:chemical:ccs811: Fix timestamp alignment and prevent data leak.Jonathan Cameron1-4/+9
One of a class of bugs pointed out by Lars in a recent review. iio_push_to_buffers_with_timestamp assumes the buffer used is aligned to the size of the timestamp (8 bytes). This is not guaranteed in this driver which uses an array of smaller elements on the stack. As Lars also noted this anti pattern can involve a leak of data to userspace and that indeed can happen here. We close both issues by moving to a suitable structure in the iio_priv() data with alignment explicitly requested. This data is allocated with kzalloc so no data can leak appart from previous readings. The explicit alignment of ts is necessary to ensure consistent padding for x86_32 in which the ts would otherwise be 4 byte aligned. Fixes: 283d26917ad6 ("iio: chemical: ccs811: Add triggered buffer support") Reported-by: Lars-Peter Clausen <lars@metafoo.de> Cc: Narcisa Ana Maria Vasile <narcisaanamaria12@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Cc: <Stable@vger.kernel.org>
2020-08-22iio: chemical: atlas-ezo-sensor: add support for O2 sensorMatt Ranostay1-19/+54
Add support for the Atlas EZO O2 chemical sensor which required some refactoring of the driver and parsing of i2c transfer. Sensor data is converted by the scaling value from percent to IIO_CONCENTRATION. Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: chemical: scd30: add serial interface driverTomasz Duszynski3-0/+275
Add serial interface driver for the SCD30 sensor. Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: chemical: scd30: add I2C interface driverTomasz Duszynski3-0/+151
Add I2C interface driver for the SCD30 sensor. Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-27iio: chemical: scd30: add core driverTomasz Duszynski4-0/+861
Add Sensirion SCD30 carbon dioxide core driver. Signed-off-by: Tomasz Duszynski <tomasz.duszynski@octakon.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-20iio: Move attach/detach of the poll func to the coreLars-Peter Clausen1-5/+1
All devices using a triggered buffer need to attach and detach the trigger to the device in order to properly work. Instead of doing this in each and every driver by hand move this into the core. At this point in time, all drivers should have been resolved to attach/detach the poll-function in the same order. This patch removes all explicit calls of iio_triggered_buffer_postenable() & iio_triggered_buffer_predisable() in all drivers, since the core handles now the pollfunc attach/detach. The more peculiar change is for the 'at91-sama5d2_adc' driver, since it's not immediately obvious that removing the hooks doesn't break anything. Eugen was able to test on at91-sama5d2-adc driver, sama5d2-xplained board. All seems to be fine. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Tested-by: Eugen Hristev <eugen.hristev@microchip.com> #for at91-sama5d2-adc Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>