[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <411513a99af62b51828500a75ee0970bc763efd4.camel@collabora.com>
Date: Tue, 02 Jul 2019 10:36:30 +0200
From: Fabien Lahoudere <fabien.lahoudere@...labora.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: egranata@...omium.org, kernel@...labora.com,
Nick Vaccaro <nvaccaro@...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>, linux-iio@...r.kernel.org,
linux-kernel@...r.kernel.org, gwendal@...omium.org
Subject: Re: [PATCH v3 1/1] iio: common: cros_ec_sensors: determine protocol
version
Hi,
There is a double semi colon in that patch.
Let me send a v4 without it.
Le lundi 01 juillet 2019 à 10:14 +0200, Fabien Lahoudere a écrit :
> This patch adds a function to determine which version of the
> protocol is used to communicate with EC.
>
> Signed-off-by: Fabien Lahoudere <fabien.lahoudere@...labora.com>
> Signed-off-by: Nick Vaccaro <nvaccaro@...omium.org>
> Reviewed-by: Gwendal Grignou <gwendal@...omium.org>
> Tested-by: Gwendal Grignou <gwendal@...omium.org>
> ---
> .../cros_ec_sensors/cros_ec_sensors_core.c | 36
> ++++++++++++++++++-
> 1 file changed, 35 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 130362ca421b..2e0f97448e64 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
> @@ -25,6 +25,31 @@ static char *cros_ec_loc[] = {
> [MOTIONSENSE_LOC_MAX] = "unknown",
> };
>
> +static int cros_ec_get_host_cmd_version_mask(struct cros_ec_device
> *ec_dev,
> + u16 cmd_offset, u16 cmd,
> u32 *mask)
> +{
> + int ret;
> + struct {
> + struct cros_ec_command msg;
> + union {
> + struct ec_params_get_cmd_versions params;
> + struct ec_response_get_cmd_versions resp;
> + };
> + } __packed buf = {
> + .msg = {
> + .command = EC_CMD_GET_CMD_VERSIONS +
> cmd_offset,
> + .insize = sizeof(struct
> ec_response_get_cmd_versions),
> + .outsize = sizeof(struct
> ec_params_get_cmd_versions)
> + },
> + .params = {.cmd = cmd}
> + };
> +
> + ret = cros_ec_cmd_xfer_status(ec_dev, &buf.msg);
> + if (ret >= 0)
> + *mask = buf.resp.version_mask;
> + return ret;
> +}
> +
> int cros_ec_sensors_core_init(struct platform_device *pdev,
> struct iio_dev *indio_dev,
> bool physical_device)
> @@ -33,6 +58,8 @@ int cros_ec_sensors_core_init(struct
> platform_device *pdev,
> struct cros_ec_sensors_core_state *state = iio_priv(indio_dev);
> struct cros_ec_dev *ec = dev_get_drvdata(pdev->dev.parent);
> struct cros_ec_sensor_platform *sensor_platform =
> dev_get_platdata(dev);
> + u32 ver_mask;
> + int ret;
>
> platform_set_drvdata(pdev, indio_dev);
>
> @@ -47,8 +74,15 @@ int cros_ec_sensors_core_init(struct
> platform_device *pdev,
>
> mutex_init(&state->cmd_lock);
>
> + ret = cros_ec_get_host_cmd_version_mask(state->ec,
> + ec->cmd_offset,
> + EC_CMD_MOTION_SENSE_CMD
> ,
> + &ver_mask);
> + if (ret < 0)
> + return ret;
> +
> /* Set up the host command structure. */
> - state->msg->version = 2;
> + state->msg->version = fls(ver_mask) - 1;;
Unneeded semi colon.
> state->msg->command = EC_CMD_MOTION_SENSE_CMD + ec->cmd_offset;
> state->msg->outsize = sizeof(struct ec_params_motion_sense);
>
Powered by blists - more mailing lists