* [PATCH v3 0/3] iio: light: stk3310: stk3013 support
@ 2024-07-21 10:14 Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 1/3] iio: light: stk3310: relax chipid check warning Kaustabh Chakraborty
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Kaustabh Chakraborty @ 2024-07-21 10:14 UTC (permalink / raw)
To: Jonathan Cameron, Conor Dooley
Cc: linux-iio, devicetree, Kaustabh Chakraborty
STK3013 is a part manufactured by Sensortek which is marketed as a [1]
"Proximity Sensor". This part is available in several consumer mobile
devices, including, but not limited to, Samsung Galaxy J7 Prime and
Samsung Galaxy A2 Core.
The existing ambient light sensor seemed suitable for this chip, and on
enabling the driver, it was discovered that these "Proximity Sensors" had
ambient light sensing capabilities as well.
The downstream kernel driver shipped with this phone by Samsung [2] exposes
a sysfs interface for proximity sensing, but leaves out the light sensing
features, hence there's no such functionality in userspace.
The following patch series aims to add support for STK3013 as an
ambient light/proximity sensor.
[1] https://www.sensortek.com.tw/index.php/en/products/optical-sensor/
[2] https://github.com/samsungexynos7870/android_kernel_samsung_exynos7870/blob/master/drivers/sensors/stk3013.c
Changes in v3:
- added a cover letter to the patch series
- added stk3310 as a fallback compatible
v2: https://lore.kernel.org/linux-iio/20240712152417.97726-1-kauschluss@disroot.org/
Changes in v2:
- added a commit to relax unknown chipid warning
- missed "v2" in patches
v1: https://lore.kernel.org/linux-iio/20240625165122.231182-1-kauschluss@disroot.org/
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
Kaustabh Chakraborty (3):
iio: light: stk3310: relax chipid check warning
iio: light: stk3310: add support for stk3013
dt-bindings: iio: light: stk33xx: add compatible for stk3013
Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 13 +++++++++----
drivers/iio/light/stk3310.c | 7 ++++++-
2 files changed, 15 insertions(+), 5 deletions(-)
---
base-commit: 62c97045b8f720c2eac807a5f38e26c9ed512371
change-id: 20240714-stk3310-658f6f34a798
Best regards,
--
Kaustabh Chakraborty <kauschluss@disroot.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/3] iio: light: stk3310: relax chipid check warning
2024-07-21 10:14 [PATCH v3 0/3] iio: light: stk3310: stk3013 support Kaustabh Chakraborty
@ 2024-07-21 10:14 ` Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 2/3] iio: light: stk3310: add support for stk3013 Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible " Kaustabh Chakraborty
2 siblings, 0 replies; 7+ messages in thread
From: Kaustabh Chakraborty @ 2024-07-21 10:14 UTC (permalink / raw)
To: Jonathan Cameron, Conor Dooley
Cc: linux-iio, devicetree, Kaustabh Chakraborty
In order to allow newer devices which are compatible with existing
sensors, issuing a warning for an unknown chipid indicates that
something has gone wrong with the init process, which isn't ideal.
Swap it with a friendlier info message to get things right.
Suggested-by: Conor Dooley <conor@kernel.org>
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
drivers/iio/light/stk3310.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index e3470d6743ef..48a971de6a04 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -496,7 +496,7 @@ static int stk3310_init(struct iio_dev *indio_dev)
ret = stk3310_check_chip_id(chipid);
if (ret < 0)
- dev_warn(&client->dev, "unknown chip id: 0x%x\n", chipid);
+ dev_info(&client->dev, "new unknown chip id: 0x%x\n", chipid);
state = STK3310_STATE_EN_ALS | STK3310_STATE_EN_PS;
ret = stk3310_set_state(data, state);
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 2/3] iio: light: stk3310: add support for stk3013
2024-07-21 10:14 [PATCH v3 0/3] iio: light: stk3310: stk3013 support Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 1/3] iio: light: stk3310: relax chipid check warning Kaustabh Chakraborty
@ 2024-07-21 10:14 ` Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible " Kaustabh Chakraborty
2 siblings, 0 replies; 7+ messages in thread
From: Kaustabh Chakraborty @ 2024-07-21 10:14 UTC (permalink / raw)
To: Jonathan Cameron, Conor Dooley
Cc: linux-iio, devicetree, Kaustabh Chakraborty
Add support for Sensortek's STK3013 in the driver. The part bears the
product ID 0x31.
As seen in [1], Sensortek lists STK3013 as a proximity sensor. But it
has been experimentally observed that they do have ambient light sensing
capabilities. Furthermore, [2] implements a proximity and ambient light
sensor driver for STK3x1x devices, which is also indicative of the fact
that these parts are also ambient light sensors.
[1] https://www.sensortek.com.tw/index.php/en/products/optical-sensor/
[2] https://android.googlesource.com/kernel/msm.git/+/e6dfa4641d88201e8019be19ff557e5d2cf4572f
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
drivers/iio/light/stk3310.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/iio/light/stk3310.c b/drivers/iio/light/stk3310.c
index 48a971de6a04..ed20b6714546 100644
--- a/drivers/iio/light/stk3310.c
+++ b/drivers/iio/light/stk3310.c
@@ -35,6 +35,7 @@
#define STK3310_STATE_EN_ALS BIT(1)
#define STK3310_STATE_STANDBY 0x00
+#define STK3013_CHIP_ID_VAL 0x31
#define STK3310_CHIP_ID_VAL 0x13
#define STK3311_CHIP_ID_VAL 0x1D
#define STK3311A_CHIP_ID_VAL 0x15
@@ -84,6 +85,7 @@ static const struct reg_field stk3310_reg_field_flag_nf =
REG_FIELD(STK3310_REG_FLAG, 0, 0);
static const u8 stk3310_chip_ids[] = {
+ STK3013_CHIP_ID_VAL,
STK3310_CHIP_ID_VAL,
STK3311A_CHIP_ID_VAL,
STK3311S34_CHIP_ID_VAL,
@@ -700,6 +702,7 @@ static DEFINE_SIMPLE_DEV_PM_OPS(stk3310_pm_ops, stk3310_suspend,
stk3310_resume);
static const struct i2c_device_id stk3310_i2c_id[] = {
+ { "STK3013" },
{ "STK3310" },
{ "STK3311" },
{ "STK3335" },
@@ -708,6 +711,7 @@ static const struct i2c_device_id stk3310_i2c_id[] = {
MODULE_DEVICE_TABLE(i2c, stk3310_i2c_id);
static const struct acpi_device_id stk3310_acpi_id[] = {
+ {"STK3013", 0},
{"STK3310", 0},
{"STK3311", 0},
{}
@@ -716,6 +720,7 @@ static const struct acpi_device_id stk3310_acpi_id[] = {
MODULE_DEVICE_TABLE(acpi, stk3310_acpi_id);
static const struct of_device_id stk3310_of_match[] = {
+ { .compatible = "sensortek,stk3013", },
{ .compatible = "sensortek,stk3310", },
{ .compatible = "sensortek,stk3311", },
{ .compatible = "sensortek,stk3335", },
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible for stk3013
2024-07-21 10:14 [PATCH v3 0/3] iio: light: stk3310: stk3013 support Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 1/3] iio: light: stk3310: relax chipid check warning Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 2/3] iio: light: stk3310: add support for stk3013 Kaustabh Chakraborty
@ 2024-07-21 10:14 ` Kaustabh Chakraborty
2024-07-22 17:05 ` Conor Dooley
2024-07-22 18:41 ` Rob Herring (Arm)
2 siblings, 2 replies; 7+ messages in thread
From: Kaustabh Chakraborty @ 2024-07-21 10:14 UTC (permalink / raw)
To: Jonathan Cameron, Conor Dooley
Cc: linux-iio, devicetree, Kaustabh Chakraborty
STK3013 is a proximity sensor by Sensortek, bearing chipid of 0x31. Despite
being marketed as a proximity sensor, it also appears to have ambient
light sensing capabilities.
The part is fully compatible with the existing implementation of the
device driver. Add the compatible string of stk3013 to the existing
list, with a fallback of stk3310.
Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
---
Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
index f6e22dc9814a..d5f6b622c8da 100644
--- a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
+++ b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
@@ -18,10 +18,15 @@ allOf:
properties:
compatible:
- enum:
- - sensortek,stk3310
- - sensortek,stk3311
- - sensortek,stk3335
+ oneOf:
+ - enum:
+ - sensortek,stk3310
+ - sensortek,stk3311
+ - sensortek,stk3335
+ - items:
+ - enum:
+ - sensortek,stk3013
+ - const: sensortek,stk3310
reg:
maxItems: 1
--
2.45.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible for stk3013
2024-07-21 10:14 ` [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible " Kaustabh Chakraborty
@ 2024-07-22 17:05 ` Conor Dooley
2024-07-26 18:52 ` Kaustabh Chakraborty
2024-07-22 18:41 ` Rob Herring (Arm)
1 sibling, 1 reply; 7+ messages in thread
From: Conor Dooley @ 2024-07-22 17:05 UTC (permalink / raw)
To: Kaustabh Chakraborty; +Cc: Jonathan Cameron, linux-iio, devicetree
[-- Attachment #1: Type: text/plain, Size: 1874 bytes --]
On Sun, Jul 21, 2024 at 03:44:31PM +0530, Kaustabh Chakraborty wrote:
> STK3013 is a proximity sensor by Sensortek, bearing chipid of 0x31. Despite
> being marketed as a proximity sensor, it also appears to have ambient
> light sensing capabilities.
>
> The part is fully compatible with the existing implementation of the
> device driver. Add the compatible string of stk3013 to the existing
> list, with a fallback of stk3310.
>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
> index f6e22dc9814a..d5f6b622c8da 100644
> --- a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
> +++ b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
> @@ -18,10 +18,15 @@ allOf:
>
> properties:
> compatible:
> - enum:
> - - sensortek,stk3310
> - - sensortek,stk3311
> - - sensortek,stk3335
> + oneOf:
> + - enum:
> + - sensortek,stk3310
> + - sensortek,stk3311
> + - sensortek,stk3335
> + - items:
> + - enum:
> + - sensortek,stk3013
> + - const: sensortek,stk3310
>
./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:23:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:27:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:28:11: [warning] wrong indentation: expected 12 but found 10 (indentation)
From dt_binding_check, please fix.
> reg:
> maxItems: 1
>
> --
> 2.45.2
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible for stk3013
2024-07-21 10:14 ` [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible " Kaustabh Chakraborty
2024-07-22 17:05 ` Conor Dooley
@ 2024-07-22 18:41 ` Rob Herring (Arm)
1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring (Arm) @ 2024-07-22 18:41 UTC (permalink / raw)
To: Kaustabh Chakraborty
Cc: Conor Dooley, devicetree, linux-iio, Jonathan Cameron
On Sun, 21 Jul 2024 15:44:31 +0530, Kaustabh Chakraborty wrote:
> STK3013 is a proximity sensor by Sensortek, bearing chipid of 0x31. Despite
> being marketed as a proximity sensor, it also appears to have ambient
> light sensing capabilities.
>
> The part is fully compatible with the existing implementation of the
> device driver. Add the compatible string of stk3013 to the existing
> list, with a fallback of stk3310.
>
> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
> ---
> Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 13 +++++++++----
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:23:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:27:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:28:11: [warning] wrong indentation: expected 12 but found 10 (indentation)
dtschema/dtc warnings/errors:
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20240721-stk3310-v3-3-98fcb6f551a1@disroot.org
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible for stk3013
2024-07-22 17:05 ` Conor Dooley
@ 2024-07-26 18:52 ` Kaustabh Chakraborty
0 siblings, 0 replies; 7+ messages in thread
From: Kaustabh Chakraborty @ 2024-07-26 18:52 UTC (permalink / raw)
To: Conor Dooley; +Cc: Jonathan Cameron, linux-iio, devicetree, kauschluss
On 2024-07-22 17:05, Conor Dooley wrote:
> On Sun, Jul 21, 2024 at 03:44:31PM +0530, Kaustabh Chakraborty wrote:
>> STK3013 is a proximity sensor by Sensortek, bearing chipid of 0x31. Despite
>> being marketed as a proximity sensor, it also appears to have ambient
>> light sensing capabilities.
>>
>> The part is fully compatible with the existing implementation of the
>> device driver. Add the compatible string of stk3013 to the existing
>> list, with a fallback of stk3310.
>>
>> Signed-off-by: Kaustabh Chakraborty <kauschluss@disroot.org>
>> ---
>> Documentation/devicetree/bindings/iio/light/stk33xx.yaml | 13 +++++++++----
>> 1 file changed, 9 insertions(+), 4 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
>> index f6e22dc9814a..d5f6b622c8da 100644
>> --- a/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
>> +++ b/Documentation/devicetree/bindings/iio/light/stk33xx.yaml
>> @@ -18,10 +18,15 @@ allOf:
>>
>> properties:
>> compatible:
>> - enum:
>> - - sensortek,stk3310
>> - - sensortek,stk3311
>> - - sensortek,stk3335
>> + oneOf:
>> + - enum:
>> + - sensortek,stk3310
>> + - sensortek,stk3311
>> + - sensortek,stk3335
>> + - items:
>> + - enum:
>> + - sensortek,stk3013
>> + - const: sensortek,stk3310
>>
>
> ./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:23:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
> ./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:27:9: [warning] wrong indentation: expected 10 but found 8 (indentation)
> ./Documentation/devicetree/bindings/iio/light/stk33xx.yaml:28:11: [warning] wrong indentation: expected 12 but found 10 (indentation)
>
> From dt_binding_check, please fix.
Will get fixed in v4.
Thanks.
>
>> reg:
>> maxItems: 1
>>
>> --
>> 2.45.2
>>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-07-26 18:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-21 10:14 [PATCH v3 0/3] iio: light: stk3310: stk3013 support Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 1/3] iio: light: stk3310: relax chipid check warning Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 2/3] iio: light: stk3310: add support for stk3013 Kaustabh Chakraborty
2024-07-21 10:14 ` [PATCH v3 3/3] dt-bindings: iio: light: stk33xx: add compatible " Kaustabh Chakraborty
2024-07-22 17:05 ` Conor Dooley
2024-07-26 18:52 ` Kaustabh Chakraborty
2024-07-22 18:41 ` Rob Herring (Arm)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).