OSDN Git Service

usb: typec: tcpm: Address incorrect values of tcpm psy for fixed supply
authorBadhri Jagan Sridharan <badhri@google.com>
Wed, 7 Apr 2021 20:07:18 +0000 (13:07 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Apr 2021 13:21:24 +0000 (15:21 +0200)
commitf3dedafb8263ca4791a92a23f5230068f5bde008
treee885b564eb66ea417921a206a6ed6ef8c92021fe
parentb46b1ef7b0da5c9257b98a0d1d658422e7851783
usb: typec: tcpm: Address incorrect values of tcpm psy for fixed supply

tcpm_pd_build_request overwrites current_limit and supply_voltage
even before port partner accepts the requests. This leaves stale
values in current_limit and supply_voltage that get exported by
"tcpm-source-psy-". Solving this problem by caching the request
values of current limit/supply voltage in req_current_limit
and req_supply_voltage. current_limit/supply_voltage gets updated
once the port partner accepts the request.

Fixes: f2a8aa053c176 ("typec: tcpm: Represent source supply through power_supply")
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Cc: stable <stable@vger.kernel.org>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Reviewed-by: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210407200723.1914388-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c