Linux IIO development
 help / color / mirror / Atom feed
From: Maslov Dmitry <maslovdmitry@seeed.cc>
To: jic23@kernel.org, linux-iio@vger.kernel.org, lars@metafoo.de,
	andy.shevchenko@gmail.com, north_sea@qq.com, baozhu.zuo@seeed.cc,
	jian.xiong@seeed.cc
Cc: Maslov Dmitry <maslovdmitry@seeed.cc>
Subject: [PATCH v3] iio: light: ltr501: Added ltr303 driver support
Date: Sun, 31 Oct 2021 17:46:03 +0100	[thread overview]
Message-ID: <20211031164603.4343-1-maslovdmitry@seeed.cc> (raw)

Previously ltr501 driver supported a number of light and,
proximity sensors including ltr501, ltr559 and ltr301.
This adds support for another light sensor ltr303
used in Seeed Studio reTerminal, a carrier board
for Raspberry Pi 4 CM.

Signed-off-by: Maslov Dmitry <maslovdmitry@seeed.cc>
---
 drivers/iio/light/ltr501.c | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

It is a fix of previous commit, that simplified ltr303 support
and removed a lot of unnecessary code. Filename has also been removed
from the file.
Additionally, in v3 of the patch, unused ltr_max was removed
and description of the driver was changed to more general, i.e.
"LTR501 and similar ambient light and proximity sensors."

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 7e51aaac0bf..4c8672547fd 100644
--- a/drivers/iio/light/ltr501.c
+++ b/drivers/iio/light/ltr501.c
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0-only
 /*
- * ltr501.c - Support for Lite-On LTR501 ambient light and proximity sensor
+ * Support for Lite-On LTR501 and similar ambient light and proximity sensors.
  *
  * Copyright 2014 Peter Meerwald <pmeerw@pmeerw.net>
  *
@@ -98,6 +98,7 @@ enum {
 	ltr501 = 0,
 	ltr559,
 	ltr301,
+	ltr303,
 };
 
 struct ltr501_gain {
@@ -1231,6 +1232,18 @@ static const struct ltr501_chip_info ltr501_chip_info_tbl[] = {
 		.channels = ltr301_channels,
 		.no_channels = ARRAY_SIZE(ltr301_channels),
 	},
+	[ltr303] = {
+		.partid = 0x0A,
+		.als_gain = ltr559_als_gain_tbl,
+		.als_gain_tbl_size = ARRAY_SIZE(ltr559_als_gain_tbl),
+		.als_mode_active = BIT(0),
+		.als_gain_mask = BIT(2) | BIT(3) | BIT(4),
+		.als_gain_shift = 2,
+		.info = &ltr301_info,
+		.info_no_irq = &ltr301_info_no_irq,
+		.channels = ltr301_channels,
+		.no_channels = ARRAY_SIZE(ltr301_channels),
+	},
 };
 
 static int ltr501_write_contr(struct ltr501_data *data, u8 als_val, u8 ps_val)
@@ -1597,6 +1610,7 @@ static const struct acpi_device_id ltr_acpi_match[] = {
 	{"LTER0501", ltr501},
 	{"LTER0559", ltr559},
 	{"LTER0301", ltr301},
+	{"LTER0303", ltr303},
 	{ },
 };
 MODULE_DEVICE_TABLE(acpi, ltr_acpi_match);
@@ -1605,6 +1619,7 @@ static const struct i2c_device_id ltr501_id[] = {
 	{ "ltr501", ltr501},
 	{ "ltr559", ltr559},
 	{ "ltr301", ltr301},
+	{ "ltr303", ltr303},
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, ltr501_id);
@@ -1613,6 +1628,7 @@ static const struct of_device_id ltr501_of_match[] = {
 	{ .compatible = "liteon,ltr501", },
 	{ .compatible = "liteon,ltr559", },
 	{ .compatible = "liteon,ltr301", },
+	{ .compatible = "liteon,ltr303", },
 	{}
 };
 MODULE_DEVICE_TABLE(of, ltr501_of_match);
-- 
2.25.1


             reply	other threads:[~2021-10-31 16:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-31 16:46 Maslov Dmitry [this message]
2021-10-31 20:07 ` [PATCH v3] iio: light: ltr501: Added ltr303 driver support Andy Shevchenko
2021-11-01 13:57   ` Dmitry Maslov
2021-11-01 14:20     ` Andy Shevchenko
2021-11-01 19:55       ` Dmitry Maslov
2021-11-03 18:21         ` Jonathan Cameron
2021-11-04 22:25           ` Dmitry Maslov
2021-11-05 17:06             ` Jonathan Cameron
2021-11-03 18:04       ` Jonathan Cameron

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=20211031164603.4343-1-maslovdmitry@seeed.cc \
    --to=maslovdmitry@seeed.cc \
    --cc=andy.shevchenko@gmail.com \
    --cc=baozhu.zuo@seeed.cc \
    --cc=jian.xiong@seeed.cc \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=north_sea@qq.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