Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
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
27#include <zephyr/types.h>
28#include <zephyr/device.h>
29#include <errno.h>
30
31#include "usbc_tc.h"
32#include "usbc_pd.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif
37
81
99
120
121typedef int (*tcpc_vconn_control_cb_t)(const struct device *dev, enum tc_cc_polarity pol,
122 bool enable);
123typedef int (*tcpc_vconn_discharge_cb_t)(const struct device *dev, enum tc_cc_polarity pol,
124 bool enable);
125typedef void (*tcpc_alert_handler_cb_t)(const struct device *dev, void *data,
126 enum tcpc_alert alert);
127
128__subsystem struct tcpc_driver_api {
129 int (*init)(const struct device *dev);
130 int (*get_cc)(const struct device *dev, enum tc_cc_voltage_state *cc1,
131 enum tc_cc_voltage_state *cc2);
132 int (*select_rp_value)(const struct device *dev, enum tc_rp_value rp);
133 int (*get_rp_value)(const struct device *dev, enum tc_rp_value *rp);
134 int (*set_cc)(const struct device *dev, enum tc_cc_pull pull);
136 void (*set_vconn_cb)(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb);
137 int (*vconn_discharge)(const struct device *dev, bool enable);
138 int (*set_vconn)(const struct device *dev, bool enable);
139 int (*set_roles)(const struct device *dev, enum tc_power_role power_role,
140 enum tc_data_role data_role);
141 int (*get_rx_pending_msg)(const struct device *dev, struct pd_msg *msg);
142 int (*set_rx_enable)(const struct device *dev, bool enable);
143 int (*set_cc_polarity)(const struct device *dev, enum tc_cc_polarity polarity);
144 int (*transmit_data)(const struct device *dev, struct pd_msg *msg);
145 int (*dump_std_reg)(const struct device *dev);
146 void (*alert_handler_cb)(const struct device *dev, void *data, enum tcpc_alert alert);
147 int (*get_status_register)(const struct device *dev, enum tcpc_status_reg reg,
148 uint32_t *status);
149 int (*clear_status_register)(const struct device *dev, enum tcpc_status_reg reg,
150 uint32_t mask);
151 int (*mask_status_register)(const struct device *dev, enum tcpc_status_reg reg,
152 uint32_t mask);
153 int (*set_debug_accessory)(const struct device *dev, bool enable);
154 int (*set_debug_detach)(const struct device *dev);
155 int (*set_drp_toggle)(const struct device *dev, bool enable);
156 int (*get_snk_ctrl)(const struct device *dev);
157 int (*set_snk_ctrl)(const struct device *dev, bool enable);
158 int (*get_src_ctrl)(const struct device *dev);
159 int (*set_src_ctrl)(const struct device *dev, bool enable);
160 int (*get_chip_info)(const struct device *dev, struct tcpc_chip_info *chip_info);
161 int (*set_low_power_mode)(const struct device *dev, bool enable);
162 int (*sop_prime_enable)(const struct device *dev, bool enable);
163 int (*set_bist_test_mode)(const struct device *dev, bool enable);
164 int (*set_alert_handler_cb)(const struct device *dev, tcpc_alert_handler_cb_t handler,
165 void *data);
166};
167
171static inline int tcpc_is_cc_rp(enum tc_cc_voltage_state cc)
172{
173 return (cc == TC_CC_VOLT_RP_DEF) || (cc == TC_CC_VOLT_RP_1A5) || (cc == TC_CC_VOLT_RP_3A0);
174}
175
179static inline int tcpc_is_cc_open(enum tc_cc_voltage_state cc1, enum tc_cc_voltage_state cc2)
180{
181 return (cc1 < TC_CC_VOLT_RD) && (cc2 < TC_CC_VOLT_RD);
182}
183
188{
189 return cc1 == TC_CC_VOLT_RD && cc2 == TC_CC_VOLT_RD;
190}
191
196{
197 return tcpc_is_cc_rp(cc1) && tcpc_is_cc_rp(cc2);
198}
199
204{
205 return cc1 == TC_CC_VOLT_RA && cc2 == TC_CC_VOLT_RA;
206}
207
212 enum tc_cc_voltage_state cc2)
213{
214 return cc1 == TC_CC_VOLT_RD || cc2 == TC_CC_VOLT_RD;
215}
216
221{
222 return tcpc_is_cc_at_least_one_rd(cc1, cc2) && cc1 != cc2;
223}
224
234static inline int tcpc_init(const struct device *dev)
235{
236 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
237
238 __ASSERT(api->init != NULL, "Callback pointer should not be NULL");
239
240 return api->init(dev);
241}
242
254static inline int tcpc_get_cc(const struct device *dev, enum tc_cc_voltage_state *cc1,
255 enum tc_cc_voltage_state *cc2)
256{
257 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
258
259 if (api->get_cc == NULL) {
260 return -ENOSYS;
261 }
262
263 return api->get_cc(dev, cc1, cc2);
264}
265
276static inline int tcpc_select_rp_value(const struct device *dev, enum tc_rp_value rp)
277{
278 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
279
280 if (api->select_rp_value == NULL) {
281 return -ENOSYS;
282 }
283
284 return api->select_rp_value(dev, rp);
285}
286
297static inline int tcpc_get_rp_value(const struct device *dev, enum tc_rp_value *rp)
298{
299 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
300
301 if (api->get_rp_value == NULL) {
302 return -ENOSYS;
303 }
304
305 return api->get_rp_value(dev, rp);
306}
307
317static inline int tcpc_set_cc(const struct device *dev, enum tc_cc_pull pull)
318{
319 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
320
321 __ASSERT(api->set_cc != NULL, "Callback pointer should not be NULL");
322
323 return api->set_cc(dev, pull);
324}
325
336static inline void tcpc_set_vconn_cb(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb)
337{
338 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
339
340 __ASSERT(api->set_vconn_cb != NULL, "Callback pointer should not be NULL");
341
342 api->set_vconn_cb(dev, vconn_cb);
343}
344
355static inline void tcpc_set_vconn_discharge_cb(const struct device *dev,
357{
358 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
359
360 __ASSERT(api->set_vconn_discharge_cb != NULL, "Callback pointer should not be NULL");
361
362 api->set_vconn_discharge_cb(dev, cb);
363}
364
378static inline int tcpc_vconn_discharge(const struct device *dev, bool enable)
379{
380 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
381
382 if (api->vconn_discharge == NULL) {
383 return -ENOSYS;
384 }
385
386 return api->vconn_discharge(dev, enable);
387}
388
402static inline int tcpc_set_vconn(const struct device *dev, bool enable)
403{
404 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
405
406 if (api->set_vconn == NULL) {
407 return -ENOSYS;
408 }
409
410 return api->set_vconn(dev, enable);
411}
412
426static inline int tcpc_set_roles(const struct device *dev, enum tc_power_role power_role,
427 enum tc_data_role data_role)
428{
429 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
430
431 if (api->set_roles == NULL) {
432 return -ENOSYS;
433 }
434
435 return api->set_roles(dev, power_role, data_role);
436}
437
451static inline int tcpc_get_rx_pending_msg(const struct device *dev, struct pd_msg *buf)
452{
453 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
454
455 __ASSERT(api->get_rx_pending_msg != NULL, "Callback pointer should not be NULL");
456
457 return api->get_rx_pending_msg(dev, buf);
458}
459
471static inline int tcpc_set_rx_enable(const struct device *dev, bool enable)
472{
473 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
474
475 if (api->set_rx_enable == NULL) {
476 return -ENOSYS;
477 }
478
479 return api->set_rx_enable(dev, enable);
480}
481
491static inline int tcpc_set_cc_polarity(const struct device *dev, enum tc_cc_polarity polarity)
492{
493 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
494
495 __ASSERT(api->set_cc_polarity != NULL, "Callback pointer should not be NULL");
496
497 return api->set_cc_polarity(dev, polarity);
498}
499
510static inline int tcpc_transmit_data(const struct device *dev, struct pd_msg *msg)
511{
512 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
513
514 if (api->transmit_data == NULL) {
515 return -ENOSYS;
516 }
517
518 return api->transmit_data(dev, msg);
519}
520
530static inline int tcpc_dump_std_reg(const struct device *dev)
531{
532 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
533
534 if (api->dump_std_reg == NULL) {
535 return -ENOSYS;
536 }
537
538 return api->dump_std_reg(dev);
539}
540
554static inline int tcpc_set_alert_handler_cb(const struct device *dev,
555 tcpc_alert_handler_cb_t handler, void *data)
556{
557 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
558
559 __ASSERT(api->set_alert_handler_cb != NULL, "Callback pointer should not be NULL");
560
561 return api->set_alert_handler_cb(dev, handler, data);
562}
563
575static inline int tcpc_get_status_register(const struct device *dev, enum tcpc_status_reg reg,
576 uint32_t *status)
577{
578 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
579
580 if (api->get_status_register == NULL) {
581 return -ENOSYS;
582 }
583
584 return api->get_status_register(dev, reg, status);
585}
586
599static inline int tcpc_clear_status_register(const struct device *dev, enum tcpc_status_reg reg,
600 uint32_t mask)
601{
602 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
603
604 if (api->clear_status_register == NULL) {
605 return -ENOSYS;
606 }
607
608 return api->clear_status_register(dev, reg, mask);
609}
610
623static inline int tcpc_mask_status_register(const struct device *dev, enum tcpc_status_reg reg,
624 uint32_t mask)
625{
626 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
627
628 if (api->mask_status_register == NULL) {
629 return -ENOSYS;
630 }
631
632 return api->mask_status_register(dev, reg, mask);
633}
634
645static inline int tcpc_set_debug_accessory(const struct device *dev, bool enable)
646{
647 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
648
649 if (api->set_debug_accessory == NULL) {
650 return -ENOSYS;
651 }
652
653 return api->set_debug_accessory(dev, enable);
654}
655
665static inline int tcpc_set_debug_detach(const struct device *dev)
666{
667 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
668
669 if (api->set_debug_detach == NULL) {
670 return -ENOSYS;
671 }
672
673 return api->set_debug_detach(dev);
674}
675
686static inline int tcpc_set_drp_toggle(const struct device *dev, bool enable)
687{
688 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
689
690 if (api->set_drp_toggle == NULL) {
691 return -ENOSYS;
692 }
693
694 return api->set_drp_toggle(dev, enable);
695}
696
706static inline int tcpc_get_snk_ctrl(const struct device *dev)
707{
708 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
709
710 if (api->get_snk_ctrl == NULL) {
711 return -ENOSYS;
712 }
713
714 return api->get_snk_ctrl(dev);
715}
716
725static inline int tcpc_set_snk_ctrl(const struct device *dev, bool enable)
726{
727 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
728
729 if (api->set_snk_ctrl == NULL) {
730 return -ENOSYS;
731 }
732
733 return api->set_snk_ctrl(dev, enable);
734}
735
745static inline int tcpc_get_src_ctrl(const struct device *dev)
746{
747 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
748
749 if (api->get_src_ctrl == NULL) {
750 return -ENOSYS;
751 }
752
753 return api->get_src_ctrl(dev);
754}
755
764static inline int tcpc_set_src_ctrl(const struct device *dev, bool enable)
765{
766 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
767
768 if (api->set_src_ctrl == NULL) {
769 return -ENOSYS;
770 }
771
772 return api->set_src_ctrl(dev, enable);
773}
774
786static inline int tcpc_set_bist_test_mode(const struct device *dev, bool enable)
787{
788 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
789
790 if (api->set_bist_test_mode == NULL) {
791 return -ENOSYS;
792 }
793
794 return api->set_bist_test_mode(dev, enable);
795}
796
807static inline int tcpc_get_chip_info(const struct device *dev, struct tcpc_chip_info *chip_info)
808{
809 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
810
811 if (api->get_chip_info == NULL) {
812 return -ENOSYS;
813 }
814
815 return api->get_chip_info(dev, chip_info);
816}
817
828static inline int tcpc_set_low_power_mode(const struct device *dev, bool enable)
829{
830 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
831
832 if (api->set_low_power_mode == NULL) {
833 return -ENOSYS;
834 }
835
836 return api->set_low_power_mode(dev, enable);
837}
838
849static inline int tcpc_sop_prime_enable(const struct device *dev, bool enable)
850{
851 const struct tcpc_driver_api *api = (const struct tcpc_driver_api *)dev->api;
852
853 if (api->sop_prime_enable == NULL) {
854 return -ENOSYS;
855 }
856
857 return api->sop_prime_enable(dev, enable);
858}
859
864#ifdef __cplusplus
865}
866#endif
867
868#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:82
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:599
static int tcpc_set_debug_accessory(const struct device *dev, bool enable)
Manual control of TCPC DebugAccessory control.
Definition usbc_tcpc.h:645
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:195
static int tcpc_get_src_ctrl(const struct device *dev)
Queries the current sourcing state of the TCPC.
Definition usbc_tcpc.h:745
static int tcpc_get_snk_ctrl(const struct device *dev)
Queries the current sinking state of the TCPC.
Definition usbc_tcpc.h:706
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:623
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:179
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:402
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:297
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:451
static int tcpc_vconn_discharge(const struct device *dev, bool enable)
Discharges VCONN.
Definition usbc_tcpc.h:378
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:276
int(* tcpc_vconn_discharge_cb_t)(const struct device *dev, enum tc_cc_polarity pol, bool enable)
Definition usbc_tcpc.h:123
tcpc_alert
TCPC Alert bits.
Definition usbc_tcpc.h:41
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:491
void(* tcpc_alert_handler_cb_t)(const struct device *dev, void *data, enum tcpc_alert alert)
Definition usbc_tcpc.h:125
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:254
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:171
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:554
static int tcpc_set_snk_ctrl(const struct device *dev, bool enable)
Set the VBUS sinking state of the TCPC.
Definition usbc_tcpc.h:725
int(* tcpc_vconn_control_cb_t)(const struct device *dev, enum tc_cc_polarity pol, bool enable)
Definition usbc_tcpc.h:121
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:807
static int tcpc_transmit_data(const struct device *dev, struct pd_msg *msg)
Transmits a Power Delivery message.
Definition usbc_tcpc.h:510
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:426
static int tcpc_set_src_ctrl(const struct device *dev, bool enable)
Set the VBUS sourcing state of the TCPC.
Definition usbc_tcpc.h:764
static int tcpc_set_rx_enable(const struct device *dev, bool enable)
Enables the reception of SOP* message types.
Definition usbc_tcpc.h:471
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:220
static int tcpc_dump_std_reg(const struct device *dev)
Dump a set of TCPC registers.
Definition usbc_tcpc.h:530
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:828
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:355
static int tcpc_set_drp_toggle(const struct device *dev, bool enable)
Enable TCPC auto dual role toggle.
Definition usbc_tcpc.h:686
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:187
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:336
static int tcpc_set_debug_detach(const struct device *dev)
Detach from a debug connection.
Definition usbc_tcpc.h:665
static int tcpc_sop_prime_enable(const struct device *dev, bool enable)
Enables the reception of SOP Prime messages.
Definition usbc_tcpc.h:849
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:211
static int tcpc_init(const struct device *dev)
Initializes the TCPC.
Definition usbc_tcpc.h:234
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:317
static int tcpc_set_bist_test_mode(const struct device *dev, bool enable)
Controls the BIST Mode of the TCPC.
Definition usbc_tcpc.h:786
static int tcpc_get_status_register(const struct device *dev, enum tcpc_status_reg reg, uint32_t *status)
Gets a status register.
Definition usbc_tcpc.h:575
tcpc_status_reg
TCPC Status register.
Definition usbc_tcpc.h:85
@ TCPC_ALERT_EXTENDED_STATUS
Extended status changed.
Definition usbc_tcpc.h:72
@ TCPC_ALERT_TRANSMIT_MSG_DISCARDED
Reset or SOP* message transmission not sent due to an incoming receive message.
Definition usbc_tcpc.h:56
@ TCPC_ALERT_CC_STATUS
CC status changed.
Definition usbc_tcpc.h:43
@ TCPC_ALERT_EXTENDED
An extended interrupt event has occurred.
Definition usbc_tcpc.h:77
@ TCPC_ALERT_BEGINNING_MSG_STATUS
Receive buffer register changed.
Definition usbc_tcpc.h:70
@ TCPC_ALERT_MSG_STATUS
Receive Buffer register changed.
Definition usbc_tcpc.h:47
@ TCPC_ALERT_HARD_RESET_RECEIVED
Received Hard Reset message.
Definition usbc_tcpc.h:49
@ TCPC_ALERT_TRANSMIT_MSG_SUCCESS
Reset or SOP* message transmission successful.
Definition usbc_tcpc.h:58
@ TCPC_ALERT_VBUS_ALARM_HI
A high-voltage alarm has occurred.
Definition usbc_tcpc.h:60
@ TCPC_ALERT_VBUS_SNK_DISCONNECT
The TCPC in Attached.SNK state has detected a sink disconnect.
Definition usbc_tcpc.h:68
@ TCPC_ALERT_POWER_STATUS
Power status changed.
Definition usbc_tcpc.h:45
@ TCPC_ALERT_VBUS_ALARM_LO
A low-voltage alarm has occurred.
Definition usbc_tcpc.h:62
@ TCPC_ALERT_VENDOR_DEFINED
A vendor defined alert has been detected.
Definition usbc_tcpc.h:79
@ TCPC_ALERT_FAULT_STATUS
A fault has occurred.
Definition usbc_tcpc.h:64
@ TCPC_ALERT_TRANSMIT_MSG_FAILED
SOP* message transmission not successful.
Definition usbc_tcpc.h:51
@ TCPC_ALERT_RX_BUFFER_OVERFLOW
TCPC RX buffer has overflowed.
Definition usbc_tcpc.h:66
@ TCPC_FAULT_STATUS
The Fault Status register.
Definition usbc_tcpc.h:91
@ TCPC_VENDOR_DEFINED_STATUS
The Vendor Defined Status register.
Definition usbc_tcpc.h:97
@ TCPC_EXTENDED_ALERT_STATUS
The Extended Alert Status register.
Definition usbc_tcpc.h:95
@ TCPC_POWER_STATUS
The Power Status register.
Definition usbc_tcpc.h:89
@ TCPC_CC_STATUS
The CC Status register.
Definition usbc_tcpc.h:87
@ TCPC_EXTENDED_STATUS
The Extended Status register.
Definition usbc_tcpc.h:93
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
__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:411
void * data
Address of the device instance private data.
Definition device.h:421
const void * api
Address of the API structure exposed by the device instance.
Definition device.h:417
Power Delivery message.
Definition usbc_pd.h:1040
TCPC Chip Information.
Definition usbc_tcpc.h:103
uint16_t product_id
Product Id.
Definition usbc_tcpc.h:107
uint8_t min_req_fw_version_string[8]
Minimum Required firmware version string.
Definition usbc_tcpc.h:115
uint64_t fw_version_number
Firmware version number.
Definition usbc_tcpc.h:111
uint64_t min_req_fw_version_number
Minimum Required firmware version number.
Definition usbc_tcpc.h:117
uint16_t device_id
Device Id.
Definition usbc_tcpc.h:109
uint16_t vendor_id
Vendor Id.
Definition usbc_tcpc.h:105
Definition usbc_tcpc.h:128
int(* init)(const struct device *dev)
Definition usbc_tcpc.h:129
int(* vconn_discharge)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:137
int(* set_debug_accessory)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:153
int(* get_rx_pending_msg)(const struct device *dev, struct pd_msg *msg)
Definition usbc_tcpc.h:141
int(* dump_std_reg)(const struct device *dev)
Definition usbc_tcpc.h:145
int(* get_status_register)(const struct device *dev, enum tcpc_status_reg reg, uint32_t *status)
Definition usbc_tcpc.h:147
int(* select_rp_value)(const struct device *dev, enum tc_rp_value rp)
Definition usbc_tcpc.h:132
void(* alert_handler_cb)(const struct device *dev, void *data, enum tcpc_alert alert)
Definition usbc_tcpc.h:146
void(* set_vconn_discharge_cb)(const struct device *dev, tcpc_vconn_discharge_cb_t cb)
Definition usbc_tcpc.h:135
int(* set_snk_ctrl)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:157
int(* set_rx_enable)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:142
int(* set_cc)(const struct device *dev, enum tc_cc_pull pull)
Definition usbc_tcpc.h:134
int(* set_roles)(const struct device *dev, enum tc_power_role power_role, enum tc_data_role data_role)
Definition usbc_tcpc.h:139
int(* sop_prime_enable)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:162
int(* clear_status_register)(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)
Definition usbc_tcpc.h:149
int(* get_snk_ctrl)(const struct device *dev)
Definition usbc_tcpc.h:156
int(* get_src_ctrl)(const struct device *dev)
Definition usbc_tcpc.h:158
int(* set_vconn)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:138
int(* set_src_ctrl)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:159
int(* set_cc_polarity)(const struct device *dev, enum tc_cc_polarity polarity)
Definition usbc_tcpc.h:143
int(* get_chip_info)(const struct device *dev, struct tcpc_chip_info *chip_info)
Definition usbc_tcpc.h:160
int(* transmit_data)(const struct device *dev, struct pd_msg *msg)
Definition usbc_tcpc.h:144
int(* set_low_power_mode)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:161
int(* mask_status_register)(const struct device *dev, enum tcpc_status_reg reg, uint32_t mask)
Definition usbc_tcpc.h:151
int(* set_debug_detach)(const struct device *dev)
Definition usbc_tcpc.h:154
int(* get_rp_value)(const struct device *dev, enum tc_rp_value *rp)
Definition usbc_tcpc.h:133
void(* set_vconn_cb)(const struct device *dev, tcpc_vconn_control_cb_t vconn_cb)
Definition usbc_tcpc.h:136
int(* set_alert_handler_cb)(const struct device *dev, tcpc_alert_handler_cb_t handler, void *data)
Definition usbc_tcpc.h:164
int(* get_cc)(const struct device *dev, enum tc_cc_voltage_state *cc1, enum tc_cc_voltage_state *cc2)
Definition usbc_tcpc.h:130
int(* set_drp_toggle)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:155
int(* set_bist_test_mode)(const struct device *dev, bool enable)
Definition usbc_tcpc.h:163
USB-C Power Delivery API used for USB-C drivers.
USB Type-C Cable and Connector API used for USB-C drivers.