summaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/apds9960.c
Commit message (Collapse)AuthorAgeFilesLines
* iio: make use of devm_iio_kfifo_buffer_setup() helperAlexandru Ardelean2021-03-111-9/+7
| | | | | | | | | | | | | | | | | | | | | All drivers that already call devm_iio_kfifo_allocate() & iio_device_attach_buffer() are simple to convert to iio_device_attach_kfifo_buffer() in a single go. This change does that; the unwind order is preserved. What is important, is that the devm_iio_kfifo_buffer_setup() be called after the indio_dev->modes is assigned, to make sure that INDIO_BUFFER_SOFTWARE flag is set and not overridden by the assignment to indio_dev->modes. Also, the INDIO_BUFFER_SOFTWARE has been removed from the assignments of 'indio_dev->modes' because it is set by devm_iio_kfifo_buffer_setup(). Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com>x Link: https://lore.kernel.org/r/20210215104043.91251-4-alexandru.ardelean@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio:light:apds9960 add detection for MSHW0184 ACPI device in apds9960 driverMax Leiter2021-01-091-0/+8
| | | | | | | | | The device is used in the Microsoft Surface Book 3 and Surface Pro 7 Signed-off-by: Max Leiter <maxwell.leiter@gmail.com> Reviewed-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20201220015057.107246-1-maxwell.leiter@gmail.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: light: apds9960: remove unneeded semicolonTom Rix2020-10-311-1/+1
| | | | | | | | | A semicolon is not needed after a switch statement. Signed-off-by: Tom Rix <trix@redhat.com> Acked-by: Matt Ranostay <matt.ranostay@konsulko.com> Link: https://lore.kernel.org/r/20201027201436.1597726-1-trix@redhat.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: remove explicit IIO device parent assignmentAlexandru Ardelean2020-06-141-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch applies the semantic patch: @@ expression I, P, SP; @@ I = devm_iio_device_alloc(P, SP); ... - I->dev.parent = P; It updates 302 files and does 307 deletions. This semantic patch also removes some comments like '/* Establish that the iio_dev is a child of the i2c device */' But this is is only done in case where the block is left empty. The patch does not seem to cover all cases. It looks like in some cases a different variable is used in some cases to assign the parent, but it points to the same reference. In other cases, the block covered by ... may be just too big to be covered by the semantic patch. However, this looks pretty good as well, as it does cover a big bulk of the drivers that should remove the parent assignment. Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: apds9960: Drop GPIO includesLinus Walleij2019-12-151-2/+0
| | | | | | | | | The driver includes <linux/gpio.h> and <linux/of_gpio.h> yet fails to use symbols from any of the include files, so drop these includes. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* iio: light: apds9960: Fix a typoChristophe JAILLET2019-07-271-1/+1
| | | | | | | | s/ADPS9960/APDS9960/ (P and D switched) Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
* regmap: split up regmap_config.use_single_rwDavid Frey2018-09-071-1/+2
| | | | | | | | | | | | | | | | Split regmap_config.use_single_rw into use_single_read and use_single_write. This change enables drivers of devices which only support bulk operations in one direction to use the regmap_bulk_*() functions for both directions and have their bulk operation split into single operations only when necessary. Update all struct regmap_config instances where use_single_rw==true to instead set both use_single_read and use_single_write. No attempt was made to evaluate whether it is possible to set only one of use_single_read or use_single_write. Signed-off-by: David Frey <dpfrey@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
* iio: add SPDX identifier for various driversMatt Ranostay2018-02-181-12/+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:light: 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>
* iio: light: apds9960: add system-wide suspendMatt Ranostay2017-04-141-0/+2
| | | | | | | | APDS9960 can safely force runtime suspend if the system wants to enter system-wide suspend Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: light: apds9960: constify attribute_group structuressimran singhal2017-04-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Check for attribute_group structures that are only stored in the attrs filed of iio_info structure. As the attrs field of iio_info structures is constant, so these attribute_group structures can also be declared constant. Done using coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct attribute_group i@p = {...}; @ok1@ identifier r1.i; position p; struct iio_info x; @@ x.attrs=&i@p; @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ static +const struct attribute_group i={...}; @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct attribute_group i; File size before: text data bss dec hex filename 8503 488 0 8991 231f drivers/iio/light/apds9960.o File size after: text data bss dec hex filename 8567 424 0 8991 231f drivers/iio/light/apds9960.o Signed-off-by: simran singhal <singhalsimran0@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: light: apds9960: Add OF device ID tableJavier Martinez Canillas2017-03-191-0/+7
| | | | | | | | | | | | | 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 I2C device registered via OF will always match a legacy I2C device ID and that the MODALIAS reported will always be of the form i2c:<device>. But 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. Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:core: timestamping clock selection supportGregor Boirie2016-06-301-2/+2
| | | | | | | | | | | | | | | Adds a new per-device sysfs attribute "current_timestamp_clock" to allow userspace to select a particular POSIX clock for buffered samples and events timestamping. Following clocks, as listed in clock_gettime(2), are supported: CLOCK_REALTIME, CLOCK_MONOTONIC, CLOCK_MONOTONIC_RAW, CLOCK_REALTIME_COARSE, CLOCK_MONOTONIC_COARSE, CLOCK_BOOTTIME and CLOCK_TAI. Signed-off-by: Gregor Boirie <gregor.boirie@parrot.com> Acked-by: Sanchayan Maity <maitysanchayan@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: light apds9960: Add the missing dev.parentYong Li2016-06-031-0/+1
| | | | | | | | | | | Without this, the iio:deviceX is missing in the /sys/bus/i2c/devices/0-0039 Some userspace tools use this path to identify a specific instance of the device. Signed-off-by: Yong Li <sdliyong@gmail.com> Reviewed-By: Matt Ranostay <mranostay@gmail.com> Cc: <Stable@vger.kernel.org> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* Merge tag 'iio-for-4.7b' of ↵Greg Kroah-Hartman2016-04-261-4/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testing Jonathan writes: 2nd set of new device support, features and cleanup for IIO in the 4.7 cycle. Bit of a bumper set for new drivers but plenty of other stuff here as well! New device support * ad5592R ADC/DAC - new driver supporting ad5592r and ad5593r combined ADC/DAC and gpio chips. * Aosong am2315 relative humidity - new driver with triggered buffer support in follow up patch. * bmi160 imu - new driver * bmp280 - bmp180 support - note there is support in the misc/bmp085 driver. Intent is to remove that driver long term. * invensense mpu6050 - cleanup leading to explicit support of mpu9150 with a good few cleanups along the way. * Hope RF hp03 pressure and temperature sensor. - new driver * maxim DS1803 potentiometer - new driver * maxim max44000 light and proximity sensor - new driver built in a series of steps to support pretty much everything. * ROHM BH1780 light sensor - new driver. There is an existing driver in misc that this is pretty much intended to replace. The discussion on whether to support the non standard interface of that driver is some way is continuing. * st-gyro - lsm9ds0-gyro. The accel/magn side of this will take a while longer as extensions to the st library are needed for cases where two types of sensor share a single i2c address. * ti-adc081c - support the adc101c and adc121c * Vishay VEML6070 UV sensor - new driver. New features * core - devm_ APIs for channel_get and channel_get_all. The first user of these is the generic ADC based thermal driver. As it is going through the thermal tree these will be picked up as a patch to that next cycle as that is how the author preferred to do it. - mounting matrix support. This new core support allows devices to provide to userspace (typically from the device tree) allowing compensation for how the sensor is mounted on the device. First examples are on UAVs but it has a more mundane use on typical phone where the chip may be on the front or the back of the circuit board and soldered at any angle. Includes support for this ABI in ak8975 (which has an older interface, now deprecated) and mpu6050. * tools - add a -a option to enable all available channels in generic_buffer sample. Makes it somewhat easier to use. * adis library and drivers - support manual self test flag clearing. This has technically been broken for a very long time - result is an offset on readings as the applied field is on all the time. * ak8975 - triggered buffer support * bmc150 - spi support (including splitting the driver into core and i2c parts) * bmp280 - oversampling support. * dht11 - improved logging - useful to debug timing issues on this quirky device. * st-sensors - read each channel invidivually as not all support the optimization of reading in bulk. This is technically a fix, but will need to be backported if desired. - support open drain and shared interrupts. * ti-adc081c - triggered buffer support. Cleanups * inkern - white space fix. * ad7606 - use the iio_device_claim_direct_mode call rather than open coding equiv. * ad799x - white space fix. * ad9523 - unsigned -> unsigned int * apds9660 - brace location tidying up. - silence an uninitialized variable warning. * ak8975 - else and brace on same line fix. * at91_adc - white space fixes. * bmc150 - use regmap stored copy of the device pointer rather than having an additional copy. * bmg160 - use regmap stored copy of the device pointer rather than having an additional copy. * hid-sensors - white space fixes. * mcp3422 - white space fix. * mma7455 - use regmap to retrieve the device struct rather than carrying another copy in the private data. * ms_sensors - white space fix. * mxs-lradc - move current bindings out of staging - some will be shortly deprecated but the reality is that we have device trees out there using them so they will need to be supported for some time. They accidentally got left behind when the driver graduated from staging. - white space cleanup. - set INPUT_PROP_DIRECT. - move ts config into a better function. - move the STMP reset out of the ADC init. * vf610_adc - case label indenting fix.
| * iio: light: apds9960: silence uninitialized variable warningDan Carpenter2016-04-231-2/+3
| | | | | | | | | | | | | | | | It causes a static checker warning if we use "buf" on the failure path so move that inside the if statement. Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
| * iio: light apds9960: fix wrong use of braceSlawomir Stepien2016-04-161-2/+6
| | | | | | | | | | | | | | | | | | This fixes the error reported by checkpatch.pl: ERROR: that open brace { should be on the previous line Signed-off-by: Slawomir Stepien <sst@poczta.fm> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* | iio: light: apds9960: correct FIFO check conditionMatt Ranostay2016-03-201-1/+2
|/ | | | | | | | | Correct issue that the last entry in FIFO was being read twice due to an incorrect decrement of entry count variable before condition check. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: light: apds9960: correct ->last_busy countMatt Ranostay2015-11-211-0/+1
| | | | | | | | | | | | Add missing pm_runtime_mark_last_busy to apds9960_set_power_state function. Unless pm_runtime_mark_last_busy is called the pm_runtime_put_autosuspend may put the device into suspend before the delay time requested. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio:light:apds9960 Fix sparse endian warnings.Jonathan Cameron2015-10-121-3/+3
| | | | | | | | | | | | | | This patch is a tidy up of warnings from the autobuilder. >> drivers/iio/light/apds9960.c:495:32: sparse: cast to restricted __le16 drivers/iio/light/apds9960.c:635:24: sparse: cast to restricted __le16 >> drivers/iio/light/apds9960.c:672:21: sparse: incorrect type in assignment (different base types) drivers/iio/light/apds9960.c:672:21: expected unsigned short [unsigned] [usertype] buf drivers/iio/light/apds9960.c:672:21: got restricted __le16 [usertype] <noident> Signed-off-by: Jonathan Cameron <jic23@kernel.org> Cc: mranostay@gmail.com Signed-off-by: Jonathan Cameron <jic23@kernel.org>
* iio: light: apds9960: fix platform_no_drv_owner.cocci warningskbuild test robot2015-09-231-1/+0
| | | | | | | | | | | | drivers/iio/light/apds9960.c:1125:3-8: No need to set .owner here. The core will do it. Remove .owner field if calls are used which set it automatically Generated by: scripts/coccinelle/api/platform_no_drv_owner.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: apds9960: light: fix simple_return.cocci warningskbuild test robot2015-09-231-5/+1
| | | | | | | | | | | | | drivers/iio/light/apds9960.c:986:1-4: WARNING: end returns can be simpified Simplify a trivial if-return sequence. Possibly combine with a preceding function call. Generated by: scripts/coccinelle/misc/simple_return.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: light: add APDS9960 ALS + promixity driverMatt Ranostay2015-08-311-0/+1135
APDS9960 is a combination of ALS, proximity, and gesture sensors. This patch adds support for these functions along with gain control, integration time, and event thresholds. Signed-off-by: Matt Ranostay <mranostay@gmail.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>