File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,22 @@ static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)
268
268
enable ? TCPC_POWER_CTRL_VCONN_ENABLE : 0 );
269
269
}
270
270
271
+ static int tcpci_enable_frs (struct tcpc_dev * dev , bool enable )
272
+ {
273
+ struct tcpci * tcpci = tcpc_to_tcpci (dev );
274
+ int ret ;
275
+
276
+ /* To prevent disconnect during FRS, set disconnect threshold to 3.5V */
277
+ ret = tcpci_write16 (tcpci , TCPC_VBUS_SINK_DISCONNECT_THRESH , enable ? 0 : 0x8c );
278
+ if (ret < 0 )
279
+ return ret ;
280
+
281
+ ret = regmap_update_bits (tcpci -> regmap , TCPC_POWER_CTRL , TCPC_FAST_ROLE_SWAP_EN , enable ?
282
+ TCPC_FAST_ROLE_SWAP_EN : 0 );
283
+
284
+ return ret ;
285
+ }
286
+
271
287
static int tcpci_set_bist_data (struct tcpc_dev * tcpc , bool enable )
272
288
{
273
289
struct tcpci * tcpci = tcpc_to_tcpci (tcpc );
@@ -611,6 +627,7 @@ struct tcpci *tcpci_register_port(struct device *dev, struct tcpci_data *data)
611
627
tcpci -> tcpc .set_roles = tcpci_set_roles ;
612
628
tcpci -> tcpc .pd_transmit = tcpci_pd_transmit ;
613
629
tcpci -> tcpc .set_bist_data = tcpci_set_bist_data ;
630
+ tcpci -> tcpc .enable_frs = tcpci_enable_frs ;
614
631
615
632
err = tcpci_parse_config (tcpci );
616
633
if (err < 0 )
Original file line number Diff line number Diff line change 16
16
#define TCPC_PD_INT_REV 0xa
17
17
18
18
#define TCPC_ALERT 0x10
19
+ #define TCPC_ALERT_EXTND BIT(14)
19
20
#define TCPC_ALERT_EXTENDED_STATUS BIT(13)
20
21
#define TCPC_ALERT_VBUS_DISCNCT BIT(11)
21
22
#define TCPC_ALERT_RX_BUF_OVF BIT(10)
37
38
#define TCPC_EXTENDED_STATUS_MASK 0x16
38
39
#define TCPC_EXTENDED_STATUS_MASK_VSAFE0V BIT(0)
39
40
41
+ #define TCPC_ALERT_EXTENDED_MASK 0x17
42
+ #define TCPC_SINK_FAST_ROLE_SWAP BIT(0)
43
+
40
44
#define TCPC_CONFIG_STD_OUTPUT 0x18
41
45
42
46
#define TCPC_TCPC_CTRL 0x19
63
67
64
68
#define TCPC_POWER_CTRL 0x1c
65
69
#define TCPC_POWER_CTRL_VCONN_ENABLE BIT(0)
70
+ #define TCPC_FAST_ROLE_SWAP_EN BIT(7)
66
71
67
72
#define TCPC_CC_STATUS 0x1d
68
73
#define TCPC_CC_STATUS_TOGGLING BIT(5)
74
79
75
80
#define TCPC_POWER_STATUS 0x1e
76
81
#define TCPC_POWER_STATUS_UNINIT BIT(6)
82
+ #define TCPC_POWER_STATUS_SOURCING_VBUS BIT(4)
77
83
#define TCPC_POWER_STATUS_VBUS_DET BIT(3)
78
84
#define TCPC_POWER_STATUS_VBUS_PRES BIT(2)
79
85
80
86
#define TCPC_FAULT_STATUS 0x1f
81
87
88
+ #define TCPC_ALERT_EXTENDED 0x21
89
+
82
90
#define TCPC_COMMAND 0x23
83
91
#define TCPC_CMD_WAKE_I2C 0x11
84
92
#define TCPC_CMD_DISABLE_VBUS_DETECT 0x22
You can’t perform that action at this time.
0 commit comments