aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/iio/light/rpr0521.c (follow)
AgeCommit message (Collapse)AuthorFilesLines
2017-08-22iio:light: 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-07-04iio: light: rpr0521 triggered bufferMikko Koivunen1-7/+329
Set up and use triggered buffer if there is irq defined for device in device tree. Trigger producer triggers from rpr0521 drdy interrupt line. Trigger consumer reads rpr0521 data to scan buffer. Depends on previous commits of _scale and _offset. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 channel numbers reorderedMikko Koivunen1-20/+20
Move proximity channel from last to first in structs to avoid confusion later with buffered triggers. Proximity data output is first in rpr0521 register map. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 proximity offset read/writeMikko Koivunen1-0/+52
Add sysfs read/write proximity offset feature. Offset is read/write from sensor registers. Values are proximity raw 10-bit values. After applying offset value, output values will be (measured_raw - offset_value). Output values are unsigned so offset value doesn't make output negative. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 sample_frequency read/writeMikko Koivunen1-0/+117
Add sysfs read/write sample frequency. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 whitespace fixesMikko Koivunen1-0/+3
Just whitespace change, no functional changes. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 magic number to sizeof() on value readMikko Koivunen1-1/+1
Changed magic number to sizeof() on value read. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 on-off sequence change for CONFIG_PMMikko Koivunen1-24/+46
Refactor _set_power_state(), _resume() and _suspend(). Enable measurement only when needed, not in _init(). System can suspend during measurement and measurement is continued on resume. Pm turns off measurement when both ps and als measurements are disabled for 2 seconds. During off-time the power save is 20-500mA, typically 180mA. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 poweroff for probe failsMikko Koivunen1-2/+15
Set sensor measurement off after probe fail in pm_runtime_set_active() or iio_device_register(). Without this change sensor measurement stays on even though probe fails on these calls. This is maybe rare case, but causes constant power drain without any benefits when it happens. Power drain is 20-500uA, typically 180uA. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2017-05-21iio: light: rpr0521 disable sensor -bugfixMikko Koivunen1-2/+8
Sensor was marked enabled on each call even if the call was for disabling sensor. Signed-off-by: Mikko Koivunen <mikko.koivunen@fi.rohmeurope.com> Acked-by: Daniel Baluta <daniel.baluta@nxp.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-11-08iio: Reconcile operation order between iio_register/unregister and pm functionsAdriana Reus1-10/+4
At probe, runtime pm should be setup before registering the sysfs interface so that all the power attributes are accurate and functional when registering. Also, when removing the device we should unregister first to make sure that the interfaces that may result in wakeups are no longer available. Fix this behaviour for the following drivers: bmc150, bmg160, kmx61, kxcj-1013, mma9551, mma9553, rpr0521. Signed-off-by: Adriana Reus <adriana.reus@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
2015-06-21iio: light: Add support for ROHM RPR0521 sensorDaniel Baluta1-0/+615
This patch adds support for ROHM RPR0521 ambient light and proximity sensor. It offers raw readings for intensity and proximity. Signed-off-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>