[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACeCKadLKg89c8s68QD6VsqiKBMms6765O7mFFihqtET30pUyQ@mail.gmail.com>
Date: Tue, 13 Feb 2024 08:55:20 -0800
From: Prashant Malani <pmalani@...omium.org>
To: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, Benson Leung <bleung@...omium.org>,
Tzung-Bi Shih <tzungbi@...nel.org>, Guenter Roeck <groeck@...omium.org>,
Emilie Roberts <hadrosaur@...gle.com>, "Nyman, Mathias" <mathias.nyman@...el.com>,
"Regupathy, Rajaram" <rajaram.regupathy@...el.com>,
"Radjacoumar, Shyam Sundar" <ssradjacoumar@...gle.com>, Samuel Jacob <samjaco@...gle.com>,
Uday Bhat <uday.m.bhat@...el.com>, linux-usb@...r.kernel.org,
chrome-platform@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/2] platform/chrome: cros_ec_typec: Make sure the USB
role switch has PLD
Hi Heikki,
On Tue, Feb 13, 2024 at 5:00 AM Heikki Krogerus
<heikki.krogerus@...ux.intel.com> wrote:
>
> The USB role switch does not always have the _PLD (Physical
> Location of Device) in ACPI tables. If it's missing,
> assigning the PLD hash of the port to the switch. That
> should guarantee that the USB Type-C port mapping code is
> always able to find the connection between the two (the port
> and the switch).
>
> Tested-by: Uday Bhat <uday.m.bhat@...el.com>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> ---
> drivers/platform/chrome/cros_ec_typec.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/drivers/platform/chrome/cros_ec_typec.c b/drivers/platform/chrome/cros_ec_typec.c
> index 2b2f14a1b711..4d305876ec08 100644
> --- a/drivers/platform/chrome/cros_ec_typec.c
> +++ b/drivers/platform/chrome/cros_ec_typec.c
> @@ -24,6 +24,23 @@
> #define DP_PORT_VDO (DP_CONF_SET_PIN_ASSIGN(BIT(DP_PIN_ASSIGN_C) | BIT(DP_PIN_ASSIGN_D)) | \
> DP_CAP_DFP_D | DP_CAP_RECEPTACLE)
>
> +static void cros_typec_role_switch_quirk(struct fwnode_handle *fwnode)
> +{
> +#ifdef CONFIG_ACPI
> + struct fwnode_handle *switch_fwnode;
> +
> + /* Supply the USB role switch with the correct pld_crc if it's missing. */
> + switch_fwnode = fwnode_find_reference(fwnode, "usb-role-switch", 0);
> + if (!IS_ERR_OR_NULL(switch_fwnode)) {
> + struct acpi_device *adev = to_acpi_device_node(switch_fwnode);
> +
> + if (adev && !adev->pld_crc)
> + adev->pld_crc = to_acpi_device_node(fwnode)->pld_crc;
> + fwnode_handle_put(switch_fwnode);
> + }
> +#endif
> +}
> +
I'll reiterate my comment[ 1] from v1: can this be in the
common Type-C code, i.e typec_register_port() ?
I don't see anything in this implementation which is Chrome OS specific.
Thanks,
-Prashant
[1] https://lore.kernel.org/chrome-platform/CACeCKaffZBPA0Q_Bqs1hjKJB4HCj=VKrqO21dXj4AF5C5VwtVQ@mail.gmail.com/
Powered by blists - more mailing lists