All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4] iio: light: ltr501: Added ltr303 driver support
@ 2021-11-06 17:41 Maslov Dmitry
  2021-11-13 18:19 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Maslov Dmitry @ 2021-11-06 17:41 UTC (permalink / raw)
  To: jic23, linux-iio, lars, andy.shevchenko, north_sea, baozhu.zuo,
	jian.xiong
  Cc: Maslov Dmitry

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 | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

It is a fix of previous commits, 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."
In v4 of the patch, ltr303 entry was removed from ACPI match table,
since ACPI ID is not present in acpi id list.

diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
index 7e51aaac0bf..bab5b78f2e3 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)
@@ -1605,6 +1618,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 +1627,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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH v4] iio: light: ltr501: Added ltr303 driver support
  2021-11-06 17:41 [PATCH v4] iio: light: ltr501: Added ltr303 driver support Maslov Dmitry
@ 2021-11-13 18:19 ` Jonathan Cameron
  2021-11-16 10:09   ` Dmitry Maslov
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2021-11-13 18:19 UTC (permalink / raw)
  To: Maslov Dmitry
  Cc: linux-iio, lars, andy.shevchenko, north_sea, baozhu.zuo, jian.xiong

On Sat,  6 Nov 2021 18:41:37 +0100
Maslov Dmitry <maslovdmitry@seeed.cc> wrote:

> 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>

Applied to the togreg branch of iio.git and pushed out as testing to see if 0-day
can find anything we missed.   I'll rebase the tree after rc1 and soon after that
it should be visible in linux-next.

Thanks,

Jonathan

> ---
>  drivers/iio/light/ltr501.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
> 
> It is a fix of previous commits, 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."
> In v4 of the patch, ltr303 entry was removed from ACPI match table,
> since ACPI ID is not present in acpi id list.
> 
> diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> index 7e51aaac0bf..bab5b78f2e3 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)
> @@ -1605,6 +1618,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 +1627,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);


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Re: [PATCH v4] iio: light: ltr501: Added ltr303 driver support
  2021-11-13 18:19 ` Jonathan Cameron
@ 2021-11-16 10:09   ` Dmitry Maslov
  0 siblings, 0 replies; 3+ messages in thread
From: Dmitry Maslov @ 2021-11-16 10:09 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-iio, lars, andy.shevchenko, north_sea, baozhu.zuo, jian.xiong

> Applied to the togreg branch of iio.git and pushed out as testing to see if 0-day
> can find anything we missed.   I'll rebase the tree after rc1 and soon after that
> it should be visible in linux-next.
> 
> Thanks,
> 
> Jonathan
> 
Thank you, looking forward to it!

> > ---
> >  drivers/iio/light/ltr501.c | 17 ++++++++++++++++-
> >  1 file changed, 16 insertions(+), 1 deletion(-)
> > 
> > It is a fix of previous commits, 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."
> > In v4 of the patch, ltr303 entry was removed from ACPI match table,
> > since ACPI ID is not present in acpi id list.
> > 
> > diff --git a/drivers/iio/light/ltr501.c b/drivers/iio/light/ltr501.c
> > index 7e51aaac0bf..bab5b78f2e3 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)
> > @@ -1605,6 +1618,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 +1627,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);






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-16 10:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-06 17:41 [PATCH v4] iio: light: ltr501: Added ltr303 driver support Maslov Dmitry
2021-11-13 18:19 ` Jonathan Cameron
2021-11-16 10:09   ` Dmitry Maslov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.