From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Badhri Jagan Sridharan <badhri@google.com>
Cc: Guenter Roeck <linux@roeck-us.net>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
Kyle Tso <kyletso@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH v3] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes
Date: Thu, 18 Aug 2022 11:00:40 +0300 [thread overview]
Message-ID: <Yv3xqCCmIeSnsQDz@kuha.fi.intel.com> (raw)
In-Reply-To: <20220817215410.1807477-1-badhri@google.com>
On Wed, Aug 17, 2022 at 02:54:10PM -0700, Badhri Jagan Sridharan wrote:
> When the port does not support USB PD, prevent transition to PD
> only states when power supply property is written. In this case,
> TCPM transitions to SNK_NEGOTIATE_CAPABILITIES
> which should not be the case given that the port is not pd_capable.
>
> [ 84.308251] state change SNK_READY -> SNK_NEGOTIATE_CAPABILITIES [rev3 NONE_AMS]
> [ 84.308335] Setting usb_comm capable false
> [ 84.323367] set_auto_vbus_discharge_threshold mode:3 pps_active:n vbus:5000 ret:0
> [ 84.323376] state change SNK_NEGOTIATE_CAPABILITIES -> SNK_WAIT_CAPABILITIES [rev3 NONE_AMS]
>
> Fixes: e9e6e164ed8f6 ("usb: typec: tcpm: Support non-PD mode")
> Cc: stable@vger.kernel.org
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> Changes since v1:
> - Add Fixes tag.
> Changes since v2:
> - CCed stable
> ---
> drivers/usb/typec/tcpm/tcpm.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index ea5a917c51b1..904c7b4ce2f0 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -6320,6 +6320,13 @@ static int tcpm_psy_set_prop(struct power_supply *psy,
> struct tcpm_port *port = power_supply_get_drvdata(psy);
> int ret;
>
> + /*
> + * All the properties below are related to USB PD. The check needs to be
> + * property specific when a non-pd related property is added.
> + */
> + if (!port->pd_supported)
> + return -EOPNOTSUPP;
> +
> switch (psp) {
> case POWER_SUPPLY_PROP_ONLINE:
> ret = tcpm_psy_set_online(port, val);
> --
> 2.37.1.595.g718a3a8f04-goog
--
heikki
prev parent reply other threads:[~2022-08-18 8:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-17 21:54 [PATCH v3] usb: typec: tcpm: Return ENOTSUPP for power supply prop writes Badhri Jagan Sridharan
2022-08-18 8:00 ` Heikki Krogerus [this message]
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=Yv3xqCCmIeSnsQDz@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=badhri@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=kyletso@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=stable@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