Skip to content

Commit 198e040

Browse files
barnas-michalcarlescufi
authored andcommitted
usbc: add generic TCPCI related functions
Add generic functions that will be common to all TCPCI compliant drivers like registers reading, writing and updating. Signed-off-by: Michał Barnaś <[email protected]>
1 parent 1e15656 commit 198e040

File tree

5 files changed

+594
-0
lines changed

5 files changed

+594
-0
lines changed

drivers/usb_c/tcpc/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ zephyr_library()
55
zephyr_library_sources_ifdef(CONFIG_USBC_TCPC_SHELL shell.c)
66
zephyr_library_sources_ifdef(CONFIG_USBC_TCPC_STM32 ucpd_stm32.c)
77
zephyr_library_sources_ifdef(CONFIG_USBC_TCPC_NUMAKER ucpd_numaker.c)
8+
zephyr_library_sources_ifdef(CONFIG_USBC_TCPC_TCPCI tcpci.c)

drivers/usb_c/tcpc/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ config USBC_TCPC_SHELL
2727

2828
source "drivers/usb_c/tcpc/Kconfig.tcpc_stm32"
2929
source "drivers/usb_c/tcpc/Kconfig.tcpc_numaker"
30+
source "drivers/usb_c/tcpc/Kconfig.tcpc_tcpci"
3031

3132
module = USBC
3233
module-str = usbc

drivers/usb_c/tcpc/Kconfig.tcpc_tcpci

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# USB-C TCPCI-compliant devices configuration options
2+
3+
# Copyright 2024 Google LLC
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config USBC_TCPC_TCPCI
7+
bool
8+
select I2C
9+
help
10+
Enable support for Type-C Port Controller Interface.
11+
This symbol should be selected by TCPCI-compliant drivers to allow the use of generic
12+
TCPCI functions for registers operations.
13+
14+
if USBC_TCPC_TCPCI
15+
16+
config USBC_TCPC_TCPCI_I2C_RETRIES
17+
int "I2C communication retries"
18+
default 2
19+
help
20+
Number of I2C transaction tries that will be performed for each request.
21+
Some TCPCs are going into deep sleep mode when no charger is connected and won't respond
22+
to the i2c address immediately. If device won't respond after retries, it means that
23+
it is not responsible or is not connected.
24+
25+
endif

0 commit comments

Comments
 (0)