[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190427141351.633ede62@archlinux>
Date: Sat, 27 Apr 2019 14:14:17 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Fabien Lahoudere <fabien.lahoudere@...labora.com>
Cc: Gwendal Grignou <gwendal@...omium.org>,
Hartmut Knaack <knaack.h@....de>,
Lars-Peter Clausen <lars@...afoo.de>,
Peter Meerwald-Stadler <pmeerw@...erw.net>,
Benson Leung <bleung@...omium.org>,
Enric Balletbo i Serra <enric.balletbo@...labora.com>,
Guenter Roeck <groeck@...omium.org>,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/1] iio: cros_ec: add 'id' sysfs entry
On Fri, 26 Apr 2019 13:39:16 +0200
Fabien Lahoudere <fabien.lahoudere@...labora.com> wrote:
> From: Gwendal Grignou <gwendal@...omium.org>
>
> This new sysfs entry is used to interpret ring buffer information,
> mainly by Android sensor HAL.
> It expand to all sensors, the documentation about 'id' we can found
> in Documentation/ABI/testing/sysfs-bus-iio-cros-ec.
>
> Also fix typo in docs, I replace 'Septembre' by 'September'.
>
> Signed-off-by: Gwendal Grignou <gwendal@...omium.org>
> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@...labora.com>
Hmm. I'm not 100% keen on non standard ABI like this, but given
we already have it for one type of cros_ec, I guess the other one can
have it as well.
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.
Note this has probably just missed the coming merge window unless that
is delayed for some reason.
Thanks,
Jonathan
> ---
> Documentation/ABI/testing/sysfs-bus-iio-cros-ec | 10 +++++-----
> .../common/cros_ec_sensors/cros_ec_sensors_core.c | 14 ++++++++++++++
> 2 files changed, 19 insertions(+), 5 deletions(-)
>
> diff --git a/Documentation/ABI/testing/sysfs-bus-iio-cros-ec b/Documentation/ABI/testing/sysfs-bus-iio-cros-ec
> index 0e95c2ca105c..6158f831c761 100644
> --- a/Documentation/ABI/testing/sysfs-bus-iio-cros-ec
> +++ b/Documentation/ABI/testing/sysfs-bus-iio-cros-ec
> @@ -18,11 +18,11 @@ Description:
> values are 'base' and 'lid'.
>
> What: /sys/bus/iio/devices/iio:deviceX/id
> -Date: Septembre 2017
> +Date: September 2017
> KernelVersion: 4.14
> Contact: linux-iio@...r.kernel.org
> Description:
> - This attribute is exposed by the CrOS EC legacy accelerometer
> - driver and represents the sensor ID as exposed by the EC. This
> - ID is used by the Android sensor service hardware abstraction
> - layer (sensor HAL) through the Android container on ChromeOS.
> + This attribute is exposed by the CrOS EC sensors driver and
> + represents the sensor ID as exposed by the EC. This ID is used
> + by the Android sensor service hardware abstraction layer (sensor
> + HAL) through the Android container on ChromeOS.
> 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)
> @@ -140,6 +149,11 @@ const struct iio_chan_spec_ext_info cros_ec_sensors_ext_info[] = {
> .shared = IIO_SHARED_BY_ALL,
> .write = cros_ec_sensors_calibrate
> },
> + {
> + .name = "id",
> + .shared = IIO_SHARED_BY_ALL,
> + .read = cros_ec_sensors_id
> + },
> {
> .name = "location",
> .shared = IIO_SHARED_BY_ALL,
Powered by blists - more mailing lists