iio: common: cros_ec_sensors: Expose cros_ec_sensors frequency range via iio sysfs
authorFabien Lahoudere <fabien.lahoudere@collabora.com>
Tue, 16 Jul 2019 09:11:06 +0000 (11:11 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 27 Jul 2019 22:15:08 +0000 (23:15 +0100)
commitae7b02ad2f32d39d1434655f346c04a16c1aa703
tree9230bbf83261b35be0da7a9e185316742f172d86
parent9566cb1ddb81c4f232d08cb2c7aff5b947959381
iio: common: cros_ec_sensors: Expose cros_ec_sensors frequency range via iio sysfs

Embedded controller return minimum and maximum frequencies, unfortunately
we have no way to know the step for all available frequencies.
Even if not complete, we can return a list of known values using the
standard read_avail callback (IIO_CHAN_INFO_SAMP_FREQ) to provide them to
userland.

Now cros_ec_* sensors provides frequencies values in sysfs like this:
"0 min max". 0 is always true to disable the sensor.

Default frequencies are provided for earlier protocol.

Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org>
Signed-off-by: Fabien Lahoudere <fabien.lahoudere@collabora.com>
[rebased on top of iio/testing and solved conflicts]
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/common/cros_ec_sensors/cros_ec_sensors.c
drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c
drivers/iio/light/cros_ec_light_prox.c
include/linux/iio/common/cros_ec_sensors_core.h