Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: usb_c: numaker: update UTCPD.VBSCALE register field #79959

Merged
merged 1 commit into from
Nov 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions drivers/usb_c/tcpc/ucpd_numaker.c
Original file line number Diff line number Diff line change
Expand Up @@ -2374,21 +2374,17 @@ static const struct tcpc_driver_api numaker_tcpc_driver_api = {
: 0)

/* UTCPD.VBVOL.VBSCALE cast */
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst) NUMAKER_UTCPD_VBUS_DIVIDE_CAST_NO_DIVIDE(inst)
/* no_divide */
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_NO_DIVIDE(inst) \
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, no_divice), \
({.bit = (0 << UTCPD_VBVOL_VBSCALE_Pos), .value = 1}), \
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst) NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst)
/* divide_20 */
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) \
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_20), \
({.bit = (0 << UTCPD_VBVOL_VBSCALE_Pos), .value = 20}), \
(NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_10(inst)))
/* divide_10 */
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_10(inst) \
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_10), \
({.bit = (1 << UTCPD_VBVOL_VBSCALE_Pos), .value = 10}), \
(NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst)))
/* divide_20 */
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) \
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_20), \
({.bit = (2 << UTCPD_VBVOL_VBSCALE_Pos), .value = 20}), (no_divide error))
(vbus-divide error))

/* UTCPD.PINPL */
#define NUMAKER_UTCPD_PINPL_INIT(inst) \
Expand Down
11 changes: 8 additions & 3 deletions dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,16 @@ properties:
type: string
required: true
description: |
VBUS measurement divider
VBUS measurement divider:
"divide-20": External VBUS voltage divider circuit should be 1/20
for EPR application. The divided voltage compares with
200mV to set or clean VBUS Present bit.
"divide-10": External VBUS voltage divider circuit should be 1/10
for SPR application. The divided voltage compares with
400mV to set or clean VBUS Present bit.
enum:
- "no-divide"
- "divide-10"
- "divide-20"
- "divide-10"

dead-battery:
type: boolean
Expand Down
Loading