diff options
Diffstat (limited to 'drivers/iio/common')
-rw-r--r-- | drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c index 719a0df5aeeb..130362ca421b 100644 --- a/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c +++ b/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c @@ -125,6 +125,15 @@ static ssize_t cros_ec_sensors_calibrate(struct iio_dev *indio_dev, return ret ? ret : len; } +static ssize_t cros_ec_sensors_id(struct iio_dev *indio_dev, + uintptr_t private, + const struct iio_chan_spec *chan, char *buf) +{ + struct cros_ec_sensors_core_state *st = iio_priv(indio_dev); + + return snprintf(buf, PAGE_SIZE, "%d\n", st->param.info.sensor_num); +} + static ssize_t cros_ec_sensors_loc(struct iio_dev *indio_dev, uintptr_t private, const struct iio_chan_spec *chan, char *buf) @@ -141,6 +150,11 @@ const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[] = { .write = cros_ec_sensors_calibrate }, { + .name = "id", + .shared = IIO_SHARED_BY_ALL, + .read = cros_ec_sensors_id + }, + { .name = "location", .shared = IIO_SHARED_BY_ALL, .read = cros_ec_sensors_loc |