LKML Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] iio: light: stk3310: add chip id for STK3311-X variant
@ 2020-07-03 19:44 Ondrej Jirman
  2020-07-04 16:29 ` Jonathan Cameron
  0 siblings, 1 reply; 6+ messages in thread
From: Ondrej Jirman @ 2020-07-03 19:44 UTC (permalink / raw)
  To: linux-kernel
  Cc: Icenowy Zheng, Ondrej Jirman, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Luca Weiss,
	open list:IIO SUBSYSTEM AND DRIVERS

From: Icenowy Zheng <icenowy@aosc.io>

The STK3311 chip has a variant called STK3311-X, which has a different
chip id of 0x12.

Add the chip id to the driver.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
 drivers/iio/light/stk3310.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index 185c24a75ae6..1a8401d198a4 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -37,6 +37,7 @@
 
 #define STK3310_CHIP_ID_VAL			0x13
 #define STK3311_CHIP_ID_VAL			0x1D
+#define STK3311X_CHIP_ID_VAL			0x12
 #define STK3335_CHIP_ID_VAL			0x51
 #define STK3310_PSINT_EN			0x01
 #define STK3310_PS_MAX_VAL			0xFFFF
@@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev *indio_dev)
 
 	if (chipid != STK3310_CHIP_ID_VAL &&
 	    chipid != STK3311_CHIP_ID_VAL &&
+	    chipid != STK3311X_CHIP_ID_VAL &&
 	    chipid != STK3335_CHIP_ID_VAL) {
 		dev_err(&client->dev, "invalid chip id: 0x%x\n", chipid);
 		return -ENODEV;
-- 
2.27.0


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

* Re: [PATCH] iio: light: stk3310: add chip id for STK3311-X variant
  2020-07-03 19:44 [PATCH] iio: light: stk3310: add chip id for STK3311-X variant Ondrej Jirman
@ 2020-07-04 16:29 ` Jonathan Cameron
  2020-07-04 17:09   ` Icenowy Zheng
  2020-07-14 10:44   ` Ondřej Jirman
  0 siblings, 2 replies; 6+ messages in thread
From: Jonathan Cameron @ 2020-07-04 16:29 UTC (permalink / raw)
  To: Ondrej Jirman
  Cc: linux-kernel, Icenowy Zheng, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Luca Weiss,
	open list:IIO SUBSYSTEM AND DRIVERS

On Fri,  3 Jul 2020 21:44:05 +0200
Ondrej Jirman <megous@megous.com> wrote:

> From: Icenowy Zheng <icenowy@aosc.io>
> 
> The STK3311 chip has a variant called STK3311-X, which has a different
> chip id of 0x12.
> 
> Add the chip id to the driver.
> 
> Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> Signed-off-by: Ondrej Jirman <megous@megous.com>

Given this is clearly not quite compatible with the stk3311 probably
best to also add a an id to the of id table.  Any idea what else
is different?

Thanks,

Jonathan

