From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: linux@roeck-us.net, gregkh@linuxfoundation.org,
linux-imx@nxp.com, linux-usb@vger.kernel.org, jun.li@nxp.com
Subject: Re: [PATCH] usb: typec: tcpm: not sink vbus if operational current is 0mA
Date: Mon, 31 Jul 2023 16:33:12 +0300 [thread overview]
Message-ID: <ZMe4GOfAT3a1YueY@kuha.fi.intel.com> (raw)
In-Reply-To: <20230630105656.2828595-1-xu.yang_2@nxp.com>
Hi,
I'm sorry to keep you waiting.
On Fri, Jun 30, 2023 at 06:56:56PM +0800, Xu Yang wrote:
> PD3.0 Spec 6.4.1.3.1 said:
> For a Sink requiring no power from the Source, the Voltage (B19…10)
> Shall be set to 5V and the Operational Current Shall be set to 0mA.
>
> Therefore, we can keep sink path closed if the operational current of
> the first fixed PDO is 0mA.
>
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
> drivers/usb/typec/tcpm/tcpm.c | 12 ++++++++++--
> 1 file changed, 10 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 829d75ebab42..4f7e4c50e847 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4301,7 +4301,12 @@ static void run_state_machine(struct tcpm_port *port)
> if (port->slow_charger_loop && (current_lim > PD_P_SNK_STDBY_MW / 5))
> current_lim = PD_P_SNK_STDBY_MW / 5;
> tcpm_set_current_limit(port, current_lim, 5000);
> - tcpm_set_charge(port, true);
> +
> + if (pdo_max_current(port->snk_pdo[0]))
> + tcpm_set_charge(port, true);
> + else
> + tcpm_log(port, "Not require power from Source");
> +
> if (!port->pd_supported)
> tcpm_set_state(port, SNK_READY, 0);
> else
> @@ -4582,7 +4587,10 @@ static void run_state_machine(struct tcpm_port *port)
> tcpm_set_current_limit(port,
> tcpm_get_current_limit(port),
> 5000);
> - tcpm_set_charge(port, true);
> + if (pdo_max_current(port->snk_pdo[0]))
> + tcpm_set_charge(port, true);
> + else
> + tcpm_log(port, "Not require power from Source");
Shouldn't you still always call tcpm_set_charge()?
tcpm_set_charge(port, pdo_max_current(port->snk_pdo[0]));
I think we need to wait for comments from Guenter. I don't know this
driver well enough.
thanks,
--
heikki
next prev parent reply other threads:[~2023-07-31 13:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-30 10:56 [PATCH] usb: typec: tcpm: not sink vbus if operational current is 0mA Xu Yang
2023-07-31 8:56 ` Xu Yang
2023-07-31 13:33 ` Heikki Krogerus [this message]
2023-07-31 13:42 ` Guenter Roeck
2023-08-01 2:17 ` [EXT] " Xu Yang
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=ZMe4GOfAT3a1YueY@kuha.fi.intel.com \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=jun.li@nxp.com \
--cc=linux-imx@nxp.com \
--cc=linux-usb@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=xu.yang_2@nxp.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