From: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>
To: Jonathan Cameron <jic23@kernel.org>,
Lars-Peter Clausen <lars@metafoo.de>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Subhajit Ghosh <subhajit.ghosh@tweaklogic.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Paul Gazzillo <paul@pgazz.com>,
Conor Dooley <conor+dt@kernel.org>,
Stefan Windfeldt-Prytz <stefan.windfeldt-prytz@axis.com>
Subject: [PATCH 0/2] Support for Avago APDS9306 Ambient Light Sensor
Date: Mon, 9 Oct 2023 02:18:55 +1030 [thread overview]
Message-ID: <20231008154857.24162-1-subhajit.ghosh@tweaklogic.com> (raw)
This series adds support for Avago (Broadcom) APDS9306 Ambient Light
Sensor.
Datasheet: https://docs.broadcom.com/doc/AV02-4755EN
Following features are supported:
- I2C interface
- 2 channels - als and clear
- Raw data for als and clear channels
- Pocessed data (Lux) values for als channel
- Up to 20 bit resolution
- 20 bit data register for each channel
- Common Configurable items for both channels
- Integration Time
- Measurement Frequency
- Scale
- High and Low threshold interrupts for each channel
- Selection of interrupt channels - als or clear
- Selection of interrupt mode - threshold or adaptive
- Level selection for adaptive threshold interrupts
- Persistence (Period) level selection for interrupts
Link: https://lore.kernel.org/all/20230411011203.5013-1-subhajit.ghosh@tweaklogic.com/
Link: https://patchwork.kernel.org/project/linux-iio/cover/20230411011203.5013-1-subhajit.ghosh@tweaklogic.com/
Sysfs structure:
root@stm32mp1:~# tree -I 'dev|name|of_node|power|subsystem|uevent' \
> /sys/bus/iio/devices/iio:device0/
/sys/bus/iio/devices/iio:device0/
|-- events
| |-- in_illuminance_thresh_either_en
| |-- in_intensity_clear_thresh_either_en
| |-- thresh_adaptive_either_en
| |-- thresh_adaptive_either_value
| |-- thresh_adaptive_either_values_available
| |-- thresh_either_period
| |-- thresh_either_period_available
| |-- thresh_falling_value
| `-- thresh_rising_value
|-- in_illuminance_input
|-- in_illuminance_raw
|-- in_intensity_clear_raw
|-- integration_time
|-- integration_time_available
|-- sampling_frequency
|-- sampling_frequency_available
|-- scale
|-- scale_available
`-- waiting_for_supplier
RFC -> v0
- DT binding review by Rob and Krzysztof:
- Verified with dt_binding_check
- Removed the last/redundant "bindings" word
- Review by Andy:
- Dropped blank line and reordered initial comments
- Sorted header files
- Added kernel-doc for the private structure
- Removed regmap internal lock
- Used regmap_read_poll_timeout() function instead of while loop
in apds9306_read_data()
- Applied fixes as per review
- Review by Jonathan:
- Updated apds9306_read_data() and apds9306_irq_handler() as per
review. If interrupts are enabled together with userspace read
of raw and processed adc values, then events can be pushed both
by the interrupt handler and apds9306_read_data(). If the
interrupt handler gets a data ready for read flag then it sets
a flag in the private data structure which is used by
apds9306_read_data().
- ABI update - In events, per cnannel enable for both
channels, removing custom sysfs attributes for channel selection.
- Added lux calculation. Page 4 of the datasheet has test results
for only the default integration time at the default hardware gain.
Normalized the values for all hardware gains and all supported
integration times as per the part ID. I got consistent results
when compared with a lux meter in the default range.
- Other fixes as commented
- Implemented IIO_GTS_HELPER
- Shuffled functions for logical split and readability
Apologies for this huge delay in submitting this patch from RFC to v0.
I had a change of job and subsequent relocation.
Future revisions will not be delayed.
Subhajit Ghosh (2):
dt-bindings: iio: light: Avago APDS9306
iio: light: Add support for APDS9306 Light Sensor
.../bindings/iio/light/avago,apds9306.yaml | 49 +
drivers/iio/light/Kconfig | 12 +
drivers/iio/light/Makefile | 1 +
drivers/iio/light/apds9306.c | 1381 +++++++++++++++++
4 files changed, 1443 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/light/avago,apds9306.yaml
create mode 100644 drivers/iio/light/apds9306.c
base-commit: b9ddbb0cde2adcedda26045cc58f31316a492215
--
2.34.1
next reply other threads:[~2023-10-08 15:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-08 15:48 Subhajit Ghosh [this message]
2023-10-08 15:48 ` [PATCH 1/2] dt-bindings: iio: light: Avago APDS9306 Subhajit Ghosh
2023-10-09 8:36 ` Krzysztof Kozlowski
2023-10-09 11:25 ` Subhajit Ghosh
2023-10-10 8:52 ` Matti Vaittinen
2023-10-10 12:18 ` Subhajit Ghosh
2023-10-10 14:49 ` Jonathan Cameron
2023-10-10 16:19 ` Rob Herring
2023-10-11 13:04 ` Subhajit Ghosh
2023-10-10 13:51 ` Jonathan Cameron
2023-10-11 13:10 ` Subhajit Ghosh
2023-10-08 15:48 ` [PATCH 2/2] iio: light: Add support for APDS9306 Light Sensor Subhajit Ghosh
2023-10-10 9:45 ` Matti Vaittinen
2023-10-10 12:17 ` Subhajit Ghosh
2023-10-10 14:38 ` Jonathan Cameron
2023-10-11 14:37 ` Subhajit Ghosh
2023-10-12 7:54 ` Jonathan Cameron
2023-10-12 12:37 ` Subhajit Ghosh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231008154857.24162-1-subhajit.ghosh@tweaklogic.com \
--to=subhajit.ghosh@tweaklogic.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=paul@pgazz.com \
--cc=robh+dt@kernel.org \
--cc=stefan.windfeldt-prytz@axis.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).