Zephyr API Documentation  3.6.0
A Scalable Open Source RTOS
3.6.0
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
usbc_tcpc.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 The Chromium OS Authors
3 * SPDX-License-Identifier: Apache-2.0
4 */
5
15#ifndef ZEPHYR_INCLUDE_DRIVERS_USBC_USBC_TCPC_H_
16#define ZEPHYR_INCLUDE_DRIVERS_USBC_USBC_TCPC_H_
17
25#include <zephyr/types.h>
26#include <zephyr/device.h>
27#include <errno.h>
28
29#include "usbc_tc.h"
30#include "usbc_pd.h"
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
78};
79
96};
97
110
111 union {
116 };
117};
118
119typedef int (*tcpc_vconn_control_cb_t)(const struct device *dev,
120 enum tc_cc_polarity pol, bool enable);
121typedef int (*tcpc_vconn_discharge_cb_t)(const struct device *dev,
122 enum tc_cc_polarity pol, bool enable);
123typedef void (*tcpc_alert_handler_cb_t)(const struct device *dev, void *data,
124 enum tcpc_alert alert);
125
126__subsystem struct tcpc_driver_api {
127 int (*init)(const struct device *dev);
128 int (*get_cc)(const struct device *dev, enum tc_cc_voltage_state *cc1,
129 enum tc_cc_voltage_state *cc2);
130 int (*select_rp_value)(const struct device *dev, enum tc_rp_value rp);
131 int (*get_rp_value)(const struct device *dev, enum tc_rp_value *rp);
132 int (*set_cc)(const struct device *dev, enum tc_cc_pull pull);
134 void (*set_vconn_cb)(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb);
135 int (*vconn_discharge)(const struct device *dev, bool enable);
136 int (*set_vconn)(const struct device *dev, bool enable);
137 int (*set_roles)(const struct device *dev, enum tc_power_role power_role,
138 enum tc_data_role data_role);
139 int (*get_rx_pending_msg)(const struct device *dev, struct pd_msg *msg);
140 int (*set_rx_enable)(const struct device *dev, bool enable);
141 int (*set_cc_polarity)(const struct device *dev, enum tc_cc_polarity polarity);
142 int (*transmit_data)(const struct device *dev, struct pd_msg *msg);
143 int (*dump_std_reg)(const struct device *dev);
144 void (*alert_handler_cb)(const struct device *dev, void *data, enum tcpc_alert alert);
145 int (*get_status_register)(const struct device *dev, enum tcpc_status_reg reg,
146 int32_t *status);
147 int (*clear_status_register)(const struct device *dev, enum tcpc_status_reg reg,
148 uint32_t mask);
149 int (*mask_status_register)(const struct device *dev, enum tcpc_status_reg reg,
150 uint32_t mask);
151 int (*set_debug_accessory)(const struct device *dev, bool enable);
152 int (*set_debug_detach)(const struct device *dev);
153 int (*set_drp_toggle)(const struct device *dev, bool enable);
154 int (*get_snk_ctrl)(const struct device *dev);
155 int (*get_src_ctrl)(const struct device *dev);
156 int (*get_chip_info)(const struct device *dev, struct tcpc_chip_info *chip_info);
157 int (*set_low_power_mode)(const struct device *dev, bool enable);
158 int (*sop_prime_enable)(const struct device *dev, bool enable);
159 int (*set_bist_test_mode)(const struct device *dev, bool enable);
160 int (*set_alert_handler_cb)(const struct device *dev, tcpc_alert_handler_cb_t handler,
161 void *data);
162};
163
167static inline int tcpc_is_cc_rp(enum tc_cc_voltage_state cc)
168{
169 return (cc == TC_CC_VOLT_RP_DEF) || (cc == TC_CC_VOLT_RP_1A5) ||
171}
172
176static inline int tcpc_is_cc_open(enum tc_cc_voltage_state cc1,
177 enum tc_cc_voltage_state cc2)
178{
179 return (cc1 < TC_CC_VOLT_RD) && (cc2 < TC_CC_VOLT_RD);
180}
181
186 enum tc_cc_voltage_state cc2)
187{
188 return cc1 == TC_CC_VOLT_RD && cc2 == TC_CC_VOLT_RD;
189}
190
195 enum tc_cc_voltage_state cc2)
196{
197 return tcpc_is_cc_rp(cc1) && tcpc_is_cc_rp(cc2);
198}
199
203static inline int tcpc_is_cc_audio_acc(enum tc_cc_voltage_state cc1,
204 enum tc_cc_voltage_state cc2)
205{
206 return cc1 == TC_CC_VOLT_RA && cc2 == TC_CC_VOLT_RA;
207}
208
213 enum tc_cc_voltage_state cc2)
214{
215 return cc1 == TC_CC_VOLT_RD || cc2 == TC_CC_VOLT_RD;
216}
217
222 enum tc_cc_voltage_state cc2)
223{
224 return tcpc_is_cc_at_least_one_rd(cc1, cc2) && cc1 != cc2;
225}
226
236static inline int tcpc_init(const struct device *dev)
237{
238 const struct tcpc_driver_api *api =
239 (const struct tcpc_driver_api *)dev->api;
240
241 __ASSERT(api->init != NULL,
242 "Callback pointer should not be NULL");
243
244 return api->init(dev);
245}
246
258static inline int tcpc_get_cc(const struct device *dev,
259 enum tc_cc_voltage_state *cc1,
260 enum tc_cc_voltage_state *cc2)
261{
262 const struct tcpc_driver_api *api =
263 (const struct tcpc_driver_api *)dev->api;
264
265 if (api->get_cc == NULL) {
266 return -ENOSYS;
267 }
268
269 return api->get_cc(dev, cc1, cc2);
270}
271
282static inline int tcpc_select_rp_value(const struct device *dev, enum tc_rp_value rp)
283{
284 const struct tcpc_driver_api *api =
285 (const struct tcpc_driver_api *)dev->api;
286
287 if (api->select_rp_value == NULL) {
288 return -ENOSYS;
289 }
290
291 return api->select_rp_value(dev, rp);
292}
293
304static inline int tcpc_get_rp_value(const struct device *dev, enum tc_rp_value *rp)
305{
306 const struct tcpc_driver_api *api =
307 (const struct tcpc_driver_api *)dev->api;
308
309 if (api->get_rp_value == NULL) {
310 return -ENOSYS;
311 }
312
313 return api->get_rp_value(dev, rp);
314}
315
325static inline int tcpc_set_cc(const struct device *dev, enum tc_cc_pull pull)
326{
327 const struct tcpc_driver_api *api =
328 (const struct tcpc_driver_api *)dev->api;
329
330 __ASSERT(api->set_cc != NULL,
331 "Callback pointer should not be NULL");
332
333 return api->set_cc(dev, pull);
334}
335
346static inline void tcpc_set_vconn_cb(const struct device *dev,
348{
349 const struct tcpc_driver_api *api =
350 (const struct tcpc_driver_api *)dev->api;
351
352 __ASSERT(api->set_vconn_cb != NULL,
353 "Callback pointer should not be NULL");
354
355 return api->set_vconn_cb(dev, vconn_cb);
356}
357
368static inline void tcpc_set_vconn_discharge_cb(const struct device *dev,
370{
371 const struct tcpc_driver_api *api =
372 (const struct tcpc_driver_api *)dev->api;
373
374 __ASSERT(api->set_vconn_discharge_cb != NULL,
375 "Callback pointer should not be NULL");
376
377 return api->set_vconn_discharge_cb(dev, cb);
378}
379
393static inline int tcpc_vconn_discharge(const struct device *dev, bool enable)
394{
395 const struct tcpc_driver_api *api =
396 (const struct tcpc_driver_api *)dev->api;
397
398 if (api->vconn_discharge == NULL) {
399 return -ENOSYS;
400 }
401
402 return api->vconn_discharge(dev, enable);
403}
404
418static inline int tcpc_set_vconn(const struct device *dev, bool enable)
419{
420 const struct tcpc_driver_api *api =
421 (const struct tcpc_driver_api *)dev->api;
422
423 if (api->set_vconn == NULL) {
424 return -ENOSYS;
425 }
426
427 return api->set_vconn(dev, enable);
428}
429
443static inline int tcpc_set_roles(const struct device *dev,
444 enum tc_power_role power_role,
445 enum tc_data_role data_role)
446{
447 const struct tcpc_driver_api *api =
448 (const struct tcpc_driver_api *)dev->api;
449
450 if (api->set_roles == NULL) {
451 return -ENOSYS;
452 }
453
454 return api->set_roles(dev, power_role, data_role);
455}
456
470static inline int tcpc_get_rx_pending_msg(const struct device *dev, struct pd_msg *buf)
471{
472 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
473
474 __ASSERT(api->get_rx_pending_msg != NULL, "Callback pointer should not be NULL");
475
476 return api->get_rx_pending_msg(dev, buf);
477}
478
490static inline int tcpc_set_rx_enable(const struct device *dev, bool enable)
491{
492 const struct tcpc_driver_api *api =
493 (const struct tcpc_driver_api *)dev->api;
494
495 if (api->set_rx_enable == NULL) {
496 return -ENOSYS;
497 }
498
499 return api->set_rx_enable(dev, enable);
500}
501
511static inline int tcpc_set_cc_polarity(const struct device *dev,
512 enum tc_cc_polarity polarity)
513{
514 const struct tcpc_driver_api *api =
515 (const struct tcpc_driver_api *)dev->api;
516
517 __ASSERT(api->set_cc_polarity != NULL,
518 "Callback pointer should not be NULL");
519
520 return api->set_cc_polarity(dev, polarity);
521}
522
533static inline int tcpc_transmit_data(const struct device *dev,
534 struct pd_msg *msg)
535{
536 const struct tcpc_driver_api *api =
537 (const struct tcpc_driver_api *)dev->api;
538
539 if (api->transmit_data == NULL) {
540 return -ENOSYS;
541 }
542
543 return api->transmit_data(dev, msg);
544}
545
555static inline int tcpc_dump_std_reg(const struct device *dev)
556{
557 const struct tcpc_driver_api *api =
558 (const struct tcpc_driver_api *)dev->api;
559
560 if (api->dump_std_reg == NULL) {
561 return -ENOSYS;
562 }
563
564 return api->dump_std_reg(dev);
565}
566
580static inline int tcpc_set_alert_handler_cb(const struct device *dev,
582 void *data)
583{
584 const struct tcpc_driver_api *api =
585 (const struct tcpc_driver_api *)dev->api;
586
587 __ASSERT(api->set_alert_handler_cb != NULL,
588 "Callback pointer should not be NULL");
589
590 return api->set_alert_handler_cb(dev, handler, data);
591}
592
604static inline int tcpc_get_status_register(const struct device *dev,
605 enum tcpc_status_reg reg,
606 int32_t *status)
607{
608 const struct tcpc_driver_api *api =
609 (const struct tcpc_driver_api *)dev->api;
610
611 if (api->get_status_register == NULL) {
612 return -ENOSYS;
613 }
614
615 return api->get_status_register(dev, reg, status);
616}
617
630static inline int tcpc_clear_status_register(const struct device *dev,
631 enum tcpc_status_reg reg,
632 uint32_t mask)
633{
634 const struct tcpc_driver_api *api =
635 (const struct tcpc_driver_api *)dev->api;
636
637 if (api->clear_status_register == NULL) {
638 return -ENOSYS;
639 }
640
641 return api->clear_status_register(dev, reg, mask);
642}
643
656static inline int tcpc_mask_status_register(const struct device *dev,
657 enum tcpc_status_reg reg,
658 uint32_t mask)
659{
660 const struct tcpc_driver_api *api =
661 (const struct tcpc_driver_api *)dev->api;
662
663 if (api->mask_status_register == NULL) {
664 return -ENOSYS;
665 }
666
667 return api->mask_status_register(dev, reg, mask);
668}
669
680static inline int tcpc_set_debug_accessory(const struct device *dev,
681 bool enable)
682{
683 const struct tcpc_driver_api *api =
684 (const struct tcpc_driver_api *)dev->api;
685
686 if (api->set_debug_accessory == NULL) {
687 return -ENOSYS;
688 }
689
690 return api->set_debug_accessory(dev, enable);
691}
692
702static inline int tcpc_set_debug_detach(const struct device *dev)
703{
704 const struct tcpc_driver_api *api =
705 (const struct tcpc_driver_api *)dev->api;
706
707 if (api->set_debug_detach == NULL) {
708 return -ENOSYS;
709 }
710
711 return api->set_debug_detach(dev);
712}
713
724static inline int tcpc_set_drp_toggle(const struct device *dev, bool enable)
725{
726 const struct tcpc_driver_api *api =
727 (const struct tcpc_driver_api *)dev->api;
728
729 if (api->set_drp_toggle == NULL) {
730 return -ENOSYS;
731 }
732
733 return api->set_drp_toggle(dev, enable);
734}
735
745static inline int tcpc_get_snk_ctrl(const struct device *dev)
746{
747 const struct tcpc_driver_api *api =
748 (const struct tcpc_driver_api *)dev->api;
749
750 if (api->get_snk_ctrl == NULL) {
751 return -ENOSYS;
752 }
753
754 return api->get_snk_ctrl(dev);
755}
756
766static inline int tcpc_get_src_ctrl(const struct device *dev)
767{
768 const struct tcpc_driver_api *api =
769 (const struct tcpc_driver_api *)dev->api;
770
771 if (api->get_src_ctrl == NULL) {
772 return -ENOSYS;
773 }
774
775 return api->get_src_ctrl(dev);
776}
777
789static inline int tcpc_set_bist_test_mode(const struct device *dev,
790 bool enable)
791{
792 const struct tcpc_driver_api *api =
793 (const struct tcpc_driver_api *)dev->api;
794
795 if (api->set_bist_test_mode == NULL) {
796 return -ENOSYS;
797 }
798
799 return api->set_bist_test_mode(dev, enable);
800}
801
812static inline int tcpc_get_chip_info(const struct device *dev,
813 struct tcpc_chip_info *chip_info)
814{
815 const struct tcpc_driver_api *api =
816 (const struct tcpc_driver_api *)dev->api;
817
818 if (api->get_chip_info == NULL) {
819 return -ENOSYS;
820 }
821
822 return api->get_chip_info(dev, chip_info);
823}
824
835static inline int tcpc_set_low_power_mode(const struct device *dev,
836 bool enable)
837{
838 const struct tcpc_driver_api *api =
839 (const struct tcpc_driver_api *)dev->api;
840
841 if (api->set_low_power_mode == NULL) {
842 return -ENOSYS;
843 }
844
845 return api->set_low_power_mode(dev, enable);
846}
847
858static inline int tcpc_sop_prime_enable(const struct device *dev,
859 bool enable)
860{
861 const struct tcpc_driver_api *api =
862 (const struct tcpc_driver_api *)dev->api;
863
864 if (api->sop_prime_enable == NULL) {
865 return -ENOSYS;
866 }
867
868 return api->sop_prime_enable(dev, enable);
869}
870
875#ifdef __cplusplus
876}
877#endif
878
879#endif /* ZEPHYR_INCLUDE_DRIVERS_USBC_USBC_TCPC_H_ */
irp cc
Definition: asm-macro-32-bit-gnu.h:10
System error numbers.
#define ENOSYS
Function not implemented.
Definition: errno.h:83
static int tcpc_clear_status_register(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)
Clears a TCPC status register.
Definition: usbc_tcpc.h:630
static int tcpc_set_debug_accessory(const struct device *dev, bool enable)
Manual control of TCPC DebugAccessory control.
Definition: usbc_tcpc.h:680
static int tcpc_is_cc_src_dbg_acc(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
Returns true if we detect the port partner is a src debug accessory.
Definition: usbc_tcpc.h:194
static int tcpc_get_src_ctrl(const struct device *dev)
Queries the current sourcing state of the TCPC.
Definition: usbc_tcpc.h:766
static int tcpc_get_snk_ctrl(const struct device *dev)
Queries the current sinking state of the TCPC.
Definition: usbc_tcpc.h:745
static int tcpc_mask_status_register(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)
Sets the mask of a TCPC status register.
Definition: usbc_tcpc.h:656
static int tcpc_is_cc_open(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
Returns true if both CC lines are completely open.
Definition: usbc_tcpc.h:176
static int tcpc_is_cc_audio_acc(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
Returns true if the port partner is an audio accessory.
Definition: usbc_tcpc.h:203
static int tcpc_set_vconn(const struct device *dev, bool enable)
Enables or disables VCONN.
Definition: usbc_tcpc.h:418
static int tcpc_get_rp_value(const struct device *dev, enum tc_rp_value *rp)
Gets the value of the CC pull up resistor used when operating as a Source.
Definition: usbc_tcpc.h:304
static int tcpc_get_rx_pending_msg(const struct device *dev, struct pd_msg *buf)
Retrieves the Power Delivery message from the TCPC.
Definition: usbc_tcpc.h:470
static int tcpc_vconn_discharge(const struct device *dev, bool enable)
Discharges VCONN.
Definition: usbc_tcpc.h:393
static int tcpc_select_rp_value(const struct device *dev, enum tc_rp_value rp)
Sets the value of CC pull up resistor used when operating as a Source.
Definition: usbc_tcpc.h:282
static int tcpc_get_status_register(const struct device *dev, enum tcpc_status_reg reg, int32_t *status)
Gets a status register.
Definition: usbc_tcpc.h:604
int(* tcpc_vconn_discharge_cb_t)(const struct device *dev, enum tc_cc_polarity pol, bool enable)
Definition: usbc_tcpc.h:121
tcpc_alert
TCPC Alert bits.
Definition: usbc_tcpc.h:39
static int tcpc_set_cc_polarity(const struct device *dev, enum tc_cc_polarity polarity)
Sets the polarity of the CC lines.
Definition: usbc_tcpc.h:511
void(* tcpc_alert_handler_cb_t)(const struct device *dev, void *data, enum tcpc_alert alert)
Definition: usbc_tcpc.h:123
static int tcpc_get_cc(const struct device *dev, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2)
Reads the status of the CC lines.
Definition: usbc_tcpc.h:258
static int tcpc_is_cc_rp(enum tc_cc_voltage_state cc)
Returns whether the sink has detected a Rp resistor on the other side.
Definition: usbc_tcpc.h:167
static int tcpc_set_alert_handler_cb(const struct device *dev, tcpc_alert_handler_cb_t handler, void *data)
Sets the alert function that's called when an interrupt is triggered due to an alert bit.
Definition: usbc_tcpc.h:580
int(* tcpc_vconn_control_cb_t)(const struct device *dev, enum tc_cc_polarity pol, bool enable)
Definition: usbc_tcpc.h:119
static int tcpc_get_chip_info(const struct device *dev, struct tcpc_chip_info *chip_info)
Gets the TCPC firmware version.
Definition: usbc_tcpc.h:812
static int tcpc_transmit_data(const struct device *dev, struct pd_msg *msg)
Transmits a Power Delivery message.
Definition: usbc_tcpc.h:533
static int tcpc_set_roles(const struct device *dev, enum tc_power_role power_role, enum tc_data_role data_role)
Sets the Power and Data Role of the PD message header.
Definition: usbc_tcpc.h:443
static int tcpc_set_rx_enable(const struct device *dev, bool enable)
Enables the reception of SOP* message types.
Definition: usbc_tcpc.h:490
static int tcpc_is_cc_only_one_rd(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
Returns true if the port partner is presenting Rd on only one CC line.
Definition: usbc_tcpc.h:221
static int tcpc_dump_std_reg(const struct device *dev)
Dump a set of TCPC registers.
Definition: usbc_tcpc.h:555
static int tcpc_set_low_power_mode(const struct device *dev, bool enable)
Instructs the TCPC to enter or exit low power mode.
Definition: usbc_tcpc.h:835
static void tcpc_set_vconn_discharge_cb(const struct device *dev, tcpc_vconn_discharge_cb_t cb)
Sets a callback that can enable or discharge VCONN if the TCPC is unable to or the system is configur...
Definition: usbc_tcpc.h:368
static int tcpc_set_drp_toggle(const struct device *dev, bool enable)
Enable TCPC auto dual role toggle.
Definition: usbc_tcpc.h:724
static int tcpc_is_cc_snk_dbg_acc(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
Returns true if we detect the port partner is a snk debug accessory.
Definition: usbc_tcpc.h:185
static void tcpc_set_vconn_cb(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb)
Sets a callback that can enable or disable VCONN if the TCPC is unable to or the system is configured...
Definition: usbc_tcpc.h:346
static int tcpc_set_debug_detach(const struct device *dev)
Detach from a debug connection.
Definition: usbc_tcpc.h:702
static int tcpc_sop_prime_enable(const struct device *dev, bool enable)
Enables the reception of SOP Prime messages.
Definition: usbc_tcpc.h:858
static int tcpc_is_cc_at_least_one_rd(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
Returns true if the port partner is presenting at least one Rd.
Definition: usbc_tcpc.h:212
static int tcpc_init(const struct device *dev)
Initializes the TCPC.
Definition: usbc_tcpc.h:236
static int tcpc_set_cc(const struct device *dev, enum tc_cc_pull pull)
Sets the CC pull resistor and sets the role as either Source or Sink.
Definition: usbc_tcpc.h:325
static int tcpc_set_bist_test_mode(const struct device *dev, bool enable)
Controls the BIST Mode of the TCPC.
Definition: usbc_tcpc.h:789
tcpc_status_reg
TCPC Status register.
Definition: usbc_tcpc.h:83
@ TCPC_ALERT_EXTENDED_STATUS
Extended status changed.
Definition: usbc_tcpc.h:70
@ TCPC_ALERT_TRANSMIT_MSG_DISCARDED
Reset or SOP* message transmission not sent due to an incoming receive message.
Definition: usbc_tcpc.h:54
@ TCPC_ALERT_CC_STATUS
CC status changed.
Definition: usbc_tcpc.h:41
@ TCPC_ALERT_EXTENDED
An extended interrupt event has occurred.
Definition: usbc_tcpc.h:75
@ TCPC_ALERT_BEGINNING_MSG_STATUS
Receive buffer register changed.
Definition: usbc_tcpc.h:68
@ TCPC_ALERT_MSG_STATUS
Receive Buffer register changed.
Definition: usbc_tcpc.h:45
@ TCPC_ALERT_HARD_RESET_RECEIVED
Received Hard Reset message.
Definition: usbc_tcpc.h:47
@ TCPC_ALERT_TRANSMIT_MSG_SUCCESS
Reset or SOP* message transmission successful.
Definition: usbc_tcpc.h:56
@ TCPC_ALERT_VBUS_ALARM_HI
A high-voltage alarm has occurred.
Definition: usbc_tcpc.h:58
@ TCPC_ALERT_VBUS_SNK_DISCONNECT
The TCPC in Attached.SNK state has detected a sink disconnect.
Definition: usbc_tcpc.h:66
@ TCPC_ALERT_POWER_STATUS
Power status changed.
Definition: usbc_tcpc.h:43
@ TCPC_ALERT_VBUS_ALARM_LO
A low-voltage alarm has occurred.
Definition: usbc_tcpc.h:60
@ TCPC_ALERT_VENDOR_DEFINED
A vendor defined alert has been detected.
Definition: usbc_tcpc.h:77
@ TCPC_ALERT_FAULT_STATUS
A fault has occurred.
Definition: usbc_tcpc.h:62
@ TCPC_ALERT_TRANSMIT_MSG_FAILED
SOP* message transmission not successful.
Definition: usbc_tcpc.h:49
@ TCPC_ALERT_RX_BUFFER_OVERFLOW
TCPC RX buffer has overflowed.
Definition: usbc_tcpc.h:64
@ TCPC_FAULT_STATUS
The Fault Status register.
Definition: usbc_tcpc.h:89
@ TCPC_VENDOR_DEFINED_STATUS
The Vendor Defined Status register.
Definition: usbc_tcpc.h:95
@ TCPC_EXTENDED_ALERT_STATUS
The Extended Alert Status register.
Definition: usbc_tcpc.h:93
@ TCPC_POWER_STATUS
The Power Status register.
Definition: usbc_tcpc.h:87
@ TCPC_CC_STATUS
The CC Status register.
Definition: usbc_tcpc.h:85
@ TCPC_EXTENDED_STATUS
The Extended Status register.
Definition: usbc_tcpc.h:91
tc_cc_pull
CC pull resistors.
Definition: usbc_tc.h:352
tc_rp_value
Pull-Up resistor values.
Definition: usbc_tc.h:338
tc_cc_voltage_state
CC Voltage status.
Definition: usbc_tc.h:308
tc_data_role
Power Delivery Data Role.
Definition: usbc_tc.h:389
tc_power_role
Power Delivery Power Role.
Definition: usbc_tc.h:379
tc_cc_polarity
Polarity of the CC lines.
Definition: usbc_tc.h:401
@ TC_CC_VOLT_RP_DEF
Port partner is applying Rp (0.5A)
Definition: usbc_tc.h:316
@ TC_CC_VOLT_RA
Port partner is applying Ra.
Definition: usbc_tc.h:312
@ TC_CC_VOLT_RD
Port partner is applying Rd.
Definition: usbc_tc.h:314
@ TC_CC_VOLT_RP_3A0
Port partner is applying Rp (3.0A)
Definition: usbc_tc.h:320
@ TC_CC_VOLT_RP_1A5
Definition: usbc_tc.h:318
__UINT32_TYPE__ uint32_t
Definition: stdint.h:90
__INT32_TYPE__ int32_t
Definition: stdint.h:74
__UINT64_TYPE__ uint64_t
Definition: stdint.h:91
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89
Runtime device structure (in ROM) per driver instance.
Definition: device.h:387
void * data
Address of the device instance private data.
Definition: device.h:397
const void * api
Address of the API structure exposed by the device instance.
Definition: device.h:393
Power Delivery message.
Definition: usbc_pd.h:1040
TCPC Chip Information.
Definition: usbc_tcpc.h:101
uint16_t product_id
Product Id.
Definition: usbc_tcpc.h:105
uint8_t min_req_fw_version_string[8]
Minimum Required firmware version string.
Definition: usbc_tcpc.h:113
uint64_t fw_version_number
Firmware version number.
Definition: usbc_tcpc.h:109
uint64_t min_req_fw_version_number
Minimum Required firmware version number.
Definition: usbc_tcpc.h:115
uint16_t device_id
Device Id.
Definition: usbc_tcpc.h:107
uint16_t vendor_id
Vendor Id.
Definition: usbc_tcpc.h:103
Definition: usbc_tcpc.h:126
int(* init)(const struct device *dev)
Definition: usbc_tcpc.h:127
int(* vconn_discharge)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:135
int(* set_debug_accessory)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:151
int(* get_rx_pending_msg)(const struct device *dev, struct pd_msg *msg)
Definition: usbc_tcpc.h:139
int(* dump_std_reg)(const struct device *dev)
Definition: usbc_tcpc.h:143
int(* select_rp_value)(const struct device *dev, enum tc_rp_value rp)
Definition: usbc_tcpc.h:130
void(* alert_handler_cb)(const struct device *dev, void *data, enum tcpc_alert alert)
Definition: usbc_tcpc.h:144
void(* set_vconn_discharge_cb)(const struct device *dev, tcpc_vconn_discharge_cb_t cb)
Definition: usbc_tcpc.h:133
int(* set_rx_enable)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:140
int(* set_cc)(const struct device *dev, enum tc_cc_pull pull)
Definition: usbc_tcpc.h:132
int(* set_roles)(const struct device *dev, enum tc_power_role power_role, enum tc_data_role data_role)
Definition: usbc_tcpc.h:137
int(* sop_prime_enable)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:158
int(* clear_status_register)(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)
Definition: usbc_tcpc.h:147
int(* get_snk_ctrl)(const struct device *dev)
Definition: usbc_tcpc.h:154
int(* get_src_ctrl)(const struct device *dev)
Definition: usbc_tcpc.h:155
int(* set_vconn)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:136
int(* set_cc_polarity)(const struct device *dev, enum tc_cc_polarity polarity)
Definition: usbc_tcpc.h:141
int(* get_chip_info)(const struct device *dev, struct tcpc_chip_info *chip_info)
Definition: usbc_tcpc.h:156
int(* get_status_register)(const struct device *dev, enum tcpc_status_reg reg, int32_t *status)
Definition: usbc_tcpc.h:145
int(* transmit_data)(const struct device *dev, struct pd_msg *msg)
Definition: usbc_tcpc.h:142
int(* set_low_power_mode)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:157
int(* mask_status_register)(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)
Definition: usbc_tcpc.h:149
int(* set_debug_detach)(const struct device *dev)
Definition: usbc_tcpc.h:152
int(* get_rp_value)(const struct device *dev, enum tc_rp_value *rp)
Definition: usbc_tcpc.h:131
void(* set_vconn_cb)(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb)
Definition: usbc_tcpc.h:134
int(* set_alert_handler_cb)(const struct device *dev, tcpc_alert_handler_cb_t handler, void *data)
Definition: usbc_tcpc.h:160
int(* get_cc)(const struct device *dev, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2)
Definition: usbc_tcpc.h:128
int(* set_drp_toggle)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:153
int(* set_bist_test_mode)(const struct device *dev, bool enable)
Definition: usbc_tcpc.h:159
USB-C Power Delivery API used for USB-C drivers.
USB Type-C Cable and Connector API used for USB-C drivers.