mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-27 12:25:08 +07:00
staging: typec: tcpm: Add get_current_limit tcpc_dev callback
A Rp signalling the default current limit indicates that we're possibly connected to an USB2 power-source. In some cases the type-c port-controller may provide the capability to detect the current-limit in this case, through e.g. BC1.2 detection. This commit adds an optional get_current_limit tcpc_dev callback which allows the port-controller to provide current-limit detection for when the CC pin is pulled up with Rp. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
26e59b3502
commit
ea62cfc71b
@ -685,7 +685,10 @@ static u32 tcpm_get_current_limit(struct tcpm_port *port)
|
|||||||
break;
|
break;
|
||||||
case TYPEC_CC_RP_DEF:
|
case TYPEC_CC_RP_DEF:
|
||||||
default:
|
default:
|
||||||
limit = 0;
|
if (port->tcpc->get_current_limit)
|
||||||
|
limit = port->tcpc->get_current_limit(port->tcpc);
|
||||||
|
else
|
||||||
|
limit = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,6 +109,13 @@ struct tcpc_dev {
|
|||||||
|
|
||||||
int (*init)(struct tcpc_dev *dev);
|
int (*init)(struct tcpc_dev *dev);
|
||||||
int (*get_vbus)(struct tcpc_dev *dev);
|
int (*get_vbus)(struct tcpc_dev *dev);
|
||||||
|
/*
|
||||||
|
* This optional callback gets called by the tcpm core when configured
|
||||||
|
* as a snk and cc=Rp-def. This allows the tcpm to provide a fallback
|
||||||
|
* current-limit detection method for the cc=Rp-def case. E.g. some
|
||||||
|
* tcpcs may include BC1.2 charger detection and use that in this case.
|
||||||
|
*/
|
||||||
|
int (*get_current_limit)(struct tcpc_dev *dev);
|
||||||
int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
|
int (*set_cc)(struct tcpc_dev *dev, enum typec_cc_status cc);
|
||||||
int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
|
int (*get_cc)(struct tcpc_dev *dev, enum typec_cc_status *cc1,
|
||||||
enum typec_cc_status *cc2);
|
enum typec_cc_status *cc2);
|
||||||
|
Loading…
Reference in New Issue
Block a user