lkml.org 
[lkml]   [2022]   [Jul]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 2/3] usb: typec: tcpci: Add get cc tcpci callback
Date
From: Gene Chen <gene_chen@richtek.com>

Add set_vbus tcpci callback for vendor IC workaround.
According to different rp level detected, set corresponding
rx dead zone threshold in order to decode right pd message.

Signed-off-by: Gene Chen <gene_chen@richtek.com>
---
drivers/usb/typec/tcpm/tcpci.c | 3 +++
drivers/usb/typec/tcpm/tcpci.h | 2 ++
2 files changed, 5 insertions(+)

diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c
index f33e08eb7670..fc2f6191b7d3 100644
--- a/drivers/usb/typec/tcpm/tcpci.c
+++ b/drivers/usb/typec/tcpm/tcpci.c
@@ -243,6 +243,9 @@ static int tcpci_get_cc(struct tcpc_dev *tcpc,
unsigned int reg, role_control;
int ret;

+ if (tcpci->data->get_cc)
+ return tcpci->data->get_cc(tcpci, tcpci->data, cc1, cc2);
+
ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, &role_control);
if (ret < 0)
return ret;
diff --git a/drivers/usb/typec/tcpm/tcpci.h b/drivers/usb/typec/tcpm/tcpci.h
index b2edd45f13c6..2cef19e131f8 100644
--- a/drivers/usb/typec/tcpm/tcpci.h
+++ b/drivers/usb/typec/tcpm/tcpci.h
@@ -190,6 +190,8 @@ struct tcpci_data {
unsigned char vbus_vsafe0v:1;

int (*init)(struct tcpci *tcpci, struct tcpci_data *data);
+ int (*get_cc)(struct tcpci *tcpci, struct tcpci_data *data,
+ enum typec_cc_status *cc1, enum typec_cc_status *cc2);
int (*set_vconn)(struct tcpci *tcpci, struct tcpci_data *data,
bool enable);
int (*start_drp_toggling)(struct tcpci *tcpci, struct tcpci_data *data,
--
2.25.1
\
 
 \ /
  Last update: 2022-07-15 12:06    [W:0.082 / U:0.200 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site