mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-15 01:01:56 -04:00
tcpc: add typeC mode switch interface
add typec mode switch interface this interface for only typeC and not support PD product. Change-Id: I5e5b352504e475a755561dc4875fea1b576417c1 Signed-off-by: chailu1 <chailu1@lenovo.com> Reviewed-on: https://gerrit.mot.com/2105408 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Huosheng Liao <liaohs@motorola.com> Submit-Approved: Jira Key
This commit is contained in:
parent
c8afdd7c14
commit
ea948fedb6
6 changed files with 40 additions and 1 deletions
|
|
@ -87,6 +87,7 @@ int tcpci_init_alert_mask(struct tcpc_device *tcpc);
|
|||
int tcpci_get_cc(struct tcpc_device *tcpc);
|
||||
int tcpci_set_cc(struct tcpc_device *tcpc, int pull);
|
||||
int tcpci_set_polarity(struct tcpc_device *tcpc, int polarity);
|
||||
int tcpci_set_port_type(struct tcpc_device *tcpc, int mode);
|
||||
int tcpci_set_low_rp_duty(struct tcpc_device *tcpc, bool low_rp);
|
||||
int tcpci_set_vconn(struct tcpc_device *tcpc, int enable);
|
||||
|
||||
|
|
|
|||
|
|
@ -214,7 +214,7 @@ struct tcpc_ops {
|
|||
int (*set_vconn)(struct tcpc_device *tcpc, int enable);
|
||||
int (*deinit)(struct tcpc_device *tcpc);
|
||||
int (*alert_vendor_defined_handler)(struct tcpc_device *tcpc);
|
||||
|
||||
int (*set_port_type)(struct tcpc_device *tcpc, int mode);
|
||||
#ifdef CONFIG_TCPC_VSAFE0V_DETECT_IC
|
||||
int (*is_vsafe0v)(struct tcpc_device *tcpc);
|
||||
#endif /* CONFIG_TCPC_VSAFE0V_DETECT_IC */
|
||||
|
|
|
|||
|
|
@ -874,6 +874,9 @@ extern int tcpm_typec_role_swap(
|
|||
extern int tcpm_typec_change_role(
|
||||
struct tcpc_device *tcpc, uint8_t typec_role);
|
||||
|
||||
extern int tcpm_typec_change_mode(
|
||||
struct tcpc_device *tcpc, uint8_t mode);
|
||||
|
||||
extern int tcpm_typec_change_role_postpone(
|
||||
struct tcpc_device *tcpc, uint8_t typec_role, bool postpone);
|
||||
|
||||
|
|
@ -1369,6 +1372,12 @@ static inline int tcpm_typec_change_role(
|
|||
return TCPM_ERROR_NO_IMPLEMENT;
|
||||
}
|
||||
|
||||
static inline int tcpm_typec_change_mode(
|
||||
struct tcpc_device *tcpc, uint8_t mode)
|
||||
{
|
||||
return TCPM_ERROR_NO_IMPLEMENT;
|
||||
}
|
||||
|
||||
static inline int tcpm_typec_change_role_postpone(
|
||||
struct tcpc_device *tcpc, uint8_t typec_role, bool postpone)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -770,6 +770,12 @@ static int tcpc_typec_port_type_set(const struct typec_capability *cap,
|
|||
dev_info(rpmd->dev, "%s type = %d, as_sink = %d\n",
|
||||
__func__, type, as_sink);
|
||||
|
||||
if (0 == tcpm_typec_change_mode(rpmd->tcpc, type)) {
|
||||
dev_info(rpmd->dev, "%s Only type C mode and not support PD\n",
|
||||
__func__);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case TYPEC_PORT_SNK:
|
||||
if (as_sink)
|
||||
|
|
|
|||
|
|
@ -268,6 +268,16 @@ int tcpci_set_polarity(struct tcpc_device *tcpc, int polarity)
|
|||
return tcpc->ops->set_polarity(tcpc, polarity);
|
||||
}
|
||||
|
||||
int tcpci_set_port_type(struct tcpc_device *tcpc, int mode)
|
||||
{
|
||||
if (tcpc->ops->set_port_type == NULL)
|
||||
return -ENOTSUPP;
|
||||
else
|
||||
tcpc->ops->set_port_type(tcpc, mode);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int tcpci_set_low_rp_duty(struct tcpc_device *tcpc, bool low_rp)
|
||||
{
|
||||
#ifdef CONFIG_TYPEC_CAP_LOW_RP_DUTY
|
||||
|
|
|
|||
|
|
@ -288,6 +288,19 @@ int tcpm_typec_role_swap(struct tcpc_device *tcpc)
|
|||
}
|
||||
EXPORT_SYMBOL(tcpm_typec_role_swap);
|
||||
|
||||
int tcpm_typec_change_mode(
|
||||
struct tcpc_device *tcpc, uint8_t mode)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
tcpci_lock_typec(tcpc);
|
||||
ret = tcpci_set_port_type(tcpc, mode);
|
||||
tcpci_unlock_typec(tcpc);
|
||||
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(tcpm_typec_change_mode);
|
||||
|
||||
int tcpm_typec_change_role(
|
||||
struct tcpc_device *tcpc, uint8_t typec_role)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue