A bit of refactoring for better readability.
Moved and slightly reorganized all the activity necessary for reading als
and proximity into a different function. This way the switch in read raw
becomes clearer and more compact.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add interrupt support for proximity.
Add two threshold events to signal rising and falling directions.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
When setting als only or proximity only modes make sure that we mark the
other component as disabled. This fix is in preparation of adding event
support because that will make it possible to switch between one-shot and
continuous modes and not tracking these correctly may cause faulty
behaviour (e.g wrongfully considering px enabled and not setting an
appropriate mode in the chip).
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add power management for sleep as well as runtime pm.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Keep track of the als and px enabled/disabled status in
order to enable them selectively.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
This chip supports two power modes.
1. "one-shot" mode - the chip activates and executes one complete
conversion loop and then shuts itself down. This is the default mode
chosen for raw reads.
2. "continuous" mode - the chip takes continuous measurements.
Continuous mode is more expensive power-wise but may be more reliable.
Add a property so that if preferred, the default power mode for raw
reads can be set to continuous.
Separate one-shot enabling in a separate function that will be used
depending on the chosen power mode. Also create a function for
powering the chip on and off.
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
Add support for UPISEMI us5182d als and proximity sensor.
Supports raw readings.
Data sheet for this device can be found here:
http://www.upi-semi.com/temp/uS5182D-DS-P0103-temp.pdf
Signed-off-by: Adriana Reus <adriana.reus@intel.com>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>