> ---
>  drivers/iio/light/stk3310.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> index 185c24a75ae6..1a8401d198a4 100644
> --- a/drivers/iio/light/stk3310.c
> +++ b/drivers/iio/light/stk3310.c
> @@ -37,6 +37,7 @@
>  
>  #define STK3310_CHIP_ID_VAL			0x13
>  #define STK3311_CHIP_ID_VAL			0x1D
> +#define STK3311X_CHIP_ID_VAL			0x12
>  #define STK3335_CHIP_ID_VAL			0x51
>  #define STK3310_PSINT_EN			0x01
>  #define STK3310_PS_MAX_VAL			0xFFFF
> @@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev *indio_dev)
>  
>  	if (chipid != STK3310_CHIP_ID_VAL &&
>  	    chipid != STK3311_CHIP_ID_VAL &&
> +	    chipid != STK3311X_CHIP_ID_VAL &&
>  	    chipid != STK3335_CHIP_ID_VAL) {
>  		dev_err(&client->dev, "invalid chip id: 0x%x\n", chipid);
>  		return -ENODEV;


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

* Re: [PATCH] iio: light: stk3310: add chip id for STK3311-X variant
  2020-07-04 16:29 ` Jonathan Cameron
@ 2020-07-04 17:09   ` Icenowy Zheng
  2020-07-04 17:49     ` Ondřej Jirman
  2020-07-14 10:44   ` Ondřej Jirman
  1 sibling, 1 reply; 6+ messages in thread
From: Icenowy Zheng @ 2020-07-04 17:09 UTC (permalink / raw)
  To: Jonathan Cameron, Ondrej Jirman
  Cc: linux-kernel, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Luca Weiss,
	open list:IIO SUBSYSTEM AND DRIVERS

在 2020-07-04星期六的 17:29 +0100,Jonathan Cameron写道:
> On Fri,  3 Jul 2020 21:44:05 +0200
> Ondrej Jirman <megous@megous.com> wrote:
> 
> > From: Icenowy Zheng <icenowy@aosc.io>
> > 
> > The STK3311 chip has a variant called STK3311-X, which has a
> > different
> > chip id of 0x12.
> > 
> > Add the chip id to the driver.
> > 
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > Signed-off-by: Ondrej Jirman <megous@megous.com>
> 
> Given this is clearly not quite compatible with the stk3311 probably
> best to also add a an id to the of id table.  Any idea what else
> is different?

By the way, STK3311 seems to have many variants lying around, and all
of them have different IDs. The pinouts seem to be different but the
registers are compatible.

[1] is a datasheet of STK3311-S34 with ID 0x1e.
[2] is a datasheet of STK3311-A with ID 0x15.

I cannot find the datasheet of STK3311-X, 0x12 is read from the device.
The model number itself is mentioned at [3], the official website of
sensortek.

[1] 
http://pro0fc108.hkpic1.websiteonline.cn/upload/STK3311-S34Datasheetv1.pdf

[2] 
http://pro0fc108.hkpic1.websiteonline.cn/upload/STK3311-ADatasheetv1.pdf

[3] 
http://www.sensortek.com.tw/index.php/en/products/proximity-sensor-with-als/

> 
> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/light/stk3310.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/iio/light/stk3310.c
> > b/drivers/iio/light/stk3310.c
> > index 185c24a75ae6..1a8401d198a4 100644
> > --- a/drivers/iio/light/stk3310.c
> > +++ b/drivers/iio/light/stk3310.c
> > @@ -37,6 +37,7 @@
> >  
> >  #define STK3310_CHIP_ID_VAL			0x13
> >  #define STK3311_CHIP_ID_VAL			0x1D
> > +#define STK3311X_CHIP_ID_VAL			0x12
> >  #define STK3335_CHIP_ID_VAL			0x51
> >  #define STK3310_PSINT_EN			0x01
> >  #define STK3310_PS_MAX_VAL			0xFFFF
> > @@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev
> > *indio_dev)
> >  
> >  	if (chipid != STK3310_CHIP_ID_VAL &&
> >  	    chipid != STK3311_CHIP_ID_VAL &&
> > +	    chipid != STK3311X_CHIP_ID_VAL &&
> >  	    chipid != STK3335_CHIP_ID_VAL) {
> >  		dev_err(&client->dev, "invalid chip id: 0x%x\n",
> > chipid);
> >  		return -ENODEV;

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

* Re: [PATCH] iio: light: stk3310: add chip id for STK3311-X variant
  2020-07-04 17:09   ` Icenowy Zheng
@ 2020-07-04 17:49     ` Ondřej Jirman
  0 siblings, 0 replies; 6+ messages in thread
From: Ondřej Jirman @ 2020-07-04 17:49 UTC (permalink / raw)
  To: Icenowy Zheng
  Cc: Jonathan Cameron, linux-kernel, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Luca Weiss,
	open list:IIO SUBSYSTEM AND DRIVERS

Hi,

On Sun, Jul 05, 2020 at 01:09:37AM +0800, Icenowy Zheng wrote:
> 在 2020-07-04星期六的 17:29 +0100,Jonathan Cameron写道:
> > On Fri,  3 Jul 2020 21:44:05 +0200
> > Ondrej Jirman <megous@megous.com> wrote:
> > 
> > > From: Icenowy Zheng <icenowy@aosc.io>
> > > 
> > > The STK3311 chip has a variant called STK3311-X, which has a
> > > different
> > > chip id of 0x12.
> > > 
> > > Add the chip id to the driver.
> > > 
> > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > > Signed-off-by: Ondrej Jirman <megous@megous.com>
> > 
> > Given this is clearly not quite compatible with the stk3311 probably
> > best to also add a an id to the of id table.  Any idea what else
> > is different?
> 
> By the way, STK3311 seems to have many variants lying around, and all
> of them have different IDs. The pinouts seem to be different but the
> registers are compatible.
> 
> [1] is a datasheet of STK3311-S34 with ID 0x1e.
> [2] is a datasheet of STK3311-A with ID 0x15.
> 
> I cannot find the datasheet of STK3311-X, 0x12 is read from the device.
> The model number itself is mentioned at [3], the official website of
> sensortek.
> 
> [1] 
> http://pro0fc108.hkpic1.websiteonline.cn/upload/STK3311-S34Datasheetv1.pdf
> 
> [2] 
> http://pro0fc108.hkpic1.websiteonline.cn/upload/STK3311-ADatasheetv1.pdf
> 
> [3] 
> http://www.sensortek.com.tw/index.php/en/products/proximity-sensor-with-als/

Yeah, it looks like it's the only one of stk3111-* variants that sensortek
lists on their website. I also didn't find the *-x datasheet despite trying
really hard.

All the functionality seems to work with the current driver and this patch.

regards,
	o.

> > 
> > Thanks,
> > 
> > Jonathan
> > 
> > > ---
> > >  drivers/iio/light/stk3310.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/iio/light/stk3310.c
> > > b/drivers/iio/light/stk3310.c
> > > index 185c24a75ae6..1a8401d198a4 100644
> > > --- a/drivers/iio/light/stk3310.c
> > > +++ b/drivers/iio/light/stk3310.c
> > > @@ -37,6 +37,7 @@
> > >  
> > >  #define STK3310_CHIP_ID_VAL			0x13
> > >  #define STK3311_CHIP_ID_VAL			0x1D
> > > +#define STK3311X_CHIP_ID_VAL			0x12
> > >  #define STK3335_CHIP_ID_VAL			0x51
> > >  #define STK3310_PSINT_EN			0x01
> > >  #define STK3310_PS_MAX_VAL			0xFFFF
> > > @@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev
> > > *indio_dev)
> > >  
> > >  	if (chipid != STK3310_CHIP_ID_VAL &&
> > >  	    chipid != STK3311_CHIP_ID_VAL &&
> > > +	    chipid != STK3311X_CHIP_ID_VAL &&
> > >  	    chipid != STK3335_CHIP_ID_VAL) {
> > >  		dev_err(&client->dev, "invalid chip id: 0x%x\n",
> > > chipid);
> > >  		return -ENODEV;

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

* Re: [PATCH] iio: light: stk3310: add chip id for STK3311-X variant
  2020-07-04 16:29 ` Jonathan Cameron
  2020-07-04 17:09   ` Icenowy Zheng
@ 2020-07-14 10:44   ` Ondřej Jirman
  2020-07-18 16:29     ` Jonathan Cameron
  1 sibling, 1 reply; 6+ messages in thread
From: Ondřej Jirman @ 2020-07-14 10:44 UTC (permalink / raw)
  To: Jonathan Cameron
  Cc: linux-kernel, Icenowy Zheng, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Luca Weiss,
	open list:IIO SUBSYSTEM AND DRIVERS

Hello Jonathan,

On Sat, Jul 04, 2020 at 05:29:16PM +0100, Jonathan Cameron wrote:
> On Fri,  3 Jul 2020 21:44:05 +0200
> Ondrej Jirman <megous@megous.com> wrote:
> 
> > From: Icenowy Zheng <icenowy@aosc.io>
> > 
> > The STK3311 chip has a variant called STK3311-X, which has a different
> > chip id of 0x12.
> > 
> > Add the chip id to the driver.
> > 
> > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > Signed-off-by: Ondrej Jirman <megous@megous.com>
> 
> Given this is clearly not quite compatible with the stk3311 probably
> best to also add a an id to the of id table.  Any idea what else
> is different?

I've looked at it more, and there's no stk3311 either. It always has
some suffix, like -sa -9 -a -wv -x, .... So I don't think a new
ID in the table is neccessary. The driver can differentiate based on
chip id, in case it will ever become necessary.

regards,
	o.

> Thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/light/stk3310.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> > index 185c24a75ae6..1a8401d198a4 100644
> > --- a/drivers/iio/light/stk3310.c
> > +++ b/drivers/iio/light/stk3310.c
> > @@ -37,6 +37,7 @@
> >  
> >  #define STK3310_CHIP_ID_VAL			0x13
> >  #define STK3311_CHIP_ID_VAL			0x1D
> > +#define STK3311X_CHIP_ID_VAL			0x12
> >  #define STK3335_CHIP_ID_VAL			0x51
> >  #define STK3310_PSINT_EN			0x01
> >  #define STK3310_PS_MAX_VAL			0xFFFF
> > @@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev *indio_dev)
> >  
> >  	if (chipid != STK3310_CHIP_ID_VAL &&
> >  	    chipid != STK3311_CHIP_ID_VAL &&
> > +	    chipid != STK3311X_CHIP_ID_VAL &&
> >  	    chipid != STK3335_CHIP_ID_VAL) {
> >  		dev_err(&client->dev, "invalid chip id: 0x%x\n", chipid);
> >  		return -ENODEV;
> 

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

* Re: [PATCH] iio: light: stk3310: add chip id for STK3311-X variant
  2020-07-14 10:44   ` Ondřej Jirman
@ 2020-07-18 16:29     ` Jonathan Cameron
  0 siblings, 0 replies; 6+ messages in thread
From: Jonathan Cameron @ 2020-07-18 16:29 UTC (permalink / raw)
  To: Ondřej Jirman
  Cc: linux-kernel, Icenowy Zheng, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Luca Weiss,
	open list:IIO SUBSYSTEM AND DRIVERS

On Tue, 14 Jul 2020 12:44:41 +0200
Ondřej Jirman <megous@megous.com> wrote:

> Hello Jonathan,
> 
> On Sat, Jul 04, 2020 at 05:29:16PM +0100, Jonathan Cameron wrote:
> > On Fri,  3 Jul 2020 21:44:05 +0200
> > Ondrej Jirman <megous@megous.com> wrote:
> >   
> > > From: Icenowy Zheng <icenowy@aosc.io>
> > > 
> > > The STK3311 chip has a variant called STK3311-X, which has a different
> > > chip id of 0x12.
> > > 
> > > Add the chip id to the driver.
> > > 
> > > Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
> > > Signed-off-by: Ondrej Jirman <megous@megous.com>  
> > 
> > Given this is clearly not quite compatible with the stk3311 probably
> > best to also add a an id to the of id table.  Any idea what else
> > is different?  
> 
> I've looked at it more, and there's no stk3311 either. It always has
> some suffix, like -sa -9 -a -wv -x, .... So I don't think a new
> ID in the table is neccessary. The driver can differentiate based on
> chip id, in case it will ever become necessary.
> 
Thanks for info.  In that case, applied to the togreg branch of iio.git
and pushed out as testing for the autobuilders to poke at it.

Thanks,

Jonathan

> regards,
> 	o.
> 
> > Thanks,
> > 
> > Jonathan
> >   
> > > ---
> > >  drivers/iio/light/stk3310.c | 2 ++
> > >  1 file changed, 2 insertions(+)
> > > 
> > > diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
> > > index 185c24a75ae6..1a8401d198a4 100644
> > > --- a/drivers/iio/light/stk3310.c
> > > +++ b/drivers/iio/light/stk3310.c
> > > @@ -37,6 +37,7 @@
> > >  
> > >  #define STK3310_CHIP_ID_VAL			0x13
> > >  #define STK3311_CHIP_ID_VAL			0x1D
> > > +#define STK3311X_CHIP_ID_VAL			0x12
> > >  #define STK3335_CHIP_ID_VAL			0x51
> > >  #define STK3310_PSINT_EN			0x01
> > >  #define STK3310_PS_MAX_VAL			0xFFFF
> > > @@ -453,6 +454,7 @@ static int stk3310_init(struct iio_dev *indio_dev)
> > >  
> > >  	if (chipid != STK3310_CHIP_ID_VAL &&
> > >  	    chipid != STK3311_CHIP_ID_VAL &&
> > > +	    chipid != STK3311X_CHIP_ID_VAL &&
> > >  	    chipid != STK3335_CHIP_ID_VAL) {
> > >  		dev_err(&client->dev, "invalid chip id: 0x%x\n", chipid);
> > >  		return -ENODEV;  
> >   


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

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-03 19:44 [PATCH] iio: light: stk3310: add chip id for STK3311-X variant Ondrej Jirman
2020-07-04 16:29 ` Jonathan Cameron
2020-07-04 17:09   ` Icenowy Zheng
2020-07-04 17:49     ` Ondřej Jirman
2020-07-14 10:44   ` Ondřej Jirman
2020-07-18 16:29     ` Jonathan Cameron

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git