Skip to contentSkip to conversation

iio: light: add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors

PATCH Superseded Tomasz Duszynski 1 participant 1 message Apr 28, 2015

Subsystems (2)
lore
Share & tools
lore

Tomasz Duszynski

author maintainer
#0 lore raw

PATCH v4 1/1 iio: light: add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors

Add support for ROHM BH1710/BH1715/BH1721/BH1750/BH1751 ambient light sensors.

---
Changes in v4:
- Minor changes in module documentation
- Use be16_to_cpu instead of swab16 for clarity

Changes in v3:
- Do some code cleanup
- Add comments to clarify non-intuitive driver parts
- Return proper scale value [lx / count] to userspace. In previous patches scale inverse was returned.

Changes in v2:
- Store chip-dependent values in chip_info structure
- Add bh1750_remove to power down chip (necessary for BH1721)
- Use one time mode for chips that have support for that
- Use IIO_LIGHT instead of IIO_INTENSITY for channel type

 drivers/iio/light/Kconfig  |  10 ++
 drivers/iio/light/Makefile |   1 +
 drivers/iio/light/bh1750.c | 334 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 345 insertions(+)
 create mode 100644 drivers/iio/light/bh1750.c
drivers/iio/light/Kconfig +10 -0
index 5a3237b..ebc578a 100644
@@ -37,6 +37,16 @@ config APDS9300
 	 To compile this driver as a module, choose M here: the
 	 module will be called apds9300.
 
+config BH1750
+	tristate "ROHM BH1750 ambient light sensor"
+	depends on I2C
+	help
+	 Say Y here to build support for the ROHM BH1710, BH1715, BH1721,
+	 BH1750, BH1751 ambient light sensors.
+
+	 To compile this driver as a module, choose M here: the module will
+	 be called bh1750.
+
 config CM32181
 	depends on I2C
 	tristate "CM32181 driver"
drivers/iio/light/Makefile +1 -0
index 74656c1..1a13184 100644
@@ -6,6 +6,7 @@
 obj-$(CONFIG_ADJD_S311)		+= adjd_s311.o
 obj-$(CONFIG_AL3320A)		+= al3320a.o
 obj-$(CONFIG_APDS9300)		+= apds9300.o
+obj-$(CONFIG_BH1750)		+= bh1750.o
 obj-$(CONFIG_CM32181)		+= cm32181.o
 obj-$(CONFIG_CM36651)		+= cm36651.o
 obj-$(CONFIG_GP2AP020A00F)	+= gp2ap020a00f.o
drivers/iio/light/bh1750.c new file +334 -0

334 lines not on this page · raw message

--
2.3.6