iio: light: apds9306: fix default sampling frequency definition
Subsystems (2)
PATCH v3 1/1 iio: light: apds9306: fix default sampling frequency definition
APDS9306_SAMP_FREQ_10HZ is defined as 0.
According to the datasheet (Broadcom AV02-4755EN, page 11, ALS_MEAS_RATE), bits[2:0] set the measurement rate:
- 000: 25ms (40Hz)
- 001: 20ms (20Hz)
- 010: 100ms (10Hz)
Change APDS9306_SAMP_FREQ_10HZ from 0 to 2 to write the correct value for 10Hz.
Datasheet: https://docs.broadcom.com/doc/AV02-4755EN
---
Changes in v3:
- Move datasheet URL to datasheet tag in the commit message
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Add datasheet link to commit message
- Remove blank line in the tag block
- Link to v1: https://lore.kernel.org/r/[email protected]
--- drivers/iio/light/apds9306.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/light/apds9306.c +1 -1
@@ -61,7 +61,7 @@#define APDS9306_NUM_REPEAT_RATES 7#define APDS9306_INT_SRC_CLEAR 0#define APDS9306_INT_SRC_ALS 1 -#define APDS9306_SAMP_FREQ_10HZ 0 +#define APDS9306_SAMP_FREQ_10HZ 2/** * struct part_id_gts_multiplier - Part no. and corresponding gts multiplier
---
base-commit: 940de590b839f71d6dc846160534bf202401b8b7
change-id: 20260903-apds9306-bedba7b74e59
Best regards,
Signature · 1 line
Tsz Shan Chan <[email protected]>
Jonathan Cameron
maintainerQuoted 8 lines · On Fri, 04 Sep 2026 11:19:48 +1000 Tsz Shan Chan <[email protected]> wrote:
APDS9306_SAMP_FREQ_10HZis defined as 0.According to the datasheet (Broadcom AV02-4755EN, page 11,
ALS_MEAS_RATE), bits[2:0] set the measurement rate:
- 000: 25ms (40Hz)
- 001: 20ms (20Hz)
- 010: 100ms (10Hz)
Quoted 7 lines
Change
APDS9306_SAMP_FREQ_10HZfrom 0 to 2 to write the correct value for 10Hz.Datasheet: https://docs.broadcom.com/doc/AV02-4755EN
Fixes 620d1e6c7a3f ("iio: light: Add support for APDS9306 Light Sensor")Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Tsz Shan Chan <[email protected]>
Looks correct to me, but as driver is only a few years old, I'll leave some time to see if Subhajit is still about to take a look.
Jonathan
Quoted 32 lines
---
Changes in v3:
- Move datasheet URL to datasheet tag in the commit message
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Add datasheet link to commit message
- Remove blank line in the tag block
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/iio/light/apds9306.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/apds9306.c +1
-2@@ -61,7 +61,7 @@#define APDS9306_NUM_REPEAT_RATES 7#define APDS9306_INT_SRC_CLEAR 0#define APDS9306_INT_SRC_ALS 1 -#define APDS9306_SAMP_FREQ_10HZ 0 +#define APDS9306_SAMP_FREQ_10HZ 2/** * struct part_id_gts_multiplier - Part no. and corresponding gts multiplier --- base-commit:
940de590b839f71d6dc846160534bf202401b8b7
change-id: 20260903-apds9306-bedba7b74e59Best regards,
Quoted 14 lines · Jonathan Cameron
Quoted 11 lines · On Fri, 04 Sep 2026 11:19:48 +1000 Tsz Shan Chan <[email protected]> wrote:
APDS9306_SAMP_FREQ_10HZis defined as 0.According to the datasheet (Broadcom AV02-4755EN, page 11,
ALS_MEAS_RATE), bits[2:0] set the measurement rate:
- 000: 25ms (40Hz)
- 001: 20ms (20Hz)
- 010: 100ms (10Hz)Change
APDS9306_SAMP_FREQ_10HZfrom 0 to 2 to write the correct value for 10Hz.
Quoted 8 lines
Quoted 4 lines
Datasheet: https://docs.broadcom.com/doc/AV02-4755EN
Fixes 620d1e6c7a3f ("iio: light: Add support for APDS9306 Light Sensor")Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Tsz Shan Chan <[email protected]>Looks correct to me, but as driver is only a few years old, I'll leave some time to see if Subhajit is still about to take a look.
Jonathan
Hi Tsz,
Really good find.
I am just trying to find out how this happened as this is not a logic or implementation error! Let me rig up my test setup, read back from the reg and make sure it gives 0x22 without any init.
Looks all right to me according to the datasheet and init sequence.
Thanks Andy and Jonathan.
Regards,
Subhajit Ghosh
Quoted 33 lines
Quoted 32 lines
---
Changes in v3:
- Move datasheet URL to datasheet tag in the commit message
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Add datasheet link to commit message
- Remove blank line in the tag block
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/iio/light/apds9306.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/apds9306.c +1
-2@@ -61,7 +61,7 @@#define APDS9306_NUM_REPEAT_RATES 7#define APDS9306_INT_SRC_CLEAR 0#define APDS9306_INT_SRC_ALS 1 -#define APDS9306_SAMP_FREQ_10HZ 0 +#define APDS9306_SAMP_FREQ_10HZ 2/** * struct part_id_gts_multiplier - Part no. and corresponding gts multiplier --- base-commit:
940de590b839f71d6dc846160534bf202401b8b7
change-id: 20260903-apds9306-bedba7b74e59Best regards,
Jonathan Cameron
maintainerQuoted 24 lines · On Sat, 12 Sep 2026 20:29:36 +0930 Subhajit Ghosh…
Quoted 14 lines · Jonathan Cameron
Quoted 11 lines · On Fri, 04 Sep 2026 11:19:48 +1000 Tsz Shan Chan <[email protected]> wrote:
APDS9306_SAMP_FREQ_10HZis defined as 0.According to the datasheet (Broadcom AV02-4755EN, page 11,
ALS_MEAS_RATE), bits[2:0] set the measurement rate:
- 000: 25ms (40Hz)
- 001: 20ms (20Hz)
- 010: 100ms (10Hz)Change
APDS9306_SAMP_FREQ_10HZfrom 0 to 2 to write the correct value for 10Hz.Quoted 8 lines
Quoted 4 lines
Datasheet: https://docs.broadcom.com/doc/AV02-4755EN
Fixes 620d1e6c7a3f ("iio: light: Add support for APDS9306 Light Sensor")Reviewed-by Andy Shevchenko <[email protected]>Signed-off-by Tsz Shan Chan <[email protected]>Looks correct to me, but as driver is only a few years old, I'll leave some time to see if Subhajit is still about to take a look.
Jonathan
Quoted 8 lines
Hi Tsz,
Really good find.
I am just trying to find out how this happened as this is not a logic or implementation error! Let me rig up my test setup, read back from the reg and make sure it gives0x22without any init.Looks all right to me according to the datasheet and init sequence.
Acked-by Subhajit Ghosh <[email protected]>
Shout if your testing shows up anything interesting.
In meantime I've queued this up on the testing branch of iio.git and marked it for stable
Thanks,
Jonathan
Quoted 39 lines
Thanks Andy and Jonathan.
Regards,
Subhajit GhoshQuoted 33 lines
Quoted 32 lines
---
Changes in v3:
- Move datasheet URL to datasheet tag in the commit message
- Link to v2: https://lore.kernel.org/r/[email protected]Changes in v2:
- Add datasheet link to commit message
- Remove blank line in the tag block
- Link to v1: https://lore.kernel.org/r/[email protected]--- drivers/iio/light/apds9306.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/iio/light/apds9306.c +1
-2@@ -61,7 +61,7 @@#define APDS9306_NUM_REPEAT_RATES 7#define APDS9306_INT_SRC_CLEAR 0#define APDS9306_INT_SRC_ALS 1 -#define APDS9306_SAMP_FREQ_10HZ 0 +#define APDS9306_SAMP_FREQ_10HZ 2/** * struct part_id_gts_multiplier - Part no. and corresponding gts multiplier --- base-commit:
940de590b839f71d6dc846160534bf202401b8b7
change-id: 20260903-apds9306-bedba7b74e59Best regards,