summaryrefslogtreecommitdiffstats
path: root/drivers/iio/chemical/vz89x.c
Commit message (Collapse)AuthorAgeFilesLines
* iio: chemical: vz89x: Convert enum->pointer for data in the match tablesBiju Das2023-09-111-11/+5
| | | | | | | | | | | | | | | Convert enum->pointer for data in the match tables, so that device_get_match_data() can do match against OF/ACPI/I2C tables, once i2c bus type match support added to it. Replace enum->struct *vz89x_chip_data for data in the match table. Simplify the probe() by replacing device_get_match_data() and ID lookup for retrieving data by i2c_get_match_data(). Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230818190429.338065-1-biju.das.jz@bp.renesas.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: Switch i2c drivers back to use .probe()Uwe Kleine-König2023-05-211-1/+1
| | | | | | | | | | | | After commit b8a1a4cd5a98 ("i2c: Provide a temporary .probe_new() call-back type"), all drivers being converted to .probe_new() and then 03c835f498b5 ("i2c: Switch .probe() to not take an id parameter") convert back to (the new) .probe() to be able to eventually drop .probe_new() from struct i2c_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/20230515205048.19561-1-u.kleine-koenig@pengutronix.de Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: chemical: vz89x: Convert to i2c's .probe_new()Uwe Kleine-König2022-11-231-3/+3
| | | | | | | | | | .probe_new() doesn't get the i2c_device_id * parameter, so determine that explicitly in the probe function. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20221118224540.619276-82-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: vz89x: Remove unnecessary castLars-Peter Clausen2021-12-161-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>
* iio:chemical:vz89x: Drop of_match_ptr protection and use generic fw accessorsJonathan Cameron2020-09-211-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
* iio:chemical:vz89x: Introduce local struct device pointer.Jonathan Cameron2020-09-211-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
* iio: remove left-over parent assignmentsAlexandru Ardelean2020-06-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | These were found by doing some shell magic: ------------ for file in $(git grep -w devm_iio_device_alloc | cut -d: -f1 | sort | uniq) ; do if grep 'parent =' $file | grep -v trig | grep -vq devm_; then echo "$file -> $(grep "parent =" $file)" fi done ----------- The output is bearable [after the semantic patch is applied]. There is a mix of trigger assignments with some iio device parent assignments that are removed via this patch. JC: A few more added via inspection of all parent = statements in drivers/iio. Some of these may just have crossed with this series, others were less obvious to scripting due to some cross file / module boundary calls. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: add SPDX identifier for various driversMatt Ranostay2018-02-181-13/+4
| | | | | | | Add GPLv2+ SPDX identifier and update email for author's drivers. Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:chemical: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron2017-08-221-1/+0
| | | | | | | | | The equivalent of both of these are now done via macro magic when the relevant register calls are made. The actual structure elements will shortly go away. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Lars-Peter Clausen <lars@metafoo.de>
* drivers: iio: chemical: replace comma with a semicolonArushi Singhal2017-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | Replace a comma between expression statements by a semicolon. This changes the semantics of the code, but given the current indentation appears to be what is intended. A simplified version of the Coccinelle semantic patch that performs this transformation is as follows: // <smpl> @r@ expression e1,e2; @@ e1 -, +; e2; // </smpl> Signed-off-by: Arushi Singhal <arushisinghal19971997@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: vz89x: fix boolreturn.cocci warningskbuild test robot2016-09-031-1/+1
| | | | | | | | | | | | drivers/iio/chemical/vz89x.c:119:9-10: WARNING: return of 0/1 in function 'vz89x_measurement_is_valid' with return type bool Return statements in functions returning bool should use true/false instead of 1/0. Generated by: scripts/coccinelle/misc/boolreturn.cocci CC: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: vz89x: prevent corrupted buffer from being readMatt Ranostay2016-08-291-2/+6
| | | | | Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: vz89x: add support for VZ89TE partMatt Ranostay2016-08-291-15/+98
| | | | | | | | Add support the VZ89TE variant which removes the voc_short channel, and has CRC check for data transactions. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: vz89x: abstract chip configurationMatt Ranostay2016-08-291-18/+62
| | | | | | | | Abstract chip configuration data to allow supporting multiple variants of the VZ89 chemical sensor line. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: convert to common i2c_check_functionality() return valueMatt Ranostay2016-02-271-1/+1
| | | | | | | | | Previously most drivers that used a i2c_check_functionality() check condition required various error codes on failure. This patchset converts to a standard of -EOPNOTSUPP Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: vz89x: rework i2c transfer readingMatt Ranostay2015-12-031-14/+52
| | | | | | | | Add an optimized i2c transfer reading function, and fallback to racey smbus transfers if client->adapter doesn't support this. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: vz89x hardware i2c workaroundMatt Ranostay2015-09-301-2/+21
| | | | | | | | | | | | Chipset sometime updates in the middle of a reading causing it to reset the data pointer, and causing invalid reading of previous data. We can check for this invalid state by reading MSB of the resistance reading that is always zero, and by also confirming the VOC_short isn't zero. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: chemical: add SGX VZ89x VOC sensor supportMatt Ranostay2015-09-231-0/+237
Add support for VZ89X sensors VOC and CO2 reporting channels in percentage which can be converted to part per million. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>