Zephyr API Documentation
4.1.99
A Scalable Open Source RTOS
4.1.99
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerations
Enumerator
Files
File List
Globals
All
$
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Functions
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Variables
$
a
b
c
d
f
g
h
i
k
l
m
n
o
p
r
s
t
u
x
z
Typedefs
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Enumerations
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Enumerator
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
z
Macros
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
▼
Zephyr API Documentation
►
Introduction
Deprecated List
►
Topics
►
Data Structures
▼
Files
▼
File List
►
doc
►
kernel
►
lib
►
modules
►
subsys
▼
zephyr
►
acpi
►
app_memory
►
arch
►
audio
►
bluetooth
►
canbus
►
console
►
crypto
►
data
►
debug
►
devicetree
►
dfu
►
display
►
drivers
►
dsp
▼
dt-bindings
►
acpi
►
adc
►
battery
►
clock
►
comparator
►
dac
►
dai
►
display
►
dma
►
espi
►
ethernet
►
flash_controller
►
gnss
►
gpio
►
i2c
►
input
►
inputmux
►
interrupt-controller
►
ipc_service
►
led
►
lora
►
lvgl
►
memory-attr
►
memory-controller
►
mfd
►
mipi_dbi
►
mipi_dsi
►
misc
►
pcie
►
pinctrl
►
power
►
pwm
►
qspi
►
rdc
►
regulator
►
reserved-memory
►
reset
►
sensor
►
spi
►
timer
►
usb
▼
usb-c
►
nxp_nx20p3483.h
►
pd.h
►
video
dt-util.h
►
fs
►
input
►
internal
►
ipc
►
kernel
►
linker
►
llext
►
logging
►
lorawan
►
math
►
mem_mgmt
►
mgmt
►
misc
►
modbus
►
modem
►
multi_heap
►
net
►
platform
►
pm
►
pmci
►
portability
►
posix
►
psa
►
random
►
retention
►
rtio
►
sd
►
sensing
►
settings
►
shell
►
sip_svc
►
stats
►
storage
►
sys
►
task_wdt
►
timing
►
toolchain
►
tracing
►
usb
►
usb_c
►
virtio
►
xen
►
zbus
►
zvfs
►
bindesc.h
►
cache.h
►
device.h
►
devicetree.h
►
fatal.h
►
fatal_types.h
►
init.h
►
irq.h
►
irq_multilevel.h
►
irq_nextlevel.h
►
irq_offload.h
►
kernel.h
kernel_includes.h
►
kernel_structs.h
►
kernel_version.h
►
net_buf.h
►
shared_irq.h
►
smf.h
►
spinlock.h
►
sw_isr_table.h
►
sys_clock.h
►
syscall.h
►
toolchain.h
types.h
►
Globals
•
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
pd.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
* This is based on Linux, documentation:
6
* https://github.com/torvalds/linux/blob/v5.19/include/dt-bindings/usb/pd.h
7
*/
8
#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_USBC_PD_H_
9
#define ZEPHYR_INCLUDE_DT_BINDINGS_USBC_PD_H_
10
11
/* Power delivery Power Data Object definitions */
12
#define PDO_TYPE_FIXED 0
13
#define PDO_TYPE_BATT 1
14
#define PDO_TYPE_VAR 2
15
#define PDO_TYPE_APDO 3
16
17
#define PDO_TYPE_SHIFT 30
18
#define PDO_TYPE_MASK 0x3
19
20
#define PDO_TYPE(t) ((t) << PDO_TYPE_SHIFT)
21
22
#define PDO_VOLT_MASK 0x3ff
23
#define PDO_CURR_MASK 0x3ff
24
#define PDO_PWR_MASK 0x3ff
25
26
#define PDO_FIXED_DUAL_ROLE (1 << 29)
/* Power role swap supported */
27
#define PDO_FIXED_SUSPEND (1 << 28)
/* USB Suspend supported (Source) */
28
#define PDO_FIXED_HIGHER_CAP (1 << 28)
/* Requires more than vSafe5V (Sink) */
29
#define PDO_FIXED_EXTPOWER (1 << 27)
/* Externally powered */
30
#define PDO_FIXED_USB_COMM (1 << 26)
/* USB communications capable */
31
#define PDO_FIXED_DATA_SWAP (1 << 25)
/* Data role swap supported */
32
#define PDO_FIXED_VOLT_SHIFT 10
/* 50mV units */
33
#define PDO_FIXED_CURR_SHIFT 0
/* 10mA units */
34
35
#define PDO_FIXED_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_FIXED_VOLT_SHIFT)
36
#define PDO_FIXED_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_FIXED_CURR_SHIFT)
37
38
#define PDO_FIXED(mv, ma, flags) \
39
(PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \
40
PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma))
38
#define PDO_FIXED(mv, ma, flags) \
…
41
42
#define VSAFE5V 5000
/* mv units */
43
44
#define PDO_BATT_MAX_VOLT_SHIFT 20
/* 50mV units */
45
#define PDO_BATT_MIN_VOLT_SHIFT 10
/* 50mV units */
46
#define PDO_BATT_MAX_PWR_SHIFT 0
/* 250mW units */
47
48
#define PDO_BATT_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MIN_VOLT_SHIFT)
49
#define PDO_BATT_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MAX_VOLT_SHIFT)
50
#define PDO_BATT_MAX_POWER(mw) ((((mw) / 250) & PDO_PWR_MASK) << PDO_BATT_MAX_PWR_SHIFT)
51
52
#define PDO_BATT(min_mv, max_mv, max_mw) \
53
(PDO_TYPE(PDO_TYPE_BATT) | PDO_BATT_MIN_VOLT(min_mv) | \
54
PDO_BATT_MAX_VOLT(max_mv) | PDO_BATT_MAX_POWER(max_mw))
52
#define PDO_BATT(min_mv, max_mv, max_mw) \
…
55
56
#define PDO_VAR_MAX_VOLT_SHIFT 20
/* 50mV units */
57
#define PDO_VAR_MIN_VOLT_SHIFT 10
/* 50mV units */
58
#define PDO_VAR_MAX_CURR_SHIFT 0
/* 10mA units */
59
60
#define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT)
61
#define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT)
62
#define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT)
63
64
#define PDO_VAR(min_mv, max_mv, max_ma) \
65
(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) | \
66
PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma))
64
#define PDO_VAR(min_mv, max_mv, max_ma) \
…
67
68
#define APDO_TYPE_PPS 0
69
70
#define PDO_APDO_TYPE_SHIFT 28
/* Only valid value currently is 0x0 - PPS */
71
#define PDO_APDO_TYPE_MASK 0x3
72
73
#define PDO_APDO_TYPE(t) ((t) << PDO_APDO_TYPE_SHIFT)
74
75
#define PDO_PPS_APDO_MAX_VOLT_SHIFT 17
/* 100mV units */
76
#define PDO_PPS_APDO_MIN_VOLT_SHIFT 8
/* 100mV units */
77
#define PDO_PPS_APDO_MAX_CURR_SHIFT 0
/* 50mA units */
78
79
#define PDO_PPS_APDO_VOLT_MASK 0xff
80
#define PDO_PPS_APDO_CURR_MASK 0x7f
81
82
#define PDO_PPS_APDO_MIN_VOLT(mv) \
83
((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT)
82
#define PDO_PPS_APDO_MIN_VOLT(mv) \
…
84
#define PDO_PPS_APDO_MAX_VOLT(mv) \
85
((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT)
84
#define PDO_PPS_APDO_MAX_VOLT(mv) \
…
86
#define PDO_PPS_APDO_MAX_CURR(ma) \
87
((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT)
86
#define PDO_PPS_APDO_MAX_CURR(ma) \
…
88
89
#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \
90
(PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) | \
91
PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) | \
92
PDO_PPS_APDO_MAX_CURR(max_ma))
89
#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \
…
93
94
#endif
/* ZEPHYR_INCLUDE_DT_BINDINGS_USBC_PD_H_ */
zephyr
dt-bindings
usb-c
pd.h
Generated on Thu Jun 5 2025 21:07:55 for Zephyr API Documentation by
1.12.0