Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Gwendal Grignou <gwendal@chromium.org>
Cc: enric.balletbo@collabora.com, bleung@chromium.org,
	linux-iio@vger.kernel.org
Subject: Re: [PATCH] iio: common: cros_ec_sensors: Add label attribute
Date: Sat, 16 Apr 2022 15:10:49 +0100	[thread overview]
Message-ID: <20220416151049.43844f70@jic23-huawei> (raw)
In-Reply-To: <20220412210703.3842914-1-gwendal@chromium.org>

On Tue, 12 Apr 2022 14:07:03 -0700
Gwendal Grignou <gwendal@chromium.org> wrote:

> When sensor location is known, populate iio sysfs "label" attribute:
> 
> * "accel-base" : the sensor is in the base of the convertible (2-1)
>   device.
> * "accel-display" : the sensor is in the lid/display plane of the
>   device.
> 
> It apply to standalone accelerometer and IMU (accelerometer +
> gyroscope).
> 
> Signed-off-by: Gwendal Grignou <gwendal@chromium.org>

I'm happy with this change, but I think it would
be good for the patch description to include 'why' you want to
add this. I assume that's to make use of the standard ABI rather
than the custom ABI we introduced for this driver. We'd have
used label for this in the first place if it had been an option
at the time, but given we didn't what is the logic for duplicating
this information?

Thanks,

Jonathan

> ---
>  .../iio/common/cros_ec_sensors/cros_ec_sensors_core.c    | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> 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 989b109a82f47..f86b938b36bf8 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
> @@ -325,6 +325,8 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
>  	indio_dev->name = pdev->name;
>  
>  	if (physical_device) {
> +		enum motionsensor_location loc;
> +
>  		state->param.cmd = MOTIONSENSE_CMD_INFO;
>  		state->param.info.sensor_num = sensor_platform->sensor_num;
>  		ret = cros_ec_motion_send_host_cmd(state, 0);
> @@ -333,7 +335,12 @@ int cros_ec_sensors_core_init(struct platform_device *pdev,
>  			return ret;
>  		}
>  		state->type = state->resp->info.type;
> -		state->loc = state->resp->info.location;
> +		loc = state->resp->info.location;
> +		if (loc == MOTIONSENSE_LOC_BASE)
> +			indio_dev->label = "accel-base";
> +		else if (loc == MOTIONSENSE_LOC_LID)
> +			indio_dev->label = "accel-display";
> +		state->loc = loc;
>  
>  		/* Set sign vector, only used for backward compatibility. */
>  		memset(state->sign, 1, CROS_EC_SENSOR_MAX_AXIS);


  reply	other threads:[~2022-04-16 14:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 21:07 [PATCH] iio: common: cros_ec_sensors: Add label attribute Gwendal Grignou
2022-04-16 14:10 ` Jonathan Cameron [this message]
2022-04-27 19:10   ` Gwendal Grignou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220416151049.43844f70@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=bleung@chromium.org \
    --cc=enric.balletbo@collabora.com \
    --cc=gwendal@chromium.org \
    --cc=linux-iio@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox