iio: light: stk3310: add chip id for STK3311-X variant
PATCH 1/1 iio: light: stk3310: add chip id for STK3311-X variant
From: Icenowy Zheng <[email protected]>
The STK3311 chip has a variant called STK3311-X, which has a different chip id of 0x12.
Add the chip id to the driver.
--- drivers/iio/light/stk3310.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/light/stk3310.c +2 -0
@@ -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 ;
Signature · 1 line
2.27.0
Jonathan Cameron
maintainerQuoted 9 lines · On Fri, 3 Jul 2020 21:44:05 +0200 Ondrej Jirman <[email protected]> wrote:
From: Icenowy Zheng <[email protected]>
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 <[email protected]>Signed-off-by Ondrej Jirman <[email protected]>
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
Quoted 24 lines
--- drivers/iio/light/stk3310.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/light/stk3310.c +2
-0@@ -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 ;
Quoted 9 lines · 在 2020-07-04星期六的 17:29 +0100,Jonathan Cameron写道:
Quoted 6 lines · On Fri, 3 Jul 2020 21:44:05 +0200 Ondrej Jirman <[email protected]> wrote:
From: Icenowy Zheng <[email protected]>
The STK3311 chip has a variant called STK3311-X, which has a different
chip id of0x12.
Quoted 8 lines
Quoted 4 lines
Add the chip id to the driver.
Signed-off-by Icenowy Zheng <[email protected]>Signed-off-by Ondrej Jirman <[email protected]>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/
Quoted 32 lines
Thanks,
Jonathan
Quoted 27 lines
--- drivers/iio/light/stk3310.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/light/stk3310.c +2
-0@@ -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;
Hi,
Quoted 30 lines · Icenowy Zheng
Quoted 9 lines · 在 2020-07-04星期六的 17:29 +0100,Jonathan Cameron写道:
Quoted 6 lines · On Fri, 3 Jul 2020 21:44:05 +0200 Ondrej Jirman <[email protected]> wrote:
From: Icenowy Zheng <[email protected]>
The STK3311 chip has a variant called STK3311-X, which has a different
chip id of0x12.Quoted 8 lines
Quoted 4 lines
Add the chip id to the driver.
Signed-off-by Icenowy Zheng <[email protected]>Signed-off-by Ondrej Jirman <[email protected]>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 ID0x15.I cannot find the datasheet of STK3311-X,
0x12is read from the device. The model number itself is mentioned at [3], the official website of sensortek.
Quoted 8 lines
[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.
Quoted 32 lines
Quoted 32 lines
Thanks,
Jonathan
Quoted 27 lines
--- drivers/iio/light/stk3310.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/light/stk3310.c +2
-0@@ -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;
Hello Jonathan,
Quoted 8 lines · Jonathan Cameron
Quoted 5 lines · On Fri, 3 Jul 2020 21:44:05 +0200 Ondrej Jirman <[email protected]> wrote:
From: Icenowy Zheng <[email protected]>
The STK3311 chip has a variant called STK3311-X, which has a different chip id of
0x12.
Quoted 8 lines
Quoted 4 lines
Add the chip id to the driver.
Signed-off-by Icenowy Zheng <[email protected]>Signed-off-by Ondrej Jirman <[email protected]>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.
Quoted 29 lines
Thanks,
Jonathan
Quoted 24 lines
--- drivers/iio/light/stk3310.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/light/stk3310.c +2
-0@@ -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 ;
Jonathan Cameron
maintainerQuoted 16 lines · On Tue, 14 Jul 2020 12:44:41 +0200 Ondřej Jirman <[email protected]> wrote:
Hello Jonathan,
Quoted 13 lines · Jonathan Cameron
Quoted 9 lines · On Fri, 3 Jul 2020 21:44:05 +0200 Ondrej Jirman <[email protected]> wrote:
From: Icenowy Zheng <[email protected]>
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 <[email protected]>Signed-off-by Ondrej Jirman <[email protected]>
Quoted 9 lines
Quoted 3 lines
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
Quoted 32 lines
regards,
o.Quoted 29 lines
Thanks,
Jonathan
Quoted 24 lines
--- drivers/iio/light/stk3310.c | 2 ++ 1 file changed, 2 insertions(+)drivers/iio/light/stk3310.c +2
-0@@ -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 ;