diff mbox series

[1/2] iio: light: vcnl4000: update sampling rates for vcnl4200

Message ID 20200108155852.32702-2-tomas@novotny.cz (mailing list archive)
State New, archived
Headers show
Series iio: light: vcnl4000: update sampling rates | expand

Commit Message

Tomas Novotny Jan. 8, 2020, 3:58 p.m. UTC
Vishay has published a new version of "Designing the VCNL4200 Into an
Application" application note in October 2019. The new version specifies
that there is +-20% of part to part tolerance. This explains the drift
seen during experiments. The proximity pulse width is also changed from
32us to 30us. According to the support, the tolerance also applies to
ambient light.

So update the sampling rates. As the reading is blocking, current users
may notice slightly longer response time.

Fixes: be38866fbb97 ("iio: vcnl4000: add support for VCNL4200")
Signed-off-by: Tomas Novotny <tomas@novotny.cz>
---
 drivers/iio/light/vcnl4000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Guido Günther Jan. 11, 2020, 11:32 a.m. UTC | #1
Hi,
On Wed, Jan 08, 2020 at 04:58:51PM +0100, Tomas Novotny wrote:
> Vishay has published a new version of "Designing the VCNL4200 Into an
> Application" application note in October 2019. The new version specifies
> that there is +-20% of part to part tolerance. This explains the drift
> seen during experiments. The proximity pulse width is also changed from
> 32us to 30us. According to the support, the tolerance also applies to
> ambient light.
> 
> So update the sampling rates. As the reading is blocking, current users
> may notice slightly longer response time.
> 
> Fixes: be38866fbb97 ("iio: vcnl4000: add support for VCNL4200")
> Signed-off-by: Tomas Novotny <tomas@novotny.cz>
> ---
>  drivers/iio/light/vcnl4000.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index b0e241aaefb4..98428bf430bd 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -167,10 +167,10 @@ static int vcnl4200_init(struct vcnl4000_data *data)
>  	data->vcnl4200_ps.reg = VCNL4200_PS_DATA;
>  	switch (id) {
>  	case VCNL4200_PROD_ID:
> -		/* Integration time is 50ms, but the experiments */
> -		/* show 54ms in total. */
> -		data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000);
> -		data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000);
> +		/* Default wait time is 50ms, add 20% tolerance. */
> +		data->vcnl4200_al.sampling_rate = ktime_set(0, 60000 * 1000);
> +		/* Default wait time is 4.8ms, add 20% tolerance. */
> +		data->vcnl4200_ps.sampling_rate = ktime_set(0, 5760 * 1000);
>  		data->al_scale = 24000;
>  		break;
>  	case VCNL4040_PROD_ID:

Reviewed-by: Guido Günther <agx@sigxcpu.org>

Cheers,
 -- Guido

> -- 
> 2.16.4
>
diff mbox series

Patch

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index b0e241aaefb4..98428bf430bd 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -167,10 +167,10 @@  static int vcnl4200_init(struct vcnl4000_data *data)
 	data->vcnl4200_ps.reg = VCNL4200_PS_DATA;
 	switch (id) {
 	case VCNL4200_PROD_ID:
-		/* Integration time is 50ms, but the experiments */
-		/* show 54ms in total. */
-		data->vcnl4200_al.sampling_rate = ktime_set(0, 54000 * 1000);
-		data->vcnl4200_ps.sampling_rate = ktime_set(0, 4200 * 1000);
+		/* Default wait time is 50ms, add 20% tolerance. */
+		data->vcnl4200_al.sampling_rate = ktime_set(0, 60000 * 1000);
+		/* Default wait time is 4.8ms, add 20% tolerance. */
+		data->vcnl4200_ps.sampling_rate = ktime_set(0, 5760 * 1000);
 		data->al_scale = 24000;
 		break;
 	case VCNL4040_PROD_ID: