stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH v1] usb: typec: tcpm: Fix error while calculating PPS out values
       [not found] <20210415050121.1928298-1-badhri@google.com>
@ 2021-04-15  5:03 ` Badhri Jagan Sridharan
  0 siblings, 0 replies; only message in thread
From: Badhri Jagan Sridharan @ 2021-04-15  5:03 UTC (permalink / raw)
  To: Guenter Roeck, Heikki Krogerus, Greg Kroah-Hartman, Adam Thomson
  Cc: USB, LKML, Kyle Tso, stable

On Wed, Apr 14, 2021 at 10:01 PM Badhri Jagan Sridharan
<badhri@google.com> wrote:
>
> "usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply"
> introduced a regression for req_out_volt and req_op_curr calculation.
>
> req_out_volt should consider the newly calculated max voltage instead
> of previously accepted max voltage by the port partner. Likewise,
> req_op_curr should consider the newly calculated max current instead
> of previously accepted max current by the port partner.
>
> Fixes: e3a072022487 ("usb: typec: tcpm: Address incorrect values of tcpm psy for pps supply")
> Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
> ---
>  drivers/usb/typec/tcpm/tcpm.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
> index 1c32bdf62852..04652aa1f54e 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -3132,10 +3132,10 @@ static unsigned int tcpm_pd_select_pps_apdo(struct tcpm_port *port)
>                 port->pps_data.req_max_volt = min(pdo_pps_apdo_max_voltage(src),
>                                                   pdo_pps_apdo_max_voltage(snk));
>                 port->pps_data.req_max_curr = min_pps_apdo_current(src, snk);
> -               port->pps_data.req_out_volt = min(port->pps_data.max_volt,
> -                                                 max(port->pps_data.min_volt,
> +               port->pps_data.req_out_volt = min(port->pps_data.req_max_volt,
> +                                                 max(port->pps_data.req_min_volt,
>                                                       port->pps_data.req_out_volt));
> -               port->pps_data.req_op_curr = min(port->pps_data.max_curr,
> +               port->pps_data.req_op_curr = min(port->pps_data.req_max_curr,
>                                                  port->pps_data.req_op_curr);
>         }
>
> --
> 2.31.1.295.g9ea45b61b8-goog
>

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-15  5:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210415050121.1928298-1-badhri@google.com>
2021-04-15  5:03 ` [PATCH v1] usb: typec: tcpm: Fix error while calculating PPS out values Badhri Jagan Sridharan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).