aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/apds9960.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2018-09-07regmap: split up regmap_config.use_single_rwDavid Frey1-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>
2018-02-18iio: add SPDX identifier for various driversMatt Ranostay1-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>
2017-08-22iio:light: drop assign iio_info.driver_module and iio_trigger_ops.ownerJonathan Cameron1-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>
2017-04-14iio: light: apds9960: add system-wide suspendMatt Ranostay1-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>
2017-04-01iio: light: apds9960: constify attribute_group structuressimran singhal1-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>
2017-03-19iio: light: apds9960: Add OF device ID tableJavier Martinez Canillas1-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>
2016-06-30iio:core: timestamping clock selection supportGregor Boirie1-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>
2016-06-03iio: light apds9960: Add the missing dev.parentYong Li1-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>
2016-04-26Merge tag 'iio-for-4.7b' of git://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio into staging-testingGreg Kroah-Hartman1-4/+9
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.
2016-04-23iio: light: apds9960: silence uninitialized variable warningDan Carpenter1-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>
2016-04-16iio: light apds9960: fix wrong use of braceSlawomir Stepien1-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>
2016-03-20iio: light: apds9960: correct FIFO check conditionMatt Ranostay1-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>
2015-11-21iio: light: apds9960: correct ->last_busy countMatt Ranostay1-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>
2015-10-12iio:light:apds9960 Fix sparse endian warnings.Jonathan Cameron1-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>
2015-09-23iio: light: apds9960: fix platform_no_drv_owner.cocci warningskbuild test robot1-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>
2015-09-23iio: apds9960: light: fix simple_return.cocci warningskbuild test robot1-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>
2015-08-31iio: light: add APDS9960 ALS + promixity driverMatt Ranostay1-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>