linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] iio: light: vcnl4000: update sampling rates
@ 2020-01-08 15:58 Tomas Novotny
  2020-01-08 15:58 ` [PATCH 1/2] iio: light: vcnl4000: update sampling rates for vcnl4200 Tomas Novotny
  2020-01-08 15:58 ` [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040 Tomas Novotny
  0 siblings, 2 replies; 6+ messages in thread
From: Tomas Novotny @ 2020-01-08 15:58 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Tomas Novotny, Angus Ainslie,
	Marco Felsch, Thomas Gleixner, Guido Günther

Vishay has published new information which explain drifts seen in
experiments. So update the sampling rates for affected variants.

Patches are based on iio/fixes-togreg to avoid conflict.

Tested on vcnl4200.

Tomas Novotny (2):
  iio: light: vcnl4000: update sampling rates for vcnl4200
  iio: light: vcnl4000: update sampling rates for vcnl4040

 drivers/iio/light/vcnl4000.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

-- 
2.16.4


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

* [PATCH 1/2] iio: light: vcnl4000: update sampling rates for vcnl4200
  2020-01-08 15:58 [PATCH 0/2] iio: light: vcnl4000: update sampling rates Tomas Novotny
@ 2020-01-08 15:58 ` Tomas Novotny
  2020-01-11 11:32   ` Guido Günther
  2020-01-08 15:58 ` [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040 Tomas Novotny
  1 sibling, 1 reply; 6+ messages in thread
From: Tomas Novotny @ 2020-01-08 15:58 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Tomas Novotny, Angus Ainslie,
	Marco Felsch, Thomas Gleixner, Guido Günther

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:
-- 
2.16.4


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

* [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040
  2020-01-08 15:58 [PATCH 0/2] iio: light: vcnl4000: update sampling rates Tomas Novotny
  2020-01-08 15:58 ` [PATCH 1/2] iio: light: vcnl4000: update sampling rates for vcnl4200 Tomas Novotny
@ 2020-01-08 15:58 ` Tomas Novotny
  2020-01-11 11:21   ` Guido Günther
  1 sibling, 1 reply; 6+ messages in thread
From: Tomas Novotny @ 2020-01-08 15:58 UTC (permalink / raw)
  To: linux-iio
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Tomas Novotny, Angus Ainslie,
	Marco Felsch, Thomas Gleixner, Guido Günther

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. Although the application
note is related to vcnl4200, according to support the vcnl4040's "ASIC
is quite similar to that one for the VCNL4200".

So update the sampling rates (and comment), including the correct
sampling rate for proximity. Both sampling rates are lower. Users
relying on the blocking behaviour of reading will get proximity
measurements much earlier.

Fixes: 5a441aade5b3 ("iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor")
Signed-off-by: Tomas Novotny <tomas@novotny.cz>
---
 drivers/iio/light/vcnl4000.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index 98428bf430bd..e5b00a6611ac 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -174,9 +174,10 @@ static int vcnl4200_init(struct vcnl4000_data *data)
 		data->al_scale = 24000;
 		break;
 	case VCNL4040_PROD_ID:
-		/* Integration time is 80ms, add 10ms. */
-		data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
-		data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
+		/* Default wait time is 80ms, add 20% tolerance. */
+		data->vcnl4200_al.sampling_rate = ktime_set(0, 96000 * 1000);
+		/* Default wait time is 5ms, add 20% tolerance. */
+		data->vcnl4200_ps.sampling_rate = ktime_set(0, 6000 * 1000);
 		data->al_scale = 120000;
 		break;
 	}
-- 
2.16.4


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

