[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMMMRMfYWqGEJDmMaPQFjQFeUhWJ4wVp-xy2TTdAhp3gRv-n8g@mail.gmail.com>
Date: Thu, 20 Feb 2025 13:39:57 +0000
From: Andrei Kuchynski <akuchynski@...omium.org>
To: Tzung-Bi Shih <tzungbi@...nel.org>
Cc: Prashant Malani <pmalani@...omium.org>, Benson Leung <bleung@...omium.org>,
Abhishek Pandit-Subedi <abhishekpandit@...omium.org>, chrome-platform@...ts.linux.dev,
Jameson Thies <jthies@...gle.com>, Łukasz Bartosik <ukaszb@...omium.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] platform/chrome: cros_ec_typec: Add support for setting
USB mode via sysfs
On Tue, Feb 18, 2025 at 2:26 PM Tzung-Bi Shih <tzungbi@...nel.org> wrote:
>
> On Mon, Feb 10, 2025 at 01:04:19PM +0000, Andrei Kuchynski wrote:
> > +static int cros_typec_enter_usb_mode(struct typec_port *tc_port, enum usb_mode mode)
> > +{
> > + struct cros_typec_port *port = typec_get_drvdata(tc_port);
> > + struct ec_params_typec_control req = {
> > + .port = port->port_num,
> > + .command = (mode == USB_MODE_USB4) ?
> > + TYPEC_CONTROL_COMMAND_ENTER_MODE : TYPEC_CONTROL_COMMAND_EXIT_MODES,
> > + .mode_to_enter = CROS_EC_ALTMODE_USB4
>
> The symbol `CROS_EC_ALTMODE_USB4` doesn't exist. On a related note, wouldn't
> it always enter CROS_EC_ALTMODE_USB4 if the value is hard-coded here?
>
CROS_EC_ALTMODE_USB4 is defined in drivers/platform/chrome/cros_ec_typec.h.
TYPEC_CONTROL_COMMAND_ENTER_MODE command will be sent only if
mode == USB_MODE_USB4 because EC currently only supports entering USB4 mode.
Otherwise, TYPEC_CONTROL_COMMAND_EXIT_MODES is sent, and the mode_to_enter
field is irrelevant for this command.
> > @@ -84,6 +102,13 @@ static int cros_typec_parse_port_props(struct typec_capability *cap,
> > cap->prefer_role = ret;
> > }
> >
> > + if (fwnode_property_present(fwnode, "usb2-port"))
> > + cap->usb_capability |= USB_CAPABILITY_USB2;
> > + if (fwnode_property_present(fwnode, "usb3-port"))
> > + cap->usb_capability |= USB_CAPABILITY_USB3;
> > + if (fwnode_property_present(fwnode, "usb4-port"))
> > + cap->usb_capability |= USB_CAPABILITY_USB4;
>
> Are these defined somewhere? E.g. the bindings?
Unfortunately, property names are set in the ACPI firmware in the same way.
Powered by blists - more mailing lists