]> asedeno.scripts.mit.edu Git - linux.git/commit
staging: iio: isl29028: correct proximity sleep times
authorBrian Masney <masneyb@onstation.org>
Tue, 25 Apr 2017 01:34:33 +0000 (21:34 -0400)
committerJonathan Cameron <jic23@kernel.org>
Wed, 26 Apr 2017 05:26:09 +0000 (06:26 +0100)
commite4ff6c1b41d66e929e18a9afaa7d7d5788ff3da8
treee1232250f41c1097da094ebf06b06274680134af
parentd6d0014c6b1989f9571eb06c1641de9946c3c980
staging: iio: isl29028: correct proximity sleep times

The sysfs attribute in_proximity_sampling_frequency_available currently
shows the values 1 3 5 10 13 20 83 100. These values are supposed to
correspond to the sleep values 800 400 200 100 75 50 12.5 0 (all in ms).
When passing in a sampling frequency of 3, it actually uses a sleep
time of 200ms instead of the expected 400ms value. This patch changes
the value shown by this sysfs attribute to use fixed-point numbers so
that the correct sampling frequency is shown to the user. This patch
also changes the code that updates the proximity sampling frequency to
only allow values that are shown in the _available sysfs attribute.

The original code showed the value 83 that corresponds to the sleep
time 12 ms. The data sheet actually lists 12.5 ms as the sleep time,
so the proximity frequency was updated to 80.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/light/isl29028.c