* Re: [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040
  2020-01-08 15:58 ` [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040 Tomas Novotny
@ 2020-01-11 11:21   ` Guido Günther
  2020-01-11 11:39     ` Guido Günther
  0 siblings, 1 reply; 6+ messages in thread
From: Guido Günther @ 2020-01-11 11:21 UTC (permalink / raw)
  To: Tomas Novotny
  Cc: linux-iio, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Angus Ainslie, Marco Felsch,
	Thomas Gleixner

Hi,
On Wed, Jan 08, 2020 at 04:58:52PM +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. Although the application
> note is related to vcnl4200, according to support the vcnl4040's "ASIC
> is quite similar to that one for the VCNL4200".
> 
> So update the sampling rates (and comment), including the correct
> sampling rate for proximity. Both sampling rates are lower. Users
> relying on the blocking behaviour of reading will get proximity
> measurements much earlier.
> 
> Fixes: 5a441aade5b3 ("iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor")
> Signed-off-by: Tomas Novotny <tomas@novotny.cz>
> ---
>  drivers/iio/light/vcnl4000.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index 98428bf430bd..e5b00a6611ac 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -174,9 +174,10 @@ static int vcnl4200_init(struct vcnl4000_data *data)
>  		data->al_scale = 24000;
>  		break;
>  	case VCNL4040_PROD_ID:
> -		/* Integration time is 80ms, add 10ms. */
> -		data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
> -		data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
> +		/* Default wait time is 80ms, add 20% tolerance. */
> +		data->vcnl4200_al.sampling_rate = ktime_set(0, 96000 * 1000);
> +		/* Default wait time is 5ms, add 20% tolerance. */
> +		data->vcnl4200_ps.sampling_rate = ktime_set(0, 6000 * 1000);

I'm seeing the 80ms in VCNL4040 Application guide (Revision:
12-Nov-2019) but that one also says 6400us for the proximity so 8000
might be more on the safe side which (which i just tested, it's still
way better than the current 100000).

with that fixed

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

Cheers,
 -- Guido

>  		data->al_scale = 120000;
>  		break;
>  	}
> -- 
> 2.16.4
> 

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

* Re: [PATCH 1/2] iio: light: vcnl4000: update sampling rates for vcnl4200
  2020-01-08 15:58 ` [PATCH 1/2] iio: light: vcnl4000: update sampling rates for vcnl4200 Tomas Novotny
@ 2020-01-11 11:32   ` Guido Günther
  0 siblings, 0 replies; 6+ messages in thread
From: Guido Günther @ 2020-01-11 11:32 UTC (permalink / raw)
  To: Tomas Novotny
  Cc: linux-iio, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Angus Ainslie, Marco Felsch,
	Thomas Gleixner

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
> 

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

* Re: [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040
  2020-01-11 11:21   ` Guido Günther
@ 2020-01-11 11:39     ` Guido Günther
  0 siblings, 0 replies; 6+ messages in thread
From: Guido Günther @ 2020-01-11 11:39 UTC (permalink / raw)
  To: Tomas Novotny
  Cc: linux-iio, Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Angus Ainslie, Marco Felsch,
	Thomas Gleixner

Hi,
On Sat, Jan 11, 2020 at 12:21:45PM +0100, Guido Günther wrote:
> Hi,
> On Wed, Jan 08, 2020 at 04:58:52PM +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. Although the application
> > note is related to vcnl4200, according to support the vcnl4040's "ASIC
> > is quite similar to that one for the VCNL4200".
> > 
> > So update the sampling rates (and comment), including the correct
> > sampling rate for proximity. Both sampling rates are lower. Users
> > relying on the blocking behaviour of reading will get proximity
> > measurements much earlier.
> > 
> > Fixes: 5a441aade5b3 ("iio: light: vcnl4000 add support for the VCNL4040 proximity and light sensor")
> > Signed-off-by: Tomas Novotny <tomas@novotny.cz>
> > ---
> >  drivers/iio/light/vcnl4000.c | 7 ++++---
> >  1 file changed, 4 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> > index 98428bf430bd..e5b00a6611ac 100644
> > --- a/drivers/iio/light/vcnl4000.c
> > +++ b/drivers/iio/light/vcnl4000.c
> > @@ -174,9 +174,10 @@ static int vcnl4200_init(struct vcnl4000_data *data)
> >  		data->al_scale = 24000;
> >  		break;
> >  	case VCNL4040_PROD_ID:
> > -		/* Integration time is 80ms, add 10ms. */
> > -		data->vcnl4200_al.sampling_rate = ktime_set(0, 100000 * 1000);
> > -		data->vcnl4200_ps.sampling_rate = ktime_set(0, 100000 * 1000);
> > +		/* Default wait time is 80ms, add 20% tolerance. */
> > +		data->vcnl4200_al.sampling_rate = ktime_set(0, 96000 * 1000);
> > +		/* Default wait time is 5ms, add 20% tolerance. */
> > +		data->vcnl4200_ps.sampling_rate = ktime_set(0, 6000 * 1000);
> 
> I'm seeing the 80ms in VCNL4040 Application guide (Revision:
> 12-Nov-2019) but that one also says 6400us for the proximity so 8000
> might be more on the safe side which (which i just tested, it's still
> way better than the current 100000).

In fact i was looking at the wrong value so no changes required:

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

 -- Guido

> 
> with that fixed
> 
> Reviewed-by: Guido Günther <agx@sigxcpu.org>
> 
> Cheers,
>  -- Guido
> 
> >  		data->al_scale = 120000;
> >  		break;
> >  	}
> > -- 
> > 2.16.4
> > 

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

end of thread, other threads:[~2020-01-11 11:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-08 15:58 [PATCH 0/2] iio: light: vcnl4000: update sampling rates Tomas Novotny
2020-01-08 15:58 ` [PATCH 1/2] iio: light: vcnl4000: update sampling rates for vcnl4200 Tomas Novotny
2020-01-11 11:32   ` Guido Günther
2020-01-08 15:58 ` [PATCH 2/2] iio: light: vcnl4000: update sampling rates for vcnl4040 Tomas Novotny
2020-01-11 11:21   ` Guido Günther
2020-01-11 11:39     ` Guido Günther

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).