Skip to content

Commit d716f54

Browse files
ccli8nashif
authored andcommitted
drivers: usb_c: numaker: update UTCPD.VBSCALE register field
This follows update of UTCPD.VBSCALE register field. It supports: - "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. Signed-off-by: Chun-Chieh Li <[email protected]>
1 parent 9df88e6 commit d716f54

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

drivers/usb_c/tcpc/ucpd_numaker.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2374,21 +2374,17 @@ static const struct tcpc_driver_api numaker_tcpc_driver_api = {
23742374
: 0)
23752375

23762376
/* UTCPD.VBVOL.VBSCALE cast */
2377-
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst) NUMAKER_UTCPD_VBUS_DIVIDE_CAST_NO_DIVIDE(inst)
2378-
/* no_divide */
2379-
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_NO_DIVIDE(inst) \
2380-
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, no_divice), \
2381-
({.bit = (0 << UTCPD_VBVOL_VBSCALE_Pos), .value = 1}), \
2377+
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST(inst) NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst)
2378+
/* divide_20 */
2379+
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) \
2380+
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_20), \
2381+
({.bit = (0 << UTCPD_VBVOL_VBSCALE_Pos), .value = 20}), \
23822382
(NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_10(inst)))
23832383
/* divide_10 */
23842384
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_10(inst) \
23852385
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_10), \
23862386
({.bit = (1 << UTCPD_VBVOL_VBSCALE_Pos), .value = 10}), \
2387-
(NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst)))
2388-
/* divide_20 */
2389-
#define NUMAKER_UTCPD_VBUS_DIVIDE_CAST_DIVIDE_20(inst) \
2390-
COND_CODE_1(DT_ENUM_HAS_VALUE(DT_DRV_INST(inst), vbus_divide, divide_20), \
2391-
({.bit = (2 << UTCPD_VBVOL_VBSCALE_Pos), .value = 20}), (no_divide error))
2387+
(vbus-divide error))
23922388

23932389
/* UTCPD.PINPL */
23942390
#define NUMAKER_UTCPD_PINPL_INIT(inst) \

dts/bindings/tcpc/nuvoton,numaker-tcpc.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,16 @@ properties:
9696
type: string
9797
required: true
9898
description: |
99-
VBUS measurement divider
99+
VBUS measurement divider:
100+
"divide-20": External VBUS voltage divider circuit should be 1/20
101+
for EPR application. The divided voltage compares with
102+
200mV to set or clean VBUS Present bit.
103+
"divide-10": External VBUS voltage divider circuit should be 1/10
104+
for SPR application. The divided voltage compares with
105+
400mV to set or clean VBUS Present bit.
100106
enum:
101-
- "no-divide"
102-
- "divide-10"
103107
- "divide-20"
108+
- "divide-10"
104109

105110
dead-battery:
106111
type: boolean

0 commit comments

Comments
 (0)