summaryrefslogtreecommitdiff
path: root/drivers/iio/proximity/srf08.c
AgeCommit message (Collapse)AuthorFilesLines
2022-11-23iio: proximity: srf08: Convert to i2c's .probe_new()Uwe Kleine-König1-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-184-uwe@kleine-koenig.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-06-11iio: srf08: Remove redundant if statementLi Zhengyu1-1/+1
(!val) has been checked outside the loop, remove redundant (val &&) from loop. Signed-off-by: Li Zhengyu <lizhengyu3@huawei.com> Acked-by: Andreas Klinger <ak@it-klinger.de> Link: https://lore.kernel.org/r/20220523122755.90638-1-lizhengyu3@huawei.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2022-01-23iio:proximity:srf08: White space cleanup of spacing around {} in id tablesJonathan Cameron1-3/+3
The spacing in this driver was inconsistent with a space after the { but not before the }. Tidy this up to avoid providing a bad example to copy into new drivers. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Andreas Klinger <ak@it-klinger.de> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Link: https://lore.kernel.org/r/20211230174911.78291-10-jic23@kernel.org
2021-05-17iio: prox: srf08: Fix buffer alignment in iio_push_to_buffers_with_timestamp()Jonathan Cameron1-7/+7
To make code more readable, use a structure to express the channel layout and ensure the timestamp is 8 byte aligned. Found during an audit of all calls of uses of iio_push_to_buffers_with_timestamp() Fixes: 78f839029e1d ("iio: distance: srf08: add IIO driver for us ranger") Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Cc: Andreas Klinger <ak@it-klinger.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20210501170121.512209-13-jic23@kernel.org
2020-07-13Replace HTTP links with HTTPS ones: drivers/iioAlexander A. Klimov1-3/+3
Rationale: Reduces attack surface on kernel devs opening the links for MITM as HTTPS traffic is much harder to manipulate. Deterministic algorithm: For each file: If not .svg: For each line: If doesn't contain `\bxmlns\b`: For each link, `\bhttp://[^# \t\r\n]*(?:\w|/)`: If both the HTTP and HTTPS versions return 200 OK and serve the same content: Replace HTTP with HTTPS. Signed-off-by: Alexander A. Klimov <grandmaster@al2klimov.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2020-06-14iio: remove left-over parent assignmentsAlexandru Ardelean1-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>
2019-06-05treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 330Thomas Gleixner1-4/+1
Based on 1 normalized pattern(s): this file is subject to the terms and conditions of version 2 of the gnu general public license see the file copying in the main directory of this archive for more details extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 55 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Alexios Zavras <alexios.zavras@intel.com> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190530000436.108941081@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2017-08-23iio:proximity: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron1-2/+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>
2017-08-18iio: srf08: add support for srf02 in i2c modeAndreas Klinger1-18/+63
srf02 added with support for i2c interface Attributes for setting max range or sensitivity are omitted for the case of srf02 type sensor, because they are not supported by the hardware. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-18iio: srf08: add sensor type srf10Andreas Klinger1-15/+75
Ultrasonic sensor srf10 is quite similar to srf08 and now also supported by the driver as device tree compatible string. It was necessary to prepare the source for supplementary sensors. This is done by enum srf08_sensor_type. The most significiant difference between srf08 and srf10 is another range and values of register gain (in the driver it's call sensitivity). Therefore the array of it is extended and dependent of the sensor type. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-18iio: srf08: add triggered buffer supportAndreas Klinger1-3/+57
Add support for triggered buffers. Data format is quite simple: distance 16 Bit alignment 48 Bit timestamp 64 Bit Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-08-18iio: srf08: add device tree tableAndreas Klinger1-0/+8
Added MODULE_DEVICE_TABLE for device tree bindings. It used to work without it by using the i2c_device_id table, but adding the table makes everything clear and documented. Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
2017-01-28iio: distance: srf08: add IIO driver for us rangerAndreas Klinger1-0/+398
This is the IIO driver for devantech srf08 ultrasonic ranger which can be used to measure the distances to an object. The sensor supports I2C with some registers. Supported Features include: - read the distance in ranging mode in centimeters - output of the driver is directly the read value - together with the scale the driver delivers the distance in meters - only the first echo of the nearest object is delivered - set sensitivity as analog value in the range of 0-31 means setting gain register on device - set range registers; userspace enters max. range in millimeters in 43 mm steps Features not supported by this driver: - ranging mode in inches or in microseconds - ANN mode - change I2C address through this driver - light sensor The driver was added in the directory "proximity" of the iio subsystem and the menu in den config is now called "Proximity and distance sensors" Signed-off-by: Andreas Klinger <ak@it-klinger.de> Signed-off-by: Jonathan Cameron <jic23@kernel.org>