From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Prashant Malani <pmalani@chromium.org>
Cc: linux-kernel@vger.kernel.org, Benson Leung <bleung@chromium.org>,
Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Fabien Lahoudere <fabien.lahoudere@collabora.com>,
Guenter Roeck <groeck@chromium.org>,
Gwendal Grignou <gwendal@chromium.org>,
Lee Jones <lee.jones@linaro.org>,
Tzung-Bi Shih <tzungbi@google.com>
Subject: Re: [PATCH 2/4] platform/chrome: typec: Register PD CTRL cmd v2
Date: Tue, 16 Jun 2020 10:27:38 +0300 [thread overview]
Message-ID: <20200616072738.GH3213128@kuha.fi.intel.com> (raw)
In-Reply-To: <20200528113607.120841-3-pmalani@chromium.org>
On Thu, May 28, 2020 at 04:36:05AM -0700, Prashant Malani wrote:
> Recognize EC_CMD_USB_PD_CONTROL command version 2. This is necessary in
> order to process Type C mux information (like DP alt mode pin
> configuration), which is needed by the Type C Connector class API to
> configure the Type C muxes correctly
>
> While we are here, rename the struct member storing this version number
> from cmd_ver to pd_ctrl_ver, which more accurately reflects what is
> being stored.
>
> Also, slightly change the logic for calling
> cros_typec_set_port_params_*(). Now, v0 is called when pd_ctrl_ver is 0,
> and v1 is called otherwise.
>
> Signed-off-by: Prashant Malani <pmalani@chromium.org>
LGTM. One nitpick bellow, but don't prepare v2 just because of that.
FWIW:
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/platform/chrome/cros_ec_typec.c | 16 +++++++++-------
> 1 file changed, 9 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 6e79f917314b..d69a88464cef 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -37,7 +37,7 @@ struct cros_typec_data {
> struct device *dev;
> struct cros_ec_device *ec;
> int num_ports;
> - unsigned int cmd_ver;
> + unsigned int pd_ctrl_ver;
> /* Array of ports, indexed by port number. */
> struct cros_typec_port *ports[EC_USB_PD_MAX_PORTS];
> struct notifier_block nb;
> @@ -340,7 +340,7 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num)
> req.mux = USB_PD_CTRL_MUX_NO_CHANGE;
> req.swap = USB_PD_CTRL_SWAP_NONE;
>
> - ret = cros_typec_ec_command(typec, typec->cmd_ver,
> + ret = cros_typec_ec_command(typec, typec->pd_ctrl_ver,
> EC_CMD_USB_PD_CONTROL, &req, sizeof(req),
> &resp, sizeof(resp));
> if (ret < 0)
> @@ -351,7 +351,7 @@ static int cros_typec_port_update(struct cros_typec_data *typec, int port_num)
> dev_dbg(typec->dev, "Polarity %d: 0x%hhx\n", port_num, resp.polarity);
> dev_dbg(typec->dev, "State %d: %s\n", port_num, resp.state);
>
> - if (typec->cmd_ver == 1)
> + if (typec->pd_ctrl_ver != 0)
How about:
if (typec->pd_ctrl_ver)
> cros_typec_set_port_params_v1(typec, port_num, &resp);
> else
> cros_typec_set_port_params_v0(typec, port_num,
> @@ -374,13 +374,15 @@ static int cros_typec_get_cmd_version(struct cros_typec_data *typec)
> if (ret < 0)
> return ret;
>
> - if (resp.version_mask & EC_VER_MASK(1))
> - typec->cmd_ver = 1;
> + if (resp.version_mask & EC_VER_MASK(2))
> + typec->pd_ctrl_ver = 2;
> + else if (resp.version_mask & EC_VER_MASK(1))
> + typec->pd_ctrl_ver = 1;
> else
> - typec->cmd_ver = 0;
> + typec->pd_ctrl_ver = 0;
>
> dev_dbg(typec->dev, "PD Control has version mask 0x%hhx\n",
> - typec->cmd_ver);
> + typec->pd_ctrl_ver);
>
> return 0;
> }
thanks,
--
heikki
next prev parent reply other threads:[~2020-06-16 7:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 11:36 [PATCH 0/4] platform/chrome: typec: Add mux support Prashant Malani
2020-05-28 11:36 ` [PATCH 1/4] platform/chrome: cros_ec: Update mux state bits Prashant Malani
2020-05-28 11:36 ` [PATCH 2/4] platform/chrome: typec: Register PD CTRL cmd v2 Prashant Malani
2020-06-16 7:27 ` Heikki Krogerus [this message]
2020-05-28 11:36 ` [PATCH 3/4] platform/chrome: typec: Add USB mux control Prashant Malani
2020-06-05 9:12 ` Prashant Malani
2020-06-16 8:19 ` Heikki Krogerus
2020-05-28 11:36 ` [PATCH 4/4] platform/chrome: typec: Support DP alt mode Prashant Malani
2020-06-05 9:12 ` Prashant Malani
2020-06-16 10:31 ` Heikki Krogerus
2020-06-25 11:56 ` [PATCH 0/4] platform/chrome: typec: Add mux support Enric Balletbo i Serra
2020-06-25 16:10 ` Prashant Malani
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=20200616072738.GH3213128@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=bleung@chromium.org \
--cc=enric.balletbo@collabora.com \
--cc=fabien.lahoudere@collabora.com \
--cc=groeck@chromium.org \
--cc=gwendal@chromium.org \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmalani@chromium.org \
--cc=tzungbi@google.com \
/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
all inboxes | Powered by JetHome®