iio: light: vcnl4000: update sampling periods
v2 cover iio: light: vcnl4000: update sampling periods
Vishay has published new information which explain drifts seen in experiments. So update the sampling periods for affected variants.
As pointed out in another series, the variable has a misleading name (rate instead of period). This will be fixed in the other series to make backporting of these patches straightforward.
Tested on vcnl4200. Tests on vcnl4040 done by Guido.
Changes in v2:
- fix rate -> period in commit messages and subjects
- collect tags
Tomas Novotny (2):
iio: light: vcnl4000: update sampling periods for vcnl4200
iio: light: vcnl4000: update sampling periods for vcnl4040
drivers/iio/light/vcnl4000.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)
Signature · 1 line
2.16.4
PATCH v2 1/2 iio: light: vcnl4000: update sampling periods for vcnl4200
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 periods. As the reading is blocking, current users may notice slightly longer response time.
--- drivers/iio/light/vcnl4000.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/light/vcnl4000.c +4 -4
@@ -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 :
Signature · 1 line
2.16.4
PATCH v2 2/2 iio: light: vcnl4000: update sampling periods for vcnl4040
In reply to Tomas NovotnyVishay 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 periods (and comment), including the correct sampling period for proximity. Both sampling periods are lower. Users relying on the blocking behaviour of reading will get proximity measurements much earlier.
--- drivers/iio/light/vcnl4000.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/iio/light/vcnl4000.c +4 -3
@@ -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 ; }
Signature · 1 line
2.16.4
Jonathan Cameron
maintainerQuoted 8 lines · On Tue, 18 Feb 2020 16:44:49 +0100 Tomas Novotny <[email protected]> wrote:
Vishay has published new information which explain drifts seen in experiments. So update the sampling periods for affected variants.
As pointed out in another series, the variable has a misleading name (rate instead of period). This will be fixed in the other series to make backporting of these patches straightforward.
Tested on vcnl4200. Tests on vcnl4040 done by Guido.
Both applied to the fixes-togreg branch of iio.git and marked as suitable for stable.
Thanks,
Jonathan
Quoted 12 lines
Changes in v2:
- fix rate -> period in commit messages and subjects
- collect tagsTomas Novotny (2):
iio: light: vcnl4000: update sampling periods for vcnl4200
iio: light: vcnl4000: update sampling periods for vcnl4040drivers/iio/light/vcnl4000.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)