summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--[l---------]board/adlrvpm_ite/board.h103
-rw-r--r--board/adlrvpm_ite/ec.tasklist2
-rw-r--r--board/adlrvpp_ite/board.c2
-rw-r--r--board/adlrvpp_ite/board.h82
-rw-r--r--board/adlrvpp_ite/build.mk2
-rw-r--r--board/adlrvpp_ite/ec.tasklist2
-rw-r--r--board/adlrvpp_ite/gpio.inc6
-rw-r--r--board/adlrvpp_mchp1521/board.c4
-rw-r--r--board/adlrvpp_mchp1521/board.h109
-rw-r--r--board/adlrvpp_mchp1521/build.mk2
-rw-r--r--board/adlrvpp_mchp1521/ec.tasklist2
-rw-r--r--board/adlrvpp_mchp1521/gpio.inc2
-rw-r--r--board/adlrvpp_mchp1727/board.c4
-rw-r--r--board/adlrvpp_mchp1727/board.h88
-rw-r--r--board/adlrvpp_mchp1727/build.mk2
-rw-r--r--board/adlrvpp_mchp1727/ec.tasklist2
-rw-r--r--board/adlrvpp_mchp1727/gpio.inc6
-rw-r--r--board/adlrvpp_npcx/board.c2
-rw-r--r--board/adlrvpp_npcx/board.h78
-rw-r--r--board/adlrvpp_npcx/build.mk2
-rw-r--r--board/adlrvpp_npcx/ec.tasklist2
-rw-r--r--board/adlrvpp_npcx/gpio.inc6
-rw-r--r--board/agah/battery.c2
-rw-r--r--board/agah/board.c54
-rw-r--r--board/agah/board.h156
-rw-r--r--board/agah/build.mk2
-rw-r--r--board/agah/charger_isl9241.c236
-rw-r--r--board/agah/ec.tasklist3
-rw-r--r--board/agah/fans.c6
-rw-r--r--board/agah/fw_config.c4
-rw-r--r--board/agah/fw_config.h8
-rw-r--r--board/agah/gpio.inc23
-rw-r--r--board/agah/i2c.c4
-rw-r--r--board/agah/keyboard.c3
-rw-r--r--board/agah/led.c221
-rw-r--r--board/agah/pwm.c16
-rw-r--r--board/agah/sensors.c64
-rw-r--r--board/agah/usbc_config.c65
-rw-r--r--board/agah/usbc_config.h10
-rw-r--r--board/akemi/battery.c2
-rw-r--r--board/akemi/board.c107
-rw-r--r--board/akemi/board.h32
-rw-r--r--board/akemi/build.mk2
-rw-r--r--board/akemi/ec.tasklist2
-rw-r--r--board/akemi/gpio.inc6
-rw-r--r--board/akemi/led.c53
-rw-r--r--board/aleena/battery.c2
-rw-r--r--board/aleena/board.c144
-rw-r--r--board/aleena/board.h13
-rw-r--r--board/aleena/build.mk2
-rw-r--r--board/aleena/ec.tasklist2
-rw-r--r--board/aleena/gpio.inc2
-rw-r--r--board/aleena/led.c46
-rw-r--r--board/ambassador/board.c191
-rw-r--r--board/ambassador/board.h108
-rw-r--r--board/ambassador/build.mk2
-rw-r--r--board/ambassador/ec.tasklist2
-rw-r--r--board/ambassador/gpio.inc6
-rw-r--r--board/ambassador/led.c14
-rw-r--r--board/ambassador/usb_pd_policy.c7
-rw-r--r--board/ampton/battery.c2
-rw-r--r--board/ampton/board.c123
-rw-r--r--board/ampton/board.h25
-rw-r--r--board/ampton/build.mk2
-rw-r--r--board/ampton/ec.tasklist2
-rw-r--r--board/ampton/gpio.inc2
-rw-r--r--board/ampton/led.c40
-rw-r--r--board/anahera/battery.c2
-rw-r--r--board/anahera/board.c13
-rw-r--r--board/anahera/board.h128
-rw-r--r--board/anahera/build.mk2
-rw-r--r--[l---------]board/anahera/charger.c91
-rw-r--r--board/anahera/ec.tasklist2
-rw-r--r--board/anahera/fans.c4
-rw-r--r--board/anahera/fw_config.c4
-rw-r--r--board/anahera/fw_config.h23
-rw-r--r--board/anahera/gpio.inc2
-rw-r--r--board/anahera/i2c.c2
-rw-r--r--board/anahera/keyboard.c14
-rw-r--r--board/anahera/led.c76
-rw-r--r--board/anahera/pwm.c2
-rw-r--r--board/anahera/sensors.c58
-rw-r--r--board/anahera/thermal.c68
-rw-r--r--board/anahera/usbc_config.c112
-rw-r--r--board/anahera/usbc_config.h16
-rw-r--r--board/arcada_ish/board.c13
-rw-r--r--board/arcada_ish/board.h32
-rw-r--r--board/arcada_ish/build.mk2
-rw-r--r--board/arcada_ish/ec.tasklist2
-rw-r--r--board/arcada_ish/gpio.inc2
-rw-r--r--board/asurada/battery.c2
-rw-r--r--board/asurada/board.c72
-rw-r--r--board/asurada/board.h18
-rw-r--r--board/asurada/build.mk2
-rw-r--r--board/asurada/ec.tasklist2
-rw-r--r--board/asurada/gpio.inc2
-rw-r--r--board/asurada/led.c21
-rw-r--r--board/asurada/led_hayato.c63
-rw-r--r--board/asurada/usbc_config.c17
-rw-r--r--board/asurada_scp/board.h6
-rw-r--r--board/asurada_scp/build.mk2
-rw-r--r--board/asurada_scp/ec.tasklist2
-rw-r--r--board/asurada_scp/gpio.inc2
-rw-r--r--board/atlas/battery.c54
-rw-r--r--board/atlas/board.c192
-rw-r--r--board/atlas/board.h126
-rw-r--r--board/atlas/build.mk2
-rw-r--r--board/atlas/ec.tasklist2
-rw-r--r--board/atlas/gpio.inc2
-rw-r--r--board/atlas/led.c16
-rw-r--r--board/atlas/usb_pd_policy.c27
-rw-r--r--board/baklava/board.c100
-rw-r--r--board/baklava/board.h14
-rw-r--r--board/baklava/build.mk2
-rw-r--r--board/baklava/ec.tasklist2
-rw-r--r--board/baklava/gpio.inc2
-rw-r--r--board/banshee/battery.c2
-rw-r--r--board/banshee/board.c103
-rw-r--r--board/banshee/board.h142
-rw-r--r--board/banshee/build.mk3
-rw-r--r--board/banshee/charger.c12
-rw-r--r--board/banshee/ec.tasklist2
-rw-r--r--board/banshee/fans.c4
-rw-r--r--board/banshee/fw_config.c4
-rw-r--r--board/banshee/fw_config.h13
-rw-r--r--board/banshee/gpio.inc2
-rw-r--r--board/banshee/i2c.c22
-rw-r--r--board/banshee/keyboard.c36
-rw-r--r--board/banshee/keyboard_customization.c111
-rw-r--r--board/banshee/keyboard_customization.h79
-rw-r--r--board/banshee/led.c92
-rw-r--r--board/banshee/pwm.c2
-rw-r--r--board/banshee/sensors.c29
-rw-r--r--board/banshee/tune_mp2964.c43
-rw-r--r--board/banshee/usbc_config.c114
-rw-r--r--board/banshee/usbc_config.h4
-rw-r--r--board/beadrix/battery.c2
-rw-r--r--board/beadrix/board.c290
-rw-r--r--board/beadrix/board.h36
-rw-r--r--board/beadrix/build.mk2
-rw-r--r--board/beadrix/cbi_ssfc.c6
-rw-r--r--board/beadrix/cbi_ssfc.h3
-rw-r--r--board/beadrix/ec.tasklist2
-rw-r--r--board/beadrix/gpio.inc2
-rw-r--r--board/beadrix/led.c35
-rw-r--r--board/beadrix/usb_pd_policy.c6
-rw-r--r--board/beetley/battery.c2
-rw-r--r--board/beetley/board.c114
-rw-r--r--board/beetley/board.h16
-rw-r--r--board/beetley/build.mk2
-rw-r--r--board/beetley/cbi_ssfc.c6
-rw-r--r--board/beetley/cbi_ssfc.h3
-rw-r--r--board/beetley/ec.tasklist2
-rw-r--r--board/beetley/gpio.inc2
-rw-r--r--board/beetley/led.c60
-rw-r--r--board/beetley/usb_pd_policy.c6
-rw-r--r--board/bellis/battery.c2
-rw-r--r--board/bellis/board.c127
-rw-r--r--board/bellis/board.h47
-rw-r--r--board/bellis/build.mk2
-rw-r--r--board/bellis/ec.tasklist2
-rw-r--r--board/bellis/gpio.inc2
-rw-r--r--board/bellis/led.c55
-rw-r--r--board/berknip/battery.c2
-rw-r--r--board/berknip/board.c178
-rw-r--r--board/berknip/board.h86
-rw-r--r--board/berknip/build.mk2
-rw-r--r--board/berknip/ec.tasklist2
-rw-r--r--board/berknip/gpio.inc2
-rw-r--r--board/berknip/led.c66
-rw-r--r--board/blipper/battery.c2
-rw-r--r--board/blipper/board.c197
-rw-r--r--board/blipper/board.h26
-rw-r--r--board/blipper/build.mk2
-rw-r--r--board/blipper/cbi_ssfc.c6
-rw-r--r--board/blipper/cbi_ssfc.h3
-rw-r--r--board/blipper/ec.tasklist2
-rw-r--r--board/blipper/gpio.inc2
-rw-r--r--board/blipper/led.c60
-rw-r--r--board/blipper/usb_pd_policy.c6
-rw-r--r--board/bloog/battery.c2
-rw-r--r--board/bloog/board.c113
-rw-r--r--board/bloog/board.h26
-rw-r--r--board/bloog/build.mk2
-rw-r--r--board/bloog/ec.tasklist2
-rw-r--r--board/bloog/gpio.inc2
-rw-r--r--board/bloog/led.c63
-rw-r--r--board/bobba/battery.c2
-rw-r--r--board/bobba/board.c154
-rw-r--r--board/bobba/board.h44
-rw-r--r--board/bobba/build.mk2
-rw-r--r--board/bobba/ec.tasklist2
-rw-r--r--board/bobba/gpio.inc2
-rw-r--r--board/bobba/led.c36
-rw-r--r--board/boldar/battery.c2
-rw-r--r--board/boldar/board.c123
-rw-r--r--board/boldar/board.h114
-rw-r--r--board/boldar/build.mk2
-rw-r--r--board/boldar/ec.tasklist2
-rw-r--r--board/boldar/gpio.inc4
-rw-r--r--board/boldar/led.c16
-rw-r--r--board/boldar/sensors.c18
-rw-r--r--board/boten/battery.c2
-rw-r--r--board/boten/board.c98
-rw-r--r--board/boten/board.h30
-rw-r--r--board/boten/build.mk2
-rw-r--r--board/boten/cbi_ssfc.c6
-rw-r--r--board/boten/cbi_ssfc.h3
-rw-r--r--board/boten/ec.tasklist2
-rw-r--r--board/boten/gpio.inc2
-rw-r--r--board/boten/led.c59
-rw-r--r--board/boten/usb_pd_policy.c6
-rw-r--r--board/brask/board.c79
-rw-r--r--board/brask/board.h123
-rw-r--r--board/brask/build.mk2
-rw-r--r--board/brask/ec.tasklist2
-rw-r--r--board/brask/fans.c4
-rw-r--r--board/brask/fw_config.c4
-rw-r--r--board/brask/fw_config.h12
-rw-r--r--board/brask/gpio.inc2
-rw-r--r--board/brask/i2c.c2
-rw-r--r--board/brask/led.c23
-rw-r--r--board/brask/pwm.c27
-rw-r--r--board/brask/sensors.c46
-rw-r--r--board/brask/usbc_config.c81
-rw-r--r--board/brask/usbc_config.h4
-rw-r--r--board/brya/battery.c7
-rw-r--r--board/brya/board.c69
-rw-r--r--board/brya/board.h154
-rw-r--r--board/brya/build.mk3
-rw-r--r--[l---------]board/brya/charger.c91
-rw-r--r--board/brya/ec.tasklist2
-rw-r--r--board/brya/fans.c4
-rw-r--r--board/brya/fw_config.c19
-rw-r--r--board/brya/fw_config.h14
-rw-r--r--board/brya/gpio.inc35
-rw-r--r--board/brya/i2c.c20
-rw-r--r--board/brya/keyboard.c2
-rw-r--r--board/brya/led.c13
-rw-r--r--board/brya/pwm.c6
-rw-r--r--board/brya/sensors.c51
-rw-r--r--board/brya/tune_mp2964.c43
-rw-r--r--board/brya/usbc_config.c157
-rw-r--r--board/brya/usbc_config.h4
-rw-r--r--board/bugzzy/battery.c9
-rw-r--r--board/bugzzy/board.c168
-rw-r--r--board/bugzzy/board.h89
-rw-r--r--board/bugzzy/build.mk2
-rw-r--r--board/bugzzy/cbi_ssfc.c6
-rw-r--r--board/bugzzy/cbi_ssfc.h3
-rw-r--r--board/bugzzy/ec.tasklist2
-rw-r--r--board/bugzzy/gpio.inc2
-rw-r--r--board/bugzzy/led.c72
-rw-r--r--board/bugzzy/usb_pd_policy.c6
-rw-r--r--board/burnet/battery.c2
-rw-r--r--board/burnet/board.c120
-rw-r--r--board/burnet/board.h26
-rw-r--r--board/burnet/build.mk2
-rw-r--r--board/burnet/ec.tasklist2
-rw-r--r--board/burnet/gpio.inc2
-rw-r--r--board/burnet/led.c36
-rw-r--r--board/c2d2/board.c228
-rw-r--r--board/c2d2/board.h51
-rw-r--r--board/c2d2/build.mk2
-rw-r--r--board/c2d2/ec.tasklist2
-rw-r--r--board/c2d2/gpio.inc2
-rw-r--r--board/cappy2/battery.c10
-rw-r--r--board/cappy2/board.c55
-rw-r--r--board/cappy2/board.h35
-rw-r--r--board/cappy2/build.mk2
-rw-r--r--board/cappy2/cbi_ssfc.c6
-rw-r--r--board/cappy2/cbi_ssfc.h3
-rw-r--r--board/cappy2/ec.tasklist2
-rw-r--r--board/cappy2/gpio.inc2
-rw-r--r--board/cappy2/led.c65
-rw-r--r--board/cappy2/usb_pd_policy.c6
-rw-r--r--board/careena/battery.c2
-rw-r--r--board/careena/board.c76
-rw-r--r--board/careena/board.h9
-rw-r--r--board/careena/build.mk2
-rw-r--r--board/careena/ec.tasklist2
-rw-r--r--board/careena/gpio.inc2
-rw-r--r--board/careena/led.c28
-rw-r--r--board/casta/battery.c18
-rw-r--r--board/casta/board.c48
-rw-r--r--board/casta/board.h6
-rw-r--r--board/casta/build.mk2
-rw-r--r--board/casta/ec.tasklist2
-rw-r--r--board/casta/gpio.inc2
-rw-r--r--board/casta/led.c90
-rw-r--r--board/cerise/battery.c2
-rw-r--r--board/cerise/board.c101
-rw-r--r--board/cerise/board.h24
-rw-r--r--board/cerise/build.mk2
-rw-r--r--board/cerise/ec.tasklist2
-rw-r--r--board/cerise/gpio.inc2
-rw-r--r--board/cerise/led.c45
-rw-r--r--board/cherry/battery.c2
-rw-r--r--board/cherry/board.c90
-rw-r--r--board/cherry/board.h7
-rw-r--r--board/cherry/build.mk2
-rw-r--r--board/cherry/ec.tasklist2
-rw-r--r--board/cherry/gpio.inc2
-rw-r--r--board/cherry/led.c45
-rw-r--r--board/cherry_scp/board.h6
-rw-r--r--board/cherry_scp/build.mk2
-rw-r--r--board/cherry_scp/ec.tasklist2
-rw-r--r--board/cherry_scp/gpio.inc2
-rw-r--r--board/chocodile_vpdmcu/board.c44
-rw-r--r--board/chocodile_vpdmcu/board.h44
-rw-r--r--board/chocodile_vpdmcu/build.mk2
-rw-r--r--board/chocodile_vpdmcu/chocodile.html2
-rw-r--r--board/chocodile_vpdmcu/ec.tasklist2
-rw-r--r--board/chocodile_vpdmcu/gpio.inc2
-rw-r--r--board/chocodile_vpdmcu/usb_pd_config.h29
-rw-r--r--board/chocodile_vpdmcu/vpd_api.c108
-rw-r--r--board/chocodile_vpdmcu/vpd_api.h26
-rw-r--r--board/chronicler/battery.c2
-rw-r--r--board/chronicler/board.c94
-rw-r--r--board/chronicler/board.h93
-rw-r--r--board/chronicler/build.mk2
-rw-r--r--board/chronicler/cbi.c2
-rw-r--r--board/chronicler/ec.tasklist2
-rw-r--r--board/chronicler/gpio.inc4
-rw-r--r--board/chronicler/keyboard.c2
-rw-r--r--board/chronicler/led.c61
-rw-r--r--board/chronicler/usbc_config.c54
-rw-r--r--board/chronicler/usbc_config.h8
-rw-r--r--board/coachz/base_detect.c18
-rw-r--r--board/coachz/battery.c2
-rw-r--r--board/coachz/board.c190
-rw-r--r--board/coachz/board.h13
-rw-r--r--board/coachz/build.mk2
-rw-r--r--board/coachz/ec.tasklist2
-rw-r--r--board/coachz/gpio.inc2
-rw-r--r--board/coachz/led.c42
-rw-r--r--board/coachz/usbc_config.c6
-rw-r--r--board/coffeecake/board.c41
-rw-r--r--board/coffeecake/board.h24
-rw-r--r--board/coffeecake/build.mk2
-rw-r--r--board/coffeecake/ec.tasklist2
-rw-r--r--board/coffeecake/gpio.inc2
-rw-r--r--board/coffeecake/usb_pd_config.h10
-rw-r--r--board/coffeecake/usb_pd_pdo.c15
-rw-r--r--board/coffeecake/usb_pd_pdo.h2
-rw-r--r--board/coffeecake/usb_pd_policy.c58
-rw-r--r--board/collis/battery.c2
-rw-r--r--board/collis/board.c84
-rw-r--r--board/collis/board.h114
-rw-r--r--board/collis/build.mk2
-rw-r--r--board/collis/ec.tasklist2
-rw-r--r--board/collis/gpio.inc4
-rw-r--r--board/collis/led.c45
-rw-r--r--board/collis/sensors.c24
-rw-r--r--board/copano/battery.c2
-rw-r--r--board/copano/board.c70
-rw-r--r--board/copano/board.h118
-rw-r--r--board/copano/build.mk2
-rw-r--r--board/copano/ec.tasklist2
-rw-r--r--board/copano/gpio.inc4
-rw-r--r--board/copano/led.c45
-rw-r--r--board/copano/sensors.c24
-rw-r--r--board/coral/battery.c41
-rw-r--r--board/coral/board.c215
-rw-r--r--board/coral/board.h61
-rw-r--r--board/coral/build.mk2
-rw-r--r--board/coral/ec.tasklist2
-rw-r--r--board/coral/gpio.inc2
-rw-r--r--board/coral/led.c88
-rw-r--r--board/coral/sku.h10
-rw-r--r--board/coral/usb_pd_policy.c13
-rw-r--r--board/corori/battery.c2
-rw-r--r--board/corori/board.c128
-rw-r--r--board/corori/board.h32
-rw-r--r--board/corori/build.mk2
-rw-r--r--board/corori/cbi_ssfc.c6
-rw-r--r--board/corori/cbi_ssfc.h3
-rw-r--r--board/corori/ec.tasklist2
-rw-r--r--board/corori/gpio.inc2
-rw-r--r--board/corori/led.c74
-rw-r--r--board/corori/usb_pd_policy.c6
-rw-r--r--board/corori2/battery.c2
-rw-r--r--board/corori2/board.c125
-rw-r--r--board/corori2/board.h61
-rw-r--r--board/corori2/build.mk2
-rw-r--r--board/corori2/cbi_ssfc.c6
-rw-r--r--board/corori2/cbi_ssfc.h3
-rw-r--r--board/corori2/ec.tasklist2
-rw-r--r--board/corori2/gpio.inc2
-rw-r--r--board/corori2/led.c13
-rw-r--r--board/corori2/usb_pd_policy.c6
-rw-r--r--board/cret/battery.c6
-rw-r--r--board/cret/board.c72
-rw-r--r--board/cret/board.h52
-rw-r--r--board/cret/build.mk2
-rw-r--r--board/cret/cbi_ssfc.c6
-rw-r--r--board/cret/cbi_ssfc.h3
-rw-r--r--board/cret/ec.tasklist2
-rw-r--r--board/cret/gpio.inc2
-rw-r--r--board/cret/led.c49
-rw-r--r--board/cret/usb_pd_policy.c6
-rw-r--r--board/crota/battery.c44
-rw-r--r--board/crota/board.c29
-rw-r--r--board/crota/board.h198
-rw-r--r--board/crota/build.mk2
-rw-r--r--board/crota/charger.c12
-rw-r--r--board/crota/ec.tasklist2
-rw-r--r--board/crota/fans.c185
-rw-r--r--board/crota/fw_config.c4
-rw-r--r--board/crota/fw_config.h19
-rw-r--r--board/crota/gpio.inc10
-rw-r--r--board/crota/i2c.c20
-rw-r--r--board/crota/keyboard.c6
-rw-r--r--board/crota/led.c49
-rw-r--r--board/crota/pwm.c2
-rw-r--r--board/crota/sensors.c241
-rw-r--r--board/crota/usbc_config.c85
-rw-r--r--board/crota/usbc_config.h10
-rw-r--r--board/dalboz/battery.c2
-rw-r--r--board/dalboz/board.c105
-rw-r--r--board/dalboz/board.h93
-rw-r--r--board/dalboz/build.mk2
-rw-r--r--board/dalboz/ec.tasklist2
-rw-r--r--board/dalboz/gpio.inc2
-rw-r--r--board/dalboz/led.c61
-rw-r--r--board/damu/battery.c2
-rw-r--r--board/damu/board.c101
-rw-r--r--board/damu/board.h24
-rw-r--r--board/damu/build.mk2
-rw-r--r--board/damu/ec.tasklist2
-rw-r--r--board/damu/gpio.inc2
-rw-r--r--board/damu/led.c69
-rw-r--r--board/delbin/battery.c2
-rw-r--r--board/delbin/board.c141
-rw-r--r--board/delbin/board.h110
-rw-r--r--board/delbin/build.mk3
-rw-r--r--board/delbin/ec.tasklist2
-rw-r--r--board/delbin/gpio.inc4
-rw-r--r--board/delbin/keyboard_customization.c169
-rw-r--r--board/delbin/keyboard_customization.h130
-rw-r--r--board/delbin/led.c52
-rw-r--r--board/delbin/sensors.c24
-rw-r--r--board/dewatt/battery.c2
-rw-r--r--board/dewatt/board.c99
-rw-r--r--board/dewatt/board.h12
-rw-r--r--board/dewatt/board_fw_config.c5
-rw-r--r--board/dewatt/board_fw_config.h27
-rw-r--r--board/dewatt/build.mk2
-rw-r--r--board/dewatt/ec.tasklist2
-rw-r--r--board/dewatt/gpio.inc2
-rw-r--r--board/dewatt/led.c45
-rw-r--r--board/dewatt/thermal.c26
-rw-r--r--board/dingdong/board.c10
-rw-r--r--board/dingdong/board.h20
-rw-r--r--board/dingdong/build.mk2
-rw-r--r--board/dingdong/ec.tasklist2
-rw-r--r--board/dingdong/gpio.inc2
-rw-r--r--board/dingdong/usb_pd_config.h17
-rw-r--r--board/dingdong/usb_pd_pdo.c4
-rw-r--r--board/dingdong/usb_pd_pdo.h2
-rw-r--r--board/dingdong/usb_pd_policy.c57
-rw-r--r--board/dirinboz/battery.c2
-rw-r--r--board/dirinboz/board.c84
-rw-r--r--board/dirinboz/board.h81
-rw-r--r--board/dirinboz/build.mk2
-rw-r--r--board/dirinboz/ec.tasklist2
-rw-r--r--board/dirinboz/gpio.inc2
-rw-r--r--board/dirinboz/led.c58
-rw-r--r--board/discovery-stm32f072/board.c83
-rw-r--r--board/discovery-stm32f072/board.h21
-rw-r--r--board/discovery-stm32f072/build.mk2
-rw-r--r--board/discovery-stm32f072/ec.tasklist2
-rw-r--r--board/discovery-stm32f072/gpio.inc2
-rw-r--r--board/discovery-stm32f072/openocd-flash.cfg2
-rw-r--r--board/discovery/board.c19
-rw-r--r--board/discovery/board.h2
-rw-r--r--board/discovery/build.mk2
-rw-r--r--board/discovery/ec.tasklist2
-rw-r--r--board/discovery/gpio.inc2
-rw-r--r--board/discovery/openocd-flash.cfg2
-rw-r--r--board/dojo/battery.c13
-rw-r--r--board/dojo/board.c292
-rw-r--r--board/dojo/board.h22
-rw-r--r--board/dojo/build.mk4
-rw-r--r--board/dojo/cbi_fw_config.c10
-rw-r--r--board/dojo/cbi_fw_config.h10
-rw-r--r--board/dojo/cbi_ssfc.c (renamed from board/shotzo/cbi_ssfc.c)8
-rw-r--r--board/dojo/cbi_ssfc.h (renamed from board/shotzo/cbi_ssfc.h)22
-rw-r--r--board/dojo/ec.tasklist2
-rw-r--r--board/dojo/gpio.inc8
-rw-r--r--board/dojo/led.c91
-rw-r--r--board/dood/battery.c2
-rw-r--r--board/dood/board.c100
-rw-r--r--board/dood/board.h27
-rw-r--r--board/dood/build.mk2
-rw-r--r--board/dood/ec.tasklist2
-rw-r--r--board/dood/gpio.inc2
-rw-r--r--board/dood/led.c37
-rw-r--r--board/dooly/board.c274
-rw-r--r--board/dooly/board.h135
-rw-r--r--board/dooly/build.mk2
-rw-r--r--board/dooly/ec.tasklist2
-rw-r--r--board/dooly/gpio.inc6
-rw-r--r--board/dooly/led.c14
-rw-r--r--board/dooly/usb_pd_policy.c7
-rw-r--r--board/drallion_ish/board.c10
-rw-r--r--board/drallion_ish/board.h14
-rw-r--r--board/drallion_ish/build.mk2
-rw-r--r--board/drallion_ish/ec.tasklist2
-rw-r--r--board/drallion_ish/gpio.inc2
-rw-r--r--board/dratini/battery.c2
-rw-r--r--board/dratini/board.c119
-rw-r--r--board/dratini/board.h38
-rw-r--r--board/dratini/build.mk2
-rw-r--r--board/dratini/ec.tasklist2
-rw-r--r--board/dratini/gpio.inc6
-rw-r--r--board/dratini/led.c59
-rw-r--r--board/drawcia/battery.c2
-rw-r--r--board/drawcia/board.c204
-rw-r--r--board/drawcia/board.h44
-rw-r--r--board/drawcia/build.mk2
-rw-r--r--board/drawcia/cbi_ssfc.c6
-rw-r--r--board/drawcia/cbi_ssfc.h3
-rw-r--r--board/drawcia/ec.tasklist2
-rw-r--r--board/drawcia/gpio.inc2
-rw-r--r--board/drawcia/led.c34
-rw-r--r--board/drawcia/usb_pd_policy.c19
-rw-r--r--board/drawcia_riscv/battery.c2
-rw-r--r--board/drawcia_riscv/board.c204
-rw-r--r--board/drawcia_riscv/board.h45
-rw-r--r--board/drawcia_riscv/build.mk2
-rw-r--r--board/drawcia_riscv/cbi_ssfc.c6
-rw-r--r--board/drawcia_riscv/cbi_ssfc.h3
-rw-r--r--board/drawcia_riscv/ec.tasklist2
-rw-r--r--board/drawcia_riscv/gpio.inc2
-rw-r--r--board/drawcia_riscv/led.c34
-rw-r--r--board/drawcia_riscv/usb_pd_policy.c19
-rw-r--r--board/driblee/battery.c6
-rw-r--r--board/driblee/board.c67
-rw-r--r--board/driblee/board.h31
-rw-r--r--board/driblee/build.mk2
-rw-r--r--board/driblee/cbi_ssfc.c6
-rw-r--r--board/driblee/cbi_ssfc.h3
-rw-r--r--board/driblee/ec.tasklist2
-rw-r--r--board/driblee/gpio.inc2
-rw-r--r--board/driblee/led.c45
-rw-r--r--board/driblee/usb_pd_policy.c6
-rw-r--r--board/drobit/battery.c2
-rw-r--r--board/drobit/board.c77
-rw-r--r--board/drobit/board.h97
-rw-r--r--board/drobit/build.mk2
-rw-r--r--board/drobit/ec.tasklist2
-rw-r--r--board/drobit/gpio.inc4
-rw-r--r--board/drobit/led.c45
-rw-r--r--board/eldrid/battery.c8
-rw-r--r--board/eldrid/board.c101
-rw-r--r--board/eldrid/board.h102
-rw-r--r--board/eldrid/build.mk2
-rw-r--r--board/eldrid/ec.tasklist2
-rw-r--r--board/eldrid/gpio.inc4
-rw-r--r--board/eldrid/led.c69
-rw-r--r--board/eldrid/sensors.c18
-rw-r--r--board/eldrid/thermal.c58
-rw-r--r--board/elemi/battery.c2
-rw-r--r--board/elemi/board.c84
-rw-r--r--board/elemi/board.h95
-rw-r--r--board/elemi/build.mk2
-rw-r--r--board/elemi/ec.tasklist2
-rw-r--r--board/elemi/gpio.inc4
-rw-r--r--board/elemi/led.c61
-rw-r--r--board/elm/battery.c6
-rw-r--r--board/elm/board.c109
-rw-r--r--board/elm/board.h58
-rw-r--r--board/elm/build.mk2
-rw-r--r--board/elm/ec.tasklist2
-rw-r--r--board/elm/gpio.inc2
-rw-r--r--board/elm/led.c24
-rw-r--r--board/elm/usb_pd_policy.c6
-rw-r--r--board/endeavour/board.c103
-rw-r--r--board/endeavour/board.h37
-rw-r--r--board/endeavour/build.mk2
-rw-r--r--board/endeavour/ec.tasklist2
-rw-r--r--board/endeavour/gpio.inc2
-rw-r--r--board/endeavour/led.c13
-rw-r--r--board/endeavour/pse.c85
-rw-r--r--board/eve/battery.c97
-rw-r--r--board/eve/board.c183
-rw-r--r--board/eve/board.h82
-rw-r--r--board/eve/build.mk2
-rw-r--r--board/eve/ec.tasklist2
-rw-r--r--board/eve/gpio.inc2
-rw-r--r--board/eve/led.c105
-rw-r--r--board/eve/usb_pd_policy.c30
-rw-r--r--board/ezkinil/battery.c2
-rw-r--r--board/ezkinil/board.c154
-rw-r--r--board/ezkinil/board.h107
-rw-r--r--board/ezkinil/build.mk2
-rw-r--r--board/ezkinil/ec.tasklist2
-rw-r--r--board/ezkinil/gpio.inc2
-rw-r--r--board/ezkinil/led.c40
-rw-r--r--board/felwinter/battery.c2
-rw-r--r--board/felwinter/board.c14
-rw-r--r--board/felwinter/board.h151
-rw-r--r--board/felwinter/build.mk2
-rw-r--r--board/felwinter/charger_isl9241.c12
-rw-r--r--board/felwinter/ec.tasklist2
-rw-r--r--board/felwinter/fans.c4
-rw-r--r--board/felwinter/fw_config.c4
-rw-r--r--board/felwinter/fw_config.h35
-rw-r--r--board/felwinter/gpio.inc2
-rw-r--r--board/felwinter/i2c.c2
-rw-r--r--board/felwinter/keyboard.c6
-rw-r--r--board/felwinter/led.c56
-rw-r--r--board/felwinter/pwm.c2
-rw-r--r--board/felwinter/sensors.c60
-rw-r--r--board/felwinter/usbc_config.c104
-rw-r--r--board/felwinter/usbc_config.h10
-rw-r--r--board/fennel/battery.c2
-rw-r--r--board/fennel/board.c163
-rw-r--r--board/fennel/board.h26
-rw-r--r--board/fennel/build.mk2
-rw-r--r--board/fennel/ec.tasklist2
-rw-r--r--board/fennel/gpio.inc2
-rw-r--r--board/fennel/led.c55
-rw-r--r--board/fizz/board.c223
-rw-r--r--board/fizz/board.h86
-rw-r--r--board/fizz/build.mk2
-rw-r--r--board/fizz/ec.tasklist2
-rw-r--r--board/fizz/gpio.inc6
-rw-r--r--board/fizz/led.c10
-rw-r--r--board/fizz/usb_pd_pdo.c6
-rw-r--r--board/fizz/usb_pd_pdo.h2
-rw-r--r--board/fizz/usb_pd_policy.c6
-rw-r--r--board/fleex/battery.c2
-rw-r--r--board/fleex/board.c79
-rw-r--r--board/fleex/board.h26
-rw-r--r--board/fleex/build.mk2
-rw-r--r--board/fleex/ec.tasklist2
-rw-r--r--board/fleex/gpio.inc2
-rw-r--r--board/fleex/led.c49
-rw-r--r--board/fleex/usb_pd_policy.c2
-rw-r--r--board/fluffy/board.c76
-rw-r--r--board/fluffy/board.h14
-rw-r--r--board/fluffy/build.mk7
-rw-r--r--board/fluffy/ec.tasklist2
-rw-r--r--board/fluffy/gpio.inc2
-rw-r--r--board/foob/battery.c2
-rw-r--r--board/foob/board.c64
-rw-r--r--board/foob/board.h26
-rw-r--r--board/foob/build.mk2
-rw-r--r--board/foob/ec.tasklist2
-rw-r--r--board/foob/gpio.inc2
-rw-r--r--board/foob/led.c51
-rw-r--r--board/fusb307bgevb/board.c121
-rw-r--r--board/fusb307bgevb/board.h24
-rw-r--r--board/fusb307bgevb/build.mk2
-rw-r--r--board/fusb307bgevb/ec.tasklist2
-rw-r--r--board/fusb307bgevb/gpio.inc2
-rw-r--r--board/fusb307bgevb/lcd.c18
-rw-r--r--board/fusb307bgevb/lcd.h68
-rw-r--r--board/gaelin/board.c591
-rw-r--r--board/gaelin/board.h203
-rw-r--r--board/gaelin/build.mk (renamed from board/ghost/build.mk)9
-rw-r--r--board/gaelin/ec.tasklist29
-rw-r--r--board/gaelin/fans.c50
-rw-r--r--board/gaelin/fw_config.c65
-rw-r--r--board/gaelin/fw_config.h41
-rw-r--r--board/gaelin/gpio.inc187
-rw-r--r--board/gaelin/i2c.c78
-rw-r--r--board/gaelin/led.c260
-rw-r--r--board/gaelin/pwm.c40
-rw-r--r--board/gaelin/sensors.c114
-rw-r--r--board/gaelin/usbc_config.c416
-rw-r--r--board/gaelin/usbc_config.h (renamed from board/ghost/usbc_config.h)11
-rw-r--r--board/gaelin/vif_override.xml (renamed from board/ghost/vif_override.xml)0
-rw-r--r--board/galtic/battery.c2
-rw-r--r--board/galtic/board.c211
-rw-r--r--board/galtic/board.h44
-rw-r--r--board/galtic/build.mk2
-rw-r--r--board/galtic/cbi_ssfc.c8
-rw-r--r--board/galtic/cbi_ssfc.h4
-rw-r--r--board/galtic/ec.tasklist2
-rw-r--r--board/galtic/gpio.inc2
-rw-r--r--board/galtic/led.c45
-rw-r--r--board/galtic/usb_pd_policy.c6
-rw-r--r--board/garg/battery.c2
-rw-r--r--board/garg/board.c123
-rw-r--r--board/garg/board.h34
-rw-r--r--board/garg/build.mk2
-rw-r--r--board/garg/ec.tasklist2
-rw-r--r--board/garg/gpio.inc2
-rw-r--r--board/garg/led.c36
-rw-r--r--board/gelarshie/base_detect.c18
-rw-r--r--board/gelarshie/battery.c2
-rw-r--r--board/gelarshie/board.c178
-rw-r--r--board/gelarshie/board.h13
-rw-r--r--board/gelarshie/build.mk2
-rw-r--r--board/gelarshie/ec.tasklist2
-rw-r--r--board/gelarshie/gpio.inc2
-rw-r--r--board/gelarshie/led.c42
-rw-r--r--board/gelarshie/usbc_config.c6
-rw-r--r--board/genesis/board.c143
-rw-r--r--board/genesis/board.h90
-rw-r--r--board/genesis/build.mk2
-rw-r--r--board/genesis/ec.tasklist2
-rw-r--r--board/genesis/gpio.inc6
-rw-r--r--board/genesis/led.c14
-rw-r--r--board/genesis/pse.c85
-rw-r--r--board/ghost/battery.c113
-rw-r--r--board/ghost/board.c36
-rw-r--r--board/ghost/board.h192
-rw-r--r--board/ghost/charger.c92
-rw-r--r--board/ghost/ec.tasklist25
-rw-r--r--board/ghost/fans.c56
-rw-r--r--board/ghost/fw_config.c40
-rw-r--r--board/ghost/fw_config.h50
-rw-r--r--board/ghost/generated-gpio.inc114
-rw-r--r--board/ghost/gpio.inc37
-rw-r--r--board/ghost/i2c.c73
-rw-r--r--board/ghost/keyboard.c25
-rw-r--r--board/ghost/led.c48
-rw-r--r--board/ghost/pwm.c61
-rw-r--r--board/ghost/sensors.c187
-rw-r--r--board/ghost/usbc_config.c299
-rw-r--r--board/gimble/battery.c2
-rw-r--r--board/gimble/board.c49
-rw-r--r--board/gimble/board.h142
-rw-r--r--board/gimble/build.mk2
-rw-r--r--[l---------]board/gimble/charger.c91
-rw-r--r--board/gimble/ec.tasklist2
-rw-r--r--board/gimble/fans.c4
-rw-r--r--board/gimble/fw_config.c4
-rw-r--r--board/gimble/fw_config.h25
-rw-r--r--board/gimble/gpio.inc2
-rw-r--r--board/gimble/i2c.c2
-rw-r--r--board/gimble/keyboard.c6
-rw-r--r--board/gimble/led.c56
-rw-r--r--board/gimble/pwm.c2
-rw-r--r--board/gimble/sensors.c106
-rw-r--r--board/gimble/thermal.c68
-rw-r--r--board/gimble/usbc_config.c46
-rw-r--r--board/gimble/usbc_config.h10
-rw-r--r--board/gingerbread/board.c105
-rw-r--r--board/gingerbread/board.h23
-rw-r--r--board/gingerbread/build.mk2
-rw-r--r--board/gingerbread/ec.tasklist2
-rw-r--r--board/gingerbread/gpio.inc2
-rw-r--r--board/gooey/battery.c2
-rw-r--r--board/gooey/board.c100
-rw-r--r--board/gooey/board.h30
-rw-r--r--board/gooey/build.mk2
-rw-r--r--board/gooey/ec.tasklist2
-rw-r--r--board/gooey/gpio.inc2
-rw-r--r--board/gooey/led.c59
-rw-r--r--board/gooey/usb_pd_policy.c6
-rw-r--r--board/goroh/battery.c2
-rw-r--r--board/goroh/board.c60
-rw-r--r--board/goroh/board.h21
-rw-r--r--board/goroh/build.mk2
-rw-r--r--board/goroh/ec.tasklist2
-rw-r--r--board/goroh/fans.c2
-rw-r--r--board/goroh/gpio.inc2
-rw-r--r--board/goroh/led.c13
-rw-r--r--board/goroh/sensors.c2
-rw-r--r--board/goroh/usbc_confg.c2
-rw-r--r--board/grunt/battery.c2
-rw-r--r--board/grunt/board.c76
-rw-r--r--board/grunt/board.h6
-rw-r--r--board/grunt/build.mk2
-rw-r--r--board/grunt/ec.tasklist2
-rw-r--r--board/grunt/gpio.inc2
-rw-r--r--board/grunt/led.c13
-rw-r--r--board/gumboz/battery.c2
-rw-r--r--board/gumboz/board.c109
-rw-r--r--board/gumboz/board.h85
-rw-r--r--board/gumboz/build.mk2
-rw-r--r--board/gumboz/ec.tasklist2
-rw-r--r--board/gumboz/gpio.inc2
-rw-r--r--board/gumboz/led.c59
-rw-r--r--board/guybrush/battery.c2
-rw-r--r--board/guybrush/board.c98
-rw-r--r--board/guybrush/board.h12
-rw-r--r--board/guybrush/board_fw_config.c9
-rw-r--r--board/guybrush/board_fw_config.h27
-rw-r--r--board/guybrush/build.mk2
-rw-r--r--board/guybrush/ec.tasklist2
-rw-r--r--board/guybrush/gpio.inc2
-rw-r--r--board/guybrush/led.c42
-rw-r--r--board/guybrush/thermal.c4
-rw-r--r--board/haboki/battery.c2
-rw-r--r--board/haboki/board.c204
-rw-r--r--board/haboki/board.h42
-rw-r--r--board/haboki/build.mk2
-rw-r--r--board/haboki/cbi_ssfc.c6
-rw-r--r--board/haboki/cbi_ssfc.h3
-rw-r--r--board/haboki/ec.tasklist2
-rw-r--r--board/haboki/gpio.inc2
-rw-r--r--board/haboki/led.c34
-rw-r--r--board/haboki/usb_pd_policy.c19
-rw-r--r--board/hammer/battery.c6
-rw-r--r--board/hammer/board.c93
-rw-r--r--board/hammer/board.h102
-rw-r--r--board/hammer/build.mk2
-rw-r--r--board/hammer/ec.tasklist2
-rw-r--r--board/hammer/gpio.inc2
-rw-r--r--board/hammer/variants.h36
-rw-r--r--board/hatch/battery.c2
-rw-r--r--board/hatch/board.c84
-rw-r--r--board/hatch/board.h40
-rw-r--r--board/hatch/build.mk2
-rw-r--r--board/hatch/ec.tasklist2
-rw-r--r--board/hatch/gpio.inc6
-rw-r--r--board/hatch/led.c36
-rw-r--r--board/hatch_fp/board.c2
-rw-r--r--board/hatch_fp/board.h34
-rw-r--r--board/hatch_fp/board_rw.c2
-rw-r--r--board/hatch_fp/board_rw.h2
-rw-r--r--board/hatch_fp/build.mk4
-rw-r--r--board/hatch_fp/ec.tasklist2
-rw-r--r--board/hatch_fp/fpsensor_detect.c2
-rw-r--r--board/hatch_fp/fpsensor_detect_rw.c2
-rw-r--r--board/hatch_fp/gpio.inc2
-rw-r--r--board/hatch_fp/gpio_rw.inc2
-rw-r--r--board/helios/battery.c2
-rw-r--r--board/helios/board.c119
-rw-r--r--board/helios/board.h38
-rw-r--r--board/helios/build.mk2
-rw-r--r--board/helios/ec.tasklist2
-rw-r--r--board/helios/gpio.inc6
-rw-r--r--board/helios/led.c52
-rw-r--r--board/herobrine/battery.c2
-rw-r--r--board/herobrine/board.c127
-rw-r--r--board/herobrine/board.h33
-rw-r--r--board/herobrine/build.mk2
-rw-r--r--board/herobrine/ec.tasklist2
-rw-r--r--board/herobrine/gpio.inc2
-rw-r--r--board/herobrine/led.c28
-rw-r--r--board/herobrine/switchcap.c2
-rw-r--r--board/herobrine/usbc_config.c60
-rw-r--r--board/herobrine/usbc_config.h2
-rw-r--r--board/hoho/board.c17
-rw-r--r--board/hoho/board.h20
-rw-r--r--board/hoho/build.mk2
-rw-r--r--board/hoho/ec.tasklist2
-rw-r--r--board/hoho/gpio.inc2
-rw-r--r--board/hoho/usb_pd_config.h17
-rw-r--r--board/hoho/usb_pd_pdo.c4
-rw-r--r--board/hoho/usb_pd_pdo.h2
-rw-r--r--board/hoho/usb_pd_policy.c53
-rw-r--r--board/homestar/base_detect.c15
-rw-r--r--board/homestar/battery.c2
-rw-r--r--board/homestar/board.c179
-rw-r--r--board/homestar/board.h14
-rw-r--r--board/homestar/build.mk2
-rw-r--r--board/homestar/ec.tasklist2
-rw-r--r--board/homestar/gpio.inc2
-rw-r--r--board/homestar/led.c35
-rw-r--r--board/homestar/usbc_config.c6
-rw-r--r--board/host/battery.c21
-rw-r--r--board/host/board.c73
-rw-r--r--board/host/board.h26
-rw-r--r--board/host/build.mk2
-rw-r--r--board/host/charger.c27
-rw-r--r--board/host/chipset.c2
-rw-r--r--board/host/ec.tasklist2
-rw-r--r--board/host/fan.c7
-rw-r--r--board/host/gpio.inc2
-rw-r--r--board/host/usb_pd_config.c2
-rw-r--r--board/host/usb_pd_config.h2
-rw-r--r--board/host/usb_pd_pdo.c12
-rw-r--r--board/host/usb_pd_pdo.h2
-rw-r--r--board/host/usb_pd_policy.c16
-rw-r--r--board/hyperdebug/board.c329
-rw-r--r--board/hyperdebug/board.h153
-rw-r--r--board/hyperdebug/build.mk13
-rw-r--r--board/hyperdebug/ec.tasklist11
-rw-r--r--board/hyperdebug/gpio.inc186
-rw-r--r--board/icarus/battery.c2
-rw-r--r--board/icarus/board.c106
-rw-r--r--board/icarus/board.h20
-rw-r--r--board/icarus/build.mk2
-rw-r--r--board/icarus/ec.tasklist2
-rw-r--r--board/icarus/gpio.inc2
-rw-r--r--board/icarus/led.c39
-rw-r--r--board/it83xx_evb/board.c2
-rw-r--r--board/it83xx_evb/board.h2
-rw-r--r--board/it83xx_evb/build.mk2
-rw-r--r--board/it83xx_evb/ec.tasklist2
-rw-r--r--board/it83xx_evb/gpio.inc2
-rw-r--r--board/it8xxx2_evb/board.c2
-rw-r--r--board/it8xxx2_evb/board.h2
-rw-r--r--board/it8xxx2_evb/build.mk2
-rw-r--r--board/it8xxx2_evb/ec.tasklist2
-rw-r--r--board/it8xxx2_evb/gpio.inc2
-rw-r--r--board/it8xxx2_pdevb/board.c23
-rw-r--r--board/it8xxx2_pdevb/board.h16
-rw-r--r--board/it8xxx2_pdevb/build.mk2
-rw-r--r--board/it8xxx2_pdevb/ec.tasklist2
-rw-r--r--board/it8xxx2_pdevb/gpio.inc2
-rw-r--r--board/jacuzzi/battery.c5
-rw-r--r--board/jacuzzi/board.c128
-rw-r--r--board/jacuzzi/board.h27
-rw-r--r--board/jacuzzi/build.mk2
-rw-r--r--board/jacuzzi/ec.tasklist2
-rw-r--r--board/jacuzzi/gpio.inc2
-rw-r--r--board/jacuzzi/led.c39
-rw-r--r--board/jinlon/battery.c2
-rw-r--r--board/jinlon/board.c137
-rw-r--r--board/jinlon/board.h39
-rw-r--r--board/jinlon/build.mk2
-rw-r--r--board/jinlon/ec.tasklist2
-rw-r--r--board/jinlon/gpio.inc6
-rw-r--r--board/jinlon/led.c46
-rw-r--r--board/jinlon/thermal.c132
-rw-r--r--board/kakadu/board.c141
-rw-r--r--board/kakadu/board.h24
-rw-r--r--board/kakadu/build.mk2
-rw-r--r--board/kakadu/ec.tasklist2
-rw-r--r--board/kakadu/gpio.inc2
-rw-r--r--board/kakadu/led.c14
-rw-r--r--board/kano/battery.c2
-rw-r--r--board/kano/board.c25
-rw-r--r--board/kano/board.h138
-rw-r--r--board/kano/build.mk2
-rw-r--r--board/kano/charger.c12
-rw-r--r--board/kano/ec.tasklist2
-rw-r--r--board/kano/fans.c4
-rw-r--r--board/kano/fw_config.c4
-rw-r--r--board/kano/fw_config.h14
-rw-r--r--board/kano/gpio.inc2
-rw-r--r--board/kano/i2c.c2
-rw-r--r--board/kano/keyboard.c6
-rw-r--r--board/kano/led.c39
-rw-r--r--board/kano/pwm.c2
-rw-r--r--board/kano/sensors.c95
-rw-r--r--board/kano/usbc_config.c75
-rw-r--r--board/kano/usbc_config.h10
-rw-r--r--board/kappa/battery.c2
-rw-r--r--board/kappa/board.c82
-rw-r--r--board/kappa/board.h18
-rw-r--r--board/kappa/build.mk2
-rw-r--r--board/kappa/ec.tasklist2
-rw-r--r--board/kappa/gpio.inc2
-rw-r--r--board/kappa/led.c27
-rw-r--r--board/karma/board.c6
-rw-r--r--board/karma/board.h2
-rw-r--r--board/karma/build.mk2
-rw-r--r--board/karma/ec.tasklist2
-rw-r--r--board/karma/gpio.inc2
-rw-r--r--board/katsu/board.c93
-rw-r--r--board/katsu/board.h34
-rw-r--r--board/katsu/build.mk2
-rw-r--r--board/katsu/ec.tasklist2
-rw-r--r--board/katsu/gpio.inc2
-rw-r--r--board/katsu/led.c14
-rw-r--r--board/kindred/battery.c2
-rw-r--r--board/kindred/board.c136
-rw-r--r--board/kindred/board.h36
-rw-r--r--board/kindred/build.mk2
-rw-r--r--board/kindred/ec.tasklist2
-rw-r--r--board/kindred/gpio.inc6
-rw-r--r--board/kindred/led.c39
-rw-r--r--board/kingoftown/battery.c2
-rw-r--r--board/kingoftown/board.c127
-rw-r--r--board/kingoftown/board.h19
-rw-r--r--board/kingoftown/build.mk2
-rw-r--r--board/kingoftown/ec.tasklist2
-rw-r--r--board/kingoftown/gpio.inc2
-rw-r--r--board/kingoftown/hibernate.c8
-rw-r--r--board/kingoftown/led.c61
-rw-r--r--board/kingoftown/switchcap.c2
-rw-r--r--board/kingoftown/usbc_config.c60
-rw-r--r--board/kingoftown/usbc_config.h2
-rw-r--r--board/kinox/board.c58
-rw-r--r--board/kinox/board.h116
-rw-r--r--board/kinox/build.mk2
-rw-r--r--board/kinox/ec.tasklist2
-rw-r--r--board/kinox/fans.c10
-rw-r--r--board/kinox/fw_config.c4
-rw-r--r--board/kinox/fw_config.h8
-rw-r--r--board/kinox/gpio.inc8
-rw-r--r--board/kinox/i2c.c2
-rw-r--r--board/kinox/led.c17
-rw-r--r--board/kinox/power_detection.c375
-rw-r--r--board/kinox/pwm.c35
-rw-r--r--board/kinox/sensors.c52
-rw-r--r--board/kinox/usbc_config.c31
-rw-r--r--board/kinox/usbc_config.h9
-rw-r--r--board/kodama/battery.c10
-rw-r--r--board/kodama/board.c101
-rw-r--r--board/kodama/board.h18
-rw-r--r--board/kodama/build.mk2
-rw-r--r--board/kodama/ec.tasklist2
-rw-r--r--board/kodama/gpio.inc2
-rw-r--r--board/kodama/led.c67
-rw-r--r--board/kohaku/battery.c2
-rw-r--r--board/kohaku/board.c89
-rw-r--r--board/kohaku/board.h64
-rw-r--r--board/kohaku/build.mk2
-rw-r--r--board/kohaku/ec.tasklist2
-rw-r--r--board/kohaku/gpio.inc6
-rw-r--r--board/kohaku/led.c76
-rw-r--r--board/kracko/battery.c2
-rw-r--r--board/kracko/board.c212
-rw-r--r--board/kracko/board.h44
-rw-r--r--board/kracko/build.mk2
-rw-r--r--board/kracko/cbi_ssfc.c6
-rw-r--r--board/kracko/cbi_ssfc.h3
-rw-r--r--board/kracko/ec.tasklist2
-rw-r--r--board/kracko/gpio.inc2
-rw-r--r--board/kracko/led.c36
-rw-r--r--board/kracko/usb_pd_policy.c19
-rw-r--r--board/kukui/board.c109
-rw-r--r--board/kukui/board.h23
-rw-r--r--board/kukui/build.mk2
-rw-r--r--board/kukui/ec.tasklist2
-rw-r--r--board/kukui/gpio.inc2
-rw-r--r--board/kukui/led.c24
-rw-r--r--board/kukui_scp/board.c2
-rw-r--r--board/kukui_scp/board.h56
-rw-r--r--board/kukui_scp/build.mk2
-rw-r--r--board/kukui_scp/ec.tasklist2
-rw-r--r--board/kukui_scp/fd.c13
-rw-r--r--board/kukui_scp/fd.h2
-rw-r--r--board/kukui_scp/gpio.inc2
-rw-r--r--board/kukui_scp/isp_p1_srv.c12
-rw-r--r--board/kukui_scp/isp_p1_srv.h5
-rw-r--r--board/kukui_scp/isp_p2_srv.c12
-rw-r--r--board/kukui_scp/isp_p2_srv.h5
-rw-r--r--board/kukui_scp/mdp_ipi_message.c16
-rw-r--r--board/kukui_scp/mdp_ipi_message.h7
-rwxr-xr-xboard/kukui_scp/update_scp2
-rw-r--r--board/kukui_scp/vdec.c16
-rw-r--r--board/kukui_scp/vdec.h5
-rw-r--r--board/kukui_scp/venc.c12
-rw-r--r--board/kukui_scp/venc.h5
-rw-r--r--board/kuldax/board.c102
-rw-r--r--board/kuldax/board.h131
-rw-r--r--board/kuldax/build.mk2
-rw-r--r--board/kuldax/ec.tasklist7
-rw-r--r--board/kuldax/fans.c10
-rw-r--r--board/kuldax/fw_config.c18
-rw-r--r--board/kuldax/fw_config.h12
-rw-r--r--board/kuldax/gpio.inc67
-rw-r--r--board/kuldax/i2c.c10
-rw-r--r--board/kuldax/led.c23
-rw-r--r--board/kuldax/pwm.c27
-rw-r--r--board/kuldax/sensors.c87
-rw-r--r--board/kuldax/usbc_config.c220
-rw-r--r--board/kuldax/usbc_config.h11
-rw-r--r--board/lalala/battery.c2
-rw-r--r--board/lalala/board.c121
-rw-r--r--board/lalala/board.h56
-rw-r--r--board/lalala/build.mk2
-rw-r--r--board/lalala/cbi_ssfc.c6
-rw-r--r--board/lalala/cbi_ssfc.h3
-rw-r--r--board/lalala/ec.tasklist2
-rw-r--r--board/lalala/gpio.inc2
-rw-r--r--board/lalala/led.c39
-rw-r--r--board/lalala/usb_pd_policy.c6
-rw-r--r--board/lantis/battery.c2
-rw-r--r--board/lantis/board.c211
-rw-r--r--board/lantis/board.h49
-rw-r--r--board/lantis/build.mk2
-rw-r--r--board/lantis/cbi_ssfc.c6
-rw-r--r--board/lantis/cbi_ssfc.h17
-rw-r--r--board/lantis/ec.tasklist2
-rw-r--r--board/lantis/gpio.inc2
-rw-r--r--board/lantis/led.c67
-rw-r--r--board/lantis/usb_pd_policy.c19
-rw-r--r--board/lazor/battery.c2
-rw-r--r--board/lazor/board.c158
-rw-r--r--board/lazor/board.h20
-rw-r--r--board/lazor/build.mk2
-rw-r--r--board/lazor/ec.tasklist2
-rw-r--r--board/lazor/gpio.inc2
-rw-r--r--board/lazor/hibernate.c2
-rw-r--r--board/lazor/led.c27
-rw-r--r--board/lazor/sku.c6
-rw-r--r--board/lazor/sku.h2
-rw-r--r--board/lazor/switchcap.c6
-rw-r--r--board/lazor/usbc_config.c61
-rw-r--r--board/lazor/usbc_config.h2
-rw-r--r--board/liara/battery.c2
-rw-r--r--board/liara/board.c76
-rw-r--r--board/liara/board.h6
-rw-r--r--board/liara/build.mk2
-rw-r--r--board/liara/ec.tasklist2
-rw-r--r--board/liara/gpio.inc2
-rw-r--r--board/liara/led.c13
-rw-r--r--board/lick/battery.c2
-rw-r--r--board/lick/board.c73
-rw-r--r--board/lick/board.h26
-rw-r--r--board/lick/build.mk2
-rw-r--r--board/lick/ec.tasklist2
-rw-r--r--board/lick/gpio.inc2
-rw-r--r--board/lick/led.c51
-rw-r--r--board/lindar/battery.c8
-rw-r--r--board/lindar/board.c86
-rw-r--r--board/lindar/board.h101
-rw-r--r--board/lindar/build.mk2
-rw-r--r--board/lindar/ec.tasklist2
-rw-r--r--board/lindar/gpio.inc4
-rw-r--r--board/lindar/ktd20xx.h32
-rw-r--r--board/lindar/led.c346
-rw-r--r--board/madoo/battery.c4
-rw-r--r--board/madoo/board.c112
-rw-r--r--board/madoo/board.h53
-rw-r--r--board/madoo/build.mk2
-rw-r--r--board/madoo/cbi_ssfc.c6
-rw-r--r--board/madoo/cbi_ssfc.h3
-rw-r--r--board/madoo/ec.tasklist2
-rw-r--r--board/madoo/gpio.inc2
-rw-r--r--board/madoo/led.c76
-rw-r--r--board/madoo/usb_pd_policy.c6
-rw-r--r--board/magolor/battery.c2
-rw-r--r--board/magolor/board.c195
-rw-r--r--board/magolor/board.h62
-rw-r--r--board/magolor/build.mk2
-rw-r--r--board/magolor/cbi_ssfc.c8
-rw-r--r--board/magolor/cbi_ssfc.h14
-rw-r--r--board/magolor/ec.tasklist2
-rw-r--r--board/magolor/gpio.inc2
-rw-r--r--board/magolor/led.c39
-rw-r--r--board/magolor/usb_pd_policy.c6
-rw-r--r--board/makomo/battery.c2
-rw-r--r--board/makomo/board.c123
-rw-r--r--board/makomo/board.h25
-rw-r--r--board/makomo/build.mk2
-rw-r--r--board/makomo/ec.tasklist2
-rw-r--r--board/makomo/gpio.inc2
-rw-r--r--board/makomo/led.c55
-rw-r--r--board/marzipan/battery.c2
-rw-r--r--board/marzipan/board.c198
-rw-r--r--board/marzipan/board.h19
-rw-r--r--board/marzipan/build.mk2
-rw-r--r--board/marzipan/ec.tasklist2
-rw-r--r--board/marzipan/gpio.inc2
-rw-r--r--board/marzipan/led.c27
-rw-r--r--board/marzipan/switchcap.c6
-rw-r--r--board/marzipan/usbc_config.c6
-rw-r--r--board/marzipan/usbc_config.h2
-rw-r--r--board/max32660-eval/board.c2
-rw-r--r--board/max32660-eval/board.h2
-rw-r--r--board/max32660-eval/build.mk2
-rw-r--r--board/max32660-eval/ec.tasklist2
-rw-r--r--board/max32660-eval/gpio.inc2
-rw-r--r--board/mchpevb1/battery.c23
-rw-r--r--board/mchpevb1/board.c172
-rw-r--r--board/mchpevb1/board.h67
-rw-r--r--board/mchpevb1/build.mk2
-rw-r--r--board/mchpevb1/ec.tasklist2
-rw-r--r--board/mchpevb1/gpio.inc2
-rw-r--r--board/mchpevb1/led.c42
-rw-r--r--board/mchpevb1/usb_pd_policy.c18
-rw-r--r--board/meep/battery.c2
-rw-r--r--board/meep/board.c112
-rw-r--r--board/meep/board.h26
-rw-r--r--board/meep/build.mk2
-rw-r--r--board/meep/ec.tasklist2
-rw-r--r--board/meep/gpio.inc2
-rw-r--r--board/meep/led.c67
-rw-r--r--board/metaknight/battery.c2
-rw-r--r--board/metaknight/board.c182
-rw-r--r--board/metaknight/board.h56
-rw-r--r--board/metaknight/build.mk2
-rw-r--r--board/metaknight/cbi_ssfc.c6
-rw-r--r--board/metaknight/cbi_ssfc.h3
-rw-r--r--board/metaknight/ec.tasklist2
-rw-r--r--board/metaknight/gpio.inc2
-rw-r--r--board/metaknight/led.c37
-rw-r--r--board/metaknight/usb_pd_policy.c6
-rw-r--r--board/mithrax/battery.c31
-rw-r--r--board/mithrax/board.c44
-rw-r--r--board/mithrax/board.h161
-rw-r--r--board/mithrax/build.mk2
-rw-r--r--board/mithrax/charger_isl9241.c12
-rw-r--r--board/mithrax/ec.tasklist2
-rw-r--r--board/mithrax/fans.c4
-rw-r--r--board/mithrax/fw_config.c4
-rw-r--r--board/mithrax/fw_config.h42
-rw-r--r--board/mithrax/gpio.inc2
-rw-r--r--board/mithrax/i2c.c2
-rw-r--r--board/mithrax/keyboard.c173
-rw-r--r--board/mithrax/keyboard_customization.c89
-rw-r--r--board/mithrax/keyboard_customization.h76
-rw-r--r--board/mithrax/led.c41
-rw-r--r--board/mithrax/pwm.c2
-rw-r--r--board/mithrax/sensors.c60
-rw-r--r--board/mithrax/usbc_config.c124
-rw-r--r--board/mithrax/usbc_config.h12
-rw-r--r--board/moli/board.c56
-rw-r--r--board/moli/board.h122
-rw-r--r--board/moli/build.mk3
-rw-r--r--board/moli/ec.tasklist2
-rw-r--r--board/moli/fans.c16
-rw-r--r--board/moli/gpio.inc8
-rw-r--r--board/moli/i2c.c2
-rw-r--r--board/moli/led.c65
-rw-r--r--board/moli/pwm.c35
-rw-r--r--board/moli/sensors.c78
-rw-r--r--board/moli/thermal.c143
-rw-r--r--board/moli/usbc_config.c58
-rw-r--r--board/moli/usbc_config.h10
-rw-r--r--board/moonbuggy/board.c141
-rw-r--r--board/moonbuggy/board.h87
-rw-r--r--board/moonbuggy/build.mk2
-rw-r--r--board/moonbuggy/ec.tasklist2
-rw-r--r--board/moonbuggy/gpio.inc6
-rw-r--r--board/moonbuggy/led.c17
-rw-r--r--board/moonbuggy/pse.c85
-rw-r--r--board/morphius/battery.c2
-rw-r--r--board/morphius/board.c133
-rw-r--r--board/morphius/board.h86
-rw-r--r--board/morphius/build.mk2
-rw-r--r--board/morphius/ec.tasklist2
-rw-r--r--board/morphius/gpio.inc2
-rw-r--r--board/morphius/led.c44
-rw-r--r--board/morphius/thermal.c328
-rw-r--r--board/mrbland/base_detect.c17
-rw-r--r--board/mrbland/battery.c2
-rw-r--r--board/mrbland/board.c150
-rw-r--r--board/mrbland/board.h13
-rw-r--r--board/mrbland/build.mk2
-rw-r--r--board/mrbland/ec.tasklist2
-rw-r--r--board/mrbland/gpio.inc2
-rw-r--r--board/mrbland/led.c37
-rw-r--r--board/mrbland/usbc_config.c6
-rw-r--r--board/munna/battery.c2
-rw-r--r--board/munna/board.c127
-rw-r--r--board/munna/board.h47
-rw-r--r--board/munna/build.mk2
-rw-r--r--board/munna/ec.tasklist2
-rw-r--r--board/munna/gpio.inc2
-rw-r--r--board/munna/led.c55
-rw-r--r--board/mushu/battery.c2
-rw-r--r--board/mushu/board.c142
-rw-r--r--board/mushu/board.h56
-rw-r--r--board/mushu/build.mk2
-rw-r--r--board/mushu/ec.tasklist2
-rw-r--r--board/mushu/gpio.inc6
-rw-r--r--board/mushu/led.c36
-rw-r--r--board/mushu/thermal.c5
-rw-r--r--board/nami/battery.c23
-rw-r--r--board/nami/board.c239
-rw-r--r--board/nami/board.h79
-rw-r--r--board/nami/build.mk2
-rw-r--r--board/nami/ec.tasklist2
-rw-r--r--board/nami/gpio.inc2
-rw-r--r--board/nami/led.c138
-rw-r--r--board/nami/usb_pd_policy.c16
-rw-r--r--board/nautilus/battery.c24
-rw-r--r--board/nautilus/board.c176
-rw-r--r--board/nautilus/board.h71
-rw-r--r--board/nautilus/build.mk2
-rw-r--r--board/nautilus/ec.tasklist2
-rw-r--r--board/nautilus/gpio.inc6
-rw-r--r--board/nautilus/led.c35
-rw-r--r--board/nautilus/usb_pd_policy.c30
-rw-r--r--board/nightfury/battery.c14
-rw-r--r--board/nightfury/board.c99
-rw-r--r--board/nightfury/board.h60
-rw-r--r--board/nightfury/build.mk2
-rw-r--r--board/nightfury/ec.tasklist2
-rw-r--r--board/nightfury/gpio.inc6
-rw-r--r--board/nightfury/led.c78
-rw-r--r--board/nipperkin/battery.c2
-rw-r--r--board/nipperkin/board.c93
-rw-r--r--board/nipperkin/board.h10
-rw-r--r--board/nipperkin/board_fw_config.c9
-rw-r--r--board/nipperkin/board_fw_config.h18
-rw-r--r--board/nipperkin/build.mk2
-rw-r--r--board/nipperkin/ec.tasklist2
-rw-r--r--board/nipperkin/gpio.inc2
-rw-r--r--board/nipperkin/led.c80
-rw-r--r--board/nipperkin/thermal.c102
-rw-r--r--board/nocturne/base_detect.c40
-rw-r--r--board/nocturne/battery.c34
-rw-r--r--board/nocturne/board.c193
-rw-r--r--board/nocturne/board.h99
-rw-r--r--board/nocturne/build.mk2
-rw-r--r--board/nocturne/ec.tasklist2
-rw-r--r--board/nocturne/gpio.inc2
-rw-r--r--board/nocturne/led.c46
-rw-r--r--board/nocturne/usb_pd_policy.c14
-rw-r--r--board/nocturne_fp/board.h36
-rw-r--r--board/nocturne_fp/board_ro.c3
-rw-r--r--board/nocturne_fp/board_rw.c2
-rw-r--r--board/nocturne_fp/board_rw.h2
-rw-r--r--board/nocturne_fp/build.mk4
-rw-r--r--board/nocturne_fp/ec.tasklist2
-rw-r--r--board/nocturne_fp/fpsensor_detect.c2
-rw-r--r--board/nocturne_fp/fpsensor_detect_rw.c2
-rw-r--r--board/nocturne_fp/gpio.inc2
-rw-r--r--board/nocturne_fp/gpio_rw.inc2
-rw-r--r--board/nocturne_fp/ro_workarounds.c9
-rw-r--r--board/npcx7_evb/board.c85
-rw-r--r--board/npcx7_evb/board.h30
-rw-r--r--board/npcx7_evb/build.mk2
-rw-r--r--board/npcx7_evb/ec.tasklist2
-rw-r--r--board/npcx7_evb/gpio.inc2
-rw-r--r--board/npcx9_evb/board.c104
-rw-r--r--board/npcx9_evb/board.h24
-rw-r--r--board/npcx9_evb/build.mk2
-rw-r--r--board/npcx9_evb/ec.tasklist2
-rw-r--r--board/npcx9_evb/gpio.inc2
-rw-r--r--board/npcx_evb/board.c83
-rw-r--r--board/npcx_evb/board.h27
-rw-r--r--board/npcx_evb/build.mk2
-rw-r--r--board/npcx_evb/ec.tasklist2
-rw-r--r--board/npcx_evb/gpio.inc2
-rw-r--r--board/npcx_evb_arm/board.c77
-rw-r--r--board/npcx_evb_arm/board.h32
-rw-r--r--board/npcx_evb_arm/build.mk2
-rw-r--r--board/npcx_evb_arm/ec.tasklist2
-rw-r--r--board/npcx_evb_arm/gpio.inc2
-rw-r--r--board/nucleo-dartmonkey/board.c8
-rw-r--r--board/nucleo-dartmonkey/board.h30
-rw-r--r--board/nucleo-dartmonkey/build.mk4
-rw-r--r--board/nucleo-dartmonkey/ec.tasklist2
-rw-r--r--board/nucleo-dartmonkey/fpsensor_detect.c2
-rw-r--r--board/nucleo-dartmonkey/gpio.inc2
-rw-r--r--board/nucleo-f072rb/board.c25
-rw-r--r--board/nucleo-f072rb/board.h4
-rw-r--r--board/nucleo-f072rb/build.mk2
-rw-r--r--board/nucleo-f072rb/ec.tasklist2
-rw-r--r--board/nucleo-f072rb/gpio.inc2
-rw-r--r--board/nucleo-f072rb/openocd-flash.cfg2
-rw-r--r--board/nucleo-f411re/board.c27
-rw-r--r--board/nucleo-f411re/board.h5
-rw-r--r--board/nucleo-f411re/build.mk2
-rw-r--r--board/nucleo-f411re/ec.tasklist2
-rw-r--r--board/nucleo-f411re/gpio.inc2
-rw-r--r--board/nucleo-f411re/openocd-flash.cfg2
-rw-r--r--board/nucleo-f412zg/board.c6
-rw-r--r--board/nucleo-f412zg/board.h4
-rw-r--r--board/nucleo-f412zg/build.mk4
-rw-r--r--board/nucleo-f412zg/ec.tasklist2
-rw-r--r--board/nucleo-f412zg/gpio.inc2
-rw-r--r--board/nucleo-g431rb/board.c3
-rw-r--r--board/nucleo-g431rb/board.h13
-rw-r--r--board/nucleo-g431rb/build.mk2
-rw-r--r--board/nucleo-g431rb/ec.tasklist2
-rw-r--r--board/nucleo-g431rb/gpio.inc2
-rw-r--r--board/nucleo-h743zi/board.c6
-rw-r--r--board/nucleo-h743zi/board.h4
-rw-r--r--board/nucleo-h743zi/build.mk4
-rw-r--r--board/nucleo-h743zi/ec.tasklist2
-rw-r--r--board/nucleo-h743zi/gpio.inc2
-rw-r--r--board/nuwani/battery.c2
-rw-r--r--board/nuwani/board.c96
-rw-r--r--board/nuwani/board.h7
-rw-r--r--board/nuwani/build.mk2
-rw-r--r--board/nuwani/ec.tasklist2
-rw-r--r--board/nuwani/gpio.inc2
-rw-r--r--board/nuwani/led.c55
-rw-r--r--board/oak/battery.c14
-rw-r--r--board/oak/board.c137
-rw-r--r--board/oak/board.h48
-rw-r--r--board/oak/board_revs.h4
-rw-r--r--board/oak/build.mk2
-rw-r--r--board/oak/ec.tasklist2
-rw-r--r--board/oak/gpio.inc2
-rw-r--r--board/oak/led.c30
-rw-r--r--board/oak/usb_pd_policy.c15
-rw-r--r--board/osiris/battery.c109
-rw-r--r--board/osiris/board.c22
-rw-r--r--board/osiris/board.h138
-rw-r--r--board/osiris/build.mk2
-rw-r--r--board/osiris/charger.c12
-rw-r--r--board/osiris/ec.tasklist2
-rw-r--r--board/osiris/fans.c177
-rw-r--r--board/osiris/fw_config.c4
-rw-r--r--board/osiris/fw_config.h10
-rw-r--r--board/osiris/gpio.inc10
-rw-r--r--board/osiris/i2c.c4
-rw-r--r--board/osiris/keyboard.c216
-rw-r--r--board/osiris/led.c39
-rw-r--r--board/osiris/pwm.c34
-rw-r--r--board/osiris/sensors.c23
-rw-r--r--board/osiris/usbc_config.c61
-rw-r--r--board/osiris/usbc_config.h10
-rw-r--r--board/palkia/battery.c2
-rw-r--r--board/palkia/board.c85
-rw-r--r--board/palkia/board.h38
-rw-r--r--board/palkia/build.mk2
-rw-r--r--board/palkia/ec.tasklist2
-rw-r--r--board/palkia/gpio.inc6
-rw-r--r--board/palkia/keyboard_customization.c90
-rw-r--r--board/palkia/keyboard_customization.h76
-rw-r--r--board/palkia/led.c52
-rw-r--r--board/panqueque/board.c100
-rw-r--r--board/panqueque/board.h14
-rw-r--r--board/panqueque/build.mk2
-rw-r--r--board/panqueque/ec.tasklist2
-rw-r--r--board/panqueque/gpio.inc2
-rw-r--r--board/pazquel/battery.c2
-rw-r--r--board/pazquel/board.c426
-rw-r--r--board/pazquel/board.h34
-rw-r--r--board/pazquel/build.mk2
-rw-r--r--board/pazquel/ec.tasklist2
-rw-r--r--board/pazquel/gpio.inc8
-rw-r--r--board/pazquel/led.c27
-rw-r--r--board/pazquel/usbc_config.c6
-rw-r--r--board/pdeval-stm32f072/PD_evaluation.md4
-rw-r--r--board/pdeval-stm32f072/board.c24
-rw-r--r--board/pdeval-stm32f072/board.h17
-rw-r--r--board/pdeval-stm32f072/build.mk2
-rw-r--r--board/pdeval-stm32f072/ec.tasklist2
-rw-r--r--board/pdeval-stm32f072/gpio.inc2
-rw-r--r--board/pdeval-stm32f072/openocd-flash.cfg2
-rw-r--r--board/pdeval-stm32f072/usb_pd_pdo.c2
-rw-r--r--board/pdeval-stm32f072/usb_pd_pdo.h2
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c100
-rw-r--r--board/phaser/battery.c2
-rw-r--r--board/phaser/board.c93
-rw-r--r--board/phaser/board.h30
-rw-r--r--board/phaser/build.mk2
-rw-r--r--board/phaser/ec.tasklist2
-rw-r--r--board/phaser/gpio.inc2
-rw-r--r--board/phaser/led.c51
-rw-r--r--board/pico/battery.c2
-rw-r--r--board/pico/board.c125
-rw-r--r--board/pico/board.h22
-rw-r--r--board/pico/build.mk2
-rw-r--r--board/pico/ec.tasklist2
-rw-r--r--board/pico/gpio.inc2
-rw-r--r--board/pico/led.c39
-rw-r--r--board/pirika/battery.c2
-rw-r--r--board/pirika/board.c177
-rw-r--r--board/pirika/board.h38
-rw-r--r--board/pirika/build.mk2
-rw-r--r--board/pirika/cbi_ssfc.c6
-rw-r--r--board/pirika/cbi_ssfc.h3
-rw-r--r--board/pirika/ec.tasklist2
-rw-r--r--board/pirika/gpio.inc2
-rw-r--r--board/pirika/led.c45
-rw-r--r--board/pirika/usb_pd_policy.c6
-rw-r--r--board/plankton/board.c106
-rw-r--r--board/plankton/board.h16
-rw-r--r--board/plankton/build.mk2
-rw-r--r--board/plankton/ec.tasklist2
-rw-r--r--board/plankton/gpio.inc2
-rw-r--r--board/plankton/usb_pd_config.h18
-rw-r--r--board/plankton/usb_pd_pdo.c24
-rw-r--r--board/plankton/usb_pd_pdo.h2
-rw-r--r--board/plankton/usb_pd_policy.c45
-rw-r--r--board/polyberry/board.c40
-rw-r--r--board/polyberry/board.h16
-rw-r--r--board/polyberry/build.mk2
-rw-r--r--board/polyberry/ec.tasklist2
-rw-r--r--board/polyberry/gpio.inc2
-rw-r--r--board/pompom/battery.c2
-rw-r--r--board/pompom/board.c154
-rw-r--r--board/pompom/board.h17
-rw-r--r--board/pompom/board_revs.h5
-rw-r--r--board/pompom/build.mk2
-rw-r--r--board/pompom/ec.tasklist2
-rw-r--r--board/pompom/gpio.inc2
-rw-r--r--board/pompom/led.c29
-rw-r--r--board/pompom/usbc_config.c6
-rw-r--r--board/poppy/base_detect_lux.c17
-rw-r--r--board/poppy/base_detect_poppy.c13
-rw-r--r--board/poppy/battery.c23
-rw-r--r--board/poppy/board.c212
-rw-r--r--board/poppy/board.h70
-rw-r--r--board/poppy/build.mk2
-rw-r--r--board/poppy/ec.tasklist2
-rw-r--r--board/poppy/gpio.inc8
-rw-r--r--board/poppy/led.c31
-rw-r--r--board/poppy/usb_pd_policy.c29
-rw-r--r--board/primus/battery.c97
-rw-r--r--board/primus/board.c31
-rw-r--r--board/primus/board.h137
-rw-r--r--board/primus/build.mk2
-rw-r--r--board/primus/cbi_ssfc.c2
-rw-r--r--board/primus/cbi_ssfc.h2
-rw-r--r--[l---------]board/primus/charger.c91
-rw-r--r--board/primus/ec.tasklist2
-rw-r--r--board/primus/fans.c4
-rw-r--r--board/primus/fw_config.c4
-rw-r--r--board/primus/fw_config.h23
-rw-r--r--board/primus/gpio.inc2
-rw-r--r--board/primus/i2c.c2
-rw-r--r--board/primus/keyboard.c2
-rw-r--r--board/primus/led.c64
-rw-r--r--board/primus/ps2.c20
-rw-r--r--board/primus/ps2.h20
-rw-r--r--board/primus/pwm.c2
-rw-r--r--board/primus/sensors.c64
-rw-r--r--board/primus/thermal.c66
-rw-r--r--board/primus/usbc_config.c61
-rw-r--r--board/primus/usbc_config.h10
-rw-r--r--board/prism/board.c304
-rw-r--r--board/prism/board.h78
-rw-r--r--board/prism/build.mk2
-rw-r--r--board/prism/ec.tasklist2
-rw-r--r--board/prism/gpio.inc5
-rw-r--r--board/puff/board.c194
-rw-r--r--board/puff/board.h108
-rw-r--r--board/puff/build.mk2
-rw-r--r--board/puff/ec.tasklist2
-rw-r--r--board/puff/gpio.inc6
-rw-r--r--board/puff/led.c14
-rw-r--r--board/puff/usb_pd_policy.c7
-rw-r--r--board/quackingstick/base_detect.c12
-rw-r--r--board/quackingstick/battery.c2
-rw-r--r--board/quackingstick/board.c133
-rw-r--r--board/quackingstick/board.h19
-rw-r--r--board/quackingstick/build.mk2
-rw-r--r--board/quackingstick/ec.tasklist2
-rw-r--r--board/quackingstick/gpio.inc2
-rw-r--r--board/quackingstick/led.c31
-rw-r--r--board/quackingstick/usbc_config.c25
-rw-r--r--board/quiche/board.c128
-rw-r--r--board/quiche/board.h17
-rw-r--r--board/quiche/build.mk2
-rw-r--r--board/quiche/ec.tasklist2
-rw-r--r--board/quiche/gpio.inc2
-rw-r--r--board/rainier/board.c114
-rw-r--r--board/rainier/board.h32
-rw-r--r--board/rainier/build.mk2
-rw-r--r--board/rainier/ec.tasklist2
-rw-r--r--board/rainier/gpio.inc2
-rw-r--r--board/rainier/usb_pd_policy.c6
-rw-r--r--board/rammus/battery.c19
-rw-r--r--board/rammus/board.c168
-rw-r--r--board/rammus/board.h110
-rw-r--r--board/rammus/build.mk2
-rw-r--r--board/rammus/cbi_ssfc.c4
-rw-r--r--board/rammus/cbi_ssfc.h2
-rw-r--r--board/rammus/ec.tasklist2
-rw-r--r--board/rammus/gpio.inc2
-rw-r--r--board/rammus/led.c48
-rw-r--r--board/rammus/usb_pd_policy.c19
-rw-r--r--board/redrix/battery.c2
-rw-r--r--board/redrix/board.c6
-rw-r--r--board/redrix/board.h158
-rw-r--r--board/redrix/build.mk2
-rw-r--r--board/redrix/cbi_ssfc.c2
-rw-r--r--board/redrix/cbi_ssfc.h2
-rw-r--r--[l---------]board/redrix/charger.c91
-rw-r--r--board/redrix/ec.tasklist2
-rw-r--r--board/redrix/fans.c6
-rw-r--r--board/redrix/fw_config.c4
-rw-r--r--board/redrix/fw_config.h21
-rw-r--r--board/redrix/gpio.inc2
-rw-r--r--board/redrix/i2c.c2
-rw-r--r--board/redrix/keyboard.c15
-rw-r--r--board/redrix/led.c77
-rw-r--r--board/redrix/pwm.c2
-rw-r--r--board/redrix/sensors.c76
-rw-r--r--board/redrix/thermal.c116
-rw-r--r--board/redrix/usbc_config.c58
-rw-r--r--board/redrix/usbc_config.h10
-rw-r--r--board/reef/battery.c59
-rw-r--r--board/reef/board.c188
-rw-r--r--board/reef/board.h62
-rw-r--r--board/reef/build.mk2
-rw-r--r--board/reef/ec.tasklist2
-rw-r--r--board/reef/gpio.inc2
-rw-r--r--board/reef/led.c33
-rw-r--r--board/reef/usb_pd_policy.c13
-rw-r--r--board/reef_it8320/battery.c57
-rw-r--r--board/reef_it8320/board.c142
-rw-r--r--board/reef_it8320/board.h40
-rw-r--r--board/reef_it8320/build.mk2
-rw-r--r--board/reef_it8320/ec.tasklist2
-rw-r--r--board/reef_it8320/gpio.inc2
-rw-r--r--board/reef_it8320/led.c33
-rw-r--r--board/reef_it8320/usb_pd_policy.c12
-rw-r--r--board/reef_mchp/battery.c62
-rw-r--r--board/reef_mchp/board.c170
-rw-r--r--board/reef_mchp/board.h63
-rw-r--r--board/reef_mchp/build.mk2
-rw-r--r--board/reef_mchp/ec.tasklist2
-rw-r--r--board/reef_mchp/gpio.inc2
-rw-r--r--board/reef_mchp/led.c24
-rw-r--r--board/reef_mchp/usb_pd_policy.c13
-rw-r--r--board/sasuke/battery.c9
-rw-r--r--board/sasuke/board.c389
-rw-r--r--board/sasuke/board.h46
-rw-r--r--board/sasuke/build.mk2
-rw-r--r--board/sasuke/cbi_ssfc.c8
-rw-r--r--board/sasuke/cbi_ssfc.h3
-rw-r--r--board/sasuke/ec.tasklist2
-rw-r--r--board/sasuke/gpio.inc2
-rw-r--r--board/sasuke/led.c90
-rw-r--r--board/sasuke/usb_pd_policy.c6
-rw-r--r--board/sasukette/battery.c10
-rw-r--r--board/sasukette/board.c120
-rw-r--r--board/sasukette/board.h15
-rw-r--r--board/sasukette/build.mk2
-rw-r--r--board/sasukette/cbi_ssfc.c6
-rw-r--r--board/sasukette/cbi_ssfc.h3
-rw-r--r--board/sasukette/ec.tasklist2
-rw-r--r--board/sasukette/gpio.inc2
-rw-r--r--board/sasukette/led.c69
-rw-r--r--board/sasukette/usb_pd_policy.c6
-rw-r--r--board/scarlet/battery.c20
-rw-r--r--board/scarlet/board.c122
-rw-r--r--board/scarlet/board.h47
-rw-r--r--board/scarlet/build.mk2
-rw-r--r--board/scarlet/ec.tasklist2
-rw-r--r--board/scarlet/gpio.inc2
-rw-r--r--board/scarlet/led.c30
-rw-r--r--board/scarlet/usb_pd_policy.c7
-rw-r--r--board/scout/board.c147
-rw-r--r--board/scout/board.h96
-rw-r--r--board/scout/build.mk2
-rw-r--r--board/scout/ec.tasklist2
-rw-r--r--board/scout/gpio.inc6
-rw-r--r--board/scout/led.c14
-rw-r--r--board/servo_micro/board.c158
-rw-r--r--board/servo_micro/board.h49
-rw-r--r--board/servo_micro/build.mk2
-rw-r--r--board/servo_micro/ccd.md2
-rw-r--r--board/servo_micro/ec.tasklist2
-rw-r--r--board/servo_micro/gpio.inc2
-rw-r--r--board/servo_v4/board.c183
-rw-r--r--board/servo_v4/board.h59
-rw-r--r--board/servo_v4/build.mk2
-rw-r--r--board/servo_v4/ec.tasklist2
-rw-r--r--board/servo_v4/gpio.inc2
-rw-r--r--board/servo_v4/usb_pd_config.h55
-rw-r--r--board/servo_v4/usb_pd_pdo.c10
-rw-r--r--board/servo_v4/usb_pd_pdo.h2
-rw-r--r--board/servo_v4/usb_pd_policy.c239
-rw-r--r--board/servo_v4p1/board.c179
-rw-r--r--board/servo_v4p1/board.h89
-rw-r--r--board/servo_v4p1/build.mk2
-rw-r--r--board/servo_v4p1/ccd_measure_sbu.c22
-rw-r--r--board/servo_v4p1/ccd_measure_sbu.h2
-rw-r--r--board/servo_v4p1/chg_control.c24
-rw-r--r--board/servo_v4p1/chg_control.h8
-rw-r--r--board/servo_v4p1/dacs.c25
-rw-r--r--board/servo_v4p1/dacs.h2
-rw-r--r--board/servo_v4p1/ec.tasklist2
-rw-r--r--board/servo_v4p1/fusb302b.c4
-rw-r--r--board/servo_v4p1/fusb302b.h320
-rw-r--r--board/servo_v4p1/gpio.inc2
-rw-r--r--board/servo_v4p1/ina231s.c8
-rw-r--r--board/servo_v4p1/ina231s.h2
-rw-r--r--board/servo_v4p1/ioexpanders.c49
-rw-r--r--board/servo_v4p1/ioexpanders.h27
-rw-r--r--board/servo_v4p1/pathsel.c2
-rw-r--r--board/servo_v4p1/pathsel.h2
-rw-r--r--board/servo_v4p1/pi3usb9201.c6
-rw-r--r--board/servo_v4p1/pi3usb9201.h40
-rw-r--r--board/servo_v4p1/usb_pd_config.h64
-rw-r--r--board/servo_v4p1/usb_pd_policy.c265
-rw-r--r--board/servo_v4p1/usb_sm.c30
-rw-r--r--board/servo_v4p1/usb_tc_snk_sm.c20
-rw-r--r--board/shotzo/battery.c349
-rw-r--r--board/shotzo/board.c791
-rw-r--r--board/shotzo/board.h154
-rw-r--r--board/shotzo/build.mk5
-rw-r--r--board/shotzo/ec.tasklist12
-rw-r--r--board/shotzo/gpio.inc77
-rw-r--r--board/shotzo/led.c306
-rw-r--r--board/shotzo/usb_pd_policy.c27
-rw-r--r--board/shuboz/battery.c4
-rw-r--r--board/shuboz/board.c89
-rw-r--r--board/shuboz/board.h89
-rw-r--r--board/shuboz/build.mk2
-rw-r--r--board/shuboz/ec.tasklist2
-rw-r--r--board/shuboz/gpio.inc2
-rw-r--r--board/shuboz/led.c45
-rw-r--r--board/spherion/battery.c11
-rw-r--r--board/spherion/board.c52
-rw-r--r--board/spherion/board.h21
-rw-r--r--board/spherion/build.mk2
-rw-r--r--board/spherion/ec.tasklist2
-rw-r--r--board/spherion/gpio.inc2
-rw-r--r--board/spherion/led.c40
-rw-r--r--board/stern/battery.c2
-rw-r--r--board/stern/board.c101
-rw-r--r--board/stern/board.h24
-rw-r--r--board/stern/build.mk2
-rw-r--r--board/stern/ec.tasklist2
-rw-r--r--board/stern/gpio.inc2
-rw-r--r--board/stern/led.c53
-rw-r--r--board/stm32f446e-eval/board.c76
-rw-r--r--board/stm32f446e-eval/board.h6
-rw-r--r--board/stm32f446e-eval/build.mk2
-rw-r--r--board/stm32f446e-eval/ec.tasklist2
-rw-r--r--board/stm32f446e-eval/gpio.inc2
-rw-r--r--board/stm32l476g-eval/board.c16
-rw-r--r--board/stm32l476g-eval/board.h14
-rw-r--r--board/stm32l476g-eval/build.mk2
-rw-r--r--board/stm32l476g-eval/ec.tasklist2
-rw-r--r--board/stm32l476g-eval/gpio.inc2
-rw-r--r--board/stm32l476g-eval/openocd-flash.cfg2
-rw-r--r--board/storo/battery.c2
-rw-r--r--board/storo/board.c334
-rw-r--r--board/storo/board.h44
-rw-r--r--board/storo/build.mk2
-rw-r--r--board/storo/cbi_ssfc.c6
-rw-r--r--board/storo/cbi_ssfc.h3
-rw-r--r--board/storo/ec.tasklist2
-rw-r--r--board/storo/gpio.inc2
-rw-r--r--board/storo/led.c45
-rw-r--r--board/storo/usb_pd_policy.c6
-rw-r--r--board/stryke/battery.c2
-rw-r--r--board/stryke/board.c84
-rw-r--r--board/stryke/board.h38
-rw-r--r--board/stryke/build.mk2
-rw-r--r--board/stryke/ec.tasklist2
-rw-r--r--board/stryke/gpio.inc6
-rw-r--r--board/stryke/led.c36
-rw-r--r--board/sweetberry/board.c111
-rw-r--r--board/sweetberry/board.h34
-rw-r--r--board/sweetberry/build.mk2
-rw-r--r--board/sweetberry/ec.tasklist2
-rw-r--r--board/sweetberry/gpio.inc2
-rw-r--r--board/taeko/battery.c8
-rw-r--r--board/taeko/board.c17
-rw-r--r--board/taeko/board.h151
-rw-r--r--board/taeko/build.mk2
-rw-r--r--[l---------]board/taeko/charger.c91
-rw-r--r--board/taeko/ec.tasklist2
-rw-r--r--board/taeko/fans.c4
-rw-r--r--board/taeko/fw_config.c4
-rw-r--r--board/taeko/fw_config.h32
-rw-r--r--board/taeko/gpio.inc2
-rw-r--r--board/taeko/i2c.c2
-rw-r--r--board/taeko/keyboard.c60
-rw-r--r--board/taeko/led.c63
-rw-r--r--board/taeko/pwm.c3
-rw-r--r--board/taeko/sensors.c99
-rw-r--r--board/taeko/usbc_config.c72
-rw-r--r--board/taeko/usbc_config.h10
-rw-r--r--board/taniks/battery.c8
-rw-r--r--board/taniks/board.c19
-rw-r--r--board/taniks/board.h203
-rw-r--r--board/taniks/build.mk2
-rw-r--r--[l---------]board/taniks/charger.c91
-rw-r--r--board/taniks/ec.tasklist4
-rw-r--r--board/taniks/fans.c4
-rw-r--r--board/taniks/fw_config.c6
-rw-r--r--board/taniks/fw_config.h30
-rw-r--r--board/taniks/gpio.inc2
-rw-r--r--board/taniks/i2c.c5
-rw-r--r--board/taniks/keyboard.c200
-rw-r--r--board/taniks/led.c63
-rw-r--r--board/taniks/pwm.c10
-rw-r--r--board/taniks/sensors.c72
-rw-r--r--board/taniks/usbc_config.c72
-rw-r--r--board/taniks/usbc_config.h10
-rw-r--r--board/terrador/battery.c2
-rw-r--r--board/terrador/board.c66
-rw-r--r--board/terrador/board.h116
-rw-r--r--board/terrador/build.mk2
-rw-r--r--board/terrador/ec.tasklist2
-rw-r--r--board/terrador/gpio.inc4
-rw-r--r--board/terrador/led.c16
-rw-r--r--board/terrador/sensors.c18
-rw-r--r--board/tglrvp_ish/board.c8
-rw-r--r--board/tglrvp_ish/board.h15
-rw-r--r--board/tglrvp_ish/build.mk2
-rw-r--r--board/tglrvp_ish/ec.tasklist2
-rw-r--r--board/tglrvp_ish/gpio.inc2
-rw-r--r--board/tigertail/board.c103
-rw-r--r--board/tigertail/board.h29
-rw-r--r--board/tigertail/build.mk2
-rw-r--r--board/tigertail/ec.tasklist2
-rw-r--r--board/tigertail/gpio.inc2
-rw-r--r--board/treeya/battery.c2
-rw-r--r--board/treeya/board.c106
-rw-r--r--board/treeya/board.h7
-rw-r--r--board/treeya/build.mk2
-rw-r--r--board/treeya/ec.tasklist2
-rw-r--r--board/treeya/gpio.inc2
-rw-r--r--board/treeya/led.c55
-rw-r--r--board/trembyle/battery.c2
-rw-r--r--board/trembyle/board.c80
-rw-r--r--board/trembyle/board.h110
-rw-r--r--board/trembyle/build.mk2
-rw-r--r--board/trembyle/ec.tasklist2
-rw-r--r--board/trembyle/gpio.inc2
-rw-r--r--board/trembyle/led.c40
-rw-r--r--board/trogdor/battery.c2
-rw-r--r--board/trogdor/board.c115
-rw-r--r--board/trogdor/board.h19
-rw-r--r--board/trogdor/build.mk2
-rw-r--r--board/trogdor/ec.tasklist2
-rw-r--r--board/trogdor/gpio.inc2
-rw-r--r--board/trogdor/hibernate.c8
-rw-r--r--board/trogdor/led.c28
-rw-r--r--board/trogdor/switchcap.c2
-rw-r--r--board/trogdor/usbc_config.c60
-rw-r--r--board/trogdor/usbc_config.h2
-rw-r--r--board/twinkie/board.c24
-rw-r--r--board/twinkie/board.h36
-rw-r--r--board/twinkie/build.mk2
-rw-r--r--board/twinkie/ec.tasklist2
-rw-r--r--board/twinkie/gpio.inc2
-rw-r--r--board/twinkie/injector.c88
-rw-r--r--board/twinkie/injector.h60
-rw-r--r--board/twinkie/simpletrace.c112
-rw-r--r--board/twinkie/sniffer.c72
-rw-r--r--board/twinkie/usb_pd_config.h23
-rw-r--r--board/twinkie/usb_pd_pdo.c14
-rw-r--r--board/twinkie/usb_pd_pdo.h2
-rw-r--r--board/twinkie/usb_pd_policy.c18
-rw-r--r--board/vell/battery.c2
-rw-r--r--board/vell/board.c7
-rw-r--r--board/vell/board.h144
-rw-r--r--board/vell/build.mk2
-rw-r--r--board/vell/charger.c16
-rw-r--r--board/vell/ec.tasklist2
-rw-r--r--board/vell/fans.c4
-rw-r--r--board/vell/fw_config.c4
-rw-r--r--board/vell/fw_config.h14
-rw-r--r--board/vell/gpio.inc10
-rw-r--r--board/vell/i2c.c2
-rw-r--r--board/vell/keyboard.c15
-rw-r--r--board/vell/led.c75
-rw-r--r--board/vell/pwm.c2
-rw-r--r--board/vell/sensors.c65
-rw-r--r--board/vell/thermal.c60
-rw-r--r--board/vell/usbc_config.c117
-rw-r--r--board/vell/usbc_config.h4
-rw-r--r--board/vilboz/battery.c8
-rw-r--r--board/vilboz/board.c62
-rw-r--r--board/vilboz/board.h77
-rw-r--r--board/vilboz/build.mk2
-rw-r--r--board/vilboz/ec.tasklist2
-rw-r--r--board/vilboz/gpio.inc2
-rw-r--r--board/vilboz/led.c59
-rw-r--r--board/voema/battery.c2
-rw-r--r--board/voema/board.c81
-rw-r--r--board/voema/board.h108
-rw-r--r--board/voema/build.mk2
-rw-r--r--board/voema/ec.tasklist2
-rw-r--r--board/voema/gpio.inc4
-rw-r--r--board/voema/led.c39
-rw-r--r--board/voema/sensors.c54
-rw-r--r--board/volet/battery.c2
-rw-r--r--board/volet/board.c79
-rw-r--r--board/volet/board.h107
-rw-r--r--board/volet/build.mk2
-rw-r--r--board/volet/ec.tasklist2
-rw-r--r--board/volet/gpio.inc4
-rw-r--r--board/volet/led.c39
-rw-r--r--board/volet/sensors.c31
-rw-r--r--board/volmar/battery.c107
-rw-r--r--board/volmar/board.c23
-rw-r--r--board/volmar/board.h123
-rw-r--r--board/volmar/build.mk2
-rw-r--r--board/volmar/charger.c12
-rw-r--r--board/volmar/ec.tasklist2
-rw-r--r--board/volmar/fans.c10
-rw-r--r--board/volmar/fw_config.c4
-rw-r--r--board/volmar/fw_config.h14
-rw-r--r--board/volmar/gpio.inc4
-rw-r--r--board/volmar/i2c.c4
-rw-r--r--board/volmar/keyboard.c6
-rw-r--r--board/volmar/led.c39
-rw-r--r--board/volmar/pwm.c2
-rw-r--r--board/volmar/sensors.c44
-rw-r--r--board/volmar/usbc_config.c44
-rw-r--r--board/volmar/usbc_config.h10
-rw-r--r--board/volteer/battery.c2
-rw-r--r--board/volteer/board.c12
-rw-r--r--board/volteer/board.h113
-rw-r--r--board/volteer/build.mk2
-rw-r--r--board/volteer/cbi.c2
-rw-r--r--board/volteer/ec.tasklist2
-rw-r--r--board/volteer/gpio.inc4
-rw-r--r--board/volteer/led.c16
-rw-r--r--board/volteer/sensors.c18
-rw-r--r--board/volteer/usbc_config.c98
-rw-r--r--board/volteer/usbc_config.h8
-rw-r--r--board/volteer_ish/board.c8
-rw-r--r--board/volteer_ish/board.h10
-rw-r--r--board/volteer_ish/build.mk2
-rw-r--r--board/volteer_ish/ec.tasklist2
-rw-r--r--board/volteer_ish/gpio.inc2
-rw-r--r--board/voxel/battery.c2
-rw-r--r--board/voxel/board.c89
-rw-r--r--board/voxel/board.h121
-rw-r--r--board/voxel/build.mk2
-rw-r--r--board/voxel/ec.tasklist2
-rw-r--r--board/voxel/gpio.inc4
-rw-r--r--board/voxel/led.c39
-rw-r--r--board/voxel/sensors.c31
-rw-r--r--board/waddledee/battery.c2
-rw-r--r--board/waddledee/board.c115
-rw-r--r--board/waddledee/board.h46
-rw-r--r--board/waddledee/build.mk2
-rw-r--r--board/waddledee/cbi_ssfc.c6
-rw-r--r--board/waddledee/cbi_ssfc.h3
-rw-r--r--board/waddledee/ec.tasklist2
-rw-r--r--board/waddledee/gpio.inc2
-rw-r--r--board/waddledee/led.c16
-rw-r--r--board/waddledee/usb_pd_policy.c19
-rw-r--r--board/waddledoo/battery.c2
-rw-r--r--board/waddledoo/board.c101
-rw-r--r--board/waddledoo/board.h55
-rw-r--r--board/waddledoo/build.mk2
-rw-r--r--board/waddledoo/cbi_ssfc.c6
-rw-r--r--board/waddledoo/cbi_ssfc.h3
-rw-r--r--board/waddledoo/ec.tasklist2
-rw-r--r--board/waddledoo/gpio.inc2
-rw-r--r--board/waddledoo/led.c13
-rw-r--r--board/waddledoo/usb_pd_policy.c6
-rw-r--r--board/waddledoo2/battery.c2
-rw-r--r--board/waddledoo2/board.c121
-rw-r--r--board/waddledoo2/board.h56
-rw-r--r--board/waddledoo2/build.mk2
-rw-r--r--board/waddledoo2/cbi_ssfc.c6
-rw-r--r--board/waddledoo2/cbi_ssfc.h3
-rw-r--r--board/waddledoo2/ec.tasklist2
-rw-r--r--board/waddledoo2/gpio.inc2
-rw-r--r--board/waddledoo2/led.c39
-rw-r--r--board/waddledoo2/usb_pd_policy.c6
-rw-r--r--board/wheelie/battery.c2
-rw-r--r--board/wheelie/board.c107
-rw-r--r--board/wheelie/board.h50
-rw-r--r--board/wheelie/build.mk2
-rw-r--r--board/wheelie/cbi_ssfc.c6
-rw-r--r--board/wheelie/cbi_ssfc.h3
-rw-r--r--board/wheelie/ec.tasklist2
-rw-r--r--board/wheelie/gpio.inc2
-rw-r--r--board/wheelie/led.c16
-rw-r--r--board/wheelie/usb_pd_policy.c6
-rw-r--r--board/willow/battery.c2
-rw-r--r--board/willow/board.c93
-rw-r--r--board/willow/board.h24
-rw-r--r--board/willow/build.mk2
-rw-r--r--board/willow/ec.tasklist2
-rw-r--r--board/willow/gpio.inc2
-rw-r--r--board/willow/led.c39
-rw-r--r--board/woomax/battery.c2
-rw-r--r--board/woomax/board.c410
-rw-r--r--board/woomax/board.h91
-rw-r--r--board/woomax/build.mk2
-rw-r--r--board/woomax/ec.tasklist2
-rw-r--r--board/woomax/gpio.inc2
-rw-r--r--board/woomax/led.c52
-rw-r--r--board/woomax/thermal.c50
-rw-r--r--board/wormdingler/base_detect.c15
-rw-r--r--board/wormdingler/battery.c2
-rw-r--r--board/wormdingler/board.c176
-rw-r--r--board/wormdingler/board.h11
-rw-r--r--board/wormdingler/build.mk2
-rw-r--r--board/wormdingler/ec.tasklist2
-rw-r--r--board/wormdingler/gpio.inc2
-rw-r--r--board/wormdingler/led.c39
-rw-r--r--board/wormdingler/usbc_config.c6
-rw-r--r--board/yorp/battery.c2
-rw-r--r--board/yorp/board.c58
-rw-r--r--board/yorp/board.h22
-rw-r--r--board/yorp/build.mk2
-rw-r--r--board/yorp/ec.tasklist2
-rw-r--r--board/yorp/gpio.inc2
-rw-r--r--board/yorp/led.c41
-rw-r--r--board/zinger/board.c13
-rw-r--r--board/zinger/board.h11
-rw-r--r--board/zinger/build.mk2
-rw-r--r--board/zinger/ec.irqlist2
-rw-r--r--board/zinger/ec.tasklist2
-rw-r--r--board/zinger/gpio.inc2
-rw-r--r--board/zinger/hardware.c56
-rw-r--r--board/zinger/runtime.c28
-rw-r--r--board/zinger/usb_pd_config.h14
-rw-r--r--board/zinger/usb_pd_pdo.c4
-rw-r--r--board/zinger/usb_pd_pdo.h2
-rw-r--r--board/zinger/usb_pd_policy.c107
1970 files changed, 32893 insertions, 33206 deletions
diff --git a/board/adlrvpm_ite/board.h b/board/adlrvpm_ite/board.h
index 2c75a3883c..37662a5d52 120000..100644
--- a/board/adlrvpm_ite/board.h
+++ b/board/adlrvpm_ite/board.h
@@ -1 +1,102 @@
-../adlrvpp_ite/board.h \ No newline at end of file
+/* Copyright 2020 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Intel ADL-P-RVP-ITE board-specific configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+/* ITE EC variant */
+#define VARIANT_INTELRVP_EC_IT8320
+
+#include "adlrvp.h"
+
+/*
+ * Macros for GPIO signals used in common code that don't match the
+ * schematic names. Signal names in gpio.inc match the schematic and are
+ * then redefined here to so it's more clear which signal is being used for
+ * which purpose.
+ */
+#define GPIO_AC_PRESENT GPIO_BC_ACOK_EC
+#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL_EC
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW_EC
+#define GPIO_LID_OPEN GPIO_SMC_LID
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE_EC
+#define GPIO_PCH_WAKE_L GPIO_PCH_WAKE_N
+#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N_EC
+#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_EC
+#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_R_L
+#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3_EC
+#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL_EC
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
+#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC_R
+#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
+#define GPIO_ESPI_RESET_L GPIO_ESPI_RST_R
+#define GPIO_UART1_RX GPIO_UART_SERVO_TX_EC_RX
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET_EC
+#define GPIO_BAT_LED_RED_L GPIO_LED_1_L_EC
+#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L_EC
+#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC
+#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD_EC
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD_EC
+#define GPIO_PCH_DSW_PWROK GPIO_DSW_PWROK_EC
+#define GPIO_EN_PP3300_A GPIO_EC_DS3
+#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
+
+/* I2C ports & Configs */
+#define CONFIG_IT83XX_SMCLK2_ON_GPC7
+
+#define I2C_PORT_CHARGER IT83XX_I2C_CH_B
+
+/* Battery */
+#define I2C_PORT_BATTERY IT83XX_I2C_CH_B
+
+/* Board ID */
+#define I2C_PORT_PCA9555_BOARD_ID_GPIO IT83XX_I2C_CH_B
+
+/* Port 80 */
+#define I2C_PORT_PORT80 IT83XX_I2C_CH_B
+
+/* USB-C I2C */
+#define I2C_PORT_TYPEC_0 IT83XX_I2C_CH_C
+#define I2C_PORT_TYPEC_1 IT83XX_I2C_CH_F
+#if defined(HAS_TASK_PD_C2)
+#define I2C_PORT_TYPEC_2 IT83XX_I2C_CH_E
+#define I2C_PORT_TYPEC_3 IT83XX_I2C_CH_D
+#endif
+
+/* TCPC */
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
+
+/* Config Fan */
+#define GPIO_FAN_POWER_EN GPIO_EC_THRM_SEN_PWRGATE_N
+#define GPIO_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD_EC
+
+/* Increase EC speed */
+#undef PLL_CLOCK
+#define PLL_CLOCK 96000000
+
+#ifndef __ASSEMBLER__
+
+enum adlrvp_i2c_channel {
+ I2C_CHAN_FLASH,
+ I2C_CHAN_BATT_CHG,
+ I2C_CHAN_TYPEC_0,
+ I2C_CHAN_TYPEC_1,
+#if defined(HAS_TASK_PD_C2)
+ I2C_CHAN_TYPEC_2,
+ I2C_CHAN_TYPEC_3,
+#endif
+ I2C_CHAN_COUNT,
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/adlrvpm_ite/ec.tasklist b/board/adlrvpm_ite/ec.tasklist
index 48c033d14c..b0afc9e9a7 100644
--- a/board/adlrvpm_ite/ec.tasklist
+++ b/board/adlrvpm_ite/ec.tasklist
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_ite/board.c b/board/adlrvpp_ite/board.c
index 15aa1c46d7..aa2764f823 100644
--- a/board/adlrvpp_ite/board.c
+++ b/board/adlrvpp_ite/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_ite/board.h b/board/adlrvpp_ite/board.h
index 55b56854ea..37662a5d52 100644
--- a/board/adlrvpp_ite/board.h
+++ b/board/adlrvpp_ite/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,56 +19,56 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_BC_ACOK_EC
-#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL_EC
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW_EC
-#define GPIO_LID_OPEN GPIO_SMC_LID
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE_EC
-#define GPIO_PCH_WAKE_L GPIO_PCH_WAKE_N
-#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N_EC
-#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_EC
-#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_R_L
-#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3_EC
-#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL_EC
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
-#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC_R
-#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
-#define GPIO_ESPI_RESET_L GPIO_ESPI_RST_R
-#define GPIO_UART1_RX GPIO_UART_SERVO_TX_EC_RX
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET_EC
-#define GPIO_BAT_LED_RED_L GPIO_LED_1_L_EC
-#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L_EC
-#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC
-#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD_EC
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD_EC
-#define GPIO_PCH_DSW_PWROK GPIO_DSW_PWROK_EC
-#define GPIO_EN_PP3300_A GPIO_EC_DS3
-#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
+#define GPIO_AC_PRESENT GPIO_BC_ACOK_EC
+#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL_EC
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW_EC
+#define GPIO_LID_OPEN GPIO_SMC_LID
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE_EC
+#define GPIO_PCH_WAKE_L GPIO_PCH_WAKE_N
+#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N_EC
+#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_EC
+#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_R_L
+#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3_EC
+#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL_EC
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
+#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC_R
+#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
+#define GPIO_ESPI_RESET_L GPIO_ESPI_RST_R
+#define GPIO_UART1_RX GPIO_UART_SERVO_TX_EC_RX
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET_EC
+#define GPIO_BAT_LED_RED_L GPIO_LED_1_L_EC
+#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L_EC
+#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC
+#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD_EC
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD_EC
+#define GPIO_PCH_DSW_PWROK GPIO_DSW_PWROK_EC
+#define GPIO_EN_PP3300_A GPIO_EC_DS3
+#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
/* I2C ports & Configs */
#define CONFIG_IT83XX_SMCLK2_ON_GPC7
-#define I2C_PORT_CHARGER IT83XX_I2C_CH_B
+#define I2C_PORT_CHARGER IT83XX_I2C_CH_B
/* Battery */
-#define I2C_PORT_BATTERY IT83XX_I2C_CH_B
+#define I2C_PORT_BATTERY IT83XX_I2C_CH_B
/* Board ID */
-#define I2C_PORT_PCA9555_BOARD_ID_GPIO IT83XX_I2C_CH_B
+#define I2C_PORT_PCA9555_BOARD_ID_GPIO IT83XX_I2C_CH_B
/* Port 80 */
-#define I2C_PORT_PORT80 IT83XX_I2C_CH_B
+#define I2C_PORT_PORT80 IT83XX_I2C_CH_B
/* USB-C I2C */
-#define I2C_PORT_TYPEC_0 IT83XX_I2C_CH_C
-#define I2C_PORT_TYPEC_1 IT83XX_I2C_CH_F
+#define I2C_PORT_TYPEC_0 IT83XX_I2C_CH_C
+#define I2C_PORT_TYPEC_1 IT83XX_I2C_CH_F
#if defined(HAS_TASK_PD_C2)
-#define I2C_PORT_TYPEC_2 IT83XX_I2C_CH_E
-#define I2C_PORT_TYPEC_3 IT83XX_I2C_CH_D
+#define I2C_PORT_TYPEC_2 IT83XX_I2C_CH_E
+#define I2C_PORT_TYPEC_3 IT83XX_I2C_CH_D
#endif
/* TCPC */
@@ -76,12 +76,12 @@
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
/* Config Fan */
-#define GPIO_FAN_POWER_EN GPIO_EC_THRM_SEN_PWRGATE_N
-#define GPIO_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD_EC
+#define GPIO_FAN_POWER_EN GPIO_EC_THRM_SEN_PWRGATE_N
+#define GPIO_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD_EC
/* Increase EC speed */
#undef PLL_CLOCK
-#define PLL_CLOCK 96000000
+#define PLL_CLOCK 96000000
#ifndef __ASSEMBLER__
diff --git a/board/adlrvpp_ite/build.mk b/board/adlrvpp_ite/build.mk
index fe5f548324..9da9f60561 100644
--- a/board/adlrvpp_ite/build.mk
+++ b/board/adlrvpp_ite/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/adlrvpp_ite/ec.tasklist b/board/adlrvpp_ite/ec.tasklist
index c110617d6b..8bd63b1730 100644
--- a/board/adlrvpp_ite/ec.tasklist
+++ b/board/adlrvpp_ite/ec.tasklist
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_ite/gpio.inc b/board/adlrvpp_ite/gpio.inc
index f7cb8ea19c..22b97a7eff 100644
--- a/board/adlrvpp_ite/gpio.inc
+++ b/board/adlrvpp_ite/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,10 +21,10 @@ GPIO_INT(PCH_SLP_S0_N, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(VCCPDSW_3P3_EC, PIN(I, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(VCCST_PWRGD, PIN(I, 5), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PM_SLP_SUS_EC, PIN(K, 2), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_R_L, PIN(F, 2), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_R_L, PIN(F, 3), GPIO_INT_BOTH, power_signal_interrupt)
#endif
diff --git a/board/adlrvpp_mchp1521/board.c b/board/adlrvpp_mchp1521/board.c
index 7a51d0cbd9..a65a3ec60e 100644
--- a/board/adlrvpp_mchp1521/board.c
+++ b/board/adlrvpp_mchp1521/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -105,6 +105,6 @@ BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT);
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { QMSPI0_PORT, 4, GPIO_QMSPI_CS0},
+ { QMSPI0_PORT, 4, GPIO_QMSPI_CS0 },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
diff --git a/board/adlrvpp_mchp1521/board.h b/board/adlrvpp_mchp1521/board.h
index a76fbd87df..bcd46acf25 100644
--- a/board/adlrvpp_mchp1521/board.h
+++ b/board/adlrvpp_mchp1521/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,6 +17,14 @@
#include "adlrvp.h"
+#undef CONFIG_CMD_ADC
+#undef CONFIG_CMD_APTHROTTLE
+#undef CONFIG_CMD_BATTFAKE
+#undef CONFIG_CMD_GETTIME
+
+/* Enable LTO */
+#define CONFIG_LTO
+
/*
* Macros for GPIO signals used in common code that don't match the
* schematic names. Signal names in gpio.inc match the schematic and are
@@ -24,77 +32,76 @@
* which purpose.
*/
/* Power sequencing */
-#define GPIO_EC_SPI_OE_N GPIO_EC_PCH_SPI_OE_N
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD_EC_N
-#define GPIO_PCH_SLP_S0_L GPIO_PM_SLP_S0_R_N
-#define GPIO_PG_EC_DSW_PWROK GPIO_EC_TRACE_DATA_2
-#define GPIO_VCCST_PWRGD GPIO_EC_TRACE_DATA_3
-#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_N
-#define GPIO_SYS_RESET_L GPIO_DG2_PRESENT
-#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_R
-#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N_R
-#define GPIO_EN_PP3300_A GPIO_EC_DS3_R
-#define GPIO_SYS_PWROK_EC GPIO_SYS_PWROK_EC_R
-#define GPIO_PCH_DSW_PWROK GPIO_EC_TRACE_DATA_1
+#define GPIO_EC_SPI_OE_N GPIO_EC_PCH_SPI_OE_N
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD_EC_N
+#define GPIO_PCH_SLP_S0_L GPIO_PM_SLP_S0_R_N
+#define GPIO_PG_EC_DSW_PWROK GPIO_EC_TRACE_DATA_2
+#define GPIO_VCCST_PWRGD GPIO_EC_TRACE_DATA_3
+#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_N
+#define GPIO_SYS_RESET_L GPIO_DG2_PRESENT
+#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_R
+#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N_R
+#define GPIO_EN_PP3300_A GPIO_EC_DS3_R
+#define GPIO_SYS_PWROK_EC GPIO_SYS_PWROK_EC_R
+#define GPIO_PCH_DSW_PWROK GPIO_EC_TRACE_DATA_1
/* Buttons */
-#define GPIO_LID_OPEN GPIO_SMC_LID
-#define GPIO_VOLUME_UP_L GPIO_VOL_UP_EC
-#define GPIO_VOLUME_DOWN_L GPIO_VOL_DOWN_EC
-#define GPIO_POWER_BUTTON_L GPIO_PWRBTN_EC_IN_N
+#define GPIO_LID_OPEN GPIO_SMC_LID
+#define GPIO_VOLUME_UP_L GPIO_VOL_UP_EC
+#define GPIO_VOLUME_DOWN_L GPIO_VOL_DOWN_EC
+#define GPIO_POWER_BUTTON_L GPIO_PWRBTN_EC_IN_N
/* Sensors */
-#define GPIO_TABLET_MODE_L GPIO_EC_SLATEMODE_HALLOUT_SNSR_R
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC_R
+#define GPIO_TABLET_MODE_L GPIO_EC_SLATEMODE_HALLOUT_SNSR_R
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC_R
/* AC & Battery */
-#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT_EC
-#define GPIO_AC_PRESENT GPIO_BC_ACOK_EC_IN
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BATT_ID_R
+#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT_EC
+#define GPIO_AC_PRESENT GPIO_BC_ACOK_EC_IN
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BATT_ID_R
/* eSPI/Host communication */
-#define GPIO_ESPI_RESET_L GPIO_ESPI_RST_EC_R_N
-#define GPIO_PCH_WAKE_L GPIO_SMC_WAKE_SCI_N
-#define GPIO_EC_INT_L GPIO_EC_TRACE_DATA_0
+#define GPIO_ESPI_RESET_L GPIO_ESPI_RST_EC_R_N
+#define GPIO_PCH_WAKE_L GPIO_SMC_WAKE_SCI_N
+#define GPIO_EC_INT_L GPIO_EC_TRACE_DATA_0
/* H1 */
-#define GPIO_WP_L GPIO_EC_WAKE_CLK_R
-#define GPIO_PACKET_MODE_EN GPIO_EC_TRACE_CLK
-#define GPIO_ENTERING_RW GPIO_DNX_FORCE_RELOAD_EC_R
+#define GPIO_WP_L GPIO_EC_WAKE_CLK_R
+#define GPIO_PACKET_MODE_EN GPIO_EC_TRACE_CLK
+#define GPIO_ENTERING_RW GPIO_DNX_FORCE_RELOAD_EC_R
/* FAN */
-#define GPIO_FAN_POWER_EN GPIO_FAN_PWR_DISABLE
+#define GPIO_FAN_POWER_EN GPIO_FAN_PWR_DISABLE
/* LEDs */
-#define GPIO_BAT_LED_RED_L GPIO_PM_BAT_STATUS_LED2
-#define GPIO_PWR_LED_WHITE_L GPIO_PM_PWRBTN_LED
+#define GPIO_BAT_LED_RED_L GPIO_PM_BAT_STATUS_LED2
+#define GPIO_PWR_LED_WHITE_L GPIO_PM_PWRBTN_LED
/* Uart */
-#define GPIO_UART2_RX GPIO_EC_UART_RX
+#define GPIO_UART2_RX GPIO_EC_UART_RX
/* Case Closed Debug Mode interrupt */
-#define GPIO_CCD_MODE_ODL GPIO_KBC_NUMLOCK
+#define GPIO_CCD_MODE_ODL GPIO_KBC_NUMLOCK
/* USB-C interrupts */
-#define GPIO_USBC_TCPC_ALRT_P0 GPIO_TYPEC_EC_SMBUS_ALERT_0_R
-#define GPIO_USBC_TCPC_ALRT_P1 GPIO_TYPEC_EC_SMBUS_ALERT_1_R
-#define GPIO_USBC_TCPC_PPC_ALRT_P0 GPIO_KBC_SCANOUT_15
-#define GPIO_USBC_TCPC_PPC_ALRT_P1 GPIO_KBC_CAPSLOCK
-
+#define GPIO_USBC_TCPC_ALRT_P0 GPIO_TYPEC_EC_SMBUS_ALERT_0_R
+#define GPIO_USBC_TCPC_ALRT_P1 GPIO_TYPEC_EC_SMBUS_ALERT_1_R
+#define GPIO_USBC_TCPC_PPC_ALRT_P0 GPIO_KBC_SCANOUT_15
+#define GPIO_USBC_TCPC_PPC_ALRT_P1 GPIO_KBC_CAPSLOCK
/* I2C ports & Configs */
/* Charger */
-#define I2C_PORT_CHARGER MCHP_I2C_PORT0
+#define I2C_PORT_CHARGER MCHP_I2C_PORT0
/* Port 80 */
-#define I2C_PORT_PORT80 MCHP_I2C_PORT0
+#define I2C_PORT_PORT80 MCHP_I2C_PORT0
/* Board ID */
-#define I2C_PORT_PCA9555_BOARD_ID_GPIO MCHP_I2C_PORT0
+#define I2C_PORT_PCA9555_BOARD_ID_GPIO MCHP_I2C_PORT0
/* Battery */
-#define I2C_PORT_BATTERY MCHP_I2C_PORT0
+#define I2C_PORT_BATTERY MCHP_I2C_PORT0
/* USB-C I2C */
-#define I2C_PORT_TYPEC_0 MCHP_I2C_PORT1
-#define I2C_PORT_TYPEC_1 MCHP_I2C_PORT5
+#define I2C_PORT_TYPEC_0 MCHP_I2C_PORT1
+#define I2C_PORT_TYPEC_1 MCHP_I2C_PORT5
/*
* MEC1521H loads firmware using QMSPI controller
@@ -109,8 +116,8 @@
* is of size 512KB. This bin is then later appended with 0xFF to become 32MB
* binary for flashing purpose.
*/
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
-#define CONFIG_SPI_FLASH_W25X40 /* TODO: change to W25R256 */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
+#define CONFIG_SPI_FLASH_W25X40 /* TODO: change to W25R256 */
/* ADC channels */
/*
@@ -122,10 +129,10 @@
#undef ADC_TEMP_SNS_DDR_CHANNEL
#undef ADC_TEMP_SNS_SKIN_CHANNEL
-#define ADC_TEMP_SNS_AMBIENT_CHANNEL CHIP_ADC_CH4
-#define ADC_TEMP_SNS_VR_CHANNEL CHIP_ADC_CH5
-#define ADC_TEMP_SNS_DDR_CHANNEL CHIP_ADC_CH6
-#define ADC_TEMP_SNS_SKIN_CHANNEL CHIP_ADC_CH7
+#define ADC_TEMP_SNS_AMBIENT_CHANNEL CHIP_ADC_CH4
+#define ADC_TEMP_SNS_VR_CHANNEL CHIP_ADC_CH5
+#define ADC_TEMP_SNS_DDR_CHANNEL CHIP_ADC_CH6
+#define ADC_TEMP_SNS_SKIN_CHANNEL CHIP_ADC_CH7
/* To do: Remove once fan register details are added in mchp/fan.c */
#undef CONFIG_FANS
diff --git a/board/adlrvpp_mchp1521/build.mk b/board/adlrvpp_mchp1521/build.mk
index b53a3bb479..5bc76c4429 100644
--- a/board/adlrvpp_mchp1521/build.mk
+++ b/board/adlrvpp_mchp1521/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/adlrvpp_mchp1521/ec.tasklist b/board/adlrvpp_mchp1521/ec.tasklist
index 6d30fe3312..0019755448 100644
--- a/board/adlrvpp_mchp1521/ec.tasklist
+++ b/board/adlrvpp_mchp1521/ec.tasklist
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_mchp1521/gpio.inc b/board/adlrvpp_mchp1521/gpio.inc
index ce6d2de65f..848253fa17 100644
--- a/board/adlrvpp_mchp1521/gpio.inc
+++ b/board/adlrvpp_mchp1521/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_mchp1727/board.c b/board/adlrvpp_mchp1727/board.c
index 5d850c8e10..46092b91e3 100644
--- a/board/adlrvpp_mchp1727/board.c
+++ b/board/adlrvpp_mchp1727/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -133,6 +133,6 @@ BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == CONFIG_USB_PD_PORT_MAX_COUNT);
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { QMSPI0_PORT, 4, GPIO_QMSPI_CS0},
+ { QMSPI0_PORT, 4, GPIO_QMSPI_CS0 },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
diff --git a/board/adlrvpp_mchp1727/board.h b/board/adlrvpp_mchp1727/board.h
index d806c92314..ad4d189b42 100644
--- a/board/adlrvpp_mchp1727/board.h
+++ b/board/adlrvpp_mchp1727/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,7 +32,7 @@
* #undef CONFIG_CLOCK_SRC_EXTERNAL
* CONFIG_CLOCK_CRYSTAL is a don't care
*/
-#undef CONFIG_CLOCK_SRC_EXTERNAL
+#undef CONFIG_CLOCK_SRC_EXTERNAL
/* MEC1727 integrated SPI chip 512KB SST25PF040C */
#define CONFIG_SPI_FLASH_W25X40
@@ -52,10 +52,10 @@
#undef ADC_TEMP_SNS_DDR_CHANNEL
#undef ADC_TEMP_SNS_SKIN_CHANNEL
#undef ADC_TEMP_SNS_VR_CHANNEL
-#define ADC_TEMP_SNS_AMBIENT_CHANNEL CHIP_ADC_CH3
-#define ADC_TEMP_SNS_DDR_CHANNEL CHIP_ADC_CH5
-#define ADC_TEMP_SNS_SKIN_CHANNEL CHIP_ADC_CH4
-#define ADC_TEMP_SNS_VR_CHANNEL CHIP_ADC_CH0
+#define ADC_TEMP_SNS_AMBIENT_CHANNEL CHIP_ADC_CH3
+#define ADC_TEMP_SNS_DDR_CHANNEL CHIP_ADC_CH5
+#define ADC_TEMP_SNS_SKIN_CHANNEL CHIP_ADC_CH4
+#define ADC_TEMP_SNS_VR_CHANNEL CHIP_ADC_CH0
/*
* ADC maximum voltage is a board level configuration.
@@ -74,73 +74,73 @@
* which purpose.
*/
/* Power sequencing */
-#define GPIO_EC_SPI_OE_N GPIO_EC_SPI_OE_MECC
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD
-#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
-#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3
-#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC_N
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_N
-#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N
-#define GPIO_EN_PP3300_A GPIO_EC_DS3
-#define GPIO_SYS_PWROK_EC GPIO_SYS_PWROK
-#define GPIO_PCH_DSW_PWROK GPIO_EC_DSW_PWROK
+#define GPIO_EC_SPI_OE_N GPIO_EC_SPI_OE_MECC
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD
+#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
+#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3
+#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC_N
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_N
+#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N
+#define GPIO_EN_PP3300_A GPIO_EC_DS3
+#define GPIO_SYS_PWROK_EC GPIO_SYS_PWROK
+#define GPIO_PCH_DSW_PWROK GPIO_EC_DSW_PWROK
/* Sensors */
-#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC_N
+#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC_N
/* Buttons */
-#define GPIO_LID_OPEN GPIO_SMC_LID
-#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
-#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC
-#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
+#define GPIO_LID_OPEN GPIO_SMC_LID
+#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
+#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC
+#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
/* H1 */
-#define GPIO_WP_L GPIO_EC_FLASH_WP_ODL
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_WP_L GPIO_EC_FLASH_WP_ODL
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
/* AC & Battery */
-#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
-#define GPIO_AC_PRESENT GPIO_BC_ACOK
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET
+#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
+#define GPIO_AC_PRESENT GPIO_BC_ACOK
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET
/* eSPI/Host communication */
-#define GPIO_ESPI_RESET_L GPIO_LPC_ESPI_RST_N
-#define GPIO_PCH_WAKE_L GPIO_SMC_WAKE_SCI_N_MECC
-#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL
+#define GPIO_ESPI_RESET_L GPIO_LPC_ESPI_RST_N
+#define GPIO_PCH_WAKE_L GPIO_SMC_WAKE_SCI_N_MECC
+#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL
/* LED */
-#define GPIO_BAT_LED_RED_L GPIO_LED_1_L
-#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L
+#define GPIO_BAT_LED_RED_L GPIO_LED_1_L
+#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L
/* FAN */
-#define GPIO_FAN_POWER_EN GPIO_THERM_SEN_MECC
+#define GPIO_FAN_POWER_EN GPIO_THERM_SEN_MECC
/* Charger */
-#define I2C_PORT_CHARGER MCHP_I2C_PORT0
+#define I2C_PORT_CHARGER MCHP_I2C_PORT0
/* Battery */
-#define I2C_PORT_BATTERY MCHP_I2C_PORT0
+#define I2C_PORT_BATTERY MCHP_I2C_PORT0
/* Board ID */
-#define I2C_PORT_PCA9555_BOARD_ID_GPIO MCHP_I2C_PORT0
+#define I2C_PORT_PCA9555_BOARD_ID_GPIO MCHP_I2C_PORT0
/* Port 80 */
-#define I2C_PORT_PORT80 MCHP_I2C_PORT0
+#define I2C_PORT_PORT80 MCHP_I2C_PORT0
/* USB-C I2C */
-#define I2C_PORT_TYPEC_0 MCHP_I2C_PORT6
+#define I2C_PORT_TYPEC_0 MCHP_I2C_PORT6
/*
* Note: I2C for Type-C Port-1 is swapped with Type-C Port-2
* on the RVP to reduce BOM stuffing options.
*/
-#define I2C_PORT_TYPEC_1 MCHP_I2C_PORT3
+#define I2C_PORT_TYPEC_1 MCHP_I2C_PORT3
#if defined(HAS_TASK_PD_C2)
-#define I2C_PORT_TYPEC_2 MCHP_I2C_PORT7
-#define I2C_PORT_TYPEC_3 MCHP_I2C_PORT2
+#define I2C_PORT_TYPEC_2 MCHP_I2C_PORT7
+#define I2C_PORT_TYPEC_3 MCHP_I2C_PORT2
#endif
#ifndef __ASSEMBLER__
diff --git a/board/adlrvpp_mchp1727/build.mk b/board/adlrvpp_mchp1727/build.mk
index 2a056943d4..0527f50d24 100644
--- a/board/adlrvpp_mchp1727/build.mk
+++ b/board/adlrvpp_mchp1727/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/adlrvpp_mchp1727/ec.tasklist b/board/adlrvpp_mchp1727/ec.tasklist
index 8c3776ccad..3ae4784397 100644
--- a/board/adlrvpp_mchp1727/ec.tasklist
+++ b/board/adlrvpp_mchp1727/ec.tasklist
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_mchp1727/gpio.inc b/board/adlrvpp_mchp1727/gpio.inc
index 42973648b4..582da4c46a 100644
--- a/board/adlrvpp_mchp1727/gpio.inc
+++ b/board/adlrvpp_mchp1727/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,12 +18,12 @@ GPIO_INT(PCH_SLP_S0_N, PIN(0243), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(VCCPDSW_3P3, PIN(0201), GPIO_INT_BOTH, power_signal_interrupt)
/* TODO: GPIO_INT(VCCST_PWRGD_MECC, PIN(0207), GPIO_INT_BOTH, power_signal_interrupt) */
GPIO_INT(PM_SLP_SUS_EC_N, PIN(0227), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(PM_SLP_S3_N, PIN(0161), GPIO_INT_BOTH, power_signal_interrupt)
#else
GPIO(PM_SLP_S3_N, PIN(0161), GPIO_INPUT)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(PM_SLP_S4_N, PIN(0162), GPIO_INT_BOTH, power_signal_interrupt)
#else
GPIO(PM_SLP_S4_N, PIN(0162), GPIO_INPUT)
diff --git a/board/adlrvpp_npcx/board.c b/board/adlrvpp_npcx/board.c
index 412cebdb9a..f0b2a4408d 100644
--- a/board/adlrvpp_npcx/board.c
+++ b/board/adlrvpp_npcx/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_npcx/board.h b/board/adlrvpp_npcx/board.h
index c787beea84..ff214ddec2 100644
--- a/board/adlrvpp_npcx/board.h
+++ b/board/adlrvpp_npcx/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,76 +20,76 @@
* which purpose.
*/
/* Power sequencing */
-#define GPIO_EC_SPI_OE_N GPIO_EC_SPI_OE_MECC
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD
-#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
-#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3
-#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC_N
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_N
-#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N
-#define GPIO_EN_PP3300_A GPIO_EC_DS3
-#define GPIO_SYS_PWROK_EC GPIO_SYS_PWROK
-#define GPIO_PCH_DSW_PWROK GPIO_EC_DSW_PWROK
+#define GPIO_EC_SPI_OE_N GPIO_EC_SPI_OE_MECC
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_ALL_SYS_PWRGD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_PWRGD
+#define GPIO_PCH_SLP_S0_L GPIO_PCH_SLP_S0_N
+#define GPIO_PG_EC_DSW_PWROK GPIO_VCCPDSW_3P3
+#define GPIO_SLP_SUS_L GPIO_PM_SLP_SUS_EC_N
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_PM_RSMRST_N
+#define GPIO_PCH_PWRBTN_L GPIO_PM_PWRBTN_N
+#define GPIO_EN_PP3300_A GPIO_EC_DS3
+#define GPIO_SYS_PWROK_EC GPIO_SYS_PWROK
+#define GPIO_PCH_DSW_PWROK GPIO_EC_DSW_PWROK
/* Sensors */
-#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC_N
+#define GPIO_TABLET_MODE_L GPIO_SLATE_MODE_INDICATION
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_EC_N
/* Buttons */
-#define GPIO_LID_OPEN GPIO_SMC_LID
-#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
-#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC
-#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
+#define GPIO_LID_OPEN GPIO_SMC_LID
+#define GPIO_VOLUME_UP_L GPIO_VOLUME_UP
+#define GPIO_VOLUME_DOWN_L GPIO_VOL_DN_EC
+#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
/* H1 */
-#define GPIO_WP_L GPIO_EC_FLASH_WP_ODL
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_WP_L GPIO_EC_FLASH_WP_ODL
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
/* AC & Battery */
-#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
-#define GPIO_AC_PRESENT GPIO_BC_ACOK
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET
+#define GPIO_DC_JACK_PRESENT GPIO_STD_ADP_PRSNT
+#define GPIO_AC_PRESENT GPIO_BC_ACOK
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_DET
/* eSPI/Host communication */
-#define GPIO_ESPI_RESET_L GPIO_LPC_ESPI_RST_N
-#define GPIO_PCH_WAKE_L GPIO_SMC_WAKE_SCI_N_MECC
-#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL
+#define GPIO_ESPI_RESET_L GPIO_LPC_ESPI_RST_N
+#define GPIO_PCH_WAKE_L GPIO_SMC_WAKE_SCI_N_MECC
+#define GPIO_EC_INT_L GPIO_EC_PCH_MKBP_INT_ODL
/* LED */
-#define GPIO_BAT_LED_RED_L GPIO_LED_1_L
-#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L
+#define GPIO_BAT_LED_RED_L GPIO_LED_1_L
+#define GPIO_PWR_LED_WHITE_L GPIO_LED_2_L
/* FAN */
-#define GPIO_FAN_POWER_EN GPIO_THERM_SEN_MECC
+#define GPIO_FAN_POWER_EN GPIO_THERM_SEN_MECC
/* I2C ports & Configs */
/* Charger */
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
/* Battery */
-#define I2C_PORT_BATTERY NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT7_0
/* Board ID */
-#define I2C_PORT_PCA9555_BOARD_ID_GPIO NPCX_I2C_PORT7_0
+#define I2C_PORT_PCA9555_BOARD_ID_GPIO NPCX_I2C_PORT7_0
/* Port 80 */
-#define I2C_PORT_PORT80 NPCX_I2C_PORT7_0
+#define I2C_PORT_PORT80 NPCX_I2C_PORT7_0
/* USB-C I2C */
-#define I2C_PORT_TYPEC_0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TYPEC_0 NPCX_I2C_PORT0_0
/*
* Note: I2C for Type-C Port-1 is swapped with Type-C Port-2
* on the RVP to reduce BOM stuffing options.
*/
-#define I2C_PORT_TYPEC_1 NPCX_I2C_PORT2_0
+#define I2C_PORT_TYPEC_1 NPCX_I2C_PORT2_0
#if defined(HAS_TASK_PD_C2)
-#define I2C_PORT_TYPEC_2 NPCX_I2C_PORT1_0
+#define I2C_PORT_TYPEC_2 NPCX_I2C_PORT1_0
#endif
#if defined(HAS_TASK_PD_C3)
-#define I2C_PORT_TYPEC_3 NPCX_I2C_PORT3_0
+#define I2C_PORT_TYPEC_3 NPCX_I2C_PORT3_0
#endif
#ifndef __ASSEMBLER__
diff --git a/board/adlrvpp_npcx/build.mk b/board/adlrvpp_npcx/build.mk
index ec3450ee7e..db43110a34 100644
--- a/board/adlrvpp_npcx/build.mk
+++ b/board/adlrvpp_npcx/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/adlrvpp_npcx/ec.tasklist b/board/adlrvpp_npcx/ec.tasklist
index 08521ac10e..df3dc2c67d 100644
--- a/board/adlrvpp_npcx/ec.tasklist
+++ b/board/adlrvpp_npcx/ec.tasklist
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/adlrvpp_npcx/gpio.inc b/board/adlrvpp_npcx/gpio.inc
index 4a696e4c09..ebc04045bf 100644
--- a/board/adlrvpp_npcx/gpio.inc
+++ b/board/adlrvpp_npcx/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,12 +16,12 @@ GPIO_INT(PCH_SLP_S0_N, PIN(A, 1), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(VCCPDSW_3P3, PIN(4, 5), GPIO_INT_BOTH, power_signal_interrupt)
/* TODO: GPIO_INT(VCCST_PWRGD_MECC, PIN(7, 1), GPIO_INT_BOTH, power_signal_interrupt) */
GPIO_INT(PM_SLP_SUS_EC_N, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(PM_SLP_S3_N, PIN(B, 0), GPIO_INT_BOTH, power_signal_interrupt)
#else
GPIO(PM_SLP_S3_N, PIN(B, 0), GPIO_INPUT)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(PM_SLP_S4_N, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#else
GPIO(PM_SLP_S4_N, PIN(A, 5), GPIO_INPUT)
diff --git a/board/agah/battery.c b/board/agah/battery.c
index b9adcb4db9..92e2ad4b07 100644
--- a/board/agah/battery.c
+++ b/board/agah/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/agah/board.c b/board/agah/board.c
index d1cc519402..c8c98621d3 100644
--- a/board/agah/board.c
+++ b/board/agah/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,19 +15,32 @@
#include "hooks.h"
#include "fw_config.h"
#include "hooks.h"
+#include "keyboard_scan.h"
#include "lid_switch.h"
#include "power_button.h"
#include "power.h"
#include "registers.h"
#include "switch.h"
+#include "system.h"
#include "throttle_ap.h"
#include "usbc_config.h"
+#include "util.h"
+
+#include "driver/nvidia_gpu.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
+
+static int block_sequence;
+
+struct d_notify_policy d_notify_policies[] = {
+ AC_ATLEAST_W(100), AC_ATLEAST_W(65), AC_DC,
+ DC_ATLEAST_SOC(20), DC_ATLEAST_SOC(5),
+};
+BUILD_ASSERT(ARRAY_SIZE(d_notify_policies) == D_NOTIFY_COUNT);
__override void board_cbi_init(void)
{
@@ -51,8 +64,15 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
static void board_init(void)
{
+ if ((system_get_reset_flags() & EC_RESET_FLAG_AP_OFF) ||
+ (keyboard_scan_get_boot_keys() & BOOT_KEY_DOWN_ARROW)) {
+ CPRINTS("PG_PP3300_S5_OD block is enabled");
+ block_sequence = 1;
+ }
gpio_enable_interrupt(GPIO_PG_PP3300_S5_OD);
gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_ODL);
+
+ nvidia_gpu_init_policy(d_notify_policies);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -61,9 +81,13 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
*/
static void bypass_pp3300_s5_deferred(void)
{
- int pg_pp3300_s5 = gpio_get_level(GPIO_PG_PP3300_S5_OD);
+ if (block_sequence) {
+ CPRINTS("PG_PP3300_S5_OD is blocked.");
+ return;
+ }
- gpio_set_level(GPIO_PG_PP3300_S5_EC_SEQ_OD, pg_pp3300_s5);
+ gpio_set_level(GPIO_PG_PP3300_S5_EC_SEQ_OD,
+ gpio_get_level(GPIO_PG_PP3300_S5_OD));
}
DECLARE_DEFERRED(bypass_pp3300_s5_deferred);
@@ -72,3 +96,23 @@ void board_power_interrupt(enum gpio_signal signal)
/* Trigger deferred notification of gpio PG_PP3300_S5_OD change */
hook_call_deferred(&bypass_pp3300_s5_deferred_data, 0);
}
+
+static int cc_blockseq(int argc, const char *argv[])
+{
+ if (argc > 1) {
+ if (!parse_bool(argv[1], &block_sequence)) {
+ ccprintf("Invalid argument: %s\n", argv[1]);
+ return EC_ERROR_INVAL;
+ }
+ }
+
+ ccprintf("PG_PP3300_S5_OD block is %s\n",
+ block_sequence ? "enabled" : "disabled");
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(blockseq, cc_blockseq, "[on/off]", NULL);
+
+void gpu_overt_interrupt(enum gpio_signal signal)
+{
+ nvidia_gpu_over_temp(gpio_get_level(signal));
+}
diff --git a/board/agah/board.h b/board/agah/board.h
index 7655f9a4fe..0622e33df3 100644
--- a/board/agah/board.h
+++ b/board/agah/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,6 +14,11 @@
#include "baseboard.h"
/*
+ * Nvidia GPU
+ */
+#define CONFIG_GPU_NVIDIA
+
+/*
* This will happen automatically on NPCX9 ES2 and later. Do not remove
* until we can confirm all earlier chips are out of service.
*/
@@ -24,18 +29,6 @@
*/
#undef CONFIG_CHIPSET_X86_RSMRST_AFTER_S5
-/* LED */
-#define CONFIG_LED_PWM
-#define CONFIG_LED_PWM_COUNT 1
-#undef CONFIG_LED_PWM_NEAR_FULL_COLOR
-#undef CONFIG_LED_PWM_SOC_ON_COLOR
-#undef CONFIG_LED_PWM_SOC_SUSPEND_COLOR
-#undef CONFIG_LED_PWM_LOW_BATT_COLOR
-#define CONFIG_LED_PWM_NEAR_FULL_COLOR EC_LED_COLOR_WHITE
-#define CONFIG_LED_PWM_SOC_ON_COLOR EC_LED_COLOR_WHITE
-#define CONFIG_LED_PWM_SOC_SUSPEND_COLOR EC_LED_COLOR_WHITE
-#define CONFIG_LED_PWM_LOW_BATT_COLOR EC_LED_COLOR_AMBER
-
/* Sensors */
#undef CONFIG_TABLET_MODE
#undef CONFIG_TABLET_MODE_SWITCH
@@ -45,7 +38,7 @@
#undef CONFIG_VOLUME_BUTTONS
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -61,18 +54,20 @@
#define CONFIG_USBC_PPC_SYV682X
#define CONFIG_USB_PD_FRS_PPC
+#undef CONFIG_SYV682X_HV_ILIM
+#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
-/*
- * Passive USB-C cables only support up to 60W.
- */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
+
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 500
/*
* Macros for GPIO signals used in common code that don't match the
@@ -80,73 +75,77 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USBA1_RT NPCX_I2C_PORT6_1
+#define I2C_PORT_USBA1_RT NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Thermal features */
#define CONFIG_THERMISTOR
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_SEQ_EC_DSW_PWROK
+#define CONFIG_TEMP_SENSOR_POWER
+#define CONFIG_TEMP_SENSOR_FIRST_READ_DELAY_MS 500
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+/* Round down 7700 max current to multiple of 128mA for ISL9241 AC prochot. */
+#define AGAH_AC_PROCHOT_CURRENT_MA 7680
/* Barrel jack adapter settings */
-#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
-#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
+#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
/* This is the next available port # after USB-C ports. */
-#define DEDICATED_CHARGE_PORT 2
+#define DEDICATED_CHARGE_PORT 2
/*
* Older boards have a different ADC assignment.
@@ -156,23 +155,23 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
enum adc_channel {
ADC_TEMP_SENSOR_1_DDR_SOC,
- ADC_TEMP_SENSOR_2_AMBIENT,
+ ADC_TEMP_SENSOR_2_GPU,
ADC_TEMP_SENSOR_3_CHARGER,
- ADC_TEMP_SENSOR_4_WWAN,
+ ADC_CHARGER_IADP,
+ ADC_ADP_TYP,
ADC_CH_COUNT
};
enum temp_sensor_id {
TEMP_SENSOR_1_DDR_SOC,
- TEMP_SENSOR_2_AMBIENT,
+ TEMP_SENSOR_2_GPU,
TEMP_SENSOR_3_CHARGER,
- TEMP_SENSOR_4_WWAN,
TEMP_SENSOR_COUNT
};
@@ -183,25 +182,15 @@ enum battery_type {
};
enum pwm_channel {
- PWM_CH_LED2 = 0, /* PWM0 (white charger) */
- PWM_CH_LED1, /* PWM2 (orange charger) */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_FAN2, /* PWM4 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_FAN2, /* PWM4 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_1,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_1, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_1,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_1, MFT_CH_COUNT };
enum charge_port {
CHARGE_PORT_TYPEC0,
@@ -219,6 +208,9 @@ void board_power_interrupt(enum gpio_signal signal);
/* IRQ for BJ plug/unplug. */
void bj_present_interrupt(enum gpio_signal signal);
+/* IRQ for over temperature. */
+void gpu_overt_interrupt(enum gpio_signal signal);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/agah/build.mk b/board/agah/build.mk
index fbdd503bc4..d2f2db68df 100644
--- a/board/agah/build.mk
+++ b/board/agah/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/agah/charger_isl9241.c b/board/agah/charger_isl9241.c
index 6f041a7455..47e8261f78 100644
--- a/board/agah/charger_isl9241.c
+++ b/board/agah/charger_isl9241.c
@@ -1,8 +1,38 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+/*
+ *
+ * We need to deal with plug / unplug of AC chargers:
+ *
+ * +---------+ +USB +---------+
+ * | BATTERY |------------>| BATTERY |
+ * | |<------------| +USB |
+ * +---------+ -USB +---------+
+ * | ^ | ^
+ * +BJ | | -BJ +BJ | | -BJ
+ * v | v |
+ * +---------+ +USB +---------+
+ * | BATTERY |------------>| BATTERY |
+ * | +BJ |<------------| +BJ+USB |
+ * +---------+ -USB +---------+
+ *
+ * Depending on available battery charge, power rating of the new charger, and
+ * the system power state, transition/throttling may or may not occur but
+ * switching chargers is handled as follows:
+ *
+ * 1. Detects a new charger or removal of an existing charger.
+ * 2. charge_manager_update_charge is called with new charger's info.
+ * 3. board_set_active_charge_port is called.
+ * 3.1 It triggers hard & soft throttling for AP & GPU.
+ * 3.2 It disable active port then enables the new port.
+ * 4. HOOK_POWER_SUPPLY_CHANGE is called. We disables hard throttling.
+ * 5. charger task wakes up on HOOK_POWER_SUPPLY_CHANGE, enables (or disables)
+ * bypass mode.
+ */
+
#include "common.h"
#include "charge_manager.h"
@@ -15,12 +45,13 @@
#include "gpio.h"
#include "hooks.h"
#include "stdbool.h"
+#include "throttle_ap.h"
#include "usbc_ppc.h"
#include "usb_pd.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -32,71 +63,42 @@ const struct charger_config_t chg_chips[] = {
};
BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
-static int board_disable_bj_port(void)
+static int board_enable_bj_port(bool enable)
{
- gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
- /* If the current port is BJ, disable bypass mode. */
- if (charge_manager_get_supplier() == CHARGE_SUPPLIER_DEDICATED)
- return charger_enable_bypass_mode(0, 0);
+ if (enable) {
+ if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
+ return EC_ERROR_INVAL;
+ gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
+ } else {
+ gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
+ }
- CPRINTS("BJ power is disabled");
+ CPRINTS("BJ power is %sabled", enable ? "en" : "dis");
return EC_SUCCESS;
}
-static int board_enable_bj_port(void)
-{
- if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
- return EC_ERROR_INVAL;
- gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
-
- CPRINTS("BJ power is enabled");
-
- return charger_enable_bypass_mode(0, 1);
-}
-
-/*
- * TODO:
- *
- * When AC is being plugged in (including switching source port),
- * 1. Deassert NVIDIA_GPU_ACOFF_ODL.
- * 2. Call evaluate_d_notify.
- *
- * When AC is being lost,
- * 1. Assert NVIDIA_GPU_ACOFF_ODL.
- * 2. Set D-Notify to D5.
- * 3. Differ-call
- * a. Deassert NVIDIA_GPU_ACOFF_ODL.
- * b. evaluate_d_notify
- */
-static int board_throttle_ap_gpu(bool enable)
+static void board_throttle_ap_gpu(void)
{
- int rv = EC_SUCCESS;
-
- if (!chipset_in_state(CHIPSET_STATE_ON))
- return EC_SUCCESS;
-
- CPRINTS("TODO: %s to %s AP & GPU (%d)", rv ? "Failed" : "Succeeded",
- enable ? "throttle" : "unthrottle", rv);
-
- return rv;
+ throttle_ap(THROTTLE_ON, THROTTLE_HARD, THROTTLE_SRC_AC);
+ throttle_gpu(THROTTLE_ON, THROTTLE_HARD, THROTTLE_SRC_AC);
}
/* Disable all VBUS sink ports except <port>. <port> = -1 disables all ports. */
-static int board_disable_vbus_sink(int port)
+static int board_disable_other_vbus_sink(int except_port)
{
int i, r, rv = EC_SUCCESS;
for (i = 0; i < ppc_cnt; i++) {
- if (i == port)
+ if (i == except_port)
continue;
/*
* Do not return early if one fails otherwise we can get into a
* boot loop assertion failure.
*/
r = ppc_vbus_sink_enable(i, 0);
- CPRINTS("%s to disable sink path C%d (%d).",
- r ? "Failed" : "Succeeded", i, r);
+ if (r)
+ CPRINTS("Failed to disable sink path C%d (%d)", i, r);
rv |= r;
}
@@ -104,77 +106,74 @@ static int board_disable_vbus_sink(int port)
}
/* Minimum battery SoC required for switching source port. */
-#define MIN_BATT_FOR_SWITCHING_SOURCE_PORT 1
+#define MIN_BATT_FOR_SWITCHING_SOURCE_PORT 1
/*
- * It should also work on POR with/without a battery:
- *
- * 1. EC gathers power info of all ports.
- * 2. Identify the highest power port.
- * 3. If
- * 1. battery soc = 0% --> Exit
- * 2. BJ_ADP_PRESENT_ODL = 1 --> Exit
- * 3. highest power port == active port --> Exit
- * 4. If
- * 1. in S0, throttle AP & GPU to the DC rating.
- * 5. Turn off the current active port.
- * 6. Turn on the highest power port.
- * 7. If
- * 1. in S0, throttle AP & GPU back.
- *
- * TODO: Are the following cases covered?
- * 1. Two AC adapters are plugged. Then, the active adapter is removed.
- *
* TODO: Recover from incomplete execution:
- * 1. Failed to turn on/off PPC.
*/
int board_set_active_charge_port(int port)
{
- enum charge_supplier supplier = charge_manager_get_supplier();
+ enum charge_supplier active_supplier = charge_manager_get_supplier();
int active_port = charge_manager_get_active_charge_port();
- CPRINTS("Changing charge port to %d (current port=%d supplier=%d)",
- port, active_port, supplier);
+ CPRINTS("Switching charger from P%d (supplier=%d) to P%d", active_port,
+ active_supplier, port);
if (port == CHARGE_PORT_NONE) {
CPRINTS("Disabling all charger ports");
- board_throttle_ap_gpu(1);
-
- board_disable_bj_port();
- board_disable_vbus_sink(-1);
+ board_enable_bj_port(false);
+ board_disable_other_vbus_sink(-1);
return EC_SUCCESS;
}
+ /* Return on invalid or no-op call. */
if (port < 0 || CHARGE_PORT_COUNT <= port) {
return EC_ERROR_INVAL;
} else if (port == active_port) {
return EC_SUCCESS;
} else if (board_vbus_source_enabled(port)) {
/* Don't charge from a USBC source port */
- CPRINTS("Don't enable C%d. It's sourcing.", port);
+ CPRINTS("Don't enable P%d. It's sourcing.", port);
return EC_ERROR_INVAL;
}
/*
+ * If we're in S0, throttle AP and GPU. They'll be unthrottled when
+ * a port/supply switch completes (via HOOK_POWER_SUPPLY_CHANGE).
+ *
+ * If we're running currently on a battery (active_supplier == NONE), we
+ * don't need to throttle because we're not disabling any port.
+ */
+ if (chipset_in_state(CHIPSET_STATE_ON) &&
+ active_supplier != CHARGE_SUPPLIER_NONE)
+ board_throttle_ap_gpu();
+
+ /*
+ * We're here for the two cases:
+ * 1. A new charger was connected.
+ * 2. One charger was disconnected and we're switching to another.
+ */
+
+ /*
* We need to check the battery if we're switching a source port. If
* we're just starting up or no AC was previously plugged, we shouldn't
* check the battery. Both cases can be caught by supplier == NONE.
*/
- if (supplier != CHARGE_SUPPLIER_NONE) {
+ if (active_supplier != CHARGE_SUPPLIER_NONE) {
if (charge_get_percent() < MIN_BATT_FOR_SWITCHING_SOURCE_PORT)
return EC_ERROR_NOT_POWERED;
}
/* Turn off other ports' sink paths before enabling requested port. */
- if (port == CHARGE_PORT_TYPEC0 || port == CHARGE_PORT_TYPEC1) {
+ if (is_pd_port(port)) {
/*
- * BJ port is on POR. So, we need to turn it off even if we're
- * not previously on BJ.
+ * BJ port is enabled on start-up. So, we need to turn it off
+ * even if we were not previously on BJ.
*/
- board_disable_bj_port();
- if (board_disable_vbus_sink(port))
+ board_enable_bj_port(false);
+ if (board_disable_other_vbus_sink(port))
return EC_ERROR_UNCHANGED;
/* Enable requested USBC charge port. */
@@ -187,26 +186,21 @@ int board_set_active_charge_port(int port)
* We can't proceed unless both ports are successfully
* disconnected as sources.
*/
- if (board_disable_vbus_sink(-1))
+ if (board_disable_other_vbus_sink(-1))
return EC_ERROR_UNKNOWN;
- board_enable_bj_port();
+ board_enable_bj_port(true);
}
- /* Switching port is complete. Turn off throttling. */
- if (supplier != CHARGE_SUPPLIER_NONE)
- board_throttle_ap_gpu(0);
-
- CPRINTS("New charger p%d", port);
+ CPRINTS("New charger P%d", port);
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
static const struct charge_port_info bj_power = {
@@ -216,32 +210,62 @@ static const struct charge_port_info bj_power = {
};
/* Debounce time for BJ plug/unplug */
-#define BJ_DEBOUNCE_MS 1000
+#define BJ_DEBOUNCE_MS CONFIG_EXTPOWER_DEBOUNCE_MS
+
+int board_should_charger_bypass(void)
+{
+ return charge_manager_get_active_charge_port() == DEDICATED_CHARGE_PORT;
+}
-static void bj_connect_deferred(void)
+static void bj_connect(void)
{
static int8_t bj_connected = -1;
- const struct charge_port_info *pi = NULL;
int connected = !gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL);
+ /* Debounce */
if (connected == bj_connected)
return;
- if (connected)
- pi = &bj_power;
+ bj_connected = connected;
+ CPRINTS("BJ %sconnected", connected ? "" : "dis");
charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
- DEDICATED_CHARGE_PORT, pi);
- bj_connected = connected;
- CPRINTS("BJ %s", connected ? "connected" : "disconnected");
+ DEDICATED_CHARGE_PORT,
+ connected ? &bj_power : NULL);
}
-DECLARE_DEFERRED(bj_connect_deferred);
+DECLARE_DEFERRED(bj_connect);
+/* This handler shouldn't be needed if ACOK from isl9241 is working. */
void bj_present_interrupt(enum gpio_signal signal)
{
- hook_call_deferred(&bj_connect_deferred_data, BJ_DEBOUNCE_MS * MSEC);
+ hook_call_deferred(&bj_connect_data, BJ_DEBOUNCE_MS * MSEC);
}
+void ac_change(void)
+{
+ /*
+ * Serialize. We don't handle USB-C here because we'll get a
+ * notification from TCPC.
+ */
+ hook_call_deferred(&bj_connect_data, 0);
+}
+DECLARE_HOOK(HOOK_AC_CHANGE, ac_change, HOOK_PRIO_DEFAULT);
+
+static void power_supply_changed(void)
+{
+ /*
+ * We've switched to a new charge port (or no port). Hardware throttles
+ * can be removed now. Software throttles may stay enabled and change
+ * as the situation changes.
+ */
+ throttle_ap(THROTTLE_OFF, THROTTLE_HARD, THROTTLE_SRC_AC);
+ /*
+ * Unthrottling GPU is done through a deferred call scheduled when it
+ * was throttled.
+ */
+}
+DECLARE_HOOK(HOOK_POWER_SUPPLY_CHANGE, power_supply_changed, HOOK_PRIO_DEFAULT);
+
static void bj_state_init(void)
{
/*
@@ -253,6 +277,8 @@ static void bj_state_init(void)
charge_manager_update_charge(j, i, NULL);
}
- bj_connect_deferred();
+ bj_connect();
+
+ isl9241_set_ac_prochot(CHARGER_SOLO, AGAH_AC_PROCHOT_CURRENT_MA);
}
DECLARE_HOOK(HOOK_INIT, bj_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
diff --git a/board/agah/ec.tasklist b/board/agah/ec.tasklist
index 7286caf6c6..ebbfd239f9 100644
--- a/board/agah/ec.tasklist
+++ b/board/agah/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,6 +12,7 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, HOOKS_TASK_STACK_SIZE) \
+ TASK_ALWAYS(LED, led_task, NULL, TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, BASEBOARD_CHARGER_TASK_STACK_SIZE) \
diff --git a/board/agah/fans.c b/board/agah/fans.c
index df6102b460..45533d9e8c 100644
--- a/board/agah/fans.c
+++ b/board/agah/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,14 +30,14 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
static const struct fan_conf fan_conf_1 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_1, /* Use MFT id to control fan */
+ .ch = MFT_CH_1, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/agah/fw_config.c b/board/agah/fw_config.c
index 7a08e187a6..a16cf10d5a 100644
--- a/board/agah/fw_config.c
+++ b/board/agah/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union agah_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/agah/fw_config.h b/board/agah/fw_config.h
index fe9fa24135..7efdae51ac 100644
--- a/board/agah/fw_config.h
+++ b/board/agah/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,9 +21,9 @@ enum ec_cfg_keyboard_backlight_type {
union agah_cbi_fw_config {
struct {
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 21;
};
uint32_t raw_value;
};
diff --git a/board/agah/gpio.inc b/board/agah/gpio.inc
index 41a8f2a4d8..a3a6610ac8 100644
--- a/board/agah/gpio.inc
+++ b/board/agah/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,6 +27,7 @@ GPIO_INT(USB_C2_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_inter
GPIO_INT(USB_C2_TCPC_INT_ODL, PIN(A, 7), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C2_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(5, 6), GPIO_INT_BOTH | GPIO_PULL_UP, bj_present_interrupt)
+GPIO_INT(GPU_OVERT_ODL, PIN(5, 0), GPIO_INT_BOTH, gpu_overt_interrupt)
/* USED GPIOs: */
GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
@@ -54,7 +55,7 @@ GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_R_ODL, PIN(C, 0), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
-GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH)
+GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_LOW)
GPIO(EN_PP5000_USBA_R, PIN(D, 7), GPIO_OUT_LOW)
GPIO(EN_S5_RAILS, PIN(9, 6), GPIO_OUT_LOW)
GPIO(IMVP9_VRRDY_OD, PIN(4, 3), GPIO_INPUT)
@@ -67,8 +68,15 @@ GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
GPIO(EN_USB_A_LOW_POWER, PIN(9, 3), GPIO_OUT_LOW)
GPIO(PG_PP3300_S5_EC_SEQ_OD, PIN(B, 5), GPIO_OUT_LOW)
GPIO(USB_C2_FRS_EN, PIN(D, 4), GPIO_OUT_LOW)
+GPIO(NVIDIA_GPU_ACOFF_ODL, PIN(9, 5), GPIO_ODR_HIGH)
+GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_LOW)
+GPIO(LED_1_L, PIN(C, 4), GPIO_OUT_LOW)
-/* Barreljack */
+/*
+ * Barrel-jack adapter enable switch. When starting up on a depleted battery,
+ * we'll be powered by either BJ or USB-C but not both. The EC will detect BJ
+ * or USBC and disable the other ports.
+ */
GPIO(EN_PPVAR_BJ_ADP_L, PIN(A, 2), GPIO_OUT_LOW)
/*
@@ -95,12 +103,10 @@ ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */
ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* GPIO73/TA2 */
ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* GPIO80/PWM3 */
ALTERNATE(PIN_MASK(B, 0xC0), 0, MODULE_PWM, 0) /* GPIOB7/PWM5, GPIOB6/PWM4 */
-ALTERNATE(PIN_MASK(C, 0x18), 0, MODULE_PWM, 0) /* GPIOC4/PWM2, GPIOC3/PWM0 */
/* ADC alternate functions */
ALTERNATE(PIN_MASK(3, 0x10), 0, MODULE_ADC, 0) /* GPIO34/PS2_DAT2/ADC6 */
-ALTERNATE(PIN_MASK(4, 0x34), 0, MODULE_ADC, 0) /* GPIO42/ADC3/RI_L, GPIO45/ADC0, GPIO44/ADC1 */
-ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
+ALTERNATE(PIN_MASK(4, 0x36), 0, MODULE_ADC, 0) /* GPIO42/ADC3/RI_L, GPIO45/ADC0, GPIO44/ADC1, GPIO41/ADC4 */
/* KB alternate functions */
ALTERNATE(PIN_MASK(0, 0xf0), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO10&P80_CLK/GPIO07, KSO11&P80_DAT/GPIO06, KSO12/GPIO05, KSO13/GPIO04 */
@@ -123,9 +129,6 @@ UNUSED(PIN(0, 2)) /* GPIO02 */
UNUSED(PIN(6, 6)) /* GPIO66 */
UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
UNUSED(PIN(8, 1)) /* GPIO81 */
-UNUSED(PIN(9, 5)) /* GPIO95 */
-UNUSED(PIN(7, 3)) /* GPIO73 */
-UNUSED(PIN(4, 1)) /* GPIO41 */
-UNUSED(PIN(5, 0)) /* GPIO50 */
UNUSED(PIN(6, 0)) /* GPIO60 */
UNUSED(PIN(C, 2)) /* GPIOC2 */
+UNUSED(PIN(E, 1)) /* GPIOE1 */
diff --git a/board/agah/i2c.c b/board/agah/i2c.c
index dedf3b4c4f..5bdf6936c1 100644
--- a/board/agah/i2c.c
+++ b/board/agah/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#include "hooks.h"
#include "i2c.h"
-#define BOARD_ID_FAST_PLUS_CAPABLE 2
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
diff --git a/board/agah/keyboard.c b/board/agah/keyboard.c
index d234dfd64e..cb34543db8 100644
--- a/board/agah/keyboard.c
+++ b/board/agah/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,7 +45,6 @@ static const struct ec_response_keybd_config keybd = {
.capabilities = KEYBD_CAP_NUMERIC_KEYPAD,
};
-
__override const struct ec_response_keybd_config *
board_vivaldi_keybd_config(void)
{
diff --git a/board/agah/led.c b/board/agah/led.c
index 12a7c3e09f..e16b3df5d6 100644
--- a/board/agah/led.c
+++ b/board/agah/led.c
@@ -1,83 +1,192 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
- */
-
-/* Agah specific PWM LED settings: there are 2 LEDs on each side of the board,
- * each one can be controlled separately. The LED colors are white or amber,
- * and the default behavior is tied to the charging process: both sides are
- * amber while charging the battery and white when the battery is charged.
+ *
+ * Battery LED control for Agah
*/
#include <stdint.h>
-#include "common.h"
-#include "compile_time_macros.h"
+#include "battery.h"
+#include "charge_manager.h"
+#include "charge_state.h"
+#include "chipset.h"
#include "ec_commands.h"
-#include "led_pwm.h"
-#include "pwm.h"
-#include "util.h"
+#include "gpio.h"
+#include "host_command.h"
+#include "led_common.h"
+#include "task.h"
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
-};
+#define BAT_LED_ON 0
+#define BAT_LED_OFF 1
+
+#define BATT_LOW_BCT 10
+
+#define LED_TICK_INTERVAL_MS (500 * MSEC)
+#define LED_CYCLE_TIME_MS (2000 * MSEC)
+#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1000 * MSEC)
+#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-/*
- * We only have a white and an amber LED, so setting any other color results in
- * both LEDs being off. Cap at 50% to save power.
- */
-struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Amber, White */
- [EC_LED_COLOR_RED] = { 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 0, 50 },
- [EC_LED_COLOR_AMBER] = { 50, 0 },
+enum led_color {
+ LED_OFF = 0,
+ LED_AMBER,
+ LED_WHITE,
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-/* Two logical LEDs with amber and white channels. */
-struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = {
- {
- .ch0 = PWM_CH_LED1,
- .ch1 = PWM_CH_LED2,
- .ch2 = PWM_LED_NO_CHANNEL,
- .enable = &pwm_enable,
- .set_duty = &pwm_set_duty,
- },
-};
+static void led_set_color_battery(enum led_color color)
+{
+ enum gpio_signal amber_led, white_led;
+
+ amber_led = GPIO_LED_1_L;
+ white_led = GPIO_LED_2_L;
+
+ switch (color) {
+ case LED_WHITE:
+ gpio_set_level(white_led, BAT_LED_ON);
+ gpio_set_level(amber_led, BAT_LED_OFF);
+ break;
+ case LED_AMBER:
+ gpio_set_level(white_led, BAT_LED_OFF);
+ gpio_set_level(amber_led, BAT_LED_ON);
+ break;
+ case LED_OFF:
+ gpio_set_level(white_led, BAT_LED_OFF);
+ gpio_set_level(amber_led, BAT_LED_OFF);
+ break;
+ default:
+ break;
+ }
+}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
- memset(brightness_range, '\0',
- sizeof(*brightness_range) * EC_LED_COLOR_COUNT);
- brightness_range[EC_LED_COLOR_AMBER] = 100;
- brightness_range[EC_LED_COLOR_WHITE] = 100;
+ switch (led_id) {
+ case EC_LED_ID_BATTERY_LED:
+ brightness_range[EC_LED_COLOR_WHITE] = 1;
+ brightness_range[EC_LED_COLOR_AMBER] = 1;
+ break;
+ default:
+ break;
+ }
}
int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
{
- enum pwm_led_id pwm_id;
-
- /* Convert ec_led_id to pwm_led_id. */
switch (led_id) {
- case EC_LED_ID_LEFT_LED:
- pwm_id = PWM_LED0;
+ case EC_LED_ID_BATTERY_LED:
+ if (brightness[EC_LED_COLOR_WHITE] != 0)
+ led_set_color_battery(LED_WHITE);
+ else if (brightness[EC_LED_COLOR_AMBER] != 0)
+ led_set_color_battery(LED_AMBER);
+ else
+ led_set_color_battery(LED_OFF);
break;
default:
- return EC_ERROR_UNKNOWN;
+ return EC_ERROR_PARAM1;
}
- if (brightness[EC_LED_COLOR_WHITE])
- set_pwm_led_color(pwm_id, EC_LED_COLOR_WHITE);
- else if (brightness[EC_LED_COLOR_AMBER])
- set_pwm_led_color(pwm_id, EC_LED_COLOR_AMBER);
- else
- /* Otherwise, the "color" is "off". */
- set_pwm_led_color(pwm_id, -1);
-
return EC_SUCCESS;
}
+
+/*
+ * Set active charge port color to the parameter, turn off all others.
+ * If no port is active (-1), turn off all LEDs.
+ */
+static void set_active_port_color(enum led_color color)
+{
+ if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
+ led_set_color_battery(color);
+}
+
+static void led_set_battery(void)
+{
+ static unsigned int battery_ticks;
+ static unsigned int suspend_ticks;
+
+ battery_ticks++;
+
+ if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
+ suspend_ticks++;
+
+ led_set_color_battery(
+ (suspend_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
+
+ return;
+ }
+
+ switch (charge_get_state()) {
+ case PWR_STATE_CHARGE:
+ /* Always indicate when charging, even in suspend. */
+ set_active_port_color(LED_AMBER);
+ break;
+ case PWR_STATE_DISCHARGE:
+ /*
+ * Blinking amber LEDs slowly if battery is lower 10
+ * percentage.
+ */
+ if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ if (charge_get_percent() < BATT_LOW_BCT)
+ led_set_color_battery(
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
+ else
+ led_set_color_battery(LED_OFF);
+ }
+
+ break;
+ case PWR_STATE_ERROR:
+ if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ led_set_color_battery(
+ (battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
+ }
+
+ break;
+ case PWR_STATE_CHARGE_NEAR_FULL:
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_IDLE: /* External power connected in IDLE */
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
+ break;
+ default:
+ /* Other states don't alter LED behavior */
+ break;
+ }
+}
+
+void led_task(void *u)
+{
+ uint32_t start_time;
+ uint32_t task_duration;
+
+ while (1) {
+ start_time = get_time().le.lo;
+
+ led_set_battery();
+
+ /* Compute time for this iteration */
+ task_duration = get_time().le.lo - start_time;
+ /*
+ * Compute wait time required to for next desired LED tick. If
+ * the duration exceeds the tick time, then don't sleep.
+ */
+ if (task_duration < LED_TICK_INTERVAL_MS)
+ usleep(LED_TICK_INTERVAL_MS - task_duration);
+ }
+}
diff --git a/board/agah/pwm.c b/board/agah/pwm.c
index 1b704bc71e..9fa0f41eff 100644
--- a/board/agah/pwm.c
+++ b/board/agah/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,16 +11,6 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED2] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 4800,
- },
- [PWM_CH_LED1] = {
- .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 4800,
- },
[PWM_CH_KBLIGHT] = {
.channel = 3,
.flags = 0,
@@ -51,10 +41,6 @@ static void board_pwm_init(void)
* Turn off all the LEDs.
* Turn on the fan at 100%.
*/
- pwm_enable(PWM_CH_LED1, 1);
- pwm_set_duty(PWM_CH_LED1, 0);
- pwm_enable(PWM_CH_LED2, 1);
- pwm_set_duty(PWM_CH_LED2, 0);
pwm_enable(PWM_CH_KBLIGHT, 1);
pwm_set_duty(PWM_CH_KBLIGHT, 50);
diff --git a/board/agah/sensors.c b/board/agah/sensors.c
index b68984c95c..046787872d 100644
--- a/board/agah/sensors.c
+++ b/board/agah/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@ struct adc_t adc_channels[] = {
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
- [ADC_TEMP_SENSOR_2_AMBIENT] = {
- .name = "TEMP_AMBIENT",
+ [ADC_TEMP_SENSOR_2_GPU] = {
+ .name = "TEMP_GPU",
.input_ch = NPCX_ADC_CH1,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
@@ -33,9 +33,16 @@ struct adc_t adc_channels[] = {
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
- [ADC_TEMP_SENSOR_4_WWAN] = {
- .name = "TEMP_WWAN",
- .input_ch = NPCX_ADC_CH7,
+ [ADC_CHARGER_IADP] = {
+ .name = "CHARGER_IADP",
+ .input_ch = NPCX_ADC_CH3,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_ADP_TYP] = {
+ .name = "ADP_TYP",
+ .input_ch = NPCX_ADC_CH4,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
@@ -51,11 +58,11 @@ const struct temp_sensor_t temp_sensors[] = {
.read = get_temp_3v3_30k9_47k_4050b,
.idx = ADC_TEMP_SENSOR_1_DDR_SOC,
},
- [TEMP_SENSOR_2_AMBIENT] = {
- .name = "Ambient",
+ [TEMP_SENSOR_2_GPU] = {
+ .name = "GPU",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_AMBIENT,
+ .idx = ADC_TEMP_SENSOR_2_GPU,
},
[TEMP_SENSOR_3_CHARGER] = {
.name = "Charger",
@@ -63,17 +70,11 @@ const struct temp_sensor_t temp_sensors[] = {
.read = get_temp_3v3_30k9_47k_4050b,
.idx = ADC_TEMP_SENSOR_3_CHARGER,
},
- [TEMP_SENSOR_4_WWAN] = {
- .name = "WWAN",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_WWAN,
- },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -86,8 +87,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
-#define THERMAL_AMBIENT \
- { \
+#define THERMAL_GPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -98,8 +99,7 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
.temp_fan_off = C_TO_K(35), \
.temp_fan_max = C_TO_K(60), \
}
-__maybe_unused static const struct ec_thermal_config thermal_ambient =
- THERMAL_AMBIENT;
+__maybe_unused static const struct ec_thermal_config thermal_gpu = THERMAL_GPU;
/*
* Inductor limits - used for both charger and PP3300 regulator
@@ -112,8 +112,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient =
* Inductors: limit of 125c
* PCB: limit is 80c
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(105), \
[EC_TEMP_THRESH_HALT] = C_TO_K(120), \
@@ -127,25 +127,9 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient =
__maybe_unused static const struct ec_thermal_config thermal_charger =
THERMAL_CHARGER;
-#define THERMAL_WWAN \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(130), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(130), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
- }
-__maybe_unused static const struct ec_thermal_config thermal_wwan =
- THERMAL_WWAN;
-
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU,
- [TEMP_SENSOR_2_AMBIENT] = THERMAL_AMBIENT,
+ [TEMP_SENSOR_2_GPU] = THERMAL_GPU,
[TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
- [TEMP_SENSOR_4_WWAN] = THERMAL_WWAN,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/agah/usbc_config.c b/board/agah/usbc_config.c
index 0902f2f799..a8bad0f121 100644
--- a/board/agah/usbc_config.c
+++ b/board/agah/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,7 +14,7 @@
#include "console.h"
#include "driver/bc12/pi3usb9201_public.h"
#include "driver/ppc/syv682x_public.h"
-#include "driver/retimer/ps8818.h"
+#include "driver/retimer/ps8818_public.h"
#include "driver/tcpm/rt1715.h"
#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
@@ -33,8 +33,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -116,18 +116,17 @@ const static struct ps8818_reg_val equalizer_default_table[] = {
#define NUM_EQ_DEFAULT_ARRAY ARRAY_SIZE(equalizer_default_table)
-int board_ps8818_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+int board_ps8818_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
int rv = EC_SUCCESS;
int i;
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
-
/* Boost the USB gain */
for (i = 0; i < NUM_EQ_DEFAULT_ARRAY; i++)
- rv |= ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ rv |= ps8818_i2c_field_update8(
+ me, PS8818_REG_PAGE1,
equalizer_default_table[i].reg,
equalizer_default_table[i].mask,
equalizer_default_table[i].val);
@@ -136,36 +135,42 @@ int board_ps8818_mux_set(const struct usb_mux *me,
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- rv |= ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_DPEQ_LEVEL,
- PS8818_DPEQ_LEVEL_UP_MASK,
- PS8818_DPEQ_LEVEL_UP_19DB);
+ rv |= ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_DPEQ_LEVEL,
+ PS8818_DPEQ_LEVEL_UP_MASK,
+ PS8818_DPEQ_LEVEL_UP_19DB);
}
return rv;
}
-const static struct usb_mux usbc2_ps8818 = {
- .usb_port = USBC_PORT_C2,
- .i2c_port = I2C_PORT_USB_C2_TCPC,
- .i2c_addr_flags = PS8818_I2C_ADDR_FLAGS,
- .driver = &ps8818_usb_retimer_driver,
- .board_set = &board_ps8818_mux_set,
+const static struct usb_mux_chain usbc2_ps8818 = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .i2c_port = I2C_PORT_USB_C2_TCPC,
+ .i2c_addr_flags = PS8818_I2C_ADDR_FLAGS,
+ .driver = &ps8818_usb_retimer_driver,
+ .board_set = &board_ps8818_mux_set,
+ },
};
/* USBC mux configuration - Alder Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc2_ps8818,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc2_ps8818,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -203,8 +208,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -215,7 +220,7 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
void board_reset_pd_mcu(void)
{
- /* There's no reset pin on TCPC */
+ /* There's no reset pin on TCPC */
}
static void board_tcpc_init(void)
diff --git a/board/agah/usbc_config.h b/board/agah/usbc_config.h
index e5b7576d72..e353263f5f 100644
--- a/board/agah/usbc_config.h
+++ b/board/agah/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C2,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C2, USBC_PORT_COUNT };
struct ps8818_reg_val {
uint8_t reg;
diff --git a/board/akemi/battery.c b/board/akemi/battery.c
index 238716b116..de380ac01c 100644
--- a/board/akemi/battery.c
+++ b/board/akemi/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/akemi/board.c b/board/akemi/board.c
index de5438344e..7d480b1268 100644
--- a/board/akemi/board.c
+++ b/board/akemi/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,8 +43,8 @@
#include "util.h"
#include "battery_smart.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* GPIO to enable/disable the USB Type-A port. */
const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
@@ -105,16 +105,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -140,16 +140,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -177,17 +181,13 @@ static struct stprivate_data g_lis2dwl_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -267,13 +267,12 @@ struct motion_sensor_t motion_sensors[] = {
};
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -292,36 +291,35 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Temp1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Temp2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Temp3",
- .type = TEMP_SENSOR_TYPE_CPU,
- .read = g753_get_val,
- .idx = 0},
+ [TEMP_SENSOR_1] = { .name = "Temp1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Temp2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Temp3",
+ .type = TEMP_SENSOR_TYPE_CPU,
+ .read = g753_get_val,
+ .idx = 0 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Hatch Temperature sensors */
/*
* TODO(b/124316213): These setting need to be reviewed and set appropriately
@@ -331,8 +329,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -391,12 +389,12 @@ __override uint32_t board_override_feature_flags0(uint32_t flags0)
}
/* Battery functions */
-#define SB_OPTIONALMFG_FUNCTION2 0x26
-#define QUICK_CHARGE_SUPPORT 0x01
-#define QUICK_CHARGE_ENABLE 0x02
+#define SB_OPTIONALMFG_FUNCTION2 0x26
+#define QUICK_CHARGE_SUPPORT 0x01
+#define QUICK_CHARGE_ENABLE 0x02
-#define SB_QUICK_CHARGE_ENABLE 1
-#define SB_QUICK_CHARGE_DISABLE 0
+#define SB_QUICK_CHARGE_ENABLE 1
+#define SB_QUICK_CHARGE_DISABLE 0
static void sb_quick_charge_mode(int enable)
{
@@ -422,7 +420,8 @@ static void board_chipset_startup(void)
/* Normal charge current */
sb_quick_charge_mode(SB_QUICK_CHARGE_DISABLE);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
+ HOOK_PRIO_INIT_I2C + 1);
/* Called on AP S0 -> S5 transition */
static void board_chipset_shutdown(void)
@@ -437,5 +436,5 @@ bool board_is_convertible(void)
const uint8_t sku = get_board_sku();
return (sku == 255) || (sku == 1) || (sku == 2) || (sku == 3) ||
- (sku == 4);
+ (sku == 4);
}
diff --git a/board/akemi/board.h b/board/akemi/board.h
index caf1a39147..bdc18638f8 100644
--- a/board/akemi/board.h
+++ b/board/akemi/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -102,16 +102,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -119,8 +119,8 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
ADC_CH_COUNT
};
@@ -131,11 +131,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/akemi/build.mk b/board/akemi/build.mk
index 733912454f..13153c1526 100644
--- a/board/akemi/build.mk
+++ b/board/akemi/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/akemi/ec.tasklist b/board/akemi/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/akemi/ec.tasklist
+++ b/board/akemi/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/akemi/gpio.inc b/board/akemi/gpio.inc
index 1ea8cca58a..05466078c7 100644
--- a/board/akemi/gpio.inc
+++ b/board/akemi/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/akemi/led.c b/board/akemi/led.c
index 80d52f7cc2..49f767a28e 100644
--- a/board/akemi/led.c
+++ b/board/akemi/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,33 +19,35 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -58,7 +60,6 @@ __override void led_set_color_power(enum ec_led_colors color)
gpio_set_level(GPIO_LED_3_L, LED_OFF_LVL);
}
-
__override void led_set_color_battery(enum ec_led_colors color)
{
switch (color) {
diff --git a/board/aleena/battery.c b/board/aleena/battery.c
index b3abae7f73..0862ba209f 100644
--- a/board/aleena/battery.c
+++ b/board/aleena/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/aleena/board.c b/board/aleena/board.c
index 460c73fcdd..0970a7513c 100644
--- a/board/aleena/board.c
+++ b/board/aleena/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,52 +31,40 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_POWER_BUTTON_L,
GPIO_EC_RST_ODL,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "kblight",
- .port = I2C_PORT_KBLIGHT,
- .kbps = 100,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL_AP,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "kblight",
+ .port = I2C_PORT_KBLIGHT,
+ .kbps = 100,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -101,11 +89,9 @@ enum base_accelgyro_type {
BASE_GYRO_ICM426XX = 2,
};
-const mat33_fp_t base_standard_ref_icm426xx = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref_icm426xx = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm426xx_base_accel = {
.name = "Base Accel",
@@ -136,20 +122,20 @@ struct motion_sensor_t icm426xx_base_accel = {
};
struct motion_sensor_t icm426xx_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &icm426xx_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_standard_ref_icm426xx,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm426xx_drv,
+ .mutex = &icm426xx_mutex,
+ .drv_data = &g_icm426xx_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_standard_ref_icm426xx,
+ .min_frequency = ICM426XX_GYRO_MIN_FREQ,
+ .max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
static enum base_accelgyro_type base_accelgyro_config;
@@ -179,18 +165,20 @@ static void board_detect_motionsensor(void)
if (board_is_convertible()) {
/* Check base accelgyro chip */
- ret = icm_read8(&icm426xx_base_accel,
- ICM426XX_REG_WHO_AM_I, &val);
+ ret = icm_read8(&icm426xx_base_accel, ICM426XX_REG_WHO_AM_I,
+ &val);
if (ret)
ccprints("Get ICM fail.");
if (val == ICM426XX_CHIP_ICM40608) {
motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
}
- base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608)
- ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160;
- ccprints("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608)
- ? "ICM40608" : "BMI160");
+ base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) ?
+ BASE_GYRO_ICM426XX :
+ BASE_GYRO_BMI160;
+ ccprints("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608) ?
+ "ICM40608" :
+ "BMI160");
}
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsensor,
@@ -207,8 +195,7 @@ void board_update_sensor_config_from_sku(void)
/* Device is clamshell only */
tablet_set_mode(0, TABLET_TRIGGER_LID);
/* Gyro is not present, don't allow line to float */
- gpio_set_flags(GPIO_6AXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_6AXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
}
@@ -230,15 +217,14 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_kblight_init, HOOK_PRIO_DEFAULT);
* The connector has 30 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/aleena/board.h b/board/aleena/board.h
index dab6f3de3a..f51b7b3e16 100644
--- a/board/aleena/board.h
+++ b/board/aleena/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -37,7 +37,7 @@
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCEL_KX022
@@ -51,17 +51,14 @@
/*
* Slew rate on the PP1800_SENSOR load switch requires a short delay on startup.
*/
-#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
+#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
#define CONFIG_MOTION_SENSE_RESUME_DELAY_US (10 * MSEC)
#define CONFIG_KEYBOARD_FACTORY_TEST
#ifndef __ASSEMBLER__
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
enum battery_type {
BATTERY_PANASONIC,
diff --git a/board/aleena/build.mk b/board/aleena/build.mk
index c808e65aed..d24127ddae 100644
--- a/board/aleena/build.mk
+++ b/board/aleena/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/aleena/ec.tasklist b/board/aleena/ec.tasklist
index dc898c4502..9572d61c8f 100644
--- a/board/aleena/ec.tasklist
+++ b/board/aleena/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/aleena/gpio.inc b/board/aleena/gpio.inc
index 6fefcf88f1..669c833e56 100644
--- a/board/aleena/gpio.inc
+++ b/board/aleena/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/aleena/led.c b/board/aleena/led.c
index 4774a39045..c24bc404cc 100644
--- a/board/aleena/led.c
+++ b/board/aleena/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,10 +10,10 @@
#include "hooks.h"
#include "console.h"
-#define CPRINTS(format, args...) cprints(CC_HOOK, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_HOOK, format, ##args)
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -29,18 +29,24 @@ static enum gpio_signal led_blue = GPIO_BAT_LED_2_L;
/* Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
@@ -48,10 +54,9 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
static void board_led_init(void)
{
- int board_id =
- (gpio_get_level(GPIO_BOARD_VERSION3) << 2) |
- (gpio_get_level(GPIO_BOARD_VERSION2) << 1) |
- (gpio_get_level(GPIO_BOARD_VERSION1) << 0);
+ int board_id = (gpio_get_level(GPIO_BOARD_VERSION3) << 2) |
+ (gpio_get_level(GPIO_BOARD_VERSION2) << 1) |
+ (gpio_get_level(GPIO_BOARD_VERSION1) << 0);
CPRINTS("board_id=%d", board_id);
@@ -60,7 +65,6 @@ static void board_led_init(void)
led_blue = GPIO_BAT_LED_1_L;
CPRINTS("LED: switch LED");
}
-
}
DECLARE_HOOK(HOOK_INIT, board_led_init, HOOK_PRIO_DEFAULT);
diff --git a/board/ambassador/board.c b/board/ambassador/board.c
index 5cf319bc79..f2bc7557ec 100644
--- a/board/ambassador/board.c
+++ b/board/ambassador/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,8 +45,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -88,8 +88,8 @@ uint16_t tcpc_get_alert_status(void)
}
/* Called when the charge manager has switched to a new port. */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Blink alert if insufficient power per system_can_boot_ap(). */
int insufficient_power =
@@ -105,14 +105,14 @@ static int32_t base_5v_power;
* Power usage for each port as measured or estimated.
* Units are milliwatts (5v x ma current)
*/
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1603)
-#define PWR_FRONT_LOW (5*963)
-#define PWR_REAR (5*1075)
-#define PWR_HDMI (5*562)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
+#define PWR_BASE_LOAD (5 * 1335)
+#define PWR_FRONT_HIGH (5 * 1603)
+#define PWR_FRONT_LOW (5 * 963)
+#define PWR_REAR (5 * 1075)
+#define PWR_HDMI (5 * 562)
+#define PWR_C_HIGH (5 * 3740)
+#define PWR_C_LOW (5 * 2090)
+#define PWR_MAX (5 * 10000)
/*
* Update the 5V power usage, assuming no throttling,
@@ -185,16 +185,14 @@ static const struct {
int current;
} bj_power[] = {
{ /* 0 - 65W (also default) */
- .voltage = 19000,
- .current = 3420
- },
+ .voltage = 19000,
+ .current = 3420 },
{ /* 1 - 90W */
- .voltage = 19000,
- .current = 4740
- },
+ .voltage = 19000,
+ .current = 4740 },
};
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/* Debounced connection state of the barrel jack */
static int8_t adp_connected = -1;
static void adp_connect_deferred(void)
@@ -239,27 +237,25 @@ static void adp_state_init(void)
}
DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
-
#include "gpio_list.h" /* Must come after other header files. */
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_WHITE] = { .channel = 2,
- .flags = PWM_CONFIG_DSLEEP,
- .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_LED_WHITE] = { .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
/******************************************************************************/
@@ -275,52 +271,44 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
};
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "ina",
- .port = I2C_PORT_INA,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "ppc0",
- .port = I2C_PORT_PPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 400,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -376,15 +364,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
+const enum gpio_signal hibernate_wake_pins[] = {};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -403,7 +390,7 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -412,8 +399,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
@@ -432,8 +419,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
@@ -535,16 +522,13 @@ static void board_chipset_startup(void)
if (ppc_is_sourcing_vbus(0))
ppc_vbus_source_enable(0, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
/******************************************************************************/
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .i2c_port = I2C_PORT_PPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ [USB_PD_PORT_TCPC_0] = { .i2c_port = I2C_PORT_PPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -577,14 +561,12 @@ static void board_tcpc_init(void)
/*
* By default configured as output low.
*/
- gpio_set_flags(GPIO_USB_A4_OC_ODL,
- GPIO_INPUT | GPIO_INT_BOTH);
+ gpio_set_flags(GPIO_USB_A4_OC_ODL, GPIO_INPUT | GPIO_INT_BOTH);
gpio_enable_interrupt(GPIO_USB_A4_OC_ODL);
} else {
/* Ensure no interrupts from pin */
gpio_disable_interrupt(GPIO_USB_A4_OC_ODL);
}
-
}
/* Make sure this is called after fw_config is initialised */
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2);
@@ -703,8 +685,8 @@ void board_enable_s0_rails(int enable)
unsigned int ec_config_get_bj_power(void)
{
- unsigned int bj =
- (fw_config & EC_CFG_BJ_POWER_MASK) >> EC_CFG_BJ_POWER_L;
+ unsigned int bj = (fw_config & EC_CFG_BJ_POWER_MASK) >>
+ EC_CFG_BJ_POWER_L;
/* Out of range value defaults to 0 */
if (bj >= ARRAY_SIZE(bj_power))
bj = 0;
@@ -779,23 +761,23 @@ DECLARE_HOOK(HOOK_INIT, setup_thermal, HOOK_PRIO_DEFAULT - 1);
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
+#define THROT_TYPE_A BIT(0)
+#define THROT_TYPE_C BIT(1)
+#define THROT_PROCHOT BIT(2)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -810,8 +792,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
@@ -839,7 +820,7 @@ static void power_monitor(void)
*/
power = (adc_read_channel(ADC_VBUS) *
adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
+ 1000;
/* Init power table */
if (history[0] == 0) {
for (i = 0; i < POWER_READINGS; i++)
@@ -866,8 +847,7 @@ static void power_monitor(void)
* For barrel-jack supplies, the rating can be
* exceeded briefly, so use the average.
*/
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
power = max;
else
power = total / POWER_READINGS;
@@ -959,8 +939,9 @@ static void power_monitor(void)
gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
}
if (diff & THROT_TYPE_C) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
diff --git a/board/ambassador/board.h b/board/ambassador/board.h
index c6aac262c5..fb9659bda7 100644
--- a/board/ambassador/board.h
+++ b/board/ambassador/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
#define CONFIG_UART_TX_BUF_SIZE 4096
/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
/* Internal SPI flash on NPCX796FC is 512 kB */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
@@ -40,7 +40,7 @@
#undef CONFIG_HIBERNATE
#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
#define CONFIG_PWM
#define CONFIG_VBOOT_EFS2
@@ -85,7 +85,7 @@
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
/* Dedicated barreljack charger port */
-#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
#define DEDICATED_CHARGE_PORT 1
@@ -104,15 +104,15 @@
#define CONFIG_INA3221
/* b/143501304 */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Fan and temp. */
#define CONFIG_FANS 1
@@ -136,7 +136,7 @@
#define CONFIG_USB_PD_DECODE_SOP
#undef CONFIG_USB_CHARGER
#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PID 0x5040
+#define CONFIG_USB_PID 0x5040
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DISCHARGE_PPC
@@ -156,7 +156,7 @@
#define CONFIG_USBC_VCONN
#define CONFIG_USBC_VCONN_SWAP
-#define USB_PD_PORT_TCPC_0 0
+#define USB_PD_PORT_TCPC_0 0
#define BOARD_TCPC_C0_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS
#define BOARD_TCPC_C0_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS
@@ -168,12 +168,12 @@
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_INA NPCX_I2C_PORT0_0
+#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
@@ -191,11 +191,11 @@ enum charge_port {
};
enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_SNS_PP3300, /* ADC2 */
+ ADC_SNS_PP1050, /* ADC7 */
+ ADC_VBUS, /* ADC4 */
+ ADC_PPVAR_IMON, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
/* Number of ADC channels */
ADC_CH_COUNT
};
@@ -220,11 +220,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_CORE,
- TEMP_SENSOR_COUNT
-};
-
+enum temp_sensor_id { TEMP_SENSOR_CORE, TEMP_SENSOR_COUNT };
/* Board specific handlers */
void board_reset_pd_mcu(void);
@@ -238,20 +234,20 @@ void show_critical_error(void);
/*
* Barrel-jack power (4 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 3
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
/*
* USB Connector 4 not present (1 bit).
*/
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
+#define EC_CFG_NO_USB4_L 4
+#define EC_CFG_NO_USB4_H 4
#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
/*
* Thermal solution config (3 bits).
*/
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
+#define EC_CFG_THERMAL_L 5
+#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
unsigned int ec_config_get_bj_power(void);
@@ -261,30 +257,30 @@ unsigned int ec_config_get_thermal_solution(void);
#endif /* !__ASSEMBLER__ */
/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
/*
* There is no RSMRST input, so alias it to the output. This short-circuits
* common_intel_x86_handle_rsmrst.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/ambassador/build.mk b/board/ambassador/build.mk
index 0f55c45f77..f9096c64ff 100644
--- a/board/ambassador/build.mk
+++ b/board/ambassador/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/ambassador/ec.tasklist b/board/ambassador/ec.tasklist
index f820cf903c..42b9542d96 100644
--- a/board/ambassador/ec.tasklist
+++ b/board/ambassador/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/ambassador/gpio.inc b/board/ambassador/gpio.inc
index 871031ebf9..46b6118ce2 100644
--- a/board/ambassador/gpio.inc
+++ b/board/ambassador/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
/* EC output, but also interrupt so this can be polled as a power signal */
GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
#endif
GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/ambassador/led.c b/board/ambassador/led.c
index 659a63a483..3baf867580 100644
--- a/board/ambassador/led.c
+++ b/board/ambassador/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -89,9 +89,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -216,7 +216,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
diff --git a/board/ambassador/usb_pd_policy.c b/board/ambassador/usb_pd_policy.c
index 5bc754453a..fbb4edf23e 100644
--- a/board/ambassador/usb_pd_policy.c
+++ b/board/ambassador/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,9 +19,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/ampton/battery.c b/board/ampton/battery.c
index f52f0d5d7a..18bf4e591a 100644
--- a/board/ampton/battery.c
+++ b/board/ampton/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 3e7bee1993..f1346a6b07 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -65,8 +65,8 @@ int ppc_get_alert_status(int port)
/******************************************************************************/
/* USB-C MUX Configuration */
-#define USB_PD_PORT_ITE_0 0
-#define USB_PD_PORT_ITE_1 1
+#define USB_PD_PORT_ITE_0 0
+#define USB_PD_PORT_ITE_1 1
static int tune_mux(const struct usb_mux *me);
@@ -101,8 +101,8 @@ static int tune_mux(const struct usb_mux *me)
/* Auto EQ disabled, compensate for channel lost up to 3.6dB */
RETURN_ERROR(mux_write(me, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98));
/* DP output swing adjustment +15% */
- RETURN_ERROR(mux_write(me, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION,
- 0xc0));
+ RETURN_ERROR(
+ mux_write(me, PS8XXX_REG_MUX_DP_OUTPUT_CONFIGURATION, 0xc0));
return EC_SUCCESS;
}
@@ -110,44 +110,44 @@ static int tune_mux(const struct usb_mux *me)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus C0 sensing (10x voltage divider). PPVAR_USB_C0_VBUS */
- [ADC_VBUS_C0] = {.name = "VBUS_C0",
- .factor_mul = 10 * ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13},
+ [ADC_VBUS_C0] = { .name = "VBUS_C0",
+ .factor_mul = 10 * ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
/* Vbus C1 sensing (10x voltage divider). SUB_EC_ADC */
- [ADC_VBUS_C1] = {.name = "VBUS_C1",
- .factor_mul = 10 * ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH14},
+ [ADC_VBUS_C1] = { .name = "VBUS_C1",
+ .factor_mul = 10 * ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH14 },
/* Convert to raw mV for thermistor table lookup */
- [ADC_TEMP_SENSOR_AMB] = {.name = "TEMP_AMB",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3},
+ [ADC_TEMP_SENSOR_AMB] = { .name = "TEMP_AMB",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
/* Convert to raw mV for thermistor table lookup */
- [ADC_TEMP_SENSOR_CHARGER] = {.name = "TEMP_CHARGER",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH5},
+ [ADC_TEMP_SENSOR_CHARGER] = { .name = "TEMP_CHARGER",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH5 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -156,35 +156,25 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t gyro_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t gyro_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref_icm42607 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_icm42607 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref_sku57 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_standard_ref_sku57 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
static struct bmi_drv_data_t g_bmi160_data;
@@ -355,9 +345,9 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
static int board_is_convertible(void)
{
/* SKU IDs of Ampton & unprovisioned: 1, 2, 3, 4, 255 */
- return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4
- || sku_id == 57 || sku_id == 255;
- }
+ return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4 ||
+ sku_id == 57 || sku_id == 255;
+}
static int board_with_sensor_bma253(void)
{
@@ -389,13 +379,12 @@ static void board_update_sensor_config_from_sku(void)
if (board_with_sensor_icm42607()) {
motion_sensors[BASE_ACCEL] =
motion_sensor_accel_icm42607;
- motion_sensors[BASE_GYRO] =
- motion_sensor_gyro_icm42607;
+ motion_sensors[BASE_GYRO] = motion_sensor_gyro_icm42607;
ccprints("Gyro sensor: ICM-42607");
}
if (sku_id == 57)
motion_sensors[LID_ACCEL].rot_standard_ref =
- &lid_standard_ref_sku57;
+ &lid_standard_ref_sku57;
/* Enable Base Accel interrupt */
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
diff --git a/board/ampton/board.h b/board/ampton/board.h
index d0a3cf5bc0..4a00f82cd2 100644
--- a/board/ampton/board.h
+++ b/board/ampton/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* I2C bus configuraiton */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
/* EC console commands */
#define CONFIG_CMD_ACCELS
@@ -28,7 +28,7 @@
#define CONFIG_LED_COMMON
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
/* Sensors */
#define CONFIG_TEMP_SENSOR
@@ -38,11 +38,11 @@
#define CONFIG_TEMP_SENSOR_POWER
#define GPIO_TEMP_SENSOR_POWER GPIO_EN_PP3300
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_ICM42607 /* Base accel */
-#define CONFIG_SYNC /* Camera VSYNC */
+#define CONFIG_SYNC /* Camera VSYNC */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
@@ -57,8 +57,7 @@
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_ICM42607_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
/* Keyboard backlight is unimplemented in hardware */
#undef CONFIG_PWM
@@ -90,13 +89,7 @@ enum temp_sensor_id {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- VSYNC,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, VSYNC, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/ampton/build.mk b/board/ampton/build.mk
index cc6b73093e..daf4529f19 100644
--- a/board/ampton/build.mk
+++ b/board/ampton/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/ampton/ec.tasklist b/board/ampton/ec.tasklist
index 2703dd0b5c..466dd4c60f 100644
--- a/board/ampton/ec.tasklist
+++ b/board/ampton/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc
index 854a28655d..c1d7769668 100644
--- a/board/ampton/gpio.inc
+++ b/board/ampton/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/ampton/led.c b/board/ampton/led.c
index 40b0acdd9c..02bafec4e0 100644
--- a/board/ampton/led.c
+++ b/board/ampton/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1;
@@ -19,19 +19,27 @@ __override const int led_charge_lvl_2 = 94;
/* Ampton: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/anahera/battery.c b/board/anahera/battery.c
index 95ca9be206..f7b0b6f43f 100644
--- a/board/anahera/battery.c
+++ b/board/anahera/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/anahera/board.c b/board/anahera/board.c
index b7110951ce..e087d629a7 100644
--- a/board/anahera/board.c
+++ b/board/anahera/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,8 +28,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -66,14 +66,13 @@ enum battery_present battery_hw_present(void)
}
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Limit the input current to 95% negotiated limit,
* to account for the charger chip margin.
*/
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/anahera/board.h b/board/anahera/board.h
index 4730eba213..18360171e3 100644
--- a/board/anahera/board.h
+++ b/board/anahera/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,7 +29,7 @@
#undef CONFIG_VOLUME_BUTTONS
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
#define CONFIG_USBC_RETIMER_PS8811
@@ -38,7 +38,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_FRS_PPC
@@ -48,17 +48,17 @@
#define CONFIG_USBC_PPC_NX20P3483
/* TODO: b/193452481 - measure and check these values on redrix */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -66,64 +66,64 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_USB_A0_RETIMER NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_A1_RETIMER NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_A0_RETIMER NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_A1_RETIMER NPCX_I2C_PORT6_1
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/*
* see b/174768555#comment22
*/
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x58
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
@@ -141,17 +141,17 @@
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan features */
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
#define CONFIG_CUSTOM_FAN_CONTROL
-#define RPM_DEVIATION 1
+#define RPM_DEVIATION 1
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
/* Keyboard features */
#define CONFIG_KEYBOARD_FACTORY_TEST
@@ -160,7 +160,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -180,11 +180,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
enum battery_type {
BATTERY_SIMPLO_HIGHPOWER,
@@ -193,20 +189,14 @@ enum battery_type {
};
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
extern const int keyboard_factory_scan_pins[][2];
diff --git a/board/anahera/build.mk b/board/anahera/build.mk
index b3aef429a6..dda59fdd82 100644
--- a/board/anahera/build.mk
+++ b/board/anahera/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/anahera/charger.c b/board/anahera/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/anahera/charger.c
+++ b/board/anahera/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/anahera/ec.tasklist b/board/anahera/ec.tasklist
index 187609f36e..ebbfd239f9 100644
--- a/board/anahera/ec.tasklist
+++ b/board/anahera/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/anahera/fans.c b/board/anahera/fans.c
index 61671fd0a7..7d08701dc0 100644
--- a/board/anahera/fans.c
+++ b/board/anahera/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/anahera/fw_config.c b/board/anahera/fw_config.c
index 3c64f055f6..6073384f53 100644
--- a/board/anahera/fw_config.c
+++ b/board/anahera/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union anahera_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/anahera/fw_config.h b/board/anahera/fw_config.h
index 92bc9e55e7..32787c1e4f 100644
--- a/board/anahera/fw_config.h
+++ b/board/anahera/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,10 +19,7 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_eps_type {
- EPS_DISABLED = 0,
- EPS_ENABLED = 1
-};
+enum ec_cfg_eps_type { EPS_DISABLED = 0, EPS_ENABLED = 1 };
enum ec_cfg_ite_type {
LTE_NOT_PRESENT = 0,
@@ -31,14 +28,14 @@ enum ec_cfg_ite_type {
union anahera_cbi_fw_config {
struct {
- uint32_t sd_db : 2;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- enum ec_cfg_ite_type lte_db : 2;
- uint32_t ufc : 2;
- enum ec_cfg_eps_type eps : 1;
- uint32_t boot_device : 2;
- uint32_t reserved_1 : 19;
+ uint32_t sd_db : 2;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ enum ec_cfg_ite_type lte_db : 2;
+ uint32_t ufc : 2;
+ enum ec_cfg_eps_type eps : 1;
+ uint32_t boot_device : 2;
+ uint32_t reserved_1 : 19;
};
uint32_t raw_value;
};
diff --git a/board/anahera/gpio.inc b/board/anahera/gpio.inc
index 794e8750b4..5cce74abff 100644
--- a/board/anahera/gpio.inc
+++ b/board/anahera/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/anahera/i2c.c b/board/anahera/i2c.c
index 7748066514..7e7993b4d5 100644
--- a/board/anahera/i2c.c
+++ b/board/anahera/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/anahera/keyboard.c b/board/anahera/keyboard.c
index 782ba0d0db..8588191460 100644
--- a/board/anahera/keyboard.c
+++ b/board/anahera/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -154,13 +154,13 @@ board_vivaldi_keybd_config(void)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/anahera/led.c b/board/anahera/led.c
index ce172c7b1e..d7a3d07efc 100644
--- a/board/anahera/led.c
+++ b/board/anahera/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -26,15 +26,13 @@
#define BATT_LOW_BCT 10
#define LED_TICK_INTERVAL_MS (500 * MSEC)
-#define LED_CYCLE_TIME_MS (2000 * MSEC)
-#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
-#define LED_ON_TIME_MS (1000 * MSEC)
-#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED
-};
+#define LED_CYCLE_TIME_MS (2000 * MSEC)
+#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1000 * MSEC)
+#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -42,22 +40,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- LEFT_PORT = 0,
- RIGHT_PORT
-};
+enum led_port { LEFT_PORT = 0, RIGHT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_C1_CHARGE_LED_AMBER_L :
- GPIO_C0_CHARGE_LED_AMBER_L);
+ GPIO_C0_CHARGE_LED_AMBER_L);
white_led = (port == RIGHT_PORT ? GPIO_C1_CHARGE_LED_WHITE_L :
- GPIO_C0_CHARGE_LED_WHITE_L);
+ GPIO_C0_CHARGE_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -129,18 +124,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static unsigned int battery_ticks;
- uint32_t chflags = charge_get_flags();
-
battery_ticks++;
switch (charge_get_state()) {
@@ -155,43 +148,52 @@ static void led_set_battery(void)
*/
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < BATT_LOW_BCT)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
if (charge_get_percent() < BATT_LOW_BCT)
- led_set_color_battery(LEFT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ LEFT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(LEFT_PORT, LED_OFF);
}
break;
case PWR_STATE_ERROR:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
- led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1)
- ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
- led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1)
- ? LED_AMBER : LED_OFF);
+ led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) ?
+ LED_AMBER :
+ LED_OFF);
}
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/anahera/pwm.c b/board/anahera/pwm.c
index 54d0d05afb..b242683306 100644
--- a/board/anahera/pwm.c
+++ b/board/anahera/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/anahera/sensors.c b/board/anahera/sensors.c
index 851930d1d3..05d9a9080b 100644
--- a/board/anahera/sensors.c
+++ b/board/anahera/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,38 +44,30 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_FAN] = {
- .name = "Fan",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_FAN
- },
- [TEMP_SENSOR_2_SOC] = {
- .name = "SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_SOC
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
- [TEMP_SENSOR_4_REGULATOR] = {
- .name = "Regulator",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_REGULATOR
- },
+ [TEMP_SENSOR_1_FAN] = { .name = "Fan",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_FAN },
+ [TEMP_SENSOR_2_SOC] = { .name = "SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_SOC },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
+ [TEMP_SENSOR_4_REGULATOR] = { .name = "Regulator",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_REGULATOR },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -94,8 +86,8 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -109,8 +101,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
@@ -125,8 +117,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_REGULATOR \
- { \
+#define THERMAL_REGULATOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(55), \
[EC_TEMP_THRESH_HALT] = C_TO_K(60), \
diff --git a/board/anahera/thermal.c b/board/anahera/thermal.c
index 8bd670c22a..b5b5a0c1cc 100644
--- a/board/anahera/thermal.c
+++ b/board/anahera/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,7 +15,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -37,45 +37,45 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {53, 51, 0, -1},
- .off = {99, 99, 99, -1},
- .rpm = {0},
+ .on = { 53, 51, 0, -1 },
+ .off = { 99, 99, 99, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {54, 52, 0, -1},
- .off = {52, 50, 99, -1},
- .rpm = {3000},
+ .on = { 54, 52, 0, -1 },
+ .off = { 52, 50, 99, -1 },
+ .rpm = { 3000 },
},
{
/* level 2 */
- .on = {55, 53, 0, -1},
- .off = {53, 51, 99, -1},
- .rpm = {3400},
+ .on = { 55, 53, 0, -1 },
+ .off = { 53, 51, 99, -1 },
+ .rpm = { 3400 },
},
{
/* level 3 */
- .on = {56, 54, 0, -1},
- .off = {54, 52, 99, -1},
- .rpm = {3800},
+ .on = { 56, 54, 0, -1 },
+ .off = { 54, 52, 99, -1 },
+ .rpm = { 3800 },
},
{
/* level 4 */
- .on = {57, 55, 54, -1},
- .off = {55, 53, 51, -1},
- .rpm = {4100},
+ .on = { 57, 55, 54, -1 },
+ .off = { 55, 53, 51, -1 },
+ .rpm = { 4100 },
},
{
/* level 5 */
- .on = {58, 56, 60, -1},
- .off = {56, 54, 52, -1},
- .rpm = {4400},
+ .on = { 58, 56, 60, -1 },
+ .off = { 56, 54, 52, -1 },
+ .rpm = { 4400 },
},
{
/* level 6 */
- .on = {100, 100, 100, -1},
- .off = {57, 59, 58, -1},
- .rpm = {4900},
+ .on = { 100, 100, 100, -1 },
+ .off = { 57, 59, 58, -1 },
+ .rpm = { 4900 },
},
};
@@ -99,11 +99,11 @@ int fan_table_to_rpm(int fan, int *temp)
temp[TEMP_SENSOR_3_CHARGER] < prev_tmp[TEMP_SENSOR_3_CHARGER]) {
for (i = current_level; i > 0; i--) {
if (temp[TEMP_SENSOR_1_FAN] <
- fan_table[i].off[TEMP_SENSOR_1_FAN] &&
+ fan_table[i].off[TEMP_SENSOR_1_FAN] &&
temp[TEMP_SENSOR_3_CHARGER] <
- fan_table[i].off[TEMP_SENSOR_3_CHARGER] &&
+ fan_table[i].off[TEMP_SENSOR_3_CHARGER] &&
temp[TEMP_SENSOR_2_SOC] <
- fan_table[i].off[TEMP_SENSOR_2_SOC])
+ fan_table[i].off[TEMP_SENSOR_2_SOC])
current_level = i - 1;
else
break;
@@ -111,14 +111,14 @@ int fan_table_to_rpm(int fan, int *temp)
} else if (temp[TEMP_SENSOR_1_FAN] > prev_tmp[TEMP_SENSOR_1_FAN] ||
temp[TEMP_SENSOR_2_SOC] > prev_tmp[TEMP_SENSOR_2_SOC] ||
temp[TEMP_SENSOR_3_CHARGER] >
- prev_tmp[TEMP_SENSOR_3_CHARGER]) {
+ prev_tmp[TEMP_SENSOR_3_CHARGER]) {
for (i = current_level; i < NUM_FAN_LEVELS; i++) {
if ((temp[TEMP_SENSOR_1_FAN] >
- fan_table[i].on[TEMP_SENSOR_1_FAN] &&
- temp[TEMP_SENSOR_3_CHARGER] >
- fan_table[i].on[TEMP_SENSOR_3_CHARGER]) ||
+ fan_table[i].on[TEMP_SENSOR_1_FAN] &&
+ temp[TEMP_SENSOR_3_CHARGER] >
+ fan_table[i].on[TEMP_SENSOR_3_CHARGER]) ||
temp[TEMP_SENSOR_2_SOC] >
- fan_table[i].on[TEMP_SENSOR_2_SOC])
+ fan_table[i].on[TEMP_SENSOR_2_SOC])
current_level = i + 1;
else
break;
@@ -139,10 +139,8 @@ int fan_table_to_rpm(int fan, int *temp)
void board_override_fan_control(int fan, int *tmp)
{
- if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, tmp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp));
}
}
diff --git a/board/anahera/usbc_config.c b/board/anahera/usbc_config.c
index 52b6b498f0..b0fd5551d9 100644
--- a/board/anahera/usbc_config.c
+++ b/board/anahera/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,8 +32,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -79,33 +79,43 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -321,33 +331,33 @@ const static struct ps8811_reg_val equalizer_wwan_table[] = {
{
/* Set channel A EQ setting */
.reg = PS8811_REG1_USB_AEQ_LEVEL,
- .val = (PS8811_AEQ_I2C_LEVEL_UP_13DB <<
- PS8811_AEQ_I2C_LEVEL_UP_SHIFT) |
- (PS8811_AEQ_PIN_LEVEL_UP_18DB <<
- PS8811_AEQ_PIN_LEVEL_UP_SHIFT),
+ .val = (PS8811_AEQ_I2C_LEVEL_UP_13DB
+ << PS8811_AEQ_I2C_LEVEL_UP_SHIFT) |
+ (PS8811_AEQ_PIN_LEVEL_UP_18DB
+ << PS8811_AEQ_PIN_LEVEL_UP_SHIFT),
},
{
/* Set ADE pin setting */
.reg = PS8811_REG1_USB_ADE_CONFIG,
- .val = (PS8811_ADE_PIN_MID_LEVEL_3DB <<
- PS8811_ADE_PIN_MID_LEVEL_SHIFT) |
- PS8811_AEQ_CONFIG_REG_ENABLE |
- PS8811_AEQ_ADAPTIVE_REG_ENABLE,
+ .val = (PS8811_ADE_PIN_MID_LEVEL_3DB
+ << PS8811_ADE_PIN_MID_LEVEL_SHIFT) |
+ PS8811_AEQ_CONFIG_REG_ENABLE |
+ PS8811_AEQ_ADAPTIVE_REG_ENABLE,
},
{
/* Set channel B EQ setting */
.reg = PS8811_REG1_USB_BEQ_LEVEL,
- .val = (PS8811_BEQ_I2C_LEVEL_UP_10P5DB <<
- PS8811_BEQ_I2C_LEVEL_UP_SHIFT) |
- (PS8811_BEQ_PIN_LEVEL_UP_18DB <<
- PS8811_BEQ_PIN_LEVEL_UP_SHIFT),
+ .val = (PS8811_BEQ_I2C_LEVEL_UP_10P5DB
+ << PS8811_BEQ_I2C_LEVEL_UP_SHIFT) |
+ (PS8811_BEQ_PIN_LEVEL_UP_18DB
+ << PS8811_BEQ_PIN_LEVEL_UP_SHIFT),
},
{
/* Set BDE pin setting */
.reg = PS8811_REG1_USB_BDE_CONFIG,
- .val = (PS8811_BDE_PIN_MID_LEVEL_3DB <<
- PS8811_BDE_PIN_MID_LEVEL_SHIFT) |
- PS8811_BEQ_CONFIG_REG_ENABLE,
+ .val = (PS8811_BDE_PIN_MID_LEVEL_3DB
+ << PS8811_BDE_PIN_MID_LEVEL_SHIFT) |
+ PS8811_BEQ_CONFIG_REG_ENABLE,
},
};
@@ -357,8 +367,8 @@ const static struct ps8811_reg_val equalizer_wlan_table[] = {
{
/* Set 50ohm adjust for B channel */
.reg = PS8811_REG1_50OHM_ADJUST_CHAN_B,
- .val = (PS8811_50OHM_ADJUST_CHAN_B_MINUS_9PCT <<
- PS8811_50OHM_ADJUST_CHAN_B_SHIFT),
+ .val = (PS8811_50OHM_ADJUST_CHAN_B_MINUS_9PCT
+ << PS8811_50OHM_ADJUST_CHAN_B_SHIFT),
},
};
@@ -371,16 +381,16 @@ static int usba_retimer_init(int port)
int i;
const struct usb_mux *me = &usba_ps8811[port];
- rv = ps8811_i2c_read(me, PS8811_REG_PAGE1,
- PS8811_REG1_USB_BEQ_LEVEL, &val);
+ rv = ps8811_i2c_read(me, PS8811_REG_PAGE1, PS8811_REG1_USB_BEQ_LEVEL,
+ &val);
switch (port) {
case USBA_PORT_A0:
/* Set channel A output swing */
- rv = ps8811_i2c_field_update(
- me, PS8811_REG_PAGE1, PS8811_REG1_USB_CHAN_A_SWING,
- PS8811_CHAN_A_SWING_MASK,
- 0x2 << PS8811_CHAN_A_SWING_SHIFT);
+ rv = ps8811_i2c_field_update(me, PS8811_REG_PAGE1,
+ PS8811_REG1_USB_CHAN_A_SWING,
+ PS8811_CHAN_A_SWING_MASK,
+ 0x2 << PS8811_CHAN_A_SWING_SHIFT);
break;
case USBA_PORT_A1:
if (ec_cfg_has_lte()) {
@@ -403,9 +413,9 @@ static int usba_retimer_init(int port)
PS8811_REG1_USB_CHAN_B_DE_PS_MSB,
PS8811_CHAN_B_DE_PS_MSB_MASK, 0x16);
-
for (i = 0; i < NUM_EQ_WWAN_ARRAY; i++)
- rv |= ps8811_i2c_write(me, PS8811_REG_PAGE1,
+ rv |= ps8811_i2c_write(
+ me, PS8811_REG_PAGE1,
equalizer_wwan_table[i].reg,
equalizer_wwan_table[i].val);
} else {
@@ -416,9 +426,9 @@ static int usba_retimer_init(int port)
PS8811_CHAN_A_SWING_MASK,
0x2 << PS8811_CHAN_A_SWING_SHIFT);
-
for (i = 0; i < NUM_EQ_WLAN_ARRAY; i++)
- rv |= ps8811_i2c_write(me, PS8811_REG_PAGE1,
+ rv |= ps8811_i2c_write(
+ me, PS8811_REG_PAGE1,
equalizer_wlan_table[i].reg,
equalizer_wlan_table[i].val);
}
diff --git a/board/anahera/usbc_config.h b/board/anahera/usbc_config.h
index b42c0f59fe..c476919027 100644
--- a/board/anahera/usbc_config.h
+++ b/board/anahera/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,21 +8,13 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* USB-A ports */
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
/* USB-C ports */
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
struct ps8811_reg_val {
uint8_t reg;
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c
index b23784cd38..d340f61251 100644
--- a/board/arcada_ish/board.c
+++ b/board/arcada_ish/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,11 +42,9 @@ static struct stprivate_data g_lis2dh_data;
static struct lis2mdl_private_data lis2mdl_a_data;
/* Matrix to rotate lid sensor into standard reference frame */
-const mat33_fp_t lid_rot_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_rot_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
@@ -155,8 +153,7 @@ int board_sensor_at_360(void)
* closed at 0 degrees. Ignore the hall sensor when the lid close is
* also active.
*/
- return lid_is_open() &&
- !gpio_get_level(GPIO_TABLET_MODE_L);
+ return lid_is_open() && !gpio_get_level(GPIO_TABLET_MODE_L);
}
/* Initialize board. */
diff --git a/board/arcada_ish/board.h b/board/arcada_ish/board.h
index bf05a48697..129640d60f 100644
--- a/board/arcada_ish/board.h
+++ b/board/arcada_ish/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* ISH specific*/
-#undef CONFIG_DEBUG_ASSERT
+#undef CONFIG_DEBUG_ASSERT
#define CONFIG_CLOCK_CRYSTAL
/* EC */
#define CONFIG_FLASH_SIZE_BYTES 0x80000
@@ -24,13 +24,13 @@
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define CONFIG_ACCEL_LNG2DM /* Base sensor: LNG2DM
- * (uses LIS2DH driver)
- */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Lid sensor: LSM6DS3
- * (uses LSM6DSM driver)
- */
-#define CONFIG_MAG_LIS2MDL /* Lid sensor: LIS2DML */
+#define CONFIG_ACCEL_LNG2DM /* Base sensor: LNG2DM \
+ * (uses LIS2DH driver) \
+ */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Lid sensor: LSM6DS3 \
+ * (uses LSM6DSM driver) \
+ */
+#define CONFIG_MAG_LIS2MDL /* Lid sensor: LIS2DML */
#define CONFIG_MAG_CALIBRATE
/* Enable sensor fifo, must also define the _SIZE and _THRES */
@@ -40,7 +40,7 @@
/* Depends on how fast the AP boots and typical ODRs. */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(BASE_ACCEL) | BIT(LID_MAG))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(BASE_ACCEL) | BIT(LID_MAG))
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
@@ -99,8 +99,8 @@
#define CONFIG_ISH_PM_D3
#define CONFIG_ISH_PM_RESET_PREP
-#define CONFIG_ISH_D0I2_MIN_USEC (15*MSEC) /* need final tune */
-#define CONFIG_ISH_D0I3_MIN_USEC (100*MSEC) /* need final tune */
+#define CONFIG_ISH_D0I2_MIN_USEC (15 * MSEC) /* need final tune */
+#define CONFIG_ISH_D0I3_MIN_USEC (100 * MSEC) /* need final tune */
#ifndef __ASSEMBLER__
@@ -112,13 +112,7 @@
* Note: Since we aren't using LPC memory map to transmit sensor data, the
* order of this enum does not need to be accel, accel, gyro
*/
-enum sensor_id {
- LID_ACCEL,
- LID_GYRO,
- BASE_ACCEL,
- LID_MAG,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, LID_GYRO, BASE_ACCEL, LID_MAG, SENSOR_COUNT };
#endif /* !__ASSEMBLER__ */
diff --git a/board/arcada_ish/build.mk b/board/arcada_ish/build.mk
index a57c08e6ba..80cf4886eb 100644
--- a/board/arcada_ish/build.mk
+++ b/board/arcada_ish/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/arcada_ish/ec.tasklist b/board/arcada_ish/ec.tasklist
index d72fdf309e..81d3c5dc20 100644
--- a/board/arcada_ish/ec.tasklist
+++ b/board/arcada_ish/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/arcada_ish/gpio.inc b/board/arcada_ish/gpio.inc
index 336f807269..6a577d0efe 100644
--- a/board/arcada_ish/gpio.inc
+++ b/board/arcada_ish/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/asurada/battery.c b/board/asurada/battery.c
index 6237a5058c..ad49477366 100644
--- a/board/asurada/battery.c
+++ b/board/asurada/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/asurada/board.c b/board/asurada/board.c
index 83c95722ef..4e4aede76d 100644
--- a/board/asurada/board.c
+++ b/board/asurada/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -66,17 +66,15 @@ static enum base_accelgyro_type base_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
/* for rev 0 */
static const mat33_fp_t base_standard_ref_rev0 = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1)},
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
static void update_rotation_matrix(void)
{
- motion_sensors[BASE_ACCEL].rot_standard_ref =
- &base_standard_ref_rev0;
- motion_sensors[BASE_GYRO].rot_standard_ref =
- &base_standard_ref_rev0;
+ motion_sensors[BASE_ACCEL].rot_standard_ref = &base_standard_ref_rev0;
+ motion_sensors[BASE_GYRO].rot_standard_ref = &base_standard_ref_rev0;
}
DECLARE_HOOK(HOOK_INIT, update_rotation_matrix, HOOK_PRIO_INIT_ADC + 2);
@@ -138,9 +136,9 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
/* Matrix to rotate accelerometer into standard reference frame */
/* for Hayato */
static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0 , 0},
- {0, 0, FLOAT_TO_FP(1)},
+ { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) },
};
static void update_rotation_matrix(void)
@@ -151,8 +149,7 @@ static void update_rotation_matrix(void)
if (board_get_version() >= 2) {
motion_sensors[BASE_ACCEL].rot_standard_ref =
&base_standard_ref;
- motion_sensors[BASE_GYRO].rot_standard_ref =
- &base_standard_ref;
+ motion_sensors[BASE_GYRO].rot_standard_ref = &base_standard_ref;
}
}
DECLARE_HOOK(HOOK_INIT, update_rotation_matrix, HOOK_PRIO_INIT_ADC + 2);
@@ -340,28 +337,27 @@ static void board_detect_motionsense(void)
if (val == ICM426XX_CHIP_ICM40608) {
motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
- base_accelgyro_config = BASE_GYRO_ICM426XX;
+ base_accelgyro_config = BASE_GYRO_ICM426XX;
ccprints("Base Accelgyro: ICM426XX");
} else {
base_accelgyro_config = BASE_GYRO_BMI160;
ccprints("Base Accelgyro: BMI160");
}
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsense,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsense, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_INIT, board_detect_motionsense, HOOK_PRIO_DEFAULT);
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
/* Convert to mV (3000mV/1024). */
- {"VBUS_C0", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH0},
- {"BOARD_ID_0", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1},
- {"BOARD_ID_1", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2},
+ { "VBUS_C0", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH0 },
+ { "BOARD_ID_0", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1 },
+ { "BOARD_ID_1", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2 },
/* AMON/BMON gain = 17.97 */
- {"CHARGER_AMON_R", ADC_MAX_MVOLT * 1000 / 17.97, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH3},
- {"VBUS_C1", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5},
- {"CHARGER_PMON", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH6},
+ { "CHARGER_AMON_R", ADC_MAX_MVOLT * 1000 / 17.97, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH3 },
+ { "VBUS_C1", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5 },
+ { "CHARGER_PMON", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH6 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -374,24 +370,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
* number of pwm channel greater than three.
*/
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED1] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_LED2] = {
- .channel = 1,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_LED3] = {
- .channel = 2,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
+ [PWM_CH_LED1] = { .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_LED2] = { .channel = 1,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_LED3] = { .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/asurada/board.h b/board/asurada/board.h
index 85b10e69b3..6d9a19b884 100644
--- a/board/asurada/board.h
+++ b/board/asurada/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,7 +41,7 @@
#define PD_MAX_VOLTAGE_MV 20000
#define PD_MAX_POWER_MW 60000
#endif
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* Optional console commands */
@@ -49,7 +49,7 @@
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_STACKOVERFLOW
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
/* Sensor */
#define CONFIG_GMR_TABLET_MODE
@@ -118,12 +118,12 @@ enum sensor_id {
};
enum adc_channel {
- ADC_VBUS_C0, /* ADC 0 */
- ADC_BOARD_ID_0, /* ADC 1 */
- ADC_BOARD_ID_1, /* ADC 2 */
- ADC_CHARGER_AMON_R, /* ADC 3 */
- ADC_VBUS_C1, /* ADC 5 */
- ADC_CHARGER_PMON, /* ADC 6 */
+ ADC_VBUS_C0, /* ADC 0 */
+ ADC_BOARD_ID_0, /* ADC 1 */
+ ADC_BOARD_ID_1, /* ADC 2 */
+ ADC_CHARGER_AMON_R, /* ADC 3 */
+ ADC_VBUS_C1, /* ADC 5 */
+ ADC_CHARGER_PMON, /* ADC 6 */
/* Number of ADC channels */
ADC_CH_COUNT,
diff --git a/board/asurada/build.mk b/board/asurada/build.mk
index d6866f8568..72015fba95 100644
--- a/board/asurada/build.mk
+++ b/board/asurada/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/asurada/ec.tasklist b/board/asurada/ec.tasklist
index ff47718bae..c8e234a412 100644
--- a/board/asurada/ec.tasklist
+++ b/board/asurada/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/asurada/gpio.inc b/board/asurada/gpio.inc
index 75d1fbafa5..46700a7749 100644
--- a/board/asurada/gpio.inc
+++ b/board/asurada/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/asurada/led.c b/board/asurada/led.c
index 166ece92e9..ca29f0be45 100644
--- a/board/asurada/led.c
+++ b/board/asurada/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -15,18 +15,16 @@
#include "stdbool.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_PWM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_PWM, format, ##args)
#define LED_OFF EC_LED_COLOR_COUNT
const enum ec_led_id supported_led_ids[] = {
/* Main LED */
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_LEFT_LED, EC_LED_ID_RIGHT_LED,
/* Not used, give them some random name for testing */
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
+ EC_LED_ID_POWER_LED, EC_LED_ID_BATTERY_LED
};
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -85,8 +83,7 @@ static void led_set_color_battery(enum ec_led_colors color, int duty)
}
static enum ec_error_list set_color(enum ec_led_id led_id,
- enum ec_led_colors color,
- int duty)
+ enum ec_led_colors color, int duty)
{
switch (led_id) {
case EC_LED_ID_LEFT_LED:
@@ -174,13 +171,11 @@ static void update_led(enum ec_led_id led_id, bool is_active_charge_port,
if (chipset_in_state(CHIPSET_STATE_ON))
set_color(led_id, EC_LED_COLOR_WHITE, duty);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- set_color(
- led_id,
- (tick % 8 < 6) ? EC_LED_COLOR_AMBER : LED_OFF,
- duty);
+ set_color(led_id,
+ (tick % 8 < 6) ? EC_LED_COLOR_AMBER : LED_OFF,
+ duty);
else
set_color(led_id, LED_OFF, 0);
-
}
}
diff --git a/board/asurada/led_hayato.c b/board/asurada/led_hayato.c
index 1d3108c47b..be1a352289 100644
--- a/board/asurada/led_hayato.c
+++ b/board/asurada/led_hayato.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,31 +14,40 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
@@ -78,12 +87,12 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
brightness_range[EC_LED_COLOR_AMBER] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
brightness_range[EC_LED_COLOR_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
} else if (led_id == EC_LED_ID_POWER_LED) {
brightness_range[EC_LED_COLOR_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
}
}
diff --git a/board/asurada/usbc_config.c b/board/asurada/usbc_config.c
index 63552980c3..ba6461b0f8 100644
--- a/board/asurada/usbc_config.c
+++ b/board/asurada/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,16 +17,13 @@ __override int syv682x_board_is_syv682c(int port)
void board_usb_mux_init(void)
{
if (board_get_sub_board() == SUB_BOARD_TYPEC) {
- ps8743_tune_usb_eq(&usb_muxes[1],
- PS8743_USB_EQ_TX_12_8_DB,
+ ps8743_tune_usb_eq(usb_muxes[1].mux, PS8743_USB_EQ_TX_12_8_DB,
PS8743_USB_EQ_RX_12_8_DB);
- ps8743_write(&usb_muxes[1],
- PS8743_REG_HS_DET_THRESHOLD,
- PS8743_USB_HS_THRESH_NEG_10);
- ps8743_field_update(&usb_muxes[1],
- PS8743_REG_DCI_CONFIG_2,
- PS8743_AUTO_DCI_MODE_MASK,
- PS8743_AUTO_DCI_MODE_FORCE_USB);
+ ps8743_write(usb_muxes[1].mux, PS8743_REG_HS_DET_THRESHOLD,
+ PS8743_USB_HS_THRESH_NEG_10);
+ ps8743_field_update(usb_muxes[1].mux, PS8743_REG_DCI_CONFIG_2,
+ PS8743_AUTO_DCI_MODE_MASK,
+ PS8743_AUTO_DCI_MODE_FORCE_USB);
}
}
DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/asurada_scp/board.h b/board/asurada_scp/board.h
index e25a26dec0..b70a39d20d 100644
--- a/board/asurada_scp/board.h
+++ b/board/asurada_scp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,8 +25,8 @@
#define CONFIG_ROM_BASE 0x0
#define CONFIG_RAM_BASE 0x58000
#define CONFIG_ROM_SIZE (CONFIG_RAM_BASE - CONFIG_ROM_BASE)
-#define CONFIG_RAM_SIZE ((CONFIG_IPC_SHARED_OBJ_ADDR & (~(0x400 - 1))) - \
- CONFIG_RAM_BASE)
+#define CONFIG_RAM_SIZE \
+ ((CONFIG_IPC_SHARED_OBJ_ADDR & (~(0x400 - 1))) - CONFIG_RAM_BASE)
#define SCP_FW_END 0x100000
diff --git a/board/asurada_scp/build.mk b/board/asurada_scp/build.mk
index f3c4a82a10..94efa82a6f 100644
--- a/board/asurada_scp/build.mk
+++ b/board/asurada_scp/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/asurada_scp/ec.tasklist b/board/asurada_scp/ec.tasklist
index 6e2f613c6d..1e43d6d30d 100644
--- a/board/asurada_scp/ec.tasklist
+++ b/board/asurada_scp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/asurada_scp/gpio.inc b/board/asurada_scp/gpio.inc
index 3222a34e08..efc5675875 100644
--- a/board/asurada_scp/gpio.inc
+++ b/board/asurada_scp/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/atlas/battery.c b/board/atlas/battery.c
index fb2fba18be..78b3be16a4 100644
--- a/board/atlas/battery.c
+++ b/board/atlas/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,10 +18,10 @@
#include "i2c.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHUTDOWN_DATA 0x0010
enum battery_type {
BATTERY_LG,
@@ -52,16 +52,16 @@ static int battery_report_present = 1;
* limits are given by discharging_min/max_c.
*/
static const struct battery_info batt_info_lg = {
- .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6100, /* Add 100mV for charger accuracy */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 46,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
+ .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
+ .voltage_normal = 7700,
+ .voltage_min = 6100, /* Add 100mV for charger accuracy */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 46,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = 0,
+ .discharging_max_c = 60,
};
/*
@@ -70,16 +70,16 @@ static const struct battery_info batt_info_lg = {
* limits are given by discharging_min/max_c.
*/
static const struct battery_info batt_info_lishen = {
- .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6100, /* Add 100mV for charger accuracy */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 46,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
+ .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
+ .voltage_normal = 7700,
+ .voltage_min = 6100, /* Add 100mV for charger accuracy */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 46,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = 0,
+ .discharging_max_c = 60,
};
static const struct board_batt_params info[] = {
@@ -110,7 +110,7 @@ static int board_get_battery_type(void)
if (!battery_manufacturer_name(name, sizeof(name))) {
for (i = 0; i < BATTERY_TYPE_COUNT; i++) {
if (!strncasecmp(name, info[i].manuf_name,
- ARRAY_SIZE(name)-1)) {
+ ARRAY_SIZE(name) - 1)) {
board_battery_type = i;
break;
}
@@ -139,7 +139,9 @@ DECLARE_HOOK(HOOK_INIT, board_init_battery_type, HOOK_PRIO_INIT_I2C + 1);
const struct battery_info *battery_get_info(void)
{
return info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type].batt_info;
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type]
+ .batt_info;
}
int board_cut_off_battery(void)
@@ -183,7 +185,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
*/
if (!battery_is_cut_off() &&
!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
return 0;
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 64d0789dd9..6fbbb64b16 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,6 +29,7 @@
#include "keyboard_scan.h"
#include "lid_switch.h"
#include "motion_sense.h"
+#include "panic.h"
#include "power_button.h"
#include "power.h"
#include "pwm_chip.h"
@@ -46,8 +47,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -85,19 +86,19 @@ __override struct keyboard_scan_config keyscan_config = {
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { 3, 0, 10000 },
- [PWM_CH_DB0_LED_BLUE] = {
- 0, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB0_LED_RED] = {
- 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB0_LED_GREEN] = {
- 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB1_LED_BLUE] = {
- 1, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB1_LED_RED] = {
- 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
- [PWM_CH_DB1_LED_GREEN] = {
- 5, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP, 2400 },
+ [PWM_CH_KBLIGHT] = { 3, 0, 10000 },
+ [PWM_CH_DB0_LED_BLUE] = { 0, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB0_LED_RED] = { 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB0_LED_GREEN] = { 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB1_LED_BLUE] = { 1, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB1_LED_RED] = { 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
+ [PWM_CH_DB1_LED_GREEN] = { 5, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 2400 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -114,66 +115,46 @@ const struct adc_t adc_channels[] = {
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 12.4K resistor, to read
* 0.8V @ 45 W, i.e. 56250 uW/mV. Using ADC_MAX_VOLT*56250 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT*56250*2/(ADC_READ_MAX+1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 56250 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C0_POWER_SCL,
- .sda = GPIO_EC_I2C0_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C1_USB_C0_SCL,
- .sda = GPIO_EC_I2C1_USB_C0_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C2_USB_C1_SCL,
- .sda = GPIO_EC_I2C2_USB_C1_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 100,
- .scl = GPIO_EC_I2C3_SENSOR_3V3_SCL,
- .sda = GPIO_EC_I2C3_SENSOR_3V3_SDA
- },
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C4_BATTERY_SCL,
- .sda = GPIO_EC_I2C4_BATTERY_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C0_POWER_SCL,
+ .sda = GPIO_EC_I2C0_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C1_USB_C0_SCL,
+ .sda = GPIO_EC_I2C1_USB_C0_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C2_USB_C1_SCL,
+ .sda = GPIO_EC_I2C2_USB_C1_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C3_SENSOR_3V3_SCL,
+ .sda = GPIO_EC_I2C3_SENSOR_3V3_SDA },
+ { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C4_BATTERY_SCL,
+ .sda = GPIO_EC_I2C4_BATTERY_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -212,16 +193,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -247,9 +234,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
@@ -269,16 +256,16 @@ uint16_t tcpc_get_alert_status(void)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
+ { "eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -304,12 +291,12 @@ static void board_report_pmic_fault(const char *str)
/* VRFAULT has occurred, print VRFAULT status bits. */
/* PWRSTAT1 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_PWRSTAT1, &pwrstat1);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_PWRSTAT1,
+ &pwrstat1);
/* PWRSTAT2 */
- i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_PWRSTAT2, &pwrstat2);
+ i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_PWRSTAT2,
+ &pwrstat2);
CPRINTS("PMIC VRFAULT: %s", str);
CPRINTS("PMIC VRFAULT: PWRSTAT1=0x%02x PWRSTAT2=0x%02x", pwrstat1,
@@ -350,8 +337,8 @@ static void board_pmic_disable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_V18ACNT, 0x2a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_V18ACNT,
+ 0x2a);
/*
* V085ACNT:
@@ -383,8 +370,8 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
* Bits 3:2 (10) - VR set to AUTO on SLP_S0# de-assertion
* Bits 1:0 (10) - VR set to AUTO operating mode
*/
- i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- BD99992GW_REG_V18ACNT, 0x6a);
+ i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, BD99992GW_REG_V18ACNT,
+ 0x6a);
/*
* V085ACNT:
@@ -397,8 +384,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
BD99992GW_REG_V085ACNT, 0x6a);
}
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
@@ -517,8 +503,8 @@ int board_set_active_charge_port(int charge_port)
int is_real_port = (charge_port >= 0 &&
charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are sourcing VBUS on the port */
- int is_source = gpio_get_level(charge_port == 0 ?
- GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN);
+ int is_source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
+ GPIO_USB_C1_5V_EN);
if (is_real_port && is_source) {
CPRINTS("No charging from p%d", charge_port);
@@ -534,10 +520,12 @@ int board_set_active_charge_port(int charge_port)
} else {
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_EN_USB_C0_CHARGE_L :
- GPIO_EN_USB_C1_CHARGE_L, 1);
+ GPIO_EN_USB_C1_CHARGE_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_EN_USB_C1_CHARGE_L :
- GPIO_EN_USB_C0_CHARGE_L, 0);
+ GPIO_EN_USB_C0_CHARGE_L,
+ 0);
}
return EC_SUCCESS;
@@ -568,12 +556,12 @@ DECLARE_HOOK(HOOK_INIT, board_charger_init, HOOK_PRIO_DEFAULT);
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = charger_derate(charge_ma);
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
static void board_chipset_suspend(void)
diff --git a/board/atlas/board.h b/board/atlas/board.h
index c3ddafe2cb..0882b5742e 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -55,8 +55,8 @@
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define CONFIG_KEYBOARD_COL2_INVERTED
#define CONFIG_KEYBOARD_PROTOCOL_8042
@@ -147,29 +147,29 @@
#define CONFIG_USBC_VCONN_SWAP
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
-#define CONFIG_HIBERNATE_PSL /* Enable PSL pins for wakeup */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define CONFIG_HIBERNATE_PSL /* Enable PSL pins for wakeup */
/* I2C ports */
-#define I2C_PORT_POWER NPCX_I2C_PORT0_0 /* pmic/charger */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT2_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT3_0 /* als */
-#define I2C_PORT_BATTERY NPCX_I2C_PORT4_1
-#define I2C_PORT_GYRO NPCX_I2C_PORT5_0 /* accel/gyro */
-
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_CHARGER I2C_PORT_POWER
-#define I2C_PORT_PMIC I2C_PORT_POWER
-#define I2C_PORT_THERMAL I2C_PORT_POWER
+#define I2C_PORT_POWER NPCX_I2C_PORT0_0 /* pmic/charger */
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT2_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT3_0 /* als */
+#define I2C_PORT_BATTERY NPCX_I2C_PORT4_1
+#define I2C_PORT_GYRO NPCX_I2C_PORT5_0 /* accel/gyro */
+
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_CHARGER I2C_PORT_POWER
+#define I2C_PORT_PMIC I2C_PORT_POWER
+#define I2C_PORT_THERMAL I2C_PORT_POWER
/* I2C addresses */
-#define I2C_ADDR_TCPC_FLAGS 0x0B
-#define I2C_ADDR_MP2949_FLAGS 0x20
-#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_TCPC_FLAGS 0x0B
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
#ifndef __ASSEMBLER__
@@ -177,11 +177,11 @@
#include "registers.h"
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_SYSTHERM0, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_SYSTHERM1, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_SYSTHERM2, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_SYSTHERM3, /* BD99992GW SYSTHERM3 */
+ TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
+ TEMP_SENSOR_SYSTHERM0, /* BD99992GW SYSTHERM0 */
+ TEMP_SENSOR_SYSTHERM1, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_SYSTHERM2, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_SYSTHERM3, /* BD99992GW SYSTHERM3 */
TEMP_SENSOR_COUNT
};
@@ -202,28 +202,24 @@ enum sensor_id {
};
/* LID_ALS needs to be polled */
-#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ALS)
+#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ALS)
-enum adc_channel {
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
int board_get_version(void);
@@ -236,33 +232,33 @@ void board_reset_pd_mcu(void);
* vs. names hard-coded in various parts of the EC codebase.
*/
-#define GPIO_AC_PRESENT GPIO_ROP_EC_ACOK
-#define GPIO_BATTERY_PRESENT_L GPIO_EC_BATT_PRES_L
-#define GPIO_BOARD_VERSION1 GPIO_EC_BRD_ID1
-#define GPIO_BOARD_VERSION2 GPIO_EC_BRD_ID2
-#define GPIO_BOARD_VERSION3 GPIO_EC_BRD_ID3
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KB_ROW02_INV
-#define GPIO_PCH_ACOK GPIO_EC_PCH_ACPRESENT
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_RSMRST_L
-#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_L
-#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK_EC
-#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
-#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
-#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_USB_C0_5V_EN GPIO_EN_USB_C0_5V_OUT
-#define GPIO_USB_C0_PD_RST_L GPIO_USB_PD_RST_L
-#define GPIO_USB_C1_5V_EN GPIO_EN_USB_C1_5V_OUT
-#define GPIO_USB_C1_PD_RST_L GPIO_USB_PD_RST_L
-#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_AC_PRESENT GPIO_ROP_EC_ACOK
+#define GPIO_BATTERY_PRESENT_L GPIO_EC_BATT_PRES_L
+#define GPIO_BOARD_VERSION1 GPIO_EC_BRD_ID1
+#define GPIO_BOARD_VERSION2 GPIO_EC_BRD_ID2
+#define GPIO_BOARD_VERSION3 GPIO_EC_BRD_ID3
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KB_ROW02_INV
+#define GPIO_PCH_ACOK GPIO_EC_PCH_ACPRESENT
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_RSMRST_L
+#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_L
+#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK_EC
+#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
+#define GPIO_POWER_BUTTON_L GPIO_MECH_PWR_BTN_ODL
+#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_USB_C0_5V_EN GPIO_EN_USB_C0_5V_OUT
+#define GPIO_USB_C0_PD_RST_L GPIO_USB_PD_RST_L
+#define GPIO_USB_C1_5V_EN GPIO_EN_USB_C1_5V_OUT
+#define GPIO_USB_C1_PD_RST_L GPIO_USB_PD_RST_L
+#define GPIO_WP_L GPIO_EC_WP_L
/* ps8751 requires 1ms reset down assertion */
-#define PS8XXX_RST_L_RST_H_DELAY_MS 1
+#define PS8XXX_RST_L_RST_H_DELAY_MS 1
-#define ATLAS_REV_FIXED_EC_WP 4
+#define ATLAS_REV_FIXED_EC_WP 4
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/atlas/build.mk b/board/atlas/build.mk
index f1619f73cd..b7eeeb0a61 100644
--- a/board/atlas/build.mk
+++ b/board/atlas/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/atlas/ec.tasklist b/board/atlas/ec.tasklist
index 33e3cccb16..b0bf043717 100644
--- a/board/atlas/ec.tasklist
+++ b/board/atlas/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/atlas/gpio.inc b/board/atlas/gpio.inc
index 4ce44cc130..ea76ab8841 100644
--- a/board/atlas/gpio.inc
+++ b/board/atlas/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/atlas/led.c b/board/atlas/led.c
index 9cb4dabfd3..2a297848e3 100644
--- a/board/atlas/led.c
+++ b/board/atlas/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,13 +18,13 @@ const enum ec_led_id supported_led_ids[] = {
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 70, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 35, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 55, 15, 0 },
- [EC_LED_COLOR_WHITE] = { 62, 100, 31 },
- [EC_LED_COLOR_AMBER] = { 100, 31, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 70, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 35, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ [EC_LED_COLOR_YELLOW] = { 55, 15, 0 },
+ [EC_LED_COLOR_WHITE] = { 62, 100, 31 },
+ [EC_LED_COLOR_AMBER] = { 100, 31, 0 },
};
/*
diff --git a/board/atlas/usb_pd_policy.c b/board/atlas/usb_pd_policy.c
index 77a4941a9a..fc7a2141f5 100644
--- a/board/atlas/usb_pd_policy.c
+++ b/board/atlas/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,12 +23,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -38,9 +38,9 @@ int board_vbus_source_enabled(int port)
static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio_5v_en = port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN;
+ GPIO_USB_C0_5V_EN;
enum gpio_signal gpio_3a_en = port ? GPIO_EN_USB_C1_3A :
- GPIO_EN_USB_C0_3A;
+ GPIO_EN_USB_C0_3A;
/*
* 1.5 vs 3.0 A limit is controlled by a dedicated gpio where
@@ -67,8 +67,8 @@ int pd_snk_is_vbus_provided(int port)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_EN_USB_C1_CHARGE_L :
- GPIO_EN_USB_C0_CHARGE_L, 1);
+ gpio_set_level(port ? GPIO_EN_USB_C1_CHARGE_L : GPIO_EN_USB_C0_CHARGE_L,
+ 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
@@ -111,15 +111,12 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
return;
- gpio_set_level(GPIO_USB2_ID,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
- gpio_set_level(GPIO_USB2_VBUSSENSE,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_ID, (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_VBUSSENSE, (data_role == PD_ROLE_UFP) ? 1 : 0);
}
diff --git a/board/baklava/board.c b/board/baklava/board.c
index 12365e0ff6..dc0b3a952a 100644
--- a/board/baklava/board.c
+++ b/board/baklava/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,8 +28,8 @@
#include "usb_tc_sm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
#define QUICHE_PD_DEBUG_LVL 1
@@ -84,25 +84,25 @@ static void board_usbc_usb3_interrupt(enum gpio_signal signal)
* signals is driven by USB/MST hub power sequencing requirements.
*/
const struct power_seq board_power_seq[] = {
- {GPIO_EN_AC_JACK, 1, 20},
- {GPIO_EC_DFU_MUX_CTRL, 0, 0},
- {GPIO_EN_PP5000_A, 1, 31},
- {GPIO_MST_LP_CTL_L, 1, 0},
- {GPIO_EN_PP3300_B, 1, 1},
- {GPIO_EN_PP1100_A, 1, 100+30},
- {GPIO_EN_BB, 1, 30},
- {GPIO_EN_PP1050_A, 1, 30},
- {GPIO_EN_PP1200_A, 1, 20},
- {GPIO_EN_PP5000_C, 1, 20},
- {GPIO_EN_PP5000_HSPORT, 1, 31},
- {GPIO_EN_DP_SINK, 1, 80},
- {GPIO_MST_RST_L, 1, 61},
- {GPIO_EC_HUB2_RESET_L, 1, 41},
- {GPIO_EC_HUB3_RESET_L, 1, 33},
- {GPIO_DP_SINK_RESET, 1, 100},
- {GPIO_USBC_UF_RESET_L, 1, 33},
- {GPIO_DEMUX_DP_HDMI_PD_N, 1, 10},
- {GPIO_DEMUX_DP_HDMI_MODE, 1, 5},
+ { GPIO_EN_AC_JACK, 1, 20 },
+ { GPIO_EC_DFU_MUX_CTRL, 0, 0 },
+ { GPIO_EN_PP5000_A, 1, 31 },
+ { GPIO_MST_LP_CTL_L, 1, 0 },
+ { GPIO_EN_PP3300_B, 1, 1 },
+ { GPIO_EN_PP1100_A, 1, 100 + 30 },
+ { GPIO_EN_BB, 1, 30 },
+ { GPIO_EN_PP1050_A, 1, 30 },
+ { GPIO_EN_PP1200_A, 1, 20 },
+ { GPIO_EN_PP5000_C, 1, 20 },
+ { GPIO_EN_PP5000_HSPORT, 1, 31 },
+ { GPIO_EN_DP_SINK, 1, 80 },
+ { GPIO_MST_RST_L, 1, 61 },
+ { GPIO_EC_HUB2_RESET_L, 1, 41 },
+ { GPIO_EC_HUB3_RESET_L, 1, 33 },
+ { GPIO_DP_SINK_RESET, 1, 100 },
+ { GPIO_USBC_UF_RESET_L, 1, 33 },
+ { GPIO_DEMUX_DP_HDMI_PD_N, 1, 10 },
+ { GPIO_DEMUX_DP_HDMI_MODE, 1, 5 },
};
const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
@@ -110,13 +110,13 @@ const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Acer"),
- [USB_STR_PRODUCT] = USB_STRING_DESC("D501"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] =
- USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Acer"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("D501"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] =
+ USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -135,8 +135,7 @@ struct ppc_config_t ppc_chips[] = {
* PS8802 set mux board tuning.
* Adds in board specific gain and DP lane count configuration
*/
-static int board_ps8822_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8822_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
int rv = EC_SUCCESS;
@@ -155,28 +154,26 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_HOST] = {
- .usb_port = USB_PD_PORT_HOST,
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = PS8822_I2C_ADDR3_FLAG,
- .driver = &ps8822_usb_mux_driver,
- .board_set = &board_ps8822_mux_set,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_HOST,
+ .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = PS8822_I2C_ADDR3_FLAG,
+ .driver = &ps8822_usb_mux_driver,
+ .board_set = &board_ps8822_mux_set,
+ },
},
};
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_HOST] = {
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_USB3] = {
- .i2c_port = I2C_PORT_I2C3,
- .i2c_addr_flags = SN5S330_ADDR1_FLAGS,
- .drv = &sn5s330_drv
- },
+ [USB_PD_PORT_HOST] = { .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ [USB_PD_PORT_USB3] = { .i2c_port = I2C_PORT_I2C3,
+ .i2c_addr_flags = SN5S330_ADDR1_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -284,14 +281,13 @@ static void board_usb_tc_disconnect(void)
if (port == USB_PD_PORT_HOST)
gpio_set_level(GPIO_UFP_PLUG_DET, 1);
}
-DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect,
HOOK_PRIO_DEFAULT);
#endif /* SECTION_IS_RW */
static void board_init(void)
{
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -328,7 +324,7 @@ void board_debug_gpio(enum debug_gpio trigger, int level, int pulse_usec)
}
}
-static int command_dplane(int argc, char **argv)
+static int command_dplane(int argc, const char **argv)
{
char *e;
int lane;
@@ -356,6 +352,4 @@ static int command_dplane(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(dplane, command_dplane,
- "<2 | 4>",
- "MST lane control.");
+DECLARE_CONSOLE_COMMAND(dplane, command_dplane, "<2 | 4>", "MST lane control.");
diff --git a/board/baklava/board.h b/board/baklava/board.h
index e061d2342d..8cbe1cdc76 100644
--- a/board/baklava/board.h
+++ b/board/baklava/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
#undef CONFIG_FLASH_PSTATE_LOCKED
/* USB Type C and USB PD defines */
-#define USB_PD_PORT_HOST 0
-#define USB_PD_PORT_USB3 1
+#define USB_PD_PORT_HOST 0
+#define USB_PD_PORT_USB3 1
/*
* Only the host and display usbc ports are usb-pd capable. There is a 2nd usbc
@@ -40,9 +40,9 @@
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
/* I2C port names */
-#define I2C_PORT_I2C1 0
-#define I2C_PORT_I2C2 1
-#define I2C_PORT_I2C3 2
+#define I2C_PORT_I2C1 0
+#define I2C_PORT_I2C2 1
+#define I2C_PORT_I2C3 2
/* Required symbolic I2C port names */
#define I2C_PORT_MP4245 I2C_PORT_I2C3
@@ -68,7 +68,7 @@
#define GPIO_TRIGGER_1 GPIO_USB3_A5_CDP_EN
#define GPIO_TRIGGER_2 GPIO_USB3_A6_CDP_EN
-enum debug_gpio {
+enum debug_gpio {
TRIGGER_1 = 0,
TRIGGER_2,
};
diff --git a/board/baklava/build.mk b/board/baklava/build.mk
index 7e3e1240fd..258bafe87d 100644
--- a/board/baklava/build.mk
+++ b/board/baklava/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/baklava/ec.tasklist b/board/baklava/ec.tasklist
index 14c2c31393..a478fbe2e0 100644
--- a/board/baklava/ec.tasklist
+++ b/board/baklava/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/baklava/gpio.inc b/board/baklava/gpio.inc
index 144a5e3f8c..2745ae7caf 100644
--- a/board/baklava/gpio.inc
+++ b/board/baklava/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/banshee/battery.c b/board/banshee/battery.c
index 8143e6cec8..35d6a7a935 100644
--- a/board/banshee/battery.c
+++ b/board/banshee/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/banshee/board.c b/board/banshee/board.c
index 8f1d8bb811..611686f88d 100644
--- a/board/banshee/board.c
+++ b/board/banshee/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,14 +10,17 @@
#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
+#include "cros_board_info.h"
#include "gpio.h"
#include "gpio_signal.h"
#include "hooks.h"
#include "driver/als_tcs3400.h"
#include "driver/charger/isl9241.h"
+#include "driver/retimer/bb_retimer.h"
#include "fw_config.h"
#include "hooks.h"
#include "keyboard_customization.h"
+#include "keyboard_scan.h"
#include "lid_switch.h"
#include "power_button.h"
#include "power.h"
@@ -25,22 +28,47 @@
#include "switch.h"
#include "throttle_ap.h"
#include "usbc_config.h"
+#include "watchdog.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
+
+/*
+ * USBA card connect to chromebook the USB_3_CONNECTION
+ * bit would be enable.
+ * It will increase BBR power consumption, so clear
+ * USB3_Connection bit in S0ix and enable when return S0.
+ */
+void set_bb_retimer_usb3_state(bool enable)
+{
+ mux_state_t mux_state = 0;
+
+ for (int i = 0; i < CONFIG_USB_PD_PORT_MAX_COUNT; i++) {
+ const struct usb_mux *mux = usb_muxes[i].mux;
+
+ mux_state = usb_mux_get(i);
+
+ if ((mux_state & USB_PD_MUX_USB_ENABLED)) {
+ bb_retimer_set_usb3(mux, enable);
+ }
+ }
+}
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
+ if (chipset_in_state(CHIPSET_STATE_ON))
+ set_bb_retimer_usb3_state(true);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
{
+ set_bb_retimer_usb3_state(false);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
@@ -50,58 +78,97 @@ void board_set_charger_current_limit_deferred(void)
int rv;
if (extpower_is_present() &&
- (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED))
+ (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED))
/* AC only or AC+DC but battery is disconnect */
action = MASK_SET;
else
action = MASK_CLR;
rv = i2c_update16(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- ISL9241_REG_CONTROL3,
- ISL9241_CONTROL3_INPUT_CURRENT_LIMIT, action);
+ chg_chips[CHARGER_SOLO].i2c_addr_flags,
+ ISL9241_REG_CONTROL3,
+ ISL9241_CONTROL3_INPUT_CURRENT_LIMIT, action);
if (rv)
- CPRINTF("Could not set charger input current limit! Error: %d\n"
- , rv);
+ CPRINTF("Could not set charger input current limit! Error: %d\n",
+ rv);
}
DECLARE_DEFERRED(board_set_charger_current_limit_deferred);
DECLARE_HOOK(HOOK_SECOND, board_set_charger_current_limit_deferred,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
void battery_present_interrupt(enum gpio_signal signal)
{
hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0);
}
-void board_init(void)
+static uint32_t board_id;
+static void configure_keyboard(void)
{
- int board_id = get_board_id();
+ uint32_t cbi_val;
- gpio_enable_interrupt(GPIO_EC_BATT_PRES_ODL);
- hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0);
+ /* Board ID */
+ if (cbi_get_board_version(&cbi_val) != EC_SUCCESS ||
+ cbi_val > UINT8_MAX)
+ CPRINTS("CBI: Read Board ID failed");
+ else
+ board_id = cbi_val;
+
+ CPRINTS("Read Board ID: %d", board_id);
if (board_id == 0) {
/* keyboard_col2_inverted on board id 0 */
gpio_set_flags(GPIO_EC_KSO_04_INV, GPIO_ODR_HIGH);
gpio_set_flags(GPIO_EC_KSO_05_INV, GPIO_ODR_HIGH);
gpio_set_alternate_function(GPIO_PORT_1, (BIT(4) | BIT(5)),
- GPIO_ALT_FUNC_DEFAULT);
+ GPIO_ALT_FUNC_DEFAULT);
} else if (board_id == 1) {
/* keyboard_col4_inverted on board id 1 */
gpio_set_flags(GPIO_EC_KSO_02_INV, GPIO_ODR_HIGH);
gpio_set_flags(GPIO_EC_KSO_05_INV, GPIO_ODR_HIGH);
gpio_set_alternate_function(GPIO_PORT_1, (BIT(4) | BIT(7)),
- GPIO_ALT_FUNC_DEFAULT);
+ GPIO_ALT_FUNC_DEFAULT);
} else {
/* keyboard_col5_inverted on board id 2 and later */
gpio_set_flags(GPIO_EC_KSO_02_INV, GPIO_ODR_HIGH);
gpio_set_flags(GPIO_EC_KSO_04_INV, GPIO_ODR_HIGH);
gpio_set_alternate_function(GPIO_PORT_1, (BIT(5) | BIT(7)),
- GPIO_ALT_FUNC_DEFAULT);
+ GPIO_ALT_FUNC_DEFAULT);
+ key_typ.col_refresh = KEYBOARD_COL_ID2_REFRESH;
+ key_typ.row_refresh = KEYBOARD_ROW_ID2_REFRESH;
}
- board_id_keyboard_col_inverted(board_id);
+ board_id_keyboard_col_inverted((int)board_id);
+}
+
+void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_EC_BATT_PRES_ODL);
+ hook_call_deferred(&board_set_charger_current_limit_deferred_data, 0);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+__override void board_pre_task_i2c_peripheral_init(void)
+{
+ /* Configure board specific keyboard */
+ configure_keyboard();
+
+ /* Workaround for b:238683420 with board id >= 2 */
+
+#ifdef SECTION_IS_RO
+ if (board_id >= 2) {
+ udelay(500 * MSEC);
+ watchdog_reload();
+ CPRINTS("Add delay to check boot key");
+ }
+#endif
+}
+
+__override uint8_t board_keyboard_row_refresh(void)
+{
+ if (board_id < 2)
+ return KEYBOARD_ROW_ID1_REFRESH;
+ else
+ return KEYBOARD_ROW_ID2_REFRESH;
+}
diff --git a/board/banshee/board.h b/board/banshee/board.h
index e412fcc7d2..c456a17e68 100644
--- a/board/banshee/board.h
+++ b/board/banshee/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,6 +35,7 @@
#define CONFIG_MP2964
/* KEYBOARD */
+#define CONFIG_KEYBOARD_MULTIPLE
#define CONFIG_KEYBOARD_CUSTOMIZATION
#define CONFIG_KEYBOARD_VIVALDI
@@ -58,13 +59,12 @@
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(CLEAR_ALS)
-
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 4
+#define CONFIG_IO_EXPANDER_PORT_COUNT 4
#define CONFIG_USB_PD_FRS_PPC
@@ -79,17 +79,17 @@
#define CONFIG_USBC_PPC_SYV682X
#define CONFIG_USB_PD_PPC
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -97,67 +97,68 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
+#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C2_C3_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C2_C3_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_PPC_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_PPC_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
-#define USBC_PORT_C3_BB_RETIMER_I2C_ADDR 0x59
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C3_BB_RETIMER_I2C_ADDR 0x59
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
/*
* TODO: Disable BBR firmware update temporally,
@@ -175,13 +176,13 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
/*
* Older boards have a different ADC assignment.
@@ -191,10 +192,19 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
+/* I2C access in polling mode before task is initialized */
+#define CONFIG_I2C_BITBANG
+
+enum banshee_bitbang_i2c_channel {
+ I2C_BITBANG_CHAN_BRD_ID,
+ I2C_BITBANG_CHAN_COUNT
+};
+#define I2C_BITBANG_PORT_COUNT I2C_BITBANG_CHAN_COUNT
+
enum adc_channel {
ADC_TEMP_SENSOR_1_DDR_SOC,
ADC_TEMP_SENSOR_2_AMBIENT,
@@ -209,10 +219,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- CLEAR_ALS = 0,
- SENSOR_COUNT
-};
+enum sensor_id { CLEAR_ALS = 0, SENSOR_COUNT };
enum ioex_port {
IOEX_C0_NCT38XX = 0,
@@ -222,30 +229,21 @@ enum ioex_port {
IOEX_PORT_COUNT
};
-enum battery_type {
- BATTERY_NVT,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_NVT, BATTERY_TYPE_COUNT };
enum pwm_channel {
- PWM_CH_SIDE_LED_R = 0, /* PWM0 (Red charger) */
- PWM_CH_SIDE_LED_G, /* PWM1 (Green charger) */
- PWM_CH_SIDE_LED_B, /* PWM2 (Blue charger) */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_POWER_LED_W, /* PWM7 (white LED) */
+ PWM_CH_SIDE_LED_R = 0, /* PWM0 (Red charger) */
+ PWM_CH_SIDE_LED_G, /* PWM1 (Green charger) */
+ PWM_CH_SIDE_LED_B, /* PWM2 (Blue charger) */
+ PWM_CH_KBLIGHT, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_POWER_LED_W, /* PWM7 (white LED) */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void battery_present_interrupt(enum gpio_signal signal);
diff --git a/board/banshee/build.mk b/board/banshee/build.mk
index 88621dd44b..78c675a67a 100644
--- a/board/banshee/build.mk
+++ b/board/banshee/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -22,6 +22,5 @@ board-y+=keyboard.o
board-y+=led.o
board-y+=pwm.o
board-y+=sensors.o
-board-y+=tune_mp2964.o
board-y+=usbc_config.o
board-y+=keyboard_customization.o
diff --git a/board/banshee/charger.c b/board/banshee/charger.c
index 85e0de90fe..88f5b85a41 100644
--- a/board/banshee/charger.c
+++ b/board/banshee/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -84,7 +83,6 @@ int board_set_active_charge_port(int port)
__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/banshee/ec.tasklist b/board/banshee/ec.tasklist
index 0b8d0e412b..b193da8f9f 100644
--- a/board/banshee/ec.tasklist
+++ b/board/banshee/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/banshee/fans.c b/board/banshee/fans.c
index 73bd0dcd77..0658dc8859 100644
--- a/board/banshee/fans.c
+++ b/board/banshee/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/banshee/fw_config.c b/board/banshee/fw_config.c
index 2ce200cc4f..dc7fe7ca2a 100644
--- a/board/banshee/fw_config.c
+++ b/board/banshee/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union banshee_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/banshee/fw_config.h b/board/banshee/fw_config.h
index 6800c492ad..912aebca7e 100644
--- a/board/banshee/fw_config.h
+++ b/board/banshee/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,7 +14,6 @@
* Source of truth is the project/brya/brya/config.star configuration file.
*/
-
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
KEYBOARD_BACKLIGHT_ENABLED = 1
@@ -22,11 +21,11 @@ enum ec_cfg_keyboard_backlight_type {
union banshee_cbi_fw_config {
struct {
- uint32_t sd_db : 2;
- uint32_t lte_db : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ uint32_t sd_db : 2;
+ uint32_t lte_db : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 21;
};
uint32_t raw_value;
};
diff --git a/board/banshee/gpio.inc b/board/banshee/gpio.inc
index 2a0e90e675..e33fa5ec06 100644
--- a/board/banshee/gpio.inc
+++ b/board/banshee/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/banshee/i2c.c b/board/banshee/i2c.c
index ed92cfbf82..ea3fd38e62 100644
--- a/board/banshee/i2c.c
+++ b/board/banshee/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -7,8 +7,9 @@
#include "compile_time_macros.h"
#include "hooks.h"
#include "i2c.h"
+#include "i2c_bitbang.h"
-#define BOARD_ID_FAST_PLUS_CAPABLE 2
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
@@ -40,7 +41,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C3 */
.name = "retimer0,1",
.port = I2C_PORT_USB_C0_C1_MUX,
- .kbps = 1000,
+ .kbps = 400,
.scl = GPIO_EC_I2C_USB_C0_C1_RT_SCL,
.sda = GPIO_EC_I2C_USB_C0_C1_RT_SDA,
},
@@ -64,7 +65,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C6 */
.name = "retimer2,3",
.port = I2C_PORT_USB_C2_C3_MUX,
- .kbps = 1000,
+ .kbps = 400,
.scl = GPIO_EC_I2C_USB_C2_C3_RT_SCL,
.sda = GPIO_EC_I2C_USB_C2_C3_RT_SDA,
},
@@ -78,3 +79,16 @@ const struct i2c_port_t i2c_ports[] = {
},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+const struct i2c_port_t i2c_bitbang_ports[] = {
+ [I2C_BITBANG_CHAN_BRD_ID] = {
+ .name = "bitbang_brd_id",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_MISC_SCL_R,
+ .sda = GPIO_EC_I2C_MISC_SDA_R,
+ .drv = &bitbang_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(i2c_bitbang_ports) == I2C_BITBANG_CHAN_COUNT);
+const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
diff --git a/board/banshee/keyboard.c b/board/banshee/keyboard.c
index 3891955b46..928f02e025 100644
--- a/board/banshee/keyboard.c
+++ b/board/banshee/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -63,8 +63,8 @@ static const struct ec_response_keybd_config banshee_kb_id2 = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (get_board_id() <= 1)
return &banshee_kb_id1;
@@ -81,20 +81,20 @@ __override const struct key {
uint8_t row;
uint8_t col;
} vivaldi_keys[] = {
- {.row = 3, .col = 5}, /* T1 */
- {.row = 2, .col = 5}, /* T2 */
- {.row = 6, .col = 4}, /* T3 */
- {.row = 3, .col = 4}, /* T4 */
- {.row = 4, .col = 10}, /* T5 */
- {.row = 3, .col = 10}, /* T6 */
- {.row = 2, .col = 10}, /* T7 */
- {.row = 1, .col = 15}, /* T8 */
- {.row = 3, .col = 11}, /* T9 */
- {.row = 4, .col = 8}, /* T10 */
- {.row = 6, .col = 8}, /* T11 */
- {.row = 3, .col = 13}, /* T12 */
- {.row = 3, .col = 5}, /* T13 */
- {.row = 0, .col = 9}, /* T14 */
- {.row = 0, .col = 11}, /* T15 */
+ { .row = 3, .col = 5 }, /* T1 */
+ { .row = 2, .col = 5 }, /* T2 */
+ { .row = 6, .col = 4 }, /* T3 */
+ { .row = 3, .col = 4 }, /* T4 */
+ { .row = 4, .col = 10 }, /* T5 */
+ { .row = 3, .col = 10 }, /* T6 */
+ { .row = 2, .col = 10 }, /* T7 */
+ { .row = 1, .col = 15 }, /* T8 */
+ { .row = 3, .col = 11 }, /* T9 */
+ { .row = 4, .col = 8 }, /* T10 */
+ { .row = 6, .col = 8 }, /* T11 */
+ { .row = 3, .col = 13 }, /* T12 */
+ { .row = 3, .col = 5 }, /* T13 */
+ { .row = 0, .col = 9 }, /* T14 */
+ { .row = 0, .col = 11 }, /* T15 */
};
BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
diff --git a/board/banshee/keyboard_customization.c b/board/banshee/keyboard_customization.c
index cf6904cb37..dfec873343 100644
--- a/board/banshee/keyboard_customization.c
+++ b/board/banshee/keyboard_customization.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,30 +10,30 @@
#include "keyboard_config.h"
#include "keyboard_protocol.h"
#include "keyboard_raw.h"
+#include "keyboard_scan.h"
enum gpio_signal signal;
static int colinv;
static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {0x0021, 0x007B, 0x0079, 0x0072, 0x007A, 0x0071, 0x0069, 0xe04A},
- {0x002f, 0xe070, 0x007D, 0xe01f, 0x006c, 0xe06c, 0xe07d, 0x0077},
- {0x0015, 0x0070, 0x00ff, 0x000D, 0x000E, 0x0016, 0x0067, 0x001c},
- {0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0xe05a, 0x0029, 0x0024, 0xe01d, 0xe01f, 0x0026, 0xe020, 0xe07a},
- {0x0022, 0x001a, 0xe030, 0xe038, 0x001b, 0x001e, 0x001d, 0x0076},
- {0x002A, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b},
- {0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b},
- {0x0049, 0xe072, 0x005d, 0x0044, 0xe023, 0x0046, 0xe021, 0x004b},
- {0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x0041, 0x007c, 0xe02c, 0xe02d, 0xe024, 0x003e, 0x0043, 0x0042},
- {0x0013, 0x0064, 0x0075, 0xe054, 0x0051, 0x0061, 0xe06b, 0xe02f},
- {0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x004a, 0xe075, 0x004e, 0xe032, 0x0045, 0x004d, 0x0054, 0x004c},
- {0x0052, 0x005a, 0xe03c, 0xe069, 0x0055, 0x0066, 0x005b, 0x0023},
- {0x006a, 0xe035, 0xe074, 0xe054, 0x0000, 0x006b, 0x0073, 0x0074},
+ { 0x0021, 0x007B, 0x0079, 0x0072, 0x007A, 0x0071, 0x0069, 0xe04A },
+ { 0x002f, 0xe070, 0x007D, 0xe01f, 0x006c, 0xe06c, 0xe07d, 0x0077 },
+ { 0x0015, 0x0070, 0x00ff, 0x000D, 0x000E, 0x0016, 0x0067, 0x001c },
+ { 0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0xe05a, 0x0029, 0x0024, 0xe01d, 0xe01f, 0x0026, 0xe020, 0xe07a },
+ { 0x0022, 0x001a, 0xe030, 0xe038, 0x001b, 0x001e, 0x001d, 0x0076 },
+ { 0x002A, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b },
+ { 0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b },
+ { 0x0049, 0xe072, 0x005d, 0x0044, 0xe023, 0x0046, 0xe021, 0x004b },
+ { 0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x0041, 0x007c, 0xe02c, 0xe02d, 0xe024, 0x003e, 0x0043, 0x0042 },
+ { 0x0013, 0x0064, 0x0075, 0xe054, 0x0051, 0x0061, 0xe06b, 0xe02f },
+ { 0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x004a, 0xe075, 0x004e, 0xe032, 0x0045, 0x004d, 0x0054, 0x004c },
+ { 0x0052, 0x005a, 0xe03c, 0xe069, 0x0055, 0x0066, 0x005b, 0x0023 },
+ { 0x006a, 0xe035, 0xe074, 0xe054, 0x0000, 0x006b, 0x0073, 0x0074 },
};
-
uint16_t get_scancode_set2(uint8_t row, uint8_t col)
{
if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
@@ -47,6 +47,25 @@ void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val)
scancode_set2[col][row] = val;
}
+struct keyboard_type key_typ = {
+ .col_esc = KEYBOARD_COL_ESC,
+ .row_esc = KEYBOARD_ROW_ESC,
+ .col_down = KEYBOARD_COL_DOWN,
+ .row_down = KEYBOARD_ROW_DOWN,
+ .col_left_shift = KEYBOARD_COL_LEFT_SHIFT,
+ .row_left_shift = KEYBOARD_ROW_LEFT_SHIFT,
+ .col_refresh = KEYBOARD_COL_ID1_REFRESH,
+ .row_refresh = KEYBOARD_ROW_ID1_REFRESH,
+ .col_right_alt = KEYBOARD_COL_RIGHT_ALT,
+ .row_right_alt = KEYBOARD_ROW_RIGHT_ALT,
+ .col_left_alt = KEYBOARD_COL_LEFT_ALT,
+ .row_left_alt = KEYBOARD_ROW_LEFT_ALT,
+ .col_key_r = KEYBOARD_COL_KEY_R,
+ .row_key_r = KEYBOARD_ROW_KEY_R,
+ .col_key_h = KEYBOARD_COL_KEY_H,
+ .row_key_h = KEYBOARD_ROW_KEY_H,
+};
+
void board_id_keyboard_col_inverted(int board_id)
{
if (board_id == 0) {
@@ -85,38 +104,30 @@ void board_keyboard_drive_col(int col)
#ifdef CONFIG_KEYBOARD_DEBUG
static char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`',
- '1', KLLI_UNKNO, 'a'},
- {KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4,
- KLLI_SEARC, '3', KLLI_F3, KLLI_UNKNO},
- {'x', 'z', KLLI_F2, KLLI_F1,
- 's', '2', 'w', KLLI_ESC},
- {'v', 'b', 'g', 't',
- '5', '4', 'r', 'f'},
- {'m', 'n', 'h', 'y',
- '6', '7', 'u', 'j'},
- {'.', KLLI_DOWN, '\\', 'o',
- KLLI_F10, '9', KLLI_UNKNO, 'l'},
- {KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {',', KLLI_UNKNO, KLLI_F7, KLLI_F6,
- KLLI_F5, '8', 'i', 'k'},
- {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_LEFT, KLLI_UNKNO},
- {KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {'/', KLLI_UP, '-', KLLI_UNKNO,
- '0', 'p', '[', ';'},
- {'\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO,
- '=', KLLI_B_SPC, ']', 'd'},
- {KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
+ { 'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { 'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', '1', KLLI_UNKNO, 'a' },
+ { KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, KLLI_SEARC, '3', KLLI_F3,
+ KLLI_UNKNO },
+ { 'x', 'z', KLLI_F2, KLLI_F1, 's', '2', 'w', KLLI_ESC },
+ { 'v', 'b', 'g', 't', '5', '4', 'r', 'f' },
+ { 'm', 'n', 'h', 'y', '6', '7', 'u', 'j' },
+ { '.', KLLI_DOWN, '\\', 'o', KLLI_F10, '9', KLLI_UNKNO, 'l' },
+ { KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { ',', KLLI_UNKNO, KLLI_F7, KLLI_F6, KLLI_F5, '8', 'i', 'k' },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_LEFT, KLLI_UNKNO },
+ { KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { '/', KLLI_UP, '-', KLLI_UNKNO, '0', 'p', '[', ';' },
+ { '\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, '=', KLLI_B_SPC, ']', 'd' },
+ { KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
};
char get_keycap_label(uint8_t row, uint8_t col)
diff --git a/board/banshee/keyboard_customization.h b/board/banshee/keyboard_customization.h
index 18043d7453..1b4994ded0 100644
--- a/board/banshee/keyboard_customization.h
+++ b/board/banshee/keyboard_customization.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,52 +25,53 @@ extern uint8_t keyboard_cols;
#define KEYBOARD_ROW_TO_MASK(r) (1 << (r))
/* Columns and masks for keys we particularly care about */
-#define KEYBOARD_COL_DOWN 8
-#define KEYBOARD_ROW_DOWN 1
-#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
-#define KEYBOARD_COL_ESC 5
-#define KEYBOARD_ROW_ESC 7
-#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
-#define KEYBOARD_COL_KEY_H 7
-#define KEYBOARD_ROW_KEY_H 2
-#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
-#define KEYBOARD_COL_KEY_R 6
-#define KEYBOARD_ROW_KEY_R 6
-#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
-#define KEYBOARD_COL_LEFT_ALT 3
-#define KEYBOARD_ROW_LEFT_ALT 1
-#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
-#define KEYBOARD_COL_REFRESH 4
-#define KEYBOARD_ROW_REFRESH 6
-#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
-#define KEYBOARD_COL_RIGHT_ALT 3
-#define KEYBOARD_ROW_RIGHT_ALT 0
-#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
-#define KEYBOARD_DEFAULT_COL_VOL_UP 13
-#define KEYBOARD_DEFAULT_ROW_VOL_UP 3
-#define KEYBOARD_COL_LEFT_CTRL 12
-#define KEYBOARD_ROW_LEFT_CTRL 1
+#define KEYBOARD_COL_DOWN 8
+#define KEYBOARD_ROW_DOWN 1
+#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
+#define KEYBOARD_COL_ESC 5
+#define KEYBOARD_ROW_ESC 7
+#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
+#define KEYBOARD_COL_KEY_H 7
+#define KEYBOARD_ROW_KEY_H 2
+#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
+#define KEYBOARD_COL_KEY_R 6
+#define KEYBOARD_ROW_KEY_R 6
+#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
+#define KEYBOARD_COL_LEFT_ALT 3
+#define KEYBOARD_ROW_LEFT_ALT 1
+#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
+#define KEYBOARD_COL_ID1_REFRESH 4
+#define KEYBOARD_ROW_ID1_REFRESH 6
+#define KEYBOARD_COL_ID2_REFRESH 5
+#define KEYBOARD_ROW_ID2_REFRESH 2
+#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ID1_REFRESH)
+#define KEYBOARD_COL_RIGHT_ALT 3
+#define KEYBOARD_ROW_RIGHT_ALT 0
+#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
+#define KEYBOARD_DEFAULT_COL_VOL_UP 13
+#define KEYBOARD_DEFAULT_ROW_VOL_UP 3
+#define KEYBOARD_COL_LEFT_CTRL 12
+#define KEYBOARD_ROW_LEFT_CTRL 1
#define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL)
#define KEYBOARD_COL_RIGHT_CTRL 12
#define KEYBOARD_ROW_RIGHT_CTRL 0
#define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL)
-#define KEYBOARD_COL_SEARCH 4
-#define KEYBOARD_ROW_SEARCH 4
-#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
-#define KEYBOARD_COL_KEY_0 13
-#define KEYBOARD_ROW_KEY_0 4
-#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
-#define KEYBOARD_COL_KEY_1 2
-#define KEYBOARD_ROW_KEY_1 5
-#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
-#define KEYBOARD_COL_KEY_2 5
-#define KEYBOARD_ROW_KEY_2 5
-#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
+#define KEYBOARD_COL_SEARCH 4
+#define KEYBOARD_ROW_SEARCH 4
+#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
+#define KEYBOARD_COL_KEY_0 13
+#define KEYBOARD_ROW_KEY_0 4
+#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
+#define KEYBOARD_COL_KEY_1 2
+#define KEYBOARD_ROW_KEY_1 5
+#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
+#define KEYBOARD_COL_KEY_2 5
+#define KEYBOARD_ROW_KEY_2 5
+#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
#define KEYBOARD_COL_LEFT_SHIFT 9
#define KEYBOARD_ROW_LEFT_SHIFT 1
#define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT)
void board_id_keyboard_col_inverted(int board_id);
-
#endif /* __KEYBOARD_CUSTOMIZATION_H */
diff --git a/board/banshee/led.c b/board/banshee/led.c
index b1c6a6445f..1471388085 100644
--- a/board/banshee/led.c
+++ b/board/banshee/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,16 +28,15 @@
#define LED_TICKS_PER_CYCLE 10
#define LED_ON_TICKS 5
-#define BREATH_LIGHT_LENGTH 55
-#define BREATH_HOLD_LENGTH 50
-#define BREATH_OFF_LENGTH 200
+#define BREATH_LIGHT_LENGTH 100
+#define BREATH_HOLD_LENGTH 50
+#define BREATH_OFF_LENGTH 200
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
EC_LED_ID_POWER_LED,
};
-
enum breath_status {
BREATH_LIGHT_UP = 0,
BREATH_LIGHT_DOWN,
@@ -45,26 +44,23 @@ enum breath_status {
BREATH_OFF,
};
-enum led_port {
- RIGHT_PORT = 1,
- LEFT_PORT
-};
+enum led_port { RIGHT_PORT = 1, LEFT_PORT };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 50, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 50, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 8 },
- [EC_LED_COLOR_YELLOW] = { 40, 50, 0 },
- [EC_LED_COLOR_WHITE] = { 20, 50, 25 },
- [EC_LED_COLOR_AMBER] = { 45, 5, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 50, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 50, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 8 },
+ [EC_LED_COLOR_YELLOW] = { 40, 50, 0 },
+ [EC_LED_COLOR_WHITE] = { 4, 10, 5 },
+ [EC_LED_COLOR_AMBER] = { 45, 5, 0 },
};
struct pwm_led_color_map pwr_led_color_map[EC_LED_COLOR_COUNT] = {
- /* White, Green, Red */
- [EC_LED_COLOR_WHITE] = { BREATH_LIGHT_LENGTH, 0, 0 },
+ /* White, Green, Red */
+ [EC_LED_COLOR_WHITE] = { BREATH_LIGHT_LENGTH, 0, 0 },
};
/*
@@ -88,13 +84,11 @@ struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = {
},
};
-
uint8_t breath_led_light_up;
uint8_t breath_led_light_down;
uint8_t breath_led_hold;
uint8_t breath_led_off;
-
int breath_pwm_enable;
int breath_led_status;
static void breath_led_pwm_deferred(void);
@@ -102,21 +96,19 @@ DECLARE_DEFERRED(breath_led_pwm_deferred);
/*
* Breath LED API
- * Max duty (percentage) = BREATH_LIGHT_LENGTH (55%)
- * Fade time (second) = 550ms(In) / 550ms(Out)
+ * Max duty (percentage) = BREATH_LIGHT_LENGTH (100%)
+ * Fade time (second) = 1000ms(In) / 1000ms(Out)
* Duration time (second) = BREATH_HOLD_LENGTH(500ms)
* Interval time (second) = BREATH_OFF_LENGTH(2000ms)
*/
static void breath_led_pwm_deferred(void)
{
-
switch (breath_led_status) {
case BREATH_LIGHT_UP:
- if (breath_led_light_up <= BREATH_LIGHT_LENGTH)
- pwm_set_duty(PWM_CH_POWER_LED_W,
- breath_led_light_up++);
+ if (breath_led_light_up <= BREATH_LIGHT_LENGTH)
+ pwm_set_duty(PWM_CH_POWER_LED_W, breath_led_light_up++);
else {
breath_led_light_up = 0;
breath_led_light_down = BREATH_LIGHT_LENGTH;
@@ -126,7 +118,7 @@ static void breath_led_pwm_deferred(void)
break;
case BREATH_HOLD:
- if (breath_led_hold <= BREATH_HOLD_LENGTH)
+ if (breath_led_hold <= BREATH_HOLD_LENGTH)
breath_led_hold++;
else {
breath_led_hold = 0;
@@ -138,7 +130,7 @@ static void breath_led_pwm_deferred(void)
if (breath_led_light_down != 0)
pwm_set_duty(PWM_CH_POWER_LED_W,
- breath_led_light_down--);
+ breath_led_light_down--);
else {
breath_led_light_down = BREATH_LIGHT_LENGTH;
breath_led_status = BREATH_OFF;
@@ -147,7 +139,7 @@ static void breath_led_pwm_deferred(void)
break;
case BREATH_OFF:
- if (breath_led_off <= BREATH_OFF_LENGTH)
+ if (breath_led_off <= BREATH_OFF_LENGTH)
breath_led_off++;
else {
breath_led_off = 0;
@@ -157,12 +149,10 @@ static void breath_led_pwm_deferred(void)
break;
}
-
if (breath_pwm_enable)
hook_call_deferred(&breath_led_pwm_deferred_data, 10 * MSEC);
}
-
void breath_led_run(uint8_t enable)
{
if (enable && !breath_pwm_enable) {
@@ -180,7 +170,6 @@ void breath_led_run(uint8_t enable)
}
}
-
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
@@ -192,7 +181,6 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
brightness_range[EC_LED_COLOR_WHITE] = 100;
} else if (led_id == EC_LED_ID_POWER_LED)
brightness_range[EC_LED_COLOR_WHITE] = 100;
-
}
void set_pwr_led_color(enum pwm_led_id id, int color)
@@ -265,8 +253,8 @@ static int led_get_charge_percent(void)
static void select_active_port_led(int port)
{
if ((charge_get_state() == PWR_STATE_DISCHARGE &&
- led_get_charge_percent() < 10) ||
- charge_get_state() == PWR_STATE_ERROR) {
+ led_get_charge_percent() < 10) ||
+ charge_get_state() == PWR_STATE_ERROR) {
gpio_set_level(GPIO_LEFT_SIDE, 1);
gpio_set_level(GPIO_RIGHT_SIDE, 1);
} else if (port == RIGHT_PORT) {
@@ -283,8 +271,7 @@ static void select_active_port_led(int port)
static int led_power_enable(void)
{
- if (gpio_get_level(GPIO_LEFT_SIDE) ||
- gpio_get_level(GPIO_RIGHT_SIDE))
+ if (gpio_get_level(GPIO_LEFT_SIDE) || gpio_get_level(GPIO_RIGHT_SIDE))
return true;
return false;
@@ -309,7 +296,6 @@ static void set_active_port_color(int color)
static void led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -322,38 +308,43 @@ static void led_set_battery(void)
if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
if (led_get_charge_percent() < 10)
set_active_port_color((battery_ticks & 0x2) ?
- EC_LED_COLOR_RED : -1);
+ EC_LED_COLOR_RED :
+ -1);
else
set_active_port_color(-1);
}
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- EC_LED_COLOR_RED : -1);
+ set_active_port_color((battery_ticks & 0x2) ? EC_LED_COLOR_RED :
+ -1);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
- set_active_port_color(EC_LED_COLOR_GREEN);
+ set_active_port_color(EC_LED_COLOR_WHITE);
break;
case PWR_STATE_IDLE:
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks & 0x4) ?
- EC_LED_COLOR_AMBER : -1);
- else
- set_active_port_color(EC_LED_COLOR_AMBER);
+ set_active_port_color(EC_LED_COLOR_AMBER);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks & 0x4) ? EC_LED_COLOR_AMBER : -1);
break;
default:
break;
}
-
}
static void led_set_power(void)
{
+ /* turn off led when lid is close*/
+ if (!lid_is_open()) {
+ set_pwr_led_color(PWM_LED1, -1);
+ return;
+ }
+
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
breath_led_run(1);
return;
- }
- else
+ } else
breath_led_run(0);
if (chipset_in_state(CHIPSET_STATE_ON)) {
@@ -369,6 +360,5 @@ static void led_tick(void)
led_set_battery();
if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
led_set_power();
-
}
DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);
diff --git a/board/banshee/pwm.c b/board/banshee/pwm.c
index e02d19064d..bfe5071eca 100644
--- a/board/banshee/pwm.c
+++ b/board/banshee/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/banshee/sensors.c b/board/banshee/sensors.c
index b4b6360984..57b81b2af8 100644
--- a/board/banshee/sensors.c
+++ b/board/banshee/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,15 +40,14 @@ struct adc_t adc_channels[] = {
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
/* CM32183 private data */
static struct als_drv_data_t g_cm32183_data = {
/**
* adjusted_value = raw_value * scale + raw_value * uscale / 10000
- * the coeficient we need is 3.8
+ * the coeficient we need is 3.2
*/
.als_cal.scale = 3,
- .als_cal.uscale = 8000,
+ .als_cal.uscale = 2000,
.als_cal.offset = 0,
.als_cal.channel_scale = {
/* TODO(b/219424210): Calibrate ALS CM32183A3OP */
@@ -120,8 +119,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = C_TO_K(80), \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
@@ -131,7 +130,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
[EC_TEMP_THRESH_WARN] = C_TO_K(75), \
[EC_TEMP_THRESH_HIGH] = C_TO_K(81), \
}, \
- .temp_fan_off = C_TO_K(40), \
+ .temp_fan_off = C_TO_K(50), \
.temp_fan_max = C_TO_K(58), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
@@ -152,8 +151,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_AMBIENT \
- { \
+#define THERMAL_AMBIENT \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = C_TO_K(85), \
[EC_TEMP_THRESH_HIGH] = C_TO_K(95), \
@@ -163,7 +162,7 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
[EC_TEMP_THRESH_WARN] = C_TO_K(70), \
[EC_TEMP_THRESH_HIGH] = C_TO_K(86), \
}, \
- .temp_fan_off = C_TO_K(40), \
+ .temp_fan_off = C_TO_K(50), \
.temp_fan_max = C_TO_K(58), \
}
__maybe_unused static const struct ec_thermal_config thermal_ambient =
@@ -183,8 +182,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = C_TO_K(90), \
[EC_TEMP_THRESH_HIGH] = C_TO_K(100), \
@@ -194,7 +193,7 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient =
[EC_TEMP_THRESH_WARN] = C_TO_K(85), \
[EC_TEMP_THRESH_HIGH] = C_TO_K(91), \
}, \
- .temp_fan_off = C_TO_K(40), \
+ .temp_fan_off = C_TO_K(50), \
.temp_fan_max = C_TO_K(58), \
}
__maybe_unused static const struct ec_thermal_config thermal_charger =
@@ -206,8 +205,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_WWAN \
- { \
+#define THERMAL_WWAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(130), \
[EC_TEMP_THRESH_HALT] = C_TO_K(130), \
diff --git a/board/banshee/tune_mp2964.c b/board/banshee/tune_mp2964.c
deleted file mode 100644
index f67caa587e..0000000000
--- a/board/banshee/tune_mp2964.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Tune the MP2964 IMVP9.1 parameters for brya */
-
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "hooks.h"
-#include "mp2964.h"
-
-const static struct mp2964_reg_val rail_a[] = {
- { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */
-};
-const static struct mp2964_reg_val rail_b[] = {
- { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */
-};
-
-static void mp2964_on_startup(void)
-{
- static int chip_updated;
- int status;
-
- if (get_board_id() != 1)
- return;
-
- if (chip_updated)
- return;
-
- chip_updated = 1;
-
- ccprintf("%s: attempting to tune PMIC\n", __func__);
-
- status = mp2964_tune(rail_a, ARRAY_SIZE(rail_a),
- rail_b, ARRAY_SIZE(rail_b));
- if (status != EC_SUCCESS)
- ccprintf("%s: could not update all settings\n", __func__);
-}
-
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, mp2964_on_startup,
- HOOK_PRIO_FIRST);
diff --git a/board/banshee/usbc_config.c b/board/banshee/usbc_config.c
index 93292873bc..7840b865ab 100644
--- a/board/banshee/usbc_config.c
+++ b/board/banshee/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,8 +36,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -113,59 +113,79 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc2_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc3_tcss_usb_mux = {
- .usb_port = USBC_PORT_C3,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc3_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C3,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C2_C3_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C2_C3_MUX,
+ .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc2_tcss_usb_mux,
},
[USBC_PORT_C3] = {
- .usb_port = USBC_PORT_C3,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C2_C3_MUX,
- .i2c_addr_flags = USBC_PORT_C3_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc3_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C3,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C2_C3_MUX,
+ .i2c_addr_flags = USBC_PORT_C3_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc3_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -252,8 +272,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -294,7 +314,7 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
* which powers I2C controller within retimer
*/
msleep(1);
- } else{
+ } else {
ioex_set_level(rst_signal, 0);
msleep(1);
}
diff --git a/board/banshee/usbc_config.h b/board/banshee/usbc_config.h
index 9a7cf4caca..5085b28bec 100644
--- a/board/banshee/usbc_config.h
+++ b/board/banshee/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 4
+#define CONFIG_USB_PD_PORT_MAX_COUNT 4
enum usbc_port {
USBC_PORT_C0 = 0,
diff --git a/board/beadrix/battery.c b/board/beadrix/battery.c
index 8ebdaf466d..48defc0481 100644
--- a/board/beadrix/battery.c
+++ b/board/beadrix/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/beadrix/board.c b/board/beadrix/board.c
index 0fb2f9773b..5cea32f90c 100644
--- a/board/beadrix/board.c
+++ b/board/beadrix/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,8 +39,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -142,34 +142,26 @@ __override void board_pulse_entering_rw(void)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -224,38 +216,48 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static int board_nb7v904m_mux_set(const struct usb_mux *me,
- mux_state_t mux_state);
+ mux_state_t mux_state);
/* USB Retimer */
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
- .board_set = &board_nb7v904m_mux_set,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ .board_set = &board_nb7v904m_mux_set,
+ },
};
/* USB Muxes */
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
- { /* Used as MUX only*/
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
- .flags = USB_MUX_FLAG_NOT_TCPC,
- .driver = &anx7447_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ {
+ /* Used as MUX only*/
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
+ .flags = USB_MUX_FLAG_NOT_TCPC,
+ .driver = &anx7447_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
},
};
/* USB Mux */
static int board_nb7v904m_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
int flipped = !!(mux_state & USB_PD_MUX_POLARITY_INVERTED);
@@ -264,75 +266,71 @@ static int board_nb7v904m_mux_set(const struct usb_mux *me,
/* USB with DP */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
if (flipped) { /* CC2 */
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_0_DB,
- NB7V904M_CH_B_EQ_4_DB,
- NB7V904M_CH_C_EQ_0_DB,
- NB7V904M_CH_D_EQ_0_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_3P5_DB,
- NB7V904M_CH_C_GAIN_0_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D);
+ rv |= nb7v904m_tune_usb_set_eq(
+ me, NB7V904M_CH_A_EQ_0_DB,
+ NB7V904M_CH_B_EQ_4_DB,
+ NB7V904M_CH_C_EQ_0_DB,
+ NB7V904M_CH_D_EQ_0_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_3P5_DB,
+ NB7V904M_CH_C_GAIN_0_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_D);
} /* CC1 */
else {
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_0_DB,
- NB7V904M_CH_B_EQ_0_DB,
- NB7V904M_CH_C_EQ_4_DB,
- NB7V904M_CH_D_EQ_0_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_0_DB,
- NB7V904M_CH_C_GAIN_3P5_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A);
- }
- } else {
- /* USB only */
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_0_DB,
- NB7V904M_CH_B_EQ_4_DB,
+ rv |= nb7v904m_tune_usb_set_eq(
+ me, NB7V904M_CH_A_EQ_0_DB,
+ NB7V904M_CH_B_EQ_0_DB,
NB7V904M_CH_C_EQ_4_DB,
NB7V904M_CH_D_EQ_0_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_3P5_DB,
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_0_DB,
NB7V904M_CH_C_GAIN_3P5_DB,
NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_D,
NB7V904M_LOSS_PROFILE_A,
NB7V904M_LOSS_PROFILE_A);
+ }
+ } else {
+ /* USB only */
+ rv |= nb7v904m_tune_usb_set_eq(me,
+ NB7V904M_CH_A_EQ_0_DB,
+ NB7V904M_CH_B_EQ_4_DB,
+ NB7V904M_CH_C_EQ_4_DB,
+ NB7V904M_CH_D_EQ_0_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_3P5_DB,
+ NB7V904M_CH_C_GAIN_3P5_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A);
}
} else if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* 4 lanes DP */
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_0_DB,
- NB7V904M_CH_B_EQ_0_DB,
- NB7V904M_CH_C_EQ_0_DB,
- NB7V904M_CH_D_EQ_0_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_0_DB,
- NB7V904M_CH_C_GAIN_0_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D);
+ rv |= nb7v904m_tune_usb_set_eq(me, NB7V904M_CH_A_EQ_0_DB,
+ NB7V904M_CH_B_EQ_0_DB,
+ NB7V904M_CH_C_EQ_0_DB,
+ NB7V904M_CH_D_EQ_0_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_0_DB,
+ NB7V904M_CH_C_GAIN_0_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_D, NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_D, NB7V904M_LOSS_PROFILE_D);
}
return rv;
@@ -406,8 +404,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -443,22 +440,24 @@ int board_set_active_charge_port(int port)
* Turn off the other ports' sink path FETs, before enabling the
* requested charge port.
*/
- for (i = 0; i < board_get_usb_pd_port_count(); i++) {
- if (i == port)
- continue;
-
- if (tcpc_write(i, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW))
- CPRINTS("p%d: sink path disable failed.", i);
- raa489000_enable_asgate(i, false);
- }
+ if (old_port != CHARGE_PORT_NONE && old_port != port) {
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
+ if (i == port)
+ continue;
- /*
- * Stop the charger IC from switching while changing ports. Otherwise,
- * we can overcurrent the adapter we're switching to. (crbug.com/926056)
- */
- if (old_port != CHARGE_PORT_NONE)
+ if (tcpc_write(i, TCPC_REG_COMMAND,
+ TCPC_REG_COMMAND_SNK_CTRL_LOW))
+ CPRINTS("p%d: sink path disable failed.", i);
+ raa489000_enable_asgate(i, false);
+ }
+
+ /*
+ * Stop the charger IC from switching while changing ports.
+ * Otherwise, we can overcurrent the adapter we're switching to.
+ * (crbug.com/926056)
+ */
charger_discharge_on_ac(1);
+ }
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
@@ -476,8 +475,8 @@ int board_set_active_charge_port(int port)
}
/* Vconn control for integrated ITE TCPC */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -518,7 +517,7 @@ uint16_t tcpc_get_alert_status(void)
}
if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_USB_C1_INT_V1_ODL)) {
+ !gpio_get_level(GPIO_USB_C1_INT_V1_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
@@ -532,9 +531,8 @@ uint16_t tcpc_get_alert_status(void)
return status;
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -550,25 +548,23 @@ int pd_snk_is_vbus_provided(int port)
}
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
+const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 10000,
+ } };
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -589,8 +585,8 @@ static const struct ec_response_keybd_config keybd1 = {
/* No function keys, no numeric keypad and no screenlock key */
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
/*
* Future boards should use fw_config if needed.
diff --git a/board/beadrix/board.h b/board/beadrix/board.h
index 6e7975fd14..82a7802445 100644
--- a/board/beadrix/board.h
+++ b/board/beadrix/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,7 @@
#define VARIANT_DEDEDE_EC_IT8320
#include "baseboard.h"
-/* System unlocked in early development */
-#define CONFIG_SYSTEM_UNLOCKED
+#undef CONFIG_I2C_DEBUG
/* EC console commands */
#define CONFIG_CMD_CHARGER_DUMP
@@ -27,12 +26,15 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGE_RAMP_HW
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
/*
* GPIO for C1 interrupts, for baseboard use
@@ -45,7 +47,7 @@
#define CONFIG_PWM
/* TCPC */
-#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: MUX only*/
+#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: MUX only*/
#define CONFIG_USB_PD_TCPM_MUX
#define CONFIG_USB_PD_TCPM_ANX7447_AUX_PU_PD
@@ -57,7 +59,7 @@
/* USB */
#define CONFIG_BC12_DETECT_PI3USB9201
#define CONFIG_USB_MUX_RUNTIME_CONFIG
-#define CONFIG_USB_MUX_IT5205 /* C0: ITE MUX */
+#define CONFIG_USB_MUX_IT5205 /* C0: ITE MUX */
/* USB PD */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
@@ -67,7 +69,7 @@
/* USB Mux and Retimer */
#define CONFIG_USB_MUX_RUNTIME_CONFIG
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
#define CONFIG_USBC_RETIMER_NB7V904M
/* USB defines specific to external TCPCs */
@@ -82,8 +84,8 @@
#undef PD_POWER_SUPPLY_TURN_ON_DELAY
#undef PD_POWER_SUPPLY_TURN_OFF_DELAY
/* 20% margin added for these timings */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
#ifndef __ASSEMBLER__
@@ -103,18 +105,14 @@ enum pwm_channel {
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/beadrix/build.mk b/board/beadrix/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/beadrix/build.mk
+++ b/board/beadrix/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/beadrix/cbi_ssfc.c b/board/beadrix/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/beadrix/cbi_ssfc.c
+++ b/board/beadrix/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/beadrix/cbi_ssfc.h b/board/beadrix/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/beadrix/cbi_ssfc.h
+++ b/board/beadrix/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/beadrix/ec.tasklist b/board/beadrix/ec.tasklist
index 74b7663d69..253501100e 100644
--- a/board/beadrix/ec.tasklist
+++ b/board/beadrix/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/beadrix/gpio.inc b/board/beadrix/gpio.inc
index b5e557f01f..b450c520e8 100644
--- a/board/beadrix/gpio.inc
+++ b/board/beadrix/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/beadrix/led.c b/board/beadrix/led.c
index ab011d49d4..8bef7c0bd9 100644
--- a/board/beadrix/led.c
+++ b/board/beadrix/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,27 +19,25 @@
#include "util.h"
#define LED_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
-#define BAT_LED_ON 0
-#define BAT_LED_OFF 1
+#define BAT_LED_ON 0
+#define BAT_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
LED_OFF = 0,
LED_RED,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_LED_R_ODL,
- (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_LED_B_ODL,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -65,7 +63,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
enum led_color color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -105,16 +102,16 @@ static void board_led_set_battery(void)
color = LED_BLUE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Red 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_RED;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Red 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_RED;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/beadrix/usb_pd_policy.c b/board/beadrix/usb_pd_policy.c
index a50ef8cfa9..c22c68d224 100644
--- a/board/beadrix/usb_pd_policy.c
+++ b/board/beadrix/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/beetley/battery.c b/board/beetley/battery.c
index 94f5dbb630..0402ef33fd 100644
--- a/board/beetley/battery.c
+++ b/board/beetley/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/beetley/board.c b/board/beetley/board.c
index 0e6c88b24b..f6b1f1008c 100644
--- a/board/beetley/board.c
+++ b/board/beetley/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
__override struct keyboard_scan_config keyscan_config = {
@@ -100,7 +100,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -114,34 +113,26 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -177,12 +168,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
};
@@ -203,27 +197,23 @@ static const struct ec_response_keybd_config beetley_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &beetley_keybd;
}
/* USB-A charging control */
-const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_EN_USB_A0_VBUS
-};
+const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_USB_A0_VBUS };
/* Sensors */
static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t base_lsm6dsm_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_lsm6dsm_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
@@ -331,7 +321,6 @@ void board_init(void)
keyscan_config.actual_key_mask[12] = 0xff;
keyscan_config.actual_key_mask[13] = 0xff;
keyscan_config.actual_key_mask[14] = 0xff;
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -422,7 +411,6 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
@@ -434,8 +422,7 @@ int board_set_active_charge_port(int port)
/* Disable all ports. */
if (port == CHARGE_PORT_NONE) {
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
raa489000_enable_asgate(0, false);
return EC_SUCCESS;
}
@@ -448,8 +435,7 @@ int board_set_active_charge_port(int port)
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
CPRINTUSB("p%d: sink path enable failed.", port);
return EC_ERROR_UNKNOWN;
}
@@ -481,18 +467,18 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charge",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "5V_Inductor",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charge",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "5V_Inductor",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/beetley/board.h b/board/beetley/board.h
index 15eac0d3f8..a70ee73ebb 100644
--- a/board/beetley/board.h
+++ b/board/beetley/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,6 +27,7 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
@@ -42,13 +43,13 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
@@ -112,12 +113,7 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
diff --git a/board/beetley/build.mk b/board/beetley/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/beetley/build.mk
+++ b/board/beetley/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/beetley/cbi_ssfc.c b/board/beetley/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/beetley/cbi_ssfc.c
+++ b/board/beetley/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/beetley/cbi_ssfc.h b/board/beetley/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/beetley/cbi_ssfc.h
+++ b/board/beetley/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/beetley/ec.tasklist b/board/beetley/ec.tasklist
index bdcbcdf074..8ccdfc81b2 100644
--- a/board/beetley/ec.tasklist
+++ b/board/beetley/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/beetley/gpio.inc b/board/beetley/gpio.inc
index bbb793ee44..0677e5a2ac 100644
--- a/board/beetley/gpio.inc
+++ b/board/beetley/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/beetley/led.c b/board/beetley/led.c
index bf64b33dcf..e3d4eb543e 100644
--- a/board/beetley/led.c
+++ b/board/beetley/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,42 +11,46 @@
#include "gpio.h"
#include "pwm.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/beetley/usb_pd_policy.c b/board/beetley/usb_pd_policy.c
index b7c0ca21df..a7633b73ac 100644
--- a/board/beetley/usb_pd_policy.c
+++ b/board/beetley/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/bellis/battery.c b/board/bellis/battery.c
index 7c086fb8e2..d74876ec27 100644
--- a/board/bellis/battery.c
+++ b/board/bellis/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bellis/board.c b/board/bellis/board.c
index 7c7392e4d5..e03ae1c36c 100644
--- a/board/bellis/board.c
+++ b/board/bellis/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,6 +31,7 @@
#include "keyboard_scan.h"
#include "keyboard_backlight.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -44,8 +45,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -57,42 +58,36 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(5),
- STM32_RANK(1)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(15),
- STM32_RANK(2)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(5),
+ STM32_RANK(1) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(15),
+ STM32_RANK(2) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 2,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 2,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 3,
- .kbps = 100,
- .scl = GPIO_I2C4_SCL,
- .sda = GPIO_I2C4_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 3,
+ .kbps = 100,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C4_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -100,8 +95,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -157,8 +152,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -171,13 +165,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -239,12 +236,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -314,8 +311,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -333,8 +329,7 @@ static void board_spi_disable(void)
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
#endif
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -373,17 +368,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1) }
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
/* Lid accel private data */
@@ -471,7 +462,7 @@ struct motion_sensor_t motion_sensors[] = {
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct it8801_pwm_t it8801_pwm_channels[] = {
- [IT8801_PWM_CH_KBLIGHT] = {.index = 4},
+ [IT8801_PWM_CH_KBLIGHT] = { .index = 4 },
};
void board_kblight_init(void)
@@ -487,11 +478,11 @@ bool board_has_kb_backlight(void)
#endif /* !VARIANT_KUKUI_NO_SENSORS */
/* Battery functions */
-#define SB_SMARTCHARGE 0x26
+#define SB_SMARTCHARGE 0x26
/* Quick charge enable bit */
-#define SMART_QUICK_CHARGE 0x02
+#define SMART_QUICK_CHARGE 0x02
/* Quick charge support bit */
-#define MODE_QUICK_CHARGE_SUPPORT 0x01
+#define MODE_QUICK_CHARGE_SUPPORT 0x01
static void sb_quick_charge_mode(int enable)
{
@@ -562,8 +553,8 @@ int board_get_battery_i2c(void)
}
#ifdef SECTION_IS_RW
-static int it8801_get_target_channel(enum pwm_channel *channel,
- int type, int index)
+static int it8801_get_target_channel(enum pwm_channel *channel, int type,
+ int index)
{
switch (type) {
case EC_PWM_TYPE_GENERIC:
@@ -586,14 +577,13 @@ host_command_pwm_set_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- duty = (uint32_t) p->duty * 255 / 65535;
+ duty = (uint32_t)p->duty * 255 / 65535;
it8801_pwm_set_raw_duty(channel, duty);
it8801_pwm_enable(channel, p->duty > 0);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
- host_command_pwm_set_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY, host_command_pwm_set_duty,
EC_VER_MASK(0));
static enum ec_status
@@ -607,12 +597,11 @@ host_command_pwm_get_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- r->duty = (uint32_t) it8801_pwm_get_raw_duty(channel) * 65535 / 255;
+ r->duty = (uint32_t)it8801_pwm_get_raw_duty(channel) * 65535 / 255;
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY,
- host_command_pwm_get_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY, host_command_pwm_get_duty,
EC_VER_MASK(0));
#endif
diff --git a/board/bellis/board.h b/board/bellis/board.h
index 76f70f47c1..d502c4c5ef 100644
--- a/board/bellis/board.h
+++ b/board/bellis/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,13 +27,13 @@
#undef STM32_PLLM
#undef STM32_PLLN
#undef STM32_PLLR
-#define STM32_PLLM 1
+#define STM32_PLLM 1
#ifdef STM32_HSE_CLOCK
-#define STM32_PLLN 12
+#define STM32_PLLN 12
#else
-#define STM32_PLLN 10
+#define STM32_PLLN 10
#endif
-#define STM32_PLLR 2
+#define STM32_PLLR 2
#define STM32_USE_PLL
@@ -65,13 +65,12 @@
#define CONFIG_LED_ONOFF_STATES
#define CONFIG_LED_POWER_LED
-#undef CONFIG_WATCHDOG_PERIOD_MS
+#undef CONFIG_WATCHDOG_PERIOD_MS
#define CONFIG_WATCHDOG_PERIOD_MS 4000
-
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -93,34 +92,34 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_CHARGER 2
-#define I2C_PORT_SENSORS 2
-#define I2C_PORT_KB_DISCRETE 2
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_BATTERY 3
-#define I2C_PORT_TCPC0 0
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER 2
+#define I2C_PORT_SENSORS 2
+#define I2C_PORT_KB_DISCRETE 2
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BATTERY 3
+#define I2C_PORT_TCPC0 0
#undef I2C_CONTROLLER_COUNT
#undef I2C_PORT_COUNT
-#define I2C_CONTROLLER_COUNT 3
-#define I2C_PORT_COUNT 3
+#define I2C_CONTROLLER_COUNT 3
+#define I2C_PORT_COUNT 3
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
/* Define the MKBP events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
#undef CONFIG_GMR_TABLET_MODE
#undef GPIO_TABLET_MODE_L
diff --git a/board/bellis/build.mk b/board/bellis/build.mk
index f88dde8da8..604790d66c 100644
--- a/board/bellis/build.mk
+++ b/board/bellis/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/bellis/ec.tasklist b/board/bellis/ec.tasklist
index faecc9d405..2d69c1b113 100644
--- a/board/bellis/ec.tasklist
+++ b/board/bellis/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bellis/gpio.inc b/board/bellis/gpio.inc
index 5fa1383483..a80ef27c97 100644
--- a/board/bellis/gpio.inc
+++ b/board/bellis/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bellis/led.c b/board/bellis/led.c
index a6a926a958..658533d075 100644
--- a/board/bellis/led.c
+++ b/board/bellis/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,33 +18,38 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
-led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/berknip/battery.c b/board/berknip/battery.c
index 526375c0db..d024e710c3 100644
--- a/board/berknip/battery.c
+++ b/board/berknip/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/berknip/board.c b/board/berknip/board.c
index 36b6b4f68f..cade20a3c7 100644
--- a/board/berknip/board.c
+++ b/board/berknip/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,8 +40,8 @@ static void hdmi_hpd_interrupt(enum gpio_signal signal);
#include "gpio_list.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct pwm_t pwm_channels[] = {
[PWM_CH_KBLIGHT] = {
@@ -95,8 +95,7 @@ static void board_chipset_resume(void)
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 1);
msleep(PI3HDX1204_POWER_ON_DELAY_MS);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
check_hdmi_hpd_status());
}
}
@@ -105,9 +104,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
static void board_chipset_suspend(void)
{
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 0);
}
@@ -145,14 +142,21 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since PI3USB221 is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration
*/
+
+/* Place holder for second mux in USBC1 chain */
+struct usb_mux_chain usbc1_mux1;
+
static void setup_mux(void)
{
if (ec_config_has_usbc1_retimer_tusb544()) {
@@ -163,11 +167,9 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the AMD FP5
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_amd_fp5_usb_mux,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux;
/* Set the TUSB544 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_tusb544;
+ usbc1_mux1.mux = &usbc1_tusb544;
} else if (ec_config_has_usbc1_retimer_ps8743()) {
ccprints("C1 PS8743 detected");
/*
@@ -176,92 +178,84 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the PS8743
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_ps8743,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_ps8743;
/* Set the AMD FP5 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux;
+ usbc1_mux1.mux = &usbc1_amd_fp5_usb_mux;
/* Don't have the AMD FP5 flip */
usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
}
}
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
[USBC_PORT_C1] = {
/* Filled in dynamically at startup */
+ .next = &usbc1_mux1,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
static int board_tusb544_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
if (mux_state & USB_PD_MUX_USB_ENABLED) {
-
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_USB3_1_1,
- TUSB544_EQ_RX_MASK,
- TUSB544_EQ_RX_DFP_04_UFP_MINUS15);
+ rv = tusb544_i2c_field_update8(
+ me, TUSB544_REG_USB3_1_1, TUSB544_EQ_RX_MASK,
+ TUSB544_EQ_RX_DFP_04_UFP_MINUS15);
if (rv)
return rv;
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_USB3_1_1,
- TUSB544_EQ_TX_MASK,
- TUSB544_EQ_TX_DFP_MINUS14_UFP_MINUS33);
+ rv = tusb544_i2c_field_update8(
+ me, TUSB544_REG_USB3_1_1, TUSB544_EQ_TX_MASK,
+ TUSB544_EQ_TX_DFP_MINUS14_UFP_MINUS33);
if (rv)
return rv;
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_USB3_1_2,
- TUSB544_EQ_RX_MASK,
- TUSB544_EQ_RX_DFP_04_UFP_MINUS15);
+ rv = tusb544_i2c_field_update8(
+ me, TUSB544_REG_USB3_1_2, TUSB544_EQ_RX_MASK,
+ TUSB544_EQ_RX_DFP_04_UFP_MINUS15);
if (rv)
return rv;
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_USB3_1_2,
- TUSB544_EQ_TX_MASK,
- TUSB544_EQ_TX_DFP_MINUS14_UFP_MINUS33);
+ rv = tusb544_i2c_field_update8(
+ me, TUSB544_REG_USB3_1_2, TUSB544_EQ_TX_MASK,
+ TUSB544_EQ_TX_DFP_MINUS14_UFP_MINUS33);
if (rv)
return rv;
}
if (mux_state & USB_PD_MUX_DP_ENABLED) {
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_DISPLAYPORT_1,
- TUSB544_EQ_RX_MASK,
- TUSB544_EQ_RX_DFP_61_UFP_43);
+ rv = tusb544_i2c_field_update8(me, TUSB544_REG_DISPLAYPORT_1,
+ TUSB544_EQ_RX_MASK,
+ TUSB544_EQ_RX_DFP_61_UFP_43);
if (rv)
return rv;
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_DISPLAYPORT_1,
- TUSB544_EQ_TX_MASK,
- TUSB544_EQ_TX_DFP_61_UFP_43);
+ rv = tusb544_i2c_field_update8(me, TUSB544_REG_DISPLAYPORT_1,
+ TUSB544_EQ_TX_MASK,
+ TUSB544_EQ_TX_DFP_61_UFP_43);
if (rv)
return rv;
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_DISPLAYPORT_2,
- TUSB544_EQ_RX_MASK,
- TUSB544_EQ_RX_DFP_61_UFP_43);
+ rv = tusb544_i2c_field_update8(me, TUSB544_REG_DISPLAYPORT_2,
+ TUSB544_EQ_RX_MASK,
+ TUSB544_EQ_RX_DFP_61_UFP_43);
if (rv)
return rv;
- rv = tusb544_i2c_field_update8(me,
- TUSB544_REG_DISPLAYPORT_2,
- TUSB544_EQ_TX_MASK,
- TUSB544_EQ_TX_DFP_61_UFP_43);
+ rv = tusb544_i2c_field_update8(me, TUSB544_REG_DISPLAYPORT_2,
+ TUSB544_EQ_TX_MASK,
+ TUSB544_EQ_TX_DFP_61_UFP_43);
if (rv)
return rv;
@@ -346,10 +340,9 @@ static void hdmi_hpd_handler(void)
gpio_set_level(GPIO_EC_DP1_HPD, hpd);
ccprints("HDMI HPD %d", hpd);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON)
- && hpd);
+ pi3hdx1204_enable(
+ I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) && hpd);
}
DECLARE_DEFERRED(hdmi_hpd_handler);
@@ -366,7 +359,7 @@ static void hdmi_hpd_interrupt(enum gpio_signal signal)
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -401,7 +394,7 @@ int board_get_temp(int idx, int *temp_k)
/* adc power not ready when transition to S5 */
if (chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_SOFT_OFF))
+ CHIPSET_STATE_SOFT_OFF))
return EC_ERROR_NOT_POWERED;
channel = ADC_TEMP_SENSOR_SOC;
@@ -413,7 +406,7 @@ int board_get_temp(int idx, int *temp_k)
/* adc power not ready when transition to S5 */
if (chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_SOFT_OFF))
+ CHIPSET_STATE_SOFT_OFF))
return EC_ERROR_NOT_POWERED;
channel = ADC_TEMP_SENSOR_5V_REGULATOR;
@@ -487,8 +480,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_THERMISTOR_SOC \
- { \
+#define THERMAL_THERMISTOR_SOC \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(62), \
[EC_TEMP_THRESH_HALT] = C_TO_K(66), \
@@ -506,7 +499,7 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor_soc =
* TODO(b/202062363): Remove when clang is fixed.
*/
#define THERMAL_THERMISTOR_CHARGER \
- { \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(99), \
[EC_TEMP_THRESH_HALT] = C_TO_K(99), \
@@ -515,16 +508,16 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor_soc =
[EC_TEMP_THRESH_HIGH] = C_TO_K(98), \
}, \
.temp_fan_off = C_TO_K(98), \
- .temp_fan_max = C_TO_K(99), \
+ .temp_fan_max = C_TO_K(99), \
}
-__maybe_unused static const struct ec_thermal_config
- thermal_thermistor_charger = THERMAL_THERMISTOR_CHARGER;
+__maybe_unused static const struct ec_thermal_config thermal_thermistor_charger =
+ THERMAL_THERMISTOR_CHARGER;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_THERMISTOR_5V \
- { \
+#define THERMAL_THERMISTOR_5V \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(60), \
[EC_TEMP_THRESH_HALT] = C_TO_K(99), \
@@ -541,8 +534,8 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor_5v =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(100), \
[EC_TEMP_THRESH_HALT] = C_TO_K(105), \
@@ -562,13 +555,13 @@ struct fan_step {
};
static const struct fan_step fan_table0[] = {
- {.on = 0, .off = 5, .rpm = 0},
- {.on = 29, .off = 5, .rpm = 3700},
- {.on = 38, .off = 19, .rpm = 4000},
- {.on = 48, .off = 33, .rpm = 4500},
- {.on = 62, .off = 43, .rpm = 4800},
- {.on = 76, .off = 52, .rpm = 5200},
- {.on = 100, .off = 67, .rpm = 6200},
+ { .on = 0, .off = 5, .rpm = 0 },
+ { .on = 29, .off = 5, .rpm = 3700 },
+ { .on = 38, .off = 19, .rpm = 4000 },
+ { .on = 48, .off = 33, .rpm = 4500 },
+ { .on = 62, .off = 43, .rpm = 4800 },
+ { .on = 76, .off = 52, .rpm = 5200 },
+ { .on = 100, .off = 67, .rpm = 6200 },
};
/* All fan tables must have the same number of levels */
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0)
@@ -608,8 +601,7 @@ int fan_percent_to_rpm(int fan, int pct)
previous_pct = pct;
- if (fan_table[current_level].rpm !=
- fan_get_rpm_target(FAN_CH(fan)))
+ if (fan_table[current_level].rpm != fan_get_rpm_target(FAN_CH(fan)))
cprints(CC_THERMAL, "Setting fan RPM to %d",
fan_table[current_level].rpm);
@@ -632,15 +624,14 @@ DECLARE_HOOK(HOOK_INIT, setup_fans, HOOK_PRIO_DEFAULT);
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {0, 5}, {1, 1}, {1, 0}, {0, 6}, {0, 7},
- {1, 4}, {1, 3}, {1, 6}, {1, 7}, {3, 1},
- {2, 0}, {1, 5}, {2, 6}, {2, 7}, {2, 1},
- {2, 4}, {2, 5}, {1, 2}, {2, 3}, {2, 2},
- {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 }, { 1, 4 },
+ { 1, 3 }, { 1, 6 }, { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 },
+ { 2, 6 }, { 2, 7 }, { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 },
+ { 2, 3 }, { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
/*****************************************************************************
@@ -685,9 +676,8 @@ enum gpio_signal board_usbc_port_to_hpd_gpio(int port)
* from USB-PD messages..
*/
else if (ec_config_has_mst_hub_rtd2141b())
- return (board_ver >= 3)
- ? GPIO_USB_C1_HPD_IN_DB_V1
- : GPIO_NO_HPD;
+ return (board_ver >= 3) ? GPIO_USB_C1_HPD_IN_DB_V1 :
+ GPIO_NO_HPD;
/* USB-C1 OPT1 DB uses DP2_HPD. */
return GPIO_DP2_HPD;
diff --git a/board/berknip/board.h b/board/berknip/board.h
index 5ef9e33f0c..62261f284b 100644
--- a/board/berknip/board.h
+++ b/board/berknip/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,27 +30,27 @@
#define CONFIG_POWER_SIGNAL_RUNTIME_CONFIG
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
@@ -76,11 +76,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_FAN, PWM_CH_COUNT };
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -90,11 +86,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
@@ -147,49 +139,39 @@ enum ec_cfg_usb_db_type {
#include "cbi_ec_fw_config.h"
-#define HAS_USBC1_RETIMER_PS8743 \
- (BIT(BERKNIP_DB_T_OPT3_USBAC_HDMI_MSTHUB))
+#define HAS_USBC1_RETIMER_PS8743 (BIT(BERKNIP_DB_T_OPT3_USBAC_HDMI_MSTHUB))
static inline bool ec_config_has_usbc1_retimer_ps8743(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8743);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8743);
}
-#define HAS_USBC1_RETIMER_TUSB544 \
- (BIT(BERKNIP_DB_T_OPT1_USBAC_HMDI))
+#define HAS_USBC1_RETIMER_TUSB544 (BIT(BERKNIP_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_usbc1_retimer_tusb544(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_TUSB544);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_TUSB544);
}
-#define HAS_HDMI_RETIMER_PI3HDX1204 \
- (BIT(BERKNIP_DB_T_OPT1_USBAC_HMDI))
+#define HAS_HDMI_RETIMER_PI3HDX1204 (BIT(BERKNIP_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_RETIMER_PI3HDX1204);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_RETIMER_PI3HDX1204);
}
-#define HAS_MST_HUB_RTD2141B \
- (BIT(BERKNIP_DB_T_OPT3_USBAC_HDMI_MSTHUB))
+#define HAS_MST_HUB_RTD2141B (BIT(BERKNIP_DB_T_OPT3_USBAC_HDMI_MSTHUB))
static inline bool ec_config_has_mst_hub_rtd2141b(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_MST_HUB_RTD2141B);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_MST_HUB_RTD2141B);
}
-#define HAS_HDMI_CONN_HPD \
- (BIT(BERKNIP_DB_T_OPT1_USBAC_HMDI))
+#define HAS_HDMI_CONN_HPD (BIT(BERKNIP_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_hdmi_conn_hpd(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_CONN_HPD);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_CONN_HPD);
}
enum gpio_signal board_usbc_port_to_hpd_gpio(int port);
diff --git a/board/berknip/build.mk b/board/berknip/build.mk
index 1c0cbc4f63..45c71f962c 100644
--- a/board/berknip/build.mk
+++ b/board/berknip/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/berknip/ec.tasklist b/board/berknip/ec.tasklist
index 3a08ebc972..779bd4fdd6 100644
--- a/board/berknip/ec.tasklist
+++ b/board/berknip/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/berknip/gpio.inc b/board/berknip/gpio.inc
index 860cbba284..1bba6a3a69 100644
--- a/board/berknip/gpio.inc
+++ b/board/berknip/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/berknip/led.c b/board/berknip/led.c
index 79d691ffac..afa3c3e5d2 100644
--- a/board/berknip/led.c
+++ b/board/berknip/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,22 +35,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- RIGHT_PORT = 0,
- LEFT_PORT
-};
+enum led_port { RIGHT_PORT = 0, LEFT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_LED_CHRG_L :
- GPIO_C1_CHARGE_LED_AMBER_DB_L);
+ GPIO_C1_CHARGE_LED_AMBER_DB_L);
white_led = (port == RIGHT_PORT ? GPIO_LED_FULL_L :
- GPIO_C1_CHARGE_LED_WHITE_DB_L);
+ GPIO_C1_CHARGE_LED_WHITE_DB_L);
switch (color) {
case LED_WHITE:
@@ -122,17 +119,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -141,18 +137,20 @@ static void led_set_battery(void)
* design, blinking both two side battery white LEDs to indicate
* system suspend with non-charging state.
*/
- if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
- led_set_color_battery(RIGHT_PORT, power_ticks
- % LED_TICKS_PER_CYCLE_S3 < POWER_LED_ON_S3_TICKS
- ? LED_WHITE : LED_OFF);
- led_set_color_battery(LEFT_PORT, power_ticks
- % LED_TICKS_PER_CYCLE_S3 < POWER_LED_ON_S3_TICKS
- ? LED_WHITE : LED_OFF);
+ led_set_color_battery(RIGHT_PORT,
+ power_ticks % LED_TICKS_PER_CYCLE_S3 <
+ POWER_LED_ON_S3_TICKS ?
+ LED_WHITE :
+ LED_OFF);
+ led_set_color_battery(LEFT_PORT,
+ power_ticks % LED_TICKS_PER_CYCLE_S3 <
+ POWER_LED_ON_S3_TICKS ?
+ LED_WHITE :
+ LED_OFF);
return;
}
@@ -166,9 +164,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
@@ -177,19 +178,20 @@ static void led_set_battery(void)
led_set_color_battery(LEFT_PORT, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/blipper/battery.c b/board/blipper/battery.c
index 114cfbc313..61ad95d4b7 100644
--- a/board/blipper/battery.c
+++ b/board/blipper/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/blipper/board.c b/board/blipper/board.c
index c980e3ce0f..766f55579c 100644
--- a/board/blipper/board.c
+++ b/board/blipper/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -47,8 +47,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
__override struct keyboard_scan_config keyscan_config = {
@@ -105,7 +105,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -119,34 +118,26 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -182,12 +173,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
};
@@ -208,16 +202,14 @@ static const struct ec_response_keybd_config blipper_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
- return &blipper_keybd;
+ return &blipper_keybd;
}
/* USB-A charging control */
-const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_EN_USB_A0_VBUS
-};
+const int usb_port_enable[USB_PORT_COUNT] = { GPIO_EN_USB_A0_VBUS };
static uint32_t board_id;
@@ -226,11 +218,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_lis2dwl_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_lis2dwl_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
@@ -310,11 +300,9 @@ struct motion_sensor_t motion_sensors[] = {
};
static struct icm_drv_data_t g_icm42607_data;
-const mat33_fp_t based_ref_icm42607 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t based_ref_icm42607 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -342,28 +330,26 @@ struct motion_sensor_t icm42607_base_accel = {
},
};
struct motion_sensor_t icm42607_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM42607,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm42607_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm42607_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &based_ref_icm42607,
- .min_frequency = ICM42607_GYRO_MIN_FREQ,
- .max_frequency = ICM42607_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm42607_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &based_ref_icm42607,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
};
static struct bmi_drv_data_t g_bmi220_data;
-const mat33_fp_t based_ref_bmi220 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t based_ref_bmi220 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t bmi220_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -391,20 +377,20 @@ struct motion_sensor_t bmi220_base_accel = {
},
};
struct motion_sensor_t bmi220_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI220,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi260_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi220_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &based_ref_bmi220,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI220,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi260_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi220_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &based_ref_bmi220,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
};
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
@@ -448,15 +434,13 @@ void board_init(void)
* line to float.
*/
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
/* Disable Volume keys for blipper */
button_disable_gpio(BUTTON_VOLUME_UP);
button_disable_gpio(BUTTON_VOLUME_DOWN);
- gpio_set_flags(GPIO_VOLDN_BTN_ODL,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_VOLUP_BTN_ODL,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_VOLDN_BTN_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
} else {
if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM42607) {
motion_sensors[BASE_ACCEL] = icm42607_base_accel;
@@ -579,7 +563,6 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
@@ -591,8 +574,7 @@ int board_set_active_charge_port(int port)
/* Disable all ports. */
if (port == CHARGE_PORT_NONE) {
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
raa489000_enable_asgate(0, false);
return EC_SUCCESS;
}
@@ -605,8 +587,7 @@ int board_set_active_charge_port(int port)
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
CPRINTUSB("p%d: sink path enable failed.", port);
return EC_ERROR_UNKNOWN;
}
@@ -638,18 +619,18 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charge",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "5V_Inductor",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charge",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "5V_Inductor",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/blipper/board.h b/board/blipper/board.h
index 2e7ad6c6b5..379a92a007 100644
--- a/board/blipper/board.h
+++ b/board/blipper/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,6 +24,7 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
@@ -36,20 +37,20 @@
#define CONFIG_LED_ONOFF_STATES
/*SENSOR*/
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCELGYRO_ICM42607
#define CONFIG_ACCELGYRO_BMI220
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_I2C_XFER_LARGE_TRANSFER
@@ -125,19 +126,14 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
ADC_CH_COUNT
};
diff --git a/board/blipper/build.mk b/board/blipper/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/blipper/build.mk
+++ b/board/blipper/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/blipper/cbi_ssfc.c b/board/blipper/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/blipper/cbi_ssfc.c
+++ b/board/blipper/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/blipper/cbi_ssfc.h b/board/blipper/cbi_ssfc.h
index f4a51b8e91..bc6bc92286 100644
--- a/board/blipper/cbi_ssfc.h
+++ b/board/blipper/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -57,5 +57,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/blipper/ec.tasklist b/board/blipper/ec.tasklist
index bdcbcdf074..8ccdfc81b2 100644
--- a/board/blipper/ec.tasklist
+++ b/board/blipper/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/blipper/gpio.inc b/board/blipper/gpio.inc
index 8558aab638..215f31a281 100644
--- a/board/blipper/gpio.inc
+++ b/board/blipper/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/blipper/led.c b/board/blipper/led.c
index c28b39f6af..c6617d081c 100644
--- a/board/blipper/led.c
+++ b/board/blipper/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,42 +11,46 @@
#include "gpio.h"
#include "pwm.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/blipper/usb_pd_policy.c b/board/blipper/usb_pd_policy.c
index b7c0ca21df..a7633b73ac 100644
--- a/board/blipper/usb_pd_policy.c
+++ b/board/blipper/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/bloog/battery.c b/board/bloog/battery.c
index f67b21d3b5..af3282576a 100644
--- a/board/bloog/battery.c
+++ b/board/bloog/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/bloog/board.c b/board/bloog/board.c
index 47802bf584..9250dfe299 100644
--- a/board/bloog/board.c
+++ b/board/bloog/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,13 +40,13 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -71,32 +71,32 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus C0 sensing (10x voltage divider). PPVAR_USB_C0_VBUS */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/* Vbus C1 sensing (10x voltage divider). PPVAR_USB_C1_VBUS */
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -106,23 +106,17 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t lid_a_cover_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_a_cover_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_b_cover_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_b_cover_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data kx022_data;
@@ -220,10 +214,10 @@ int board_is_convertible(void)
* Bipship: 53, 54, 55, 56
* Unprovisioned: 255
*/
- return sku_id == 33 || sku_id == 34 || sku_id == 35 || sku_id == 36
- || sku_id == 49 || sku_id == 50 || sku_id == 51 || sku_id == 52
- || sku_id == 53 || sku_id == 54 || sku_id == 55 || sku_id == 56
- || sku_id == 255;
+ return sku_id == 33 || sku_id == 34 || sku_id == 35 || sku_id == 36 ||
+ sku_id == 49 || sku_id == 50 || sku_id == 51 || sku_id == 52 ||
+ sku_id == 53 || sku_id == 54 || sku_id == 55 || sku_id == 56 ||
+ sku_id == 255;
}
static void board_update_sensor_config_from_sku(void)
@@ -234,8 +228,8 @@ static void board_update_sensor_config_from_sku(void)
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
/* Override sensor marix for Bipship. */
- if (sku_id == 53 || sku_id == 54 || sku_id == 55
- || sku_id == 56)
+ if (sku_id == 53 || sku_id == 54 || sku_id == 55 ||
+ sku_id == 56)
motion_sensors[LID_ACCEL].rot_standard_ref =
&lid_b_cover_ref;
} else {
@@ -265,10 +259,10 @@ void board_hibernate_late(void)
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_LED_WHITE_C0_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LED_AMBER_C0_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LED_WHITE_C1_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LED_AMBER_C1_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_LED_WHITE_C0_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LED_AMBER_C0_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LED_WHITE_C1_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LED_AMBER_C1_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
@@ -297,15 +291,15 @@ __override void lid_angle_peripheral_enable(int enable)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
void board_overcurrent_event(int port, int is_overcurrented)
@@ -323,9 +317,8 @@ __override uint32_t board_override_feature_flags0(uint32_t flags0)
/*
* Remove keyboard backlight feature for devices that don't support it.
*/
- if (sku_id == 33 || sku_id == 36 || sku_id == 51 ||
- sku_id == 52 || sku_id == 53 || sku_id == 55 ||
- sku_id == 66 || sku_id == 68)
+ if (sku_id == 33 || sku_id == 36 || sku_id == 51 || sku_id == 52 ||
+ sku_id == 53 || sku_id == 55 || sku_id == 66 || sku_id == 68)
return (flags0 & ~EC_FEATURE_MASK_0(EC_FEATURE_PWM_KEYB));
else
return flags0;
diff --git a/board/bloog/board.h b/board/bloog/board.h
index d32fb43578..38e8484df2 100644
--- a/board/bloog/board.h
+++ b/board/bloog/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,8 +27,8 @@
#define CONFIG_LED_COMMON
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
@@ -59,10 +59,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -73,18 +73,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum battery_type {
BATTERY_DYNAPACK_COS,
diff --git a/board/bloog/build.mk b/board/bloog/build.mk
index 137e208b53..fee77e38b5 100644
--- a/board/bloog/build.mk
+++ b/board/bloog/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/bloog/ec.tasklist b/board/bloog/ec.tasklist
index 6eac78a042..6c56976091 100644
--- a/board/bloog/ec.tasklist
+++ b/board/bloog/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bloog/gpio.inc b/board/bloog/gpio.inc
index 3ee2f88eb1..f07b380974 100644
--- a/board/bloog/gpio.inc
+++ b/board/bloog/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bloog/led.c b/board/bloog/led.c
index 609b330a56..22f5bc5523 100644
--- a/board/bloog/led.c
+++ b/board/bloog/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -24,11 +24,9 @@
#define LED_TICKS_PER_CYCLE 10
#define LED_ON_TICKS 5
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -36,15 +34,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(int port, enum led_color color)
{
gpio_set_level(port ? GPIO_LED_AMBER_C1_L : GPIO_LED_AMBER_C0_L,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(port ? GPIO_LED_WHITE_C1_L : GPIO_LED_WHITE_C0_L,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_set_color_power(enum led_color color)
@@ -130,7 +128,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -141,15 +138,14 @@ static void led_set_battery(void)
*/
if (!board_is_convertible()) {
if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ CHIPSET_STATE_STANDBY) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
- led_set_color_battery(0, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(1, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(0, power_ticks & 0x4 ? LED_WHITE :
+ LED_OFF);
+ led_set_color_battery(1, power_ticks & 0x4 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -164,9 +160,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(1, (battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ 1,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(1, LED_OFF);
}
@@ -175,19 +174,20 @@ static void led_set_battery(void)
led_set_color_battery(0, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -205,9 +205,10 @@ static void led_set_power(void)
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_SUSPEND |
CHIPSET_STATE_STANDBY))
- led_set_color_power((power_tick %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_power(
+ (power_tick % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/bobba/battery.c b/board/bobba/battery.c
index dbebf250d9..ab77c44062 100644
--- a/board/bobba/battery.c
+++ b/board/bobba/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 1ab1dad660..64e713a55e 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,11 +48,11 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -62,17 +62,16 @@ static uint8_t sku_id;
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* Check PPC ID Pin and Board ver to decide which one ppc is used. */
static bool support_syv_ppc(void)
@@ -115,31 +114,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -149,17 +148,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/*
* Sparky360 SKU ID 26 has AR Cam, and move base accel/gryo to AR Cam board.
@@ -174,9 +169,9 @@ const mat33_fp_t base_icm_ref = {
* |0 0.27564 0.96126|
*/
const mat33_fp_t base_ar_cam_ref = {
- { 0, FLOAT_TO_FP(-0.96126), FLOAT_TO_FP(0.27564)},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(0.27564), FLOAT_TO_FP(0.96126)}
+ { 0, FLOAT_TO_FP(-0.96126), FLOAT_TO_FP(0.27564) },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(0.27564), FLOAT_TO_FP(0.96126) }
};
/* sensor private data */
@@ -301,20 +296,20 @@ struct motion_sensor_t icm426xx_base_accel = {
};
struct motion_sensor_t icm426xx_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_icm_ref,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm426xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm426xx_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_icm_ref,
+ .min_frequency = ICM426XX_GYRO_MIN_FREQ,
+ .max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
static int board_is_convertible(void)
@@ -323,9 +318,8 @@ static int board_is_convertible(void)
* SKU ID of Bobba360, Sparky360, & unprovisioned: 9, 10, 11, 12,
* 25, 26, 27, 255
*/
- return sku_id == 9 || sku_id == 10 || sku_id == 11 || sku_id == 12
- || sku_id == 25 || sku_id == 26 || sku_id == 27
- || sku_id == 255;
+ return sku_id == 9 || sku_id == 10 || sku_id == 11 || sku_id == 12 ||
+ sku_id == 25 || sku_id == 26 || sku_id == 27 || sku_id == 255;
}
static int board_with_ar_cam(void)
@@ -407,8 +401,9 @@ static void board_usb_charge_mode_init(void)
int i;
/*
- * Only overriding the USB_DISALLOW_SUSPEND_CHARGE in RO is enough because
- * USB_SYSJUMP_TAG preserves the settings to RW. And we should honor to it.
+ * Only overriding the USB_DISALLOW_SUSPEND_CHARGE in RO is enough
+ * because USB_SYSJUMP_TAG preserves the settings to RW. And we should
+ * honor to it.
*/
if (system_jumped_late())
return;
@@ -425,7 +420,7 @@ static void board_usb_charge_mode_init(void)
*/
for (i = 0; i < CONFIG_USB_PORT_POWER_SMART_PORT_COUNT; i++)
usb_charge_set_mode(i, CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE,
- USB_DISALLOW_SUSPEND_CHARGE);
+ USB_DISALLOW_SUSPEND_CHARGE);
}
/*
* usb_charge_init() is hooked in HOOK_PRIO_DEFAULT and set inhibit_charge to
@@ -462,15 +457,15 @@ __override uint32_t board_override_feature_flags0(uint32_t flags0)
}
static const struct ppc_config_t ppc_syv682x_port0 = {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static const struct ppc_config_t ppc_syv682x_port1 = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static void board_setup_ppc(void)
@@ -478,11 +473,9 @@ static void board_setup_ppc(void)
if (!support_syv_ppc())
return;
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_0],
- &ppc_syv682x_port0,
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], &ppc_syv682x_port0,
sizeof(struct ppc_config_t));
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_1],
- &ppc_syv682x_port1,
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], &ppc_syv682x_port1,
sizeof(struct ppc_config_t));
gpio_set_flags(GPIO_USB_PD_C0_INT_ODL, GPIO_INT_BOTH);
@@ -490,14 +483,14 @@ static void board_setup_ppc(void)
}
DECLARE_HOOK(HOOK_INIT, board_setup_ppc, HOOK_PRIO_INIT_I2C + 2);
-void board_hibernate_late(void) {
-
+void board_hibernate_late(void)
+{
int i;
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
@@ -528,7 +521,6 @@ void board_overcurrent_event(int port, int is_overcurrented)
gpio_set_level(GPIO_USB_C_OC, !is_overcurrented);
}
-
int ppc_get_alert_status(int port)
{
if (port == 0)
diff --git a/board/bobba/board.h b/board/bobba/board.h
index a1fc900084..2a1be082e8 100644
--- a/board/bobba/board.h
+++ b/board/bobba/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* I2C bus configuraiton */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
/* EC console commands */
#define CONFIG_CMD_ACCEL_INFO
@@ -40,10 +40,10 @@
#define CONFIG_USB_PD_RESET_MIN_BATT_SOC 2
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel main source*/
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
-#define CONFIG_SYNC /* Camera VSYNC */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel main source*/
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_SYNC /* Camera VSYNC */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
@@ -55,9 +55,7 @@
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -88,6 +86,13 @@
/* SYV682 isn't connected to CC, so TCPC must provide VCONN */
#define CONFIG_USBC_PPC_SYV682X_NO_CC
+/*
+ * SMP battery sleep mode time is 5 second.
+ * Change max sleep time from once/min to once/4sec to prevent
+ * battery entering sleeping mode. See b/226259582.
+ */
+#define CHARGE_MAX_SLEEP_USEC (4 * SECOND)
+
#ifndef __ASSEMBLER__
/* support factory keyboard test */
@@ -97,10 +102,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -111,19 +116,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- VSYNC,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, VSYNC, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/bobba/build.mk b/board/bobba/build.mk
index 3d04b75731..998a65a3de 100644
--- a/board/bobba/build.mk
+++ b/board/bobba/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/bobba/ec.tasklist b/board/bobba/ec.tasklist
index d98db145e7..977b8b01be 100644
--- a/board/bobba/ec.tasklist
+++ b/board/bobba/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bobba/gpio.inc b/board/bobba/gpio.inc
index edb76d05f6..f57ea6bf12 100644
--- a/board/bobba/gpio.inc
+++ b/board/bobba/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bobba/led.c b/board/bobba/led.c
index d247ad0128..54227ed107 100644
--- a/board/bobba/led.c
+++ b/board/bobba/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -19,18 +19,24 @@ __override const int led_charge_lvl_2 = 100;
/* Bobba: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/boldar/battery.c b/board/boldar/battery.c
index 48f7fcda84..2b2a9f4842 100644
--- a/board/boldar/battery.c
+++ b/board/boldar/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/boldar/board.c b/board/boldar/board.c
index 69546a4ea2..19b8f44020 100644
--- a/board/boldar/board.c
+++ b/board/boldar/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -47,7 +47,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -86,7 +86,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -111,8 +111,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -133,8 +133,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -281,24 +281,33 @@ static const struct tcpc_config_t tcpc_config_p1_usb3 = {
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-static const struct usb_mux mux_config_p1_usb3_active = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+static const struct usb_mux_chain mux_config_p1_usb3_active = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
};
-static const struct usb_mux mux_config_p1_usb3_passive = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain mux_config_p1_usb3_passive = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
/******************************************************************************/
@@ -313,8 +322,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -325,16 +333,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -346,8 +354,9 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
if (usb_db == DB_USB3_ACTIVE) {
ps8815_reset();
- usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(USBC_PORT_C1,
+ USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
}
@@ -509,33 +518,43 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .next_mux = &usbc0_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .next_mux = &usbc1_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/boldar/board.h b/board/boldar/board.h
index 12409a5435..f2a76dab82 100644
--- a/board/boldar/board.h
+++ b/board/boldar/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@
#define CONFIG_POWER_BUTTON
-#define CONFIG_HOSTCMD_ESPI_RESET_SLP_SX_VW_ON_ESPI_RST
+#define CONFIG_HOST_INTERFACE_ESPI_RESET_SLP_SX_VW_ON_ESPI_RST
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -51,19 +51,18 @@
/* TCS3400 ALS/RGB */
#define CONFIG_ALS
-#define ALS_COUNT 1
+#define ALS_COUNT 1
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
/*
@@ -73,36 +72,36 @@
*/
#define CONFIG_USB_PID 0x503E
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x37
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x37
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
+#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
/* BC 1.2 */
@@ -111,8 +110,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -120,45 +119,44 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -189,11 +187,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/boldar/build.mk b/board/boldar/build.mk
index 838d6a16ce..c994631759 100644
--- a/board/boldar/build.mk
+++ b/board/boldar/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/boldar/ec.tasklist b/board/boldar/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/boldar/ec.tasklist
+++ b/board/boldar/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/boldar/gpio.inc b/board/boldar/gpio.inc
index 4f55b5c503..f06541ebbb 100644
--- a/board/boldar/gpio.inc
+++ b/board/boldar/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/boldar/led.c b/board/boldar/led.c
index 6ee71bbe19..d2425d13b6 100644
--- a/board/boldar/led.c
+++ b/board/boldar/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@ const enum ec_led_id supported_led_ids[] = {
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map[] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 100, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 100, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
/* The green LED seems to be brighter than the others, so turn down
* green from its natural level for these secondary colors.
*/
- [EC_LED_COLOR_YELLOW] = { 100, 70, 0 },
- [EC_LED_COLOR_WHITE] = { 100, 70, 100 },
- [EC_LED_COLOR_AMBER] = { 100, 20, 0 },
+ [EC_LED_COLOR_YELLOW] = { 100, 70, 0 },
+ [EC_LED_COLOR_WHITE] = { 100, 70, 100 },
+ [EC_LED_COLOR_AMBER] = { 100, 20, 0 },
};
struct pwm_led pwm_leds[] = {
diff --git a/board/boldar/sensors.c b/board/boldar/sensors.c
index 534065cde3..0670223f13 100644
--- a/board/boldar/sensors.c
+++ b/board/boldar/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -85,17 +85,13 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/boten/battery.c b/board/boten/battery.c
index 0f4c8ffeb9..c4b4f9261d 100644
--- a/board/boten/battery.c
+++ b/board/boten/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/boten/board.c b/board/boten/board.c
index 76ee055fe4..c47b9e46f0 100644
--- a/board/boten/board.c
+++ b/board/boten/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,7 +40,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
/* C0 interrupt line shared by BC 1.2 and charger */
@@ -84,7 +84,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -114,8 +113,7 @@ DECLARE_DEFERRED(pendetect_deferred);
void pen_detect_interrupt(enum gpio_signal s)
{
/* Trigger deferred notification of pen detect change */
- hook_call_deferred(&pendetect_deferred_data,
- 500 * MSEC);
+ hook_call_deferred(&pendetect_deferred_data, 500 * MSEC);
}
void board_hibernate(void)
@@ -147,27 +145,21 @@ __override void board_pulse_entering_rw(void)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -203,12 +195,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
};
@@ -276,7 +271,6 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
@@ -288,8 +282,7 @@ int board_set_active_charge_port(int port)
/* Disable all ports. */
if (port == CHARGE_PORT_NONE) {
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
raa489000_enable_asgate(0, false);
return EC_SUCCESS;
}
@@ -302,8 +295,7 @@ int board_set_active_charge_port(int port)
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
CPRINTUSB("p%d: sink path enable failed.", port);
return EC_ERROR_UNKNOWN;
}
@@ -345,17 +337,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* Sensor Data */
static struct stprivate_data g_lis2dwl_data;
@@ -459,7 +447,7 @@ void board_init(void)
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
/* only clamshell sku todo */
gpio_set_flags(GPIO_PEN_DET_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
@@ -488,14 +476,14 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/boten/board.h b/board/boten/board.h
index a78296e997..ec5d25ff9f 100644
--- a/board/boten/board.h
+++ b/board/boten/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,9 +24,12 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -40,8 +43,8 @@
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
@@ -109,26 +112,17 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/boten/build.mk b/board/boten/build.mk
index 806168ea0d..9b862c7624 100644
--- a/board/boten/build.mk
+++ b/board/boten/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/boten/cbi_ssfc.c b/board/boten/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/boten/cbi_ssfc.c
+++ b/board/boten/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/boten/cbi_ssfc.h b/board/boten/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/boten/cbi_ssfc.h
+++ b/board/boten/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/boten/ec.tasklist b/board/boten/ec.tasklist
index be1f92aff2..e610e8ad33 100644
--- a/board/boten/ec.tasklist
+++ b/board/boten/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/boten/gpio.inc b/board/boten/gpio.inc
index 4e8290c277..4c9890441d 100644
--- a/board/boten/gpio.inc
+++ b/board/boten/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/boten/led.c b/board/boten/led.c
index 93675966b3..ca2f7c9399 100644
--- a/board/boten/led.c
+++ b/board/boten/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,41 +11,46 @@
#include "gpio.h"
#include "pwm.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF,
+ 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/boten/usb_pd_policy.c b/board/boten/usb_pd_policy.c
index 65ee678263..74167850ee 100644
--- a/board/boten/usb_pd_policy.c
+++ b/board/boten/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/brask/board.c b/board/brask/board.c
index 7b22e37e29..bd9d1d7998 100644
--- a/board/brask/board.c
+++ b/board/brask/board.c
@@ -1,11 +1,11 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdbool.h>
#include "adc.h"
-#include "assert.h"
+#include "builtin/assert.h"
#include "button.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
@@ -27,8 +27,8 @@
#include "fw_config.h"
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -140,21 +140,21 @@ static int32_t base_5v_power_z1;
*/
/* PP5000_S5 loads */
-#define PWR_S5_BASE_LOAD (5*1431)
-#define PWR_S5_FRONT_HIGH (5*1737)
-#define PWR_S5_FRONT_LOW (5*1055)
-#define PWR_S5_REAR_HIGH (5*1737)
-#define PWR_S5_REAR_LOW (5*1055)
-#define PWR_S5_HDMI (5*580)
-#define PWR_S5_MAX (5*10000)
-#define FRONT_DELTA (PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW)
-#define REAR_DELTA (PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW)
+#define PWR_S5_BASE_LOAD (5 * 1431)
+#define PWR_S5_FRONT_HIGH (5 * 1737)
+#define PWR_S5_FRONT_LOW (5 * 1055)
+#define PWR_S5_REAR_HIGH (5 * 1737)
+#define PWR_S5_REAR_LOW (5 * 1055)
+#define PWR_S5_HDMI (5 * 580)
+#define PWR_S5_MAX (5 * 10000)
+#define FRONT_DELTA (PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW)
+#define REAR_DELTA (PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW)
/* PP5000_Z1 loads */
-#define PWR_Z1_BASE_LOAD (5*5)
-#define PWR_Z1_C_HIGH (5*3600)
-#define PWR_Z1_C_LOW (5*2000)
-#define PWR_Z1_MAX (5*9000)
+#define PWR_Z1_BASE_LOAD (5 * 5)
+#define PWR_Z1_C_HIGH (5 * 3600)
+#define PWR_Z1_C_LOW (5 * 2000)
+#define PWR_Z1_MAX (5 * 9000)
/*
* Update the 5V power usage, assuming no throttling,
* and invoke the power monitoring.
@@ -228,7 +228,7 @@ static void port_ocp_interrupt(enum gpio_signal signal)
* only do that if the system is off since it might still brown out.
*/
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/* Debounced connection state of the barrel jack */
static int8_t adp_connected = -1;
static void adp_connect_deferred(void)
@@ -328,26 +328,26 @@ void board_overcurrent_event(int port, int is_overcurrented)
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A_FRONT BIT(0)
-#define THROT_TYPE_A_REAR BIT(1)
-#define THROT_TYPE_C0 BIT(2)
-#define THROT_TYPE_C1 BIT(3)
-#define THROT_TYPE_C2 BIT(4)
-#define THROT_PROCHOT BIT(5)
+#define THROT_TYPE_A_FRONT BIT(0)
+#define THROT_TYPE_A_REAR BIT(1)
+#define THROT_TYPE_C0 BIT(2)
+#define THROT_TYPE_C1 BIT(3)
+#define THROT_TYPE_C2 BIT(4)
+#define THROT_PROCHOT BIT(5)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -363,8 +363,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
@@ -392,7 +391,7 @@ static void power_monitor(void)
*/
power = (adc_read_channel(ADC_VBUS) *
adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
+ 1000;
/* Init power table */
if (history[0] == 0) {
for (i = 0; i < POWER_READINGS; i++)
@@ -419,8 +418,7 @@ static void power_monitor(void)
* For barrel-jack supplies, the rating can be
* exceeded briefly, so use the average.
*/
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
power = max;
else
power = total / POWER_READINGS;
@@ -551,24 +549,27 @@ static void power_monitor(void)
gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
}
if (diff & THROT_TYPE_C0) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
pd_update_contract(0);
}
if (diff & THROT_TYPE_C1) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(1, rp);
tcpm_select_rp_value(1, rp);
pd_update_contract(1);
}
if (diff & THROT_TYPE_C2) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(2, rp);
tcpm_select_rp_value(2, rp);
diff --git a/board/brask/board.h b/board/brask/board.h
index 1599749a07..dde8b85412 100644
--- a/board/brask/board.h
+++ b/board/brask/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,11 +21,11 @@
/* HDMI CEC */
#define CONFIG_CEC
#define CEC_GPIO_OUT GPIO_HDMI_CEC_OUT
-#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
+#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
#define CEC_GPIO_PULL_UP GPIO_HDMI_CEC_PULL_UP
/* USB Type A Features */
-#define USB_PORT_COUNT 4
+#define USB_PORT_COUNT 4
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -33,7 +33,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_PPC
#define CONFIG_USB_PD_TCPM_RT1715
@@ -46,18 +46,18 @@
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* The design should support up to 100W. */
/* TODO(b/197702356): Set the max PD to 60W now and change it
* to 100W after we verify it.
*/
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -65,64 +65,65 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
-#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
+#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
/* I2C Bus Configuration */
-#define I2C_PORT_DP_REDRIVER NPCX_I2C_PORT0_0
+#define I2C_PORT_DP_REDRIVER NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_QI NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_QI NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
/* Retimer */
#define CONFIG_USBC_RETIMER_FW_UPDATE
@@ -140,7 +141,7 @@
* TODO(b/197478860): Enable the fan control. We need
* to check the sensor value and adjust the fan speed.
*/
- #define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
@@ -153,7 +154,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -171,7 +172,7 @@ enum adc_channel {
ADC_TEMP_SENSOR_3_WIFI,
ADC_TEMP_SENSOR_4_DIMM,
ADC_VBUS,
- ADC_PPVAR_IMON, /* ADC3 */
+ ADC_PPVAR_IMON, /* ADC3 */
ADC_CH_COUNT
};
@@ -183,28 +184,18 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C2_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C2_NCT38XX, IOEX_PORT_COUNT };
enum pwm_channel {
- PWM_CH_LED_GREEN, /* PWM0 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED_RED, /* PWM2 */
+ PWM_CH_LED_GREEN, /* PWM0 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED_RED, /* PWM2 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
extern void adp_connect_interrupt(enum gpio_signal signal);
diff --git a/board/brask/build.mk b/board/brask/build.mk
index f92c283725..f180fcb8ef 100644
--- a/board/brask/build.mk
+++ b/board/brask/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/brask/ec.tasklist b/board/brask/ec.tasklist
index a366e05682..3572543743 100644
--- a/board/brask/ec.tasklist
+++ b/board/brask/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/brask/fans.c b/board/brask/fans.c
index f2a70636d0..6828438a10 100644
--- a/board/brask/fans.c
+++ b/board/brask/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/brask/fw_config.c b/board/brask/fw_config.c
index a5857ef48f..3ee71e6a0f 100644
--- a/board/brask/fw_config.c
+++ b/board/brask/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union brask_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/brask/fw_config.h b/board/brask/fw_config.h
index 5ddb3b02a1..95d81f1e05 100644
--- a/board/brask/fw_config.h
+++ b/board/brask/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,15 +13,9 @@
*
* Source of truth is the project/brask/brask/config.star configuration file.
*/
-enum ec_cfg_audio_type {
- DB_AUDIO_UNKNOWN = 0,
- DB_NAU88L25B_I2S = 1
-};
+enum ec_cfg_audio_type { DB_AUDIO_UNKNOWN = 0, DB_NAU88L25B_I2S = 1 };
-enum ec_cfg_bj_power {
- BJ_135W = 0,
- BJ_230W = 1
-};
+enum ec_cfg_bj_power { BJ_135W = 0, BJ_230W = 1 };
union brask_cbi_fw_config {
struct {
diff --git a/board/brask/gpio.inc b/board/brask/gpio.inc
index 5bd13beaee..5fa07523f6 100644
--- a/board/brask/gpio.inc
+++ b/board/brask/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/brask/i2c.c b/board/brask/i2c.c
index 190f4f019e..3af3e43d75 100644
--- a/board/brask/i2c.c
+++ b/board/brask/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/brask/led.c b/board/brask/led.c
index 68dffb67a7..0a57994ca0 100644
--- a/board/brask/led.c
+++ b/board/brask/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -84,9 +84,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/*
* When pulsing is enabled, brightness is incremented by <duty_inc> every
@@ -206,7 +206,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -231,8 +231,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|green|off|alert|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|green|off|alert|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -250,10 +249,10 @@ int led_set_brightness(enum ec_led_id id, const uint8_t *brightness)
else
return set_color(id, LED_OFF, 0);
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- /* Blink alert if insufficient power per system_can_boot_ap(). */
+ /* Blink alert if insufficient power per system_can_boot_ap(). */
int insufficient_power =
(charge_ma * charge_mv) <
(CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000);
diff --git a/board/brask/pwm.c b/board/brask/pwm.c
index 5ad905f861..1804cb5586 100644
--- a/board/brask/pwm.c
+++ b/board/brask/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,21 +11,16 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_GREEN] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
- .freq = 1000
- },
- [PWM_CH_LED_RED] = {
- .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
+ [PWM_CH_LED_GREEN] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
+ .freq = 1000 },
+ [PWM_CH_LED_RED] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/brask/sensors.c b/board/brask/sensors.c
index 2803dd1025..b5caaaf717 100644
--- a/board/brask/sensors.c
+++ b/board/brask/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -58,30 +58,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_CPU
- },
- [TEMP_SENSOR_2_CPU_VR] = {
- .name = "CPU VR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_CPU_VR
- },
- [TEMP_SENSOR_3_WIFI] = {
- .name = "WIFI",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_WIFI
- },
- [TEMP_SENSOR_4_DIMM] = {
- .name = "DIMM",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_DIMM
- },
+ [TEMP_SENSOR_1_CPU] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_CPU },
+ [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_CPU_VR },
+ [TEMP_SENSOR_3_WIFI] = { .name = "WIFI",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_WIFI },
+ [TEMP_SENSOR_4_DIMM] = { .name = "DIMM",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_DIMM },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -95,8 +87,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
diff --git a/board/brask/usbc_config.c b/board/brask/usbc_config.c
index caae5437a9..5cec791afc 100644
--- a/board/brask/usbc_config.c
+++ b/board/brask/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,8 +32,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -91,20 +91,29 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc2_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
struct kb800x_control_t kb800x_control[] = {
@@ -124,29 +133,35 @@ struct kb800x_control_t kb800x_control[] = {
};
BUILD_ASSERT(ARRAY_SIZE(kb800x_control) == USBC_PORT_COUNT);
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &kb800x_usb_mux_driver,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = KB800X_I2C_ADDR0_FLAGS,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &kb800x_usb_mux_driver,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = KB800X_I2C_ADDR0_FLAGS,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc2_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/brask/usbc_config.h b/board/brask/usbc_config.h
index 7319bcb5e2..0d4f62651a 100644
--- a/board/brask/usbc_config.h
+++ b/board/brask/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 3
+#define CONFIG_USB_PD_PORT_MAX_COUNT 3
enum usbc_port {
USBC_PORT_C0 = 0,
diff --git a/board/brya/battery.c b/board/brya/battery.c
index 91faab57a3..71b46082d8 100644
--- a/board/brya/battery.c
+++ b/board/brya/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -102,10 +102,7 @@ enum battery_present battery_hw_present(void)
{
enum gpio_signal batt_pres;
- if (get_board_id() == 1)
- batt_pres = GPIO_ID_1_EC_BATT_PRES_ODL;
- else
- batt_pres = GPIO_EC_BATT_PRES_ODL;
+ batt_pres = GPIO_EC_BATT_PRES_ODL;
/* The GPIO is low when the battery is physically present */
return gpio_get_level(batt_pres) ? BP_NO : BP_YES;
diff --git a/board/brya/board.c b/board/brya/board.c
index c9246c197b..50b13e8743 100644
--- a/board/brya/board.c
+++ b/board/brya/board.c
@@ -1,22 +1,20 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "battery.h"
#include "button.h"
+#include "cbi.h"
#include "charge_ramp.h"
#include "charger.h"
#include "common.h"
-#include "compile_time_macros.h"
#include "console.h"
-#include "gpio.h"
-#include "gpio_signal.h"
-#include "hooks.h"
-#include "driver/accel_lis2dw12.h"
#include "driver/accelgyro_lsm6dso.h"
+#include "driver/accel_lis2dw12.h"
#include "driver/als_tcs3400.h"
#include "fw_config.h"
+#include "gpio.h"
+#include "gpio_signal.h"
#include "hooks.h"
#include "lid_switch.h"
#include "power_button.h"
@@ -30,8 +28,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
__override void board_cbi_init(void)
{
@@ -43,9 +41,7 @@ static void board_chipset_resume(void)
{
/* Allow keyboard backlight to be enabled */
- if (get_board_id() == 1)
- gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 1);
- else
+ if (IS_ENABLED(CONFIG_PWM_KBLIGHT))
gpio_set_level(GPIO_EC_KB_BL_EN_L, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
@@ -55,54 +51,7 @@ static void board_chipset_suspend(void)
{
/* Turn off the keyboard backlight if it's on. */
- if (get_board_id() == 1)
- gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 0);
- else
+ if (IS_ENABLED(CONFIG_PWM_KBLIGHT))
gpio_set_level(GPIO_EC_KB_BL_EN_L, 1);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-
-/*
- * Explicitly apply the board ID 1 *gpio.inc settings to pins that
- * were reassigned on current boards.
- */
-
-static void set_board_id_1_gpios(void)
-{
- if (get_board_id() != 1)
- return;
-
- gpio_set_flags(GPIO_ID_1_EC_KB_BL_EN, GPIO_OUT_LOW);
-}
-DECLARE_HOOK(HOOK_INIT, set_board_id_1_gpios, HOOK_PRIO_FIRST);
-
-/*
- * Reclaim GPIO pins on board ID 1 that are used as ADC inputs on
- * current boards. ALT function group MODULE_ADC pins are set in
- * HOOK_PRIO_INIT_ADC and can be reclaimed right after the hook runs.
- */
-
-static void board_id_1_reclaim_adc(void)
-{
- if (get_board_id() != 1)
- return;
-
- /*
- * GPIO_ID_1_USB_C0_C2_TCPC_RST_ODL is on GPIO34
- *
- * The TCPC has already been reset by board_tcpc_init() executed
- * from HOOK_PRIO_INIT_CHIPSET. Later, the pin gets set to ADC6
- * in HOOK_PRIO_INIT_ADC, so we simply need to set the pin back
- * to GPIO34.
- */
- gpio_set_flags(GPIO_ID_1_USB_C0_C2_TCPC_RST_ODL, GPIO_ODR_HIGH);
- gpio_set_alternate_function(GPIO_PORT_3, BIT(4), GPIO_ALT_FUNC_NONE);
-
- /*
- * The pin gets set to ADC7 in HOOK_PRIO_INIT_ADC, so we simply
- * need to set it back to GPIOE1.
- */
- gpio_set_flags(GPIO_ID_1_EC_BATT_PRES_ODL, GPIO_INPUT);
- gpio_set_alternate_function(GPIO_PORT_E, BIT(1), GPIO_ALT_FUNC_NONE);
-}
-DECLARE_HOOK(HOOK_INIT, board_id_1_reclaim_adc, HOOK_PRIO_INIT_ADC + 1);
diff --git a/board/brya/board.h b/board/brya/board.h
index 8188ee68d9..8b0aceb93b 100644
--- a/board/brya/board.h
+++ b/board/brya/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,7 +39,7 @@
#define CONFIG_LED_PWM_LOW_BATT_COLOR EC_LED_COLOR_AMBER
/* Sensors */
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -63,19 +63,18 @@
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_LIS2DWL
#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-
/* Sensor console commands */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -83,7 +82,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 4
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_FRS_PPC
@@ -101,17 +100,17 @@
#define CONFIG_USBC_PPC_NX20P3483
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -119,75 +118,74 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-
-#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/*
* see b/174768555#comment22
*/
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x57
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x57
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
/* Retimer */
#define CONFIG_USBC_RETIMER_FW_UPDATE
@@ -198,15 +196,15 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
/*
@@ -217,7 +215,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -246,39 +244,23 @@ enum sensor_id {
SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C2_NCT38XX,
- IOEX_ID_1_C0_NCT38XX,
- IOEX_ID_1_C2_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C2_NCT38XX, IOEX_PORT_COUNT };
-enum battery_type {
- BATTERY_POWER_TECH,
- BATTERY_LGC011,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_POWER_TECH, BATTERY_LGC011, BATTERY_TYPE_COUNT };
enum pwm_channel {
- PWM_CH_LED2 = 0, /* PWM0 (white charger) */
- PWM_CH_LED3, /* PWM1 (orange on DB) */
- PWM_CH_LED1, /* PWM2 (orange charger) */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED4, /* PWM7 (white on DB) */
+ PWM_CH_LED2 = 0, /* PWM0 (white charger) */
+ PWM_CH_LED3, /* PWM1 (orange on DB) */
+ PWM_CH_LED1, /* PWM2 (orange charger) */
+ PWM_CH_KBLIGHT, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED4, /* PWM7 (white on DB) */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
#endif /* !__ASSEMBLER__ */
diff --git a/board/brya/build.mk b/board/brya/build.mk
index 674c17c1df..bc3e3cd31e 100644
--- a/board/brya/build.mk
+++ b/board/brya/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -22,5 +22,4 @@ board-y+=keyboard.o
board-y+=led.o
board-y+=pwm.o
board-y+=sensors.o
-board-y+=tune_mp2964.o
board-y+=usbc_config.o
diff --git a/board/brya/charger.c b/board/brya/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/brya/charger.c
+++ b/board/brya/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/brya/ec.tasklist b/board/brya/ec.tasklist
index 260f6561d9..3b94575196 100644
--- a/board/brya/ec.tasklist
+++ b/board/brya/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/brya/fans.c b/board/brya/fans.c
index 021f0de8e2..eb9bb8a809 100644
--- a/board/brya/fans.c
+++ b/board/brya/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/brya/fw_config.c b/board/brya/fw_config.c
index 414908a1f1..3a4c91acf1 100644
--- a/board/brya/fw_config.c
+++ b/board/brya/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union brya_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
@@ -33,21 +33,6 @@ void board_init_fw_config(void)
CPRINTS("CBI: Read FW_CONFIG failed, using board defaults");
fw_config = fw_config_defaults;
}
-
- if (get_board_id() == 0) {
- /*
- * Early boards have a zero'd out FW_CONFIG, so replace
- * it with a sensible default value. If DB_USB_ABSENT2
- * was used as an alternate encoding of DB_USB_ABSENT to
- * avoid the zero check, then fix it.
- */
- if (fw_config.raw_value == 0) {
- CPRINTS("CBI: FW_CONFIG is zero, using board defaults");
- fw_config = fw_config_defaults;
- } else if (fw_config.usb_db == DB_USB_ABSENT2) {
- fw_config.usb_db = DB_USB_ABSENT;
- }
- }
}
union brya_cbi_fw_config get_fw_config(void)
diff --git a/board/brya/fw_config.h b/board/brya/fw_config.h
index 6e4eb3ef58..fea6c9a8da 100644
--- a/board/brya/fw_config.h
+++ b/board/brya/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,12 +27,12 @@ enum ec_cfg_keyboard_backlight_type {
union brya_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
- uint32_t sd_db : 2;
- uint32_t lte_db : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ enum ec_cfg_usb_db_type usb_db : 4;
+ uint32_t sd_db : 2;
+ uint32_t lte_db : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 21;
};
uint32_t raw_value;
};
diff --git a/board/brya/gpio.inc b/board/brya/gpio.inc
index e88d72eba8..d68dfc4dd0 100644
--- a/board/brya/gpio.inc
+++ b/board/brya/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,38 +28,7 @@
*/
GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW)
-/*
- * GPIOE1 is an ALT function ADC INPUT on board ID 2 and a GPIO INPUT on
- * board ID 1. This declaration gives us a signal name to use on board
- * ID 1.
- */
-GPIO(ID_1_EC_BATT_PRES_ODL, PIN(E, 1), GPIO_INPUT)
-
-/*
- * GPIO34 is an INPUT on board ID 2 and ODR_LOW on board ID 1.
- *
- * Since this pin is pulled up to 3.3V through a 30.9K ohm resistor on
- * board ID 2, we will leak about 0.3mW until the pin is put in ALT mode
- * when MODULE_ADC configuration runs. Initializing the pin to ODR_LOW
- * gives us full control on both boards.
- */
-GPIO(ID_1_USB_C0_C2_TCPC_RST_ODL, PIN(3, 4), GPIO_ODR_LOW)
-
-/* Board ID 1 IO expander configuration */
-
-IOEX(ID_1_USB_C0_RT_RST_ODL, EXPIN(IOEX_ID_1_C0_NCT38XX, 0, 2), GPIO_ODR_LOW)
-/* GPIO03_P1 to PU */
-IOEX(ID_1_USB_C0_FRS_EN, EXPIN(IOEX_ID_1_C0_NCT38XX, 0, 4), GPIO_LOW)
-IOEX(ID_1_USB_C0_OC_ODL, EXPIN(IOEX_ID_1_C0_NCT38XX, 0, 6), GPIO_ODR_HIGH)
-/* GPIO07_P1 to PU */
-
-IOEX(ID_1_USB_C2_RT_RST_ODL, EXPIN(IOEX_ID_1_C2_NCT38XX, 0, 2), GPIO_ODR_LOW)
-/* GPIO03_P2 to PU */
-IOEX(ID_1_USB_C2_FRS_EN, EXPIN(IOEX_ID_1_C2_NCT38XX, 0, 4), GPIO_LOW)
-IOEX(ID_1_USB_C1_OC_ODL, EXPIN(IOEX_ID_1_C2_NCT38XX, 0, 6), GPIO_ODR_HIGH)
-IOEX(ID_1_USB_C2_OC_ODL, EXPIN(IOEX_ID_1_C2_NCT38XX, 0, 7), GPIO_ODR_HIGH)
-
-/* Board ID 2 IO expander configuration */
+/* IO expander configuration */
/* GPIO02_P2 to PU */
/* GPIO03_P2 to PU */
diff --git a/board/brya/i2c.c b/board/brya/i2c.c
index 1e405f4216..feed4023d7 100644
--- a/board/brya/i2c.c
+++ b/board/brya/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,8 +9,6 @@
#include "hooks.h"
#include "i2c.h"
-#define BOARD_ID_FAST_PLUS_CAPABLE 2
-
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
{
@@ -81,19 +79,3 @@ const struct i2c_port_t i2c_ports[] = {
},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/*
- * I2C controllers are initialized in main.c. This sets the speed much
- * later, but before I2C peripherals are initialized.
- */
-static void set_board_legacy_i2c_speeds(void)
-{
- if (get_board_id() >= BOARD_ID_FAST_PLUS_CAPABLE)
- return;
-
- ccprints("setting USB DB I2C buses to 400 kHz\n");
-
- i2c_set_freq(I2C_PORT_USB_C1_TCPC, I2C_FREQ_400KHZ);
- i2c_set_freq(I2C_PORT_USB_C1_PPC, I2C_FREQ_400KHZ);
-}
-DECLARE_HOOK(HOOK_INIT, set_board_legacy_i2c_speeds, HOOK_PRIO_INIT_I2C - 1);
diff --git a/board/brya/keyboard.c b/board/brya/keyboard.c
index a9f033130d..0ebe25dc90 100644
--- a/board/brya/keyboard.c
+++ b/board/brya/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/brya/led.c b/board/brya/led.c
index 78c10e65b8..fec5a13311 100644
--- a/board/brya/led.c
+++ b/board/brya/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,13 +30,10 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* both LEDs being off. Cap at 50% to save power.
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Amber, White */
- [EC_LED_COLOR_RED] = { 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 0, 50 },
- [EC_LED_COLOR_AMBER] = { 50, 0 },
+ /* Amber, White */
+ [EC_LED_COLOR_RED] = { 0, 0 }, [EC_LED_COLOR_GREEN] = { 0, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0 }, [EC_LED_COLOR_YELLOW] = { 0, 0 },
+ [EC_LED_COLOR_WHITE] = { 0, 50 }, [EC_LED_COLOR_AMBER] = { 50, 0 },
};
/* Two logical LEDs with amber and white channels. */
diff --git a/board/brya/pwm.c b/board/brya/pwm.c
index cb452c13ed..bb578968b7 100644
--- a/board/brya/pwm.c
+++ b/board/brya/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,8 +39,8 @@ const struct pwm_t pwm_channels[] = {
},
[PWM_CH_FAN] = {
.channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
- .freq = 1000
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000,
},
[PWM_CH_LED4] = {
.channel = 7,
diff --git a/board/brya/sensors.c b/board/brya/sensors.c
index 51841b8599..8ab5b58d7e 100644
--- a/board/brya/sensors.c
+++ b/board/brya/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -55,18 +55,14 @@ static struct stprivate_data g_lis2dw12_data;
static struct lsm6dso_data lsm6dso_data;
/* TODO(b/184779333): calibrate the orientation matrix on later board stage */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* TODO(b/184779743): verify orientation matrix */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* TCS3400 private data */
static struct als_drv_data_t g_tcs3400_data = {
@@ -292,8 +288,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -322,8 +318,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_AMBIENT \
- { \
+#define THERMAL_AMBIENT \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -351,8 +347,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(105), \
[EC_TEMP_THRESH_HALT] = C_TO_K(120), \
@@ -372,8 +368,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_WWAN \
- { \
+#define THERMAL_WWAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(130), \
[EC_TEMP_THRESH_HALT] = C_TO_K(130), \
@@ -394,20 +390,3 @@ struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_4_WWAN] = THERMAL_WWAN,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
-static void board_thermals_init(void)
-{
- if (get_board_id() == 1) {
- /*
- * Board ID 1 only has 3 sensors and the AMBIENT sensor
- * ADC pins have been reassigned, so we're down to 2
- * sensors that can easily be configured. So, alias the
- * AMBIENT sensor ADC channel to the unimplemented ADC
- * slots.
- */
- adc_channels[ADC_TEMP_SENSOR_3_CHARGER].input_ch = NPCX_ADC_CH1;
- adc_channels[ADC_TEMP_SENSOR_4_WWAN].input_ch = NPCX_ADC_CH1;
- }
-}
-
-DECLARE_HOOK(HOOK_INIT, board_thermals_init, HOOK_PRIO_INIT_CHIPSET);
diff --git a/board/brya/tune_mp2964.c b/board/brya/tune_mp2964.c
deleted file mode 100644
index 198f06d8eb..0000000000
--- a/board/brya/tune_mp2964.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Tune the MP2964 IMVP9.1 parameters for brya */
-
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "hooks.h"
-#include "mp2964.h"
-
-const static struct mp2964_reg_val rail_a[] = {
- { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */
-};
-const static struct mp2964_reg_val rail_b[] = {
- { MP2964_MFR_ALT_SET, 0xe081 }, /* ALERT_DELAY = 200ns */
-};
-
-static void mp2964_on_startup(void)
-{
- static int chip_updated;
- int status;
-
- if (get_board_id() != 1)
- return;
-
- if (chip_updated)
- return;
-
- chip_updated = 1;
-
- ccprintf("%s: attempting to tune PMIC\n", __func__);
-
- status = mp2964_tune(rail_a, ARRAY_SIZE(rail_a),
- rail_b, ARRAY_SIZE(rail_b));
- if (status != EC_SUCCESS)
- ccprintf("%s: could not update all settings\n", __func__);
-}
-
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, mp2964_on_startup,
- HOOK_PRIO_FIRST);
diff --git a/board/brya/usbc_config.c b/board/brya/usbc_config.c
index eb72412423..0c9afc6943 100644
--- a/board/brya/usbc_config.c
+++ b/board/brya/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,17 +36,11 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#ifdef CONFIG_ZEPHYR
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C2_NCT38XX,
- IOEX_ID_1_C0_NCT38XX,
- IOEX_ID_1_C2_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C2_NCT38XX, IOEX_PORT_COUNT };
#endif /* CONFIG_ZEPHYR */
#ifndef CONFIG_ZEPHYR
@@ -86,7 +80,7 @@ const struct tcpc_config_t tcpc_config[] = {
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
-#endif /* !CONFIG_ZEPHYR */
+#endif /* !CONFIG_ZEPHYR */
/******************************************************************************/
/* USB-A charging control */
@@ -100,6 +94,7 @@ BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
/******************************************************************************/
+#ifndef CONFIG_ZEPHYR
/* USBC PPC configuration */
struct ppc_config_t ppc_chips[] = {
[USBC_PORT_C0] = {
@@ -125,17 +120,22 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-#ifndef CONFIG_ZEPHYR
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc2_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
/*
@@ -143,35 +143,44 @@ static const struct usb_mux usbc2_tcss_usb_mux = {
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc2_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -215,18 +224,6 @@ struct ioexpander_config_t ioex_config[] = {
.drv = &nct38xx_ioexpander_drv,
.flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
},
- [IOEX_ID_1_C0_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
- },
- [IOEX_ID_1_C2_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
- },
};
BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
#endif /* !CONFIG_ZEPHYR */
@@ -255,8 +252,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -283,10 +280,7 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
if (me->usb_port == USBC_PORT_C0) {
/* TODO: explore how to handle board id in zephyr*/
#ifndef CONFIG_ZEPHYR
- if (get_board_id() == 1)
- rst_signal = IOEX_ID_1_USB_C0_RT_RST_ODL;
- else
- rst_signal = IOEX_USB_C0_RT_RST_ODL;
+ rst_signal = IOEX_USB_C0_RT_RST_ODL;
#else
/* On Zephyr use bb_controls generated from DTS */
rst_signal = bb_controls[me->usb_port].retimer_rst_gpio;
@@ -294,10 +288,7 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
} else if (me->usb_port == USBC_PORT_C2) {
/* TODO: explore how to handle board id in zephyr*/
#ifndef CONFIG_ZEPHYR
- if (get_board_id() == 1)
- rst_signal = IOEX_ID_1_USB_C2_RT_RST_ODL;
- else
- rst_signal = IOEX_USB_C2_RT_RST_ODL;
+ rst_signal = IOEX_USB_C2_RT_RST_ODL;
#else
/* On Zephyr use bb_controls generated from DTS */
rst_signal = bb_controls[me->usb_port].retimer_rst_gpio;
@@ -324,20 +315,6 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
* which powers I2C controller within retimer
*/
msleep(1);
- if (get_board_id() == 1) {
- int val;
-
- /*
- * Check if we were able to deassert
- * reset. Board ID 1 uses a GPIO that is
- * uncontrollable when a debug accessory is
- * connected.
- */
- if (ioex_get_level(rst_signal, &val) != EC_SUCCESS)
- return EC_ERROR_UNKNOWN;
- if (val != 1)
- return EC_ERROR_NOT_POWERED;
- }
} else {
ioex_set_level(rst_signal, 0);
msleep(1);
@@ -350,10 +327,7 @@ void board_reset_pd_mcu(void)
enum gpio_signal tcpc_rst;
#ifndef CONFIG_ZEPHYR
- if (get_board_id() == 1)
- tcpc_rst = GPIO_ID_1_USB_C0_C2_TCPC_RST_ODL;
- else
- tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL;
+ tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL;
#else
tcpc_rst = GPIO_UNIMPLEMENTED;
#endif /* !CONFIG_ZEPHYR */
@@ -391,19 +365,14 @@ static void board_tcpc_init(void)
if (!system_jumped_late())
board_reset_pd_mcu();
- /*
- * These IO expander pins are implemented using the
- * C0/C2 TCPC, so they must be set up after the TCPC has
- * been taken out of reset.
- */
+ /*
+ * These IO expander pins are implemented using the
+ * C0/C2 TCPC, so they must be set up after the TCPC has
+ * been taken out of reset.
+ */
#ifndef CONFIG_ZEPHYR
- if (get_board_id() == 1) {
- ioex_init(IOEX_ID_1_C0_NCT38XX);
- ioex_init(IOEX_ID_1_C2_NCT38XX);
- } else {
- ioex_init(IOEX_C0_NCT38XX);
- ioex_init(IOEX_C2_NCT38XX);
- }
+ ioex_init(IOEX_C0_NCT38XX);
+ ioex_init(IOEX_C2_NCT38XX);
#else
gpio_reset_port(DEVICE_DT_GET(DT_NODELABEL(ioex_port1)));
gpio_reset_port(DEVICE_DT_GET(DT_NODELABEL(ioex_port2)));
diff --git a/board/brya/usbc_config.h b/board/brya/usbc_config.h
index 9e7652d9a0..bff89438d4 100644
--- a/board/brya/usbc_config.h
+++ b/board/brya/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#define __CROS_EC_USBC_CONFIG_H
#ifndef CONFIG_ZEPHYR
-#define CONFIG_USB_PD_PORT_MAX_COUNT 3
+#define CONFIG_USB_PD_PORT_MAX_COUNT 3
#endif
enum usbc_port {
diff --git a/board/bugzzy/battery.c b/board/bugzzy/battery.c
index 23318890f3..2df4848d05 100644
--- a/board/bugzzy/battery.c
+++ b/board/bugzzy/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -85,7 +85,7 @@ const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SDI;
int charger_profile_override(struct charge_state_data *curr)
{
if ((chipset_in_state(CHIPSET_STATE_ON)) &&
- (curr->requested_current > CHARGING_CURRENT_45C))
+ (curr->requested_current > CHARGING_CURRENT_45C))
curr->requested_current = CHARGING_CURRENT_45C;
return 0;
@@ -115,7 +115,7 @@ static void reduce_input_voltage_when_full(void)
int port;
if (charge_get_percent() == 100 &&
- chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
+ chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
if (max_pd_voltage_mv != PD_VOLTAGE_WHEN_FULL) {
saved_input_voltage = max_pd_voltage_mv;
max_pd_voltage_mv = PD_VOLTAGE_WHEN_FULL;
@@ -131,5 +131,4 @@ static void reduce_input_voltage_when_full(void)
pd_set_external_voltage_limit(port, max_pd_voltage_mv);
}
}
-DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full, HOOK_PRIO_DEFAULT);
diff --git a/board/bugzzy/board.c b/board/bugzzy/board.c
index 25fc04a20a..5a28fb2c25 100644
--- a/board/bugzzy/board.c
+++ b/board/bugzzy/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -85,7 +85,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -120,7 +119,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
@@ -181,22 +179,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Skin1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "Skin2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Skin1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "Skin2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -212,16 +210,17 @@ void board_init(void)
if (get_cbi_fw_config_db() == DB_1A_HDMI) {
/* Disable i2c on HDMI pins */
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0);
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
+ 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
+ 0);
/* Set HDMI and sub-rail enables to output */
gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
chipset_in_state(CHIPSET_STATE_ON) ?
- GPIO_ODR_LOW : GPIO_ODR_HIGH);
- gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
+ GPIO_ODR_LOW :
+ GPIO_ODR_HIGH);
+ gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
/* Select HDMI option */
gpio_set_level(GPIO_HDMI_SEL_L, 0);
@@ -230,8 +229,7 @@ void board_init(void)
gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL);
} else {
/* Set SDA as an input */
- gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
- GPIO_INPUT);
+ gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, GPIO_INPUT);
/* Enable C1 interrupt and check if it needs processing */
gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
@@ -300,10 +298,9 @@ __override void board_power_5v_enable(int enable)
gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
} else {
if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTS("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
-
}
__override uint8_t board_get_usb_pd_port_count(void)
@@ -328,13 +325,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -398,8 +393,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -426,23 +421,17 @@ static struct mutex g_base_mutex;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref_lsm = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref_lsm = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t ldm6dsm_base_accel = {
.name = "Base Accel",
@@ -481,8 +470,7 @@ struct motion_sensor_t ldm6dsm_base_gyro = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &lsm6dsm_drv,
.mutex = &g_base_mutex,
- .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
- MOTIONSENSE_TYPE_GYRO),
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, MOTIONSENSE_TYPE_GYRO),
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -601,9 +589,8 @@ void motion_interrupt(enum gpio_signal signal)
lsm6dsm_interrupt(signal);
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -671,44 +658,44 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
static int ps8743_tune_mux_c0(const struct usb_mux *me);
static int ps8743_tune_mux_c1(const struct usb_mux *me);
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .board_init = &ps8743_tune_mux_c0,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ .board_init = &ps8743_tune_mux_c0,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .board_init = &ps8743_tune_mux_c1,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ .board_init = &ps8743_tune_mux_c1,
+ },
}
};
/* USB Mux C0 : board_init of PS8743 */
static int ps8743_tune_mux_c0(const struct usb_mux *me)
{
- ps8743_tune_usb_eq(me,
- PS8743_USB_EQ_TX_3_6_DB,
- PS8743_USB_EQ_RX_16_0_DB);
+ ps8743_tune_usb_eq(me, PS8743_USB_EQ_TX_3_6_DB,
+ PS8743_USB_EQ_RX_16_0_DB);
return EC_SUCCESS;
}
/* USB Mux C1 : board_init of PS8743 */
static int ps8743_tune_mux_c1(const struct usb_mux *me)
{
- ps8743_tune_usb_eq(me,
- PS8743_USB_EQ_TX_3_6_DB,
- PS8743_USB_EQ_RX_16_0_DB);
+ ps8743_tune_usb_eq(me, PS8743_USB_EQ_TX_3_6_DB,
+ PS8743_USB_EQ_RX_16_0_DB);
- ps8743_write(me,
- PS8743_REG_USB_SWING,
- PS8743_LFPS_SWG_TD);
- ps8743_write(me,
- PS8743_REG_DP_SETTING,
- PS8743_DP_SWG_ADJ_P15P);
+ ps8743_write(me, PS8743_REG_USB_SWING, PS8743_LFPS_SWG_TD);
+ ps8743_write(me, PS8743_REG_DP_SETTING, PS8743_DP_SWG_ADJ_P15P);
return EC_SUCCESS;
}
@@ -735,7 +722,7 @@ uint16_t tcpc_get_alert_status(void)
}
if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
+ !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
@@ -765,8 +752,8 @@ static const struct ec_response_keybd_config keybd1 = {
/* No function keys, no numeric keypad, has screenlock key */
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
/*
* Future boards should use fw_config if needed.
@@ -830,11 +817,11 @@ static void panel_power_change_deferred(void)
gpio_set_level(GPIO_EN_LCD_ENN, signal);
} else if (signal != 0) {
i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS,
- ISL98607_REG_VBST_OUT, ISL98607_VBST_OUT_5P65);
+ ISL98607_REG_VBST_OUT, ISL98607_VBST_OUT_5P65);
i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS,
- ISL98607_REG_VN_OUT, ISL98607_VN_OUT_5P5);
+ ISL98607_REG_VN_OUT, ISL98607_VN_OUT_5P5);
i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS,
- ISL98607_REG_VP_OUT, ISL98607_VP_OUT_5P5);
+ ISL98607_REG_VP_OUT, ISL98607_VP_OUT_5P5);
}
gpio_set_level(GPIO_TSP_TA, signal & extpower_is_present());
}
@@ -878,9 +865,8 @@ static void lcd_reset_change_deferred(void)
if (signal == 0)
return;
- i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS,
- ISL98607_REG_ENABLE, ISL97607_VP_VN_VBST_DIS);
-
+ i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS, ISL98607_REG_ENABLE,
+ ISL97607_VP_VN_VBST_DIS);
}
DECLARE_DEFERRED(lcd_reset_change_deferred);
void lcd_reset_change_interrupt(enum gpio_signal signal)
@@ -927,8 +913,6 @@ void backlit_gpio_tick(void)
if (board_id >= 4 && signal == 1)
i2c_write16(I2C_PORT_LCD, I2C_ADDR_MP3372_FLAGS,
- MP3372_REG_ISET_CHEN,
- MP3372_ISET_15P3_CHEN_ALL);
-
+ MP3372_REG_ISET_CHEN, MP3372_ISET_15P3_CHEN_ALL);
}
DECLARE_HOOK(HOOK_TICK, backlit_gpio_tick, HOOK_PRIO_DEFAULT);
diff --git a/board/bugzzy/board.h b/board/bugzzy/board.h
index 722375b34b..707314d02a 100644
--- a/board/bugzzy/board.h
+++ b/board/bugzzy/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,12 +32,15 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
#define CONFIG_CHARGE_RAMP_HW
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
#define CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
@@ -60,9 +63,8 @@
#define GPIO_BAT_LED_GREEN_L GPIO_LED_G_ODL
#define GPIO_PWR_LED_BLUE_L GPIO_LED_B_ODL
-
/* PWM */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
/* Thermistors */
#define CONFIG_TEMP_SENSOR
@@ -97,23 +99,23 @@
#undef PD_POWER_SUPPLY_TURN_OFF_DELAY
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
/* 20% margin added for these timings */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
-#define I2C_PORT_LCD NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_LCD NPCX_I2C_PORT3_0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
#define I2C_ADDR_ISL98607_FLAGS 0x29
@@ -121,30 +123,30 @@
/* ISL98607 registers and value */
/* Enable VP / VN / VBST */
-#define ISL98607_REG_ENABLE 0x05
-#define ISL98607_VP_VN_VBST_EN 0x07
-#define ISL97607_VP_VN_VBST_DIS 0x00
+#define ISL98607_REG_ENABLE 0x05
+#define ISL98607_VP_VN_VBST_EN 0x07
+#define ISL97607_VP_VN_VBST_DIS 0x00
/* VBST Voltage Adjustment */
-#define ISL98607_REG_VBST_OUT 0x06
-#define ISL98607_VBST_OUT_5P65 0x0a
+#define ISL98607_REG_VBST_OUT 0x06
+#define ISL98607_VBST_OUT_5P65 0x0a
/* VN Voltage Adjustment */
-#define ISL98607_REG_VN_OUT 0x08
-#define ISL98607_VN_OUT_5P5 0x0a
+#define ISL98607_REG_VN_OUT 0x08
+#define ISL98607_VN_OUT_5P5 0x0a
/* VP Voltage Adjustment */
-#define ISL98607_REG_VP_OUT 0x09
-#define ISL98607_VP_OUT_5P5 0x0a
+#define ISL98607_REG_VP_OUT 0x09
+#define ISL98607_VP_OUT_5P5 0x0a
/* MP3372 registers and value */
/* ISET & CHEN */
-#define MP3372_REG_ISET_CHEN 0x00
-#define MP3372_ISET_21P8_CHEN_ALL 0x70ff
-#define MP3372_ISET_19P4_CHEN_ALL 0x63ff
-#define MP3372_ISET_18P0_CHEN_ALL 0x5cff
-#define MP3372_ISET_15P8_CHEN_ALL 0x50ff
-#define MP3372_ISET_15P3_CHEN_ALL 0x4eff
+#define MP3372_REG_ISET_CHEN 0x00
+#define MP3372_ISET_21P8_CHEN_ALL 0x70ff
+#define MP3372_ISET_19P4_CHEN_ALL 0x63ff
+#define MP3372_ISET_18P0_CHEN_ALL 0x5cff
+#define MP3372_ISET_15P8_CHEN_ALL 0x50ff
+#define MP3372_ISET_15P3_CHEN_ALL 0x4eff
/*
* I2C pin names for baseboard
*
@@ -158,18 +160,18 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
/* Lid operates in forced mode, base in interrupt mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -204,21 +206,16 @@ enum temp_sensor_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC5 */
- ADC_TEMP_SENSOR_4, /* ADC6 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC5 */
+ ADC_TEMP_SENSOR_4, /* ADC6 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/bugzzy/build.mk b/board/bugzzy/build.mk
index 815a285d83..5b37e085ef 100644
--- a/board/bugzzy/build.mk
+++ b/board/bugzzy/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/bugzzy/cbi_ssfc.c b/board/bugzzy/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/bugzzy/cbi_ssfc.c
+++ b/board/bugzzy/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/bugzzy/cbi_ssfc.h b/board/bugzzy/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/bugzzy/cbi_ssfc.h
+++ b/board/bugzzy/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/bugzzy/ec.tasklist b/board/bugzzy/ec.tasklist
index d4fb416bce..29666dd959 100644
--- a/board/bugzzy/ec.tasklist
+++ b/board/bugzzy/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bugzzy/gpio.inc b/board/bugzzy/gpio.inc
index b8bd5bf604..8e0fa56768 100644
--- a/board/bugzzy/gpio.inc
+++ b/board/bugzzy/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/bugzzy/led.c b/board/bugzzy/led.c
index 17da244534..cad2d5ed0b 100644
--- a/board/bugzzy/led.c
+++ b/board/bugzzy/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,8 +12,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 1;
@@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100;
/* bugzzy : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -57,7 +60,7 @@ __override void led_set_color_power(enum ec_led_colors color)
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
@@ -70,8 +73,7 @@ __override void led_set_color_power(enum ec_led_colors color)
return;
}
- if (color == EC_LED_COLOR_BLUE)
- {
+ if (color == EC_LED_COLOR_BLUE) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_ON_LVL);
@@ -87,7 +89,7 @@ __override void led_set_color_battery(enum ec_led_colors color)
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
@@ -140,12 +142,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L,
- !brightness[EC_LED_COLOR_GREEN]);
+ !brightness[EC_LED_COLOR_GREEN]);
gpio_set_level(GPIO_BAT_LED_RED_L,
- !brightness[EC_LED_COLOR_RED]);
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L,
- !brightness[EC_LED_COLOR_BLUE]);
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/bugzzy/usb_pd_policy.c b/board/bugzzy/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/bugzzy/usb_pd_policy.c
+++ b/board/bugzzy/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/burnet/battery.c b/board/burnet/battery.c
index 7d9b659ad1..d76634d6ce 100644
--- a/board/burnet/battery.c
+++ b/board/burnet/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/burnet/board.c b/board/burnet/board.c
index 23abc2dad9..aa378ca289 100644
--- a/board/burnet/board.c
+++ b/board/burnet/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,6 +34,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -48,8 +49,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -61,40 +62,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -102,8 +97,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -159,8 +154,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -173,13 +167,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -225,12 +222,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -300,8 +297,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -309,14 +305,15 @@ static void board_spi_disable(void)
/* Set pins to a state calming the sensor down. */
gpio_set_flags(GPIO_EC_SENSOR_SPI_CK, GPIO_OUT_LOW);
gpio_set_level(GPIO_EC_SENSOR_SPI_CK, 0);
+ gpio_set_flags(GPIO_EC_SENSOR_SPI_NSS, GPIO_OUT_LOW);
+ gpio_set_level(GPIO_EC_SENSOR_SPI_NSS, 0);
gpio_config_module(MODULE_SPI_CONTROLLER, 0);
/* Disable spi peripheral and clocks. */
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -327,23 +324,17 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_bmi160_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_bmi160_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_icm42607_ref = {
- {0, FLOAT_TO_FP(-1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_icm42607_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
static struct accelgyro_saved_data_t g_bma253_data;
@@ -516,8 +507,7 @@ static void board_update_config(void)
enum ec_error_list rv;
/* Ping for ack */
- rv = i2c_read8(I2C_PORT_SENSORS,
- KX022_ADDR1_FLAGS, KX022_WHOAMI, &val);
+ rv = i2c_read8(I2C_PORT_SENSORS, KX022_ADDR1_FLAGS, KX022_WHOAMI, &val);
if (rv == EC_SUCCESS)
motion_sensors[LID_ACCEL] = lid_accel_kx022;
@@ -553,7 +543,8 @@ static void board_init(void)
motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Enable interrupts from BMI160 sensor. */
gpio_enable_interrupt(GPIO_ACCEL_INT_ODL);
- /* For some reason we have to do this again in case of sysjump */
+ /* For some reason we have to do this again in case of sysjump
+ */
board_spi_enable();
board_update_config();
} else {
@@ -563,8 +554,7 @@ static void board_init(void)
/* Turn off GMR interrupt */
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
- gpio_set_flags(GPIO_ACCEL_INT_ODL,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_INT_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
board_spi_disable();
}
#endif /* !VARIANT_KUKUI_NO_SENSORS */
diff --git a/board/burnet/board.h b/board/burnet/board.h
index 1cc103d6fc..6870ccc2d2 100644
--- a/board/burnet/board.h
+++ b/board/burnet/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -52,9 +52,9 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
#define CONFIG_ACCEL_KX022
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* ICM42607 Base accel/gyro */
@@ -75,20 +75,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 2
-#define I2C_PORT_CHARGER 1
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 2
+#define I2C_PORT_CHARGER 1
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/burnet/build.mk b/board/burnet/build.mk
index a6e1c010d7..f583684804 100644
--- a/board/burnet/build.mk
+++ b/board/burnet/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/burnet/ec.tasklist b/board/burnet/ec.tasklist
index c1330b86f8..fb131b8eb4 100644
--- a/board/burnet/ec.tasklist
+++ b/board/burnet/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/burnet/gpio.inc b/board/burnet/gpio.inc
index c43a232870..9bb0aa73db 100644
--- a/board/burnet/gpio.inc
+++ b/board/burnet/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/burnet/led.c b/board/burnet/led.c
index 06ae68609e..4aa91c63e2 100644
--- a/board/burnet/led.c
+++ b/board/burnet/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -17,10 +17,8 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -28,7 +26,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -111,8 +109,7 @@ static void led_set_power(void)
if (chipset_in_state(CHIPSET_STATE_ON))
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power(
- (power_tick & 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick & 0x2) ? LED_WHITE : LED_OFF);
else
led_set_color_power(LED_OFF);
}
@@ -121,7 +118,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -132,10 +128,10 @@ static void led_set_battery(void)
*/
if (!board_is_convertible()) {
if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
- charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x2 ?
- LED_WHITE : LED_OFF);
+ CHIPSET_STATE_STANDBY) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
+ led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -164,18 +160,18 @@ static void led_set_battery(void)
led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/c2d2/board.c b/board/c2d2/board.c
index 24b314118e..fa6373c861 100644
--- a/board/c2d2/board.c
+++ b/board/c2d2/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,8 +30,8 @@
#include "gpio_list.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Forward declarations */
static void update_vrefs_and_shifters(void);
@@ -41,19 +41,19 @@ static bool is_ec_i2c_enabled(void);
/* Global state tracking current pin configuration and operations */
static struct mutex vref_bus_state_mutex;
static int vref_monitor_disable;
-#define VREF_MON_DIS_H1_RST_HELD BIT(0)
-#define VREF_MON_DIS_EC_PWR_HELD BIT(1)
-#define VREF_MON_DIS_SPI_MODE BIT(2)
+#define VREF_MON_DIS_H1_RST_HELD BIT(0)
+#define VREF_MON_DIS_EC_PWR_HELD BIT(1)
+#define VREF_MON_DIS_SPI_MODE BIT(2)
/*
* Tracks if bus pins are locked by a function like UART holding, I2C,
* or SPI.
*/
enum bus_lock {
- BUS_UNLOCKED, /* Normal UART; pins available for other functions */
- BUS_UART_HELD, /* UART locked to pins while holding RX low */
- BUS_SPI, /* SPI locked to pins */
- BUS_I2C, /* I2C bus locked to pins */
+ BUS_UNLOCKED, /* Normal UART; pins available for other functions */
+ BUS_UART_HELD, /* UART locked to pins while holding RX low */
+ BUS_SPI, /* SPI locked to pins */
+ BUS_I2C, /* I2C bus locked to pins */
};
/* A0/A1 (H1 UART or SPI) */
enum bus_lock h1_pins;
@@ -77,7 +77,7 @@ static const char *lock_to_string(const enum bus_lock val)
return names[val];
}
-static int command_bus_status(int argc, char **argv)
+static int command_bus_status(int argc, const char **argv)
{
if (argc > 1)
return EC_ERROR_PARAM_COUNT;
@@ -88,11 +88,9 @@ static int command_bus_status(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(bus_status, command_bus_status,
- "",
+DECLARE_CONSOLE_COMMAND(bus_status, command_bus_status, "",
"Gets the bus state for swappable pins");
-
/******************************************************************************
** Chip-specific board configuration
*/
@@ -114,12 +112,11 @@ void board_config_pre_init(void)
* i2c : no dma
* tim16/17: no dma
*/
- STM32_SYSCFG_CFGR1 |= BIT(24); /* Remap SPI2_RX to channel 6 */
- STM32_SYSCFG_CFGR1 |= BIT(26); /* Remap USART3 RX/TX DMA */
- STM32_SYSCFG_CFGR1 |= BIT(10); /* Remap USART1 RX/TX DMA */
+ STM32_SYSCFG_CFGR1 |= BIT(24); /* Remap SPI2_RX to channel 6 */
+ STM32_SYSCFG_CFGR1 |= BIT(26); /* Remap USART3 RX/TX DMA */
+ STM32_SYSCFG_CFGR1 |= BIT(10); /* Remap USART1 RX/TX DMA */
}
-
/******************************************************************************
** ADC channels
*/
@@ -147,18 +144,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("C2D2"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("CR50"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
- [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("C2D2 Shell"),
- [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
- [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("CPU"),
- [USB_STR_USART1_STREAM_NAME] = USB_STRING_DESC("EC"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("C2D2"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("CR50"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("C2D2 Shell"),
+ [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("CPU"),
+ [USB_STR_USART1_STREAM_NAME] = USB_STRING_DESC("EC"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -174,7 +171,7 @@ const struct i2c_port_t i2c_ports[] = {
.port = I2C_PORT_EC,
.kbps = 100,
.scl = GPIO_UART_DBG_TX_EC_RX_SCL,
- .sda = GPIO_UART_EC_TX_DBG_RX_SDA,
+ .sda = GPIO_UART_EC_TX_DBG_RX_SDA,
.flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
},
{
@@ -182,7 +179,7 @@ const struct i2c_port_t i2c_ports[] = {
.port = I2C_PORT_AUX,
.kbps = 100,
.scl = GPIO_UART_DBG_TX_AP_RX_INA_SCL,
- .sda = GPIO_UART_AP_TX_DBG_RX_INA_SDA,
+ .sda = GPIO_UART_AP_TX_DBG_RX_INA_SDA,
.flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
},
};
@@ -203,14 +200,19 @@ const struct ite_dfu_config_t ite_dfu_config = {
* let the i2c transactions fail instead of using the USB endpoint disable
* status.
*/
-int usb_i2c_board_is_enabled(void) { return 1; }
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
/******************************************************************************
* Forward UARTs as a USB serial interface.
*/
-#define USB_STREAM_RX_SIZE 32
-#define USB_STREAM_TX_SIZE 64
+#define USB_STREAM_RX_SIZE 32
+#define USB_STREAM_TX_SIZE 64
+#define USART_TO_USB_SIZE 1024
+#define USB_TO_USART_SIZE 64
/******************************************************************************
* Forward USART1 (EC) as a simple USB serial interface.
@@ -219,33 +221,22 @@ int usb_i2c_board_is_enabled(void) { return 1; }
static struct usart_config const usart1;
struct usb_stream_config const usart1_usb;
-static struct queue const usart1_to_usb = QUEUE_DIRECT(128, uint8_t,
- usart1.producer, usart1_usb.consumer);
-static struct queue const usb_to_usart1 = QUEUE_DIRECT(64, uint8_t,
- usart1_usb.producer, usart1.consumer);
+static struct queue const usart1_to_usb = QUEUE_DIRECT(
+ USART_TO_USB_SIZE, uint8_t, usart1.producer, usart1_usb.consumer);
+static struct queue const usb_to_usart1 = QUEUE_DIRECT(
+ USB_TO_USART_SIZE, uint8_t, usart1_usb.producer, usart1.consumer);
static struct usart_rx_dma const usart1_rx_dma =
USART_RX_DMA(STM32_DMAC_CH5, 32);
static struct usart_config const usart1 =
- USART_CONFIG(usart1_hw,
- usart1_rx_dma.usart_rx,
- usart_tx_interrupt,
- 115200,
- 0,
- usart1_to_usb,
- usb_to_usart1);
-
-USB_STREAM_CONFIG_USART_IFACE(usart1_usb,
- USB_IFACE_USART1_STREAM,
- USB_STR_USART1_STREAM_NAME,
- USB_EP_USART1_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart1,
- usart1_to_usb,
- usart1)
+ USART_CONFIG(usart1_hw, usart1_rx_dma.usart_rx, usart_tx_interrupt,
+ 115200, 0, usart1_to_usb, usb_to_usart1);
+USB_STREAM_CONFIG_USART_IFACE(usart1_usb, USB_IFACE_USART1_STREAM,
+ USB_STR_USART1_STREAM_NAME, USB_EP_USART1_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart1, usart1_to_usb, usart1)
/******************************************************************************
* Forward USART3 (CPU) as a simple USB serial interface.
@@ -254,33 +245,22 @@ USB_STREAM_CONFIG_USART_IFACE(usart1_usb,
static struct usart_config const usart3;
struct usb_stream_config const usart3_usb;
-static struct queue const usart3_to_usb = QUEUE_DIRECT(1024, uint8_t,
- usart3.producer, usart3_usb.consumer);
-static struct queue const usb_to_usart3 = QUEUE_DIRECT(64, uint8_t,
- usart3_usb.producer, usart3.consumer);
+static struct queue const usart3_to_usb = QUEUE_DIRECT(
+ USART_TO_USB_SIZE, uint8_t, usart3.producer, usart3_usb.consumer);
+static struct queue const usb_to_usart3 = QUEUE_DIRECT(
+ USB_TO_USART_SIZE, uint8_t, usart3_usb.producer, usart3.consumer);
static struct usart_rx_dma const usart3_rx_dma =
USART_RX_DMA(STM32_DMAC_CH3, 32);
static struct usart_config const usart3 =
- USART_CONFIG(usart3_hw,
- usart3_rx_dma.usart_rx,
- usart_tx_interrupt,
- 115200,
- 0,
- usart3_to_usb,
- usb_to_usart3);
-
-USB_STREAM_CONFIG_USART_IFACE(usart3_usb,
- USB_IFACE_USART3_STREAM,
- USB_STR_USART3_STREAM_NAME,
- USB_EP_USART3_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart3,
- usart3_to_usb,
- usart3)
+ USART_CONFIG(usart3_hw, usart3_rx_dma.usart_rx, usart_tx_interrupt,
+ 115200, 0, usart3_to_usb, usb_to_usart3);
+USB_STREAM_CONFIG_USART_IFACE(usart3_usb, USB_IFACE_USART3_STREAM,
+ USB_STR_USART3_STREAM_NAME, USB_EP_USART3_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart3, usart3_to_usb, usart3)
/******************************************************************************
* Forward USART4 (cr50) as a simple USB serial interface.
@@ -291,29 +271,19 @@ USB_STREAM_CONFIG_USART_IFACE(usart3_usb,
static struct usart_config const usart4;
struct usb_stream_config const usart4_usb;
-static struct queue const usart4_to_usb = QUEUE_DIRECT(1024, uint8_t,
- usart4.producer, usart4_usb.consumer);
-static struct queue const usb_to_usart4 = QUEUE_DIRECT(64, uint8_t,
- usart4_usb.producer, usart4.consumer);
+static struct queue const usart4_to_usb = QUEUE_DIRECT(
+ USART_TO_USB_SIZE, uint8_t, usart4.producer, usart4_usb.consumer);
+static struct queue const usb_to_usart4 = QUEUE_DIRECT(
+ USB_TO_USART_SIZE, uint8_t, usart4_usb.producer, usart4.consumer);
static struct usart_config const usart4 =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 115200,
- 0,
- usart4_to_usb,
- usb_to_usart4);
-
-USB_STREAM_CONFIG_USART_IFACE(usart4_usb,
- USB_IFACE_USART4_STREAM,
- USB_STR_USART4_STREAM_NAME,
- USB_EP_USART4_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart4,
- usart4_to_usb,
- usart4)
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart4_to_usb, usb_to_usart4);
+
+USB_STREAM_CONFIG_USART_IFACE(usart4_usb, USB_IFACE_USART4_STREAM,
+ USB_STR_USART4_STREAM_NAME, USB_EP_USART4_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart4, usart4_to_usb, usart4)
/******************************************************************************
* Set up SPI over USB
@@ -322,7 +292,7 @@ USB_STREAM_CONFIG_USART_IFACE(usart4_usb,
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_FLASH_PORT, 1, GPIO_SPI_CSN},
+ { CONFIG_SPI_FLASH_PORT, 1, GPIO_SPI_CSN },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
@@ -364,7 +334,7 @@ USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI,
/******************************************************************************
* Check parity setting on usarts.
*/
-static int command_uart_parity(int argc, char **argv)
+static int command_uart_parity(int argc, const char **argv)
{
int parity = 0, newparity;
struct usart_config const *usart;
@@ -398,14 +368,13 @@ static int command_uart_parity(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(parity, command_uart_parity,
- "usart[2|3|4] [0|1|2]",
+DECLARE_CONSOLE_COMMAND(parity, command_uart_parity, "usart[2|3|4] [0|1|2]",
"Set parity on uart");
/******************************************************************************
* Set baud rate setting on usarts.
*/
-static int command_uart_baud(int argc, char **argv)
+static int command_uart_baud(int argc, const char **argv)
{
int baud = 0;
struct usart_config const *usart;
@@ -431,14 +400,13 @@ static int command_uart_baud(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(baud, command_uart_baud,
- "usart[2|3|4] rate",
+DECLARE_CONSOLE_COMMAND(baud, command_uart_baud, "usart[2|3|4] rate",
"Set baud rate on uart");
/******************************************************************************
* Hold the usart pins low while disabling it, or return it to normal.
*/
-static int command_hold_usart_low(int argc, char **argv)
+static int command_hold_usart_low(int argc, const char **argv)
{
enum bus_lock *bus;
enum gpio_signal rx;
@@ -501,7 +469,7 @@ static int command_hold_usart_low(int argc, char **argv)
/* Print status for get and set case. */
ccprintf("USART status: %s\n",
- *bus == BUS_UART_HELD ? "held low" : "normal");
+ *bus == BUS_UART_HELD ? "held low" : "normal");
return EC_SUCCESS;
@@ -513,7 +481,6 @@ DECLARE_CONSOLE_COMMAND(hold_usart_low, command_hold_usart_low,
"usart[1|3|4] [0|1]?",
"Get/set the hold-low state for usart port");
-
/******************************************************************************
* Console commands SPI programming
*/
@@ -523,7 +490,7 @@ enum vref {
PP3300 = 3300,
};
-static int command_enable_spi(int argc, char **argv)
+static int command_enable_spi(int argc, const char **argv)
{
static enum vref current_spi_vref_state;
@@ -650,8 +617,7 @@ busy_error_unlock:
mutex_unlock(&vref_bus_state_mutex);
return EC_ERROR_BUSY;
}
-DECLARE_CONSOLE_COMMAND(enable_spi, command_enable_spi,
- "[0|1800|3300]?",
+DECLARE_CONSOLE_COMMAND(enable_spi, command_enable_spi, "[0|1800|3300]?",
"Get/set the SPI Vref");
/******************************************************************************
@@ -686,7 +652,7 @@ static inline int to_kbps(enum i2c_freq freq)
}
}
-static int command_enable_i2c(int argc, char **argv)
+static int command_enable_i2c(int argc, const char **argv)
{
int i2c_index;
enum bus_lock *bus;
@@ -770,7 +736,7 @@ DECLARE_CONSOLE_COMMAND(enable_i2c, command_enable_i2c,
* Console commands for asserting H1 reset and EC Power button
*/
-static int command_vref_alternate(int argc, char **argv,
+static int command_vref_alternate(int argc, const char **argv,
const enum gpio_signal vref_signal,
const enum gpio_signal en_signal,
const int state_flag,
@@ -819,7 +785,6 @@ static int command_vref_alternate(int argc, char **argv,
ccprintf("%s held: %s\n", print_name,
vref_monitor_disable & state_flag ? "yes" : "no");
-
return EC_SUCCESS;
busy_error_unlock:
@@ -827,24 +792,23 @@ busy_error_unlock:
return EC_ERROR_BUSY;
}
-static int command_pwr_button(int argc, char **argv)
+static int command_pwr_button(int argc, const char **argv)
{
return command_vref_alternate(argc, argv,
GPIO_SPIVREF_HOLDN_ECVREF_H1_PWRBTN_ODL,
GPIO_EN_SPIVREF_HOLDN_ECVREF_H1_PWRBTN,
VREF_MON_DIS_EC_PWR_HELD, "Power button");
}
-DECLARE_CONSOLE_COMMAND(pwr_button, command_pwr_button,
- "[0|1]?",
+DECLARE_CONSOLE_COMMAND(pwr_button, command_pwr_button, "[0|1]?",
"Get/set the power button state");
-static int command_h1_reset(int argc, char **argv)
+static int command_h1_reset(int argc, const char **argv)
{
if ((argc == 2) && !strncasecmp("pulse", argv[1], strlen(argv[1]))) {
int rv;
int c = 2;
- char *cmd_on[] = {"", "1", ""};
- char *cmd_off[] = {"", "0", ""};
+ const char *cmd_on[] = { "", "1", "" };
+ const char *cmd_off[] = { "", "0", "" };
rv = command_vref_alternate(c, cmd_on,
GPIO_SPIVREF_RSVD_H1VREF_H1_RST_ODL,
@@ -853,11 +817,10 @@ static int command_h1_reset(int argc, char **argv)
"H1 reset");
if (rv == EC_SUCCESS) {
msleep(100);
- rv = command_vref_alternate
- (c, cmd_off,
- GPIO_SPIVREF_RSVD_H1VREF_H1_RST_ODL,
- GPIO_EN_SPIVREF_RSVD_H1VREF_H1_RST,
- VREF_MON_DIS_H1_RST_HELD, "H1 reset");
+ rv = command_vref_alternate(
+ c, cmd_off, GPIO_SPIVREF_RSVD_H1VREF_H1_RST_ODL,
+ GPIO_EN_SPIVREF_RSVD_H1VREF_H1_RST,
+ VREF_MON_DIS_H1_RST_HELD, "H1 reset");
}
return rv;
}
@@ -867,11 +830,9 @@ static int command_h1_reset(int argc, char **argv)
GPIO_EN_SPIVREF_RSVD_H1VREF_H1_RST,
VREF_MON_DIS_H1_RST_HELD, "H1 reset");
}
-DECLARE_CONSOLE_COMMAND(h1_reset, command_h1_reset,
- "[0|1|pulse]?",
+DECLARE_CONSOLE_COMMAND(h1_reset, command_h1_reset, "[0|1|pulse]?",
"Get/set the h1 reset state");
-
/******************************************************************************
* Vref detection logic
*/
@@ -880,14 +841,13 @@ DECLARE_CONSOLE_COMMAND(h1_reset, command_h1_reset,
static enum vref h1_vref;
static enum vref ec_vref;
-static int command_h1_vref_present(int argc, char **argv)
+static int command_h1_vref_present(int argc, const char **argv)
{
ccprintf("H1 Vref: %s\n", h1_vref ? "on" : "off");
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(h1_vref, command_h1_vref_present,
- "",
+DECLARE_CONSOLE_COMMAND(h1_vref, command_h1_vref_present, "",
"Get if the h1 vref is present");
/* Voltage thresholds for rail detection */
@@ -1033,11 +993,9 @@ static void update_vrefs_and_shifters(void)
void set_up_comparator(void)
{
/* Overwrite any previous values. This is the only comparator usage */
- STM32_COMP_CSR = STM32_COMP_CMP2HYST_HI |
- STM32_COMP_CMP2OUTSEL_NONE |
+ STM32_COMP_CSR = STM32_COMP_CMP2HYST_HI | STM32_COMP_CMP2OUTSEL_NONE |
STM32_COMP_CMP2INSEL_INM5 | /* Watch DAC_OUT2 (PA5) */
- STM32_COMP_CMP2MODE_LSPEED |
- STM32_COMP_CMP2EN;
+ STM32_COMP_CMP2MODE_LSPEED | STM32_COMP_CMP2EN;
/* Set Falling and Rising interrupts for COMP2 */
STM32_EXTI_FTSR |= EXTI_COMP2_EVENT;
diff --git a/board/c2d2/board.h b/board/c2d2/board.h
index ada5b01ab6..6b1ac69efd 100644
--- a/board/c2d2/board.h
+++ b/board/c2d2/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,9 +21,9 @@
/* Enable USART */
#define CONFIG_STREAM_USART
-#define CONFIG_STREAM_USART1 /* EC USART */
-#define CONFIG_STREAM_USART3 /* AP USART - not connected by default */
-#define CONFIG_STREAM_USART4 /* H1 USART */
+#define CONFIG_STREAM_USART1 /* EC USART */
+#define CONFIG_STREAM_USART3 /* AP USART - not connected by default */
+#define CONFIG_STREAM_USART4 /* H1 USART */
#define CONFIG_STREAM_USB
#define CONFIG_CMD_USART_INFO
@@ -45,35 +45,34 @@
#define DEFAULT_SERIALNO "Uninitialized"
#define CONFIG_USB_UPDATE
-
/* USB interface indexes (use define rather than enum to expand them)
*
* Note these values are used in servo_interface.py for the 'interface' value
*/
-#define USB_IFACE_USART4_STREAM 0 /* H1 */
-#define USB_IFACE_UPDATE 1
-#define USB_IFACE_SPI 2
-#define USB_IFACE_CONSOLE 3
-#define USB_IFACE_I2C 4
-#define USB_IFACE_USART3_STREAM 5 /* AP (not connected by default) */
-#define USB_IFACE_USART1_STREAM 6 /* EC */
-#define USB_IFACE_COUNT 7
+#define USB_IFACE_USART4_STREAM 0 /* H1 */
+#define USB_IFACE_UPDATE 1
+#define USB_IFACE_SPI 2
+#define USB_IFACE_CONSOLE 3
+#define USB_IFACE_I2C 4
+#define USB_IFACE_USART3_STREAM 5 /* AP (not connected by default) */
+#define USB_IFACE_USART1_STREAM 6 /* EC */
+#define USB_IFACE_COUNT 7
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_USART4_STREAM 1
-#define USB_EP_UPDATE 2
-#define USB_EP_SPI 3
-#define USB_EP_CONSOLE 4
-#define USB_EP_I2C 5
-#define USB_EP_USART3_STREAM 6
-#define USB_EP_USART1_STREAM 7
-#define USB_EP_COUNT 8
+#define USB_EP_CONTROL 0
+#define USB_EP_USART4_STREAM 1
+#define USB_EP_UPDATE 2
+#define USB_EP_SPI 3
+#define USB_EP_CONSOLE 4
+#define USB_EP_I2C 5
+#define USB_EP_USART3_STREAM 6
+#define USB_EP_USART1_STREAM 7
+#define USB_EP_COUNT 8
/* Enable control of SPI over USB */
#define CONFIG_USB_SPI
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FLASH_PORT 0 /* SPI2 is 0th in stm's SPI_REGS var */
+#define CONFIG_SPI_FLASH_PORT 0 /* SPI2 is 0th in stm's SPI_REGS var */
/* Enable control of I2C over USB */
#define CONFIG_USB_I2C
@@ -87,8 +86,8 @@
#define CONFIG_I2C_XFER_LARGE_TRANSFER
#undef CONFIG_USB_I2C_MAX_WRITE_COUNT
#undef CONFIG_USB_I2C_MAX_READ_COUNT
-#define CONFIG_USB_I2C_MAX_WRITE_COUNT ((1<<9) - 4)
-#define CONFIG_USB_I2C_MAX_READ_COUNT ((1<<9) - 6)
+#define CONFIG_USB_I2C_MAX_WRITE_COUNT ((1 << 9) - 4)
+#define CONFIG_USB_I2C_MAX_READ_COUNT ((1 << 9) - 6)
/*
* Set all ADC samples to take 239.5 clock cycles. This allows us to measure
@@ -114,7 +113,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
diff --git a/board/c2d2/build.mk b/board/c2d2/build.mk
index 559b6b8e95..d5940c3885 100644
--- a/board/c2d2/build.mk
+++ b/board/c2d2/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/c2d2/ec.tasklist b/board/c2d2/ec.tasklist
index c1fb169118..c45a1e89a7 100644
--- a/board/c2d2/ec.tasklist
+++ b/board/c2d2/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/c2d2/gpio.inc b/board/c2d2/gpio.inc
index 485a603453..b100250f20 100644
--- a/board/c2d2/gpio.inc
+++ b/board/c2d2/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cappy2/battery.c b/board/cappy2/battery.c
index a0aef7bd4c..19be1825eb 100644
--- a/board/cappy2/battery.c
+++ b/board/cappy2/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,8 +11,8 @@
#include "common.h"
#include "util.h"
-#define CHARGING_VOLTAGE_MV_SAFE 8400
-#define CHARGING_CURRENT_MA_SAFE 1500
+#define CHARGING_VOLTAGE_MV_SAFE 8400
+#define CHARGING_CURRENT_MA_SAFE 1500
/*
* Battery info for lalala battery types. Note that the fields
@@ -165,13 +165,13 @@ int charger_profile_override(struct charge_state_data *curr)
}
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
return EC_RES_INVALID_PARAM;
}
diff --git a/board/cappy2/board.c b/board/cappy2/board.c
index c6f560b503..de651ac874 100644
--- a/board/cappy2/board.c
+++ b/board/cappy2/board.c
@@ -1,11 +1,10 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* cappy2 board-specific configuration */
-
#include "adc_chip.h"
#include "button.h"
#include "cbi_fw_config.h"
@@ -39,8 +38,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -80,7 +79,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -159,7 +157,6 @@ __override void board_power_5v_enable(int enable)
*/
gpio_set_level(GPIO_EN_PP5000, !!enable);
gpio_set_level(GPIO_EN_USB_A0_VBUS, !!enable);
-
}
int board_is_sourcing_vbus(int port)
@@ -168,13 +165,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -234,8 +229,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -289,12 +284,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
- .driver = &ps8743_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PS8743_I2C_ADDR0_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ },
},
};
@@ -341,23 +339,22 @@ void board_init(void)
/* modify AC DC prochot value */
isl923x_set_ac_prochot(CHARGER_SOLO, 4096);
isl923x_set_dc_prochot(CHARGER_SOLO, 6000);
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Cpu",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Cpu",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/cappy2/board.h b/board/cappy2/board.h
index 5a2fa75bba..b21a20d6e5 100644
--- a/board/cappy2/board.h
+++ b/board/cappy2/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,9 +11,9 @@
#define VARIANT_KEEBY_EC_NPCX797FC
#include "baseboard.h"
-#undef GPIO_VOLUME_UP_L
-#undef GPIO_VOLUME_DOWN_L
-#undef CONFIG_VOLUME_BUTTONS
+#undef GPIO_VOLUME_UP_L
+#undef GPIO_VOLUME_DOWN_L
+#undef CONFIG_VOLUME_BUTTONS
/* System unlocked in early development */
#define CONFIG_SYSTEM_UNLOCKED
@@ -32,15 +32,16 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_CHARGER_PROFILE_OVERRIDE
-#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
+#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
/* Keyboard */
-#undef CONFIG_PWM_KBLIGHT
+#undef CONFIG_PWM_KBLIGHT
/* LED defines */
#define CONFIG_LED_COMMON
@@ -50,7 +51,7 @@
#define GPIO_PWR_LED_BLUE_L GPIO_LED_B_ODL
/* PWM */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is used as PWM1. */
/******************************************************************************/
@@ -81,11 +82,11 @@
#define GPIO_TEMP_SENSOR_POWER GPIO_EN_PP3300_A
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -95,11 +96,11 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_TEMP_SENSOR_3, /* ADC6 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_TEMP_SENSOR_3, /* ADC6 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
diff --git a/board/cappy2/build.mk b/board/cappy2/build.mk
index b012d8d502..eb422dae93 100644
--- a/board/cappy2/build.mk
+++ b/board/cappy2/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/cappy2/cbi_ssfc.c b/board/cappy2/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/cappy2/cbi_ssfc.c
+++ b/board/cappy2/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/cappy2/cbi_ssfc.h b/board/cappy2/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/cappy2/cbi_ssfc.h
+++ b/board/cappy2/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/cappy2/ec.tasklist b/board/cappy2/ec.tasklist
index 0025c2985b..386e8625b3 100644
--- a/board/cappy2/ec.tasklist
+++ b/board/cappy2/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cappy2/gpio.inc b/board/cappy2/gpio.inc
index 00799bfdd8..1a32f31e06 100644
--- a/board/cappy2/gpio.inc
+++ b/board/cappy2/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cappy2/led.c b/board/cappy2/led.c
index fb6faae482..dba215ab51 100644
--- a/board/cappy2/led.c
+++ b/board/cappy2/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100;
/* cappy2 : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -55,7 +58,7 @@ __override void led_set_color_power(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
@@ -73,7 +76,7 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
@@ -117,12 +120,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L,
- !brightness[EC_LED_COLOR_GREEN]);
+ !brightness[EC_LED_COLOR_GREEN]);
gpio_set_level(GPIO_BAT_LED_RED_L,
- !brightness[EC_LED_COLOR_RED]);
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L,
- !brightness[EC_LED_COLOR_BLUE]);
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/cappy2/usb_pd_policy.c b/board/cappy2/usb_pd_policy.c
index fd9018a3f0..3410726e87 100644
--- a/board/cappy2/usb_pd_policy.c
+++ b/board/cappy2/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/careena/battery.c b/board/careena/battery.c
index 7180109168..ae8b2f905a 100644
--- a/board/careena/battery.c
+++ b/board/careena/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/careena/board.c b/board/careena/board.c
index e8171b1be0..cfe7199a91 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,45 +26,35 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_POWER_BUTTON_L,
GPIO_EC_RST_ODL,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL_AP,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -114,15 +104,15 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {-1, -1},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {-1, -1},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { -1, -1 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { -1, -1 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
static int board_is_support_ps8755_tcpc(void)
{
diff --git a/board/careena/board.h b/board/careena/board.h
index 75545cfcaa..86b88b64f0 100644
--- a/board/careena/board.h
+++ b/board/careena/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,7 +17,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -41,10 +41,7 @@
#ifndef __ASSEMBLER__
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
enum battery_type {
BATTERY_DYNAPACK_COS,
diff --git a/board/careena/build.mk b/board/careena/build.mk
index c808e65aed..d24127ddae 100644
--- a/board/careena/build.mk
+++ b/board/careena/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/careena/ec.tasklist b/board/careena/ec.tasklist
index b562761311..24300fe7da 100644
--- a/board/careena/ec.tasklist
+++ b/board/careena/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/careena/gpio.inc b/board/careena/gpio.inc
index c84c81a68e..477b17234e 100644
--- a/board/careena/gpio.inc
+++ b/board/careena/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/careena/led.c b/board/careena/led.c
index 4188290b4f..48a065fdb9 100644
--- a/board/careena/led.c
+++ b/board/careena/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -20,7 +20,7 @@
#define BAT_LED_ON 0
#define BAT_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -28,7 +28,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -88,16 +88,14 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
/* override battery led for system suspend */
- if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
+ if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY) &&
charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(power_ticks++ & 0x4 ? LED_WHITE :
+ LED_OFF);
return;
}
@@ -125,18 +123,18 @@ static void led_set_battery(void)
led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_battery((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x4) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x4) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/casta/battery.c b/board/casta/battery.c
index 0ced18e734..efee023d6a 100644
--- a/board/casta/battery.c
+++ b/board/casta/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,8 +12,8 @@
#include "common.h"
#include "util.h"
-#define CHARGING_VOLTAGE_MV_SAFE 8400
-#define CHARGING_CURRENT_MA_SAFE 1500
+#define CHARGING_VOLTAGE_MV_SAFE 8400
+#define CHARGING_CURRENT_MA_SAFE 1500
/*
* Battery info for all casta battery types. Note that the fields
@@ -95,12 +95,12 @@ int charger_profile_override(struct charge_state_data *curr)
TEMP_OUT_OF_RANGE = TEMP_ZONE_COUNT
} temp_zone;
- /*
- * Precharge must be executed when communication is failed on
+ /*
+ * Precharge must be executed when communication is failed on
* dead battery.
- */
- if(!(curr->batt.flags & BATT_FLAG_RESPONSIVE))
- return 0;
+ */
+ if (!(curr->batt.flags & BATT_FLAG_RESPONSIVE))
+ return 0;
current = curr->requested_current;
voltage = curr->requested_voltage;
@@ -146,7 +146,7 @@ int charger_profile_override(struct charge_state_data *curr)
break;
}
- if(voltage > batt_info->voltage_max)
+ if (voltage > batt_info->voltage_max)
voltage = batt_info->voltage_max;
curr->requested_voltage = MIN(curr->requested_voltage, voltage);
diff --git a/board/casta/board.c b/board/casta/board.c
index 24dafc9fee..512a7c224b 100644
--- a/board/casta/board.c
+++ b/board/casta/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,10 +37,10 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static uint8_t sku_id;
@@ -65,27 +65,27 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* TODO(b/119872005): Casta: confirm thermistor parts */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -103,13 +103,12 @@ const unsigned int chg_cnt = ARRAY_SIZE(chg_chips);
* I2C callbacks to ensure bus free time for battery I2C transactions is at
* least 5ms.
*/
-#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
+#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
static timestamp_t battery_last_i2c_time;
static int is_battery_i2c(const int port, const uint16_t addr_flags)
{
- return (port == I2C_PORT_BATTERY)
- && (addr_flags == BATTERY_ADDR_FLAGS);
+ return (port == I2C_PORT_BATTERY) && (addr_flags == BATTERY_ADDR_FLAGS);
}
static int is_battery_port(int port)
@@ -157,7 +156,7 @@ DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C);
static void board_init(void)
{
- if(get_cbi_ssfc_charger() != SSFC_CHARGER_BQ25710)
+ if (get_cbi_ssfc_charger() != SSFC_CHARGER_BQ25710)
return;
chg_chips[0].drv = &bq25710_drv;
@@ -174,7 +173,6 @@ static void set_input_limit_on_ac_removal(void)
return;
charger_set_input_current_limit(0, CONFIG_CHARGER_INPUT_CURRENT);
-
}
DECLARE_HOOK(HOOK_AC_CHANGE, set_input_limit_on_ac_removal, HOOK_PRIO_DEFAULT);
diff --git a/board/casta/board.h b/board/casta/board.h
index c8f4f7b1e7..3e7fe066cc 100644
--- a/board/casta/board.h
+++ b/board/casta/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -74,8 +74,8 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
ADC_CH_COUNT
};
diff --git a/board/casta/build.mk b/board/casta/build.mk
index 3d04b75731..998a65a3de 100644
--- a/board/casta/build.mk
+++ b/board/casta/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/casta/ec.tasklist b/board/casta/ec.tasklist
index ac41d643dc..5a1dc02a25 100644
--- a/board/casta/ec.tasklist
+++ b/board/casta/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/casta/gpio.inc b/board/casta/gpio.inc
index e37926b72e..724efd36ce 100644
--- a/board/casta/gpio.inc
+++ b/board/casta/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/casta/led.c b/board/casta/led.c
index 2c4cc63f80..7dfdc39151 100644
--- a/board/casta/led.c
+++ b/board/casta/led.c
@@ -1,8 +1,8 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
- * Power and battery LED control for Casta
+ * Power and battery LED control for Casta
*/
#include "chipset.h"
@@ -12,8 +12,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 1;
@@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100;
/* Casta : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -55,14 +58,13 @@ __override void led_set_color_power(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
- }
+ }
- if (color == EC_LED_COLOR_BLUE)
- {
- gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
- gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
+ if (color == EC_LED_COLOR_BLUE) {
+ gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
+ gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_ON_LVL);
} else {
/* LED_OFF and unsupported colors */
@@ -74,17 +76,16 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
- }
+ }
/* Battery leds must be turn off when blue led is on
* because casta has 3-in-1 led.
*/
- if(!gpio_get_level(GPIO_PWR_LED_BLUE_L))
- {
+ if (!gpio_get_level(GPIO_PWR_LED_BLUE_L)) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL); /*red*/
- gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); /*green*/
+ gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); /*green*/
return;
}
@@ -118,10 +119,13 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
- gpio_set_level(GPIO_BAT_LED_GREEN_L, !brightness[EC_LED_COLOR_GREEN]);
- gpio_set_level(GPIO_BAT_LED_RED_L, !brightness[EC_LED_COLOR_RED]);
+ gpio_set_level(GPIO_BAT_LED_GREEN_L,
+ !brightness[EC_LED_COLOR_GREEN]);
+ gpio_set_level(GPIO_BAT_LED_RED_L,
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
- gpio_set_level(GPIO_PWR_LED_BLUE_L, !brightness[EC_LED_COLOR_BLUE]);
+ gpio_set_level(GPIO_PWR_LED_BLUE_L,
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/cerise/battery.c b/board/cerise/battery.c
index 50d2bf397c..9edab52867 100644
--- a/board/cerise/battery.c
+++ b/board/cerise/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cerise/board.c b/board/cerise/board.c
index 61722dd530..e3fa60c76a 100644
--- a/board/cerise/board.c
+++ b/board/cerise/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -46,8 +47,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -59,40 +60,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -100,8 +95,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -157,8 +152,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -171,13 +165,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -239,12 +236,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -301,8 +298,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -316,8 +312,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -359,17 +354,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(-1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(1), 0, 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
/* Lid accel private data */
diff --git a/board/cerise/board.h b/board/cerise/board.h
index 1cb8cd9266..41d86b956d 100644
--- a/board/cerise/board.h
+++ b/board/cerise/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,7 +56,7 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -72,20 +72,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 2
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 2
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/cerise/build.mk b/board/cerise/build.mk
index a6e1c010d7..f583684804 100644
--- a/board/cerise/build.mk
+++ b/board/cerise/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/cerise/ec.tasklist b/board/cerise/ec.tasklist
index 36be2e96a4..e77603a8e2 100644
--- a/board/cerise/ec.tasklist
+++ b/board/cerise/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cerise/gpio.inc b/board/cerise/gpio.inc
index d7d5b9837d..6edf1f1eab 100644
--- a/board/cerise/gpio.inc
+++ b/board/cerise/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cerise/led.c b/board/cerise/led.c
index 53bec5bf05..81203ba331 100644
--- a/board/cerise/led.c
+++ b/board/cerise/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,25 +19,32 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/cherry/battery.c b/board/cherry/battery.c
index 72daf4966d..4f3a12e43d 100644
--- a/board/cherry/battery.c
+++ b/board/cherry/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cherry/board.c b/board/cherry/board.c
index 69828d19b5..c2ad54acb2 100644
--- a/board/cherry/board.c
+++ b/board/cherry/board.c
@@ -1,9 +1,11 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Cherry board configuration */
+#include "charge_manager.h"
+#include "charge_state_v2.h"
#include "common.h"
#include "console.h"
#include "driver/accel_bma422.h"
@@ -21,8 +23,8 @@
#include "system.h"
#include "usb_mux.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Sensor */
static struct mutex g_base_mutex;
@@ -33,17 +35,13 @@ static struct kionix_accel_data g_kx022_data;
static struct accelgyro_saved_data_t g_bma422_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -199,8 +197,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* USB Mux */
-static int board_ps8762_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8762_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
/* Make sure the PS8802 is awake */
RETURN_ERROR(ps8802_i2c_wake(me));
@@ -208,21 +205,18 @@ static int board_ps8762_mux_set(const struct usb_mux *me,
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- RETURN_ERROR(ps8802_i2c_field_update16(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_USB_SSEQ_LEVEL,
- PS8802_USBEQ_LEVEL_UP_MASK,
- PS8802_USBEQ_LEVEL_UP_12DB));
+ RETURN_ERROR(ps8802_i2c_field_update16(
+ me, PS8802_REG_PAGE2, PS8802_REG2_USB_SSEQ_LEVEL,
+ PS8802_USBEQ_LEVEL_UP_MASK,
+ PS8802_USBEQ_LEVEL_UP_12DB));
}
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- RETURN_ERROR(ps8802_i2c_field_update8(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_DPEQ_LEVEL,
- PS8802_DPEQ_LEVEL_UP_MASK,
- PS8802_DPEQ_LEVEL_UP_12DB));
+ RETURN_ERROR(ps8802_i2c_field_update8(
+ me, PS8802_REG_PAGE2, PS8802_REG2_DPEQ_LEVEL,
+ PS8802_DPEQ_LEVEL_UP_MASK, PS8802_DPEQ_LEVEL_UP_12DB));
}
return EC_SUCCESS;
@@ -230,11 +224,10 @@ static int board_ps8762_mux_set(const struct usb_mux *me,
static int board_ps8762_mux_init(const struct usb_mux *me)
{
- return ps8802_i2c_field_update8(
- me, PS8802_REG_PAGE1,
- PS8802_REG_DCIRX,
- PS8802_AUTO_DCI_MODE_DISABLE | PS8802_FORCE_DCI_MODE,
- PS8802_AUTO_DCI_MODE_DISABLE);
+ return ps8802_i2c_field_update8(me, PS8802_REG_PAGE1, PS8802_REG_DCIRX,
+ PS8802_AUTO_DCI_MODE_DISABLE |
+ PS8802_FORCE_DCI_MODE,
+ PS8802_AUTO_DCI_MODE_DISABLE);
}
static int board_anx3443_mux_set(const struct usb_mux *me,
@@ -245,24 +238,37 @@ static int board_anx3443_mux_set(const struct usb_mux *me,
return EC_SUCCESS;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX0,
- .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS,
- .driver = &ps8802_usb_mux_driver,
- .board_init = &board_ps8762_mux_init,
- .board_set = &board_ps8762_mux_set,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX0,
+ .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS,
+ .driver = &ps8802_usb_mux_driver,
+ .board_init = &board_ps8762_mux_init,
+ .board_set = &board_ps8762_mux_set,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_USB_MUX1,
- .i2c_addr_flags = ANX3443_I2C_ADDR0_FLAGS,
- .driver = &anx3443_usb_mux_driver,
- .board_set = &board_anx3443_mux_set,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_USB_MUX1,
+ .i2c_addr_flags = ANX3443_I2C_ADDR0_FLAGS,
+ .driver = &anx3443_usb_mux_driver,
+ .board_set = &board_anx3443_mux_set,
+ },
},
};
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
/* Initialize board. */
static void board_init(void)
{
diff --git a/board/cherry/board.h b/board/cherry/board.h
index 73f7d4044d..c94f862ede 100644
--- a/board/cherry/board.h
+++ b/board/cherry/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,14 +26,15 @@
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* PD / USB-C / PPC */
-#undef CONFIG_USB_PD_DEBUG_LEVEL /* default to 1, configurable in ec console */
+#undef CONFIG_USB_PD_DEBUG_LEVEL /* default to 1, configurable in ec console \
+ */
/* Optional console commands */
#define CONFIG_CMD_FLASH
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_STACKOVERFLOW
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
/* Keyboard */
#define CONFIG_KEYBOARD_REFRESH_ROW3
diff --git a/board/cherry/build.mk b/board/cherry/build.mk
index 0b0569c6d8..998e4d2750 100644
--- a/board/cherry/build.mk
+++ b/board/cherry/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/cherry/ec.tasklist b/board/cherry/ec.tasklist
index f9050fef87..5ce0fab583 100644
--- a/board/cherry/ec.tasklist
+++ b/board/cherry/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cherry/gpio.inc b/board/cherry/gpio.inc
index 296e3a418e..b953b16b27 100644
--- a/board/cherry/gpio.inc
+++ b/board/cherry/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cherry/led.c b/board/cherry/led.c
index c177a1b48f..0607301d4c 100644
--- a/board/cherry/led.c
+++ b/board/cherry/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,28 +10,37 @@
#include "led_onoff_states.h"
#include "pwm.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_S5] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_S5] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/cherry_scp/board.h b/board/cherry_scp/board.h
index dcf7f09a6f..0f6d006a44 100644
--- a/board/cherry_scp/board.h
+++ b/board/cherry_scp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,8 +25,8 @@
#define CONFIG_ROM_BASE 0x0
#define CONFIG_RAM_BASE 0x68000
#define CONFIG_ROM_SIZE (CONFIG_RAM_BASE - CONFIG_ROM_BASE)
-#define CONFIG_RAM_SIZE ((CONFIG_IPC_SHARED_OBJ_ADDR & (~(0x400 - 1))) - \
- CONFIG_RAM_BASE)
+#define CONFIG_RAM_SIZE \
+ ((CONFIG_IPC_SHARED_OBJ_ADDR & (~(0x400 - 1))) - CONFIG_RAM_BASE)
#define SCP_FW_END 0xc0000
diff --git a/board/cherry_scp/build.mk b/board/cherry_scp/build.mk
index 0d6c33755f..498bee2848 100644
--- a/board/cherry_scp/build.mk
+++ b/board/cherry_scp/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/cherry_scp/ec.tasklist b/board/cherry_scp/ec.tasklist
index 1c8cd120a0..353e5ee686 100644
--- a/board/cherry_scp/ec.tasklist
+++ b/board/cherry_scp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cherry_scp/gpio.inc b/board/cherry_scp/gpio.inc
index 48b397b9a9..8301fb437f 100644
--- a/board/cherry_scp/gpio.inc
+++ b/board/cherry_scp/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/chocodile_vpdmcu/board.c b/board/chocodile_vpdmcu/board.c
index b3e49fc547..a64da1633e 100644
--- a/board/chocodile_vpdmcu/board.c
+++ b/board/chocodile_vpdmcu/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,7 +20,7 @@
#include "util.h"
#include "vpd_api.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
void board_config_pre_init(void)
{
@@ -40,26 +40,26 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_VCONN_VSENSE] = {
- "VCONN_VSENSE", 3000, 4096, 0, STM32_AIN(ADC_VCONN_VSENSE)},
- [ADC_CC_VPDMCU] = {
- "CC_VPDMCU", 3000, 4096, 0, STM32_AIN(ADC_CC_VPDMCU)},
- [ADC_CC_RP3A0_RD_L] = {
- "CC_RP3A0_RD_L", 3000, 4096, 0, STM32_AIN(ADC_CC_RP3A0_RD_L)},
- [ADC_RDCONNECT_REF] = {
- "RDCONNECT_REF", 3000, 4096, 0, STM32_AIN(ADC_RDCONNECT_REF)},
- [ADC_CC1_RP3A0_RD_L] = {
- "CC1_RP1A5_ODH", 3000, 4096, 0, STM32_AIN(ADC_CC1_RP3A0_RD_L)},
- [ADC_CC2_RP3A0_RD_L] = {
- "CC2_RP1A5_ODH", 3000, 4096, 0, STM32_AIN(ADC_CC2_RP3A0_RD_L)},
- [ADC_HOST_VBUS_VSENSE] = {
- "HOST_VBUS_VSENSE", 3000, 4096, 0, STM32_AIN(ADC_HOST_VBUS_VSENSE)},
- [ADC_CHARGE_VBUS_VSENSE] = {
- "CHARGE_VBUS_VSENSE", 3000, 4096, 0, STM32_AIN(ADC_CHARGE_VBUS_VSENSE)},
- [ADC_CC1_RPUSB_ODH] = {
- "CC1_RPUSB_ODH", 3000, 4096, 0, STM32_AIN(ADC_CC1_RPUSB_ODH)},
- [ADC_CC2_RPUSB_ODH] = {
- "CC2_RPUSB_ODH", 3000, 4096, 0, STM32_AIN(ADC_CC2_RPUSB_ODH)},
+ [ADC_VCONN_VSENSE] = { "VCONN_VSENSE", 3000, 4096, 0,
+ STM32_AIN(ADC_VCONN_VSENSE) },
+ [ADC_CC_VPDMCU] = { "CC_VPDMCU", 3000, 4096, 0,
+ STM32_AIN(ADC_CC_VPDMCU) },
+ [ADC_CC_RP3A0_RD_L] = { "CC_RP3A0_RD_L", 3000, 4096, 0,
+ STM32_AIN(ADC_CC_RP3A0_RD_L) },
+ [ADC_RDCONNECT_REF] = { "RDCONNECT_REF", 3000, 4096, 0,
+ STM32_AIN(ADC_RDCONNECT_REF) },
+ [ADC_CC1_RP3A0_RD_L] = { "CC1_RP1A5_ODH", 3000, 4096, 0,
+ STM32_AIN(ADC_CC1_RP3A0_RD_L) },
+ [ADC_CC2_RP3A0_RD_L] = { "CC2_RP1A5_ODH", 3000, 4096, 0,
+ STM32_AIN(ADC_CC2_RP3A0_RD_L) },
+ [ADC_HOST_VBUS_VSENSE] = { "HOST_VBUS_VSENSE", 3000, 4096, 0,
+ STM32_AIN(ADC_HOST_VBUS_VSENSE) },
+ [ADC_CHARGE_VBUS_VSENSE] = { "CHARGE_VBUS_VSENSE", 3000, 4096, 0,
+ STM32_AIN(ADC_CHARGE_VBUS_VSENSE) },
+ [ADC_CC1_RPUSB_ODH] = { "CC1_RPUSB_ODH", 3000, 4096, 0,
+ STM32_AIN(ADC_CC1_RPUSB_ODH) },
+ [ADC_CC2_RPUSB_ODH] = { "CC2_RPUSB_ODH", 3000, 4096, 0,
+ STM32_AIN(ADC_CC2_RPUSB_ODH) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
diff --git a/board/chocodile_vpdmcu/board.h b/board/chocodile_vpdmcu/board.h
index 552f00aa09..ede07dd9a0 100644
--- a/board/chocodile_vpdmcu/board.h
+++ b/board/chocodile_vpdmcu/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,7 +34,7 @@
#define CPU_CLOCK 48000000
/* the UART console is on USART1 (PA9/PA10) */
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
/* Optional features */
@@ -43,23 +43,23 @@
#undef CONFIG_CMD_PD
#undef CONFIG_USBC_VCONN
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#define CONFIG_ADC_SAMPLE_TIME STM32_ADC_SMPR_41_5_CY
#define CONFIG_BOARD_PRE_INIT
#define CONFIG_COMMON_GPIO_SHORTNAMES
-#undef CONFIG_DEBUG_ASSERT
+#undef CONFIG_DEBUG_ASSERT
#define CONFIG_FORCE_CONSOLE_RESUME
#define CONFIG_HIBERNATE
-#undef CONFIG_HOSTCMD_EVENTS
+#undef CONFIG_HOSTCMD_EVENTS
#define CONFIG_HW_CRC
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LOW_POWER_IDLE
#define CONFIG_LTO
#define CONFIG_STM_HWTIMER32
-#undef CONFIG_TASK_PROFILING
-#undef CONFIG_UART_TX_BUF_SIZE
-#undef CONFIG_UART_TX_DMA
-#undef CONFIG_UART_RX_DMA
+#undef CONFIG_TASK_PROFILING
+#undef CONFIG_UART_TX_BUF_SIZE
+#undef CONFIG_UART_TX_DMA
+#undef CONFIG_UART_RX_DMA
#define CONFIG_UART_TX_BUF_SIZE 128
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
@@ -74,7 +74,7 @@
#define CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_VBOOT_HASH
#define CONFIG_WATCHDOG
-#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_WATCHDOG_HELP
#define CONFIG_USB_PID 0x5036
#define VPD_HW_VERSION 0x0001
@@ -92,10 +92,10 @@
/* GND impedance in milliohms */
#define VPD_GND_IMPEDANCE 33
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* TODO(crosbug.com/p/50519): Remove CONFIG_SYSTEM_UNLOCKED prior to building
* MP FW.
@@ -103,19 +103,19 @@
#define CONFIG_SYSTEM_UNLOCKED
#ifdef HAS_TASK_CONSOLE
-#undef CONFIG_CONSOLE_HISTORY
+#undef CONFIG_CONSOLE_HISTORY
#define CONFIG_CONSOLE_HISTORY 2
#else
-#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CONSOLE_CMDHELP
#define CONFIG_DEBUG_PRINTF
#define UARTN CONFIG_UART_CONSOLE
#define UARTN_BASE STM32_USART_BASE(CONFIG_UART_CONSOLE)
#endif /* HAS_TASK_CONSOLE */
/* Use PSTATE embedded in the RO image, not in its own erase block */
-#undef CONFIG_FLASH_PSTATE_BANK
-#undef CONFIG_FW_PSTATE_SIZE
+#undef CONFIG_FLASH_PSTATE_BANK
+#undef CONFIG_FW_PSTATE_SIZE
#define CONFIG_FW_PSTATE_SIZE 0
/* Include math_util for bitmask_uint64 used in pd_timers */
@@ -125,7 +125,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -146,8 +146,8 @@ enum adc_channel {
};
/* 1.5A Rp */
-#define PD_SRC_VNC PD_SRC_1_5_VNC_MV
-#define PD_SRC_RD_THRESHOLD PD_SRC_1_5_RD_THRESH_MV
+#define PD_SRC_VNC PD_SRC_1_5_VNC_MV
+#define PD_SRC_RD_THRESHOLD PD_SRC_1_5_RD_THRESH_MV
#endif /* !__ASSEMBLER__ */
diff --git a/board/chocodile_vpdmcu/build.mk b/board/chocodile_vpdmcu/build.mk
index d4e5f58962..21c257bd7e 100644
--- a/board/chocodile_vpdmcu/build.mk
+++ b/board/chocodile_vpdmcu/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/chocodile_vpdmcu/chocodile.html b/board/chocodile_vpdmcu/chocodile.html
index b38edf94ec..6aec670f2a 100644
--- a/board/chocodile_vpdmcu/chocodile.html
+++ b/board/chocodile_vpdmcu/chocodile.html
@@ -866,7 +866,7 @@ th.expander input {
<text stroke="none" x="4750" y="-25" font-size="40" text-anchor="middle">10</text>
<text stroke="none" x="250" y="-25" font-size="40" text-anchor="middle">1</text>
<text stroke="none" x="38" y="-250" font-size="40" text-anchor="middle">A</text>
-<text stroke="none" x="99" y="-97" font-size="24">FOLLOWING NOTICE SHALL APPLY: &nbsp;COPYRIGHT C 2009 GOOGLE, INC. &nbsp;ALL RIGHTS RESERVED.</text>
+<text stroke="none" x="99" y="-97" font-size="24">FOLLOWING NOTICE SHALL APPLY: &nbsp;COPYRIGHT 2009 GOOGLE LLC</text>
<text stroke="none" x="38" y="-3750" font-size="40" text-anchor="middle">H</text>
<text stroke="none" x="5750" y="-25" font-size="40" text-anchor="middle">12</text>
<text stroke="none" x="92" y="-200" font-size="24">THESE MATERIALS (INCLUDING ALL TEXT, SOFTWARE,CODE, DISPLAYS, ARTWORK, AND IMAGES) CONTAIN TRADE SECRETS AND CONFIDENTIAL INFORMATION WHICH ARE PROPRIETARY TO GOOGLE, INC. &nbsp;ANY USE, REPRODUCTION, DISTRIBUTION,</text>
diff --git a/board/chocodile_vpdmcu/ec.tasklist b/board/chocodile_vpdmcu/ec.tasklist
index 6753502b92..ecbd3b052c 100644
--- a/board/chocodile_vpdmcu/ec.tasklist
+++ b/board/chocodile_vpdmcu/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/chocodile_vpdmcu/gpio.inc b/board/chocodile_vpdmcu/gpio.inc
index a34c617ef1..060054f719 100644
--- a/board/chocodile_vpdmcu/gpio.inc
+++ b/board/chocodile_vpdmcu/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/chocodile_vpdmcu/usb_pd_config.h b/board/chocodile_vpdmcu/usb_pd_config.h
index 048bbf3988..7fe608eb2a 100644
--- a/board/chocodile_vpdmcu/usb_pd_config.h
+++ b/board/chocodile_vpdmcu/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -55,7 +55,7 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
/* EXTI line 21 is connected to the CMP1 output */
#define EXTI_COMP1_MASK (1 << 21)
@@ -95,13 +95,15 @@ static inline void pd_tx_spi_reset(int port)
static inline void pd_tx_enable(int port, int polarity)
{
/* USB_CC_TX_DATA: PB4 is SPI1 MISO */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- & ~(3 << (2*4))) /* PB4 disable ADC */
- | (2 << (2*4)); /* Set as SPI1_MISO */
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 4))) /* PB4 disable ADC
+ */
+ | (2 << (2 * 4)); /* Set as SPI1_MISO */
/* MCU ADC PA1 pin output low */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*1))) /* PA1 disable ADC */
- | (1 << (2*1)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2 * 1))) /* PA1 disable ADC
+ */
+ | (1 << (2 * 1)); /* Set as GPO */
gpio_set_level(GPIO_CC_VPDMCU, 0);
}
@@ -109,11 +111,10 @@ static inline void pd_tx_enable(int port, int polarity)
static inline void pd_tx_disable(int port, int polarity)
{
/* Set CC_TX_DATA to Hi-Z, PB4 is SPI1 MISO */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- & ~(3 << (2*4)));
+ STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 4)));
/* set ADC PA1 pin to ADC function (Hi-Z) */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*1))); /* PA1 as ADC */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) | (3 << (2 * 1))); /* PA1 as ADC */
}
/* we know the plug polarity, do the right configuration */
@@ -123,8 +124,8 @@ static inline void pd_select_polarity(int port, int polarity)
* use the right comparator : CC1 -> PA1 (COMP1 INP)
* use VrefInt / 2 as INM (about 600mV)
*/
- STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK)
- | STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
+ STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK) |
+ STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
}
/* Initialize pins used for TX and put them in Hi-Z */
diff --git a/board/chocodile_vpdmcu/vpd_api.c b/board/chocodile_vpdmcu/vpd_api.c
index cdd2d9776d..fdfdf47efc 100644
--- a/board/chocodile_vpdmcu/vpd_api.c
+++ b/board/chocodile_vpdmcu/vpd_api.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,7 +35,7 @@
#endif
#undef CC_RA
-#define CC_RA(cc, sel) (cc < pd_src_rd_threshold[sel])
+#define CC_RA(cc, sel) (cc < pd_src_rd_threshold[sel])
#undef CC_RD
#define CC_RD(cc, sel) ((cc >= pd_src_rd_threshold[sel]) && (cc < PD_SRC_VNC))
@@ -47,16 +47,16 @@
#define VBUS_DETECT_THRESHOLD 2500 /* mV */
#define VCONN_DETECT_THRESHOLD 2500 /* mV */
-#define SCALE(vmeas, sfactor) (((vmeas) * 1000) / (sfactor))
+#define SCALE(vmeas, sfactor) (((vmeas)*1000) / (sfactor))
/*
* Type C power source charge current limits are identified by their cc
* voltage (set by selecting the proper Rd resistor). Any voltage below
* TYPE_C_SRC_500_THRESHOLD will not be identified as a type C charger.
*/
-#define TYPE_C_SRC_DEFAULT_THRESHOLD 200 /* mV */
-#define TYPE_C_SRC_1500_THRESHOLD 660 /* mV */
-#define TYPE_C_SRC_3000_THRESHOLD 1230 /* mV */
+#define TYPE_C_SRC_DEFAULT_THRESHOLD 200 /* mV */
+#define TYPE_C_SRC_1500_THRESHOLD 660 /* mV */
+#define TYPE_C_SRC_3000_THRESHOLD 1230 /* mV */
/* Charge-Through pull up/down enabled */
static int ct_cc_pull;
@@ -86,7 +86,7 @@ static int vpd_cc_voltage_to_status(int cc_volt, int cc_pull)
return TYPEC_CC_VOLT_RA;
else
return TYPEC_CC_VOLT_OPEN;
- /* If we have a pull-down, then we are sink, check for Rp. */
+ /* If we have a pull-down, then we are sink, check for Rp. */
} else if (cc_pull == TYPEC_CC_RD || cc_pull == TYPEC_CC_RA_RD) {
if (cc_volt >= TYPE_C_SRC_3000_THRESHOLD)
return TYPEC_CC_VOLT_RP_3_0;
@@ -218,8 +218,8 @@ void vpd_host_set_pull(int pull, int rp_value)
void vpd_host_get_cc(int *cc)
{
- *cc = vpd_cc_voltage_to_status(
- adc_read_channel(ADC_CC_VPDMCU), host_cc_pull);
+ *cc = vpd_cc_voltage_to_status(adc_read_channel(ADC_CC_VPDMCU),
+ host_cc_pull);
}
void vpd_rx_enable(int en)
@@ -237,17 +237,23 @@ void vpd_config_cc_rp3a0_rd_l(enum vpd_pin cfg, int en)
gpio_set_level(GPIO_CC_RP3A0_RD_L, en ? 1 : 0);
/* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*2))) /* PA2 disable ADC */
- | (1 << (2*2)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2 * 2))) /* PA2
+ disable
+ ADC */
+ | (1 << (2 * 2)); /* Set as GPO */
} else {
/* Set PA2 pin to ANALOG function */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*2))); /* PA2 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) | (3 << (2 * 2))); /* PA2 in
+ ANALOG
+ mode */
/* Set PA3 pin to ANALOG function */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*3))); /* PA3 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) | (3 << (2 * 3))); /* PA3 in
+ ANALOG
+ mode */
/* Disable Window Mode. Select PA3 */
STM32_COMP_CSR &= ~STM32_COMP_WNDWEN;
@@ -276,9 +282,11 @@ void vpd_config_cc1_rp3a0_rd_l(enum vpd_pin cfg, int en)
gpio_set_level(GPIO_CC1_RP3A0_RD_L, en ? 1 : 0);
/* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*4))) /* PA4 disable ADC */
- | (1 << (2*4)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2 * 4))) /* PA4
+ disable
+ ADC */
+ | (1 << (2 * 4)); /* Set as GPO */
}
if (cfg == PIN_ADC || cfg == PIN_CMP) {
@@ -286,13 +294,17 @@ void vpd_config_cc1_rp3a0_rd_l(enum vpd_pin cfg, int en)
STM32_COMP_CSR &= ~STM32_COMP_CMP2EN;
/* Set PA4 pin to Analog mode */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*4))); /* PA4 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) | (3 << (2 * 4))); /* PA4 in
+ ANALOG
+ mode */
if (cfg == PIN_CMP) {
/* Set PA3 pin to ANALOG function */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*3))); /* PA3 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A) |
+ (3 << (2 * 3))); /* PA3 in
+ ANALOG
+ mode */
/* Disable Window Mode. Select PA3*/
STM32_COMP_CSR &= ~STM32_COMP_WNDWEN;
@@ -319,9 +331,11 @@ void vpd_config_cc2_rp3a0_rd_l(enum vpd_pin cfg, int en)
gpio_set_level(GPIO_CC2_RP3A0_RD_L, en ? 1 : 0);
/* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*5))) /* PA5 disable ADC */
- | (1 << (2*5)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2 * 5))) /* PA5
+ disable
+ ADC */
+ | (1 << (2 * 5)); /* Set as GPO */
}
if (cfg == PIN_ADC || cfg == PIN_CMP) {
@@ -329,13 +343,17 @@ void vpd_config_cc2_rp3a0_rd_l(enum vpd_pin cfg, int en)
STM32_COMP_CSR &= ~STM32_COMP_CMP2EN;
/* Set PA5 pin to ANALOG function */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*5))); /* PA5 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) | (3 << (2 * 5))); /* PA5 in
+ ANALOG
+ mode */
if (cfg == PIN_CMP) {
/* Set PA3 pin to ANALOG function */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*3))); /* PA3 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A) |
+ (3 << (2 * 3))); /* PA3 in
+ ANALOG
+ mode */
/* Disable Window Mode. */
STM32_COMP_CSR &= ~STM32_COMP_WNDWEN;
@@ -362,13 +380,17 @@ void vpd_config_cc1_rpusb_odh(enum vpd_pin cfg, int en)
gpio_set_level(GPIO_CC1_RPUSB_ODH, en ? 1 : 0);
/* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- & ~(3 << (2*0))) /* PB0 disable ADC */
- | (1 << (2*0)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 0))) /* PB0
+ disable
+ ADC */
+ | (1 << (2 * 0)); /* Set as GPO */
} else {
/* Enable Analog mode */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- | (3 << (2*0))); /* PB0 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) | (3 << (2 * 0))); /* PB0 in
+ ANALOG
+ mode */
}
}
@@ -382,13 +404,17 @@ void vpd_config_cc2_rpusb_odh(enum vpd_pin cfg, int en)
gpio_set_level(GPIO_CC2_RPUSB_ODH, en ? 1 : 0);
/* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- & ~(3 << (2*1))) /* PB1 disable ADC */
- | (1 << (2*1)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 1))) /* PB1
+ disable
+ ADC */
+ | (1 << (2 * 1)); /* Set as GPO */
} else {
/* Enable Analog mode */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- | (3 << (2*1))); /* PB1 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) | (3 << (2 * 1))); /* PB1 in
+ ANALOG
+ mode */
}
}
@@ -405,7 +431,7 @@ inline int vpd_read_host_vbus(void)
inline int vpd_read_ct_vbus(void)
{
return SCALE(adc_read_channel(ADC_CHARGE_VBUS_VSENSE),
- VBUS_SCALE_FACTOR);
+ VBUS_SCALE_FACTOR);
}
inline int vpd_read_vconn(void)
diff --git a/board/chocodile_vpdmcu/vpd_api.h b/board/chocodile_vpdmcu/vpd_api.h
index df50f92006..5d2fd24afb 100644
--- a/board/chocodile_vpdmcu/vpd_api.h
+++ b/board/chocodile_vpdmcu/vpd_api.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,34 +12,18 @@
#include "gpio.h"
#include "usb_pd.h"
-enum vpd_pin {
- PIN_ADC,
- PIN_CMP,
- PIN_GPO
-};
+enum vpd_pin { PIN_ADC, PIN_CMP, PIN_GPO };
-enum vpd_gpo {
- GPO_HZ,
- GPO_HIGH,
- GPO_LOW
-};
+enum vpd_gpo { GPO_HZ, GPO_HIGH, GPO_LOW };
enum vpd_pwr {
PWR_VCONN,
PWR_VBUS,
};
-enum vpd_cc {
- CT_OPEN,
- CT_CC1,
- CT_CC2
-};
+enum vpd_cc { CT_OPEN, CT_CC1, CT_CC2 };
-enum vpd_billboard {
- BB_NONE,
- BB_SRC,
- BB_SNK
-};
+enum vpd_billboard { BB_NONE, BB_SRC, BB_SNK };
/**
* Set Charge-Through Rp or Rd on CC lines
diff --git a/board/chronicler/battery.c b/board/chronicler/battery.c
index aee0095765..1d885607b7 100644
--- a/board/chronicler/battery.c
+++ b/board/chronicler/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/chronicler/board.c b/board/chronicler/board.c
index 5f7f717bca..40cefc714d 100644
--- a/board/chronicler/board.c
+++ b/board/chronicler/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,22 +36,22 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 3000,
+ .rpm_min = 3000,
.rpm_start = 5000,
- .rpm_max = 5100,
+ .rpm_max = 5100,
};
const struct fan_t fans[FAN_CH_COUNT] = {
@@ -73,23 +73,23 @@ const struct fan_t fans[FAN_CH_COUNT] = {
* TODO(b/202062363): Remove when clang is fixed.
*/
#define THERMAL_CONFIG_WITHOUT_FAN \
- { \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(77), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
}, \
.temp_host_release = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
- }, \
+ }, \
}
-__maybe_unused static const struct ec_thermal_config
- thermal_config_without_fan = THERMAL_CONFIG_WITHOUT_FAN;
+__maybe_unused static const struct ec_thermal_config thermal_config_without_fan =
+ THERMAL_CONFIG_WITHOUT_FAN;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CONFIG_WITH_FAN \
- { \
+#define THERMAL_CONFIG_WITH_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(77), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -120,12 +120,12 @@ struct fan_step {
/* Fan control table */
static const struct fan_step fan_table0[] = {
- {.on = 30, .off = 0, .rpm = 3150 }, /* Fan level 0 */
- {.on = 47, .off = 43, .rpm = 3500 }, /* Fan level 1 */
- {.on = 50, .off = 47, .rpm = 3750 }, /* Fan level 2 */
- {.on = 53, .off = 50, .rpm = 4200 }, /* Fan level 3 */
- {.on = 56, .off = 53, .rpm = 4500 }, /* Fan level 4 */
- {.on = 59, .off = 56, .rpm = 5000 }, /* Fan level 5 */
+ { .on = 30, .off = 0, .rpm = 3150 }, /* Fan level 0 */
+ { .on = 47, .off = 43, .rpm = 3500 }, /* Fan level 1 */
+ { .on = 50, .off = 47, .rpm = 3750 }, /* Fan level 2 */
+ { .on = 53, .off = 50, .rpm = 4200 }, /* Fan level 3 */
+ { .on = 56, .off = 53, .rpm = 4500 }, /* Fan level 4 */
+ { .on = 59, .off = 56, .rpm = 5000 }, /* Fan level 5 */
};
/* All fan tables must have the same number of levels */
@@ -148,7 +148,7 @@ int fan_percent_to_rpm(int fan, int pct)
if (++cnt != FAN_AVERAGE_TIME_SEC)
return fan_table[previous_level].rpm;
- avg_pct = (int) avg_pct / FAN_AVERAGE_TIME_SEC;
+ avg_pct = (int)avg_pct / FAN_AVERAGE_TIME_SEC;
/*
* Compare the pct and previous pct, we have the three paths :
@@ -287,8 +287,8 @@ static const struct ec_response_keybd_config main_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &main_kb;
}
@@ -303,15 +303,15 @@ __override const struct ec_response_keybd_config
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
/******************************************************************************/
@@ -322,19 +322,19 @@ static int manual_run_time = -1;
#endif
struct drop_step {
- int run_time; /* battery run time (day) */
- int drop_volt; /* drop voltage (mV) */
+ int run_time; /* battery run time (day) */
+ int drop_volt; /* drop voltage (mV) */
};
/* voltage drop table */
static const struct drop_step voltage_drop_table[] = {
- {.run_time = 90, .drop_volt = 13200 }, /* drop level 0 */
- {.run_time = 198, .drop_volt = 13125 }, /* drop level 1 */
- {.run_time = 305, .drop_volt = 13050 }, /* drop level 2 */
- {.run_time = 412, .drop_volt = 12975 }, /* drop level 3 */
- {.run_time = 519, .drop_volt = 12900 }, /* drop level 4 */
- {.run_time = 626, .drop_volt = 12825 }, /* drop level 5 */
- {.run_time = __INT_MAX__, .drop_volt = 12750 },/* drop level 6 */
+ { .run_time = 90, .drop_volt = 13200 }, /* drop level 0 */
+ { .run_time = 198, .drop_volt = 13125 }, /* drop level 1 */
+ { .run_time = 305, .drop_volt = 13050 }, /* drop level 2 */
+ { .run_time = 412, .drop_volt = 12975 }, /* drop level 3 */
+ { .run_time = 519, .drop_volt = 12900 }, /* drop level 4 */
+ { .run_time = 626, .drop_volt = 12825 }, /* drop level 5 */
+ { .run_time = __INT_MAX__, .drop_volt = 12750 }, /* drop level 6 */
};
#define NUM_DROP_LEVELS ARRAY_SIZE(voltage_drop_table)
@@ -346,19 +346,19 @@ static int get_battery_run_time_day(uint32_t *battery_run_time)
uint8_t data[6];
/* get battery run time */
- rv = sb_read_mfgacc(PARAM_FIRMWARE_RUNTIME,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_FIRMWARE_RUNTIME, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return EC_ERROR_UNKNOWN;
/*
* The response is 6 bytes; the runtime in seconds is the last 4 bytes.
*/
- run_time = *(int32_t *) (&data[2]);
+ run_time = *(int32_t *)(&data[2]);
#ifdef BATTERY_RUNTIME_TEST
- cprints(CC_CHARGER, "run_time : 0x%08x (%d day)",
- run_time, (run_time / 86400));
+ cprints(CC_CHARGER, "run_time : 0x%08x (%d day)", run_time,
+ (run_time / 86400));
/* manual battery run time fot test */
if (manual_run_time != -1)
@@ -388,8 +388,8 @@ int charger_profile_override(struct charge_state_data *curr)
break;
}
- curr->requested_voltage = MIN(curr->requested_voltage,
- voltage_drop_table[i].drop_volt);
+ curr->requested_voltage =
+ MIN(curr->requested_voltage, voltage_drop_table[i].drop_volt);
#ifdef BATTERY_RUNTIME_TEST
cprints(CC_CHARGER,
"Charger: run time(day): %d, drop level: %d, CV: %d",
@@ -399,13 +399,13 @@ int charger_profile_override(struct charge_state_data *curr)
}
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
return EC_RES_INVALID_PARAM;
}
@@ -427,7 +427,7 @@ DECLARE_HOOK(HOOK_INIT, battery_runtime_init, HOOK_PRIO_LAST);
#ifdef BATTERY_RUNTIME_TEST
/* test command */
-static int command_manual_run_time(int argc, char **argv)
+static int command_manual_run_time(int argc, const char **argv)
{
char *e = NULL;
@@ -445,10 +445,10 @@ static int command_manual_run_time(int argc, char **argv)
return EC_ERROR_PARAM1;
cprints(CC_CHARGER, "manual run time set to %d sec (%d day)",
- manual_run_time, (manual_run_time/86400));
+ manual_run_time, (manual_run_time / 86400));
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(rt, command_manual_run_time, "<battery_run_time_sec>",
- "Set manual run time for test");
+ "Set manual run time for test");
#endif
diff --git a/board/chronicler/board.h b/board/chronicler/board.h
index 1f6fb0f287..71ef0bd959 100644
--- a/board/chronicler/board.h
+++ b/board/chronicler/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,27 +37,27 @@
#undef CONFIG_ACCEL_FIFO_SIZE
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
+#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
#define CONFIG_USB_PD_FRS_PPC
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#undef CONFIG_USB_PD_TCPM_TUSB422
@@ -72,8 +72,8 @@
#define CONFIG_FAN_RPM_CUSTOM
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_PROFILE_OVERRIDE
/* Retimer */
@@ -89,44 +89,44 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
#define CONFIG_DEBUG_ASSERT_BRIEF
/* Disable volume button command in EC console */
-#undef CONFIG_CMD_BUTTON
+#undef CONFIG_CMD_BUTTON
/* Disable volume button in ectool */
#undef CONFIG_HOSTCMD_BUTTON
@@ -141,16 +141,9 @@
#include "usbc_config.h"
-enum battery_type {
- BATTERY_NVT_CP813907,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_NVT_CP813907, BATTERY_TYPE_COUNT };
-enum pwm_channel {
- PWM_CH_FAN,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_FAN, PWM_CH_KBLIGHT, PWM_CH_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/chronicler/build.mk b/board/chronicler/build.mk
index c0daa31eaa..f317b88795 100644
--- a/board/chronicler/build.mk
+++ b/board/chronicler/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/chronicler/cbi.c b/board/chronicler/cbi.c
index 210207eeac..712461cd2c 100644
--- a/board/chronicler/cbi.c
+++ b/board/chronicler/cbi.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/chronicler/ec.tasklist b/board/chronicler/ec.tasklist
index df7495f2a1..644c36cd37 100644
--- a/board/chronicler/ec.tasklist
+++ b/board/chronicler/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/chronicler/gpio.inc b/board/chronicler/gpio.inc
index b8b8d4f5e7..b0a9ad6981 100644
--- a/board/chronicler/gpio.inc
+++ b/board/chronicler/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/chronicler/keyboard.c b/board/chronicler/keyboard.c
index b9cc378295..9e04d77ca3 100644
--- a/board/chronicler/keyboard.c
+++ b/board/chronicler/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/chronicler/led.c b/board/chronicler/led.c
index dfa7fefa1b..8fd743101a 100644
--- a/board/chronicler/led.c
+++ b/board/chronicler/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -21,10 +21,10 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-#define LED_CYCLE_TIME_MS (2 * 1000)
+#define LED_CYCLE_TIME_MS (2 * 1000)
#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / HOOK_TICK_INTERVAL_MS)
-#define LED_ON_TIME_MS (1 * 1000)
-#define LED_ON_TICKS (LED_ON_TIME_MS / HOOK_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1 * 1000)
+#define LED_ON_TICKS (LED_ON_TIME_MS / HOOK_TICK_INTERVAL_MS)
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_LEFT_LED,
@@ -37,22 +37,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- RIGHT_PORT = 0,
- LEFT_PORT
-};
+enum led_port { RIGHT_PORT = 0, LEFT_PORT };
static void led_set_color_battery(enum led_port port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_C0_CHARGE_LED_AMBER_L :
- GPIO_C1_CHARGE_LED_AMBER_L);
+ GPIO_C1_CHARGE_LED_AMBER_L);
white_led = (port == RIGHT_PORT ? GPIO_C0_CHARGE_LED_WHITE_L :
- GPIO_C1_CHARGE_LED_WHITE_L);
+ GPIO_C1_CHARGE_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -124,17 +121,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
static int suspend_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -144,14 +140,13 @@ static void led_set_battery(void)
* LEDs to indicate system suspend without charging state.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ charge_get_state() != PWR_STATE_CHARGE) {
suspend_ticks++;
- led_set_color_battery(RIGHT_PORT, suspend_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(LEFT_PORT, suspend_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT, suspend_ticks & 0x4 ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ LEFT_PORT, suspend_ticks & 0x4 ? LED_WHITE : LED_OFF);
return;
}
@@ -165,9 +160,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
@@ -176,19 +174,20 @@ static void led_set_battery(void)
led_set_color_battery(LEFT_PORT, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/chronicler/usbc_config.c b/board/chronicler/usbc_config.c
index c2783dd755..b05cd4ecfd 100644
--- a/board/chronicler/usbc_config.c
+++ b/board/chronicler/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,18 +23,21 @@
#include "driver/tcpm/tusb422_public.h"
#include "driver/tcpm/tcpci.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/*
* USB3 DB mux configuration - the top level mux still needs to be set to the
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
/******************************************************************************/
@@ -104,17 +107,21 @@ const int usb_port_enable[USB_PORT_COUNT] = {
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -124,8 +131,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -136,16 +142,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -207,7 +213,7 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
ps8815_reset();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
static void board_tcpc_init(void)
diff --git a/board/chronicler/usbc_config.h b/board/chronicler/usbc_config.h
index 55dfce7621..7428d0c436 100644
--- a/board/chronicler/usbc_config.h
+++ b/board/chronicler/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,11 +8,7 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
/* Configure the USB3 daughterboard type */
void config_usb3_db_type(void);
diff --git a/board/coachz/base_detect.c b/board/coachz/base_detect.c
index 0068b37d8d..f2195f4d8a 100644
--- a/board/coachz/base_detect.c
+++ b/board/coachz/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Base detection and debouncing */
#define BASE_DETECT_EN_DEBOUNCE_US (350 * MSEC)
@@ -93,8 +93,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -144,12 +144,12 @@ void base_detect_interrupt(enum gpio_signal signal)
{
uint64_t time_now = get_time().val;
int debounce_us;
-
+
if (detect_pin_connected(signal))
debounce_us = BASE_DETECT_EN_DEBOUNCE_US;
- else
+ else
debounce_us = BASE_DETECT_DIS_DEBOUNCE_US;
-
+
if (base_detect_debounce_time <= time_now) {
/*
* Detect and measure detection pin pulse, when base is
@@ -211,7 +211,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/coachz/battery.c b/board/coachz/battery.c
index a5be64df0f..a89b26f49a 100644
--- a/board/coachz/battery.c
+++ b/board/coachz/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/coachz/board.c b/board/coachz/board.c
index 088c958679..c9a22d8211 100644
--- a/board/coachz/board.c
+++ b/board/coachz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,10 +36,10 @@
#include "task.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
+#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -173,8 +173,7 @@ static void ks_change_deferred(void)
proximity_detected = !(ks_attached && ks_open);
CPRINTS("ks %s %s -> proximity %s",
ks_attached ? "attached" : "detached",
- ks_open ? "open" : "close",
- proximity_detected ? "on" : "off");
+ ks_open ? "open" : "close", proximity_detected ? "on" : "off");
debounced_ks_attached = ks_attached;
debounced_ks_open = ks_open;
@@ -191,48 +190,36 @@ static void ks_interrupt(enum gpio_signal s)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "wlc",
- .port = I2C_PORT_WLC,
- .kbps = 400,
- .scl = GPIO_EC_I2C_WLC_SCL,
- .sda = GPIO_EC_I2C_WLC_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "wlc",
+ .port = I2C_PORT_WLC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_WLC_SCL,
+ .sda = GPIO_EC_I2C_WLC_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -240,45 +227,25 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
/* Base detection */
- [ADC_BASE_DET] = {
- "BASE_DET",
- NPCX_ADC_CH5,
- ADC_MAX_VOLT,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH5, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -290,16 +257,12 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -330,16 +293,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -364,11 +333,9 @@ static struct bmi_drv_data_t g_bmi260_data;
bool is_bmi260_present;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -471,8 +438,8 @@ static void board_detect_motionsensor(void)
/* Check base accelgyro chip */
bmi_read8(motion_sensors[LID_ACCEL].port,
- motion_sensors[LID_ACCEL].i2c_spi_addr_flags,
- BMI260_CHIP_ID, &val);
+ motion_sensors[LID_ACCEL].i2c_spi_addr_flags, BMI260_CHIP_ID,
+ &val);
if (val == BMI260_CHIP_ID_MAJOR) {
motion_sensors[LID_ACCEL] = motion_sensors_260[LID_ACCEL];
motion_sensors[LID_GYRO] = motion_sensors_260[LID_GYRO];
@@ -553,9 +520,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
void board_hibernate(void)
{
@@ -565,8 +532,7 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 1+ has the hardware fix. Don't need the following
@@ -662,8 +628,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -691,7 +656,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -715,24 +679,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/coachz/board.h b/board/coachz/board.h
index e1e2d94545..8d21cbc68c 100644
--- a/board/coachz/board.h
+++ b/board/coachz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
/* On-body detection */
#define CONFIG_BODY_DETECTION
-#define CONFIG_BODY_DETECTION_SENSOR LID_ACCEL
+#define CONFIG_BODY_DETECTION_SENSOR LID_ACCEL
#define CONFIG_BODY_DETECTION_VAR_NOISE_FACTOR 150 /* % */
#define CONFIG_GESTURE_DETECTION
#define CONFIG_GESTURE_DETECTION_MASK BIT(CONFIG_BODY_DETECTION_SENSOR)
@@ -21,7 +21,7 @@
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Save some flash space */
#define CONFIG_LTO
@@ -34,7 +34,7 @@
#undef CONFIG_CMD_TASK_RESET
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -101,10 +101,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_DISPLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_DISPLIGHT = 0, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/coachz/build.mk b/board/coachz/build.mk
index e8e293064e..01678fc8bb 100644
--- a/board/coachz/build.mk
+++ b/board/coachz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/coachz/ec.tasklist b/board/coachz/ec.tasklist
index dc5b32b4cf..ecb6672d32 100644
--- a/board/coachz/ec.tasklist
+++ b/board/coachz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coachz/gpio.inc b/board/coachz/gpio.inc
index d7ca61ac6b..1bb8e9135b 100644
--- a/board/coachz/gpio.inc
+++ b/board/coachz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coachz/led.c b/board/coachz/led.c
index 9dd8729a04..6623089db0 100644
--- a/board/coachz/led.c
+++ b/board/coachz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -35,15 +35,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_W_C0,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -69,7 +69,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -84,16 +83,15 @@ static void board_led_set_battery(void)
period = (1 + 1) * LED_ONE_SEC;
battery_ticks = battery_ticks % period;
if (battery_ticks < 1 * LED_ONE_SEC) {
- if (charge_get_percent() < 10)
- {
- /* Blink amber light (1 sec on, 1 sec off) */
+ if (charge_get_percent() < 10) {
+ /* Blink amber light (1 sec on, 1 sec
+ * off) */
color = LED_AMBER;
- }
- else
- {
- /* Blink white light (1 sec on, 1 sec off) */
+ } else {
+ /* Blink white light (1 sec on, 1 sec
+ * off) */
color = LED_BLUE;
- }
+ }
} else {
color = LED_OFF;
}
@@ -138,16 +136,16 @@ static void board_led_set_battery(void)
}
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Amber 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_AMBER;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Amber 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/coachz/usbc_config.c b/board/coachz/usbc_config.c
index d6930586dd..9409ee04fc 100644
--- a/board/coachz/usbc_config.c
+++ b/board/coachz/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "gpio.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/coffeecake/board.c b/board/coffeecake/board.c
index b344a5f745..05cba7e4f7 100644
--- a/board/coffeecake/board.c
+++ b/board/coffeecake/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,13 +31,11 @@ void vbus_event(enum gpio_signal signal);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "charger",
- .port = I2C_PORT_SY21612,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
+ { .name = "charger",
+ .port = I2C_PORT_SY21612,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -153,7 +151,7 @@ void board_config_pre_init(void)
/* Set 5Vsafe Vdac */
board_set_usb_output_voltage(5000);
/* Remap USART DMA to match the USART driver */
- STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10);/* Remap USART1 RX/TX DMA */
+ STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10); /* Remap USART1 RX/TX DMA */
}
#ifdef CONFIG_SPI_FLASH
@@ -197,10 +195,9 @@ static void factory_validation_deferred(void)
/* test mcdp via serial to validate function */
if (!mcdp_get_info(&info) && (MCDP_FAMILY(info.family) == 0x0010) &&
- (MCDP_CHIPID(info.chipid) == 0x2850)) {
+ (MCDP_CHIPID(info.chipid) == 0x2850)) {
pd_log_event(PD_EVENT_VIDEO_CODEC,
- PD_LOG_PORT_SIZE(0, sizeof(info)),
- 0, &info);
+ PD_LOG_PORT_SIZE(0, sizeof(info)), 0, &info);
}
mcdp_disable();
@@ -215,7 +212,8 @@ static void board_post_init(void)
* DUT powered - DRP SINK
*/
pd_set_dual_role(0, gpio_get_level(GPIO_AC_PRESENT_L) ?
- PD_DRP_FORCE_SINK : PD_DRP_FORCE_SOURCE);
+ PD_DRP_FORCE_SINK :
+ PD_DRP_FORCE_SOURCE);
}
DECLARE_DEFERRED(board_post_init);
@@ -233,10 +231,11 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_CHARGER_INT);
gpio_enable_interrupt(GPIO_USB_C_VBUS_DET_L);
/* Set PD_DISCHARGE initial state */
- gpio_set_level(GPIO_PD_DISCHARGE, gpio_get_level(GPIO_USB_C_VBUS_DET_L));
+ gpio_set_level(GPIO_PD_DISCHARGE,
+ gpio_get_level(GPIO_USB_C_VBUS_DET_L));
/* Delay needed to allow HDMI MCU to boot. */
- hook_call_deferred(&factory_validation_deferred_data, 200*MSEC);
+ hook_call_deferred(&factory_validation_deferred_data, 200 * MSEC);
/* Initialize buck-boost converter */
hook_call_deferred(&board_post_init_data, 0);
}
@@ -246,16 +245,16 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CH_CC1_PD] = {"USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1)},
- [ADC_VBUS_MON] = {"VBUS_MON", 13200, 4096, 0, STM32_AIN(2)},
- [ADC_DAC_REF_TP28] = {"DAC_REF_TP28", 3300, 4096, 0, STM32_AIN(4)},
- [ADC_DAC_VOLT] = {"DAC_VOLT", 3300, 4096, 0, STM32_AIN(5)},
+ [ADC_CH_CC1_PD] = { "USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1) },
+ [ADC_VBUS_MON] = { "VBUS_MON", 13200, 4096, 0, STM32_AIN(2) },
+ [ADC_DAC_REF_TP28] = { "DAC_REF_TP28", 3300, 4096, 0, STM32_AIN(4) },
+ [ADC_DAC_VOLT] = { "DAC_VOLT", 3300, 4096, 0, STM32_AIN(5) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-const void * const usb_strings[] = {
+const void *const usb_strings[] = {
[USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
[USB_STR_PRODUCT] = USB_STRING_DESC("Hoho"),
[USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_BB_URL] = USB_STRING_DESC(USB_GOOGLE_TYPEC_URL),
diff --git a/board/coffeecake/board.h b/board/coffeecake/board.h
index cabbb0bf4e..966a5b2516 100644
--- a/board/coffeecake/board.h
+++ b/board/coffeecake/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,7 +50,7 @@
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
#define CONFIG_USB_PD_LOGGING
-#undef CONFIG_EVENT_LOG_SIZE
+#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
#define CONFIG_USB_PD_CUSTOM_PDO
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
@@ -80,7 +80,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -106,21 +106,21 @@ enum usb_strings {
};
/* 3.0A Rp */
-#define PD_SRC_VNC PD_SRC_3_0_VNC_MV
-#define PD_SRC_RD_THRESHOLD PD_SRC_3_0_RD_THRESH_MV
+#define PD_SRC_VNC PD_SRC_3_0_VNC_MV
+#define PD_SRC_RD_THRESHOLD PD_SRC_3_0_RD_THRESH_MV
/* delay necessary for the voltage transition on the power supply */
/* TODO (code.google.com/p/chrome-os-partner/issues/detail?id=37078)
* Need to measure these and adjust for honeybuns.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 1000
-#define PD_MAX_POWER_MW 22500
-#define PD_MAX_CURRENT_MA 2500
-#define PD_MAX_VOLTAGE_MV 9000
+#define PD_MAX_POWER_MW 22500
+#define PD_MAX_CURRENT_MA 2500
+#define PD_MAX_VOLTAGE_MV 9000
/* Board interfaces */
void board_set_usb_output_voltage(int mv);
@@ -131,11 +131,11 @@ void board_set_usb_output_voltage(int mv);
#define USB_DEV_CLASS USB_CLASS_BILLBOARD
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_COUNT 0
+#define USB_IFACE_COUNT 0
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_COUNT 1
+#define USB_EP_CONTROL 0
+#define USB_EP_COUNT 1
/* I2C ports */
#define I2C_PORT_SY21612 0
diff --git a/board/coffeecake/build.mk b/board/coffeecake/build.mk
index 59ca88486b..26ddbbd925 100644
--- a/board/coffeecake/build.mk
+++ b/board/coffeecake/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/coffeecake/ec.tasklist b/board/coffeecake/ec.tasklist
index d6686d72e9..e02c0620f8 100644
--- a/board/coffeecake/ec.tasklist
+++ b/board/coffeecake/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coffeecake/gpio.inc b/board/coffeecake/gpio.inc
index bab62a6bea..9d0a02ea40 100644
--- a/board/coffeecake/gpio.inc
+++ b/board/coffeecake/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coffeecake/usb_pd_config.h b/board/coffeecake/usb_pd_config.h
index e2c1dbb2db..728d96bafe 100644
--- a/board/coffeecake/usb_pd_config.h
+++ b/board/coffeecake/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -49,7 +49,7 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
#define EXTI_COMP_MASK(p) BIT(21)
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -100,8 +100,8 @@ static inline void pd_select_polarity(int port, int polarity)
* use the right comparator : CC1 -> PA1 (COMP1 INP)
* use VrefInt / 2 as INM (about 600mV)
*/
- STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK)
- | STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
+ STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK) |
+ STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
}
/* Initialize pins used for TX and put them in Hi-Z */
@@ -136,7 +136,7 @@ static inline int pd_adc_read(int port, int cc)
* Check HOST_HIGH Rp setting.
* Return 3300mV on host mode.
*/
- if ((STM32_GPIO_MODER(GPIO_B) & (3 << (2*5))) == (1 << (2*5)))
+ if ((STM32_GPIO_MODER(GPIO_B) & (3 << (2 * 5))) == (1 << (2 * 5)))
return 3300;
else
return 0;
diff --git a/board/coffeecake/usb_pd_pdo.c b/board/coffeecake/usb_pd_pdo.c
index a766d7dbe5..c0d2298706 100644
--- a/board/coffeecake/usb_pd_pdo.c
+++ b/board/coffeecake/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -7,15 +7,16 @@
#include "usb_pd.h"
#include "usb_pd_pdo.h"
-#define PDO_FIXED_FLAGS_EXT (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\
- PDO_FIXED_COMM_CAP | PDO_FIXED_UNCONSTRAINED)
+#define PDO_FIXED_FLAGS_EXT \
+ (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP | \
+ PDO_FIXED_UNCONSTRAINED)
-#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\
- PDO_FIXED_COMM_CAP)
+#define PDO_FIXED_FLAGS \
+ (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP)
const uint32_t pd_src_pdo[] = {
- [PDO_IDX_5V] = PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS_EXT),
- [PDO_IDX_9V] = PDO_FIXED(9000, 2500, PDO_FIXED_FLAGS),
+ [PDO_IDX_5V] = PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS_EXT),
+ [PDO_IDX_9V] = PDO_FIXED(9000, 2500, PDO_FIXED_FLAGS),
};
const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
BUILD_ASSERT(ARRAY_SIZE(pd_src_pdo) == PDO_IDX_COUNT);
diff --git a/board/coffeecake/usb_pd_pdo.h b/board/coffeecake/usb_pd_pdo.h
index f695defddb..2ec925955d 100644
--- a/board/coffeecake/usb_pd_pdo.h
+++ b/board/coffeecake/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coffeecake/usb_pd_policy.c b/board/coffeecake/usb_pd_policy.c
index c8c74688a8..525d1057e2 100644
--- a/board/coffeecake/usb_pd_policy.c
+++ b/board/coffeecake/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,8 +22,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* Holds valid object position (opos) for entered mode */
static int alt_mode[PD_AMODE_COUNT];
@@ -97,31 +97,24 @@ int pd_check_power_swap(int port)
return 0;
}
-int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* We can swap to UFP */
return data_role == PD_ROLE_DFP;
}
-void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* TODO: turn on pp5000, pp3300 */
}
-void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
- int flags)
+void pd_check_pr_role(int port, enum pd_power_role pr_role, int flags)
{
if (pr_role == PD_ROLE_SINK && !gpio_get_level(GPIO_AC_PRESENT_L))
pd_request_power_swap(port);
-
}
-void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
if ((flags & PD_FLAGS_PARTNER_DR_DATA) && dr_role == PD_ROLE_DFP)
pd_request_data_swap(port);
@@ -136,8 +129,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
- CONFIG_USB_PD_IDENTITY_SW_VERS,
- 0, 0, 0, 0, /* SS[TR][12] */
+ CONFIG_USB_PD_IDENTITY_SW_VERS, 0, 0, 0,
+ 0, /* SS[TR][12] */
0, /* Vconn power */
0, /* Vconn power required */
1, /* Vbus power required */
@@ -163,18 +156,16 @@ static int svdm_response_svids(int port, uint32_t *payload)
#define OPOS_DP 1
#define OPOS_GFU 1
-const uint32_t vdo_dp_modes[1] = {
- VDO_MODE_DP(0, /* UFP pin cfg supported : none */
+const uint32_t vdo_dp_modes[1] = {
+ VDO_MODE_DP(0, /* UFP pin cfg supported : none */
MODE_DP_PIN_C, /* DFP pin cfg supported */
- 1, /* no usb2.0 signalling in AMode */
- CABLE_PLUG, /* its a plug */
- MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
- MODE_DP_SNK) /* Its a sink only */
+ 1, /* no usb2.0 signalling in AMode */
+ CABLE_PLUG, /* its a plug */
+ MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
+ MODE_DP_SNK) /* Its a sink only */
};
-const uint32_t vdo_goog_modes[1] = {
- VDO_MODE_GOOGLE(MODE_GOOGLE_FU)
-};
+const uint32_t vdo_goog_modes[1] = { VDO_MODE_GOOGLE(MODE_GOOGLE_FU) };
static int svdm_response_modes(int port, uint32_t *payload)
{
@@ -196,13 +187,15 @@ static int dp_status(int port, uint32_t *payload)
if (opos != OPOS_DP)
return 0; /* nak */
- payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
- (hpd == 1), /* HPD_HI|LOW */
- 0, /* request exit DP */
- 0, /* request exit USB */
- 0, /* MF pref */
+ payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
+ (hpd == 1), /* HPD_HI|LOW */
+ 0, /* request exit DP */
+ 0, /* request exit USB */
+ 0, /* MF pref */
gpio_get_level(GPIO_PD_SBU_ENABLE),
- 0, /* power low */
+ 0, /* power
+ low
+ */
0x2);
return 2;
}
@@ -281,8 +274,7 @@ const struct svdm_response svdm_rsp = {
.exit_mode = &svdm_exit_mode,
};
-int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
{
int rsize;
diff --git a/board/collis/battery.c b/board/collis/battery.c
index 5da46e9caa..21c7b80901 100644
--- a/board/collis/battery.c
+++ b/board/collis/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/collis/board.c b/board/collis/board.c
index fe308778a4..6b2c81bc02 100644
--- a/board/collis/board.c
+++ b/board/collis/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,7 +41,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -76,8 +76,8 @@ static const struct ec_response_keybd_config copano_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &copano_kb;
}
@@ -92,7 +92,6 @@ union volteer_cbi_fw_config fw_config_defaults = {
static void board_init(void)
{
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -179,8 +178,8 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -207,8 +206,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -319,32 +318,42 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-static const struct usb_mux usbc0_usb3_mb_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc0_usb3_mb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc0_usb3_mb_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc0_usb3_mb_retimer,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -417,23 +426,22 @@ static void ps8815_reset(int port)
}
gpio_set_level(ps8xxx_rst_odl, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(ps8xxx_rst_odl, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
CPRINTS("[C%d] %s: patching ps8815 registers", port, __func__);
- if (i2c_read8(i2c_port,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(i2c_port,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(i2c_port,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -441,8 +449,8 @@ void board_reset_pd_mcu(void)
{
ps8815_reset(USBC_PORT_C0);
usb_mux_hpd_update(USBC_PORT_C0, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
ps8815_reset(USBC_PORT_C1);
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
diff --git a/board/collis/board.h b/board/collis/board.h
index 22f7af1b6c..d9e903c6b3 100644
--- a/board/collis/board.h
+++ b/board/collis/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,11 +28,11 @@
#define CONFIG_POWER_PP5000_CONTROL
#undef NPCX_PWM1_SEL
-#define NPCX_PWM1_SEL 0 /* GPIO C2 is not used as PWM1 */
+#define NPCX_PWM1_SEL 0 /* GPIO C2 is not used as PWM1 */
/* LED defines */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* Keyboard features */
#define CONFIG_KEYBOARD_VIVALDI
@@ -57,34 +57,34 @@
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W, the limitation of 45W is for the Collis
* board.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#undef CONFIG_USBC_RETIMER_INTEL_BB
#undef CONFIG_USBC_RETIMER_INTEL_BB_RUNTIME_CONFIG
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
#undef CONFIG_USB_MUX_RUNTIME_CONFIG
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
@@ -99,8 +99,8 @@
#undef CONFIG_FANS
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -108,47 +108,46 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -159,10 +158,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -171,11 +167,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/collis/build.mk b/board/collis/build.mk
index 546bcba8d2..18397fdec3 100644
--- a/board/collis/build.mk
+++ b/board/collis/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/collis/ec.tasklist b/board/collis/ec.tasklist
index ca6d9fbf14..07a91894ed 100644
--- a/board/collis/ec.tasklist
+++ b/board/collis/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/collis/gpio.inc b/board/collis/gpio.inc
index 95e0ca8ba2..51c5f6b144 100644
--- a/board/collis/gpio.inc
+++ b/board/collis/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/collis/led.c b/board/collis/led.c
index 508a5eb585..9220b7a95c 100644
--- a/board/collis/led.c
+++ b/board/collis/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,28 +9,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/collis/sensors.c b/board/collis/sensors.c
index cdf6db971e..e647fe7d61 100644
--- a/board/collis/sensors.c
+++ b/board/collis/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,22 +36,18 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct icm_drv_data_t g_icm426xx_data;
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
const mat33_fp_t base_standard_ref_icm = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)},
+ { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
struct motion_sensor_t icm426xx_base_accel = {
diff --git a/board/copano/battery.c b/board/copano/battery.c
index add2094b52..85f3d67448 100644
--- a/board/copano/battery.c
+++ b/board/copano/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/copano/board.c b/board/copano/board.c
index efcde2c177..b4a8c5eb20 100644
--- a/board/copano/board.c
+++ b/board/copano/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,7 +42,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -77,8 +77,8 @@ static const struct ec_response_keybd_config copano_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &copano_kb;
}
@@ -93,7 +93,6 @@ union volteer_cbi_fw_config fw_config_defaults = {
static void board_init(void)
{
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -180,8 +179,8 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -208,8 +207,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -251,12 +250,15 @@ void board_reset_pd_mcu(void)
}
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc0_usb4_mb_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_0_MIX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+struct usb_mux_chain usbc0_usb4_mb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_0_MIX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
};
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration.
@@ -265,7 +267,7 @@ static void setup_mux(void)
{
CPRINTS("C0 supports bb-retimer");
/* USB-C port 0 have a retimer */
- usb_muxes[USBC_PORT_C0].next_mux = &usbc0_usb4_mb_retimer;
+ usb_muxes[USBC_PORT_C0].next = &usbc0_usb4_mb_retimer;
}
__override void board_cbi_init(void)
@@ -277,7 +279,6 @@ __override void board_cbi_init(void)
/* Reassign USB_C0_RT_RST_ODL */
bb_controls[USBC_PORT_C0].usb_ls_en_gpio = GPIO_USB_C0_LS_EN;
bb_controls[USBC_PORT_C0].retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL;
-
}
/******************************************************************************/
@@ -353,24 +354,31 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .next_mux = &usbc1_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/copano/board.h b/board/copano/board.h
index 315d7bc8bb..6efd3e88ee 100644
--- a/board/copano/board.h
+++ b/board/copano/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,11 +28,11 @@
#define CONFIG_POWER_PP5000_CONTROL
#undef NPCX_PWM1_SEL
-#define NPCX_PWM1_SEL 0 /* GPIO C2 is not used as PWM1 */
+#define NPCX_PWM1_SEL 0 /* GPIO C2 is not used as PWM1 */
/* LED defines */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* Keyboard features */
#define CONFIG_KEYBOARD_VIVALDI
@@ -57,23 +57,23 @@
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 15000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
@@ -82,15 +82,15 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
#define CONFIG_USB_PD_FRS_PPC
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
@@ -104,8 +104,8 @@
#undef CONFIG_FANS
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -113,47 +113,46 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -164,10 +163,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -176,11 +172,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/copano/build.mk b/board/copano/build.mk
index 838d6a16ce..c994631759 100644
--- a/board/copano/build.mk
+++ b/board/copano/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/copano/ec.tasklist b/board/copano/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/copano/ec.tasklist
+++ b/board/copano/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/copano/gpio.inc b/board/copano/gpio.inc
index 52be1271f1..c6271c20f4 100644
--- a/board/copano/gpio.inc
+++ b/board/copano/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/copano/led.c b/board/copano/led.c
index a5b535000a..15daf7b2b9 100644
--- a/board/copano/led.c
+++ b/board/copano/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,28 +9,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/copano/sensors.c b/board/copano/sensors.c
index 8aa9f5888b..3884c5cc93 100644
--- a/board/copano/sensors.c
+++ b/board/copano/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,22 +36,18 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct icm_drv_data_t g_icm426xx_data;
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
const mat33_fp_t base_standard_ref_icm = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)},
+ { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
struct motion_sensor_t icm426xx_base_accel = {
diff --git a/board/coral/battery.c b/board/coral/battery.c
index 8dfb05d631..3b105c90ca 100644
--- a/board/coral/battery.c
+++ b/board/coral/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,7 +19,7 @@
#include "i2c.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Number of writes needed to invoke battery cutoff command */
#define SHIP_MODE_WRITES 2
@@ -412,7 +412,8 @@ BUILD_ASSERT(ARRAY_SIZE(info) == BATTERY_TYPE_COUNT);
static inline const struct board_batt_params *board_get_batt_params(void)
{
return &info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type];
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type];
}
/* Get type of the battery connected on the board */
@@ -424,14 +425,16 @@ static int board_get_battery_type(void)
if (!battery_manufacturer_name(manu_name, sizeof(manu_name))) {
for (i = 0; i < BATTERY_TYPE_COUNT; i++) {
if (!strcasecmp(manu_name,
- info[i].fuel_gauge.manuf_name)) {
+ info[i].fuel_gauge.manuf_name)) {
if (info[i].fuel_gauge.device_name == NULL) {
board_battery_type = i;
break;
- } else if (!battery_device_name(device_name,
- sizeof(device_name))) {
+ } else if (!battery_device_name(
+ device_name,
+ sizeof(device_name))) {
if (!strcasecmp(device_name,
- info[i].fuel_gauge.device_name)) {
+ info[i].fuel_gauge
+ .device_name)) {
board_battery_type = i;
break;
}
@@ -496,7 +499,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
/* Do not discharge on AC if the battery is still waking up */
if (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- !(curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.status & STATUS_FULLY_CHARGED))
return 0;
/*
@@ -513,8 +516,8 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
* and suspend USB charging and DC/DC converter.
*/
if (!battery_is_cut_off() &&
- !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
/*
@@ -548,13 +551,13 @@ enum battery_present battery_hw_present(void)
return gpio_get_level(GPIO_EC_BATT_PRES_L) ? BP_NO : BP_YES;
}
-
static int battery_init(void)
{
int batt_status;
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
+ return battery_status(&batt_status) ?
+ 0 :
+ !!(batt_status & STATUS_INITIALIZED);
}
/* Allow booting now that the battery has woke up */
@@ -595,12 +598,13 @@ static int battery_check_disconnect(void)
/* Read the status of charge/discharge FETs */
if (info[board_battery_type].fuel_gauge.fet.mfgacc_support == 1) {
rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ SB_ALT_MANUFACTURER_ACCESS, data,
+ sizeof(data));
/* Get the lowest 16bits of the OperationStatus() data */
reg = data[2] | data[3] << 8;
} else
rv = sb_read(info[board_battery_type].fuel_gauge.fet.reg_addr,
- &reg);
+ &reg);
if (rv)
return BATTERY_DISCONNECT_ERROR;
@@ -650,7 +654,7 @@ enum battery_present battery_is_present(void)
* error due to a failed sb_read.
*/
battery_report_present_timer_started = 0;
- } else if (batt_pres == BP_YES && batt_pres_prev == BP_NO &&
+ } else if (batt_pres == BP_YES && batt_pres_prev == BP_NO &&
!battery_report_present_timer_started) {
/*
* Wait 1/2 second before reporting present if it was
@@ -674,11 +678,10 @@ int board_battery_initialized(void)
return battery_hw_present() == batt_pres_prev;
}
-
/* Customs options controllable by host command. */
#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0)
-#define PARAM_LEARN_MODE 0x10001
-#define PARAM_DISCONNECT_STATE 0x10002
+#define PARAM_LEARN_MODE 0x10001
+#define PARAM_DISCONNECT_STATE 0x10002
enum ec_status charger_profile_override_get_param(uint32_t param,
uint32_t *value)
diff --git a/board/coral/board.c b/board/coral/board.c
index 21729489bc..c63a2f6ddc 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,6 +33,7 @@
#include "math_util.h"
#include "motion_sense.h"
#include "motion_lid.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -53,15 +54,15 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
-#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
-#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
+#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
+#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
+#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
-#define USB_PD_PORT_ANX74XX 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX74XX 0
+#define USB_PD_PORT_PS8751 1
static int sku_id;
@@ -128,66 +129,51 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vfs = Vref = 2.816V, 10-bit unsigned reading */
- [ADC_TEMP_SENSOR_CHARGER] = {
- "CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
- [ADC_TEMP_SENSOR_AMB] = {
- "AMBIENT", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
- [ADC_BOARD_ID] = {
- "BRD_ID", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
- [ADC_BOARD_SKU_1] = {
- "BRD_SKU_1", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
- [ADC_BOARD_SKU_0] = {
- "BRD_SKU_0", NPCX_ADC_CH4, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
+ [ADC_TEMP_SENSOR_CHARGER] = { "CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_AMB] = { "AMBIENT", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_BOARD_ID] = { "BRD_ID", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_BOARD_SKU_1] = { "BRD_SKU_1", NPCX_ADC_CH3, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_BOARD_SKU_0] = { "BRD_SKU_0", NPCX_ADC_CH4, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { 4, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_KBLIGHT] = { 4, PWM_CONFIG_DSLEEP, 100 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "accelgyro",
- .port = I2C_PORT_GYRO,
- .kbps = 400,
- .scl = GPIO_EC_I2C_GYRO_SCL,
- .sda = GPIO_EC_I2C_GYRO_SDA
- },
- {
- .name = "sensors",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
- {
- .name = "batt",
- .port = NPCX_I2C_PORT3,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "accelgyro",
+ .port = I2C_PORT_GYRO,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_GYRO_SCL,
+ .sda = GPIO_EC_I2C_GYRO_SDA },
+ { .name = "sensors",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
+ { .name = "batt",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -303,17 +289,21 @@ static int ps8751_tune_mux(const struct usb_mux *me)
return EC_SUCCESS;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
- .usb_port = USB_PD_PORT_ANX74XX,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_ANX74XX,
+ .driver = &anx74xx_tcpm_usb_mux_driver,
+ .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_PS8751] = {
- .usb_port = USB_PD_PORT_PS8751,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .board_init = &ps8751_tune_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_PS8751,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .board_init = &ps8751_tune_mux,
+ },
}
};
@@ -419,28 +409,28 @@ static void board_tcpc_init(void)
gpio_enable_interrupt(GPIO_USB_C0_CABLE_DET);
#endif
/*
- * Initialize HPD to low; after sysjump SOC needs to see
- * HPD pulse to enable video path
- */
+ * Initialize HPD to low; after sysjump SOC needs to see
+ * HPD pulse to enable video path
+ */
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_DEFAULT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -564,8 +554,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
@@ -577,8 +567,8 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
return;
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -688,17 +678,17 @@ void board_hibernate_late(void)
int i;
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs in hibernate */
- {GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN},
+ { GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN },
/*
* BD99956 handles charge input automatically. We'll disable
* charge output in hibernate. Charger will assert ACOK_OD
* when VBUS or VCC are plugged in.
*/
- {GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
- {GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
+ { GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
+ { GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
};
/* Change GPIOs' state in hibernate for better power consumption */
@@ -725,17 +715,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t mag_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t mag_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -845,8 +831,8 @@ static void board_set_motion_sensor_count(uint8_t sku_id)
* sensor. If a new SKU id is used that is not in the table, then the
* number of motion sensors will remain as ARRAY_SIZE(motion_sensors).
*/
- motion_sensor_count = SKU_IS_CONVERTIBLE(sku_id) ?
- ARRAY_SIZE(motion_sensors) : 0;
+ motion_sensor_count =
+ SKU_IS_CONVERTIBLE(sku_id) ? ARRAY_SIZE(motion_sensors) : 0;
CPRINTS("Motion Sensor Count = %d", motion_sensor_count);
}
@@ -857,11 +843,11 @@ struct {
} const coral_board_versions[] = {
/* Vin = 3.3V, Ideal voltage, R2 values listed below */
/* R1 = 51.1 kOhm */
- { BOARD_VERSION_1, 200 }, /* 124 mV, 2.0 Kohm */
- { BOARD_VERSION_2, 366 }, /* 278 mV, 4.7 Kohm */
- { BOARD_VERSION_3, 550 }, /* 456 mV, 8.2 Kohm */
- { BOARD_VERSION_4, 752 }, /* 644 mV, 12.4 Kohm */
- { BOARD_VERSION_5, 927}, /* 860 mV, 18.0 Kohm */
+ { BOARD_VERSION_1, 200 }, /* 124 mV, 2.0 Kohm */
+ { BOARD_VERSION_2, 366 }, /* 278 mV, 4.7 Kohm */
+ { BOARD_VERSION_3, 550 }, /* 456 mV, 8.2 Kohm */
+ { BOARD_VERSION_4, 752 }, /* 644 mV, 12.4 Kohm */
+ { BOARD_VERSION_5, 927 }, /* 860 mV, 18.0 Kohm */
{ BOARD_VERSION_6, 1073 }, /* 993 mV, 22.0 Kohm */
{ BOARD_VERSION_7, 1235 }, /* 1152 mV, 27.4 Kohm */
{ BOARD_VERSION_8, 1386 }, /* 1318 mV, 34.0 Kohm */
@@ -948,15 +934,15 @@ static void print_form_factor_list(int low, int high)
if (high > 255)
high = 255;
for (id = low; id <= high; id++) {
- ccprintf("SKU ID %03d: %s\n", id, SKU_IS_CONVERTIBLE(id) ?
- "Convertible" : "Clamshell");
+ ccprintf("SKU ID %03d: %s\n", id,
+ SKU_IS_CONVERTIBLE(id) ? "Convertible" : "Clamshell");
/* Don't print too many lines at once */
if (!(++count % 5))
msleep(20);
}
}
-static int command_sku(int argc, char **argv)
+static int command_sku(int argc, const char **argv)
{
enum adc_channel chan;
@@ -999,8 +985,7 @@ static int command_sku(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(sku, command_sku,
- "<board|line0|line1|form [low high]>",
+DECLARE_CONSOLE_COMMAND(sku, command_sku, "<board|line0|line1|form [low high]>",
"Get board id, sku, form factor");
__override uint32_t board_get_sku_id(void)
diff --git a/board/coral/board.h b/board/coral/board.h
index 4a1709e7a9..bc6226152c 100644
--- a/board/coral/board.h
+++ b/board/coral/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages except Events:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_EVENTS))
+#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_EVENTS))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -23,14 +23,14 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_CMD_BATT_MFG_ACCESS
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define BD9995X_IOUT_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
#define CONFIG_CHARGER_PSYS_READ
#define BD9995X_PSYS_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
#define CONFIG_CMD_I2C_STRESS_TEST
#define CONFIG_CMD_I2C_STRESS_TEST_ACCEL
@@ -44,7 +44,7 @@
#define CONFIG_PORT80_HISTORY_LEN 256
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_HW_PRESENT_CUSTOM
#define CONFIG_BATTERY_LEVEL_NEAR_FULL 94
@@ -90,7 +90,7 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
-#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
+#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
#define CONFIG_USB_PD_TCPM_ANX3429
#define CONFIG_USB_PD_TCPM_PS8751
#define CONFIG_USB_PD_TCPM_TCPCI
@@ -117,11 +117,11 @@
/* EC */
#define CONFIG_ADC
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_FPU
/* Region sizes are not a power of 2 so we can't use MPU */
-#undef CONFIG_MPU
+#undef CONFIG_MPU
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
@@ -150,7 +150,7 @@
#define CONFIG_WIRELESS
#define CONFIG_WIRELESS_SUSPEND EC_WIRELESS_SWITCH_WLAN_POWER
#define CONFIG_WLAN_POWER_ACTIVE_LOW
-#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
+#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
#define CONFIG_PWR_STATE_DISCHARGE_FULL
/*
@@ -168,7 +168,7 @@
#define CONFIG_FLASH_SIZE_BYTES 524288
#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */
+#define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */
/*
* Enable 1 slot of secure temporary storage to support
@@ -178,19 +178,19 @@
#define CONFIG_VSTORE_SLOT_COUNT 1
/* Optional feature - used by nuvoton */
-#define NPCX_UART_MODULE2 1 /* 0:GPIO10/11 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
+#define NPCX_UART_MODULE2 1 /* 0:GPIO10/11 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
/* FIXME(dhendrix): these pins are just normal GPIOs on Coral. Do we need
* to change some other setting to put them in GPIO mode? */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* I2C ports */
-#define I2C_PORT_GYRO NPCX_I2C_PORT1
-#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
-#define I2C_PORT_BATTERY NPCX_I2C_PORT3
-#define I2C_PORT_CHARGER NPCX_I2C_PORT3
+#define I2C_PORT_GYRO NPCX_I2C_PORT1
+#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
+#define I2C_PORT_BATTERY NPCX_I2C_PORT3
+#define I2C_PORT_CHARGER NPCX_I2C_PORT3
/* Accelerometer and Gyroscope are the same device. */
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
/* Sensors */
#define CONFIG_MKBP_EVENT
@@ -213,7 +213,6 @@
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -221,11 +220,11 @@
/* ADC signal */
enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER, /* ADC0 */
- ADC_TEMP_SENSOR_AMB, /* ADC1 */
- ADC_BOARD_ID, /* ADC2 */
- ADC_BOARD_SKU_1, /* ADC3 */
- ADC_BOARD_SKU_0, /* ADC4 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC0 */
+ ADC_TEMP_SENSOR_AMB, /* ADC1 */
+ ADC_BOARD_ID, /* ADC2 */
+ ADC_BOARD_SKU_1, /* ADC3 */
+ ADC_BOARD_SKU_0, /* ADC4 */
ADC_CH_COUNT
};
@@ -283,16 +282,16 @@ enum coral_board_version {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Reset PD MCU */
void board_reset_pd_mcu(void);
diff --git a/board/coral/build.mk b/board/coral/build.mk
index 728d027803..470e439b13 100644
--- a/board/coral/build.mk
+++ b/board/coral/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/coral/ec.tasklist b/board/coral/ec.tasklist
index eeebc0cc59..bc8668a1db 100644
--- a/board/coral/ec.tasklist
+++ b/board/coral/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coral/gpio.inc b/board/coral/gpio.inc
index da15615c86..7f09fe0735 100644
--- a/board/coral/gpio.inc
+++ b/board/coral/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/coral/led.c b/board/coral/led.c
index 2a1e39946c..8af0f6f3e2 100644
--- a/board/coral/led.c
+++ b/board/coral/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -28,8 +28,7 @@
#define LED_POWER_ON_TICKS (LED_POWER_BLINK_ON_MSEC / HOOK_TICK_INTERVAL_MS)
#define LED_POWER_OFF_TICKS (LED_POWER_BLINK_OFF_MSEC / HOOK_TICK_INTERVAL_MS)
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -37,18 +36,14 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
#define GPIO_LED_COLOR_2 GPIO_BAT_LED_BLUE
#define GPIO_LED_COLOR_3 GPIO_POW_LED
-enum led_phase {
- LED_PHASE_0,
- LED_PHASE_1,
- LED_NUM_PHASES
-};
+enum led_phase { LED_PHASE_0, LED_PHASE_1, LED_NUM_PHASES };
enum led_color {
LED_OFF,
LED_COLOR_1,
LED_COLOR_2,
LED_COLOR_BOTH,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
enum led_states {
@@ -85,37 +80,37 @@ struct led_info {
/* COLOR_1 = Amber, COLOR_2 = Blue */
static const struct led_descriptor led_default_state_table[][LED_NUM_PHASES] = {
- { {LED_COLOR_1, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_COLOR_1, LED_INDEFINITE} },
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_1, 1 * LED_ONE_SEC }, {LED_OFF, 3 * LED_ONE_SEC} },
- { {LED_OFF, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_1, 1 * LED_ONE_SEC}, {LED_OFF, 1 * LED_ONE_SEC} },
- { {LED_COLOR_1, 2 * LED_ONE_SEC}, {LED_COLOR_2, 2 * LED_ONE_SEC} },
+ { { LED_COLOR_1, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_COLOR_1, LED_INDEFINITE } },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_1, 1 * LED_ONE_SEC }, { LED_OFF, 3 * LED_ONE_SEC } },
+ { { LED_OFF, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_1, 1 * LED_ONE_SEC }, { LED_OFF, 1 * LED_ONE_SEC } },
+ { { LED_COLOR_1, 2 * LED_ONE_SEC }, { LED_COLOR_2, 2 * LED_ONE_SEC } },
};
/* COLOR_1 = Green, COLOR_2 = Red */
static const struct led_descriptor led_robo_state_table[][LED_NUM_PHASES] = {
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_BOTH, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_1, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_OFF, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_OFF, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_OFF, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_2, 1 * LED_ONE_SEC}, {LED_OFF, 1 * LED_ONE_SEC} },
- { {LED_COLOR_2, 2 * LED_ONE_SEC}, {LED_COLOR_1, 2 * LED_ONE_SEC} },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_BOTH, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_1, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_OFF, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_OFF, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_OFF, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_2, 1 * LED_ONE_SEC }, { LED_OFF, 1 * LED_ONE_SEC } },
+ { { LED_COLOR_2, 2 * LED_ONE_SEC }, { LED_COLOR_1, 2 * LED_ONE_SEC } },
};
static const struct led_descriptor led_nasher_state_table[][LED_NUM_PHASES] = {
- { {LED_COLOR_1, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_COLOR_1, LED_INDEFINITE} },
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_2, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_2, 1 * LED_ONE_SEC}, {LED_OFF, 1 * LED_ONE_SEC} },
- { {LED_OFF, LED_INDEFINITE}, {LED_OFF, LED_INDEFINITE} },
- { {LED_COLOR_1, 1 * LED_ONE_SEC}, {LED_OFF, 1 * LED_ONE_SEC} },
- { {LED_COLOR_1, 2 * LED_ONE_SEC}, {LED_COLOR_2, 2 * LED_ONE_SEC} },
+ { { LED_COLOR_1, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_COLOR_1, LED_INDEFINITE } },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_2, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_2, 1 * LED_ONE_SEC }, { LED_OFF, 1 * LED_ONE_SEC } },
+ { { LED_OFF, LED_INDEFINITE }, { LED_OFF, LED_INDEFINITE } },
+ { { LED_COLOR_1, 1 * LED_ONE_SEC }, { LED_OFF, 1 * LED_ONE_SEC } },
+ { { LED_COLOR_1, 2 * LED_ONE_SEC }, { LED_COLOR_2, 2 * LED_ONE_SEC } },
};
static struct led_info led;
@@ -176,7 +171,7 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
static enum led_states led_get_state(void)
{
- int charge_lvl;
+ int charge_lvl;
enum led_states new_state = LED_NUM_STATES;
switch (charge_get_state()) {
@@ -185,7 +180,8 @@ static enum led_states led_get_state(void)
charge_lvl = charge_get_percent();
/* Determine which charge state to use */
new_state = charge_lvl <= led.charge_lvl_1 ?
- STATE_CHARGING_LVL_1 : STATE_CHARGING_LVL_2;
+ STATE_CHARGING_LVL_1 :
+ STATE_CHARGING_LVL_2;
break;
case PWR_STATE_DISCHARGE_FULL:
if (extpower_is_present()) {
@@ -208,10 +204,10 @@ static enum led_states led_get_state(void)
new_state = STATE_CHARGING_LVL_3;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)
- new_state = STATE_FACTORY_TEST;
- else
- new_state = STATE_DISCHARGE_S0;
+ new_state = STATE_DISCHARGE_S0;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ new_state = STATE_FACTORY_TEST;
break;
default:
/* Other states don't alter LED behavior */
@@ -248,11 +244,13 @@ static void led_update_battery(void)
int period;
period = led.state_table[led.state][LED_PHASE_0].time +
- led.state_table[led.state][LED_PHASE_1].time;
+ led.state_table[led.state][LED_PHASE_1].time;
if (period)
- phase = ticks % period <
- led.state_table[led.state][LED_PHASE_0].time ?
- 0 : 1;
+ phase = ticks % period < led.state_table[led.state]
+ [LED_PHASE_0]
+ .time ?
+ 0 :
+ 1;
}
/* Set the color for the given state and phase */
@@ -278,8 +276,8 @@ static void led_robo_update_power(void)
* power LED is off for 600 msec, on for 3 seconds.
*/
period = LED_POWER_ON_TICKS + LED_POWER_OFF_TICKS;
- level = ticks % period < LED_POWER_OFF_TICKS ?
- LED_OFF_LVL : LED_ON_LVL;
+ level = ticks % period < LED_POWER_OFF_TICKS ? LED_OFF_LVL :
+ LED_ON_LVL;
ticks++;
} else {
level = LED_OFF_LVL;
diff --git a/board/coral/sku.h b/board/coral/sku.h
index 4588932377..c12777a2f7 100644
--- a/board/coral/sku.h
+++ b/board/coral/sku.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_SKU_H
#define __CROS_EC_SKU_H
-#define SKU_CONVERTIBLE(id) (1 << ((id) & 0x7))
+#define SKU_CONVERTIBLE(id) (1 << ((id)&0x7))
/*
* There are 256 possible SKUs for Coral. This table is used to map a given SKU
@@ -22,7 +22,7 @@ static const uint8_t form_factor[32] = {
SKU_CONVERTIBLE(4) | SKU_CONVERTIBLE(5),
/* SKU 8 - 15 */
SKU_CONVERTIBLE(8) | SKU_CONVERTIBLE(9) | SKU_CONVERTIBLE(10) |
- SKU_CONVERTIBLE(11),
+ SKU_CONVERTIBLE(11),
/* SKU 16 - 23 */
0x00,
/* SKU 24 - 31 */
@@ -61,7 +61,7 @@ static const uint8_t form_factor[32] = {
0x00,
/* SKU 160 - 167 */
SKU_CONVERTIBLE(163) | SKU_CONVERTIBLE(164) | SKU_CONVERTIBLE(165) |
- SKU_CONVERTIBLE(166),
+ SKU_CONVERTIBLE(166),
/* SKU 168 - 175 */
0x00,
/* SKU 176 - 183 */
@@ -86,6 +86,6 @@ static const uint8_t form_factor[32] = {
0x00,
};
-#define SKU_IS_CONVERTIBLE(id) ((form_factor[(id) >> 3] >> ((id) & 0x7)) & 1)
+#define SKU_IS_CONVERTIBLE(id) ((form_factor[(id) >> 3] >> ((id)&0x7)) & 1)
#endif /* __CROS_EC_SKU_H */
diff --git a/board/coral/usb_pd_policy.c b/board/coral/usb_pd_policy.c
index e071f6ae2a..a2e1f3c412 100644
--- a/board/coral/usb_pd_policy.c
+++ b/board/coral/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,12 +23,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -39,7 +39,8 @@ static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN;
int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) : (GPIO_OUTPUT | GPIO_PULL_UP);
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
/*
* Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
diff --git a/board/corori/battery.c b/board/corori/battery.c
index 405a69751a..f4e126d42e 100644
--- a/board/corori/battery.c
+++ b/board/corori/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/corori/board.c b/board/corori/board.c
index 3453fccef4..4fe1e01fec 100644
--- a/board/corori/board.c
+++ b/board/corori/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,14 +40,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
-#define ADC_VOL_UP_MASK BIT(0)
-#define ADC_VOL_DOWN_MASK BIT(1)
-
+#define ADC_VOL_UP_MASK BIT(0)
+#define ADC_VOL_DOWN_MASK BIT(1)
/******************************************************************************/
/* USB-A Configuration */
@@ -73,8 +72,8 @@ static const struct ec_response_keybd_config corori_keybd = {
/* No function keys, no numeric keypad, no screenlock key */
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &corori_keybd;
}
@@ -115,7 +114,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -154,22 +152,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
@@ -186,8 +184,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -249,13 +247,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -315,8 +311,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -353,9 +349,8 @@ void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -399,12 +394,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
};
@@ -446,46 +444,36 @@ static void board_extpower(void)
DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
-
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C_BATTERY_SCL,
- .sda = GPIO_EC_I2C_BATTERY_SDA
- },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+
+ { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BATTERY_SCL,
+ .sda = GPIO_EC_I2C_BATTERY_SDA },
#ifdef HAS_TASK_MOTIONSENSE
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
#endif
- {
- .name = "usbc0",
- .port = I2C_PORT_USB_C0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_SCL,
- .sda = GPIO_EC_I2C_USB_C0_SDA
- },
+ { .name = "usbc0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_SDA },
#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- {
- .name = "sub_usbc1",
- .port = I2C_PORT_SUB_USB_C1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_SUB_USB_C1_SCL,
- .sda = GPIO_EC_I2C_SUB_USB_C1_SDA
- },
+ { .name = "sub_usbc1",
+ .port = I2C_PORT_SUB_USB_C1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_SUB_USB_C1_SCL,
+ .sda = GPIO_EC_I2C_SUB_USB_C1_SDA },
#endif
};
diff --git a/board/corori/board.h b/board/corori/board.h
index 42d242abee..75e0e4eec6 100644
--- a/board/corori/board.h
+++ b/board/corori/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,6 +22,7 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#undef CONFIG_CMD_CHARGER_DUMP
@@ -34,9 +35,8 @@
#define GPIO_BAT_LED_AMBER GPIO_LED_Y_ODL
#define GPIO_PWR_LED_WHITE GPIO_LED_W_ODL
-
/* PWM */
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -65,16 +65,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -89,17 +89,13 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
enum battery_type {
BATTERY_C21N2018,
diff --git a/board/corori/build.mk b/board/corori/build.mk
index b012d8d502..eb422dae93 100644
--- a/board/corori/build.mk
+++ b/board/corori/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/corori/cbi_ssfc.c b/board/corori/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/corori/cbi_ssfc.c
+++ b/board/corori/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/corori/cbi_ssfc.h b/board/corori/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/corori/cbi_ssfc.h
+++ b/board/corori/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/corori/ec.tasklist b/board/corori/ec.tasklist
index 0025c2985b..386e8625b3 100644
--- a/board/corori/ec.tasklist
+++ b/board/corori/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/corori/gpio.inc b/board/corori/gpio.inc
index 5f6f119648..038c70243f 100644
--- a/board/corori/gpio.inc
+++ b/board/corori/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/corori/led.c b/board/corori/led.c
index 96a43caa76..89799c8e74 100644
--- a/board/corori/led.c
+++ b/board/corori/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,20 +19,16 @@
#define LED_ON_LVL 0
#define LED_OFF_LVL 1
-#define LED_INDEFINITE UINT8_MAX
-#define LED_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
-#define LED_OFF EC_LED_COLOR_COUNT
+#define LED_INDEFINITE UINT8_MAX
+#define LED_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
+#define LED_OFF EC_LED_COLOR_COUNT
struct led_descriptor {
enum ec_led_colors color;
uint8_t time;
};
-enum led_phase {
- LED_PHASE_0,
- LED_PHASE_1,
- LED_NUM_PHASES
-};
+enum led_phase { LED_PHASE_0, LED_PHASE_1, LED_NUM_PHASES };
enum led_states {
STATE_CHARGING,
@@ -47,28 +43,32 @@ enum led_states {
};
static const struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_BATTERY_S0_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_BATTERY_S3_BLINK] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_BATTERY_S5_OFF] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING] = { { EC_LED_COLOR_AMBER, LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_BATTERY_S0_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_BATTERY_S3_BLINK] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_BATTERY_S5_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
static int led_get_charge_percent(void)
{
return DIV_ROUND_NEAREST(charge_get_display_charge(), 10);
@@ -131,7 +131,8 @@ static enum led_states led_get_state(void)
case PWR_STATE_DISCHARGE /* and PWR_STATE_DISCHARGE_FULL */:
if (chipset_in_state(CHIPSET_STATE_ON))
new_state = (led_get_charge_percent() < 10) ?
- STATE_DISCHARGE_S0_BAT_LOW : STATE_DISCHARGE_S0;
+ STATE_DISCHARGE_S0_BAT_LOW :
+ STATE_DISCHARGE_S0;
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
new_state = STATE_BATTERY_S3_BLINK;
else
@@ -149,10 +150,10 @@ static enum led_states led_get_state(void)
new_state = STATE_CHARGING_FULL_CHARGE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)
- new_state = STATE_FACTORY_TEST;
- else
- new_state = STATE_DISCHARGE_S0;
+ new_state = STATE_DISCHARGE_S0;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ new_state = STATE_FACTORY_TEST;
break;
default:
/* Other states don't alter LED behavior */
@@ -182,8 +183,7 @@ static void led_update_battery(void)
ticks = 0;
period = led_bat_state_table[led_state][LED_PHASE_0].time +
- led_bat_state_table[led_state][LED_PHASE_1].time;
-
+ led_bat_state_table[led_state][LED_PHASE_1].time;
}
/* If this state is undefined, turn the LED off */
@@ -196,8 +196,8 @@ static void led_update_battery(void)
* Determine which phase of the state table to use. The phase is
* determined if it falls within first phase time duration.
*/
- phase = ticks < led_bat_state_table[led_state][LED_PHASE_0].time ?
- 0 : 1;
+ phase = ticks < led_bat_state_table[led_state][LED_PHASE_0].time ? 0 :
+ 1;
ticks = (ticks + 1) % period;
/* Set the color for the given state and phase */
diff --git a/board/corori/usb_pd_policy.c b/board/corori/usb_pd_policy.c
index fd9018a3f0..3410726e87 100644
--- a/board/corori/usb_pd_policy.c
+++ b/board/corori/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/corori2/battery.c b/board/corori2/battery.c
index 1263e4cef0..a59663c751 100644
--- a/board/corori2/battery.c
+++ b/board/corori2/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/corori2/board.c b/board/corori2/board.c
index 0ccd3c3ebc..efebc3af2e 100644
--- a/board/corori2/board.c
+++ b/board/corori2/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -85,7 +85,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -120,7 +119,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
@@ -167,22 +165,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [ADC_TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [ADC_TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [ADC_TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [ADC_TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_MEMORY \
- { \
+#define THERMAL_MEMORY \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
@@ -200,8 +198,8 @@ __maybe_unused static const struct ec_thermal_config thermal_memory =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
@@ -234,16 +232,17 @@ void board_init(void)
if (get_cbi_fw_config_db() == DB_1A_HDMI) {
/* Disable i2c on HDMI pins */
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0);
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
+ 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
+ 0);
/* Set HDMI and sub-rail enables to output */
gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
chipset_in_state(CHIPSET_STATE_ON) ?
- GPIO_ODR_LOW : GPIO_ODR_HIGH);
- gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
+ GPIO_ODR_LOW :
+ GPIO_ODR_HIGH);
+ gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
/* Select HDMI option */
gpio_set_level(GPIO_HDMI_SEL_L, 0);
@@ -252,8 +251,7 @@ void board_init(void)
gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL);
} else {
/* Set SDA as an input */
- gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
- GPIO_INPUT);
+ gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, GPIO_INPUT);
/* Enable C1 interrupt and check if it needs processing */
gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
@@ -320,7 +318,7 @@ static void reconfigure_5v_gpio(void)
gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_OUT_LOW);
}
}
-DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C + 1);
#endif /* BOARD_WADDLEDOO */
static void set_5v_gpio(int level)
@@ -361,10 +359,9 @@ __override void board_power_5v_enable(int enable)
gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
} else {
if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTS("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
-
}
__override uint8_t board_get_usb_pd_port_count(void)
@@ -389,13 +386,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -459,8 +454,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -485,17 +480,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
@@ -571,9 +562,8 @@ struct motion_sensor_t motion_sensors[] = {
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -660,25 +650,34 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ },
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
}
};
@@ -704,7 +703,7 @@ uint16_t tcpc_get_alert_status(void)
}
if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
+ !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
diff --git a/board/corori2/board.h b/board/corori2/board.h
index 1e24d5eb71..0fc4423020 100644
--- a/board/corori2/board.h
+++ b/board/corori2/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,7 @@
/* Save some flash space */
#define CONFIG_CHIP_INIT_ROM_REGION
-#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CONSOLE_CMDHELP
#define CONFIG_DEBUG_ASSERT_BRIEF
#define CONFIG_USB_PD_DEBUG_LEVEL 2
@@ -35,11 +35,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -68,7 +71,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -98,23 +101,22 @@
#undef PD_POWER_SUPPLY_TURN_OFF_DELAY
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
/* 20% margin added for these timings */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
-
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -128,13 +130,13 @@
#define GPIO_EC_I2C_SUB_USB_C1_SDA GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -161,25 +163,16 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
diff --git a/board/corori2/build.mk b/board/corori2/build.mk
index af526189dd..1512a49379 100644
--- a/board/corori2/build.mk
+++ b/board/corori2/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/corori2/cbi_ssfc.c b/board/corori2/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/corori2/cbi_ssfc.c
+++ b/board/corori2/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/corori2/cbi_ssfc.h b/board/corori2/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/corori2/cbi_ssfc.h
+++ b/board/corori2/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/corori2/ec.tasklist b/board/corori2/ec.tasklist
index d4fb416bce..29666dd959 100644
--- a/board/corori2/ec.tasklist
+++ b/board/corori2/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/corori2/gpio.inc b/board/corori2/gpio.inc
index 78d41aab16..63b16a1bc3 100644
--- a/board/corori2/gpio.inc
+++ b/board/corori2/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/corori2/led.c b/board/corori2/led.c
index 3c27bf0f8e..71a8159a07 100644
--- a/board/corori2/led.c
+++ b/board/corori2/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,13 +20,10 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* both LEDs being off.
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Amber, White */
- [EC_LED_COLOR_RED] = { 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 0, 100 },
- [EC_LED_COLOR_AMBER] = { 100, 0 },
+ /* Amber, White */
+ [EC_LED_COLOR_RED] = { 0, 0 }, [EC_LED_COLOR_GREEN] = { 0, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0 }, [EC_LED_COLOR_YELLOW] = { 0, 0 },
+ [EC_LED_COLOR_WHITE] = { 0, 100 }, [EC_LED_COLOR_AMBER] = { 100, 0 },
};
/* One logical LED with amber and white channels. */
diff --git a/board/corori2/usb_pd_policy.c b/board/corori2/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/corori2/usb_pd_policy.c
+++ b/board/corori2/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/cret/battery.c b/board/cret/battery.c
index ee5def4183..27bfed5355 100644
--- a/board/cret/battery.c
+++ b/board/cret/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -638,8 +638,8 @@ const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_BYD_1VX1H;
int charger_profile_override(struct charge_state_data *curr)
{
if (chipset_in_state(CHIPSET_STATE_ON)) {
- curr->requested_current = MIN(curr->requested_current,
- CHARGING_CURRENT_1100MA);
+ curr->requested_current =
+ MIN(curr->requested_current, CHARGING_CURRENT_1100MA);
}
return 0;
diff --git a/board/cret/board.c b/board/cret/board.c
index 57bddae55e..c9c34d6d32 100644
--- a/board/cret/board.c
+++ b/board/cret/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -86,7 +86,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
@@ -202,7 +201,7 @@ static void reconfigure_5v_gpio(void)
gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_OUT_LOW);
}
}
-DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C + 1);
#endif /* BOARD_WADDLEDOO */
static void set_5v_gpio(int level)
@@ -220,7 +219,6 @@ __override void board_power_5v_enable(int enable)
* DB.
*/
set_5v_gpio(!!enable);
-
}
__override uint8_t board_get_usb_pd_port_count(void)
@@ -239,13 +237,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -308,8 +304,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -334,17 +330,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static struct stprivate_data g_lis2dh_data;
static struct lsm6dso_data lsm6dso_data;
@@ -424,20 +416,19 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -489,12 +480,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.drv = &raa489000_tcpm_drv,
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
};
@@ -568,8 +562,8 @@ static const struct ec_response_keybd_config cret_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &cret_keybd;
}
diff --git a/board/cret/board.h b/board/cret/board.h
index 69394fe218..2080185c7c 100644
--- a/board/cret/board.h
+++ b/board/cret/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,6 +29,7 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
@@ -47,7 +48,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* USB */
#define CONFIG_BC12_DETECT_PI3USB9201
@@ -74,23 +75,22 @@
#undef PD_POWER_SUPPLY_TURN_OFF_DELAY
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
/* 20% margin added for these timings */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
-
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -98,18 +98,17 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
#define CONFIG_LID_ANGLE
@@ -132,24 +131,15 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
diff --git a/board/cret/build.mk b/board/cret/build.mk
index af526189dd..1512a49379 100644
--- a/board/cret/build.mk
+++ b/board/cret/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/cret/cbi_ssfc.c b/board/cret/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/cret/cbi_ssfc.c
+++ b/board/cret/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/cret/cbi_ssfc.h b/board/cret/cbi_ssfc.h
index 058290de8d..bef606bc72 100644
--- a/board/cret/cbi_ssfc.h
+++ b/board/cret/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -61,5 +61,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/cret/ec.tasklist b/board/cret/ec.tasklist
index ee5333eb17..a98ca6fd86 100644
--- a/board/cret/ec.tasklist
+++ b/board/cret/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cret/gpio.inc b/board/cret/gpio.inc
index 352f689620..5f39fedc80 100644
--- a/board/cret/gpio.inc
+++ b/board/cret/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/cret/led.c b/board/cret/led.c
index edfb4ac761..8a7a343fb3 100644
--- a/board/cret/led.c
+++ b/board/cret/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,8 +8,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 10;
@@ -17,23 +17,32 @@ __override const int led_charge_lvl_2 = 100;
/* Cret: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/cret/usb_pd_policy.c b/board/cret/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/cret/usb_pd_policy.c
+++ b/board/cret/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/crota/battery.c b/board/crota/battery.c
index 5bdf307b07..4738b5910f 100644
--- a/board/crota/battery.c
+++ b/board/crota/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -63,7 +63,7 @@ const struct board_batt_params board_battery_info[] = {
},
},
/* BYD 13076993-009 Battery Information */
- [BATTERY_BYD] = {
+ [BATTERY_BYD_GSL4] = {
.fuel_gauge = {
.manuf_name = "BYD",
.device_name = "DELL WV3K8",
@@ -210,7 +210,7 @@ const struct board_batt_params board_battery_info[] = {
/* SWD 1002000008482 Battery Information */
[BATTERY_SWD_ATL3] = {
.fuel_gauge = {
- .manuf_name = "SWD-ATL3.661",
+ .manuf_name = "SWD-ATL3.660",
.device_name = "DELL VKYJX",
.ship_mode = {
.reg_addr = 0x00,
@@ -323,6 +323,35 @@ const struct board_batt_params board_battery_info[] = {
.discharging_max_c = 70,
},
},
+ /* BYD 13148981-00 Battery Information */
+ [BATTERY_BYD_CSL4] = {
+ .fuel_gauge = {
+ .manuf_name = "BYD",
+ .device_name = "DELL JGCCT",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .mfgacc_support = 0,
+ .reg_addr = 0x00,
+ .reg_mask = 0x2000,
+ .disconnect_val = 0x2000,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 17400, /* mV */
+ .voltage_normal = 15000, /* mV */
+ .voltage_min = 12000, /* mV */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 60,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = 0,
+ .discharging_max_c = 70,
+ },
+ },
/* Sunwoda 1002000009262 Battery Information */
[BATTERY_SWD_ATL4] = {
.fuel_gauge = {
@@ -392,6 +421,11 @@ enum battery_present battery_hw_present(void)
batt_pres = GPIO_EC_BATT_PRES_ODL;
- /* The GPIO is low when the battery is physically present */
- return gpio_get_level(batt_pres) ? BP_NO : BP_YES;
+ /*
+ * The GPIO is low when the battery is physically present.
+ * But if battery cell voltage < 2.5V, it will not able to
+ * pull down EC_BATT_PRES_ODL. So we need to set pre-charge
+ * current even EC_BATT_PRES_ODL is high.
+ */
+ return gpio_get_level(batt_pres) ? BP_NOT_SURE : BP_YES;
}
diff --git a/board/crota/board.c b/board/crota/board.c
index 855eeabb81..04f64bd2a5 100644
--- a/board/crota/board.c
+++ b/board/crota/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,13 +10,12 @@
#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
-#include "extpower.h"
#include "gpio.h"
#include "gpio_signal.h"
#include "hooks.h"
#include "driver/accel_lis2dw12.h"
+#include "driver/accelgyro_bmi260.h"
#include "driver/accelgyro_lsm6dso.h"
-#include "driver/als_tcs3400.h"
#include "fw_config.h"
#include "hooks.h"
#include "lid_switch.h"
@@ -31,8 +30,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
__override void board_cbi_init(void)
{
@@ -56,23 +55,3 @@ static void board_chipset_suspend(void)
gpio_set_level(GPIO_EC_KB_BL_EN_L, 1);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-
-#ifdef CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK
-static void usb_port_startup(void)
-{
- gpio_set_level(GPIO_EN_PP5000_USBA_R, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, usb_port_startup, HOOK_PRIO_DEFAULT);
-
-static void usba_power(void)
-{
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
- if (extpower_is_present())
- gpio_set_level(GPIO_EN_PP5000_USBA_R, 1);
- else
- gpio_set_level(GPIO_EN_PP5000_USBA_R, 0);
- }
-}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, usba_power, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_AC_CHANGE, usba_power, HOOK_PRIO_DEFAULT);
-#endif /* CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK */
diff --git a/board/crota/board.h b/board/crota/board.h
index 46f3eb7755..0271a369bc 100644
--- a/board/crota/board.h
+++ b/board/crota/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,7 +22,11 @@
#define CONFIG_MP2964
/* Sensors */
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCELGYRO_BMI260 /* Base accel/gyro */
+#define CONFIG_ACCELGYRO_BMI260_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel/gyro */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -36,14 +40,14 @@
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_LIS2DWL
#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
#define CONFIG_BODY_DETECTION
-#define CONFIG_BODY_DETECTION_SENSOR BASE_ACCEL
+#define CONFIG_BODY_DETECTION_SENSOR BASE_ACCEL
#define CONFIG_BODY_DETECTION_VAR_NOISE_FACTOR 150 /* % */
#define CONFIG_GESTURE_DETECTION
#define CONFIG_GESTURE_DETECTION_MASK BIT(CONFIG_BODY_DETECTION_SENSOR)
@@ -54,16 +58,15 @@
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
-#define CONFIG_USB_PORT_POWER_DUMB_CUSTOM_HOOK
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USBC_RETIMER_INTEL_BB
@@ -78,17 +81,17 @@
#define CONFIG_USB_PD_FRS_PPC
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -96,35 +99,35 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-
-#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+
+#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
@@ -134,47 +137,48 @@
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+
+#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+/* define this to avoid error on CONFIG_ACCELGYRO_BMI_COMM_I2C */
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/*
* see b/174768555#comment22
*/
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
-#define USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR 0x54
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR 0x54
/* Type-C connector facing Burnside Bridge retimer */
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
-/*
- * TODO: b/229934138, Disable BBR firmware update temporarily.
- */
/* Retimer */
-#undef CONFIG_USBC_RETIMER_FW_UPDATE
+#define CONFIG_USBC_RETIMER_FW_UPDATE
/* Thermal features */
#define CONFIG_THERMISTOR
@@ -182,59 +186,55 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
-
/* LED defines */
#define CONFIG_LED_ONOFF_STATES
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+/* Fan features */
+#define CONFIG_CUSTOM_FAN_CONTROL
+#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FAN_DYNAMIC
+#define RPM_DEVIATION 1
+
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
+#define CONFIG_CHARGER_BQ25710_PP_ACOK
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1_DDR_SOC,
- ADC_TEMP_SENSOR_2_AMBIENT,
+ ADC_TEMP_SENSOR_1_SOC,
+ ADC_TEMP_SENSOR_2_DDR,
ADC_TEMP_SENSOR_3_CHARGER,
- ADC_TEMP_SENSOR_4_WWAN,
+ ADC_TEMP_SENSOR_4_AMBIENT,
ADC_CH_COUNT
};
enum temp_sensor_id {
- TEMP_SENSOR_1_DDR_SOC,
- TEMP_SENSOR_2_AMBIENT,
+ TEMP_SENSOR_1_SOC,
+ TEMP_SENSOR_2_DDR,
TEMP_SENSOR_3_CHARGER,
- TEMP_SENSOR_4_WWAN,
+ TEMP_SENSOR_4_AMBIENT,
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
enum battery_type {
BATTERY_ATL,
- BATTERY_BYD,
+ BATTERY_BYD_GSL4,
BATTERY_COM,
BATTERY_LGC,
BATTERY_SMP_ATL3,
@@ -243,29 +243,35 @@ enum battery_type {
BATTERY_SWD_COS3,
BATTERY_SMP_ATL4,
BATTERY_SMP_COS4,
+ BATTERY_BYD_CSL4,
BATTERY_SWD_ATL4,
BATTERY_SWD_COS4,
BATTERY_TYPE_COUNT
};
enum pwm_channel {
- PWM_CH_LED2 = 0, /* PWM0 (white charger) */
- PWM_CH_LED1, /* PWM2 (orange charger) */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED2 = 0, /* PWM0 (white charger) */
+ PWM_CH_LED1, /* PWM2 (orange charger) */
+ PWM_CH_KBLIGHT, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
+enum fan_rpm_table {
+ RPM_TABLE_CPU0,
+ RPM_TABLE_CPU1,
+ RPM_TABLE_DDR,
+ RPM_TABLE_CHARGER,
+ RPM_TABLE_AMBIENT,
+ FAN_RPM_TABLE_COUNT
};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
+
+void motion_interrupt(enum gpio_signal signal);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/crota/build.mk b/board/crota/build.mk
index cd6a38a852..8b85854cf0 100644
--- a/board/crota/build.mk
+++ b/board/crota/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/crota/charger.c b/board/crota/charger.c
index e6a5c446d7..c7dcf7b0c1 100644
--- a/board/crota/charger.c
+++ b/board/crota/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -84,7 +83,6 @@ int board_set_active_charge_port(int port)
__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/crota/ec.tasklist b/board/crota/ec.tasklist
index 296654d39d..17eeb4ae7c 100644
--- a/board/crota/ec.tasklist
+++ b/board/crota/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/crota/fans.c b/board/crota/fans.c
index 27f5bca929..17e19dc863 100644
--- a/board/crota/fans.c
+++ b/board/crota/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,6 +12,16 @@
#include "fan.h"
#include "hooks.h"
#include "pwm.h"
+#include "timer.h"
+#include "thermal.h"
+#include "util.h"
+
+#define SENSOR_SOC_FAN_OFF 30
+#define SENSOR_SOC_FAN_MID 47
+#define SENSOR_SOC_FAN_MAX 53
+#define SENSOR_DDR_FAN_TURN_OFF 37
+#define SENSOR_DDR_FAN_TURN_ON 38
+#define RECORD_TIME (2 * MINUTE)
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
@@ -25,65 +35,152 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
-/*
- * TOOD(b/181271666): thermistor placement and calibration
- *
- * Prototype fan spins at about 4200 RPM at 100% PWM, this
- * is specific to board ID 2 and might also apears in later
- * boards as well.
- */
-static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 2200,
- .rpm_start = 2200,
- .rpm_max = 4200,
+static const struct fan_rpm rpm_table[FAN_RPM_TABLE_COUNT] = {
+ [RPM_TABLE_CPU0] = {
+ .rpm_min = 2200,
+ .rpm_start = 2200,
+ .rpm_max = 3700,
+ },
+
+ [RPM_TABLE_CPU1] = {
+ .rpm_min = 3700,
+ .rpm_start = 3700,
+ .rpm_max = 4000,
+ },
+
+ [RPM_TABLE_DDR] = {
+ .rpm_min = 4000,
+ .rpm_start = 4000,
+ .rpm_max = 4200,
+ },
+
+ [RPM_TABLE_CHARGER] = {
+ .rpm_min = 4000,
+ .rpm_start = 4000,
+ .rpm_max = 4200,
+ },
+
+ [RPM_TABLE_AMBIENT] = {
+ .rpm_min = 4000,
+ .rpm_start = 4000,
+ .rpm_max = 4200,
+ },
};
-const struct fan_t fans[FAN_CH_COUNT] = {
+struct fan_t fans[FAN_CH_COUNT] = {
[FAN_CH_0] = {
.conf = &fan_conf_0,
- .rpm = &fan_rpm_0,
+ .rpm = &rpm_table[RPM_TABLE_CPU0],
},
};
-#ifndef CONFIG_FANS
-
-/*
- * TODO(b/181271666): use static fan speeds until fan and sensors are
- * tuned. for now, use:
- *
- * AP off: 33%
- * AP on: 100%
- */
-
-static void fan_slow(void)
+static void fan_get_rpm(int fan)
{
- const int duty_pct = 33;
-
- ccprints("%s: speed %d%%", __func__, duty_pct);
+ static timestamp_t deadline;
- pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, duty_pct);
+ /* Record actual RPM every 2 minutes. */
+ if (timestamp_expired(deadline, NULL)) {
+ ccprints("fan actual rpm: %d", fan_get_rpm_actual(FAN_CH(fan)));
+ deadline.val += RECORD_TIME;
+ }
}
-static void fan_max(void)
+static void fan_set_percent(int fan, int pct)
{
- const int duty_pct = 100;
+ int new_rpm;
- ccprints("%s: speed %d%%", __func__, duty_pct);
-
- pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, duty_pct);
+ new_rpm = fan_percent_to_rpm(fan, pct);
+ fan_set_rpm_target(FAN_CH(fan), new_rpm);
+ fan_get_rpm(fan);
}
-DECLARE_HOOK(HOOK_INIT, fan_slow, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, fan_slow, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, fan_slow, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_RESET, fan_max, HOOK_PRIO_FIRST);
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, fan_max, HOOK_PRIO_DEFAULT);
-
-#endif /* CONFIG_FANS */
+void board_override_fan_control(int fan, int *tmp)
+{
+ /*
+ * Crota's fan speed is control by four sensors.
+ *
+ * Sensor charger control the speed when system's temperature
+ * is too high.
+ * Other sensors control normal loading's speed.
+ *
+ * When sensor charger is triggered, the fan speed is only
+ * control by sensor charger, avoid heat damage to system.
+ * When other sensors is triggered, the fan is control
+ * by other sensors.
+ *
+ * Sensor SOC has two slopes for fan speed.
+ * Sensor DDR also become a fan on/off switch.
+ */
+ static int pct;
+ int sensor_soc;
+ int sensor_ddr;
+ int sensor_charger;
+ int sensor_ambient;
+
+ /* Decide sensor SOC temperature using which slope. */
+ if (tmp[TEMP_SENSOR_1_SOC] > SENSOR_SOC_FAN_MID) {
+ thermal_params[TEMP_SENSOR_1_SOC].temp_fan_off =
+ C_TO_K(SENSOR_SOC_FAN_MID);
+ thermal_params[TEMP_SENSOR_1_SOC].temp_fan_max =
+ C_TO_K(SENSOR_SOC_FAN_MAX);
+ } else {
+ thermal_params[TEMP_SENSOR_1_SOC].temp_fan_off =
+ C_TO_K(SENSOR_SOC_FAN_OFF);
+ thermal_params[TEMP_SENSOR_1_SOC].temp_fan_max =
+ C_TO_K(SENSOR_SOC_FAN_MID);
+ }
+
+ sensor_soc = thermal_fan_percent(
+ thermal_params[TEMP_SENSOR_1_SOC].temp_fan_off,
+ thermal_params[TEMP_SENSOR_1_SOC].temp_fan_max,
+ C_TO_K(tmp[TEMP_SENSOR_1_SOC]));
+ sensor_ddr = thermal_fan_percent(
+ thermal_params[TEMP_SENSOR_2_DDR].temp_fan_off,
+ thermal_params[TEMP_SENSOR_2_DDR].temp_fan_max,
+ C_TO_K(tmp[TEMP_SENSOR_2_DDR]));
+ sensor_charger = thermal_fan_percent(
+ thermal_params[TEMP_SENSOR_3_CHARGER].temp_fan_off,
+ thermal_params[TEMP_SENSOR_3_CHARGER].temp_fan_max,
+ C_TO_K(tmp[TEMP_SENSOR_3_CHARGER]));
+ sensor_ambient = thermal_fan_percent(
+ thermal_params[TEMP_SENSOR_4_AMBIENT].temp_fan_off,
+ thermal_params[TEMP_SENSOR_4_AMBIENT].temp_fan_max,
+ C_TO_K(tmp[TEMP_SENSOR_4_AMBIENT]));
+
+ /*
+ * Sensor DDR turn on when temperature > 38,
+ * turn off when temperature < 37
+ */
+ if ((tmp[TEMP_SENSOR_2_DDR]) < SENSOR_DDR_FAN_TURN_OFF) {
+ pct = 0;
+ } else if ((tmp[TEMP_SENSOR_2_DDR]) > SENSOR_DDR_FAN_TURN_ON) {
+ /*
+ * Decide which sensor was triggered and choose table.
+ * Priority: charger > soc > ddr > ambient
+ */
+ if (sensor_charger) {
+ fans[fan].rpm = &rpm_table[RPM_TABLE_CHARGER];
+ pct = sensor_charger;
+ } else if (sensor_soc) {
+ if (tmp[TEMP_SENSOR_1_SOC] > SENSOR_SOC_FAN_MID)
+ fans[fan].rpm = &rpm_table[RPM_TABLE_CPU1];
+ else
+ fans[fan].rpm = &rpm_table[RPM_TABLE_CPU0];
+ pct = sensor_soc;
+ } else if (sensor_ddr) {
+ fans[fan].rpm = &rpm_table[RPM_TABLE_DDR];
+ pct = sensor_ddr;
+ } else {
+ fans[fan].rpm = &rpm_table[RPM_TABLE_AMBIENT];
+ pct = sensor_ambient;
+ }
+ }
+
+ /* Transfer percent to rpm. */
+ fan_set_percent(fan, pct);
+}
diff --git a/board/crota/fw_config.c b/board/crota/fw_config.c
index 35fc466fd1..5feb8a2d3e 100644
--- a/board/crota/fw_config.c
+++ b/board/crota/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union brya_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/crota/fw_config.h b/board/crota/fw_config.h
index f441650ec6..407af32472 100644
--- a/board/crota/fw_config.h
+++ b/board/crota/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,10 +14,7 @@
* Source of truth is the project/brya/brya/config.star configuration file.
*/
-enum ec_cfg_usb_db_type {
- DB_USB_ABSENT = 0,
- DB_USB_ABSENT2 = 15
-};
+enum ec_cfg_usb_db_type { DB_USB_ABSENT = 0, DB_USB_ABSENT2 = 15 };
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
@@ -26,12 +23,12 @@ enum ec_cfg_keyboard_backlight_type {
union brya_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
- uint32_t sd_db : 2;
- uint32_t lte_db : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ enum ec_cfg_usb_db_type usb_db : 4;
+ uint32_t sd_db : 2;
+ uint32_t lte_db : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 21;
};
uint32_t raw_value;
};
diff --git a/board/crota/gpio.inc b/board/crota/gpio.inc
index 655fc68060..7668442b7b 100644
--- a/board/crota/gpio.inc
+++ b/board/crota/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,10 +10,10 @@
/* INTERRUPT GPIOs: */
GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt)
GPIO_INT(EC_ACCEL_INT_R_L, PIN(8, 1), GPIO_SEL_1P8V | GPIO_INT_FALLING, lis2dw12_interrupt)
-GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, lsm6dso_interrupt)
+GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, motion_interrupt)
GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt)
-GPIO_INT(EC_VOLDN_BTN_ODL, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-GPIO_INT(EC_VOLUP_BTN_ODL, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
+GPIO_INT(EC_VOLDN_BTN_ODL, PIN(9, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
+GPIO_INT(EC_VOLUP_BTN_ODL, PIN(9, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
GPIO_INT(GSC_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH | GPIO_HIB_WAKE_LOW, power_button_interrupt)
GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, lid_interrupt)
@@ -69,6 +69,7 @@ GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
GPIO(USB_C0_C1_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
+GPIO(EC_SENSOR_STRAP, PIN(5, 7), GPIO_INPUT)
/* UART alternate functions */
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
@@ -109,7 +110,6 @@ UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
UNUSED(PIN(6, 6)) /* GPIO66 */
-UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
UNUSED(PIN(D, 4)) /* GPIOD4/CR_SIN3 */
UNUSED(PIN(5, 0)) /* GPIO50 */
UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1 */
diff --git a/board/crota/i2c.c b/board/crota/i2c.c
index 1fc1126282..681e600bf2 100644
--- a/board/crota/i2c.c
+++ b/board/crota/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "hooks.h"
#include "i2c.h"
-#define BOARD_ID_FAST_PLUS_CAPABLE 2
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
@@ -63,19 +63,3 @@ const struct i2c_port_t i2c_ports[] = {
},
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
-/*
- * I2C controllers are initialized in main.c. This sets the speed much
- * later, but before I2C peripherals are initialized.
- */
-static void set_board_legacy_i2c_speeds(void)
-{
- if (get_board_id() >= BOARD_ID_FAST_PLUS_CAPABLE)
- return;
-
- ccprints("setting USB DB I2C buses to 400 kHz\n");
-
- i2c_set_freq(I2C_PORT_USB_C0_C1_TCPC, I2C_FREQ_400KHZ);
- i2c_set_freq(I2C_PORT_USB_C0_C1_PPC, I2C_FREQ_400KHZ);
-}
-DECLARE_HOOK(HOOK_INIT, set_board_legacy_i2c_speeds, HOOK_PRIO_INIT_I2C - 1);
diff --git a/board/crota/keyboard.c b/board/crota/keyboard.c
index d193ac9034..8911d48b81 100644
--- a/board/crota/keyboard.c
+++ b/board/crota/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@ static const struct ec_response_keybd_config crota_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &crota_kb;
}
diff --git a/board/crota/led.c b/board/crota/led.c
index 0a9c9503fe..83f3789e36 100644
--- a/board/crota/led.c
+++ b/board/crota/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,6 +8,7 @@
#include <stdint.h>
#include "charge_manager.h"
+#include "charge_state.h"
#include "common.h"
#include "compile_time_macros.h"
#include "ec_commands.h"
@@ -21,23 +22,27 @@
#define BAT_LED_OFF_LVL 0
__override const int led_charge_lvl_1 = 5;
-__override const int led_charge_lvl_2 = 100;
+__override const int led_charge_lvl_2 = 96;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_FACTORY_TEST] = {
- {EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC}
- },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
@@ -87,3 +92,15 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
return EC_SUCCESS;
}
+
+__override enum led_states board_led_get_state(enum led_states desired_state)
+{
+ /* Make sure when battery is pre-charging, the LED will blinking.
+ * Otherwise it will wait 30 seconds then blinking.
+ */
+ if (charge_get_state() == PWR_STATE_IDLE) {
+ if (charge_get_flags() & CHARGE_FLAG_EXTERNAL_POWER)
+ desired_state = STATE_BATTERY_ERROR;
+ }
+ return desired_state;
+}
diff --git a/board/crota/pwm.c b/board/crota/pwm.c
index 51bee909ff..26da4e4f7d 100644
--- a/board/crota/pwm.c
+++ b/board/crota/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/crota/sensors.c b/board/crota/sensors.c
index baa82f7b56..bbd2686512 100644
--- a/board/crota/sensors.c
+++ b/board/crota/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,8 +8,8 @@
#include "accelgyro.h"
#include "adc.h"
#include "driver/accel_lis2dw12.h"
+#include "driver/accelgyro_bmi_common.h"
#include "driver/accelgyro_lsm6dso.h"
-#include "driver/als_tcs3400_public.h"
#include "gpio.h"
#include "hooks.h"
#include "motion_sense.h"
@@ -19,15 +19,15 @@
/* ADC configuration */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1_DDR_SOC] = {
- .name = "TEMP_DDR_SOC",
+ [ADC_TEMP_SENSOR_1_SOC] = {
+ .name = "TEMP_SOC",
.input_ch = NPCX_ADC_CH0,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
- [ADC_TEMP_SENSOR_2_AMBIENT] = {
- .name = "TEMP_AMBIENT",
+ [ADC_TEMP_SENSOR_2_DDR] = {
+ .name = "TEMP_DDR",
.input_ch = NPCX_ADC_CH1,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
@@ -40,8 +40,8 @@ const struct adc_t adc_channels[] = {
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
- [ADC_TEMP_SENSOR_4_WWAN] = {
- .name = "TEMP_WWAN",
+ [ADC_TEMP_SENSOR_4_AMBIENT] = {
+ .name = "TEMP_AMBIENT",
.input_ch = NPCX_ADC_CH7,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
@@ -54,20 +54,19 @@ K_MUTEX_DEFINE(g_lid_accel_mutex);
K_MUTEX_DEFINE(g_base_accel_mutex);
static struct stprivate_data g_lis2dw12_data;
static struct lsm6dso_data lsm6dso_data;
+static struct bmi_drv_data_t g_bmi260_data;
-/* TODO(b/184779333): calibrate the orientation matrix on later board stage */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-/* TODO(b/184779743): verify orientation matrix */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+
+static const mat33_fp_t base_standard_ref_id_1 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -145,6 +144,75 @@ struct motion_sensor_t motion_sensors[] = {
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+struct motion_sensor_t bmi260_base_accel = {
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI260,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi260_drv,
+ .mutex = &g_base_accel_mutex,
+ .drv_data = &g_bmi260_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
+ .rot_standard_ref = &base_standard_ref_id_1,
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g */
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ /* Sensor on in S3 */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ },
+};
+struct motion_sensor_t bmi260_base_gyro = {
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI260,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi260_drv,
+ .mutex = &g_base_accel_mutex,
+ .drv_data = &g_bmi260_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_standard_ref_id_1,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
+};
+
+void motion_interrupt(enum gpio_signal signal)
+{
+ if (get_board_id() > 1) {
+ if (gpio_get_level(GPIO_EC_SENSOR_STRAP) == 0)
+ bmi260_interrupt(signal);
+ else
+ lsm6dso_interrupt(signal);
+ } else
+ lsm6dso_interrupt(signal);
+}
+
+static void board_update_motion_sensor_config(void)
+{
+ if (get_board_id() > 1 && gpio_get_level(GPIO_EC_SENSOR_STRAP) == 0) {
+ motion_sensors[BASE_ACCEL] = bmi260_base_accel;
+ motion_sensors[BASE_GYRO] = bmi260_base_gyro;
+ ccprints("BASE IMU is BMI260");
+ } else {
+ ccprints("BASE IMU is LSM6DSO");
+ }
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_update_motion_sensor_config,
+ HOOK_PRIO_INIT_I2C + 1);
+
static void baseboard_sensors_init(void)
{
/* Enable gpio interrupt for lid accel sensor */
@@ -156,17 +224,17 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
+ [TEMP_SENSOR_1_SOC] = {
+ .name = "SOC",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC,
+ .idx = ADC_TEMP_SENSOR_1_SOC,
},
- [TEMP_SENSOR_2_AMBIENT] = {
- .name = "Ambient",
+ [TEMP_SENSOR_2_DDR] = {
+ .name = "DDR",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_AMBIENT,
+ .idx = ADC_TEMP_SENSOR_2_DDR,
},
[TEMP_SENSOR_3_CHARGER] = {
.name = "Charger",
@@ -174,124 +242,53 @@ const struct temp_sensor_t temp_sensors[] = {
.read = get_temp_3v3_30k9_47k_4050b,
.idx = ADC_TEMP_SENSOR_3_CHARGER,
},
- [TEMP_SENSOR_4_WWAN] = {
- .name = "WWAN",
+ [TEMP_SENSOR_4_AMBIENT] = {
+ .name = "Ambient",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_WWAN,
+ .idx = ADC_TEMP_SENSOR_4_AMBIENT,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-/*
- * TODO(b/180681346): update for Alder Lake/brya
- *
- * Alder Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
- * 130 C. However, sensor is located next to DDR, so we need to use the lower
- * DDR temperature limit (85 C)
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(90), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(77), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \
}, \
.temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(77), \
}, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+ .temp_fan_off = C_TO_K(30), \
+ .temp_fan_max = C_TO_K(47), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
-/*
- * TODO(b/180681346): update for Alder Lake/brya
- *
- * Inductor limits - used for both charger and PP3300 regulator
- *
- * Need to use the lower of the charger IC, PP3300 regulator, and the inductors
- *
- * Charger max recommended temperature 100C, max absolute temperature 125C
- * PP3300 regulator: operating range -40 C to 145 C
- *
- * Inductors: limit of 125c
- * PCB: limit is 80c
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_AMBIENT \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(90), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+#define THERMAL_DDR \
+ { \
+ .temp_fan_off = C_TO_K(56), .temp_fan_max = C_TO_K(59), \
}
-__maybe_unused static const struct ec_thermal_config thermal_ambient =
- THERMAL_AMBIENT;
+__maybe_unused static const struct ec_thermal_config thermal_ddr = THERMAL_DDR;
-/*
- * Inductor limits - used for both charger and PP3300 regulator
- *
- * Need to use the lower of the charger IC, PP3300 regulator, and the inductors
- *
- * Charger max recommended temperature 125C, max absolute temperature 150C
- * PP3300 regulator: operating range -40 C to 125 C
- *
- * Inductors: limit of 125c
- * PCB: limit is 80c
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_CHARGER \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(105), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(120), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(65), \
+#define THERMAL_CHARGER \
+ { \
+ .temp_fan_off = C_TO_K(67), .temp_fan_max = C_TO_K(70), \
}
__maybe_unused static const struct ec_thermal_config thermal_charger =
THERMAL_CHARGER;
-/*
- * TODO(b/180681346): update for brya WWAN module
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_WWAN \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(130), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(130), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+#define THERMAL_AMBIENT \
+ { \
+ .temp_fan_off = C_TO_K(38), .temp_fan_max = C_TO_K(45), \
}
-__maybe_unused static const struct ec_thermal_config thermal_wwan =
- THERMAL_WWAN;
+__maybe_unused static const struct ec_thermal_config thermal_ambient =
+ THERMAL_AMBIENT;
struct ec_thermal_config thermal_params[] = {
- [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU,
- [TEMP_SENSOR_2_AMBIENT] = THERMAL_AMBIENT,
+ [TEMP_SENSOR_1_SOC] = THERMAL_CPU,
+ [TEMP_SENSOR_2_DDR] = THERMAL_DDR,
[TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
- [TEMP_SENSOR_4_WWAN] = THERMAL_WWAN,
+ [TEMP_SENSOR_4_AMBIENT] = THERMAL_AMBIENT,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/crota/usbc_config.c b/board/crota/usbc_config.c
index a06631489f..84b0934dd8 100644
--- a/board/crota/usbc_config.c
+++ b/board/crota/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,15 +36,11 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#ifdef CONFIG_ZEPHYR
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
#endif /* CONFIG_ZEPHYR */
/* USBC TCPC configuration */
@@ -102,40 +98,53 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux soc_side_bb_retimer_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+struct usb_mux_chain soc_side_bb_retimer_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &soc_side_bb_retimer_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &soc_side_bb_retimer_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -204,8 +213,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
diff --git a/board/crota/usbc_config.h b/board/crota/usbc_config.h
index 55134ce79e..63e077ea95 100644
--- a/board/crota/usbc_config.h
+++ b/board/crota/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,14 +9,10 @@
#define __CROS_EC_USBC_CONFIG_H
#ifndef CONFIG_ZEPHYR
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#endif
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/dalboz/battery.c b/board/dalboz/battery.c
index 5a90a767c8..e5adf3c4b3 100644
--- a/board/dalboz/battery.c
+++ b/board/dalboz/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/dalboz/board.c b/board/dalboz/board.c
index e8690d5cc1..471446878f 100644
--- a/board/dalboz/board.c
+++ b/board/dalboz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "driver/accelgyro_lsm6dsm.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/ioexpander/pcal6408.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/retimer/pi3hdx1204.h"
#include "driver/tcpm/nct38xx.h"
@@ -36,8 +36,8 @@
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* This I2C moved. Temporarily detect and support the V0 HW. */
int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1;
@@ -84,11 +84,9 @@ static struct stprivate_data g_lis2dwl_data;
static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
struct motion_sensor_t motion_sensors[] = {
@@ -203,9 +201,7 @@ static void board_chipset_resume(void)
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
ioex_set_level(IOEX_EN_PWR_HDMI_DB, 1);
msleep(PI3HDX1204_POWER_ON_DELAY_MS);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 1);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 1);
}
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
@@ -215,16 +211,13 @@ static void board_chipset_suspend(void)
ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0);
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
ioex_set_level(IOEX_EN_PWR_HDMI_DB, 0);
}
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-static int board_ps8743_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
if (mux_state & USB_PD_MUX_DP_ENABLED)
/* Enable IN_HPD on the DB */
@@ -236,7 +229,6 @@ static int board_ps8743_mux_set(const struct usb_mux *me,
return EC_SUCCESS;
}
-
/*****************************************************************************
* USB-C
*/
@@ -274,33 +266,45 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since FSUSB42UMX is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
-struct usb_mux usbc1_amd_fp5_usb_mux = {
+struct usb_mux usbc1_ps8xxx_mux = {
.usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+};
+
+struct usb_mux_chain usbc1_amd_fp5_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .next_mux = &usbc1_amd_fp5_usb_mux,
+ .mux = &usbc1_ps8xxx_mux,
+ .next = &usbc1_amd_fp5_usb_mux,
}
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -343,8 +347,7 @@ void ppc_interrupt(enum gpio_signal signal)
int board_set_active_charge_port(int port)
{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (port == CHARGE_PORT_NONE) {
@@ -365,7 +368,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
/* Check if the port is sourcing VBUS. */
if (ppc_is_sourcing_vbus(port)) {
CPRINTFUSB("Skip enable C%d", port);
@@ -467,7 +469,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -538,11 +539,9 @@ int board_pd_set_frs_enable(int port, int enable)
/* Use the TCPC to enable fast switch when FRS included */
if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable);
} else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, !!enable);
}
return rv;
@@ -552,17 +551,17 @@ static void setup_fw_config(void)
{
uint32_t board_version = 0;
- if (cbi_get_board_version(&board_version) == EC_SUCCESS
- && board_version >= 2) {
+ if (cbi_get_board_version(&board_version) == EC_SUCCESS &&
+ board_version >= 2) {
ccprints("PS8743 USB MUX");
- usb_muxes[USBC_PORT_C1].i2c_addr_flags = PS8743_I2C_ADDR1_FLAG;
- usb_muxes[USBC_PORT_C1].driver = &ps8743_usb_mux_driver;
- usb_muxes[USBC_PORT_C1].board_set = &board_ps8743_mux_set;
+ usbc1_ps8xxx_mux.i2c_addr_flags = PS8743_I2C_ADDR1_FLAG;
+ usbc1_ps8xxx_mux.driver = &ps8743_usb_mux_driver;
+ usbc1_ps8xxx_mux.board_set = &board_ps8743_mux_set;
} else {
ccprints("PS8740 USB MUX");
- usb_muxes[USBC_PORT_C1].i2c_addr_flags = PS8740_I2C_ADDR0_FLAG;
- usb_muxes[USBC_PORT_C1].driver = &ps8740_usb_mux_driver;
- usb_muxes[USBC_PORT_C1].board_set = NULL;
+ usbc1_ps8xxx_mux.i2c_addr_flags = PS8740_I2C_ADDR0_FLAG;
+ usbc1_ps8xxx_mux.driver = &ps8740_usb_mux_driver;
+ usbc1_ps8xxx_mux.board_set = NULL;
}
if (ec_config_get_usb_db() == DALBOZ_DB_D_OPT2_USBA_HDMI) {
diff --git a/board/dalboz/board.h b/board/dalboz/board.h
index bcb60bda0b..967d1dce8f 100644
--- a/board/dalboz/board.h
+++ b/board/dalboz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,42 +40,36 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-
-
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
/* This I2C moved. Temporarily detect and support the V0 HW. */
extern int I2C_PORT_BATTERY;
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_SMP,
@@ -84,10 +78,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
enum ioex_port {
IOEX_C0_NCT3807 = 0,
@@ -96,9 +87,7 @@ enum ioex_port {
IOEX_PORT_COUNT
};
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB3_C0_DP2_HPD \
- : GPIO_DP1_HPD)
+#define PORT_TO_HPD(port) ((port == 0) ? GPIO_USB3_C0_DP2_HPD : GPIO_DP1_HPD)
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -107,17 +96,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
@@ -166,31 +147,25 @@ enum ec_cfg_usb_db_type {
#include "cbi_ec_fw_config.h"
-#define HAS_USBC1 \
- (BIT(DALBOZ_DB_D_OPT1_USBAC))
+#define HAS_USBC1 (BIT(DALBOZ_DB_D_OPT1_USBAC))
static inline bool ec_config_has_usbc1(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1);
}
-#define HAS_USBC1_RETIMER_PS8740 \
- (BIT(DALBOZ_DB_D_OPT1_USBAC))
+#define HAS_USBC1_RETIMER_PS8740 (BIT(DALBOZ_DB_D_OPT1_USBAC))
static inline bool ec_config_has_usbc1_retimer_ps8740(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8740);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8740);
}
-#define HAS_HDMI_RETIMER_PI3HDX1204 \
- (BIT(DALBOZ_DB_D_OPT2_USBA_HDMI))
+#define HAS_HDMI_RETIMER_PI3HDX1204 (BIT(DALBOZ_DB_D_OPT2_USBA_HDMI))
static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_RETIMER_PI3HDX1204);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_RETIMER_PI3HDX1204);
}
/* These IO expander GPIOs vary with DB option. */
diff --git a/board/dalboz/build.mk b/board/dalboz/build.mk
index 4ca0cbd96f..cd58c2b91b 100644
--- a/board/dalboz/build.mk
+++ b/board/dalboz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dalboz/ec.tasklist b/board/dalboz/ec.tasklist
index 41b83cf4f3..4bb60ed55d 100644
--- a/board/dalboz/ec.tasklist
+++ b/board/dalboz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dalboz/gpio.inc b/board/dalboz/gpio.inc
index 74fe019b47..386898f013 100644
--- a/board/dalboz/gpio.inc
+++ b/board/dalboz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dalboz/led.c b/board/dalboz/led.c
index 53e94e84d6..d9614539e5 100644
--- a/board/dalboz/led.c
+++ b/board/dalboz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,44 +8,51 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 100;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_RED, 2 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_RED, 2 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_RED,
+ 2 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_RED,
+ 2 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_pwr_state_table) == PWR_LED_NUM_STATES);
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/damu/battery.c b/board/damu/battery.c
index c85240a108..2c3b259a23 100644
--- a/board/damu/battery.c
+++ b/board/damu/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/damu/board.c b/board/damu/board.c
index 8a97e53afb..ddc8885e22 100644
--- a/board/damu/board.c
+++ b/board/damu/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -46,8 +47,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -59,40 +60,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -100,8 +95,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -157,8 +152,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -171,13 +165,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -239,12 +236,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -301,8 +298,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -316,8 +312,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -356,17 +351,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(1) }
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
/* Lid accel private data */
diff --git a/board/damu/board.h b/board/damu/board.h
index 1d2993443a..49875e6883 100644
--- a/board/damu/board.h
+++ b/board/damu/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -55,7 +55,7 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -71,20 +71,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 2
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 2
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/damu/build.mk b/board/damu/build.mk
index 0b3565fd84..6a7e557a0e 100644
--- a/board/damu/build.mk
+++ b/board/damu/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/damu/ec.tasklist b/board/damu/ec.tasklist
index 19d2f34687..30e9967a0a 100644
--- a/board/damu/ec.tasklist
+++ b/board/damu/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/damu/gpio.inc b/board/damu/gpio.inc
index 9ee4035917..9db5b49238 100644
--- a/board/damu/gpio.inc
+++ b/board/damu/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/damu/led.c b/board/damu/led.c
index ee376b4b41..9d2b70795b 100644
--- a/board/damu/led.c
+++ b/board/damu/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,33 +18,40 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
@@ -79,24 +86,24 @@ __override void led_set_color_power(enum ec_led_colors color)
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
- if(led_id == EC_LED_ID_BATTERY_LED) {
+ if (led_id == EC_LED_ID_BATTERY_LED) {
brightness_range[EC_LED_COLOR_AMBER] = 1;
brightness_range[EC_LED_COLOR_WHITE] = 1;
- } else if(led_id == EC_LED_ID_POWER_LED) {
+ } else if (led_id == EC_LED_ID_POWER_LED) {
brightness_range[EC_LED_COLOR_WHITE] = 1;
}
}
int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
{
- if(led_id == EC_LED_ID_BATTERY_LED) {
- if(brightness[EC_LED_COLOR_AMBER] != 0)
+ if (led_id == EC_LED_ID_BATTERY_LED) {
+ if (brightness[EC_LED_COLOR_AMBER] != 0)
led_set_color_battery(EC_LED_COLOR_AMBER);
- else if(brightness[EC_LED_COLOR_WHITE] != 0)
+ else if (brightness[EC_LED_COLOR_WHITE] != 0)
led_set_color_battery(EC_LED_COLOR_WHITE);
else
led_set_color_battery(LED_OFF);
- } else if(led_id == EC_LED_ID_POWER_LED) {
+ } else if (led_id == EC_LED_ID_POWER_LED) {
if (brightness[EC_LED_COLOR_WHITE] != 0)
led_set_color_power(EC_LED_COLOR_WHITE);
else
diff --git a/board/delbin/battery.c b/board/delbin/battery.c
index e907a3574f..6d6ae2afad 100644
--- a/board/delbin/battery.c
+++ b/board/delbin/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/delbin/board.c b/board/delbin/board.c
index 068d453e8d..1cdb42d954 100644
--- a/board/delbin/board.c
+++ b/board/delbin/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,6 +8,7 @@
#include "common.h"
#include "accelgyro.h"
#include "cbi_ec_fw_config.h"
+#include "cbi_ssfc.h"
#include "driver/accel_bma2x2.h"
#include "driver/accelgyro_bmi260.h"
#include "driver/bc12/pi3usb9201.h"
@@ -22,6 +23,7 @@
#include "gpio.h"
#include "hooks.h"
#include "keyboard_scan.h"
+#include "keyboard_customization.h"
#include "lid_switch.h"
#include "power.h"
#include "power_button.h"
@@ -41,7 +43,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -60,6 +62,28 @@ __override struct keyboard_scan_config keyscan_config = {
},
};
+__override struct key {
+ uint8_t row;
+ uint8_t col;
+} vivaldi_keys[] = {
+ { .row = 0, .col = 2 }, /* T1 */
+ { .row = 3, .col = 2 }, /* T2 */
+ { .row = 2, .col = 2 }, /* T3 */
+ { .row = 1, .col = 2 }, /* T4 */
+ { .row = 3, .col = 4 }, /* T5 */
+ { .row = 2, .col = 4 }, /* T6 */
+ { .row = 1, .col = 4 }, /* T7 */
+ { .row = 2, .col = 9 }, /* T8 */
+ { .row = 1, .col = 9 }, /* T9 */
+ { .row = 0, .col = 4 }, /* T10 */
+ { .row = 0, .col = 1 }, /* T11 */
+ { .row = 1, .col = 5 }, /* T12 */
+ { .row = 3, .col = 5 }, /* T13 */
+ { .row = 0, .col = 9 }, /* T14 */
+ { .row = 0, .col = 11 }, /* T15 */
+};
+BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
+
/******************************************************************************/
/*
* FW_CONFIG defaults for Delbin if the CBI data is not initialized.
@@ -70,15 +94,35 @@ union volteer_cbi_fw_config fw_config_defaults = {
static void board_init(void)
{
+ key_choose();
+
+ if (get_cbi_ssfc_keyboard() == SSFC_KEYBOARD_GAMING) {
+ keyscan_config.actual_key_mask[1] = 0xfa;
+ keyscan_config.actual_key_mask[4] = 0xfe;
+ keyscan_config.actual_key_mask[7] = 0x86;
+ keyscan_config.actual_key_mask[9] = 0xff;
+ keyscan_config.actual_key_mask[11] = 0xff;
+
+ vivaldi_keys[0].row = 4;
+ vivaldi_keys[0].col = 2;
+ vivaldi_keys[4].row = 4;
+ vivaldi_keys[4].col = 4;
+ vivaldi_keys[5].row = 3;
+ vivaldi_keys[5].col = 4;
+ vivaldi_keys[6].row = 2;
+ vivaldi_keys[6].col = 4;
+ vivaldi_keys[9].row = 1;
+ vivaldi_keys[9].col = 4;
+ }
}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_PRE_DEFAULT);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -114,8 +158,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -142,8 +186,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -270,23 +314,22 @@ static void ps8815_reset(int port)
}
gpio_set_level(ps8xxx_rst_odl, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(ps8xxx_rst_odl, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
CPRINTS("[C%d] %s: patching ps8815 registers", port, __func__);
- if (i2c_read8(i2c_port,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(i2c_port,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(i2c_port,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(i2c_port, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -294,10 +337,10 @@ void board_reset_pd_mcu(void)
{
ps8815_reset(USBC_PORT_C0);
usb_mux_hpd_update(USBC_PORT_C0, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
ps8815_reset(USBC_PORT_C1);
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
/******************************************************************************/
@@ -349,8 +392,8 @@ static const struct ec_response_keybd_config delbin_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &delbin_kb;
}
@@ -361,19 +404,19 @@ static void ps8811_init(void)
/* Set Channel A output swing to Level1 */
rv = i2c_write8(I2C_PORT_USB_1_MIX,
- PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x66, 0x10);
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x66, 0x10);
/* Set 50 ohm termination adjuct for B channel: -9%*/
rv |= i2c_write8(I2C_PORT_USB_1_MIX,
- PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x73, 0x04);
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0x73, 0x04);
/* Set Channel B output swing to Level3 */
rv |= i2c_write8(I2C_PORT_USB_1_MIX,
- PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA4, 0x03);
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA4, 0x03);
/* Set PS level for B channel */
rv |= i2c_write8(I2C_PORT_USB_1_MIX,
- PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA5, 0x84);
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA5, 0x84);
/* Set DE level for B channel */
rv |= i2c_write8(I2C_PORT_USB_1_MIX,
- PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA6, 0x16);
+ PS8811_I2C_ADDR_FLAGS0 + PS8811_REG_PAGE1, 0xA6, 0x16);
}
/* Called on AP S5 -> S0ix transition */
@@ -440,32 +483,42 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-static const struct usb_mux usbc0_usb3_mb_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc0_usb3_mb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc0_usb3_mb_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc0_usb3_mb_retimer,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/delbin/board.h b/board/delbin/board.h
index c889d65b47..50759b74d2 100644
--- a/board/delbin/board.h
+++ b/board/delbin/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,7 +18,7 @@
#undef CONFIG_CHIP_INIT_ROM_REGION
#undef NPCX_PWM1_SEL
-#define NPCX_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
/* Optional features */
#undef CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */
@@ -39,6 +39,8 @@
/* Keyboard features */
#define CONFIG_KEYBOARD_VIVALDI
#define CONFIG_KEYBOARD_REFRESH_ROW3
+#define CONFIG_KEYBOARD_CUSTOMIZATION
+#define CONFIG_KEYBOARD_MULTIPLE
/* Sensors */
/* BMA253 accelerometer in base */
@@ -58,36 +60,35 @@
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W, the limitation of 45W is for the delbin
* board.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#undef CONFIG_USB_MUX_RUNTIME_CONFIG
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
#define CONFIG_USBC_PPC_SYV682X
-
/* BC 1.2 */
/* Volume Button feature */
@@ -95,8 +96,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Retimer */
#undef CONFIG_USBC_RETIMER_INTEL_BB
@@ -108,45 +109,44 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_UART2_EC_RX
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_UART2_EC_RX
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -157,11 +157,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_FAN = 0,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_FAN = 0, PWM_CH_KBLIGHT, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -170,11 +166,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/delbin/build.mk b/board/delbin/build.mk
index 66ad809f59..26007095af 100644
--- a/board/delbin/build.mk
+++ b/board/delbin/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -16,3 +16,4 @@ board-y=board.o
board-y+=battery.o
board-y+=led.o
board-y+=sensors.o
+board-$(CONFIG_KEYBOARD_CUSTOMIZATION)+=keyboard_customization.o
diff --git a/board/delbin/ec.tasklist b/board/delbin/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/delbin/ec.tasklist
+++ b/board/delbin/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/delbin/gpio.inc b/board/delbin/gpio.inc
index 61dae06cde..f229e50dcc 100644
--- a/board/delbin/gpio.inc
+++ b/board/delbin/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/delbin/keyboard_customization.c b/board/delbin/keyboard_customization.c
new file mode 100644
index 0000000000..56cf33ad7a
--- /dev/null
+++ b/board/delbin/keyboard_customization.c
@@ -0,0 +1,169 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+#include "cbi_ssfc.h"
+#include "gpio.h"
+#include "keyboard_customization.h"
+#include "keyboard_8042_sharedlib.h"
+#include "keyboard_config.h"
+#include "keyboard_protocol.h"
+#include "keyboard_raw.h"
+#include "keyboard_scan.h"
+
+static uint16_t (*scancode_set2)[KEYBOARD_ROWS];
+
+static uint16_t KB2scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
+ { 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000 },
+ { 0x0000, 0x0076, 0x0000, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016 },
+ { 0x006c, 0x000c, 0x0004, 0x0006, 0x0005, 0xe071, 0x0026, 0x002a },
+ { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d },
+ { 0xe01f, 0x0009, 0x0083, 0x000b, 0x0003, 0x0041, 0x001e, 0x001d },
+ { 0x0051, 0x0000, 0x005b, 0x0000, 0x0042, 0x0022, 0x003e, 0x0043 },
+ { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c },
+ { 0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059 },
+ { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d },
+ { 0x0045, 0x0001, 0x000a, 0x002f, 0x004b, 0x0049, 0x0046, 0x001a },
+ { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 },
+ { 0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066 },
+ { 0xe06b, 0xe074, 0xe069, 0x0067, 0xe06c, 0x0064, 0x0015, 0xe07d },
+ { 0x0073, 0x007c, 0x007b, 0x0074, 0x0071, 0xe04a, 0x0070, 0x0021 },
+ { 0x0023, 0xe05a, 0x0075, 0x0079, 0x007a, 0x0072, 0x007D, 0x0069 },
+};
+
+/* The standard Chrome OS keyboard matrix table in scan code set 2. */
+static uint16_t KB1scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
+ { 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0xe007, 0x0000, 0x0000 },
+ { 0xe01f, 0x0076, 0x000d, 0x000e, 0x001c, 0x001a, 0x0016, 0x0015 },
+ { 0x0005, 0x000c, 0x0004, 0x0006, 0x0023, 0x0021, 0x0026, 0x0024 },
+ { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x002a, 0x0025, 0x002d },
+ { 0x0009, 0x0083, 0x000b, 0x0003, 0x001b, 0x0022, 0x001e, 0x001d },
+ { 0x0051, 0x0000, 0x005b, 0x0000, 0x0042, 0x0041, 0x003e, 0x0043 },
+ { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x003a, 0x003d, 0x003c },
+ { 0x0000, 0x0000, 0x0061, 0x0000, 0x0000, 0x0012, 0x0000, 0x0059 },
+ { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x004a, 0x0045, 0x004d },
+ { 0x0000, 0x0001, 0x000a, 0x002f, 0x004b, 0x0049, 0x0046, 0x0044 },
+ { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 },
+#ifndef CONFIG_KEYBOARD_KEYPAD
+ { 0x0000, 0x0066, 0x0000, 0x005d, 0x005a, 0x0029, 0xe072, 0xe075 },
+ { 0x0000, 0x0064, 0x0000, 0x0067, 0x0000, 0x0000, 0xe074, 0xe06b },
+#else
+ { 0x0000, 0x0066, 0xe071, 0x005d, 0x005a, 0x0029, 0xe072, 0xe075 },
+ { 0xe06c, 0x0064, 0xe07d, 0x0067, 0xe069, 0xe07a, 0xe074, 0xe06b },
+ { 0xe04a, 0x007c, 0x007b, 0x0074, 0x0071, 0x0073, 0x006b, 0x0070 },
+ { 0x006c, 0x0075, 0x007d, 0x0079, 0x007a, 0x0072, 0x0069, 0xe05a },
+#endif
+};
+
+uint16_t get_scancode_set2(uint8_t row, uint8_t col)
+{
+ if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) {
+ return *(*(scancode_set2 + col) + row);
+ }
+ return 0;
+}
+
+void set_scancode_set2(uint8_t row, uint8_t col, uint16_t val)
+{
+ if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS) {
+ *(*(scancode_set2 + col) + row) = val;
+ }
+}
+
+void board_keyboard_drive_col(int col)
+{
+ /* Drive all lines to high */
+ if (col == KEYBOARD_COLUMN_NONE)
+ gpio_set_level(GPIO_KBD_KSO2, 0);
+
+ /* Set KBSOUT to zero to detect key-press */
+ else if (col == KEYBOARD_COLUMN_ALL)
+ gpio_set_level(GPIO_KBD_KSO2, 1);
+
+ /* Drive one line for detection */
+ else {
+ if (col == 2)
+ gpio_set_level(GPIO_KBD_KSO2, 1);
+ else
+ gpio_set_level(GPIO_KBD_KSO2, 0);
+ }
+}
+
+struct keyboard_type key_typ = {
+ .col_esc = KEYBOARD_COL_ESC,
+ .row_esc = KEYBOARD_ROW_ESC,
+ .col_down = KEYBOARD_COL_DOWN,
+ .row_down = KEYBOARD_ROW_DOWN,
+ .col_left_shift = KEYBOARD_COL_LEFT_SHIFT,
+ .row_left_shift = KEYBOARD_ROW_LEFT_SHIFT,
+ .col_refresh = KEYBOARD_COL_REFRESH,
+ .row_refresh = KEYBOARD_ROW_REFRESH,
+ .col_right_alt = KEYBOARD_COL_RIGHT_ALT,
+ .row_right_alt = KEYBOARD_ROW_RIGHT_ALT,
+ .col_left_alt = KEYBOARD_COL_LEFT_ALT,
+ .row_left_alt = KEYBOARD_ROW_LEFT_ALT,
+ .col_key_r = KEYBOARD_COL_KEY_R,
+ .row_key_r = KEYBOARD_ROW_KEY_R,
+ .col_key_h = KEYBOARD_COL_KEY_H,
+ .row_key_h = KEYBOARD_ROW_KEY_H,
+};
+
+int keyboard_choose(void)
+{
+ if (get_cbi_ssfc_keyboard() == SSFC_KEYBOARD_GAMING)
+ return 1;
+
+ return 0;
+}
+
+void key_choose(void)
+{
+ if (keyboard_choose() == 1) {
+ key_typ.col_esc = KEYBOARD2_COL_ESC;
+ key_typ.row_esc = KEYBOARD2_ROW_ESC;
+ key_typ.col_down = KEYBOARD2_COL_DOWN;
+ key_typ.row_down = KEYBOARD2_ROW_DOWN;
+ key_typ.col_left_shift = KEYBOARD2_COL_LEFT_SHIFT;
+ key_typ.row_left_shift = KEYBOARD2_ROW_LEFT_SHIFT;
+ key_typ.col_refresh = KEYBOARD2_COL_REFRESH;
+ key_typ.row_refresh = KEYBOARD2_ROW_REFRESH;
+ key_typ.col_right_alt = KEYBOARD2_COL_RIGHT_ALT;
+ key_typ.row_right_alt = KEYBOARD2_ROW_RIGHT_ALT;
+ key_typ.col_left_alt = KEYBOARD2_COL_LEFT_ALT;
+ key_typ.row_left_alt = KEYBOARD2_ROW_LEFT_ALT;
+ key_typ.col_key_r = KEYBOARD2_COL_KEY_R;
+ key_typ.row_key_r = KEYBOARD2_ROW_KEY_R;
+ key_typ.col_key_h = KEYBOARD2_COL_KEY_H;
+ key_typ.row_key_h = KEYBOARD2_ROW_KEY_H;
+
+ boot_key_list[0].col = KEYBOARD2_COL_ESC;
+ boot_key_list[0].row = KEYBOARD2_ROW_ESC;
+ boot_key_list[1].col = KEYBOARD2_COL_DOWN;
+ boot_key_list[1].row = KEYBOARD2_ROW_DOWN;
+ boot_key_list[2].col = KEYBOARD2_COL_LEFT_SHIFT;
+ boot_key_list[2].row = KEYBOARD2_ROW_LEFT_SHIFT;
+
+ scancode_set2 = KB2scancode_set2;
+ } else {
+ key_typ.col_esc = KEYBOARD_COL_ESC;
+ key_typ.row_esc = KEYBOARD_ROW_ESC;
+ key_typ.col_down = KEYBOARD_COL_DOWN;
+ key_typ.row_down = KEYBOARD_ROW_DOWN;
+ key_typ.col_left_shift = KEYBOARD_COL_LEFT_SHIFT;
+ key_typ.row_left_shift = KEYBOARD_ROW_LEFT_SHIFT;
+ key_typ.col_refresh = KEYBOARD_COL_REFRESH;
+ key_typ.row_refresh = KEYBOARD_ROW_REFRESH;
+ key_typ.col_right_alt = KEYBOARD_COL_RIGHT_ALT;
+ key_typ.row_right_alt = KEYBOARD_ROW_RIGHT_ALT;
+ key_typ.col_left_alt = KEYBOARD_COL_LEFT_ALT;
+ key_typ.row_left_alt = KEYBOARD_ROW_LEFT_ALT;
+ key_typ.col_key_r = KEYBOARD_COL_KEY_R;
+ key_typ.row_key_r = KEYBOARD_ROW_KEY_R;
+ key_typ.col_key_h = KEYBOARD_COL_KEY_H;
+ key_typ.row_key_h = KEYBOARD_ROW_KEY_H;
+
+ scancode_set2 = KB1scancode_set2;
+ }
+}
diff --git a/board/delbin/keyboard_customization.h b/board/delbin/keyboard_customization.h
new file mode 100644
index 0000000000..bfe5c3b584
--- /dev/null
+++ b/board/delbin/keyboard_customization.h
@@ -0,0 +1,130 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Keyboard configuration */
+
+#ifndef __KEYBOARD_CUSTOMIZATION_H
+#define __KEYBOARD_CUSTOMIZATION_H
+
+/*
+ * KEYBOARD_COLS_MAX has the build time column size. It's used to allocate
+ * exact spaces for arrays. Actual keyboard scanning is done using
+ * keyboard_cols, which holds a runtime column size.
+ */
+#define KEYBOARD_COLS_MAX 16
+#define KEYBOARD_ROWS 8
+
+/*
+ * WARNING: Do not directly modify it. You should call keyboard_raw_set_cols,
+ * instead. It checks whether you're eligible or not.
+ */
+extern uint8_t keyboard_cols;
+
+#define KEYBOARD_ROW_TO_MASK(r) (1 << (r))
+
+#define KEYBOARD_COL_DOWN 11
+#define KEYBOARD_ROW_DOWN 6
+#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
+#define KEYBOARD_COL_ESC 1
+#define KEYBOARD_ROW_ESC 1
+#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
+#define KEYBOARD_COL_KEY_H 6
+#define KEYBOARD_ROW_KEY_H 1
+#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
+#define KEYBOARD_COL_KEY_R 3
+#define KEYBOARD_ROW_KEY_R 7
+#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
+#define KEYBOARD_COL_LEFT_ALT 10
+#define KEYBOARD_ROW_LEFT_ALT 6
+#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
+#define KEYBOARD_COL_REFRESH 2
+#ifdef CONFIG_KEYBOARD_REFRESH_ROW3
+#define KEYBOARD_ROW_REFRESH 3
+#else
+#define KEYBOARD_ROW_REFRESH 2
+#endif
+#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
+#define KEYBOARD_COL_RIGHT_ALT 10
+#define KEYBOARD_ROW_RIGHT_ALT 0
+#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
+#define KEYBOARD_DEFAULT_COL_VOL_UP 4
+#define KEYBOARD_DEFAULT_ROW_VOL_UP 0
+#define KEYBOARD_COL_LEFT_CTRL 0
+#define KEYBOARD_ROW_LEFT_CTRL 2
+#define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL)
+#define KEYBOARD_COL_RIGHT_CTRL 0
+#define KEYBOARD_ROW_RIGHT_CTRL 4
+#define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL)
+#define KEYBOARD_COL_SEARCH 1
+#define KEYBOARD_ROW_SEARCH 0
+#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
+#define KEYBOARD_COL_KEY_0 8
+#define KEYBOARD_ROW_KEY_0 6
+#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
+#define KEYBOARD_COL_KEY_1 1
+#define KEYBOARD_ROW_KEY_1 6
+#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
+#define KEYBOARD_COL_KEY_2 4
+#define KEYBOARD_ROW_KEY_2 6
+#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
+#define KEYBOARD_COL_LEFT_SHIFT 7
+#define KEYBOARD_ROW_LEFT_SHIFT 5
+#define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT)
+#ifdef CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI2
+#define KEYBOARD_MASK_PWRBTN KEYBOARD_ROW_TO_MASK(2)
+#elif defined(CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3)
+#define KEYBOARD_MASK_PWRBTN KEYBOARD_ROW_TO_MASK(3)
+#endif
+
+/* Columns and masks for keys we particularly care about */
+#define KEYBOARD2_COL_DOWN 11
+#define KEYBOARD2_ROW_DOWN 5
+#define KEYBOARD2_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_DOWN)
+#define KEYBOARD2_COL_ESC 1
+#define KEYBOARD2_ROW_ESC 1
+#define KEYBOARD2_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_ESC)
+#define KEYBOARD2_COL_KEY_H 6
+#define KEYBOARD2_ROW_KEY_H 1
+#define KEYBOARD2_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_KEY_H)
+#define KEYBOARD2_COL_KEY_R 3
+#define KEYBOARD2_ROW_KEY_R 7
+#define KEYBOARD2_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_KEY_R)
+#define KEYBOARD2_COL_LEFT_ALT 10
+#define KEYBOARD2_ROW_LEFT_ALT 6
+#define KEYBOARD2_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_LEFT_ALT)
+#define KEYBOARD2_COL_REFRESH 2
+#define KEYBOARD2_ROW_REFRESH 3
+#define KEYBOARD2_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_REFRESH)
+#define KEYBOARD2_COL_RIGHT_ALT 10
+#define KEYBOARD2_ROW_RIGHT_ALT 0
+#define KEYBOARD2_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_RIGHT_ALT)
+#define KEYBOARD2_DEFAULT_COL_VOL_UP 4
+#define KEYBOARD2_DEFAULT_ROW_VOL_UP 1
+#define KEYBOARD2_COL_LEFT_CTRL 0
+#define KEYBOARD2_ROW_LEFT_CTRL 2
+#define KEYBOARD2_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_LEFT_CTRL)
+#define KEYBOARD2_COL_RIGHT_CTRL 0
+#define KEYBOARD2_ROW_RIGHT_CTRL 4
+#define KEYBOARD2_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_RIGHT_CTRL)
+#define KEYBOARD2_COL_SEARCH 4
+#define KEYBOARD2_ROW_SEARCH 0
+#define KEYBOARD2_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_SEARCH)
+#define KEYBOARD2_COL_KEY_0 9
+#define KEYBOARD2_ROW_KEY_0 0
+#define KEYBOARD2_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_KEY_0)
+#define KEYBOARD2_COL_KEY_1 1
+#define KEYBOARD2_ROW_KEY_1 7
+#define KEYBOARD2_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_KEY_1)
+#define KEYBOARD2_COL_KEY_2 4
+#define KEYBOARD2_ROW_KEY_2 6
+#define KEYBOARD2_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_KEY_2)
+#define KEYBOARD2_COL_LEFT_SHIFT 7
+#define KEYBOARD2_ROW_LEFT_SHIFT 1
+#define KEYBOARD2_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD2_ROW_LEFT_SHIFT)
+
+int keyboard_choose(void);
+void key_choose(void);
+
+#endif /* __KEYBOARD_CUSTOMIZATION_H */
diff --git a/board/delbin/led.c b/board/delbin/led.c
index d7c1df491f..27eb98a75e 100644
--- a/board/delbin/led.c
+++ b/board/delbin/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,29 +17,37 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/delbin/sensors.c b/board/delbin/sensors.c
index a3d5015e2b..77b5757e28 100644
--- a/board/delbin/sensors.c
+++ b/board/delbin/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,22 +34,18 @@ static struct bmi_drv_data_t g_bmi260_data;
static struct icm_drv_data_t g_icm426xx_data;
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
const mat33_fp_t base_standard_ref_icm = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)},
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) },
};
struct motion_sensor_t icm426xx_base_accel = {
diff --git a/board/dewatt/battery.c b/board/dewatt/battery.c
index 40d5f930e3..9b3e15cfcf 100644
--- a/board/dewatt/battery.c
+++ b/board/dewatt/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/dewatt/board.c b/board/dewatt/board.c
index 8d37cd076d..4667979e15 100644
--- a/board/dewatt/board.c
+++ b/board/dewatt/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,6 +9,7 @@
#include "base_fw_config.h"
#include "battery.h"
#include "board_fw_config.h"
+#include "builtin/assert.h"
#include "button.h"
#include "charger.h"
#include "common.h"
@@ -17,7 +18,7 @@
#include "driver/accelgyro_bmi260.h"
#include "driver/accel_bma422.h"
#include "driver/retimer/ps8811.h"
-#include "driver/retimer/ps8818.h"
+#include "driver/retimer/ps8818_public.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/temp_sensor/pct2075.h"
#include "extpower.h"
@@ -47,17 +48,13 @@ static struct bmi_drv_data_t g_bmi_data;
static struct accelgyro_saved_data_t g_bma422_data;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/*
* We have total 30 pins for keyboard connecter {-1, -1} mean
@@ -65,16 +62,15 @@ const mat33_fp_t lid_standard_ref = {
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
struct motion_sensor_t motion_sensors[] = {
[BASE_ACCEL] = {
@@ -178,51 +174,46 @@ board_a1_ps8811_retimer_init(const struct usb_mux *me)
}
__override int board_c1_ps8818_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
/* Set the RX input termination */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_RX_PHY,
- PS8818_RX_INPUT_TERM_MASK,
- PS8818_RX_INPUT_TERM_112_OHM);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_RX_PHY,
+ PS8818_RX_INPUT_TERM_MASK,
+ PS8818_RX_INPUT_TERM_112_OHM);
if (rv)
return rv;
}
@@ -230,11 +221,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_DPEQ_LEVEL,
- PS8818_DPEQ_LEVEL_UP_MASK,
- PS8818_DPEQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_DPEQ_LEVEL,
+ PS8818_DPEQ_LEVEL_UP_MASK,
+ PS8818_DPEQ_LEVEL_UP_19DB);
if (rv)
return rv;
@@ -302,8 +292,7 @@ static void board_chipset_startup(void)
if (get_board_version() > 1)
pct2075_init();
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
int board_get_soc_temp_k(int idx, int *temp_k)
{
@@ -437,8 +426,8 @@ static const struct ec_response_keybd_config main_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &main_kb;
}
diff --git a/board/dewatt/board.h b/board/dewatt/board.h
index 5d34f8324a..58990c97d3 100644
--- a/board/dewatt/board.h
+++ b/board/dewatt/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,7 +26,7 @@
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCEL_BMA4XX
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
/* EC console commands */
#define CONFIG_CMD_ACCELS
@@ -37,11 +37,11 @@
#define CONFIG_USB_MUX_ANX7451
#define CONFIG_USBC_RETIMER_ANX7451
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_CURRENT_MA 3250
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_CURRENT_MA 3250
+#define PD_MAX_VOLTAGE_MV 20000
/* Max Power = 65 W */
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
/* USB Type A Features */
diff --git a/board/dewatt/board_fw_config.c b/board/dewatt/board_fw_config.c
index e6dbcadb92..7128a153ca 100644
--- a/board/dewatt/board_fw_config.c
+++ b/board/dewatt/board_fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,7 +14,8 @@ bool board_is_convertible(void)
bool board_has_kblight(void)
{
return (get_fw_config_field(FW_CONFIG_KBLIGHT_OFFSET,
- FW_CONFIG_KBLIGHT_WIDTH) == FW_CONFIG_KBLIGHT_YES);
+ FW_CONFIG_KBLIGHT_WIDTH) ==
+ FW_CONFIG_KBLIGHT_YES);
}
enum board_usb_c1_mux board_get_usb_c1_mux(void)
diff --git a/board/dewatt/board_fw_config.h b/board/dewatt/board_fw_config.h
index 1de417d77a..4477aca6fd 100644
--- a/board/dewatt/board_fw_config.h
+++ b/board/dewatt/board_fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,26 +13,25 @@
/*
* USB Daughter Board (2 bits)
*/
-#define FW_CONFIG_USB_DB_OFFSET 0
-#define FW_CONFIG_USB_DB_WIDTH 2
-#define FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818 0
-#define FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451 1
+#define FW_CONFIG_USB_DB_OFFSET 0
+#define FW_CONFIG_USB_DB_WIDTH 2
+#define FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818 0
+#define FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451 1
/*
* Form Factor (1 bits)
*/
-#define FW_CONFIG_FORM_FACTOR_OFFSET 2
-#define FW_CONFIG_FORM_FACTOR_WIDTH 1
-#define FW_CONFIG_FORM_FACTOR_CLAMSHELL 0
-#define FW_CONFIG_FORM_FACTOR_CONVERTIBLE 1
+#define FW_CONFIG_FORM_FACTOR_OFFSET 2
+#define FW_CONFIG_FORM_FACTOR_WIDTH 1
+#define FW_CONFIG_FORM_FACTOR_CLAMSHELL 0
+#define FW_CONFIG_FORM_FACTOR_CONVERTIBLE 1
/*
* Keyboard Backlight (1 bit)
*/
-#define FW_CONFIG_KBLIGHT_OFFSET 3
-#define FW_CONFIG_KBLIGHT_WIDTH 1
-#define FW_CONFIG_KBLIGHT_NO 0
-#define FW_CONFIG_KBLIGHT_YES 1
-
+#define FW_CONFIG_KBLIGHT_OFFSET 3
+#define FW_CONFIG_KBLIGHT_WIDTH 1
+#define FW_CONFIG_KBLIGHT_NO 0
+#define FW_CONFIG_KBLIGHT_YES 1
#endif /* _GUYBRUSH_CBI_FW_CONFIG__H_ */
diff --git a/board/dewatt/build.mk b/board/dewatt/build.mk
index 8f2b78ddc8..8a1ce35e1e 100644
--- a/board/dewatt/build.mk
+++ b/board/dewatt/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dewatt/ec.tasklist b/board/dewatt/ec.tasklist
index 94ff657db3..14ecddebc9 100644
--- a/board/dewatt/ec.tasklist
+++ b/board/dewatt/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dewatt/gpio.inc b/board/dewatt/gpio.inc
index 1bab89ed63..9798239af5 100644
--- a/board/dewatt/gpio.inc
+++ b/board/dewatt/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dewatt/led.c b/board/dewatt/led.c
index 7cbb9133bf..9453bd8e6e 100644
--- a/board/dewatt/led.c
+++ b/board/dewatt/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,10 +14,10 @@
#include "pwm.h"
/* Note PWM LEDs are active low */
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
-#define CPRINTS(format, args...) cprints(CC_PWM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_PWM, format, ##args)
__override const int led_charge_lvl_1 = 5;
@@ -45,20 +45,29 @@ static void led_pwm_ch_init(void)
DECLARE_HOOK(HOOK_INIT, led_pwm_ch_init, HOOK_PRIO_INIT_PWM - 1);
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_S5] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_S5] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_BLUE,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/dewatt/thermal.c b/board/dewatt/thermal.c
index 0d0d80095a..bd63fda984 100644
--- a/board/dewatt/thermal.c
+++ b/board/dewatt/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
@@ -93,14 +93,14 @@ struct fan_step {
};
static const struct fan_step fan_table[] = {
- {.on = 0, .off = 1, .rpm = 0},
- {.on = 6, .off = 2, .rpm = 3000},
- {.on = 28, .off = 15, .rpm = 3300},
- {.on = 34, .off = 26, .rpm = 3700},
- {.on = 39, .off = 32, .rpm = 4000},
- {.on = 45, .off = 38, .rpm = 4300},
- {.on = 51, .off = 43, .rpm = 4700},
- {.on = 74, .off = 62, .rpm = 5400},
+ { .on = 0, .off = 1, .rpm = 0 },
+ { .on = 6, .off = 2, .rpm = 3000 },
+ { .on = 28, .off = 15, .rpm = 3300 },
+ { .on = 34, .off = 26, .rpm = 3700 },
+ { .on = 39, .off = 32, .rpm = 4000 },
+ { .on = 45, .off = 38, .rpm = 4300 },
+ { .on = 51, .off = 43, .rpm = 4700 },
+ { .on = 74, .off = 62, .rpm = 5400 },
};
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table)
@@ -137,10 +137,8 @@ int fan_percent_to_rpm(int fan, int pct)
previous_pct = pct;
- if (fan_table[current_level].rpm !=
- fan_get_rpm_target(FAN_CH(fan)))
- CPRINTS("Setting fan RPM to %d",
- fan_table[current_level].rpm);
+ if (fan_table[current_level].rpm != fan_get_rpm_target(FAN_CH(fan)))
+ CPRINTS("Setting fan RPM to %d", fan_table[current_level].rpm);
return fan_table[current_level].rpm;
}
diff --git a/board/dingdong/board.c b/board/dingdong/board.c
index ddaf6bb928..7f17668313 100644
--- a/board/dingdong/board.c
+++ b/board/dingdong/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -96,7 +96,7 @@ void board_config_pre_init(void)
/* enable SYSCFG clock */
STM32_RCC_APB2ENR |= BIT(0);
/* Remap USART DMA to match the USART driver */
- STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10);/* Remap USART1 RX/TX DMA */
+ STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10); /* Remap USART1 RX/TX DMA */
}
/* Initialize board. */
@@ -115,12 +115,12 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CH_CC1_PD] = {"USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1)},
+ [ADC_CH_CC1_PD] = { "USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-const void * const usb_strings[] = {
+const void *const usb_strings[] = {
[USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
[USB_STR_PRODUCT] = USB_STRING_DESC("Dingdong"),
[USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_BB_URL] = USB_STRING_DESC(USB_GOOGLE_TYPEC_URL),
diff --git a/board/dingdong/board.h b/board/dingdong/board.h
index 64947960ba..c0372c9322 100644
--- a/board/dingdong/board.h
+++ b/board/dingdong/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,7 +39,7 @@
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
#define CONFIG_USB_PD_VBUS_DETECT_NONE
#define CONFIG_USB_PD_LOGGING
-#undef CONFIG_EVENT_LOG_SIZE
+#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
@@ -63,7 +63,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -86,14 +86,14 @@ enum usb_strings {
};
/* we are never a source : don't care about power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 0 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 0 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 0 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 1000
-#define PD_MAX_POWER_MW 1500
-#define PD_MAX_CURRENT_MA 300
-#define PD_MAX_VOLTAGE_MV 5000
+#define PD_MAX_POWER_MW 1500
+#define PD_MAX_CURRENT_MA 300
+#define PD_MAX_VOLTAGE_MV 5000
#endif /* !__ASSEMBLER__ */
@@ -101,10 +101,10 @@ enum usb_strings {
#define USB_DEV_CLASS USB_CLASS_BILLBOARD
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_COUNT 0
+#define USB_IFACE_COUNT 0
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_COUNT 1
+#define USB_EP_CONTROL 0
+#define USB_EP_COUNT 1
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/dingdong/build.mk b/board/dingdong/build.mk
index 71cea3f845..b6fbbe7a9e 100644
--- a/board/dingdong/build.mk
+++ b/board/dingdong/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dingdong/ec.tasklist b/board/dingdong/ec.tasklist
index 41fc047d6a..5a82344122 100644
--- a/board/dingdong/ec.tasklist
+++ b/board/dingdong/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dingdong/gpio.inc b/board/dingdong/gpio.inc
index ec1e9a7fa9..d8ea0dfc8f 100644
--- a/board/dingdong/gpio.inc
+++ b/board/dingdong/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dingdong/usb_pd_config.h b/board/dingdong/usb_pd_config.h
index 2f01c275a8..5a7dfd12a6 100644
--- a/board/dingdong/usb_pd_config.h
+++ b/board/dingdong/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -49,7 +49,7 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
#define EXTI_COMP_MASK(p) BIT(21)
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -88,9 +88,8 @@ static inline void pd_tx_enable(int port, int polarity)
static inline void pd_tx_disable(int port, int polarity)
{
/* output low on SPI TX (PB4) to disable the FET */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- & ~(3 << (2*4)))
- | (1 << (2*4));
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 4))) | (1 << (2 * 4));
/* put the low level reference in Hi-Z */
gpio_set_level(GPIO_PD_CC1_TX_EN, 0);
}
@@ -101,8 +100,8 @@ static inline void pd_select_polarity(int port, int polarity)
* use the right comparator : CC1 -> PA1 (COMP1 INP)
* use VrefInt / 2 as INM (about 600mV)
*/
- STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK)
- | STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
+ STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK) |
+ STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
}
/* Initialize pins used for TX and put them in Hi-Z */
@@ -111,7 +110,9 @@ static inline void pd_tx_init(void)
gpio_config_module(MODULE_USB_PD, 1);
}
-static inline void pd_set_host_mode(int port, int enable) {}
+static inline void pd_set_host_mode(int port, int enable)
+{
+}
static inline void pd_config_init(int port, uint8_t power_role)
{
diff --git a/board/dingdong/usb_pd_pdo.c b/board/dingdong/usb_pd_pdo.c
index 990c2de5ab..7b4ed3e2d8 100644
--- a/board/dingdong/usb_pd_pdo.c
+++ b/board/dingdong/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,6 +15,6 @@ const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
/* Fake PDOs : we just want our pre-defined voltages */
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
+ PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
diff --git a/board/dingdong/usb_pd_pdo.h b/board/dingdong/usb_pd_pdo.h
index 66bb713ee8..e1b628c3a8 100644
--- a/board/dingdong/usb_pd_pdo.h
+++ b/board/dingdong/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c
index 9bcc7f806f..493897c6da 100644
--- a/board/dingdong/usb_pd_policy.c
+++ b/board/dingdong/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,8 +20,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* Holds valid object position (opos) for entered mode */
static int alt_mode[PD_AMODE_COUNT];
@@ -69,28 +69,22 @@ int pd_check_power_swap(int port)
return 0;
}
-int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Always refuse data swap */
return 0;
}
-void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Do nothing */
}
-void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
- int flags)
+void pd_check_pr_role(int port, enum pd_power_role pr_role, int flags)
{
}
-void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
}
/* ----------------- Vendor Defined Messages ------------------ */
@@ -103,8 +97,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
- CONFIG_USB_PD_IDENTITY_SW_VERS,
- 0, 0, 0, 0, /* SS[TR][12] */
+ CONFIG_USB_PD_IDENTITY_SW_VERS, 0, 0, 0,
+ 0, /* SS[TR][12] */
0, /* Vconn power */
0, /* Vconn power required */
1, /* Vbus power required */
@@ -130,18 +124,16 @@ static int svdm_response_svids(int port, uint32_t *payload)
#define OPOS_DP 1
#define OPOS_GFU 1
-const uint32_t vdo_dp_modes[1] = {
- VDO_MODE_DP(0, /* UFP pin cfg supported : none */
+const uint32_t vdo_dp_modes[1] = {
+ VDO_MODE_DP(0, /* UFP pin cfg supported : none */
MODE_DP_PIN_E, /* DFP pin cfg supported */
- 1, /* no usb2.0 signalling in AMode */
- CABLE_PLUG, /* its a plug */
- MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
- MODE_DP_SNK) /* Its a sink only */
+ 1, /* no usb2.0 signalling in AMode */
+ CABLE_PLUG, /* its a plug */
+ MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
+ MODE_DP_SNK) /* Its a sink only */
};
-const uint32_t vdo_goog_modes[1] = {
- VDO_MODE_GOOGLE(MODE_GOOGLE_FU)
-};
+const uint32_t vdo_goog_modes[1] = { VDO_MODE_GOOGLE(MODE_GOOGLE_FU) };
static int svdm_response_modes(int port, uint32_t *payload)
{
@@ -163,13 +155,15 @@ static int dp_status(int port, uint32_t *payload)
if (opos != OPOS_DP)
return 0; /* nak */
- payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
- (hpd == 1), /* HPD_HI|LOW */
- 0, /* request exit DP */
- 0, /* request exit USB */
- 0, /* MF pref */
+ payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
+ (hpd == 1), /* HPD_HI|LOW */
+ 0, /* request exit DP */
+ 0, /* request exit USB */
+ 0, /* MF pref */
gpio_get_level(GPIO_PD_SBU_ENABLE),
- 0, /* power low */
+ 0, /* power
+ low
+ */
0x2);
return 2;
}
@@ -249,8 +243,7 @@ const struct svdm_response svdm_rsp = {
.exit_mode = &svdm_exit_mode,
};
-int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
{
int rsize;
diff --git a/board/dirinboz/battery.c b/board/dirinboz/battery.c
index c148f9aa52..d02d424ba4 100644
--- a/board/dirinboz/battery.c
+++ b/board/dirinboz/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/dirinboz/board.c b/board/dirinboz/board.c
index d49f82773b..c6e35cf7e8 100644
--- a/board/dirinboz/board.c
+++ b/board/dirinboz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#include "cros_board_info.h"
#include "charge_state.h"
#include "driver/bc12/pi3usb9201.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/usb_mux/amd_fp5.h"
@@ -35,8 +35,8 @@
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* This I2C moved. Temporarily detect and support the V0 HW. */
int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1;
@@ -98,33 +98,43 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since PI3USB221 is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
-struct usb_mux usbc1_amd_fp5_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+struct usb_mux_chain usbc1_amd_fp5_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .next_mux = &usbc1_amd_fp5_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ },
+ .next = &usbc1_amd_fp5_usb_mux,
}
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -167,8 +177,7 @@ void ppc_interrupt(enum gpio_signal signal)
int board_set_active_charge_port(int port)
{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (port == CHARGE_PORT_NONE) {
@@ -189,7 +198,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
/* Check if the port is sourcing VBUS. */
if (ppc_is_sourcing_vbus(port)) {
CPRINTFUSB("Skip enable C%d", port);
@@ -291,7 +299,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -362,11 +369,9 @@ int board_pd_set_frs_enable(int port, int enable)
/* Use the TCPC to enable fast switch when FRS included */
if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable);
} else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, !!enable);
}
return rv;
@@ -434,14 +439,13 @@ int usb_port_enable[USBA_PORT_COUNT] = {
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {0, 5}, {1, 1}, {1, 0}, {0, 6}, {0, 7},
- {1, 4}, {1, 3}, {1, 6}, {1, 7}, {3, 1},
- {2, 0}, {1, 5}, {2, 6}, {2, 7}, {2, 1},
- {2, 4}, {2, 5}, {1, 2}, {2, 3}, {2, 2},
- {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 }, { 1, 4 },
+ { 1, 3 }, { 1, 6 }, { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 },
+ { 2, 6 }, { 2, 7 }, { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 },
+ { 2, 3 }, { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
#define CHARGING_CURRENT_500mA 500
@@ -501,13 +505,13 @@ int charger_profile_override(struct charge_state_data *curr)
}
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
return EC_RES_INVALID_PARAM;
}
diff --git a/board/dirinboz/board.h b/board/dirinboz/board.h
index 67e083b51f..a27176fcae 100644
--- a/board/dirinboz/board.h
+++ b/board/dirinboz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,7 +20,7 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PORT_ENABLE_DYNAMIC
-#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 40000
#define CONFIG_CHARGER_PROFILE_OVERRIDE
@@ -35,39 +35,35 @@
#undef CONFIG_LED_ONOFF_STATES
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
/* This I2C moved. Temporarily detect and support the V0 HW. */
extern int I2C_PORT_BATTERY;
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_SIMPLO_COS,
@@ -79,20 +75,11 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
-enum ioex_port {
- IOEX_C0_NCT3807 = 0,
- IOEX_C1_NCT3807,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT3807 = 0, IOEX_C1_NCT3807, IOEX_PORT_COUNT };
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB3_C0_DP2_HPD \
- : GPIO_DP1_HPD)
+#define PORT_TO_HPD(port) ((port == 0) ? GPIO_USB3_C0_DP2_HPD : GPIO_DP1_HPD)
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -101,17 +88,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
diff --git a/board/dirinboz/build.mk b/board/dirinboz/build.mk
index 1c0cbc4f63..45c71f962c 100644
--- a/board/dirinboz/build.mk
+++ b/board/dirinboz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dirinboz/ec.tasklist b/board/dirinboz/ec.tasklist
index 3a08ebc972..779bd4fdd6 100644
--- a/board/dirinboz/ec.tasklist
+++ b/board/dirinboz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dirinboz/gpio.inc b/board/dirinboz/gpio.inc
index f4de7e567a..ab1b83c55f 100644
--- a/board/dirinboz/gpio.inc
+++ b/board/dirinboz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dirinboz/led.c b/board/dirinboz/led.c
index b05ade3bcc..1c53b9173e 100644
--- a/board/dirinboz/led.c
+++ b/board/dirinboz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,13 +28,10 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- LEFT_PORT = 0,
- RIGHT_PORT
-};
+enum led_port { LEFT_PORT = 0, RIGHT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
@@ -44,9 +41,9 @@ static void led_set_color_battery(int port, enum led_color color)
cbi_get_board_version(&board_ver);
amber_led = (port == LEFT_PORT ? GPIO_LED_CHRG_L :
- IOEX_C1_CHARGER_LED_AMBER_DB);
+ IOEX_C1_CHARGER_LED_AMBER_DB);
white_led = (port == LEFT_PORT ? GPIO_LED_FULL_L :
- IOEX_C1_CHARGER_LED_WHITE_DB);
+ IOEX_C1_CHARGER_LED_WHITE_DB);
if ((board_ver >= 3) && (port == RIGHT_PORT)) {
led_batt_on_lvl = 1;
@@ -126,17 +123,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -145,16 +141,14 @@ static void led_set_battery(void)
* design, blinking both two side battery white LEDs to indicate
* system suspend with non-charging state.
*/
- if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
- led_set_color_battery(RIGHT_PORT, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(LEFT_PORT, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(RIGHT_PORT,
+ power_ticks & 0x4 ? LED_WHITE : LED_OFF);
+ led_set_color_battery(LEFT_PORT,
+ power_ticks & 0x4 ? LED_WHITE : LED_OFF);
return;
}
@@ -168,9 +162,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
@@ -179,19 +176,20 @@ static void led_set_battery(void)
led_set_color_battery(LEFT_PORT, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c
index 086e5260a2..478bce663c 100644
--- a/board/discovery-stm32f072/board.c
+++ b/board/discovery-stm32f072/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,31 +28,22 @@ void button_event(enum gpio_signal signal);
#include "gpio_list.h"
static enum gpio_signal const usb_gpio_list[] = {
- GPIO_USER_BUTTON,
- GPIO_LED_U,
- GPIO_LED_D,
- GPIO_LED_L,
- GPIO_LED_R,
+ GPIO_USER_BUTTON, GPIO_LED_U, GPIO_LED_D, GPIO_LED_L, GPIO_LED_R,
};
/*
* This instantiates struct usb_gpio_config const usb_gpio, plus several other
* variables, all named something beginning with usb_gpio_
*/
-USB_GPIO_CONFIG(usb_gpio,
- usb_gpio_list,
- USB_IFACE_GPIO,
- USB_EP_GPIO);
+USB_GPIO_CONFIG(usb_gpio, usb_gpio_list, USB_IFACE_GPIO, USB_EP_GPIO);
/******************************************************************************
* Setup USART1 as a loopback device, it just echo's back anything sent to it.
*/
static struct usart_config const loopback_usart;
-static struct queue const loopback_queue =
- QUEUE_DIRECT(64, uint8_t,
- loopback_usart.producer,
- loopback_usart.consumer);
+static struct queue const loopback_queue = QUEUE_DIRECT(
+ 64, uint8_t, loopback_usart.producer, loopback_usart.consumer);
static struct usart_rx_dma const loopback_rx_dma =
USART_RX_DMA(STM32_DMAC_CH3, 8);
@@ -60,14 +51,9 @@ static struct usart_rx_dma const loopback_rx_dma =
static struct usart_tx_dma const loopback_tx_dma =
USART_TX_DMA(STM32_DMAC_CH2, 16);
-static struct usart_config const loopback_usart =
- USART_CONFIG(usart1_hw,
- loopback_rx_dma.usart_rx,
- loopback_tx_dma.usart_tx,
- 115200,
- 0,
- loopback_queue,
- loopback_queue);
+static struct usart_config const loopback_usart = USART_CONFIG(
+ usart1_hw, loopback_rx_dma.usart_rx, loopback_tx_dma.usart_tx, 115200,
+ 0, loopback_queue, loopback_queue);
/******************************************************************************
* Forward USART4 as a simple USB serial interface.
@@ -75,36 +61,24 @@ static struct usart_config const loopback_usart =
static struct usart_config const forward_usart;
struct usb_stream_config const forward_usb;
-static struct queue const usart_to_usb = QUEUE_DIRECT(64, uint8_t,
- forward_usart.producer,
- forward_usb.consumer);
-static struct queue const usb_to_usart = QUEUE_DIRECT(64, uint8_t,
- forward_usb.producer,
- forward_usart.consumer);
+static struct queue const usart_to_usb =
+ QUEUE_DIRECT(64, uint8_t, forward_usart.producer, forward_usb.consumer);
+static struct queue const usb_to_usart =
+ QUEUE_DIRECT(64, uint8_t, forward_usb.producer, forward_usart.consumer);
static struct usart_tx_dma const forward_tx_dma =
USART_TX_DMA(STM32_DMAC_CH7, 16);
static struct usart_config const forward_usart =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- forward_tx_dma.usart_tx,
- 115200,
- 0,
- usart_to_usb,
- usb_to_usart);
-
-#define USB_STREAM_RX_SIZE 16
-#define USB_STREAM_TX_SIZE 16
-
-USB_STREAM_CONFIG(forward_usb,
- USB_IFACE_STREAM,
- USB_STR_STREAM_NAME,
- USB_EP_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart,
- usart_to_usb)
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, forward_tx_dma.usart_tx,
+ 115200, 0, usart_to_usb, usb_to_usart);
+
+#define USB_STREAM_RX_SIZE 16
+#define USB_STREAM_TX_SIZE 16
+
+USB_STREAM_CONFIG(forward_usb, USB_IFACE_STREAM, USB_STR_STREAM_NAME,
+ USB_EP_STREAM, USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart, usart_to_usb)
/******************************************************************************
* Handle button presses by cycling the LEDs on the board. Also run a tick
@@ -135,18 +109,17 @@ DECLARE_HOOK(HOOK_TICK, usb_gpio_tick, HOOK_PRIO_DEFAULT);
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("discovery-stm32f072"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_STREAM_NAME] = USB_STRING_DESC("Forward"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("discovery-stm32f072"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_STREAM_NAME] = USB_STRING_DESC("Forward"),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"),
- [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
+ [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
-
/******************************************************************************
* Support SPI bridging over USB, this requires usb_spi_board_enable and
* usb_spi_board_disable to be defined to enable and disable the SPI bridge.
@@ -154,7 +127,7 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS},
+ { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
diff --git a/board/discovery-stm32f072/board.h b/board/discovery-stm32f072/board.h
index b889ebc8fe..d5db803b65 100644
--- a/board/discovery-stm32f072/board.h
+++ b/board/discovery-stm32f072/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,27 +32,26 @@
#define CONFIG_USB_CONSOLE
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_STREAM 0
-#define USB_IFACE_GPIO 1
-#define USB_IFACE_SPI 2
+#define USB_IFACE_STREAM 0
+#define USB_IFACE_GPIO 1
+#define USB_IFACE_SPI 2
#define USB_IFACE_CONSOLE 3
-#define USB_IFACE_COUNT 4
+#define USB_IFACE_COUNT 4
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
-#define USB_EP_STREAM 1
-#define USB_EP_GPIO 2
-#define USB_EP_SPI 3
+#define USB_EP_STREAM 1
+#define USB_EP_GPIO 2
+#define USB_EP_SPI 3
#define USB_EP_CONSOLE 4
-#define USB_EP_COUNT 5
+#define USB_EP_COUNT 5
/* Enable control of GPIOs over USB */
#define CONFIG_USB_GPIO
/* Enable control of SPI over USB */
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FLASH_PORT 0 /* First SPI controller port */
-
+#define CONFIG_SPI_FLASH_PORT 0 /* First SPI controller port */
#define CONFIG_USB_SPI
diff --git a/board/discovery-stm32f072/build.mk b/board/discovery-stm32f072/build.mk
index c1892335ed..21613f74eb 100644
--- a/board/discovery-stm32f072/build.mk
+++ b/board/discovery-stm32f072/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/discovery-stm32f072/ec.tasklist b/board/discovery-stm32f072/ec.tasklist
index cc4c2ad42d..2bd7e2f5ce 100644
--- a/board/discovery-stm32f072/ec.tasklist
+++ b/board/discovery-stm32f072/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/discovery-stm32f072/gpio.inc b/board/discovery-stm32f072/gpio.inc
index 65bdd0179b..25b5f1b0e0 100644
--- a/board/discovery-stm32f072/gpio.inc
+++ b/board/discovery-stm32f072/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/discovery-stm32f072/openocd-flash.cfg b/board/discovery-stm32f072/openocd-flash.cfg
index ec32416934..05a697acf8 100644
--- a/board/discovery-stm32f072/openocd-flash.cfg
+++ b/board/discovery-stm32f072/openocd-flash.cfg
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/discovery/board.c b/board/discovery/board.c
index 0d4cde2e7c..a9ba174a4f 100644
--- a/board/discovery/board.c
+++ b/board/discovery/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,10 +39,8 @@ DECLARE_HOOK(HOOK_TICK, usb_gpio_tick, HOOK_PRIO_DEFAULT);
*/
static struct usart_config const loopback_usart;
-static struct queue const loopback_queue =
- QUEUE_DIRECT(64, uint8_t,
- loopback_usart.producer,
- loopback_usart.consumer);
+static struct queue const loopback_queue = QUEUE_DIRECT(
+ 64, uint8_t, loopback_usart.producer, loopback_usart.consumer);
static struct usart_rx_dma const loopback_rx_dma =
USART_RX_DMA(STM32_DMAC_CH6, 32);
@@ -50,14 +48,9 @@ static struct usart_rx_dma const loopback_rx_dma =
static struct usart_tx_dma const loopback_tx_dma =
USART_TX_DMA(STM32_DMAC_CH7, 16);
-static struct usart_config const loopback_usart =
- USART_CONFIG(usart2_hw,
- loopback_rx_dma.usart_rx,
- loopback_tx_dma.usart_tx,
- 115200,
- 0,
- loopback_queue,
- loopback_queue);
+static struct usart_config const loopback_usart = USART_CONFIG(
+ usart2_hw, loopback_rx_dma.usart_rx, loopback_tx_dma.usart_tx, 115200,
+ 0, loopback_queue, loopback_queue);
/******************************************************************************
* Initialize board.
diff --git a/board/discovery/board.h b/board/discovery/board.h
index ddd2461a56..e348454af1 100644
--- a/board/discovery/board.h
+++ b/board/discovery/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/discovery/build.mk b/board/discovery/build.mk
index 42f9f9a0fc..e07d8af33d 100644
--- a/board/discovery/build.mk
+++ b/board/discovery/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2013 The Chromium OS Authors. All rights reserved.
+# Copyright 2013 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/discovery/ec.tasklist b/board/discovery/ec.tasklist
index 3822ab3779..e58390c01d 100644
--- a/board/discovery/ec.tasklist
+++ b/board/discovery/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/discovery/gpio.inc b/board/discovery/gpio.inc
index 821f38ca46..da2742ff7a 100644
--- a/board/discovery/gpio.inc
+++ b/board/discovery/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/discovery/openocd-flash.cfg b/board/discovery/openocd-flash.cfg
index 6426ad5473..f87c191576 100644
--- a/board/discovery/openocd-flash.cfg
+++ b/board/discovery/openocd-flash.cfg
@@ -1,4 +1,4 @@
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/dojo/battery.c b/board/dojo/battery.c
index 290bf6067c..a766ea3e59 100644
--- a/board/dojo/battery.c
+++ b/board/dojo/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -178,19 +178,18 @@ int charger_profile_override(struct charge_state_data *curr)
chg_temp = K_TO_C(chg_temp);
prev_chg_lvl = chg_lvl;
- if (chg_temp <= temp_chg_table[chg_lvl].lo_thre &&
- chg_lvl > 0)
+ if (chg_temp <= temp_chg_table[chg_lvl].lo_thre && chg_lvl > 0)
chg_lvl--;
else if (chg_temp >= temp_chg_table[chg_lvl].hi_thre &&
- chg_lvl < CHG_LEVEL_COUNT - 1)
+ chg_lvl < CHG_LEVEL_COUNT - 1)
chg_lvl++;
curr->requested_current = MIN(curr->requested_current,
- temp_chg_table[chg_lvl].chg_curr);
+ temp_chg_table[chg_lvl].chg_curr);
- if(chg_lvl != prev_chg_lvl)
+ if (chg_lvl != prev_chg_lvl)
ccprints("Override chg curr to %dmA by chg LEVEL_%d",
- curr->requested_current, chg_lvl);
+ curr->requested_current, chg_lvl);
}
return 0;
diff --git a/board/dojo/board.c b/board/dojo/board.c
index f539d17d2d..65a1635111 100644
--- a/board/dojo/board.c
+++ b/board/dojo/board.c
@@ -1,16 +1,20 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Dojo board configuration */
#include "cbi_fw_config.h"
+#include "cbi_ssfc.h"
+#include "charge_manager.h"
+#include "charge_state_v2.h"
#include "common.h"
#include "console.h"
#include "cros_board_info.h"
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/accelgyro_icm426xx.h"
+#include "driver/accelgyro_icm42607.h"
#include "driver/accelgyro_icm_common.h"
#include "driver/accelgyro_bmi_common_public.h"
#include "driver/accelgyro_bmi260_public.h"
@@ -25,10 +29,11 @@
#include "system.h"
#include "usb_mux.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
uint32_t board_version;
+enum ec_ssfc_base_sensor base_sensor;
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -45,6 +50,31 @@ __override struct keyboard_scan_config keyscan_config = {
},
};
+/* Support keyboard factory test */
+#ifdef CONFIG_KEYBOARD_FACTORY_TEST
+/*
+ * Map keyboard connector pins to EC GPIO pins for factory test.
+ * Pins mapped to {-1, -1} are skipped.
+ * The connector has 30 pins total, and there is no pin 0.
+ */
+const int keyboard_factory_scan_pins[][2] = {
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { -1, -1 }, { -1, -1 }, { GPIO_KSO_L, 5 },
+ { GPIO_KSO_L, 6 }, { -1, -1 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { GPIO_KSO_H, 5 },
+ { -1, -1 }, { GPIO_KSO_H, 6 }, { -1, -1 },
+ { -1, -1 },
+};
+
+const int keyboard_factory_scan_pins_used =
+ ARRAY_SIZE(keyboard_factory_scan_pins);
+#endif
+
/* Vol-up key matrix at T13 */
const struct vol_up_key vol_up_key_matrix_T13 = {
.row = 3,
@@ -66,17 +96,20 @@ static void board_update_vol_up_key(void)
* Set vol up key to T13 for KB_BL_TOGGLE_KEY_PRESENT
* and board_version >= 2
*/
- set_vol_up_key(vol_up_key_matrix_T13.row, vol_up_key_matrix_T13.col);
+ set_vol_up_key(vol_up_key_matrix_T13.row,
+ vol_up_key_matrix_T13.col);
} else {
/*
* Set vol up key to T12 for KB_BL_TOGGLE_KEY_ABSENT
* and board_version >= 2
*/
- set_vol_up_key(vol_up_key_matrix_T12.row, vol_up_key_matrix_T12.col);
+ set_vol_up_key(vol_up_key_matrix_T12.row,
+ vol_up_key_matrix_T12.col);
}
} else {
/* Set vol up key to T13 for board_version < 2 */
- set_vol_up_key(vol_up_key_matrix_T13.row, vol_up_key_matrix_T13.col);
+ set_vol_up_key(vol_up_key_matrix_T13.row,
+ vol_up_key_matrix_T13.col);
}
}
@@ -105,27 +138,26 @@ static struct mutex g_base_mutex;
static struct mutex g_lid_mutex;
static struct icm_drv_data_t g_icm426xx_data;
+static struct icm_drv_data_t g_icm42607_data;
static struct bmi_drv_data_t g_bmi260_data;
static struct kionix_accel_data g_kx022_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t bmi260_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t icm42607_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
+
+static const mat33_fp_t icm426xx_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -136,44 +168,46 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_ACCEL] = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .chip = MOTIONSENSE_CHIP_BMI260,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
+ .drv = &bmi260_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
+ .drv_data = &g_bmi260_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs. */
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
- .min_frequency = ICM426XX_ACCEL_MIN_FREQ,
- .max_frequency = ICM426XX_ACCEL_MAX_FREQ,
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g */
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
.odr = 10000 | ROUND_UP_FLAG,
.ec_rate = 100 * MSEC,
},
+ /* Sensor on in S3 */
[SENSOR_CONFIG_EC_S3] = {
.odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
},
},
},
[BASE_GYRO] = {
.name = "Base Gyro",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .chip = MOTIONSENSE_CHIP_BMI260,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
+ .drv = &bmi260_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
+ .drv_data = &g_bmi260_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
},
[LID_ACCEL] = {
.name = "Lid Accel",
@@ -205,69 +239,117 @@ struct motion_sensor_t motion_sensors[] = {
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-struct motion_sensor_t bmi260_base_accel = {
+struct motion_sensor_t icm42607_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI260,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi260_drv,
+ .drv = &icm42607_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi260_data,
+ .drv_data = &g_icm42607_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
- .rot_standard_ref = &bmi260_standard_ref,
- .min_frequency = BMI_ACCEL_MIN_FREQ,
- .max_frequency = BMI_ACCEL_MAX_FREQ,
- .default_range = 4, /* g */
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
+ .rot_standard_ref = &icm42607_standard_ref,
+ .min_frequency = ICM42607_ACCEL_MIN_FREQ,
+ .max_frequency = ICM42607_ACCEL_MAX_FREQ,
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
.odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
},
- /* Sensor on in S3 */
+ /* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S3] = {
.odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+};
+
+struct motion_sensor_t icm42607_base_gyro = {
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm42607_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &icm42607_standard_ref,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
+};
+
+struct motion_sensor_t icm426xx_base_accel = {
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm426xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm426xx_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs. */
+ .rot_standard_ref = &icm426xx_standard_ref,
+ .min_frequency = ICM426XX_ACCEL_MIN_FREQ,
+ .max_frequency = ICM426XX_ACCEL_MAX_FREQ,
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
.ec_rate = 100 * MSEC,
},
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
},
};
-struct motion_sensor_t bmi260_base_gyro = {
+struct motion_sensor_t icm426xx_base_gyro = {
.name = "Base Gyro",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI260,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi260_drv,
+ .drv = &icm426xx_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi260_data,
+ .drv_data = &g_icm426xx_data,
.port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
.default_range = 1000, /* dps */
- .rot_standard_ref = &bmi260_standard_ref,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
+ .rot_standard_ref = &icm426xx_standard_ref,
+ .min_frequency = ICM426XX_GYRO_MIN_FREQ,
+ .max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
static void board_update_motion_sensor_config(void)
{
- if (board_version >= 2) {
- motion_sensors[BASE_ACCEL] = bmi260_base_accel;
- motion_sensors[BASE_GYRO] = bmi260_base_gyro;
- ccprints("BASE Accelgyro is BMI260");
- } else {
+ if (board_version <= 1 || base_sensor == SSFC_SENSOR_ICM426XX) {
+ motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
+ motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
ccprints("BASE Accelgyro is ICM426XX");
+ } else if (base_sensor == SSFC_SENSOR_ICM42607) {
+ motion_sensors[BASE_ACCEL] = icm42607_base_accel;
+ motion_sensors[BASE_GYRO] = icm42607_base_gyro;
+ ccprints("BASE Accelgyro is ICM42607");
+ } else {
+ ccprints("BASE Accelgyro is BMI260");
}
}
void motion_interrupt(enum gpio_signal signal)
{
- if (board_version >= 2)
- bmi260_interrupt(signal);
- else
+ if (board_version <= 1 || base_sensor == SSFC_SENSOR_ICM426XX)
icm426xx_interrupt(signal);
+ else if (base_sensor == SSFC_SENSOR_ICM42607)
+ icm42607_interrupt(signal);
+ else
+ bmi260_interrupt(signal);
}
/* PWM */
@@ -299,7 +381,7 @@ const struct pwm_t pwm_channels[] = {
},
[PWM_CH_KBLIGHT] = {
.channel = 3,
- .freq_hz = 10000,
+ .freq_hz = 2400,
.pcfsr_sel = PWM_PRESCALER_C6,
},
[PWM_CH_LED_C0_WHITE] = {
@@ -319,8 +401,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* USB Mux */
-static int board_ps8762_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8762_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
/* Make sure the PS8802 is awake */
RETURN_ERROR(ps8802_i2c_wake(me));
@@ -328,21 +409,18 @@ static int board_ps8762_mux_set(const struct usb_mux *me,
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- RETURN_ERROR(ps8802_i2c_field_update16(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_USB_SSEQ_LEVEL,
- PS8802_USBEQ_LEVEL_UP_MASK,
- PS8802_USBEQ_LEVEL_UP_12DB));
+ RETURN_ERROR(ps8802_i2c_field_update16(
+ me, PS8802_REG_PAGE2, PS8802_REG2_USB_SSEQ_LEVEL,
+ PS8802_USBEQ_LEVEL_UP_MASK,
+ PS8802_USBEQ_LEVEL_UP_12DB));
}
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- RETURN_ERROR(ps8802_i2c_field_update8(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_DPEQ_LEVEL,
- PS8802_DPEQ_LEVEL_UP_MASK,
- PS8802_DPEQ_LEVEL_UP_9DB));
+ RETURN_ERROR(ps8802_i2c_field_update8(
+ me, PS8802_REG_PAGE2, PS8802_REG2_DPEQ_LEVEL,
+ PS8802_DPEQ_LEVEL_UP_MASK, PS8802_DPEQ_LEVEL_UP_9DB));
}
return EC_SUCCESS;
@@ -350,11 +428,10 @@ static int board_ps8762_mux_set(const struct usb_mux *me,
static int board_ps8762_mux_init(const struct usb_mux *me)
{
- return ps8802_i2c_field_update8(
- me, PS8802_REG_PAGE1,
- PS8802_REG_DCIRX,
- PS8802_AUTO_DCI_MODE_DISABLE | PS8802_FORCE_DCI_MODE,
- PS8802_AUTO_DCI_MODE_DISABLE);
+ return ps8802_i2c_field_update8(me, PS8802_REG_PAGE1, PS8802_REG_DCIRX,
+ PS8802_AUTO_DCI_MODE_DISABLE |
+ PS8802_FORCE_DCI_MODE,
+ PS8802_AUTO_DCI_MODE_DISABLE);
}
static int board_anx3443_mux_set(const struct usb_mux *me,
@@ -365,24 +442,40 @@ static int board_anx3443_mux_set(const struct usb_mux *me,
return EC_SUCCESS;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX0,
- .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS,
- .driver = &ps8802_usb_mux_driver,
- .board_init = &board_ps8762_mux_init,
- .board_set = &board_ps8762_mux_set,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX0,
+ .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS,
+ .driver = &ps8802_usb_mux_driver,
+ .board_init = &board_ps8762_mux_init,
+ .board_set = &board_ps8762_mux_set,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_USB_MUX1,
- .i2c_addr_flags = ANX3443_I2C_ADDR0_FLAGS,
- .driver = &anx3443_usb_mux_driver,
- .board_set = &board_anx3443_mux_set,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_USB_MUX1,
+ .i2c_addr_flags = ANX3443_I2C_ADDR0_FLAGS,
+ .driver = &anx3443_usb_mux_driver,
+ .board_set = &board_anx3443_mux_set,
+ },
},
};
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ /* Limit input current lower than 2944 mA for safety */
+ charge_ma = MIN(charge_ma, 2944);
+
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
+
/* Initialize board. */
static void board_init(void)
{
@@ -393,21 +486,34 @@ static void board_init(void)
/* Store board version for use of something */
cbi_get_board_version(&board_version);
+ /* Store base sensor to recognize which base sensor we are using */
+ base_sensor = get_cbi_ssfc_base_sensor();
+
board_update_motion_sensor_config();
board_update_vol_up_key();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-static void board_do_chipset_resume(void)
+static void enable_nvme(void)
{
gpio_set_level(GPIO_EN_PP3300_SSD, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME_INIT, enable_nvme, HOOK_PRIO_FIRST);
+
+static void disable_nvme(void)
+{
+ gpio_set_level(GPIO_EN_PP3300_SSD, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, disable_nvme, HOOK_PRIO_DEFAULT);
+
+static void board_do_chipset_resume(void)
+{
gpio_set_level(GPIO_EN_KB_BL, 1);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_do_chipset_resume, HOOK_PRIO_DEFAULT);
static void board_do_chipset_suspend(void)
{
- gpio_set_level(GPIO_EN_PP3300_SSD, 0);
gpio_set_level(GPIO_EN_KB_BL, 0);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_do_chipset_suspend, HOOK_PRIO_DEFAULT);
diff --git a/board/dojo/board.h b/board/dojo/board.h
index 734b73bac7..cc2d5eba2f 100644
--- a/board/dojo/board.h
+++ b/board/dojo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,6 +13,10 @@
#define CONFIG_LTO
#define CONFIG_PRESERVE_LOGS
+/* Watchdog period in ms */
+#undef CONFIG_WATCHDOG_PERIOD_MS
+#define CONFIG_WATCHDOG_PERIOD_MS 2500
+
/*
* TODO: Remove this option once the VBAT no longer keeps high when
* system's power isn't presented.
@@ -25,6 +29,7 @@
#define CONFIG_BATTERY_COUNT 1
#define CONFIG_HOSTCMD_BATTERY_V2
#define CONFIG_BATTERY_PRESENT_CUSTOM
+#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_VENDOR_PARAM
/* BC12 */
@@ -32,18 +37,24 @@
/* Charger */
#define CONFIG_CHARGER_PROFILE_OVERRIDE
+/* Chipset */
+#define CONFIG_CHIPSET_RESUME_INIT_HOOK
+
/* PD / USB-C / PPC */
-#undef CONFIG_USB_PD_DEBUG_LEVEL /* default to 1, configurable in ec console */
+#undef CONFIG_USB_PD_DEBUG_LEVEL /* default to 1, configurable in ec console \
+ */
/* Optional console commands */
#define CONFIG_CMD_FLASH
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_STACKOVERFLOW
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
/* Keyboard */
#define CONFIG_KEYBOARD_REFRESH_ROW3
+#define CONFIG_KEYBOARD_FACTORY_TEST
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
/* Sensor */
#define CONFIG_GMR_TABLET_MODE
@@ -56,6 +67,11 @@
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+/* ICM42607 Base accel/gyro*/
+#define CONFIG_ACCELGYRO_ICM42607
+#define CONFIG_ACCELGYRO_ICM42607_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+
/* BMI260 accel/gyro in base */
#define CONFIG_ACCELGYRO_BMI260
#define CONFIG_ACCELGYRO_BMI260_INT_EVENT \
diff --git a/board/dojo/build.mk b/board/dojo/build.mk
index 25af05d562..740cd30a9d 100644
--- a/board/dojo/build.mk
+++ b/board/dojo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -11,4 +11,4 @@ CHIP_FAMILY:=it8xxx2
CHIP_VARIANT:=it81202bx_1024
BASEBOARD:=cherry
-board-y+=led.o battery.o board.o cbi_fw_config.o
+board-y+=led.o battery.o board.o cbi_fw_config.o cbi_ssfc.o
diff --git a/board/dojo/cbi_fw_config.c b/board/dojo/cbi_fw_config.c
index 9972e02249..96e6d9b266 100644
--- a/board/dojo/cbi_fw_config.c
+++ b/board/dojo/cbi_fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,12 +30,12 @@ DECLARE_HOOK(HOOK_INIT, cbi_fw_config_init, HOOK_PRIO_FIRST);
enum fw_config_kblight_type get_cbi_fw_config_kblight(void)
{
- return ((cached_fw_config & FW_CONFIG_KB_BL_MASK)
- >> FW_CONFIG_KB_BL_OFFSET);
+ return ((cached_fw_config & FW_CONFIG_KB_BL_MASK) >>
+ FW_CONFIG_KB_BL_OFFSET);
}
enum fw_config_kblayout_type get_cbi_fw_config_kblayout(void)
{
- return ((cached_fw_config & FW_CONFIG_KB_LAYOUT_MASK)
- >> FW_CONFIG_KB_LAYOUT_OFFSET);
+ return ((cached_fw_config & FW_CONFIG_KB_LAYOUT_MASK) >>
+ FW_CONFIG_KB_LAYOUT_OFFSET);
}
diff --git a/board/dojo/cbi_fw_config.h b/board/dojo/cbi_fw_config.h
index 7f98585b84..6ca0e5b9a8 100644
--- a/board/dojo/cbi_fw_config.h
+++ b/board/dojo/cbi_fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,8 +17,8 @@ enum fw_config_kblight_type {
KB_BL_ABSENT = 0,
KB_BL_PRESENT = 1,
};
-#define FW_CONFIG_KB_BL_OFFSET 0
-#define FW_CONFIG_KB_BL_MASK GENMASK(0, 0)
+#define FW_CONFIG_KB_BL_OFFSET 0
+#define FW_CONFIG_KB_BL_MASK GENMASK(0, 0)
/*
* Keyboard layout (bit 4-5)
@@ -27,8 +27,8 @@ enum fw_config_kblayout_type {
KB_BL_TOGGLE_KEY_ABSENT = 0, /* Vol-up key on T12 */
KB_BL_TOGGLE_KEY_PRESENT = 1, /* Vol-up key on T13 */
};
-#define FW_CONFIG_KB_LAYOUT_OFFSET 4
-#define FW_CONFIG_KB_LAYOUT_MASK GENMASK(5, 4)
+#define FW_CONFIG_KB_LAYOUT_OFFSET 4
+#define FW_CONFIG_KB_LAYOUT_MASK GENMASK(5, 4)
enum fw_config_kblight_type get_cbi_fw_config_kblight(void);
enum fw_config_kblayout_type get_cbi_fw_config_kblayout(void);
diff --git a/board/shotzo/cbi_ssfc.c b/board/dojo/cbi_ssfc.c
index 9f1383b455..3b7ed483f5 100644
--- a/board/shotzo/cbi_ssfc.c
+++ b/board/dojo/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/* Cache SSFC on init since we don't expect it to change in runtime */
-static union dedede_cbi_ssfc cached_ssfc;
+static union dojo_cbi_ssfc cached_ssfc;
BUILD_ASSERT(sizeof(cached_ssfc) == sizeof(uint32_t));
static void cbi_ssfc_init(void)
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/shotzo/cbi_ssfc.h b/board/dojo/cbi_ssfc.h
index ddfada8a68..da37dbaca1 100644
--- a/board/shotzo/cbi_ssfc.h
+++ b/board/dojo/cbi_ssfc.h
@@ -1,15 +1,15 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#ifndef _DEDEDE_CBI_SSFC__H_
-#define _DEDEDE_CBI_SSFC__H_
+#ifndef _DOJO_CBI_SSFC__H_
+#define _DOJO_CBI_SSFC__H_
#include "stdint.h"
/****************************************************************************
- * Dedede CBI Second Source Factory Cache
+ * Dojo CBI Second Source Factory Cache
*/
/*
@@ -17,10 +17,9 @@
*/
enum ec_ssfc_base_sensor {
SSFC_SENSOR_BASE_DEFAULT = 0,
- SSFC_SENSOR_BMI160 = 1,
+ SSFC_SENSOR_ICM42607 = 1,
SSFC_SENSOR_ICM426XX = 2,
- SSFC_SENSOR_LSM6DSM = 3,
- SSFC_SENSOR_ICM42607 = 4
+ SSFC_SENSOR_BMI260 = 3,
};
/*
@@ -28,11 +27,11 @@ enum ec_ssfc_base_sensor {
*/
enum ec_ssfc_lid_sensor {
SSFC_SENSOR_LID_DEFAULT = 0,
- SSFC_SENSOR_BMA255 = 1,
- SSFC_SENSOR_BMA422 = 2,
+ SSFC_SENSOR_BMA422 = 1,
+ SSFC_SENSOR_KX022 = 2,
};
-union dedede_cbi_ssfc {
+union dojo_cbi_ssfc {
struct {
uint32_t base_sensor : 3;
uint32_t lid_sensor : 3;
@@ -55,5 +54,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
-#endif /* _DEDEDE_CBI_SSFC__H_ */
+#endif /* _DOJO_CBI_SSFC__H_ */
diff --git a/board/dojo/ec.tasklist b/board/dojo/ec.tasklist
index f9050fef87..5ce0fab583 100644
--- a/board/dojo/ec.tasklist
+++ b/board/dojo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dojo/gpio.inc b/board/dojo/gpio.inc
index c215d3f5d4..0fb85b47b7 100644
--- a/board/dojo/gpio.inc
+++ b/board/dojo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -118,6 +118,12 @@ ALTERNATE(PIN_MASK(I, 0b11001001), 0, MODULE_ADC, 0) /* ADC 0,3,6,7 */
/* SPI */
ALTERNATE(PIN_MASK(M, 0x33), 0, MODULE_SPI, 0) /* SPI */
+/* KEYBOARD */
+ALTERNATE(PIN_MASK(KSI, 0xFF), 0, MODULE_KEYBOARD_SCAN, 0) /* KSI0-7 */
+ALTERNATE(PIN_MASK(KSO_H, 0xFF), 0, MODULE_KEYBOARD_SCAN, 0) /* KSO8-15 */
+ALTERNATE(PIN_MASK(KSO_L, 0xFB), 0, MODULE_KEYBOARD_SCAN, 0) /* KSO0-1, 3-7 */
+GPIO(EC_KSO_02_INV, PIN(KSO_L, 2), GPIO_OUT_HIGH) /* KSO2 inverted */
+
/* Unimplemented Pins */
GPIO(PG_PP5000_S5_OD, PIN(D, 2), GPIO_INPUT)
/* *_ODL pin has external pullup so don't pull it down. */
diff --git a/board/dojo/led.c b/board/dojo/led.c
index 38d0e4904b..4b2b379a1b 100644
--- a/board/dojo/led.c
+++ b/board/dojo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -38,7 +38,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
enum led_port {
@@ -49,15 +49,15 @@ enum led_port {
static void battery_led_set_color(enum led_port port, enum led_color color)
{
pwm_enable(port ? PWM_CH_LED_C1_AMBER : PWM_CH_LED_C0_AMBER,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
pwm_enable(port ? PWM_CH_LED_C1_WHITE : PWM_CH_LED_C0_WHITE,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
static void power_led_set_color(enum led_color color)
{
pwm_enable(PWM_CH_LED_PWR,
- (color == LED_WHITE) ? PWR_LED_ON : PWR_LED_OFF);
+ (color == LED_WHITE) ? PWR_LED_ON : PWR_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -83,17 +83,17 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
static int led_set_color(enum ec_led_id led_id, enum led_color color)
{
switch (led_id) {
- case EC_LED_ID_RIGHT_LED:
- battery_led_set_color(RIGHT_PORT, color);
- break;
- case EC_LED_ID_LEFT_LED:
- battery_led_set_color(LEFT_PORT, color);
- break;
- case EC_LED_ID_POWER_LED:
- power_led_set_color(color);
- break;
- default:
- return EC_ERROR_UNKNOWN;
+ case EC_LED_ID_RIGHT_LED:
+ battery_led_set_color(RIGHT_PORT, color);
+ break;
+ case EC_LED_ID_LEFT_LED:
+ battery_led_set_color(LEFT_PORT, color);
+ break;
+ case EC_LED_ID_POWER_LED:
+ power_led_set_color(color);
+ break;
+ default:
+ return EC_ERROR_UNKNOWN;
}
return EC_SUCCESS;
@@ -121,17 +121,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
battery_led_set_color(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
battery_led_set_color(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void board_led_set_battery(void)
{
static int battery_ticks;
int battery_led_blink_cycle;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -142,18 +141,20 @@ static void board_led_set_battery(void)
break;
case PWR_STATE_DISCHARGE:
if (charge_get_percent() <= 10) {
- battery_led_blink_cycle = battery_ticks %
- (2 * TIMES_TICK_ONE_SEC);
+ battery_led_blink_cycle =
+ battery_ticks % (2 * TIMES_TICK_ONE_SEC);
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
battery_led_set_color(RIGHT_PORT,
- (battery_led_blink_cycle <
- TIMES_TICK_ONE_SEC) ?
- LED_AMBER : LED_OFF);
+ (battery_led_blink_cycle <
+ TIMES_TICK_ONE_SEC) ?
+ LED_AMBER :
+ LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
battery_led_set_color(LEFT_PORT,
- (battery_led_blink_cycle <
- TIMES_TICK_ONE_SEC) ?
- LED_AMBER : LED_OFF);
+ (battery_led_blink_cycle <
+ TIMES_TICK_ONE_SEC) ?
+ LED_AMBER :
+ LED_OFF);
} else {
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
battery_led_set_color(RIGHT_PORT, LED_OFF);
@@ -165,27 +166,30 @@ static void board_led_set_battery(void)
battery_led_blink_cycle = battery_ticks % TIMES_TICK_ONE_SEC;
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
battery_led_set_color(RIGHT_PORT,
- (battery_led_blink_cycle <
- TIMES_TICK_HALF_SEC) ?
- LED_AMBER : LED_OFF);
+ (battery_led_blink_cycle <
+ TIMES_TICK_HALF_SEC) ?
+ LED_AMBER :
+ LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
battery_led_set_color(LEFT_PORT,
- (battery_led_blink_cycle <
- TIMES_TICK_HALF_SEC) ?
- LED_AMBER : LED_OFF);
+ (battery_led_blink_cycle <
+ TIMES_TICK_HALF_SEC) ?
+ LED_AMBER :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- battery_led_blink_cycle = battery_ticks %
- (2 * TIMES_TICK_ONE_SEC);
- set_active_port_color((battery_led_blink_cycle <
- TIMES_TICK_ONE_SEC) ?
- LED_AMBER : LED_OFF);
- } else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ battery_led_blink_cycle =
+ battery_ticks % (2 * TIMES_TICK_ONE_SEC);
+ set_active_port_color(
+ (battery_led_blink_cycle < TIMES_TICK_ONE_SEC) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -205,7 +209,8 @@ static void board_led_set_power(void)
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
power_led_blink_cycle = power_ticks % (2 * TIMES_TICK_ONE_SEC);
power_led_set_color(power_led_blink_cycle < TIMES_TICK_ONE_SEC ?
- LED_WHITE : LED_OFF);
+ LED_WHITE :
+ LED_OFF);
} else {
power_led_set_color(LED_OFF);
}
@@ -214,7 +219,7 @@ static void board_led_set_power(void)
/* Called by hook task every TICK */
static void led_tick(void)
{
- if(led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
board_led_set_power();
board_led_set_battery();
diff --git a/board/dood/battery.c b/board/dood/battery.c
index da5f4c47dc..8564eb0926 100644
--- a/board/dood/battery.c
+++ b/board/dood/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/dood/board.c b/board/dood/board.c
index cef4c21268..9d395d3bfe 100644
--- a/board/dood/board.c
+++ b/board/dood/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,11 +45,11 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -59,17 +59,16 @@ static uint8_t sku_id;
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* Check PPC ID and board version to decide which one ppc is used. */
static bool support_syv_ppc(void)
@@ -87,7 +86,6 @@ static bool support_syv_ppc(void)
static void ppc_interrupt(enum gpio_signal signal)
{
-
switch (signal) {
case GPIO_USB_PD_C0_INT_ODL:
if (support_syv_ppc())
@@ -113,31 +111,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -147,11 +145,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -274,8 +270,8 @@ void board_hibernate_late(void)
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_BAT_LED_WHITE_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_AMBER_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_BAT_LED_WHITE_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_AMBER_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
@@ -307,15 +303,15 @@ void board_overcurrent_event(int port, int is_overcurrented)
}
const struct ppc_config_t ppc_syv682x_port0 = {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
const struct ppc_config_t ppc_syv682x_port1 = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static void board_setup_ppc(void)
@@ -323,12 +319,10 @@ static void board_setup_ppc(void)
if (!support_syv_ppc())
return;
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_0],
- &ppc_syv682x_port0,
- sizeof(struct ppc_config_t));
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_1],
- &ppc_syv682x_port1,
- sizeof(struct ppc_config_t));
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], &ppc_syv682x_port0,
+ sizeof(struct ppc_config_t));
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], &ppc_syv682x_port1,
+ sizeof(struct ppc_config_t));
gpio_set_flags(GPIO_USB_PD_C0_INT_ODL, GPIO_INT_BOTH);
gpio_set_flags(GPIO_USB_PD_C1_INT_ODL, GPIO_INT_BOTH);
diff --git a/board/dood/board.h b/board/dood/board.h
index 5b9b55af1b..8c9f225a59 100644
--- a/board/dood/board.h
+++ b/board/dood/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,13 +16,13 @@
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* I2C bus configuraiton */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define CONFIG_LED_COMMON
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
@@ -32,8 +32,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -60,7 +59,6 @@
/* prevent pd reset when battery soc under 2% */
#define CONFIG_USB_PD_RESET_MIN_BATT_SOC 2
-
#ifndef __ASSEMBLER__
/* support factory keyboard test */
@@ -70,10 +68,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -85,12 +83,7 @@ enum temp_sensor_id {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/dood/build.mk b/board/dood/build.mk
index 3d04b75731..998a65a3de 100644
--- a/board/dood/build.mk
+++ b/board/dood/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dood/ec.tasklist b/board/dood/ec.tasklist
index d98db145e7..977b8b01be 100644
--- a/board/dood/ec.tasklist
+++ b/board/dood/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dood/gpio.inc b/board/dood/gpio.inc
index 961acf8ee0..b10c377ddf 100644
--- a/board/dood/gpio.inc
+++ b/board/dood/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dood/led.c b/board/dood/led.c
index 3f6958b1bc..248dae037f 100644
--- a/board/dood/led.c
+++ b/board/dood/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -19,18 +19,25 @@ __override const int led_charge_lvl_2 = 100;
/* Dood: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/dooly/board.c b/board/dooly/board.c
index 545ec86ebe..6e1f6ebbeb 100644
--- a/board/dooly/board.c
+++ b/board/dooly/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,8 +50,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Sensors */
static struct mutex g_accel_mutex;
@@ -109,11 +109,9 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
.saturation.atime = TCS_DEFAULT_ATIME,
};
-const mat33_fp_t screen_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t screen_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[SCREEN_ACCEL] = {
@@ -190,15 +188,15 @@ DECLARE_DEFERRED(power_monitor);
* that range, so we define and use a 64-bit fixed representation instead.
*/
typedef int64_t fp64_t;
-#define INT_TO_FP64(x) ((int64_t)(x) << 32)
-#define FP64_TO_INT(x) ((x) >> 32)
+#define INT_TO_FP64(x) ((int64_t)(x) << 32)
+#define FP64_TO_INT(x) ((x) >> 32)
#define FLOAT_TO_FP64(x) ((int64_t)((x) * (float)(1LL << 32)))
__override void tcs3400_translate_to_xyz(struct motion_sensor_t *s,
int32_t *crgb_data, int32_t *xyz_data)
{
struct tcs_saturation_t *sat_p =
- &(TCS3400_RGB_DRV_DATA(s+1)->saturation);
+ &(TCS3400_RGB_DRV_DATA(s + 1)->saturation);
int32_t cur_gain = (1 << (2 * sat_p->again));
int32_t integration_time_us =
@@ -208,40 +206,37 @@ __override void tcs3400_translate_to_xyz(struct motion_sensor_t *s,
fp64_t result;
/* Use different coefficients based on n_interval = (G+B)/C */
- fp64_t gb_sum = INT_TO_FP64(crgb_data[2]) +
- INT_TO_FP64(crgb_data[3]);
+ fp64_t gb_sum = INT_TO_FP64(crgb_data[2]) + INT_TO_FP64(crgb_data[3]);
fp64_t n_interval = gb_sum / MAX(crgb_data[0], 1);
if (n_interval < FLOAT_TO_FP64(0.692)) {
const float scale = 799.797;
- c_coeff = FLOAT_TO_FP64(0.009 * scale);
- r_coeff = FLOAT_TO_FP64(0.056 * scale);
- g_coeff = FLOAT_TO_FP64(2.735 * scale);
+ c_coeff = FLOAT_TO_FP64(0.009 * scale);
+ r_coeff = FLOAT_TO_FP64(0.056 * scale);
+ g_coeff = FLOAT_TO_FP64(2.735 * scale);
b_coeff = FLOAT_TO_FP64(-1.903 * scale);
} else if (n_interval < FLOAT_TO_FP64(1.012)) {
const float scale = 801.347;
- c_coeff = FLOAT_TO_FP64(0.202 * scale);
- r_coeff = FLOAT_TO_FP64(-1.1 * scale);
- g_coeff = FLOAT_TO_FP64(8.692 * scale);
+ c_coeff = FLOAT_TO_FP64(0.202 * scale);
+ r_coeff = FLOAT_TO_FP64(-1.1 * scale);
+ g_coeff = FLOAT_TO_FP64(8.692 * scale);
b_coeff = FLOAT_TO_FP64(-7.068 * scale);
} else {
const float scale = 795.574;
c_coeff = FLOAT_TO_FP64(-0.661 * scale);
- r_coeff = FLOAT_TO_FP64(1.334 * scale);
- g_coeff = FLOAT_TO_FP64(1.095 * scale);
+ r_coeff = FLOAT_TO_FP64(1.334 * scale);
+ g_coeff = FLOAT_TO_FP64(1.095 * scale);
b_coeff = FLOAT_TO_FP64(-1.821 * scale);
}
/* Multiply each channel by the coefficient and compute the sum.
* Note: int * fp64_t = fp64_t and fp64_t + fp64_t = fp64_t.
*/
- result = crgb_data[0] * c_coeff +
- crgb_data[1] * r_coeff +
- crgb_data[2] * g_coeff +
- crgb_data[3] * b_coeff;
+ result = crgb_data[0] * c_coeff + crgb_data[1] * r_coeff +
+ crgb_data[2] * g_coeff + crgb_data[3] * b_coeff;
/* Adjust for exposure time and sensor gain.
* Note: fp64_t / int = fp64_t.
@@ -328,8 +323,8 @@ uint16_t tcpc_get_alert_status(void)
}
/* Called when the charge manager has switched to a new port. */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Blink alert if insufficient power per system_can_boot_ap(). */
int insufficient_power =
@@ -346,12 +341,12 @@ static int32_t base_5v_power;
* Power usage for each port as measured or estimated.
* Units are milliwatts (5v x ma current)
*/
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1603)
-#define PWR_FRONT_LOW (5*963)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
+#define PWR_BASE_LOAD (5 * 1335)
+#define PWR_FRONT_HIGH (5 * 1603)
+#define PWR_FRONT_LOW (5 * 963)
+#define PWR_C_HIGH (5 * 3740)
+#define PWR_C_LOW (5 * 2090)
+#define PWR_MAX (5 * 10000)
/*
* Update the 5V power usage, assuming no throttling,
@@ -416,16 +411,14 @@ static const struct {
int current;
} bj_power[] = {
{ /* 0 - 65W (also default) */
- .voltage = 19500,
- .current = 3200
- },
+ .voltage = 19500,
+ .current = 3200 },
{ /* 1 - 90W */
- .voltage = 19500,
- .current = 4600
- },
+ .voltage = 19500,
+ .current = 4600 },
};
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/* Debounced connection state of the barrel jack */
static int8_t adp_connected = -1;
static void adp_connect_deferred(void)
@@ -470,29 +463,26 @@ static void adp_state_init(void)
}
DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
-
#include "gpio_list.h" /* Must come after other header files. */
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_WHITE] = { .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_LED_WHITE] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
/******************************************************************************/
@@ -517,71 +507,61 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
};
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "ina",
- .port = I2C_PORT_INA,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "ppc0",
- .port = I2C_PORT_PPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "ppc1",
- .port = I2C_PORT_PPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C4_SCL,
- .sda = GPIO_I2C4_SDA
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 400,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "ppc1",
+ .port = I2C_PORT_PPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C4_SDA },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -637,15 +617,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
+const enum gpio_signal hibernate_wake_pins[] = {};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -664,7 +643,7 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -673,8 +652,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -727,7 +706,7 @@ static void cbi_init(void)
if (cbi_get_ssfc(&val) == EC_SUCCESS)
ssfc = val;
CPRINTS("Board Version: %d, SKU ID: 0x%08x, "
- "F/W config: 0x%08x, SSFC: 0x%08x ",
+ "F/W config: 0x%08x, SSFC: 0x%08x ",
board_version, sku_id, fw_config, ssfc);
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
@@ -793,29 +772,23 @@ static void board_chipset_startup(void)
/* set high to enable EDID ROM WP */
gpio_set_level(GPIO_EC_EDID_WP_DISABLE_L, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
static void board_chipset_shutdown(void)
{
/* set low to prevent power leakage */
gpio_set_level(GPIO_EC_EDID_WP_DISABLE_L, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/******************************************************************************/
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .i2c_port = I2C_PORT_PPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_TCPC_1] = {
- .i2c_port = I2C_PORT_PPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ [USB_PD_PORT_TCPC_0] = { .i2c_port = I2C_PORT_PPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ [USB_PD_PORT_TCPC_1] = { .i2c_port = I2C_PORT_PPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -842,7 +815,6 @@ static void board_tcpc_init(void)
/* Enable other overcurrent interrupts */
gpio_enable_interrupt(GPIO_USB_A0_OC_ODL);
gpio_enable_interrupt(GPIO_USB_A1_OC_ODL);
-
}
/* Make sure this is called after fw_config is initialised */
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2);
@@ -965,8 +937,8 @@ void board_enable_s0_rails(int enable)
unsigned int ec_config_get_bj_power(void)
{
- unsigned int bj =
- (fw_config & EC_CFG_BJ_POWER_MASK) >> EC_CFG_BJ_POWER_L;
+ unsigned int bj = (fw_config & EC_CFG_BJ_POWER_MASK) >>
+ EC_CFG_BJ_POWER_L;
/* Out of range value defaults to 0 */
if (bj >= ARRAY_SIZE(bj_power))
bj = 0;
@@ -1021,28 +993,28 @@ unsigned int ec_ssfc_get_led_ic(void)
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
+#define THROT_TYPE_A BIT(0)
+#define THROT_TYPE_C BIT(1)
+#define THROT_PROCHOT BIT(2)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
/* PROCHOT_DEFER_OFF is to extend CPU prochot long enough
* to pass safety requirement 30 * 2ms = 60 ms
*/
-#define PROCHOT_DEFER_OFF 30
+#define PROCHOT_DEFER_OFF 30
static void power_monitor(void)
{
@@ -1058,8 +1030,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
@@ -1087,7 +1058,7 @@ static void power_monitor(void)
*/
power = (adc_read_channel(ADC_VBUS) *
adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
+ 1000;
/* Init power table */
if (history[0] == 0) {
for (i = 0; i < POWER_READINGS; i++)
@@ -1114,8 +1085,7 @@ static void power_monitor(void)
* For barrel-jack supplies, the rating can be
* exceeded briefly, so use the average.
*/
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
power = max;
else
power = total / POWER_READINGS;
@@ -1184,8 +1154,8 @@ static void power_monitor(void)
* Check whether type C is not throttled,
* and is not overcurrent.
*/
- if (!((new_state & THROT_TYPE_C) ||
- usbc_0_overcurrent || usbc_1_overcurrent)) {
+ if (!((new_state & THROT_TYPE_C) || usbc_0_overcurrent ||
+ usbc_1_overcurrent)) {
/*
* [1] Type C not in overcurrent, throttle it.
*/
@@ -1218,8 +1188,9 @@ static void power_monitor(void)
gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
}
if (diff & THROT_TYPE_C) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
@@ -1302,5 +1273,4 @@ void board_backlight_enable_interrupt(enum gpio_signal signal)
oz554_interrupt(signal);
break;
}
-
}
diff --git a/board/dooly/board.h b/board/dooly/board.h
index 884117bbbc..cb9d12f4ff 100644
--- a/board/dooly/board.h
+++ b/board/dooly/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,13 +15,13 @@
* By default, enable all console messages except HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
/* Internal SPI flash on NPCX796FC is 512 kB */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
@@ -49,14 +49,13 @@
/* TCS3400 ALS */
#define CONFIG_ALS
-#define ALS_COUNT 1
+#define ALS_COUNT 1
#define CONFIG_ALS_TCS3400
-#define CONFIG_ALS_TCS3400_INT_EVENT\
+#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(SCREEN_ACCEL) | BIT(CLEAR_ALS))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(SCREEN_ACCEL) | BIT(CLEAR_ALS))
/* EC Defines */
#define CONFIG_ADC
@@ -74,7 +73,7 @@
#undef CONFIG_HIBERNATE
#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
#define CONFIG_PWM
#define CONFIG_VBOOT_EFS2
@@ -83,7 +82,6 @@
#define CONFIG_VSTORE_SLOT_COUNT 1
#define CONFIG_SHA256
-
/* EC Commands */
#define CONFIG_CMD_BUTTON
/* Include CLI command needed to support CCD testing. */
@@ -120,7 +118,7 @@
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
/* Dedicated barreljack charger port */
-#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
#define DEDICATED_CHARGE_PORT 2
@@ -141,15 +139,15 @@
#define CONFIG_INA3221
/* b/143501304 */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Fan and temp. */
#define CONFIG_FANS 1
@@ -173,7 +171,7 @@
#define CONFIG_USB_PD_DECODE_SOP
#undef CONFIG_USB_CHARGER
#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PID 0x5040
+#define CONFIG_USB_PID 0x5040
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DISCHARGE_PPC
@@ -193,10 +191,10 @@
#define CONFIG_USBC_VCONN
#define CONFIG_USBC_VCONN_SWAP
-#define USB_PD_PORT_TCPC_0 0
+#define USB_PD_PORT_TCPC_0 0
#define BOARD_TCPC_C0_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS
#define BOARD_TCPC_C0_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS
-#define USB_PD_PORT_TCPC_1 1
+#define USB_PD_PORT_TCPC_1 1
#define BOARD_TCPC_C1_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS
#define BOARD_TCPC_C1_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS
@@ -208,16 +206,16 @@
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_SENSORS NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_PPC1 NPCX_I2C_PORT2_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT7_0
+#define I2C_PORT_INA NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSORS NPCX_I2C_PORT0_0
+#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_PPC1 NPCX_I2C_PORT2_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_BACKLIGHT NPCX_I2C_PORT7_0
/*
* LED backlight controller
@@ -239,11 +237,11 @@ enum charge_port {
};
enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_SNS_PP3300, /* ADC2 */
+ ADC_SNS_PP1050, /* ADC7 */
+ ADC_VBUS, /* ADC4 */
+ ADC_PPVAR_IMON, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
/* Number of ADC channels */
ADC_CH_COUNT
};
@@ -268,10 +266,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_COUNT };
enum sensor_id {
SCREEN_ACCEL = 0,
@@ -286,7 +281,6 @@ enum ssfc_led_id {
SSFC_LED_COUNT,
};
-
/* Board specific handlers */
void board_reset_pd_mcu(void);
void board_set_tcpc_power_mode(int port, int mode);
@@ -299,20 +293,20 @@ void show_critical_error(void);
/*
* Barrel-jack power (4 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 3
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
/*
* USB Connector 4 not present (1 bit) (not used).
*/
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
+#define EC_CFG_NO_USB4_L 4
+#define EC_CFG_NO_USB4_H 4
#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
/*
* Thermal solution config (3 bits).
*/
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
+#define EC_CFG_THERMAL_L 5
+#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
/*
@@ -321,11 +315,10 @@ void show_critical_error(void);
/*
* Led driver IC (2 bits).
*/
-#define EC_SSFC_LED_L 0
-#define EC_SSFC_LED_H 1
+#define EC_SSFC_LED_L 0
+#define EC_SSFC_LED_H 1
#define EC_SSFC_LED_MASK GENMASK(EC_SSFC_LED_H, EC_SSFC_LED_L)
-
unsigned int ec_config_get_bj_power(void);
unsigned int ec_config_get_thermal_solution(void);
unsigned int ec_ssfc_get_led_ic(void);
@@ -335,31 +328,31 @@ void board_backlight_enable_interrupt(enum gpio_signal signal);
#endif /* !__ASSEMBLER__ */
/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
/*
* There is no RSMRST input, so alias it to the output. This short-circuits
* common_intel_x86_handle_rsmrst.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/dooly/build.mk b/board/dooly/build.mk
index 0f55c45f77..f9096c64ff 100644
--- a/board/dooly/build.mk
+++ b/board/dooly/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dooly/ec.tasklist b/board/dooly/ec.tasklist
index 72b81be8d8..cf509f86a2 100644
--- a/board/dooly/ec.tasklist
+++ b/board/dooly/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dooly/gpio.inc b/board/dooly/gpio.inc
index 65488936b7..d92dedd145 100644
--- a/board/dooly/gpio.inc
+++ b/board/dooly/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
/* EC output, but also interrupt so this can be polled as a power signal */
GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
#endif
GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/dooly/led.c b/board/dooly/led.c
index fefa8908fe..224db77dc0 100644
--- a/board/dooly/led.c
+++ b/board/dooly/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -88,9 +88,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -213,7 +213,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
diff --git a/board/dooly/usb_pd_policy.c b/board/dooly/usb_pd_policy.c
index a8d89130c2..71396e8797 100644
--- a/board/dooly/usb_pd_policy.c
+++ b/board/dooly/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,9 +19,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/drallion_ish/board.c b/board/drallion_ish/board.c
index fba8a622a9..b23748b62d 100644
--- a/board/drallion_ish/board.c
+++ b/board/drallion_ish/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,11 +43,9 @@ static struct stprivate_data g_lis2dh_data;
static struct lis2mdl_private_data lis2mdl_a_data;
/* Matrix to rotate base sensor into standard reference frame */
-const mat33_fp_t base_rot_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_rot_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
diff --git a/board/drallion_ish/board.h b/board/drallion_ish/board.h
index a14656e701..d87acc48c3 100644
--- a/board/drallion_ish/board.h
+++ b/board/drallion_ish/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -94,8 +94,8 @@
#define CONFIG_ISH_PM_D3
#define CONFIG_ISH_PM_RESET_PREP
-#define CONFIG_ISH_D0I2_MIN_USEC (15*MSEC)
-#define CONFIG_ISH_D0I3_MIN_USEC (100*MSEC)
+#define CONFIG_ISH_D0I2_MIN_USEC (15 * MSEC)
+#define CONFIG_ISH_D0I3_MIN_USEC (100 * MSEC)
#ifndef __ASSEMBLER__
@@ -107,13 +107,7 @@
* Note: Since we aren't using LPC memory map to transmit sensor data, the
* order of this enum does not need to be accel, accel, gyro
*/
-enum sensor_id {
- LID_ACCEL,
- LID_GYRO,
- BASE_ACCEL,
- LID_MAG,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, LID_GYRO, BASE_ACCEL, LID_MAG, SENSOR_COUNT };
#endif /* !__ASSEMBLER__ */
diff --git a/board/drallion_ish/build.mk b/board/drallion_ish/build.mk
index 51bd96d339..50d4bf1042 100644
--- a/board/drallion_ish/build.mk
+++ b/board/drallion_ish/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/drallion_ish/ec.tasklist b/board/drallion_ish/ec.tasklist
index a4db486e9a..de7d256324 100644
--- a/board/drallion_ish/ec.tasklist
+++ b/board/drallion_ish/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/drallion_ish/gpio.inc b/board/drallion_ish/gpio.inc
index 93e6752e2b..b1c585b329 100644
--- a/board/drallion_ish/gpio.inc
+++ b/board/drallion_ish/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dratini/battery.c b/board/dratini/battery.c
index 77c84cd973..5cb57e4ba5 100644
--- a/board/dratini/battery.c
+++ b/board/dratini/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/dratini/board.c b/board/dratini/board.c
index 61634d3a7b..84759b74b6 100644
--- a/board/dratini/board.c
+++ b/board/dratini/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,8 +43,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void check_reboot_deferred(void);
DECLARE_DEFERRED(check_reboot_deferred);
@@ -128,16 +128,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -163,16 +163,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -201,17 +205,13 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -291,7 +291,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -310,44 +310,43 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "5V Reg",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "5V Reg",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Dratini Temperature sensors */
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -366,8 +365,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
@@ -404,8 +403,8 @@ bool board_is_convertible(void)
* Dratini is not.
* Unprovisioned SKU 255.
*/
- return sku_id == 21 || sku_id == 22 || sku_id == 23 ||
- sku_id == 24 || sku_id == 255;
+ return sku_id == 21 || sku_id == 22 || sku_id == 23 || sku_id == 24 ||
+ sku_id == 255;
}
static void board_update_sensor_config_from_sku(void)
@@ -485,7 +484,7 @@ bool board_has_kb_backlight(void)
* Unprovisioned: 255
*/
return sku_id == 2 || sku_id == 3 || sku_id == 5 || sku_id == 8 ||
- sku_id == 22 || sku_id == 24 || sku_id == 255;
+ sku_id == 22 || sku_id == 24 || sku_id == 255;
}
__override uint32_t board_override_feature_flags0(uint32_t flags0)
@@ -503,15 +502,15 @@ __override uint32_t board_override_feature_flags0(uint32_t flags0)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
/* Disable HDMI power while AP is suspended / off */
@@ -540,7 +539,7 @@ __override void board_chipset_forced_shutdown(void)
hook_call_deferred(&check_reboot_deferred_data, -1);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_forced_shutdown,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
static void check_reboot_deferred(void)
{
diff --git a/board/dratini/board.h b/board/dratini/board.h
index 82c09494f5..9bb4347158 100644
--- a/board/dratini/board.h
+++ b/board/dratini/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,10 +30,10 @@
* Dratini's battery takes several seconds to come back out of its disconnect
* state (~4 seconds, but give it 6 for margin).
*/
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
/* Sensors */
/* BMI160 Base accel/gyro */
@@ -112,16 +112,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -129,9 +129,9 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC2 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC2 */
ADC_CH_COUNT
};
@@ -142,11 +142,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/dratini/build.mk b/board/dratini/build.mk
index 733912454f..13153c1526 100644
--- a/board/dratini/build.mk
+++ b/board/dratini/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/dratini/ec.tasklist b/board/dratini/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/dratini/ec.tasklist
+++ b/board/dratini/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/dratini/gpio.inc b/board/dratini/gpio.inc
index c242919a89..b8649ca3b1 100644
--- a/board/dratini/gpio.inc
+++ b/board/dratini/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,10 +17,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/dratini/led.c b/board/dratini/led.c
index a5a8e9e158..029ae11da8 100644
--- a/board/dratini/led.c
+++ b/board/dratini/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -24,11 +24,9 @@
#define LED_TICKS_PER_CYCLE 10
#define LED_ON_TICKS 5
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -36,7 +34,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(int port, enum led_color color)
@@ -147,7 +145,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -158,15 +155,14 @@ static void led_set_battery(void)
*/
if (!board_is_convertible()) {
if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ CHIPSET_STATE_STANDBY) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
- led_set_color_battery(0, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(1, power_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(0, power_ticks & 0x4 ? LED_WHITE :
+ LED_OFF);
+ led_set_color_battery(1, power_ticks & 0x4 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -181,9 +177,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(0, (battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ 0,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(0, LED_OFF);
}
@@ -192,19 +191,20 @@ static void led_set_battery(void)
led_set_color_battery(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -222,9 +222,10 @@ static void led_set_power(void)
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_SUSPEND |
CHIPSET_STATE_STANDBY))
- led_set_color_power((power_tick %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_power(
+ (power_tick % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/drawcia/battery.c b/board/drawcia/battery.c
index 62d6e95947..acc50ca048 100644
--- a/board/drawcia/battery.c
+++ b/board/drawcia/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/drawcia/board.c b/board/drawcia/board.c
index ce6247e931..118b3178be 100644
--- a/board/drawcia/board.c
+++ b/board/drawcia/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -182,48 +182,36 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
- [ADC_TEMP_SENSOR_4] = {
- .name = "TEMP_SENSOR4",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH16
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
+ [ADC_TEMP_SENSOR_4] = { .name = "TEMP_SENSOR4",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH16 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -272,19 +260,25 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -298,17 +292,13 @@ static struct accelgyro_saved_data_t g_bma422_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
@@ -564,8 +554,8 @@ __override void board_power_5v_enable(int enable)
if (board_get_charger_chip_count() > 1) {
if (sm5803_set_gpio0_level(1, !!enable))
- CPRINTUSB("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTUSB("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
}
@@ -573,11 +563,11 @@ __override uint8_t board_get_usb_pd_port_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT;
ccprints("Unhandled DB configuration: %d", db);
@@ -588,11 +578,11 @@ __override uint8_t board_get_charger_chip_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CHARGER_NUM - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CHARGER_NUM;
ccprints("Unhandled DB configuration: %d", db);
@@ -697,33 +687,31 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
+const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 10000,
+ } };
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "5V regular",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "5V regular",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -753,9 +741,8 @@ __override void lid_angle_peripheral_enable(int enable)
}
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 20;
@@ -774,14 +761,17 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div,
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
- {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
- {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
- {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
- {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { GPIO_KSO_L, 5 }, { GPIO_KSO_L, 6 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/drawcia/board.h b/board/drawcia/board.h
index 9cff277255..afad544ef8 100644
--- a/board/drawcia/board.h
+++ b/board/drawcia/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,21 +23,24 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr \
+ */
/* PWM */
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -70,8 +73,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
@@ -82,8 +85,8 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
/* USB Type A Features */
#define USB_PORT_COUNT 1
@@ -106,21 +109,16 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
- ADC_TEMP_SENSOR_4, /* ADC16 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_TEMP_SENSOR_4, /* ADC16 */
ADC_CH_COUNT
};
diff --git a/board/drawcia/build.mk b/board/drawcia/build.mk
index 806168ea0d..9b862c7624 100644
--- a/board/drawcia/build.mk
+++ b/board/drawcia/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/drawcia/cbi_ssfc.c b/board/drawcia/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/drawcia/cbi_ssfc.c
+++ b/board/drawcia/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/drawcia/cbi_ssfc.h b/board/drawcia/cbi_ssfc.h
index 6f3591a496..37e7d9c26f 100644
--- a/board/drawcia/cbi_ssfc.h
+++ b/board/drawcia/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -55,5 +55,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/drawcia/ec.tasklist b/board/drawcia/ec.tasklist
index 2edf48ee05..c3c360febb 100644
--- a/board/drawcia/ec.tasklist
+++ b/board/drawcia/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/drawcia/gpio.inc b/board/drawcia/gpio.inc
index 2bfbb9c91b..0c4599911a 100644
--- a/board/drawcia/gpio.inc
+++ b/board/drawcia/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/drawcia/led.c b/board/drawcia/led.c
index ed22fc29ba..8e6263fbbc 100644
--- a/board/drawcia/led.c
+++ b/board/drawcia/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,10 +18,8 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -29,7 +27,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -116,7 +114,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -127,9 +124,9 @@ static void led_set_battery(void)
*/
if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT) {
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x2 ?
- LED_WHITE : LED_OFF);
+ charge_get_state() != PWR_STATE_CHARGE) {
+ led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -158,18 +155,18 @@ static void led_set_battery(void)
led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -186,8 +183,7 @@ static void led_set_power(void)
if (chipset_in_state(CHIPSET_STATE_ON))
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power(
- (power_tick & 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick & 0x2) ? LED_WHITE : LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/drawcia/usb_pd_policy.c b/board/drawcia/usb_pd_policy.c
index 7046e25d6c..2433b25431 100644
--- a/board/drawcia/usb_pd_policy.c
+++ b/board/drawcia/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,18 +65,7 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/drawcia_riscv/battery.c b/board/drawcia_riscv/battery.c
index 4aa0f49043..074bc78d58 100644
--- a/board/drawcia_riscv/battery.c
+++ b/board/drawcia_riscv/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/drawcia_riscv/board.c b/board/drawcia_riscv/board.c
index e770d17818..cbc977d64b 100644
--- a/board/drawcia_riscv/board.c
+++ b/board/drawcia_riscv/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,7 +42,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -165,48 +165,36 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
- [ADC_TEMP_SENSOR_4] = {
- .name = "TEMP_SENSOR4",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH16
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
+ [ADC_TEMP_SENSOR_4] = { .name = "TEMP_SENSOR4",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH16 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -255,19 +243,25 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -280,17 +274,13 @@ static struct accelgyro_saved_data_t g_bma253_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
@@ -496,8 +486,8 @@ __override void board_power_5v_enable(int enable)
if (board_get_charger_chip_count() > 1) {
if (sm5803_set_gpio0_level(1, !!enable))
- CPRINTUSB("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTUSB("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
}
@@ -505,11 +495,11 @@ __override uint8_t board_get_usb_pd_port_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT;
ccprints("Unhandled DB configuration: %d", db);
@@ -520,11 +510,11 @@ __override uint8_t board_get_charger_chip_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CHARGER_NUM - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CHARGER_NUM;
ccprints("Unhandled DB configuration: %d", db);
@@ -629,33 +619,31 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
+const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 10000,
+ } };
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "5V regular",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "5V regular",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -685,9 +673,8 @@ __override void lid_angle_peripheral_enable(int enable)
}
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 20;
@@ -706,14 +693,17 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div,
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
- {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
- {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
- {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
- {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { GPIO_KSO_L, 5 }, { GPIO_KSO_L, 6 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/drawcia_riscv/board.h b/board/drawcia_riscv/board.h
index 45f16c9ac3..2867412cf8 100644
--- a/board/drawcia_riscv/board.h
+++ b/board/drawcia_riscv/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,20 +37,23 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr \
+ */
/* PWM */
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -83,8 +86,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
@@ -95,13 +98,16 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
/* USB Type A Features */
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
+/* Reduce flash image footprint */
+#undef CONFIG_CMD_ACCELS
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -119,21 +125,16 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
- ADC_TEMP_SENSOR_4, /* ADC16 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_TEMP_SENSOR_4, /* ADC16 */
ADC_CH_COUNT
};
diff --git a/board/drawcia_riscv/build.mk b/board/drawcia_riscv/build.mk
index cf62dfc823..b63b7a58b9 100644
--- a/board/drawcia_riscv/build.mk
+++ b/board/drawcia_riscv/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/drawcia_riscv/cbi_ssfc.c b/board/drawcia_riscv/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/drawcia_riscv/cbi_ssfc.c
+++ b/board/drawcia_riscv/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/drawcia_riscv/cbi_ssfc.h b/board/drawcia_riscv/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/drawcia_riscv/cbi_ssfc.h
+++ b/board/drawcia_riscv/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/drawcia_riscv/ec.tasklist b/board/drawcia_riscv/ec.tasklist
index 5c9a2d1a01..c13df44543 100644
--- a/board/drawcia_riscv/ec.tasklist
+++ b/board/drawcia_riscv/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/drawcia_riscv/gpio.inc b/board/drawcia_riscv/gpio.inc
index cf0e3377cd..ad20442673 100644
--- a/board/drawcia_riscv/gpio.inc
+++ b/board/drawcia_riscv/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/drawcia_riscv/led.c b/board/drawcia_riscv/led.c
index d13862cdcd..3cb7cb835e 100644
--- a/board/drawcia_riscv/led.c
+++ b/board/drawcia_riscv/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,10 +18,8 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -29,7 +27,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -116,7 +114,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -127,9 +124,9 @@ static void led_set_battery(void)
*/
if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT) {
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x2 ?
- LED_WHITE : LED_OFF);
+ charge_get_state() != PWR_STATE_CHARGE) {
+ led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -158,18 +155,18 @@ static void led_set_battery(void)
led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -186,8 +183,7 @@ static void led_set_power(void)
if (chipset_in_state(CHIPSET_STATE_ON))
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power(
- (power_tick & 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick & 0x2) ? LED_WHITE : LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/drawcia_riscv/usb_pd_policy.c b/board/drawcia_riscv/usb_pd_policy.c
index 3ff7152541..8a2c07c575 100644
--- a/board/drawcia_riscv/usb_pd_policy.c
+++ b/board/drawcia_riscv/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,18 +65,7 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/driblee/battery.c b/board/driblee/battery.c
index 19f0312305..d73bc104ac 100644
--- a/board/driblee/battery.c
+++ b/board/driblee/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -638,8 +638,8 @@ const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_BYD_1VX1H;
int charger_profile_override(struct charge_state_data *curr)
{
if (chipset_in_state(CHIPSET_STATE_ON)) {
- curr->requested_current = MIN(curr->requested_current,
- CHARGING_CURRENT_1100MA);
+ curr->requested_current =
+ MIN(curr->requested_current, CHARGING_CURRENT_1100MA);
}
return 0;
diff --git a/board/driblee/board.c b/board/driblee/board.c
index 5cf9b686ac..30075e683e 100644
--- a/board/driblee/board.c
+++ b/board/driblee/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,13 +41,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
-#define ADC_VOL_UP_MASK BIT(0)
-#define ADC_VOL_DOWN_MASK BIT(1)
+#define ADC_VOL_UP_MASK BIT(0)
+#define ADC_VOL_DOWN_MASK BIT(1)
static uint8_t new_adc_key_state;
@@ -77,8 +77,8 @@ static const struct ec_response_keybd_config driblee_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &driblee_keybd;
}
@@ -119,7 +119,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
@@ -165,22 +164,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
@@ -197,8 +196,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -271,13 +270,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -328,7 +325,7 @@ int board_set_active_charge_port(int port)
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
- tcpc_write(port, TCPC_REG_COMMAND,
+ tcpc_write(port, TCPC_REG_COMMAND,
TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
CPRINTS("p%d: sink path enable failed.", port);
charger_discharge_on_ac(0);
@@ -341,8 +338,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -398,9 +395,8 @@ static void hdmi_disable(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, hdmi_disable, HOOK_PRIO_DEFAULT);
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -444,12 +440,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
};
diff --git a/board/driblee/board.h b/board/driblee/board.h
index e1bd9d1dca..f6a3ac9130 100644
--- a/board/driblee/board.h
+++ b/board/driblee/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,6 +25,7 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#undef CONFIG_CMD_CHARGER_DUMP
@@ -49,7 +50,7 @@
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* PWM */
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -86,16 +87,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -111,17 +112,13 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/driblee/build.mk b/board/driblee/build.mk
index b012d8d502..eb422dae93 100644
--- a/board/driblee/build.mk
+++ b/board/driblee/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/driblee/cbi_ssfc.c b/board/driblee/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/driblee/cbi_ssfc.c
+++ b/board/driblee/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/driblee/cbi_ssfc.h b/board/driblee/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/driblee/cbi_ssfc.h
+++ b/board/driblee/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/driblee/ec.tasklist b/board/driblee/ec.tasklist
index 0025c2985b..386e8625b3 100644
--- a/board/driblee/ec.tasklist
+++ b/board/driblee/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/driblee/gpio.inc b/board/driblee/gpio.inc
index 82ba0d67bc..acd6a33852 100644
--- a/board/driblee/gpio.inc
+++ b/board/driblee/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/driblee/led.c b/board/driblee/led.c
index cd34613a7c..7aa983ea79 100644
--- a/board/driblee/led.c
+++ b/board/driblee/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,32 @@ __override const int led_charge_lvl_1 = 10;
__override const int led_charge_lvl_2 = 100;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/driblee/usb_pd_policy.c b/board/driblee/usb_pd_policy.c
index 19dd01d37b..157f4be2cb 100644
--- a/board/driblee/usb_pd_policy.c
+++ b/board/driblee/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/charger/isl923x_public.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/drobit/battery.c b/board/drobit/battery.c
index f8f3eb296f..0db543a12f 100644
--- a/board/drobit/battery.c
+++ b/board/drobit/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/drobit/board.c b/board/drobit/board.c
index fdfab38b52..19b5162092 100644
--- a/board/drobit/board.c
+++ b/board/drobit/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,7 +41,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -76,8 +76,8 @@ static const struct ec_response_keybd_config drobit_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &drobit_kb;
}
@@ -95,7 +95,7 @@ union volteer_cbi_fw_config fw_config_defaults = {
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -131,8 +131,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(72), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -159,8 +159,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(72), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -363,33 +363,43 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .next_mux = &usbc0_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .next_mux = &usbc1_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -467,8 +477,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/******************************************************************************/
/* Set the charge limit based upon desired maximum. */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Limit the input current to 98% negotiated limit,
@@ -476,6 +486,5 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 98 / 100;
charge_set_input_current_limit(
- MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/drobit/board.h b/board/drobit/board.h
index 12cfe834c6..d6fda98f3d 100644
--- a/board/drobit/board.h
+++ b/board/drobit/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,7 +29,7 @@
/* LED defines */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* Keyboard features */
#define CONFIG_KEYBOARD_VIVALDI
@@ -42,20 +42,20 @@
#undef CONFIG_ACCEL_FIFO_SIZE
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
#ifdef BOARD_DROBIT_ECMODEENTRY
@@ -68,11 +68,11 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
@@ -87,8 +87,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -96,42 +96,41 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_USB_C1_MIX NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_C1_MIX NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -142,11 +141,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_FAN = 0,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_FAN = 0, PWM_CH_KBLIGHT, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -155,11 +150,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/drobit/build.mk b/board/drobit/build.mk
index 43b40c644c..d590255d2a 100644
--- a/board/drobit/build.mk
+++ b/board/drobit/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/drobit/ec.tasklist b/board/drobit/ec.tasklist
index c1b0295d37..a1b5d30d93 100644
--- a/board/drobit/ec.tasklist
+++ b/board/drobit/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/drobit/gpio.inc b/board/drobit/gpio.inc
index 6bacab4474..2057cfd27a 100644
--- a/board/drobit/gpio.inc
+++ b/board/drobit/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/drobit/led.c b/board/drobit/led.c
index 47c3cca5b7..bb712a8fe0 100644
--- a/board/drobit/led.c
+++ b/board/drobit/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,28 +9,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/eldrid/battery.c b/board/eldrid/battery.c
index 3c9f2b0c21..6f9e6df5af 100644
--- a/board/eldrid/battery.c
+++ b/board/eldrid/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -100,7 +100,9 @@ __override bool board_battery_is_initialized(void)
bool batt_initialization_state;
int batt_status;
- batt_initialization_state = (battery_status(&batt_status) ? false :
- !!(batt_status & STATUS_INITIALIZED));
+ batt_initialization_state =
+ (battery_status(&batt_status) ?
+ false :
+ !!(batt_status & STATUS_INITIALIZED));
return batt_initialization_state;
}
diff --git a/board/eldrid/board.c b/board/eldrid/board.c
index b3d1bb8293..717878bc95 100644
--- a/board/eldrid/board.c
+++ b/board/eldrid/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,7 +48,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -94,7 +94,7 @@ static void board_charger_config(void)
ISL9241_REG_CONTROL1, &reg) == EC_SUCCESS) {
reg |= ISL9241_CONTROL1_PSYS;
if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
- ISL9241_REG_CONTROL1, reg))
+ ISL9241_REG_CONTROL1, reg))
CPRINTS("Failed to set isl9241");
}
@@ -105,7 +105,7 @@ static void board_charger_config(void)
ISL9241_REG_CONTROL2, &reg) == EC_SUCCESS) {
reg &= ~ISL9241_CONTROL2_PROCHOT_DEBOUNCE_MASK;
if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
- ISL9241_REG_CONTROL2, reg))
+ ISL9241_REG_CONTROL2, reg))
CPRINTS("Failed to set isl9241");
}
@@ -116,7 +116,7 @@ static void board_charger_config(void)
ISL9241_REG_CONTROL4, &reg) == EC_SUCCESS) {
reg |= ISL9241_CONTROL4_PSYS_RSENSE_RATIO;
if (i2c_write16(I2C_PORT_CHARGER, ISL9241_ADDR_FLAGS,
- ISL9241_REG_CONTROL4, reg))
+ ISL9241_REG_CONTROL4, reg))
CPRINTS("Failed to set isl9241");
}
}
@@ -166,12 +166,12 @@ __override bool board_is_tbt_usb4_port(int port)
* TODO (b/147732807): All the USB-C ports need to support same
* features. Need to fix once USB-C feature set is known for Volteer.
*/
- return ((port == USBC_PORT_C1)
- && ((usb_db == DB_USB4_GEN2) || (usb_db == DB_USB4_GEN3)));
+ return ((port == USBC_PORT_C1) &&
+ ((usb_db == DB_USB4_GEN2) || (usb_db == DB_USB4_GEN3)));
}
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* b/166728543
@@ -188,9 +188,8 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 90 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/******************************************************************************/
@@ -198,7 +197,7 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -326,24 +325,33 @@ static const struct tcpc_config_t tcpc_config_p1_usb3 = {
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-static const struct usb_mux mux_config_p1_usb3_active = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+static const struct usb_mux_chain mux_config_p1_usb3_active = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
};
-static const struct usb_mux mux_config_p1_usb3_passive = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain mux_config_p1_usb3_passive = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
/******************************************************************************/
@@ -360,8 +368,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(ps8xxx_rst_odl, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(ps8xxx_rst_odl, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -372,16 +379,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -393,8 +400,9 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
if (usb_db == DB_USB3_ACTIVE) {
ps8815_reset();
- usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(USBC_PORT_C1,
+ USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
}
@@ -433,8 +441,7 @@ static void config_port_discrete_tcpc(int port)
*/
if (get_board_id() >= 1) {
CPRINTS("C%d: RT1715", port);
- tcpc_config[port].i2c_info.addr_flags =
- RT1715_I2C_ADDR_FLAGS;
+ tcpc_config[port].i2c_info.addr_flags = RT1715_I2C_ADDR_FLAGS;
tcpc_config[port].drv = &rt1715_tcpm_drv;
return;
}
@@ -553,16 +560,20 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/eldrid/board.h b/board/eldrid/board.h
index df785a5573..1bbe183425 100644
--- a/board/eldrid/board.h
+++ b/board/eldrid/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,7 +40,7 @@
* TODO(b/170966461): Re-enable Vivaldi keyboard once
* 8042 and MKBP drivers can coexist.
*/
-#undef CONFIG_KEYBOARD_VIVALDI
+#undef CONFIG_KEYBOARD_VIVALDI
/* Sensors */
/* BMA253 accelerometer in base */
@@ -52,37 +52,36 @@
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL))
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
+#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
/* BC 1.2 */
@@ -92,8 +91,8 @@
#define CONFIG_CUSTOM_FAN_CONTROL
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Retimer */
#undef CONFIG_USBC_RETIMER_INTEL_BB
@@ -105,44 +104,43 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -168,11 +166,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/eldrid/build.mk b/board/eldrid/build.mk
index 868a463932..91041efa43 100644
--- a/board/eldrid/build.mk
+++ b/board/eldrid/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/eldrid/ec.tasklist b/board/eldrid/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/eldrid/ec.tasklist
+++ b/board/eldrid/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/eldrid/gpio.inc b/board/eldrid/gpio.inc
index 9d5b374c40..08d754b366 100644
--- a/board/eldrid/gpio.inc
+++ b/board/eldrid/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/eldrid/led.c b/board/eldrid/led.c
index 26526e0b76..797b6d4bda 100644
--- a/board/eldrid/led.c
+++ b/board/eldrid/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,36 +27,39 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {
- {EC_LED_COLOR_WHITE, 0.4 * LED_ONE_SEC},
- {LED_OFF, 0.4 * LED_ONE_SEC}
- },
- [STATE_FACTORY_TEST] = {
- {EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC}
- },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_WHITE,
+ 0.4 * LED_ONE_SEC },
+ { LED_OFF, 0.4 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 6 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {
- {LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 6 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
@@ -80,10 +83,10 @@ __override void led_set_color_battery(enum ec_led_colors color)
side_select_duty = 100;
break;
default:
- /*
- * We need to turn off led here since curr.ac won't update
- * immediately but led will update every 200ms.
- */
+ /*
+ * We need to turn off led here since curr.ac won't
+ * update immediately but led will update every 200ms.
+ */
side_select_duty = 50;
color = LED_OFF;
}
diff --git a/board/eldrid/sensors.c b/board/eldrid/sensors.c
index a9248938a3..538cacb985 100644
--- a/board/eldrid/sensors.c
+++ b/board/eldrid/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,17 +30,13 @@ static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/eldrid/thermal.c b/board/eldrid/thermal.c
index 3f20b16d70..5ce7b362fc 100644
--- a/board/eldrid/thermal.c
+++ b/board/eldrid/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,8 +15,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
/******************************************************************************/
/* EC thermal management configuration */
@@ -30,8 +29,8 @@
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -56,8 +55,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -102,39 +101,39 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {-1, -1, 44, -1},
- .off = {-1, -1, 0, -1},
- .rpm = {0},
+ .on = { -1, -1, 44, -1 },
+ .off = { -1, -1, 0, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 46, -1},
- .off = {-1, -1, 44, -1},
- .rpm = {3200},
+ .on = { -1, -1, 46, -1 },
+ .off = { -1, -1, 44, -1 },
+ .rpm = { 3200 },
},
{
/* level 2 */
- .on = {-1, -1, 50, -1},
- .off = {-1, -1, 45, -1},
- .rpm = {3600},
+ .on = { -1, -1, 50, -1 },
+ .off = { -1, -1, 45, -1 },
+ .rpm = { 3600 },
},
{
/* level 3 */
- .on = {-1, -1, 54, -1},
- .off = {-1, -1, 49, -1},
- .rpm = {4100},
+ .on = { -1, -1, 54, -1 },
+ .off = { -1, -1, 49, -1 },
+ .rpm = { 4100 },
},
{
/* level 4 */
- .on = {-1, -1, 58, -1},
- .off = {-1, -1, 53, -1},
- .rpm = {4900},
+ .on = { -1, -1, 58, -1 },
+ .off = { -1, -1, 53, -1 },
+ .rpm = { 4900 },
},
{
/* level 5 */
- .on = {-1, -1, 60, -1},
- .off = {-1, -1, 57, -1},
- .rpm = {5200},
+ .on = { -1, -1, 60, -1 },
+ .off = { -1, -1, 57, -1 },
+ .rpm = { 5200 },
},
};
@@ -162,16 +161,16 @@ int fan_table_to_rpm(int fan, int *temp)
if (temp[TEMP_SENSOR_3_DDR_SOC] < prev_temp[TEMP_SENSOR_3_DDR_SOC]) {
for (i = current_level; i > 0; i--) {
if (temp[TEMP_SENSOR_3_DDR_SOC] <
- fan_table[i].off[TEMP_SENSOR_3_DDR_SOC])
+ fan_table[i].off[TEMP_SENSOR_3_DDR_SOC])
current_level = i - 1;
else
break;
}
} else if (temp[TEMP_SENSOR_3_DDR_SOC] >
- prev_temp[TEMP_SENSOR_3_DDR_SOC]) {
+ prev_temp[TEMP_SENSOR_3_DDR_SOC]) {
for (i = current_level; i < num_fan_levels; i++) {
if (temp[TEMP_SENSOR_3_DDR_SOC] >
- fan_table[i].on[TEMP_SENSOR_3_DDR_SOC])
+ fan_table[i].on[TEMP_SENSOR_3_DDR_SOC])
current_level = i;
else
break;
@@ -207,8 +206,7 @@ void board_override_fan_control(int fan, int *temp)
{
if (chipset_in_state(CHIPSET_STATE_ON)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, temp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, temp));
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Stop fan when enter S0ix */
fan_set_rpm_mode(FAN_CH(fan), 1);
diff --git a/board/elemi/battery.c b/board/elemi/battery.c
index 602176b718..f24c4c6847 100644
--- a/board/elemi/battery.c
+++ b/board/elemi/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/elemi/board.c b/board/elemi/board.c
index 1aaf5e1d95..6b166e1206 100644
--- a/board/elemi/board.c
+++ b/board/elemi/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,7 +42,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -72,7 +72,7 @@ union volteer_cbi_fw_config fw_config_defaults = {
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -101,8 +101,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
[EC_TEMP_THRESH_HALT] = C_TO_K(70), \
@@ -118,8 +118,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -136,8 +136,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_REGULATOR \
- { \
+#define THERMAL_REGULATOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
[EC_TEMP_THRESH_HALT] = C_TO_K(70), \
@@ -248,8 +248,8 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kb_backlight_disable, HOOK_PRIO_DEFAULT);
__override void board_ps8xxx_tcpc_init(int port)
{
/* b/189587527: Set Displayport EQ loss up to 10dB */
- tcpc_addr_write(port, PS8XXX_I2C_ADDR1_P1_FLAGS,
- PS8815_REG_DP_EQ_SETTING,
+ tcpc_addr_write(
+ port, PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_DP_EQ_SETTING,
PS8815_DPEQ_LOSS_UP_10DB << PS8815_REG_DP_EQ_COMP_SHIFT);
}
@@ -258,11 +258,14 @@ __override void board_ps8xxx_tcpc_init(int port)
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
/******************************************************************************/
@@ -277,8 +280,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -289,16 +291,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -308,7 +310,7 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
ps8815_reset();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
__override void board_cbi_init(void)
@@ -391,17 +393,21 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -458,13 +464,13 @@ int ppc_get_alert_status(int port)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/elemi/board.h b/board/elemi/board.h
index 1556a802b6..aa6756d0ce 100644
--- a/board/elemi/board.h
+++ b/board/elemi/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,31 +37,31 @@
#undef CONFIG_ACCEL_FIFO_SIZE
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/* Experimentally determined. See b/186079130. */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 10000 /* us */
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 10000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
+#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#undef CONFIG_USB_PD_TCPM_TUSB422
#undef CONFIG_USB_MUX_RUNTIME_CONFIG
@@ -74,8 +74,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Retimer */
#undef CONFIG_USBC_RETIMER_INTEL_BB
@@ -90,41 +90,40 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -136,17 +135,9 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_FAN,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_FAN, PWM_CH_KBLIGHT, PWM_CH_COUNT };
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/elemi/build.mk b/board/elemi/build.mk
index 43b40c644c..d590255d2a 100644
--- a/board/elemi/build.mk
+++ b/board/elemi/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/elemi/ec.tasklist b/board/elemi/ec.tasklist
index c1b0295d37..a1b5d30d93 100644
--- a/board/elemi/ec.tasklist
+++ b/board/elemi/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/elemi/gpio.inc b/board/elemi/gpio.inc
index 9886497e24..3dbf9b35c7 100644
--- a/board/elemi/gpio.inc
+++ b/board/elemi/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/elemi/led.c b/board/elemi/led.c
index d8df9c92a0..8deb12474a 100644
--- a/board/elemi/led.c
+++ b/board/elemi/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -21,10 +21,10 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-#define LED_CYCLE_TIME_MS (2 * 1000)
+#define LED_CYCLE_TIME_MS (2 * 1000)
#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / HOOK_TICK_INTERVAL_MS)
-#define LED_ON_TIME_MS (1 * 1000)
-#define LED_ON_TICKS (LED_ON_TIME_MS / HOOK_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1 * 1000)
+#define LED_ON_TICKS (LED_ON_TIME_MS / HOOK_TICK_INTERVAL_MS)
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_LEFT_LED,
@@ -37,22 +37,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- RIGHT_PORT = 0,
- LEFT_PORT
-};
+enum led_port { RIGHT_PORT = 0, LEFT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_C0_CHARGE_LED_AMBER_L :
- GPIO_C1_CHARGE_LED_AMBER_L);
+ GPIO_C1_CHARGE_LED_AMBER_L);
white_led = (port == RIGHT_PORT ? GPIO_C0_CHARGE_LED_WHITE_L :
- GPIO_C1_CHARGE_LED_WHITE_L);
+ GPIO_C1_CHARGE_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -124,17 +121,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
static int suspend_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -144,14 +140,13 @@ static void led_set_battery(void)
* system suspend without charging state.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ charge_get_state() != PWR_STATE_CHARGE) {
suspend_ticks++;
- led_set_color_battery(RIGHT_PORT, suspend_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
- led_set_color_battery(LEFT_PORT, suspend_ticks & 0x4 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT, suspend_ticks & 0x4 ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ LEFT_PORT, suspend_ticks & 0x4 ? LED_WHITE : LED_OFF);
return;
}
@@ -165,9 +160,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
@@ -176,19 +174,20 @@ static void led_set_battery(void)
led_set_color_battery(LEFT_PORT, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/elm/battery.c b/board/elm/battery.c
index de9685a89d..9ef59414a2 100644
--- a/board/elm/battery.c
+++ b/board/elm/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "util.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHIP_MODE_REG 0x3a
-#define SB_SHUTDOWN_DATA 0xC574
+#define SB_SHIP_MODE_REG 0x3a
+#define SB_SHUTDOWN_DATA 0xC574
static const struct battery_info info = {
.voltage_max = 13200,
diff --git a/board/elm/board.c b/board/elm/board.c
index 1c7cc4b320..4007d34379 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -49,8 +49,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Dispaly port hardware can connect to port 0, 1 or neither. */
#define PD_PORT_NONE -1
@@ -73,8 +73,8 @@ void usb_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"},
- {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"},
+ { GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD" },
+ { GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -84,11 +84,11 @@ const struct adc_t adc_channels[] = {
* PSYS_MONITOR(PA2): ADC_IN2, 1.44 uA/W on 6.05k Ohm
* output in mW
*/
- [ADC_PSYS] = {"PSYS", 379415, 4096, 0, STM32_AIN(2)},
+ [ADC_PSYS] = { "PSYS", 379415, 4096, 0, STM32_AIN(2) },
/* AMON_BMON(PC0): ADC_IN10, output in uV */
- [ADC_AMON_BMON] = {"AMON_BMON", 183333, 4096, 0, STM32_AIN(10)},
+ [ADC_AMON_BMON] = { "AMON_BMON", 183333, 4096, 0, STM32_AIN(10) },
/* VDC_BOOSTIN_SENSE(PC1): ADC_IN11, output in mV */
- [ADC_VBUS] = {"VBUS", 33000, 4096, 0, STM32_AIN(11)},
+ [ADC_VBUS] = { "VBUS", 33000, 4096, 0, STM32_AIN(11) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -107,23 +107,18 @@ int anx7688_passthru_allowed(const struct i2c_port_t *port,
}
/* I2C ports */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "pd",
- .port = I2C_PORT_PD_MCU,
- .kbps = 1000,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA,
- .passthru_allowed = anx7688_passthru_allowed
- }
-};
+const struct i2c_port_t i2c_ports[] = { { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "pd",
+ .port = I2C_PORT_PD_MCU,
+ .kbps = 1000,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA,
+ .passthru_allowed =
+ anx7688_passthru_allowed } };
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -162,22 +157,24 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
*/
const struct temp_sensor_t temp_sensors[] = {
#ifdef CONFIG_TEMP_SENSOR_TMP432
- {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL},
- {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1},
- {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE2},
+ { "TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL },
+ { "TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1 },
+ { "TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE2 },
#endif
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp,
- 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &anx7688_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &anx7688_usb_mux_driver,
+ },
},
};
@@ -207,7 +204,7 @@ void deferred_reset_pd_mcu(void)
* and wait for 1ms.
*/
gpio_set_level(GPIO_USB_C0_PWR_EN_L, 1);
- hook_call_deferred(&deferred_reset_pd_mcu_data, 1*MSEC);
+ hook_call_deferred(&deferred_reset_pd_mcu_data, 1 * MSEC);
break;
case 1:
/*
@@ -215,7 +212,7 @@ void deferred_reset_pd_mcu(void)
* pull PD reset pin and wait for another 1ms
*/
gpio_set_level(GPIO_USB_C0_RST, 1);
- hook_call_deferred(&deferred_reset_pd_mcu_data, 1*MSEC);
+ hook_call_deferred(&deferred_reset_pd_mcu_data, 1 * MSEC);
/* on PD reset, trigger PD task to reset state */
task_set_event(TASK_ID_PD_C0, PD_EVENT_TCPC_RESET);
break;
@@ -225,7 +222,7 @@ void deferred_reset_pd_mcu(void)
* enable power and wait for 10ms then pull RESET_N
*/
gpio_set_level(GPIO_USB_C0_PWR_EN_L, 0);
- hook_call_deferred(&deferred_reset_pd_mcu_data, 10*MSEC);
+ hook_call_deferred(&deferred_reset_pd_mcu_data, 10 * MSEC);
break;
case 2:
/*
@@ -244,7 +241,7 @@ static void board_power_on_pd_mcu(void)
return;
gpio_set_level(GPIO_USB_C0_EXTPWR_EN, 1);
- hook_call_deferred(&deferred_reset_pd_mcu_data, 1*MSEC);
+ hook_call_deferred(&deferred_reset_pd_mcu_data, 1 * MSEC);
}
void board_reset_pd_mcu(void)
@@ -253,17 +250,15 @@ void board_reset_pd_mcu(void)
anx7688_enable_cable_detection(0);
/* wait for 10ms, then start port controller's reset sequence */
- hook_call_deferred(&deferred_reset_pd_mcu_data, 10*MSEC);
+ hook_call_deferred(&deferred_reset_pd_mcu_data, 10 * MSEC);
}
-static int command_pd_reset(int argc, char **argv)
+static int command_pd_reset(int argc, const char **argv)
{
board_reset_pd_mcu();
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(resetpd, command_pd_reset,
- "",
- "Reset PD IC");
+DECLARE_CONSOLE_COMMAND(resetpd, command_pd_reset, "", "Reset PD IC");
/**
* There is a level shift for AC_OK & LID_OPEN signal between AP & EC,
@@ -342,13 +337,13 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Limit input current 95% ratio on elm board for safety */
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -464,17 +459,13 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
static struct mutex g_kx022_mutex[2];
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* KX022 private data */
struct kionix_accel_data g_kx022_data[2];
diff --git a/board/elm/board.h b/board/elm/board.h
index 8bb8c2bf15..10cb6bb75d 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,7 +27,7 @@
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
/* AC adaptor, charger, battery */
#define CONFIG_BATTERY_CUT_OFF
@@ -75,10 +75,10 @@
#define CONFIG_SPI_CONTROLLER
#define CONFIG_STM_HWTIMER32
#define CONFIG_VBOOT_HASH
-#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_WATCHDOG_HELP
#define CONFIG_SWITCH
#define CONFIG_BOARD_VERSION_GPIO
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#define CONFIG_TEMP_SENSOR
#define CONFIG_DPTF
@@ -102,7 +102,7 @@
#define CONFIG_USB_PD_TCPM_TCPCI
#define CONFIG_USB_PD_TRY_SRC
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
-#undef CONFIG_TCPC_I2C_BASE_ADDR_FLAGS
+#undef CONFIG_TCPC_I2C_BASE_ADDR_FLAGS
#define CONFIG_TCPC_I2C_BASE_ADDR_FLAGS 0x2C
#define CONFIG_USB_PD_ANX7688
@@ -144,11 +144,11 @@
#undef CONFIG_EC_WRITABLE_STORAGE_OFF
#undef CONFIG_EC_WRITABLE_STORAGE_SIZE
#undef CONFIG_WP_STORAGE_SIZE
-#define CONFIG_RW_MEM_OFF (128 * 1024)
-#define CONFIG_RW_SIZE (128 * 1024)
-#define CONFIG_EC_WRITABLE_STORAGE_OFF (128 * 1024)
-#define CONFIG_EC_WRITABLE_STORAGE_SIZE (128 * 1024)
-#define CONFIG_WP_STORAGE_SIZE (128 * 1024)
+#define CONFIG_RW_MEM_OFF (128 * 1024)
+#define CONFIG_RW_SIZE (128 * 1024)
+#define CONFIG_EC_WRITABLE_STORAGE_OFF (128 * 1024)
+#define CONFIG_EC_WRITABLE_STORAGE_SIZE (128 * 1024)
+#define CONFIG_WP_STORAGE_SIZE (128 * 1024)
/* Drivers */
#ifndef __ASSEMBLER__
@@ -160,30 +160,30 @@
#define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C, GPIO_D
/* 2 I2C master ports, connect to battery, charger, pd and USB switches */
-#define I2C_PORT_MASTER 0
-#define I2C_PORT_ACCEL 0
+#define I2C_PORT_MASTER 0
+#define I2C_PORT_ACCEL 0
#define I2C_PORT_BATTERY 0
#define I2C_PORT_CHARGER 0
#define I2C_PORT_PERICOM 0
#define I2C_PORT_THERMAL 0
-#define I2C_PORT_PD_MCU 1
+#define I2C_PORT_PD_MCU 1
#define I2C_PORT_USB_MUX 1
-#define I2C_PORT_TCPC 1
+#define I2C_PORT_TCPC 1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */
/* Timer selection */
#define TIM_CLOCK32 2
#define TIM_WATCHDOG 4
/* Define the host events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT))
#include "gpio_signal.h"
@@ -201,9 +201,9 @@ enum pwm_channel {
};
enum adc_channel {
- ADC_PSYS = 0, /* PC1: STM32_AIN(2) */
+ ADC_PSYS = 0, /* PC1: STM32_AIN(2) */
ADC_AMON_BMON, /* PC0: STM32_AIN(10) */
- ADC_VBUS, /* PA2: STM32_AIN(11) */
+ ADC_VBUS, /* PA2: STM32_AIN(11) */
ADC_CH_COUNT
};
@@ -231,16 +231,16 @@ enum sensor_id {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT
+#define PD_MAX_VOLTAGE_MV 20000
/* The lower the input voltage, the higher the power efficiency. */
#define PD_PREFER_LOW_VOLTAGE
@@ -250,6 +250,6 @@ void board_reset_pd_mcu(void);
/* Set AP reset pin according to parameter */
void board_set_ap_reset(int asserted);
-#endif /* !__ASSEMBLER__ */
+#endif /* !__ASSEMBLER__ */
-#endif /* __CROS_EC_BOARD_H */
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/elm/build.mk b/board/elm/build.mk
index 172a88e843..4d6ba76cae 100644
--- a/board/elm/build.mk
+++ b/board/elm/build.mk
@@ -1,5 +1,5 @@
#-*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/elm/ec.tasklist b/board/elm/ec.tasklist
index 3ea68bf9f8..be745f7487 100644
--- a/board/elm/ec.tasklist
+++ b/board/elm/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/elm/gpio.inc b/board/elm/gpio.inc
index 0dc89269ba..ef77ad732e 100644
--- a/board/elm/gpio.inc
+++ b/board/elm/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/elm/led.c b/board/elm/led.c
index d73cc05c1b..29140ce237 100644
--- a/board/elm/led.c
+++ b/board/elm/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,10 +19,8 @@
#define LOW_BATTERY_PERMILLAGE 137
#define FULL_BATTERY_PERMILLAGE 937
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -31,7 +29,7 @@ enum led_color {
BAT_LED_ORANGE,
PWR_LED_BLUE,
PWR_LED_ORANGE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int bat_led_set(enum led_color color, int on)
@@ -111,8 +109,7 @@ static void elm_led_set_power(void)
bat_led_set(PWR_LED_ORANGE, 0);
} else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) {
bat_led_set(PWR_LED_BLUE, 0);
- bat_led_set(PWR_LED_ORANGE,
- (blink_second & 3) ? 0 : 1);
+ bat_led_set(PWR_LED_ORANGE, (blink_second & 3) ? 0 : 1);
}
}
@@ -135,8 +132,9 @@ static void elm_led_set_battery(void)
/* Make the percentage approximate to UI shown */
remaining_capacity = *(int *)host_get_memmap(EC_MEMMAP_BATT_CAP);
full_charge_capacity = *(int *)host_get_memmap(EC_MEMMAP_BATT_LFCC);
- permillage = !full_charge_capacity ? 0 :
- (1000 * remaining_capacity) / full_charge_capacity;
+ permillage = !full_charge_capacity ?
+ 0 :
+ (1000 * remaining_capacity) / full_charge_capacity;
switch (charge_get_state()) {
case PWR_STATE_CHARGE:
@@ -156,12 +154,10 @@ static void elm_led_set_battery(void)
bat_led_set(BAT_LED_BLUE, 0);
if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
permillage <= CRITICAL_LOW_BATTERY_PERMILLAGE)
- bat_led_set(BAT_LED_ORANGE,
- (blink_second & 1) ? 0 : 1);
+ bat_led_set(BAT_LED_ORANGE, (blink_second & 1) ? 0 : 1);
else if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
permillage <= LOW_BATTERY_PERMILLAGE)
- bat_led_set(BAT_LED_ORANGE,
- (blink_second & 3) ? 0 : 1);
+ bat_led_set(BAT_LED_ORANGE, (blink_second & 3) ? 0 : 1);
else
bat_led_set(BAT_LED_ORANGE, 0);
break;
diff --git a/board/elm/usb_pd_policy.c b/board/elm/usb_pd_policy.c
index 2eeab736d9..0ba277f71d 100644
--- a/board/elm/usb_pd_policy.c
+++ b/board/elm/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
#include "usb_mux.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_set_power_supply_ready(int port)
{
diff --git a/board/endeavour/board.c b/board/endeavour/board.c
index 98d805f60a..0d5e633ea0 100644
--- a/board/endeavour/board.c
+++ b/board/endeavour/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -38,8 +38,8 @@
#include "uart.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static uint8_t board_version;
static uint32_t oem;
@@ -56,14 +56,15 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* TODO: Verify fan control and mft */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_FAN_PWR_EN,
};
@@ -80,39 +81,31 @@ const struct fan_t fans[] = {
BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "pse",
- .port = I2C_PORT_PSE,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "pmic",
- .port = I2C_PORT_PMIC,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "pse",
+ .port = I2C_PORT_PSE,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "pmic",
+ .port = I2C_PORT_PMIC,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -131,10 +124,10 @@ const int usb_port_enable[USB_PORT_COUNT] = {
* src/mainboard/google/${board}/acpi/dptf.asl
*/
const struct temp_sensor_t temp_sensors[] = {
- {"TMP431_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL},
- {"TMP431_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1},
+ { "TMP431_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL },
+ { "TMP431_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -147,9 +140,11 @@ struct ec_thermal_config thermal_params[] = {
* {Twarn, Thigh, X }, <off>
* fan_off, fan_max
*/
- {{0, C_TO_K(81), C_TO_K(82)}, {0, C_TO_K(77), 0},
- C_TO_K(19), C_TO_K(74)}, /* TMP431_Internal */
- {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* TMP431_Sensor_1 */
+ { { 0, C_TO_K(81), C_TO_K(82) },
+ { 0, C_TO_K(77), 0 },
+ C_TO_K(19),
+ C_TO_K(74) }, /* TMP431_Internal */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* TMP431_Sensor_1 */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
@@ -318,9 +313,9 @@ int64_t get_time_dsw_pwrok(void)
}
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 100 },
[PWM_CH_LED_WHITE] = { 5, PWM_CONFIG_DSLEEP, 100 },
- [PWM_CH_FAN] = {4, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 4, PWM_CONFIG_OPEN_DRAIN, 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -332,21 +327,20 @@ struct fan_step {
/* Note: Do not make the fan on/off point equal to 0 or 100 */
static const struct fan_step fan_table0[] = {
- {.on = 0, .off = 2, .rpm = 0},
- {.on = 11, .off = 2, .rpm = 2500},
- {.on = 38, .off = 29, .rpm = 3200},
- {.on = 65, .off = 36, .rpm = 3500},
- {.on = 76, .off = 64, .rpm = 3900},
- {.on = 84, .off = 75, .rpm = 4500},
- {.on = 91, .off = 82, .rpm = 5100},
- {.on = 98, .off = 89, .rpm = 5400},
+ { .on = 0, .off = 2, .rpm = 0 },
+ { .on = 11, .off = 2, .rpm = 2500 },
+ { .on = 38, .off = 29, .rpm = 3200 },
+ { .on = 65, .off = 36, .rpm = 3500 },
+ { .on = 76, .off = 64, .rpm = 3900 },
+ { .on = 84, .off = 75, .rpm = 4500 },
+ { .on = 91, .off = 82, .rpm = 5100 },
+ { .on = 98, .off = 89, .rpm = 5400 },
};
/* All fan tables must have the same number of levels */
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0)
static const struct fan_step *fan_table = fan_table0;
-
static void cbi_init(void)
{
uint32_t val;
@@ -403,8 +397,7 @@ int fan_percent_to_rpm(int fan, int pct)
previous_pct = pct;
- if (fan_table[current_level].rpm !=
- fan_get_rpm_target(FAN_CH(fan)))
+ if (fan_table[current_level].rpm != fan_get_rpm_target(FAN_CH(fan)))
cprints(CC_THERMAL, "Setting fan RPM to %d",
fan_table[current_level].rpm);
diff --git a/board/endeavour/board.h b/board/endeavour/board.h
index 9b0107b2c4..9c0836b0e3 100644
--- a/board/endeavour/board.h
+++ b/board/endeavour/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* Allow dangerous commands.
* TODO: Remove this config before production.
*/
-#undef CONFIG_SYSTEM_UNLOCKED
+#undef CONFIG_SYSTEM_UNLOCKED
#define CONFIG_USB_PD_COMM_LOCKED
/* EC */
@@ -31,7 +31,7 @@
#define CONFIG_FPU
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_POWER_BUTTON_IGNORE_LID
#define CONFIG_PWM
#define CONFIG_LTO
@@ -59,12 +59,12 @@
#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
@@ -82,18 +82,18 @@
#define USB_PORT_COUNT 4
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* I2C ports */
-#define I2C_PORT_PSE NPCX_I2C_PORT0_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT0_1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_THERMAL NPCX_I2C_PORT3
+#define I2C_PORT_PSE NPCX_I2C_PORT0_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT0_1
+#define I2C_PORT_PMIC NPCX_I2C_PORT2
+#define I2C_PORT_THERMAL NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_VBOOT_HASH
#define CONFIG_VSTORE
@@ -109,15 +109,12 @@ enum charge_port {
};
enum temp_sensor_id {
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
TEMP_SENSOR_COUNT
};
-enum adc_channel {
- ADC_VBUS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_CH_COUNT };
enum pwm_channel {
PWM_CH_LED_RED,
diff --git a/board/endeavour/build.mk b/board/endeavour/build.mk
index 20f3f4d02c..2b19f6b43d 100644
--- a/board/endeavour/build.mk
+++ b/board/endeavour/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/endeavour/ec.tasklist b/board/endeavour/ec.tasklist
index ef58c6267a..9a4435f43e 100644
--- a/board/endeavour/ec.tasklist
+++ b/board/endeavour/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/endeavour/gpio.inc b/board/endeavour/gpio.inc
index 85904aab0c..e67f88347a 100644
--- a/board/endeavour/gpio.inc
+++ b/board/endeavour/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/endeavour/led.c b/board/endeavour/led.c
index b75de503e5..91bd6a3410 100644
--- a/board/endeavour/led.c
+++ b/board/endeavour/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -15,7 +15,7 @@
#include "timer.h"
#include "util.h"
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -71,9 +71,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -167,7 +167,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -190,8 +190,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|white|off|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|white|off|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
diff --git a/board/endeavour/pse.c b/board/endeavour/pse.c
index 671288ccf5..bda7e1994d 100644
--- a/board/endeavour/pse.c
+++ b/board/endeavour/pse.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,44 +18,44 @@
#include "timer.h"
#include "util.h"
-#define LTC4291_I2C_ADDR 0x2C
-
-#define LTC4291_REG_SUPEVN_COR 0x0B
-#define LTC4291_REG_STATPWR 0x10
-#define LTC4291_REG_STATPIN 0x11
-#define LTC4291_REG_OPMD 0x12
-#define LTC4291_REG_DISENA 0x13
-#define LTC4291_REG_DETENA 0x14
-#define LTC4291_REG_DETPB 0x18
-#define LTC4291_REG_PWRPB 0x19
-#define LTC4291_REG_RSTPB 0x1A
-#define LTC4291_REG_ID 0x1B
-#define LTC4291_REG_DEVID 0x43
-#define LTC4291_REG_HPMD1 0x46
-#define LTC4291_REG_HPMD2 0x4B
-#define LTC4291_REG_HPMD3 0x50
-#define LTC4291_REG_HPMD4 0x55
-#define LTC4291_REG_LPWRPB 0x6E
-
-#define LTC4291_FLD_STATPIN_AUTO BIT(0)
-#define LTC4291_FLD_RSTPB_RSTALL BIT(4)
-
-#define LTC4291_STATPWR_ON_PORT(port) (0x01 << (port))
-#define LTC4291_DETENA_EN_PORT(port) (0x11 << (port))
-#define LTC4291_DETPB_EN_PORT(port) (0x11 << (port))
-#define LTC4291_PWRPB_OFF_PORT(port) (0x10 << (port))
-
-#define LTC4291_OPMD_AUTO 0xFF
-#define LTC4291_DISENA_ALL 0x0F
-#define LTC4291_DETENA_ALL 0xFF
-#define LTC4291_ID 0x64
-#define LTC4291_DEVID 0x38
-#define LTC4291_HPMD_MIN 0x00
-#define LTC4291_HPMD_MAX 0xA8
-
-#define LTC4291_PORT_MAX 4
-
-#define LTC4291_RESET_DELAY_US (20 * MSEC)
+#define LTC4291_I2C_ADDR 0x2C
+
+#define LTC4291_REG_SUPEVN_COR 0x0B
+#define LTC4291_REG_STATPWR 0x10
+#define LTC4291_REG_STATPIN 0x11
+#define LTC4291_REG_OPMD 0x12
+#define LTC4291_REG_DISENA 0x13
+#define LTC4291_REG_DETENA 0x14
+#define LTC4291_REG_DETPB 0x18
+#define LTC4291_REG_PWRPB 0x19
+#define LTC4291_REG_RSTPB 0x1A
+#define LTC4291_REG_ID 0x1B
+#define LTC4291_REG_DEVID 0x43
+#define LTC4291_REG_HPMD1 0x46
+#define LTC4291_REG_HPMD2 0x4B
+#define LTC4291_REG_HPMD3 0x50
+#define LTC4291_REG_HPMD4 0x55
+#define LTC4291_REG_LPWRPB 0x6E
+
+#define LTC4291_FLD_STATPIN_AUTO BIT(0)
+#define LTC4291_FLD_RSTPB_RSTALL BIT(4)
+
+#define LTC4291_STATPWR_ON_PORT(port) (0x01 << (port))
+#define LTC4291_DETENA_EN_PORT(port) (0x11 << (port))
+#define LTC4291_DETPB_EN_PORT(port) (0x11 << (port))
+#define LTC4291_PWRPB_OFF_PORT(port) (0x10 << (port))
+
+#define LTC4291_OPMD_AUTO 0xFF
+#define LTC4291_DISENA_ALL 0x0F
+#define LTC4291_DETENA_ALL 0xFF
+#define LTC4291_ID 0x64
+#define LTC4291_DEVID 0x38
+#define LTC4291_HPMD_MIN 0x00
+#define LTC4291_HPMD_MAX 0xA8
+
+#define LTC4291_PORT_MAX 4
+
+#define LTC4291_RESET_DELAY_US (20 * MSEC)
#define I2C_PSE_READ(reg, data) \
i2c_read8(I2C_PORT_PSE, LTC4291_I2C_ADDR, LTC4291_REG_##reg, (data))
@@ -63,7 +63,7 @@
#define I2C_PSE_WRITE(reg, data) \
i2c_write8(I2C_PORT_PSE, LTC4291_I2C_ADDR, LTC4291_REG_##reg, (data))
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static int pse_write_hpmd(int port, int val)
{
@@ -173,7 +173,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, pse_init, HOOK_PRIO_DEFAULT);
/* Also reset the PSE on a reboot to toggle the power. */
DECLARE_HOOK(HOOK_CHIPSET_RESET, pse_init, HOOK_PRIO_DEFAULT);
-static int command_pse(int argc, char **argv)
+static int command_pse(int argc, const char **argv)
{
int port;
@@ -205,8 +205,7 @@ static int command_pse(int argc, char **argv)
else
return EC_ERROR_PARAM2;
}
-DECLARE_CONSOLE_COMMAND(pse, command_pse,
- "<port# 0-3> <off | on | min | max>",
+DECLARE_CONSOLE_COMMAND(pse, command_pse, "<port# 0-3> <off | on | min | max>",
"Set PSE port power");
static int ec_command_pse_status(int port, uint8_t *status)
diff --git a/board/eve/battery.c b/board/eve/battery.c
index 2a505b80ec..d1ce1fd74a 100644
--- a/board/eve/battery.c
+++ b/board/eve/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,10 +18,10 @@
#include "i2c.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHUTDOWN_DATA 0x0010
/* Vendor CTO command parameter */
#define SB_VENDOR_PARAM_CTO_DISABLE 0
@@ -81,16 +81,16 @@ static int otd_recovery_temp_reg = -1;
* limits are given by discharging_min/max_c.
*/
static const struct battery_info batt_info_lg = {
- .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6100, /* Add 100mV for charger accuracy */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 46,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
+ .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
+ .voltage_normal = 7700,
+ .voltage_min = 6100, /* Add 100mV for charger accuracy */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 46,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = 0,
+ .discharging_max_c = 60,
};
/*
@@ -99,16 +99,16 @@ static const struct battery_info batt_info_lg = {
* limits are given by discharging_min/max_c.
*/
static const struct battery_info batt_info_lishen = {
- .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6100, /* Add 100mV for charger accuracy */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 46,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
+ .voltage_max = TARGET_WITH_MARGIN(8800, 5), /* mV */
+ .voltage_normal = 7700,
+ .voltage_min = 6100, /* Add 100mV for charger accuracy */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 46,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = 0,
+ .discharging_max_c = 60,
};
static const struct board_batt_params info[] = {
@@ -139,7 +139,7 @@ static int board_get_battery_type(void)
if (!battery_manufacturer_name(name, sizeof(name))) {
for (i = 0; i < BATTERY_TYPE_COUNT; i++) {
if (!strncasecmp(name, info[i].manuf_name,
- ARRAY_SIZE(name)-1)) {
+ ARRAY_SIZE(name) - 1)) {
board_battery_type = i;
break;
}
@@ -168,7 +168,9 @@ DECLARE_HOOK(HOOK_INIT, board_init_battery_type, HOOK_PRIO_INIT_I2C + 1);
const struct battery_info *battery_get_info(void)
{
return info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type].batt_info;
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type]
+ .batt_info;
}
int board_cut_off_battery(void)
@@ -192,7 +194,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
/* Do not discharge on AC if the battery is still waking up */
if (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- !(curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.status & STATUS_FULLY_CHARGED))
return 0;
/*
@@ -209,8 +211,8 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
* and suspend USB charging and DC/DC converter.
*/
if (!battery_is_cut_off() &&
- !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
/*
@@ -275,8 +277,9 @@ static int battery_init(void)
{
int batt_status;
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
+ return battery_status(&batt_status) ?
+ 0 :
+ !!(batt_status & STATUS_INITIALIZED);
}
/* Allow booting now that the battery has woke up */
@@ -305,8 +308,8 @@ static int battery_check_disconnect(void)
uint8_t data[6];
/* Check if battery discharging is disabled. */
- rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return BATTERY_DISCONNECT_ERROR;
@@ -384,14 +387,13 @@ static int board_battery_sb_write(uint8_t access, int cmd)
buf[1] = cmd & 0xff;
buf[2] = (cmd >> 8) & 0xff;
- rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
- buf, 1 + sizeof(uint16_t), NULL, 0);
+ rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf,
+ 1 + sizeof(uint16_t), NULL, 0);
return rv;
}
-int board_battery_read_mfgacc(int offset, int access,
- uint8_t *buf, int len)
+int board_battery_read_mfgacc(int offset, int access, uint8_t *buf, int len)
{
int rv;
uint8_t block_len, reg;
@@ -408,7 +410,7 @@ int board_battery_read_mfgacc(int offset, int access,
reg = access;
rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, &reg, 1,
- &block_len, 1, I2C_XFER_START);
+ &block_len, 1, I2C_XFER_START);
if (rv) {
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
@@ -419,7 +421,7 @@ int board_battery_read_mfgacc(int offset, int access,
block_len = len;
rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, NULL, 0,
- buf, block_len, I2C_XFER_STOP);
+ buf, block_len, I2C_XFER_STOP);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
@@ -432,7 +434,8 @@ static int board_battery_unseal(uint32_t param)
/* Get Operation Status */
rv = board_battery_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ SB_ALT_MANUFACTURER_ACCESS, data,
+ sizeof(data));
if (rv)
return EC_ERROR_UNKNOWN;
@@ -457,7 +460,8 @@ static int board_battery_unseal(uint32_t param)
/* Verify that battery is unsealed */
rv = board_battery_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ SB_ALT_MANUFACTURER_ACCESS, data,
+ sizeof(data));
if (rv || ((data[3] & 0x3) != 0x2))
return EC_ERROR_UNKNOWN;
}
@@ -474,7 +478,7 @@ static int board_battery_seal(void)
int rv;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = board_battery_sb_write(SB_MANUFACTURER_ACCESS, 0x0030);
+ rv = board_battery_sb_write(SB_MANUFACTURER_ACCESS, 0x0030);
i2c_lock(I2C_PORT_BATTERY, 0);
if (rv != EC_SUCCESS)
@@ -507,8 +511,7 @@ static int board_battery_write_flash(int addr, uint32_t data, int len)
len += 4;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf,
- len, NULL, 0);
+ rv = i2c_xfer(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, len, NULL, 0);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
@@ -522,13 +525,13 @@ static int board_battery_read_flash(int block, int len, uint8_t *buf)
if (len > 4)
len = 4;
- rv = board_battery_read_mfgacc(block,
- SB_ALT_MANUFACTURER_ACCESS, data, len + 2);
+ rv = board_battery_read_mfgacc(block, SB_ALT_MANUFACTURER_ACCESS, data,
+ len + 2);
if (rv)
return EC_RES_ERROR;
for (i = 0; i < len; i++)
- buf[i] = data[i+2];
+ buf[i] = data[i + 2];
return EC_SUCCESS;
}
@@ -594,7 +597,7 @@ static int board_battery_fix_otd_recovery_temp(uint32_t value)
(uint8_t *)&otd_recovery_temp))
otd_recovery_temp_reg = otd_recovery_temp;
} else {
- otd_recovery_temp_reg = otd_recovery_temp;
+ otd_recovery_temp_reg = otd_recovery_temp;
}
if (board_battery_seal()) {
diff --git a/board/eve/board.c b/board/eve/board.c
index fb0fc4b87a..9b7395b039 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -38,6 +38,7 @@
#include "math_util.h"
#include "motion_lid.h"
#include "motion_sense.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -57,8 +58,8 @@
#include "util.h"
#include "espi.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -171,13 +172,13 @@ __override struct keyboard_scan_config keyscan_config = {
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { 5, 0, 10000 },
- [PWM_CH_LED_L_RED] = { 2, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_KBLIGHT] = { 5, 0, 10000 },
+ [PWM_CH_LED_L_RED] = { 2, PWM_CONFIG_DSLEEP, 100 },
[PWM_CH_LED_L_GREEN] = { 3, PWM_CONFIG_DSLEEP, 100 },
- [PWM_CH_LED_L_BLUE] = { 4, PWM_CONFIG_DSLEEP, 100 },
- [PWM_CH_LED_R_RED] = { 1, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_LED_L_BLUE] = { 4, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_LED_R_RED] = { 1, PWM_CONFIG_DSLEEP, 100 },
[PWM_CH_LED_R_GREEN] = { 0, PWM_CONFIG_DSLEEP, 100 },
- [PWM_CH_LED_R_BLUE] = { 6, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_LED_R_BLUE] = { 6, PWM_CONFIG_DSLEEP, 100 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -190,42 +191,32 @@ const enum gpio_signal hibernate_wake_pins[] = {
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "accelgyro",
- .port = I2C_PORT_GYRO,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "sensors",
- .port = I2C_PORT_LID_ACCEL,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "batt",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "accelgyro",
+ .port = I2C_PORT_GYRO,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "sensors",
+ .port = I2C_PORT_LID_ACCEL,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "batt",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -249,16 +240,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &anx74xx_tcpm_usb_mux_driver,
+ .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &anx74xx_tcpm_usb_mux_driver,
+ .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ },
},
};
@@ -360,7 +357,7 @@ void board_tcpc_init(void)
*/
for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
uint16_t tcpc_get_alert_status(void)
@@ -381,18 +378,18 @@ uint16_t tcpc_get_alert_status(void)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* These BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
- {"Gyro", TEMP_SENSOR_TYPE_BOARD, bmi160_get_sensor_temp, BASE_GYRO},
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
+ { "eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM3 },
+ { "Gyro", TEMP_SENSOR_TYPE_BOARD, bmi160_get_sensor_temp, BASE_GYRO },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -408,8 +405,8 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
- != EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault) !=
+ EC_SUCCESS)
return;
if (!(vrfault & BIT(4)))
@@ -636,8 +633,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
@@ -649,8 +646,8 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
return;
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -719,7 +716,7 @@ __override void lid_angle_peripheral_enable(int enable)
* which might be faulty. Disable keyboard and trackpad wake.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_OFF) ||
- (tablet_get_mode() && chipset_in_state(CHIPSET_STATE_SUSPEND)))
+ (tablet_get_mode() && chipset_in_state(CHIPSET_STATE_SUSPEND)))
enable = 0;
keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
@@ -851,36 +848,30 @@ static struct mutex g_lid_mutex;
static struct kionix_accel_data g_kxcj9_data;
static struct bmi_drv_data_t g_bmi160_data;
-static struct si114x_drv_data_t g_si114x_data = {
- .state = SI114X_NOT_READY,
- .covered = 0,
- .type_data = {
- /* Proximity - unused */
- {
- },
- /* light */
- {
- .base_data_reg = SI114X_ALS_VIS_DATA0,
- .irq_flags = SI114X_IRQ_ENABLE_ALS_IE_INT0 |
- SI114X_IRQ_ENABLE_ALS_IE_INT1,
- .scale = 1,
- .offset = -256,
- }
- }
-};
+static struct si114x_drv_data_t
+ g_si114x_data = { .state = SI114X_NOT_READY,
+ .covered = 0,
+ .type_data = {
+ /* Proximity - unused */
+ {},
+ /* light */
+ {
+ .base_data_reg = SI114X_ALS_VIS_DATA0,
+ .irq_flags =
+ SI114X_IRQ_ENABLE_ALS_IE_INT0 |
+ SI114X_IRQ_ENABLE_ALS_IE_INT1,
+ .scale = 1,
+ .offset = -256,
+ } } };
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t mag_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t mag_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/eve/board.h b/board/eve/board.h
index c1549becfb..defc3e746e 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -26,7 +26,7 @@
#define CONFIG_FLASH_SIZE_BYTES 0x80000
#define CONFIG_FPU
/* 7 day delay before hibernate */
-#undef CONFIG_HIBERNATE_DELAY_SEC
+#undef CONFIG_HIBERNATE_DELAY_SEC
#define CONFIG_HIBERNATE_DELAY_SEC (3600 * 24 * 7)
/* 1 day delay before hibernate if battery is less than 10% */
#define CONFIG_HIBERNATE_BATT_PCT 10
@@ -65,7 +65,7 @@
#define CONFIG_HOSTCMD_PD_CONTROL
/* EC console history configuration */
-#undef CONFIG_CONSOLE_HISTORY
+#undef CONFIG_CONSOLE_HISTORY
#define CONFIG_CONSOLE_HISTORY 1
/* SOC */
@@ -73,12 +73,12 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
#define CONFIG_KEYBOARD_COL2_INVERTED
-#undef CONFIG_KEYBOARD_VIVALDI
+#undef CONFIG_KEYBOARD_VIVALDI
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_KEYBOARD_REFRESH_ROW3
#define CONFIG_TABLET_MODE
@@ -108,12 +108,12 @@
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define BD9995X_IOUT_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
#define BD9995X_PSYS_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
@@ -138,7 +138,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS
-#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT /* Unused */
+#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT /* Unused */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_INVALID_CHECK
@@ -195,26 +195,26 @@
#define CONFIG_USBC_VCONN_SWAP
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
-#define I2C_PORT_GYRO NPCX_I2C_PORT1
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
-#define I2C_PORT_ALS NPCX_I2C_PORT2
-#define I2C_PORT_PMIC NPCX_I2C_PORT3
-#define I2C_PORT_BATTERY NPCX_I2C_PORT3
-#define I2C_PORT_CHARGER NPCX_I2C_PORT3
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
-#define I2C_PORT_MP2949 NPCX_I2C_PORT3
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
+#define I2C_PORT_GYRO NPCX_I2C_PORT1
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
+#define I2C_PORT_ALS NPCX_I2C_PORT2
+#define I2C_PORT_PMIC NPCX_I2C_PORT3
+#define I2C_PORT_BATTERY NPCX_I2C_PORT3
+#define I2C_PORT_CHARGER NPCX_I2C_PORT3
+#define I2C_PORT_THERMAL I2C_PORT_PMIC
+#define I2C_PORT_MP2949 NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_BD99992_FLAGS 0x30
-#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
#ifndef __ASSEMBLER__
@@ -234,11 +234,11 @@ enum board_version_list {
};
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
+ TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
+ TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
TEMP_SENSOR_GYRO,
TEMP_SENSOR_COUNT
};
@@ -282,24 +282,22 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum adc_channel {
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_CH_COUNT };
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
int board_get_version(void);
diff --git a/board/eve/build.mk b/board/eve/build.mk
index f47b5d9caf..0913dd9370 100644
--- a/board/eve/build.mk
+++ b/board/eve/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/eve/ec.tasklist b/board/eve/ec.tasklist
index 99de365243..75e5f918c5 100644
--- a/board/eve/ec.tasklist
+++ b/board/eve/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/eve/gpio.inc b/board/eve/gpio.inc
index f9b0c3cfc4..6bf357f0c3 100644
--- a/board/eve/gpio.inc
+++ b/board/eve/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/eve/led.c b/board/eve/led.c
index 91a7b24a2b..9fe3becabd 100644
--- a/board/eve/led.c
+++ b/board/eve/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,8 +19,8 @@
#include "task.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_PWM, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_PWM, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_PWM, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_PWM, format, ##args)
#define LED_TICK_TIME (500 * MSEC)
#define LED_TICKS_PER_BEAT 1
@@ -37,7 +37,9 @@
* (120, .5, .33). For the transitions of interest only S and I are changed and
* they are changed linearly in HSI space.
*/
-static const uint8_t trans_steps[] = {0, 4, 9, 16, 24, 33, 44, 56, 69, 84, 100};
+static const uint8_t trans_steps[] = {
+ 0, 4, 9, 16, 24, 33, 44, 56, 69, 84, 100
+};
/* List of LED colors used */
enum led_color {
@@ -65,11 +67,7 @@ enum led_pattern {
LED_NUM_PATTERNS,
};
-enum led_side {
- LED_LEFT = 0,
- LED_RIGHT,
- LED_BOTH
-};
+enum led_side { LED_LEFT = 0, LED_RIGHT, LED_BOTH };
struct led_info {
/* LED pattern manage variables */
@@ -101,8 +99,8 @@ static int double_tap;
static int led_charge_side;
static struct led_info led[LED_BOTH];
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED, EC_LED_ID_RIGHT_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
/*
@@ -110,16 +108,18 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* particular pattern never changes from the first phase.
*/
static const struct led_phase pattern[LED_NUM_PATTERNS] = {
- { {LED_OFF, LED_OFF}, {0, 0}, DOUBLE_TAP_TICK_LEN },
- { {LED_GREEN, LED_GREEN}, {0, 0}, DOUBLE_TAP_TICK_LEN },
- { {LED_WHITE, LED_GREEN}, {2, 4}, DOUBLE_TAP_TICK_LEN },
- { {LED_WHITE, LED_WHITE}, {0, 0}, DOUBLE_TAP_TICK_LEN },
- { {LED_WHITE, LED_RED}, {2, 4}, DOUBLE_TAP_TICK_LEN },
- { {LED_RED, LED_RED}, {0, 0}, DOUBLE_TAP_TICK_LEN},
- { {LED_RED, LED_RED_HALF}, {4, 4}, DOUBLE_TAP_TICK_LEN * 2 +
- DOUBLE_TAP_TICK_LEN / 2},
- { {LED_RED, LED_OFF}, {1, 5}, DOUBLE_TAP_TICK_LEN * 3 +
- DOUBLE_TAP_TICK_LEN / 2},
+ { { LED_OFF, LED_OFF }, { 0, 0 }, DOUBLE_TAP_TICK_LEN },
+ { { LED_GREEN, LED_GREEN }, { 0, 0 }, DOUBLE_TAP_TICK_LEN },
+ { { LED_WHITE, LED_GREEN }, { 2, 4 }, DOUBLE_TAP_TICK_LEN },
+ { { LED_WHITE, LED_WHITE }, { 0, 0 }, DOUBLE_TAP_TICK_LEN },
+ { { LED_WHITE, LED_RED }, { 2, 4 }, DOUBLE_TAP_TICK_LEN },
+ { { LED_RED, LED_RED }, { 0, 0 }, DOUBLE_TAP_TICK_LEN },
+ { { LED_RED, LED_RED_HALF },
+ { 4, 4 },
+ DOUBLE_TAP_TICK_LEN * 2 + DOUBLE_TAP_TICK_LEN / 2 },
+ { { LED_RED, LED_OFF },
+ { 1, 5 },
+ DOUBLE_TAP_TICK_LEN * 3 + DOUBLE_TAP_TICK_LEN / 2 },
};
/*
@@ -129,12 +129,9 @@ static const struct led_phase pattern[LED_NUM_PATTERNS] = {
#define PWM_CHAN_PER_LED 3
static const uint8_t color_brightness[LED_COLOR_COUNT][PWM_CHAN_PER_LED] = {
/* {Red, Green, Blue}, */
- [LED_OFF] = {0, 0, 0},
- [LED_RED] = {80, 0, 0},
- [LED_GREEN] = {0, 80, 0},
- [LED_BLUE] = {0, 0, 80},
- [LED_WHITE] = {100, 100, 100},
- [LED_RED_HALF] = {40, 0, 0},
+ [LED_OFF] = { 0, 0, 0 }, [LED_RED] = { 80, 0, 0 },
+ [LED_GREEN] = { 0, 80, 0 }, [LED_BLUE] = { 0, 0, 80 },
+ [LED_WHITE] = { 100, 100, 100 }, [LED_RED_HALF] = { 40, 0, 0 },
};
/*
@@ -153,13 +150,13 @@ struct range_map {
#error "LED: PULSE_RED battery level <= BLINK_RED level"
#endif
static const struct range_map pattern_tbl[] = {
- {CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC - 1, BLINK_RED},
- {5, PULSE_RED},
- {15, SOLID_RED},
- {25, WHITE_RED},
- {75, SOLID_WHITE},
- {95, WHITE_GREEN},
- {100, SOLID_GREEN},
+ { CONFIG_USB_PD_TRY_SRC_MIN_BATT_SOC - 1, BLINK_RED },
+ { 5, PULSE_RED },
+ { 15, SOLID_RED },
+ { 25, WHITE_RED },
+ { 75, SOLID_WHITE },
+ { 95, WHITE_GREEN },
+ { 100, SOLID_GREEN },
};
enum led_state_change {
@@ -323,18 +320,17 @@ static void led_setup_color_change(int old_idx, int new_idx, enum led_side side)
*/
total_change = ABS(led[side].rgb_current[rgb_index] -
led[side].rgb_target[rgb_index]);
- delta_per_step = (total_change << LED_FRAC_BITS)
- / (ARRAY_SIZE(trans_steps) - 1);
+ delta_per_step = (total_change << LED_FRAC_BITS) /
+ (ARRAY_SIZE(trans_steps) - 1);
step_value = 0;
for (i = 0; i < ARRAY_SIZE(trans_steps); i++) {
- led[side].trans[i] = start_lvl +
- ((step_value +
- (1 << (LED_FRAC_BITS - 1)))
- >> LED_FRAC_BITS);
+ led[side].trans[i] =
+ start_lvl +
+ ((step_value + (1 << (LED_FRAC_BITS - 1))) >>
+ LED_FRAC_BITS);
step_value += delta_per_step;
}
}
-
}
static void led_adjust_color_step(int side)
@@ -397,12 +393,10 @@ static void led_change_color(void)
/* Will loop here until the color change is complete. */
while (led[LED_LEFT].state != LED_STATE_DONE ||
led[LED_RIGHT].state != LED_STATE_DONE) {
-
for (i = 0; i < LED_BOTH; i++) {
if (led[i].state != LED_STATE_DONE)
/* Move one step in the transition table */
led_adjust_color_step(i);
-
}
msleep(LED_STEP_MSEC);
}
@@ -427,14 +421,19 @@ static void led_manage_patterns(enum led_pattern *pattern_desired, int tap)
*/
if (i == led_charge_side || !led[i].tap_tick_count) {
led[i].ticks = 0;
- led[i].tap_tick_count = tap ?
- pattern[pattern_desired[i]].tap_len : 0;
+ led[i].tap_tick_count =
+ tap ? pattern[pattern_desired[i]]
+ .tap_len :
+ 0;
led[i].pattern_sel = pattern_desired[i];
}
}
/* Determine pattern phase and color for current phase */
phase = led[i].ticks < LED_TICKS_PER_BEAT *
- pattern[led[i].pattern_sel].len[0] ? 0 : 1;
+ pattern[led[i].pattern_sel]
+ .len[0] ?
+ 0 :
+ 1;
color = pattern[led[i].pattern_sel].color[phase];
/* If color is changing, then setup the transition. */
if (led[i].color != color) {
@@ -458,9 +457,10 @@ static void led_manage_patterns(enum led_pattern *pattern_desired, int tap)
* count.
*/
if (pattern[led[i].pattern_sel].len[0])
- if (++led[i].ticks == LED_TICKS_PER_BEAT *
- (pattern[led[i].pattern_sel].len[0] +
- pattern[led[i].pattern_sel].len[1]))
+ if (++led[i].ticks ==
+ LED_TICKS_PER_BEAT *
+ (pattern[led[i].pattern_sel].len[0] +
+ pattern[led[i].pattern_sel].len[1]))
led[i].ticks = 0;
/* If double tap display is active, decrement its counter */
@@ -535,8 +535,8 @@ static void led_select_pattern(enum led_pattern *pattern_desired, int tap)
* charging side LED.
*/
if (chg_state == PWR_STATE_CHARGE_NEAR_FULL ||
- ((chg_state == PWR_STATE_DISCHARGE_FULL)
- && extpower_is_present())) {
+ ((chg_state == PWR_STATE_DISCHARGE_FULL) &&
+ extpower_is_present())) {
new_pattern = SOLID_GREEN;
} else if (chg_state == PWR_STATE_CHARGE) {
new_pattern = SOLID_WHITE;
@@ -586,7 +586,6 @@ static void led_init(void)
led[i].tap_tick_count = 0;
led[i].state = LED_STATE_DONE;
}
-
}
void led_task(void *u)
@@ -633,7 +632,7 @@ void led_task(void *u)
/******************************************************************/
/* Console commands */
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
int side = LED_BOTH;
char *e;
diff --git a/board/eve/usb_pd_policy.c b/board/eve/usb_pd_policy.c
index d6dd5ad1be..729cdfa018 100644
--- a/board/eve/usb_pd_policy.c
+++ b/board/eve/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,12 +23,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -38,9 +38,9 @@ int board_vbus_source_enabled(int port)
static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio_5v_en = port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN;
+ GPIO_USB_C0_5V_EN;
enum gpio_signal gpio_3a_en = port ? GPIO_EN_USB_C1_3A :
- GPIO_EN_USB_C0_3A;
+ GPIO_EN_USB_C0_3A;
int flags;
if (system_get_board_version() >= BOARD_VERSION_P1B) {
@@ -50,8 +50,8 @@ static void board_vbus_update_source_current(int port)
* is controlled by GPIO_USB_C0/1_5V_EN. Both of these signals
* can remain outputs.
*/
- gpio_set_level(gpio_3a_en, vbus_rp[port] == TYPEC_RP_3A0 ?
- 1 : 0);
+ gpio_set_level(gpio_3a_en,
+ vbus_rp[port] == TYPEC_RP_3A0 ? 1 : 0);
gpio_set_level(gpio_5v_en, vbus_en[port]);
} else {
/*
@@ -65,8 +65,8 @@ static void board_vbus_update_source_current(int port)
* 1505 mA.
*/
flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) :
- (GPIO_OUTPUT | GPIO_PULL_UP);
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
gpio_set_level(gpio_5v_en, vbus_en[port]);
gpio_set_flags(gpio_5v_en, flags);
}
@@ -120,15 +120,13 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
}
-void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
return;
- gpio_set_level(GPIO_USB2_OTG_ID,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_OTG_ID, (data_role == PD_ROLE_UFP) ? 1 : 0);
gpio_set_level(GPIO_USB2_OTG_VBUSSENSE,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ (data_role == PD_ROLE_UFP) ? 1 : 0);
}
diff --git a/board/ezkinil/battery.c b/board/ezkinil/battery.c
index 8c5ec9e1d7..1260b428ae 100644
--- a/board/ezkinil/battery.c
+++ b/board/ezkinil/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c
index 46757d22f3..c9e1aca267 100644
--- a/board/ezkinil/board.c
+++ b/board/ezkinil/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,7 +14,7 @@
#include "driver/accelgyro_icm426xx.h"
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/retimer/pi3hdx1204.h"
#include "driver/retimer/tusb544.h"
@@ -50,17 +50,16 @@ static int board_ver;
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* Motion sensors */
static struct mutex g_lid_mutex;
@@ -72,21 +71,15 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct icm_drv_data_t g_icm426xx_data;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-const mat33_fp_t base_standard_ref_1 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+const mat33_fp_t base_standard_ref_1 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
struct motion_sensor_t motion_sensors[] = {
@@ -211,7 +204,6 @@ struct motion_sensor_t icm426xx_base_gyro = {
.max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
-
struct motion_sensor_t icm42607_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -347,9 +339,12 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since FSUSB42UMX is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
/*****************************************************************************
@@ -394,6 +389,9 @@ void motion_interrupt(enum gpio_signal signal)
* USB-C MUX/Retimer dynamic configuration
*/
+/* Place holder for second mux in USBC1 chain */
+struct usb_mux_chain usbc1_mux1;
+
int board_usbc1_retimer_inhpd = IOEX_USB_C1_HPD_IN_DB;
static void setup_mux(void)
@@ -411,11 +409,9 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the AMD FP5
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_amd_fp5_usb_mux,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux;
/* Set the PS8818 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818;
+ usbc1_mux1.mux = &usbc1_ps8818;
} else if (mux == SSFC_C1_MUX_TUSB544) {
ccprints("C1 TUSB544 detected");
/*
@@ -424,11 +420,9 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the AMD FP5
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_amd_fp5_usb_mux,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux;
/* Set the TUSB544 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_tusb544;
+ usbc1_mux1.mux = &usbc1_tusb544;
} else if (ec_config_has_usbc1_retimer_ps8743()) {
ccprints("C1 PS8743 detected");
/*
@@ -437,32 +431,33 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the PS8743
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_ps8743,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_ps8743;
/* Set the AMD FP5 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux;
+ usbc1_mux1.mux = &usbc1_amd_fp5_usb_mux;
/* Don't have the AMD FP5 flip */
usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
}
}
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
[USBC_PORT_C1] = {
/* Filled in dynamically at startup */
+ .next = &usbc1_mux1,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
static int board_tusb544_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Enable IN_HPD on the DB */
@@ -474,8 +469,7 @@ static int board_tusb544_mux_set(const struct usb_mux *me,
return EC_SUCCESS;
}
-static int board_ps8743_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
if (mux_state & USB_PD_MUX_DP_ENABLED)
/* Enable IN_HPD on the DB */
@@ -543,15 +537,15 @@ __override void ppc_interrupt(enum gpio_signal signal)
}
}
-__override int board_aoz1380_set_vbus_source_current_limit(int port,
- enum tcpc_rp_value rp)
+__override int
+board_aoz1380_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp)
{
int rv;
/* Use the TCPC to set the current limit */
- rv = ioex_set_level(port ? IOEX_USB_C1_PPC_ILIM_3A_EN
- : IOEX_USB_C0_PPC_ILIM_3A_EN,
- (rp == TYPEC_RP_3A0) ? 1 : 0);
+ rv = ioex_set_level(port ? IOEX_USB_C1_PPC_ILIM_3A_EN :
+ IOEX_USB_C0_PPC_ILIM_3A_EN,
+ (rp == TYPEC_RP_3A0) ? 1 : 0);
return rv;
}
@@ -621,10 +615,9 @@ static void hdmi_hpd_handler(void)
gpio_set_level(GPIO_DP1_HPD, hpd);
ccprints("HDMI HPD %d", hpd);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON)
- && hpd);
+ pi3hdx1204_enable(
+ I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) && hpd);
}
DECLARE_DEFERRED(hdmi_hpd_handler);
@@ -652,8 +645,7 @@ static void board_chipset_resume(void)
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 1);
msleep(PI3HDX1204_POWER_ON_DELAY_MS);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
check_hdmi_hpd_status());
}
}
@@ -664,9 +656,7 @@ static void board_chipset_suspend(void)
ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0);
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 0);
}
@@ -681,7 +671,7 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -772,8 +762,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_THERMISTOR \
- { \
+#define THERMAL_THERMISTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(95), \
@@ -790,8 +780,8 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_SOC \
- { \
+#define THERMAL_SOC \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -814,14 +804,14 @@ struct fan_step {
/* Note: Do not make the fan on/off point equal to 0 or 100 */
static const struct fan_step fan_table0[] = {
- {.on = 0, .off = 1, .rpm = 0},
- {.on = 9, .off = 1, .rpm = 3200},
- {.on = 21, .off = 7, .rpm = 3500},
- {.on = 28, .off = 16, .rpm = 3900},
- {.on = 37, .off = 26, .rpm = 4200},
- {.on = 47, .off = 35, .rpm = 4600},
- {.on = 56, .off = 44, .rpm = 5100},
- {.on = 72, .off = 60, .rpm = 5500},
+ { .on = 0, .off = 1, .rpm = 0 },
+ { .on = 9, .off = 1, .rpm = 3200 },
+ { .on = 21, .off = 7, .rpm = 3500 },
+ { .on = 28, .off = 16, .rpm = 3900 },
+ { .on = 37, .off = 26, .rpm = 4200 },
+ { .on = 47, .off = 35, .rpm = 4600 },
+ { .on = 56, .off = 44, .rpm = 5100 },
+ { .on = 72, .off = 60, .rpm = 5500 },
};
/* All fan tables must have the same number of levels */
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0)
@@ -867,8 +857,7 @@ int fan_percent_to_rpm(int fan, int pct)
previous_pct = pct;
- if (fan_table[current_level].rpm !=
- fan_get_rpm_target(FAN_CH(fan))) {
+ if (fan_table[current_level].rpm != fan_get_rpm_target(FAN_CH(fan))) {
cprints(CC_THERMAL, "Setting fan RPM to %d",
fan_table[current_level].rpm);
board_print_temps();
@@ -878,7 +867,7 @@ int fan_percent_to_rpm(int fan, int pct)
}
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Limit the input current to 95% negotiated limit,
@@ -886,7 +875,6 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/ezkinil/board.h b/board/ezkinil/board.h
index 72ccbc78d2..aa1fe065f4 100644
--- a/board/ezkinil/board.h
+++ b/board/ezkinil/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,38 +40,34 @@
#define TUSB544_I2C_ADDR_FLAGS1 0x0F
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_DP1_HPD GPIO_EC_DP1_HPD
-#define IOEX_HDMI_CONN_HPD_3V3_DB IOEX_USB_C1_PPC_ILIM_3A_EN
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_DP1_HPD GPIO_EC_DP1_HPD
+#define IOEX_HDMI_CONN_HPD_3V3_DB IOEX_USB_C1_PPC_ILIM_3A_EN
#ifndef __ASSEMBLER__
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_AP19B8M,
@@ -85,11 +81,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_FAN, PWM_CH_COUNT };
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -98,11 +90,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
@@ -153,57 +141,46 @@ enum ec_cfg_usb_db_type {
#include "cbi_ec_fw_config.h"
-#define HAS_USBA1_RETIMER_TUSB522 \
- (BIT(EZKINIL_DB_T_OPT2_USBAC))
+#define HAS_USBA1_RETIMER_TUSB522 (BIT(EZKINIL_DB_T_OPT2_USBAC))
static inline bool ec_config_has_usba1_retimer_tusb522(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBA1_RETIMER_TUSB522);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBA1_RETIMER_TUSB522);
}
-#define HAS_USBC1_RETIMER_PS8743 \
- (BIT(EZKINIL_DB_T_OPT2_USBAC))
+#define HAS_USBC1_RETIMER_PS8743 (BIT(EZKINIL_DB_T_OPT2_USBAC))
static inline bool ec_config_has_usbc1_retimer_ps8743(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8743);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8743);
}
-#define HAS_USBC1_RETIMER_TUSB544 \
- (BIT(EZKINIL_DB_T_OPT1_USBC_HDMI))
+#define HAS_USBC1_RETIMER_TUSB544 (BIT(EZKINIL_DB_T_OPT1_USBC_HDMI))
static inline bool ec_config_has_usbc1_retimer_tusb544(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_TUSB544);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_TUSB544);
}
-#define HAS_HDMI_RETIMER_PI3HDX1204 \
- (BIT(EZKINIL_DB_T_OPT1_USBC_HDMI))
+#define HAS_HDMI_RETIMER_PI3HDX1204 (BIT(EZKINIL_DB_T_OPT1_USBC_HDMI))
static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_RETIMER_PI3HDX1204);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_RETIMER_PI3HDX1204);
}
-#define HAS_HDMI_CONN_HPD \
- (BIT(EZKINIL_DB_T_OPT1_USBC_HDMI))
+#define HAS_HDMI_CONN_HPD (BIT(EZKINIL_DB_T_OPT1_USBC_HDMI))
static inline bool ec_config_has_hdmi_conn_hpd(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_CONN_HPD);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_CONN_HPD);
}
/* TODO: Fill in with GPIO values */
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB_C0_HPD \
- : (ec_config_has_usbc1_retimer_ps8743()) \
- ? GPIO_DP1_HPD \
- : GPIO_DP2_HPD)
+#define PORT_TO_HPD(port) \
+ ((port == 0) ? GPIO_USB_C0_HPD : \
+ (ec_config_has_usbc1_retimer_ps8743()) ? GPIO_DP1_HPD : \
+ GPIO_DP2_HPD)
extern const struct usb_mux usbc1_tusb544;
extern const struct usb_mux usbc1_ps8818;
diff --git a/board/ezkinil/build.mk b/board/ezkinil/build.mk
index 1c0cbc4f63..45c71f962c 100644
--- a/board/ezkinil/build.mk
+++ b/board/ezkinil/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/ezkinil/ec.tasklist b/board/ezkinil/ec.tasklist
index d9c1606eb2..abc796f74f 100644
--- a/board/ezkinil/ec.tasklist
+++ b/board/ezkinil/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/ezkinil/gpio.inc b/board/ezkinil/gpio.inc
index 8e75ec9975..4ea6712424 100644
--- a/board/ezkinil/gpio.inc
+++ b/board/ezkinil/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/ezkinil/led.c b/board/ezkinil/led.c
index 7c425fa138..328b47a9e4 100644
--- a/board/ezkinil/led.c
+++ b/board/ezkinil/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,26 +8,34 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 100;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{LED_OFF, 1 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_BLUE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { LED_OFF, 1 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/felwinter/battery.c b/board/felwinter/battery.c
index 08c129d118..257d7e8255 100644
--- a/board/felwinter/battery.c
+++ b/board/felwinter/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/felwinter/board.c b/board/felwinter/board.c
index 7f39e58336..556ea2475e 100644
--- a/board/felwinter/board.c
+++ b/board/felwinter/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,8 +29,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -94,8 +94,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -126,7 +126,6 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
/**
* Deferred function to handle pen detect change
*/
@@ -149,8 +148,7 @@ DECLARE_HOOK(HOOK_INIT, pendetect_deferred, HOOK_PRIO_DEFAULT);
void pen_detect_interrupt(enum gpio_signal s)
{
/* Trigger deferred notification of pen detect change */
- hook_call_deferred(&pendetect_deferred_data,
- 500 * MSEC);
+ hook_call_deferred(&pendetect_deferred_data, 500 * MSEC);
}
void pen_config(void)
diff --git a/board/felwinter/board.h b/board/felwinter/board.h
index 26feb8de3c..17e1cf9246 100644
--- a/board/felwinter/board.h
+++ b/board/felwinter/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,12 +24,12 @@
/* LED */
#define CONFIG_LED_ONOFF_STATES
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
-#define GPIO_PWR_LED_WHITE_L GPIO_LED_1_L
-#define GPIO_BAT_LED_AMBER_L GPIO_LED_3_L
-#define GPIO_BAT_LED_WHITE_L GPIO_LED_4_L
+#define GPIO_PWR_LED_WHITE_L GPIO_LED_1_L
+#define GPIO_BAT_LED_AMBER_L GPIO_LED_3_L
+#define GPIO_BAT_LED_WHITE_L GPIO_LED_4_L
/* Sensors */
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -43,19 +43,18 @@
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_LIS2DWL
#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-
/* Sensor console commands */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -63,7 +62,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_PS8815
#define CONFIG_USBC_RETIMER_INTEL_BB
@@ -78,17 +77,17 @@
#define CONFIG_USBC_PPC_NX20P3483
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 65000
-#define PD_MAX_CURRENT_MA 3250
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 65000
+#define PD_MAX_CURRENT_MA 3250
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -96,67 +95,67 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C2_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/*
*
*/
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
@@ -173,19 +172,19 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_KEYBOARD_REFRESH_ROW3
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -203,39 +202,21 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum ioex_port {
- IOEX_C2_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C2_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
-enum battery_type {
- BATTERY_C536,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_C536, BATTERY_TYPE_COUNT };
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void pen_detect_interrupt(enum gpio_signal s);
diff --git a/board/felwinter/build.mk b/board/felwinter/build.mk
index 5a0a20b5e6..848c76f457 100644
--- a/board/felwinter/build.mk
+++ b/board/felwinter/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/felwinter/charger_isl9241.c b/board/felwinter/charger_isl9241.c
index 8bb38754dd..dd2535ea7c 100644
--- a/board/felwinter/charger_isl9241.c
+++ b/board/felwinter/charger_isl9241.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -85,7 +84,6 @@ __overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
charge_ma = (charge_ma * 90) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/felwinter/ec.tasklist b/board/felwinter/ec.tasklist
index 6d995d6b44..29fd0bf4cb 100644
--- a/board/felwinter/ec.tasklist
+++ b/board/felwinter/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/felwinter/fans.c b/board/felwinter/fans.c
index 636364a6de..5f68df09ff 100644
--- a/board/felwinter/fans.c
+++ b/board/felwinter/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/felwinter/fw_config.c b/board/felwinter/fw_config.c
index 4228394d5b..0a4905bc9d 100644
--- a/board/felwinter/fw_config.c
+++ b/board/felwinter/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union brya_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/felwinter/fw_config.h b/board/felwinter/fw_config.h
index 5f5f956b61..2a8a175efd 100644
--- a/board/felwinter/fw_config.h
+++ b/board/felwinter/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,37 +14,28 @@
* Source of truth is the project/brya/felwinter/config.star configuration file.
*/
-enum ec_cfg_usb_db_type {
- DB_USB3_PS8815 = 1,
- DB_USB4_NCT3807 = 2
-};
+enum ec_cfg_usb_db_type { DB_USB3_PS8815 = 1, DB_USB4_NCT3807 = 2 };
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_usb_mb_type {
- MB_USB4_TBT = 0,
- MB_USB3_NON_TBT = 1
-};
+enum ec_cfg_usb_mb_type { MB_USB4_TBT = 0, MB_USB3_NON_TBT = 1 };
-enum ec_cfg_stylus_type {
- STYLUS_ABSENT = 0,
- STYLUS_PRSENT = 1
-};
+enum ec_cfg_stylus_type { STYLUS_ABSENT = 0, STYLUS_PRSENT = 1 };
union brya_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 3;
- uint32_t wifi : 2;
- enum ec_cfg_stylus_type stylus : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t thermal : 2;
- uint32_t table_mode : 1;
- enum ec_cfg_usb_mb_type usb_mb : 3;
- uint32_t reserved_1 : 16;
+ enum ec_cfg_usb_db_type usb_db : 3;
+ uint32_t wifi : 2;
+ enum ec_cfg_stylus_type stylus : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t thermal : 2;
+ uint32_t table_mode : 1;
+ enum ec_cfg_usb_mb_type usb_mb : 3;
+ uint32_t reserved_1 : 16;
};
uint32_t raw_value;
};
diff --git a/board/felwinter/gpio.inc b/board/felwinter/gpio.inc
index 112047c35f..df992a18eb 100644
--- a/board/felwinter/gpio.inc
+++ b/board/felwinter/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/felwinter/i2c.c b/board/felwinter/i2c.c
index a850c12544..b765ccff98 100644
--- a/board/felwinter/i2c.c
+++ b/board/felwinter/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/felwinter/keyboard.c b/board/felwinter/keyboard.c
index a8cbf72238..cee23af8c3 100644
--- a/board/felwinter/keyboard.c
+++ b/board/felwinter/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@ static const struct ec_response_keybd_config felwinter_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &felwinter_kb;
}
diff --git a/board/felwinter/led.c b/board/felwinter/led.c
index 3b7e649470..2770e7fae8 100644
--- a/board/felwinter/led.c
+++ b/board/felwinter/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,35 +11,43 @@
#include "led_onoff_states.h"
#include "system.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
-__override const int led_charge_lvl_2 = 94;
+__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/felwinter/pwm.c b/board/felwinter/pwm.c
index fea431c4ce..97b5c17a03 100644
--- a/board/felwinter/pwm.c
+++ b/board/felwinter/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/felwinter/sensors.c b/board/felwinter/sensors.c
index fd3f721947..6b62f5f4d2 100644
--- a/board/felwinter/sensors.c
+++ b/board/felwinter/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,18 +46,14 @@ K_MUTEX_DEFINE(g_base_accel_mutex);
static struct stprivate_data g_lis2dw12_data;
static struct lsm6dso_data lsm6dso_data;
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* TODO(b/184779743): verify orientation matrix */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -146,24 +142,18 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_2_FAN] = {
- .name = "FAN",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_FAN
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_2_FAN] = { .name = "FAN",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_FAN },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -177,8 +167,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -207,8 +197,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(60), \
[EC_TEMP_THRESH_HALT] = C_TO_K(70), \
@@ -221,8 +211,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
}
__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
diff --git a/board/felwinter/usbc_config.c b/board/felwinter/usbc_config.c
index 3d39650ba8..ebe77bf7c7 100644
--- a/board/felwinter/usbc_config.c
+++ b/board/felwinter/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,8 +33,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
struct tcpc_config_t tcpc_config[] = {
@@ -99,16 +99,22 @@ struct ppc_config_t ppc_chips_c1 = {
};
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc2_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
/*
@@ -116,47 +122,59 @@ static const struct usb_mux usbc1_tcss_usb_mux = {
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
-static const struct usb_mux usb_muxes_c1 = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+static const struct usb_mux_chain usb_muxes_c1 = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
};
-static const struct usb_mux usb_muxes_c2 = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
+static const struct usb_mux_chain usb_muxes_c2 = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc2_tcss_usb_mux,
};
-
/* BC1.2 charger detect configuration */
const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
[USBC_PORT_C2] = {
@@ -254,7 +272,6 @@ void board_reset_pd_mcu(void)
if (ec_cfg_usb_db_type() == DB_USB4_NCT3807)
gpio_set_level(GPIO_USB_C1_RST_ODL, 0);
-
/*
* delay for power-on to reset-off and min. assertion time
*/
@@ -392,10 +409,9 @@ __override bool board_is_dts_port(int port)
__override bool board_is_tbt_usb4_port(int port)
{
- if (((port == USBC_PORT_C2) &&
- (ec_cfg_usb_mb_type() == MB_USB4_TBT)) ||
- ((port == USBC_PORT_C1) &&
- (ec_cfg_usb_db_type() == DB_USB4_NCT3807)))
+ if (((port == USBC_PORT_C2) && (ec_cfg_usb_mb_type() == MB_USB4_TBT)) ||
+ ((port == USBC_PORT_C1) &&
+ (ec_cfg_usb_db_type() == DB_USB4_NCT3807)))
return true;
return false;
diff --git a/board/felwinter/usbc_config.h b/board/felwinter/usbc_config.h
index 9f0a26210f..cab32351f5 100644
--- a/board/felwinter/usbc_config.h
+++ b/board/felwinter/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,15 +8,11 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#define CONFIG_USB_MUX_RUNTIME_CONFIG
-enum usbc_port {
- USBC_PORT_C2 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C2 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
void db_update_usb4_config_from_config(void);
diff --git a/board/fennel/battery.c b/board/fennel/battery.c
index cfd17a136f..882ff0c5a2 100644
--- a/board/fennel/battery.c
+++ b/board/fennel/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fennel/board.c b/board/fennel/board.c
index b9adcad237..563f680dee 100644
--- a/board/fennel/board.c
+++ b/board/fennel/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,6 +33,7 @@
#include "keyboard_scan.h"
#include "keyboard_backlight.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -47,8 +48,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -60,40 +61,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -101,8 +96,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -158,8 +153,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -172,13 +166,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -240,12 +237,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -302,8 +299,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -320,8 +316,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -360,17 +355,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1) }
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
/* Lid accel private data */
@@ -417,20 +408,20 @@ struct motion_sensor_t icm42607_base_accel = {
};
struct motion_sensor_t icm42607_base_gyro = {
- .name = "Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM42607,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm42607_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm42607_data,
- .port = CONFIG_SPI_ACCEL_PORT,
- .i2c_spi_addr_flags = ACCEL_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
- .default_range = 1000, /* dps */
- .rot_standard_ref = NULL,
- .min_frequency = ICM42607_GYRO_MIN_FREQ,
- .max_frequency = ICM42607_GYRO_MAX_FREQ,
+ .name = "Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm42607_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = CONFIG_SPI_ACCEL_PORT,
+ .i2c_spi_addr_flags = ACCEL_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT),
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = NULL,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
};
struct motion_sensor_t motion_sensors[] = {
@@ -522,18 +513,18 @@ static void board_detect_motionsensor(void)
if (base_accelgyro_config != BASE_GYRO_NONE)
return;
/* Check base accelgyro chip */
- ret = icm_read8(&icm42607_base_accel,
- ICM42607_REG_WHO_AM_I, &val);
+ ret = icm_read8(&icm42607_base_accel, ICM42607_REG_WHO_AM_I, &val);
if (ret)
ccprints("Get ICM fail.");
if (val == ICM42607_CHIP_ICM42607P) {
motion_sensors[BASE_ACCEL] = icm42607_base_accel;
motion_sensors[BASE_GYRO] = icm42607_base_gyro;
}
- base_accelgyro_config = (val == ICM42607_CHIP_ICM42607P)
- ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160;
- ccprints("BASE Accelgyro: %s", (val == ICM42607_CHIP_ICM42607P)
- ? "ICM42607" : "BMI160");
+ base_accelgyro_config = (val == ICM42607_CHIP_ICM42607P) ?
+ BASE_GYRO_ICM426XX :
+ BASE_GYRO_BMI160;
+ ccprints("BASE Accelgyro: %s",
+ (val == ICM42607_CHIP_ICM42607P) ? "ICM42607" : "BMI160");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsensor,
HOOK_PRIO_DEFAULT);
@@ -559,7 +550,7 @@ void motion_interrupt(enum gpio_signal signal)
}
const struct it8801_pwm_t it8801_pwm_channels[] = {
- [IT8801_PWM_CH_KBLIGHT] = {.index = 4},
+ [IT8801_PWM_CH_KBLIGHT] = { .index = 4 },
};
void board_kblight_init(void)
@@ -575,11 +566,11 @@ bool board_has_kb_backlight(void)
#endif /* !VARIANT_KUKUI_NO_SENSORS */
/* Battery functions */
-#define SB_SMARTCHARGE 0x26
+#define SB_SMARTCHARGE 0x26
/* Quick charge enable bit */
-#define SMART_QUICK_CHARGE 0x02
+#define SMART_QUICK_CHARGE 0x02
/* Quick charge support bit */
-#define MODE_QUICK_CHARGE_SUPPORT 0x01
+#define MODE_QUICK_CHARGE_SUPPORT 0x01
static void sb_quick_charge_mode(int enable)
{
@@ -650,8 +641,8 @@ int board_get_battery_i2c(void)
}
#ifdef SECTION_IS_RW
-static int it8801_get_target_channel(enum pwm_channel *channel,
- int type, int index)
+static int it8801_get_target_channel(enum pwm_channel *channel, int type,
+ int index)
{
switch (type) {
case EC_PWM_TYPE_GENERIC:
@@ -674,14 +665,13 @@ host_command_pwm_set_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- duty = (uint32_t) p->duty * 255 / 65535;
+ duty = (uint32_t)p->duty * 255 / 65535;
it8801_pwm_set_raw_duty(channel, duty);
it8801_pwm_enable(channel, p->duty > 0);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
- host_command_pwm_set_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY, host_command_pwm_set_duty,
EC_VER_MASK(0));
static enum ec_status
@@ -695,12 +685,11 @@ host_command_pwm_get_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- r->duty = (uint32_t) it8801_pwm_get_raw_duty(channel) * 65535 / 255;
+ r->duty = (uint32_t)it8801_pwm_get_raw_duty(channel) * 65535 / 255;
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY,
- host_command_pwm_get_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY, host_command_pwm_get_duty,
EC_VER_MASK(0));
#endif
diff --git a/board/fennel/board.h b/board/fennel/board.h
index f15e61da11..6bb90ef0f3 100644
--- a/board/fennel/board.h
+++ b/board/fennel/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -52,11 +52,11 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_ICM42607 /* Base accel second source*/
+#define CONFIG_ACCELGYRO_ICM42607 /* Base accel second source*/
#define CONFIG_ACCELGYRO_ICM42607_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
#define CONFIG_ALS
@@ -75,20 +75,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_BATTERY 2
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BATTERY 2
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/fennel/build.mk b/board/fennel/build.mk
index a6e1c010d7..f583684804 100644
--- a/board/fennel/build.mk
+++ b/board/fennel/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/fennel/ec.tasklist b/board/fennel/ec.tasklist
index c1330b86f8..fb131b8eb4 100644
--- a/board/fennel/ec.tasklist
+++ b/board/fennel/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fennel/gpio.inc b/board/fennel/gpio.inc
index 29518fbc4e..5ebecfac53 100644
--- a/board/fennel/gpio.inc
+++ b/board/fennel/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fennel/led.c b/board/fennel/led.c
index 7d95c4807e..e6badd92bc 100644
--- a/board/fennel/led.c
+++ b/board/fennel/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,33 +18,38 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/fizz/board.c b/board/fizz/board.c
index a397ca27e4..f58083c6ed 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,8 +50,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static uint16_t board_version;
static uint8_t oem;
@@ -62,7 +62,7 @@ static void tcpc_alert_event(enum gpio_signal signal)
schedule_deferred_pd_interrupt(0 /* port */);
}
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/*
* ADP_IN pin state. It's initialized to 1 (=unplugged) because the IRQ won't
* be triggered if BJ is the power source.
@@ -125,7 +125,8 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -133,7 +134,7 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_FAN_PWR_EN,
};
@@ -158,47 +159,37 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "eeprom",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "charger",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "pmic",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = NPCX_I2C_PORT3,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "eeprom",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "charger",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "pmic",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -221,21 +212,19 @@ static int ps8751_tune_mux(const struct usb_mux *me)
return EC_SUCCESS;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .board_init = &ps8751_tune_mux,
- }
-};
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .board_init = &ps8751_tune_mux,
+ },
+} };
const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_USB1_ENABLE,
- GPIO_USB2_ENABLE,
- GPIO_USB3_ENABLE,
- GPIO_USB4_ENABLE,
- GPIO_USB5_ENABLE,
+ GPIO_USB1_ENABLE, GPIO_USB2_ENABLE, GPIO_USB3_ENABLE,
+ GPIO_USB4_ENABLE, GPIO_USB5_ENABLE,
};
void board_reset_pd_mcu(void)
@@ -270,9 +259,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
@@ -294,10 +283,10 @@ uint16_t tcpc_get_alert_status(void)
* src/mainboard/google/${board}/acpi/dptf.asl
*/
const struct temp_sensor_t temp_sensors[] = {
- {"TMP431_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL},
- {"TMP431_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1},
+ { "TMP431_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL },
+ { "TMP431_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -310,9 +299,11 @@ struct ec_thermal_config thermal_params[] = {
* {Twarn, Thigh, X }, <off>
* fan_off, fan_max
*/
- {{0, C_TO_K(80), C_TO_K(81)}, {0, C_TO_K(78), 0},
- C_TO_K(4), C_TO_K(76)}, /* TMP431_Internal */
- {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* TMP431_Sensor_1 */
+ { { 0, C_TO_K(80), C_TO_K(81) },
+ { 0, C_TO_K(78), 0 },
+ C_TO_K(4),
+ C_TO_K(76) }, /* TMP431_Internal */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* TMP431_Sensor_1 */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
@@ -521,8 +512,8 @@ static void set_charge_limit(int charge_ma)
}
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int p87w = 0, p65w = 0, p60w = 0;
@@ -533,7 +524,7 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
* is called.
*/
led_alert(charge_ma * charge_mv <
- CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000);
+ CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000);
/*
* In terms of timing, this should always work because
@@ -580,11 +571,11 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
} else {
/*
* TODO:http://crosbug.com/p/65013352.
- * The current monitoring system doesn't support lower
- * current. These currents are most likely not enough to
- * power the system. However, if they're needed, EC can
- * monitor PMON_PSYS and trigger H_PROCHOT by itself.
- */
+ * The current monitoring system doesn't support lower
+ * current. These currents are most likely not enough to
+ * power the system. However, if they're needed, EC can
+ * monitor PMON_PSYS and trigger H_PROCHOT by itself.
+ */
p60w = 1;
CPRINTS("Current %dmA not supported", charge_ma);
}
@@ -602,9 +593,9 @@ int64_t get_time_dsw_pwrok(void)
}
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 100 },
[PWM_CH_LED_GREEN] = { 5, PWM_CONFIG_DSLEEP, 100 },
- [PWM_CH_FAN] = {4, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 4, PWM_CONFIG_OPEN_DRAIN, 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -618,44 +609,44 @@ static const struct fan_step *fan_table;
/* Note: Do not make the fan on/off point equal to 0 or 100 */
static const struct fan_step fan_table0[] = {
- {.on = 0, .off = 1, .rpm = 0},
- {.on = 36, .off = 1, .rpm = 2800},
- {.on = 58, .off = 58, .rpm = 3200},
- {.on = 66, .off = 61, .rpm = 3400},
- {.on = 75, .off = 69, .rpm = 4200},
- {.on = 81, .off = 76, .rpm = 4800},
- {.on = 88, .off = 83, .rpm = 5200},
- {.on = 98, .off = 91, .rpm = 5600},
+ { .on = 0, .off = 1, .rpm = 0 },
+ { .on = 36, .off = 1, .rpm = 2800 },
+ { .on = 58, .off = 58, .rpm = 3200 },
+ { .on = 66, .off = 61, .rpm = 3400 },
+ { .on = 75, .off = 69, .rpm = 4200 },
+ { .on = 81, .off = 76, .rpm = 4800 },
+ { .on = 88, .off = 83, .rpm = 5200 },
+ { .on = 98, .off = 91, .rpm = 5600 },
};
static const struct fan_step fan_table1[] = {
- {.on = 0, .off = 1, .rpm = 0},
- {.on = 36, .off = 1, .rpm = 2800},
- {.on = 62, .off = 58, .rpm = 3200},
- {.on = 68, .off = 63, .rpm = 3400},
- {.on = 75, .off = 69, .rpm = 4200},
- {.on = 81, .off = 76, .rpm = 4800},
- {.on = 88, .off = 83, .rpm = 5200},
- {.on = 98, .off = 91, .rpm = 5600},
+ { .on = 0, .off = 1, .rpm = 0 },
+ { .on = 36, .off = 1, .rpm = 2800 },
+ { .on = 62, .off = 58, .rpm = 3200 },
+ { .on = 68, .off = 63, .rpm = 3400 },
+ { .on = 75, .off = 69, .rpm = 4200 },
+ { .on = 81, .off = 76, .rpm = 4800 },
+ { .on = 88, .off = 83, .rpm = 5200 },
+ { .on = 98, .off = 91, .rpm = 5600 },
};
static const struct fan_step fan_table2[] = {
- {.on = 0, .off = 1, .rpm = 0},
- {.on = 36, .off = 1, .rpm = 2200},
- {.on = 63, .off = 56, .rpm = 2900},
- {.on = 69, .off = 65, .rpm = 3000},
- {.on = 75, .off = 70, .rpm = 3300},
- {.on = 80, .off = 76, .rpm = 3600},
- {.on = 87, .off = 81, .rpm = 3900},
- {.on = 98, .off = 91, .rpm = 5000},
+ { .on = 0, .off = 1, .rpm = 0 },
+ { .on = 36, .off = 1, .rpm = 2200 },
+ { .on = 63, .off = 56, .rpm = 2900 },
+ { .on = 69, .off = 65, .rpm = 3000 },
+ { .on = 75, .off = 70, .rpm = 3300 },
+ { .on = 80, .off = 76, .rpm = 3600 },
+ { .on = 87, .off = 81, .rpm = 3900 },
+ { .on = 98, .off = 91, .rpm = 5000 },
};
static const struct fan_step fan_table3[] = {
- {.on = 0, .off = 1, .rpm = 0},
- {.on = 36, .off = 22, .rpm = 2500},
- {.on = 54, .off = 49, .rpm = 3200},
- {.on = 61, .off = 56, .rpm = 3500},
- {.on = 68, .off = 63, .rpm = 3900},
- {.on = 75, .off = 69, .rpm = 4500},
- {.on = 82, .off = 76, .rpm = 5100},
- {.on = 92, .off = 85, .rpm = 5400},
+ { .on = 0, .off = 1, .rpm = 0 },
+ { .on = 36, .off = 22, .rpm = 2500 },
+ { .on = 54, .off = 49, .rpm = 3200 },
+ { .on = 61, .off = 56, .rpm = 3500 },
+ { .on = 68, .off = 63, .rpm = 3900 },
+ { .on = 75, .off = 69, .rpm = 4500 },
+ { .on = 82, .off = 76, .rpm = 5100 },
+ { .on = 92, .off = 85, .rpm = 5400 },
};
/* All fan tables must have the same number of levels */
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table0)
@@ -748,8 +739,8 @@ static void setup_bj(void)
switch (oem) {
case OEM_KENCH:
- bj = (BJ_ADAPTER_90W_MASK & BIT(sku)) ?
- BJ_90W_19P5V : BJ_65W_19P5V;
+ bj = (BJ_ADAPTER_90W_MASK & BIT(sku)) ? BJ_90W_19P5V :
+ BJ_65W_19P5V;
break;
case OEM_TEEMO:
case OEM_BLEEMO:
@@ -758,15 +749,14 @@ static void setup_bj(void)
case OEM_WUKONG_A:
case OEM_WUKONG_M:
case OEM_EXCELSIOR:
- bj = (BJ_ADAPTER_90W_MASK & BIT(sku)) ?
- BJ_90W_19V : BJ_65W_19V;
+ bj = (BJ_ADAPTER_90W_MASK & BIT(sku)) ? BJ_90W_19V : BJ_65W_19V;
break;
case OEM_JAX:
bj = BJ_65W_19V;
break;
default:
- bj = (BJ_ADAPTER_90W_MASK & BIT(sku)) ?
- BJ_90W_19P5V : BJ_65W_19P5V;
+ bj = (BJ_ADAPTER_90W_MASK & BIT(sku)) ? BJ_90W_19P5V :
+ BJ_65W_19P5V;
break;
}
@@ -795,8 +785,8 @@ static void board_charge_manager_init(void)
charge_manager_update_charge(j, i, NULL);
}
- port = gpio_get_level(GPIO_ADP_IN_L) ?
- CHARGE_PORT_TYPEC0 : CHARGE_PORT_BARRELJACK;
+ port = gpio_get_level(GPIO_ADP_IN_L) ? CHARGE_PORT_TYPEC0 :
+ CHARGE_PORT_BARRELJACK;
CPRINTS("Power source is p%d (%s)", port,
port == CHARGE_PORT_TYPEC0 ? "USB-C" : "BJ");
@@ -855,8 +845,7 @@ int fan_percent_to_rpm(int fan, int pct)
previous_pct = pct;
- if (fan_table[current_level].rpm !=
- fan_get_rpm_target(FAN_CH(fan)))
+ if (fan_table[current_level].rpm != fan_get_rpm_target(FAN_CH(fan)))
cprints(CC_THERMAL, "Setting fan RPM to %d",
fan_table[current_level].rpm);
diff --git a/board/fizz/board.h b/board/fizz/board.h
index ad1ca85cac..a1499f6105 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* Allow dangerous commands.
* TODO: Remove this config before production.
*/
-#undef CONFIG_SYSTEM_UNLOCKED
+#undef CONFIG_SYSTEM_UNLOCKED
#define CONFIG_USB_PD_COMM_LOCKED
/* EC */
@@ -32,7 +32,7 @@
#define CONFIG_FPU
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_POWER_BUTTON_IGNORE_LID
#define CONFIG_PWM
#define CONFIG_LTO
@@ -47,7 +47,7 @@
#define WIRELESS_GPIO_WLAN_POWER GPIO_PP3300_DX_WLAN
#define WIRELESS_GPIO_WWAN GPIO_PP3300_DX_LTE
#define CEC_GPIO_OUT GPIO_CEC_OUT
-#define CEC_GPIO_IN GPIO_CEC_IN
+#define CEC_GPIO_IN GPIO_CEC_IN
#define CEC_GPIO_PULL_UP GPIO_CEC_PULL_UP
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
@@ -63,7 +63,7 @@
#undef CONFIG_CMD_ADC
/* Reduce flash space usage */
-#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CONSOLE_CMDHELP
/* SOC */
#define CONFIG_CHIPSET_SKYLAKE
@@ -71,8 +71,8 @@
#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* Charger */
@@ -82,7 +82,7 @@
#define CONFIG_HOSTCMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
@@ -96,7 +96,7 @@
#define CONFIG_TEMP_SENSOR_TMP432
/* USB */
-#undef CONFIG_USB_CHARGER /* dnojiri: verify */
+#undef CONFIG_USB_CHARGER /* dnojiri: verify */
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_CUSTOM_PDO
@@ -119,7 +119,7 @@
#define CONFIG_USBC_VCONN_SWAP
/* Charge ports */
-#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
#define DEDICATED_CHARGE_PORT 1
@@ -128,21 +128,21 @@
#define USB_PORT_COUNT 5
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT0_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_THERMAL NPCX_I2C_PORT3
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT0_1
+#define I2C_PORT_BATTERY NPCX_I2C_PORT1
+#define I2C_PORT_CHARGER NPCX_I2C_PORT1
+#define I2C_PORT_PMIC NPCX_I2C_PORT2
+#define I2C_PORT_THERMAL NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_TCPC0_FLAGS 0x0b
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_TCPC0_FLAGS 0x0b
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Verify and jump to RW image on boot */
#define CONFIG_VBOOT_EFS
@@ -159,18 +159,17 @@
* end of RW_A and RW_B, respectively.
*/
#define CONFIG_RW_B
-#define CONFIG_RW_B_MEM_OFF CONFIG_RO_MEM_OFF
-#undef CONFIG_RO_SIZE
-#define CONFIG_RO_SIZE (CONFIG_FLASH_SIZE_BYTES / 4)
-#undef CONFIG_RW_SIZE
-#define CONFIG_RW_SIZE CONFIG_RO_SIZE
-#define CONFIG_RW_A_STORAGE_OFF CONFIG_RW_STORAGE_OFF
-#define CONFIG_RW_B_STORAGE_OFF (CONFIG_RW_A_STORAGE_OFF + \
- CONFIG_RW_SIZE)
-#define CONFIG_RW_A_SIGN_STORAGE_OFF (CONFIG_RW_A_STORAGE_OFF + \
- CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE)
-#define CONFIG_RW_B_SIGN_STORAGE_OFF (CONFIG_RW_B_STORAGE_OFF + \
- CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE)
+#define CONFIG_RW_B_MEM_OFF CONFIG_RO_MEM_OFF
+#undef CONFIG_RO_SIZE
+#define CONFIG_RO_SIZE (CONFIG_FLASH_SIZE_BYTES / 4)
+#undef CONFIG_RW_SIZE
+#define CONFIG_RW_SIZE CONFIG_RO_SIZE
+#define CONFIG_RW_A_STORAGE_OFF CONFIG_RW_STORAGE_OFF
+#define CONFIG_RW_B_STORAGE_OFF (CONFIG_RW_A_STORAGE_OFF + CONFIG_RW_SIZE)
+#define CONFIG_RW_A_SIGN_STORAGE_OFF \
+ (CONFIG_RW_A_STORAGE_OFF + CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE)
+#define CONFIG_RW_B_SIGN_STORAGE_OFF \
+ (CONFIG_RW_B_STORAGE_OFF + CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE)
#define CONFIG_RWSIG
#define CONFIG_RWSIG_TYPE_RWSIG
@@ -196,15 +195,12 @@ enum charge_port {
};
enum temp_sensor_id {
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
TEMP_SENSOR_COUNT
};
-enum adc_channel {
- ADC_VBUS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_CH_COUNT };
enum pwm_channel {
PWM_CH_LED_RED,
@@ -245,17 +241,17 @@ enum OEM_ID {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power. Since Fizz doesn't have a battery to charge,
* we're not interested in any power lower than the AP power-on threshold. */
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
void board_reset_pd_mcu(void);
diff --git a/board/fizz/build.mk b/board/fizz/build.mk
index febbb7fac2..b07b1b4cf3 100644
--- a/board/fizz/build.mk
+++ b/board/fizz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/fizz/ec.tasklist b/board/fizz/ec.tasklist
index 75a09a43df..6212516e6a 100644
--- a/board/fizz/ec.tasklist
+++ b/board/fizz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fizz/gpio.inc b/board/fizz/gpio.inc
index 7da0bfce71..2eee02bfd3 100644
--- a/board/fizz/gpio.inc
+++ b/board/fizz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,10 +13,10 @@ GPIO_INT(AC_PRESENT, PIN(C, 1), GPIO_INT_BOTH, extpower_interrupt)
GPIO_INT(POWER_BUTTON_L, PIN(0, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt) /* MECH_PWR_BTN_ODL */
GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/fizz/led.c b/board/fizz/led.c
index 9b6942d241..acd0eb5918 100644
--- a/board/fizz/led.c
+++ b/board/fizz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -15,7 +15,7 @@
#include "timer.h"
#include "util.h"
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -76,9 +76,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -181,7 +181,7 @@ void led_critical(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
diff --git a/board/fizz/usb_pd_pdo.c b/board/fizz/usb_pd_pdo.c
index bb612affef..edcc43f15a 100644
--- a/board/fizz/usb_pd_pdo.c
+++ b/board/fizz/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -7,8 +7,8 @@
#include "usb_pd.h"
#include "usb_pd_pdo.h"
-#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\
- PDO_FIXED_COMM_CAP)
+#define PDO_FIXED_FLAGS \
+ (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP)
const uint32_t pd_src_pdo[] = {
PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
diff --git a/board/fizz/usb_pd_pdo.h b/board/fizz/usb_pd_pdo.h
index de4f8f9474..97ee437a3f 100644
--- a/board/fizz/usb_pd_pdo.h
+++ b/board/fizz/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fizz/usb_pd_policy.c b/board/fizz/usb_pd_policy.c
index 5fc495417f..b3b1ee5971 100644
--- a/board/fizz/usb_pd_policy.c
+++ b/board/fizz/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,8 +23,8 @@
#include "usb_pd_pdo.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int board_vbus_source_enabled(int port)
{
diff --git a/board/fleex/battery.c b/board/fleex/battery.c
index 57a5246052..e5efb19920 100644
--- a/board/fleex/battery.c
+++ b/board/fleex/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 4464d45730..063222fbe3 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,11 +42,11 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
static int is_support_syv_ppc;
@@ -74,11 +74,9 @@ static void board_update_ppc_config_from_board(void)
if (!is_support_syv_ppc)
return;
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_0],
- &ppc_syv682x_port0,
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], &ppc_syv682x_port0,
sizeof(struct ppc_config_t));
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_1],
- &ppc_syv682x_port1,
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], &ppc_syv682x_port1,
sizeof(struct ppc_config_t));
gpio_set_flags(GPIO_USB_PD_C0_INT_ODL, GPIO_INT_BOTH);
@@ -112,28 +110,30 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C0] = {"VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {"VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -143,17 +143,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
- const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
- };
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct stprivate_data g_lis2dh_data;
@@ -242,8 +238,8 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
static int board_is_convertible(void)
{
- return sku_id == 0x21 || sku_id == 0x22 || sku_id == 0x23
- || sku_id == 0xff;
+ return sku_id == 0x21 || sku_id == 0x22 || sku_id == 0x23 ||
+ sku_id == 0xff;
}
static void board_update_sensor_config_from_sku(void)
@@ -300,9 +296,10 @@ void board_overcurrent_event(int port, int is_overcurrented)
static void charger_set_buck_boost_mode(void)
{
int reg;
- /* Reduce Buck-boost mode switching frequency to improve power efficiency. */
+ /* Reduce Buck-boost mode switching frequency to improve power
+ * efficiency. */
if (i2c_read16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
- ISL9238_REG_CONTROL3, &reg) == EC_SUCCESS) {
+ ISL9238_REG_CONTROL3, &reg) == EC_SUCCESS) {
reg |= ISL9238_C3_BB_SWITCHING_PERIOD;
if (i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
ISL9238_REG_CONTROL3, reg))
diff --git a/board/fleex/board.h b/board/fleex/board.h
index b097685449..3095fad271 100644
--- a/board/fleex/board.h
+++ b/board/fleex/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,8 +33,8 @@
#define CONFIG_USB_PD_RESET_MIN_BATT_SOC 2
/* Sensors */
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
@@ -80,10 +80,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -94,18 +94,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/fleex/build.mk b/board/fleex/build.mk
index 7e806f4667..0eab0adc21 100644
--- a/board/fleex/build.mk
+++ b/board/fleex/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/fleex/ec.tasklist b/board/fleex/ec.tasklist
index d98db145e7..977b8b01be 100644
--- a/board/fleex/ec.tasklist
+++ b/board/fleex/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fleex/gpio.inc b/board/fleex/gpio.inc
index efedd6989b..0b74f8fa76 100644
--- a/board/fleex/gpio.inc
+++ b/board/fleex/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fleex/led.c b/board/fleex/led.c
index bf3fd6ccec..4ba3c18457 100644
--- a/board/fleex/led.c
+++ b/board/fleex/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 10;
@@ -19,23 +19,32 @@ __override const int led_charge_lvl_2 = 100;
/* Fleex: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/fleex/usb_pd_policy.c b/board/fleex/usb_pd_policy.c
index 82922f9a4d..bfcf4484e4 100644
--- a/board/fleex/usb_pd_policy.c
+++ b/board/fleex/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fluffy/board.c b/board/fluffy/board.c
index 874195404b..90de54a761 100644
--- a/board/fluffy/board.c
+++ b/board/fluffy/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,20 +19,20 @@
#include "gpio_list.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/******************************************************************************
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Fluffy"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Fluffy"),
/* This gets filled in at runtime. */
- [USB_STR_SERIALNO] = USB_STRING_DESC(""),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_SERIALNO] = USB_STRING_DESC(""),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Fluffy Shell"),
};
@@ -77,7 +77,7 @@ static void print_port_status(void)
CPRINTS("USB MUX: %s", gpio_get_level(GPIO_EN_USB_MUX2) ? "ON" : "OFF");
}
-static int command_cc_flip(int argc, char *argv[])
+static int command_cc_flip(int argc, const char *argv[])
{
int enable;
@@ -106,20 +106,19 @@ static int command_cc_flip(int argc, char *argv[])
print_port_status();
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(ccflip, command_cc_flip,
- "<enable/disable>",
+DECLARE_CONSOLE_COMMAND(ccflip, command_cc_flip, "<enable/disable>",
"enable or disable flipping CC orientation");
/*
* Support tca6416 I2C ioexpander.
*/
-#define GPIOX_I2C_ADDR_FLAGS 0x20
-#define GPIOX_IN_PORT_A 0x0
-#define GPIOX_IN_PORT_B 0x1
-#define GPIOX_OUT_PORT_A 0x2
-#define GPIOX_OUT_PORT_B 0x3
-#define GPIOX_DIR_PORT_A 0x6
-#define GPIOX_DIR_PORT_B 0x7
-#define I2C_PORT_MASTER 1
+#define GPIOX_I2C_ADDR_FLAGS 0x20
+#define GPIOX_IN_PORT_A 0x0
+#define GPIOX_IN_PORT_B 0x1
+#define GPIOX_OUT_PORT_A 0x2
+#define GPIOX_OUT_PORT_B 0x3
+#define GPIOX_DIR_PORT_A 0x6
+#define GPIOX_DIR_PORT_B 0x7
+#define I2C_PORT_MASTER 1
static void i2c_expander_init(void)
{
@@ -128,12 +127,12 @@ static void i2c_expander_init(void)
/*
* Setup P00, P02, P04, P10, and P12 on the I/O expander as an output.
*/
- i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
- GPIOX_DIR_PORT_A, 0xea);
- i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
- GPIOX_DIR_PORT_B, 0xfa);
+ i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS, GPIOX_DIR_PORT_A,
+ 0xea);
+ i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS, GPIOX_DIR_PORT_B,
+ 0xfa);
}
-DECLARE_HOOK(HOOK_INIT, i2c_expander_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, i2c_expander_init, HOOK_PRIO_INIT_I2C + 1);
/* Write to a GPIO register on the tca6416 I2C ioexpander. */
static void write_ioexpander(int bank, int gpio, int reg, int val)
@@ -141,15 +140,13 @@ static void write_ioexpander(int bank, int gpio, int reg, int val)
int tmp;
/* Read output port register */
- i2c_read8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
- reg + bank, &tmp);
+ i2c_read8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS, reg + bank, &tmp);
if (val)
tmp |= BIT(gpio);
else
tmp &= ~BIT(gpio);
/* Write back modified output port register */
- i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS,
- reg + bank, tmp);
+ i2c_write8(I2C_PORT_MASTER, GPIOX_I2C_ADDR_FLAGS, reg + bank, tmp);
}
enum led_ch {
@@ -227,7 +224,6 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
enum usb_mux {
USB_MUX0 = 0,
USB_MUX1,
@@ -272,7 +268,7 @@ static void set_mux(enum usb_mux mux, uint8_t val)
}
/* This function assumes only 1 port works at a time. */
-static int command_portctl(int argc, char **argv)
+static int command_portctl(int argc, const char **argv)
{
int port;
int enable;
@@ -293,7 +289,7 @@ static int command_portctl(int argc, char **argv)
gpio_set_level(enabled_port, 0);
if (enabled_port != GPIO_EN_C0 + port)
- CPRINTS("Port %d: disabled", enabled_port-GPIO_EN_C0);
+ CPRINTS("Port %d: disabled", enabled_port - GPIO_EN_C0);
/* Allow time for an "unplug" to allow VBUS and CC to fall. */
usleep(1 * SECOND);
@@ -309,17 +305,17 @@ static int command_portctl(int argc, char **argv)
gpio_set_level(enabled_port, 1);
if (port < 8) {
- set_mux(USB_MUX0, 7-port);
+ set_mux(USB_MUX0, 7 - port);
set_mux(USB_MUX2, 3);
} else if (port < 16) {
if (port < 14)
- set_mux(USB_MUX1, 5-(port-8));
+ set_mux(USB_MUX1, 5 - (port - 8));
else
- set_mux(USB_MUX1, 7-(port-14));
+ set_mux(USB_MUX1, 7 - (port - 14));
set_mux(USB_MUX2, 1);
} else {
- set_mux(USB_MUX2, 7-(port-16));
+ set_mux(USB_MUX2, 7 - (port - 16));
}
gpio_set_level(GPIO_EN_USB_MUX2, 1);
@@ -337,11 +333,11 @@ DECLARE_CONSOLE_COMMAND(portctl, command_portctl,
"<port# 0-19> <enable/disable>",
"enable or disable a port");
-static int command_status(int argc, char **argv)
+static int command_status(int argc, const char **argv)
{
int vbus_mv = adc_read_channel(ADC_PPVAR_VBUS_DUT);
- CPRINTS("PPVAR_VBUS_DUT: %dmV (raw: %d)", vbus_mv*7692/1000,
+ CPRINTS("PPVAR_VBUS_DUT: %dmV (raw: %d)", vbus_mv * 7692 / 1000,
vbus_mv);
print_port_status();
@@ -388,7 +384,8 @@ void show_output_voltage_on_leds(void)
set_led(i, i < max_on_exclusive);
act = (vbus_mv * 76667) / 10000;
- if ((vbus_mv > prev_vbus_mv+2) || (vbus_mv < prev_vbus_mv-2)) {
+ if ((vbus_mv > prev_vbus_mv + 2) ||
+ (vbus_mv < prev_vbus_mv - 2)) {
CPRINTS("PPVAR_VBUS_DUT: %d mV (raw: %d)", act,
vbus_mv);
prev_vbus_mv = vbus_mv;
@@ -400,6 +397,5 @@ void show_output_voltage_on_leds(void)
* a hook with a HOOK_TICK period is to allow the LED sweep sequence
* when the board boots up.
*/
- hook_call_deferred(&show_output_voltage_on_leds_data,
- 500 * MSEC);
+ hook_call_deferred(&show_output_voltage_on_leds_data, 500 * MSEC);
}
diff --git a/board/fluffy/board.h b/board/fluffy/board.h
index 75e9843b83..1309c41901 100644
--- a/board/fluffy/board.h
+++ b/board/fluffy/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,13 +29,13 @@
#define DEFAULT_SERIALNO "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_COUNT 1
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_COUNT 1
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_COUNT 2
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_COUNT 2
/* Optional features */
#define CONFIG_STM_HWTIMER32
@@ -48,7 +48,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
diff --git a/board/fluffy/build.mk b/board/fluffy/build.mk
index b6761a4692..82aa7522d0 100644
--- a/board/fluffy/build.mk
+++ b/board/fluffy/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -10,9 +10,4 @@ CHIP:=stm32
CHIP_FAMILY:=stm32f0
CHIP_VARIANT:=stm32f07x
-# Use coreboot-sdk
-$(call set-option,CROSS_COMPILE_arm,\
- $(CROSS_COMPILE_coreboot_sdk_arm),\
- /opt/coreboot-sdk/bin/arm-eabi-)
-
board-y=board.o
diff --git a/board/fluffy/ec.tasklist b/board/fluffy/ec.tasklist
index c732944a23..9c45739414 100644
--- a/board/fluffy/ec.tasklist
+++ b/board/fluffy/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fluffy/gpio.inc b/board/fluffy/gpio.inc
index 4c802554f9..532422ae5b 100644
--- a/board/fluffy/gpio.inc
+++ b/board/fluffy/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/foob/battery.c b/board/foob/battery.c
index 01a6654920..fe5692eec2 100644
--- a/board/foob/battery.c
+++ b/board/foob/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/foob/board.c b/board/foob/board.c
index 91d66d88d7..c9bf0934ad 100644
--- a/board/foob/board.c
+++ b/board/foob/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,11 +31,11 @@
#include "util.h"
#include "battery_smart.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -60,31 +60,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -94,11 +94,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate lid and base sensor into standard reference frame */
-const mat33_fp_t standard_rot_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t standard_rot_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct stprivate_data g_lis2dh_data;
@@ -238,11 +236,11 @@ int board_is_lid_angle_tablet_mode(void)
}
/* Battery functions */
-#define SB_OPTIONALMFG_FUNCTION2 0x3e
+#define SB_OPTIONALMFG_FUNCTION2 0x3e
/* Optional mfg function2 */
-#define SMART_QUICK_CHARGE (1<<12)
+#define SMART_QUICK_CHARGE (1 << 12)
/* Quick charge support */
-#define MODE_QUICK_CHARGE_SUPPORT (1<<4)
+#define MODE_QUICK_CHARGE_SUPPORT (1 << 4)
static void sb_quick_charge_mode(int enable)
{
diff --git a/board/foob/board.h b/board/foob/board.h
index 07637c3373..f6d0f20607 100644
--- a/board/foob/board.h
+++ b/board/foob/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,8 +30,8 @@
#define CONFIG_CMD_ACCEL_INFO
/* Sensors */
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -50,10 +50,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT,
};
@@ -64,18 +64,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/foob/build.mk b/board/foob/build.mk
index 137e208b53..fee77e38b5 100644
--- a/board/foob/build.mk
+++ b/board/foob/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/foob/ec.tasklist b/board/foob/ec.tasklist
index 6eac78a042..6c56976091 100644
--- a/board/foob/ec.tasklist
+++ b/board/foob/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/foob/gpio.inc b/board/foob/gpio.inc
index ad6773a211..3a553f6e91 100644
--- a/board/foob/gpio.inc
+++ b/board/foob/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/foob/led.c b/board/foob/led.c
index bb7764dadd..b8cdc4c252 100644
--- a/board/foob/led.c
+++ b/board/foob/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,32 +19,35 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/fusb307bgevb/board.c b/board/fusb307bgevb/board.c
index f3f4da1a74..1388aef49a 100644
--- a/board/fusb307bgevb/board.c
+++ b/board/fusb307bgevb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,8 +24,8 @@
#include "usb_common.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -72,10 +72,13 @@ static void button_refresh_event_deferred(void)
/* Display supply voltage on first page. */
lcd_clear();
for (i = 0; i < MIN(pd_get_src_cap_cnt(0), 4); i++) {
+ int rv;
pd_extract_pdo_power(pd_get_src_caps(0)[i], &ma, &mv, &unused);
- snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma);
- lcd_set_cursor(0, i);
- lcd_print_string(c);
+ rv = snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma);
+ if (rv > 0) {
+ lcd_set_cursor(0, i);
+ lcd_print_string(c);
+ }
}
/* Display selector */
@@ -107,21 +110,29 @@ static void button_down_event_deferred(void)
if (count == 0) {
lcd_clear();
for (i = 0; i < MIN(pd_get_src_cap_cnt(0), 4); i++) {
+ int rv;
pd_extract_pdo_power(pd_get_src_caps(0)[i], &ma, &mv,
&unused);
- snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma);
- lcd_set_cursor(0, i);
- lcd_print_string(c);
+ rv = snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv,
+ ma);
+ if (rv > 0) {
+ lcd_set_cursor(0, i);
+ lcd_print_string(c);
+ }
}
}
if (count == 4) {
lcd_clear();
for (i = 4; i < pd_get_src_cap_cnt(0); i++) {
+ int rv;
pd_extract_pdo_power(pd_get_src_caps(0)[i], &ma, &mv,
&unused);
- snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv, ma);
- lcd_set_cursor(0, i - 4);
- lcd_print_string(c);
+ rv = snprintf(c, ARRAY_SIZE(c), "[%d] %dmV %dmA", i, mv,
+ ma);
+ if (rv > 0) {
+ lcd_set_cursor(0, i - 4);
+ lcd_print_string(c);
+ }
}
}
@@ -156,20 +167,15 @@ static enum gpio_signal const usb_gpio_list[] = {
* This instantiates struct usb_gpio_config const usb_gpio, plus several other
* variables, all named something beginning with usb_gpio_
*/
-USB_GPIO_CONFIG(usb_gpio,
- usb_gpio_list,
- USB_IFACE_GPIO,
- USB_EP_GPIO);
+USB_GPIO_CONFIG(usb_gpio, usb_gpio_list, USB_IFACE_GPIO, USB_EP_GPIO);
/******************************************************************************
* Setup USART1 as a loopback device, it just echo's back anything sent to it.
*/
static struct usart_config const loopback_usart;
-static struct queue const loopback_queue =
- QUEUE_DIRECT(64, uint8_t,
- loopback_usart.producer,
- loopback_usart.consumer);
+static struct queue const loopback_queue = QUEUE_DIRECT(
+ 64, uint8_t, loopback_usart.producer, loopback_usart.consumer);
static struct usart_rx_dma const loopback_rx_dma =
USART_RX_DMA(STM32_DMAC_CH3, 8);
@@ -177,14 +183,9 @@ static struct usart_rx_dma const loopback_rx_dma =
static struct usart_tx_dma const loopback_tx_dma =
USART_TX_DMA(STM32_DMAC_CH2, 16);
-static struct usart_config const loopback_usart =
- USART_CONFIG(usart1_hw,
- loopback_rx_dma.usart_rx,
- loopback_tx_dma.usart_tx,
- 115200,
- 0,
- loopback_queue,
- loopback_queue);
+static struct usart_config const loopback_usart = USART_CONFIG(
+ usart1_hw, loopback_rx_dma.usart_rx, loopback_tx_dma.usart_tx, 115200,
+ 0, loopback_queue, loopback_queue);
/******************************************************************************
* Forward USART4 as a simple USB serial interface.
@@ -192,46 +193,34 @@ static struct usart_config const loopback_usart =
static struct usart_config const forward_usart;
struct usb_stream_config const forward_usb;
-static struct queue const usart_to_usb = QUEUE_DIRECT(64, uint8_t,
- forward_usart.producer,
- forward_usb.consumer);
-static struct queue const usb_to_usart = QUEUE_DIRECT(64, uint8_t,
- forward_usb.producer,
- forward_usart.consumer);
+static struct queue const usart_to_usb =
+ QUEUE_DIRECT(64, uint8_t, forward_usart.producer, forward_usb.consumer);
+static struct queue const usb_to_usart =
+ QUEUE_DIRECT(64, uint8_t, forward_usb.producer, forward_usart.consumer);
static struct usart_tx_dma const forward_tx_dma =
USART_TX_DMA(STM32_DMAC_CH7, 16);
static struct usart_config const forward_usart =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- forward_tx_dma.usart_tx,
- 115200,
- 0,
- usart_to_usb,
- usb_to_usart);
-
-#define USB_STREAM_RX_SIZE 16
-#define USB_STREAM_TX_SIZE 16
-
-USB_STREAM_CONFIG(forward_usb,
- USB_IFACE_STREAM,
- USB_STR_STREAM_NAME,
- USB_EP_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart,
- usart_to_usb)
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, forward_tx_dma.usart_tx,
+ 115200, 0, usart_to_usb, usb_to_usart);
+
+#define USB_STREAM_RX_SIZE 16
+#define USB_STREAM_TX_SIZE 16
+
+USB_STREAM_CONFIG(forward_usb, USB_IFACE_STREAM, USB_STR_STREAM_NAME,
+ USB_EP_STREAM, USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart, usart_to_usb)
/******************************************************************************
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("fusb307bgevb"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_STREAM_NAME] = USB_STRING_DESC("Forward"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("fusb307bgevb"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_STREAM_NAME] = USB_STRING_DESC("Forward"),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"),
};
@@ -240,15 +229,11 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
/******************************************************************************
* I2C interface.
*/
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc",
- .port = I2C_PORT_TCPC,
- .kbps = 400 /* kHz */,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- }
-};
+const struct i2c_port_t i2c_ports[] = { { .name = "tcpc",
+ .port = I2C_PORT_TCPC,
+ .kbps = 400 /* kHz */,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA } };
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/******************************************************************************
@@ -265,7 +250,6 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-
uint16_t tcpc_get_alert_status(void)
{
uint16_t status = 0;
@@ -329,6 +313,5 @@ static void board_init(void)
queue_init(&usb_to_usart);
usart_init(&loopback_usart);
usart_init(&forward_usart);
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/fusb307bgevb/board.h b/board/fusb307bgevb/board.h
index 3495f7125f..5e45b346b7 100644
--- a/board/fusb307bgevb/board.h
+++ b/board/fusb307bgevb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,6 +8,7 @@
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
+#define CONFIG_LTO
/* 48 MHz SYSCLK clock frequency */
#define CPU_CLOCK 48000000
@@ -56,11 +57,11 @@
#define PD_OPERATING_POWER_MW 15000
#define PD_MAX_VOLTAGE_MV 20000
#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
/* Degine board specific type-C power constants */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 160000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 160000 /* us */
/* I2C master port connected to the TCPC */
#define I2C_PORT_TCPC 1
@@ -69,23 +70,24 @@
#define LCD_SLAVE_ADDR 0x27
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_STREAM 0
-#define USB_IFACE_GPIO 1
-#define USB_IFACE_SPI 2
+#define USB_IFACE_STREAM 0
+#define USB_IFACE_GPIO 1
+#define USB_IFACE_SPI 2
#define USB_IFACE_CONSOLE 3
-#define USB_IFACE_COUNT 4
+#define USB_IFACE_COUNT 4
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
-#define USB_EP_STREAM 1
-#define USB_EP_GPIO 2
-#define USB_EP_SPI 3
+#define USB_EP_STREAM 1
+#define USB_EP_GPIO 2
+#define USB_EP_SPI 3
#define USB_EP_CONSOLE 4
-#define USB_EP_COUNT 5
+#define USB_EP_COUNT 5
/* Enable control of GPIOs over USB */
#define CONFIG_USB_GPIO
+#undef CONFIG_CMD_GETTIME
#undef CONFIG_WATCHDOG_HELP
#undef CONFIG_LID_SWITCH
diff --git a/board/fusb307bgevb/build.mk b/board/fusb307bgevb/build.mk
index 1372562107..923b144165 100644
--- a/board/fusb307bgevb/build.mk
+++ b/board/fusb307bgevb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/fusb307bgevb/ec.tasklist b/board/fusb307bgevb/ec.tasklist
index e25b8f7a68..bca2d075be 100644
--- a/board/fusb307bgevb/ec.tasklist
+++ b/board/fusb307bgevb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fusb307bgevb/gpio.inc b/board/fusb307bgevb/gpio.inc
index 16a845576d..ba3b84fb08 100644
--- a/board/fusb307bgevb/gpio.inc
+++ b/board/fusb307bgevb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/fusb307bgevb/lcd.c b/board/fusb307bgevb/lcd.c
index 892888329e..f907de7462 100644
--- a/board/fusb307bgevb/lcd.c
+++ b/board/fusb307bgevb/lcd.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -26,17 +26,17 @@ static struct lcd_state_info state = {
/* write either command or data */
static void expander_write(uint8_t data)
{
- i2c_write8(I2C_PORT_TCPC, LCD_SLAVE_ADDR, 0x00, data |
- state.backlightval);
+ i2c_write8(I2C_PORT_TCPC, LCD_SLAVE_ADDR, 0x00,
+ data | state.backlightval);
}
static void pulse_enable(uint8_t data)
{
- expander_write(data | LCD_EN);/* En high */
- usleep(1); /* enable pulse must be >450ns */
+ expander_write(data | LCD_EN); /* En high */
+ usleep(1); /* enable pulse must be >450ns */
- expander_write(data & ~LCD_EN);/* En low */
- usleep(50); /* commands need > 37us to settle */
+ expander_write(data & ~LCD_EN); /* En low */
+ usleep(50); /* commands need > 37us to settle */
}
static void write_4bits(uint8_t value)
@@ -63,8 +63,8 @@ static void command(uint8_t value)
/********** high level commands, for the user! */
void lcd_clear(void)
{
- command(LCD_CLEAR_DISPLAY);/* clear display, set cursor to zero */
- usleep(2000); /* this command takes a long time! */
+ command(LCD_CLEAR_DISPLAY); /* clear display, set cursor to zero */
+ usleep(2000); /* this command takes a long time! */
}
void lcd_set_cursor(uint8_t col, uint8_t row)
diff --git a/board/fusb307bgevb/lcd.h b/board/fusb307bgevb/lcd.h
index 21b0ee9ce9..9ed773d92f 100644
--- a/board/fusb307bgevb/lcd.h
+++ b/board/fusb307bgevb/lcd.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,50 +11,50 @@
#include "common.h"
/* commands */
-#define LCD_CLEAR_DISPLAY BIT(0)
-#define LCD_RETURN_HOME BIT(1)
-#define LCD_ENTRYMODE_SET BIT(2)
-#define LCD_DISPLAY_CONTROL BIT(3)
-#define LCD_CURSOR_SHIFT BIT(4)
-#define LCD_FUNCTION_SET BIT(5)
-#define LCD_SET_CGRAMADDR BIT(6)
-#define LCD_SET_DDRAMADDR BIT(7)
+#define LCD_CLEAR_DISPLAY BIT(0)
+#define LCD_RETURN_HOME BIT(1)
+#define LCD_ENTRYMODE_SET BIT(2)
+#define LCD_DISPLAY_CONTROL BIT(3)
+#define LCD_CURSOR_SHIFT BIT(4)
+#define LCD_FUNCTION_SET BIT(5)
+#define LCD_SET_CGRAMADDR BIT(6)
+#define LCD_SET_DDRAMADDR BIT(7)
/* flags for display entry mode */
-#define LCD_ENTRY_RIGHT 0x00
-#define LCD_ENTRY_LEFT BIT(1)
-#define LCD_ENTRY_SHIFT_INCREMENT BIT(0)
-#define LCD_ENTRY_SHIFT_DECREMENT 0x00
+#define LCD_ENTRY_RIGHT 0x00
+#define LCD_ENTRY_LEFT BIT(1)
+#define LCD_ENTRY_SHIFT_INCREMENT BIT(0)
+#define LCD_ENTRY_SHIFT_DECREMENT 0x00
/* flags for display on/off control */
-#define LCD_DISPLAY_ON BIT(2)
-#define LCD_DISPLAY_OFF 0x00
-#define LCD_CURSOR_ON BIT(1)
-#define LCD_CURSOR_OFF 0x00
-#define LCD_BLINK_ON BIT(0)
-#define LCD_BLINK_OFF 0x00
+#define LCD_DISPLAY_ON BIT(2)
+#define LCD_DISPLAY_OFF 0x00
+#define LCD_CURSOR_ON BIT(1)
+#define LCD_CURSOR_OFF 0x00
+#define LCD_BLINK_ON BIT(0)
+#define LCD_BLINK_OFF 0x00
/* flags for display/cursor shift */
-#define LCD_DISPLAY_MOVE BIT(3)
-#define LCD_CURSOR_MOVE 0x00
-#define LCD_MOVE_RIGHT BIT(2)
-#define LCD_MOVE_LEFT 0x00
+#define LCD_DISPLAY_MOVE BIT(3)
+#define LCD_CURSOR_MOVE 0x00
+#define LCD_MOVE_RIGHT BIT(2)
+#define LCD_MOVE_LEFT 0x00
/* flags for function set */
-#define LCD_8BITMODE BIT(4)
-#define LCD_4BITMODE 0x00
-#define LCD_2LINE BIT(3)
-#define LCD_1LINE 0x00
-#define LCD_5X10DOTS BIT(2)
-#define LCD_5X8DOTS 0x00
+#define LCD_8BITMODE BIT(4)
+#define LCD_4BITMODE 0x00
+#define LCD_2LINE BIT(3)
+#define LCD_1LINE 0x00
+#define LCD_5X10DOTS BIT(2)
+#define LCD_5X8DOTS 0x00
/* flags for backlight control */
-#define LCD_BACKLIGHT BIT(3)
-#define LCD_NO_BACKLIGHT 0x00
+#define LCD_BACKLIGHT BIT(3)
+#define LCD_NO_BACKLIGHT 0x00
-#define LCD_EN BIT(2) /* Enable bit */
-#define LCD_RW BIT(1) /* Read/Write bit */
-#define LCD_RS BIT(0) /* Register select bit */
+#define LCD_EN BIT(2) /* Enable bit */
+#define LCD_RW BIT(1) /* Read/Write bit */
+#define LCD_RS BIT(0) /* Register select bit */
void lcd_init(uint8_t cols, uint8_t rows, uint8_t dotsize);
void lcd_set_cursor(uint8_t col, uint8_t row);
diff --git a/board/gaelin/board.c b/board/gaelin/board.c
new file mode 100644
index 0000000000..3409aa750f
--- /dev/null
+++ b/board/gaelin/board.c
@@ -0,0 +1,591 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+#include <stdbool.h>
+
+#include "adc.h"
+#include "assert.h"
+#include "button.h"
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "gpio.h"
+#include "gpio_signal.h"
+#include "power_button.h"
+#include "hooks.h"
+#include "peripheral_charger.h"
+#include "power.h"
+#include "switch.h"
+#include "throttle_ap.h"
+#include "usbc_config.h"
+#include "usbc_ppc.h"
+#include "driver/tcpm/tcpci.h"
+#include "fw_config.h"
+
+/* Console output macros */
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
+
+static void power_monitor(void);
+DECLARE_DEFERRED(power_monitor);
+
+/******************************************************************************/
+/* USB-A charging control */
+
+const int usb_port_enable[USB_PORT_COUNT] = {
+ GPIO_EN_PP5000_USBA,
+};
+BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
+
+extern struct pchg_drv cps8100_drv;
+struct pchg pchgs[] = {
+ [0] = {
+ .cfg = &(const struct pchg_config) {
+ .drv = &cps8100_drv,
+ .i2c_port = I2C_PORT_QI,
+ .irq_pin = GPIO_QI_INT_ODL,
+ .full_percent = 96,
+ .block_size = 128,
+ },
+ .events = QUEUE_NULL(PCHG_EVENT_QUEUE_SIZE, enum pchg_event),
+ },
+};
+const int pchg_count = ARRAY_SIZE(pchgs);
+
+__override void board_pchg_power_on(int port, bool on)
+{
+ if (port == 0)
+ gpio_set_level(GPIO_EC_QI_PWR, on);
+ else
+ CPRINTS("%s: Invalid port=%d", __func__, port);
+}
+
+/******************************************************************************/
+
+int board_set_active_charge_port(int port)
+{
+ CPRINTS("Requested charge port change to %d", port);
+
+ /*
+ * The charge manager may ask us to switch to no charger if we're
+ * running off USB-C only but upstream doesn't support PD. It requires
+ * that we accept this switch otherwise it triggers an assert and EC
+ * reset; it's not possible to boot the AP anyway, but we want to avoid
+ * resetting the EC so we can continue to do the "low power" LED blink.
+ */
+ if (port == CHARGE_PORT_NONE)
+ return EC_SUCCESS;
+
+ if (port < 0 || CHARGE_PORT_COUNT <= port)
+ return EC_ERROR_INVAL;
+
+ if (port == charge_manager_get_active_charge_port())
+ return EC_SUCCESS;
+
+ /* Don't charge from a source port */
+ if (board_vbus_source_enabled(port))
+ return EC_ERROR_INVAL;
+
+ if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+ int bj_active, bj_requested;
+
+ if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
+ /* Change is only permitted while the system is off */
+ return EC_ERROR_INVAL;
+
+ /*
+ * Current setting is no charge port but the AP is on, so the
+ * charge manager is out of sync (probably because we're
+ * reinitializing after sysjump). Reject requests that aren't
+ * in sync with our outputs.
+ */
+ bj_active = !gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L);
+ bj_requested = port == CHARGE_PORT_BARRELJACK;
+ if (bj_active != bj_requested)
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTS("New charger p%d", port);
+
+ switch (port) {
+ case CHARGE_PORT_TYPEC0:
+ case CHARGE_PORT_TYPEC1:
+ case CHARGE_PORT_TYPEC2:
+ gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
+ break;
+ case CHARGE_PORT_BARRELJACK:
+ /* Make sure BJ adapter is sourcing power */
+ if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
+ return EC_ERROR_INVAL;
+ gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
+ break;
+ default:
+ return EC_ERROR_INVAL;
+ }
+
+ return EC_SUCCESS;
+}
+
+static uint8_t usbc_overcurrent;
+static int32_t base_5v_power_s5;
+static int32_t base_5v_power_z1;
+
+/*
+ * Power usage for each port as measured or estimated.
+ * Units are milliwatts (5v x ma current)
+ */
+
+/* PP5000_S5 loads */
+#define PWR_S5_BASE_LOAD (5 * 1431)
+#define PWR_S5_FRONT_HIGH (5 * 1737)
+#define PWR_S5_FRONT_LOW (5 * 1055)
+#define PWR_S5_REAR_HIGH (5 * 1737)
+#define PWR_S5_REAR_LOW (5 * 1055)
+#define PWR_S5_HDMI (5 * 580)
+#define PWR_S5_MAX (5 * 10000)
+#define FRONT_DELTA (PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW)
+#define REAR_DELTA (PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW)
+
+/* PP5000_Z1 loads */
+#define PWR_Z1_BASE_LOAD (5 * 5)
+#define PWR_Z1_C_HIGH (5 * 3600)
+#define PWR_Z1_C_LOW (5 * 2000)
+#define PWR_Z1_MAX (5 * 9000)
+/*
+ * Update the 5V power usage, assuming no throttling,
+ * and invoke the power monitoring.
+ */
+static void update_5v_usage(void)
+{
+ int front_ports = 0;
+ int rear_ports = 0;
+
+ /*
+ * Recalculate the 5V load, assuming no throttling.
+ */
+ base_5v_power_s5 = PWR_S5_BASE_LOAD;
+ if (!gpio_get_level(GPIO_USB_A0_OC_ODL)) {
+ front_ports++;
+ base_5v_power_s5 += PWR_S5_FRONT_LOW;
+ }
+ if (!gpio_get_level(GPIO_USB_A1_OC_ODL)) {
+ front_ports++;
+ base_5v_power_s5 += PWR_S5_FRONT_LOW;
+ }
+ /*
+ * Only 1 front port can run higher power at a time.
+ */
+ if (front_ports > 0)
+ base_5v_power_s5 += PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW;
+
+ if (!gpio_get_level(GPIO_USB_A2_OC_ODL)) {
+ rear_ports++;
+ base_5v_power_s5 += PWR_S5_REAR_LOW;
+ }
+ if (!gpio_get_level(GPIO_USB_A3_OC_ODL)) {
+ rear_ports++;
+ base_5v_power_s5 += PWR_S5_REAR_LOW;
+ }
+ /*
+ * Only 1 rear port can run higher power at a time.
+ */
+ if (rear_ports > 0)
+ base_5v_power_s5 += PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW;
+ if (!gpio_get_level(GPIO_HDMI_CONN_OC_ODL))
+ base_5v_power_s5 += PWR_S5_HDMI;
+ base_5v_power_z1 = PWR_Z1_BASE_LOAD;
+ if (usbc_overcurrent)
+ base_5v_power_z1 += PWR_Z1_C_HIGH;
+ /*
+ * Invoke the power handler immediately.
+ */
+ hook_call_deferred(&power_monitor_data, 0);
+}
+DECLARE_DEFERRED(update_5v_usage);
+/*
+ * Start power monitoring after ADCs have been initialised.
+ */
+DECLARE_HOOK(HOOK_INIT, update_5v_usage, HOOK_PRIO_INIT_ADC + 1);
+
+static void port_ocp_interrupt(enum gpio_signal signal)
+{
+ hook_call_deferred(&update_5v_usage_data, 0);
+}
+#include "gpio_list.h" /* Must come after other header files. */
+
+/******************************************************************************/
+/*
+ * Barrel jack power supply handling
+ *
+ * EN_PPVAR_BJ_ADP_L must default active to ensure we can power on when the
+ * barrel jack is connected, and the USB-C port can bring the EC up fine in
+ * dead-battery mode. Both the USB-C and barrel jack switches do reverse
+ * protection, so we're safe to turn one on then the other off- but we should
+ * only do that if the system is off since it might still brown out.
+ */
+
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+/* Debounced connection state of the barrel jack */
+static int8_t adp_connected = -1;
+static void adp_connect_deferred(void)
+{
+ struct charge_port_info pi = { 0 };
+ int connected = !gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL);
+
+ /* Debounce */
+ if (connected == adp_connected)
+ return;
+ if (connected)
+ ec_bj_power(&pi.voltage, &pi.current);
+ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
+ DEDICATED_CHARGE_PORT, &pi);
+ adp_connected = connected;
+}
+DECLARE_DEFERRED(adp_connect_deferred);
+
+/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */
+void adp_connect_interrupt(enum gpio_signal signal)
+{
+ hook_call_deferred(&adp_connect_deferred_data, ADP_DEBOUNCE_MS * MSEC);
+}
+
+static void adp_state_init(void)
+{
+ ASSERT(CHARGE_PORT_ENUM_COUNT == CHARGE_PORT_COUNT);
+ /*
+ * Initialize all charge suppliers to 0. The charge manager waits until
+ * all ports have reported in before doing anything.
+ */
+ for (int i = 0; i < CHARGE_PORT_COUNT; i++) {
+ for (int j = 0; j < CHARGE_SUPPLIER_COUNT; j++)
+ charge_manager_update_charge(j, i, NULL);
+ }
+
+ /* Report charge state from the barrel jack. */
+ adp_connect_deferred();
+}
+DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
+
+static void board_init(void)
+{
+ gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_ODL);
+ gpio_enable_interrupt(GPIO_HDMI_CONN_OC_ODL);
+ gpio_enable_interrupt(GPIO_USB_A0_OC_ODL);
+ gpio_enable_interrupt(GPIO_USB_A1_OC_ODL);
+ gpio_enable_interrupt(GPIO_USB_A2_OC_ODL);
+ gpio_enable_interrupt(GPIO_USB_A3_OC_ODL);
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+void board_overcurrent_event(int port, int is_overcurrented)
+{
+ /* Check that port number is valid. */
+ if ((port < 0) || (port >= CONFIG_USB_PD_PORT_MAX_COUNT))
+ return;
+ usbc_overcurrent = is_overcurrented;
+ update_5v_usage();
+}
+/*
+ * Power monitoring and management.
+ *
+ * the power budgets are met without letting the system fall into
+ * power deficit (perhaps causing a brownout).
+ *
+ * There are 2 power budgets that need to be managed:
+ * The overall goal is to gracefully manage the power demand so that
+ * - overall system power as measured on the main power supply rail.
+ * - 5V power delivered to the USB and HDMI ports.
+ *
+ * The actual system power demand is calculated from the VBUS voltage and
+ * the input current (read from a shunt), averaged over 5 readings.
+ * The power budget limit is from the charge manager.
+ *
+ * The 5V power cannot be read directly. Instead, we rely on overcurrent
+ * inputs from the USB and HDMI ports to indicate that the port is in use
+ * (and drawing maximum power).
+ *
+ * There are 3 throttles that can be applied (in priority order):
+ *
+ * - Type A BC1.2 front port restriction (3W)
+ * - Type A BC1.2 rear port restriction (3W)
+ * - Type C PD (throttle to 1.5A if sourcing)
+ * - Turn on PROCHOT, which immediately throttles the CPU.
+ *
+ * The first 3 throttles affect both the system power and the 5V rails.
+ * The third is a last resort to force an immediate CPU throttle to
+ * reduce the overall power use.
+ *
+ * The strategy is to determine what the state of the throttles should be,
+ * and to then turn throttles off or on as needed to match this.
+ *
+ * This function runs on demand, or every 2 ms when the CPU is up,
+ * and continually monitors the power usage, applying the
+ * throttles when necessary.
+ *
+ * All measurements are in milliwatts.
+ */
+#define THROT_TYPE_A_FRONT BIT(0)
+#define THROT_TYPE_A_REAR BIT(1)
+#define THROT_TYPE_C0 BIT(2)
+#define THROT_TYPE_C1 BIT(3)
+#define THROT_TYPE_C2 BIT(4)
+#define THROT_PROCHOT BIT(5)
+
+/*
+ * Power gain if front USB A ports are limited.
+ */
+#define POWER_GAIN_TYPE_A 3200
+/*
+ * Power gain if Type C port is limited.
+ */
+#define POWER_GAIN_TYPE_C 8800
+/*
+ * Power is averaged over 10 ms, with a reading every 2 ms.
+ */
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
+
+static void power_monitor(void)
+{
+ static uint32_t current_state;
+ static uint32_t history[POWER_READINGS];
+ static uint8_t index;
+ int32_t delay;
+ uint32_t new_state = 0, diff;
+ int32_t headroom_5v_s5 = PWR_S5_MAX - base_5v_power_s5;
+ int32_t headroom_5v_z1 = PWR_Z1_MAX - base_5v_power_z1;
+
+ /*
+ * If CPU is off or suspended, no need to throttle
+ * or restrict power.
+ */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
+ /*
+ * Slow down monitoring, assume no throttling required.
+ */
+ delay = 20 * MSEC;
+ /*
+ * Clear the first entry of the power table so that
+ * it is re-initilalised when the CPU starts.
+ */
+ history[0] = 0;
+ } else {
+ int32_t charger_mw;
+
+ delay = POWER_DELAY_MS * MSEC;
+ /*
+ * Get current charger limit (in mw).
+ * If not configured yet, skip.
+ */
+ charger_mw = charge_manager_get_power_limit_uw() / 1000;
+ if (charger_mw != 0) {
+ int32_t gap, total, max, power;
+ int i;
+
+ /*
+ * Read power usage.
+ */
+ power = (adc_read_channel(ADC_VBUS) *
+ adc_read_channel(ADC_PPVAR_IMON)) /
+ 1000;
+ /* Init power table */
+ if (history[0] == 0) {
+ for (i = 0; i < POWER_READINGS; i++)
+ history[i] = power;
+ }
+ /*
+ * Update the power readings and
+ * calculate the average and max.
+ */
+ history[index] = power;
+ index = (index + 1) % POWER_READINGS;
+ total = 0;
+ max = history[0];
+ for (i = 0; i < POWER_READINGS; i++) {
+ total += history[i];
+ if (history[i] > max)
+ max = history[i];
+ }
+ /*
+ * For Type-C power supplies, there is
+ * less tolerance for exceeding the rating,
+ * so use the max power that has been measured
+ * over the measuring period.
+ * For barrel-jack supplies, the rating can be
+ * exceeded briefly, so use the average.
+ */
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
+ power = max;
+ else
+ power = total / POWER_READINGS;
+ /*
+ * Calculate gap, and if negative, power
+ * demand is exceeding configured power budget, so
+ * throttling is required to reduce the demand.
+ */
+ gap = charger_mw - power;
+ /*
+ * Limiting type-A power rear ports.
+ */
+ if (gap <= 0) {
+ new_state |= THROT_TYPE_A_REAR;
+ headroom_5v_s5 += REAR_DELTA;
+ if (!(current_state & THROT_TYPE_A_REAR))
+ gap += POWER_GAIN_TYPE_A;
+ }
+ /*
+ * Limiting type-A power front ports.
+ */
+ if (gap <= 0) {
+ new_state |= THROT_TYPE_A_FRONT;
+ headroom_5v_s5 += FRONT_DELTA;
+ if (!(current_state & THROT_TYPE_A_REAR))
+ gap += POWER_GAIN_TYPE_A;
+ }
+ /*
+ * If the type-C port is sourcing power,
+ * check whether it should be throttled.
+ */
+ if (ppc_is_sourcing_vbus(0) && gap <= 0) {
+ new_state |= THROT_TYPE_C0;
+ headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW;
+ if (!(current_state & THROT_TYPE_C0))
+ gap += POWER_GAIN_TYPE_C;
+ }
+ /*
+ * If the type-C port is sourcing power,
+ * check whether it should be throttled.
+ */
+ if (ppc_is_sourcing_vbus(1) && gap <= 0) {
+ new_state |= THROT_TYPE_C1;
+ headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW;
+ if (!(current_state & THROT_TYPE_C1))
+ gap += POWER_GAIN_TYPE_C;
+ }
+ /*
+ * If the type-C port is sourcing power,
+ * check whether it should be throttled.
+ */
+ if (ppc_is_sourcing_vbus(2) && gap <= 0) {
+ new_state |= THROT_TYPE_C2;
+ headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW;
+ if (!(current_state & THROT_TYPE_C2))
+ gap += POWER_GAIN_TYPE_C;
+ }
+ /*
+ * As a last resort, turn on PROCHOT to
+ * throttle the CPU.
+ */
+ if (gap <= 0)
+ new_state |= THROT_PROCHOT;
+ }
+ }
+ /*
+ * Check the 5v power usage and if necessary,
+ * adjust the throttles in priority order.
+ *
+ * Either throttle may have already been activated by
+ * the overall power control.
+ *
+ * We rely on the overcurrent detection to inform us
+ * if the port is in use.
+ *
+ * - If type C not already throttled:
+ * * If not overcurrent, prefer to limit type C [1].
+ * * If in overcurrentuse:
+ * - limit type A first [2]
+ * - If necessary, limit type C [3].
+ * - If type A not throttled, if necessary limit it [2].
+ */
+ if (headroom_5v_z1 < 0) {
+ /*
+ * Check whether type C is not throttled,
+ * and is not overcurrent.
+ */
+ if (!((new_state & THROT_TYPE_C0) || usbc_overcurrent)) {
+ /*
+ * [1] Type C not in overcurrent, throttle it.
+ */
+ headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW;
+ new_state |= THROT_TYPE_C0;
+ }
+ /*
+ * [2] If still under-budget, limit type C.
+ * No need to check if it is already throttled or not.
+ */
+ if (headroom_5v_z1 < 0)
+ new_state |= THROT_TYPE_C0;
+ }
+ if (headroom_5v_s5 < 0) {
+ /*
+ * [1] If type A rear not already throttled, and power still
+ * needed, limit type A rear.
+ */
+ if (!(new_state & THROT_TYPE_A_REAR) && headroom_5v_s5 < 0) {
+ headroom_5v_s5 += PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW;
+ new_state |= THROT_TYPE_A_REAR;
+ }
+ /*
+ * [2] If type A front not already throttled, and power still
+ * needed, limit type A front.
+ */
+ if (!(new_state & THROT_TYPE_A_FRONT) && headroom_5v_s5 < 0) {
+ headroom_5v_s5 += PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW;
+ new_state |= THROT_TYPE_A_FRONT;
+ }
+ }
+ /*
+ * Turn the throttles on or off if they have changed.
+ */
+ diff = new_state ^ current_state;
+ current_state = new_state;
+ if (diff & THROT_PROCHOT) {
+ int prochot = (new_state & THROT_PROCHOT) ? 0 : 1;
+
+ gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
+ }
+ if (diff & THROT_TYPE_C0) {
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
+
+ ppc_set_vbus_source_current_limit(0, rp);
+ tcpm_select_rp_value(0, rp);
+ pd_update_contract(0);
+ }
+ if (diff & THROT_TYPE_C1) {
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
+
+ ppc_set_vbus_source_current_limit(1, rp);
+ tcpm_select_rp_value(1, rp);
+ pd_update_contract(1);
+ }
+ if (diff & THROT_TYPE_C2) {
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
+
+ ppc_set_vbus_source_current_limit(2, rp);
+ tcpm_select_rp_value(2, rp);
+ pd_update_contract(2);
+ }
+ if (diff & THROT_TYPE_A_REAR) {
+ int typea_bc = (new_state & THROT_TYPE_A_REAR) ? 1 : 0;
+
+ gpio_set_level(GPIO_USB_A_LOW_PWR0_OD, typea_bc);
+ gpio_set_level(GPIO_USB_A_LOW_PWR1_OD, typea_bc);
+ }
+ if (diff & THROT_TYPE_A_FRONT) {
+ int typea_bc = (new_state & THROT_TYPE_A_FRONT) ? 1 : 0;
+
+ gpio_set_level(GPIO_USB_A_LOW_PWR2_OD, typea_bc);
+ gpio_set_level(GPIO_USB_A_LOW_PWR3_OD, typea_bc);
+ }
+ hook_call_deferred(&power_monitor_data, delay);
+}
diff --git a/board/gaelin/board.h b/board/gaelin/board.h
new file mode 100644
index 0000000000..f113c6cffd
--- /dev/null
+++ b/board/gaelin/board.h
@@ -0,0 +1,203 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Brask board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#include "compile_time_macros.h"
+
+/* Baseboard features */
+#include "baseboard.h"
+
+#define CONFIG_MP2964
+
+/* Barrel Jack */
+#define DEDICATED_CHARGE_PORT 3
+
+/* HDMI CEC */
+#define CONFIG_CEC
+#define CEC_GPIO_OUT GPIO_HDMI_CEC_OUT
+#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
+#define CEC_GPIO_PULL_UP GPIO_HDMI_CEC_PULL_UP
+
+/* USB Type A Features */
+#define USB_PORT_COUNT 4
+#define CONFIG_USB_PORT_POWER_DUMB
+
+/* USB Type C and USB PD defines */
+#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
+
+#define CONFIG_IO_EXPANDER
+#define CONFIG_IO_EXPANDER_NCT38XX
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+
+#define CONFIG_USB_PD_PPC
+#define CONFIG_USB_PD_TCPM_RT1715
+#define CONFIG_USBC_RETIMER_INTEL_BB
+
+#define CONFIG_USBC_RETIMER_KB800X
+#define CONFIG_KB800X_CUSTOM_XBAR
+#define CONFIG_USBC_PPC_SYV682X
+#undef CONFIG_SYV682X_HV_ILIM
+#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
+
+/* TODO: b/177608416 - measure and check these values on brya */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
+
+/* The design should support up to 100W. */
+/* TODO(b/197702356): Set the max PD to 60W now and change it
+ * to 100W after we verify it.
+ */
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
+
+/*
+ * Macros for GPIO signals used in common code that don't match the
+ * schematic names. Signal names in gpio.inc match the schematic and are
+ * then redefined here to so it's more clear which signal is being used for
+ * which purpose.
+ */
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+
+/*
+ * GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
+ * signal.
+ */
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
+#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
+
+/* I2C Bus Configuration */
+
+#define I2C_PORT_DP_REDRIVER NPCX_I2C_PORT0_0
+
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+
+#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+
+#define I2C_PORT_QI NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+
+#define I2C_ADDR_MP2964_FLAGS 0x20
+
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59
+
+/* Enabling Thunderbolt-compatible mode */
+#define CONFIG_USB_PD_TBT_COMPAT_MODE
+
+/* Enabling USB4 mode */
+#define CONFIG_USB_PD_USB4
+
+/* Retimer */
+#define CONFIG_USBC_RETIMER_FW_UPDATE
+
+/* Thermal features */
+#define CONFIG_THERMISTOR
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_TEMP_SENSOR_POWER
+#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
+
+/* ADC */
+#define CONFIG_ADC
+
+/*
+ * TODO(b/197478860): Enable the fan control. We need
+ * to check the sensor value and adjust the fan speed.
+ */
+#define CONFIG_FANS FAN_CH_COUNT
+
+/* Include math_util for bitmask_uint64 used in pd_timers */
+#define CONFIG_MATH_UTIL
+
+/* WPC/Qi charger */
+#ifdef SECTION_IS_RW
+#define CONFIG_PERIPHERAL_CHARGER
+#define CONFIG_CPS8100
+#endif
+
+#ifndef __ASSEMBLER__
+
+#include "gpio_signal.h" /* needed by registers.h */
+#include "registers.h"
+#include "usbc_config.h"
+
+enum charge_port {
+ CHARGE_PORT_TYPEC0,
+ CHARGE_PORT_TYPEC1,
+ CHARGE_PORT_TYPEC2,
+ CHARGE_PORT_BARRELJACK,
+ CHARGE_PORT_ENUM_COUNT
+};
+
+enum adc_channel {
+ ADC_TEMP_SENSOR_1_CPU,
+ ADC_TEMP_SENSOR_2_CPU_VR,
+ ADC_TEMP_SENSOR_3_WIFI,
+ ADC_TEMP_SENSOR_4_DIMM,
+ ADC_VBUS,
+ ADC_PPVAR_IMON, /* ADC3 */
+ ADC_CH_COUNT
+};
+
+enum temp_sensor_id {
+ TEMP_SENSOR_1_CPU,
+ TEMP_SENSOR_2_CPU_VR,
+ TEMP_SENSOR_3_WIFI,
+ TEMP_SENSOR_4_DIMM,
+ TEMP_SENSOR_COUNT
+};
+
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C2_NCT38XX, IOEX_PORT_COUNT };
+
+enum pwm_channel {
+ PWM_CH_LED_GREEN, /* PWM0 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED_RED, /* PWM2 */
+ PWM_CH_COUNT
+};
+
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
+
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
+
+extern void adp_connect_interrupt(enum gpio_signal signal);
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/ghost/build.mk b/board/gaelin/build.mk
index 4efdd19249..3de758d1bd 100644
--- a/board/ghost/build.mk
+++ b/board/gaelin/build.mk
@@ -1,24 +1,21 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
-# Ghost board specific files build
+# Brask board specific files build
#
CHIP:=npcx
CHIP_FAMILY:=npcx9
CHIP_VARIANT:=npcx9m3f
-BASEBOARD:=brya
+BASEBOARD:=brask
board-y=
-board-y+=battery.o
board-y+=board.o
-board-y+=charger.o
board-y+=fans.o
board-y+=fw_config.o
board-y+=i2c.o
-board-y+=keyboard.o
board-y+=led.o
board-y+=pwm.o
board-y+=sensors.o
diff --git a/board/gaelin/ec.tasklist b/board/gaelin/ec.tasklist
new file mode 100644
index 0000000000..d16fc35f52
--- /dev/null
+++ b/board/gaelin/ec.tasklist
@@ -0,0 +1,29 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * See CONFIG_TASK_LIST in config.h for details.
+ *
+ * USB_CHG_Px tasks must be contiguous (see USB_CHG_PORT_TO_TASK_ID(x)).
+ * PD_Cx tasks must be contiguous (see PD_PORT_TO_TASK_ID(x))
+ */
+
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS_RW(PCHG, pchg_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \
+ TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_MUX, usb_mux_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_C2, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(CEC, cec_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/gaelin/fans.c b/board/gaelin/fans.c
new file mode 100644
index 0000000000..6828438a10
--- /dev/null
+++ b/board/gaelin/fans.c
@@ -0,0 +1,50 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Physical fans. These are logically separate from pwm_channels. */
+
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "fan_chip.h"
+#include "fan.h"
+#include "hooks.h"
+#include "pwm.h"
+
+/* MFT channels. These are logically separate from pwm_channels. */
+const struct mft_t mft_channels[] = {
+ [MFT_CH_0] = {
+ .module = NPCX_MFT_MODULE_2,
+ .clk_src = TCKC_LFCLK,
+ .pwm_id = PWM_CH_FAN,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
+
+static const struct fan_conf fan_conf_0 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .pgood_gpio = -1,
+ .enable_gpio = GPIO_EN_PP5000_FAN,
+};
+
+/*
+ * TOOD(b/197478860): need to update for real fan
+ *
+ * Prototype fan spins at about 7200 RPM at 100% PWM.
+ * Set minimum at around 30% PWM.
+ */
+static const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 2200,
+ .rpm_start = 2200,
+ .rpm_max = 7200,
+};
+
+const struct fan_t fans[FAN_CH_COUNT] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
diff --git a/board/gaelin/fw_config.c b/board/gaelin/fw_config.c
new file mode 100644
index 0000000000..3ee71e6a0f
--- /dev/null
+++ b/board/gaelin/fw_config.c
@@ -0,0 +1,65 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "cbi.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "fw_config.h"
+
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+
+static union brask_cbi_fw_config fw_config;
+BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
+
+/*
+ * FW_CONFIG defaults for brask if the CBI.FW_CONFIG data is not
+ * initialized.
+ */
+static const union brask_cbi_fw_config fw_config_defaults = {
+ .audio = DB_NAU88L25B_I2S,
+ .bj_power = BJ_135W,
+};
+
+/*
+ * Barrel-jack power adapter ratings.
+ */
+static const struct {
+ int voltage;
+ int current;
+} bj_power[] = {
+ [BJ_135W] = { /* 0 - 135W (also default) */
+ .voltage = 19500,
+ .current = 6920
+ },
+ [BJ_230W] = { /* 1 - 230W */
+ .voltage = 19500,
+ .current = 11800
+ }
+};
+
+/****************************************************************************
+ * Brask FW_CONFIG access
+ */
+void board_init_fw_config(void)
+{
+ if (cbi_get_fw_config(&fw_config.raw_value)) {
+ CPRINTS("CBI: Read FW_CONFIG failed, using board defaults");
+ fw_config = fw_config_defaults;
+ }
+}
+
+void ec_bj_power(uint32_t *voltage, uint32_t *current)
+{
+ unsigned int bj;
+
+ bj = fw_config.bj_power;
+ /* Out of range value defaults to 0 */
+ if (bj >= ARRAY_SIZE(bj_power))
+ bj = 0;
+ *voltage = bj_power[bj].voltage;
+ *current = bj_power[bj].current;
+}
diff --git a/board/gaelin/fw_config.h b/board/gaelin/fw_config.h
new file mode 100644
index 0000000000..95d81f1e05
--- /dev/null
+++ b/board/gaelin/fw_config.h
@@ -0,0 +1,41 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef __BOARD_BRASK_FW_CONFIG_H_
+#define __BOARD_BRASK_FW_CONFIG_H_
+
+#include <stdint.h>
+
+/****************************************************************************
+ * CBI FW_CONFIG layout for Brask board.
+ *
+ * Source of truth is the project/brask/brask/config.star configuration file.
+ */
+enum ec_cfg_audio_type { DB_AUDIO_UNKNOWN = 0, DB_NAU88L25B_I2S = 1 };
+
+enum ec_cfg_bj_power { BJ_135W = 0, BJ_230W = 1 };
+
+union brask_cbi_fw_config {
+ struct {
+ uint32_t audio : 3;
+ uint32_t bj_power : 2;
+ uint32_t reserved_1 : 27;
+ };
+ uint32_t raw_value;
+};
+
+/**
+ * Read the cached FW_CONFIG. Guaranteed to have valid values.
+ *
+ * @return the FW_CONFIG for the board.
+ */
+union brask_cbi_fw_config get_fw_config(void);
+
+/**
+ * Get the barrel-jack power from FW_CONFIG.
+ */
+void ec_bj_power(uint32_t *voltage, uint32_t *current);
+
+#endif /* __BOARD_BRASK_FW_CONFIG_H_ */
diff --git a/board/gaelin/gpio.inc b/board/gaelin/gpio.inc
new file mode 100644
index 0000000000..51cf0010c6
--- /dev/null
+++ b/board/gaelin/gpio.inc
@@ -0,0 +1,187 @@
+/* -*- mode:c -*-
+ *
+ * Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* INTERRUPT GPIOs: */
+
+GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH, extpower_interrupt)
+GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt)
+GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
+GPIO_INT(GSC_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt)
+GPIO_INT(SEQ_EC_ALL_SYS_PG, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SEQ_EC_DSW_PWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SEQ_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C0_RT_INT_ODL, PIN(B, 1), GPIO_INT_FALLING, retimer_interrupt)
+GPIO_INT(USB_C1_BC12_INT_ODL, PIN(5, 0), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C1_PPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(USB_C2_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C2_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C2_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt)
+GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
+GPIO_INT(EC_RECOVERY_BTN_OD, PIN(2, 3), GPIO_INT_BOTH, button_interrupt)
+GPIO_INT(HDMI_CONN_OC_ODL, PIN(2, 4), GPIO_INPUT | GPIO_INT_BOTH, port_ocp_interrupt)
+GPIO_INT(USB_A0_OC_ODL, PIN(3, 1), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt)
+GPIO_INT(USB_A1_OC_ODL, PIN(3, 0), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt)
+GPIO_INT(USB_A2_OC_ODL, PIN(2, 7), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt)
+GPIO_INT(USB_A3_OC_ODL, PIN(2, 6), GPIO_INPUT | GPIO_PULL_UP | GPIO_INT_BOTH, port_ocp_interrupt)
+#ifdef SECTION_IS_RW
+GPIO_INT(QI_INT_ODL, PIN(9, 6), GPIO_INT_FALLING, pchg_irq)
+#else
+UNIMPLEMENTED(QI_INT_ODL)
+#endif
+
+/* CCD */
+GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
+
+/* Security */
+GPIO(EC_ENTERING_RW, PIN(0, 3), GPIO_OUT_LOW)
+GPIO(EC_GSC_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW)
+
+/* Fan */
+GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH)
+
+/* ADC, need to check the usage */
+GPIO(ANALOG_PPVAR_PWR_IN_IMON_EC, PIN(4, 2), GPIO_INPUT)
+
+/* Display */
+GPIO(DP_CONN_OC_ODL, PIN(2, 5), GPIO_INPUT)
+
+
+/* BarrelJack */
+GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 7), GPIO_OUT_LOW)
+
+/* Chipset PCH */
+GPIO(EC_PCHHOT_ODL, PIN(7, 4), GPIO_INPUT)
+GPIO(EC_PCH_INT_ODL, PIN(B, 0), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUT_LOW)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
+GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
+GPIO(EC_PCH_WAKE_ODL, PIN(C, 0), GPIO_ODR_HIGH)
+GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
+GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW)
+GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
+GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
+GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
+GPIO(IMVP9_VRRDY_OD, PIN(6, 0), GPIO_INPUT)
+GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT)
+
+/* Button */
+GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
+GPIO(GSC_EC_RECOVERY_BTN_OD, PIN(2, 2), GPIO_INPUT)
+
+/* NFC */
+/* TODO(b/194068530): Enable NFC */
+GPIO(NFC_COIL_ACT_L, PIN(D, 4), GPIO_INPUT)
+GPIO(NFC_LOW_POWER_MODE, PIN(9, 5), GPIO_OUT_HIGH)
+GPIO(NFC_CARD_DET_L, PIN(A, 3), GPIO_INPUT)
+GPIO(EN_NFC_BUZZER, PIN(0, 5), GPIO_OUT_LOW)
+
+/* Wireless Charger */
+GPIO(EC_QI_PWR, PIN(D, 2), GPIO_OUT_LOW)
+GPIO(QI_RESET_L, PIN(9, 3), GPIO_OUT_HIGH)
+
+/* HDMI CEC */
+/* TODO(b/197474873): Enable HDMI CEC */
+GPIO(HDMI_CEC_IN, PIN(4, 0), GPIO_INPUT)
+GPIO(HDMI_CEC_OUT, PIN(D, 3), GPIO_OUT_HIGH | GPIO_OPEN_DRAIN)
+GPIO(HDMI_CEC_PULL_UP, PIN(C, 2), GPIO_OUT_HIGH)
+
+/* I2C SCL/SDA */
+GPIO(EC_I2C_QI_SCL, PIN(3, 3), GPIO_INPUT)
+GPIO(EC_I2C_QI_SDA, PIN(3, 6), GPIO_INPUT)
+GPIO(EC_I2C_MISC_SCL_R, PIN(B, 3), GPIO_INPUT)
+GPIO(EC_I2C_MISC_SDA_R, PIN(B, 2), GPIO_INPUT)
+GPIO(EC_I2C_DP_SCL, PIN(B, 5), GPIO_INPUT)
+GPIO(EC_I2C_DP_SDA, PIN(B, 4), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_PPC_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_PPC_SDA, PIN(9, 1), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_RT_SCL, PIN(D, 1), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_RT_SDA, PIN(D, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_TCPC_SCL, PIN(9, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_TCPC_SDA, PIN(8, 7), GPIO_INPUT)
+GPIO(EC_I2C_USB_C1_MIX_SCL, PIN(E, 4), GPIO_INPUT)
+GPIO(EC_I2C_USB_C1_MIX_SDA, PIN(E, 3), GPIO_INPUT)
+GPIO(EC_I2C_USB_C1_TCPC_SCL, PIN(F, 3), GPIO_INPUT)
+GPIO(EC_I2C_USB_C1_TCPC_SDA, PIN(F, 2), GPIO_INPUT)
+
+/* USBA */
+GPIO(EN_PP5000_USBA, PIN(D, 7), GPIO_OUT_LOW)
+GPIO(USB_A0_STATUS_L, PIN(2, 1), GPIO_INPUT)
+GPIO(USB_A1_STATUS_L, PIN(2, 0), GPIO_INPUT)
+GPIO(USB_A2_STATUS_L, PIN(1, 7), GPIO_INPUT)
+GPIO(USB_A3_STATUS_L, PIN(1, 6), GPIO_INPUT)
+GPIO(USB_A_LOW_PWR0_OD, PIN(1, 5), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(USB_A_LOW_PWR1_OD, PIN(1, 4), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(USB_A_LOW_PWR2_OD, PIN(1, 1), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(USB_A_LOW_PWR3_OD, PIN(1, 0), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(USB_A_OC_SOC_L, PIN(8, 0), GPIO_OUT_HIGH)
+
+/* LED */
+/* TODO(b/197471359): LED implementation */
+GPIO(LED_GREEN_L, PIN(C, 3), GPIO_OUT_LOW)
+GPIO(LED_RED_L, PIN(C, 4), GPIO_OUT_LOW)
+
+/* USBC */
+GPIO(USB_C0_C2_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
+GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW)
+GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT)
+GPIO(USB_C1_RT_RST_R_L, PIN(0, 2), GPIO_OUT_LOW)
+
+/* GPIO02_P2 to PU */
+/* GPIO03_P2 to PU */
+IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH)
+IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW)
+IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW)
+
+IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 2), GPIO_ODR_LOW)
+IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 3), GPIO_ODR_HIGH)
+IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_ODR_HIGH)
+IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_LOW)
+/* GPIO07_P2 to PU */
+
+/* UART alternate functions */
+ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
+
+/* I2C alternate functions */
+ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* GPIO33/I2C5_SCL0/CTS_L, GPIO36/RTS_L/I2C5_SDA0 */
+ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* GPIO87/I2C1_SDA0 */
+ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* GPIO92/I2C2_SCL0, GPIO91/I2C2_SDA0, GPIO90/I2C1_SCL0 */
+ALTERNATE(PIN_MASK(B, 0x0c), 0, MODULE_I2C, 0) /* GPIOB3/I2C7_SCL0/DCD_L, GPIOB2/I2C7_SDA0/DSR_L */
+ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, 0) /* GPIOB5/I2C0_SCL0, GPIOB4/I2C0_SDA0 */
+ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* GPIOD1/I2C3_SCL0, GPIOD0/I2C3_SDA0 */
+ALTERNATE(PIN_MASK(E, 0x18), 0, MODULE_I2C, 0) /* GPIOE4/I2C6_SCL1/I3C_SCL, GPIOE3/I2C6_SDA1/I3C_SDA */
+ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */
+
+/* PWM alternate functions */
+ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* GPIO73/TA2 */
+ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */
+ALTERNATE(PIN_MASK(C, 0x18), 0, MODULE_PWM, 0) /* GPIOC4/PWM2, GPIOC3/PWM0 */
+
+/* ADC alternate functions */
+ALTERNATE(PIN_MASK(3, 0x10), 0, MODULE_ADC, 0) /* GPIO34/PS2_DAT2/ADC6 */
+ALTERNATE(PIN_MASK(4, 0x38), 0, MODULE_ADC, 0) /* GPIO45/ADC0, GPIO44/ADC1, GPIO43/ADC2 */
+ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
+
+/* Unused Pins */
+UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
+UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
+UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
+UNUSED(PIN(6, 6)) /* GPIO66 */
+UNUSED(PIN(8, 1)) /* GPIO81/PECI_DATA */
+UNUSED(PIN(5, 6)) /* GPIO56/CLKRUN# */
+UNUSED(PIN(9, 7)) /* GPIO97 */
+UNUSED(PIN(8, 6)) /* GPIO86/TXD/CR_SOUT2 */
+UNUSED(PIN(1, 3)) /* KSO06/GPO13/GP_SEL# */
+UNUSED(PIN(1, 2)) /* KSO07/GPO12/JEN# */
+UNUSED(PIN(0, 6)) /* KSO11/GPIO06/P80_CLK */
+UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */
diff --git a/board/gaelin/i2c.c b/board/gaelin/i2c.c
new file mode 100644
index 0000000000..0a0b6b69a6
--- /dev/null
+++ b/board/gaelin/i2c.c
@@ -0,0 +1,78 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+#include "compile_time_macros.h"
+
+#include "i2c.h"
+
+/* I2C port map configuration */
+const struct i2c_port_t i2c_ports[] = {
+ {
+ /* I2C0 */
+ .name = "dp_redriver",
+ .port = I2C_PORT_DP_REDRIVER,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_DP_SCL,
+ .sda = GPIO_EC_I2C_DP_SDA,
+ },
+ {
+ /* I2C1 */
+ .name = "tcpc0,2",
+ .port = I2C_PORT_USB_C0_C2_TCPC,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_C2_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C2_TCPC_SDA,
+ },
+ {
+ /* I2C2 */
+ .name = "ppc0,2",
+ .port = I2C_PORT_USB_C0_C2_PPC,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_C2_PPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C2_PPC_SDA,
+ },
+ {
+ /* I2C3 */
+ .name = "retimer0,2",
+ .port = I2C_PORT_USB_C0_C2_MUX,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_C2_RT_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C2_RT_SDA,
+ },
+ {
+ /* I2C4 C1 TCPC */
+ .name = "tcpc1",
+ .port = I2C_PORT_USB_C1_TCPC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
+ },
+ {
+ /* I2C5 */
+ .name = "wireless_charger",
+ .port = I2C_PORT_QI,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_QI_SCL,
+ .sda = GPIO_EC_I2C_QI_SDA,
+ },
+ {
+ /* I2C6 */
+ .name = "ppc1",
+ .port = I2C_PORT_USB_C1_PPC,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_MIX_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_MIX_SDA,
+ },
+ {
+ /* I2C7 */
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_MISC_SCL_R,
+ .sda = GPIO_EC_I2C_MISC_SDA_R,
+ },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/gaelin/led.c b/board/gaelin/led.c
new file mode 100644
index 0000000000..842cee0530
--- /dev/null
+++ b/board/gaelin/led.c
@@ -0,0 +1,260 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Power LED control for Brask.
+ * Solid green - active power
+ * Green flashing - suspended
+ * Red flashing - alert
+ * Solid red - critical
+ */
+
+#include "chipset.h"
+#include "console.h"
+#include "ec_commands.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "led_common.h"
+#include "pwm.h"
+#include "timer.h"
+#include "util.h"
+
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
+
+/*
+ * Due to the CSME-Lite processing, upon startup the CPU transitions through
+ * S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
+ * delay turning off the LED during suspend/shutdown.
+ */
+#define LED_CPU_DELAY_MS (2000 * MSEC)
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
+const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
+
+enum led_color {
+ LED_OFF = 0,
+ LED_RED,
+ LED_GREEN,
+
+ /* Number of colors, not a color itself */
+ LED_COLOR_COUNT
+};
+
+static int set_color_power(enum led_color color, int duty)
+{
+ int green = 0;
+ int red = 0;
+
+ if (duty < 0 || 100 < duty)
+ return EC_ERROR_UNKNOWN;
+
+ switch (color) {
+ case LED_OFF:
+ break;
+ case LED_GREEN:
+ green = 1;
+ break;
+ case LED_RED:
+ red = 1;
+ break;
+ default:
+ return EC_ERROR_UNKNOWN;
+ }
+
+ if (red)
+ pwm_set_duty(PWM_CH_LED_RED, duty);
+ else
+ pwm_set_duty(PWM_CH_LED_RED, 0);
+
+ if (green)
+ pwm_set_duty(PWM_CH_LED_GREEN, duty);
+ else
+ pwm_set_duty(PWM_CH_LED_GREEN, 0);
+
+ return EC_SUCCESS;
+}
+
+static int set_color(enum ec_led_id id, enum led_color color, int duty)
+{
+ switch (id) {
+ case EC_LED_ID_POWER_LED:
+ return set_color_power(color, duty);
+ default:
+ return EC_ERROR_UNKNOWN;
+ }
+}
+
+#define LED_PULSE_US (2 * SECOND)
+/* 40 msec for nice and smooth transition. */
+#define LED_PULSE_TICK_US (40 * MSEC)
+
+/*
+ * When pulsing is enabled, brightness is incremented by <duty_inc> every
+ * <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
+ * likewise in LED_PULSE_US usec.
+ */
+static struct {
+ uint32_t interval;
+ int duty_inc;
+ enum led_color color;
+ int duty;
+} led_pulse;
+
+#define CONFIG_TICK(interval, color) \
+ config_tick((interval), 100 / (LED_PULSE_US / (interval)), (color))
+
+static void config_tick(uint32_t interval, int duty_inc, enum led_color color)
+{
+ led_pulse.interval = interval;
+ led_pulse.duty_inc = duty_inc;
+ led_pulse.color = color;
+ led_pulse.duty = 0;
+}
+
+static void pulse_power_led(enum led_color color)
+{
+ set_color(EC_LED_ID_POWER_LED, color, led_pulse.duty);
+ if (led_pulse.duty + led_pulse.duty_inc > 100)
+ led_pulse.duty_inc = led_pulse.duty_inc * -1;
+ else if (led_pulse.duty + led_pulse.duty_inc < 0)
+ led_pulse.duty_inc = led_pulse.duty_inc * -1;
+ led_pulse.duty += led_pulse.duty_inc;
+}
+
+static void led_tick(void);
+DECLARE_DEFERRED(led_tick);
+static void led_tick(void)
+{
+ uint32_t elapsed;
+ uint32_t next = 0;
+ uint32_t start = get_time().le.lo;
+
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ pulse_power_led(led_pulse.color);
+ elapsed = get_time().le.lo - start;
+ next = led_pulse.interval > elapsed ? led_pulse.interval - elapsed : 0;
+ hook_call_deferred(&led_tick_data, next);
+}
+
+static void led_suspend(void)
+{
+ CONFIG_TICK(LED_PULSE_TICK_US, LED_GREEN);
+ led_tick();
+}
+DECLARE_DEFERRED(led_suspend);
+
+static void led_shutdown(void)
+{
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ set_color(EC_LED_ID_POWER_LED, LED_OFF, 0);
+}
+DECLARE_DEFERRED(led_shutdown);
+
+static void led_shutdown_hook(void)
+{
+ hook_call_deferred(&led_tick_data, -1);
+ hook_call_deferred(&led_suspend_data, -1);
+ hook_call_deferred(&led_shutdown_data, LED_CPU_DELAY_MS);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, led_shutdown_hook, HOOK_PRIO_DEFAULT);
+
+static void led_suspend_hook(void)
+{
+ hook_call_deferred(&led_shutdown_data, -1);
+ hook_call_deferred(&led_suspend_data, LED_CPU_DELAY_MS);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, led_suspend_hook, HOOK_PRIO_DEFAULT);
+
+static void led_resume(void)
+{
+ /*
+ * Assume there is no race condition with led_tick, which also
+ * runs in hook_task.
+ */
+ hook_call_deferred(&led_tick_data, -1);
+ /*
+ * Avoid invoking the suspend/shutdown delayed hooks.
+ */
+ hook_call_deferred(&led_suspend_data, -1);
+ hook_call_deferred(&led_shutdown_data, -1);
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ set_color(EC_LED_ID_POWER_LED, LED_GREEN, 100);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, led_resume, HOOK_PRIO_DEFAULT);
+
+void led_alert(int enable)
+{
+ if (enable) {
+ /* Overwrite the current signal */
+ config_tick(1 * SECOND, 100, LED_RED);
+ led_tick();
+ } else {
+ /* Restore the previous signal */
+ if (chipset_in_state(CHIPSET_STATE_ON))
+ led_resume();
+ else if (chipset_in_state(CHIPSET_STATE_SUSPEND))
+ led_suspend_hook();
+ else if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ led_shutdown_hook();
+ }
+}
+
+void show_critical_error(void)
+{
+ hook_call_deferred(&led_tick_data, -1);
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
+}
+
+static int command_led(int argc, const char **argv)
+{
+ enum ec_led_id id = EC_LED_ID_POWER_LED;
+
+ if (argc < 2)
+ return EC_ERROR_PARAM_COUNT;
+
+ if (!strcasecmp(argv[1], "debug")) {
+ led_auto_control(id, !led_auto_control_is_enabled(id));
+ ccprintf("o%s\n", led_auto_control_is_enabled(id) ? "ff" : "n");
+ } else if (!strcasecmp(argv[1], "off")) {
+ set_color(id, LED_OFF, 0);
+ } else if (!strcasecmp(argv[1], "red")) {
+ set_color(id, LED_RED, 100);
+ } else if (!strcasecmp(argv[1], "green")) {
+ set_color(id, LED_GREEN, 100);
+ } else if (!strcasecmp(argv[1], "alert")) {
+ led_alert(1);
+ } else if (!strcasecmp(argv[1], "crit")) {
+ show_critical_error();
+ } else {
+ return EC_ERROR_PARAM1;
+ }
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|green|off|alert|crit]",
+ "Turn on/off LED.");
+
+void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
+{
+ brightness_range[EC_LED_COLOR_RED] = 100;
+ brightness_range[EC_LED_COLOR_GREEN] = 100;
+}
+
+int led_set_brightness(enum ec_led_id id, const uint8_t *brightness)
+{
+ if (brightness[EC_LED_COLOR_RED])
+ return set_color(id, LED_RED, brightness[EC_LED_COLOR_RED]);
+ else if (brightness[EC_LED_COLOR_GREEN])
+ return set_color(id, LED_GREEN, brightness[EC_LED_COLOR_GREEN]);
+ else
+ return set_color(id, LED_OFF, 0);
+}
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
+{
+ /* Blink alert if insufficient power per system_can_boot_ap(). */
+ int insufficient_power =
+ (charge_ma * charge_mv) <
+ (CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000);
+ led_alert(insufficient_power);
+}
diff --git a/board/gaelin/pwm.c b/board/gaelin/pwm.c
new file mode 100644
index 0000000000..3d4335f453
--- /dev/null
+++ b/board/gaelin/pwm.c
@@ -0,0 +1,40 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "compile_time_macros.h"
+#include "hooks.h"
+#include "pwm.h"
+#include "pwm_chip.h"
+
+const struct pwm_t pwm_channels[] = {
+ [PWM_CH_LED_GREEN] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
+ .freq = 1000 },
+ [PWM_CH_LED_RED] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+static void board_pwm_init(void)
+{
+ /*
+ * TODO(b/197478860): Turn on the fan at 100% by default
+ * We need to find tune the fan speed according to the
+ * thermal sensor value.
+ */
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, 100);
+
+ pwm_enable(PWM_CH_LED_RED, 1);
+ pwm_enable(PWM_CH_LED_GREEN, 1);
+}
+DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT);
diff --git a/board/gaelin/sensors.c b/board/gaelin/sensors.c
new file mode 100644
index 0000000000..162140d37d
--- /dev/null
+++ b/board/gaelin/sensors.c
@@ -0,0 +1,114 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+#include "adc_chip.h"
+#include "hooks.h"
+#include "temp_sensor.h"
+#include "thermal.h"
+#include "temp_sensor/thermistor.h"
+
+/* ADC configuration */
+const struct adc_t adc_channels[] = {
+ [ADC_TEMP_SENSOR_1_CPU] = {
+ .name = "TEMP_CPU",
+ .input_ch = NPCX_ADC_CH0,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_TEMP_SENSOR_2_CPU_VR] = {
+ .name = "TEMP_CPU_VR",
+ .input_ch = NPCX_ADC_CH1,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_TEMP_SENSOR_3_WIFI] = {
+ .name = "TEMP_WIFI",
+ .input_ch = NPCX_ADC_CH6,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_TEMP_SENSOR_4_DIMM] = {
+ .name = "TEMP_DIMM",
+ .input_ch = NPCX_ADC_CH7,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_VBUS] = { /* 5/39 voltage divider */
+ .name = "VBUS",
+ .input_ch = NPCX_ADC_CH2,
+ .factor_mul = ADC_MAX_VOLT * 39,
+ .factor_div = (ADC_READ_MAX + 1) * 5,
+ },
+ [ADC_PPVAR_IMON] = { /* 872.3 mV/A */
+ .name = "PPVAR_IMON",
+ .input_ch = NPCX_ADC_CH3,
+ .factor_mul = ADC_MAX_VOLT * 1433,
+ .factor_div = (ADC_READ_MAX + 1) * 1250,
+ },
+
+};
+BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
+
+/* Temperature sensor configuration */
+const struct temp_sensor_t temp_sensors[] = {
+ [TEMP_SENSOR_1_CPU] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_CPU },
+ [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_CPU_VR },
+ [TEMP_SENSOR_3_WIFI] = { .name = "WIFI",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_WIFI },
+ [TEMP_SENSOR_4_DIMM] = { .name = "DIMM",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_DIMM },
+};
+BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
+
+/*
+ * TODO(b/180681346): update for Alder Lake/brya
+ *
+ * Tiger Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
+ * 130 C. However, sensor is located next to DDR, so we need to use the lower
+ * DDR temperature limit (85 C)
+ */
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
+#define THERMAL_CPU \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
+ }, \
+ .temp_fan_off = C_TO_K(35), \
+ .temp_fan_max = C_TO_K(50), \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
+
+/*
+ * TODO(b/197478860): add the thermal sensor setting
+ */
+/* this should really be "const" */
+struct ec_thermal_config thermal_params[] = {
+ [TEMP_SENSOR_1_CPU] = THERMAL_CPU,
+ [TEMP_SENSOR_2_CPU_VR] = THERMAL_CPU,
+ [TEMP_SENSOR_3_WIFI] = THERMAL_CPU,
+ [TEMP_SENSOR_4_DIMM] = THERMAL_CPU,
+};
+BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/gaelin/usbc_config.c b/board/gaelin/usbc_config.c
new file mode 100644
index 0000000000..806ff2c4ee
--- /dev/null
+++ b/board/gaelin/usbc_config.c
@@ -0,0 +1,416 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/bc12/pi3usb9201_public.h"
+#include "driver/ppc/syv682x_public.h"
+#include "driver/retimer/bb_retimer_public.h"
+#include "driver/retimer/kb800x.h"
+#include "driver/tcpm/nct38xx.h"
+#include "driver/tcpm/rt1715.h"
+#include "driver/tcpm/tcpci.h"
+#include "ec_commands.h"
+#include "gpio.h"
+#include "gpio_signal.h"
+#include "hooks.h"
+#include "ioexpander.h"
+#include "system.h"
+#include "task.h"
+#include "task_id.h"
+#include "timer.h"
+#include "usbc_config.h"
+#include "usbc_ppc.h"
+#include "usb_charge.h"
+#include "usb_mux.h"
+#include "usb_pd.h"
+#include "usb_pd_tcpm.h"
+
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
+
+/* USBC TCPC configuration */
+const struct tcpc_config_t tcpc_config[] = {
+ [USBC_PORT_C0] = {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0_C2_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
+ },
+ .drv = &nct38xx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_NO_DEBUG_ACC_CONTROL,
+ },
+ [USBC_PORT_C1] = {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = RT1715_I2C_ADDR_FLAGS,
+ },
+ .drv = &rt1715_tcpm_drv,
+ },
+ [USBC_PORT_C2] = {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0_C2_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
+ },
+ .drv = &nct38xx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
+BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
+
+/* USBC PPC configuration */
+struct ppc_config_t ppc_chips[] = {
+ [USBC_PORT_C0] = {
+ .i2c_port = I2C_PORT_USB_C0_C2_PPC,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
+ },
+ [USBC_PORT_C1] = {
+ .i2c_port = I2C_PORT_USB_C1_PPC,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
+ },
+ [USBC_PORT_C2] = {
+ .i2c_port = I2C_PORT_USB_C0_C2_PPC,
+ .i2c_addr_flags = SYV682X_ADDR2_FLAGS,
+ .drv = &syv682x_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
+
+unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
+
+/* USBC mux configuration - Alder Lake includes internal mux */
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+};
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+};
+static const struct usb_mux_chain usbc2_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+};
+
+struct kb800x_control_t kb800x_control[] = {
+ [USBC_PORT_C0] = {
+ },
+ [USBC_PORT_C1] = {
+ .retimer_rst_gpio = GPIO_USB_C1_RT_RST_R_L,
+ .ss_lanes = {
+ [KB800X_A0] = KB800X_TX0, [KB800X_A1] = KB800X_RX0,
+ [KB800X_B0] = KB800X_RX1, [KB800X_B1] = KB800X_TX1,
+ [KB800X_C0] = KB800X_RX0, [KB800X_C1] = KB800X_TX0,
+ [KB800X_D0] = KB800X_TX1, [KB800X_D1] = KB800X_RX1,
+ }
+ },
+ [USBC_PORT_C2] = {
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(kb800x_control) == USBC_PORT_COUNT);
+
+const struct usb_mux_chain usb_muxes[] = {
+ [USBC_PORT_C0] = {
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
+ },
+ [USBC_PORT_C1] = {
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &kb800x_usb_mux_driver,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = KB800X_I2C_ADDR0_FLAGS,
+ },
+ .next = &usbc1_tcss_usb_mux,
+ },
+ [USBC_PORT_C2] = {
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc2_tcss_usb_mux,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
+
+/* BC1.2 charger detect configuration */
+const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
+ [USBC_PORT_C0] = {
+ .i2c_port = I2C_PORT_USB_C0_C2_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
+ },
+ [USBC_PORT_C1] = {
+ .i2c_port = I2C_PORT_USB_C1_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
+ },
+ [USBC_PORT_C2] = {
+ .i2c_port = I2C_PORT_USB_C0_C2_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
+
+/*
+ * USB C0 and C2 uses burnside bridge chips and have their reset
+ * controlled by their respective TCPC chips acting as GPIO expanders.
+ *
+ * ioex_init() is normally called before we take the TCPCs out of
+ * reset, so we need to start in disabled mode, then explicitly
+ * call ioex_init().
+ */
+
+struct ioexpander_config_t ioex_config[] = {
+ [IOEX_C0_NCT38XX] = {
+ .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
+ .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
+ },
+ [IOEX_C2_NCT38XX] = {
+ .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
+ .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
+ .drv = &nct38xx_ioexpander_drv,
+ .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
+
+__override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
+{
+ enum ioex_signal rst_signal;
+
+ if (me->usb_port == USBC_PORT_C0) {
+ rst_signal = IOEX_USB_C0_RT_RST_ODL;
+ } else if (me->usb_port == USBC_PORT_C2) {
+ rst_signal = IOEX_USB_C2_RT_RST_ODL;
+ } else {
+ return EC_ERROR_INVAL;
+ }
+
+ /*
+ * We do not have a load switch for the burnside bridge chips,
+ * so we only need to sequence reset.
+ */
+
+ if (enable) {
+ /*
+ * Tpw, minimum time from VCC to RESET_N de-assertion is 100us.
+ * For boards that don't provide a load switch control, the
+ * retimer_init() function ensures power is up before calling
+ * this function.
+ */
+ ioex_set_level(rst_signal, 1);
+ /*
+ * Allow 1ms time for the retimer to power up lc_domain
+ * which powers I2C controller within retimer
+ */
+ msleep(1);
+ } else {
+ ioex_set_level(rst_signal, 0);
+ msleep(1);
+ }
+ return EC_SUCCESS;
+}
+
+__override int bb_retimer_reset(const struct usb_mux *me)
+{
+ /*
+ * TODO(b/193402306, b/195375738): Remove this once transition to
+ * QS Silicon is complete
+ */
+ bb_retimer_power_enable(me, false);
+ msleep(5);
+ bb_retimer_power_enable(me, true);
+ msleep(25);
+
+ return EC_SUCCESS;
+}
+
+void board_reset_pd_mcu(void)
+{
+ enum gpio_signal tcpc_rst;
+
+ tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL;
+
+ /*
+ * TODO(b/179648104): figure out correct timing
+ */
+
+ gpio_set_level(tcpc_rst, 0);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 0);
+
+ /*
+ * delay for power-on to reset-off and min. assertion time
+ */
+
+ msleep(20);
+
+ gpio_set_level(tcpc_rst, 1);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 1);
+
+ /* wait for chips to come up */
+
+ msleep(50);
+}
+
+static void enable_ioex(int ioex)
+{
+ ioex_init(ioex);
+}
+
+static void board_tcpc_init(void)
+{
+ /* Don't reset TCPCs after initial reset */
+ if (!system_jumped_late()) {
+ board_reset_pd_mcu();
+
+ /*
+ * These IO expander pins are implemented using the
+ * C0/C2 TCPC, so they must be set up after the TCPC has
+ * been taken out of reset.
+ */
+ enable_ioex(IOEX_C0_NCT38XX);
+ enable_ioex(IOEX_C2_NCT38XX);
+ }
+
+ /* Enable PPC interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C2_PPC_INT_ODL);
+
+ /* Enable TCPC interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_C2_TCPC_INT_ODL);
+
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
+}
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
+
+uint16_t tcpc_get_alert_status(void)
+{
+ uint16_t status = 0;
+
+ if (gpio_get_level(GPIO_USB_C0_C2_TCPC_INT_ODL) == 0)
+ status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_2;
+
+ if (gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL) == 0)
+ status |= PD_STATUS_TCPC_ALERT_1;
+
+ return status;
+}
+
+int ppc_get_alert_status(int port)
+{
+ if (port == USBC_PORT_C0)
+ return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0;
+ else if (port == USBC_PORT_C1)
+ return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0;
+ else if (port == USBC_PORT_C2)
+ return gpio_get_level(GPIO_USB_C2_PPC_INT_ODL) == 0;
+ return 0;
+}
+
+void tcpc_alert_event(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C0_C2_TCPC_INT_ODL:
+ schedule_deferred_pd_interrupt(USBC_PORT_C0);
+ break;
+ case GPIO_USB_C1_TCPC_INT_ODL:
+ schedule_deferred_pd_interrupt(USBC_PORT_C1);
+ break;
+ default:
+ break;
+ }
+}
+
+void bc12_interrupt(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C0_BC12_INT_ODL:
+ usb_charger_task_set_event(0, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C1_BC12_INT_ODL:
+ usb_charger_task_set_event(1, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C2_BC12_INT_ODL:
+ usb_charger_task_set_event(2, USB_CHG_EVENT_BC12);
+ break;
+ default:
+ break;
+ }
+}
+
+void ppc_interrupt(enum gpio_signal signal)
+{
+ switch (signal) {
+ case GPIO_USB_C0_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C0);
+ break;
+ case GPIO_USB_C1_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C1);
+ break;
+ case GPIO_USB_C2_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C2);
+ break;
+ default:
+ break;
+ }
+}
+
+void retimer_interrupt(enum gpio_signal signal)
+{
+ /*
+ * TODO(b/179513527): add USB-C support
+ */
+}
+
+__override bool board_is_dts_port(int port)
+{
+ return port == USBC_PORT_C0;
+}
+
+__override bool board_is_tbt_usb4_port(int port)
+{
+ return true;
+}
+
+__override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
+{
+ if (!board_is_tbt_usb4_port(port))
+ return TBT_SS_RES_0;
+
+ return TBT_SS_TBT_GEN3;
+}
diff --git a/board/ghost/usbc_config.h b/board/gaelin/usbc_config.h
index 047d094c6d..5e7beae21a 100644
--- a/board/ghost/usbc_config.h
+++ b/board/gaelin/usbc_config.h
@@ -1,22 +1,19 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-/* Ghost board-specific USB-C configuration */
+/* Brya board-specific USB-C configuration */
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#include "baseboard_usbc_config.h"
-
-#ifndef CONFIG_ZEPHYR
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#endif
+#define CONFIG_USB_PD_PORT_MAX_COUNT 3
enum usbc_port {
USBC_PORT_C0 = 0,
USBC_PORT_C1,
+ USBC_PORT_C2,
USBC_PORT_COUNT
};
diff --git a/board/ghost/vif_override.xml b/board/gaelin/vif_override.xml
index 32736caf64..32736caf64 100644
--- a/board/ghost/vif_override.xml
+++ b/board/gaelin/vif_override.xml
diff --git a/board/galtic/battery.c b/board/galtic/battery.c
index df23027815..10fc273303 100644
--- a/board/galtic/battery.c
+++ b/board/galtic/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/galtic/board.c b/board/galtic/board.c
index 727e31508e..af0638be20 100644
--- a/board/galtic/board.c
+++ b/board/galtic/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -47,8 +47,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -131,34 +131,26 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -218,40 +210,31 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Retimer */
-enum tusb544_conf {
- USB_DP = 0,
- USB_DP_INV,
- USB,
- USB_INV,
- DP,
- DP_INV
-};
+enum tusb544_conf { USB_DP = 0, USB_DP_INV, USB, USB_INV, DP, DP_INV };
-static int board_tusb544_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
{
- int rv = EC_SUCCESS;
+ int rv = EC_SUCCESS;
enum tusb544_conf usb_mode = 0;
/* USB */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* USB with DP */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_DP_INV
- : USB_DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_DP_INV :
+ USB_DP;
}
/* USB without DP */
else {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_INV
- : USB;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_INV :
+ USB;
}
}
/* DP without USB */
else if (mux_state & USB_PD_MUX_DP_ENABLED) {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? DP_INV
- : DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? DP_INV :
+ DP;
}
/* Nothing enabled */
else
@@ -320,11 +303,9 @@ static int board_tusb544_set(const struct usb_mux *me,
return rv;
}
-static int board_ps8743_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
- return ps8743_write(me, PS8743_REG_USB_EQ_RX,
- PS8743_USB_EQ_RX_16_7_DB);
+ return ps8743_write(me, PS8743_REG_USB_EQ_RX, PS8743_USB_EQ_RX_16_7_DB);
}
const struct usb_mux usbc1_retimer = {
@@ -341,20 +322,31 @@ const struct usb_mux usbc1_virtual_mux_ps8743 = {
.hpd_update = &virtual_hpd_update,
};
+struct usb_mux usbc1_mux0_data = {
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+};
+
+struct usb_mux_chain usbc1_mux1 = {
+ .mux = &usbc1_retimer,
+};
+
/* USB Muxes */
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux = &usbc1_mux0_data,
+ .next = &usbc1_mux1,
},
};
@@ -392,8 +384,8 @@ static const struct ec_response_keybd_config galtic_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (get_cbi_fw_config_numeric_pad() == NUMERIC_PAD_PRESENT)
return &galith_kb;
@@ -442,10 +434,10 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void setup_mux_config(void)
{
if (get_cbi_ssfc_mux_redriver() == SSFC_MUX_PS8743) {
- usb_muxes[1].i2c_addr_flags = PS8743_I2C_ADDR1_FLAG;
- usb_muxes[1].driver = &ps8743_usb_mux_driver;
- usb_muxes[1].next_mux = &usbc1_virtual_mux_ps8743;
- usb_muxes[1].board_set = &board_ps8743_mux_set;
+ usbc1_mux0_data.i2c_addr_flags = PS8743_I2C_ADDR1_FLAG;
+ usbc1_mux0_data.driver = &ps8743_usb_mux_driver;
+ usbc1_mux1.mux = &usbc1_virtual_mux_ps8743;
+ usbc1_mux0_data.board_set = &board_ps8743_mux_set;
}
}
DECLARE_HOOK(HOOK_INIT, setup_mux_config, HOOK_PRIO_INIT_I2C + 2);
@@ -532,8 +524,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -595,12 +586,10 @@ int board_set_active_charge_port(int port)
charger_discharge_on_ac(0);
return EC_SUCCESS;
-
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -634,27 +623,21 @@ static struct mutex g_base_mutex;
/* Sensor Data */
static struct accelgyro_saved_data_t g_bma253_data;
-static struct kionix_accel_data g_kx022_data;
+static struct kionix_accel_data g_kx022_data;
static struct bmi_drv_data_t g_bmi160_data;
static struct icm_drv_data_t g_icm426xx_data;
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref_icm = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_icm = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref_bmi = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_bmi = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t bma253_lid_accel = {
.name = "Lid Accel",
@@ -826,26 +809,26 @@ DECLARE_HOOK(HOOK_INIT, board_sensors_init, HOOK_PRIO_DEFAULT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Vcore",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Vcore",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(98), \
@@ -859,8 +842,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_VCORE \
- { \
+#define THERMAL_VCORE \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -874,8 +857,8 @@ __maybe_unused static const struct ec_thermal_config thermal_vcore =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_AMBIENT \
- { \
+#define THERMAL_AMBIENT \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -941,8 +924,8 @@ static void get_battery_cell(void)
{
int val;
- if (i2c_read16(I2C_PORT_USB_C0, ISL923X_ADDR_FLAGS,
- ISL9238_REG_INFO2, &val) == EC_SUCCESS) {
+ if (i2c_read16(I2C_PORT_USB_C0, ISL923X_ADDR_FLAGS, ISL9238_REG_INFO2,
+ &val) == EC_SUCCESS) {
/* PROG resistor read out. Number of battery cells [4:0] */
val = val & 0x001f;
}
@@ -958,7 +941,7 @@ static void get_battery_cell(void)
CPRINTS("Get battery cells: %d", battery_cell);
}
-DECLARE_HOOK(HOOK_INIT, get_battery_cell, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, get_battery_cell, HOOK_PRIO_INIT_I2C + 1);
enum battery_cell_type board_get_battery_cell_type(void)
{
diff --git a/board/galtic/board.h b/board/galtic/board.h
index 50f9fdca9c..cfed23b359 100644
--- a/board/galtic/board.h
+++ b/board/galtic/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,12 +22,15 @@
#define CONFIG_BC12_DETECT_PI3USB9201
/* Charger */
-#define CONFIG_CHARGER_RAA489000 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_RAA489000 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -35,19 +38,19 @@
/* LED */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* PWM */
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_BMI_COMM_I2C
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel */
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_ICM_COMM_I2C
@@ -86,11 +89,11 @@
#define CONFIG_THROTTLE_AP
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define CONFIG_USB_MUX_PS8743 /* C1: PS8743 Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define CONFIG_USB_MUX_PS8743 /* C1: PS8743 Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
-#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
+#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
#define CONFIG_USB_MUX_RUNTIME_CONFIG
#define CONFIG_USB_MUX_VIRTUAL
@@ -116,19 +119,14 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
ADC_CH_COUNT
};
diff --git a/board/galtic/build.mk b/board/galtic/build.mk
index 806168ea0d..9b862c7624 100644
--- a/board/galtic/build.mk
+++ b/board/galtic/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/galtic/cbi_ssfc.c b/board/galtic/cbi_ssfc.c
index c760f37573..7a7ed9f7cf 100644
--- a/board/galtic/cbi_ssfc.c
+++ b/board/galtic/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,15 +27,15 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
enum ec_ssfc_mux_redriver get_cbi_ssfc_mux_redriver(void)
{
- return (enum ec_ssfc_mux_redriver) cached_ssfc.mux_redriver;
+ return (enum ec_ssfc_mux_redriver)cached_ssfc.mux_redriver;
}
diff --git a/board/galtic/cbi_ssfc.h b/board/galtic/cbi_ssfc.h
index 686dcb4d47..84f321977e 100644
--- a/board/galtic/cbi_ssfc.h
+++ b/board/galtic/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,7 +37,7 @@ enum ec_ssfc_lid_sensor {
* Mux Redriver (Bit 6)
*/
enum ec_ssfc_mux_redriver {
- SSFC_MUX_DEFAULT = 0, /* IT5205 + TUSB544 */
+ SSFC_MUX_DEFAULT = 0, /* IT5205 + TUSB544 */
SSFC_MUX_PS8743 = 1,
};
diff --git a/board/galtic/ec.tasklist b/board/galtic/ec.tasklist
index 762325a825..bc2fea6148 100644
--- a/board/galtic/ec.tasklist
+++ b/board/galtic/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/galtic/gpio.inc b/board/galtic/gpio.inc
index bd8787acb3..721a193f36 100644
--- a/board/galtic/gpio.inc
+++ b/board/galtic/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/galtic/led.c b/board/galtic/led.c
index ecd40dc973..1438ccd91a 100644
--- a/board/galtic/led.c
+++ b/board/galtic/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,28 +9,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {LED_OFF, 2 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { LED_OFF, 2 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/galtic/usb_pd_policy.c b/board/galtic/usb_pd_policy.c
index 3190595596..23166f7fca 100644
--- a/board/galtic/usb_pd_policy.c
+++ b/board/galtic/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/garg/battery.c b/board/garg/battery.c
index ac65572d09..5706344191 100644
--- a/board/garg/battery.c
+++ b/board/garg/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/garg/board.c b/board/garg/board.c
index de55f33c6a..60365a6312 100644
--- a/board/garg/board.c
+++ b/board/garg/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,11 +44,11 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -58,17 +58,16 @@ static uint8_t sku_id;
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -91,31 +90,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -125,24 +124,17 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-
-const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_bmi260_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
+static const mat33_fp_t base_bmi260_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -256,20 +248,20 @@ struct motion_sensor_t icm426xx_base_accel = {
};
struct motion_sensor_t icm426xx_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_icm_ref,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm426xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm426xx_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_icm_ref,
+ .min_frequency = ICM426XX_GYRO_MIN_FREQ,
+ .max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
struct motion_sensor_t bmi260_base_accel = {
@@ -318,7 +310,6 @@ struct motion_sensor_t bmi260_base_gyro = {
.max_frequency = BMI_GYRO_MAX_FREQ,
};
-
static int board_is_convertible(void)
{
/*
@@ -389,8 +380,8 @@ void board_hibernate_late(void)
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
diff --git a/board/garg/board.h b/board/garg/board.h
index 638c8c93a0..23f44b469e 100644
--- a/board/garg/board.h
+++ b/board/garg/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,6 +10,7 @@
/* Free up flash space */
#define CONFIG_LTO
+#undef CONFIG_CMD_BATTFAKE
/* Select Baseboard features */
#define VARIANT_OCTOPUS_EC_NPCX796FB
@@ -19,16 +20,16 @@
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* I2C bus configuraiton */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define CONFIG_LED_COMMON
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCELGYRO_BMI260 /* 3rd Base accel */
-#define CONFIG_ACCELGYRO_ICM426XX /* 2nd Base accel */
-#define CONFIG_SYNC /* Camera VSYNC */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_BMI260 /* 3rd Base accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* 2nd Base accel */
+#define CONFIG_SYNC /* Camera VSYNC */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
@@ -42,8 +43,7 @@
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -68,10 +68,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -83,13 +83,7 @@ enum temp_sensor_id {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- VSYNC,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, VSYNC, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/garg/build.mk b/board/garg/build.mk
index 137e208b53..fee77e38b5 100644
--- a/board/garg/build.mk
+++ b/board/garg/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/garg/ec.tasklist b/board/garg/ec.tasklist
index 6eac78a042..6c56976091 100644
--- a/board/garg/ec.tasklist
+++ b/board/garg/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/garg/gpio.inc b/board/garg/gpio.inc
index 995986d600..57feead408 100644
--- a/board/garg/gpio.inc
+++ b/board/garg/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/garg/led.c b/board/garg/led.c
index bc77efe9b9..eff8c1307b 100644
--- a/board/garg/led.c
+++ b/board/garg/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -19,18 +19,24 @@ __override const int led_charge_lvl_2 = 100;
/* Garg: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/gelarshie/base_detect.c b/board/gelarshie/base_detect.c
index a5bbca427b..e045e9ea4f 100644
--- a/board/gelarshie/base_detect.c
+++ b/board/gelarshie/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Base detection and debouncing */
#define BASE_DETECT_EN_DEBOUNCE_US (350 * MSEC)
@@ -93,8 +93,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -144,12 +144,12 @@ void base_detect_interrupt(enum gpio_signal signal)
{
uint64_t time_now = get_time().val;
int debounce_us;
-
+
if (detect_pin_connected(signal))
debounce_us = BASE_DETECT_EN_DEBOUNCE_US;
- else
+ else
debounce_us = BASE_DETECT_DIS_DEBOUNCE_US;
-
+
if (base_detect_debounce_time <= time_now) {
/*
* Detect and measure detection pin pulse, when base is
@@ -211,7 +211,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/gelarshie/battery.c b/board/gelarshie/battery.c
index 45934366b7..da96b773f8 100644
--- a/board/gelarshie/battery.c
+++ b/board/gelarshie/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/gelarshie/board.c b/board/gelarshie/board.c
index b16e2f823f..11346a3c7d 100644
--- a/board/gelarshie/board.c
+++ b/board/gelarshie/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,10 +37,10 @@
#include "task.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
+#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -149,8 +149,7 @@ static void ks_change_deferred(void)
proximity_detected = !(ks_attached && ks_open);
CPRINTS("ks %s %s -> proximity %s",
ks_attached ? "attached" : "detached",
- ks_open ? "open" : "close",
- proximity_detected ? "on" : "off");
+ ks_open ? "open" : "close", proximity_detected ? "on" : "off");
debounced_ks_attached = ks_attached;
debounced_ks_open = ks_open;
@@ -172,41 +171,31 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -214,45 +203,25 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
/* Base detection */
- [ADC_BASE_DET] = {
- "BASE_DET",
- NPCX_ADC_CH5,
- ADC_MAX_VOLT,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH5, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -270,16 +239,12 @@ const struct ln9310_config_t ln9310_config = {
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -310,16 +275,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -344,11 +315,9 @@ static struct bmi_drv_data_t g_bmi260_data;
bool is_bmi260_present;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -451,8 +420,8 @@ static void board_detect_motionsensor(void)
/* Check base accelgyro chip */
bmi_read8(motion_sensors[LID_ACCEL].port,
- motion_sensors[LID_ACCEL].i2c_spi_addr_flags,
- BMI260_CHIP_ID, &val);
+ motion_sensors[LID_ACCEL].i2c_spi_addr_flags, BMI260_CHIP_ID,
+ &val);
if (val == BMI260_CHIP_ID_MAJOR) {
motion_sensors[LID_ACCEL] = motion_sensors_260[LID_ACCEL];
motion_sensors[LID_GYRO] = motion_sensors_260[LID_GYRO];
@@ -553,9 +522,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
void board_hibernate(void)
{
@@ -565,8 +534,7 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 1+ has the hardware fix. Don't need the following
@@ -663,8 +631,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -692,7 +659,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -716,24 +682,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/gelarshie/board.h b/board/gelarshie/board.h
index 45b8c42dcc..7e27c7a62f 100644
--- a/board/gelarshie/board.h
+++ b/board/gelarshie/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
/* On-body detection */
#define CONFIG_BODY_DETECTION
-#define CONFIG_BODY_DETECTION_SENSOR LID_ACCEL
+#define CONFIG_BODY_DETECTION_SENSOR LID_ACCEL
#define CONFIG_BODY_DETECTION_VAR_NOISE_FACTOR 150 /* % */
#define CONFIG_GESTURE_DETECTION
#define CONFIG_GESTURE_DETECTION_MASK BIT(CONFIG_BODY_DETECTION_SENSOR)
@@ -21,7 +21,7 @@
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Switchcap */
#define CONFIG_LN9310
@@ -37,7 +37,7 @@
#undef CONFIG_CMD_TASK_RESET
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -103,10 +103,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_DISPLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_DISPLIGHT = 0, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/gelarshie/build.mk b/board/gelarshie/build.mk
index 84616b4e1c..5b0f734fda 100644
--- a/board/gelarshie/build.mk
+++ b/board/gelarshie/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/gelarshie/ec.tasklist b/board/gelarshie/ec.tasklist
index 0d861dda25..7d193fecf3 100644
--- a/board/gelarshie/ec.tasklist
+++ b/board/gelarshie/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gelarshie/gpio.inc b/board/gelarshie/gpio.inc
index cb0f842102..189a9657a6 100644
--- a/board/gelarshie/gpio.inc
+++ b/board/gelarshie/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gelarshie/led.c b/board/gelarshie/led.c
index 0a6c85be6d..e401787f7f 100644
--- a/board/gelarshie/led.c
+++ b/board/gelarshie/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -35,15 +35,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_W_C0,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -69,7 +69,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -84,16 +83,15 @@ static void board_led_set_battery(void)
period = (1 + 1) * LED_ONE_SEC;
battery_ticks = battery_ticks % period;
if (battery_ticks < 1 * LED_ONE_SEC) {
- if (charge_get_percent() < 10)
- {
- /* Blink amber light (1 sec on, 1 sec off) */
+ if (charge_get_percent() < 10) {
+ /* Blink amber light (1 sec on, 1 sec
+ * off) */
color = LED_AMBER;
- }
- else
- {
- /* Blink white light (1 sec on, 1 sec off) */
+ } else {
+ /* Blink white light (1 sec on, 1 sec
+ * off) */
color = LED_BLUE;
- }
+ }
} else {
color = LED_OFF;
}
@@ -138,16 +136,16 @@ static void board_led_set_battery(void)
}
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Amber 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_AMBER;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Amber 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/gelarshie/usbc_config.c b/board/gelarshie/usbc_config.c
index 86a2f4663f..7389f8cb52 100644
--- a/board/gelarshie/usbc_config.c
+++ b/board/gelarshie/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "gpio.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/genesis/board.c b/board/genesis/board.c
index 5305c8d630..5c3f1c5c00 100644
--- a/board/genesis/board.c
+++ b/board/genesis/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,8 +36,8 @@
#include "usb_common.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -49,14 +49,14 @@ static int32_t base_5v_power;
* Power usage for each port as measured or estimated.
* Units are milliwatts (5v x ma current)
*/
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1500)
-#define PWR_FRONT_LOW (5*900)
-#define PWR_REAR (5*1500)
-#define PWR_HDMI (5*562)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
+#define PWR_BASE_LOAD (5 * 1335)
+#define PWR_FRONT_HIGH (5 * 1500)
+#define PWR_FRONT_LOW (5 * 900)
+#define PWR_REAR (5 * 1500)
+#define PWR_HDMI (5 * 562)
+#define PWR_C_HIGH (5 * 3740)
+#define PWR_C_LOW (5 * 2090)
+#define PWR_MAX (5 * 10000)
/*
* Update the 5V power usage, assuming no throttling,
@@ -112,69 +112,56 @@ static void port_ocp_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_WHITE] = { .channel = 2,
- .flags = PWM_CONFIG_DSLEEP,
- .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_LED_WHITE] = { .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "ina",
- .port = I2C_PORT_INA,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "ppc0",
- .port = I2C_PORT_PPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "pse",
- .port = I2C_PORT_PSE,
- .kbps = 400,
- .scl = GPIO_I2C4_SCL,
- .sda = GPIO_I2C4_SDA
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 400,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "pse",
+ .port = I2C_PORT_PSE,
+ .kbps = 400,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C4_SDA },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -230,15 +217,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
+const enum gpio_signal hibernate_wake_pins[] = {};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -257,7 +243,7 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -266,8 +252,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
@@ -420,23 +406,23 @@ void board_enable_s0_rails(int enable)
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
+#define THROT_TYPE_A BIT(0)
+#define THROT_TYPE_C BIT(1)
+#define THROT_PROCHOT BIT(2)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -449,8 +435,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
diff --git a/board/genesis/board.h b/board/genesis/board.h
index 9c9233590e..41de23b6a8 100644
--- a/board/genesis/board.h
+++ b/board/genesis/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
#define CONFIG_UART_TX_BUF_SIZE 4096
/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
/* Internal SPI flash on NPCX796FC is 512 kB */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
@@ -40,7 +40,7 @@
#undef CONFIG_HIBERNATE
#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
#define CONFIG_PWM
#define CONFIG_VBOOT_EFS2
@@ -118,13 +118,13 @@
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_PSE NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_INA NPCX_I2C_PORT0_0
+#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
+#define I2C_PORT_PSE NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
@@ -134,11 +134,11 @@
#include "registers.h"
enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_SNS_PP3300, /* ADC2 */
+ ADC_SNS_PP1050, /* ADC7 */
+ ADC_VBUS, /* ADC4 */
+ ADC_PPVAR_IMON, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
/* Number of ADC channels */
ADC_CH_COUNT
};
@@ -163,11 +163,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_CORE,
- TEMP_SENSOR_COUNT
-};
-
+enum temp_sensor_id { TEMP_SENSOR_CORE, TEMP_SENSOR_COUNT };
/* Board specific handlers */
void led_alert(int enable);
@@ -179,20 +175,20 @@ void show_critical_error(void);
/*
* Barrel-jack power (4 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 3
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
/*
* USB Connector 4 not present (1 bit).
*/
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
+#define EC_CFG_NO_USB4_L 4
+#define EC_CFG_NO_USB4_H 4
#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
/*
* Thermal solution config (3 bits).
*/
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
+#define EC_CFG_THERMAL_L 5
+#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
unsigned int ec_config_get_thermal_solution(void);
@@ -200,30 +196,30 @@ unsigned int ec_config_get_thermal_solution(void);
#endif /* !__ASSEMBLER__ */
/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
/*
* There is no RSMRST input, so alias it to the output. This short-circuits
* common_intel_x86_handle_rsmrst.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/genesis/build.mk b/board/genesis/build.mk
index 2785133e11..50d3763d2b 100644
--- a/board/genesis/build.mk
+++ b/board/genesis/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/genesis/ec.tasklist b/board/genesis/ec.tasklist
index 3828142c55..c43d643410 100644
--- a/board/genesis/ec.tasklist
+++ b/board/genesis/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/genesis/gpio.inc b/board/genesis/gpio.inc
index d8f2989b8e..7d2c33c5a9 100644
--- a/board/genesis/gpio.inc
+++ b/board/genesis/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
/* EC output, but also interrupt so this can be polled as a power signal */
GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
#endif
GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/genesis/led.c b/board/genesis/led.c
index c562dff27e..9258b6eb6d 100644
--- a/board/genesis/led.c
+++ b/board/genesis/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -89,9 +89,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -223,7 +223,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
diff --git a/board/genesis/pse.c b/board/genesis/pse.c
index 671288ccf5..bda7e1994d 100644
--- a/board/genesis/pse.c
+++ b/board/genesis/pse.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,44 +18,44 @@
#include "timer.h"
#include "util.h"
-#define LTC4291_I2C_ADDR 0x2C
-
-#define LTC4291_REG_SUPEVN_COR 0x0B
-#define LTC4291_REG_STATPWR 0x10
-#define LTC4291_REG_STATPIN 0x11
-#define LTC4291_REG_OPMD 0x12
-#define LTC4291_REG_DISENA 0x13
-#define LTC4291_REG_DETENA 0x14
-#define LTC4291_REG_DETPB 0x18
-#define LTC4291_REG_PWRPB 0x19
-#define LTC4291_REG_RSTPB 0x1A
-#define LTC4291_REG_ID 0x1B
-#define LTC4291_REG_DEVID 0x43
-#define LTC4291_REG_HPMD1 0x46
-#define LTC4291_REG_HPMD2 0x4B
-#define LTC4291_REG_HPMD3 0x50
-#define LTC4291_REG_HPMD4 0x55
-#define LTC4291_REG_LPWRPB 0x6E
-
-#define LTC4291_FLD_STATPIN_AUTO BIT(0)
-#define LTC4291_FLD_RSTPB_RSTALL BIT(4)
-
-#define LTC4291_STATPWR_ON_PORT(port) (0x01 << (port))
-#define LTC4291_DETENA_EN_PORT(port) (0x11 << (port))
-#define LTC4291_DETPB_EN_PORT(port) (0x11 << (port))
-#define LTC4291_PWRPB_OFF_PORT(port) (0x10 << (port))
-
-#define LTC4291_OPMD_AUTO 0xFF
-#define LTC4291_DISENA_ALL 0x0F
-#define LTC4291_DETENA_ALL 0xFF
-#define LTC4291_ID 0x64
-#define LTC4291_DEVID 0x38
-#define LTC4291_HPMD_MIN 0x00
-#define LTC4291_HPMD_MAX 0xA8
-
-#define LTC4291_PORT_MAX 4
-
-#define LTC4291_RESET_DELAY_US (20 * MSEC)
+#define LTC4291_I2C_ADDR 0x2C
+
+#define LTC4291_REG_SUPEVN_COR 0x0B
+#define LTC4291_REG_STATPWR 0x10
+#define LTC4291_REG_STATPIN 0x11
+#define LTC4291_REG_OPMD 0x12
+#define LTC4291_REG_DISENA 0x13
+#define LTC4291_REG_DETENA 0x14
+#define LTC4291_REG_DETPB 0x18
+#define LTC4291_REG_PWRPB 0x19
+#define LTC4291_REG_RSTPB 0x1A
+#define LTC4291_REG_ID 0x1B
+#define LTC4291_REG_DEVID 0x43
+#define LTC4291_REG_HPMD1 0x46
+#define LTC4291_REG_HPMD2 0x4B
+#define LTC4291_REG_HPMD3 0x50
+#define LTC4291_REG_HPMD4 0x55
+#define LTC4291_REG_LPWRPB 0x6E
+
+#define LTC4291_FLD_STATPIN_AUTO BIT(0)
+#define LTC4291_FLD_RSTPB_RSTALL BIT(4)
+
+#define LTC4291_STATPWR_ON_PORT(port) (0x01 << (port))
+#define LTC4291_DETENA_EN_PORT(port) (0x11 << (port))
+#define LTC4291_DETPB_EN_PORT(port) (0x11 << (port))
+#define LTC4291_PWRPB_OFF_PORT(port) (0x10 << (port))
+
+#define LTC4291_OPMD_AUTO 0xFF
+#define LTC4291_DISENA_ALL 0x0F
+#define LTC4291_DETENA_ALL 0xFF
+#define LTC4291_ID 0x64
+#define LTC4291_DEVID 0x38
+#define LTC4291_HPMD_MIN 0x00
+#define LTC4291_HPMD_MAX 0xA8
+
+#define LTC4291_PORT_MAX 4
+
+#define LTC4291_RESET_DELAY_US (20 * MSEC)
#define I2C_PSE_READ(reg, data) \
i2c_read8(I2C_PORT_PSE, LTC4291_I2C_ADDR, LTC4291_REG_##reg, (data))
@@ -63,7 +63,7 @@
#define I2C_PSE_WRITE(reg, data) \
i2c_write8(I2C_PORT_PSE, LTC4291_I2C_ADDR, LTC4291_REG_##reg, (data))
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static int pse_write_hpmd(int port, int val)
{
@@ -173,7 +173,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, pse_init, HOOK_PRIO_DEFAULT);
/* Also reset the PSE on a reboot to toggle the power. */
DECLARE_HOOK(HOOK_CHIPSET_RESET, pse_init, HOOK_PRIO_DEFAULT);
-static int command_pse(int argc, char **argv)
+static int command_pse(int argc, const char **argv)
{
int port;
@@ -205,8 +205,7 @@ static int command_pse(int argc, char **argv)
else
return EC_ERROR_PARAM2;
}
-DECLARE_CONSOLE_COMMAND(pse, command_pse,
- "<port# 0-3> <off | on | min | max>",
+DECLARE_CONSOLE_COMMAND(pse, command_pse, "<port# 0-3> <off | on | min | max>",
"Set PSE port power");
static int ec_command_pse_status(int port, uint8_t *status)
diff --git a/board/ghost/battery.c b/board/ghost/battery.c
deleted file mode 100644
index 50086b6c86..0000000000
--- a/board/ghost/battery.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Battery pack vendor provided charging profile
- */
-
-#include "battery.h"
-#include "battery_fuel_gauge.h"
-#include "common.h"
-#include "compile_time_macros.h"
-#include "gpio.h"
-#include "gpio_signal.h"
-
-/*
- * Battery info for all Ghost battery types. Note that the fields
- * start_charging_min/max and charging_min/max are not used for the charger.
- * The effective temperature limits are given by discharging_min/max_c.
- *
- * Fuel Gauge (FG) parameters which are used for determining if the battery
- * is connected, the appropriate ship mode (battery cutoff) command, and the
- * charge/discharge FETs status.
- *
- * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery
- * register. For some batteries, the charge/discharge FET bits are set when
- * charging/discharging is active, in other types, these bits set mean that
- * charging/discharging is disabled. Therefore, in addition to the mask for
- * these bits, a disconnect value must be specified. Note that for TI fuel
- * gauge, the charge/discharge FET status is found in Operation Status (0x54),
- * but a read of Manufacturer Access (0x00) will return the lower 16 bits of
- * Operation status which contains the FET status bits.
- *
- * The assumption for battery types supported is that the charge/discharge FET
- * status can be read with a sb_read() command and therefore, only the register
- * address, mask, and disconnect value need to be provided.
- */
-const struct board_batt_params board_battery_info[] = {
- /* POW-TECH GQA05 Battery Information */
- [BATTERY_POWER_TECH] = {
- /* BQ40Z50 Fuel Gauge */
- .fuel_gauge = {
- .manuf_name = "POW-TECH",
- .device_name = "BATGQA05L22",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x00,
- .reg_mask = 0x2000, /* XDSG */
- .disconnect_val = 0x2000,
- }
- },
- .batt_info = {
- .voltage_max = TARGET_WITH_MARGIN(13050, 5),
- .voltage_normal = 11400, /* mV */
- .voltage_min = 9000, /* mV */
- .precharge_current = 280, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
- /*
- * TODO(b/233120385): verify these
- */
- [BATTERY_SWD_ATL] = {
- /* BQ40Z50-R3 Fuel Gauge */
- .fuel_gauge = {
- .manuf_name = "SWD",
- .device_name = "1163985013",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x00,
- .reg_mask = 0x2000, /* XDSG */
- .disconnect_val = 0x2000,
- }
- },
- .batt_info = {
- .voltage_max = TARGET_WITH_MARGIN(8960, 5),
- .voltage_normal = 7780, /* mV */
- .voltage_min = 6000, /* mV */
- .precharge_current = 570, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 60,
- .charging_min_c = 0,
- .charging_max_c = 60,
- .discharging_min_c = -20,
- .discharging_max_c = 60,
- },
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_POWER_TECH;
-
-enum battery_present battery_hw_present(void)
-{
- enum gpio_signal batt_pres;
-
- batt_pres = GPIO_EC_BATT_PRES_ODL;
-
- /* The GPIO is low when the battery is physically present */
- return gpio_get_level(batt_pres) ? BP_NO : BP_YES;
-}
diff --git a/board/ghost/board.c b/board/ghost/board.c
deleted file mode 100644
index d156a78975..0000000000
--- a/board/ghost/board.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "gpio.h"
-#include "hooks.h"
-#include "lid_switch.h"
-#include "power_button.h"
-#include "power.h"
-#include "switch.h"
-#include "throttle_ap.h"
-
-#include "gpio_list.h" /* Must come after other header files. */
-
-/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-
-/* Called on AP S3 -> S0 transition */
-static void board_chipset_resume(void)
-{
- /* Allow keyboard backlight to be enabled */
-
- gpio_set_level(GPIO_EC_KB_BL_EN, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
-
-/* Called on AP S0 -> S3 transition */
-static void board_chipset_suspend(void)
-{
- /* Turn off the keyboard backlight if it's on. */
-
- gpio_set_level(GPIO_EC_KB_BL_EN, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
diff --git a/board/ghost/board.h b/board/ghost/board.h
deleted file mode 100644
index 79be17ac2f..0000000000
--- a/board/ghost/board.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Ghost board configuration */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-#include "compile_time_macros.h"
-
-/*
- * Early ghost boards are not set up for vivaldi
- */
-#undef CONFIG_KEYBOARD_VIVALDI
-
-/* Baseboard features */
-#include "baseboard.h"
-
-/*
- * TODO(b/230813416): remove after bringup
- */
-#define CONFIG_BRINGUP
-
-/* Buttons are not supported */
-#undef CONFIG_VOLUME_BUTTONS
-#undef CONFIG_MKBP_INPUT_DEVICES
-
-/* Tablet mode is not supported */
-#undef CONFIG_TABLET_MODE
-#undef CONFIG_TABLET_MODE_SWITCH
-#undef CONFIG_LID_ANGLE
-
-/* BC1.2 is not supported */
-#undef CONFIG_USB_CHARGER
-#undef CONFIG_BC12_SINGLE_DRIVER
-#undef CONFIG_BC12_DETECT_PI3USB9201
-
-#define CONFIG_MP2964
-
-/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
-
-#define CONFIG_IO_EXPANDER
-#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
-
-#define CONFIG_USB_PD_FRS_PPC
-
-#define CONFIG_USBC_RETIMER_INTEL_BB
-
-#define CONFIG_USBC_PPC_SYV682X
-
-/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
-
-/*
- * Passive USB-C cables only support up to 60W.
- */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
-
-/*
- * Macros for GPIO signals used in common code that don't match the
- * schematic names. Signal names in gpio.inc match the schematic and are
- * then redefined here to so it's more clear which signal is being used for
- * which purpose.
- */
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
-
-/*
- * GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
- * signal.
- */
-#define GPIO_IMVP9_VRRDY_OD GPIO_IMVP91_VRRDY_OD
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-
-/* System has back-lit keyboard */
-#define CONFIG_PWM_KBLIGHT
-
-/* I2C Bus Configuration */
-
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-
-#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_RT NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_RT NPCX_I2C_PORT6_1
-
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT5_0
-#define I2C_PORT_MISC NPCX_I2C_PORT7_0
-
-#define I2C_PORT_EEPROM I2C_PORT_MISC
-#define I2C_PORT_MP2964 I2C_PORT_MISC
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-
-#define I2C_ADDR_MP2964_FLAGS 0x20
-
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x57
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
-
-/* Enabling Thunderbolt-compatible mode */
-#define CONFIG_USB_PD_TBT_COMPAT_MODE
-
-/* Enabling USB4 mode */
-#define CONFIG_USB_PD_USB4
-
-/* Retimer */
-#define CONFIG_USBC_RETIMER_FW_UPDATE
-
-/* Thermal features */
-#define CONFIG_THERMISTOR
-#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER
-#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-
-/* Charger defines */
-#define CONFIG_CHARGER_ISL9241
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
-
-#ifndef __ASSEMBLER__
-
-#include "gpio_signal.h" /* needed by registers.h */
-#include "registers.h"
-#include "usbc_config.h"
-
-enum adc_channel {
- ADC_TEMP_SENSOR_1_DDR_SOC,
- ADC_TEMP_SENSOR_2_AMBIENT,
- ADC_TEMP_SENSOR_3_CHARGER,
- ADC_TEMP_SENSOR_4_WWAN,
- ADC_CH_COUNT
-};
-
-enum temp_sensor_id {
- TEMP_SENSOR_1_DDR_SOC,
- TEMP_SENSOR_2_AMBIENT,
- TEMP_SENSOR_3_CHARGER,
- TEMP_SENSOR_4_WWAN,
- TEMP_SENSOR_COUNT
-};
-
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
-
-enum battery_type {
- BATTERY_POWER_TECH,
- BATTERY_SWD_ATL,
- BATTERY_TYPE_COUNT
-};
-
-enum pwm_channel {
- PWM_CH_LED1 = 0, /* PWM0 */
- PWM_CH_LED2, /* PWM1 */
- PWM_CH_FAN2, /* PWM2 */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN1, /* PWM5 */
- PWM_CH_COUNT
-};
-
-#endif /* !__ASSEMBLER__ */
-
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/ghost/charger.c b/board/ghost/charger.c
deleted file mode 100644
index 6e14119a77..0000000000
--- a/board/ghost/charger.c
+++ /dev/null
@@ -1,92 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-
-#include "charge_manager.h"
-#include "charge_state_v2.h"
-#include "charger.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "driver/charger/isl9241.h"
-#include "usbc_ppc.h"
-#include "usb_pd.h"
-#include "util.h"
-
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
-#ifndef CONFIG_ZEPHYR
-/* Charger Chip Configuration */
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_CHARGER,
- .i2c_addr_flags = ISL9241_ADDR_FLAGS,
- .drv = &isl9241_drv,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
-#endif
-
-int board_set_active_charge_port(int port)
-{
- int is_valid_port = board_is_usb_pd_port_present(port);
- int i;
-
- if (port == CHARGE_PORT_NONE) {
- CPRINTSUSB("Disabling all charger ports");
-
- /* Disable all ports. */
- for (i = 0; i < ppc_cnt; i++) {
- /*
- * Do not return early if one fails otherwise we can
- * get into a boot loop assertion failure.
- */
- if (ppc_vbus_sink_enable(i, 0))
- CPRINTSUSB("Disabling C%d as sink failed.", i);
- }
-
- return EC_SUCCESS;
- } else if (!is_valid_port) {
- return EC_ERROR_INVAL;
- }
-
- /* Check if the port is sourcing VBUS. */
- if (ppc_is_sourcing_vbus(port)) {
- CPRINTFUSB("Skip enable C%d", port);
- return EC_ERROR_INVAL;
- }
-
- CPRINTSUSB("New charge port: C%d", port);
-
- /*
- * Turn off the other ports' sink path FETs, before enabling the
- * requested charge port.
- */
- for (i = 0; i < ppc_cnt; i++) {
- if (i == port)
- continue;
-
- if (ppc_vbus_sink_enable(i, 0))
- CPRINTSUSB("C%d: sink path disable failed.", i);
- }
-
- /* Enable requested charge port. */
- if (ppc_vbus_sink_enable(port, 1)) {
- CPRINTSUSB("C%d: sink path enable failed.", port);
- return EC_ERROR_UNKNOWN;
- }
-
- return EC_SUCCESS;
-}
-
-__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
-{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
-}
diff --git a/board/ghost/ec.tasklist b/board/ghost/ec.tasklist
deleted file mode 100644
index 0c79416198..0000000000
--- a/board/ghost/ec.tasklist
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/*
- * See CONFIG_TASK_LIST in config.h for details.
- *
- * USB_CHG_Px tasks must be contiguous (see USB_CHG_PORT_TO_TASK_ID(x)).
- * PD_Cx tasks must be contiguous (see PD_PORT_TO_TASK_ID(x))
- */
-
-#define CONFIG_TASK_LIST \
- TASK_ALWAYS(HOOKS, hook_task, NULL, HOOKS_TASK_STACK_SIZE) \
- TASK_ALWAYS(CHARGER, charger_task, NULL, BASEBOARD_CHARGER_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, BASEBOARD_CHIPSET_TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_MUX, usb_mux_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(HOSTCMD, host_command_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, CONSOLE_TASK_STACK_SIZE) \
- TASK_ALWAYS(POWERBTN, power_button_task, NULL, BASEBOARD_POWERBTN_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, BASEBOARD_PD_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, BASEBOARD_PD_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(1) | BIT(0)), BASEBOARD_PD_INT_TASK_STACK_SIZE)
diff --git a/board/ghost/fans.c b/board/ghost/fans.c
deleted file mode 100644
index 375ea9a669..0000000000
--- a/board/ghost/fans.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/* Physical fans. These are logically separate from pwm_channels. */
-
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "fan_chip.h"
-#include "fan.h"
-#include "hooks.h"
-#include "pwm.h"
-
-#ifndef CONFIG_FANS
-
-/*
- * TODO(b/233126129): use static fan speeds until fan and sensors are
- * tuned. for now, use:
- *
- * AP off: 33%
- * AP on: 50%
- */
-
-static void fan_slow(void)
-{
- const int duty_pct = 33;
-
- ccprints("%s: speed %d%%", __func__, duty_pct);
-
- pwm_enable(PWM_CH_FAN1, 1);
- pwm_set_duty(PWM_CH_FAN1, duty_pct);
- pwm_enable(PWM_CH_FAN2, 1);
- pwm_set_duty(PWM_CH_FAN2, duty_pct);
-}
-
-static void fan_max(void)
-{
- const int duty_pct = 50;
-
- ccprints("%s: speed %d%%", __func__, duty_pct);
-
- pwm_enable(PWM_CH_FAN1, 1);
- pwm_set_duty(PWM_CH_FAN1, duty_pct);
- pwm_enable(PWM_CH_FAN2, 1);
- pwm_set_duty(PWM_CH_FAN2, duty_pct);
-}
-
-DECLARE_HOOK(HOOK_INIT, fan_slow, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, fan_slow, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, fan_slow, HOOK_PRIO_DEFAULT);
-DECLARE_HOOK(HOOK_CHIPSET_RESET, fan_max, HOOK_PRIO_FIRST);
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, fan_max, HOOK_PRIO_DEFAULT);
-
-#endif /* CONFIG_FANS */
diff --git a/board/ghost/fw_config.c b/board/ghost/fw_config.c
deleted file mode 100644
index 4a968caccd..0000000000
--- a/board/ghost/fw_config.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "cbi.h"
-#include "common.h"
-#include "compile_time_macros.h"
-#include "console.h"
-#include "cros_board_info.h"
-#include "fw_config.h"
-
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-
-static union ghost_cbi_fw_config fw_config;
-BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
-
-/*
- * FW_CONFIG defaults for ghost if the CBI.FW_CONFIG data is not
- * initialized.
- */
-static const union ghost_cbi_fw_config fw_config_defaults = {
- .kb_bl = KEYBOARD_BACKLIGHT_ENABLED,
-};
-
-/****************************************************************************
- * Ghost FW_CONFIG access
- */
-void board_init_fw_config(void)
-{
- if (cbi_get_fw_config(&fw_config.raw_value)) {
- CPRINTS("CBI: Read FW_CONFIG failed, using board defaults");
- fw_config = fw_config_defaults;
- }
-}
-
-union ghost_cbi_fw_config get_fw_config(void)
-{
- return fw_config;
-}
diff --git a/board/ghost/fw_config.h b/board/ghost/fw_config.h
deleted file mode 100644
index df2ceae238..0000000000
--- a/board/ghost/fw_config.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef __BOARD_GHOST_FW_CONFIG_H_
-#define __BOARD_GHOST_FW_CONFIG_H_
-
-#include <stdint.h>
-
-/*
- * TODO(b/233319598): what needs to go into FW_CONFIG
- *
- * CBI FW_CONFIG layout for Ghost board.
- *
- * Source of truth is the project/brya/brya/config.star configuration file.
- */
-
-enum ec_cfg_keyboard_backlight_type {
- KEYBOARD_BACKLIGHT_DISABLED = 0,
- KEYBOARD_BACKLIGHT_ENABLED = 1
-};
-
-union ghost_cbi_fw_config {
- struct {
- uint32_t reserved_1 : 4;
- uint32_t sd_db : 2;
- uint32_t lte_db : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_2 : 21;
- };
- uint32_t raw_value;
-};
-
-/**
- * Read the cached FW_CONFIG. Guaranteed to have valid values.
- *
- * @return the FW_CONFIG for the board.
- */
-union ghost_cbi_fw_config get_fw_config(void);
-
-/**
- * Get the USB daughter board type from FW_CONFIG.
- *
- * @return the USB daughter board type.
- */
-enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void);
-
-#endif /* __BOARD_GHOST_FW_CONFIG_H_ */
diff --git a/board/ghost/generated-gpio.inc b/board/ghost/generated-gpio.inc
deleted file mode 100644
index 593eb21dec..0000000000
--- a/board/ghost/generated-gpio.inc
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * This file was auto-generated.
- */
-
-/* INTERRUPT GPIOs: */
-GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, extpower_interrupt)
-GPIO_INT(EC_PROCHOT_IN_L, PIN(F, 0), GPIO_INT_BOTH, throttle_ap_prochot_input_interrupt)
-GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(GSC_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH | GPIO_HIB_WAKE_LOW, power_button_interrupt)
-GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, lid_interrupt)
-GPIO_INT(SEQ_EC_ALL_SYS_PG, PIN(F, 4), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(SEQ_EC_DSW_PWROK, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(SEQ_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(USB_C0_C1_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
-GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C0_RT_INT_ODL, PIN(B, 1), GPIO_INT_FALLING, retimer_interrupt)
-GPIO_INT(USB_C1_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C1_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt)
-
-/* USED GPIOs: */
-GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
-GPIO(CHARGER_INT_ODL, PIN(7, 3), GPIO_INPUT)
-GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT)
-GPIO(EC_ALS_RGB_INT_R_L, PIN(D, 4), GPIO_INPUT)
-GPIO(EC_BATT_PRES_ODL, PIN(A, 3), GPIO_INPUT)
-GPIO(EC_ENTERING_RW, PIN(0, 3), GPIO_OUT_LOW)
-GPIO(EC_EN_EDP_BL, PIN(8, 3), GPIO_OUT_HIGH)
-GPIO(EC_GSC_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW)
-GPIO(EC_I2C_BAT_SCL, PIN(3, 3), GPIO_INPUT)
-GPIO(EC_I2C_BAT_SDA, PIN(3, 6), GPIO_INPUT)
-GPIO(EC_I2C_MISC_SCL_R, PIN(B, 3), GPIO_INPUT)
-GPIO(EC_I2C_MISC_SDA_R, PIN(B, 2), GPIO_INPUT)
-GPIO(EC_I2C_SENSOR_SCL, PIN(B, 5), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO(EC_I2C_SENSOR_SDA, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO(EC_I2C_USB_C0_C1_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C1_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C1_TCPC_SCL, PIN(9, 0), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C1_TCPC_SDA, PIN(8, 7), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_RT_SCL, PIN(D, 1), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_RT_SDA, PIN(D, 0), GPIO_INPUT)
-GPIO(EC_I2C_USB_C1_RT_SCL, PIN(E, 4), GPIO_INPUT)
-GPIO(EC_I2C_USB_C1_RT_SDA, PIN(E, 3), GPIO_INPUT)
-GPIO(EC_KB_BL_EN, PIN(F, 5), GPIO_OUT_HIGH)
-GPIO(EC_PCHHOT_ODL, PIN(7, 4), GPIO_INPUT)
-GPIO(EC_PCH_INT_ODL, PIN(B, 0), GPIO_ODR_HIGH)
-GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUT_LOW)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
-GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
-GPIO(EC_PCH_WAKE_R_ODL, PIN(C, 0), GPIO_ODR_HIGH)
-GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
-GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH)
-GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW)
-GPIO(FAN_TACH2, PIN(D, 3), GPIO_INPUT)
-GPIO(GLOGO_EN, PIN(D, 7), GPIO_OUT_LOW)
-GPIO(IMVP91_VRRDY_OD, PIN(4, 3), GPIO_INPUT)
-GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
-GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
-GPIO(USB_C0_C1_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
-GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
-
-/* UART alternate functions */
-ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
-
-/* I2C alternate functions */
-ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* GPIO33/I2C5_SCL0/CTS_L, GPIO36/RTS_L/I2C5_SDA0 */
-ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* GPIO87/I2C1_SDA0 */
-ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* GPIO92/I2C2_SCL0, GPIO91/I2C2_SDA0, GPIO90/I2C1_SCL0 */
-ALTERNATE(PIN_MASK(B, 0x0c), 0, MODULE_I2C, 0) /* GPIOB3/I2C7_SCL0/DCD_L, GPIOB2/I2C7_SDA0/DSR_L */
-ALTERNATE(PIN_MASK(B, 0x30), 0, MODULE_I2C, GPIO_SEL_1P8V) /* GPIOB5/I2C0_SCL0, GPIOB4/I2C0_SDA0 */
-ALTERNATE(PIN_MASK(D, 0x03), 0, MODULE_I2C, 0) /* GPIOD1/I2C3_SCL0, GPIOD0/I2C3_SDA0 */
-ALTERNATE(PIN_MASK(E, 0x18), 0, MODULE_I2C, 0) /* GPIOE4/I2C6_SCL1/I3C_SCL, GPIOE3/I2C6_SDA1/I3C_SDA */
-
-/* PWM alternate functions */
-ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */
-ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* GPIO80/PWM3 */
-ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */
-ALTERNATE(PIN_MASK(C, 0x1c), 0, MODULE_PWM, 0) /* GPIOC2/PWM1/I2C6_SCL0, GPIOC3/PWM0, GPIOC4/PWM2 */
-
-/* ADC alternate functions */
-ALTERNATE(PIN_MASK(3, 0x10), 0, MODULE_ADC, 0) /* GPIO34/PS2_DAT2/ADC6 */
-ALTERNATE(PIN_MASK(4, 0x34), 0, MODULE_ADC, 0) /* GPIO42/ADC3/RI_L, GPIO45/ADC0, GPIO44/ADC1 */
-ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
-
-/* KB alternate functions */
-ALTERNATE(PIN_MASK(0, 0xe0), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO10&P80_CLK/GPIO07, KSO11&P80_DAT/GPIO06, KSO12/GPIO05 */
-ALTERNATE(PIN_MASK(1, 0x7f), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO06/GPO13/GP_SEL_L, KSO07/GPO12/JEN_L, KSO03/GPIO16/JTAG_TDO0_SWO, KSO04/GPIO15/XNOR, KSO05/GPIO14, KSO08/GPIO11/CR_SOUT1, KSO09/GPIO10/CR_SIN1 */
-
-ALTERNATE(PIN_MASK(2, 0xfc), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* KSI3/GPIO26/TRACEDATA0, KSI2/GPIO27/TRACEDATA1, KSI4/GPIO25/TRACECLK/GP_SCLK, KSI5/GPIO24/GP_MISO, KSI6/GPIO23/S_SBUB, KSI7/GPIO22/S_SBUA */
-ALTERNATE(PIN_MASK(2, 0x03), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO00/GPIO21/JTAG_TCK_SWCLK, KSO01/GPIO20/JTAG_TMS_SWIO */
-ALTERNATE(PIN_MASK(3, 0x03), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* KSI0/GPIO31/TRACEDATA3/GP_MOSI, KSI1/GPIO30/TRACEDATA2/GP_CS_L */
-
-/* PMU alternate functions */
-ALTERNATE(PIN_MASK(0, 0x01), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH) /* PSL_IN2_L&GPI00/GPIO00 */
-ALTERNATE(PIN_MASK(0, 0x02), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_LOW) /* GPIO01/PSL_IN3_L&GPI01 */
-ALTERNATE(PIN_MASK(D, 0x04), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH) /* PSL_IN1_L&GPID2/GPIOD2 */
-
-/* GPIO alternate functions */
-ALTERNATE(PIN_MASK(D, 0x08), 0, MODULE_GPIO, GPIO_INPUT) /* GPIOD3/TB1 */
-
-/* Unused Pins */
-UNUSED(PIN(5, 7)) /* SER_IRQ/ESPI_ALERT_L/GPIO57 */
-UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
-UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
-UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
-UNUSED(PIN(6, 6)) /* GPIO66 */
-
-/* Pre-configured PSL balls: J8 K6 */
-
-/* Unreferenced balls */
-/* ['D10', 'D11', 'D6', 'E11', 'F12', 'F5', 'F6', 'F7', 'G10', 'G11', 'G12', 'G6', 'J9', 'L10', 'M11', 'M12', 'M2', 'M7'] */
diff --git a/board/ghost/gpio.inc b/board/ghost/gpio.inc
deleted file mode 100644
index 40d9aa1418..0000000000
--- a/board/ghost/gpio.inc
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- mode:c -*-
- *
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#define MODULE_KB MODULE_KEYBOARD_SCAN
-
-/*
- * Generated-gpio.inc is produced using a Brya specific tool that
- * parses the GPIO definitions derived from the board schematics and
- * EC pinout descriptions derived form the chip datasheets to generate
- * the Chrome EC GPIO pinout definitions. Due to the confidential
- * nature of schematics and datasheets, they are not provided here.
- *
- * Variants that do not auto-generate their GPIO definitions should
- * combine the Brya gpio.inc and generated-gpio.inc into their
- * gpio.inc and customize as appropriate.
- */
-
-#include "generated-gpio.inc"
-
-/*
- * The NPCX keyboard driver does not use named GPIOs to access
- * keyboard scan pins, so we do not list them in *gpio.inc. However, when
- * KEYBOARD_COL2_INVERTED is defined, this name is required.
- */
-GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW)
-
-IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 2), GPIO_ODR_LOW)
-IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_OUT_LOW)
-
-IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_OUT_LOW)
-IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 7), GPIO_ODR_LOW)
diff --git a/board/ghost/i2c.c b/board/ghost/i2c.c
deleted file mode 100644
index f65a074344..0000000000
--- a/board/ghost/i2c.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-#include "compile_time_macros.h"
-#include "i2c.h"
-
-/* I2C port map configuration */
-const struct i2c_port_t i2c_ports[] = {
- {
- /* I2C0 */
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA,
- },
- {
- /* I2C1 */
- .name = "tcpc0,1",
- .port = I2C_PORT_USB_C0_C1_TCPC,
- /* TODO(b/233013680): set to 1000 when validated */
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C0_C1_TCPC_SCL,
- .sda = GPIO_EC_I2C_USB_C0_C1_TCPC_SDA,
- },
- {
- /* I2C2 */
- .name = "ppc0,1",
- .port = I2C_PORT_USB_C0_C1_PPC,
- /* TODO(b/233013680): set to 1000 when validated */
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C0_C1_PPC_BC_SCL,
- .sda = GPIO_EC_I2C_USB_C0_C1_PPC_BC_SDA,
- },
- {
- /* I2C3 */
- .name = "retimer0",
- .port = I2C_PORT_USB_C0_RT,
- /* TODO(b/233013680): set to 1000 when validated */
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C0_RT_SCL,
- .sda = GPIO_EC_I2C_USB_C0_RT_SDA,
- },
- {
- /* I2C5 */
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C_BAT_SCL,
- .sda = GPIO_EC_I2C_BAT_SDA,
- },
- {
- /* I2C6 */
- .name = "retimer1",
- .port = I2C_PORT_USB_C1_RT,
- /* TODO(b/233013680): set to 1000 when validated */
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C1_RT_SCL,
- .sda = GPIO_EC_I2C_USB_C1_RT_SDA,
- },
- {
- /* I2C7 */
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_MISC_SCL_R,
- .sda = GPIO_EC_I2C_MISC_SDA_R,
- },
-};
-const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/ghost/keyboard.c b/board/ghost/keyboard.c
deleted file mode 100644
index 133d574dfa..0000000000
--- a/board/ghost/keyboard.c
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-
-#include "keyboard_scan.h"
-#include "timer.h"
-
-/* Keyboard scan setting */
-__override struct keyboard_scan_config keyscan_config = {
- /* Increase from 50 us, because KSO_02 passes through the H1. */
- .output_settle_us = 80,
- /* Other values should be the same as the default configuration. */
- .debounce_down_us = 9 * MSEC,
- .debounce_up_us = 30 * MSEC,
- .scan_period_us = 3 * MSEC,
- .min_post_scan_delay_us = 1000,
- .poll_timeout_us = 100 * MSEC,
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
- },
-};
diff --git a/board/ghost/led.c b/board/ghost/led.c
deleted file mode 100644
index 685d96dbb2..0000000000
--- a/board/ghost/led.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-/*
- * Ghost specific PWM LED settings.
- *
- * Early boards have 2 PWM LEDs which we simply treat as power
- * indicators.
- */
-
-#include <stdint.h>
-
-#include "common.h"
-#include "compile_time_macros.h"
-#include "ec_commands.h"
-#include "pwm.h"
-#include "util.h"
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
-};
-
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
-{
- memset(brightness_range, '\0',
- sizeof(*brightness_range) * EC_LED_COLOR_COUNT);
- brightness_range[EC_LED_COLOR_WHITE] = 100;
-}
-
-int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
-{
- uint8_t duty_percent;
-
- if (led_id != EC_LED_ID_POWER_LED)
- return EC_ERROR_UNKNOWN;
-
- duty_percent = brightness[EC_LED_COLOR_WHITE];
- if (duty_percent > 100)
- duty_percent = 100;
- pwm_set_duty(PWM_CH_LED1, duty_percent);
- pwm_set_duty(PWM_CH_LED2, duty_percent);
-
- return EC_SUCCESS;
-}
diff --git a/board/ghost/pwm.c b/board/ghost/pwm.c
deleted file mode 100644
index e5fe44dea5..0000000000
--- a/board/ghost/pwm.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-
-#include "compile_time_macros.h"
-#include "hooks.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED1] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 4800,
- },
- [PWM_CH_LED2] = {
- .channel = 1,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 4800,
- },
- [PWM_CH_FAN2] = {
- .channel = 2,
- .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
- .freq = 1000,
- },
- [PWM_CH_KBLIGHT] = {
- .channel = 3,
- .flags = 0,
- /*
- * Set PWM frequency to multiple of 50 Hz and 60 Hz to prevent
- * flicker. Higher frequencies consume similar average power to
- * lower PWM frequencies, but higher frequencies record a much
- * lower maximum power.
- */
- .freq = 2400,
- },
- [PWM_CH_FAN1] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
- .freq = 1000,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
-
-static void board_pwm_init(void)
-{
- /*
- * Turn on all the LEDs at 50%.
- */
- pwm_enable(PWM_CH_LED1, 1);
- pwm_set_duty(PWM_CH_LED1, 50);
- pwm_enable(PWM_CH_LED2, 1);
- pwm_set_duty(PWM_CH_LED2, 50);
-
- pwm_enable(PWM_CH_KBLIGHT, 1);
- pwm_set_duty(PWM_CH_KBLIGHT, 50);
-}
-DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT);
diff --git a/board/ghost/sensors.c b/board/ghost/sensors.c
deleted file mode 100644
index 202f9c6ef8..0000000000
--- a/board/ghost/sensors.c
+++ /dev/null
@@ -1,187 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "common.h"
-#include "adc_chip.h"
-#include "ec_commands.h"
-#include "temp_sensor.h"
-#include "temp_sensor/thermistor.h"
-
-/* ADC configuration */
-struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1_DDR_SOC] = {
- .name = "TEMP_DDR_SOC",
- .input_ch = NPCX_ADC_CH0,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
- [ADC_TEMP_SENSOR_2_AMBIENT] = {
- .name = "TEMP_AMBIENT",
- .input_ch = NPCX_ADC_CH1,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
- [ADC_TEMP_SENSOR_3_CHARGER] = {
- .name = "TEMP_CHARGER",
- .input_ch = NPCX_ADC_CH6,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
- [ADC_TEMP_SENSOR_4_WWAN] = {
- .name = "TEMP_WWAN",
- .input_ch = NPCX_ADC_CH7,
- .factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-/* Temperature sensor configuration */
-const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC,
- },
- [TEMP_SENSOR_2_AMBIENT] = {
- .name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_AMBIENT,
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER,
- },
- [TEMP_SENSOR_4_WWAN] = {
- .name = "WWAN",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_WWAN,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-/*
- * TODO(b/233311897): update temps for ghost
- *
- * Alder Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
- * 130 C. However, sensor is located next to DDR, so we need to use the lower
- * DDR temperature limit (85 C)
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_CPU \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(90), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
- }
-__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
-
-/*
- * TODO(b/233311897): update temps for ghost
- *
- * Inductor limits - used for both charger and PP3300 regulator
- *
- * Need to use the lower of the charger IC, PP3300 regulator, and the inductors
- *
- * Charger max recommended temperature 100C, max absolute temperature 125C
- * PP3300 regulator: operating range -40 C to 145 C
- *
- * Inductors: limit of 125c
- * PCB: limit is 80c
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_AMBIENT \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(90), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
- }
-__maybe_unused static const struct ec_thermal_config thermal_ambient =
- THERMAL_AMBIENT;
-
-/*
- * TODO(b/233311897): update temps for ghost
- *
- * Inductor limits - used for both charger and PP3300 regulator
- *
- * Need to use the lower of the charger IC, PP3300 regulator, and the inductors
- *
- * Charger max recommended temperature 125C, max absolute temperature 150C
- * PP3300 regulator: operating range -40 C to 125 C
- *
- * Inductors: limit of 125c
- * PCB: limit is 80c
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_CHARGER \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(105), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(120), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(65), \
- }
-__maybe_unused static const struct ec_thermal_config thermal_charger =
- THERMAL_CHARGER;
-
-/*
- * TODO(b/233311897): update temps for ghost
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_WWAN \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(130), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(130), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
- }
-__maybe_unused static const struct ec_thermal_config thermal_wwan =
- THERMAL_WWAN;
-
-struct ec_thermal_config thermal_params[] = {
- [TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU,
- [TEMP_SENSOR_2_AMBIENT] = THERMAL_AMBIENT,
- [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
- [TEMP_SENSOR_4_WWAN] = THERMAL_WWAN,
-};
-BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/ghost/usbc_config.c b/board/ghost/usbc_config.c
deleted file mode 100644
index f8b1df5ade..0000000000
--- a/board/ghost/usbc_config.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "common.h"
-#include "compile_time_macros.h"
-#include "driver/ppc/syv682x_public.h"
-#include "driver/retimer/bb_retimer_public.h"
-#include "driver/tcpm/nct38xx.h"
-#include "ec_commands.h"
-#include "gpio.h"
-#include "gpio_signal.h"
-#include "hooks.h"
-#include "ioexpander.h"
-#include "system.h"
-#include "timer.h"
-#include "usbc_config.h"
-#include "usbc_ppc.h"
-#include "usb_mux.h"
-#include "usb_pd.h"
-#include "usb_pd_tbt.h"
-#include "usb_pd_tcpm.h"
-
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
-#ifdef CONFIG_ZEPHYR
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
-#endif /* CONFIG_ZEPHYR */
-
-/* USBC TCPC configuration */
-const struct tcpc_config_t tcpc_config[] = {
- [USBC_PORT_C0] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C0_C1_TCPC,
- .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_NO_DEBUG_ACC_CONTROL,
- },
- [USBC_PORT_C1] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C0_C1_TCPC,
- .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
-BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
-
-/******************************************************************************/
-
-/* USBC PPC configuration */
-struct ppc_config_t ppc_chips[] = {
- [USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_USB_C0_C1_PPC,
- .i2c_addr_flags = SYV682X_ADDR2_FLAGS,
- .frs_en = IOEX_USB_C0_FRS_EN,
- .drv = &syv682x_drv,
- },
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_USB_C0_C1_PPC,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .frs_en = IOEX_USB_C1_FRS_EN,
- .drv = &syv682x_drv,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
-
-unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
-/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-
-const struct usb_mux usb_muxes[] = {
- [USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_RT,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
- },
- [USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_RT,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
-
-#ifndef CONFIG_ZEPHYR
-/*
- * USB C0 and C1 uses burnside bridge chips and have their reset
- * controlled by their respective TCPC chips acting as GPIO expanders.
- *
- * ioex_init() is normally called before we take the TCPCs out of
- * reset, so we need to start in disabled mode, then explicitly
- * call ioex_init().
- */
-
-struct ioexpander_config_t ioex_config[] = {
- [IOEX_C0_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C1_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
- },
- [IOEX_C1_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C1_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
-#endif /* !CONFIG_ZEPHYR */
-
-__override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
-{
- enum ioex_signal rst_signal;
-
- if (me->usb_port == USBC_PORT_C0)
- rst_signal = IOEX_USB_C0_RT_RST_ODL;
- else if (me->usb_port == USBC_PORT_C1)
- rst_signal = IOEX_USB_C1_RT_RST_ODL;
- else
- return EC_ERROR_INVAL;
-
- /*
- * We do not have a load switch for the burnside bridge chips,
- * so we only need to sequence reset.
- */
-
- if (enable) {
- /*
- * Tpw, minimum time from VCC to RESET_N de-assertion is 100us.
- * For boards that don't provide a load switch control, the
- * retimer_init() function ensures power is up before calling
- * this function.
- */
- ioex_set_level(rst_signal, 1);
- /*
- * Allow 1ms time for the retimer to power up lc_domain
- * which powers I2C controller within retimer
- */
- msleep(1);
- } else {
- ioex_set_level(rst_signal, 0);
- msleep(1);
- }
-
- return EC_SUCCESS;
-}
-
-void board_reset_pd_mcu(void)
-{
- enum gpio_signal tcpc_rst;
-
- tcpc_rst = GPIO_USB_C0_C1_TCPC_RST_ODL;
-
- gpio_set_level(tcpc_rst, 0);
-
- /*
- * delay for power-on to reset-off and min. assertion time.
- * the nct380x needs a 100 ns reset pulse.
- */
-
- msleep(1);
-
- gpio_set_level(tcpc_rst, 1);
-
- /*
- * wait for chips to come up.
- * the nct3808 needs 3 ms.
- */
-
- msleep(5);
-}
-
-static void board_tcpc_init(void)
-{
- /* Don't reset TCPCs after initial reset */
- if (!system_jumped_late())
- board_reset_pd_mcu();
-
- /*
- * These IO expander pins are implemented using the
- * C0/C1 TCPC, so they must be set up after the TCPC has
- * been taken out of reset.
- */
- ioex_init(IOEX_C0_NCT38XX);
- ioex_init(IOEX_C1_NCT38XX);
-
- /* Enable PPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
-
- /* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_C1_TCPC_INT_ODL);
-}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
-
-uint16_t tcpc_get_alert_status(void)
-{
- uint16_t status = 0;
-
- if (gpio_get_level(GPIO_USB_C0_C1_TCPC_INT_ODL) == 0)
- status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_1;
-
- return status;
-}
-
-int ppc_get_alert_status(int port)
-{
- if (port == USBC_PORT_C0)
- return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0;
- else if (port == USBC_PORT_C1)
- return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0;
- return 0;
-}
-
-void tcpc_alert_event(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_C1_TCPC_INT_ODL:
- schedule_deferred_pd_interrupt(USBC_PORT_C0);
- break;
- default:
- break;
- }
-}
-
-void ppc_interrupt(enum gpio_signal signal)
-{
- switch (signal) {
- case GPIO_USB_C0_PPC_INT_ODL:
- syv682x_interrupt(USBC_PORT_C0);
- break;
- case GPIO_USB_C1_PPC_INT_ODL:
- syv682x_interrupt(USBC_PORT_C1);
- break;
- default:
- break;
- }
-}
-
-void retimer_interrupt(enum gpio_signal signal)
-{
- /*
- * TODO(b/233317538): do we need this interrupt
- */
-}
-
-__override bool board_is_dts_port(int port)
-{
- return port == USBC_PORT_C0;
-}
-
-__override bool board_is_tbt_usb4_port(int port)
-{
- if (port == USBC_PORT_C0 || port == USBC_PORT_C1)
- return true;
-
- return false;
-}
-
-__override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
-{
- if (!board_is_tbt_usb4_port(port))
- return TBT_SS_RES_0;
-
- return TBT_SS_TBT_GEN3;
-}
diff --git a/board/gimble/battery.c b/board/gimble/battery.c
index 235503a6f1..89b0ddf1e2 100644
--- a/board/gimble/battery.c
+++ b/board/gimble/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/gimble/board.c b/board/gimble/board.c
index 2d0ebdeb80..0ca135b9fd 100644
--- a/board/gimble/board.c
+++ b/board/gimble/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,8 +35,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -106,8 +106,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -141,53 +141,53 @@ __overridable void board_ps8xxx_tcpc_init(int port)
{
int val;
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_APTX_EQ_AT_10G, &val))
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_APTX_EQ_AT_10G, &val))
CPRINTS("ps8815: fail to read reg 0x%02x",
PS8815_REG_APTX_EQ_AT_10G);
/* APTX2 EQ 23dB, APTX1 EQ 23dB */
- if (i2c_write8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_APTX_EQ_AT_10G, 0x99))
+ if (i2c_write8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_APTX_EQ_AT_10G, 0x99))
CPRINTS("ps8815: fail to write reg 0x%02x",
PS8815_REG_APTX_EQ_AT_10G);
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_RX_EQ_AT_10G, &val))
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_RX_EQ_AT_10G, &val))
CPRINTS("ps8815: fail to read reg 0x%02x",
PS8815_REG_RX_EQ_AT_10G);
/* RX2 EQ 18dB, RX1 EQ 16dB */
- if (i2c_write8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_RX_EQ_AT_10G, 0x64))
+ if (i2c_write8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_RX_EQ_AT_10G, 0x64))
CPRINTS("ps8815: fail to write reg 0x%02x",
PS8815_REG_RX_EQ_AT_10G);
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_APTX_EQ_AT_5G, &val))
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_APTX_EQ_AT_5G, &val))
CPRINTS("ps8815: fail to read reg 0x%02x",
PS8815_REG_APTX_EQ_AT_5G);
/* APTX2 EQ 16dB, APTX1 EQ 16dB */
- if (i2c_write8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_APTX_EQ_AT_5G, 0x44))
+ if (i2c_write8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_APTX_EQ_AT_5G, 0x44))
CPRINTS("ps8815: fail to write reg 0x%02x",
PS8815_REG_APTX_EQ_AT_5G);
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_RX_EQ_AT_5G, &val))
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_RX_EQ_AT_5G, &val))
CPRINTS("ps8815: fail to read reg 0x%02x",
PS8815_REG_RX_EQ_AT_5G);
/* RX2 EQ 16dB, RX1 EQ 16dB */
- if (i2c_write8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_P1_FLAGS, PS8815_REG_RX_EQ_AT_5G, 0x44))
+ if (i2c_write8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_P1_FLAGS,
+ PS8815_REG_RX_EQ_AT_5G, 0x44))
CPRINTS("ps8815: fail to write reg 0x%02x",
PS8815_REG_RX_EQ_AT_5G);
}
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Follow OEM request to limit the input current to
@@ -195,7 +195,6 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 90 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/gimble/board.h b/board/gimble/board.h
index 32b2945abe..015f3f78e6 100644
--- a/board/gimble/board.h
+++ b/board/gimble/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@
/* BMA253 accelerometer in lid */
#define CONFIG_ACCEL_BMA255
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel/gyro */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel/gyro */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -42,8 +42,8 @@
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* Enable sensor fifo, must also define the _SIZE and _THRES */
#define CONFIG_ACCEL_FIFO
@@ -57,13 +57,13 @@
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 1
+#define CONFIG_IO_EXPANDER_PORT_COUNT 1
#define CONFIG_USB_PD_TCPM_PS8815
#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
@@ -78,9 +78,9 @@
#define CONFIG_USB_PD_FRS_PPC
/* measure and check these values on gimble */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* I2C speed console command */
#define CONFIG_CMD_I2C_SPEED
@@ -91,10 +91,10 @@
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -102,33 +102,33 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
@@ -139,28 +139,28 @@
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT4_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
/* define this to aviod error on CONFIG_ACCELGYRO_BMI_COMM_I2C */
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/* Disabling Thunderbolt-compatible mode */
#undef CONFIG_USB_PD_TBT_COMPAT_MODE
@@ -191,14 +191,14 @@
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
/* PROCHOT defines */
-#define BATT_MAX_CONTINUE_DISCHARGE_WATT 45
+#define BATT_MAX_CONTINUE_DISCHARGE_WATT 45
/* Prochot assertion/deassertion ratios*/
#define PROCHOT_ADAPTER_WATT_RATIO 97
@@ -213,7 +213,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -232,17 +232,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_PORT_COUNT };
enum battery_type {
BATTERY_SIMPLO_HIGHPOWER,
@@ -251,24 +243,18 @@ enum battery_type {
};
enum pwm_channel {
- PWM_CH_LED2 = 0, /* PWM0 (white charger) */
- PWM_CH_LED3, /* PWM1 (orange on DB) */
- PWM_CH_LED1, /* PWM2 (orange charger) */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED4, /* PWM7 (white on DB) */
+ PWM_CH_LED2 = 0, /* PWM0 (white charger) */
+ PWM_CH_LED3, /* PWM1 (orange on DB) */
+ PWM_CH_LED1, /* PWM2 (orange charger) */
+ PWM_CH_KBLIGHT, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED4, /* PWM7 (white on DB) */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/gimble/build.mk b/board/gimble/build.mk
index c43f37b4dd..cad0da2a4e 100644
--- a/board/gimble/build.mk
+++ b/board/gimble/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/gimble/charger.c b/board/gimble/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/gimble/charger.c
+++ b/board/gimble/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/gimble/ec.tasklist b/board/gimble/ec.tasklist
index 9207f8729d..27ab9a6e63 100644
--- a/board/gimble/ec.tasklist
+++ b/board/gimble/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gimble/fans.c b/board/gimble/fans.c
index d966056331..90e251511f 100644
--- a/board/gimble/fans.c
+++ b/board/gimble/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/gimble/fw_config.c b/board/gimble/fw_config.c
index 1589811ad0..8698145efd 100644
--- a/board/gimble/fw_config.c
+++ b/board/gimble/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union brya_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/gimble/fw_config.h b/board/gimble/fw_config.h
index 32631f7b77..fcf24b4094 100644
--- a/board/gimble/fw_config.h
+++ b/board/gimble/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,22 +25,19 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_keyboard_layout {
- KB_LAYOUT_DEFAULT = 0,
- KB_LAYOUT_1 = 1
-};
+enum ec_cfg_keyboard_layout { KB_LAYOUT_DEFAULT = 0, KB_LAYOUT_1 = 1 };
union brya_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
- uint32_t sd_db : 2;
- uint32_t reserved_0 : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t cellular_db : 2;
- uint32_t wifi_sar_id : 1;
- enum ec_cfg_keyboard_layout kb_layout : 2;
- uint32_t reserved_1 : 16;
+ enum ec_cfg_usb_db_type usb_db : 4;
+ uint32_t sd_db : 2;
+ uint32_t reserved_0 : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t cellular_db : 2;
+ uint32_t wifi_sar_id : 1;
+ enum ec_cfg_keyboard_layout kb_layout : 2;
+ uint32_t reserved_1 : 16;
};
uint32_t raw_value;
};
diff --git a/board/gimble/gpio.inc b/board/gimble/gpio.inc
index 412673c227..1961f1bcb4 100644
--- a/board/gimble/gpio.inc
+++ b/board/gimble/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gimble/i2c.c b/board/gimble/i2c.c
index 7bedcc05db..621e7bf3f0 100644
--- a/board/gimble/i2c.c
+++ b/board/gimble/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gimble/keyboard.c b/board/gimble/keyboard.c
index cec70e3d97..e1b0ca8a21 100644
--- a/board/gimble/keyboard.c
+++ b/board/gimble/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@ static const struct ec_response_keybd_config gimble_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &gimble_kb;
}
diff --git a/board/gimble/led.c b/board/gimble/led.c
index 3176e1a35d..7b6fd5c24e 100644
--- a/board/gimble/led.c
+++ b/board/gimble/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,34 +28,34 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {
- {EC_LED_COLOR_AMBER, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC}
- },
- [STATE_FACTORY_TEST] = {
- {EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC}
- },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {
- {LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
@@ -108,7 +108,7 @@ __override void led_set_color_battery(enum ec_led_colors color)
default: /* Unknown charging port */
break;
}
- } else {
+ } else {
switch (color) {
case EC_LED_COLOR_AMBER:
led1_duty = BAT_LED_ON_LVL;
diff --git a/board/gimble/pwm.c b/board/gimble/pwm.c
index 54ffd9411d..9f9a8ed94f 100644
--- a/board/gimble/pwm.c
+++ b/board/gimble/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gimble/sensors.c b/board/gimble/sensors.c
index 0e030846db..d39d43d887 100644
--- a/board/gimble/sensors.c
+++ b/board/gimble/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,6 +11,8 @@
#include "driver/accel_bma422.h"
#include "driver/accelgyro_bmi_common.h"
#include "driver/accelgyro_lsm6dsm.h"
+#include "driver/tcpm/ps8xxx_public.h"
+#include "driver/tcpm/tcpci.h"
#include "gpio.h"
#include "hooks.h"
#include "keyboard_scan.h"
@@ -67,30 +69,22 @@ static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
static struct accelgyro_saved_data_t g_bma422_data;
/* TODO(b/192477578): calibrate the orientation matrix on later board stage */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref_id_1 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref_id_1 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* TODO(b/192477578): calibrate the orientation matrix on later board stage */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref_id_1 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref_id_1 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -285,24 +279,18 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_2_FAN] = {
- .name = "Fan",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_FAN
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_2_FAN] = { .name = "Fan",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_FAN },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -316,8 +304,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -344,8 +332,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -357,6 +345,19 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
__maybe_unused static const struct ec_thermal_config thermal_inductor =
THERMAL_INDUCTOR;
+#define THERMAL_FAN_MISSING \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(100), \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
+ }, \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_fan_missing =
+ THERMAL_FAN_MISSING;
+
/* this should really be "const" */
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU,
@@ -364,4 +365,23 @@ struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_2_FAN] = THERMAL_INDUCTOR,
[TEMP_SENSOR_3_CHARGER] = THERMAL_INDUCTOR,
};
+
+struct ec_thermal_config temp_sensor_2_fan_set[] = {
+ [TEMP_SENSOR_2_FAN] = THERMAL_FAN_MISSING,
+};
+
+static void config_thermal_params(void)
+{
+ int rv, val;
+
+ rv = tcpc_addr_read16_no_lpm_exit(USBC_PORT_C1, PS8XXX_I2C_ADDR1_FLAGS,
+ TCPC_REG_VENDOR_ID, &val);
+
+ if (rv != 0) {
+ thermal_params[TEMP_SENSOR_2_FAN] =
+ temp_sensor_2_fan_set[TEMP_SENSOR_2_FAN];
+ }
+}
+DECLARE_HOOK(HOOK_INIT, config_thermal_params, HOOK_PRIO_INIT_I2C + 1);
+
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/gimble/thermal.c b/board/gimble/thermal.c
index 25e7bf2c00..37184f92f2 100644
--- a/board/gimble/thermal.c
+++ b/board/gimble/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,7 @@
#include "util.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
-
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -42,45 +40,45 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {43, -1, -1},
- .off = {0, -1, -1},
- .rpm = {0},
- .rpm_tablet = {0},
+ .on = { 43, -1, -1 },
+ .off = { 0, -1, -1 },
+ .rpm = { 0 },
+ .rpm_tablet = { 0 },
},
{
/* level 1 */
- .on = {45, -1, -1},
- .off = {43, -1, -1},
- .rpm = {3400},
- .rpm_tablet = {3400},
+ .on = { 45, -1, -1 },
+ .off = { 43, -1, -1 },
+ .rpm = { 3400 },
+ .rpm_tablet = { 3400 },
},
{
/* level 2 */
- .on = {46, -1, -1},
- .off = {44, -1, -1},
- .rpm = {3800},
- .rpm_tablet = {3700},
+ .on = { 46, -1, -1 },
+ .off = { 44, -1, -1 },
+ .rpm = { 3800 },
+ .rpm_tablet = { 3700 },
},
{
/* level 3 */
- .on = {48, -1, -1},
- .off = {45, -1, -1},
- .rpm = {4200},
- .rpm_tablet = {4100},
+ .on = { 48, -1, -1 },
+ .off = { 45, -1, -1 },
+ .rpm = { 4200 },
+ .rpm_tablet = { 4100 },
},
{
/* level 4 */
- .on = {50, -1, -1},
- .off = {47, -1, -1},
- .rpm = {4800},
- .rpm_tablet = {4800},
+ .on = { 50, -1, -1 },
+ .off = { 47, -1, -1 },
+ .rpm = { 4800 },
+ .rpm_tablet = { 4800 },
},
{
/* level 5 */
- .on = {52, -1, -1},
- .off = {49, -1, -1},
- .rpm = {5400},
- .rpm_tablet = {5200},
+ .on = { 52, -1, -1 },
+ .off = { 49, -1, -1 },
+ .rpm = { 5400 },
+ .rpm_tablet = { 5200 },
},
};
const int num_fan_levels = ARRAY_SIZE(fan_table);
@@ -106,18 +104,15 @@ int fan_table_to_rpm(int fan, int *temp, enum temp_sensor_id temp_sensor)
*/
if (temp[temp_sensor] < prev_temp[temp_sensor]) {
for (i = current_level; i > 0; i--) {
- if (temp[temp_sensor] <
- fan_table[i].off[temp_sensor])
+ if (temp[temp_sensor] < fan_table[i].off[temp_sensor])
current_level = i - 1;
else
break;
}
- } else if (temp[temp_sensor] >
- prev_temp[temp_sensor]) {
+ } else if (temp[temp_sensor] > prev_temp[temp_sensor]) {
for (i = current_level; i < num_fan_levels; i++) {
- if (temp[temp_sensor] >
- fan_table[i].on[temp_sensor])
- current_level = i + 1;
+ if (temp[temp_sensor] >= fan_table[i].on[temp_sensor])
+ current_level = i;
else
break;
}
@@ -151,7 +146,8 @@ void board_override_fan_control(int fan, int *temp)
if (chipset_in_state(CHIPSET_STATE_ON)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(FAN_CH(fan), temp, TEMP_SENSOR_1_DDR_SOC));
+ fan_table_to_rpm(FAN_CH(fan), temp,
+ TEMP_SENSOR_1_DDR_SOC));
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Stop fan when enter S0ix */
fan_set_rpm_mode(FAN_CH(fan), 1);
diff --git a/board/gimble/usbc_config.c b/board/gimble/usbc_config.c
index e747ab0df9..feb123a525 100644
--- a/board/gimble/usbc_config.c
+++ b/board/gimble/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,8 +34,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -88,26 +88,33 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
/* USBC mux configuration - Alder Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -160,12 +167,11 @@ void board_reset_pd_mcu(void)
if (battery_hw_present())
gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 1);
gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
-
+
/* wait for chips to come up */
msleep(PS8815_FW_INIT_DELAY_MS);
}
diff --git a/board/gimble/usbc_config.h b/board/gimble/usbc_config.h
index 87e601ee3e..ab2dabc1e9 100644
--- a/board/gimble/usbc_config.h
+++ b/board/gimble/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/gingerbread/board.c b/board/gingerbread/board.c
index 3d80985c0a..8d14bda30c 100644
--- a/board/gingerbread/board.c
+++ b/board/gingerbread/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,8 +31,8 @@
#include "usb_tc_sm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
#define QUICHE_PD_DEBUG_LVL 1
@@ -102,27 +102,27 @@ static void board_pwr_btn_interrupt(enum gpio_signal signal)
* signals is driven by USB/MST hub power sequencing requirements.
*/
const struct power_seq board_power_seq[] = {
- {GPIO_EN_AC_JACK, 1, 20},
- {GPIO_EN_PP5000_A, 1, 31},
- {GPIO_EN_PP3300_A, 1, 135},
- {GPIO_EN_BB, 1, 30},
- {GPIO_EN_PP1100_A, 1, 30},
- {GPIO_EN_PP1000_A, 1, 20},
- {GPIO_EN_PP1050_A, 1, 30},
- {GPIO_EN_PP1200_A, 1, 20},
- {GPIO_EN_PP5000_HSPORT, 1, 31},
- {GPIO_EN_DP_SINK, 1, 80},
- {GPIO_MST_LP_CTL_L, 1, 80},
- {GPIO_MST_RST_L, 1, 41},
- {GPIO_EC_HUB1_RESET_L, 1, 41},
- {GPIO_EC_HUB2_RESET_L, 1, 33},
- {GPIO_USBC_DP_PD_RST_L, 1, 100},
- {GPIO_USBC_UF_RESET_L, 1, 33},
- {GPIO_DEMUX_DUAL_DP_PD_N, 1, 100},
- {GPIO_DEMUX_DUAL_DP_RESET_N, 1, 100},
- {GPIO_DEMUX_DP_HDMI_PD_N, 1, 10},
- {GPIO_DEMUX_DUAL_DP_MODE, 1, 10},
- {GPIO_DEMUX_DP_HDMI_MODE, 1, 1},
+ { GPIO_EN_AC_JACK, 1, 20 },
+ { GPIO_EN_PP5000_A, 1, 31 },
+ { GPIO_EN_PP3300_A, 1, 135 },
+ { GPIO_EN_BB, 1, 30 },
+ { GPIO_EN_PP1100_A, 1, 30 },
+ { GPIO_EN_PP1000_A, 1, 20 },
+ { GPIO_EN_PP1050_A, 1, 30 },
+ { GPIO_EN_PP1200_A, 1, 20 },
+ { GPIO_EN_PP5000_HSPORT, 1, 31 },
+ { GPIO_EN_DP_SINK, 1, 80 },
+ { GPIO_MST_LP_CTL_L, 1, 80 },
+ { GPIO_MST_RST_L, 1, 41 },
+ { GPIO_EC_HUB1_RESET_L, 1, 41 },
+ { GPIO_EC_HUB2_RESET_L, 1, 33 },
+ { GPIO_USBC_DP_PD_RST_L, 1, 100 },
+ { GPIO_USBC_UF_RESET_L, 1, 33 },
+ { GPIO_DEMUX_DUAL_DP_PD_N, 1, 100 },
+ { GPIO_DEMUX_DUAL_DP_RESET_N, 1, 100 },
+ { GPIO_DEMUX_DP_HDMI_PD_N, 1, 10 },
+ { GPIO_DEMUX_DUAL_DP_MODE, 1, 10 },
+ { GPIO_DEMUX_DP_HDMI_MODE, 1, 1 },
};
const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
@@ -131,13 +131,13 @@ const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Gingerbread"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] =
- USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Gingerbread"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] =
+ USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -186,33 +186,33 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_HOST] = {
- .usb_port = USB_PD_PORT_HOST,
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = TUSB1064_I2C_ADDR0_FLAGS,
- .driver = &tusb1064_usb_mux_driver,
- .board_set = &board_tusb1064_dp_rx_eq_set,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_HOST,
+ .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = TUSB1064_I2C_ADDR0_FLAGS,
+ .driver = &tusb1064_usb_mux_driver,
+ .board_set = &board_tusb1064_dp_rx_eq_set,
+ },
},
[USB_PD_PORT_DP] = {
- .usb_port = USB_PD_PORT_DP,
- .i2c_port = I2C_PORT_I2C3,
- .i2c_addr_flags = PS8XXX_I2C_ADDR2_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_DP,
+ .i2c_port = I2C_PORT_I2C3,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR2_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_HOST] = {
- .i2c_port = I2C_PORT_I2C3,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_DP] = {
- .drv = &board_ppc_null_drv
- },
+ [USB_PD_PORT_HOST] = { .i2c_port = I2C_PORT_I2C3,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ [USB_PD_PORT_DP] = { .drv = &board_ppc_null_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -239,7 +239,6 @@ void board_reset_pd_mcu(void)
msleep(PS8805_FW_INIT_DELAY_MS);
}
-
/* Power Delivery and charging functions */
void board_enable_usbc_interrupts(void)
{
@@ -253,7 +252,6 @@ void board_enable_usbc_interrupts(void)
/* Enable HPD interrupt */
gpio_enable_interrupt(GPIO_DDI_MST_IN_HPD);
-
}
/* Power Delivery and charging functions */
@@ -267,7 +265,6 @@ void board_disable_usbc_interrupts(void)
/* Disable HPD interrupt */
gpio_disable_interrupt(GPIO_DDI_MST_IN_HPD);
-
}
void board_tcpc_init(void)
@@ -351,7 +348,7 @@ static void board_usb_tc_disconnect(void)
gpio_set_level(GPIO_EC_HUB2_RESET_L, 0);
}
}
-DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect,
HOOK_PRIO_DEFAULT);
#endif /* SECTION_IS_RW */
diff --git a/board/gingerbread/board.h b/board/gingerbread/board.h
index cfc5bbf0a0..09e9e0b7fe 100644
--- a/board/gingerbread/board.h
+++ b/board/gingerbread/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,7 +20,6 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */
#undef CONFIG_FLASH_PSTATE_LOCKED
-
#define CONFIG_WP_ACTIVE_HIGH
/* Console */
@@ -29,8 +28,8 @@
#define CONFIG_UART_TX_DMA_PH DMAMUX_REQ_USART3_TX
/* USB Type C and USB PD defines */
-#define USB_PD_PORT_HOST 0
-#define USB_PD_PORT_DP 1
+#define USB_PD_PORT_HOST 0
+#define USB_PD_PORT_DP 1
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_MUX_TUSB1064
@@ -44,13 +43,13 @@
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
/* I2C port names */
-#define I2C_PORT_I2C1 0
-#define I2C_PORT_I2C2 1
-#define I2C_PORT_I2C3 2
+#define I2C_PORT_I2C1 0
+#define I2C_PORT_I2C2 1
+#define I2C_PORT_I2C3 2
/* Required symbolic I2C port names */
#define I2C_PORT_MP4245 I2C_PORT_I2C3
#define I2C_PORT_EEPROM I2C_PORT_I2C1
-#define MP4245_I2C_ADDR_FLAGS MP4245_I2C_ADDR_0_FLAGS
+#define MP4245_I2C_ADDR_FLAGS MP4245_I2C_ADDR_0_FLAGS
/*
* Macros for GPIO signals used in common code that don't match the
@@ -58,9 +57,9 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_WP GPIO_EC_WP_L
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_WP GPIO_EC_WP_L
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
@@ -80,7 +79,7 @@
#define GPIO_TRIGGER_1 GPIO_USB3_A1_CDP_EN
#define GPIO_TRIGGER_2 GPIO_USB3_A2_CDP_EN
-enum debug_gpio {
+enum debug_gpio {
TRIGGER_1 = 0,
TRIGGER_2,
};
diff --git a/board/gingerbread/build.mk b/board/gingerbread/build.mk
index f994cc1434..d7ca7b35b5 100644
--- a/board/gingerbread/build.mk
+++ b/board/gingerbread/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/gingerbread/ec.tasklist b/board/gingerbread/ec.tasklist
index cc36bf5a74..ffd4a604c9 100644
--- a/board/gingerbread/ec.tasklist
+++ b/board/gingerbread/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gingerbread/gpio.inc b/board/gingerbread/gpio.inc
index 6226ff747e..4da3c973c1 100644
--- a/board/gingerbread/gpio.inc
+++ b/board/gingerbread/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gooey/battery.c b/board/gooey/battery.c
index c40e0d7ec7..e8cec5af5f 100644
--- a/board/gooey/battery.c
+++ b/board/gooey/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/gooey/board.c b/board/gooey/board.c
index fe7e2c3792..250f6afd61 100644
--- a/board/gooey/board.c
+++ b/board/gooey/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,7 +40,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
/* C0 interrupt line shared by BC 1.2 and charger */
@@ -84,7 +84,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -114,8 +113,7 @@ DECLARE_DEFERRED(pendetect_deferred);
void pen_detect_interrupt(enum gpio_signal s)
{
/* Trigger deferred notification of pen detect change */
- hook_call_deferred(&pendetect_deferred_data,
- 500 * MSEC);
+ hook_call_deferred(&pendetect_deferred_data, 500 * MSEC);
}
void board_hibernate(void)
@@ -132,27 +130,21 @@ void board_hibernate(void)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -188,12 +180,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
};
@@ -291,7 +286,6 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
@@ -303,8 +297,7 @@ int board_set_active_charge_port(int port)
/* Disable all ports. */
if (port == CHARGE_PORT_NONE) {
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
raa489000_enable_asgate(0, false);
return EC_SUCCESS;
}
@@ -317,8 +310,7 @@ int board_set_active_charge_port(int port)
/* Enable requested charge port. */
if (raa489000_enable_asgate(port, true) ||
- tcpc_write(0, TCPC_REG_COMMAND,
- TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
+ tcpc_write(0, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_HIGH)) {
CPRINTUSB("p%d: sink path enable failed.", port);
return EC_ERROR_UNKNOWN;
}
@@ -360,17 +352,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* Sensor Data */
static struct stprivate_data g_lis2dwl_data;
@@ -452,14 +440,14 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -508,8 +496,8 @@ static const struct ec_response_keybd_config gooey_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &gooey_keybd;
}
diff --git a/board/gooey/board.h b/board/gooey/board.h
index 4681fb5dcf..b586c0f334 100644
--- a/board/gooey/board.h
+++ b/board/gooey/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,9 +24,12 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -40,8 +43,8 @@
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
@@ -109,26 +112,17 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/gooey/build.mk b/board/gooey/build.mk
index ff15b3e8e4..f65b5e8f0c 100644
--- a/board/gooey/build.mk
+++ b/board/gooey/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/gooey/ec.tasklist b/board/gooey/ec.tasklist
index bdcbcdf074..8ccdfc81b2 100644
--- a/board/gooey/ec.tasklist
+++ b/board/gooey/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gooey/gpio.inc b/board/gooey/gpio.inc
index 1eaae9e354..8eb1f5ef22 100644
--- a/board/gooey/gpio.inc
+++ b/board/gooey/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gooey/led.c b/board/gooey/led.c
index 6d55ce2932..5c7eb08407 100644
--- a/board/gooey/led.c
+++ b/board/gooey/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,41 +11,46 @@
#include "gpio.h"
#include "pwm.h"
-#define LED_OFF_LVL 0
-#define LED_ON_LVL 1
+#define LED_OFF_LVL 0
+#define LED_ON_LVL 1
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF,
+ 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/gooey/usb_pd_policy.c b/board/gooey/usb_pd_policy.c
index b7c0ca21df..a7633b73ac 100644
--- a/board/gooey/usb_pd_policy.c
+++ b/board/gooey/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/goroh/battery.c b/board/goroh/battery.c
index f76af4d99b..4da7b255e0 100644
--- a/board/goroh/battery.c
+++ b/board/goroh/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/goroh/board.c b/board/goroh/board.c
index c99b0deff6..a9eaa35b92 100644
--- a/board/goroh/board.c
+++ b/board/goroh/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,9 +41,9 @@
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Initialize board. */
static void board_init(void)
@@ -55,41 +55,35 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- { "BOARD_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1 },
- { "TEMP_CPU", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2 },
- { "TEMP_GPU", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH3 },
+ { "BOARD_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1 },
+ { "TEMP_CPU", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2 },
+ { "TEMP_GPU", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH3 },
{ "TEMP_CHARGER", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* PWM channels. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_GREEN] = {
- .channel = PWM_HW_CH_DCR0,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_OPEN_DRAIN |
- PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_LED_RED] = {
- .channel = PWM_HW_CH_DCR1,
- .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_OPEN_DRAIN |
- PWM_CONFIG_ACTIVE_LOW,
- .freq_hz = 324, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_FAN] = {
- .channel = PWM_HW_CH_DCR2,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq_hz = 25000, /* maximum supported frequency */
- .pcfsr_sel = PWM_PRESCALER_C4
- },
- [PWM_CH_KBLIGHT] = {
- .channel = PWM_HW_CH_DCR3,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 25000,
- .pcfsr_sel = PWM_PRESCALER_C4
- },
+ [PWM_CH_LED_GREEN] = { .channel = PWM_HW_CH_DCR0,
+ .flags = PWM_CONFIG_DSLEEP |
+ PWM_CONFIG_OPEN_DRAIN |
+ PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_LED_RED] = { .channel = PWM_HW_CH_DCR1,
+ .flags = PWM_CONFIG_DSLEEP |
+ PWM_CONFIG_OPEN_DRAIN |
+ PWM_CONFIG_ACTIVE_LOW,
+ .freq_hz = 324, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_FAN] = { .channel = PWM_HW_CH_DCR2,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq_hz = 25000, /* maximum supported frequency */
+ .pcfsr_sel = PWM_PRESCALER_C4 },
+ [PWM_CH_KBLIGHT] = { .channel = PWM_HW_CH_DCR3,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 25000,
+ .pcfsr_sel = PWM_PRESCALER_C4 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/goroh/board.h b/board/goroh/board.h
index c5b1758aa4..b15c7de076 100644
--- a/board/goroh/board.h
+++ b/board/goroh/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,7 +46,7 @@
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_STACKOVERFLOW
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
/* Sensor */
#define CONFIG_GMR_TABLET_MODE
@@ -99,20 +99,16 @@ enum sensor_id {
};
enum adc_channel {
- ADC_BOARD_ID, /* ADC 1 */
- ADC_TEMP_SENSOR_CPU, /* ADC 2 */
- ADC_TEMP_SENSOR_GPU, /* ADC 3 */
+ ADC_BOARD_ID, /* ADC 1 */
+ ADC_TEMP_SENSOR_CPU, /* ADC 2 */
+ ADC_TEMP_SENSOR_GPU, /* ADC 3 */
ADC_TEMP_SENSOR_CHARGER, /* ADC 5 */
/* Number of ADC channels */
ADC_CH_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
enum pwm_channel {
PWM_CH_LED_GREEN,
@@ -122,10 +118,7 @@ enum pwm_channel {
PWM_CH_COUNT,
};
-enum fan_channel {
- FAN_CH_0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0, FAN_CH_COUNT };
enum temp_sensor_id {
TEMP_SENSOR_CPU,
diff --git a/board/goroh/build.mk b/board/goroh/build.mk
index 4bc0561678..5f2dea191a 100644
--- a/board/goroh/build.mk
+++ b/board/goroh/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/goroh/ec.tasklist b/board/goroh/ec.tasklist
index 6bc80781d8..148b7679ae 100644
--- a/board/goroh/ec.tasklist
+++ b/board/goroh/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/goroh/fans.c b/board/goroh/fans.c
index 415eb9681d..1ac9a79acb 100644
--- a/board/goroh/fans.c
+++ b/board/goroh/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/goroh/gpio.inc b/board/goroh/gpio.inc
index 9d10ea37bd..5d534044fe 100644
--- a/board/goroh/gpio.inc
+++ b/board/goroh/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/goroh/led.c b/board/goroh/led.c
index 63f00ef82e..7ed155acc0 100644
--- a/board/goroh/led.c
+++ b/board/goroh/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,13 +9,10 @@
#include "pwm.h"
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Green, Red */
- [EC_LED_COLOR_RED] = { 0, 100 },
- [EC_LED_COLOR_GREEN] = { 100, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 0, 0 },
- [EC_LED_COLOR_AMBER] = { 0, 0 },
+ /* Green, Red */
+ [EC_LED_COLOR_RED] = { 0, 100 }, [EC_LED_COLOR_GREEN] = { 100, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0 }, [EC_LED_COLOR_YELLOW] = { 0, 0 },
+ [EC_LED_COLOR_WHITE] = { 0, 0 }, [EC_LED_COLOR_AMBER] = { 0, 0 },
};
struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = {
diff --git a/board/goroh/sensors.c b/board/goroh/sensors.c
index fe0a50b762..4499ebf64c 100644
--- a/board/goroh/sensors.c
+++ b/board/goroh/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/goroh/usbc_confg.c b/board/goroh/usbc_confg.c
index 57a52da986..2f1b4a021f 100644
--- a/board/goroh/usbc_confg.c
+++ b/board/goroh/usbc_confg.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/grunt/battery.c b/board/grunt/battery.c
index 359ec9785b..7c7ec44c56 100644
--- a/board/grunt/battery.c
+++ b/board/grunt/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/grunt/board.c b/board/grunt/board.c
index 0efa8b9696..9c4666fec5 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,52 +25,40 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_AC_PRESENT,
GPIO_POWER_BUTTON_L,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "kblight",
- .port = I2C_PORT_KBLIGHT,
- .kbps = 100,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL_AP,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "kblight",
+ .port = I2C_PORT_KBLIGHT,
+ .kbps = 100,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/grunt/board.h b/board/grunt/board.h
index fe0d9e3d0f..b8cb063dee 100644
--- a/board/grunt/board.h
+++ b/board/grunt/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -62,7 +62,7 @@
/*
* Slew rate on the PP1800_SENSOR load switch requires a short delay on startup.
*/
-#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
+#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
#define CONFIG_MOTION_SENSE_RESUME_DELAY_US (10 * MSEC)
#ifndef __ASSEMBLER__
diff --git a/board/grunt/build.mk b/board/grunt/build.mk
index c808e65aed..d24127ddae 100644
--- a/board/grunt/build.mk
+++ b/board/grunt/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/grunt/ec.tasklist b/board/grunt/ec.tasklist
index dc898c4502..9572d61c8f 100644
--- a/board/grunt/ec.tasklist
+++ b/board/grunt/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/grunt/gpio.inc b/board/grunt/gpio.inc
index 97f5afabfd..8c75686f47 100644
--- a/board/grunt/gpio.inc
+++ b/board/grunt/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/grunt/led.c b/board/grunt/led.c
index 824ec55f6c..0a7a794bfd 100644
--- a/board/grunt/led.c
+++ b/board/grunt/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,13 +19,10 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* both LEDs being off.
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Amber, Blue */
- [EC_LED_COLOR_RED] = { 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 0, 0 },
- [EC_LED_COLOR_AMBER] = { 100, 0 },
+ /* Amber, Blue */
+ [EC_LED_COLOR_RED] = { 0, 0 }, [EC_LED_COLOR_GREEN] = { 0, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 100 }, [EC_LED_COLOR_YELLOW] = { 0, 0 },
+ [EC_LED_COLOR_WHITE] = { 0, 0 }, [EC_LED_COLOR_AMBER] = { 100, 0 },
};
/* One logical LED with amber and blue channels. */
diff --git a/board/gumboz/battery.c b/board/gumboz/battery.c
index 7d1831fdbc..8b9b3ddf96 100644
--- a/board/gumboz/battery.c
+++ b/board/gumboz/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/gumboz/board.c b/board/gumboz/board.c
index f90902f765..82522ada4d 100644
--- a/board/gumboz/board.c
+++ b/board/gumboz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "driver/accel_kionix.h"
#include "driver/accelgyro_lsm6dsm.h"
#include "driver/bc12/pi3usb9201.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/usb_mux/amd_fp5.h"
@@ -36,8 +36,8 @@
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* This I2C moved. Temporarily detect and support the V0 HW. */
int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1;
@@ -49,21 +49,17 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* sensor private data */
-static struct kionix_accel_data g_kx022_data;
+static struct kionix_accel_data g_kx022_data;
static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
struct motion_sensor_t motion_sensors[] = {
@@ -199,33 +195,43 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since PI3USB221 is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
-struct usb_mux usbc1_amd_fp5_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+struct usb_mux_chain usbc1_amd_fp5_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .next_mux = &usbc1_amd_fp5_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ },
+ .next = &usbc1_amd_fp5_usb_mux,
}
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -268,8 +274,7 @@ void ppc_interrupt(enum gpio_signal signal)
int board_set_active_charge_port(int port)
{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (port == CHARGE_PORT_NONE) {
@@ -290,7 +295,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
/* Check if the port is sourcing VBUS. */
if (ppc_is_sourcing_vbus(port)) {
CPRINTFUSB("Skip enable C%d", port);
@@ -392,7 +396,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -463,11 +466,9 @@ int board_pd_set_frs_enable(int port, int enable)
/* Use the TCPC to enable fast switch when FRS included */
if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable);
} else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, !!enable);
}
return rv;
@@ -539,14 +540,13 @@ int usb_port_enable[USBA_PORT_COUNT] = {
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {0, 5}, {1, 1}, {1, 0}, {0, 6}, {0, 7},
- {1, 4}, {1, 3}, {1, 6}, {1, 7}, {3, 1},
- {2, 0}, {1, 5}, {2, 6}, {2, 7}, {2, 1},
- {2, 4}, {2, 5}, {1, 2}, {2, 3}, {2, 2},
- {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 }, { 1, 4 },
+ { 1, 3 }, { 1, 6 }, { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 },
+ { 2, 6 }, { 2, 7 }, { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 },
+ { 2, 3 }, { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
#define CHARGING_CURRENT_500MA 500
@@ -586,12 +586,11 @@ int charger_profile_override(struct charge_state_data *curr)
if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
return 0;
- curr->requested_current = (limit_charge) ? CHARGING_CURRENT_500MA
- : curr->batt.desired_current;
+ curr->requested_current = (limit_charge) ? CHARGING_CURRENT_500MA :
+ curr->batt.desired_current;
if (limit_usbc_power != limit_usbc_power_backup) {
- rp = (limit_usbc_power) ? TYPEC_RP_1A5
- : TYPEC_RP_3A0;
+ rp = (limit_usbc_power) ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
@@ -605,13 +604,13 @@ int charger_profile_override(struct charge_state_data *curr)
}
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
return EC_RES_INVALID_PARAM;
}
diff --git a/board/gumboz/board.h b/board/gumboz/board.h
index 42e2b23c32..b2f7682ed8 100644
--- a/board/gumboz/board.h
+++ b/board/gumboz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,7 +20,7 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PORT_ENABLE_DYNAMIC
-#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 40000
#define CONFIG_CHARGER_PROFILE_OVERRIDE
@@ -38,7 +38,7 @@
#define CONFIG_ACCELGYRO_LSM6DSM
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_TABLET_MODE
@@ -48,42 +48,36 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-
-
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
/* This I2C moved. Temporarily detect and support the V0 HW. */
extern int I2C_PORT_BATTERY;
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_SIMPLO_COS,
@@ -95,20 +89,11 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
-enum ioex_port {
- IOEX_C0_NCT3807 = 0,
- IOEX_C1_NCT3807,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT3807 = 0, IOEX_C1_NCT3807, IOEX_PORT_COUNT };
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB3_C0_DP2_HPD \
- : GPIO_DP1_HPD)
+#define PORT_TO_HPD(port) ((port == 0) ? GPIO_USB3_C0_DP2_HPD : GPIO_DP1_HPD)
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -117,17 +102,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
diff --git a/board/gumboz/build.mk b/board/gumboz/build.mk
index 1c0cbc4f63..45c71f962c 100644
--- a/board/gumboz/build.mk
+++ b/board/gumboz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/gumboz/ec.tasklist b/board/gumboz/ec.tasklist
index d9c1606eb2..abc796f74f 100644
--- a/board/gumboz/ec.tasklist
+++ b/board/gumboz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gumboz/gpio.inc b/board/gumboz/gpio.inc
index 9beaecc17a..2e7e4b78a9 100644
--- a/board/gumboz/gpio.inc
+++ b/board/gumboz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/gumboz/led.c b/board/gumboz/led.c
index ac27fe3a2c..95f61494f9 100644
--- a/board/gumboz/led.c
+++ b/board/gumboz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,11 +23,9 @@
#define LED_TICKS_PER_CYCLE 10
#define LED_ON_TICKS 5
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -35,13 +33,10 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- LEFT_PORT = 0,
- RIGHT_PORT
-};
+enum led_port { LEFT_PORT = 0, RIGHT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
@@ -51,9 +46,9 @@ static void led_set_color_battery(int port, enum led_color color)
cbi_get_board_version(&board_ver);
amber_led = (port == LEFT_PORT ? GPIO_LED_CHRG_L :
- IOEX_C1_CHARGER_LED_AMBER_DB);
+ IOEX_C1_CHARGER_LED_AMBER_DB);
white_led = (port == LEFT_PORT ? GPIO_LED_FULL_L :
- IOEX_C1_CHARGER_LED_WHITE_DB);
+ IOEX_C1_CHARGER_LED_WHITE_DB);
if ((board_ver >= 2) && (port == RIGHT_PORT)) {
led_batt_on_lvl = 1;
@@ -156,16 +151,15 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -177,9 +171,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
@@ -188,19 +185,20 @@ static void led_set_battery(void)
led_set_color_battery(LEFT_PORT, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -217,9 +215,10 @@ static void led_set_power(void)
if (chipset_in_state(CHIPSET_STATE_ON))
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power((power_tick %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_power(
+ (power_tick % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/guybrush/battery.c b/board/guybrush/battery.c
index ddf3adff50..e7163c8a11 100644
--- a/board/guybrush/battery.c
+++ b/board/guybrush/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/guybrush/board.c b/board/guybrush/board.c
index 6ba8de04c9..663094233e 100644
--- a/board/guybrush/board.c
+++ b/board/guybrush/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,6 +8,7 @@
#include "adc.h"
#include "base_fw_config.h"
#include "board_fw_config.h"
+#include "builtin/assert.h"
#include "button.h"
#include "common.h"
#include "cros_board_info.h"
@@ -16,7 +17,7 @@
#include "driver/accelgyro_bmi323.h"
#include "driver/accel_bma422.h"
#include "driver/retimer/ps8811.h"
-#include "driver/retimer/ps8818.h"
+#include "driver/retimer/ps8818_public.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/temp_sensor/tmp112.h"
#include "extpower.h"
@@ -45,17 +46,13 @@ static struct bmi_drv_data_t g_bmi_data;
static struct accelgyro_saved_data_t g_bma422_data;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/*
* We have total 30 pins for keyboard connecter {-1, -1} mean
@@ -63,16 +60,15 @@ const mat33_fp_t lid_standard_ref = {
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -222,51 +218,46 @@ board_a1_ps8811_retimer_init(const struct usb_mux *me)
}
__override int board_c1_ps8818_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
/* Set the RX input termination */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_RX_PHY,
- PS8818_RX_INPUT_TERM_MASK,
- PS8818_RX_INPUT_TERM_112_OHM);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_RX_PHY,
+ PS8818_RX_INPUT_TERM_MASK,
+ PS8818_RX_INPUT_TERM_112_OHM);
if (rv)
return rv;
}
@@ -274,11 +265,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_DPEQ_LEVEL,
- PS8818_DPEQ_LEVEL_UP_MASK,
- PS8818_DPEQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_DPEQ_LEVEL,
+ PS8818_DPEQ_LEVEL_UP_MASK,
+ PS8818_DPEQ_LEVEL_UP_19DB);
if (rv)
return rv;
@@ -356,8 +346,7 @@ static void board_chipset_startup(void)
if (get_board_version() > 1)
tmp112_init();
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
int board_get_soc_temp_k(int idx, int *temp_k)
{
@@ -490,8 +479,7 @@ struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
.temp_host_release = {
[EC_TEMP_THRESH_HIGH] = C_TO_K(80),
},
- /* TODO: Setting fan off to 0 so it's allways on */
- .temp_fan_off = C_TO_K(0),
+ .temp_fan_off = C_TO_K(25),
.temp_fan_max = C_TO_K(70),
},
[TEMP_SENSOR_CHARGER] = {
diff --git a/board/guybrush/board.h b/board/guybrush/board.h
index a749802cfa..094b98f23e 100644
--- a/board/guybrush/board.h
+++ b/board/guybrush/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCEL_BMA4XX
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
/* EC console commands */
#define CONFIG_CMD_ACCELS
@@ -36,11 +36,11 @@
#define CONFIG_USB_MUX_ANX7451
#define CONFIG_USBC_RETIMER_ANX7451
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Max Power = 100 W */
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
/* USB Type A Features */
diff --git a/board/guybrush/board_fw_config.c b/board/guybrush/board_fw_config.c
index c919d82851..0484b82461 100644
--- a/board/guybrush/board_fw_config.c
+++ b/board/guybrush/board_fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,14 +9,15 @@
bool board_is_convertible(void)
{
return (get_fw_config_field(FW_CONFIG_FORM_FACTOR_OFFSET,
- FW_CONFIG_FORM_FACTOR_WIDTH)
- == FW_CONFIG_FORM_FACTOR_CONVERTIBLE);
+ FW_CONFIG_FORM_FACTOR_WIDTH) ==
+ FW_CONFIG_FORM_FACTOR_CONVERTIBLE);
}
bool board_has_kblight(void)
{
return (get_fw_config_field(FW_CONFIG_KBLIGHT_OFFSET,
- FW_CONFIG_KBLIGHT_WIDTH) == FW_CONFIG_KBLIGHT_YES);
+ FW_CONFIG_KBLIGHT_WIDTH) ==
+ FW_CONFIG_KBLIGHT_YES);
}
enum board_usb_c1_mux board_get_usb_c1_mux(void)
diff --git a/board/guybrush/board_fw_config.h b/board/guybrush/board_fw_config.h
index 1de417d77a..4477aca6fd 100644
--- a/board/guybrush/board_fw_config.h
+++ b/board/guybrush/board_fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,26 +13,25 @@
/*
* USB Daughter Board (2 bits)
*/
-#define FW_CONFIG_USB_DB_OFFSET 0
-#define FW_CONFIG_USB_DB_WIDTH 2
-#define FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818 0
-#define FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451 1
+#define FW_CONFIG_USB_DB_OFFSET 0
+#define FW_CONFIG_USB_DB_WIDTH 2
+#define FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818 0
+#define FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451 1
/*
* Form Factor (1 bits)
*/
-#define FW_CONFIG_FORM_FACTOR_OFFSET 2
-#define FW_CONFIG_FORM_FACTOR_WIDTH 1
-#define FW_CONFIG_FORM_FACTOR_CLAMSHELL 0
-#define FW_CONFIG_FORM_FACTOR_CONVERTIBLE 1
+#define FW_CONFIG_FORM_FACTOR_OFFSET 2
+#define FW_CONFIG_FORM_FACTOR_WIDTH 1
+#define FW_CONFIG_FORM_FACTOR_CLAMSHELL 0
+#define FW_CONFIG_FORM_FACTOR_CONVERTIBLE 1
/*
* Keyboard Backlight (1 bit)
*/
-#define FW_CONFIG_KBLIGHT_OFFSET 3
-#define FW_CONFIG_KBLIGHT_WIDTH 1
-#define FW_CONFIG_KBLIGHT_NO 0
-#define FW_CONFIG_KBLIGHT_YES 1
-
+#define FW_CONFIG_KBLIGHT_OFFSET 3
+#define FW_CONFIG_KBLIGHT_WIDTH 1
+#define FW_CONFIG_KBLIGHT_NO 0
+#define FW_CONFIG_KBLIGHT_YES 1
#endif /* _GUYBRUSH_CBI_FW_CONFIG__H_ */
diff --git a/board/guybrush/build.mk b/board/guybrush/build.mk
index a7865db889..806e8988a2 100644
--- a/board/guybrush/build.mk
+++ b/board/guybrush/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/guybrush/ec.tasklist b/board/guybrush/ec.tasklist
index f7cf0f7205..7a64850dfb 100644
--- a/board/guybrush/ec.tasklist
+++ b/board/guybrush/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/guybrush/gpio.inc b/board/guybrush/gpio.inc
index b7381f588d..ffc567b261 100644
--- a/board/guybrush/gpio.inc
+++ b/board/guybrush/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/guybrush/led.c b/board/guybrush/led.c
index b17c8be488..26b1fc826a 100644
--- a/board/guybrush/led.c
+++ b/board/guybrush/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,29 +12,37 @@
#include "pwm.h"
/* Note PWM LEDs are active low */
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
-#define CPRINTS(format, args...) cprints(CC_PWM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_PWM, format, ##args)
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/guybrush/thermal.c b/board/guybrush/thermal.c
index 606d21cfdf..5bb1295f84 100644
--- a/board/guybrush/thermal.c
+++ b/board/guybrush/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
diff --git a/board/haboki/battery.c b/board/haboki/battery.c
index 551ff1cbc0..72ad9ad6cb 100644
--- a/board/haboki/battery.c
+++ b/board/haboki/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/haboki/board.c b/board/haboki/board.c
index 3a33787603..d7509115b5 100644
--- a/board/haboki/board.c
+++ b/board/haboki/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,7 +41,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -164,48 +164,36 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
- [ADC_TEMP_SENSOR_4] = {
- .name = "TEMP_SENSOR4",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH16
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
+ [ADC_TEMP_SENSOR_4] = { .name = "TEMP_SENSOR4",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH16 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -254,19 +242,25 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -279,17 +273,13 @@ static struct accelgyro_saved_data_t g_bma253_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
@@ -480,8 +470,8 @@ __override void board_power_5v_enable(int enable)
if (board_get_charger_chip_count() > 1) {
if (sm5803_set_gpio0_level(1, !!enable))
- CPRINTUSB("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTUSB("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
}
@@ -489,11 +479,11 @@ __override uint8_t board_get_usb_pd_port_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT;
ccprints("Unhandled DB configuration: %d", db);
@@ -504,11 +494,11 @@ __override uint8_t board_get_charger_chip_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CHARGER_NUM - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CHARGER_NUM;
ccprints("Unhandled DB configuration: %d", db);
@@ -613,33 +603,31 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
+const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 10000,
+ } };
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "5V regular",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "5V regular",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -669,9 +657,8 @@ __override void lid_angle_peripheral_enable(int enable)
}
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 20;
@@ -690,14 +677,17 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div,
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
- {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
- {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
- {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
- {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { GPIO_KSO_L, 5 }, { GPIO_KSO_L, 6 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/haboki/board.h b/board/haboki/board.h
index 58dafb945f..0365d094ea 100644
--- a/board/haboki/board.h
+++ b/board/haboki/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,20 +23,23 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr \
+ */
/* PWM */
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -69,8 +72,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
@@ -81,8 +84,8 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
/* USB Type A Features */
#define USB_PORT_COUNT 1
@@ -105,21 +108,16 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
- ADC_TEMP_SENSOR_4, /* ADC16 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_TEMP_SENSOR_4, /* ADC16 */
ADC_CH_COUNT
};
diff --git a/board/haboki/build.mk b/board/haboki/build.mk
index aa0e3b766e..4362df50a4 100644
--- a/board/haboki/build.mk
+++ b/board/haboki/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/haboki/cbi_ssfc.c b/board/haboki/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/haboki/cbi_ssfc.c
+++ b/board/haboki/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/haboki/cbi_ssfc.h b/board/haboki/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/haboki/cbi_ssfc.h
+++ b/board/haboki/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/haboki/ec.tasklist b/board/haboki/ec.tasklist
index 5c9a2d1a01..c13df44543 100644
--- a/board/haboki/ec.tasklist
+++ b/board/haboki/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/haboki/gpio.inc b/board/haboki/gpio.inc
index c1a03bfd56..8ecc458a19 100644
--- a/board/haboki/gpio.inc
+++ b/board/haboki/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/haboki/led.c b/board/haboki/led.c
index 3e3a61edc2..b31d4fab75 100644
--- a/board/haboki/led.c
+++ b/board/haboki/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,10 +18,8 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -29,7 +27,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -116,7 +114,6 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -127,9 +124,9 @@ static void led_set_battery(void)
*/
if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT) {
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x2 ?
- LED_WHITE : LED_OFF);
+ charge_get_state() != PWR_STATE_CHARGE) {
+ led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -158,18 +155,18 @@ static void led_set_battery(void)
led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -186,8 +183,7 @@ static void led_set_power(void)
if (chipset_in_state(CHIPSET_STATE_ON))
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power(
- (power_tick & 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick & 0x2) ? LED_WHITE : LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/haboki/usb_pd_policy.c b/board/haboki/usb_pd_policy.c
index 3ff7152541..8a2c07c575 100644
--- a/board/haboki/usb_pd_policy.c
+++ b/board/haboki/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,18 +65,7 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/hammer/battery.c b/board/hammer/battery.c
index 4025a08b14..df6a716cd7 100644
--- a/board/hammer/battery.c
+++ b/board/hammer/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "util.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
+#define SB_SHUTDOWN_DATA 0x0010
static const struct battery_info info = {
.voltage_max = 8800,
diff --git a/board/hammer/board.c b/board/hammer/board.c
index 3e3491d3e1..4700130b4b 100644
--- a/board/hammer/board.c
+++ b/board/hammer/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,21 +48,21 @@
#define CROS_EC_SECTION "RO"
#endif
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/******************************************************************************
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Hammer"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] =
- USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
- [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Hammer"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] =
+ USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
+ [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
#ifdef CONFIG_USB_ISOCHRONOUS
[USB_STR_HEATMAP_NAME] = USB_STRING_DESC("Heatmap"),
#endif
@@ -84,28 +84,28 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
USB_SPI_CONFIG(usb_spi, USB_IFACE_I2C_SPI, USB_EP_I2C_SPI, 0);
/* SPI interface is always enabled, no need to do anything. */
-void usb_spi_board_enable(struct usb_spi_config const *config) {}
-void usb_spi_board_disable(struct usb_spi_config const *config) {}
-#endif /* !HAS_SPI_TOUCHPAD */
+void usb_spi_board_enable(struct usb_spi_config const *config)
+{
+}
+void usb_spi_board_disable(struct usb_spi_config const *config)
+{
+}
+#endif /* !HAS_SPI_TOUCHPAD */
#ifdef CONFIG_I2C
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 400,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 400,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
#ifdef BOARD_WAND
- {
- .name = "charger",
- .port = I2C_PORT_CHARGER,
- .kbps = 100,
- .scl = GPIO_CHARGER_I2C_SCL,
- .sda = GPIO_CHARGER_I2C_SDA
- },
+ { .name = "charger",
+ .port = I2C_PORT_CHARGER,
+ .kbps = 100,
+ .scl = GPIO_CHARGER_I2C_SCL,
+ .sda = GPIO_CHARGER_I2C_SDA },
#endif
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -125,7 +125,7 @@ const struct charger_config_t chg_chips[] = {
#ifdef HAS_BACKLIGHT
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- {STM32_TIM(TIM_KBLIGHT), STM32_TIM_CH(1), 0, KBLIGHT_PWM_FREQ},
+ { STM32_TIM(TIM_KBLIGHT), STM32_TIM_CH(1), 0, KBLIGHT_PWM_FREQ },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
#endif /* HAS_BACKLIGHT */
@@ -154,26 +154,22 @@ __override struct keyboard_scan_config keyscan_config = {
struct consumer const ec_ec_usart_consumer;
static struct usart_config const ec_ec_usart;
-struct queue const ec_ec_comm_server_input = QUEUE_DIRECT(64, uint8_t,
- ec_ec_usart.producer, ec_ec_usart_consumer);
-struct queue const ec_ec_comm_server_output = QUEUE_DIRECT(64, uint8_t,
- null_producer, ec_ec_usart.consumer);
+struct queue const ec_ec_comm_server_input =
+ QUEUE_DIRECT(64, uint8_t, ec_ec_usart.producer, ec_ec_usart_consumer);
+struct queue const ec_ec_comm_server_output =
+ QUEUE_DIRECT(64, uint8_t, null_producer, ec_ec_usart.consumer);
struct consumer const ec_ec_usart_consumer = {
.queue = &ec_ec_comm_server_input,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = ec_ec_comm_server_written,
}),
};
static struct usart_config const ec_ec_usart =
- USART_CONFIG(EC_EC_UART,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 115200,
- USART_CONFIG_FLAG_HDSEL,
- ec_ec_comm_server_input,
- ec_ec_comm_server_output);
+ USART_CONFIG(EC_EC_UART, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ USART_CONFIG_FLAG_HDSEL, ec_ec_comm_server_input,
+ ec_ec_comm_server_output);
#endif /* BOARD_WAND && SECTION_IS_RW */
/******************************************************************************
@@ -280,9 +276,9 @@ static void board_tablet_mode_change(void)
keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE);
}
DECLARE_HOOK(HOOK_TABLET_MODE_CHANGE, board_tablet_mode_change,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
/* Run after tablet_mode_init. */
-DECLARE_HOOK(HOOK_INIT, board_tablet_mode_change, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, board_tablet_mode_change, HOOK_PRIO_DEFAULT + 1);
#endif
/*
@@ -295,7 +291,7 @@ int board_get_entropy(void *buffer, int len)
uint8_t *data = buffer;
uint32_t start;
/* We expect one SOF per ms, so wait at most 2ms. */
- const uint32_t timeout = 2*MSEC;
+ const uint32_t timeout = 2 * MSEC;
for (i = 0; i < len; i++) {
STM32_CRS_ICR |= STM32_CRS_ICR_SYNCOKC;
@@ -326,8 +322,9 @@ __override const char *board_read_serial(void)
int i;
for (i = 0; i < idlen && pos < sizeof(str); i++, pos += 2) {
- snprintf(&str[pos], sizeof(str)-pos,
- "%02x", id[i]);
+ if (snprintf(&str[pos], sizeof(str) - pos, "%02x",
+ id[i]) < 0)
+ return NULL;
}
}
@@ -390,8 +387,8 @@ static const struct ec_response_keybd_config duck_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override
-const struct ec_response_keybd_config *board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (IS_ENABLED(BOARD_ZED) || IS_ENABLED(BOARD_STAR) ||
IS_ENABLED(BOARD_GELATIN))
diff --git a/board/hammer/board.h b/board/hammer/board.h
index 768d15bc5b..bce7dc39f4 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,27 +46,27 @@
/* Do not use a dedicated PSTATE bank */
#undef CONFIG_FLASH_PSTATE_BANK
-#define CONFIG_SHAREDLIB_SIZE 0
+#define CONFIG_SHAREDLIB_SIZE 0
-#define CONFIG_RO_MEM_OFF 0
-#define CONFIG_RO_STORAGE_OFF 0
-#define CONFIG_RO_SIZE (44*1024)
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_STORAGE_OFF 0
+#define CONFIG_RO_SIZE (44 * 1024)
/* EC rollback protection block */
#define CONFIG_ROLLBACK_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
#define CONFIG_ROLLBACK_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
-#define CONFIG_RW_STORAGE_OFF 0
-#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - CONFIG_RW_MEM_OFF)
+#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
+#define CONFIG_RW_STORAGE_OFF 0
+#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - CONFIG_RW_MEM_OFF)
-#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
-#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
-#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
-#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
+#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
+#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
+#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
-#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
-#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
+#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
+#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
/* The UART console is on USART1 (PA9/PA10) */
#undef CONFIG_UART_CONSOLE
@@ -110,48 +110,48 @@
/* USB interface indexes (use define rather than enum to expand them) */
#ifdef SECTION_IS_RW
-#define USB_IFACE_HID_KEYBOARD 0
-#define USB_IFACE_UPDATE 1
+#define USB_IFACE_HID_KEYBOARD 0
+#define USB_IFACE_UPDATE 1
#ifdef HAS_NO_TOUCHPAD
-#define USB_IFACE_COUNT 2
+#define USB_IFACE_COUNT 2
#else /* !HAS_NO_TOUCHPAD */
-#define USB_IFACE_HID_TOUCHPAD 2
+#define USB_IFACE_HID_TOUCHPAD 2
/* Can be either I2C or SPI passthrough, depending on the board. */
-#define USB_IFACE_I2C_SPI 3
+#define USB_IFACE_I2C_SPI 3
#if defined(CONFIG_USB_ISOCHRONOUS)
-#define USB_IFACE_ST_TOUCHPAD 4
-#define USB_IFACE_COUNT 5
-#else /* !CONFIG_USB_ISOCHRONOUS */
-#define USB_IFACE_COUNT 4
-#endif /* CONFIG_USB_ISOCHRONOUS */
+#define USB_IFACE_ST_TOUCHPAD 4
+#define USB_IFACE_COUNT 5
+#else /* !CONFIG_USB_ISOCHRONOUS */
+#define USB_IFACE_COUNT 4
+#endif /* CONFIG_USB_ISOCHRONOUS */
#endif /* !HAS_NO_TOUCHPAD */
-#else /* !SECTION_IS_RW */
-#define USB_IFACE_UPDATE 0
-#define USB_IFACE_COUNT 1
-#endif /* SECTION_IS_RW */
+#else /* !SECTION_IS_RW */
+#define USB_IFACE_UPDATE 0
+#define USB_IFACE_COUNT 1
+#endif /* SECTION_IS_RW */
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_UPDATE 1
+#define USB_EP_CONTROL 0
+#define USB_EP_UPDATE 1
#ifdef SECTION_IS_RW
-#define USB_EP_HID_KEYBOARD 2
+#define USB_EP_HID_KEYBOARD 2
#ifdef HAS_NO_TOUCHPAD
-#define USB_EP_COUNT 3
+#define USB_EP_COUNT 3
#else /* !HAS_NO_TOUCHPAD */
-#define USB_EP_HID_TOUCHPAD 3
+#define USB_EP_HID_TOUCHPAD 3
/* Can be either I2C or SPI passthrough, depending on the board. */
-#define USB_EP_I2C_SPI 4
+#define USB_EP_I2C_SPI 4
#if defined(CONFIG_USB_ISOCHRONOUS)
-#define USB_EP_ST_TOUCHPAD 5
-#define USB_EP_ST_TOUCHPAD_INT 6
-#define USB_EP_COUNT 7
+#define USB_EP_ST_TOUCHPAD 5
+#define USB_EP_ST_TOUCHPAD_INT 6
+#define USB_EP_COUNT 7
#else /* !CONFIG_USB_ISOCHRONOUS */
-#define USB_EP_COUNT 5
+#define USB_EP_COUNT 5
#endif /* CONFIG_USB_ISOCHRONOUS */
#endif /* !HAS_NO_TOUCHPAD */
-#else /* !SECTION_IS_RW */
-#define USB_EP_COUNT 2
-#endif /* SECTION_IS_RW */
+#else /* !SECTION_IS_RW */
+#define USB_EP_COUNT 2
+#endif /* SECTION_IS_RW */
/* Optional features */
#define CONFIG_BOARD_PRE_INIT
@@ -177,13 +177,19 @@
#undef CONFIG_USB_I2C_MAX_WRITE_COUNT
#ifdef VARIANT_HAMMER_TP_LARGE_PAGE
/* Zed requires 516 byte per packet for touchpad update */
-#define CONFIG_USB_I2C_MAX_WRITE_COUNT (1024 - 4) /* 4 is maximum header size */
+#define CONFIG_USB_I2C_MAX_WRITE_COUNT \
+ (1024 - 4) /* 4 is maximum header size \
+ */
#else
-#define CONFIG_USB_I2C_MAX_WRITE_COUNT (128 - 4) /* 4 is maximum header size */
+#define CONFIG_USB_I2C_MAX_WRITE_COUNT \
+ (128 - 4) /* 4 is maximum header size \
+ */
#endif
#undef CONFIG_USB_I2C_MAX_READ_COUNT
-#define CONFIG_USB_I2C_MAX_READ_COUNT (1024 - 6) /* 6 is maximum header size */
+#define CONFIG_USB_I2C_MAX_READ_COUNT \
+ (1024 - 6) /* 6 is maximum header size \
+ */
#define CONFIG_I2C_XFER_LARGE_TRANSFER
@@ -201,7 +207,7 @@
#define CONFIG_USB_HID_TOUCHPAD
/* Virtual address for touchpad FW in USB updater. */
-#define CONFIG_TOUCHPAD_VIRTUAL_OFF 0x80000000
+#define CONFIG_TOUCHPAD_VIRTUAL_OFF 0x80000000
/* Include touchpad FW hashes in image */
#define CONFIG_TOUCHPAD_HASH_FW
@@ -315,10 +321,10 @@
#endif
/* Maximum current to draw. */
-#define MAX_CURRENT_MA 2000
+#define MAX_CURRENT_MA 2000
/* Maximum current/voltage to provide over OTG. */
-#define MAX_OTG_CURRENT_MA 2000
-#define MAX_OTG_VOLTAGE_MV 20000
+#define MAX_OTG_CURRENT_MA 2000
+#define MAX_OTG_VOLTAGE_MV 20000
#ifndef __ASSEMBLER__
diff --git a/board/hammer/build.mk b/board/hammer/build.mk
index b32a6b768a..d41aed0d84 100644
--- a/board/hammer/build.mk
+++ b/board/hammer/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/hammer/ec.tasklist b/board/hammer/ec.tasklist
index b568619065..e528d20cd8 100644
--- a/board/hammer/ec.tasklist
+++ b/board/hammer/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hammer/gpio.inc b/board/hammer/gpio.inc
index 8372d4fc4b..d79895564d 100644
--- a/board/hammer/gpio.inc
+++ b/board/hammer/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hammer/variants.h b/board/hammer/variants.h
index 71e70f5758..06dbe3d0f7 100644
--- a/board/hammer/variants.h
+++ b/board/hammer/variants.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -55,7 +55,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1018 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 566 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (48*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (48 * 1024)
#elif defined(BOARD_BLAND)
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
@@ -65,7 +65,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 839 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 457 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#elif defined(BOARD_DON)
#define HAS_I2C_TOUCHPAD
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2925
@@ -73,7 +73,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 929 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 457 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56 * 1024)
#elif defined(BOARD_DUCK)
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
@@ -83,7 +83,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 839 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 457 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#elif defined(BOARD_EEL)
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
@@ -93,7 +93,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 839 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 457 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#elif defined(BOARD_GELATIN)
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
@@ -104,7 +104,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1060 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 575 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#elif defined(BOARD_MAGNEMITE)
#define HAS_NO_TOUCHPAD
#elif defined(BOARD_MASTERBALL)
@@ -114,7 +114,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 839 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 457 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#elif defined(BOARD_MOONBALL)
#define HAS_I2C_TOUCHPAD
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2925
@@ -122,7 +122,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 929 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 457 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56 * 1024)
#elif defined(BOARD_STAFF)
#define HAS_I2C_TOUCHPAD
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 3206
@@ -130,7 +130,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1018 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 582 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (56 * 1024)
#elif defined(BOARD_STAR)
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
@@ -140,7 +140,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1042 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 569 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#elif defined(BOARD_WHISKERS)
#define HAS_SPI_TOUCHPAD
#define HAS_EN_PP3300_TP_ACTIVE_HIGH
@@ -149,7 +149,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 255
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1031 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 751 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (CONFIG_UPDATE_PDU_SIZE + 128*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (CONFIG_UPDATE_PDU_SIZE + 128 * 1024)
/* Enable to send heatmap to AP */
#define CONFIG_USB_ISOCHRONOUS
#elif defined(BOARD_ZED)
@@ -163,7 +163,7 @@
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_PRESSURE 511
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_X 1060 /* tenth of mm */
#define CONFIG_USB_HID_TOUCHPAD_PHYSICAL_MAX_Y 575 /* tenth of mm */
-#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64*1024)
+#define CONFIG_TOUCHPAD_VIRTUAL_SIZE (64 * 1024)
#else
#error "No touchpad information for board."
#endif
@@ -175,8 +175,8 @@
#endif
/* Backlight */
-#if defined(BOARD_HAMMER) || defined(BOARD_STAFF) || \
- defined(BOARD_WAND) || defined(BOARD_WHISKERS)
+#if defined(BOARD_HAMMER) || defined(BOARD_STAFF) || defined(BOARD_WAND) || \
+ defined(BOARD_WHISKERS)
/*
* Even with this option, we detect the backlight presence using a PU/PD on the
* PWM pin. Not defining this totally disables support.
@@ -196,9 +196,9 @@
#endif /* BOARD_HAMMER/WAND/WHISKERS */
/* GMR sensor for tablet mode detection */
-#if defined(BOARD_DON) || defined(BOARD_MASTERBALL) || \
- defined(BOARD_MOONBALL) || defined(BOARD_WHISKERS) || \
- defined(BOARD_EEL)
+#if defined(BOARD_DON) || defined(BOARD_MASTERBALL) || \
+ defined(BOARD_MOONBALL) || defined(BOARD_WHISKERS) || \
+ defined(BOARD_EEL)
#define CONFIG_GMR_TABLET_MODE
#endif
diff --git a/board/hatch/battery.c b/board/hatch/battery.c
index b81fa795b9..444262b353 100644
--- a/board/hatch/battery.c
+++ b/board/hatch/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/hatch/board.c b/board/hatch/board.c
index 1cb3282299..a15e276113 100644
--- a/board/hatch/board.c
+++ b/board/hatch/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,8 +42,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* GPIO to enable/disable the USB Type-A port. */
const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
@@ -109,16 +109,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -144,16 +144,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -220,22 +224,18 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/*
* TODO(b/124337208): P0 boards don't have this sensor mounted so the rotation
* matrix can't be tested properly. This needs to be revisited after EVT to make
* sure the rotaiton matrix for the lid sensor is correct.
*/
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -359,7 +359,7 @@ BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -378,32 +378,31 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Temp1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Temp2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Temp1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Temp2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Hatch Temperature sensors */
/*
* TODO(b/124316213): These setting need to be reviewed and set appropriately
@@ -413,8 +412,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -469,7 +468,6 @@ static void board_gpio_set_pp5000(void)
} else if (board_id >= 1) {
reset_gpio_flags(GPIO_EN_PP5000_A_V1, GPIO_OUT_LOW);
}
-
}
static void board_init(void)
diff --git a/board/hatch/board.h b/board/hatch/board.h
index 78c97372ec..0de9a4828f 100644
--- a/board/hatch/board.h
+++ b/board/hatch/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
-#define I2C_PORT_ALS I2C_PORT_SENSOR
+#define I2C_PORT_ALS I2C_PORT_SENSOR
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_COMM_LOCKED
@@ -107,16 +107,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -128,8 +128,8 @@
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
ADC_CH_COUNT
};
@@ -142,11 +142,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
@@ -160,11 +156,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/hatch/build.mk b/board/hatch/build.mk
index 733912454f..13153c1526 100644
--- a/board/hatch/build.mk
+++ b/board/hatch/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/hatch/ec.tasklist b/board/hatch/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/hatch/ec.tasklist
+++ b/board/hatch/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch/gpio.inc b/board/hatch/gpio.inc
index cd241f15f5..22cda73feb 100644
--- a/board/hatch/gpio.inc
+++ b/board/hatch/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/hatch/led.c b/board/hatch/led.c
index d03aed0585..5bb76e1812 100644
--- a/board/hatch/led.c
+++ b/board/hatch/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,22 +19,26 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/hatch_fp/board.c b/board/hatch_fp/board.c
index b48dce2b7e..00e7949083 100644
--- a/board/hatch_fp/board.c
+++ b/board/hatch_fp/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/board.h b/board/hatch_fp/board.h
index 290e0f80e6..d36a9228c1 100644
--- a/board/hatch_fp/board.h
+++ b/board/hatch_fp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -59,28 +59,28 @@
#define CONFIG_FLASH_WRITE_SIZE STM32_FLASH_WRITE_SIZE_3300
-#define CONFIG_SHAREDLIB_SIZE 0
+#define CONFIG_SHAREDLIB_SIZE 0
-#define CONFIG_RO_MEM_OFF 0
-#define CONFIG_RO_STORAGE_OFF 0
-#define CONFIG_RO_SIZE (128 * 1024)
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_STORAGE_OFF 0
+#define CONFIG_RO_SIZE (128 * 1024)
/* EC rollback protection block */
#define CONFIG_ROLLBACK_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
#define CONFIG_ROLLBACK_SIZE (128 * 1024 * 2) /* 2 blocks of 128KB each */
-#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
-#define CONFIG_RW_STORAGE_OFF 0
-#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - \
- (CONFIG_RW_MEM_OFF - CONFIG_RO_MEM_OFF))
+#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
+#define CONFIG_RW_STORAGE_OFF 0
+#define CONFIG_RW_SIZE \
+ (CONFIG_FLASH_SIZE_BYTES - (CONFIG_RW_MEM_OFF - CONFIG_RO_MEM_OFF))
-#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
-#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
-#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
-#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
+#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
+#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
+#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
-#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
-#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
+#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
+#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
/*
* We want to prevent flash readout, and use it as indicator of protection
@@ -189,7 +189,7 @@
/* SPI configuration for the fingerprint sensor */
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FP_PORT 0 /* SPI2: first master config */
+#define CONFIG_SPI_FP_PORT 0 /* SPI2: first master config */
#define CONFIG_FINGERPRINT_MCU
#ifdef SECTION_IS_RW
#define CONFIG_FP_SENSOR_FPC1025
@@ -230,7 +230,7 @@
#define CONFIG_HOST_COMMAND_STATUS
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
-#define CONFIG_PRINTF_LEGACY_LI_FORMAT
+#define CONFIG_PRINTF_LONG_IS_32BITS
#define CONFIG_RNG
#define CONFIG_SHA256
#define CONFIG_SHA256_UNROLLED
diff --git a/board/hatch_fp/board_rw.c b/board/hatch_fp/board_rw.c
index 00a6b89b19..93a62b09bc 100644
--- a/board/hatch_fp/board_rw.c
+++ b/board/hatch_fp/board_rw.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/board_rw.h b/board/hatch_fp/board_rw.h
index 1bee6c947d..fc38dcc259 100644
--- a/board/hatch_fp/board_rw.h
+++ b/board/hatch_fp/board_rw.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/build.mk b/board/hatch_fp/build.mk
index cffb093fc8..d42dc15918 100644
--- a/board/hatch_fp/build.mk
+++ b/board/hatch_fp/build.mk
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -31,6 +31,7 @@ test-list-y=\
compile_time_macros \
cortexm_fpu \
crc \
+ debug \
flash_physical \
flash_write_protect \
fpsensor \
@@ -49,6 +50,7 @@ test-list-y=\
sha256 \
sha256_unrolled \
static_if \
+ stdlib \
stm32f_rtc \
system_is_locked \
timer_dos \
diff --git a/board/hatch_fp/ec.tasklist b/board/hatch_fp/ec.tasklist
index ed1e6ed294..2a4771fa98 100644
--- a/board/hatch_fp/ec.tasklist
+++ b/board/hatch_fp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/fpsensor_detect.c b/board/hatch_fp/fpsensor_detect.c
index 638b5fbfe0..7e3b99cac7 100644
--- a/board/hatch_fp/fpsensor_detect.c
+++ b/board/hatch_fp/fpsensor_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/fpsensor_detect_rw.c b/board/hatch_fp/fpsensor_detect_rw.c
index 274cfee054..2a313cda18 100644
--- a/board/hatch_fp/fpsensor_detect_rw.c
+++ b/board/hatch_fp/fpsensor_detect_rw.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/gpio.inc b/board/hatch_fp/gpio.inc
index c5319c2bee..dc185751bc 100644
--- a/board/hatch_fp/gpio.inc
+++ b/board/hatch_fp/gpio.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hatch_fp/gpio_rw.inc b/board/hatch_fp/gpio_rw.inc
index 3dfe890c12..dc82cd984a 100644
--- a/board/hatch_fp/gpio_rw.inc
+++ b/board/hatch_fp/gpio_rw.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/helios/battery.c b/board/helios/battery.c
index c7168caf8a..dcc9503244 100644
--- a/board/helios/battery.c
+++ b/board/helios/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/helios/board.c b/board/helios/board.c
index b4d2fb1ef8..256459314c 100644
--- a/board/helios/board.c
+++ b/board/helios/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -134,16 +134,16 @@ static void board_gmr_tablet_switch_isr(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -168,16 +168,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -215,22 +219,18 @@ enum base_accelgyro_type {
static enum base_accelgyro_type base_accelgyro_config;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static const mat33_fp_t base_standard_ref_icm = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)},
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
struct motion_sensor_t icm426xx_base_accel = {
@@ -379,8 +379,7 @@ static void board_detect_motionsense(void)
ccprints("Base Accelgyro: BMI160");
}
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsense,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsense, HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_INIT, board_detect_motionsense, HOOK_PRIO_INIT_I2C + 1);
/******************************************************************************/
@@ -388,7 +387,7 @@ DECLARE_HOOK(HOOK_INIT, board_detect_motionsense, HOOK_PRIO_INIT_I2C + 1);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -407,40 +406,40 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_AMB", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_4] = {
- "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_AMB", NPCX_ADC_CH3, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_4] = { "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Temp1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Temp2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Temp3",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "Temp4",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Temp1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Temp2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Temp3",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "Temp4",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -448,8 +447,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
@@ -500,8 +499,8 @@ int board_tcpc_post_init(int port)
/* Set MUX_DP_EQ to 3.6dB (0x98) */
rv = tcpc_write(port, PS8XXX_REG_MUX_DP_EQ_CONFIGURATION, 0x98);
else if (port == USB_PD_PORT_TCPC_1)
- rv = tcpc_write(port,
- PS8XXX_REG_MUX_USB_C2SS_HS_THRESHOLD, 0x80);
+ rv = tcpc_write(port, PS8XXX_REG_MUX_USB_C2SS_HS_THRESHOLD,
+ 0x80);
return rv;
}
diff --git a/board/helios/board.h b/board/helios/board.h
index 174c5157b6..83ffd2b4b7 100644
--- a/board/helios/board.h
+++ b/board/helios/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,7 +56,7 @@
* Helios' battery takes several seconds to come back out of its disconnect
* state (~4.2 seconds on the unit I have, so give it a little more for margin).
*/
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6
/* BC 1.2 */
@@ -85,16 +85,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -102,10 +102,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC3 */
- ADC_TEMP_SENSOR_4, /* ADC2 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC3 */
+ ADC_TEMP_SENSOR_4, /* ADC2 */
ADC_CH_COUNT
};
@@ -117,11 +117,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/helios/build.mk b/board/helios/build.mk
index 733912454f..13153c1526 100644
--- a/board/helios/build.mk
+++ b/board/helios/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/helios/ec.tasklist b/board/helios/ec.tasklist
index 63d366a33b..7fb3e38b63 100644
--- a/board/helios/ec.tasklist
+++ b/board/helios/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/helios/gpio.inc b/board/helios/gpio.inc
index d16e1643be..65fc10f761 100644
--- a/board/helios/gpio.inc
+++ b/board/helios/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,10 +17,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/helios/led.c b/board/helios/led.c
index 7a63c4401c..92fb7d80ce 100644
--- a/board/helios/led.c
+++ b/board/helios/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,29 +19,37 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/herobrine/battery.c b/board/herobrine/battery.c
index 38e22aafb3..84c43cc263 100644
--- a/board/herobrine/battery.c
+++ b/board/herobrine/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/herobrine/board.c b/board/herobrine/board.c
index fea8bf3a88..1ef1801c44 100644
--- a/board/herobrine/board.c
+++ b/board/herobrine/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,8 +26,8 @@
#include "usbc_config.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#include "gpio_list.h"
@@ -50,10 +50,8 @@ __override struct keyboard_scan_config keyscan_config = {
* Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key);
* as it still uses the legacy location (KSO_01/KSI_00).
*/
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -64,48 +62,36 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "rtc",
- .port = I2C_PORT_RTC,
- .kbps = 400,
- .scl = GPIO_EC_I2C_RTC_SCL,
- .sda = GPIO_EC_I2C_RTC_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "rtc",
+ .port = I2C_PORT_RTC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_RTC_SCL,
+ .sda = GPIO_EC_I2C_RTC_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -113,37 +99,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -214,17 +185,13 @@ static struct bmi_drv_data_t g_bmi260_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/herobrine/board.h b/board/herobrine/board.h
index 15cbcf305a..59580826f5 100644
--- a/board/herobrine/board.h
+++ b/board/herobrine/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@
#define CONFIG_PWM_KBLIGHT
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
@@ -62,26 +62,21 @@
#define CONFIG_GMR_TABLET_MODE
/* GPIO alias */
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_SWITCHCAP_PG GPIO_SRC_VPH_PWR_PG
-#define GPIO_ACOK_OD GPIO_CHG_ACOK_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_S5
-#define GPIO_POWER_GOOD GPIO_MB_POWER_GOOD
-#define GPIO_EC_INT_L GPIO_AP_EC_INT_L
-#define GPIO_DP_HOT_PLUG_DET GPIO_DP_HOT_PLUG_DET_R
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_SWITCHCAP_PG GPIO_SRC_VPH_PWR_PG
+#define GPIO_ACOK_OD GPIO_CHG_ACOK_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_S5
+#define GPIO_POWER_GOOD GPIO_MB_POWER_GOOD
+#define GPIO_EC_INT_L GPIO_AP_EC_INT_L
+#define GPIO_DP_HOT_PLUG_DET GPIO_DP_HOT_PLUG_DET_R
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -91,11 +86,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/herobrine/build.mk b/board/herobrine/build.mk
index 601c45a042..6827780a6c 100644
--- a/board/herobrine/build.mk
+++ b/board/herobrine/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/herobrine/ec.tasklist b/board/herobrine/ec.tasklist
index 5beeb38feb..228828af3c 100644
--- a/board/herobrine/ec.tasklist
+++ b/board/herobrine/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/herobrine/gpio.inc b/board/herobrine/gpio.inc
index 239bedd95d..9628684737 100644
--- a/board/herobrine/gpio.inc
+++ b/board/herobrine/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/herobrine/led.c b/board/herobrine/led.c
index 295c8effeb..fb68e85deb 100644
--- a/board/herobrine/led.c
+++ b/board/herobrine/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -31,15 +31,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void side_led_set_color(int port, enum led_color color)
{
gpio_set_level(port ? GPIO_EC_CHG_LED_Y_C1 : GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(port ? GPIO_EC_CHG_LED_W_C1 : GPIO_EC_CHG_LED_W_C0,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -90,7 +90,6 @@ static void set_active_port_color(enum led_color color)
static void board_led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -102,8 +101,9 @@ static void board_led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() <= 10)
- side_led_set_color(0,
- (battery_ticks & 0x4) ? LED_WHITE : LED_OFF);
+ side_led_set_color(0, (battery_ticks & 0x4) ?
+ LED_WHITE :
+ LED_OFF);
else
side_led_set_color(0, LED_OFF);
}
@@ -112,18 +112,18 @@ static void board_led_set_battery(void)
side_led_set_color(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks & 0x4) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color((battery_ticks & 0x4) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/herobrine/switchcap.c b/board/herobrine/switchcap.c
index 16b0db6ef6..5173e27f75 100644
--- a/board/herobrine/switchcap.c
+++ b/board/herobrine/switchcap.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/herobrine/usbc_config.c b/board/herobrine/usbc_config.c
index 93ec401171..98d1b70bac 100644
--- a/board/herobrine/usbc_config.c
+++ b/board/herobrine/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,8 +23,8 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* GPIO Interrupt Handlers */
void tcpc_alert_event(enum gpio_signal signal)
@@ -84,16 +84,12 @@ void ppc_interrupt(enum gpio_signal signal)
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -124,16 +120,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -186,7 +188,7 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
@@ -232,8 +234,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -261,7 +262,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -285,23 +285,21 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/herobrine/usbc_config.h b/board/herobrine/usbc_config.h
index 69f546ef85..da19a67d2d 100644
--- a/board/herobrine/usbc_config.h
+++ b/board/herobrine/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hoho/board.c b/board/hoho/board.c
index 07b772c826..e981c9ce87 100644
--- a/board/hoho/board.c
+++ b/board/hoho/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -98,7 +98,7 @@ void board_config_pre_init(void)
/* enable SYSCFG clock */
STM32_RCC_APB2ENR |= BIT(0);
/* Remap USART DMA to match the USART driver */
- STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10);/* Remap USART1 RX/TX DMA */
+ STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10); /* Remap USART1 RX/TX DMA */
}
#ifdef CONFIG_SPI_FLASH
@@ -142,11 +142,10 @@ static void factory_validation_deferred(void)
/* test mcdp via serial to validate function */
if (!mcdp_get_info(&info) && (MCDP_FAMILY(info.family) == 0x0010) &&
- (MCDP_CHIPID(info.chipid) == 0x2850)) {
+ (MCDP_CHIPID(info.chipid) == 0x2850)) {
gpio_set_level(GPIO_MCDP_READY, 1);
pd_log_event(PD_EVENT_VIDEO_CODEC,
- PD_LOG_PORT_SIZE(0, sizeof(info)),
- 0, &info);
+ PD_LOG_PORT_SIZE(0, sizeof(info)), 0, &info);
}
mcdp_disable();
@@ -167,7 +166,7 @@ static void board_init(void)
gpio_set_level(GPIO_STM_READY, 1); /* factory test only */
/* Delay needed to allow HDMI MCU to boot. */
- hook_call_deferred(&factory_validation_deferred_data, 200*MSEC);
+ hook_call_deferred(&factory_validation_deferred_data, 200 * MSEC);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -175,13 +174,13 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CH_CC1_PD] = {"USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1)},
+ [ADC_CH_CC1_PD] = { "USB_C_CC1_PD", 3300, 4096, 0, STM32_AIN(1) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-const void * const usb_strings[] = {
+const void *const usb_strings[] = {
[USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
[USB_STR_PRODUCT] = USB_STRING_DESC("Hoho"),
[USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_BB_URL] = USB_STRING_DESC(USB_GOOGLE_TYPEC_URL),
diff --git a/board/hoho/board.h b/board/hoho/board.h
index 635abfbeda..7768ab7293 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@
#define CONFIG_USB_PD_IDENTITY_HW_VERS 1
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
#define CONFIG_USB_PD_LOGGING
-#undef CONFIG_EVENT_LOG_SIZE
+#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
#define CONFIG_USB_PD_TCPC
@@ -72,7 +72,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -95,14 +95,14 @@ enum usb_strings {
};
/* we are never a source : don't care about power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 0 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 0 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 0 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 1000
-#define PD_MAX_POWER_MW 1500
-#define PD_MAX_CURRENT_MA 300
-#define PD_MAX_VOLTAGE_MV 5000
+#define PD_MAX_POWER_MW 1500
+#define PD_MAX_CURRENT_MA 300
+#define PD_MAX_VOLTAGE_MV 5000
#endif /* !__ASSEMBLER__ */
@@ -110,10 +110,10 @@ enum usb_strings {
#define USB_DEV_CLASS USB_CLASS_BILLBOARD
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_COUNT 0
+#define USB_IFACE_COUNT 0
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_COUNT 1
+#define USB_EP_CONTROL 0
+#define USB_EP_COUNT 1
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/hoho/build.mk b/board/hoho/build.mk
index 71cea3f845..b6fbbe7a9e 100644
--- a/board/hoho/build.mk
+++ b/board/hoho/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/hoho/ec.tasklist b/board/hoho/ec.tasklist
index 41fc047d6a..5a82344122 100644
--- a/board/hoho/ec.tasklist
+++ b/board/hoho/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hoho/gpio.inc b/board/hoho/gpio.inc
index 6d0701ded1..56a4f8808e 100644
--- a/board/hoho/gpio.inc
+++ b/board/hoho/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hoho/usb_pd_config.h b/board/hoho/usb_pd_config.h
index 2f01c275a8..5a7dfd12a6 100644
--- a/board/hoho/usb_pd_config.h
+++ b/board/hoho/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -49,7 +49,7 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
#define EXTI_COMP_MASK(p) BIT(21)
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -88,9 +88,8 @@ static inline void pd_tx_enable(int port, int polarity)
static inline void pd_tx_disable(int port, int polarity)
{
/* output low on SPI TX (PB4) to disable the FET */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B)
- & ~(3 << (2*4)))
- | (1 << (2*4));
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 4))) | (1 << (2 * 4));
/* put the low level reference in Hi-Z */
gpio_set_level(GPIO_PD_CC1_TX_EN, 0);
}
@@ -101,8 +100,8 @@ static inline void pd_select_polarity(int port, int polarity)
* use the right comparator : CC1 -> PA1 (COMP1 INP)
* use VrefInt / 2 as INM (about 600mV)
*/
- STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK)
- | STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
+ STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK) |
+ STM32_COMP_CMP1EN | STM32_COMP_CMP1INSEL_VREF12;
}
/* Initialize pins used for TX and put them in Hi-Z */
@@ -111,7 +110,9 @@ static inline void pd_tx_init(void)
gpio_config_module(MODULE_USB_PD, 1);
}
-static inline void pd_set_host_mode(int port, int enable) {}
+static inline void pd_set_host_mode(int port, int enable)
+{
+}
static inline void pd_config_init(int port, uint8_t power_role)
{
diff --git a/board/hoho/usb_pd_pdo.c b/board/hoho/usb_pd_pdo.c
index 19b5d127a5..c52179acfc 100644
--- a/board/hoho/usb_pd_pdo.c
+++ b/board/hoho/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,6 +13,6 @@ const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
/* Fake PDOs : we just want our pre-defined voltages */
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, PDO_FIXED_COMM_CAP),
+ PDO_FIXED(5000, 500, PDO_FIXED_COMM_CAP),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
diff --git a/board/hoho/usb_pd_pdo.h b/board/hoho/usb_pd_pdo.h
index 8a43db795e..e04c3aa677 100644
--- a/board/hoho/usb_pd_pdo.h
+++ b/board/hoho/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c
index 73f3fca16e..baf05d0e71 100644
--- a/board/hoho/usb_pd_policy.c
+++ b/board/hoho/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* Holds valid object position (opos) for entered mode */
static int alt_mode[PD_AMODE_COUNT];
@@ -54,22 +54,18 @@ __override int pd_check_power_swap(int port)
return 0;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Always refuse data swap */
return 0;
}
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
}
/* ----------------- Vendor Defined Messages ------------------ */
@@ -82,8 +78,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
- CONFIG_USB_PD_IDENTITY_SW_VERS,
- 0, 0, 0, 0, /* SS[TR][12] */
+ CONFIG_USB_PD_IDENTITY_SW_VERS, 0, 0, 0,
+ 0, /* SS[TR][12] */
0, /* Vconn power */
0, /* Vconn power required */
1, /* Vbus power required */
@@ -109,18 +105,16 @@ static int svdm_response_svids(int port, uint32_t *payload)
#define OPOS_DP 1
#define OPOS_GFU 1
-const uint32_t vdo_dp_modes[1] = {
- VDO_MODE_DP(0, /* UFP pin cfg supported : none */
+const uint32_t vdo_dp_modes[1] = {
+ VDO_MODE_DP(0, /* UFP pin cfg supported : none */
MODE_DP_PIN_C, /* DFP pin cfg supported */
- 1, /* no usb2.0 signalling in AMode */
- CABLE_PLUG, /* its a plug */
- MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
- MODE_DP_SNK) /* Its a sink only */
+ 1, /* no usb2.0 signalling in AMode */
+ CABLE_PLUG, /* its a plug */
+ MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
+ MODE_DP_SNK) /* Its a sink only */
};
-const uint32_t vdo_goog_modes[1] = {
- VDO_MODE_GOOGLE(MODE_GOOGLE_FU)
-};
+const uint32_t vdo_goog_modes[1] = { VDO_MODE_GOOGLE(MODE_GOOGLE_FU) };
static int svdm_response_modes(int port, uint32_t *payload)
{
@@ -142,13 +136,15 @@ static int dp_status(int port, uint32_t *payload)
if (opos != OPOS_DP)
return 0; /* nak */
- payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
- (hpd == 1), /* HPD_HI|LOW */
- 0, /* request exit DP */
- 0, /* request exit USB */
- 0, /* MF pref */
+ payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
+ (hpd == 1), /* HPD_HI|LOW */
+ 0, /* request exit DP */
+ 0, /* request exit USB */
+ 0, /* MF pref */
gpio_get_level(GPIO_PD_SBU_ENABLE),
- 0, /* power low */
+ 0, /* power
+ low
+ */
0x2);
return 2;
}
@@ -227,8 +223,7 @@ const struct svdm_response svdm_rsp = {
.exit_mode = &svdm_exit_mode,
};
-int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload)
{
int rsize;
diff --git a/board/homestar/base_detect.c b/board/homestar/base_detect.c
index b08784357b..7625db02d7 100644
--- a/board/homestar/base_detect.c
+++ b/board/homestar/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Make sure POGO VBUS starts later then PP3300_HUB when power on */
#define BASE_DETECT_EN_LATER_US (600 * MSEC)
@@ -96,8 +96,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -188,8 +188,7 @@ static void base_enable(void)
{
/* Enable base detection interrupt. */
base_detect_debounce_time = get_time().val;
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_EN_LATER_US);
+ hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_EN_LATER_US);
gpio_enable_interrupt(GPIO_BASE_DET_L);
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, base_enable, HOOK_PRIO_DEFAULT);
@@ -215,7 +214,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/homestar/battery.c b/board/homestar/battery.c
index 7cfd201b0f..01fdb29f6a 100644
--- a/board/homestar/battery.c
+++ b/board/homestar/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/homestar/board.c b/board/homestar/board.c
index 05c9759355..ab4b95b625 100644
--- a/board/homestar/board.c
+++ b/board/homestar/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,10 +39,10 @@
#include "task.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
+#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -119,41 +119,31 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -161,45 +151,25 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
/* Base detection */
- [ADC_BASE_DET] = {
- "BASE_DET",
- NPCX_ADC_CH5,
- ADC_MAX_VOLT,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH5, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -217,16 +187,12 @@ const struct ln9310_config_t ln9310_config = {
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -257,16 +223,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -297,17 +269,13 @@ enum lid_accelgyro_type {
static enum lid_accelgyro_type lid_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t lid_standard_ref_icm42607 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref_icm42607 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_lid_accel = {
.name = "Lid Accel",
@@ -502,9 +470,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
void board_hibernate(void)
{
@@ -514,8 +482,7 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 1+ has the hardware fix. Don't need the following
@@ -612,8 +579,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -641,7 +607,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -665,24 +630,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/homestar/board.h b/board/homestar/board.h
index 74de48df1d..230aa6e7d3 100644
--- a/board/homestar/board.h
+++ b/board/homestar/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,16 +10,19 @@
#include "baseboard.h"
+/* Free up flash space */
+#undef CONFIG_CONSOLE_CMDHELP
+
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Switchcap */
#define CONFIG_LN9310
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -90,10 +93,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_DISPLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_DISPLIGHT = 0, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/homestar/build.mk b/board/homestar/build.mk
index 452abeb591..363ef59a16 100644
--- a/board/homestar/build.mk
+++ b/board/homestar/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/homestar/ec.tasklist b/board/homestar/ec.tasklist
index ea2aaa97f5..8fc8115afc 100644
--- a/board/homestar/ec.tasklist
+++ b/board/homestar/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/homestar/gpio.inc b/board/homestar/gpio.inc
index 77a69a5faa..37e71977ac 100644
--- a/board/homestar/gpio.inc
+++ b/board/homestar/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/homestar/led.c b/board/homestar/led.c
index 3950ce1ec0..c314d584c3 100644
--- a/board/homestar/led.c
+++ b/board/homestar/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -36,15 +36,15 @@ enum led_color {
LED_RED,
LED_GREEN,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_R_C0,
- (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_G_C0,
- (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
if (color == LED_AMBER) {
gpio_set_level(GPIO_EC_CHG_LED_R_C0, BAT_LED_ON);
gpio_set_level(GPIO_EC_CHG_LED_G_C0, BAT_LED_ON);
@@ -78,7 +78,6 @@ static void board_led_set_battery(void)
int color = LED_OFF;
int period = 0;
int percent = DIV_ROUND_NEAREST(charge_get_display_charge(), 10);
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -86,13 +85,13 @@ static void board_led_set_battery(void)
case PWR_STATE_CHARGE:
case PWR_STATE_CHARGE_NEAR_FULL:
if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND |
- CHIPSET_STATE_ANY_OFF)) {
+ CHIPSET_STATE_ANY_SUSPEND |
+ CHIPSET_STATE_ANY_OFF)) {
if (percent <= BATTERY_LEVEL_CRITICAL) {
/* battery capa <= 5%, Red */
color = LED_RED;
} else if (percent > BATTERY_LEVEL_CRITICAL &&
- percent < BATTERY_LEVEL_NEAR_FULL) {
+ percent < BATTERY_LEVEL_NEAR_FULL) {
/* 5% < battery capa < 97%, Orange */
color = LED_AMBER;
} else {
@@ -115,16 +114,16 @@ static void board_led_set_battery(void)
color = LED_OFF;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode, Red 2 sec, green 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_RED;
- else
- color = LED_GREEN;
- } else
+ color = LED_RED;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode, Red 2 sec, green 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_RED;
+ else
+ color = LED_GREEN;
break;
default:
/* Other states don't alter LED behavior */
@@ -147,7 +146,7 @@ void led_control(enum ec_led_id led_id, enum ec_led_state state)
enum led_color color;
if ((led_id != EC_LED_ID_RECOVERY_HW_REINIT_LED) &&
- (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
+ (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
return;
if (state == LED_STATE_RESET) {
diff --git a/board/homestar/usbc_config.c b/board/homestar/usbc_config.c
index aac136415d..5d30adb6e2 100644
--- a/board/homestar/usbc_config.c
+++ b/board/homestar/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "console.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/host/battery.c b/board/host/battery.c
index 58390133e4..f3ce1766f5 100644
--- a/board/host/battery.c
+++ b/board/host/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,8 +14,7 @@
static uint16_t mock_smart_battery[SB_MANUFACTURER_DATA + 1];
-int sb_i2c_xfer(int port, uint16_t addr_flags,
- const uint8_t *out, int out_size,
+int sb_i2c_xfer(int port, uint16_t addr_flags, const uint8_t *out, int out_size,
uint8_t *in, int in_size, int flags)
{
if (out_size == 0)
@@ -23,7 +22,7 @@ int sb_i2c_xfer(int port, uint16_t addr_flags,
if (port != I2C_PORT_BATTERY || addr_flags != BATTERY_ADDR_FLAGS)
return EC_ERROR_INVAL;
- if (out[0] >= ARRAY_SIZE(mock_smart_battery))
+ if (out[0] >= ARRAY_SIZE(mock_smart_battery))
return EC_ERROR_UNIMPLEMENTED;
if (out_size == 1) {
/* Read */
@@ -56,12 +55,12 @@ static const struct battery_info bat_info = {
* normal = 7.4V
* min = 6.0V
*/
- .voltage_max = 8400,
+ .voltage_max = 8400,
.voltage_normal = 7400,
- .voltage_min = 6000,
+ .voltage_min = 6000,
/* Pre-charge current: I <= 0.01C */
- .precharge_current = 64, /* mA */
+ .precharge_current = 64, /* mA */
/*
* Operational temperature range
@@ -70,10 +69,10 @@ static const struct battery_info bat_info = {
*/
.start_charging_min_c = 0,
.start_charging_max_c = 50,
- .charging_min_c = 0,
- .charging_max_c = 50,
- .discharging_min_c = -20,
- .discharging_max_c = 60,
+ .charging_min_c = 0,
+ .charging_max_c = 50,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
};
const struct battery_info *battery_get_info(void)
diff --git a/board/host/board.c b/board/host/board.c
index e639b6bc99..baaed22b43 100644
--- a/board/host/board.c
+++ b/board/host/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,7 +28,7 @@
* GPIO ports. This maps back to 0, which is then ignored by the host GPIO mock
* code.
*/
-#define GPIO_0 0
+#define GPIO_0 0
#include "gpio_list.h"
@@ -48,10 +48,10 @@ test_mockable_static int mock_temp_get_val(int idx, int *temp_ptr)
}
const struct temp_sensor_t temp_sensors[] = {
- {"CPU", TEMP_SENSOR_TYPE_CPU, mock_temp_get_val, 0},
- {"Board", TEMP_SENSOR_TYPE_BOARD, mock_temp_get_val, 1},
- {"Case", TEMP_SENSOR_TYPE_CASE, mock_temp_get_val, 2},
- {"Battery", TEMP_SENSOR_TYPE_BOARD, mock_temp_get_val, 3},
+ { "CPU", TEMP_SENSOR_TYPE_CPU, mock_temp_get_val, 0 },
+ { "Board", TEMP_SENSOR_TYPE_BOARD, mock_temp_get_val, 1 },
+ { "Case", TEMP_SENSOR_TYPE_CASE, mock_temp_get_val, 2 },
+ { "Battery", TEMP_SENSOR_TYPE_BOARD, mock_temp_get_val, 3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -67,45 +67,31 @@ test_mockable void fps_event(enum gpio_signal signal)
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
#ifdef I2C_PORT_BATTERY
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = 0,
- .sda = 0
- },
+ { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0 },
#elif defined I2C_PORT_LIGHTBAR
- {
- .name = "lightbar",
- .port = I2C_PORT_LIGHTBAR,
- .kbps = 100,
- .scl = 0,
- .sda = 0
- },
+ { .name = "lightbar",
+ .port = I2C_PORT_LIGHTBAR,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0 },
#elif defined I2C_PORT_HOST_TCPC
- {
- .name = "tcpc",
- .port = I2C_PORT_HOST_TCPC,
- .kbps = 100,
- .scl = 0,
- .sda = 0
- },
+ { .name = "tcpc",
+ .port = I2C_PORT_HOST_TCPC,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0 },
#elif defined I2C_PORT_EEPROM
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 100,
- .scl = 0,
- .sda = 0
- },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0 },
#elif defined I2C_PORT_WLC
- {
- .name = "wlc",
- .port = I2C_PORT_WLC,
- .kbps = 100,
- .scl = 0,
- .sda = 0
- },
+ { .name = "wlc", .port = I2C_PORT_WLC, .kbps = 100, .scl = 0, .sda = 0 },
#endif
};
@@ -141,9 +127,8 @@ int board_get_entropy(void *buffer, int len)
static uint8_t eeprom[CBI_IMAGE_SIZE];
-int eeprom_i2c_xfer(int port, uint16_t addr_flags,
- const uint8_t *out, int out_size,
- uint8_t *in, int in_size, int flags)
+int eeprom_i2c_xfer(int port, uint16_t addr_flags, const uint8_t *out,
+ int out_size, uint8_t *in, int in_size, int flags)
{
static int offset;
diff --git a/board/host/board.h b/board/host/board.h
index 979763af4e..165331ce4c 100644
--- a/board/host/board.h
+++ b/board/host/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,8 @@
#define CONFIG_USB_PD_CUSTOM_PDO
#define CONFIG_USB_PD_DUAL_ROLE
+#define CONFIG_CMD_AP_RESET_LOG
+
#include "gpio_signal.h"
enum temp_sensor_id {
@@ -65,25 +67,25 @@ enum {
};
/* Standard-current Rp */
-#define PD_SRC_VNC PD_SRC_DEF_VNC_MV
-#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV
+#define PD_SRC_VNC PD_SRC_DEF_VNC_MV
+#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV
/* delay necessary for the voltage transition on the power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 20000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 20000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 20000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
-#define PD_MIN_CURRENT_MA 500
-#define PD_MIN_POWER_MW 7500
+#define PD_MIN_CURRENT_MA 500
+#define PD_MIN_POWER_MW 7500
/* Configuration for fake Fingerprint Sensor */
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FP_PORT 1 /* SPI1: third master config */
+#define CONFIG_SPI_FP_PORT 1 /* SPI1: third master config */
#define CONFIG_RNG
void fps_event(enum gpio_signal signal);
@@ -92,7 +94,7 @@ void fps_event(enum gpio_signal signal);
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_EEPROM 0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_EEPROM 0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/host/build.mk b/board/host/build.mk
index 17927528c2..a1fad4723a 100644
--- a/board/host/build.mk
+++ b/board/host/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2013 The Chromium OS Authors. All rights reserved.
+# Copyright 2013 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/host/charger.c b/board/host/charger.c
index 4db1f44351..fddadf245d 100644
--- a/board/host/charger.c
+++ b/board/host/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2012 The Chromium OS Authors. All rights reserved.
+/* Copyright 2012 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,15 +12,15 @@
#include "util.h"
static const struct charger_info mock_charger_info = {
- .name = "MockCharger",
- .voltage_max = 19200,
- .voltage_min = 1024,
+ .name = "MockCharger",
+ .voltage_max = 19200,
+ .voltage_min = 1024,
.voltage_step = 16,
- .current_max = 8192,
- .current_min = 128,
+ .current_max = 8192,
+ .current_min = 128,
.current_step = 128,
- .input_current_max = 8064,
- .input_current_min = 128,
+ .input_current_max = 8064,
+ .input_current_min = 128,
.input_current_step = 128,
};
@@ -37,7 +37,6 @@ static const struct charger_info *mock_get_info(int chgnum)
return &mock_charger_info;
}
-
static enum ec_error_list mock_get_status(int chgnum, int *status)
{
*status = CHARGER_LEVEL_2;
@@ -47,7 +46,6 @@ static enum ec_error_list mock_get_status(int chgnum, int *status)
return EC_SUCCESS;
}
-
static enum ec_error_list mock_set_mode(int chgnum, int mode)
{
if (mode & CHARGE_FLAG_INHIBIT_CHARGE)
@@ -57,14 +55,12 @@ static enum ec_error_list mock_set_mode(int chgnum, int mode)
return EC_SUCCESS;
}
-
static enum ec_error_list mock_get_current(int chgnum, int *current)
{
*current = mock_current;
return EC_SUCCESS;
}
-
static enum ec_error_list mock_set_current(int chgnum, int current)
{
const struct charger_info *info = mock_get_info(chgnum);
@@ -86,7 +82,6 @@ static enum ec_error_list mock_get_voltage(int chgnum, int *voltage)
return EC_SUCCESS;
}
-
static enum ec_error_list mock_set_voltage(int chgnum, int voltage)
{
mock_voltage = voltage;
@@ -94,27 +89,23 @@ static enum ec_error_list mock_set_voltage(int chgnum, int voltage)
return EC_SUCCESS;
}
-
static enum ec_error_list mock_get_option(int chgnum, int *option)
{
*option = mock_option;
return EC_SUCCESS;
}
-
static enum ec_error_list mock_set_option(int chgnum, int option)
{
mock_option = option;
return EC_SUCCESS;
}
-
static enum ec_error_list mock_manufacturer_id(int chgnum, int *id)
{
return EC_SUCCESS;
}
-
static enum ec_error_list mock_device_id(int chgnum, int *id)
{
return EC_SUCCESS;
@@ -127,7 +118,6 @@ static enum ec_error_list mock_get_input_current_limit(int chgnum,
return EC_SUCCESS;
}
-
static enum ec_error_list mock_set_input_current_limit(int chgnum, int current)
{
const struct charger_info *info = mock_get_info(chgnum);
@@ -144,7 +134,6 @@ static enum ec_error_list mock_set_input_current_limit(int chgnum, int current)
return EC_SUCCESS;
}
-
static enum ec_error_list mock_post_init(int chgnum)
{
mock_current = mock_input_current = CONFIG_CHARGER_INPUT_CURRENT;
diff --git a/board/host/chipset.c b/board/host/chipset.c
index 0a7385fc84..47ad097c53 100644
--- a/board/host/chipset.c
+++ b/board/host/chipset.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/host/ec.tasklist b/board/host/ec.tasklist
index c056c51e8a..0195800932 100644
--- a/board/host/ec.tasklist
+++ b/board/host/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/host/fan.c b/board/host/fan.c
index 1e1001f1cd..de335afa06 100644
--- a/board/host/fan.c
+++ b/board/host/fan.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,7 +22,10 @@ const struct fan_rpm fan_rpm_0 = {
};
const struct fan_t fans[CONFIG_FANS] = {
- { .conf = &fan_conf_0, .rpm = &fan_rpm_0, },
+ {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
};
static int mock_enabled;
diff --git a/board/host/gpio.inc b/board/host/gpio.inc
index ce69385259..ab30915881 100644
--- a/board/host/gpio.inc
+++ b/board/host/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/host/usb_pd_config.c b/board/host/usb_pd_config.c
index 878e747342..10ed9536fa 100644
--- a/board/host/usb_pd_config.c
+++ b/board/host/usb_pd_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/host/usb_pd_config.h b/board/host/usb_pd_config.h
index fb12b2ce7d..0fff2af019 100644
--- a/board/host/usb_pd_config.h
+++ b/board/host/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/host/usb_pd_pdo.c b/board/host/usb_pd_pdo.c
index a84b03f75f..a352148ecb 100644
--- a/board/host/usb_pd_pdo.c
+++ b/board/host/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,14 +10,14 @@
#define PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP)
const uint32_t pd_src_pdo[] = {
- PDO_FIXED(5000, 900, PDO_FIXED_FLAGS),
- PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(5000, 900, PDO_FIXED_FLAGS),
+ PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS),
};
const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
- PDO_BATT(4750, 21000, 15000),
- PDO_VAR(4750, 21000, 3000),
+ PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
+ PDO_BATT(4750, 21000, 15000),
+ PDO_VAR(4750, 21000, 3000),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
diff --git a/board/host/usb_pd_pdo.h b/board/host/usb_pd_pdo.h
index 64d73c7a15..4f1a64dced 100644
--- a/board/host/usb_pd_pdo.h
+++ b/board/host/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/host/usb_pd_policy.c b/board/host/usb_pd_policy.c
index b90db882ce..dc965ca192 100644
--- a/board/host/usb_pd_policy.c
+++ b/board/host/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,8 +9,8 @@
#include "usb_pd_pdo.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
test_mockable int pd_set_power_supply_ready(int port)
{
@@ -41,22 +41,18 @@ __override int pd_check_power_swap(int port)
return 1;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Always allow data swap */
return 1;
}
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
}
diff --git a/board/hyperdebug/board.c b/board/hyperdebug/board.c
new file mode 100644
index 0000000000..37e41f66a9
--- /dev/null
+++ b/board/hyperdebug/board.c
@@ -0,0 +1,329 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+/* HyperDebug board configuration */
+
+#include "common.h"
+#include "console.h"
+#include "ec_version.h"
+#include "gpio.h"
+#include "i2c.h"
+#include "queue_policies.h"
+#include "registers.h"
+#include "spi.h"
+#include "task.h"
+#include "timer.h"
+#include "usart-stm32l5.h"
+#include "usb_hw.h"
+#include "usb_spi.h"
+#include "usb-stream.h"
+#include "gpio_list.h"
+
+void board_config_pre_init(void)
+{
+ /* enable SYSCFG clock */
+ STM32_RCC_APB2ENR |= STM32_RCC_SYSCFGEN;
+}
+
+/******************************************************************************
+ * Forward UARTs as a USB serial interface.
+ */
+
+#define USB_STREAM_RX_SIZE 16
+#define USB_STREAM_TX_SIZE 16
+
+/******************************************************************************
+ * Forward USART2 as a simple USB serial interface.
+ */
+
+static struct usart_config const usart2;
+struct usb_stream_config const usart2_usb;
+
+static struct queue const usart2_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart2.producer, usart2_usb.consumer);
+static struct queue const usb_to_usart2 =
+ QUEUE_DIRECT(64, uint8_t, usart2_usb.producer, usart2.consumer);
+
+static struct usart_config const usart2 =
+ USART_CONFIG(usart2_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart2_to_usb, usb_to_usart2);
+
+USB_STREAM_CONFIG(usart2_usb, USB_IFACE_USART2_STREAM,
+ USB_STR_USART2_STREAM_NAME, USB_EP_USART2_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart2,
+ usart2_to_usb)
+
+/******************************************************************************
+ * Forward USART3 as a simple USB serial interface.
+ */
+
+static struct usart_config const usart3;
+struct usb_stream_config const usart3_usb;
+
+static struct queue const usart3_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart3.producer, usart3_usb.consumer);
+static struct queue const usb_to_usart3 =
+ QUEUE_DIRECT(64, uint8_t, usart3_usb.producer, usart3.consumer);
+
+static struct usart_config const usart3 =
+ USART_CONFIG(usart3_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart3_to_usb, usb_to_usart3);
+
+USB_STREAM_CONFIG(usart3_usb, USB_IFACE_USART3_STREAM,
+ USB_STR_USART3_STREAM_NAME, USB_EP_USART3_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart3,
+ usart3_to_usb)
+
+/******************************************************************************
+ * Forward USART4 as a simple USB serial interface.
+ */
+
+static struct usart_config const usart4;
+struct usb_stream_config const usart4_usb;
+
+static struct queue const usart4_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart4.producer, usart4_usb.consumer);
+static struct queue const usb_to_usart4 =
+ QUEUE_DIRECT(64, uint8_t, usart4_usb.producer, usart4.consumer);
+
+static struct usart_config const usart4 =
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart4_to_usb, usb_to_usart4);
+
+USB_STREAM_CONFIG(usart4_usb, USB_IFACE_USART4_STREAM,
+ USB_STR_USART4_STREAM_NAME, USB_EP_USART4_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart4,
+ usart4_to_usb)
+
+/******************************************************************************
+ * Forward USART5 as a simple USB serial interface.
+ */
+
+static struct usart_config const usart5;
+struct usb_stream_config const usart5_usb;
+
+static struct queue const usart5_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart5.producer, usart5_usb.consumer);
+static struct queue const usb_to_usart5 =
+ QUEUE_DIRECT(64, uint8_t, usart5_usb.producer, usart5.consumer);
+
+static struct usart_config const usart5 =
+ USART_CONFIG(usart5_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart5_to_usb, usb_to_usart5);
+
+USB_STREAM_CONFIG(usart5_usb, USB_IFACE_USART5_STREAM,
+ USB_STR_USART5_STREAM_NAME, USB_EP_USART5_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart5,
+ usart5_to_usb)
+
+/******************************************************************************
+ * Support SPI bridging over USB, this requires usb_spi_board_enable and
+ * usb_spi_board_disable to be defined to enable and disable the SPI bridge.
+ */
+
+/* SPI devices */
+const struct spi_device_t spi_devices[] = {
+ { 1 /* SPI2 */, 7, GPIO_SPI2_CS },
+};
+const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
+
+void usb_spi_board_enable(struct usb_spi_config const *config)
+{
+ /* Configure SPI GPIOs */
+ gpio_config_module(MODULE_SPI, 1);
+ gpio_config_module(MODULE_SPI_FLASH, 1);
+
+ /* Set all SPI pins to high speed */
+ STM32_GPIO_OSPEEDR(GPIO_F) |= 0xFFF00000;
+ STM32_GPIO_OSPEEDR(GPIO_D) |= 0x000000C3;
+ STM32_GPIO_OSPEEDR(GPIO_C) |= 0x000000F0;
+
+ /* Enable clocks to SPI2 module */
+ STM32_RCC_APB1ENR1 |= STM32_RCC_APB1ENR1_SPI2EN;
+
+ /* Reset SPI2 */
+ STM32_RCC_APB1RSTR1 |= STM32_RCC_APB1RSTR1_SPI2RST;
+ STM32_RCC_APB1RSTR1 &= ~STM32_RCC_APB1RSTR1_SPI2RST;
+
+ spi_enable(&spi_devices[0], 1);
+}
+
+void usb_spi_board_disable(struct usb_spi_config const *config)
+{
+ spi_enable(&spi_devices[0], 0);
+
+ /* Disable clocks to SPI2 module */
+ STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
+
+ /* Release SPI GPIOs */
+ gpio_config_module(MODULE_SPI_FLASH, 0);
+}
+
+USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI, 0);
+
+/******************************************************************************
+ * Support I2C bridging over USB.
+ */
+
+/* I2C ports */
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "controller",
+ .port = I2C_PORT_CONTROLLER,
+ .kbps = 100,
+ .scl = GPIO_TPM_I2C1_HOST_SCL,
+ .sda = GPIO_TPM_I2C1_HOST_SDA },
+};
+const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
+
+/******************************************************************************
+ * Define the strings used in our USB descriptors.
+ */
+
+const void *const usb_strings[] = {
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("HyperDebug"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("HyperDebug Shell"),
+ [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_USART2_STREAM_NAME] = USB_STRING_DESC("UART2"),
+ [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("UART3"),
+ [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("UART4"),
+ [USB_STR_USART5_STREAM_NAME] = USB_STRING_DESC("UART5"),
+};
+
+BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
+
+/******************************************************************************
+ * Initialize board.
+ */
+
+static void board_init(void)
+{
+ STM32_GPIO_BSRR(STM32_GPIOE_BASE) |= 0x0000FF00;
+
+ /* We know VDDIO2 is present, enable the GPIO circuit. */
+ STM32_PWR_CR2 |= STM32_PWR_CR2_IOSV;
+
+ /* USB to serial queues */
+ queue_init(&usart2_to_usb);
+ queue_init(&usb_to_usart2);
+ queue_init(&usart3_to_usb);
+ queue_init(&usb_to_usart3);
+ queue_init(&usart4_to_usb);
+ queue_init(&usb_to_usart4);
+ queue_init(&usart5_to_usb);
+ queue_init(&usb_to_usart5);
+
+ STM32_GPIO_BSRR(STM32_GPIOE_BASE) |= 0x0F000000;
+ /* UART init */
+ usart_init(&usart2);
+ usart_init(&usart3);
+ usart_init(&usart4);
+ usart_init(&usart5);
+
+ /* Structured endpoints */
+ usb_spi_enable(&usb_spi, 1);
+ STM32_GPIO_BSRR(STM32_GPIOE_BASE) |= 0xF0000000;
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/**
+ * Find a GPIO signal by name.
+ *
+ * This is copied from gpio.c unfortunately, as it is static over there.
+ *
+ * @param name Signal name to find
+ *
+ * @return the signal index, or GPIO_COUNT if no match.
+ */
+static enum gpio_signal find_signal_by_name(const char *name)
+{
+ int i;
+
+ if (!name || !*name)
+ return GPIO_COUNT;
+
+ for (i = 0; i < GPIO_COUNT; i++)
+ if (gpio_is_implemented(i) &&
+ !strcasecmp(name, gpio_get_name(i)))
+ return i;
+
+ return GPIO_COUNT;
+}
+
+/*
+ * Set the mode of a GPIO pin: input/opendrain/pushpull.
+ */
+static int command_gpio_mode(int argc, const char **argv)
+{
+ int gpio;
+ int flags;
+
+ if (argc < 3)
+ return EC_ERROR_PARAM_COUNT;
+
+ gpio = find_signal_by_name(argv[1]);
+ if (gpio == GPIO_COUNT)
+ return EC_ERROR_PARAM1;
+ flags = gpio_get_flags(gpio);
+
+ flags = flags & ~(GPIO_INPUT | GPIO_OUTPUT | GPIO_OPEN_DRAIN);
+ if (strcasecmp(argv[2], "input") == 0)
+ flags |= GPIO_INPUT;
+ else if (strcasecmp(argv[2], "opendrain") == 0)
+ flags |= GPIO_OUTPUT | GPIO_OPEN_DRAIN;
+ else if (strcasecmp(argv[2], "pushpull") == 0)
+ flags |= GPIO_OUTPUT;
+ else
+ return EC_ERROR_PARAM2;
+
+ /* Update GPIO flags. */
+ gpio_set_flags(gpio, flags);
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND_FLAGS(gpiomode, command_gpio_mode,
+ "name <input | opendrain | pushpull>",
+ "Set a GPIO mode", CMD_FLAG_RESTRICTED);
+
+/*
+ * Set the weak pulling of a GPIO pin: up/down/none.
+ */
+static int command_gpio_pull_mode(int argc, const char **argv)
+{
+ int gpio;
+ int flags;
+
+ if (argc < 3)
+ return EC_ERROR_PARAM_COUNT;
+
+ gpio = find_signal_by_name(argv[1]);
+ if (gpio == GPIO_COUNT)
+ return EC_ERROR_PARAM1;
+ flags = gpio_get_flags(gpio);
+
+ flags = flags & ~(GPIO_PULL_UP | GPIO_PULL_DOWN);
+ if (strcasecmp(argv[2], "none") == 0)
+ ;
+ else if (strcasecmp(argv[2], "up") == 0)
+ flags |= GPIO_PULL_UP;
+ else if (strcasecmp(argv[2], "down") == 0)
+ flags |= GPIO_PULL_DOWN;
+ else
+ return EC_ERROR_PARAM2;
+
+ /* Update GPIO flags. */
+ gpio_set_flags(gpio, flags);
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND_FLAGS(gpiopullmode, command_gpio_pull_mode,
+ "name <none | up | down>",
+ "Set a GPIO weak pull mode", CMD_FLAG_RESTRICTED);
diff --git a/board/hyperdebug/board.h b/board/hyperdebug/board.h
new file mode 100644
index 0000000000..9d15311784
--- /dev/null
+++ b/board/hyperdebug/board.h
@@ -0,0 +1,153 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* HyperDebug configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#define CONFIG_LTO
+
+/* 48 MHz SYSCLK clock frequency */
+#define CPU_CLOCK 48000000
+
+#define CONFIG_BOARD_PRE_INIT
+
+#define CONFIG_ROM_BASE 0x0
+#define CONFIG_ROM_SIZE (CONFIG_RAM_BASE - CONFIG_ROM_BASE)
+
+/* Enable USB forwarding on UART 2, 3, 4, and 5. */
+#define CONFIG_STREAM_USART
+#undef CONFIG_STREAM_USART1
+#define CONFIG_STREAM_USART2
+#define CONFIG_STREAM_USART3
+#define CONFIG_STREAM_USART4
+#define CONFIG_STREAM_USART5
+#undef CONFIG_STREAM_USART9
+#define CONFIG_STREAM_USB
+#define CONFIG_CMD_USART_INFO
+
+/* The UART console is on LPUART (UART9), connected to st-link debugger. */
+#undef CONFIG_UART_CONSOLE
+#define CONFIG_UART_CONSOLE 9
+#undef CONFIG_UART_TX_DMA
+#undef CONFIG_UART_RX_DMA
+
+/* Optional features */
+#define CONFIG_STM_HWTIMER32
+#define CONFIG_HW_CRC
+#undef CONFIG_PVD
+/*
+ * See 'Programmable voltage detector characteristics' in the
+ * STM32F072x8 Datasheet. PVD Threshold 1 corresponds to a falling
+ * voltage threshold of min:2.09V, max:2.27V.
+ */
+#define PVD_THRESHOLD (1)
+
+/* USB Configuration */
+
+#define CONFIG_USB
+#define CONFIG_USB_PID 0x520e
+#define CONFIG_USB_CONSOLE
+
+/*
+ * Enabling USB updating would exceed the number of USB endpoints
+ * supported by the hardware. We will have to rely on the built-in
+ * DFU support of STM32 chips.
+ */
+#undef CONFIG_USB_UPDATE
+
+#undef CONFIG_USB_MAXPOWER_MA
+#define CONFIG_USB_MAXPOWER_MA 100
+
+#define CONFIG_USB_SERIALNO
+#define DEFAULT_SERIALNO "Uninitialized"
+
+/* USB interface indexes (use define rather than enum to expand them) */
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_SPI 1
+#define USB_IFACE_I2C 2
+#define USB_IFACE_USART2_STREAM 3
+#define USB_IFACE_USART3_STREAM 4
+#define USB_IFACE_USART4_STREAM 5
+#define USB_IFACE_USART5_STREAM 6
+#define USB_IFACE_COUNT 7
+
+/* USB endpoint indexes (use define rather than enum to expand them) */
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_SPI 2
+#define USB_EP_I2C 3
+#define USB_EP_USART2_STREAM 4
+#define USB_EP_USART3_STREAM 5
+#define USB_EP_USART4_STREAM 6
+#define USB_EP_USART5_STREAM 7
+#define USB_EP_COUNT 8
+
+/*
+ * Do not enable the common EC command gpioset for recasting of GPIO
+ * type. Instead, board specific commands are used for implementing
+ * the OpenTitan tool requirements.
+ */
+#undef CONFIG_CMD_GPIO_EXTENDED
+#define CONFIG_GPIO_GET_EXTENDED
+
+/* Enable control of SPI over USB */
+#define CONFIG_USB_SPI
+#define CONFIG_USB_SPI_BUFFER_SIZE 2048
+#define CONFIG_SPI_CONTROLLER
+
+/* Enable control of I2C over USB */
+#define CONFIG_USB_I2C
+#define CONFIG_I2C
+#define CONFIG_I2C_CONTROLLER
+#define I2C_PORT_CONTROLLER 0
+#define CONFIG_STM32_SPI1_CONTROLLER
+
+/* See i2c_ite_flash_support.c for more information about these values */
+/*#define CONFIG_ITE_FLASH_SUPPORT */
+/*#define CONFIG_I2C_XFER_LARGE_TRANSFER */
+#undef CONFIG_USB_I2C_MAX_WRITE_COUNT
+#undef CONFIG_USB_I2C_MAX_READ_COUNT
+#define CONFIG_USB_I2C_MAX_WRITE_COUNT ((1 << 9) - 4)
+#define CONFIG_USB_I2C_MAX_READ_COUNT ((1 << 9) - 6)
+
+/* This is not actually an EC so disable some features. */
+#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_LID_SWITCH
+
+/*
+ * Allow dangerous commands all the time, since we don't have a write protect
+ * switch.
+ */
+#define CONFIG_SYSTEM_UNLOCKED
+
+#ifndef __ASSEMBLER__
+
+/* Timer selection */
+#define TIM_CLOCK32 2
+
+#include "gpio_signal.h"
+
+/* USB string indexes */
+enum usb_strings {
+ USB_STR_DESC = 0,
+ USB_STR_VENDOR,
+ USB_STR_PRODUCT,
+ USB_STR_SERIALNO,
+ USB_STR_VERSION,
+ USB_STR_CONSOLE_NAME,
+ USB_STR_SPI_NAME,
+ USB_STR_I2C_NAME,
+ USB_STR_USART2_STREAM_NAME,
+ USB_STR_USART3_STREAM_NAME,
+ USB_STR_USART4_STREAM_NAME,
+ USB_STR_USART5_STREAM_NAME,
+
+ USB_STR_COUNT
+};
+
+#endif /* !__ASSEMBLER__ */
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/hyperdebug/build.mk b/board/hyperdebug/build.mk
new file mode 100644
index 0000000000..d65418f259
--- /dev/null
+++ b/board/hyperdebug/build.mk
@@ -0,0 +1,13 @@
+# -*- makefile -*-
+# Copyright 2022 The ChromiumOS Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+#
+# Board specific files build
+
+# the IC is STmicro STM32F302R8
+CHIP:=stm32
+CHIP_FAMILY:=stm32l5
+CHIP_VARIANT:=stm32l552xe
+
+board-y=board.o
diff --git a/board/hyperdebug/ec.tasklist b/board/hyperdebug/ec.tasklist
new file mode 100644
index 0000000000..ed894a7f87
--- /dev/null
+++ b/board/hyperdebug/ec.tasklist
@@ -0,0 +1,11 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * See CONFIG_TASK_LIST in config.h for details.
+ */
+#define CONFIG_TASK_LIST \
+ TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE)
diff --git a/board/hyperdebug/gpio.inc b/board/hyperdebug/gpio.inc
new file mode 100644
index 0000000000..5dc0cebc1b
--- /dev/null
+++ b/board/hyperdebug/gpio.inc
@@ -0,0 +1,186 @@
+/* -*- mode:c -*-
+ *
+ * Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/*
+ * List of all GPIO pins available for Host computer to manipulate.
+ * The are named based on their location on the two 70-pin DIL
+ * connectors on either side of the HyperDebug board. Pins with
+ * special functions are commented out, and declared with relevant
+ * symbolic name further below.
+ */
+
+GPIO(CN7_1, PIN(C, 6), GPIO_INPUT)
+/*GPIO(CN7_2, PIN(B, 8), GPIO_INPUT) I2C1 */
+GPIO(CN7_3, PIN(D, 11), GPIO_INPUT)
+/*GPIO(CN7_4, PIN(B, 9), GPIO_INPUT) I2C1 */
+GPIO(CN7_5, PIN(B, 13), GPIO_INPUT)
+/* CN7_6 is VREFP */
+GPIO(CN7_7, PIN(D, 12), GPIO_INPUT)
+/* CN7_8 is GND */
+/*GPIO(CN7_9, PIN(A, 4), GPIO_INPUT) CC1 */
+/*GPIO(CN7_10, PIN(A, 5), GPIO_INPUT) CC2 */
+GPIO(CN7_11, PIN(B, 4), GPIO_INPUT)
+GPIO(CN7_12, PIN(A, 6), GPIO_INPUT)
+/*GPIO(CN7_13, PIN(B, 5), GPIO_INPUT) Nucleo USB-C */
+GPIO(CN7_14, PIN(A, 7), GPIO_INPUT)
+GPIO(CN7_15, PIN(B, 3), GPIO_INPUT)
+GPIO(CN7_16, PIN(D, 14), GPIO_INPUT)
+/*GPIO(CN7_17, PIN(A, 4), GPIO_INPUT)*/
+GPIO(CN7_18, PIN(D, 15), GPIO_INPUT)
+/*GPIO(CN7_19, PIN(B, 4), GPIO_INPUT)*/
+GPIO(CN7_20, PIN(F, 12), GPIO_INPUT)
+
+/* CN8_1 is NC */
+GPIO(CN8_2, PIN(C, 8), GPIO_INPUT)
+/* CN8_3 is IOREF */
+GPIO(CN8_4, PIN(C, 9), GPIO_INPUT)
+/* CN8_5 is NRST */
+/*GPIO(CN8_6, PIN(C, 10), GPIO_INPUT) UART4 */
+/* CN8_7 is 3V3 */
+/*GPIO(CN8_8, PIN(C, 11), GPIO_INPUT) UART4 */
+/* CN8_9 is 5V */
+/*GPIO(CN8_10, PIN(C, 12), GPIO_INPUT) UART5 */
+/* CN8_11 is GND */
+/*GPIO(CN8_12, PIN(D, 2), GPIO_INPUT) UART5 */
+/* CN8_13 is GND */
+GPIO(CN8_14, PIN(F, 3), GPIO_INPUT)
+/* CN8_15 is VIN */
+GPIO(CN8_16, PIN(F, 5), GPIO_INPUT)
+
+GPIO(CN9_1, PIN(A, 3), GPIO_INPUT)
+GPIO(CN9_2, PIN(D, 7), GPIO_INPUT)
+GPIO(CN9_3, PIN(A, 2), GPIO_INPUT)
+/*GPIO(CN9_4, PIN(D, 6), GPIO_INPUT) UART2 */
+GPIO(CN9_5, PIN(C, 3), GPIO_INPUT)
+/*GPIO(CN9_6, PIN(D, 5), GPIO_INPUT) UART2 */
+GPIO(CN9_7, PIN(B, 0), GPIO_INPUT)
+/*GPIO(CN9_8, PIN(D, 4), GPIO_INPUT) SPI2 */
+/*GPIO(CN9_9, PIN(C, 1), GPIO_INPUT) I2C3 */
+/*GPIO(CN9_10, PIN(D, 3), GPIO_INPUT) SPI2 */
+/*GPIO(CN9_11, PIN(C, 0), GPIO_INPUT) I2C3 */
+/* CN9_12 is GND */
+GPIO(CN9_13, PIN(B, 2), GPIO_INPUT)
+GPIO(CN9_14, PIN(E, 2), GPIO_INPUT)
+GPIO(CN9_15, PIN(B, 6), GPIO_INPUT)
+GPIO(CN9_16, PIN(E, 4), GPIO_INPUT)
+GPIO(CN9_17, PIN(F, 2), GPIO_INPUT)
+GPIO(CN9_18, PIN(E, 5), GPIO_INPUT)
+/*GPIO(CN9_19, PIN(F, 1), GPIO_INPUT) I2C2 */
+GPIO(CN9_20, PIN(E, 6), GPIO_INPUT)
+/*GPIO(CN9_21, PIN(F, 0), GPIO_INPUT) I2C2 */
+GPIO(CN9_22, PIN(E, 3), GPIO_INPUT)
+/* CN9_23 is GND */
+GPIO(CN9_24, PIN(F, 8), GPIO_INPUT)
+/*GPIO(CN9_25, PIN(D, 0), GPIO_INPUT) SPI2 */
+GPIO(CN9_26, PIN(F, 7), GPIO_INPUT)
+/*GPIO(CN9_27, PIN(D, 1), GPIO_INPUT) SPI2 */
+GPIO(CN9_28, PIN(F, 9), GPIO_INPUT)
+GPIO(CN9_29, PIN(G, 0), GPIO_INPUT)
+GPIO(CN9_30, PIN(G, 1), GPIO_INPUT)
+
+/* CN10_1 is AVDD */
+GPIO(CN10_2, PIN(F, 13), GPIO_INPUT)
+/* CN10_3 is AGND */
+GPIO(CN10_4, PIN(E, 9), GPIO_INPUT)
+/* CN10_5 is GND */
+/*GPIO(CN10_6, PIN(E, 11), GPIO_INPUT) QSPI */
+GPIO(CN10_7, PIN(B, 1), GPIO_INPUT)
+GPIO(CN10_8, PIN(F, 14), GPIO_INPUT)
+/*GPIO(CN10_9, PIN(C, 2), GPIO_INPUT) Nucleo USB VBUS sense */
+/*GPIO(CN10_10, PIN(E, 13), GPIO_INPUT) QSPI */
+GPIO(CN10_11, PIN(A, 1), GPIO_INPUT)
+GPIO(CN10_12, PIN(F, 15), GPIO_INPUT)
+/*GPIO(CN10_13, PIN(A, 2), GPIO_INPUT)*/
+/*GPIO(CN10_14, PIN(D, 8), GPIO_INPUT) UART3 */
+GPIO(CN10_15, PIN(B, 10), GPIO_INPUT)
+/*GPIO(CN10_16, PIN(D, 9), GPIO_INPUT) UART3 */
+/* CN10_17 is GND */
+GPIO(CN10_18, PIN(E, 8), GPIO_INPUT)
+/*GPIO(CN10_19, PIN(E, 15), GPIO_INPUT) QSPI */
+GPIO(CN10_20, PIN(E, 7), GPIO_INPUT)
+/*GPIO(CN10_21, PIN(B, 0), GPIO_INPUT)*/
+/* CN10_22 is GND */
+/*GPIO(CN10_23, PIN(E, 12), GPIO_INPUT) QSPI */
+/*GPIO(CN10_24, PIN(E, 10), GPIO_INPUT) QSPI */
+/*GPIO(CN10_25, PIN(E, 14), GPIO_INPUT) QSPI */
+/*GPIO(CN10_26, PIN(E, 12), GPIO_INPUT) QSPI */
+/* CN10_27 is GND */
+/*GPIO(CN10_28, PIN(E, 14), GPIO_INPUT) QSPI */
+GPIO(CN10_29, PIN(A, 0), GPIO_INPUT)
+/*GPIO(CN10_30, PIN(E, 15), GPIO_INPUT) QSPI */
+GPIO(CN10_31, PIN(A, 8), GPIO_INPUT)
+/*GPIO(CN10_32, PIN(B, 10), GPIO_INPUT)*/
+GPIO(CN10_33, PIN(E, 0), GPIO_INPUT)
+GPIO(CN10_34, PIN(B, 11), GPIO_INPUT)
+
+
+/* QSPI controller */
+GPIO(QSPI_DEV_CLK, PIN(E, 10), GPIO_INPUT)
+GPIO(QSPI_DEV_CS_L, PIN(E, 11), GPIO_INPUT)
+GPIO(QSPI_DEV_D0, PIN(E, 12), GPIO_INPUT)
+GPIO(QSPI_DEV_D1, PIN(E, 13), GPIO_INPUT)
+GPIO(QSPI_DEV_D2, PIN(E, 14), GPIO_INPUT)
+GPIO(QSPI_DEV_D3, PIN(E, 15), GPIO_INPUT)
+
+/* I2C pins should be configured as inputs until I2C module is */
+/* initialized. This will avoid driving the lines unintentionally.*/
+GPIO(TPM_I2C1_HOST_SCL, PIN(B, 8), GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+GPIO(TPM_I2C1_HOST_SDA, PIN(B, 9), GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+GPIO(INA_I2C2_DEV_SCL, PIN(F, 1), GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+GPIO(INA_I2C2_DEV_SDA, PIN(F, 0), GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+GPIO(AUX_I2C3_DEV_SCL, PIN(C, 0), GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+GPIO(AUX_I2C3_DEV_SDA, PIN(C, 1), GPIO_OUTPUT | GPIO_OPEN_DRAIN)
+
+/* These pins are used for USART and are set to alternate mode below */
+GPIO(USART2_OT_TX, PIN(D, 5), GPIO_INPUT)
+GPIO(USART2_OT_RX, PIN(D, 6), GPIO_INPUT)
+GPIO(USART4_AP_TX, PIN(C, 10), GPIO_INPUT)
+GPIO(USART4_AP_RX, PIN(C, 11), GPIO_INPUT)
+GPIO(USART5_FPMCU_TX, PIN(C, 12), GPIO_INPUT)
+GPIO(USART5_FPMCU_RX, PIN(D, 2), GPIO_INPUT)
+GPIO(USART3_EC_TX, PIN(D, 8), GPIO_INPUT)
+GPIO(USART3_EC_RX, PIN(D, 9), GPIO_INPUT)
+GPIO(LPUART1_HYPER_RX, PIN(G, 7), GPIO_INPUT)
+GPIO(LPUART1_HYPER_TX, PIN(G, 8), GPIO_INPUT)
+
+/* Additional SPI controller, only available on CN11/CN12 */
+GPIO(SPI2_CS, PIN(D, 0), GPIO_OUT_HIGH)
+GPIO(SPI2_SCK, PIN(D, 1), GPIO_ALTERNATE)
+GPIO(SPI2_CIDO, PIN(D, 3), GPIO_ALTERNATE)
+GPIO(SPI2_CODI, PIN(D, 4), GPIO_ALTERNATE)
+
+/* USB pins */
+GPIO(USB_FS_DM, PIN(A, 11), GPIO_ALTERNATE)
+GPIO(USB_FS_DP, PIN(A, 12), GPIO_ALTERNATE)
+GPIO(CC1, PIN(A, 4), GPIO_ANALOG)
+GPIO(CC2, PIN(A, 5), GPIO_ANALOG)
+
+/* Signals for hardware on the Nucleo board itself */
+GPIO(NUCLEO_LED1, PIN(C, 7), GPIO_OUT_HIGH) /* Green */
+GPIO(NUCLEO_LED2, PIN(B, 7), GPIO_OUT_LOW) /* Blue */
+GPIO(NUCLEO_LED3, PIN(A, 9), GPIO_OUT_LOW) /* Red */
+
+/* Unimplemented signals since we are not an EC */
+UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
+
+
+ALTERNATE(PIN_MASK(A, 0x1800), 10, MODULE_USB, 0) /* USB: PA11/12 */
+
+ALTERNATE(PIN_MASK(D, 0x0060), 7, MODULE_UART, 0) /* USART2: PD5/PD6 - OT UART */
+ALTERNATE(PIN_MASK(C, 0x0C00), 8, MODULE_UART, 0) /* USART4: PC10/PC11 - AP UART */
+ALTERNATE(PIN_MASK(D, 0x0300), 7, MODULE_UART, 0) /* USART3: PD8/PD9 - EC UART */
+ALTERNATE(PIN_MASK(C, 0x1000), 8, MODULE_UART, 0) /* USART5: PC12 - FP MCU UART */
+ALTERNATE(PIN_MASK(D, 0x0004), 8, MODULE_UART, 0) /* USART5: PD2 - FP MCU UART */
+ALTERNATE(PIN_MASK(G, 0x0180), 8, MODULE_UART, 0) /* LPUART1: PG7/PG8 - HyperDebug console */
+
+ALTERNATE(PIN_MASK(F, 0x0003), 4, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C2: PF0/PF1 */
+ALTERNATE(PIN_MASK(B, 0x0300), 4, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C1: PB8/PB9 */
+ALTERNATE(PIN_MASK(C, 0x0003), 4, MODULE_I2C, GPIO_OPEN_DRAIN) /* I2C3: PC0/PC1 */
+/*ALTERNATE(PIN_MASK(E, 0xFC00), 10, MODULE_SPI_FLASH, 0) / * QSPI: PE10-15 */
+/*ALTERNATE(PIN_MASK(D, 0x0001), 5, MODULE_SPI, 0) / * SPI2: PD0 CS */
+ALTERNATE(PIN_MASK(D, 0x001A), 5, MODULE_SPI, 0) /* SPI2: PD1/PD3/PD4 SCK/CIDO/DOCI */
diff --git a/board/icarus/battery.c b/board/icarus/battery.c
index 6f6b49899a..5e1671f5f3 100644
--- a/board/icarus/battery.c
+++ b/board/icarus/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/icarus/board.c b/board/icarus/board.c
index 4dcb55d472..be464e3a77 100644
--- a/board/icarus/board.c
+++ b/board/icarus/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,6 +26,7 @@
#include "i2c.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -40,8 +41,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#include "gpio_list.h"
@@ -51,18 +52,21 @@
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {-1, -1}, {-1, -1},
- {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6}, {-1, -1}, {GPIO_KSO_L, 3},
- {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1}, {GPIO_KSO_L, 4},
- {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0}, {GPIO_KSI, 5},
- {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6}, {GPIO_KSI, 7},
- {GPIO_KSI, 1}, {-1, -1}, {GPIO_KSO_H, 5}, {-1, -1},
- {GPIO_KSO_H, 6}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { -1, -1 }, { -1, -1 }, { GPIO_KSO_L, 5 },
+ { GPIO_KSO_L, 6 }, { -1, -1 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { GPIO_KSO_H, 5 },
+ { -1, -1 }, { GPIO_KSO_H, 6 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* Wake-up pins for hibernate */
const enum gpio_signal hibernate_wake_pins[] = {
@@ -75,39 +79,33 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH1},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH2},
- [ADC_VBUS] = {"VBUS", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH0},
+ [ADC_BOARD_ID] = { "BOARD_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH1 },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH2 },
+ [ADC_VBUS] = { "VBUS", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = IT83XX_I2C_CH_C,
- .kbps = 400,
- .scl = GPIO_I2C_C_SCL,
- .sda = GPIO_I2C_C_SDA
- },
- {
- .name = "other",
- .port = IT83XX_I2C_CH_B,
- .kbps = 100,
- .scl = GPIO_I2C_B_SCL,
- .sda = GPIO_I2C_B_SDA
- },
- {
- .name = "battery",
- .port = IT83XX_I2C_CH_A,
- .kbps = 100,
- .scl = GPIO_I2C_A_SCL,
- .sda = GPIO_I2C_A_SDA
- },
+ { .name = "typec",
+ .port = IT83XX_I2C_CH_C,
+ .kbps = 400,
+ .scl = GPIO_I2C_C_SCL,
+ .sda = GPIO_I2C_C_SDA },
+ { .name = "other",
+ .port = IT83XX_I2C_CH_B,
+ .kbps = 100,
+ .scl = GPIO_I2C_B_SCL,
+ .sda = GPIO_I2C_B_SDA },
+ { .name = "battery",
+ .port = IT83XX_I2C_CH_A,
+ .kbps = 100,
+ .scl = GPIO_I2C_A_SCL,
+ .sda = GPIO_I2C_A_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -115,8 +113,8 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -139,8 +137,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -153,13 +150,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -204,12 +204,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
diff --git a/board/icarus/board.h b/board/icarus/board.h
index 0fe63af10c..98b6da3fd5 100644
--- a/board/icarus/board.h
+++ b/board/icarus/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,14 +48,14 @@
#undef CONFIG_ACCEL_FIFO_THRES
/* I2C ports */
-#define I2C_PORT_BC12 IT83XX_I2C_CH_C
-#define I2C_PORT_TCPC0 IT83XX_I2C_CH_C
-#define I2C_PORT_USB_MUX IT83XX_I2C_CH_C
-#define I2C_PORT_CHARGER IT83XX_I2C_CH_A
-#define I2C_PORT_SENSORS IT83XX_I2C_CH_B
-#define I2C_PORT_ACCEL I2C_PORT_SENSORS
-#define I2C_PORT_BATTERY IT83XX_I2C_CH_A
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 IT83XX_I2C_CH_C
+#define I2C_PORT_TCPC0 IT83XX_I2C_CH_C
+#define I2C_PORT_USB_MUX IT83XX_I2C_CH_C
+#define I2C_PORT_CHARGER IT83XX_I2C_CH_A
+#define I2C_PORT_SENSORS IT83XX_I2C_CH_B
+#define I2C_PORT_ACCEL I2C_PORT_SENSORS
+#define I2C_PORT_BATTERY IT83XX_I2C_CH_A
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
@@ -114,7 +114,7 @@ enum battery_type {
/* support factory keyboard test */
#define CONFIG_KEYBOARD_FACTORY_TEST
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
#ifdef SECTION_IS_RO
/* Interrupt handler for AP jump to BL */
diff --git a/board/icarus/build.mk b/board/icarus/build.mk
index 9ca7933e2a..a1ca27116e 100644
--- a/board/icarus/build.mk
+++ b/board/icarus/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/icarus/ec.tasklist b/board/icarus/ec.tasklist
index e8ad538bc2..9b6e29ea07 100644
--- a/board/icarus/ec.tasklist
+++ b/board/icarus/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/icarus/gpio.inc b/board/icarus/gpio.inc
index a3a097c17b..1ec4c9cc41 100644
--- a/board/icarus/gpio.inc
+++ b/board/icarus/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/icarus/led.c b/board/icarus/led.c
index 076199b2ed..bbbad7ceb8 100644
--- a/board/icarus/led.c
+++ b/board/icarus/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,22 +14,27 @@
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
{
diff --git a/board/it83xx_evb/board.c b/board/it83xx_evb/board.c
index a18b8b3b70..37ee2f48ed 100644
--- a/board/it83xx_evb/board.c
+++ b/board/it83xx_evb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it83xx_evb/board.h b/board/it83xx_evb/board.h
index 754474174c..d3eec7f09e 100644
--- a/board/it83xx_evb/board.h
+++ b/board/it83xx_evb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it83xx_evb/build.mk b/board/it83xx_evb/build.mk
index e4c8c01b89..9a78775633 100644
--- a/board/it83xx_evb/build.mk
+++ b/board/it83xx_evb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2013 The Chromium OS Authors. All rights reserved.
+# Copyright 2013 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/it83xx_evb/ec.tasklist b/board/it83xx_evb/ec.tasklist
index 3ca78d55db..e5d2d246df 100644
--- a/board/it83xx_evb/ec.tasklist
+++ b/board/it83xx_evb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2013 The Chromium OS Authors. All rights reserved.
+/* Copyright 2013 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it83xx_evb/gpio.inc b/board/it83xx_evb/gpio.inc
index 505f91ad64..e3014814d7 100644
--- a/board/it83xx_evb/gpio.inc
+++ b/board/it83xx_evb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it8xxx2_evb/board.c b/board/it8xxx2_evb/board.c
index 0daa3d48cd..404a575e42 100644
--- a/board/it8xxx2_evb/board.c
+++ b/board/it8xxx2_evb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it8xxx2_evb/board.h b/board/it8xxx2_evb/board.h
index 1369e43496..766f0fab4f 100644
--- a/board/it8xxx2_evb/board.h
+++ b/board/it8xxx2_evb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it8xxx2_evb/build.mk b/board/it8xxx2_evb/build.mk
index b54a2fcbb6..6fefa1fc6c 100644
--- a/board/it8xxx2_evb/build.mk
+++ b/board/it8xxx2_evb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/it8xxx2_evb/ec.tasklist b/board/it8xxx2_evb/ec.tasklist
index ff184489e3..a25dab19eb 100644
--- a/board/it8xxx2_evb/ec.tasklist
+++ b/board/it8xxx2_evb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it8xxx2_evb/gpio.inc b/board/it8xxx2_evb/gpio.inc
index e5e7d5e942..32d9de4a05 100644
--- a/board/it8xxx2_evb/gpio.inc
+++ b/board/it8xxx2_evb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it8xxx2_pdevb/board.c b/board/it8xxx2_pdevb/board.c
index 9161b2ce2e..2bcc58a58c 100644
--- a/board/it8xxx2_pdevb/board.c
+++ b/board/it8xxx2_pdevb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,12 +14,12 @@
#include "timer.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
-#define USB_PD_PORT_ITE_0 0
-#define USB_PD_PORT_ITE_1 1
-#define USB_PD_PORT_ITE_2 2
-#define RESISTIVE_DIVIDER 11
+#define USB_PD_PORT_ITE_0 0
+#define USB_PD_PORT_ITE_1 1
+#define USB_PD_PORT_ITE_2 2
+#define RESISTIVE_DIVIDER 11
int board_get_battery_soc(void)
{
@@ -83,7 +83,7 @@ void board_pd_vbus_ctrl(int port, int enabled)
gpio_set_level(GPIO_USBPD_PORTA_VBUS_OUTPUT, enabled);
if (!enabled) {
gpio_set_level(GPIO_USBPD_PORTA_VBUS_DROP, 1);
- udelay(10*MSEC); /* 10ms is a try and error value */
+ udelay(10 * MSEC); /* 10ms is a try and error value */
}
gpio_set_level(GPIO_USBPD_PORTA_VBUS_DROP, 0);
} else if (port == USBPD_PORT_B) {
@@ -91,7 +91,7 @@ void board_pd_vbus_ctrl(int port, int enabled)
gpio_set_level(GPIO_USBPD_PORTB_VBUS_OUTPUT, enabled);
if (!enabled) {
gpio_set_level(GPIO_USBPD_PORTB_VBUS_DROP, 1);
- udelay(10*MSEC); /* 10ms is a try and error value */
+ udelay(10 * MSEC); /* 10ms is a try and error value */
}
gpio_set_level(GPIO_USBPD_PORTB_VBUS_DROP, 0);
} else if (port == USBPD_PORT_C) {
@@ -99,13 +99,13 @@ void board_pd_vbus_ctrl(int port, int enabled)
gpio_set_level(GPIO_USBPD_PORTC_VBUS_OUTPUT, enabled);
if (!enabled) {
gpio_set_level(GPIO_USBPD_PORTC_VBUS_DROP, 1);
- udelay(10*MSEC); /* 10ms is a try and error value */
+ udelay(10 * MSEC); /* 10ms is a try and error value */
}
gpio_set_level(GPIO_USBPD_PORTC_VBUS_DROP, 0);
}
if (enabled)
- udelay(10*MSEC); /* 10ms is a try and error value */
+ udelay(10 * MSEC); /* 10ms is a try and error value */
}
void pd_set_input_current_limit(int port, uint32_t max_ma,
@@ -120,8 +120,7 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
* so use the same frequency and prescaler register setting is required if
* number of pwm channel greater than three.
*/
-const struct pwm_t pwm_channels[] = {
-};
+const struct pwm_t pwm_channels[] = {};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
diff --git a/board/it8xxx2_pdevb/board.h b/board/it8xxx2_pdevb/board.h
index d23898f3aa..e617a015bd 100644
--- a/board/it8xxx2_pdevb/board.h
+++ b/board/it8xxx2_pdevb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,12 +42,12 @@
#define CONFIG_USB_PD_CUSTOM_PDO
#define CONFIG_USB_PD_3A_PORTS 0
#define CONFIG_USB_PD_DUAL_ROLE
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 2
#define CONFIG_USB_PD_TCPMV2
#define CONFIG_USB_DRP_ACC_TRYSRC
#define CONFIG_USB_PD_REV30
-#define CONFIG_USB_PID 0x1234 /* Invalid PID for development board */
+#define CONFIG_USB_PID 0x1234 /* Invalid PID for development board */
#define CONFIG_USB_PD_DEBUG_LEVEL 2
#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP
#define CONFIG_USB_PD_TRY_SRC
@@ -82,16 +82,16 @@ enum adc_channel {
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
/* Try to negotiate to 20V since i2c noise problems should be fixed. */
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_VOLTAGE_MV 20000
/* TODO: determine the following board specific type-C power constants */
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
diff --git a/board/it8xxx2_pdevb/build.mk b/board/it8xxx2_pdevb/build.mk
index b54a2fcbb6..6fefa1fc6c 100644
--- a/board/it8xxx2_pdevb/build.mk
+++ b/board/it8xxx2_pdevb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/it8xxx2_pdevb/ec.tasklist b/board/it8xxx2_pdevb/ec.tasklist
index 41fc733526..ef1195fe7e 100644
--- a/board/it8xxx2_pdevb/ec.tasklist
+++ b/board/it8xxx2_pdevb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/it8xxx2_pdevb/gpio.inc b/board/it8xxx2_pdevb/gpio.inc
index afc83a82c3..a03509507b 100644
--- a/board/it8xxx2_pdevb/gpio.inc
+++ b/board/it8xxx2_pdevb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/jacuzzi/battery.c b/board/jacuzzi/battery.c
index 443bf1e98a..1caeb7e3c5 100644
--- a/board/jacuzzi/battery.c
+++ b/board/jacuzzi/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -120,7 +120,8 @@ const struct board_batt_params board_battery_info[] = {
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_PANASONIC_AC16L5J_KT00205009;
+const enum battery_type DEFAULT_BATTERY_TYPE =
+ BATTERY_PANASONIC_AC16L5J_KT00205009;
enum battery_present battery_hw_present(void)
{
diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c
index 861c139fdf..129b75f8e2 100644
--- a/board/jacuzzi/board.c
+++ b/board/jacuzzi/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,6 +32,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -46,8 +47,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -59,50 +60,42 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
#ifdef BOARD_JACUZZI
- {
- .name = "other",
- .port = 1,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
#else /* Juniper */
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
#endif
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -110,8 +103,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -167,8 +160,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -181,13 +173,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -249,12 +244,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -311,8 +306,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -329,8 +323,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -368,14 +361,12 @@ static void board_init(void)
#ifndef VARIANT_KUKUI_NO_SENSORS
motion_sensor_count = 0;
gpio_disable_interrupt(GPIO_ACCEL_INT_ODL);
- gpio_set_flags(GPIO_ACCEL_INT_ODL,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_INT_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
/* Disable tablet mode. */
tablet_set_mode(0, TABLET_TRIGGER_LID);
gmr_tablet_switch_disable();
- gpio_set_flags(GPIO_TABLET_MODE_L,
- GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_TABLET_MODE_L, GPIO_INPUT | GPIO_PULL_UP);
}
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -387,17 +378,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_bmi160_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_bmi160_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_icm426xx_ref = {
- {0, FLOAT_TO_FP(-1), 0},
- {FLOAT_TO_FP(1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_icm426xx_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -558,10 +545,11 @@ static void board_detect_motionsensor(void)
motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
}
- base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608)
- ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160;
- CPRINTS("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608)
- ? "ICM40608" : "BMI160");
+ base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) ?
+ BASE_GYRO_ICM426XX :
+ BASE_GYRO_BMI160;
+ CPRINTS("Base Accelgyro: %s",
+ (val == ICM426XX_CHIP_ICM40608) ? "ICM40608" : "BMI160");
}
DECLARE_HOOK(HOOK_INIT, board_detect_motionsensor, HOOK_PRIO_DEFAULT);
diff --git a/board/jacuzzi/board.h b/board/jacuzzi/board.h
index da66312411..0fd5f6496d 100644
--- a/board/jacuzzi/board.h
+++ b/board/jacuzzi/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -58,7 +58,7 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -71,7 +71,6 @@
#define CONFIG_ALS
#define CONFIG_CMD_ACCEL_INFO
-
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
@@ -84,24 +83,24 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
#ifdef BOARD_JACUZZI
-#define I2C_PORT_BATTERY 1
+#define I2C_PORT_BATTERY 1
#else /* Juniper */
-#define I2C_PORT_BATTERY 2
+#define I2C_PORT_BATTERY 2
#endif
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/jacuzzi/build.mk b/board/jacuzzi/build.mk
index e449fce9fc..80c34a4e46 100644
--- a/board/jacuzzi/build.mk
+++ b/board/jacuzzi/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/jacuzzi/ec.tasklist b/board/jacuzzi/ec.tasklist
index b695d05a71..dd3b853c27 100644
--- a/board/jacuzzi/ec.tasklist
+++ b/board/jacuzzi/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/jacuzzi/gpio.inc b/board/jacuzzi/gpio.inc
index 60288e7195..b534ad2ea1 100644
--- a/board/jacuzzi/gpio.inc
+++ b/board/jacuzzi/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/jacuzzi/led.c b/board/jacuzzi/led.c
index e76b73bc9a..f648e879d0 100644
--- a/board/jacuzzi/led.c
+++ b/board/jacuzzi/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -15,22 +15,27 @@
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
{
diff --git a/board/jinlon/battery.c b/board/jinlon/battery.c
index 12c2e38d84..9cf4c15458 100644
--- a/board/jinlon/battery.c
+++ b/board/jinlon/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/jinlon/board.c b/board/jinlon/board.c
index 58e7e1b427..717c8db09c 100644
--- a/board/jinlon/board.c
+++ b/board/jinlon/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void check_reboot_deferred(void);
DECLARE_DEFERRED(check_reboot_deferred);
@@ -114,18 +114,19 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_FAN2] = {.channel = 6, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 100 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_FAN2] = { .channel = 6,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -150,16 +151,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -188,17 +193,13 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -278,14 +279,14 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
const struct fan_conf fan_conf_1 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_1, /* Use MFT id to control fan */
+ .ch = MFT_CH_1, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN2,
};
@@ -311,49 +312,48 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
- [MFT_CH_1] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
+ [MFT_CH_1] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2 },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "5v Reg",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "IR Sensor",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = oti502_get_val,
- .idx = OTI502_IDX_OBJECT},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "5v Reg",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "IR Sensor",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = oti502_get_val,
+ .idx = OTI502_IDX_OBJECT },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Dratini Temperature sensors */
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -368,8 +368,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -438,8 +438,8 @@ static const struct ec_response_keybd_config keybd2 = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
/*
* Future boards should use fw_config instead of SKU ID
@@ -487,15 +487,15 @@ void board_overcurrent_event(int port, int is_overcurrented)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
bool board_is_convertible(void)
@@ -503,10 +503,9 @@ bool board_is_convertible(void)
const uint8_t sku = get_board_sku();
return (sku == 255) || (sku == 1) || (sku == 2) || (sku == 21) ||
- (sku == 22);
+ (sku == 22);
}
-
void all_sys_pgood_check_reboot(void)
{
hook_call_deferred(&check_reboot_deferred_data, 3000 * MSEC);
@@ -517,7 +516,7 @@ __override void board_chipset_forced_shutdown(void)
hook_call_deferred(&check_reboot_deferred_data, -1);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_forced_shutdown,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
static void check_reboot_deferred(void)
{
diff --git a/board/jinlon/board.h b/board/jinlon/board.h
index d4ecf9bbd6..350376dd63 100644
--- a/board/jinlon/board.h
+++ b/board/jinlon/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,10 +32,10 @@
* Jinlon's battery takes several seconds to come back out of its disconnect
* state (~4 seconds, but give it 6 for margin).
*/
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
/* Sensors */
/* BMI160 Base accel/gyro */
@@ -117,16 +117,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -134,9 +134,9 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC2 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC2 */
ADC_CH_COUNT
};
@@ -147,12 +147,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_FAN2,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_FAN2, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/jinlon/build.mk b/board/jinlon/build.mk
index 2d6118ea70..4e42a0616e 100644
--- a/board/jinlon/build.mk
+++ b/board/jinlon/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/jinlon/ec.tasklist b/board/jinlon/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/jinlon/ec.tasklist
+++ b/board/jinlon/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/jinlon/gpio.inc b/board/jinlon/gpio.inc
index f57a331436..91002dacc1 100644
--- a/board/jinlon/gpio.inc
+++ b/board/jinlon/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,10 +17,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/jinlon/led.c b/board/jinlon/led.c
index 4cef6dc3ae..8ab3d7631f 100644
--- a/board/jinlon/led.c
+++ b/board/jinlon/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -25,11 +25,9 @@
#define LED_ON_TICKS 5
#define POWER_LED_ON_TICKS 2
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -37,7 +35,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(int port, enum led_color color)
@@ -147,7 +145,6 @@ static void set_active_port_color(enum led_color color)
static void led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -159,9 +156,12 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(0, (battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(
+ 0,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_battery(0, LED_OFF);
}
@@ -170,19 +170,20 @@ static void led_set_battery(void)
led_set_color_battery(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -200,9 +201,10 @@ static void led_set_power(void)
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_SUSPEND |
CHIPSET_STATE_STANDBY))
- led_set_color_power((power_tick %
- LED_TICKS_PER_CYCLE < POWER_LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick % LED_TICKS_PER_CYCLE <
+ POWER_LED_ON_TICKS) ?
+ LED_WHITE :
+ LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/jinlon/thermal.c b/board/jinlon/thermal.c
index 03437fa3cd..70e6016109 100644
--- a/board/jinlon/thermal.c
+++ b/board/jinlon/thermal.c
@@ -1,8 +1,9 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "builtin/assert.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -16,7 +17,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -40,109 +41,108 @@ static const struct fan_step *fan_step_table;
static const struct fan_step fan_table_clamshell[] = {
{
/* level 0 */
- .on = {0, -1, 54, 37},
- .off = {99, -1, 99, 99},
- .rpm = {0, 0},
+ .on = { 0, -1, 54, 37 },
+ .off = { 99, -1, 99, 99 },
+ .rpm = { 0, 0 },
},
{
/* level 1 */
- .on = {0, -1, 57, 39},
- .off = {99, -1, 54, 37},
- .rpm = {3950, 3850},
+ .on = { 0, -1, 57, 39 },
+ .off = { 99, -1, 54, 37 },
+ .rpm = { 3950, 3850 },
},
{
/* level 2 */
- .on = {0, -1, 58, 40},
- .off = {99, -1, 57, 39},
- .rpm = {4200, 4100},
+ .on = { 0, -1, 58, 40 },
+ .off = { 99, -1, 57, 39 },
+ .rpm = { 4200, 4100 },
},
{
/* level 3 */
- .on = {0, -1, 59, 41},
- .off = {99, -1, 58, 40},
- .rpm = {4550, 4450},
+ .on = { 0, -1, 59, 41 },
+ .off = { 99, -1, 58, 40 },
+ .rpm = { 4550, 4450 },
},
{
/* level 4 */
- .on = {62, -1, 60, 42},
- .off = {58, -1, 59, 41},
- .rpm = {4900, 4800},
+ .on = { 62, -1, 60, 42 },
+ .off = { 58, -1, 59, 41 },
+ .rpm = { 4900, 4800 },
},
{
/* level 5 */
- .on = {64, -1, 61, 43},
- .off = {62, -1, 60, 42},
- .rpm = {5250, 5150},
+ .on = { 64, -1, 61, 43 },
+ .off = { 62, -1, 60, 42 },
+ .rpm = { 5250, 5150 },
},
{
/* level 6 */
- .on = {65, -1, 64, 45},
- .off = {63, -1, 61, 43},
- .rpm = {5400, 5300},
+ .on = { 65, -1, 64, 45 },
+ .off = { 63, -1, 61, 43 },
+ .rpm = { 5400, 5300 },
},
{
/* level 7 */
- .on = {100, -1, 100, 100},
- .off = {65, -1, 62, 44},
- .rpm = {6000, 5900},
+ .on = { 100, -1, 100, 100 },
+ .off = { 65, -1, 62, 44 },
+ .rpm = { 6000, 5900 },
},
};
static const struct fan_step fan_table_tablet[] = {
{
/* level 0 */
- .on = {0, -1, 55, 41},
- .off = {99, -1, 99, 99},
- .rpm = {0, 0},
+ .on = { 0, -1, 55, 41 },
+ .off = { 99, -1, 99, 99 },
+ .rpm = { 0, 0 },
},
{
/* level 1 */
- .on = {0, -1, 56, 42},
- .off = {99, -1, 55, 41},
- .rpm = {0, 0},
+ .on = { 0, -1, 56, 42 },
+ .off = { 99, -1, 55, 41 },
+ .rpm = { 0, 0 },
},
{
/* level 2 */
- .on = {0, -1, 57, 43},
- .off = {99, -1, 56, 42},
- .rpm = {4000, 3350},
+ .on = { 0, -1, 57, 43 },
+ .off = { 99, -1, 56, 42 },
+ .rpm = { 4000, 3350 },
},
{
/* level 3 */
- .on = {0, -1, 58, 44},
- .off = {99, -1, 57, 43},
- .rpm = {4200, 3400},
+ .on = { 0, -1, 58, 44 },
+ .off = { 99, -1, 57, 43 },
+ .rpm = { 4200, 3400 },
},
{
/* level 4 */
- .on = {60, -1, 59, 45},
- .off = {58, -1, 58, 44},
- .rpm = {4400, 3500},
+ .on = { 60, -1, 59, 45 },
+ .off = { 58, -1, 58, 44 },
+ .rpm = { 4400, 3500 },
},
{
/* level 5 */
- .on = {62, -1, 60, 46},
- .off = {60, -1, 59, 45},
- .rpm = {4800, 4350},
+ .on = { 62, -1, 60, 46 },
+ .off = { 60, -1, 59, 45 },
+ .rpm = { 4800, 4350 },
},
{
/* level 6 */
- .on = {65, -1, 61, 47},
- .off = {62, -1, 60, 46},
- .rpm = {5000, 4500},
+ .on = { 65, -1, 61, 47 },
+ .off = { 62, -1, 60, 46 },
+ .rpm = { 5000, 4500 },
},
{
/* level 7 */
- .on = {100, -1, 100, 100},
- .off = {65, -1, 61, 47},
- .rpm = {5200, 5100},
+ .on = { 100, -1, 100, 100 },
+ .off = { 65, -1, 61, 47 },
+ .rpm = { 5200, 5100 },
},
};
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table_clamshell)
-BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) ==
- ARRAY_SIZE(fan_table_tablet));
+BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == ARRAY_SIZE(fan_table_tablet));
int fan_table_to_rpm(int fan, int *temp)
{
@@ -165,12 +165,15 @@ int fan_table_to_rpm(int fan, int *temp)
*/
if (temp[TEMP_SENSOR_1] < prev_tmp[TEMP_SENSOR_1] ||
- temp[TEMP_SENSOR_3] < prev_tmp[TEMP_SENSOR_3] ||
- temp[TEMP_SENSOR_4] < prev_tmp[TEMP_SENSOR_4]) {
+ temp[TEMP_SENSOR_3] < prev_tmp[TEMP_SENSOR_3] ||
+ temp[TEMP_SENSOR_4] < prev_tmp[TEMP_SENSOR_4]) {
for (i = current_level; i > 0; i--) {
- if (temp[TEMP_SENSOR_1] < fan_step_table[i].off[TEMP_SENSOR_1] &&
- temp[TEMP_SENSOR_4] < fan_step_table[i].off[TEMP_SENSOR_4] &&
- temp[TEMP_SENSOR_3] < fan_step_table[i].off[TEMP_SENSOR_3])
+ if (temp[TEMP_SENSOR_1] <
+ fan_step_table[i].off[TEMP_SENSOR_1] &&
+ temp[TEMP_SENSOR_4] <
+ fan_step_table[i].off[TEMP_SENSOR_4] &&
+ temp[TEMP_SENSOR_3] <
+ fan_step_table[i].off[TEMP_SENSOR_3])
current_level = i - 1;
else
break;
@@ -179,9 +182,12 @@ int fan_table_to_rpm(int fan, int *temp)
temp[TEMP_SENSOR_3] > prev_tmp[TEMP_SENSOR_3] ||
temp[TEMP_SENSOR_4] > prev_tmp[TEMP_SENSOR_4]) {
for (i = current_level; i < NUM_FAN_LEVELS; i++) {
- if ((temp[TEMP_SENSOR_1] > fan_step_table[i].on[TEMP_SENSOR_1] &&
- temp[TEMP_SENSOR_4] > fan_step_table[i].on[TEMP_SENSOR_4]) ||
- temp[TEMP_SENSOR_3] > fan_step_table[i].on[TEMP_SENSOR_3])
+ if ((temp[TEMP_SENSOR_1] >
+ fan_step_table[i].on[TEMP_SENSOR_1] &&
+ temp[TEMP_SENSOR_4] >
+ fan_step_table[i].on[TEMP_SENSOR_4]) ||
+ temp[TEMP_SENSOR_3] >
+ fan_step_table[i].on[TEMP_SENSOR_3])
current_level = i + 1;
else
break;
@@ -212,10 +218,8 @@ int fan_table_to_rpm(int fan, int *temp)
void board_override_fan_control(int fan, int *tmp)
{
- if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, tmp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp));
}
}
diff --git a/board/kakadu/board.c b/board/kakadu/board.c
index 89905aa4a3..4be1e3f795 100644
--- a/board/kakadu/board.c
+++ b/board/kakadu/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,6 +27,7 @@
#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -43,8 +44,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -61,45 +62,40 @@ static void gauge_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
- [ADC_BATT_ID] = {"BATT_ID", 3300, 4096, 0, STM32_AIN(7)},
- [ADC_POGO_ADC_INT_L] = {"POGO_ADC_INT_L", 3300, 4096, 0, STM32_AIN(6)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
+ [ADC_BATT_ID] = { "BATT_ID", 3300, 4096, 0, STM32_AIN(7) },
+ [ADC_POGO_ADC_INT_L] = { "POGO_ADC_INT_L", 3300, 4096, 0,
+ STM32_AIN(6) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
@@ -119,8 +115,7 @@ struct mt6370_thermal_bound thermal_bound = {
.err = 4,
};
-static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -147,13 +142,16 @@ __override const struct rt946x_init_setting *board_rt946x_init_setting(void)
return &battery_init_setting;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_update,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_update,
+ },
},
};
@@ -244,9 +242,8 @@ int extpower_is_present(void)
if (board_vbus_source_enabled(CHARGE_PORT_USB_C))
usb_c_extpower_present = 0;
else
- usb_c_extpower_present = tcpm_check_vbus_level(
- CHARGE_PORT_USB_C,
- VBUS_PRESENT);
+ usb_c_extpower_present =
+ tcpm_check_vbus_level(CHARGE_PORT_USB_C, VBUS_PRESENT);
return usb_c_extpower_present;
}
@@ -334,17 +331,13 @@ enum lid_accelgyro_type {
static enum lid_accelgyro_type lid_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t lid_standard_ref_icm42607 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref_icm42607 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_lid_accel = {
.name = "Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -370,20 +363,20 @@ struct motion_sensor_t icm42607_lid_accel = {
};
struct motion_sensor_t icm42607_lid_gyro = {
- .name = "Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM42607,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &icm42607_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_icm42607_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &lid_standard_ref_icm42607,
- .min_frequency = ICM42607_GYRO_MIN_FREQ,
- .max_frequency = ICM42607_GYRO_MAX_FREQ,
+ .name = "Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &icm42607_drv,
+ .mutex = &g_lid_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &lid_standard_ref_icm42607,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
};
struct motion_sensor_t motion_sensors[] = {
@@ -460,18 +453,18 @@ static void board_detect_motionsensor(void)
if (lid_accelgyro_config != LID_GYRO_NONE)
return;
/* Check base accelgyro chip */
- ret = icm_read8(&icm42607_lid_accel,
- ICM42607_REG_WHO_AM_I, &val);
+ ret = icm_read8(&icm42607_lid_accel, ICM42607_REG_WHO_AM_I, &val);
if (ret)
ccprints("Get ICM fail.");
if (val == ICM42607_CHIP_ICM42607P) {
motion_sensors[LID_ACCEL] = icm42607_lid_accel;
motion_sensors[LID_GYRO] = icm42607_lid_gyro;
}
- lid_accelgyro_config = (val == ICM42607_CHIP_ICM42607P)
- ? LID_GYRO_ICM426XX : LID_GYRO_BMI160;
- ccprints("LID Accelgyro: %s", (val == ICM42607_CHIP_ICM42607P)
- ? "ICM42607" : "BMI160");
+ lid_accelgyro_config = (val == ICM42607_CHIP_ICM42607P) ?
+ LID_GYRO_ICM426XX :
+ LID_GYRO_BMI160;
+ ccprints("LID Accelgyro: %s",
+ (val == ICM42607_CHIP_ICM42607P) ? "ICM42607" : "BMI160");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsensor,
HOOK_PRIO_DEFAULT);
@@ -525,9 +518,8 @@ __override int board_charge_port_is_connected(int port)
return gpio_get_level(GPIO_POGO_VBUS_PRESENT);
}
-__override
-void board_fill_source_power_info(int port,
- struct ec_response_usb_pd_power_info *r)
+__override void
+board_fill_source_power_info(int port, struct ec_response_usb_pd_power_info *r)
{
r->meas.voltage_now = 3300;
r->meas.voltage_max = 3300;
@@ -540,13 +532,10 @@ void board_fill_source_power_info(int port,
static void mt6370_reg_fix(void)
{
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- RT946X_REG_CHGCTRL1,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, RT946X_REG_CHGCTRL1,
BIT(3) | BIT(5), MASK_CLR);
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- RT946X_REG_CHGCTRL2,
- BIT(5) | BIT(RT946X_SHIFT_BATDET_DIS_DLY),
- MASK_CLR);
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, RT946X_REG_CHGCTRL2,
+ BIT(5) | BIT(RT946X_SHIFT_BATDET_DIS_DLY), MASK_CLR);
}
DECLARE_HOOK(HOOK_INIT, mt6370_reg_fix, HOOK_PRIO_DEFAULT);
diff --git a/board/kakadu/board.h b/board/kakadu/board.h
index 09ff6d10be..5d64af2f6b 100644
--- a/board/kakadu/board.h
+++ b/board/kakadu/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
-#define BQ27541_ADDR 0x55
+#define BQ27541_ADDR 0x55
#define VARIANT_KUKUI_BATTERY_BQ27541
#define VARIANT_KUKUI_POGO_KEYBOARD
@@ -27,35 +27,33 @@
#define CONFIG_USB_MUX_RUNTIME_CONFIG
/* Battery */
-#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
#define CONFIG_CHARGER_MT6370_BACKLIGHT
-
/* Motion Sensors */
#ifdef SECTION_IS_RW
#define CONFIG_ACCELGYRO_BMI160
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-#define CONFIG_ACCELGYRO_ICM42607 /* Base accel second source*/
+#define CONFIG_ACCELGYRO_ICM42607 /* Base accel second source*/
#define CONFIG_ACCELGYRO_ICM42607_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#endif /* SECTION_IS_RW */
/* I2C ports */
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 1
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 1
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_ACCEL 1
-#define I2C_PORT_BC12 1
+#define I2C_PORT_ACCEL 1
+#define I2C_PORT_BC12 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
diff --git a/board/kakadu/build.mk b/board/kakadu/build.mk
index 7a3953b8bb..52ee1b3354 100644
--- a/board/kakadu/build.mk
+++ b/board/kakadu/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kakadu/ec.tasklist b/board/kakadu/ec.tasklist
index fc26f445b2..8be28c373d 100644
--- a/board/kakadu/ec.tasklist
+++ b/board/kakadu/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kakadu/gpio.inc b/board/kakadu/gpio.inc
index f52f2b7f2f..6f494a9388 100644
--- a/board/kakadu/gpio.inc
+++ b/board/kakadu/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kakadu/led.c b/board/kakadu/led.c
index 504bdf0d2f..26e1ea22bb 100644
--- a/board/kakadu/led.c
+++ b/board/kakadu/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -16,13 +16,13 @@ const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-#define LED_OFF MT6370_LED_ID_OFF
-#define LED_AMBER MT6370_LED_ID1
-#define LED_WHITE MT6370_LED_ID2
+#define LED_OFF MT6370_LED_ID_OFF
+#define LED_AMBER MT6370_LED_ID1
+#define LED_WHITE MT6370_LED_ID2
-#define LED_MASK_OFF 0
-#define LED_MASK_AMBER MT6370_MASK_RGB_ISNK1DIM_EN
-#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK2DIM_EN
+#define LED_MASK_OFF 0
+#define LED_MASK_AMBER MT6370_MASK_RGB_ISNK1DIM_EN
+#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK2DIM_EN
static void kakadu_led_set_battery(void)
{
diff --git a/board/kano/battery.c b/board/kano/battery.c
index 395b45371d..0b1d956173 100644
--- a/board/kano/battery.c
+++ b/board/kano/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/kano/board.c b/board/kano/board.c
index 7ed766698c..06f4a543d8 100644
--- a/board/kano/board.c
+++ b/board/kano/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,8 +27,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -80,8 +80,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -108,15 +108,14 @@ enum battery_present battery_hw_present(void)
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/kano/board.h b/board/kano/board.h
index e3988aad3f..156df67af0 100644
--- a/board/kano/board.h
+++ b/board/kano/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@
#define CONFIG_LED_ONOFF_STATES
/* Sensors */
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel */
#define CONFIG_ACCELGYRO_ICM_COMM_I2C
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -46,12 +46,11 @@
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_KX022
#define CONFIG_ACCEL_BMA4XX
-
/* Sensor console commands */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
@@ -61,9 +60,8 @@
#define CONFIG_KEYBOARD_REFRESH_ROW3
#define CONFIG_KEYBOARD_FACTORY_TEST
-
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -77,17 +75,17 @@
#define CONFIG_USB_PD_TCPM_RT1715
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -95,70 +93,70 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_ACCEL NPCX_I2C_PORT0_0
+#define I2C_PORT_ACCEL NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/*
* see b/174768555#comment22
*/
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x54
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x54
/* SOC facing Burnside Bridge retimer */
-#define USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR 0x55
+#define USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR 0x55
/* Type-C connector facing Burnside Bridge retimer */
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
@@ -180,12 +178,12 @@
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -203,33 +201,19 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum battery_type {
- BATTERY_AP19B8M,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_AP19B8M, BATTERY_TYPE_COUNT };
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/kano/build.mk b/board/kano/build.mk
index df453187bf..0393829e6e 100644
--- a/board/kano/build.mk
+++ b/board/kano/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kano/charger.c b/board/kano/charger.c
index 9f7c760858..ab48a7338c 100644
--- a/board/kano/charger.c
+++ b/board/kano/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -84,7 +83,6 @@ int board_set_active_charge_port(int port)
__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/kano/ec.tasklist b/board/kano/ec.tasklist
index f52567d9fa..64edf7bf2e 100644
--- a/board/kano/ec.tasklist
+++ b/board/kano/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kano/fans.c b/board/kano/fans.c
index b652ec90da..54ec134fd2 100644
--- a/board/kano/fans.c
+++ b/board/kano/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/kano/fw_config.c b/board/kano/fw_config.c
index e6e5ba28bb..f04fd0063b 100644
--- a/board/kano/fw_config.c
+++ b/board/kano/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union kano_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/kano/fw_config.h b/board/kano/fw_config.h
index 88573bdd33..9f0c1c3373 100644
--- a/board/kano/fw_config.h
+++ b/board/kano/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,12 +26,12 @@ enum ec_cfg_thermal_solution_type {
union kano_cbi_fw_config {
struct {
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t ufc : 2;
- uint32_t stylus : 1;
- enum ec_cfg_thermal_solution_type thermal_solution : 1;
- uint32_t reserved_1 : 24;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t ufc : 2;
+ uint32_t stylus : 1;
+ enum ec_cfg_thermal_solution_type thermal_solution : 1;
+ uint32_t reserved_1 : 24;
};
uint32_t raw_value;
};
diff --git a/board/kano/gpio.inc b/board/kano/gpio.inc
index cfcc6bbd3f..2ace5cbbca 100644
--- a/board/kano/gpio.inc
+++ b/board/kano/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kano/i2c.c b/board/kano/i2c.c
index e779e119e3..6f5983c928 100644
--- a/board/kano/i2c.c
+++ b/board/kano/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kano/keyboard.c b/board/kano/keyboard.c
index 38e96620e2..a96971c781 100644
--- a/board/kano/keyboard.c
+++ b/board/kano/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@ static const struct ec_response_keybd_config kano_kb = {
},
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &kano_kb;
}
diff --git a/board/kano/led.c b/board/kano/led.c
index 23c9fca50c..1bbfc283de 100644
--- a/board/kano/led.c
+++ b/board/kano/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
* Power and battery LED control for kano
@@ -18,23 +18,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/kano/pwm.c b/board/kano/pwm.c
index f2c0d0db7d..6aae786cf3 100644
--- a/board/kano/pwm.c
+++ b/board/kano/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kano/sensors.c b/board/kano/sensors.c
index e3e2f9d920..5eb1f6f933 100644
--- a/board/kano/sensors.c
+++ b/board/kano/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -65,27 +65,19 @@ static enum base_accelgyro_type base_accelgyro_config;
* TODO:(b/197200940): Verify lid and base orientation
* matrix on proto board.
*/
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_bma422_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-static const mat33_fp_t base_bmi260_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_bma422_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+static const mat33_fp_t base_bmi260_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct motion_sensor_t bmi260_base_accel = {
.name = "Base Accel",
@@ -244,15 +236,15 @@ static void baseboard_sensors_detect(void)
return;
ret = i2c_read8(I2C_PORT_ACCEL, BMA4_I2C_ADDR_SECONDARY,
- BMA4_CHIP_ID_ADDR, &val);
+ BMA4_CHIP_ID_ADDR, &val);
if (ret == 0 && val == BMA422_CHIP_ID) {
motion_sensors[LID_ACCEL] = bma422_lid_accel;
ccprints("LID_ACCEL is BMA422");
} else
ccprints("LID_ACCEL is KX022");
- ret = bmi_read8(I2C_PORT_ACCEL, BMI260_ADDR0_FLAGS,
- BMI260_CHIP_ID, &val);
+ ret = bmi_read8(I2C_PORT_ACCEL, BMI260_ADDR0_FLAGS, BMI260_CHIP_ID,
+ &val);
if (ret == 0 && val == BMI260_CHIP_ID_MAJOR) {
motion_sensors[BASE_ACCEL] = bmi260_base_accel;
motion_sensors[BASE_GYRO] = bmi260_base_gyro;
@@ -263,8 +255,7 @@ static void baseboard_sensors_detect(void)
ccprints("BASE ACCEL IS ICM426XX");
}
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, baseboard_sensors_detect,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, baseboard_sensors_detect, HOOK_PRIO_DEFAULT);
static void baseboard_sensors_init(void)
{
@@ -285,24 +276,18 @@ void motion_interrupt(enum gpio_signal signal)
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_2_FAN] = {
- .name = "FAN",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_FAN
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "CHARGER",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_2_FAN] = { .name = "FAN",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_FAN },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "CHARGER",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -316,8 +301,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = 0, \
[EC_TEMP_THRESH_HALT] = 0, \
@@ -346,8 +331,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -363,8 +348,8 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN_28W \
- { \
+#define THERMAL_FAN_28W \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -376,7 +361,7 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
.temp_fan_max = C_TO_K(62), \
}
__maybe_unused static const struct ec_thermal_config thermal_fan_28w =
- THERMAL_FAN_28W;
+ THERMAL_FAN_28W;
/*
* Set value to zero to disable charger thermal control.
@@ -384,8 +369,8 @@ __maybe_unused static const struct ec_thermal_config thermal_fan_28w =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = 0, \
[EC_TEMP_THRESH_HALT] = 0, \
@@ -397,13 +382,13 @@ __maybe_unused static const struct ec_thermal_config thermal_fan_28w =
.temp_fan_max = 0, \
}
__maybe_unused static const struct ec_thermal_config thermal_charger =
- THERMAL_CHARGER;
+ THERMAL_CHARGER;
/* this should really be "const" */
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU,
[TEMP_SENSOR_2_FAN] = THERMAL_FAN,
- [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
+ [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/kano/usbc_config.c b/board/kano/usbc_config.c
index 0167646790..ed18b2d021 100644
--- a/board/kano/usbc_config.c
+++ b/board/kano/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,8 +31,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -79,43 +79,56 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux soc_side_bb_retimer_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+struct usb_mux_chain soc_side_bb_retimer_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_SOC_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &soc_side_bb_retimer_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &soc_side_bb_retimer_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/kano/usbc_config.h b/board/kano/usbc_config.h
index 38fce7d2cf..72e26c31c1 100644
--- a/board/kano/usbc_config.h
+++ b/board/kano/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/kappa/battery.c b/board/kappa/battery.c
index a098e2b8ce..bd8f05b418 100644
--- a/board/kappa/battery.c
+++ b/board/kappa/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kappa/board.c b/board/kappa/board.c
index a0d5fda409..c04b24d3ed 100644
--- a/board/kappa/board.c
+++ b/board/kappa/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -44,8 +45,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -57,40 +58,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -98,8 +93,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -132,8 +127,7 @@ struct ioexpander_config_t ioex_config[CONFIG_IO_EXPANDER_PORT_COUNT] = {
/******************************************************************************/
/* SPI devices */
/* TODO: to be added once sensors land via CL:1714436 */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
@@ -155,8 +149,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -169,13 +162,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -221,12 +217,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
diff --git a/board/kappa/board.h b/board/kappa/board.h
index 7cc7f68406..6b6461ae83 100644
--- a/board/kappa/board.h
+++ b/board/kappa/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,16 +50,16 @@
#undef CONFIG_TABLET_MODE_SWITCH
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 2
-#define I2C_PORT_CHARGER 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 2
+#define I2C_PORT_CHARGER 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/kappa/build.mk b/board/kappa/build.mk
index e449fce9fc..80c34a4e46 100644
--- a/board/kappa/build.mk
+++ b/board/kappa/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kappa/ec.tasklist b/board/kappa/ec.tasklist
index c41e203780..3705823bac 100644
--- a/board/kappa/ec.tasklist
+++ b/board/kappa/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kappa/gpio.inc b/board/kappa/gpio.inc
index 0e01d54f10..d7d6c5267b 100644
--- a/board/kappa/gpio.inc
+++ b/board/kappa/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kappa/led.c b/board/kappa/led.c
index 5b65d7b948..1c7979eac0 100644
--- a/board/kappa/led.c
+++ b/board/kappa/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,7 +14,7 @@
#define BAT_LED_ON 0
#define BAT_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -22,7 +22,7 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -82,16 +82,14 @@ static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
/* override battery led for system suspend */
- if (chipset_in_state(CHIPSET_STATE_SUSPEND |
- CHIPSET_STATE_STANDBY) &&
+ if (chipset_in_state(CHIPSET_STATE_SUSPEND | CHIPSET_STATE_STANDBY) &&
charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x2 ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(power_ticks++ & 0x2 ? LED_WHITE :
+ LED_OFF);
return;
}
@@ -119,19 +117,18 @@ static void led_set_battery(void)
led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_battery((battery_ticks % 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x2) ? LED_AMBER :
+ LED_OFF);
default:
/* Other states don't alter LED behavior */
break;
diff --git a/board/karma/board.c b/board/karma/board.c
index 4e9f9166ff..df053ad782 100644
--- a/board/karma/board.c
+++ b/board/karma/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,8 +8,8 @@
#include "hooks.h"
#include "oz554.h"
-#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
void oz554_board_init(void)
{
diff --git a/board/karma/board.h b/board/karma/board.h
index 372b18509b..c3b6cd074a 100644
--- a/board/karma/board.h
+++ b/board/karma/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/karma/build.mk b/board/karma/build.mk
index 2554425920..bee5d9f886 100644
--- a/board/karma/build.mk
+++ b/board/karma/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/karma/ec.tasklist b/board/karma/ec.tasklist
index ca4e3b5ee6..829c9f19bc 100644
--- a/board/karma/ec.tasklist
+++ b/board/karma/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/karma/gpio.inc b/board/karma/gpio.inc
index bdf0ab93be..2f0fef053e 100644
--- a/board/karma/gpio.inc
+++ b/board/karma/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/katsu/board.c b/board/katsu/board.c
index a91f2c4afa..3527214f62 100644
--- a/board/katsu/board.c
+++ b/board/katsu/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,6 +26,7 @@
#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -42,8 +43,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -60,45 +61,40 @@ static void gauge_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
- [ADC_BATT_ID] = {"BATT_ID", 3300, 4096, 0, STM32_AIN(7)},
- [ADC_POGO_ADC_INT_L] = {"POGO_ADC_INT_L", 3300, 4096, 0, STM32_AIN(6)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
+ [ADC_BATT_ID] = { "BATT_ID", 3300, 4096, 0, STM32_AIN(7) },
+ [ADC_POGO_ADC_INT_L] = { "POGO_ADC_INT_L", 3300, 4096, 0,
+ STM32_AIN(6) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
@@ -118,8 +114,7 @@ struct mt6370_thermal_bound thermal_bound = {
.err = 4,
};
-static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -146,13 +141,16 @@ __override const struct rt946x_init_setting *board_rt946x_init_setting(void)
return &battery_init_setting;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_update,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_update,
+ },
},
};
@@ -244,9 +242,8 @@ int extpower_is_present(void)
if (board_vbus_source_enabled(CHARGE_PORT_USB_C))
usb_c_extpower_present = 0;
else
- usb_c_extpower_present = tcpm_check_vbus_level(
- CHARGE_PORT_USB_C,
- VBUS_PRESENT);
+ usb_c_extpower_present =
+ tcpm_check_vbus_level(CHARGE_PORT_USB_C, VBUS_PRESENT);
if (prev_usb_c_extpower_present != usb_c_extpower_present) {
if (usb_c_extpower_present)
@@ -332,11 +329,9 @@ static struct mutex g_lid_mutex;
static struct icm_drv_data_t g_icm426xx_data;
/* Matrix to rotate accelerometer into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -436,9 +431,8 @@ __override int board_charge_port_is_connected(int port)
return gpio_get_level(GPIO_POGO_VBUS_PRESENT);
}
-__override
-void board_fill_source_power_info(int port,
- struct ec_response_usb_pd_power_info *r)
+__override void
+board_fill_source_power_info(int port, struct ec_response_usb_pd_power_info *r)
{
r->meas.voltage_now = 3300;
r->meas.voltage_max = 3300;
@@ -451,13 +445,10 @@ void board_fill_source_power_info(int port,
static void mt6370_reg_fix(void)
{
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- RT946X_REG_CHGCTRL1,
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, RT946X_REG_CHGCTRL1,
BIT(3) | BIT(5), MASK_CLR);
i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
- chg_chips[CHARGER_SOLO].i2c_addr_flags,
- RT946X_REG_CHGCTRL2,
- BIT(5) | BIT(RT946X_SHIFT_BATDET_DIS_DLY),
- MASK_CLR);
+ chg_chips[CHARGER_SOLO].i2c_addr_flags, RT946X_REG_CHGCTRL2,
+ BIT(5) | BIT(RT946X_SHIFT_BATDET_DIS_DLY), MASK_CLR);
}
DECLARE_HOOK(HOOK_INIT, mt6370_reg_fix, HOOK_PRIO_DEFAULT);
diff --git a/board/katsu/board.h b/board/katsu/board.h
index afb5cf28e0..6f53801ffc 100644
--- a/board/katsu/board.h
+++ b/board/katsu/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
-#define BQ27541_ADDR 0x55
+#define BQ27541_ADDR 0x55
#define VARIANT_KUKUI_BATTERY_BQ27541
#define VARIANT_KUKUI_POGO_KEYBOARD
@@ -27,11 +27,10 @@
#define CONFIG_USB_MUX_RUNTIME_CONFIG
/* Battery */
-#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
#define CONFIG_CHARGER_MT6370_BACKLIGHT
-
/* Motion Sensors */
#ifdef SECTION_IS_RW
#define CONFIG_ACCELGYRO_ICM426XX
@@ -41,18 +40,17 @@
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#endif /* SECTION_IS_RW */
/* I2C ports */
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 1
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 1
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_ACCEL 1
-#define I2C_PORT_BC12 1
+#define I2C_PORT_ACCEL 1
+#define I2C_PORT_BC12 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
@@ -63,12 +61,12 @@
#define CONFIG_MKBP_EVENT_WAKEUP_MASK \
(BIT(EC_MKBP_EVENT_SENSOR_FIFO) | BIT(EC_MKBP_EVENT_HOST_EVENT))
#undef CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_CONNECTED) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_AC_DISCONNECTED) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_MODE_CHANGE))
#define PD_OPERATING_POWER_MW 15000
diff --git a/board/katsu/build.mk b/board/katsu/build.mk
index 7a3953b8bb..52ee1b3354 100644
--- a/board/katsu/build.mk
+++ b/board/katsu/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/katsu/ec.tasklist b/board/katsu/ec.tasklist
index fc26f445b2..8be28c373d 100644
--- a/board/katsu/ec.tasklist
+++ b/board/katsu/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/katsu/gpio.inc b/board/katsu/gpio.inc
index f938153045..82f7ddb3af 100644
--- a/board/katsu/gpio.inc
+++ b/board/katsu/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/katsu/led.c b/board/katsu/led.c
index c72f5e4cdb..3ce9466613 100644
--- a/board/katsu/led.c
+++ b/board/katsu/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -16,13 +16,13 @@ const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-#define LED_OFF MT6370_LED_ID_OFF
-#define LED_AMBER MT6370_LED_ID1
-#define LED_WHITE MT6370_LED_ID2
+#define LED_OFF MT6370_LED_ID_OFF
+#define LED_AMBER MT6370_LED_ID1
+#define LED_WHITE MT6370_LED_ID2
-#define LED_MASK_OFF 0
-#define LED_MASK_AMBER MT6370_MASK_RGB_ISNK1DIM_EN
-#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK2DIM_EN
+#define LED_MASK_OFF 0
+#define LED_MASK_AMBER MT6370_MASK_RGB_ISNK1DIM_EN
+#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK2DIM_EN
static void katsu_led_set_battery(void)
{
diff --git a/board/kindred/battery.c b/board/kindred/battery.c
index 9db25ac059..a087d0a85f 100644
--- a/board/kindred/battery.c
+++ b/board/kindred/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/kindred/board.c b/board/kindred/board.c
index 78ec2abf0c..d6c9372d47 100644
--- a/board/kindred/board.c
+++ b/board/kindred/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,8 +46,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static int lid_device_id;
static int base_device_id;
@@ -66,17 +66,16 @@ const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -137,16 +136,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -173,16 +172,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -213,23 +216,17 @@ static struct accelgyro_saved_data_t g_bma255_data;
static struct kionix_accel_data g_kx022_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_icm_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_icm_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t kx022_lid_accel = {
.name = "Lid Accel",
@@ -302,7 +299,6 @@ struct motion_sensor_t icm426xx_base_gyro = {
.max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
-
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
.name = "Lid Accel",
@@ -382,7 +378,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -401,38 +397,37 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_WIFI", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_WIFI", NPCX_ADC_CH3, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Temp1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Temp2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Temp3",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Temp1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Temp2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Temp3",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Hatch Temperature sensors */
/*
* TODO(b/124316213): These setting need to be reviewed and set appropriately
@@ -442,8 +437,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
@@ -498,7 +493,6 @@ static void board_gpio_set_pp5000(void)
} else if (board_id >= 1) {
reset_gpio_flags(GPIO_EN_PP5000_A_V1, GPIO_OUT_LOW);
}
-
}
bool board_is_convertible(void)
@@ -582,15 +576,14 @@ static void determine_accel_devices(void)
if (read_time == 0 && board_is_convertible()) {
/* Read g sensor chip id*/
- i2c_read8(I2C_PORT_ACCEL,
- KX022_ADDR0_FLAGS, KX022_WHOAMI, &lid_device_id);
+ i2c_read8(I2C_PORT_ACCEL, KX022_ADDR0_FLAGS, KX022_WHOAMI,
+ &lid_device_id);
/* Read gyro sensor id*/
- i2c_read8(I2C_PORT_ACCEL,
- ICM426XX_ADDR0_FLAGS,
- ICM426XX_REG_WHO_AM_I, &base_device_id);
+ i2c_read8(I2C_PORT_ACCEL, ICM426XX_ADDR0_FLAGS,
+ ICM426XX_REG_WHO_AM_I, &base_device_id);
- CPRINTS("Motion Sensor Base id = %d Lid id =%d",
- base_device_id, lid_device_id);
+ CPRINTS("Motion Sensor Base id = %d Lid id =%d", base_device_id,
+ lid_device_id);
if (lid_device_id == KX022_WHO_AM_I_VAL) {
motion_sensors[LID_ACCEL] = kx022_lid_accel;
@@ -657,7 +650,8 @@ __override void board_chipset_forced_shutdown(void)
{
hook_call_deferred(&check_reboot_deferred_data, -1);
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_forced_shutdown, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_forced_shutdown,
+ HOOK_PRIO_DEFAULT);
static void check_reboot_deferred(void)
{
diff --git a/board/kindred/board.h b/board/kindred/board.h
index f85742d27e..1372887446 100644
--- a/board/kindred/board.h
+++ b/board/kindred/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
#include "baseboard.h"
#define CONFIG_POWER_BUTTON
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 2
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
@@ -111,16 +111,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -131,9 +131,9 @@
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC3 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC3 */
ADC_CH_COUNT
};
@@ -144,11 +144,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/kindred/build.mk b/board/kindred/build.mk
index 733912454f..13153c1526 100644
--- a/board/kindred/build.mk
+++ b/board/kindred/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kindred/ec.tasklist b/board/kindred/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/kindred/ec.tasklist
+++ b/board/kindred/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kindred/gpio.inc b/board/kindred/gpio.inc
index 2adb08f564..ec336c5542 100644
--- a/board/kindred/gpio.inc
+++ b/board/kindred/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/kindred/led.c b/board/kindred/led.c
index ff91d15424..05cc15b617 100644
--- a/board/kindred/led.c
+++ b/board/kindred/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/kingoftown/battery.c b/board/kingoftown/battery.c
index 3fd82bc282..3a74f99907 100644
--- a/board/kingoftown/battery.c
+++ b/board/kingoftown/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/kingoftown/board.c b/board/kingoftown/board.c
index e3d91575e1..9ee1402380 100644
--- a/board/kingoftown/board.c
+++ b/board/kingoftown/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,8 +26,8 @@
#include "usbc_config.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#include "gpio_list.h"
@@ -39,10 +39,8 @@ __override struct keyboard_scan_config keyscan_config = {
* Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key);
* as it still uses the legacy location (KSO_01/KSI_00).
*/
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -57,52 +55,42 @@ __override struct keyboard_scan_config keyscan_config = {
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -110,37 +98,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -192,17 +165,13 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/kingoftown/board.h b/board/kingoftown/board.h
index e71fdd6741..6b553f65fa 100644
--- a/board/kingoftown/board.h
+++ b/board/kingoftown/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,7 +11,7 @@
#include "baseboard.h"
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Keyboard */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
@@ -20,7 +20,7 @@
#define CONFIG_PWM_KBLIGHT
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -68,12 +68,7 @@
#include "gpio_signal.h"
#include "registers.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -83,11 +78,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/kingoftown/build.mk b/board/kingoftown/build.mk
index 5415d90b29..2c5eb4ae2e 100644
--- a/board/kingoftown/build.mk
+++ b/board/kingoftown/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kingoftown/ec.tasklist b/board/kingoftown/ec.tasklist
index 5beeb38feb..228828af3c 100644
--- a/board/kingoftown/ec.tasklist
+++ b/board/kingoftown/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kingoftown/gpio.inc b/board/kingoftown/gpio.inc
index 612de59128..7147869ea3 100644
--- a/board/kingoftown/gpio.inc
+++ b/board/kingoftown/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kingoftown/hibernate.c b/board/kingoftown/hibernate.c
index 504a295463..9b64e85053 100644
--- a/board/kingoftown/hibernate.c
+++ b/board/kingoftown/hibernate.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,6 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_LID_ACCEL_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_LID_ACCEL_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
diff --git a/board/kingoftown/led.c b/board/kingoftown/led.c
index a543bb5403..2bbb0de0af 100644
--- a/board/kingoftown/led.c
+++ b/board/kingoftown/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -36,15 +36,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void side_led_set_color(int port, enum led_color color)
{
gpio_set_level(port ? GPIO_EC_CHG_LED_Y_C1 : GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(port ? GPIO_EC_CHG_LED_W_C1 : GPIO_EC_CHG_LED_W_C0,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -97,7 +97,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
static int power_ticks;
int led_blink_cycle;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -107,15 +106,16 @@ static void board_led_set_battery(void)
* charging.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
led_blink_cycle = power_ticks % (2 * TIMES_TICK_ONE_SEC);
side_led_set_color(0, (led_blink_cycle < TIMES_TICK_ONE_SEC) ?
- LED_WHITE : LED_OFF);
+ LED_WHITE :
+ LED_OFF);
side_led_set_color(1, (led_blink_cycle < TIMES_TICK_ONE_SEC) ?
- LED_WHITE : LED_OFF);
+ LED_WHITE :
+ LED_OFF);
return;
}
@@ -128,15 +128,18 @@ static void board_led_set_battery(void)
break;
case PWR_STATE_DISCHARGE:
if (charge_get_percent() <= 10) {
- led_blink_cycle = battery_ticks % (2 * TIMES_TICK_ONE_SEC);
+ led_blink_cycle =
+ battery_ticks % (2 * TIMES_TICK_ONE_SEC);
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
- side_led_set_color(1,
- (led_blink_cycle < TIMES_TICK_ONE_SEC) ?
- LED_AMBER : LED_OFF);
+ side_led_set_color(1, (led_blink_cycle <
+ TIMES_TICK_ONE_SEC) ?
+ LED_AMBER :
+ LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
- side_led_set_color(0,
- (led_blink_cycle < TIMES_TICK_ONE_SEC) ?
- LED_AMBER : LED_OFF);
+ side_led_set_color(0, (led_blink_cycle <
+ TIMES_TICK_ONE_SEC) ?
+ LED_AMBER :
+ LED_OFF);
} else {
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
side_led_set_color(1, LED_OFF);
@@ -147,23 +150,27 @@ static void board_led_set_battery(void)
case PWR_STATE_ERROR:
led_blink_cycle = battery_ticks % TIMES_TICK_ONE_SEC;
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
- side_led_set_color(1, (led_blink_cycle < TIMES_TICK_HALF_SEC) ?
- LED_AMBER : LED_OFF);
+ side_led_set_color(1, (led_blink_cycle <
+ TIMES_TICK_HALF_SEC) ?
+ LED_AMBER :
+ LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
- side_led_set_color(0, (led_blink_cycle < TIMES_TICK_HALF_SEC) ?
- LED_AMBER : LED_OFF);
+ side_led_set_color(0, (led_blink_cycle <
+ TIMES_TICK_HALF_SEC) ?
+ LED_AMBER :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- led_blink_cycle = battery_ticks % (2 * TIMES_TICK_ONE_SEC);
- set_active_port_color(
- (led_blink_cycle < TIMES_TICK_ONE_SEC) ?
- LED_AMBER : LED_OFF);
- } else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_blink_cycle = battery_ticks % (2 * TIMES_TICK_ONE_SEC);
+ set_active_port_color((led_blink_cycle < TIMES_TICK_ONE_SEC) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/kingoftown/switchcap.c b/board/kingoftown/switchcap.c
index 16b0db6ef6..5173e27f75 100644
--- a/board/kingoftown/switchcap.c
+++ b/board/kingoftown/switchcap.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kingoftown/usbc_config.c b/board/kingoftown/usbc_config.c
index 9343fa2256..f0f17e93a9 100644
--- a/board/kingoftown/usbc_config.c
+++ b/board/kingoftown/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,8 +25,8 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
@@ -132,16 +132,12 @@ void ppc_interrupt(enum gpio_signal signal)
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -172,16 +168,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -234,7 +236,7 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
@@ -280,8 +282,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -309,7 +310,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -333,23 +333,21 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/kingoftown/usbc_config.h b/board/kingoftown/usbc_config.h
index 654da35f74..7718aea74c 100644
--- a/board/kingoftown/usbc_config.h
+++ b/board/kingoftown/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kinox/board.c b/board/kinox/board.c
index a814c7a20d..7c55fba876 100644
--- a/board/kinox/board.c
+++ b/board/kinox/board.c
@@ -1,9 +1,9 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-#include "assert.h"
+#include "builtin/assert.h"
#include "button.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
@@ -11,7 +11,6 @@
#include "compile_time_macros.h"
#include "console.h"
#include "cros_board_info.h"
-#include "fw_config.h"
#include "gpio.h"
#include "gpio_signal.h"
#include "power_button.h"
@@ -21,12 +20,13 @@
#include "throttle_ap.h"
#include "usbc_config.h"
#include "usbc_ppc.h"
+#include "fw_config.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -40,8 +40,6 @@ BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
int board_set_active_charge_port(int port)
{
- int rv;
-
CPRINTS("Requested charge port change to %d", port);
/*
@@ -64,15 +62,23 @@ int board_set_active_charge_port(int port)
if (board_vbus_source_enabled(port))
return EC_ERROR_INVAL;
- /* Don't change the charge port */
- if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
- return EC_ERROR_INVAL;
-
- /* Make sure BJ adapter is sourcing power */
- if (port == CHARGE_PORT_BARRELJACK &&
- gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL)) {
- CPRINTS("BJ port selected, but not present!");
- return EC_ERROR_INVAL;
+ if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+ int bj_active, bj_requested;
+
+ if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
+ /* Change is only permitted while the system is off */
+ return EC_ERROR_INVAL;
+
+ /*
+ * Current setting is no charge port but the AP is on, so the
+ * charge manager is out of sync (probably because we're
+ * reinitializing after sysjump). Reject requests that aren't
+ * in sync with our outputs.
+ */
+ bj_active = !gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L);
+ bj_requested = port == CHARGE_PORT_BARRELJACK;
+ if (bj_active != bj_requested)
+ return EC_ERROR_INVAL;
}
CPRINTS("New charger p%d", port);
@@ -80,19 +86,12 @@ int board_set_active_charge_port(int port)
switch (port) {
case CHARGE_PORT_TYPEC0:
gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
- rv = ppc_vbus_sink_enable(CHARGE_PORT_TYPEC0, 1);
- if (rv) {
- CPRINTS("Failed to enable C0 sink path");
- return rv;
- }
break;
case CHARGE_PORT_BARRELJACK:
- rv = ppc_vbus_sink_enable(CHARGE_PORT_TYPEC0, 0);
- if (rv) {
- CPRINTS("Failed to disable C0 sink path");
- return rv;
- }
- gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
+ /* Make sure BJ adapter is sourcing power */
+ if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
+ return EC_ERROR_INVAL;
+ ppc_vbus_sink_enable(0, 0);
break;
default:
return EC_ERROR_INVAL;
@@ -101,8 +100,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
}
@@ -122,5 +121,6 @@ DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
static void board_init(void)
{
+ gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_ODL);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/kinox/board.h b/board/kinox/board.h
index 6637fbfec1..5e22e22269 100644
--- a/board/kinox/board.h
+++ b/board/kinox/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,37 +19,36 @@
/* HDMI CEC */
#define CONFIG_CEC
#define CEC_GPIO_OUT GPIO_HDMI_CEC_OUT
-#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
+#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
#define CEC_GPIO_PULL_UP GPIO_HDMI_CEC_PULL_UP
/* USB Type A Features */
-#define USB_PORT_COUNT 4
+#define USB_PORT_COUNT 4
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
-
#define CONFIG_USB_PD_PPC
#define CONFIG_USB_PD_TCPM_PS8815
#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+#undef CONFIG_USB_PD_TCPM_NCT38XX
#define CONFIG_USBC_PPC_SYV682X
#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* The design should support up to 100W. */
/* TODO(b/197702356): Set the max PD to 60W now and change it
* to 100W after we verify it.
*/
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -57,52 +56,44 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
-#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
+#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
/* I2C Bus Configuration */
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT6_1
-
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT6_1
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* I2C control host command */
#define CONFIG_HOSTCMD_I2C_CONTROL
-/* Enabling Thunderbolt-compatible mode */
-#define CONFIG_USB_PD_TBT_COMPAT_MODE
-
-/* Enabling USB4 mode */
-#define CONFIG_USB_PD_USB4
-
/* Thermal features */
#define CONFIG_THERMISTOR
#define CONFIG_TEMP_SENSOR
@@ -116,24 +107,18 @@
* TODO(b/197478860): Enable the fan control. We need
* to check the sensor value and adjust the fan speed.
*/
- #define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
-enum adp_id {
- UNKNOWN,
- TINY,
- TIO1,
- TIO2,
- TYPEC
-};
+enum adp_id { UNKNOWN, TINY, TIO1, TIO2, TYPEC };
struct adpater_id_params {
int min_voltage;
@@ -170,27 +155,20 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_PORT_COUNT };
enum pwm_channel {
- PWM_CH_LED_GREEN, /* PWM0 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED_RED, /* PWM2 */
+ PWM_CH_LED_GREEN, /* PWM0 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED_RED, /* PWM2 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
+
+extern void adp_connect_interrupt(enum gpio_signal signal);
#endif /* !__ASSEMBLER__ */
diff --git a/board/kinox/build.mk b/board/kinox/build.mk
index 440d137968..3eb2d2b2d5 100644
--- a/board/kinox/build.mk
+++ b/board/kinox/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kinox/ec.tasklist b/board/kinox/ec.tasklist
index 025d8f86b4..6524d9c2b0 100644
--- a/board/kinox/ec.tasklist
+++ b/board/kinox/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kinox/fans.c b/board/kinox/fans.c
index a82a61648d..cb65e95f62 100644
--- a/board/kinox/fans.c
+++ b/board/kinox/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP12000_FAN,
};
@@ -37,9 +37,9 @@ static const struct fan_conf fan_conf_0 = {
* Set minimum at around 30% PWM.
*/
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 750,
- .rpm_start = 750,
- .rpm_max = 5200,
+ .rpm_min = 1000,
+ .rpm_start = 1000,
+ .rpm_max = 4200,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/kinox/fw_config.c b/board/kinox/fw_config.c
index 02f39e70f4..9736de1110 100644
--- a/board/kinox/fw_config.c
+++ b/board/kinox/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union kinox_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/kinox/fw_config.h b/board/kinox/fw_config.h
index 0d79d55376..a3efa7bfe9 100644
--- a/board/kinox/fw_config.h
+++ b/board/kinox/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,11 +14,7 @@
* Source of truth is the project/brask/kinox/config.star configuration file.
*/
-enum ec_cfg_dp_display {
- ABSENT = 0,
- DB_HDMI = 1,
- DB_DP = 2
-};
+enum ec_cfg_dp_display { ABSENT = 0, DB_HDMI = 1, DB_DP = 2 };
union kinox_cbi_fw_config {
struct {
diff --git a/board/kinox/gpio.inc b/board/kinox/gpio.inc
index d21782ba37..f3d94ebf07 100644
--- a/board/kinox/gpio.inc
+++ b/board/kinox/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,6 +19,7 @@ GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_inte
GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt)
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
GPIO_INT(EC_RECOVERY_BTN_OD, PIN(2, 3), GPIO_INT_BOTH, button_interrupt)
/* CCD */
@@ -29,7 +30,7 @@ GPIO(EC_ENTERING_RW, PIN(0, 3), GPIO_OUT_LOW)
GPIO(EC_GSC_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW)
/* Fan */
-GPIO(EN_PP12000_FAN, PIN(6, 1), GPIO_OUT_HIGH)
+GPIO(EN_PP12000_FAN, PIN(6, 1), GPIO_OUT_LOW)
/* Display */
GPIO(DP_CONN_OC_ODL, PIN(2, 5), GPIO_INPUT)
@@ -37,7 +38,6 @@ GPIO(HDMI_CONN_OC_ODL, PIN(2, 4), GPIO_INPUT)
/* BarrelJack */
GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 7), GPIO_OUT_LOW)
-GPIO(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INPUT)
/* Chipset PCH */
GPIO(EC_PCHHOT_ODL, PIN(7, 4), GPIO_INPUT)
@@ -58,7 +58,7 @@ GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
GPIO(GSC_EC_RECOVERY_BTN_OD, PIN(2, 2), GPIO_INPUT)
-GPIO(SIO_LEGO_EN, PIN(9, 6), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(SIO_LEGO_EN_L, PIN(9, 6), GPIO_OUT_LOW)
/* HDMI CEC */
/* TODO(b/197474873): Enable HDMI CEC */
diff --git a/board/kinox/i2c.c b/board/kinox/i2c.c
index d58deaa89a..0213134fcb 100644
--- a/board/kinox/i2c.c
+++ b/board/kinox/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kinox/led.c b/board/kinox/led.c
index 00381fa7f4..d2a9a599cf 100644
--- a/board/kinox/led.c
+++ b/board/kinox/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -84,9 +84,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/*
* When pulsing is enabled, brightness is incremented by <duty_inc> every
@@ -217,7 +217,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -242,8 +242,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|green|off|alert|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|green|off|alert|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
diff --git a/board/kinox/power_detection.c b/board/kinox/power_detection.c
index 54ca591252..c5b4a1a1ab 100644
--- a/board/kinox/power_detection.c
+++ b/board/kinox/power_detection.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,215 +17,211 @@
#include "util.h"
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/******************************************************************************/
-static const char * const adp_id_names[] = {
- "unknown",
- "tiny",
- "tio1",
- "tio2",
- "typec",
+static const char *const adp_id_names[] = {
+ "unknown", "tiny", "tio1", "tio2", "typec",
};
/* ADP_ID control */
struct adpater_id_params tio1_power[] = {
{
- .min_voltage = 3300,
- .max_voltage = 3300,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 1990,
- .obp85 = 1780,
+ .min_voltage = 2816,
+ .max_voltage = 2816,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 1990,
+ .obp85 = 1780,
},
};
struct adpater_id_params tio2_power[] = {
{
- .min_voltage = 0,
- .max_voltage = 68,
- .charge_voltage = 20000,
- .charge_current = 8500,
- .watt = 170,
- .obp95 = 2820,
- .obp85 = 916,
+ .min_voltage = 0,
+ .max_voltage = 68,
+ .charge_voltage = 20000,
+ .charge_current = 8500,
+ .watt = 170,
+ .obp95 = 2820,
+ .obp85 = 916,
},
{
- .min_voltage = 68,
- .max_voltage = 142,
- .charge_voltage = 20000,
- .charge_current = 2250,
- .watt = 45,
- .obp95 = 750,
- .obp85 = 670,
+ .min_voltage = 68,
+ .max_voltage = 142,
+ .charge_voltage = 20000,
+ .charge_current = 2250,
+ .watt = 45,
+ .obp95 = 750,
+ .obp85 = 670,
},
{
- .min_voltage = 200,
- .max_voltage = 288,
- .charge_voltage = 20000,
- .charge_current = 3250,
- .watt = 65,
- .obp95 = 1080,
- .obp85 = 960,
+ .min_voltage = 200,
+ .max_voltage = 288,
+ .charge_voltage = 20000,
+ .charge_current = 3250,
+ .watt = 65,
+ .obp95 = 1080,
+ .obp85 = 960,
},
{
- .min_voltage = 531,
- .max_voltage = 607,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 1990,
- .obp85 = 1780,
+ .min_voltage = 384,
+ .max_voltage = 480,
+ .charge_voltage = 20000,
+ .charge_current = 7500,
+ .watt = 150,
+ .obp95 = 2490,
+ .obp85 = 2220,
},
{
- .min_voltage = 384,
- .max_voltage = 480,
- .charge_voltage = 20000,
- .charge_current = 7500,
- .watt = 150,
- .obp95 = 2490,
- .obp85 = 2220,
+ .min_voltage = 531,
+ .max_voltage = 607,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 1990,
+ .obp85 = 1780,
},
{
- .min_voltage = 1062,
- .max_voltage = 1126,
- .charge_voltage = 20000,
- .charge_current = 8500,
- .watt = 170,
- .obp95 = 2820,
- .obp85 = 916,
+ .min_voltage = 1062,
+ .max_voltage = 1126,
+ .charge_voltage = 20000,
+ .charge_current = 8500,
+ .watt = 170,
+ .obp95 = 2820,
+ .obp85 = 916,
},
{
- .min_voltage = 2816,
- .max_voltage = 3300,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 1990,
- .obp85 = 1780,
+ .min_voltage = 2816,
+ .max_voltage = 2816,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 1990,
+ .obp85 = 1780,
},
};
struct adpater_id_params tiny_power[] = {
{
- .min_voltage = 68,
- .max_voltage = 142,
- .charge_voltage = 20000,
- .charge_current = 2250,
- .watt = 45,
- .obp95 = 750,
- .obp85 = 670,
+ .min_voltage = 68,
+ .max_voltage = 142,
+ .charge_voltage = 20000,
+ .charge_current = 2250,
+ .watt = 45,
+ .obp95 = 750,
+ .obp85 = 670,
},
{
- .min_voltage = 200,
- .max_voltage = 288,
- .charge_voltage = 20000,
- .charge_current = 3250,
- .watt = 65,
- .obp95 = 1080,
- .obp85 = 960,
+ .min_voltage = 200,
+ .max_voltage = 288,
+ .charge_voltage = 20000,
+ .charge_current = 3250,
+ .watt = 65,
+ .obp95 = 1080,
+ .obp85 = 960,
},
{
- .min_voltage = 384,
- .max_voltage = 480,
- .charge_voltage = 20000,
- .charge_current = 4500,
- .watt = 90,
- .obp95 = 1490,
- .obp85 = 1330,
+ .min_voltage = 384,
+ .max_voltage = 480,
+ .charge_voltage = 20000,
+ .charge_current = 4500,
+ .watt = 90,
+ .obp95 = 1490,
+ .obp85 = 1330,
},
{
- .min_voltage = 531,
- .max_voltage = 607,
- .charge_voltage = 20000,
- .charge_current = 6000,
- .watt = 120,
- .obp95 = 0x2D3,
- .obp85 = 0x286,
+ .min_voltage = 531,
+ .max_voltage = 607,
+ .charge_voltage = 20000,
+ .charge_current = 6000,
+ .watt = 120,
+ .obp95 = 0x2D3,
+ .obp85 = 0x286,
},
{
- .min_voltage = 653,
- .max_voltage = 783,
- .charge_voltage = 20000,
- .charge_current = 6750,
- .watt = 135,
- .obp95 = 2240,
- .obp85 = 2000,
+ .min_voltage = 653,
+ .max_voltage = 783,
+ .charge_voltage = 20000,
+ .charge_current = 6750,
+ .watt = 135,
+ .obp95 = 2240,
+ .obp85 = 2000,
},
{
- .min_voltage = 851,
- .max_voltage = 997,
- .charge_voltage = 20000,
- .charge_current = 7500,
- .watt = 150,
- .obp95 = 2490,
- .obp85 = 2220,
+ .min_voltage = 851,
+ .max_voltage = 997,
+ .charge_voltage = 20000,
+ .charge_current = 7500,
+ .watt = 150,
+ .obp95 = 2490,
+ .obp85 = 2220,
},
{
- .min_voltage = 1063,
- .max_voltage = 1226,
- .charge_voltage = 20000,
- .charge_current = 8500,
- .watt = 170,
- .obp95 = 2820,
- .obp85 = 916,
+ .min_voltage = 1063,
+ .max_voltage = 1226,
+ .charge_voltage = 20000,
+ .charge_current = 8500,
+ .watt = 170,
+ .obp95 = 2820,
+ .obp85 = 916,
},
{
- .min_voltage = 1749,
- .max_voltage = 1968,
- .charge_voltage = 20000,
- .charge_current = 11500,
- .watt = 230,
- .obp95 = 3810,
- .obp85 = 3410,
+ .min_voltage = 1749,
+ .max_voltage = 1968,
+ .charge_voltage = 20000,
+ .charge_current = 11500,
+ .watt = 230,
+ .obp95 = 3810,
+ .obp85 = 3410,
},
};
struct adpater_id_params typec_power[] = {
{
- .charge_voltage = 20000,
- .charge_current = 1500,
- .watt = 30,
- .obp95 = 500,
- .obp85 = 440,
+ .charge_voltage = 20000,
+ .charge_current = 1500,
+ .watt = 30,
+ .obp95 = 500,
+ .obp85 = 440,
},
{
- .charge_voltage = 15000,
- .charge_current = 2000,
- .watt = 30,
- .obp95 = 660,
- .obp85 = 590,
+ .charge_voltage = 15000,
+ .charge_current = 2000,
+ .watt = 30,
+ .obp95 = 660,
+ .obp85 = 590,
},
{
- .charge_voltage = 20000,
- .charge_current = 2250,
- .watt = 45,
- .obp95 = 750,
- .obp85 = 670,
+ .charge_voltage = 20000,
+ .charge_current = 2250,
+ .watt = 45,
+ .obp95 = 750,
+ .obp85 = 670,
},
{
- .charge_voltage = 15000,
- .charge_current = 3000,
- .watt = 45,
- .obp95 = 990,
- .obp85 = 890,
+ .charge_voltage = 15000,
+ .charge_current = 3000,
+ .watt = 45,
+ .obp95 = 990,
+ .obp85 = 890,
},
{
- .charge_voltage = 20000,
- .charge_current = 3250,
- .watt = 65,
- .obp95 = 1080,
- .obp85 = 960,
+ .charge_voltage = 20000,
+ .charge_current = 3250,
+ .watt = 65,
+ .obp95 = 1080,
+ .obp85 = 960,
},
{
- .charge_voltage = 20000,
- .charge_current = 5000,
- .watt = 100,
- .obp95 = 1660,
- .obp85 = 1480,
+ .charge_voltage = 20000,
+ .charge_current = 5000,
+ .watt = 100,
+ .obp95 = 1660,
+ .obp85 = 1480,
},
};
@@ -241,7 +237,7 @@ void obp_point_95(void)
/* Trigger the PROCHOT */
gpio_set_level(GPIO_EC_PROCHOT_ODL, 0);
- CPRINTF("Adapter voltage over then 95%% trigger prochot.");
+ CPRINTS("Adapter voltage over 95%% trigger prochot.");
}
void obp_point_85(void)
@@ -253,20 +249,20 @@ void obp_point_85(void)
/* Release the PROCHOT */
gpio_set_level(GPIO_EC_PROCHOT_ODL, 1);
- CPRINTF("Adapter voltage less then 85%% release prochot.");
+ CPRINTS("Adapter voltage lower than 85%% release prochot.");
}
struct npcx_adc_thresh_t adc_obp_point_95 = {
.adc_ch = ADC_PWR_IN_IMON,
.adc_thresh_cb = obp_point_95,
- .thresh_assert = 3300, /* Default */
+ .thresh_assert = 3300, /* Default */
};
struct npcx_adc_thresh_t adc_obp_point_85 = {
.adc_ch = ADC_PWR_IN_IMON,
.adc_thresh_cb = obp_point_85,
.lower_or_higher = 1,
- .thresh_assert = 0, /* Default */
+ .thresh_assert = 0, /* Default */
};
static void set_up_adc_irqs(void)
@@ -295,14 +291,16 @@ void set_the_obp(int power_type_index, int adp_type)
switch (adp_type) {
case TIO1:
case TIO2:
+ gpio_set_level(GPIO_SIO_LEGO_EN_L, 0);
charge_manager_update_charge(
- CHARGE_SUPPLIER_PROPRIETARY,
- DEDICATED_CHARGE_PORT, &pi);
+ CHARGE_SUPPLIER_PROPRIETARY,
+ DEDICATED_CHARGE_PORT, &pi);
break;
case TINY:
- charge_manager_update_charge(
- CHARGE_SUPPLIER_DEDICATED,
- DEDICATED_CHARGE_PORT, &pi);
+ gpio_set_level(GPIO_SIO_LEGO_EN_L, 1);
+ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
+ DEDICATED_CHARGE_PORT,
+ &pi);
break;
}
}
@@ -323,10 +321,10 @@ void set_the_obp(int power_type_index, int adp_type)
* | | |
* |---220 ms---|-----400 ms-----|
*
- * Tiny: Twice adapter ADC values are less than 0x3FF.
- * TIO1: Twice adapter ADC values are 0x3FF.
- * TIO2: First adapter ADC value less than 0x3FF.
- * Second adpater ADC value is 0x3FF.
+ * Tiny: Twice adapter ADC values are less than 2.816v.
+ * TIO1: Twice adapter ADC values are 2.816v.
+ * TIO2: First adapter ADC value less than 2.816v.
+ * Second adpater ADC value is 2.816v.
*/
static void adp_id_deferred(void);
DECLARE_DEFERRED(adp_id_deferred);
@@ -344,36 +342,39 @@ void adp_id_deferred(void)
adp_id_value_debounce = adp_id_value;
/* for delay the 400ms to get the next APD_ID value */
hook_call_deferred(&adp_id_deferred_data, 400 * MSEC);
- } else if (adp_id_value_debounce == 0x3FF && adp_id_value == 0x3FF) {
+ } else if (adp_id_value_debounce == ADC_MAX_VOLT &&
+ adp_id_value == ADC_MAX_VOLT) {
adp_finial_adc_value = adp_id_value;
adp_type = TIO1;
- } else if (adp_id_value_debounce < 0x3FF && adp_id_value == 0x3FF) {
+ } else if (adp_id_value_debounce < ADC_MAX_VOLT &&
+ adp_id_value == ADC_MAX_VOLT) {
adp_finial_adc_value = adp_id_value_debounce;
adp_type = TIO2;
- } else if (adp_id_value_debounce < 0x3FF && adp_id_value < 0x3FF) {
+ } else if (adp_id_value_debounce < ADC_MAX_VOLT &&
+ adp_id_value < ADC_MAX_VOLT) {
adp_finial_adc_value = adp_id_value;
adp_type = TINY;
} else {
CPRINTS("ADP_ID mismatch anything!");
- /* Set the default 65w adaptor max ADC value */
- adp_finial_adc_value = 0x69;
+ /* Set the default TINY 45w adapter */
+ adp_finial_adc_value = 142;
adp_type = TINY;
}
switch (adp_type) {
case TIO1:
- power_type_len = sizeof(tio1_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(tio1_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &tio1_power, sizeof(tio1_power));
break;
case TIO2:
- power_type_len = sizeof(tio2_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(tio2_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &tio2_power, sizeof(tio2_power));
break;
case TINY:
- power_type_len = sizeof(tiny_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(tiny_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &tiny_power, sizeof(tiny_power));
break;
}
@@ -388,10 +389,19 @@ void adp_id_deferred(void)
static void barrel_jack_setting(void)
{
+ struct charge_port_info pi = { 0 };
/* Check ADP_ID when barrel jack is present */
- if (!gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL))
+ if (!gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL)) {
+ /* Set the default TINY 45w adapter */
+ pi.voltage = 20000;
+ pi.current = 2250;
+
+ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
+ DEDICATED_CHARGE_PORT, &pi);
+
/* Delay 220ms to get the first ADP_ID value */
hook_call_deferred(&adp_id_deferred_data, 220 * MSEC);
+ }
}
DECLARE_HOOK(HOOK_INIT, barrel_jack_setting, HOOK_PRIO_DEFAULT);
@@ -405,13 +415,13 @@ static void typec_adapter_setting(void)
/* Check the barrel jack is not present */
if (gpio_get_level(GPIO_BJ_ADP_PRESENT_ODL)) {
adapter_current_ma = charge_manager_get_charger_current();
- power_type_len = sizeof(typec_power) /
- sizeof(struct adpater_id_params);
+ power_type_len =
+ sizeof(typec_power) / sizeof(struct adpater_id_params);
memcpy(&power_type, &typec_power, sizeof(typec_power));
for (i = (power_type_len - 1); i >= 0; i--) {
if (adapter_current_ma >=
- power_type[i].charge_current) {
+ power_type[i].charge_current) {
set_the_obp(i, adp_type);
break;
}
@@ -419,3 +429,10 @@ static void typec_adapter_setting(void)
}
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, typec_adapter_setting, HOOK_PRIO_DEFAULT);
+
+/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */
+void adp_connect_interrupt(enum gpio_signal signal)
+{
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ hook_call_deferred(&adp_id_deferred_data, 0);
+}
diff --git a/board/kinox/pwm.c b/board/kinox/pwm.c
index 112ee62c8c..ce1f83e187 100644
--- a/board/kinox/pwm.c
+++ b/board/kinox/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,34 +11,23 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_GREEN] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
- [PWM_CH_LED_RED] = {
- .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
+ [PWM_CH_LED_GREEN] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP |
+ PWM_CONFIG_OPEN_DRAIN,
+ .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
static void board_pwm_init(void)
{
- /*
- * TODO(b/197478860): Turn on the fan at 100% by default
- * We need to find tune the fan speed according to the
- * thermal sensor value.
- */
pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, 100);
-
pwm_enable(PWM_CH_LED_RED, 1);
pwm_enable(PWM_CH_LED_GREEN, 1);
}
diff --git a/board/kinox/sensors.c b/board/kinox/sensors.c
index e444664e8f..86c60b1427 100644
--- a/board/kinox/sensors.c
+++ b/board/kinox/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,37 +56,29 @@ const struct adc_t adc_channels[] = {
.name = "ADP_ID",
.input_ch = NPCX_ADC_CH4,
.factor_mul = ADC_MAX_VOLT,
- .factor_div = ADC_READ_MAX + 1,
+ .factor_div = ADC_READ_MAX,
},
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_CPU
- },
- [TEMP_SENSOR_2_CPU_VR] = {
- .name = "CPU VR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_CPU_VR
- },
- [TEMP_SENSOR_3_WIFI] = {
- .name = "WIFI",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_WIFI
- },
- [TEMP_SENSOR_4_DIMM] = {
- .name = "DIMM",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_DIMM
- },
+ [TEMP_SENSOR_1_CPU] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_CPU },
+ [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_CPU_VR },
+ [TEMP_SENSOR_3_WIFI] = { .name = "WIFI",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_WIFI },
+ [TEMP_SENSOR_4_DIMM] = { .name = "DIMM",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_DIMM },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -100,8 +92,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(95), \
@@ -112,8 +104,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
}, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(65), \
+ .temp_fan_off = C_TO_K(25), \
+ .temp_fan_max = C_TO_K(75), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
diff --git a/board/kinox/usbc_config.c b/board/kinox/usbc_config.c
index a5c171bede..feeb3be6d1 100644
--- a/board/kinox/usbc_config.c
+++ b/board/kinox/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,8 +28,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -61,19 +61,24 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_usb3_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc0_usb3_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- /* PS8815 */
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc0_usb3_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 */
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc0_usb3_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/kinox/usbc_config.h b/board/kinox/usbc_config.h
index b294eb69c8..7a212f8fb6 100644
--- a/board/kinox/usbc_config.h
+++ b/board/kinox/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,11 +8,8 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 1
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_COUNT };
#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/kodama/battery.c b/board/kodama/battery.c
index 1dbff92a00..1c6737bd3a 100644
--- a/board/kodama/battery.c
+++ b/board/kodama/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,7 +14,7 @@
#include "usb_pd.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
const struct board_batt_params board_battery_info[] = {
[BATTERY_SIMPLO] = {
@@ -95,9 +95,9 @@ int charger_profile_override(struct charge_state_data *curr)
* When smart battery temperature is more than 45 deg C, the max
* charging voltage is 4100mV.
*/
- if (curr->state == ST_CHARGE && bat_temp_c >= 450
- && !(curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE))
- curr->requested_voltage = 4100;
+ if (curr->state == ST_CHARGE && bat_temp_c >= 450 &&
+ !(curr->batt.flags & BATT_FLAG_BAD_TEMPERATURE))
+ curr->requested_voltage = 4100;
else
curr->requested_voltage = batt_info->voltage_max;
diff --git a/board/kodama/board.c b/board/kodama/board.c
index 2fa3ae8a3e..5ebcf00d40 100644
--- a/board/kodama/board.c
+++ b/board/kodama/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,6 +25,7 @@
#include "i2c.h"
#include "i2c_bitbang.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -40,8 +41,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -53,56 +54,50 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
- [ADC_POGO_ADC_INT_L] = {"POGO_ADC_INT_L", 3300, 4096, 0, STM32_AIN(6)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
+ [ADC_POGO_ADC_INT_L] = { "POGO_ADC_INT_L", 3300, 4096, 0,
+ STM32_AIN(6) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA,
- .flags = I2C_PORT_FLAG_DYNAMIC_SPEED
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
@@ -122,8 +117,7 @@ struct mt6370_thermal_bound thermal_bound = {
.err = 4,
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -136,7 +130,6 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-
__override const struct rt946x_init_setting *board_rt946x_init_setting(void)
{
static const struct rt946x_init_setting battery_init_setting = {
@@ -151,13 +144,16 @@ __override const struct rt946x_init_setting *board_rt946x_init_setting(void)
return &battery_init_setting;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -238,9 +234,8 @@ int extpower_is_present(void)
if (board_vbus_source_enabled(CHARGE_PORT_USB_C))
usb_c_extpower_present = 0;
else
- usb_c_extpower_present = tcpm_check_vbus_level(
- CHARGE_PORT_USB_C,
- VBUS_PRESENT);
+ usb_c_extpower_present =
+ tcpm_check_vbus_level(CHARGE_PORT_USB_C, VBUS_PRESENT);
return usb_c_extpower_present;
}
@@ -260,11 +255,11 @@ static void board_init(void)
#ifdef SECTION_IS_RW
int val;
- i2c_read8(I2C_PORT_CHARGER, CHARGER_I2C_ADDR_FLAGS,
- RT946X_REG_CHGCTRL1, &val);
+ i2c_read8(I2C_PORT_CHARGER, CHARGER_I2C_ADDR_FLAGS, RT946X_REG_CHGCTRL1,
+ &val);
val &= RT946X_MASK_OPA_MODE;
i2c_write8(I2C_PORT_CHARGER, CHARGER_I2C_ADDR_FLAGS,
- RT946X_REG_CHGCTRL1, (val | RT946X_MASK_STAT_EN));
+ RT946X_REG_CHGCTRL1, (val | RT946X_MASK_STAT_EN));
#endif
/* If the reset cause is external, pulse PMIC force reset. */
@@ -317,7 +312,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
static void board_i2c_init(void)
{
if (board_get_version() < 2)
- i2c_set_freq(1, I2C_FREQ_100KHZ);
+ i2c_set_freq(1, I2C_FREQ_100KHZ);
}
DECLARE_HOOK(HOOK_INIT, board_i2c_init, HOOK_PRIO_INIT_I2C);
@@ -329,11 +324,9 @@ static struct mutex g_lid_mutex;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelerometer into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/kodama/board.h b/board/kodama/board.h
index de953cba0b..b16e9f84a7 100644
--- a/board/kodama/board.h
+++ b/board/kodama/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,7 +15,6 @@
#define VARIANT_KUKUI_TABLET_PWRBTN
#undef CONFIG_CMD_MFALLOW
-
#ifndef SECTION_IS_RW
#define VARIANT_KUKUI_NO_SENSORS
#endif /* SECTION_IS_RW */
@@ -39,7 +38,7 @@
#define CONFIG_SMBUS_PEC
/* Battery */
-#define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */
#define CONFIG_CHARGER_MT6370_BACKLIGHT
#define CONFIG_CHARGER_MAINTAIN_VBAT
@@ -53,19 +52,18 @@
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#endif /* SECTION_IS_RW */
/* Disable verbose output in EC pd */
#define CONFIG_CMD_PD_SRCCAPS_REDUCED_SIZE
/* I2C ports */
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_ACCEL 1
-#define I2C_PORT_BATTERY board_get_battery_i2c()
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_ACCEL 1
+#define I2C_PORT_BATTERY board_get_battery_i2c()
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
/* Define the host events which are allowed to wakeup AP in S3. */
diff --git a/board/kodama/build.mk b/board/kodama/build.mk
index 0b3565fd84..6a7e557a0e 100644
--- a/board/kodama/build.mk
+++ b/board/kodama/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kodama/ec.tasklist b/board/kodama/ec.tasklist
index f71a208dd6..e66c52616b 100644
--- a/board/kodama/ec.tasklist
+++ b/board/kodama/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kodama/gpio.inc b/board/kodama/gpio.inc
index 75a3db7d20..d72532ff70 100644
--- a/board/kodama/gpio.inc
+++ b/board/kodama/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kodama/led.c b/board/kodama/led.c
index d96b340d73..d6c4297a44 100644
--- a/board/kodama/led.c
+++ b/board/kodama/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,45 +11,48 @@
#include "led_onoff_states.h"
#include "ec_commands.h"
-#define LED_RED MT6370_LED_ID1
-#define LED_GREEN MT6370_LED_ID2
-#define LED_WHITE MT6370_LED_ID3
+#define LED_RED MT6370_LED_ID1
+#define LED_GREEN MT6370_LED_ID2
+#define LED_WHITE MT6370_LED_ID3
-#define LED_MASK_OFF 0
-#define LED_MASK_RED MT6370_MASK_RGB_ISNK1DIM_EN
-#define LED_MASK_GREEN MT6370_MASK_RGB_ISNK2DIM_EN
-#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK3DIM_EN
+#define LED_MASK_OFF 0
+#define LED_MASK_RED MT6370_MASK_RGB_ISNK1DIM_EN
+#define LED_MASK_GREEN MT6370_MASK_RGB_ISNK2DIM_EN
+#define LED_MASK_WHITE MT6370_MASK_RGB_ISNK3DIM_EN
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, LED_ONE_SEC / 2} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, LED_ONE_SEC / 2 } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/kohaku/battery.c b/board/kohaku/battery.c
index 8d35008f6e..693c5b5221 100644
--- a/board/kohaku/battery.c
+++ b/board/kohaku/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/kohaku/board.c b/board/kohaku/board.c
index bf22dd6d41..42a5304353 100644
--- a/board/kohaku/board.c
+++ b/board/kohaku/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -98,14 +98,13 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -130,16 +129,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -223,11 +226,9 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -383,34 +384,34 @@ BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
/**********************************************************************/
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_AMB", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_GT", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_4] = {
- "TEMP_IA", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_AMB", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_GT", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_4] = { "TEMP_IA", NPCX_ADC_CH3, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "GT",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "IA",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "GT",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "IA",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -423,8 +424,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
diff --git a/board/kohaku/board.h b/board/kohaku/board.h
index de87000f34..d120e308aa 100644
--- a/board/kohaku/board.h
+++ b/board/kohaku/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,8 +35,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT2_OUTPUT
/* Camera VSYNC */
#define CONFIG_SYNC
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
/* BMA253 Lid accel */
#define CONFIG_ACCEL_BMA255
#define CONFIG_LID_ANGLE
@@ -46,7 +45,7 @@
/* BH1730 and TCS3400 ALS */
#define CONFIG_ALS
#define ALS_COUNT 2
-#define I2C_PORT_ALS I2C_PORT_SENSOR
+#define I2C_PORT_ALS I2C_PORT_SENSOR
#define CONFIG_ALS_BH1730
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
@@ -70,18 +69,18 @@
* Kohaku will not use both BH1730_LUXTH3_1K condition
* and BH1730_LUXTH4_1K condition.
*/
-#define BH1730_LUXTH1_1K 270
-#define BH1730_LUXTH1_D0_1K 19200
-#define BH1730_LUXTH1_D1_1K 30528
-#define BH1730_LUXTH2_1K 655360000
-#define BH1730_LUXTH2_D0_1K 11008
-#define BH1730_LUXTH2_D1_1K 10752
-#define BH1730_LUXTH3_1K 1030
-#define BH1730_LUXTH3_D0_1K 11008
-#define BH1730_LUXTH3_D1_1K 10752
-#define BH1730_LUXTH4_1K 3670
-#define BH1730_LUXTH4_D0_1K 11008
-#define BH1730_LUXTH4_D1_1K 10752
+#define BH1730_LUXTH1_1K 270
+#define BH1730_LUXTH1_D0_1K 19200
+#define BH1730_LUXTH1_D1_1K 30528
+#define BH1730_LUXTH2_1K 655360000
+#define BH1730_LUXTH2_D0_1K 11008
+#define BH1730_LUXTH2_D1_1K 10752
+#define BH1730_LUXTH3_1K 1030
+#define BH1730_LUXTH3_D0_1K 11008
+#define BH1730_LUXTH3_D1_1K 10752
+#define BH1730_LUXTH4_1K 3670
+#define BH1730_LUXTH4_D0_1K 11008
+#define BH1730_LUXTH4_D1_1K 10752
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_COMM_LOCKED
@@ -130,16 +129,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -150,10 +149,10 @@
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC2 */
- ADC_TEMP_SENSOR_4, /* ADC3 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC2 */
+ ADC_TEMP_SENSOR_4, /* ADC3 */
ADC_CH_COUNT
};
@@ -168,10 +167,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
enum temp_sensor_id {
TEMP_SENSOR_1,
diff --git a/board/kohaku/build.mk b/board/kohaku/build.mk
index 733912454f..13153c1526 100644
--- a/board/kohaku/build.mk
+++ b/board/kohaku/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kohaku/ec.tasklist b/board/kohaku/ec.tasklist
index 63d366a33b..7fb3e38b63 100644
--- a/board/kohaku/ec.tasklist
+++ b/board/kohaku/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kohaku/gpio.inc b/board/kohaku/gpio.inc
index 742a570cf8..eaddb14e2b 100644
--- a/board/kohaku/gpio.inc
+++ b/board/kohaku/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/kohaku/led.c b/board/kohaku/led.c
index 029cf5c315..2fbf2da3a5 100644
--- a/board/kohaku/led.c
+++ b/board/kohaku/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,8 +12,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -21,32 +21,35 @@ __override const int led_charge_lvl_2 = 100;
/* Kohaku : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -54,12 +57,11 @@ __override void led_set_color_power(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
- if (color == EC_LED_COLOR_BLUE)
- {
+ if (color == EC_LED_COLOR_BLUE) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_ON_LVL);
@@ -73,15 +75,14 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
/* Battery leds must be turn off when blue led is on
* because kohaku has 3-in-1 led.
*/
- if(!gpio_get_level(GPIO_PWR_LED_BLUE_L))
- {
+ if (!gpio_get_level(GPIO_PWR_LED_BLUE_L)) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
return;
@@ -117,10 +118,13 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
- gpio_set_level(GPIO_BAT_LED_GREEN_L, !brightness[EC_LED_COLOR_GREEN]);
- gpio_set_level(GPIO_BAT_LED_RED_L, !brightness[EC_LED_COLOR_RED]);
+ gpio_set_level(GPIO_BAT_LED_GREEN_L,
+ !brightness[EC_LED_COLOR_GREEN]);
+ gpio_set_level(GPIO_BAT_LED_RED_L,
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
- gpio_set_level(GPIO_PWR_LED_BLUE_L, !brightness[EC_LED_COLOR_BLUE]);
+ gpio_set_level(GPIO_PWR_LED_BLUE_L,
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/kracko/battery.c b/board/kracko/battery.c
index 13faf9f12b..4b8bbb7351 100644
--- a/board/kracko/battery.c
+++ b/board/kracko/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/kracko/board.c b/board/kracko/board.c
index 3458f91a98..136b05ea1e 100644
--- a/board/kracko/board.c
+++ b/board/kracko/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -166,48 +166,36 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
- [ADC_TEMP_SENSOR_4] = {
- .name = "TEMP_SENSOR4",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH16
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
+ [ADC_TEMP_SENSOR_4] = { .name = "TEMP_SENSOR4",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH16 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -256,19 +244,25 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -282,23 +276,17 @@ static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
static struct kionix_accel_data g_kx022_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_kx022_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_kx022_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Drivers */
struct motion_sensor_t kx022_lid_accel = {
@@ -538,8 +526,8 @@ __override void board_power_5v_enable(int enable)
if (board_get_charger_chip_count() > 1) {
if (sm5803_set_gpio0_level(1, !!enable))
- CPRINTUSB("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTUSB("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
}
@@ -547,11 +535,11 @@ __override uint8_t board_get_usb_pd_port_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT;
ccprints("Unhandled DB configuration: %d", db);
@@ -562,11 +550,11 @@ __override uint8_t board_get_charger_chip_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CHARGER_NUM - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CHARGER_NUM;
ccprints("Unhandled DB configuration: %d", db);
@@ -671,33 +659,31 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
+const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 10000,
+ } };
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "5V regular",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "5V regular",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -727,9 +713,8 @@ __override void lid_angle_peripheral_enable(int enable)
}
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 20;
@@ -748,14 +733,17 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div,
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
- {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
- {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
- {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
- {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { GPIO_KSO_L, 5 }, { GPIO_KSO_L, 6 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/kracko/board.h b/board/kracko/board.h
index 57f7927b86..78b1be8662 100644
--- a/board/kracko/board.h
+++ b/board/kracko/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,13 +23,16 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr \
+ */
/* PWM */
#define CONFIG_PWM
@@ -38,9 +41,9 @@
#define CONFIG_LED_ONOFF_STATES
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -73,8 +76,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
@@ -85,8 +88,8 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
/* USB Type A Features */
#define USB_PORT_COUNT 1
@@ -109,21 +112,16 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
- ADC_TEMP_SENSOR_4, /* ADC16 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_TEMP_SENSOR_4, /* ADC16 */
ADC_CH_COUNT
};
diff --git a/board/kracko/build.mk b/board/kracko/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/kracko/build.mk
+++ b/board/kracko/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kracko/cbi_ssfc.c b/board/kracko/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/kracko/cbi_ssfc.c
+++ b/board/kracko/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/kracko/cbi_ssfc.h b/board/kracko/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/kracko/cbi_ssfc.h
+++ b/board/kracko/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/kracko/ec.tasklist b/board/kracko/ec.tasklist
index 5c9a2d1a01..c13df44543 100644
--- a/board/kracko/ec.tasklist
+++ b/board/kracko/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kracko/gpio.inc b/board/kracko/gpio.inc
index cdcf8834c7..a138a925f3 100644
--- a/board/kracko/gpio.inc
+++ b/board/kracko/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kracko/led.c b/board/kracko/led.c
index af78cfa883..22a906807b 100644
--- a/board/kracko/led.c
+++ b/board/kracko/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -19,18 +19,24 @@ __override const int led_charge_lvl_2 = 100;
/* Kracko: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/kracko/usb_pd_policy.c b/board/kracko/usb_pd_policy.c
index 3ff7152541..8a2c07c575 100644
--- a/board/kracko/usb_pd_policy.c
+++ b/board/kracko/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,18 +65,7 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/kukui/board.c b/board/kukui/board.c
index a3468b62ca..6fafc949e1 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,6 +27,7 @@
#include "host_command.h"
#include "i2c.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -43,8 +44,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -65,30 +66,27 @@ static void motion_interrupt(enum gpio_signal signal);
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
- [ADC_BATT_ID] = {"BATT_ID", 3300, 4096, 0, STM32_AIN(7)},
- [ADC_POGO_ADC_INT_L] = {"POGO_ADC_INT_L", 3300, 4096, 0, STM32_AIN(6)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
+ [ADC_BATT_ID] = { "BATT_ID", 3300, 4096, 0, STM32_AIN(7) },
+ [ADC_POGO_ADC_INT_L] = { "POGO_ADC_INT_L", 3300, 4096, 0,
+ STM32_AIN(6) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -96,15 +94,14 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
@@ -134,8 +131,7 @@ void board_set_dp_mux_control(int output_enable, int polarity)
gpio_set_level(GPIO_USB_C0_DP_POLARITY, polarity);
}
-static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_update(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -162,13 +158,17 @@ __override const struct rt946x_init_setting *board_rt946x_init_setting(void)
return &battery_init_setting;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux usbc0_mux0 = {
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_update,
+};
+
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_update,
+ .mux = &usbc0_mux0,
},
};
@@ -266,9 +266,8 @@ int extpower_is_present(void)
if (board_vbus_source_enabled(CHARGE_PORT_USB_C))
usb_c_extpower_present = 0;
else
- usb_c_extpower_present = tcpm_check_vbus_level(
- CHARGE_PORT_USB_C,
- VBUS_PRESENT);
+ usb_c_extpower_present =
+ tcpm_check_vbus_level(CHARGE_PORT_USB_C, VBUS_PRESENT);
return usb_c_extpower_present || kukui_pogo_extpower_present();
}
@@ -357,15 +356,15 @@ static void board_rev_init(void)
/* configure PI3USB9201 to USB Path ON Mode */
i2c_write8(I2C_PORT_BC12, BC12_I2C_ADDR_FLAGS,
PI3USB9201_REG_CTRL_1,
- (PI3USB9201_USB_PATH_ON <<
- PI3USB9201_REG_CTRL_1_MODE_SHIFT));
+ (PI3USB9201_USB_PATH_ON
+ << PI3USB9201_REG_CTRL_1_MODE_SHIFT));
}
if (board_get_version() < 5) {
gpio_set_flags(GPIO_USB_C0_DP_OE_L, GPIO_OUT_HIGH);
gpio_set_flags(GPIO_USB_C0_DP_POLARITY, GPIO_OUT_LOW);
- usb_muxes[0].driver = &virtual_usb_mux_driver;
- usb_muxes[0].hpd_update = &virtual_hpd_update;
+ usbc0_mux0.driver = &virtual_usb_mux_driver;
+ usbc0_mux0.hpd_update = &virtual_hpd_update;
}
}
DECLARE_HOOK(HOOK_INIT, board_rev_init, HOOK_PRIO_INIT_ADC + 1);
@@ -438,26 +437,20 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
/* Matrix to rotate accelerometer into standard reference frame */
#ifdef BOARD_KUKUI
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
#else
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
#endif /* BOARD_KUKUI */
#ifdef CONFIG_MAG_BMI_BMM150
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t mag_standard_ref = {
- {0, FLOAT_TO_FP(-1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t mag_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
#endif /* CONFIG_MAG_BMI_BMM150 */
struct motion_sensor_t motion_sensors[] = {
@@ -632,7 +625,6 @@ static void motion_interrupt(enum gpio_signal signal)
#elif !defined(VARIANT_KUKUI_NO_SENSORS)
bmi160_interrupt(signal);
#endif /* BOARD_KRANE, !VARIANT_KUKUI_NO_SENSORS */
-
}
#endif /* SECTION_IS_RW */
@@ -669,9 +661,8 @@ __override int board_charge_port_is_connected(int port)
return gpio_get_level(GPIO_POGO_VBUS_PRESENT);
}
-__override
-void board_fill_source_power_info(int port,
- struct ec_response_usb_pd_power_info *r)
+__override void
+board_fill_source_power_info(int port, struct ec_response_usb_pd_power_info *r)
{
r->meas.voltage_now = 3300;
r->meas.voltage_max = 3300;
diff --git a/board/kukui/board.h b/board/kukui/board.h
index 8cedd195e1..94c05a1209 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,9 +37,9 @@
/* Battery */
#ifdef BOARD_KRANE
-#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 3500 /* mA */
#else
-#define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */
+#define BATTERY_DESIRED_CHARGING_CURRENT 2000 /* mA */
#endif /* BOARD_KRANE */
#ifdef BOARD_KRANE
@@ -79,19 +79,18 @@
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#endif /* SECTION_IS_RW */
/* I2C ports */
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 1
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 1
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_ACCEL 1
-#define I2C_PORT_BC12 1
-#define I2C_PORT_ALS 1
+#define I2C_PORT_ACCEL 1
+#define I2C_PORT_BC12 1
+#define I2C_PORT_ALS 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
diff --git a/board/kukui/build.mk b/board/kukui/build.mk
index 694879cee6..b60b9cf091 100644
--- a/board/kukui/build.mk
+++ b/board/kukui/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kukui/ec.tasklist b/board/kukui/ec.tasklist
index 9ba564ce52..2551038b66 100644
--- a/board/kukui/ec.tasklist
+++ b/board/kukui/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kukui/gpio.inc b/board/kukui/gpio.inc
index eed1fea828..efac70d681 100644
--- a/board/kukui/gpio.inc
+++ b/board/kukui/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kukui/led.c b/board/kukui/led.c
index 59f7681754..9cfdf855be 100644
--- a/board/kukui/led.c
+++ b/board/kukui/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -17,15 +17,15 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
static enum charge_state prv_chstate = PWR_STATE_INIT;
-#define LED_OFF MT6370_LED_ID_OFF
-#define LED_RED MT6370_LED_ID1
-#define LED_GREEN MT6370_LED_ID2
-#define LED_BLUE MT6370_LED_ID3
+#define LED_OFF MT6370_LED_ID_OFF
+#define LED_RED MT6370_LED_ID1
+#define LED_GREEN MT6370_LED_ID2
+#define LED_BLUE MT6370_LED_ID3
-#define LED_MASK_OFF 0
-#define LED_MASK_RED MT6370_MASK_RGB_ISNK1DIM_EN
-#define LED_MASK_GREEN MT6370_MASK_RGB_ISNK2DIM_EN
-#define LED_MASK_BLUE MT6370_MASK_RGB_ISNK3DIM_EN
+#define LED_MASK_OFF 0
+#define LED_MASK_RED MT6370_MASK_RGB_ISNK1DIM_EN
+#define LED_MASK_GREEN MT6370_MASK_RGB_ISNK2DIM_EN
+#define LED_MASK_BLUE MT6370_MASK_RGB_ISNK3DIM_EN
static void kukui_led_set_battery(void)
{
@@ -35,8 +35,7 @@ static void kukui_led_set_battery(void)
chstate = charge_get_state();
- if (prv_chstate == chstate &&
- chstate != PWR_STATE_DISCHARGE)
+ if (prv_chstate == chstate && chstate != PWR_STATE_DISCHARGE)
return;
prv_chstate = chstate;
@@ -62,8 +61,7 @@ static void kukui_led_set_battery(void)
return;
}
- if (prv_r == br[EC_LED_COLOR_RED] &&
- prv_g == br[EC_LED_COLOR_GREEN] &&
+ if (prv_r == br[EC_LED_COLOR_RED] && prv_g == br[EC_LED_COLOR_GREEN] &&
prv_b == br[EC_LED_COLOR_BLUE])
return;
diff --git a/board/kukui_scp/board.c b/board/kukui_scp/board.c
index d86e7e5fc6..7eab3c59a6 100644
--- a/board/kukui_scp/board.c
+++ b/board/kukui_scp/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kukui_scp/board.h b/board/kukui_scp/board.h
index 0c42c0cf2a..64104060ab 100644
--- a/board/kukui_scp/board.h
+++ b/board/kukui_scp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,8 +16,8 @@
#define CONFIG_FLASH_SIZE_BYTES 0x58000 /* Image file size: 256KB */
#endif
-#undef CONFIG_LID_SWITCH
-#undef CONFIG_FW_INCLUDE_RO
+#undef CONFIG_LID_SWITCH
+#undef CONFIG_FW_INCLUDE_RO
#define CONFIG_MKBP_EVENT
/* Sent MKBP event via IPI. */
#define CONFIG_MKBP_USE_CUSTOM
@@ -27,10 +27,12 @@
#define CONFIG_HOSTCMD_ALIGNED
/*
+ * mt8183:
+ *
* RW only, no flash
* +-------------------- 0x0
* | ROM vectortable, .text, .rodata, .data LMA
- * +-------------------- 0x10000
+ * +-------------------- 0x58000
* | RAM .bss, .data
* +-------------------- 0x7BDB0
* | IPI shared buffer with AP (288 + 8) * 2
@@ -40,11 +42,23 @@
* | 8KB D-CACHE
* +-------------------- 0x80000
*/
-#ifdef CHIP_VARIANT_MT8186
-#define ICACHE_BASE 0x3E000
-#else
-#define ICACHE_BASE 0x7C000
-#endif
+
+/*
+ * mt8186:
+ *
+ * RW only, no flash
+ * +-------------------- 0x0
+ * | ROM vectortable, .text, .rodata, .data LMA
+ * +-------------------- 0x2C000
+ * | RAM .bss, .data
+ * +-------------------- 0x3BDB0
+ * | IPI shared buffer with AP (288 + 8) * 2 => 0x250
+ * +-------------------- 0x3C000
+ * | 8KB I-CACHE
+ * +-------------------- 0x3E000
+ * | 8KB D-CACHE
+ * +-------------------- 0x40000
+ */
#define CONFIG_ROM_BASE 0x0
@@ -54,6 +68,12 @@
#define CONFIG_RAM_BASE 0x58000
#endif
+#ifdef CHIP_VARIANT_MT8186
+#define ICACHE_BASE 0x3C000
+#else
+#define ICACHE_BASE 0x7C000
+#endif
+
#define CONFIG_ROM_SIZE (CONFIG_RAM_BASE - CONFIG_ROM_BASE)
#define CONFIG_RAM_SIZE (CONFIG_IPC_SHARED_OBJ_ADDR - CONFIG_RAM_BASE)
#define CONFIG_CODE_RAM_SIZE CONFIG_RAM_BASE
@@ -64,12 +84,19 @@
#define CONFIG_DRAM_BASE 0x10000000
/* Shared memory address in AP physical address space. */
#define CONFIG_DRAM_BASE_LOAD 0x50000000
+
+#ifdef CHIP_VARIANT_MT8186
+#define CONFIG_DRAM_SIZE 0x010a0000 /* 16 MB */
+#define CACHE_TRANS_AP_SIZE 0x010a0000
+#else
#define CONFIG_DRAM_SIZE 0x01400000 /* 20 MB */
+#define CACHE_TRANS_AP_SIZE 0x00400000
+#endif
/* IPI configs */
#define CONFIG_IPC_SHARED_OBJ_BUF_SIZE 288
-#define CONFIG_IPC_SHARED_OBJ_ADDR \
- (ICACHE_BASE - \
+#define CONFIG_IPC_SHARED_OBJ_ADDR \
+ (ICACHE_BASE - \
(CONFIG_IPC_SHARED_OBJ_BUF_SIZE + 2 * 4 /* int32_t */) * 2)
#define CONFIG_IPI
#define CONFIG_RPMSG_NAME_SERVICE
@@ -95,11 +122,10 @@
#define IPI_NS_SERVICE 0xFF
-
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 8192
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
/*
* CONFIG_UART_CONSOLE
* 0 - SCP UART0
@@ -112,8 +138,8 @@
#define CONFIG_UART_CONSOLE 0
#endif
/* We let AP setup the correct pinmux. */
-#undef UART0_PINMUX_11_12
-#undef UART0_PINMUX_110_112
+#undef UART0_PINMUX_11_12
+#undef UART0_PINMUX_110_112
/* Track AP power state */
#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
diff --git a/board/kukui_scp/build.mk b/board/kukui_scp/build.mk
index 0fdaa1c820..f04d506057 100644
--- a/board/kukui_scp/build.mk
+++ b/board/kukui_scp/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kukui_scp/ec.tasklist b/board/kukui_scp/ec.tasklist
index 935d409b00..82bb6db382 100644
--- a/board/kukui_scp/ec.tasklist
+++ b/board/kukui_scp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kukui_scp/fd.c b/board/kukui_scp/fd.c
index 237f15ca94..be0bdeab57 100644
--- a/board/kukui_scp/fd.c
+++ b/board/kukui_scp/fd.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,12 +20,11 @@
static struct consumer const event_fd_consumer;
static void event_fd_written(struct consumer const *consumer, size_t count);
-static struct queue const fd_queue = QUEUE_DIRECT(4, struct fd_msg,
- null_producer,
- event_fd_consumer);
+static struct queue const fd_queue =
+ QUEUE_DIRECT(4, struct fd_msg, null_producer, event_fd_consumer);
static struct consumer const event_fd_consumer = {
.queue = &fd_queue,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = event_fd_written,
}),
};
@@ -33,7 +32,9 @@ static struct consumer const event_fd_consumer = {
/* Stub functions only provided by private overlays. */
// Jerry TODO implement private part and remove this
#ifndef HAVE_PRIVATE_MT8183
-void fd_ipi_msg_handler(void *data) {}
+void fd_ipi_msg_handler(void *data)
+{
+}
#endif
static void event_fd_written(struct consumer const *consumer, size_t count)
diff --git a/board/kukui_scp/fd.h b/board/kukui_scp/fd.h
index 3f70387400..cea5817942 100644
--- a/board/kukui_scp/fd.h
+++ b/board/kukui_scp/fd.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kukui_scp/gpio.inc b/board/kukui_scp/gpio.inc
index b186904aad..6cc2e0495e 100644
--- a/board/kukui_scp/gpio.inc
+++ b/board/kukui_scp/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/kukui_scp/isp_p1_srv.c b/board/kukui_scp/isp_p1_srv.c
index 5c2ae7c2e9..40dd37ff90 100644
--- a/board/kukui_scp/isp_p1_srv.c
+++ b/board/kukui_scp/isp_p1_srv.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,19 +20,21 @@
static struct consumer const event_isp_consumer;
static void event_isp_written(struct consumer const *consumer, size_t count);
-static struct queue const event_isp_queue = QUEUE_DIRECT(8,
- struct isp_msg, null_producer, event_isp_consumer);
+static struct queue const event_isp_queue =
+ QUEUE_DIRECT(8, struct isp_msg, null_producer, event_isp_consumer);
static struct consumer const event_isp_consumer = {
.queue = &event_isp_queue,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = event_isp_written,
}),
};
/* Stub functions only provided by private overlays. */
#ifndef HAVE_PRIVATE_MT8183
-void isp_msg_handler(void *data) {}
+void isp_msg_handler(void *data)
+{
+}
#endif
static void event_isp_written(struct consumer const *consumer, size_t count)
diff --git a/board/kukui_scp/isp_p1_srv.h b/board/kukui_scp/isp_p1_srv.h
index ba6fa7d110..e0abe9e4c8 100644
--- a/board/kukui_scp/isp_p1_srv.h
+++ b/board/kukui_scp/isp_p1_srv.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,7 +13,8 @@ struct isp_msg {
unsigned char msg[140];
};
-BUILD_ASSERT(member_size(struct isp_msg, msg) <= CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
+BUILD_ASSERT(member_size(struct isp_msg, msg) <=
+ CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
/* Functions provided by private overlay. */
void isp_msg_handler(void *data);
diff --git a/board/kukui_scp/isp_p2_srv.c b/board/kukui_scp/isp_p2_srv.c
index dba330c6a8..f38d4401ff 100644
--- a/board/kukui_scp/isp_p2_srv.c
+++ b/board/kukui_scp/isp_p2_srv.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,19 +19,21 @@
static struct consumer const event_dip_consumer;
static void event_dip_written(struct consumer const *consumer, size_t count);
-static struct queue const event_dip_queue = QUEUE_DIRECT(4,
- struct dip_msg_service, null_producer, event_dip_consumer);
+static struct queue const event_dip_queue = QUEUE_DIRECT(
+ 4, struct dip_msg_service, null_producer, event_dip_consumer);
static struct consumer const event_dip_consumer = {
.queue = &event_dip_queue,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = event_dip_written,
}),
};
/* Stub functions only provided by private overlays. */
#ifndef HAVE_PRIVATE_MT8183
-void dip_msg_handler(void *data) {}
+void dip_msg_handler(void *data)
+{
+}
#endif
static void event_dip_written(struct consumer const *consumer, size_t count)
diff --git a/board/kukui_scp/isp_p2_srv.h b/board/kukui_scp/isp_p2_srv.h
index 70fb0673de..3c1ba50f1c 100644
--- a/board/kukui_scp/isp_p2_srv.h
+++ b/board/kukui_scp/isp_p2_srv.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,7 +13,8 @@ struct dip_msg_service {
unsigned char msg[288];
};
-BUILD_ASSERT(member_size(struct dip_msg_service, msg) <= CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
+BUILD_ASSERT(member_size(struct dip_msg_service, msg) <=
+ CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
/* Functions provided by private overlay. */
void dip_msg_handler(void *data);
diff --git a/board/kukui_scp/mdp_ipi_message.c b/board/kukui_scp/mdp_ipi_message.c
index eca40b741b..f0bf7f2f92 100644
--- a/board/kukui_scp/mdp_ipi_message.c
+++ b/board/kukui_scp/mdp_ipi_message.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,19 +18,23 @@
static struct consumer const event_mdp_consumer;
static void event_mdp_written(struct consumer const *consumer, size_t count);
-static struct queue const event_mdp_queue = QUEUE_DIRECT(4,
- struct mdp_msg_service, null_producer, event_mdp_consumer);
+static struct queue const event_mdp_queue = QUEUE_DIRECT(
+ 4, struct mdp_msg_service, null_producer, event_mdp_consumer);
static struct consumer const event_mdp_consumer = {
.queue = &event_mdp_queue,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = event_mdp_written,
}),
};
/* Stub functions only provided by private overlays. */
#ifndef HAVE_PRIVATE_MT8183
-void mdp_common_init(void) {}
-void mdp_ipi_task_handler(void *pvParameters) {}
+void mdp_common_init(void)
+{
+}
+void mdp_ipi_task_handler(void *pvParameters)
+{
+}
#endif
static void event_mdp_written(struct consumer const *consumer, size_t count)
diff --git a/board/kukui_scp/mdp_ipi_message.h b/board/kukui_scp/mdp_ipi_message.h
index bcedb58504..0e46b947b2 100644
--- a/board/kukui_scp/mdp_ipi_message.h
+++ b/board/kukui_scp/mdp_ipi_message.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,9 +11,10 @@ struct mdp_msg_service {
unsigned char msg[20];
};
-BUILD_ASSERT(member_size(struct mdp_msg_service, msg) <= CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
+BUILD_ASSERT(member_size(struct mdp_msg_service, msg) <=
+ CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
void mdp_common_init(void);
void mdp_ipi_task_handler(void *pvParameters);
-#endif // _MDP_IPI_MESSAGE_H
+#endif // _MDP_IPI_MESSAGE_H
diff --git a/board/kukui_scp/update_scp b/board/kukui_scp/update_scp
index 448a8f74db..67aaacdcdc 100755
--- a/board/kukui_scp/update_scp
+++ b/board/kukui_scp/update_scp
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/kukui_scp/vdec.c b/board/kukui_scp/vdec.c
index eb4f1f8fa1..317d83d0d5 100644
--- a/board/kukui_scp/vdec.c
+++ b/board/kukui_scp/vdec.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,19 +20,23 @@
static struct consumer const event_vdec_consumer;
static void event_vdec_written(struct consumer const *consumer, size_t count);
-static struct queue const event_vdec_queue = QUEUE_DIRECT(8,
- struct vdec_msg, null_producer, event_vdec_consumer);
+static struct queue const event_vdec_queue =
+ QUEUE_DIRECT(8, struct vdec_msg, null_producer, event_vdec_consumer);
static struct consumer const event_vdec_consumer = {
.queue = &event_vdec_queue,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = event_vdec_written,
}),
};
/* Stub functions only provided by private overlays. */
#ifndef HAVE_PRIVATE_MT8183
-void vdec_h264_service_init(void) {}
-void vdec_h264_msg_handler(void *data) {}
+void vdec_h264_service_init(void)
+{
+}
+void vdec_h264_msg_handler(void *data)
+{
+}
#endif
static vdec_msg_handler mtk_vdec_msg_handle[VDEC_MAX];
diff --git a/board/kukui_scp/vdec.h b/board/kukui_scp/vdec.h
index 9cfb877e12..9284c28a40 100644
--- a/board/kukui_scp/vdec.h
+++ b/board/kukui_scp/vdec.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,7 +24,8 @@ struct vdec_msg {
unsigned char msg[48];
};
-BUILD_ASSERT(member_size(struct vdec_msg, msg) <= CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
+BUILD_ASSERT(member_size(struct vdec_msg, msg) <=
+ CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
/* Functions provided by private overlay. */
void vdec_h264_service_init(void);
diff --git a/board/kukui_scp/venc.c b/board/kukui_scp/venc.c
index c7e19d120c..1f07a6eea0 100644
--- a/board/kukui_scp/venc.c
+++ b/board/kukui_scp/venc.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,11 +20,11 @@
static struct consumer const event_venc_consumer;
static void event_venc_written(struct consumer const *consumer, size_t count);
-static struct queue const event_venc_queue = QUEUE_DIRECT(8,
- struct venc_msg, null_producer, event_venc_consumer);
+static struct queue const event_venc_queue =
+ QUEUE_DIRECT(8, struct venc_msg, null_producer, event_venc_consumer);
static struct consumer const event_venc_consumer = {
.queue = &event_venc_queue,
- .ops = &((struct consumer_ops const) {
+ .ops = &((struct consumer_ops const){
.written = event_venc_written,
}),
};
@@ -33,7 +33,9 @@ static venc_msg_handler mtk_venc_msg_handle[VENC_MAX];
/* Stub functions only provided by private overlays. */
#ifndef HAVE_PRIVATE_MT8183
-void venc_h264_msg_handler(void *data) {}
+void venc_h264_msg_handler(void *data)
+{
+}
#endif
static void event_venc_written(struct consumer const *consumer, size_t count)
diff --git a/board/kukui_scp/venc.h b/board/kukui_scp/venc.h
index 7046633046..1fc8421795 100644
--- a/board/kukui_scp/venc.h
+++ b/board/kukui_scp/venc.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,7 +22,8 @@ struct venc_msg {
unsigned char msg[288];
};
-BUILD_ASSERT(member_size(struct venc_msg, msg) <= CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
+BUILD_ASSERT(member_size(struct venc_msg, msg) <=
+ CONFIG_IPC_SHARED_OBJ_BUF_SIZE);
/* Functions provided by private overlay. */
void venc_h264_msg_handler(void *data);
diff --git a/board/kuldax/board.c b/board/kuldax/board.c
index 631aca2bdd..44b7dfdc3f 100644
--- a/board/kuldax/board.c
+++ b/board/kuldax/board.c
@@ -1,11 +1,11 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdbool.h>
#include "adc.h"
-#include "assert.h"
+#include "builtin/assert.h"
#include "button.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
@@ -27,8 +27,8 @@
#include "fw_config.h"
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -113,8 +113,6 @@ int board_set_active_charge_port(int port)
switch (port) {
case CHARGE_PORT_TYPEC0:
- case CHARGE_PORT_TYPEC1:
- case CHARGE_PORT_TYPEC2:
gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
break;
case CHARGE_PORT_BARRELJACK:
@@ -140,21 +138,21 @@ static int32_t base_5v_power_z1;
*/
/* PP5000_S5 loads */
-#define PWR_S5_BASE_LOAD (5*1431)
-#define PWR_S5_FRONT_HIGH (5*1737)
-#define PWR_S5_FRONT_LOW (5*1055)
-#define PWR_S5_REAR_HIGH (5*1737)
-#define PWR_S5_REAR_LOW (5*1055)
-#define PWR_S5_HDMI (5*580)
-#define PWR_S5_MAX (5*10000)
-#define FRONT_DELTA (PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW)
-#define REAR_DELTA (PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW)
+#define PWR_S5_BASE_LOAD (5 * 1431)
+#define PWR_S5_FRONT_HIGH (5 * 1737)
+#define PWR_S5_FRONT_LOW (5 * 1055)
+#define PWR_S5_REAR_HIGH (5 * 1737)
+#define PWR_S5_REAR_LOW (5 * 1055)
+#define PWR_S5_HDMI (5 * 580)
+#define PWR_S5_MAX (5 * 10000)
+#define FRONT_DELTA (PWR_S5_FRONT_HIGH - PWR_S5_FRONT_LOW)
+#define REAR_DELTA (PWR_S5_REAR_HIGH - PWR_S5_REAR_LOW)
/* PP5000_Z1 loads */
-#define PWR_Z1_BASE_LOAD (5*5)
-#define PWR_Z1_C_HIGH (5*3600)
-#define PWR_Z1_C_LOW (5*2000)
-#define PWR_Z1_MAX (5*9000)
+#define PWR_Z1_BASE_LOAD (5 * 5)
+#define PWR_Z1_C_HIGH (5 * 3600)
+#define PWR_Z1_C_LOW (5 * 2000)
+#define PWR_Z1_MAX (5 * 9000)
/*
* Update the 5V power usage, assuming no throttling,
* and invoke the power monitoring.
@@ -228,7 +226,7 @@ static void port_ocp_interrupt(enum gpio_signal signal)
* only do that if the system is off since it might still brown out.
*/
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/* Debounced connection state of the barrel jack */
static int8_t adp_connected = -1;
static void adp_connect_deferred(void)
@@ -328,26 +326,26 @@ void board_overcurrent_event(int port, int is_overcurrented)
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A_FRONT BIT(0)
-#define THROT_TYPE_A_REAR BIT(1)
-#define THROT_TYPE_C0 BIT(2)
-#define THROT_TYPE_C1 BIT(3)
-#define THROT_TYPE_C2 BIT(4)
-#define THROT_PROCHOT BIT(5)
+#define THROT_TYPE_A_FRONT BIT(0)
+#define THROT_TYPE_A_REAR BIT(1)
+#define THROT_TYPE_C0 BIT(2)
+#define THROT_TYPE_C1 BIT(3)
+#define THROT_TYPE_C2 BIT(4)
+#define THROT_PROCHOT BIT(5)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -363,8 +361,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
@@ -392,7 +389,7 @@ static void power_monitor(void)
*/
power = (adc_read_channel(ADC_VBUS) *
adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
+ 1000;
/* Init power table */
if (history[0] == 0) {
for (i = 0; i < POWER_READINGS; i++)
@@ -419,8 +416,7 @@ static void power_monitor(void)
* For barrel-jack supplies, the rating can be
* exceeded briefly, so use the average.
*/
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
power = max;
else
power = total / POWER_READINGS;
@@ -459,26 +455,6 @@ static void power_monitor(void)
gap += POWER_GAIN_TYPE_C;
}
/*
- * If the type-C port is sourcing power,
- * check whether it should be throttled.
- */
- if (ppc_is_sourcing_vbus(1) && gap <= 0) {
- new_state |= THROT_TYPE_C1;
- headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW;
- if (!(current_state & THROT_TYPE_C1))
- gap += POWER_GAIN_TYPE_C;
- }
- /*
- * If the type-C port is sourcing power,
- * check whether it should be throttled.
- */
- if (ppc_is_sourcing_vbus(2) && gap <= 0) {
- new_state |= THROT_TYPE_C2;
- headroom_5v_z1 += PWR_Z1_C_HIGH - PWR_Z1_C_LOW;
- if (!(current_state & THROT_TYPE_C2))
- gap += POWER_GAIN_TYPE_C;
- }
- /*
* As a last resort, turn on PROCHOT to
* throttle the CPU.
*/
@@ -551,24 +527,27 @@ static void power_monitor(void)
gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
}
if (diff & THROT_TYPE_C0) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
pd_update_contract(0);
}
if (diff & THROT_TYPE_C1) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(1, rp);
tcpm_select_rp_value(1, rp);
pd_update_contract(1);
}
if (diff & THROT_TYPE_C2) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C2) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(2, rp);
tcpm_select_rp_value(2, rp);
@@ -584,7 +563,6 @@ static void power_monitor(void)
int typea_bc = (new_state & THROT_TYPE_A_FRONT) ? 1 : 0;
gpio_set_level(GPIO_USB_A_LOW_PWR2_OD, typea_bc);
- gpio_set_level(GPIO_USB_A_LOW_PWR3_OD, typea_bc);
}
hook_call_deferred(&power_monitor_data, delay);
}
diff --git a/board/kuldax/board.h b/board/kuldax/board.h
index e73d1d8d4b..64804bf16a 100644
--- a/board/kuldax/board.h
+++ b/board/kuldax/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,48 +16,42 @@
#define CONFIG_MP2964
/* Barrel Jack */
-#define DEDICATED_CHARGE_PORT 3
+#define DEDICATED_CHARGE_PORT 1
/* HDMI CEC */
#define CONFIG_CEC
#define CEC_GPIO_OUT GPIO_HDMI_CEC_OUT
-#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
+#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
#define CEC_GPIO_PULL_UP GPIO_HDMI_CEC_PULL_UP
/* USB Type A Features */
-#define USB_PORT_COUNT 4
+#define USB_PORT_COUNT 4
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
-#define CONFIG_IO_EXPANDER
-#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
-
#define CONFIG_USB_PD_PPC
#define CONFIG_USB_PD_TCPM_RT1715
#define CONFIG_USBC_RETIMER_INTEL_BB
-#define CONFIG_USBC_RETIMER_KB800X
-#define CONFIG_KB800X_CUSTOM_XBAR
#define CONFIG_USBC_PPC_SYV682X
#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* The design should support up to 100W. */
/* TODO(b/197702356): Set the max PD to 60W now and change it
* to 100W after we verify it.
*/
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -65,64 +59,63 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
-#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_OD
+#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_OD
/* I2C Bus Configuration */
-#define I2C_PORT_DP_REDRIVER NPCX_I2C_PORT0_0
-
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_DP_REDRIVER NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_QI NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_QI NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x59
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
/* Retimer */
#define CONFIG_USBC_RETIMER_FW_UPDATE
@@ -140,7 +133,7 @@
* TODO(b/197478860): Enable the fan control. We need
* to check the sensor value and adjust the fan speed.
*/
- #define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
@@ -153,14 +146,12 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
enum charge_port {
CHARGE_PORT_TYPEC0,
- CHARGE_PORT_TYPEC1,
- CHARGE_PORT_TYPEC2,
CHARGE_PORT_BARRELJACK,
CHARGE_PORT_ENUM_COUNT
};
@@ -171,7 +162,7 @@ enum adc_channel {
ADC_TEMP_SENSOR_3_WIFI,
ADC_TEMP_SENSOR_4_DIMM,
ADC_VBUS,
- ADC_PPVAR_IMON, /* ADC3 */
+ ADC_PPVAR_IMON, /* ADC3 */
ADC_CH_COUNT
};
@@ -183,28 +174,16 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C2_NCT38XX,
- IOEX_PORT_COUNT
-};
-
enum pwm_channel {
- PWM_CH_LED_GREEN, /* PWM0 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED_RED, /* PWM2 */
+ PWM_CH_LED_GREEN, /* PWM0 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED_RED, /* PWM2 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
extern void adp_connect_interrupt(enum gpio_signal signal);
diff --git a/board/kuldax/build.mk b/board/kuldax/build.mk
index 9c668e0e2a..3de758d1bd 100644
--- a/board/kuldax/build.mk
+++ b/board/kuldax/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/kuldax/ec.tasklist b/board/kuldax/ec.tasklist
index 0688607266..23218133a8 100644
--- a/board/kuldax/ec.tasklist
+++ b/board/kuldax/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,8 +22,5 @@
TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(POWERBTN, power_button_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(PD_C0, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C2, pd_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, LARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C0, pd_interrupt_handler_task, 0, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(CEC, cec_task, NULL, LARGER_TASK_STACK_SIZE)
diff --git a/board/kuldax/fans.c b/board/kuldax/fans.c
index f2a70636d0..a2acd805f8 100644
--- a/board/kuldax/fans.c
+++ b/board/kuldax/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -37,9 +37,9 @@ static const struct fan_conf fan_conf_0 = {
* Set minimum at around 30% PWM.
*/
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 2200,
- .rpm_start = 2200,
- .rpm_max = 7200,
+ .rpm_min = 2400,
+ .rpm_start = 2400,
+ .rpm_max = 4500,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/kuldax/fw_config.c b/board/kuldax/fw_config.c
index a5857ef48f..4229f3bed1 100644
--- a/board/kuldax/fw_config.c
+++ b/board/kuldax/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union brask_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
@@ -31,13 +31,21 @@ static const struct {
int voltage;
int current;
} bj_power[] = {
- [BJ_135W] = { /* 0 - 135W (also default) */
- .voltage = 19500,
- .current = 6920
+ [BJ_150W] = { /* 0 - 150W (also default)*/
+ .voltage = 20000,
+ .current = 7500
},
[BJ_230W] = { /* 1 - 230W */
.voltage = 19500,
.current = 11800
+ },
+ [BJ_65W] = { /* 2 - 65W */
+ .voltage = 19000,
+ .current = 3420
+ },
+ [BJ_135W] = { /* 4 - 135W */
+ .voltage = 19500,
+ .current = 6920
}
};
diff --git a/board/kuldax/fw_config.h b/board/kuldax/fw_config.h
index 5ddb3b02a1..d7fa0a11a9 100644
--- a/board/kuldax/fw_config.h
+++ b/board/kuldax/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,15 +13,9 @@
*
* Source of truth is the project/brask/brask/config.star configuration file.
*/
-enum ec_cfg_audio_type {
- DB_AUDIO_UNKNOWN = 0,
- DB_NAU88L25B_I2S = 1
-};
+enum ec_cfg_audio_type { DB_AUDIO_UNKNOWN = 0, DB_NAU88L25B_I2S = 1 };
-enum ec_cfg_bj_power {
- BJ_135W = 0,
- BJ_230W = 1
-};
+enum ec_cfg_bj_power { BJ_150W = 0, BJ_230W = 1, BJ_65W = 2, BJ_135W = 3 };
union brask_cbi_fw_config {
struct {
diff --git a/board/kuldax/gpio.inc b/board/kuldax/gpio.inc
index 617463b7f6..253d9b7fc3 100644
--- a/board/kuldax/gpio.inc
+++ b/board/kuldax/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,12 +21,6 @@ GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt
GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_RT_INT_ODL, PIN(B, 1), GPIO_INT_FALLING, retimer_interrupt)
-GPIO_INT(USB_C1_BC12_INT_ODL, PIN(5, 0), GPIO_INT_FALLING, bc12_interrupt)
-GPIO_INT(USB_C1_PPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event)
-GPIO_INT(USB_C2_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_interrupt)
-GPIO_INT(USB_C2_PPC_INT_ODL, PIN(7, 0), GPIO_INT_FALLING, ppc_interrupt)
-GPIO_INT(USB_C2_RT_INT_ODL, PIN(4, 1), GPIO_INT_FALLING, retimer_interrupt)
GPIO_INT(BJ_ADP_PRESENT_ODL, PIN(8, 2), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
GPIO_INT(EC_RECOVERY_BTN_OD, PIN(2, 3), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(HDMI_CONN_OC_ODL, PIN(2, 4), GPIO_INPUT | GPIO_INT_BOTH, port_ocp_interrupt)
@@ -79,13 +73,6 @@ GPIO(CPU_C10_GATE_L, PIN(6, 7), GPIO_INPUT)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
GPIO(GSC_EC_RECOVERY_BTN_OD, PIN(2, 2), GPIO_INPUT)
-/* NFC */
-/* TODO(b/194068530): Enable NFC */
-GPIO(NFC_COIL_ACT_L, PIN(D, 4), GPIO_INPUT)
-GPIO(NFC_LOW_POWER_MODE, PIN(9, 5), GPIO_OUT_HIGH)
-GPIO(NFC_CARD_DET_L, PIN(A, 3), GPIO_INPUT)
-GPIO(EN_NFC_BUZZER, PIN(0, 5), GPIO_OUT_LOW)
-
/* Wireless Charger */
GPIO(EC_QI_PWR, PIN(D, 2), GPIO_OUT_LOW)
GPIO(QI_RESET_L, PIN(9, 3), GPIO_OUT_HIGH)
@@ -111,19 +98,14 @@ GPIO(EC_I2C_USB_C0_C2_TCPC_SCL, PIN(9, 0), GPIO_INPUT)
GPIO(EC_I2C_USB_C0_C2_TCPC_SDA, PIN(8, 7), GPIO_INPUT)
GPIO(EC_I2C_USB_C1_MIX_SCL, PIN(E, 4), GPIO_INPUT)
GPIO(EC_I2C_USB_C1_MIX_SDA, PIN(E, 3), GPIO_INPUT)
-GPIO(EC_I2C_USB_C1_TCPC_SCL, PIN(F, 3), GPIO_INPUT)
-GPIO(EC_I2C_USB_C1_TCPC_SDA, PIN(F, 2), GPIO_INPUT)
/* USBA */
GPIO(EN_PP5000_USBA, PIN(D, 7), GPIO_OUT_LOW)
GPIO(USB_A0_STATUS_L, PIN(2, 1), GPIO_INPUT)
GPIO(USB_A1_STATUS_L, PIN(2, 0), GPIO_INPUT)
-GPIO(USB_A2_STATUS_L, PIN(1, 7), GPIO_INPUT)
-GPIO(USB_A3_STATUS_L, PIN(1, 6), GPIO_INPUT)
GPIO(USB_A_LOW_PWR0_OD, PIN(1, 5), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(USB_A_LOW_PWR1_OD, PIN(1, 4), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(USB_A_LOW_PWR2_OD, PIN(1, 1), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(USB_A_LOW_PWR3_OD, PIN(1, 0), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(USB_A_OC_SOC_L, PIN(8, 0), GPIO_OUT_HIGH)
/* LED */
@@ -132,22 +114,9 @@ GPIO(LED_GREEN_L, PIN(C, 3), GPIO_OUT_LOW)
GPIO(LED_RED_L, PIN(C, 4), GPIO_OUT_LOW)
/* USBC */
-GPIO(USB_C0_C2_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
-GPIO(USB_C1_FRS_EN, PIN(9, 4), GPIO_OUT_LOW)
+GPIO(USB_C0_FRS_EN, PIN(A, 3), GPIO_OUT_LOW)
GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT)
-GPIO(USB_C1_RT_RST_R_L, PIN(0, 2), GPIO_OUT_LOW)
-
-/* GPIO02_P2 to PU */
-/* GPIO03_P2 to PU */
-IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW)
-IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW)
-
-IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 2), GPIO_ODR_LOW)
-IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 3), GPIO_ODR_HIGH)
-IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_LOW)
-/* GPIO07_P2 to PU */
+GPIO(USB_C0_RT_RST_ODL, PIN(9, 5), GPIO_ODR_LOW)
/* UART alternate functions */
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
@@ -173,15 +142,31 @@ ALTERNATE(PIN_MASK(4, 0x38), 0, MODULE_ADC, 0) /* GPIO45/ADC0, GPI
ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
/* Unused Pins */
-UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
+UNUSED(PIN(0, 2)) /* GPIO02/PSL_IN4 */
+UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */
+UNUSED(PIN(0, 5)) /* KSO13/GPIO05 */
+UNUSED(PIN(0, 6)) /* KSO11/GPIO06/P80_CLK */
+UNUSED(PIN(1, 0)) /* KSO9/GPIO10/CR_SIN1 */
+UNUSED(PIN(1, 2)) /* KSO07/GPO12/JEN# */
+UNUSED(PIN(1, 3)) /* KSO06/GPO13/GP_SEL# */
+UNUSED(PIN(1, 6)) /* KSO3/GPIO16 */
+UNUSED(PIN(1, 7)) /* KSO2/GPIO17/JTAG_TDI */
UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
+UNUSED(PIN(4, 1)) /* GPIO41/ADC4 */
+UNUSED(PIN(5, 0)) /* GPIO50 */
+UNUSED(PIN(5, 6)) /* GPIO56/CLKRUN# */
UNUSED(PIN(6, 6)) /* GPIO66 */
+UNUSED(PIN(7, 0)) /* GPIO70/PS2_DAT0*/
UNUSED(PIN(8, 1)) /* GPIO81/PECI_DATA */
-UNUSED(PIN(5, 6)) /* GPIO56/CLKRUN# */
-UNUSED(PIN(9, 7)) /* GPIO97 */
+UNUSED(PIN(8, 3)) /* KSO15/GPIO83 */
UNUSED(PIN(8, 6)) /* GPIO86/TXD/CR_SOUT2 */
-UNUSED(PIN(1, 3)) /* KSO06/GPO13/GP_SEL# */
-UNUSED(PIN(1, 2)) /* KSO07/GPO12/JEN# */
-UNUSED(PIN(0, 6)) /* KSO11/GPIO06/P80_CLK */
-UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */
+UNUSED(PIN(9, 7)) /* GPIO97 */
+UNUSED(PIN(9, 4)) /* GPIO94*/
+UNUSED(PIN(A, 2)) /* F_SCLK/GPIOA2 */
+UNUSED(PIN(A, 7)) /* GPIOA7 */
+UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
+UNUSED(PIN(D, 4)) /* GPIOD4/CR_SIN3 */
+UNUSED(PIN(F, 2)) /* GPIOF2/I2C4_SDA1*/
+UNUSED(PIN(F, 3)) /* GPIOF3/I2C4_SCL1*/
+UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1*/
diff --git a/board/kuldax/i2c.c b/board/kuldax/i2c.c
index 9c92852461..b38080f6a5 100644
--- a/board/kuldax/i2c.c
+++ b/board/kuldax/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,14 +43,6 @@ const struct i2c_port_t i2c_ports[] = {
.sda = GPIO_EC_I2C_USB_C0_C2_RT_SDA,
},
{
- /* I2C4 C1 TCPC */
- .name = "tcpc1",
- .port = I2C_PORT_USB_C1_TCPC,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
- .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
- },
- {
/* I2C5 */
.name = "wireless_charger",
.port = I2C_PORT_QI,
diff --git a/board/kuldax/led.c b/board/kuldax/led.c
index c5e74d29c2..842cee0530 100644
--- a/board/kuldax/led.c
+++ b/board/kuldax/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -84,9 +84,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/*
* When pulsing is enabled, brightness is incremented by <duty_inc> every
@@ -206,7 +206,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -231,8 +231,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|green|off|alert|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|green|off|alert|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -250,10 +249,10 @@ int led_set_brightness(enum ec_led_id id, const uint8_t *brightness)
else
return set_color(id, LED_OFF, 0);
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- /* Blink alert if insufficient power per system_can_boot_ap(). */
+ /* Blink alert if insufficient power per system_can_boot_ap(). */
int insufficient_power =
(charge_ma * charge_mv) <
(CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON * 1000);
diff --git a/board/kuldax/pwm.c b/board/kuldax/pwm.c
index 125d507a82..fe7e82894a 100644
--- a/board/kuldax/pwm.c
+++ b/board/kuldax/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,21 +11,16 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_GREEN] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
- .freq = 1000
- },
- [PWM_CH_LED_RED] = {
- .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
+ [PWM_CH_LED_GREEN] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/kuldax/sensors.c b/board/kuldax/sensors.c
index 8455a8fbc2..96f49de8a3 100644
--- a/board/kuldax/sensors.c
+++ b/board/kuldax/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -58,65 +58,60 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_CPU
- },
- [TEMP_SENSOR_2_CPU_VR] = {
- .name = "CPU VR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_CPU_VR
- },
- [TEMP_SENSOR_3_WIFI] = {
- .name = "WIFI",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_WIFI
- },
- [TEMP_SENSOR_4_DIMM] = {
- .name = "DIMM",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_DIMM
- },
+ [TEMP_SENSOR_1_CPU] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_CPU },
+ [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_CPU_VR },
+ [TEMP_SENSOR_3_WIFI] = { .name = "WIFI",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_WIFI },
+ [TEMP_SENSOR_4_DIMM] = { .name = "DIMM",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_DIMM },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
- * TODO(b/180681346): update for Alder Lake/brya
- *
- * Tiger Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
- * 130 C. However, sensor is located next to DDR, so we need to use the lower
- * DDR temperature limit (85 C)
+ * TODO(b/238260272): add the thermal sensor setting
*/
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(80), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(90), \
}, \
.temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(70), \
}, \
.temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(50), \
+ .temp_fan_max = C_TO_K(89), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
-/*
- * TODO(b/197478860): add the thermal sensor setting
- */
-/* this should really be "const" */
+#define THERMAL_FAN \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HIGH] = 0, \
+ [EC_TEMP_THRESH_HALT] = 0, \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_HIGH] = 0, \
+ }, \
+ .temp_fan_off = 0, \
+ .temp_fan_max = 0, \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
+
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_CPU] = THERMAL_CPU,
- [TEMP_SENSOR_2_CPU_VR] = THERMAL_CPU,
- [TEMP_SENSOR_3_WIFI] = THERMAL_CPU,
- [TEMP_SENSOR_4_DIMM] = THERMAL_CPU,
+ [TEMP_SENSOR_2_CPU_VR] = THERMAL_FAN,
+ [TEMP_SENSOR_3_WIFI] = THERMAL_FAN,
+ [TEMP_SENSOR_4_DIMM] = THERMAL_FAN,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/kuldax/usbc_config.c b/board/kuldax/usbc_config.c
index fddc9a449c..c0d34fc581 100644
--- a/board/kuldax/usbc_config.c
+++ b/board/kuldax/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,14 +13,12 @@
#include "driver/ppc/syv682x_public.h"
#include "driver/retimer/bb_retimer_public.h"
#include "driver/retimer/kb800x.h"
-#include "driver/tcpm/nct38xx.h"
#include "driver/tcpm/rt1715.h"
#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
#include "gpio.h"
#include "gpio_signal.h"
#include "hooks.h"
-#include "ioexpander.h"
#include "system.h"
#include "task.h"
#include "task_id.h"
@@ -32,175 +30,70 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
-const struct tcpc_config_t tcpc_config[] = {
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USBC_PORT_C0] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
.port = I2C_PORT_USB_C0_C2_TCPC,
- .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_NO_DEBUG_ACC_CONTROL,
- },
- [USBC_PORT_C1] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C1_TCPC,
.addr_flags = RT1715_I2C_ADDR_FLAGS,
},
.drv = &rt1715_tcpm_drv,
},
- [USBC_PORT_C2] = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C0_C2_TCPC,
- .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0,
- },
};
-BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
-BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/* USBC PPC configuration */
-struct ppc_config_t ppc_chips[] = {
+struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USBC_PORT_C0] = {
.i2c_port = I2C_PORT_USB_C0_C2_PPC,
.i2c_addr_flags = SYV682X_ADDR0_FLAGS,
.drv = &syv682x_drv,
},
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_USB_C1_PPC,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
- },
- [USBC_PORT_C2] = {
- .i2c_port = I2C_PORT_USB_C0_C2_PPC,
- .i2c_addr_flags = SYV682X_ADDR2_FLAGS,
- .drv = &syv682x_drv,
- },
};
-BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-
-struct kb800x_control_t kb800x_control[] = {
- [USBC_PORT_C0] = {
- },
- [USBC_PORT_C1] = {
- .retimer_rst_gpio = GPIO_USB_C1_RT_RST_R_L,
- .ss_lanes = {
- [KB800X_A0] = KB800X_TX0, [KB800X_A1] = KB800X_RX0,
- [KB800X_B0] = KB800X_RX1, [KB800X_B1] = KB800X_TX1,
- [KB800X_C0] = KB800X_RX0, [KB800X_C1] = KB800X_TX0,
- [KB800X_D0] = KB800X_TX1, [KB800X_D1] = KB800X_RX1,
- }
- },
- [USBC_PORT_C2] = {
- },
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-BUILD_ASSERT(ARRAY_SIZE(kb800x_control) == USBC_PORT_COUNT);
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
- },
- [USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &kb800x_usb_mux_driver,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = KB800X_I2C_ADDR0_FLAGS,
- .next_mux = &usbc1_tcss_usb_mux,
- },
- [USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
};
-BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
/* BC1.2 charger detect configuration */
-const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
+const struct pi3usb9201_config_t
+ pi3usb9201_bc12_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USBC_PORT_C0] = {
.i2c_port = I2C_PORT_USB_C0_C2_BC12,
.i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
- [USBC_PORT_C1] = {
- .i2c_port = I2C_PORT_USB_C1_BC12,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- },
- [USBC_PORT_C2] = {
- .i2c_port = I2C_PORT_USB_C0_C2_BC12,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS,
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
-
-/*
- * USB C0 and C2 uses burnside bridge chips and have their reset
- * controlled by their respective TCPC chips acting as GPIO expanders.
- *
- * ioex_init() is normally called before we take the TCPCs out of
- * reset, so we need to start in disabled mode, then explicitly
- * call ioex_init().
- */
-
-struct ioexpander_config_t ioex_config[] = {
- [IOEX_C0_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
- },
- [IOEX_C2_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
- .drv = &nct38xx_ioexpander_drv,
- .flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
- },
};
-BUILD_ASSERT(ARRAY_SIZE(ioex_config) == CONFIG_IO_EXPANDER_PORT_COUNT);
__override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
{
- enum ioex_signal rst_signal;
+ enum gpio_signal rst_signal;
if (me->usb_port == USBC_PORT_C0) {
- rst_signal = IOEX_USB_C0_RT_RST_ODL;
- } else if (me->usb_port == USBC_PORT_C2) {
- rst_signal = IOEX_USB_C2_RT_RST_ODL;
+ rst_signal = GPIO_USB_C0_RT_RST_ODL;
} else {
return EC_ERROR_INVAL;
}
@@ -217,14 +110,14 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
* retimer_init() function ensures power is up before calling
* this function.
*/
- ioex_set_level(rst_signal, 1);
+ gpio_set_level(rst_signal, 1);
/*
* Allow 1ms time for the retimer to power up lc_domain
* which powers I2C controller within retimer
*/
msleep(1);
} else {
- ioex_set_level(rst_signal, 0);
+ gpio_set_level(rst_signal, 0);
msleep(1);
}
return EC_SUCCESS;
@@ -246,34 +139,9 @@ __override int bb_retimer_reset(const struct usb_mux *me)
void board_reset_pd_mcu(void)
{
- enum gpio_signal tcpc_rst;
-
- tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL;
-
/*
* TODO(b/179648104): figure out correct timing
*/
-
- gpio_set_level(tcpc_rst, 0);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 0);
-
- /*
- * delay for power-on to reset-off and min. assertion time
- */
-
- msleep(20);
-
- gpio_set_level(tcpc_rst, 1);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 1);
-
- /* wait for chips to come up */
-
- msleep(50);
-}
-
-static void enable_ioex(int ioex)
-{
- ioex_init(ioex);
}
static void board_tcpc_init(void)
@@ -281,25 +149,13 @@ static void board_tcpc_init(void)
/* Don't reset TCPCs after initial reset */
if (!system_jumped_late()) {
board_reset_pd_mcu();
-
- /*
- * These IO expander pins are implemented using the
- * C0/C2 TCPC, so they must be set up after the TCPC has
- * been taken out of reset.
- */
- enable_ioex(IOEX_C0_NCT38XX);
- enable_ioex(IOEX_C2_NCT38XX);
}
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C2_PPC_INT_ODL);
/* Enable TCPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_C2_TCPC_INT_ODL);
-
- gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
@@ -310,9 +166,6 @@ uint16_t tcpc_get_alert_status(void)
if (gpio_get_level(GPIO_USB_C0_C2_TCPC_INT_ODL) == 0)
status |= PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_2;
- if (gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL) == 0)
- status |= PD_STATUS_TCPC_ALERT_1;
-
return status;
}
@@ -320,10 +173,6 @@ int ppc_get_alert_status(int port)
{
if (port == USBC_PORT_C0)
return gpio_get_level(GPIO_USB_C0_PPC_INT_ODL) == 0;
- else if (port == USBC_PORT_C1)
- return gpio_get_level(GPIO_USB_C1_PPC_INT_ODL) == 0;
- else if (port == USBC_PORT_C2)
- return gpio_get_level(GPIO_USB_C2_PPC_INT_ODL) == 0;
return 0;
}
@@ -333,9 +182,6 @@ void tcpc_alert_event(enum gpio_signal signal)
case GPIO_USB_C0_C2_TCPC_INT_ODL:
schedule_deferred_pd_interrupt(USBC_PORT_C0);
break;
- case GPIO_USB_C1_TCPC_INT_ODL:
- schedule_deferred_pd_interrupt(USBC_PORT_C1);
- break;
default:
break;
}
@@ -347,12 +193,6 @@ void bc12_interrupt(enum gpio_signal signal)
case GPIO_USB_C0_BC12_INT_ODL:
usb_charger_task_set_event(0, USB_CHG_EVENT_BC12);
break;
- case GPIO_USB_C1_BC12_INT_ODL:
- usb_charger_task_set_event(1, USB_CHG_EVENT_BC12);
- break;
- case GPIO_USB_C2_BC12_INT_ODL:
- usb_charger_task_set_event(2, USB_CHG_EVENT_BC12);
- break;
default:
break;
}
@@ -364,12 +204,6 @@ void ppc_interrupt(enum gpio_signal signal)
case GPIO_USB_C0_PPC_INT_ODL:
syv682x_interrupt(USBC_PORT_C0);
break;
- case GPIO_USB_C1_PPC_INT_ODL:
- syv682x_interrupt(USBC_PORT_C1);
- break;
- case GPIO_USB_C2_PPC_INT_ODL:
- syv682x_interrupt(USBC_PORT_C2);
- break;
default:
break;
}
diff --git a/board/kuldax/usbc_config.h b/board/kuldax/usbc_config.h
index 1ccb5f0a71..7a212f8fb6 100644
--- a/board/kuldax/usbc_config.h
+++ b/board/kuldax/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,8 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 3
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_C2,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_COUNT };
#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/lalala/battery.c b/board/lalala/battery.c
index 326ac93a6b..4edf5fa864 100644
--- a/board/lalala/battery.c
+++ b/board/lalala/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/lalala/board.c b/board/lalala/board.c
index 59eb9fd4a8..78404d6821 100644
--- a/board/lalala/board.c
+++ b/board/lalala/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -51,13 +51,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
-#define ADC_VOL_UP_MASK BIT(0)
-#define ADC_VOL_DOWN_MASK BIT(1)
+#define ADC_VOL_UP_MASK BIT(0)
+#define ADC_VOL_DOWN_MASK BIT(1)
static uint8_t new_adc_key_state;
@@ -110,8 +110,8 @@ static const struct ec_response_keybd_config lalala_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &lalala_keybd;
}
@@ -152,7 +152,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -226,22 +225,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
@@ -258,8 +257,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -334,13 +333,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -400,8 +397,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -426,18 +423,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* BMA253 private data */
static struct accelgyro_saved_data_t g_bma253_data;
@@ -445,11 +437,9 @@ static struct accelgyro_saved_data_t g_bma253_data;
/* BMI160 private data */
static struct bmi_drv_data_t g_bmi160_data;
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* ICM426 private data */
static struct icm_drv_data_t g_icm426xx_data;
@@ -633,7 +623,7 @@ void board_init(void)
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
}
/* Turn on 5V if the system is on, otherwise turn it off. */
@@ -648,20 +638,19 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void motion_interrupt(enum gpio_signal signal)
{
- switch (get_cbi_ssfc_base_sensor()) {
- case SSFC_SENSOR_ICM426XX:
- icm426xx_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI160:
- default:
- bmi160_interrupt(signal);
- break;
- }
+ switch (get_cbi_ssfc_base_sensor()) {
+ case SSFC_SENSOR_ICM426XX:
+ icm426xx_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI160:
+ default:
+ bmi160_interrupt(signal);
+ break;
+ }
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -737,18 +726,24 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM,
- .driver = &ps8802_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM,
+ .driver = &ps8802_usb_mux_driver,
+ },
}
};
diff --git a/board/lalala/board.h b/board/lalala/board.h
index c8f40d518d..4967e49752 100644
--- a/board/lalala/board.h
+++ b/board/lalala/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,11 +22,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_CMD_CHARGER_DUMP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -44,7 +47,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -81,16 +84,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -99,15 +102,15 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -143,25 +146,16 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
diff --git a/board/lalala/build.mk b/board/lalala/build.mk
index b012d8d502..eb422dae93 100644
--- a/board/lalala/build.mk
+++ b/board/lalala/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/lalala/cbi_ssfc.c b/board/lalala/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/lalala/cbi_ssfc.c
+++ b/board/lalala/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/lalala/cbi_ssfc.h b/board/lalala/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/lalala/cbi_ssfc.h
+++ b/board/lalala/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/lalala/ec.tasklist b/board/lalala/ec.tasklist
index d4fb416bce..29666dd959 100644
--- a/board/lalala/ec.tasklist
+++ b/board/lalala/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lalala/gpio.inc b/board/lalala/gpio.inc
index 3d81cd089d..8d37079ca4 100644
--- a/board/lalala/gpio.inc
+++ b/board/lalala/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lalala/led.c b/board/lalala/led.c
index cfe6f9eb6a..db36e2cb0b 100644
--- a/board/lalala/led.c
+++ b/board/lalala/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/lalala/usb_pd_policy.c b/board/lalala/usb_pd_policy.c
index fd9018a3f0..3410726e87 100644
--- a/board/lalala/usb_pd_policy.c
+++ b/board/lalala/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/lantis/battery.c b/board/lantis/battery.c
index 9f9deddb2b..6dfb91ef50 100644
--- a/board/lantis/battery.c
+++ b/board/lantis/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/lantis/board.c b/board/lantis/board.c
index f8c8b2e477..08fc84e222 100644
--- a/board/lantis/board.c
+++ b/board/lantis/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,7 +46,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -183,48 +183,36 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
- [ADC_TEMP_SENSOR_4] = {
- .name = "TEMP_SENSOR4",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH16
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
+ [ADC_TEMP_SENSOR_4] = { .name = "TEMP_SENSOR4",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH16 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -273,19 +261,25 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -299,17 +293,13 @@ static struct accelgyro_saved_data_t g_bma422_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
@@ -497,8 +487,8 @@ static const struct ec_response_keybd_config landrid_keybd = {
/* No function keys and no screenlock key */
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (get_cbi_fw_config_numeric_pad()) {
if (get_cbi_fw_config_kblight())
@@ -513,8 +503,7 @@ __override const struct ec_response_keybd_config
}
}
-__override
-uint8_t board_keyboard_row_refresh(void)
+__override uint8_t board_keyboard_row_refresh(void)
{
if (gpio_get_level(GPIO_EC_VIVALDIKEYBOARD_ID))
return 3;
@@ -674,8 +663,8 @@ __override void board_power_5v_enable(int enable)
if (board_get_charger_chip_count() > 1) {
if (sm5803_set_gpio0_level(1, !!enable))
- CPRINTUSB("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTUSB("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
}
@@ -683,11 +672,11 @@ __override uint8_t board_get_usb_pd_port_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CONFIG_USB_PD_PORT_MAX_COUNT;
ccprints("Unhandled DB configuration: %d", db);
@@ -698,11 +687,11 @@ __override uint8_t board_get_charger_chip_count(void)
{
enum fw_config_db db = get_cbi_fw_config_db();
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
+ if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI ||
+ db == DB_1A_HDMI_LTE)
return CHARGER_NUM - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
+ else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A ||
+ db == DB_1C_1A_LTE)
return CHARGER_NUM;
ccprints("Unhandled DB configuration: %d", db);
@@ -804,33 +793,31 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
}
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
+const struct pwm_t pwm_channels[] = { [PWM_CH_KBLIGHT] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq_hz = 100,
+ } };
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "5V regular",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "5V regular",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -860,9 +847,8 @@ __override void lid_angle_peripheral_enable(int enable)
}
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 20;
@@ -881,14 +867,17 @@ __override void ocpc_get_pid_constants(int *kp, int *kp_div,
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
- {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
- {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
- {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
- {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { GPIO_KSO_L, 5 }, { GPIO_KSO_L, 6 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/lantis/board.h b/board/lantis/board.h
index 067ff7eb94..bda4b01280 100644
--- a/board/lantis/board.h
+++ b/board/lantis/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,21 +23,24 @@
/* Charger */
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr \
+ */
/* PWM */
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -68,8 +71,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
@@ -80,8 +83,8 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
/* USB Type A Features */
#define USB_PORT_COUNT 1
@@ -104,21 +107,16 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
- ADC_TEMP_SENSOR_4, /* ADC16 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_TEMP_SENSOR_4, /* ADC16 */
ADC_CH_COUNT
};
@@ -143,10 +141,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum ec_cfg_keyboard_layout {
- KB_LAYOUT_DEFAULT = 0,
- KB_LAYOUT_1 = 1
-};
+enum ec_cfg_keyboard_layout { KB_LAYOUT_DEFAULT = 0, KB_LAYOUT_1 = 1 };
#endif /* !__ASSEMBLER__ */
diff --git a/board/lantis/build.mk b/board/lantis/build.mk
index 806168ea0d..9b862c7624 100644
--- a/board/lantis/build.mk
+++ b/board/lantis/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/lantis/cbi_ssfc.c b/board/lantis/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/lantis/cbi_ssfc.c
+++ b/board/lantis/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/lantis/cbi_ssfc.h b/board/lantis/cbi_ssfc.h
index 448fa5a163..e6606e8b1b 100644
--- a/board/lantis/cbi_ssfc.h
+++ b/board/lantis/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,18 +36,18 @@ enum ec_ssfc_lid_sensor {
* Audio Codec Source(Bit 8-10)
*/
enum ec_ssfc_audio_codec_source {
- SSFC_AUDIO_CODEC_DEFAULT = 0,
- SSFC_AUDIO_CODEC_VD = 1,
- SSFC_ADUIO_CODEC_VS = 2,
+ SSFC_AUDIO_CODEC_DEFAULT = 0,
+ SSFC_AUDIO_CODEC_VD = 1,
+ SSFC_ADUIO_CODEC_VS = 2,
};
/*
* Touchscreen Driver Source(Bit 11-13)
*/
enum ec_ssfc_ts_driver_source {
- SSFC_TS_DRIVER_DEFAULT = 0,
- SSFC_TS_DRIVER_GENERIC = 1,
- SSFC_TS_DRIVER_HID = 2,
+ SSFC_TS_DRIVER_DEFAULT = 0,
+ SSFC_TS_DRIVER_GENERIC = 1,
+ SSFC_TS_DRIVER_HID = 2,
};
union dedede_cbi_ssfc {
@@ -56,7 +56,7 @@ union dedede_cbi_ssfc {
uint32_t lid_sensor : 3;
uint32_t reserved : 2;
uint32_t audio_codec_source : 3;
- uint32_t ts_driver_source: 3;
+ uint32_t ts_driver_source : 3;
uint32_t reserved_2 : 18;
};
uint32_t raw_value;
@@ -76,5 +76,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/lantis/ec.tasklist b/board/lantis/ec.tasklist
index 2edf48ee05..c3c360febb 100644
--- a/board/lantis/ec.tasklist
+++ b/board/lantis/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lantis/gpio.inc b/board/lantis/gpio.inc
index 2be82d2358..6afb9ccc4b 100644
--- a/board/lantis/gpio.inc
+++ b/board/lantis/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lantis/led.c b/board/lantis/led.c
index 632f91e118..d6dbc929a8 100644
--- a/board/lantis/led.c
+++ b/board/lantis/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,11 +19,9 @@
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -31,22 +29,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- LEFT_PORT = 0,
- RIGHT_PORT
-};
+enum led_port { LEFT_PORT = 0, RIGHT_PORT };
static int led_set_color_battery(int port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_BAT_LED_AMBER_C1 :
- GPIO_BAT_LED_AMBER_C0);
+ GPIO_BAT_LED_AMBER_C0);
white_led = (port == RIGHT_PORT ? GPIO_BAT_LED_WHITE_C1 :
- GPIO_BAT_LED_WHITE_C0);
+ GPIO_BAT_LED_WHITE_C0);
switch (color) {
case LED_OFF:
@@ -144,7 +139,7 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
static bool is_led_old_policy(void)
{
if (get_cbi_fw_config_numeric_pad() == NUMERIC_PAD_ABSENT &&
- get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT)
+ get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT)
return 1;
else
return 0;
@@ -160,17 +155,16 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -181,14 +175,15 @@ static void led_set_battery(void)
*/
if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT) {
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
led_set_color_battery(RIGHT_PORT, power_ticks & 0x2 ?
- LED_WHITE : LED_OFF);
+ LED_WHITE :
+ LED_OFF);
led_set_color_battery(LEFT_PORT, power_ticks & 0x2 ?
- LED_WHITE : LED_OFF);
+ LED_WHITE :
+ LED_OFF);
return;
}
}
@@ -212,22 +207,25 @@ static void led_set_battery(void)
*/
if (charge_get_percent() < 10) {
if (is_led_old_policy()) {
- led_set_color_battery(
- RIGHT_PORT, (battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ led_set_color_battery(RIGHT_PORT,
+ (battery_ticks & 0x2) ?
+ LED_WHITE :
+ LED_OFF);
} else {
if (led_auto_control_is_enabled(
- EC_LED_ID_RIGHT_LED))
+ EC_LED_ID_RIGHT_LED))
led_set_color_battery(
RIGHT_PORT,
(battery_ticks & 0x2) ?
- LED_AMBER : LED_OFF);
+ LED_AMBER :
+ LED_OFF);
if (led_auto_control_is_enabled(
- EC_LED_ID_LEFT_LED))
+ EC_LED_ID_LEFT_LED))
led_set_color_battery(
LEFT_PORT,
(battery_ticks & 0x2) ?
- LED_AMBER : LED_OFF);
+ LED_AMBER :
+ LED_OFF);
}
} else {
set_active_port_color(LED_OFF);
@@ -245,11 +243,11 @@ static void led_set_battery(void)
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color((battery_ticks & 0x2) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -266,8 +264,7 @@ static void led_set_power(void)
if (chipset_in_state(CHIPSET_STATE_ON))
led_set_color_power(LED_WHITE);
else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power(
- (power_tick & 0x2) ? LED_WHITE : LED_OFF);
+ led_set_color_power((power_tick & 0x2) ? LED_WHITE : LED_OFF);
else
led_set_color_power(LED_OFF);
}
diff --git a/board/lantis/usb_pd_policy.c b/board/lantis/usb_pd_policy.c
index 7046e25d6c..2433b25431 100644
--- a/board/lantis/usb_pd_policy.c
+++ b/board/lantis/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,18 +65,7 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/lazor/battery.c b/board/lazor/battery.c
index 6cad716e2c..61de35da12 100644
--- a/board/lazor/battery.c
+++ b/board/lazor/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/lazor/board.c b/board/lazor/board.c
index e25b83d7db..974f09e55f 100644
--- a/board/lazor/board.c
+++ b/board/lazor/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,8 +33,9 @@
#include "usbc_config.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+/* Disable debug messages to free flash space */
+#define CPRINTS(format, args...)
+#define CPRINTF(format, args...)
#include "gpio_list.h"
@@ -46,10 +47,8 @@ __override struct keyboard_scan_config keyscan_config = {
* Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key);
* as it still uses the legacy location (KSO_01/KSI_00).
*/
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -64,55 +63,44 @@ __override struct keyboard_scan_config keyscan_config = {
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -120,37 +108,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -177,29 +150,21 @@ enum base_accelgyro_type {
};
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref_bmi160 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_bmi160 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref_icm426xx = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_icm426xx = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref_bma255 = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref_bma255 = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref_kx022 = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref_kx022 = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -371,7 +336,7 @@ static void board_detect_motionsensor(void)
/* Check lid accel chip */
ret = i2c_read8(I2C_PORT_SENSOR, BMA2x2_I2C_ADDR1_FLAGS,
- BMA2x2_CHIP_ID_ADDR, &val);
+ BMA2x2_CHIP_ID_ADDR, &val);
if (ret)
motion_sensors[LID_ACCEL] = kx022_lid_accel;
@@ -384,10 +349,11 @@ static void board_detect_motionsensor(void)
motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
}
- base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608)
- ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160;
- CPRINTS("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608)
- ? "ICM40608" : "BMI160");
+ base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) ?
+ BASE_GYRO_ICM426XX :
+ BASE_GYRO_BMI160;
+ CPRINTS("Base Accelgyro: %s",
+ (val == ICM426XX_CHIP_ICM40608) ? "ICM40608" : "BMI160");
}
static void board_update_sensor_config_from_sku(void)
diff --git a/board/lazor/board.h b/board/lazor/board.h
index f4f722c6a2..427db5e82e 100644
--- a/board/lazor/board.h
+++ b/board/lazor/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,9 +11,10 @@
#include "baseboard.h"
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Reduce flash usage */
+#define CONFIG_LTO
#define CONFIG_USB_PD_DEBUG_LEVEL 2
/* Switchcap */
@@ -25,7 +26,7 @@
#define CONFIG_PWM_KBLIGHT
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
@@ -91,12 +92,7 @@
#include "registers.h"
#include "sku.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -106,11 +102,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/lazor/build.mk b/board/lazor/build.mk
index 8cf8679e35..c17ab5e40c 100644
--- a/board/lazor/build.mk
+++ b/board/lazor/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/lazor/ec.tasklist b/board/lazor/ec.tasklist
index 2b55c26c20..92d5a1dde1 100644
--- a/board/lazor/ec.tasklist
+++ b/board/lazor/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lazor/gpio.inc b/board/lazor/gpio.inc
index b5c15b3729..c7af05eb3b 100644
--- a/board/lazor/gpio.inc
+++ b/board/lazor/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lazor/hibernate.c b/board/lazor/hibernate.c
index d262a33121..67d9b30791 100644
--- a/board/lazor/hibernate.c
+++ b/board/lazor/hibernate.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lazor/led.c b/board/lazor/led.c
index f9c91c1c6a..cf1f68d77e 100644
--- a/board/lazor/led.c
+++ b/board/lazor/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -32,15 +32,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C1,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_B_C1,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -66,7 +66,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -106,16 +105,16 @@ static void board_led_set_battery(void)
color = LED_BLUE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Amber 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_AMBER;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Amber 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/lazor/sku.c b/board/lazor/sku.c
index 1f63d05bf6..625231f5a9 100644
--- a/board/lazor/sku.c
+++ b/board/lazor/sku.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,8 +14,8 @@
#include "system.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static uint8_t sku_id;
diff --git a/board/lazor/sku.h b/board/lazor/sku.h
index 85f549858a..3ba687939d 100644
--- a/board/lazor/sku.h
+++ b/board/lazor/sku.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lazor/switchcap.c b/board/lazor/switchcap.c
index 16f4a54c79..f18378cab7 100644
--- a/board/lazor/switchcap.c
+++ b/board/lazor/switchcap.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,8 +14,8 @@
#include "system.h"
#include "sku.h"
-#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
/* LN9310 switchcap */
const struct ln9310_config_t ln9310_config = {
diff --git a/board/lazor/usbc_config.c b/board/lazor/usbc_config.c
index 59951223ec..11cc649573 100644
--- a/board/lazor/usbc_config.c
+++ b/board/lazor/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,8 +27,9 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+/* Disable debug messages to free flash space */
+#define CPRINTS(format, args...)
+#define CPRINTF(format, args...)
const struct charger_config_t chg_chips[] = {
{
@@ -149,16 +150,12 @@ void tcpc_alert_event(enum gpio_signal signal)
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -189,16 +186,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -271,7 +274,7 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
@@ -316,8 +319,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -345,7 +347,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -369,23 +370,21 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/lazor/usbc_config.h b/board/lazor/usbc_config.h
index 9c1d8d1e74..53d6df3983 100644
--- a/board/lazor/usbc_config.h
+++ b/board/lazor/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/liara/battery.c b/board/liara/battery.c
index bf244125b0..291925cd06 100644
--- a/board/liara/battery.c
+++ b/board/liara/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/liara/board.c b/board/liara/board.c
index c8fdeff2cd..f51fa1e2dd 100644
--- a/board/liara/board.c
+++ b/board/liara/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,52 +25,40 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_POWER_BUTTON_L,
GPIO_EC_RST_ODL,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "kblight",
- .port = I2C_PORT_KBLIGHT,
- .kbps = 100,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL_AP,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "kblight",
+ .port = I2C_PORT_KBLIGHT,
+ .kbps = 100,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/liara/board.h b/board/liara/board.h
index ae4494115b..4ef9a11793 100644
--- a/board/liara/board.h
+++ b/board/liara/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,13 +17,13 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
#define CONFIG_MKBP_USE_HOST_EVENT
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 5000
/* Power and battery LEDs */
#define CONFIG_LED_COMMON
diff --git a/board/liara/build.mk b/board/liara/build.mk
index c808e65aed..d24127ddae 100644
--- a/board/liara/build.mk
+++ b/board/liara/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/liara/ec.tasklist b/board/liara/ec.tasklist
index b562761311..24300fe7da 100644
--- a/board/liara/ec.tasklist
+++ b/board/liara/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/liara/gpio.inc b/board/liara/gpio.inc
index 343c50f503..a1c3e1a25f 100644
--- a/board/liara/gpio.inc
+++ b/board/liara/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/liara/led.c b/board/liara/led.c
index 371c08ce40..45cc43edc8 100644
--- a/board/liara/led.c
+++ b/board/liara/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,13 +19,10 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* both LEDs being off.
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* White, Amber */
- [EC_LED_COLOR_RED] = { 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 100, 0 },
- [EC_LED_COLOR_AMBER] = { 0, 100 },
+ /* White, Amber */
+ [EC_LED_COLOR_RED] = { 0, 0 }, [EC_LED_COLOR_GREEN] = { 0, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0 }, [EC_LED_COLOR_YELLOW] = { 0, 0 },
+ [EC_LED_COLOR_WHITE] = { 100, 0 }, [EC_LED_COLOR_AMBER] = { 0, 100 },
};
/* One logical LED with amber and blue channels. */
diff --git a/board/lick/battery.c b/board/lick/battery.c
index fa746a8c9f..01ab23dd3b 100644
--- a/board/lick/battery.c
+++ b/board/lick/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/lick/board.c b/board/lick/board.c
index 678634f785..d20aad2968 100644
--- a/board/lick/board.c
+++ b/board/lick/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,11 +31,11 @@
#include "util.h"
#include "battery_smart.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
@@ -60,31 +60,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -94,11 +94,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate lid and base sensor into standard reference frame */
-const mat33_fp_t standard_rot_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t standard_rot_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct stprivate_data g_lis2dh_data;
@@ -192,11 +190,10 @@ static int board_is_convertible(void)
static void board_update_sensor_config_from_sku(void)
{
- motion_sensor_count = 0;
- gmr_tablet_switch_disable();
- /* Base accel is not stuffed, don't allow line to float */
- gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ motion_sensor_count = 0;
+ gmr_tablet_switch_disable();
+ /* Base accel is not stuffed, don't allow line to float */
+ gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
static void cbi_init(void)
@@ -232,11 +229,11 @@ int board_is_lid_angle_tablet_mode(void)
}
/* Battery functions */
-#define SB_OPTIONALMFG_FUNCTION2 0x3e
+#define SB_OPTIONALMFG_FUNCTION2 0x3e
/* Optional mfg function2 */
-#define SMART_QUICK_CHARGE (1<<12)
+#define SMART_QUICK_CHARGE (1 << 12)
/* Quick charge support */
-#define MODE_QUICK_CHARGE_SUPPORT (1<<4)
+#define MODE_QUICK_CHARGE_SUPPORT (1 << 4)
static void sb_quick_charge_mode(int enable)
{
diff --git a/board/lick/board.h b/board/lick/board.h
index 5c75a38c84..05f24f141d 100644
--- a/board/lick/board.h
+++ b/board/lick/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,8 +30,8 @@
#define CONFIG_CMD_ACCEL_INFO
/* Sensors */
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -50,10 +50,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT,
};
@@ -64,18 +64,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/lick/build.mk b/board/lick/build.mk
index 137e208b53..fee77e38b5 100644
--- a/board/lick/build.mk
+++ b/board/lick/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/lick/ec.tasklist b/board/lick/ec.tasklist
index 6eac78a042..6c56976091 100644
--- a/board/lick/ec.tasklist
+++ b/board/lick/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lick/gpio.inc b/board/lick/gpio.inc
index ad6773a211..3a553f6e91 100644
--- a/board/lick/gpio.inc
+++ b/board/lick/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lick/led.c b/board/lick/led.c
index a7832c5e78..80972c468b 100644
--- a/board/lick/led.c
+++ b/board/lick/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,32 +19,35 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/lindar/battery.c b/board/lindar/battery.c
index 533db6ae0d..e206a5c6aa 100644
--- a/board/lindar/battery.c
+++ b/board/lindar/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -129,7 +129,9 @@ __override bool board_battery_is_initialized(void)
bool batt_initialization_state;
int batt_status;
- batt_initialization_state = (battery_status(&batt_status) ? false :
- !!(batt_status & STATUS_INITIALIZED));
+ batt_initialization_state =
+ (battery_status(&batt_status) ?
+ false :
+ !!(batt_status & STATUS_INITIALIZED));
return batt_initialization_state;
}
diff --git a/board/lindar/board.c b/board/lindar/board.c
index 79ef3a4cbb..5bb155550e 100644
--- a/board/lindar/board.c
+++ b/board/lindar/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -113,7 +113,7 @@ __override void lid_angle_peripheral_enable(int enable)
{
if (ec_cfg_has_tabletmode()) {
if (chipset_in_state(CHIPSET_STATE_ANY_OFF) ||
- tablet_get_mode())
+ tablet_get_mode())
enable = 0;
keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE);
}
@@ -130,17 +130,13 @@ static struct stprivate_data g_lis2dh_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate lid and base sensor into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -225,7 +221,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -261,8 +257,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -289,8 +285,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -425,8 +421,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -437,16 +432,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -454,7 +449,7 @@ void board_reset_pd_mcu(void)
{
ps8815_reset();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
/******************************************************************************/
@@ -530,25 +525,32 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = NULL,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = NULL,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/lindar/board.h b/board/lindar/board.h
index bc49b8514d..7c407d05a7 100644
--- a/board/lindar/board.h
+++ b/board/lindar/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,12 +27,11 @@
/* Sensors */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- BIT(LID_ACCEL)
+#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -43,31 +42,29 @@
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
-
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#undef CONFIG_USB_MUX_RUNTIME_CONFIG
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
+#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
/* BC 1.2 */
@@ -76,8 +73,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Retimer */
#undef CONFIG_USBC_RETIMER_INTEL_BB
@@ -92,42 +89,42 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_MUTE_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_MUTE_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_BUS_MAY_BE_UNPOWERED
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_LIGHTBAR NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_LIGHTBAR NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
#ifndef __ASSEMBLER__
@@ -156,11 +153,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/lindar/build.mk b/board/lindar/build.mk
index 43b40c644c..d590255d2a 100644
--- a/board/lindar/build.mk
+++ b/board/lindar/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/lindar/ec.tasklist b/board/lindar/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/lindar/ec.tasklist
+++ b/board/lindar/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/lindar/gpio.inc b/board/lindar/gpio.inc
index 30dd2a3920..f8c036b96c 100644
--- a/board/lindar/gpio.inc
+++ b/board/lindar/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/lindar/ktd20xx.h b/board/lindar/ktd20xx.h
index ad93ee3de8..63e3bfb363 100644
--- a/board/lindar/ktd20xx.h
+++ b/board/lindar/ktd20xx.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -120,21 +120,21 @@
*/
enum ktd20xx_register {
- KTD20XX_ID_DATA = 0x00,
- KTD20XX_STATUS_REG = 0x01,
- KTD20XX_CTRL_CFG = 0x02,
- KTD20XX_IRED_SET0 = 0x03,
- KTD20XX_IGRN_SET0 = 0x04,
- KTD20XX_IBLU_SET0 = 0x05,
- KTD20XX_IRED_SET1 = 0x06,
- KTD20XX_IGRN_SET1 = 0x07,
- KTD20XX_IBLU_SET1 = 0x08,
- KTD20XX_ISEL_A12 = 0x09,
- KTD20XX_ISEL_A34 = 0x0A,
- KTD20XX_ISEL_B12 = 0x0B,
- KTD20XX_ISEL_B34 = 0x0C,
- KTD20XX_ISEL_C12 = 0x0D,
- KTD20XX_ISEL_C34 = 0x0E,
+ KTD20XX_ID_DATA = 0x00,
+ KTD20XX_STATUS_REG = 0x01,
+ KTD20XX_CTRL_CFG = 0x02,
+ KTD20XX_IRED_SET0 = 0x03,
+ KTD20XX_IGRN_SET0 = 0x04,
+ KTD20XX_IBLU_SET0 = 0x05,
+ KTD20XX_IRED_SET1 = 0x06,
+ KTD20XX_IGRN_SET1 = 0x07,
+ KTD20XX_IBLU_SET1 = 0x08,
+ KTD20XX_ISEL_A12 = 0x09,
+ KTD20XX_ISEL_A34 = 0x0A,
+ KTD20XX_ISEL_B12 = 0x0B,
+ KTD20XX_ISEL_B34 = 0x0C,
+ KTD20XX_ISEL_C12 = 0x0D,
+ KTD20XX_ISEL_C34 = 0x0E,
KTD20XX_TOTOAL_REG
};
diff --git a/board/lindar/led.c b/board/lindar/led.c
index 6d602d5c4e..9ad7b48fb2 100644
--- a/board/lindar/led.c
+++ b/board/lindar/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -23,44 +23,49 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -135,9 +140,8 @@ static void controller_write(uint8_t reg, uint8_t val)
buf[0] = reg;
buf[1] = val;
- i2c_xfer_unlocked(I2C_PORT_LIGHTBAR, ktd2061_i2c_addr,
- buf, 2, 0, 0,
- I2C_XFER_SINGLE);
+ i2c_xfer_unlocked(I2C_PORT_LIGHTBAR, ktd2061_i2c_addr, buf, 2, 0, 0,
+ I2C_XFER_SINGLE);
}
enum lightbar_states {
@@ -187,51 +191,46 @@ struct lightbar_descriptor {
uint8_t ticks;
};
-#define BAR_INFINITE UINT8_MAX
-#define LIGHTBAR_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
+#define BAR_INFINITE UINT8_MAX
+#define LIGHTBAR_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
#define LIGHTBAR_COUNT_FOR_RESUME_FROM_SLEEP (3 * LIGHTBAR_ONE_SEC)
int lightbar_resume_tick;
-const struct lightbar_descriptor
- lb_table[LB_NUM_STATES][LIGHTBAR_NUM_PHASES] = {
- [LB_STATE_OFF] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_LID_CLOSE] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_ONLY] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LOW] = {{BAR_COLOR_ORG_20_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV1] = {{BAR_COLOR_GRN_40_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV2] = {{BAR_COLOR_GRN_60_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV3] = {{BAR_COLOR_GRN_80_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_SLEEP_AC_BAT_LV4] = {{BAR_COLOR_GRN_FULL, BAR_INFINITE} },
- [LB_STATE_SLEEP_BAT_LOW] = {{BAR_OFF, 5 * LIGHTBAR_ONE_SEC},
- {BAR_COLOR_ORG_FULL, LIGHTBAR_ONE_SEC} },
- [LB_STATE_SLEEP_BAT_ONLY] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_S0_AC_ONLY] = {{BAR_OFF, BAR_INFINITE} },
- [LB_STATE_S0_BAT_LOW] = {{BAR_COLOR_ORG_20_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV1] = {{BAR_COLOR_GRN_40_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV2] = {{BAR_COLOR_GRN_60_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV3] = {{BAR_COLOR_GRN_80_PERCENT,
- BAR_INFINITE} },
- [LB_STATE_S0_BAT_LV4] = {{BAR_COLOR_GRN_FULL, BAR_INFINITE} },
+const struct lightbar_descriptor lb_table[LB_NUM_STATES][LIGHTBAR_NUM_PHASES] = {
+ [LB_STATE_OFF] = { { BAR_OFF, BAR_INFINITE } },
+ [LB_STATE_LID_CLOSE] = { { BAR_OFF, BAR_INFINITE } },
+ [LB_STATE_SLEEP_AC_ONLY] = { { BAR_OFF, BAR_INFINITE } },
+ [LB_STATE_SLEEP_AC_BAT_LOW] = { { BAR_COLOR_ORG_20_PERCENT,
+ BAR_INFINITE } },
+ [LB_STATE_SLEEP_AC_BAT_LV1] = { { BAR_COLOR_GRN_40_PERCENT,
+ BAR_INFINITE } },
+ [LB_STATE_SLEEP_AC_BAT_LV2] = { { BAR_COLOR_GRN_60_PERCENT,
+ BAR_INFINITE } },
+ [LB_STATE_SLEEP_AC_BAT_LV3] = { { BAR_COLOR_GRN_80_PERCENT,
+ BAR_INFINITE } },
+ [LB_STATE_SLEEP_AC_BAT_LV4] = { { BAR_COLOR_GRN_FULL, BAR_INFINITE } },
+ [LB_STATE_SLEEP_BAT_LOW] = { { BAR_OFF, 5 * LIGHTBAR_ONE_SEC },
+ { BAR_COLOR_ORG_FULL, LIGHTBAR_ONE_SEC } },
+ [LB_STATE_SLEEP_BAT_ONLY] = { { BAR_OFF, BAR_INFINITE } },
+ [LB_STATE_S0_AC_ONLY] = { { BAR_OFF, BAR_INFINITE } },
+ [LB_STATE_S0_BAT_LOW] = { { BAR_COLOR_ORG_20_PERCENT, BAR_INFINITE } },
+ [LB_STATE_S0_BAT_LV1] = { { BAR_COLOR_GRN_40_PERCENT, BAR_INFINITE } },
+ [LB_STATE_S0_BAT_LV2] = { { BAR_COLOR_GRN_60_PERCENT, BAR_INFINITE } },
+ [LB_STATE_S0_BAT_LV3] = { { BAR_COLOR_GRN_80_PERCENT, BAR_INFINITE } },
+ [LB_STATE_S0_BAT_LV4] = { { BAR_COLOR_GRN_FULL, BAR_INFINITE } },
};
-#define DISABLE_LIGHTBAR 0x00
-#define ENABLE_LIGHTBAR 0x80
-#define I_OFF 0x00
-#define GRN_I_ON 0x1E
-#define ORG_I_ON 0x28
-#define SEL_OFF 0x00
-#define SEL_1ST_LED BIT(7)
-#define SEL_2ND_LED BIT(3)
-#define SEL_BOTH (SEL_1ST_LED | SEL_2ND_LED)
-#define SKU_ID_NONE 0x00
-#define SKU_ID_INVALID 0x01
+#define DISABLE_LIGHTBAR 0x00
+#define ENABLE_LIGHTBAR 0x80
+#define I_OFF 0x00
+#define GRN_I_ON 0x1E
+#define ORG_I_ON 0x28
+#define SEL_OFF 0x00
+#define SEL_1ST_LED BIT(7)
+#define SEL_2ND_LED BIT(3)
+#define SEL_BOTH (SEL_1ST_LED | SEL_2ND_LED)
+#define SKU_ID_NONE 0x00
+#define SKU_ID_INVALID 0x01
#define LB_SUPPORTED_SKUID_LOWER 458700
#define LB_SUPPORTED_SKUID_UPPER 458800
@@ -259,7 +258,7 @@ static bool lightbar_is_supported(void)
* if system support lightbar or not.
*/
if (skuid >= LB_SUPPORTED_SKUID_LOWER &&
- skuid <= LB_SUPPORTED_SKUID_UPPER)
+ skuid <= LB_SUPPORTED_SKUID_UPPER)
result = true;
else
result = false;
@@ -310,8 +309,7 @@ static void lightbar_set_demo_state(enum lightbar_states tmp_state)
LIGHTBAR_COUNT_FOR_RESUME_FROM_SLEEP;
}
ccprintf("lightbar_demo_state = %d; lightbar_resume_tick %d.\n",
- lightbar_demo_state,
- lightbar_resume_tick);
+ lightbar_demo_state, lightbar_resume_tick);
}
static enum lightbar_states lightbar_get_demo_state(void)
@@ -321,8 +319,8 @@ static enum lightbar_states lightbar_get_demo_state(void)
* simulate lightbar off.
*/
if ((lightbar_demo_state != LB_NUM_STATES) &&
- (lightbar_demo_state >= LB_STATE_S0_AC_ONLY) &&
- (lightbar_resume_tick == 0))
+ (lightbar_demo_state >= LB_STATE_S0_AC_ONLY) &&
+ (lightbar_resume_tick == 0))
return LB_STATE_OFF;
return lightbar_demo_state;
@@ -356,89 +354,65 @@ static bool lightbar_is_enabled(void)
* ISEL_A12, ISEL_A34, ISEL_B12, ISEL_B34, ISEL_C12, ISEL_C34
*/
const uint8_t lightbar_10_led_cfg[LIGHTBAR_COLOR_TOTAL][KTD20XX_TOTOAL_REG] = {
- [BAR_RESET] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_OFF] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_ORG_20_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_40_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_60_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_BOTH, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_80_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF
- },
- [BAR_COLOR_ORG_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF
- }
+ [BAR_RESET] = { 0x00, 0x00, DISABLE_LIGHTBAR, I_OFF, I_OFF, I_OFF,
+ I_OFF, I_OFF, I_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF,
+ SEL_OFF, SEL_OFF },
+ [BAR_OFF] = { 0x00, 0x00, DISABLE_LIGHTBAR, I_OFF, I_OFF, I_OFF, I_OFF,
+ I_OFF, I_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF,
+ SEL_OFF },
+ [BAR_COLOR_ORG_20_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, I_OFF,
+ ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_OFF, SEL_BOTH, SEL_OFF, SEL_OFF,
+ SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_40_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_OFF,
+ SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_60_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_BOTH,
+ SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_80_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH,
+ SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_FULL] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON, I_OFF,
+ I_OFF, I_OFF, I_OFF, I_OFF, SEL_BOTH, SEL_BOTH,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF },
+ [BAR_COLOR_ORG_FULL] = { 0x00, 0x00, ENABLE_LIGHTBAR, I_OFF, ORG_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, SEL_BOTH, SEL_BOTH,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF }
};
const uint8_t lightbar_12_led_cfg[LIGHTBAR_COLOR_TOTAL][KTD20XX_TOTOAL_REG] = {
- [BAR_RESET] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_OFF] = {
- 0x00, 0x00, DISABLE_LIGHTBAR,
- I_OFF, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_ORG_20_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_40_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_60_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF
- },
- [BAR_COLOR_GRN_80_PERCENT] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED
- },
- [BAR_COLOR_GRN_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- GRN_I_ON, I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH
- },
- [BAR_COLOR_ORG_FULL] = {
- 0x00, 0x00, ENABLE_LIGHTBAR,
- I_OFF, ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
- SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH
- }
+ [BAR_RESET] = { 0x00, 0x00, DISABLE_LIGHTBAR, I_OFF, I_OFF, I_OFF,
+ I_OFF, I_OFF, I_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF,
+ SEL_OFF, SEL_OFF },
+ [BAR_OFF] = { 0x00, 0x00, DISABLE_LIGHTBAR, I_OFF, I_OFF, I_OFF, I_OFF,
+ I_OFF, I_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF, SEL_OFF,
+ SEL_OFF },
+ [BAR_COLOR_ORG_20_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, I_OFF,
+ ORG_I_ON, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_2ND_LED, SEL_BOTH, SEL_OFF, SEL_OFF,
+ SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_40_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_OFF, SEL_2ND_LED,
+ SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_60_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_2ND_LED,
+ SEL_BOTH, SEL_OFF, SEL_OFF },
+ [BAR_COLOR_GRN_80_PERCENT] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, I_OFF,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH,
+ SEL_OFF, SEL_2ND_LED },
+ [BAR_COLOR_GRN_FULL] = { 0x00, 0x00, ENABLE_LIGHTBAR, GRN_I_ON, I_OFF,
+ I_OFF, I_OFF, I_OFF, I_OFF, SEL_BOTH, SEL_BOTH,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH },
+ [BAR_COLOR_ORG_FULL] = { 0x00, 0x00, ENABLE_LIGHTBAR, I_OFF, ORG_I_ON,
+ I_OFF, I_OFF, I_OFF, I_OFF, SEL_BOTH, SEL_BOTH,
+ SEL_BOTH, SEL_BOTH, SEL_BOTH, SEL_BOTH }
};
/*
@@ -462,7 +436,7 @@ static void lightbar_set_color(enum ec_lightbar_colors color)
controller_write(i, lightbar_ctrl[color][i]);
controller_write(KTD20XX_CTRL_CFG,
- lightbar_ctrl[color][KTD20XX_CTRL_CFG]);
+ lightbar_ctrl[color][KTD20XX_CTRL_CFG]);
i2c_lock(I2C_PORT_LIGHTBAR, 0);
}
@@ -519,10 +493,10 @@ static void lightbar_sleep_exit(void)
DECLARE_HOOK(HOOK_CHIPSET_RESUME, lightbar_sleep_exit, HOOK_PRIO_DEFAULT);
-#define LB_BAT_THRESHOLD_1 16
-#define LB_BAT_THRESHOLD_2 40
-#define LB_BAT_THRESHOLD_3 60
-#define LB_BAT_THRESHOLD_4 80
+#define LB_BAT_THRESHOLD_1 16
+#define LB_BAT_THRESHOLD_2 40
+#define LB_BAT_THRESHOLD_3 60
+#define LB_BAT_THRESHOLD_4 80
static enum lightbar_states lightbar_get_state(void)
{
@@ -536,7 +510,7 @@ static enum lightbar_states lightbar_get_state(void)
if (lightbar_resume_tick) {
if ((battery_is_present() == BP_YES) &&
- charge_get_display_charge()) {
+ charge_get_display_charge()) {
if (cur_bat_percent < LB_BAT_THRESHOLD_1)
new_state = LB_STATE_S0_BAT_LOW;
else if (cur_bat_percent < LB_BAT_THRESHOLD_2)
@@ -557,7 +531,7 @@ static enum lightbar_states lightbar_get_state(void)
if (extpower_is_present()) {
if ((battery_is_present() == BP_YES) &&
- charge_get_display_charge()) {
+ charge_get_display_charge()) {
if (cur_bat_percent < LB_BAT_THRESHOLD_1)
new_state = LB_STATE_SLEEP_AC_BAT_LOW;
else if (cur_bat_percent < LB_BAT_THRESHOLD_2)
@@ -607,15 +581,14 @@ static void lightbar_update(void)
if (lightbar_resume_tick)
lightbar_resume_tick--;
- if (desired_state != lb_cur_state &&
- desired_state < LB_NUM_STATES) {
+ if (desired_state != lb_cur_state && desired_state < LB_NUM_STATES) {
/* State is changing */
lb_cur_state = desired_state;
/* Reset ticks and period when state changes */
ticks = 0;
period = lb_table[lb_cur_state][LIGHTBAR_PHASE_0].ticks +
- lb_table[lb_cur_state][LIGHTBAR_PHASE_1].ticks;
+ lb_table[lb_cur_state][LIGHTBAR_PHASE_1].ticks;
/*
* System will be waken up when AC status change in S0ix. Due to
@@ -630,7 +603,8 @@ static void lightbar_update(void)
/* If this state is undefined, turn lightbar off */
if (period == 0) {
CPRINTS("Undefined lightbar behavior for lightbar state %d,"
- "turning off lightbar", lb_cur_state);
+ "turning off lightbar",
+ lb_cur_state);
lightbar_set_color(BAR_OFF);
return;
}
@@ -649,7 +623,6 @@ static void lightbar_update(void)
/* Set the color for the given state and phase */
lightbar_set_color(lb_table[lb_cur_state][phase].color);
-
}
DECLARE_HOOK(HOOK_TICK, lightbar_update, HOOK_PRIO_DEFAULT);
@@ -663,17 +636,15 @@ static void lightbar_dump_status(void)
int cbi_ssfc_lightbar;
ccprintf("lightbar is %ssupported, %sabled, auto_control: %sabled\n",
- lightbar_is_supported()?"":"un-",
- lightbar_is_enabled()?"en":"dis",
- lightbar_is_auto_control()?"en":"dis");
+ lightbar_is_supported() ? "" : "un-",
+ lightbar_is_enabled() ? "en" : "dis",
+ lightbar_is_auto_control() ? "en" : "dis");
cbi_bid = get_board_id();
cbi_get_sku_id(&cbi_skuid);
cbi_ssfc_lightbar = get_cbi_ssfc_lightbar();
- ccprintf("board id = %d, skuid = %d, ssfc_lightbar = %d\n",
- cbi_bid,
- cbi_skuid,
- cbi_ssfc_lightbar);
+ ccprintf("board id = %d, skuid = %d, ssfc_lightbar = %d\n", cbi_bid,
+ cbi_skuid, cbi_ssfc_lightbar);
}
#ifdef CONFIG_CONSOLE_CMDHELP
@@ -682,16 +653,16 @@ static int help(const char *cmd)
ccprintf("Usage:\n");
ccprintf(" %s - dump lightbar status\n", cmd);
ccprintf(" %s on - set on lightbar auto control\n",
- cmd);
+ cmd);
ccprintf(" %s off - set off lightbar auto control\n",
- cmd);
- ccprintf(" %s demo [%x - %x] - demo lightbar state\n",
- cmd, LB_STATE_OFF, (LB_NUM_STATES - 1));
+ cmd);
+ ccprintf(" %s demo [%x - %x] - demo lightbar state\n", cmd,
+ LB_STATE_OFF, (LB_NUM_STATES - 1));
return EC_SUCCESS;
}
#endif
-static int command_lightbar(int argc, char **argv)
+static int command_lightbar(int argc, const char **argv)
{
/* no args = dump lightbar status */
if (argc == 1) {
@@ -700,9 +671,9 @@ static int command_lightbar(int argc, char **argv)
}
if (!strcasecmp(argv[1], "help")) {
- #ifdef CONFIG_CONSOLE_CMDHELP
+#ifdef CONFIG_CONSOLE_CMDHELP
help(argv[0]);
- #endif
+#endif
return EC_SUCCESS;
}
@@ -744,8 +715,7 @@ static int command_lightbar(int argc, char **argv)
return EC_ERROR_INVAL;
}
-DECLARE_CONSOLE_COMMAND(lightbar, command_lightbar,
- "[help | on | off | demo]",
+DECLARE_CONSOLE_COMMAND(lightbar, command_lightbar, "[help | on | off | demo]",
"get/set lightbar status");
/****************************************************************************/
@@ -788,6 +758,4 @@ static enum ec_status lpc_cmd_lightbar(struct host_cmd_handler_args *args)
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_LIGHTBAR_CMD,
- lpc_cmd_lightbar,
- EC_VER_MASK(0));
+DECLARE_HOST_COMMAND(EC_CMD_LIGHTBAR_CMD, lpc_cmd_lightbar, EC_VER_MASK(0));
diff --git a/board/madoo/battery.c b/board/madoo/battery.c
index 92afe149f3..b37cb463dd 100644
--- a/board/madoo/battery.c
+++ b/board/madoo/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,7 +12,7 @@
#include "extpower.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHUTDOWN_DATA 0x0010
const struct board_batt_params board_battery_info[] = {
[BATTERY_SIMPLO_HIGHPOWER] = {
diff --git a/board/madoo/board.c b/board/madoo/board.c
index 2f465a81f0..eedf8e6fdd 100644
--- a/board/madoo/board.c
+++ b/board/madoo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,8 +46,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -87,7 +87,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -122,7 +121,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
-
}
static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
@@ -237,8 +235,7 @@ __override void board_power_5v_enable(int enable)
set_5v_gpio(!!enable);
if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTS("Failed to %sable sub rails!", enable ? "en" : "dis");
}
int board_is_sourcing_vbus(int port)
@@ -247,13 +244,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -317,8 +312,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -344,17 +339,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct accelgyro_saved_data_t g_bma253_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
@@ -434,20 +425,19 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -522,31 +512,43 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usbc0_retimer = {
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
+const struct usb_mux_chain usbc0_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ },
};
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ },
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
}
};
@@ -554,10 +556,10 @@ static void reconfigure_usbmux(void)
{
if (system_get_board_version() < 2) {
CPRINTS("add redriver at usbc0");
- usb_muxes[0].next_mux = &usbc0_retimer;
+ usb_muxes[0].next = &usbc0_retimer;
}
}
-DECLARE_HOOK(HOOK_INIT, reconfigure_usbmux, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, reconfigure_usbmux, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
diff --git a/board/madoo/board.h b/board/madoo/board.h
index 1a0e37ac90..82cfa30b0e 100644
--- a/board/madoo/board.h
+++ b/board/madoo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,11 +13,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
/* EC console commands */
#define CONFIG_CMD_TCPC_DUMP
@@ -31,7 +34,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
/* USB */
#define CONFIG_BC12_DETECT_PI3USB9201
@@ -58,16 +61,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -75,16 +78,15 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
@@ -119,25 +121,16 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
diff --git a/board/madoo/build.mk b/board/madoo/build.mk
index cd002a20e7..1531d1f3ae 100644
--- a/board/madoo/build.mk
+++ b/board/madoo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/madoo/cbi_ssfc.c b/board/madoo/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/madoo/cbi_ssfc.c
+++ b/board/madoo/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/madoo/cbi_ssfc.h b/board/madoo/cbi_ssfc.h
index 873b90f993..13800bcc85 100644
--- a/board/madoo/cbi_ssfc.h
+++ b/board/madoo/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -57,5 +57,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/madoo/ec.tasklist b/board/madoo/ec.tasklist
index 0aba1fabeb..ba5855412d 100644
--- a/board/madoo/ec.tasklist
+++ b/board/madoo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/madoo/gpio.inc b/board/madoo/gpio.inc
index b26c7814ce..d3eb97ed11 100644
--- a/board/madoo/gpio.inc
+++ b/board/madoo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/madoo/led.c b/board/madoo/led.c
index aef7b0e425..90cd0ab210 100644
--- a/board/madoo/led.c
+++ b/board/madoo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,8 +14,8 @@
#include "hooks.h"
#include "system.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -23,34 +23,40 @@ __override const int led_charge_lvl_2 = 100;
/* madoo: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- /* STATE_DISCHARGE_S3 will changed if sku is clamshells */
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ /* STATE_DISCHARGE_S3 will changed if sku is clamshells */
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 1 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -77,8 +83,8 @@ int battery_safety_check(void)
return false;
/* turn off LED due to a safety fault */
- rv = sb_read_mfgacc(PARAM_SAFETY_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_SAFETY_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return false;
/*
@@ -111,7 +117,7 @@ __override void led_set_color_battery(enum ec_led_colors color)
gpio_set_level(GPIO_BAT_LED_WHITE_L, LED_OFF_LVL);
gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL);
} else if (charge_manager_get_active_charge_port() == 1 ||
- system_get_board_version() < 3) {
+ system_get_board_version() < 3) {
gpio_set_level(GPIO_BAT_LED_WHITE_L, LED_ON_LVL);
gpio_set_level(GPIO_BAT_LED_AMBER_L, LED_OFF_LVL);
} else if (charge_manager_get_active_charge_port() == 0) {
@@ -125,11 +131,11 @@ __override void led_set_color_battery(enum ec_led_colors color)
gpio_set_level(GPIO_BAT_LED_AMBER_L, LED_OFF_LVL);
gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_OFF_LVL);
} else if (charge_get_state() == PWR_STATE_ERROR &&
- system_get_board_version() >= 3) {
+ system_get_board_version() >= 3) {
gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL);
gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_ON_LVL);
} else if (charge_manager_get_active_charge_port() == 1 ||
- system_get_board_version() < 3) {
+ system_get_board_version() < 3) {
gpio_set_level(GPIO_BAT_LED_WHITE_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_AMBER_L, LED_ON_LVL);
gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_OFF_LVL);
@@ -137,7 +143,7 @@ __override void led_set_color_battery(enum ec_led_colors color)
gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL);
gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_ON_LVL);
} else if (charge_get_percent() <
- CONFIG_LED_ONOFF_STATES_BAT_LOW) {
+ CONFIG_LED_ONOFF_STATES_BAT_LOW) {
gpio_set_level(GPIO_EC_CHG_LED_R_W, LED_OFF_LVL);
gpio_set_level(GPIO_EC_CHG_LED_R_Y, LED_ON_LVL);
}
diff --git a/board/madoo/usb_pd_policy.c b/board/madoo/usb_pd_policy.c
index 02bb449f60..2bad4d6931 100644
--- a/board/madoo/usb_pd_policy.c
+++ b/board/madoo/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/magolor/battery.c b/board/magolor/battery.c
index 84f75732ec..e9bacbbf58 100644
--- a/board/magolor/battery.c
+++ b/board/magolor/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/magolor/board.c b/board/magolor/board.c
index 710a94f54a..bfa77375e5 100644
--- a/board/magolor/board.c
+++ b/board/magolor/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -52,13 +52,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
-#define ADC_VOL_UP_MASK BIT(0)
-#define ADC_VOL_DOWN_MASK BIT(1)
+#define ADC_VOL_UP_MASK BIT(0)
+#define ADC_VOL_DOWN_MASK BIT(1)
static uint8_t new_adc_key_state;
@@ -165,8 +165,7 @@ static const struct ec_response_keybd_config magma_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override
-uint8_t board_keyboard_row_refresh(void)
+__override uint8_t board_keyboard_row_refresh(void)
{
if (gpio_get_level(GPIO_EC_VIVALDIKEYBOARD_ID))
return 3;
@@ -174,16 +173,15 @@ uint8_t board_keyboard_row_refresh(void)
return 2;
}
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (get_cbi_fw_config_numeric_pad()) {
if (gpio_get_level(GPIO_EC_VIVALDIKEYBOARD_ID))
return &magma_keybd;
else
return &magpie_keybd;
- }
- else {
+ } else {
if (gpio_get_level(GPIO_EC_VIVALDIKEYBOARD_ID))
return &magister_keybd;
else
@@ -198,16 +196,15 @@ __override const struct ec_response_keybd_config
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* C0 interrupt line shared by BC 1.2 and charger */
static void check_c0_line(void);
@@ -245,7 +242,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -326,22 +322,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
@@ -358,8 +354,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -443,7 +439,7 @@ static void reconfigure_5v_gpio(void)
gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_OUT_LOW);
}
}
-DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C + 1);
#endif /* BOARD_WADDLEDOO */
static void set_5v_gpio(int level)
@@ -492,8 +488,8 @@ __override void board_power_5v_enable(int enable)
gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
} else {
if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTS("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
if (!enable)
return;
@@ -503,7 +499,7 @@ __override void board_power_5v_enable(int enable)
*/
if (get_cbi_ssfc_usb_mux() == SSFC_USBMUX_PS8762)
hook_call_deferred(&ps8762_chaddr_deferred_data,
- 15 * MSEC);
+ 15 * MSEC);
}
}
@@ -529,13 +525,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -599,8 +593,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -625,25 +619,18 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Matrices to rotate accelerometers into the magister reference. */
-static const mat33_fp_t lid_magister_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_magister_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* BMA253 private data */
static struct accelgyro_saved_data_t g_bma253_data;
@@ -652,11 +639,9 @@ static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
#ifdef BOARD_MAGOLOR
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* ICM426 private data */
static struct icm_drv_data_t g_icm426xx_data;
@@ -814,7 +799,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
static void pendetect_deferred(void)
{
int pen_charge_enable = !gpio_get_level(GPIO_PEN_DET_ODL) &&
- !chipset_in_state(CHIPSET_STATE_ANY_OFF);
+ !chipset_in_state(CHIPSET_STATE_ANY_OFF);
if (pen_charge_enable)
gpio_set_level(GPIO_EN_PP5000_PEN, 1);
@@ -839,15 +824,21 @@ static void pen_charge_check(void)
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pen_charge_check, HOOK_PRIO_LAST);
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pen_charge_check, HOOK_PRIO_LAST);
-
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration
*/
+struct usb_mux usbc1_mux0 = {
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM,
+ .driver = &ps8802_usb_mux_driver,
+};
+
static void setup_mux(void)
{
if (get_cbi_ssfc_usb_mux() == SSFC_USBMUX_PS8743) {
- usb_muxes[USBC_PORT_C1].i2c_addr_flags = PS8743_I2C_ADDR0_FLAG;
- usb_muxes[USBC_PORT_C1].driver = &ps8743_usb_mux_driver;
+ usbc1_mux0.i2c_addr_flags = PS8743_I2C_ADDR0_FLAG;
+ usbc1_mux0.driver = &ps8743_usb_mux_driver;
ccprints("PS8743 USB MUX");
} else
ccprints("PS8762 USB MUX");
@@ -862,16 +853,17 @@ void board_init(void)
if (get_cbi_fw_config_db() == DB_1A_HDMI) {
/* Disable i2c on HDMI pins */
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0);
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
+ 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
+ 0);
/* Set HDMI and sub-rail enables to output */
gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
chipset_in_state(CHIPSET_STATE_ON) ?
- GPIO_ODR_LOW : GPIO_ODR_HIGH);
- gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
+ GPIO_ODR_LOW :
+ GPIO_ODR_HIGH);
+ gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
/* Select HDMI option */
gpio_set_level(GPIO_HDMI_SEL_L, 0);
@@ -881,8 +873,7 @@ void board_init(void)
} else {
/* Set SDA as an input */
- gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
- GPIO_INPUT);
+ gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, GPIO_INPUT);
/* Enable C1 interrupt and check if it needs processing */
gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
@@ -907,8 +898,8 @@ void board_init(void)
ccprints("LID_ACCEL is KX022");
} else {
if (system_get_board_version() >= 5) {
- motion_sensors[LID_ACCEL]
- .rot_standard_ref = &lid_magister_ref;
+ motion_sensors[LID_ACCEL].rot_standard_ref =
+ &lid_magister_ref;
}
ccprints("LID_ACCEL is BMA253");
}
@@ -921,7 +912,7 @@ void board_init(void)
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
}
if (get_cbi_fw_config_stylus() == STYLUS_PRESENT) {
@@ -930,8 +921,7 @@ void board_init(void)
pen_charge_check();
} else {
gpio_disable_interrupt(GPIO_PEN_DET_ODL);
- gpio_set_flags(GPIO_PEN_DET_ODL,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_PEN_DET_ODL, GPIO_INPUT | GPIO_PULL_DOWN);
}
/* Turn on 5V if the system is on, otherwise turn it off. */
@@ -944,32 +934,30 @@ void board_init(void)
#ifdef BOARD_MAGOLOR
/* Support Keyboard Pad */
- board_update_no_keypad_by_fwconfig();
+ board_update_no_keypad_by_fwconfig();
#endif
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void motion_interrupt(enum gpio_signal signal)
{
#ifdef BOARD_MAGOLOR
- switch (get_cbi_ssfc_base_sensor()) {
- case SSFC_SENSOR_ICM426XX:
- icm426xx_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI160:
- default:
- bmi160_interrupt(signal);
- break;
- }
- #else
+ switch (get_cbi_ssfc_base_sensor()) {
+ case SSFC_SENSOR_ICM426XX:
+ icm426xx_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI160:
+ default:
bmi160_interrupt(signal);
+ break;
+ }
+#else
+ bmi160_interrupt(signal);
#endif
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -1045,18 +1033,17 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USBC_PORT_C0] = {
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux = &(const struct usb_mux) {
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM,
- .driver = &ps8802_usb_mux_driver,
+ .mux = &usbc1_mux0,
}
};
@@ -1082,7 +1069,7 @@ uint16_t tcpc_get_alert_status(void)
}
if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
+ !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
diff --git a/board/magolor/board.h b/board/magolor/board.h
index 40391d16c6..481856323f 100644
--- a/board/magolor/board.h
+++ b/board/magolor/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,11 +34,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_CMD_CHARGER_DUMP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -59,7 +62,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -98,16 +101,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -125,18 +128,18 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#ifdef BOARD_MAGOLOR
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
#endif
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -174,25 +177,16 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
@@ -208,11 +202,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void motion_interrupt(enum gpio_signal signal);
void pen_detect_interrupt(enum gpio_signal s);
diff --git a/board/magolor/build.mk b/board/magolor/build.mk
index fcf5dec3ed..c69e903608 100644
--- a/board/magolor/build.mk
+++ b/board/magolor/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/magolor/cbi_ssfc.c b/board/magolor/cbi_ssfc.c
index 7708bb9905..155ecae6bf 100644
--- a/board/magolor/cbi_ssfc.c
+++ b/board/magolor/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,15 +27,15 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
enum ec_ssfc_usb_mux get_cbi_ssfc_usb_mux(void)
{
- return (enum ec_ssfc_usb_mux) cached_ssfc.usb_mux;
+ return (enum ec_ssfc_usb_mux)cached_ssfc.usb_mux;
}
diff --git a/board/magolor/cbi_ssfc.h b/board/magolor/cbi_ssfc.h
index f59d165071..78e32f5810 100644
--- a/board/magolor/cbi_ssfc.h
+++ b/board/magolor/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,12 +45,12 @@ union dedede_cbi_ssfc {
struct {
uint32_t base_sensor : 3;
uint32_t lid_sensor : 3;
- uint32_t cam_wfc: 3;
- uint32_t cam_ufc: 2;
- uint32_t cam_vcm: 2;
- uint32_t TS_Source: 4;
- uint32_t AUDIO_CODEC_SOURCE: 3;
- uint32_t usb_mux: 2;
+ uint32_t cam_wfc : 3;
+ uint32_t cam_ufc : 2;
+ uint32_t cam_vcm : 2;
+ uint32_t TS_Source : 4;
+ uint32_t AUDIO_CODEC_SOURCE : 3;
+ uint32_t usb_mux : 2;
uint32_t reserved_2 : 10;
};
uint32_t raw_value;
diff --git a/board/magolor/ec.tasklist b/board/magolor/ec.tasklist
index 0aba1fabeb..ba5855412d 100644
--- a/board/magolor/ec.tasklist
+++ b/board/magolor/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/magolor/gpio.inc b/board/magolor/gpio.inc
index 00a6b4effc..77cf523de1 100644
--- a/board/magolor/gpio.inc
+++ b/board/magolor/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/magolor/led.c b/board/magolor/led.c
index 5206244073..891bc4cecb 100644
--- a/board/magolor/led.c
+++ b/board/magolor/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/magolor/usb_pd_policy.c b/board/magolor/usb_pd_policy.c
index 02bb449f60..2bad4d6931 100644
--- a/board/magolor/usb_pd_policy.c
+++ b/board/magolor/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/makomo/battery.c b/board/makomo/battery.c
index 1b162e93c7..1f5be3dbe3 100644
--- a/board/makomo/battery.c
+++ b/board/makomo/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/makomo/board.c b/board/makomo/board.c
index e50f84f3fb..24b34d9a75 100644
--- a/board/makomo/board.c
+++ b/board/makomo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,6 +31,7 @@
#include "keyboard_scan.h"
#include "keyboard_backlight.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -45,8 +46,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -58,40 +59,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -99,8 +94,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -156,8 +151,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -170,13 +164,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -238,12 +235,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -300,8 +297,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -315,8 +311,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -355,17 +350,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1) }
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
/* Lid accel private data */
@@ -453,7 +444,7 @@ struct motion_sensor_t motion_sensors[] = {
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct it8801_pwm_t it8801_pwm_channels[] = {
- [IT8801_PWM_CH_KBLIGHT] = {.index = 4},
+ [IT8801_PWM_CH_KBLIGHT] = { .index = 4 },
};
void board_kblight_init(void)
@@ -469,11 +460,11 @@ bool board_has_kb_backlight(void)
#endif /* !VARIANT_KUKUI_NO_SENSORS */
/* Battery functions */
-#define SB_SMARTCHARGE 0x26
+#define SB_SMARTCHARGE 0x26
/* Quick charge enable bit */
-#define SMART_QUICK_CHARGE 0x02
+#define SMART_QUICK_CHARGE 0x02
/* Quick charge support bit */
-#define MODE_QUICK_CHARGE_SUPPORT 0x01
+#define MODE_QUICK_CHARGE_SUPPORT 0x01
static void sb_quick_charge_mode(int enable)
{
@@ -544,8 +535,8 @@ int board_get_battery_i2c(void)
}
#ifdef SECTION_IS_RW
-static int it8801_get_target_channel(enum pwm_channel *channel,
- int type, int index)
+static int it8801_get_target_channel(enum pwm_channel *channel, int type,
+ int index)
{
switch (type) {
case EC_PWM_TYPE_GENERIC:
@@ -568,14 +559,13 @@ host_command_pwm_set_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- duty = (uint32_t) p->duty * 255 / 65535;
+ duty = (uint32_t)p->duty * 255 / 65535;
it8801_pwm_set_raw_duty(channel, duty);
it8801_pwm_enable(channel, p->duty > 0);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
- host_command_pwm_set_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY, host_command_pwm_set_duty,
EC_VER_MASK(0));
static enum ec_status
@@ -589,12 +579,11 @@ host_command_pwm_get_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- r->duty = (uint32_t) it8801_pwm_get_raw_duty(channel) * 65535 / 255;
+ r->duty = (uint32_t)it8801_pwm_get_raw_duty(channel) * 65535 / 255;
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY,
- host_command_pwm_get_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY, host_command_pwm_get_duty,
EC_VER_MASK(0));
#endif
diff --git a/board/makomo/board.h b/board/makomo/board.h
index 9919557553..bf705e9560 100644
--- a/board/makomo/board.h
+++ b/board/makomo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -53,14 +53,13 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ALS
#define CONFIG_CMD_ACCEL_INFO
-
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
@@ -76,20 +75,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_BATTERY 2
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BATTERY 2
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/makomo/build.mk b/board/makomo/build.mk
index 04b88d3d79..5b31bc2d67 100644
--- a/board/makomo/build.mk
+++ b/board/makomo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/makomo/ec.tasklist b/board/makomo/ec.tasklist
index e943459024..23b568cb28 100644
--- a/board/makomo/ec.tasklist
+++ b/board/makomo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/makomo/gpio.inc b/board/makomo/gpio.inc
index 287ebbda1f..8cbdef529e 100644
--- a/board/makomo/gpio.inc
+++ b/board/makomo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/makomo/led.c b/board/makomo/led.c
index 140c31babe..0870806eff 100644
--- a/board/makomo/led.c
+++ b/board/makomo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,33 +18,38 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
-led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/marzipan/battery.c b/board/marzipan/battery.c
index 3a9a1cbaf1..fa3a4ec189 100644
--- a/board/marzipan/battery.c
+++ b/board/marzipan/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/marzipan/board.c b/board/marzipan/board.c
index e5e12a1afc..125c39a826 100644
--- a/board/marzipan/board.c
+++ b/board/marzipan/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,8 +39,8 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#include "gpio_list.h"
@@ -91,10 +91,8 @@ __override struct keyboard_scan_config keyscan_config = {
* Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key);
* as it still uses the legacy location (KSO_01/KSI_00).
*/
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -105,41 +103,31 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -147,37 +135,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -190,16 +163,12 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -230,16 +199,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -271,29 +246,21 @@ enum base_accelgyro_type {
};
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref_bmi160 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_bmi160 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref_icm426xx = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref_icm426xx = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref_bma255 = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref_bma255 = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref_kx022 = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref_kx022 = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -465,7 +432,7 @@ static void board_detect_motionsensor(void)
/* Check lid accel chip */
ret = i2c_read8(I2C_PORT_SENSOR, BMA2x2_I2C_ADDR1_FLAGS,
- BMA2x2_CHIP_ID_ADDR, &val);
+ BMA2x2_CHIP_ID_ADDR, &val);
if (ret)
motion_sensors[LID_ACCEL] = kx022_lid_accel;
@@ -478,10 +445,11 @@ static void board_detect_motionsensor(void)
motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
}
- base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608)
- ? BASE_GYRO_ICM426XX : BASE_GYRO_BMI160;
- CPRINTS("Base Accelgyro: %s", (val == ICM426XX_CHIP_ICM40608)
- ? "ICM40608" : "BMI160");
+ base_accelgyro_config = (val == ICM426XX_CHIP_ICM40608) ?
+ BASE_GYRO_ICM426XX :
+ BASE_GYRO_BMI160;
+ CPRINTS("Base Accelgyro: %s",
+ (val == ICM426XX_CHIP_ICM40608) ? "ICM40608" : "BMI160");
}
/* Initialize board. */
@@ -539,9 +507,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
@@ -606,8 +574,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -635,7 +602,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -659,23 +625,21 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/marzipan/board.h b/board/marzipan/board.h
index 28dc5d273a..c651e55965 100644
--- a/board/marzipan/board.h
+++ b/board/marzipan/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,7 +11,7 @@
#include "baseboard.h"
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Keyboard */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
@@ -19,7 +19,7 @@
#define CONFIG_PWM_KBLIGHT
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
@@ -71,12 +71,7 @@
#include "gpio_signal.h"
#include "registers.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -86,11 +81,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/marzipan/build.mk b/board/marzipan/build.mk
index 09853a26d7..048f0787f7 100644
--- a/board/marzipan/build.mk
+++ b/board/marzipan/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/marzipan/ec.tasklist b/board/marzipan/ec.tasklist
index 5beeb38feb..228828af3c 100644
--- a/board/marzipan/ec.tasklist
+++ b/board/marzipan/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/marzipan/gpio.inc b/board/marzipan/gpio.inc
index 11fa6b5a53..633f689c66 100644
--- a/board/marzipan/gpio.inc
+++ b/board/marzipan/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/marzipan/led.c b/board/marzipan/led.c
index e4b34576c8..0a6d8df959 100644
--- a/board/marzipan/led.c
+++ b/board/marzipan/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -32,15 +32,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C1,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_B_C1,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -66,7 +66,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -106,16 +105,16 @@ static void board_led_set_battery(void)
color = LED_BLUE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Amber 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_AMBER;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Amber 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/marzipan/switchcap.c b/board/marzipan/switchcap.c
index 26009d55d8..853f677f27 100644
--- a/board/marzipan/switchcap.c
+++ b/board/marzipan/switchcap.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
#include "power/qcom.h"
#include "system.h"
-#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_I2C, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_I2C, format, ##args)
void board_set_switchcap_power(int enable)
{
diff --git a/board/marzipan/usbc_config.c b/board/marzipan/usbc_config.c
index e8fc9e76a3..5b41e22d33 100644
--- a/board/marzipan/usbc_config.c
+++ b/board/marzipan/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "usb_pd.h"
#include "usbc_config.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/marzipan/usbc_config.h b/board/marzipan/usbc_config.h
index 7f72b01700..56cdb155ea 100644
--- a/board/marzipan/usbc_config.h
+++ b/board/marzipan/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/max32660-eval/board.c b/board/max32660-eval/board.c
index 15a856ab4e..91e78287f3 100644
--- a/board/max32660-eval/board.c
+++ b/board/max32660-eval/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/max32660-eval/board.h b/board/max32660-eval/board.h
index bcca57f18a..9061b0b958 100644
--- a/board/max32660-eval/board.h
+++ b/board/max32660-eval/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/max32660-eval/build.mk b/board/max32660-eval/build.mk
index a613922cd2..3e50dd9a00 100644
--- a/board/max32660-eval/build.mk
+++ b/board/max32660-eval/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/max32660-eval/ec.tasklist b/board/max32660-eval/ec.tasklist
index 5e58b9dea8..c92b25295b 100644
--- a/board/max32660-eval/ec.tasklist
+++ b/board/max32660-eval/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/max32660-eval/gpio.inc b/board/max32660-eval/gpio.inc
index 3ced37a77f..e7397e11a4 100644
--- a/board/max32660-eval/gpio.inc
+++ b/board/max32660-eval/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mchpevb1/battery.c b/board/mchpevb1/battery.c
index fcc09994bf..d8f7496fa0 100644
--- a/board/mchpevb1/battery.c
+++ b/board/mchpevb1/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,15 +14,15 @@
#include "util.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define PARAM_CUT_OFF_LOW 0x10
+#define PARAM_CUT_OFF_LOW 0x10
#define PARAM_CUT_OFF_HIGH 0x00
/* Battery info for BQ40Z55 */
static const struct battery_info info = {
- .voltage_max = 8700, /* mV */
+ .voltage_max = 8700, /* mV */
.voltage_normal = 7600,
.voltage_min = 6000,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 46,
.charging_min_c = 0,
@@ -47,10 +47,10 @@ int board_cut_off_battery(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
- buf, 3, NULL, 0, I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
- buf, 3, NULL, 0, I2C_XFER_SINGLE);
+ rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, 3,
+ NULL, 0, I2C_XFER_SINGLE);
+ rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, 3,
+ NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
@@ -214,7 +214,7 @@ enum ec_status charger_profile_override_set_param(uint32_t param,
return EC_RES_INVALID_PARAM;
}
-static int command_fastcharge(int argc, char **argv)
+static int command_fastcharge(int argc, const char **argv)
{
if (argc > 1 && !parse_bool(argv[1], &fast_charging_allowed))
return EC_ERROR_PARAM1;
@@ -223,8 +223,7 @@ static int command_fastcharge(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(fastcharge, command_fastcharge,
- "[on|off]",
+DECLARE_CONSOLE_COMMAND(fastcharge, command_fastcharge, "[on|off]",
"Get or set fast charging profile");
-#endif /* CONFIG_CHARGER_PROFILE_OVERRIDE */
+#endif /* CONFIG_CHARGER_PROFILE_OVERRIDE */
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index 2991b59299..23135108f6 100644
--- a/board/mchpevb1/board.c
+++ b/board/mchpevb1/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -58,26 +58,25 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_LPC, outstr)
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
-
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* NOTE: MEC17xx EVB + SKL RVP3 does not use BD99992 PMIC.
* RVP3 PMIC controlled by RVP3 logic.
*/
-#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_BD99992_FLAGS 0x30
/*
* Maxim DS1624 I2C temperature sensor used for testing I2C.
* DS1624 contains one internal temperature sensor
* and EEPROM. It has no external temperature inputs.
*/
-#define DS1624_I2C_ADDR_FLAGS (0x48 | I2C_FLAG_BIG_ENDIAN)
-#define DS1624_IDX_LOCAL 0
-#define DS1624_READ_TEMP16 0xAA /* read 16-bit temperature */
-#define DS1624_ACCESS_CFG 0xAC /* read/write 8-bit config */
-#define DS1624_CMD_START 0xEE
-#define DS1624_CMD_STOP 0x22
+#define DS1624_I2C_ADDR_FLAGS (0x48 | I2C_FLAG_BIG_ENDIAN)
+#define DS1624_IDX_LOCAL 0
+#define DS1624_READ_TEMP16 0xAA /* read 16-bit temperature */
+#define DS1624_ACCESS_CFG 0xAC /* read/write 8-bit config */
+#define DS1624_CMD_START 0xEE
+#define DS1624_CMD_STOP 0x22
/*
* static global and routine to return smart battery
@@ -116,7 +115,6 @@ void board_config_pre_init(void)
}
#endif /* #ifdef CONFIG_BOARD_PRE_INIT */
-
/*
* Use EC to handle ALL_SYS_PWRGD signal.
* MEC17xx connected to SKL/KBL RVP3 reference board
@@ -135,8 +133,8 @@ static void board_all_sys_pwrgd(void)
CPRINTS("ALL_SYS_PWRGD=%d SYS_RESET_L=%d", allsys_in, allsys_out);
- trace2(0, BRD, 0, "ALL_SYS_PWRGD=%d SYS_RESET_L=%d",
- allsys_in, allsys_out);
+ trace2(0, BRD, 0, "ALL_SYS_PWRGD=%d SYS_RESET_L=%d", allsys_in,
+ allsys_out);
/*
* Wait at least 10 ms between power signals going high
@@ -161,14 +159,12 @@ void all_sys_pwrgd_interrupt(enum gpio_signal signal)
}
#endif /* #ifdef CONFIG_BOARD_HAS_ALL_SYS_PWRGD */
-
#ifdef HAS_TASK_PDCMD
/* Exchange status with PD MCU. */
static void pd_mcu_interrupt(enum gpio_signal signal)
{
/* Exchange status with PD MCU to determine interrupt cause */
host_command_pd_send_status(0);
-
}
#endif
@@ -217,33 +213,29 @@ void tablet_mode_interrupt(enum gpio_signal signal)
*/
const struct adc_t adc_channels[] = {
/* Vbus sensing. Converted to mV, full ADC is equivalent to 30V. */
- [ADC_VBUS] = {"VBUS", 30000, 1024, 0, 1},
+ [ADC_VBUS] = { "VBUS", 30000, 1024, 0, 1 },
/* Adapter current output or battery discharging current */
- [ADC_AMON_BMON] = {"AMON_BMON", 25000, 3072, 0, 3},
+ [ADC_AMON_BMON] = { "AMON_BMON", 25000, 3072, 0, 3 },
/* System current consumption */
- [ADC_PSYS] = {"PSYS", 1, 1, 0, 4},
- [ADC_CASE] = {"CASE", 1, 1, 0, 7},
+ [ADC_PSYS] = { "PSYS", 1, 1, 0, 4 },
+ [ADC_CASE] = { "CASE", 1, 1, 0, 7 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/*
* MCHP EVB connected to KBL RVP3
*/
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "sensors",
- .port = MCHP_I2C_PORT4,
- .kbps = 100,
- .scl = GPIO_SMB04_SCL,
- .sda = GPIO_SMB04_SDA
- },
- {
- .name = "batt",
- .port = MCHP_I2C_PORT5,
- .kbps = 100,
- .scl = GPIO_SMB05_SCL,
- .sda = GPIO_SMB05_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "sensors",
+ .port = MCHP_I2C_PORT4,
+ .kbps = 100,
+ .scl = GPIO_SMB04_SCL,
+ .sda = GPIO_SMB04_SDA },
+ { .name = "batt",
+ .port = MCHP_I2C_PORT5,
+ .kbps = 100,
+ .scl = GPIO_SMB05_SCL,
+ .sda = GPIO_SMB05_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -273,19 +265,15 @@ int board_i2c_p2c(int port)
#ifdef CONFIG_USB_POWER_DELIVERY
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {I2C_PORT_TCPC,
- CONFIG_TCPC_I2C_BASE_ADDR_FLAGS,
- &tcpci_tcpm_drv},
+ { I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR_FLAGS, &tcpci_tcpm_drv },
- {I2C_PORT_TCPC,
- CONFIG_TCPC_I2C_BASE_ADDR_FLAGS + 1,
- &tcpci_tcpm_drv},
+ { I2C_PORT_TCPC, CONFIG_TCPC_I2C_BASE_ADDR_FLAGS + 1, &tcpci_tcpm_drv },
};
#endif
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { QMSPI0_PORT, 4, GPIO_QMSPI_CS0},
+ { QMSPI0_PORT, 4, GPIO_QMSPI_CS0 },
#if defined(CONFIG_SPI_ACCEL_PORT)
{ GPSPI0_PORT, 2, GPIO_SPI0_CS0 },
#endif
@@ -299,7 +287,6 @@ const enum gpio_signal hibernate_wake_pins[] = {
};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
-
/*
* Deep sleep support, called by chip level.
*/
@@ -362,18 +349,24 @@ struct pi3usb9281_config pi3usb9281_chips[] = {
BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = 0x10,
- .driver = &ps8740_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = 0x10,
+ .driver = &ps8740_usb_mux_driver,
+ },
}
};
#endif
@@ -429,9 +422,9 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
* a static global in this module.
*/
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, sb_temp, 0},
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, ds1624_get_val, 0},
- {"Case", TEMP_SENSOR_TYPE_CASE, therm_get_val, (int)ADC_CASE},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, sb_temp, 0 },
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, ds1624_get_val, 0 },
+ { "Case", TEMP_SENSOR_TYPE_CASE, therm_get_val, (int)ADC_CASE },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
#endif
@@ -440,16 +433,16 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
#ifdef CONFIG_ALS
/* ALS instances. Must be in same order as enum als_id. */
struct als_t als[] = {
- {"TI", opt3001_init, opt3001_read_lux, 5},
+ { "TI", opt3001_init, opt3001_read_lux, 5 },
};
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
#endif
const struct button_config buttons[CONFIG_BUTTON_COUNT] = {
- {"Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN, GPIO_VOLUME_DOWN_L,
- 30 * MSEC, 0},
- {"Volume Up", KEYBOARD_BUTTON_VOLUME_UP, GPIO_VOLUME_UP_L,
- 30 * MSEC, 0},
+ { "Volume Down", KEYBOARD_BUTTON_VOLUME_DOWN, GPIO_VOLUME_DOWN_L,
+ 30 * MSEC, 0 },
+ { "Volume Up", KEYBOARD_BUTTON_VOLUME_UP, GPIO_VOLUME_UP_L, 30 * MSEC,
+ 0 },
};
/* MCHP mec1701_evb connected to Intel SKL RVP3 with Kabylake
@@ -490,8 +483,7 @@ static void board_pmic_init(void)
cfg = 0x66;
rv = i2c_read8(I2C_PORT_THERMAL, DS1624_I2C_ADDR_FLAGS,
DS1624_ACCESS_CFG, &cfg);
- trace2(0, BRD, 0, "Read DS1624 Config rv = %d cfg = 0x%02X",
- rv, cfg);
+ trace2(0, BRD, 0, "Read DS1624 Config rv = %d cfg = 0x%02X", rv, cfg);
if ((rv == EC_SUCCESS) && (cfg & (1u << 0))) {
/* one-shot mode switch to continuous */
@@ -536,16 +528,13 @@ static void board_init(void)
/* Provide AC status to the PCH */
gpio_set_level(GPIO_PCH_ACOK, extpower_is_present());
- if (system_jumped_late() &&
- chipset_in_state(CHIPSET_STATE_ON)) {
+ if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON)) {
trace0(0, BRD, 0, "board_init: S0 call board_spi_enable");
board_spi_enable();
}
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
/**
* Buffer the AC present GPIO to the PCH.
*/
@@ -577,8 +566,7 @@ int board_set_active_charge_port(int charge_port)
if (is_real_port && source) {
CPRINTS("MEC1701 Skip enable p%d", charge_port);
- trace1(0, BOARD, 0, "Skip enable charge port %d",
- charge_port);
+ trace1(0, BOARD, 0, "Skip enable charge port %d", charge_port);
return EC_ERROR_INVAL;
}
@@ -592,10 +580,12 @@ int board_set_active_charge_port(int charge_port)
} else {
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_EN_L :
- GPIO_USB_C1_CHARGE_EN_L, 1);
+ GPIO_USB_C1_CHARGE_EN_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_EN_L :
- GPIO_USB_C0_CHARGE_EN_L, 0);
+ GPIO_USB_C0_CHARGE_EN_L,
+ 0);
}
return EC_SUCCESS;
@@ -609,23 +599,12 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
-{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
-}
-#else
-/*
- * TODO HACK providing functions from common/charge_state_v2.c
- * which is not compiled in when no charger
- */
-int charge_prevent_power_on(int power_button_pressed)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- return 0;
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
-
-
#endif
/*
@@ -657,23 +636,18 @@ static void board_chipset_startup(void)
gpio_set_level(GPIO_USB2_ENABLE, 1);
hook_call_deferred(&enable_input_devices_data, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S5 transition */
static void board_chipset_shutdown(void)
{
CPRINTS("MEC1701 HOOK_CHIPSET_SHUTDOWN board_chipset_shutdown");
- trace0(0, HOOK, 0,
- "HOOK_CHIPSET_SHUTDOWN board_chipset_shutdown");
+ trace0(0, HOOK, 0, "HOOK_CHIPSET_SHUTDOWN board_chipset_shutdown");
gpio_set_level(GPIO_USB1_ENABLE, 0);
gpio_set_level(GPIO_USB2_ENABLE, 0);
hook_call_deferred(&enable_input_devices_data, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_chipset_shutdown,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
@@ -685,10 +659,9 @@ static void board_chipset_resume(void)
gpio_set_level(GPIO_PP1800_DX_AUDIO_EN, 1);
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 1);
#endif
-
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume,
- MOTION_SENSE_HOOK_PRIO-1);
+ MOTION_SENSE_HOOK_PRIO - 1);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
@@ -701,9 +674,7 @@ static void board_chipset_suspend(void)
gpio_set_level(GPIO_PP1800_DX_SENSOR_EN, 0);
#endif
}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND,
- board_chipset_suspend,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
void board_hibernate_late(void)
{
@@ -780,7 +751,6 @@ static void board_handle_reboot(void)
}
DECLARE_HOOK(HOOK_INIT, board_handle_reboot, HOOK_PRIO_FIRST);
-
static int sb_temp(int idx, int *temp_ptr)
{
if (idx != 0)
@@ -817,8 +787,8 @@ static void sb_update(void)
rv = sb_read(SB_TEMPERATURE, &smart_batt_temp);
smart_batt_temp = smart_batt_temp / 10;
- trace12(0, BRD, 0, "sb_read temperature rv=%d temp=%d K",
- rv, smart_batt_temp);
+ trace12(0, BRD, 0, "sb_read temperature rv=%d temp=%d K", rv,
+ smart_batt_temp);
}
/*
diff --git a/board/mchpevb1/board.h b/board/mchpevb1/board.h
index e16d0bb10f..10208ca736 100644
--- a/board/mchpevb1/board.h
+++ b/board/mchpevb1/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -88,7 +88,6 @@
* #define EVB_NO_ESPI_TEST_MODE
*/
-
/*
* DEBUG
* Disable ARM Cortex-M4 write buffer so
@@ -104,7 +103,7 @@
* Values in MHz are 20, 25, 33, 50, and 66
*/
/* KBL + EVB fly-wire hook up only supports 20MHz */
-#define CONFIG_HOSTCMD_ESPI_EC_MAX_FREQ MCHP_ESPI_CAP1_MAX_FREQ_20M
+#define CONFIG_HOST_INTERFACE_ESPI_EC_MAX_FREQ MCHP_ESPI_CAP1_MAX_FREQ_20M
/*
* EC eSPI advertises IO lanes
@@ -114,7 +113,7 @@
* 3 = Single, Dual, and Quad
*/
/* KBL + EVB fly-wire hook up only support Single mode */
-#define CONFIG_HOSTCMD_ESPI_EC_MODE MCHP_ESPI_CAP1_SINGLE_MODE
+#define CONFIG_HOST_INTERFACE_ESPI_EC_MODE MCHP_ESPI_CAP1_SINGLE_MODE
/*
* Bit map of eSPI channels EC advertises
@@ -123,7 +122,7 @@
* bit[2] = 1 OOB channel
* bit[3] = 1 Flash channel
*/
-#define CONFIG_HOSTCMD_ESPI_EC_CHAN_BITMAP MCHP_ESPI_CAP0_ALL_CHAN_SUPP
+#define CONFIG_HOST_INTERFACE_ESPI_EC_CHAN_BITMAP MCHP_ESPI_CAP0_ALL_CHAN_SUPP
#define CONFIG_MCHP_ESPI_VW_SAVE_ON_SLEEP
@@ -146,7 +145,6 @@
/* #define CONFIG_CHARGE_MANAGER */
/* #define CONFIG_CHARGE_RAMP_SW */
-
/* #define CONFIG_CHARGER */
/* #define CONFIG_CHARGER_DISCHARGE_ON_AC */
@@ -164,8 +162,8 @@
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
#define CONFIG_CLOCK_CRYSTAL
@@ -190,7 +188,6 @@
* #define CONFIG_LOW_POWER_IDLE
*/
-
/* #define CONFIG_GPIO_POWER_DOWN */
/*
@@ -270,8 +267,8 @@
* Configure for smaller flash is OK for testing except
* for SPI flash lock bit.
*/
- #define CONFIG_FLASH_SIZE_BYTES 524288
- #define CONFIG_SPI_FLASH_W25X40
+#define CONFIG_FLASH_SIZE_BYTES 524288
+#define CONFIG_SPI_FLASH_W25X40
/*
* #define CONFIG_FLASH_SIZE_BYTES 0x1000000
* #define CONFIG_SPI_FLASH_W25Q128
@@ -321,7 +318,7 @@
* Make sure to not include GPSPI in little-firmware(LFW)
*/
#ifndef LFW
-#define CONFIG_MCHP_GPSPI 0x01
+#define CONFIG_MCHP_GPSPI 0x01
#endif
/* SPI Accelerometer
@@ -360,9 +357,8 @@
#define GPIO_BAT_LED_GREEN GPIO_CHARGE_LED_2
/* I2C ports */
-#define I2C_CONTROLLER_COUNT 2
-#define I2C_PORT_COUNT 2
-
+#define I2C_CONTROLLER_COUNT 2
+#define I2C_PORT_COUNT 2
/*
* Map I2C Ports to Controllers for this board.
@@ -377,26 +373,26 @@
* All other ports set to 0xff (not used)
*/
-#define I2C_PORT_PMIC MCHP_I2C_PORT10
-#define I2C_PORT_USB_CHARGER_1 MCHP_I2C_PORT2
-#define I2C_PORT_USB_MUX MCHP_I2C_PORT2
-#define I2C_PORT_USB_CHARGER_2 MCHP_I2C_PORT2
-#define I2C_PORT_PD_MCU MCHP_I2C_PORT3
-#define I2C_PORT_TCPC MCHP_I2C_PORT3
-#define I2C_PORT_ALS MCHP_I2C_PORT4
-#define I2C_PORT_ACCEL MCHP_I2C_PORT4
-#define I2C_PORT_BATTERY MCHP_I2C_PORT5
-#define I2C_PORT_CHARGER MCHP_I2C_PORT5
+#define I2C_PORT_PMIC MCHP_I2C_PORT10
+#define I2C_PORT_USB_CHARGER_1 MCHP_I2C_PORT2
+#define I2C_PORT_USB_MUX MCHP_I2C_PORT2
+#define I2C_PORT_USB_CHARGER_2 MCHP_I2C_PORT2
+#define I2C_PORT_PD_MCU MCHP_I2C_PORT3
+#define I2C_PORT_TCPC MCHP_I2C_PORT3
+#define I2C_PORT_ALS MCHP_I2C_PORT4
+#define I2C_PORT_ACCEL MCHP_I2C_PORT4
+#define I2C_PORT_BATTERY MCHP_I2C_PORT5
+#define I2C_PORT_CHARGER MCHP_I2C_PORT5
/* Thermal sensors read through PMIC ADC interface */
#if 0
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
+#define I2C_PORT_THERMAL I2C_PORT_PMIC
#else
-#define I2C_PORT_THERMAL MCHP_I2C_PORT4
+#define I2C_PORT_THERMAL MCHP_I2C_PORT4
#endif
/* Ambient Light Sensor address */
-#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
+#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
/* Modules we want to exclude */
#undef CONFIG_CMD_HASH
@@ -425,9 +421,9 @@ enum temp_sensor_id {
/* These temp sensors are only readable in S0 */
TEMP_SENSOR_AMBIENT,
TEMP_SENSOR_CASE,
-/* TEMP_SENSOR_CHARGER, */
-/* TEMP_SENSOR_DRAM, */
-/* TEMP_SENSOR_WIFI, */
+ /* TEMP_SENSOR_CHARGER, */
+ /* TEMP_SENSOR_DRAM, */
+ /* TEMP_SENSOR_WIFI, */
TEMP_SENSOR_COUNT
};
@@ -453,25 +449,24 @@ enum als_id {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
/* Try to negotiate to 20V since i2c noise problems should be fixed. */
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* include TFDP macros from mchp chip level
*/
#include "tfdp_chip.h"
-
/* Map I2C port to controller */
int board_i2c_p2c(int port);
diff --git a/board/mchpevb1/build.mk b/board/mchpevb1/build.mk
index 412b04d46b..c92a045646 100644
--- a/board/mchpevb1/build.mk
+++ b/board/mchpevb1/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/mchpevb1/ec.tasklist b/board/mchpevb1/ec.tasklist
index 6fcd5faa98..f187bb914a 100644
--- a/board/mchpevb1/ec.tasklist
+++ b/board/mchpevb1/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mchpevb1/gpio.inc b/board/mchpevb1/gpio.inc
index 3949e31843..b3aa29941e 100644
--- a/board/mchpevb1/gpio.inc
+++ b/board/mchpevb1/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mchpevb1/led.c b/board/mchpevb1/led.c
index 7b9f7646cb..8a5d85e97d 100644
--- a/board/mchpevb1/led.c
+++ b/board/mchpevb1/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -30,8 +30,7 @@
* NOTE: GPIO_BAT_LED_xxx defined in board.h
*/
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -40,7 +39,7 @@ enum led_color {
LED_RED,
LED_AMBER,
LED_GREEN,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int bat_led_set_color(enum led_color color)
@@ -68,8 +67,7 @@ static int bat_led_set_color(enum led_color color)
return EC_SUCCESS;
}
-void led_get_brightness_range(enum ec_led_id led_id,
- uint8_t *brightness_range)
+void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
brightness_range[EC_LED_COLOR_RED] = 1;
brightness_range[EC_LED_COLOR_GREEN] = 1;
@@ -114,7 +112,6 @@ static void board_led_set_battery(void)
{
#ifdef CONFIG_CHARGER
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -129,34 +126,42 @@ static void board_led_set_battery(void)
case PWR_STATE_DISCHARGE:
/* Less than 3%, blink one second every two second */
if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
- charge_get_percent() < CRITICAL_LOW_BATTERY_PERCENTAGE)
+ charge_get_percent() < CRITICAL_LOW_BATTERY_PERCENTAGE)
board_led_set_color_battery(
(battery_ticks % LED_TOTAL_2SECS_TICKS <
- LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF);
+ LED_ON_1SEC_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
/* Less than 10%, blink one second every four seconds */
else if (!chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
- charge_get_percent() < LOW_BATTERY_PERCENTAGE)
+ charge_get_percent() < LOW_BATTERY_PERCENTAGE)
board_led_set_color_battery(
(battery_ticks % LED_TOTAL_4SECS_TICKS <
- LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF);
+ LED_ON_1SEC_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
board_led_set_color_battery(LED_OFF);
break;
case PWR_STATE_ERROR:
board_led_set_color_battery(
(battery_ticks % LED_TOTAL_2SECS_TICKS <
- LED_ON_1SEC_TICKS) ? LED_RED : LED_OFF);
+ LED_ON_1SEC_TICKS) ?
+ LED_RED :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
board_led_set_color_battery(LED_GREEN);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- board_led_set_color_battery(
- (battery_ticks % LED_TOTAL_4SECS_TICKS <
- LED_ON_2SECS_TICKS) ? LED_GREEN : LED_AMBER);
- else
- board_led_set_color_battery(LED_GREEN);
+ board_led_set_color_battery(LED_GREEN);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ board_led_set_color_battery(
+ (battery_ticks % LED_TOTAL_4SECS_TICKS <
+ LED_ON_2SECS_TICKS) ?
+ LED_GREEN :
+ LED_AMBER);
break;
default:
/* Other states don't alter LED behavior */
@@ -165,7 +170,6 @@ static void board_led_set_battery(void)
#endif
}
-
static void led_second(void)
{
if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
diff --git a/board/mchpevb1/usb_pd_policy.c b/board/mchpevb1/usb_pd_policy.c
index 690f8b8a3c..f84d5d1171 100644
--- a/board/mchpevb1/usb_pd_policy.c
+++ b/board/mchpevb1/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,19 +18,16 @@
#include "usb_mux.h"
#include "usb_pd.h"
-
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L :
- GPIO_USB_C0_CHARGE_EN_L, 1);
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_EN_L : GPIO_USB_C0_CHARGE_EN_L,
+ 1);
/* Provide VBUS */
- gpio_set_level(port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN, 1);
+ gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 1);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
@@ -41,8 +38,7 @@ int pd_set_power_supply_ready(int port)
void pd_power_supply_reset(int port)
{
/* Disable VBUS */
- gpio_set_level(port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN, 0);
+ gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 0);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/meep/battery.c b/board/meep/battery.c
index ca9fc531b3..56434d98da 100644
--- a/board/meep/battery.c
+++ b/board/meep/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/meep/board.c b/board/meep/board.c
index 3771c72072..62e4881b1b 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,13 +42,13 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
#ifdef CONFIG_KEYBOARD_KEYPAD
#error "KSO_14 was repurposed to PPC_ID pin so CONFIG_KEYBOARD_KEYPAD \
@@ -86,32 +86,32 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus C0 sensing (10x voltage divider). PPVAR_USB_C0_VBUS */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/* Vbus C1 sensing (10x voltage divider). PPVAR_USB_C1_VBUS */
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -121,17 +121,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t lid_standrd_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_standrd_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
static struct kionix_accel_data kx022_data;
@@ -228,9 +224,9 @@ int board_is_convertible(void)
* Vortininja: 49, 50, 51, 52
* Unprovisioned: 255
*/
- return sku_id == 1 || sku_id == 2 || sku_id == 3 ||
- sku_id == 4 || sku_id == 49 || sku_id == 50 ||
- sku_id == 51 || sku_id == 52 || sku_id == 255;
+ return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 4 ||
+ sku_id == 49 || sku_id == 50 || sku_id == 51 || sku_id == 52 ||
+ sku_id == 255;
}
static void board_update_sensor_config_from_sku(void)
@@ -306,8 +302,8 @@ void board_hibernate_late(void)
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_BAT_LED_WHITE_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_AMBER_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_BAT_LED_WHITE_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_AMBER_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
@@ -336,15 +332,15 @@ __override void lid_angle_peripheral_enable(int enable)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
void board_overcurrent_event(int port, int is_overcurrented)
@@ -389,31 +385,29 @@ __override uint16_t board_get_ps8xxx_product_id(int port)
}
static const struct ppc_config_t ppc_syv682x_port0 = {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static const struct ppc_config_t ppc_syv682x_port1 = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static void board_setup_ppc(void)
{
if (c0_port_ppc == PPC_SYV682X) {
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_0],
- &ppc_syv682x_port0,
- sizeof(struct ppc_config_t));
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], &ppc_syv682x_port0,
+ sizeof(struct ppc_config_t));
gpio_set_flags(GPIO_USB_PD_C0_INT_ODL, GPIO_INT_BOTH);
}
if (c1_port_ppc == PPC_SYV682X) {
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_1],
- &ppc_syv682x_port1,
- sizeof(struct ppc_config_t));
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], &ppc_syv682x_port1,
+ sizeof(struct ppc_config_t));
gpio_set_flags(GPIO_USB_PD_C1_INT_ODL, GPIO_INT_BOTH);
}
diff --git a/board/meep/board.h b/board/meep/board.h
index 008592c7f1..6f437fb852 100644
--- a/board/meep/board.h
+++ b/board/meep/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,8 +22,8 @@
#define CONFIG_LED_COMMON
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -66,10 +66,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT
};
@@ -80,18 +80,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum battery_type {
BATTERY_DYNAPACK_COS,
diff --git a/board/meep/build.mk b/board/meep/build.mk
index 3d04b75731..998a65a3de 100644
--- a/board/meep/build.mk
+++ b/board/meep/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/meep/ec.tasklist b/board/meep/ec.tasklist
index d98db145e7..977b8b01be 100644
--- a/board/meep/ec.tasklist
+++ b/board/meep/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/meep/gpio.inc b/board/meep/gpio.inc
index ebb69bdf53..aeb659624a 100644
--- a/board/meep/gpio.inc
+++ b/board/meep/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/meep/led.c b/board/meep/led.c
index e20a88d268..87d94904c4 100644
--- a/board/meep/led.c
+++ b/board/meep/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,8 +11,8 @@
#include "led_onoff_states.h"
#include "hooks.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -20,36 +20,43 @@ __override const int led_charge_lvl_2 = 100;
/* Meep: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- /* STATE_DISCHARGE_S3 will changed if sku is clamshells */
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_WHITE, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ /* STATE_DISCHARGE_S3 will changed if sku is clamshells */
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_WHITE,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 1 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
static void s3_led_init(void)
{
diff --git a/board/metaknight/battery.c b/board/metaknight/battery.c
index 943771ffa4..cff274ae4f 100644
--- a/board/metaknight/battery.c
+++ b/board/metaknight/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/metaknight/board.c b/board/metaknight/board.c
index bfff864b89..5aa3a21cc0 100644
--- a/board/metaknight/board.c
+++ b/board/metaknight/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -49,13 +49,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
-#define ADC_VOL_UP_MASK BIT(0)
-#define ADC_VOL_DOWN_MASK BIT(1)
+#define ADC_VOL_UP_MASK BIT(0)
+#define ADC_VOL_DOWN_MASK BIT(1)
static uint8_t new_adc_key_state;
@@ -101,7 +101,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
@@ -119,7 +118,7 @@ static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
static void pen_input_deferred(void)
{
int pen_charge_enable = !gpio_get_level(GPIO_PEN_DET_ODL) &&
- !chipset_in_state(CHIPSET_STATE_ANY_OFF);
+ !chipset_in_state(CHIPSET_STATE_ANY_OFF);
if (pen_charge_enable)
gpio_set_level(GPIO_EN_PP3300_PEN, 1);
@@ -181,26 +180,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_MEMORY] = {
- .name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1
- },
- [TEMP_SENSOR_CPU] = {
- .name = "CPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2
- },
+ [TEMP_SENSOR_MEMORY] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_CPU] = { .name = "CPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_MEMORY \
- { \
+#define THERMAL_MEMORY \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
@@ -218,8 +213,8 @@ __maybe_unused static const struct ec_thermal_config thermal_memory =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -238,7 +233,7 @@ struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
static void setup_thermal(void)
{
thermal_params[TEMP_SENSOR_MEMORY] = thermal_memory;
- thermal_params[TEMP_SENSOR_CPU] = thermal_cpu;
+ thermal_params[TEMP_SENSOR_CPU] = thermal_cpu;
}
void board_hibernate(void)
@@ -274,7 +269,7 @@ static void reconfigure_5v_gpio(void)
gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_OUT_LOW);
}
}
-DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C + 1);
#endif /* BOARD_WADDLEDOO */
static void set_5v_gpio(int level)
@@ -312,7 +307,7 @@ __override void board_power_5v_enable(int enable)
set_5v_gpio(!!enable);
if (get_cbi_fw_config_db() == DB_1A_HDMI ||
- get_cbi_fw_config_db() == DB_LTE_HDMI) {
+ get_cbi_fw_config_db() == DB_LTE_HDMI) {
gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
}
}
@@ -333,13 +328,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -403,8 +396,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -429,29 +422,21 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_lsm6dsm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_lsm6dsm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
@@ -593,8 +578,7 @@ struct motion_sensor_t lsm6dsm_base_gyro = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &lsm6dsm_drv,
.mutex = &g_base_mutex,
- .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
- MOTIONSENSE_TYPE_GYRO),
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, MOTIONSENSE_TYPE_GYRO),
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -603,7 +587,6 @@ struct motion_sensor_t lsm6dsm_base_gyro = {
.max_frequency = LSM6DSM_ODR_MAX_VAL,
};
-
struct motion_sensor_t icm426xx_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -660,12 +643,12 @@ void board_init(void)
check_c0_line();
if (get_cbi_fw_config_db() == DB_1A_HDMI ||
- get_cbi_fw_config_db() == DB_LTE_HDMI) {
+ get_cbi_fw_config_db() == DB_LTE_HDMI) {
/* Disable i2c on HDMI pins */
gpio_config_pin(MODULE_I2C, GPIO_HDMI_HPD_SUB_ODL, 0);
gpio_config_pin(MODULE_I2C, GPIO_GPIO92_NC, 0);
- gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
+ gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
/* Select HDMI option */
gpio_set_level(GPIO_HDMI_SEL_L, 0);
@@ -674,8 +657,7 @@ void board_init(void)
gpio_enable_interrupt(GPIO_HDMI_HPD_SUB_ODL);
} else {
/* Set SDA as an input */
- gpio_set_flags(GPIO_HDMI_HPD_SUB_ODL,
- GPIO_INPUT);
+ gpio_set_flags(GPIO_HDMI_HPD_SUB_ODL, GPIO_INPUT);
}
/* Enable gpio interrupt for base accelgyro sensor */
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
@@ -693,11 +675,11 @@ void board_init(void)
if (base_gyro_config == SSFC_SENSOR_LSM6DSM) {
motion_sensors[BASE_ACCEL] = lsm6dsm_base_accel;
- motion_sensors[BASE_GYRO] = lsm6dsm_base_gyro;
+ motion_sensors[BASE_GYRO] = lsm6dsm_base_gyro;
cprints(CC_SYSTEM, "SSFC: BASE GYRO is LSM6DSM");
} else if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM426XX) {
motion_sensors[BASE_ACCEL] = icm426xx_base_accel;
- motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
+ motion_sensors[BASE_GYRO] = icm426xx_base_gyro;
cprints(CC_SYSTEM, "SSFC: BASE GYRO is ICM426XX");
} else
cprints(CC_SYSTEM, "SSFC: BASE GYRO is BMI160");
@@ -710,7 +692,6 @@ void board_init(void)
/* Initial thermal */
setup_thermal();
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -748,12 +729,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
};
@@ -873,45 +857,35 @@ void motion_interrupt(enum gpio_signal signal)
}
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
-
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C_BATTERY_SCL,
- .sda = GPIO_EC_I2C_BATTERY_SDA
- },
-
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
-
- {
- .name = "usbc0",
- .port = I2C_PORT_USB_C0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_SCL,
- .sda = GPIO_EC_I2C_USB_C0_SDA
- },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+
+ { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BATTERY_SCL,
+ .sda = GPIO_EC_I2C_BATTERY_SDA },
+
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
+
+ { .name = "usbc0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_SDA },
#if CONFIG_USB_PD_PORT_MAX_COUNT > 1
- {
- .name = "sub_usbc1",
- .port = I2C_PORT_SUB_USB_C1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_SUB_USB_C1_SCL,
- .sda = GPIO_EC_I2C_SUB_USB_C1_SDA
- },
+ { .name = "sub_usbc1",
+ .port = I2C_PORT_SUB_USB_C1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_SUB_USB_C1_SCL,
+ .sda = GPIO_EC_I2C_SUB_USB_C1_SDA },
#endif
};
diff --git a/board/metaknight/board.h b/board/metaknight/board.h
index c331c76457..5bd3c56a83 100644
--- a/board/metaknight/board.h
+++ b/board/metaknight/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,15 +11,15 @@
#define VARIANT_DEDEDE_EC_NPCX796FC
#include "baseboard.h"
-
/* Battery */
#define CONFIG_BATTERY_FUEL_GAUGE
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -31,12 +31,11 @@
*/
#define GPIO_USB_C1_INT_ODL GPIO_SUB_C1_INT_EN_RAILS_ODL
-
/* LED defines */
#define CONFIG_LED_ONOFF_STATES
/* PWM */
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -71,16 +70,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -97,16 +96,16 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel second source */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel second source */
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel second source */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel second source */
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source */
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -154,25 +153,16 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_MEMORY,
- TEMP_SENSOR_CPU,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_MEMORY, TEMP_SENSOR_CPU, TEMP_SENSOR_COUNT };
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum pwm_channel {
PWM_CH_COUNT,
diff --git a/board/metaknight/build.mk b/board/metaknight/build.mk
index cd002a20e7..1531d1f3ae 100644
--- a/board/metaknight/build.mk
+++ b/board/metaknight/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/metaknight/cbi_ssfc.c b/board/metaknight/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/metaknight/cbi_ssfc.c
+++ b/board/metaknight/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/metaknight/cbi_ssfc.h b/board/metaknight/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/metaknight/cbi_ssfc.h
+++ b/board/metaknight/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/metaknight/ec.tasklist b/board/metaknight/ec.tasklist
index dc4065cf98..6316569c9a 100644
--- a/board/metaknight/ec.tasklist
+++ b/board/metaknight/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/metaknight/gpio.inc b/board/metaknight/gpio.inc
index dee2e2dadf..4d68595d65 100644
--- a/board/metaknight/gpio.inc
+++ b/board/metaknight/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/metaknight/led.c b/board/metaknight/led.c
index 466037695c..a48b4bcf2a 100644
--- a/board/metaknight/led.c
+++ b/board/metaknight/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,20 +19,27 @@ __override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 100;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
-
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/metaknight/usb_pd_policy.c b/board/metaknight/usb_pd_policy.c
index 3190595596..23166f7fca 100644
--- a/board/metaknight/usb_pd_policy.c
+++ b/board/metaknight/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/mithrax/battery.c b/board/mithrax/battery.c
index 8c03169b1c..16840d5b3d 100644
--- a/board/mithrax/battery.c
+++ b/board/mithrax/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -87,6 +87,35 @@ const struct board_batt_params board_battery_info[] = {
.discharging_max_c = 60,
},
},
+ [BATTERY_C340] = {
+ .fuel_gauge = {
+ .manuf_name = "AS3FXXD3KB",
+ .device_name = "C340152",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .reg_addr = 0x99,
+ .reg_mask = 0x000C,
+ .disconnect_val = 0x000C,
+ .cfet_mask = 0x0004,
+ .cfet_off_val = 0x0004,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 13350,
+ .voltage_normal = 11985, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 45,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
+ },
+ },
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
diff --git a/board/mithrax/board.c b/board/mithrax/board.c
index 3db87618f8..69ba7d5b32 100644
--- a/board/mithrax/board.c
+++ b/board/mithrax/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,15 @@
#include "tablet_mode.h"
#include "throttle_ap.h"
#include "usbc_config.h"
+#include "keyboard_backlight.h"
+#include "rgb_keyboard.h"
+#include "ec_commands.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
static void rgb_backlight_config(void);
@@ -57,14 +60,6 @@ static void board_chipset_resume(void)
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
-/* Called on AP S0 -> S3 transition */
-static void board_chipset_suspend(void)
-{
- /* Turn off the keyboard backlight if it's on. */
- gpio_set_level(GPIO_EC_KB_BL_EN_L, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-
/* Called on AP S5 -> S3 transition */
static void board_chipset_startup(void)
{
@@ -97,8 +92,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -119,18 +114,11 @@ enum battery_present battery_hw_present(void)
static void board_init(void)
{
- if (ec_cfg_usb_db_type() == DB_USB4_NCT3807)
- db_update_usb4_config_from_config();
-
- if (ec_cfg_usb_mb_type() == MB_USB4_TBT)
- mb_update_usb4_tbt_config_from_config();
-
if (ec_cfg_stylus() == STYLUS_PRSENT)
gpio_enable_interrupt(GPIO_PEN_DET_ODL);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
/**
* Deferred function to handle pen detect change
*/
@@ -153,8 +141,7 @@ DECLARE_HOOK(HOOK_INIT, pendetect_deferred, HOOK_PRIO_DEFAULT);
void pen_detect_interrupt(enum gpio_signal s)
{
/* Trigger deferred notification of pen detect change */
- hook_call_deferred(&pendetect_deferred_data,
- 500 * MSEC);
+ hook_call_deferred(&pendetect_deferred_data, 500 * MSEC);
}
void pen_config(void)
@@ -182,3 +169,16 @@ static void rgb_backlight_config(void)
else
gpio_set_level(GPIO_EN_PP5000_LED, 0);
}
+
+void board_kblight_init(void)
+{
+ if ((IS_ENABLED(CONFIG_PWM_KBLIGHT)) &&
+ (ec_cfg_kb_backlight() == SOLID_COLOR)) {
+ kblight_register(&kblight_pwm);
+ rgbkbd_type = EC_RGBKBD_TYPE_UNKNOWN;
+ } else if ((IS_ENABLED(CONFIG_RGB_KEYBOARD)) &&
+ (ec_cfg_kb_backlight() == RGB)) {
+ kblight_register(&kblight_rgbkbd);
+ rgbkbd_type = EC_RGBKBD_TYPE_FOUR_ZONES_4_LEDS;
+ }
+}
diff --git a/board/mithrax/board.h b/board/mithrax/board.h
index c9d2112b2c..d12375d678 100644
--- a/board/mithrax/board.h
+++ b/board/mithrax/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,11 +29,11 @@
/* LED */
#define CONFIG_LED_ONOFF_STATES
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
-#define GPIO_BAT_LED_AMBER_L GPIO_LED_3_L
-#define GPIO_BAT_LED_WHITE_L GPIO_LED_4_L
+#define GPIO_BAT_LED_AMBER_L GPIO_LED_3_L
+#define GPIO_BAT_LED_WHITE_L GPIO_LED_4_L
/* Sensors */
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -49,8 +49,8 @@
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_LIS2DWL
#define CONFIG_ACCEL_LIS2DW_AS_BASE
#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
@@ -61,16 +61,15 @@
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_TCPM_PS8815
-#define CONFIG_USBC_RETIMER_INTEL_BB
/* I2C control host command */
#define CONFIG_HOSTCMD_I2C_CONTROL
@@ -82,17 +81,17 @@
#define CONFIG_USBC_PPC_NX20P3483
/* TODO: b/177608416 - measure and check these values on mithrax */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 65000
-#define PD_MAX_CURRENT_MA 3250
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 65000
+#define PD_MAX_CURRENT_MA 3250
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -100,74 +99,66 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_KEYBOARD_BACKLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C2_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C2_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_PORT_KBMCU NPCX_I2C_PORT3_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_KBMCU NPCX_I2C_PORT3_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/*
*
*/
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
-
-/* Enabling Thunderbolt-compatible mode */
-#define CONFIG_USB_PD_TBT_COMPAT_MODE
-
-/* Enabling USB4 mode */
-#define CONFIG_USB_PD_USB4
/* Retimer */
#define CONFIG_USBC_RETIMER_FW_UPDATE
@@ -178,26 +169,28 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* RGB Keyboard */
#ifdef SECTION_IS_RW
#define CONFIG_RGB_KEYBOARD
-#define CONFIG_LED_DRIVER_TLC59116F /* TLC59116F on I2C */
-#define TLC59116F_I2C_ADDR_FLAG TLC59116F_ADDR3_FLAG
+#define CONFIG_LED_DRIVER_TLC59116F /* TLC59116F on I2C */
+#define TLC59116F_I2C_ADDR_FLAG TLC59116F_ADDR3_FLAG
#endif /* SECTION_IS_RW */
-#define RGB_GRID0_COL 4
-#define RGB_GRID0_ROW 1
+#define RGB_GRID0_COL 4
+#define RGB_GRID0_ROW 1
+
+#define CONFIG_PWM_KBLIGHT
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -215,40 +208,26 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum ioex_port {
- IOEX_C2_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C2_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
enum battery_type {
BATTERY_C536,
BATTERY_C490,
+ BATTERY_C340,
BATTERY_TYPE_COUNT
};
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void pen_detect_interrupt(enum gpio_signal s);
diff --git a/board/mithrax/build.mk b/board/mithrax/build.mk
index a7ec1987de..ca2d2e6c70 100644
--- a/board/mithrax/build.mk
+++ b/board/mithrax/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/mithrax/charger_isl9241.c b/board/mithrax/charger_isl9241.c
index 10bc45b333..a9eafe353e 100644
--- a/board/mithrax/charger_isl9241.c
+++ b/board/mithrax/charger_isl9241.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -85,7 +84,6 @@ __overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
charge_ma = (charge_ma * 90) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/mithrax/ec.tasklist b/board/mithrax/ec.tasklist
index b6a6557d1e..8949bb98e7 100644
--- a/board/mithrax/ec.tasklist
+++ b/board/mithrax/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mithrax/fans.c b/board/mithrax/fans.c
index 1f75eb6ca3..fd7b380f77 100644
--- a/board/mithrax/fans.c
+++ b/board/mithrax/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/mithrax/fw_config.c b/board/mithrax/fw_config.c
index 6985059d50..17b623371f 100644
--- a/board/mithrax/fw_config.c
+++ b/board/mithrax/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union mithrax_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/mithrax/fw_config.h b/board/mithrax/fw_config.h
index 4e9ba7f3c6..c7053c0da4 100644
--- a/board/mithrax/fw_config.h
+++ b/board/mithrax/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,43 +14,31 @@
* Source of truth is the project/brya/mithrax/config.star configuration file.
*/
-enum ec_cfg_usb_db_type {
- DB_USB3_PS8815 = 1,
- DB_USB4_NCT3807 = 2
-};
+enum ec_cfg_usb_db_type { DB_USB_ABSENT = 0, DB_USB3_PS8815 = 1 };
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_usb_mb_type {
- MB_USB4_TBT = 0,
- MB_USB3_NON_TBT = 1
-};
+enum ec_cfg_usb_mb_type { NA = 0, MB_USB3_NON_TBT = 1 };
-enum ec_cfg_stylus_type {
- STYLUS_ABSENT = 0,
- STYLUS_PRSENT = 1
-};
+enum ec_cfg_stylus_type { STYLUS_ABSENT = 0, STYLUS_PRSENT = 1 };
-enum ec_cfg_kb_backlight_type {
- SOLID_COLOR = 0,
- RGB = 1
-};
+enum ec_cfg_kb_backlight_type { SOLID_COLOR = 0, RGB = 1 };
union mithrax_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 3;
- uint32_t wifi : 1;
- enum ec_cfg_kb_backlight_type rgb : 1;
- enum ec_cfg_stylus_type stylus : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t thermal : 2;
- uint32_t table_mode : 1;
- enum ec_cfg_usb_mb_type usb_mb : 3;
- uint32_t reserved_1 : 16;
+ enum ec_cfg_usb_db_type usb_db : 3;
+ uint32_t wifi : 1;
+ enum ec_cfg_kb_backlight_type rgb : 1;
+ enum ec_cfg_stylus_type stylus : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t thermal : 2;
+ uint32_t table_mode : 1;
+ enum ec_cfg_usb_mb_type usb_mb : 3;
+ uint32_t reserved_1 : 16;
};
uint32_t raw_value;
};
diff --git a/board/mithrax/gpio.inc b/board/mithrax/gpio.inc
index 133efd0390..1ee2ae40f0 100644
--- a/board/mithrax/gpio.inc
+++ b/board/mithrax/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mithrax/i2c.c b/board/mithrax/i2c.c
index 7833d1c154..76a9dfdc1c 100644
--- a/board/mithrax/i2c.c
+++ b/board/mithrax/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mithrax/keyboard.c b/board/mithrax/keyboard.c
index 6534c7bc63..36830958f5 100644
--- a/board/mithrax/keyboard.c
+++ b/board/mithrax/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -61,145 +61,20 @@ const uint8_t rgbkbd_count = ARRAY_SIZE(rgbkbds);
const uint8_t rgbkbd_hsize = RGB_GRID0_COL;
const uint8_t rgbkbd_vsize = RGB_GRID0_ROW;
-#define LED(x, y) RGBKBD_COORD((x), (y))
-#define DELM RGBKBD_DELM
+enum ec_rgbkbd_type rgbkbd_type;
+#define LED(x, y) RGBKBD_COORD((x), (y))
+#define DELM RGBKBD_DELM
+
const uint8_t rgbkbd_map[] = {
- DELM, /* 0: (null) */
- LED(0, 0), DELM, /* 1: ~ ` */
- LED(0, 0), DELM, /* 2: ! 1 */
- LED(0, 0), DELM, /* 3: @ 2 */
- LED(0, 0), DELM, /* 4: # 3 */
- LED(1, 0), DELM, /* 5: $ 4 */
- LED(1, 0), DELM, /* 6: % 5 */
- LED(1, 0), DELM, /* 7: ^ 6 */
- LED(2, 0), DELM, /* 8: & 7 */
- LED(2, 0), DELM, /* 9: * 8 */
- LED(2, 0), DELM, /* 10: ( 9 */
- LED(2, 0), DELM, /* 11: ) 0 */
- LED(2, 0), DELM, /* 12: _ - */
- LED(3, 0), DELM, /* 13: + = */
- DELM, /* 14: (null) */
- LED(3, 0), DELM, /* 15: backspace */
- LED(0, 0), DELM, /* 16: tab */
- LED(0, 0), DELM, /* 17: q */
- LED(0, 0), DELM, /* 18: w */
- LED(0, 0), DELM, /* 19: e */
- LED(1, 0), DELM, /* 20: r */
- LED(1, 0), DELM, /* 21: t */
- LED(1, 0), DELM, /* 22: y */
- LED(2, 0), DELM, /* 23: u */
- LED(2, 0), DELM, /* 24: i */
- LED(2, 0), DELM, /* 25: o */
- LED(2, 0), DELM, /* 26: p */
- LED(2, 0), DELM, /* 27: [ { */
- LED(3, 0), DELM, /* 28: ] } */
- LED(3, 0), DELM, /* 29: \ | */
- LED(0, 0), DELM, /* 30: caps lock */
- LED(0, 0), DELM, /* 31: a */
- LED(0, 0), DELM, /* 32: s */
- LED(0, 0), DELM, /* 33: d */
- LED(1, 0), DELM, /* 34: f */
- LED(1, 0), DELM, /* 35: g */
- LED(1, 0), DELM, /* 36: h */
- LED(2, 0), DELM, /* 37: j */
- LED(2, 0), DELM, /* 38: k */
- LED(2, 0), DELM, /* 39: l */
- LED(3, 0), DELM, /* 40: ; : */
- LED(3, 0), DELM, /* 41: " ' */
- DELM, /* 42: (null) */
- LED(3, 0), DELM, /* 43: enter */
- LED(0, 0), DELM, /* 44: L-shift */
- DELM, /* 45: (null) */
- LED(0, 0), DELM, /* 46: z */
- LED(0, 0), DELM, /* 47: x */
- LED(0, 0), DELM, /* 48: c */
- LED(1, 0), DELM, /* 49: v */
- LED(1, 0), DELM, /* 50: b */
- LED(1, 0), DELM, /* 51: n */
- LED(2, 0), DELM, /* 52: m */
- LED(2, 0), DELM, /* 53: , < */
- LED(2, 0), DELM, /* 54: . > */
- LED(3, 0), DELM, /* 55: / ? */
- DELM, /* 56: (null) */
- LED(3, 0), DELM, /* 57: R-shift */
- LED(0, 0), DELM, /* 58: L-ctrl */
- LED(3, 0), DELM, /* 59: power */
- LED(0, 0), DELM, /* 60: L-alt */
- LED(0, 0), LED(1, 0),
- LED(2, 0), DELM, /* 61: space */
- LED(2, 0), DELM, /* 62: R-alt */
- DELM, /* 63: (null) */
- LED(2, 0), DELM, /* 64: R-ctrl */
- DELM, /* 65: (null) */
- DELM, /* 66: (null) */
- DELM, /* 67: (null) */
- DELM, /* 68: (null) */
- DELM, /* 69: (null) */
- DELM, /* 70: (null) */
- DELM, /* 71: (null) */
- DELM, /* 72: (null) */
- DELM, /* 73: (null) */
- DELM, /* 74: (null) */
- DELM, /* 75: (null) */
- DELM, /* 76: delete */
- DELM, /* 77: (null) */
- DELM, /* 78: (null) */
- LED(3, 0), DELM, /* 79: left */
- DELM, /* 80: home */
- DELM, /* 81: end */
- DELM, /* 82: (null) */
- LED(3, 0), DELM, /* 83: up */
- LED(3, 0), DELM, /* 84: down */
- DELM, /* 85: page up */
- DELM, /* 86: page down */
- DELM, /* 87: (null) */
- DELM, /* 88: (null) */
- LED(3, 0), DELM, /* 89: right */
- DELM, /* 90: (null) */
- DELM, /* 91: numpad 7 */
- DELM, /* 92: numpad 4 */
- DELM, /* 93: numpad 1 */
- DELM, /* 94: (null) */
- DELM, /* 95: numpad / */
- DELM, /* 96: numpad 8 */
- DELM, /* 97: numpad 5 */
- DELM, /* 98: numpad 2 */
- DELM, /* 99: numpad 0 */
- DELM, /* 100: numpad * */
- DELM, /* 101: numpad 9 */
- DELM, /* 102: numpad 6 */
- DELM, /* 103: numpad 3 */
- DELM, /* 104: numpad . */
- DELM, /* 105: numpad - */
- DELM, /* 106: numpad + */
- DELM, /* 107: (null) */
- DELM, /* 108: numpad enter */
- DELM, /* 109: (null) */
- LED(0, 0), DELM, /* 110: esc */
- LED(0, 0), DELM, /* T1: back */
- LED(0, 0), DELM, /* T2: refresh */
- LED(1, 0), DELM, /* T3: full screen */
- LED(1, 0), DELM, /* T4: overview */
- LED(1, 0), DELM, /* T5: snapshot */
- LED(2, 0), DELM, /* T6: brightness down */
- LED(2, 0), DELM, /* T7: brightness up */
- LED(2, 0), DELM, /* T8: mute */
- LED(2, 0), DELM, /* T9: volume down */
- LED(3, 0), DELM, /* T10: volume up */
- DELM, /* T11: (null) */
- DELM, /* T12: (null) */
- DELM, /* T13: (null) */
- DELM, /* T14: (null) */
- DELM, /* T15: (null) */
- DELM, /* 126: (null) */
- DELM, /* 127: (null) */
+ DELM, LED(0, 0), DELM, LED(1, 0), DELM,
+ LED(2, 0), DELM, LED(3, 0), DELM, DELM,
};
#undef LED
#undef DELM
const size_t rgbkbd_map_size = ARRAY_SIZE(rgbkbd_map);
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &mithrax_kb;
}
@@ -213,20 +88,20 @@ __override const struct key {
uint8_t row;
uint8_t col;
} vivaldi_keys[] = {
- {.row = 4, .col = 2}, /* T1 */
- {.row = 3, .col = 2}, /* T2 */
- {.row = 2, .col = 2}, /* T3 */
- {.row = 1, .col = 2}, /* T4 */
- {.row = 4, .col = 4}, /* T5 */
- {.row = 3, .col = 4}, /* T6 */
- {.row = 2, .col = 4}, /* T7 */
- {.row = 2, .col = 9}, /* T8 */
- {.row = 1, .col = 9}, /* T9 */
- {.row = 1, .col = 4}, /* T10 */
- {.row = 0, .col = 4}, /* T11 */
- {.row = 1, .col = 5}, /* T12 */
- {.row = 3, .col = 5}, /* T13 */
- {.row = 2, .col = 1}, /* T14 */
- {.row = 0, .col = 1}, /* T15 */
+ { .row = 4, .col = 2 }, /* T1 */
+ { .row = 3, .col = 2 }, /* T2 */
+ { .row = 2, .col = 2 }, /* T3 */
+ { .row = 1, .col = 2 }, /* T4 */
+ { .row = 4, .col = 4 }, /* T5 */
+ { .row = 3, .col = 4 }, /* T6 */
+ { .row = 2, .col = 4 }, /* T7 */
+ { .row = 2, .col = 9 }, /* T8 */
+ { .row = 1, .col = 9 }, /* T9 */
+ { .row = 1, .col = 4 }, /* T10 */
+ { .row = 0, .col = 4 }, /* T11 */
+ { .row = 1, .col = 5 }, /* T12 */
+ { .row = 3, .col = 5 }, /* T13 */
+ { .row = 2, .col = 1 }, /* T14 */
+ { .row = 0, .col = 1 }, /* T15 */
};
BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
diff --git a/board/mithrax/keyboard_customization.c b/board/mithrax/keyboard_customization.c
index 4e45de34be..cc3623390f 100644
--- a/board/mithrax/keyboard_customization.c
+++ b/board/mithrax/keyboard_customization.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,24 +12,23 @@
#include "keyboard_raw.h"
static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000},
- {0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016},
- {0x006c, 0xe024, 0xe01d, 0xe020, 0xe038, 0xe071, 0x0026, 0x002a},
- {0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d},
- {0x0078, 0xe032, 0xe035, 0xe02c, 0xe02d, 0x0041, 0x001e, 0x001d},
- {0x0051, 0x0007, 0x005b, 0x000f, 0x0042, 0x0022, 0x003e, 0x0043},
- {0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c},
- {0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059},
- {0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d},
- {0x0045, 0xe021, 0xe023, 0x002f, 0x004b, 0x0049, 0x0046, 0x001a},
- {0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000},
- {0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066},
- {0xe06b, 0xe074, 0xe069, 0x0067, 0xe06c, 0x0064, 0x0015, 0xe07d},
- {0x0073, 0x007c, 0x007b, 0x0074, 0x0071, 0xe04a, 0x0070, 0x0021},
- {0x0023, 0xe05a, 0x0075, 0x0079, 0x007a, 0x0072, 0x007d, 0x0069},
+ { 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0x0000, 0x0000, 0x0000 },
+ { 0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016 },
+ { 0x006c, 0xe024, 0xe01d, 0xe020, 0xe038, 0xe071, 0x0026, 0x002a },
+ { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d },
+ { 0x0078, 0xe032, 0xe035, 0xe02c, 0xe02d, 0x0041, 0x001e, 0x001d },
+ { 0x0051, 0x0007, 0x005b, 0x000f, 0x0042, 0x0022, 0x003e, 0x0043 },
+ { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c },
+ { 0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059 },
+ { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d },
+ { 0x0045, 0xe021, 0xe023, 0x002f, 0x004b, 0x0049, 0x0046, 0x001a },
+ { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 },
+ { 0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066 },
+ { 0xe06b, 0xe074, 0xe069, 0x0067, 0xe06c, 0x0064, 0x0015, 0xe07d },
+ { 0x0073, 0x007c, 0x007b, 0x0074, 0x0071, 0xe04a, 0x0070, 0x0021 },
+ { 0x0023, 0xe05a, 0x0075, 0x0079, 0x007a, 0x0072, 0x007d, 0x0069 },
};
-
uint16_t get_scancode_set2(uint8_t row, uint8_t col)
{
if (col < KEYBOARD_COLS_MAX && row < KEYBOARD_ROWS)
@@ -64,38 +63,30 @@ void board_keyboard_drive_col(int col)
#ifdef CONFIG_KEYBOARD_DEBUG
static char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`',
- '1', KLLI_UNKNO, 'a'},
- {KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4,
- KLLI_SEARC, '3', KLLI_F3, KLLI_UNKNO},
- {'x', 'z', KLLI_F2, KLLI_F1,
- 's', '2', 'w', KLLI_ESC},
- {'v', 'b', 'g', 't',
- '5', '4', 'r', 'f'},
- {'m', 'n', 'h', 'y',
- '6', '7', 'u', 'j'},
- {'.', KLLI_DOWN, '\\', 'o',
- KLLI_F10, '9', KLLI_UNKNO, 'l'},
- {KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {',', KLLI_UNKNO, KLLI_F7, KLLI_F6,
- KLLI_F5, '8', 'i', 'k'},
- {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_LEFT, KLLI_UNKNO},
- {KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {'/', KLLI_UP, '-', KLLI_UNKNO,
- '0', 'p', '[', ';'},
- {'\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO,
- '=', KLLI_B_SPC, ']', 'd'},
- {KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
+ { 'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { 'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', '1', KLLI_UNKNO, 'a' },
+ { KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, KLLI_SEARC, '3', KLLI_F3,
+ KLLI_UNKNO },
+ { 'x', 'z', KLLI_F2, KLLI_F1, 's', '2', 'w', KLLI_ESC },
+ { 'v', 'b', 'g', 't', '5', '4', 'r', 'f' },
+ { 'm', 'n', 'h', 'y', '6', '7', 'u', 'j' },
+ { '.', KLLI_DOWN, '\\', 'o', KLLI_F10, '9', KLLI_UNKNO, 'l' },
+ { KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { ',', KLLI_UNKNO, KLLI_F7, KLLI_F6, KLLI_F5, '8', 'i', 'k' },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_LEFT, KLLI_UNKNO },
+ { KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { '/', KLLI_UP, '-', KLLI_UNKNO, '0', 'p', '[', ';' },
+ { '\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, '=', KLLI_B_SPC, ']', 'd' },
+ { KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
};
char get_keycap_label(uint8_t row, uint8_t col)
diff --git a/board/mithrax/keyboard_customization.h b/board/mithrax/keyboard_customization.h
index b177a11eb4..1d0e6ec483 100644
--- a/board/mithrax/keyboard_customization.h
+++ b/board/mithrax/keyboard_customization.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,47 +25,47 @@ extern uint8_t keyboard_cols;
#define KEYBOARD_ROW_TO_MASK(r) (1 << (r))
/* Columns and masks for keys we particularly care about */
-#define KEYBOARD_COL_DOWN 11
-#define KEYBOARD_ROW_DOWN 5
-#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
-#define KEYBOARD_COL_ESC 1
-#define KEYBOARD_ROW_ESC 1
-#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
-#define KEYBOARD_COL_KEY_H 6
-#define KEYBOARD_ROW_KEY_H 1
-#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
-#define KEYBOARD_COL_KEY_R 3
-#define KEYBOARD_ROW_KEY_R 7
-#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
-#define KEYBOARD_COL_LEFT_ALT 10
-#define KEYBOARD_ROW_LEFT_ALT 6
-#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
-#define KEYBOARD_COL_REFRESH 2
-#define KEYBOARD_ROW_REFRESH 3
-#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
-#define KEYBOARD_COL_RIGHT_ALT 10
-#define KEYBOARD_ROW_RIGHT_ALT 0
-#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
-#define KEYBOARD_DEFAULT_COL_VOL_UP 4
-#define KEYBOARD_DEFAULT_ROW_VOL_UP 1
-#define KEYBOARD_COL_LEFT_CTRL 0
-#define KEYBOARD_ROW_LEFT_CTRL 2
+#define KEYBOARD_COL_DOWN 11
+#define KEYBOARD_ROW_DOWN 5
+#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
+#define KEYBOARD_COL_ESC 1
+#define KEYBOARD_ROW_ESC 1
+#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
+#define KEYBOARD_COL_KEY_H 6
+#define KEYBOARD_ROW_KEY_H 1
+#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
+#define KEYBOARD_COL_KEY_R 3
+#define KEYBOARD_ROW_KEY_R 7
+#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
+#define KEYBOARD_COL_LEFT_ALT 10
+#define KEYBOARD_ROW_LEFT_ALT 6
+#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
+#define KEYBOARD_COL_REFRESH 2
+#define KEYBOARD_ROW_REFRESH 3
+#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
+#define KEYBOARD_COL_RIGHT_ALT 10
+#define KEYBOARD_ROW_RIGHT_ALT 0
+#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
+#define KEYBOARD_DEFAULT_COL_VOL_UP 4
+#define KEYBOARD_DEFAULT_ROW_VOL_UP 1
+#define KEYBOARD_COL_LEFT_CTRL 0
+#define KEYBOARD_ROW_LEFT_CTRL 2
#define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL)
#define KEYBOARD_COL_RIGHT_CTRL 0
#define KEYBOARD_ROW_RIGHT_CTRL 4
#define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL)
-#define KEYBOARD_COL_SEARCH 0
-#define KEYBOARD_ROW_SEARCH 3
-#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
-#define KEYBOARD_COL_KEY_0 9
-#define KEYBOARD_ROW_KEY_0 0
-#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
-#define KEYBOARD_COL_KEY_1 1
-#define KEYBOARD_ROW_KEY_1 7
-#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
-#define KEYBOARD_COL_KEY_2 4
-#define KEYBOARD_ROW_KEY_2 6
-#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
+#define KEYBOARD_COL_SEARCH 0
+#define KEYBOARD_ROW_SEARCH 3
+#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
+#define KEYBOARD_COL_KEY_0 9
+#define KEYBOARD_ROW_KEY_0 0
+#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
+#define KEYBOARD_COL_KEY_1 1
+#define KEYBOARD_ROW_KEY_1 7
+#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
+#define KEYBOARD_COL_KEY_2 4
+#define KEYBOARD_ROW_KEY_2 6
+#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
#define KEYBOARD_COL_LEFT_SHIFT 7
#define KEYBOARD_ROW_LEFT_SHIFT 1
#define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT)
diff --git a/board/mithrax/led.c b/board/mithrax/led.c
index 5abaed2a25..660fc8ce2d 100644
--- a/board/mithrax/led.c
+++ b/board/mithrax/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,26 +11,33 @@
#include "led_onoff_states.h"
#include "system.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
-__override const int led_charge_lvl_2 = 94;
+__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/mithrax/pwm.c b/board/mithrax/pwm.c
index ffc90e910a..8f3759316e 100644
--- a/board/mithrax/pwm.c
+++ b/board/mithrax/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mithrax/sensors.c b/board/mithrax/sensors.c
index fff002dda6..b72022a0e0 100644
--- a/board/mithrax/sensors.c
+++ b/board/mithrax/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,18 +46,14 @@ K_MUTEX_DEFINE(g_base_accel_mutex);
static struct stprivate_data g_lis2dw12_data;
static struct lsm6dso_data lsm6dso_data;
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* TODO(b/184779743): verify orientation matrix */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -146,24 +142,18 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_2_FAN] = {
- .name = "FAN",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_FAN
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_2_FAN] = { .name = "FAN",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_FAN },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -177,8 +167,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -207,8 +197,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(60), \
[EC_TEMP_THRESH_HALT] = C_TO_K(70), \
@@ -221,8 +211,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
}
__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
diff --git a/board/mithrax/usbc_config.c b/board/mithrax/usbc_config.c
index b1b28ab7c2..10189bbf50 100644
--- a/board/mithrax/usbc_config.c
+++ b/board/mithrax/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,8 +33,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
struct tcpc_config_t tcpc_config[] = {
@@ -63,17 +63,6 @@ struct tcpc_config_t tcpc_config[] = {
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
-struct tcpc_config_t tcpc_config_c1 = {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_USB_C1_TCPC,
- .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
- },
- .drv = &nct38xx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_NO_DEBUG_ACC_CONTROL,
-};
-
/* USBC PPC configuration */
struct ppc_config_t ppc_chips[] = {
[USBC_PORT_C2] = {
@@ -92,71 +81,40 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-struct ppc_config_t ppc_chips_c1 = {
- .i2c_port = I2C_PORT_USB_C1_PPC,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
-};
-
-/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
-};
-
/*
* USB3 DB mux configuration - the top level mux still needs to be set
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
-static const struct usb_mux usb_muxes_c1 = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
-};
-
-static const struct usb_mux usb_muxes_c2 = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C2_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
-};
-
-
/* BC1.2 charger detect configuration */
const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
[USBC_PORT_C2] = {
@@ -251,10 +209,6 @@ void board_reset_pd_mcu(void)
gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 0);
gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
- if (ec_cfg_usb_db_type() == DB_USB4_NCT3807)
- gpio_set_level(GPIO_USB_C1_RST_ODL, 0);
-
-
/*
* delay for power-on to reset-off and min. assertion time
*/
@@ -264,9 +218,6 @@ void board_reset_pd_mcu(void)
gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 1);
gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
- if (ec_cfg_usb_db_type() == DB_USB4_NCT3807)
- gpio_set_level(GPIO_USB_C1_RST_ODL, 1);
-
/* wait for chips to come up */
msleep(50);
@@ -288,8 +239,6 @@ static void board_tcpc_init(void)
* C0/C2 TCPC, so they must be set up after the TCPC has
* been taken out of reset.
*/
- if (ec_cfg_usb_db_type() == DB_USB4_NCT3807)
- enable_ioex(IOEX_C1_NCT38XX);
enable_ioex(IOEX_C2_NCT38XX);
}
@@ -361,14 +310,7 @@ void ppc_interrupt(enum gpio_signal signal)
{
switch (signal) {
case GPIO_USB_C1_PPC_INT_ODL:
- switch (ec_cfg_usb_db_type()) {
- case DB_USB3_PS8815:
- nx20p348x_interrupt(USBC_PORT_C1);
- break;
- case DB_USB4_NCT3807:
- syv682x_interrupt(USBC_PORT_C1);
- break;
- }
+ nx20p348x_interrupt(USBC_PORT_C1);
break;
case GPIO_USB_C2_PPC_INT_ODL:
syv682x_interrupt(USBC_PORT_C2);
@@ -392,12 +334,6 @@ __override bool board_is_dts_port(int port)
__override bool board_is_tbt_usb4_port(int port)
{
- if (((port == USBC_PORT_C2) &&
- (ec_cfg_usb_mb_type() == MB_USB4_TBT)) ||
- ((port == USBC_PORT_C1) &&
- (ec_cfg_usb_db_type() == DB_USB4_NCT3807)))
- return true;
-
return false;
}
@@ -408,15 +344,3 @@ __override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
return TBT_SS_TBT_GEN3;
}
-
-void db_update_usb4_config_from_config(void)
-{
- tcpc_config[USBC_PORT_C1] = tcpc_config_c1;
- ppc_chips[USBC_PORT_C1] = ppc_chips_c1;
- usb_muxes[USBC_PORT_C1] = usb_muxes_c1;
-}
-
-void mb_update_usb4_tbt_config_from_config(void)
-{
- usb_muxes[USBC_PORT_C2] = usb_muxes_c2;
-}
diff --git a/board/mithrax/usbc_config.h b/board/mithrax/usbc_config.h
index aaf1d02b10..22242d7c5b 100644
--- a/board/mithrax/usbc_config.h
+++ b/board/mithrax/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,18 +8,12 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#define CONFIG_USB_MUX_RUNTIME_CONFIG
-enum usbc_port {
- USBC_PORT_C2 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C2 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
-void db_update_usb4_config_from_config(void);
-void mb_update_usb4_tbt_config_from_config(void);
#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/moli/board.c b/board/moli/board.c
index 4a6445a8d6..acc12f9831 100644
--- a/board/moli/board.c
+++ b/board/moli/board.c
@@ -1,10 +1,10 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "adc.h"
-#include "assert.h"
+#include "builtin/assert.h"
#include "button.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
@@ -24,8 +24,8 @@
#include "usbc_ppc.h"
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -124,13 +124,11 @@ static const struct {
int current;
} bj_power[] = {
{ /* 0 - 90W (also default) */
- .voltage = 19000,
- .current = 4740
- },
+ .voltage = 19000,
+ .current = 4740 },
{ /* 1 - 135W */
- .voltage = 19000,
- .current = 6920
- },
+ .voltage = 19500,
+ .current = 6920 },
};
static unsigned int ec_config_get_bj_power(void)
@@ -146,7 +144,7 @@ static unsigned int ec_config_get_bj_power(void)
return bj;
}
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/* Debounced connection state of the barrel jack */
static int8_t adp_connected = -1;
static void adp_connect_deferred(void)
@@ -249,25 +247,25 @@ void board_overcurrent_event(int port, int is_overcurrented)
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A_FRONT BIT(0)
-#define THROT_TYPE_A_REAR BIT(1)
-#define THROT_TYPE_C0 BIT(2)
-#define THROT_TYPE_C1 BIT(3)
-#define THROT_PROCHOT BIT(5)
+#define THROT_TYPE_A_FRONT BIT(0)
+#define THROT_TYPE_A_REAR BIT(1)
+#define THROT_TYPE_C0 BIT(2)
+#define THROT_TYPE_C1 BIT(3)
+#define THROT_PROCHOT BIT(5)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
#include "gpio_list.h" /* Must come after other header files. */
@@ -283,8 +281,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
@@ -312,7 +309,7 @@ static void power_monitor(void)
*/
power = (adc_read_channel(ADC_VBUS) *
adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
+ 1000;
/* Init power table */
if (history[0] == 0) {
for (i = 0; i < POWER_READINGS; i++)
@@ -339,8 +336,7 @@ static void power_monitor(void)
* For barrel-jack supplies, the rating can be
* exceeded briefly, so use the average.
*/
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
power = max;
else
power = total / POWER_READINGS;
@@ -403,16 +399,18 @@ static void power_monitor(void)
gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
}
if (diff & THROT_TYPE_C0) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C0) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
pd_update_contract(0);
}
if (diff & THROT_TYPE_C1) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C1) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(1, rp);
tcpm_select_rp_value(1, rp);
diff --git a/board/moli/board.h b/board/moli/board.h
index 50744db067..ddd86c4e35 100644
--- a/board/moli/board.h
+++ b/board/moli/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,11 +21,11 @@
/* HDMI CEC */
#define CONFIG_CEC
#define CEC_GPIO_OUT GPIO_HDMI_CEC_OUT
-#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
+#define CEC_GPIO_IN GPIO_HDMI_CEC_IN
#define CEC_GPIO_PULL_UP GPIO_HDMI_CEC_PULL_UP
/* USB Type A Features */
-#define USB_PORT_COUNT 4
+#define USB_PORT_COUNT 4
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -33,7 +33,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_PPC
#define CONFIG_USBC_RETIMER_INTEL_BB
@@ -43,18 +43,18 @@
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* The design should support up to 100W. */
/* TODO(b/197702356): Set the max PD to 60W now and change it
* to 100W after we verify it.
*/
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -62,59 +62,60 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_GSC_EC_RECOVERY_BTN_ODL
/* I2C Bus Configuration */
-#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_A0_A1_MIX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_A0_A1_MIX NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_QI NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_QI NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
/* Retimer */
#define CONFIG_USBC_RETIMER_FW_UPDATE
@@ -129,15 +130,16 @@
#define CONFIG_ADC
/* Fan */
-#define CONFIG_FANS FAN_CH_COUNT
-#define RPM_DEVIATION 1
+#define CONFIG_FANS FAN_CH_COUNT
+#define RPM_DEVIATION 1
+#define CONFIG_CUSTOM_FAN_CONTROL
/* Include math_util for bitmask_uint64 used in pd_timers */
#define CONFIG_MATH_UTIL
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -153,7 +155,7 @@ enum adc_channel {
ADC_TEMP_SENSOR_2_CPU_VR,
ADC_TEMP_SENSOR_4_DIMM,
ADC_VBUS,
- ADC_PPVAR_IMON, /* ADC3 */
+ ADC_PPVAR_IMON, /* ADC3 */
ADC_CH_COUNT
};
@@ -164,28 +166,18 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
enum pwm_channel {
- PWM_CH_LED_AMBER, /* PWM0 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED_BLUE, /* PWM2 */
+ PWM_CH_LED_AMBER, /* PWM0 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED_BLUE, /* PWM2 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
/*
* firmware config fields
@@ -193,8 +185,8 @@ enum mft_channel {
/*
* Barrel-jack power (2 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 1
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 1
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
extern void adp_connect_interrupt(enum gpio_signal signal);
diff --git a/board/moli/build.mk b/board/moli/build.mk
index 00fc2723cd..4897d446b2 100644
--- a/board/moli/build.mk
+++ b/board/moli/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -18,4 +18,5 @@ board-y+=i2c.o
board-y+=led.o
board-y+=pwm.o
board-y+=sensors.o
+board-y+=thermal.o
board-y+=usbc_config.o
diff --git a/board/moli/ec.tasklist b/board/moli/ec.tasklist
index f51cbddd1b..2fda1cfb5e 100644
--- a/board/moli/ec.tasklist
+++ b/board/moli/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/moli/fans.c b/board/moli/fans.c
index f2a70636d0..7ad99d4af1 100644
--- a/board/moli/fans.c
+++ b/board/moli/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,21 +25,15 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
-/*
- * TOOD(b/197478860): need to update for real fan
- *
- * Prototype fan spins at about 7200 RPM at 100% PWM.
- * Set minimum at around 30% PWM.
- */
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 2200,
- .rpm_start = 2200,
- .rpm_max = 7200,
+ .rpm_min = 1500,
+ .rpm_start = 1500,
+ .rpm_max = 5200,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/moli/gpio.inc b/board/moli/gpio.inc
index 21336f6245..fb3b508573 100644
--- a/board/moli/gpio.inc
+++ b/board/moli/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -115,6 +115,10 @@ GPIO(USB_C0_C1_TCPC_RST_ODL, PIN(F, 5), GPIO_ODR_LOW)
/* LAN */
GPIO(LAN_PWR_GOOD, PIN(0, 2), GPIO_INPUT)
+/* LED */
+GPIO(LED_ORANGE_CONTROL, PIN(3, 1), GPIO_ODR_LOW)
+GPIO(LED_BLUE_CONTROL, PIN(2, 5), GPIO_ODR_LOW)
+
/* Option Board */
GPIO(HDMI1_MONITOR_ON, PIN(B, 4), GPIO_INPUT)
GPIO(HDMI1_MONON_SIO, PIN(1, 6), GPIO_ODR_LOW)
@@ -153,7 +157,6 @@ ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
/* Unused Pins */
UNUSED(PIN(D, 6)) /* GPOD6/CR_SOUT3/SHDF_ESPI_L */
-UNUSED(PIN(3, 1)) /* KSI0/GPIO31/TRACEDATA3/GP_MOSI */
UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
UNUSED(PIN(6, 6)) /* GPIO66 */
@@ -169,7 +172,6 @@ UNUSED(PIN(5, 0)) /* GPIO50 */
UNUSED(PIN(9, 4)) /* GPIO94 */
UNUSED(PIN(A, 0)) /* F_CS0_L/GPIOA0 */
UNUSED(PIN(3, 4)) /* GPIO34/PS2_DAT2/ADC6 */
-UNUSED(PIN(2, 5)) /* KSI4/GPIO25/TRACECLK/GP_SCLK */
UNUSED(PIN(F, 3)) /* GPIOF3/I2C4_SCL1 */
UNUSED(PIN(F, 2)) /* GPIOF2/I2C4_SDA1 */
UNUSED(PIN(A, 7)) /* GPIOA7/PS2_DAT3/TB2/F_DIO3 */
diff --git a/board/moli/i2c.c b/board/moli/i2c.c
index 534cc89a57..97625c9b29 100644
--- a/board/moli/i2c.c
+++ b/board/moli/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/moli/led.c b/board/moli/led.c
index 4f04ecdf43..f2ab214418 100644
--- a/board/moli/led.c
+++ b/board/moli/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -61,15 +61,21 @@ static int set_color_power(enum led_color color, int duty)
return EC_ERROR_UNKNOWN;
}
- if (blue)
+ if (blue && duty) {
+ gpio_set_level(GPIO_LED_BLUE_CONTROL, 1);
pwm_set_duty(PWM_CH_LED_BLUE, duty);
- else
+ } else {
+ gpio_set_level(GPIO_LED_BLUE_CONTROL, 0);
pwm_set_duty(PWM_CH_LED_BLUE, 0);
+ }
- if (amber)
+ if (amber && duty) {
+ gpio_set_level(GPIO_LED_ORANGE_CONTROL, 1);
pwm_set_duty(PWM_CH_LED_AMBER, duty);
- else
+ } else {
+ gpio_set_level(GPIO_LED_ORANGE_CONTROL, 0);
pwm_set_duty(PWM_CH_LED_AMBER, 0);
+ }
return EC_SUCCESS;
}
@@ -84,9 +90,11 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
-/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PERIOD (4 * SECOND)
+#define LED_DUTY_CYCLE (25)
+#define LED_PULSE_US (LED_PERIOD * LED_DUTY_CYCLE / 100 / 2)
+/* 10 msec for nice and smooth transition. */
+#define LED_PULSE_TICK_US (10 * MSEC)
/*
* When pulsing is enabled, brightness is incremented by <duty_inc> every
@@ -98,17 +106,26 @@ static struct {
int duty_inc;
enum led_color color;
int duty;
+ uint32_t time_off;
} led_pulse;
-#define CONFIG_TICK(interval, color) \
- config_tick((interval), 100 / (LED_PULSE_US / (interval)), (color))
+/*
+ * LED_PERIOD = time_on + time_off;
+ * time_on = LED_PULSE_US * 2;
+ * time_off = LED_PERIOD - LED_PULSE_US * 2;
+ */
+#define CONFIG_TICK(interval, period, color) \
+ config_tick((interval), 100 / (LED_PULSE_US / (interval)), \
+ LED_PERIOD - LED_PULSE_US * 2, (color))
-static void config_tick(uint32_t interval, int duty_inc, enum led_color color)
+static void config_tick(uint32_t interval, int duty_inc, int time_off,
+ enum led_color color)
{
led_pulse.interval = interval;
led_pulse.duty_inc = duty_inc;
led_pulse.color = color;
led_pulse.duty = 0;
+ led_pulse.time_off = time_off;
}
static void pulse_power_led(enum led_color color)
@@ -133,12 +150,15 @@ static void led_tick(void)
pulse_power_led(led_pulse.color);
elapsed = get_time().le.lo - start;
next = led_pulse.interval > elapsed ? led_pulse.interval - elapsed : 0;
+ next = (led_pulse.duty - led_pulse.duty_inc) ?
+ next :
+ next + led_pulse.time_off;
hook_call_deferred(&led_tick_data, next);
}
static void led_suspend(void)
{
- CONFIG_TICK(LED_PULSE_TICK_US, LED_AMBER);
+ CONFIG_TICK(LED_PULSE_TICK_US, LED_PERIOD, LED_BLUE);
led_tick();
}
DECLARE_DEFERRED(led_suspend);
@@ -178,7 +198,7 @@ static void led_resume(void)
hook_call_deferred(&led_suspend_data, -1);
hook_call_deferred(&led_shutdown_data, -1);
if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- set_color(EC_LED_ID_POWER_LED, LED_AMBER, 100);
+ set_color(EC_LED_ID_POWER_LED, LED_BLUE, 100);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, led_resume, HOOK_PRIO_DEFAULT);
@@ -186,7 +206,7 @@ void led_alert(int enable)
{
if (enable) {
/* Overwrite the current signal */
- config_tick(1 * SECOND, 100, LED_BLUE);
+ config_tick(1 * SECOND, 100, 0, LED_AMBER);
led_tick();
} else {
/* Restore the previous signal */
@@ -203,10 +223,10 @@ void show_critical_error(void)
{
hook_call_deferred(&led_tick_data, -1);
if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- set_color(EC_LED_ID_POWER_LED, LED_BLUE, 100);
+ set_color(EC_LED_ID_POWER_LED, LED_AMBER, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -231,8 +251,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|blue|amber|off|alert|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|blue|amber|off|alert|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -251,8 +270,8 @@ int led_set_brightness(enum ec_led_id id, const uint8_t *brightness)
return set_color(id, LED_OFF, 0);
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Blink alert if insufficient power per system_can_boot_ap(). */
int insufficient_power =
diff --git a/board/moli/pwm.c b/board/moli/pwm.c
index ad3d45f34c..480c90a78f 100644
--- a/board/moli/pwm.c
+++ b/board/moli/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,34 +11,23 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED_AMBER] = {
- .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
- [PWM_CH_LED_BLUE] = {
- .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 2000
- },
+ [PWM_CH_LED_AMBER] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_BLUE] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
static void board_pwm_init(void)
{
- /*
- * TODO(b/197478860): Turn on the fan at 100% by default
- * We need to find tune the fan speed according to the
- * thermal sensor value.
- */
pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, 100);
-
pwm_enable(PWM_CH_LED_BLUE, 1);
pwm_enable(PWM_CH_LED_AMBER, 1);
}
diff --git a/board/moli/sensors.c b/board/moli/sensors.c
index 8992b24ac4..5394f16f5d 100644
--- a/board/moli/sensors.c
+++ b/board/moli/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -51,58 +51,52 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_SSD] = {
- .name = "SSD",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_SSD
- },
- [TEMP_SENSOR_2_CPU_VR] = {
- .name = "CPU VR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_CPU_VR
- },
- [TEMP_SENSOR_4_DIMM] = {
- .name = "DIMM",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_DIMM
- },
+ [TEMP_SENSOR_1_SSD] = { .name = "SSD",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_SSD },
+ [TEMP_SENSOR_2_CPU_VR] = { .name = "CPU VR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_CPU_VR },
+ [TEMP_SENSOR_4_DIMM] = { .name = "DIMM",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_DIMM },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-/*
- * TODO(b/180681346): update for Alder Lake/brya
- *
- * Tiger Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
- * 130 C. However, sensor is located next to DDR, so we need to use the lower
- * DDR temperature limit (85 C)
- */
-/*
- * TODO(b/202062363): Remove when clang is fixed.
- */
-#define THERMAL_CPU \
- { \
- .temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(80), \
- }, \
- .temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
- }, \
- .temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(50), \
+#define THERMAL_SSD \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(64), \
+ }, \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_ssd = THERMAL_SSD;
+
+#define THERMAL_CPU \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(100), \
+ }, \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
+#define THERMAL_DIMM \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(67), \
+ }, \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_dimm =
+ THERMAL_DIMM;
/*
* TODO(b/197478860): add the thermal sensor setting
*/
/* this should really be "const" */
struct ec_thermal_config thermal_params[] = {
- [TEMP_SENSOR_1_SSD] = THERMAL_CPU,
+ [TEMP_SENSOR_1_SSD] = THERMAL_SSD,
[TEMP_SENSOR_2_CPU_VR] = THERMAL_CPU,
- [TEMP_SENSOR_4_DIMM] = THERMAL_CPU,
+ [TEMP_SENSOR_4_DIMM] = THERMAL_DIMM,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/moli/thermal.c b/board/moli/thermal.c
new file mode 100644
index 0000000000..110d8ae2db
--- /dev/null
+++ b/board/moli/thermal.c
@@ -0,0 +1,143 @@
+/* Copyright 2022 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "chipset.h"
+#include "common.h"
+#include "console.h"
+#include "fan.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "temp_sensor.h"
+#include "thermal.h"
+#include "util.h"
+/* Console output macros */
+#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
+
+struct fan_step {
+ /*
+ * Sensor 1~4 trigger point, set -1 if we're not using this
+ * sensor to determine fan speed.
+ */
+ int8_t on[TEMP_SENSOR_COUNT];
+ /*
+ * Sensor 1~4 trigger point, set -1 if we're not using this
+ * sensor to determine fan speed.
+ */
+ int8_t off[TEMP_SENSOR_COUNT];
+ /* Fan rpm */
+ uint16_t rpm[FAN_CH_COUNT];
+};
+
+static const struct fan_step fan_table[] = {
+ {
+ /* level 0 */
+ .on = { -1, 47, -1 },
+ .off = { -1, 0, -1 },
+ .rpm = { 1900 },
+ },
+ {
+ /* level 1 */
+ .on = { -1, 50, -1 },
+ .off = { -1, 47, -1 },
+ .rpm = { 2400 },
+ },
+ {
+ /* level 2 */
+ .on = { -1, 60, -1 },
+ .off = { -1, 57, -1 },
+ .rpm = { 3000 },
+ },
+ {
+ /* level 3 */
+ .on = { -1, 70, -1 },
+ .off = { -1, 67, -1 },
+ .rpm = { 3500 },
+ },
+ {
+ /* level 4 */
+ .on = { -1, 80, -1 },
+ .off = { -1, 77, -1 },
+ .rpm = { 4000 },
+ },
+ {
+ /* level 5 */
+ .on = { -1, 90, -1 },
+ .off = { -1, 87, -1 },
+ .rpm = { 4500 },
+ },
+};
+const int num_fan_levels = ARRAY_SIZE(fan_table);
+
+int fan_table_to_rpm(int fan, int *temp, enum temp_sensor_id temp_sensor)
+{
+ /* current fan level */
+ static int current_level;
+ /* previous fan level */
+ static int prev_current_level;
+ /* previous sensor temperature */
+ static int prev_temp[TEMP_SENSOR_COUNT];
+ int i;
+ int new_rpm = 0;
+
+ /*
+ * Compare the current and previous temperature, we have
+ * the three paths :
+ * 1. decreasing path. (check the release point)
+ * 2. increasing path. (check the trigger point)
+ * 3. invariant path. (return the current RPM)
+ */
+ if (temp[temp_sensor] < prev_temp[temp_sensor]) {
+ for (i = current_level; i > 0; i--) {
+ if (temp[temp_sensor] < fan_table[i].off[temp_sensor])
+ current_level = i - 1;
+ else
+ break;
+ }
+ } else if (temp[temp_sensor] > prev_temp[temp_sensor]) {
+ for (i = current_level; i < num_fan_levels; i++) {
+ if (temp[temp_sensor] >= fan_table[i].on[temp_sensor])
+ current_level = i;
+ else
+ break;
+ }
+ }
+ if (current_level < 0)
+ current_level = 0;
+ if (current_level >= num_fan_levels)
+ current_level = num_fan_levels - 1;
+
+ if (current_level != prev_current_level) {
+ CPRINTS("temp: %d, prev_temp: %d", temp[temp_sensor],
+ prev_temp[temp_sensor]);
+ CPRINTS("current_level: %d", current_level);
+ }
+
+ prev_temp[temp_sensor] = temp[temp_sensor];
+ prev_current_level = current_level;
+
+ switch (fan) {
+ case FAN_CH_0:
+ new_rpm = fan_table[current_level].rpm[FAN_CH_0];
+ break;
+ default:
+ break;
+ }
+ return new_rpm;
+}
+
+void board_override_fan_control(int fan, int *temp)
+{
+ if (chipset_in_state(CHIPSET_STATE_ON)) {
+ fan_set_rpm_mode(FAN_CH(fan), 1);
+ fan_set_rpm_target(FAN_CH(fan),
+ fan_table_to_rpm(FAN_CH(fan), temp,
+ TEMP_SENSOR_2_CPU_VR));
+ } else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
+ /* Stop fan when enter S0ix */
+ fan_set_rpm_mode(FAN_CH(fan), 1);
+ fan_set_rpm_target(FAN_CH(fan), 0);
+ }
+}
diff --git a/board/moli/usbc_config.c b/board/moli/usbc_config.c
index a54564c34c..fce8b46aa2 100644
--- a/board/moli/usbc_config.c
+++ b/board/moli/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,8 +30,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -76,34 +76,44 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/moli/usbc_config.h b/board/moli/usbc_config.h
index 002f4803b7..219ad9a745 100644
--- a/board/moli/usbc_config.h
+++ b/board/moli/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,12 +8,8 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/moonbuggy/board.c b/board/moonbuggy/board.c
index cfe0121374..9d8162c2d0 100644
--- a/board/moonbuggy/board.c
+++ b/board/moonbuggy/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,8 +36,8 @@
#include "usb_common.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -49,14 +49,14 @@ static int32_t base_5v_power;
* Power usage for each port as measured or estimated.
* Units are milliwatts (5v x ma current)
*/
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1500)
-#define PWR_FRONT_LOW (5*900)
-#define PWR_REAR (5*1500)
-#define PWR_HDMI (5*562)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
+#define PWR_BASE_LOAD (5 * 1335)
+#define PWR_FRONT_HIGH (5 * 1500)
+#define PWR_FRONT_LOW (5 * 900)
+#define PWR_REAR (5 * 1500)
+#define PWR_HDMI (5 * 562)
+#define PWR_C_HIGH (5 * 3740)
+#define PWR_C_LOW (5 * 2090)
+#define PWR_MAX (5 * 10000)
/*
* Update the 5V power usage, assuming no throttling,
@@ -147,64 +147,52 @@ void ads_12v_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_WHITE] = { .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_LED_WHITE] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "ina",
- .port = I2C_PORT_INA,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "pse",
- .port = I2C_PORT_PSE,
- .kbps = 400,
- .scl = GPIO_I2C4_SCL,
- .sda = GPIO_I2C4_SDA
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 400,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "pse",
+ .port = I2C_PORT_PSE,
+ .kbps = 400,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C4_SDA },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -260,15 +248,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
+const enum gpio_signal hibernate_wake_pins[] = {};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -287,7 +274,7 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -296,8 +283,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
@@ -382,13 +369,16 @@ static void board_init(void)
*/
if (board_version < 2)
button_disable_gpio(BUTTON_RECOVERY);
+
+ /* ADS GPIO interrupt enable*/
+ gpio_enable_interrupt(GPIO_ADS_5VS_V2_ADP_PRESENT_L);
+ gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_L);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/******************************************************************************/
/* USB-A port control */
-const int usb_port_enable[USB_PORT_COUNT] = {
-};
+const int usb_port_enable[USB_PORT_COUNT] = {};
int64_t get_time_dsw_pwrok(void)
{
@@ -449,23 +439,23 @@ void board_enable_s0_rails(int enable)
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
+#define THROT_TYPE_A BIT(0)
+#define THROT_TYPE_C BIT(1)
+#define THROT_PROCHOT BIT(2)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -478,8 +468,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
diff --git a/board/moonbuggy/board.h b/board/moonbuggy/board.h
index b5e8424230..26e230b2a7 100644
--- a/board/moonbuggy/board.h
+++ b/board/moonbuggy/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
#define CONFIG_UART_TX_BUF_SIZE 4096
/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
/* Internal SPI flash on NPCX796FC is 512 kB */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
@@ -40,7 +40,7 @@
#undef CONFIG_HIBERNATE
#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
#define CONFIG_PWM
#define CONFIG_VBOOT_EFS2
@@ -119,12 +119,12 @@
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_PSE NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_INA NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
+#define I2C_PORT_PSE NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
@@ -134,11 +134,11 @@
#include "registers.h"
enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_SNS_PP3300, /* ADC2 */
+ ADC_SNS_PP1050, /* ADC7 */
+ ADC_VBUS, /* ADC4 */
+ ADC_PPVAR_IMON, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
/* Number of ADC channels */
ADC_CH_COUNT
};
@@ -163,10 +163,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_CORE,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_CORE, TEMP_SENSOR_COUNT };
/* Board specific handlers */
void led_alert(int enable);
@@ -182,20 +179,20 @@ void ads_12v_interrupt(enum gpio_signal signal);
/*
* Barrel-jack power (4 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 3
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
/*
* USB Connector 4 not present (1 bit).
*/
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
+#define EC_CFG_NO_USB4_L 4
+#define EC_CFG_NO_USB4_H 4
#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
/*
* Thermal solution config (3 bits).
*/
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
+#define EC_CFG_THERMAL_L 5
+#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
unsigned int ec_config_get_thermal_solution(void);
@@ -203,30 +200,30 @@ unsigned int ec_config_get_thermal_solution(void);
#endif /* !__ASSEMBLER__ */
/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
/*
* There is no RSMRST input, so alias it to the output. This short-circuits
* common_intel_x86_handle_rsmrst.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/moonbuggy/build.mk b/board/moonbuggy/build.mk
index 0acd315b39..aca2a91e5c 100644
--- a/board/moonbuggy/build.mk
+++ b/board/moonbuggy/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/moonbuggy/ec.tasklist b/board/moonbuggy/ec.tasklist
index 3828142c55..c43d643410 100644
--- a/board/moonbuggy/ec.tasklist
+++ b/board/moonbuggy/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/moonbuggy/gpio.inc b/board/moonbuggy/gpio.inc
index b2d25440a6..bb914d2254 100644
--- a/board/moonbuggy/gpio.inc
+++ b/board/moonbuggy/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
/* EC output, but also interrupt so this can be polled as a power signal */
GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
#endif
GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/moonbuggy/led.c b/board/moonbuggy/led.c
index f05733a387..cc76c36dce 100644
--- a/board/moonbuggy/led.c
+++ b/board/moonbuggy/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -84,9 +84,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -218,7 +218,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
@@ -243,8 +243,7 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|white|off|alert|crit]",
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|red|white|off|alert|crit]",
"Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
diff --git a/board/moonbuggy/pse.c b/board/moonbuggy/pse.c
index 84d5048a86..c309db887a 100644
--- a/board/moonbuggy/pse.c
+++ b/board/moonbuggy/pse.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,44 +18,44 @@
#include "timer.h"
#include "util.h"
-#define LTC4291_I2C_ADDR 0x2C
-
-#define LTC4291_REG_SUPEVN_COR 0x0B
-#define LTC4291_REG_STATPWR 0x10
-#define LTC4291_REG_STATPIN 0x11
-#define LTC4291_REG_OPMD 0x12
-#define LTC4291_REG_DISENA 0x13
-#define LTC4291_REG_DETENA 0x14
-#define LTC4291_REG_DETPB 0x18
-#define LTC4291_REG_PWRPB 0x19
-#define LTC4291_REG_RSTPB 0x1A
-#define LTC4291_REG_ID 0x1B
-#define LTC4291_REG_DEVID 0x43
-#define LTC4291_REG_HPMD1 0x46
-#define LTC4291_REG_HPMD2 0x4B
-#define LTC4291_REG_HPMD3 0x50
-#define LTC4291_REG_HPMD4 0x55
-#define LTC4291_REG_LPWRPB 0x6E
-
-#define LTC4291_FLD_STATPIN_AUTO BIT(0)
-#define LTC4291_FLD_RSTPB_RSTALL BIT(4)
-
-#define LTC4291_STATPWR_ON_PORT(port) (0x01 << (port))
-#define LTC4291_DETENA_EN_PORT(port) (0x11 << (port))
-#define LTC4291_DETPB_EN_PORT(port) (0x11 << (port))
-#define LTC4291_PWRPB_OFF_PORT(port) (0x10 << (port))
-
-#define LTC4291_OPMD_AUTO 0xFF
-#define LTC4291_DISENA_ALL 0x0F
-#define LTC4291_DETENA_ALL 0xFF
-#define LTC4291_ID 0x64
-#define LTC4291_DEVID 0x38
-#define LTC4291_HPMD_MIN 0x00
-#define LTC4291_HPMD_MAX 0xA8
-
-#define LTC4291_PORT_MAX 4
-
-#define LTC4291_RESET_DELAY_US (20 * MSEC)
+#define LTC4291_I2C_ADDR 0x2C
+
+#define LTC4291_REG_SUPEVN_COR 0x0B
+#define LTC4291_REG_STATPWR 0x10
+#define LTC4291_REG_STATPIN 0x11
+#define LTC4291_REG_OPMD 0x12
+#define LTC4291_REG_DISENA 0x13
+#define LTC4291_REG_DETENA 0x14
+#define LTC4291_REG_DETPB 0x18
+#define LTC4291_REG_PWRPB 0x19
+#define LTC4291_REG_RSTPB 0x1A
+#define LTC4291_REG_ID 0x1B
+#define LTC4291_REG_DEVID 0x43
+#define LTC4291_REG_HPMD1 0x46
+#define LTC4291_REG_HPMD2 0x4B
+#define LTC4291_REG_HPMD3 0x50
+#define LTC4291_REG_HPMD4 0x55
+#define LTC4291_REG_LPWRPB 0x6E
+
+#define LTC4291_FLD_STATPIN_AUTO BIT(0)
+#define LTC4291_FLD_RSTPB_RSTALL BIT(4)
+
+#define LTC4291_STATPWR_ON_PORT(port) (0x01 << (port))
+#define LTC4291_DETENA_EN_PORT(port) (0x11 << (port))
+#define LTC4291_DETPB_EN_PORT(port) (0x11 << (port))
+#define LTC4291_PWRPB_OFF_PORT(port) (0x10 << (port))
+
+#define LTC4291_OPMD_AUTO 0xFF
+#define LTC4291_DISENA_ALL 0x0F
+#define LTC4291_DETENA_ALL 0xFF
+#define LTC4291_ID 0x64
+#define LTC4291_DEVID 0x38
+#define LTC4291_HPMD_MIN 0x00
+#define LTC4291_HPMD_MAX 0xA8
+
+#define LTC4291_PORT_MAX 4
+
+#define LTC4291_RESET_DELAY_US (20 * MSEC)
#define I2C_PSE_READ(reg, data) \
i2c_read8(I2C_PORT_PSE, LTC4291_I2C_ADDR, LTC4291_REG_##reg, (data))
@@ -63,7 +63,7 @@
#define I2C_PSE_WRITE(reg, data) \
i2c_write8(I2C_PORT_PSE, LTC4291_I2C_ADDR, LTC4291_REG_##reg, (data))
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static int pse_write_hpmd(int port, int val)
{
@@ -172,7 +172,7 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, pse_init, HOOK_PRIO_DEFAULT);
/* Also reset the PSE on a reboot to toggle the power. */
DECLARE_HOOK(HOOK_CHIPSET_RESET, pse_init, HOOK_PRIO_DEFAULT);
-static int command_pse(int argc, char **argv)
+static int command_pse(int argc, const char **argv)
{
int port;
@@ -204,8 +204,7 @@ static int command_pse(int argc, char **argv)
else
return EC_ERROR_PARAM2;
}
-DECLARE_CONSOLE_COMMAND(pse, command_pse,
- "<port# 0-3> <off | on | min | max>",
+DECLARE_CONSOLE_COMMAND(pse, command_pse, "<port# 0-3> <off | on | min | max>",
"Set PSE port power");
static int ec_command_pse_status(int port, uint8_t *status)
diff --git a/board/morphius/battery.c b/board/morphius/battery.c
index 6d8a8190b2..6867bcd8bd 100644
--- a/board/morphius/battery.c
+++ b/board/morphius/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/morphius/board.c b/board/morphius/board.c
index beca0d89f0..e801fd8569 100644
--- a/board/morphius/board.c
+++ b/board/morphius/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
#include "driver/accelgyro_icm426xx.h"
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/retimer/pi3dpx1207.h"
#include "driver/retimer/pi3hdx1204.h"
@@ -59,21 +59,15 @@ static bool ignore_c1_dp;
static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
-mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-const mat33_fp_t base_standard_ref_1 = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+const mat33_fp_t base_standard_ref_1 = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -293,6 +287,10 @@ void motion_interrupt(enum gpio_signal signal)
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration
*/
+
+/* Place holder for second mux in USBC1 chain */
+struct usb_mux_chain usbc1_mux1;
+
static void setup_mux(void)
{
if (ec_config_has_usbc1_retimer_ps8802()) {
@@ -304,12 +302,10 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the PS8802
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_ps8802,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_ps8802;
/* Set the AMD FP5 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux;
+ usbc1_mux1.mux = &usbc1_amd_fp5_usb_mux;
/* Don't have the AMD FP5 flip */
usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
@@ -323,12 +319,10 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the AMD FP5
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_amd_fp5_usb_mux,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux;
/* Set the PS8818 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818;
+ usbc1_mux1.mux = &usbc1_ps8818;
}
}
@@ -342,23 +336,29 @@ const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pi3dpx1207_controls) == USBC_PORT_COUNT);
-const struct usb_mux usbc0_pi3dpx1207_usb_retimer = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
- .driver = &pi3dpx1207_usb_retimer,
+const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
+ .driver = &pi3dpx1207_usb_retimer,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_pi3dpx1207_usb_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_pi3dpx1207_usb_retimer,
},
[USBC_PORT_C1] = {
/* Filled in dynamically at startup */
+ .next = &usbc1_mux1,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -400,11 +400,9 @@ int board_usbc_port_to_hpd_gpio_or_ioex(int port)
* this will be removed when version_2 hardware is retired.
*/
else if (ec_config_has_mst_hub_rtd2141b())
- return (board_ver >= 4)
- ? GPIO_USB_C1_HPD_IN_DB_V1
- : (board_ver == 3)
- ? IOEX_USB_C1_HPD_IN_DB
- : GPIO_EC_DP1_HPD;
+ return (board_ver >= 4) ? GPIO_USB_C1_HPD_IN_DB_V1 :
+ (board_ver == 3) ? IOEX_USB_C1_HPD_IN_DB :
+ GPIO_EC_DP1_HPD;
/* USB-C1 OPT1 DB uses DP2_HPD. */
return GPIO_DP2_HPD;
@@ -486,7 +484,7 @@ DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -584,8 +582,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(105), \
@@ -605,11 +603,11 @@ static void setup_fans(void)
DECLARE_HOOK(HOOK_INIT, setup_fans, HOOK_PRIO_DEFAULT);
/* Battery functions */
-#define SB_OPTIONALMFG_FUNCTION2 0x26
-#define SMART_CHARGE_SUPPORT 0x01
-#define SMART_CHARGE_ENABLE 0x02
-#define SB_SMART_CHARGE_ENABLE 1
-#define SB_SMART_CHARGE_DISABLE 0
+#define SB_OPTIONALMFG_FUNCTION2 0x26
+#define SMART_CHARGE_SUPPORT 0x01
+#define SMART_CHARGE_ENABLE 0x02
+#define SB_SMART_CHARGE_ENABLE 1
+#define SB_SMART_CHARGE_DISABLE 0
static void sb_smart_charge_mode(int enable)
{
@@ -651,18 +649,18 @@ __override void ppc_interrupt(enum gpio_signal signal)
* the attached NCT3807 to control a GPIO to indicate 1A5 or 3A0
* current limits.
*/
-__override int board_aoz1380_set_vbus_source_current_limit(int port,
- enum tcpc_rp_value rp)
+__override int
+board_aoz1380_set_vbus_source_current_limit(int port, enum tcpc_rp_value rp)
{
int rv;
/* Use the TCPC to set the current limit */
if (port == 0) {
rv = ioex_set_level(IOEX_USB_C0_PPC_ILIM_3A_EN,
- (rp == TYPEC_RP_3A0) ? 1 : 0);
+ (rp == TYPEC_RP_3A0) ? 1 : 0);
} else if (board_ver >= 3) {
rv = ioex_set_level(IOEX_USB_C1_PPC_ILIM_3A_EN,
- (rp == TYPEC_RP_3A0) ? 1 : 0);
+ (rp == TYPEC_RP_3A0) ? 1 : 0);
} else {
rv = 1;
}
@@ -716,8 +714,7 @@ static void board_chipset_resume(void)
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 1);
msleep(PI3HDX1204_POWER_ON_DELAY_MS);
}
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
check_hdmi_hpd_status());
}
}
@@ -735,16 +732,14 @@ static void board_chipset_suspend(void)
sb_smart_charge_mode(SB_SMART_CHARGE_ENABLE);
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
if (board_ver >= 3)
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 0);
}
/* Wait 500ms before allowing DP event to cause resume. */
- if (ec_config_has_mst_hub_rtd2141b()
- && (dp_flags[USBC_PORT_C1] & DP_FLAGS_DP_ON)) {
+ if (ec_config_has_mst_hub_rtd2141b() &&
+ (dp_flags[USBC_PORT_C1] & DP_FLAGS_DP_ON)) {
ignore_c1_dp = true;
hook_call_deferred(&board_chipset_suspend_delay_data,
500 * MSEC);
@@ -789,15 +784,14 @@ BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {3, 0}, {2, 2}, {2, 3}, {1, 2}, {2, 5},
- {2, 4}, {2, 1}, {2, 7}, {2, 6}, {1, 5},
- {2, 0}, {3, 1}, {1, 7}, {1, 6}, {-1, -1},
- {1, 3}, {1, 4}, {-1, -1}, {-1, -1}, {0, 7},
- {0, 6}, {1, 0}, {1, 1}, {0, 5},
+ { 3, 0 }, { 2, 2 }, { 2, 3 }, { 1, 2 }, { 2, 5 }, { 2, 4 },
+ { 2, 1 }, { 2, 7 }, { 2, 6 }, { 1, 5 }, { 2, 0 }, { 3, 1 },
+ { 1, 7 }, { 1, 6 }, { -1, -1 }, { 1, 3 }, { 1, 4 }, { -1, -1 },
+ { -1, -1 }, { 0, 7 }, { 0, 6 }, { 1, 0 }, { 1, 1 }, { 0, 5 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
/*****************************************************************************
@@ -840,10 +834,9 @@ static void hdmi_hpd_handler(void)
gpio_set_level(GPIO_EC_DP1_HPD, hpd);
ccprints("HDMI HPD %d", hpd);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON)
- && hpd);
+ pi3hdx1204_enable(
+ I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) && hpd);
}
DECLARE_DEFERRED(hdmi_hpd_handler);
diff --git a/board/morphius/board.h b/board/morphius/board.h
index 180b1df9d0..39bce41a46 100644
--- a/board/morphius/board.h
+++ b/board/morphius/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -52,36 +52,35 @@
#define RPM_DEVIATION 1
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_PWR_A
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_PWR_A
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
/* I2C mapping from board specific function*/
-#define I2C_PORT_THERMAL I2C_PORT_AP_HDMI
+#define I2C_PORT_THERMAL I2C_PORT_AP_HDMI
#ifndef __ASSEMBLER__
-
void ps2_pwr_en_interrupt(enum gpio_signal signal);
enum adc_channel {
@@ -118,11 +117,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
@@ -172,40 +167,32 @@ enum ec_cfg_usb_db_type {
#include "cbi_ec_fw_config.h"
-#define HAS_USBC1_RETIMER_PS8802 \
- (BIT(MORPHIUS_DB_T_OPT3_USBC_HDMI_MSTHUB))
+#define HAS_USBC1_RETIMER_PS8802 (BIT(MORPHIUS_DB_T_OPT3_USBC_HDMI_MSTHUB))
static inline bool ec_config_has_usbc1_retimer_ps8802(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8802);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8802);
}
-#define HAS_USBC1_RETIMER_PS8818 \
- (BIT(MORPHIUS_DB_T_OPT1_USBC_HDMI))
+#define HAS_USBC1_RETIMER_PS8818 (BIT(MORPHIUS_DB_T_OPT1_USBC_HDMI))
static inline bool ec_config_has_usbc1_retimer_ps8818(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8818);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8818);
}
-#define HAS_HDMI_RETIMER_PI3HDX1204 \
- (BIT(MORPHIUS_DB_T_OPT1_USBC_HDMI))
+#define HAS_HDMI_RETIMER_PI3HDX1204 (BIT(MORPHIUS_DB_T_OPT1_USBC_HDMI))
static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_RETIMER_PI3HDX1204);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_RETIMER_PI3HDX1204);
}
-#define HAS_MST_HUB_RTD2141B \
- (BIT(MORPHIUS_DB_T_OPT3_USBC_HDMI_MSTHUB))
+#define HAS_MST_HUB_RTD2141B (BIT(MORPHIUS_DB_T_OPT3_USBC_HDMI_MSTHUB))
static inline bool ec_config_has_mst_hub_rtd2141b(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_MST_HUB_RTD2141B);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_MST_HUB_RTD2141B);
}
void motion_interrupt(enum gpio_signal signal);
@@ -219,12 +206,11 @@ void motion_interrupt(enum gpio_signal signal);
int board_usbc_port_to_hpd_gpio_or_ioex(int port);
#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio_or_ioex(port)
-extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer;
-extern const struct usb_mux usbc1_ps8802;
+extern const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer;
extern const struct usb_mux usbc1_ps8818;
+extern struct usb_mux usbc1_ps8802;
extern struct usb_mux usbc1_amd_fp5_usb_mux;
#endif /* !__ASSEMBLER__ */
-
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/morphius/build.mk b/board/morphius/build.mk
index 4c2a6c5546..d6a15192ec 100644
--- a/board/morphius/build.mk
+++ b/board/morphius/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/morphius/ec.tasklist b/board/morphius/ec.tasklist
index 41b83cf4f3..4bb60ed55d 100644
--- a/board/morphius/ec.tasklist
+++ b/board/morphius/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/morphius/gpio.inc b/board/morphius/gpio.inc
index f14c56c66f..0597419c63 100644
--- a/board/morphius/gpio.inc
+++ b/board/morphius/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/morphius/led.c b/board/morphius/led.c
index 5e72653fe3..23f715da02 100644
--- a/board/morphius/led.c
+++ b/board/morphius/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,8 +17,8 @@
#include "timer.h"
#include "util.h"
-#define LED_BAT_OFF_LVL 0
-#define LED_BAT_ON_LVL 1
+#define LED_BAT_OFF_LVL 0
+#define LED_BAT_ON_LVL 1
#define LED_BAT_S3_OFF_TIME_MS 3000
#define LED_BAT_S3_PWM_RESCALE 5
#define LED_BAT_S3_TICK_MS 50
@@ -34,10 +34,8 @@
static int ticks;
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -45,13 +43,13 @@ enum led_color {
LED_OFF = 0,
LED_WHITE,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
/* PWM brightness vs. color, in the order of off, white */
static const uint8_t color_brightness[2] = {
- [LED_OFF] = 0,
- [LED_WHITE] = 100,
+ [LED_OFF] = 0,
+ [LED_WHITE] = 100,
};
void led_set_color_power(enum led_color color)
@@ -111,10 +109,10 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
} else if (led_id == EC_LED_ID_POWER_LED) {
if (brightness[EC_LED_COLOR_WHITE] != 0)
pwm_set_duty(PWM_CH_POWER_LED,
- color_brightness[LED_WHITE]);
+ color_brightness[LED_WHITE]);
else
pwm_set_duty(PWM_CH_POWER_LED,
- color_brightness[LED_OFF]);
+ color_brightness[LED_OFF]);
}
return EC_SUCCESS;
@@ -133,8 +131,8 @@ static void suspend_led_update_deferred(void)
if (ticks <= TICKS_STEP2_DIMMER) {
pwm_set_duty(PWM_CH_POWER_LED, ticks * LED_BAT_S3_PWM_RESCALE);
} else if (ticks <= TICKS_STEP3_OFF) {
- pwm_set_duty(PWM_CH_POWER_LED,
- (TICKS_STEP3_OFF - ticks) * LED_BAT_S3_PWM_RESCALE);
+ pwm_set_duty(PWM_CH_POWER_LED, (TICKS_STEP3_OFF - ticks) *
+ LED_BAT_S3_PWM_RESCALE);
} else {
ticks = TICKS_STEP1_BRIGHTER;
delay = LED_BAT_S3_OFF_TIME_MS * MSEC;
@@ -161,7 +159,6 @@ DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, suspend_led_deinit, HOOK_PRIO_DEFAULT);
static void led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -177,11 +174,11 @@ static void led_set_battery(void)
led_set_color_battery(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x4) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+ led_set_color_battery(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks & 0x4) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
@@ -204,9 +201,10 @@ static void led_set_power(void)
power_ticks = 0;
while (blink_ticks < LED_PWR_TICKS_PER_CYCLE) {
- led_set_color_power(
- (power_ticks % LED_TOTAL_TICKS) < LED_ON_TICKS ?
- LED_WHITE : LED_OFF);
+ led_set_color_power((power_ticks % LED_TOTAL_TICKS) <
+ LED_ON_TICKS ?
+ LED_WHITE :
+ LED_OFF);
previous_state_suspend = 1;
return;
diff --git a/board/morphius/thermal.c b/board/morphius/thermal.c
index a51dee7c8b..2ffc2d105b 100644
--- a/board/morphius/thermal.c
+++ b/board/morphius/thermal.c
@@ -1,8 +1,9 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "builtin/assert.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -20,7 +21,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -44,316 +45,315 @@ static const struct fan_step *fan_step_table;
static const struct fan_step fan1_table_clamshell[] = {
{
/* level 0 */
- .on = {-1, -1, -1, -1},
- .off = {-1, -1, -1, -1},
- .rpm = {0},
+ .on = { -1, -1, -1, -1 },
+ .off = { -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 40, -1},
- .off = {-1, -1, 31, -1},
- .rpm = {1900},
+ .on = { -1, -1, 40, -1 },
+ .off = { -1, -1, 31, -1 },
+ .rpm = { 1900 },
},
{
/* level 2 */
- .on = {-1, -1, 45, -1},
- .off = {-1, -1, 43, -1},
- .rpm = {2900},
+ .on = { -1, -1, 45, -1 },
+ .off = { -1, -1, 43, -1 },
+ .rpm = { 2900 },
},
{
/* level 3 */
- .on = {-1, -1, 48, -1},
- .off = {-1, -1, 46, -1},
- .rpm = {3200},
+ .on = { -1, -1, 48, -1 },
+ .off = { -1, -1, 46, -1 },
+ .rpm = { 3200 },
},
{
/* level 4 */
- .on = {-1, -1, 51, -1},
- .off = {-1, -1, 49, -1},
- .rpm = {3550},
+ .on = { -1, -1, 51, -1 },
+ .off = { -1, -1, 49, -1 },
+ .rpm = { 3550 },
},
{
/* level 5 */
- .on = {-1, -1, 54, -1},
- .off = {-1, -1, 52, -1},
- .rpm = {3950},
+ .on = { -1, -1, 54, -1 },
+ .off = { -1, -1, 52, -1 },
+ .rpm = { 3950 },
},
{
/* level 6 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 55, -1},
- .rpm = {4250},
+ .on = { -1, -1, 57, -1 },
+ .off = { -1, -1, 55, -1 },
+ .rpm = { 4250 },
},
{
/* level 7 */
- .on = {-1, -1, 60, -1},
- .off = {-1, -1, 58, -1},
- .rpm = {4650},
+ .on = { -1, -1, 60, -1 },
+ .off = { -1, -1, 58, -1 },
+ .rpm = { 4650 },
},
};
static const struct fan_step fan1_table_tablet[] = {
{
/* level 0 */
- .on = {-1, -1, -1, -1},
- .off = {-1, -1, -1, -1},
- .rpm = {0},
+ .on = { -1, -1, -1, -1 },
+ .off = { -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 41, -1},
- .off = {-1, -1, 31, -1},
- .rpm = {2100},
+ .on = { -1, -1, 41, -1 },
+ .off = { -1, -1, 31, -1 },
+ .rpm = { 2100 },
},
{
/* level 2 */
- .on = {-1, -1, 50, -1},
- .off = {-1, -1, 48, -1},
- .rpm = {2600},
+ .on = { -1, -1, 50, -1 },
+ .off = { -1, -1, 48, -1 },
+ .rpm = { 2600 },
},
{
/* level 3 */
- .on = {-1, -1, 54, -1},
- .off = {-1, -1, 52, -1},
- .rpm = {2800},
+ .on = { -1, -1, 54, -1 },
+ .off = { -1, -1, 52, -1 },
+ .rpm = { 2800 },
},
{
/* level 4 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 55, -1},
- .rpm = {3300},
+ .on = { -1, -1, 57, -1 },
+ .off = { -1, -1, 55, -1 },
+ .rpm = { 3300 },
},
{
/* level 5 */
- .on = {-1, -1, 60, -1},
- .off = {-1, -1, 58, -1},
- .rpm = {3800},
+ .on = { -1, -1, 60, -1 },
+ .off = { -1, -1, 58, -1 },
+ .rpm = { 3800 },
},
{
/* level 6 */
- .on = {-1, -1, 72, -1},
- .off = {-1, -1, 69, -1},
- .rpm = {4000},
+ .on = { -1, -1, 72, -1 },
+ .off = { -1, -1, 69, -1 },
+ .rpm = { 4000 },
},
{
/* level 7 */
- .on = {-1, -1, 74, -1},
- .off = {-1, -1, 73, -1},
- .rpm = {4300},
+ .on = { -1, -1, 74, -1 },
+ .off = { -1, -1, 73, -1 },
+ .rpm = { 4300 },
},
};
static const struct fan_step fan1_table_stand[] = {
{
/* level 0 */
- .on = {-1, -1, -1, -1},
- .off = {-1, -1, -1, -1},
- .rpm = {0},
+ .on = { -1, -1, -1, -1 },
+ .off = { -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 34, -1},
- .off = {-1, -1, 31, -1},
- .rpm = {1850},
+ .on = { -1, -1, 34, -1 },
+ .off = { -1, -1, 31, -1 },
+ .rpm = { 1850 },
},
{
/* level 2 */
- .on = {-1, -1, 42, -1},
- .off = {-1, -1, 39, -1},
- .rpm = {2550},
+ .on = { -1, -1, 42, -1 },
+ .off = { -1, -1, 39, -1 },
+ .rpm = { 2550 },
},
{
/* level 3 */
- .on = {-1, -1, 49, -1},
- .off = {-1, -1, 48, -1},
- .rpm = {2900},
+ .on = { -1, -1, 49, -1 },
+ .off = { -1, -1, 48, -1 },
+ .rpm = { 2900 },
},
{
/* level 4 */
- .on = {-1, -1, 51, -1},
- .off = {-1, -1, 50, -1},
- .rpm = {3350},
+ .on = { -1, -1, 51, -1 },
+ .off = { -1, -1, 50, -1 },
+ .rpm = { 3350 },
},
{
/* level 5 */
- .on = {-1, -1, 53, -1},
- .off = {-1, -1, 52, -1},
- .rpm = {3700},
+ .on = { -1, -1, 53, -1 },
+ .off = { -1, -1, 52, -1 },
+ .rpm = { 3700 },
},
{
/* level 6 */
- .on = {-1, -1, 55, -1},
- .off = {-1, -1, 54, -1},
- .rpm = {3900},
+ .on = { -1, -1, 55, -1 },
+ .off = { -1, -1, 54, -1 },
+ .rpm = { 3900 },
},
{
/* level 7 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 56, -1},
- .rpm = {4250},
+ .on = { -1, -1, 57, -1 },
+ .off = { -1, -1, 56, -1 },
+ .rpm = { 4250 },
},
};
static const struct fan_step fan0_table_clamshell[] = {
{
/* level 0 */
- .on = {-1, -1, -1, -1},
- .off = {-1, -1, -1, -1},
- .rpm = {0},
+ .on = { -1, -1, -1, -1 },
+ .off = { -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 41, -1},
- .off = {-1, -1, 31, -1},
- .rpm = {2350},
+ .on = { -1, -1, 41, -1 },
+ .off = { -1, -1, 31, -1 },
+ .rpm = { 2350 },
},
{
/* level 2 */
- .on = {-1, -1, 44, -1},
- .off = {-1, -1, 42, -1},
- .rpm = {3300},
+ .on = { -1, -1, 44, -1 },
+ .off = { -1, -1, 42, -1 },
+ .rpm = { 3300 },
},
{
/* level 3 */
- .on = {-1, -1, 47, -1},
- .off = {-1, -1, 45, -1},
- .rpm = {3600},
+ .on = { -1, -1, 47, -1 },
+ .off = { -1, -1, 45, -1 },
+ .rpm = { 3600 },
},
{
/* level 4 */
- .on = {-1, -1, 50, -1},
- .off = {-1, -1, 48, -1},
- .rpm = {4050},
+ .on = { -1, -1, 50, -1 },
+ .off = { -1, -1, 48, -1 },
+ .rpm = { 4050 },
},
{
/* level 5 */
- .on = {-1, -1, 53, -1},
- .off = {-1, -1, 51, -1},
- .rpm = {4450},
+ .on = { -1, -1, 53, -1 },
+ .off = { -1, -1, 51, -1 },
+ .rpm = { 4450 },
},
{
/* level 6 */
- .on = {-1, -1, 56, -1},
- .off = {-1, -1, 54, -1},
- .rpm = {4750},
+ .on = { -1, -1, 56, -1 },
+ .off = { -1, -1, 54, -1 },
+ .rpm = { 4750 },
},
{
/* level 7 */
- .on = {-1, -1, 59, -1},
- .off = {-1, -1, 57, -1},
- .rpm = {5150},
+ .on = { -1, -1, 59, -1 },
+ .off = { -1, -1, 57, -1 },
+ .rpm = { 5150 },
},
};
static const struct fan_step fan0_table_tablet[] = {
{
/* level 0 */
- .on = {-1, -1, -1, -1},
- .off = {-1, -1, -1, -1},
- .rpm = {0},
+ .on = { -1, -1, -1, -1 },
+ .off = { -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 41, -1},
- .off = {-1, -1, 31, -1},
- .rpm = {2250},
+ .on = { -1, -1, 41, -1 },
+ .off = { -1, -1, 31, -1 },
+ .rpm = { 2250 },
},
{
/* level 2 */
- .on = {-1, -1, 50, -1},
- .off = {-1, -1, 48, -1},
- .rpm = {2850},
+ .on = { -1, -1, 50, -1 },
+ .off = { -1, -1, 48, -1 },
+ .rpm = { 2850 },
},
{
/* level 3 */
- .on = {-1, -1, 54, -1},
- .off = {-1, -1, 51, -1},
- .rpm = {3100},
+ .on = { -1, -1, 54, -1 },
+ .off = { -1, -1, 51, -1 },
+ .rpm = { 3100 },
},
{
/* level 4 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 55, -1},
- .rpm = {3500},
+ .on = { -1, -1, 57, -1 },
+ .off = { -1, -1, 55, -1 },
+ .rpm = { 3500 },
},
{
/* level 5 */
- .on = {-1, -1, 60, -1},
- .off = {-1, -1, 58, -1},
- .rpm = {3900},
+ .on = { -1, -1, 60, -1 },
+ .off = { -1, -1, 58, -1 },
+ .rpm = { 3900 },
},
{
/* level 6 */
- .on = {-1, -1, 72, -1},
- .off = {-1, -1, 69, -1},
- .rpm = {4150},
+ .on = { -1, -1, 72, -1 },
+ .off = { -1, -1, 69, -1 },
+ .rpm = { 4150 },
},
{
/* level 7 */
- .on = {-1, -1, 74, -1},
- .off = {-1, -1, 73, -1},
- .rpm = {4400},
+ .on = { -1, -1, 74, -1 },
+ .off = { -1, -1, 73, -1 },
+ .rpm = { 4400 },
},
};
static const struct fan_step fan0_table_stand[] = {
{
/* level 0 */
- .on = {-1, -1, -1, -1},
- .off = {-1, -1, -1, -1},
- .rpm = {0},
+ .on = { -1, -1, -1, -1 },
+ .off = { -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {-1, -1, 34, -1},
- .off = {-1, -1, 31, -1},
- .rpm = {2250},
+ .on = { -1, -1, 34, -1 },
+ .off = { -1, -1, 31, -1 },
+ .rpm = { 2250 },
},
{
/* level 2 */
- .on = {-1, -1, 42, -1},
- .off = {-1, -1, 39, -1},
- .rpm = {2800},
+ .on = { -1, -1, 42, -1 },
+ .off = { -1, -1, 39, -1 },
+ .rpm = { 2800 },
},
{
/* level 3 */
- .on = {-1, -1, 49, -1},
- .off = {-1, -1, 48, -1},
- .rpm = {3150},
+ .on = { -1, -1, 49, -1 },
+ .off = { -1, -1, 48, -1 },
+ .rpm = { 3150 },
},
{
/* level 4 */
- .on = {-1, -1, 51, -1},
- .off = {-1, -1, 50, -1},
- .rpm = {3550},
+ .on = { -1, -1, 51, -1 },
+ .off = { -1, -1, 50, -1 },
+ .rpm = { 3550 },
},
{
/* level 5 */
- .on = {-1, -1, 53, -1},
- .off = {-1, -1, 52, -1},
- .rpm = {3900},
+ .on = { -1, -1, 53, -1 },
+ .off = { -1, -1, 52, -1 },
+ .rpm = { 3900 },
},
{
/* level 6 */
- .on = {-1, -1, 55, -1},
- .off = {-1, -1, 54, -1},
- .rpm = {4150},
+ .on = { -1, -1, 55, -1 },
+ .off = { -1, -1, 54, -1 },
+ .rpm = { 4150 },
},
{
/* level 7 */
- .on = {-1, -1, 57, -1},
- .off = {-1, -1, 56, -1},
- .rpm = {4400},
+ .on = { -1, -1, 57, -1 },
+ .off = { -1, -1, 56, -1 },
+ .rpm = { 4400 },
},
};
#define NUM_FAN_LEVELS ARRAY_SIZE(fan1_table_clamshell)
-#define lid_angle_tablet 340
+#define lid_angle_tablet 340
static int throttle_on;
-BUILD_ASSERT(ARRAY_SIZE(fan1_table_clamshell) ==
- ARRAY_SIZE(fan1_table_tablet));
+BUILD_ASSERT(ARRAY_SIZE(fan1_table_clamshell) == ARRAY_SIZE(fan1_table_tablet));
#define average_time 60
int fan_table_to_rpm(int fan, int *temp)
@@ -404,7 +404,7 @@ int fan_table_to_rpm(int fan, int *temp)
for (j = 0; j < average_time; j++)
avg_sum = avg_sum + avg_calc_tmp[TEMP_SENSOR_CPU][j];
- avg_tmp[TEMP_SENSOR_CPU] = avg_sum/average_time;
+ avg_tmp[TEMP_SENSOR_CPU] = avg_sum / average_time;
/*
* Compare the current and previous temperature, we have
@@ -416,10 +416,10 @@ int fan_table_to_rpm(int fan, int *temp)
if (avg_tmp[TEMP_SENSOR_CPU] < prev_tmp[TEMP_SENSOR_CPU]) {
for (i = current_level; i >= 0; i--) {
if (avg_tmp[TEMP_SENSOR_CPU] <
- fan_step_table[i].off[TEMP_SENSOR_CPU]) {
- /*
- * fan step down debounce
- */
+ fan_step_table[i].off[TEMP_SENSOR_CPU]) {
+ /*
+ * fan step down debounce
+ */
if (fan_down_count < 10) {
fan_down_count++;
fan_up_count = 0;
@@ -434,12 +434,12 @@ int fan_table_to_rpm(int fan, int *temp)
break;
}
} else if (avg_tmp[TEMP_SENSOR_CPU] > prev_tmp[TEMP_SENSOR_CPU]) {
- for (i = current_level+1; i < NUM_FAN_LEVELS; i++) {
+ for (i = current_level + 1; i < NUM_FAN_LEVELS; i++) {
if ((avg_tmp[TEMP_SENSOR_CPU] >
- fan_step_table[i].on[TEMP_SENSOR_CPU])) {
- /*
- * fan step up debounce
- */
+ fan_step_table[i].on[TEMP_SENSOR_CPU])) {
+ /*
+ * fan step up debounce
+ */
if (fan_up_count < 10) {
fan_up_count++;
fan_down_count = 0;
@@ -499,10 +499,8 @@ void thermal_protect(void)
int rv1, rv2;
int thermal_sensor1, thermal_sensor2;
- rv1 = temp_sensor_read(TEMP_SENSOR_5V_REGULATOR,
- &thermal_sensor1);
- rv2 = temp_sensor_read(TEMP_SENSOR_CPU,
- &thermal_sensor2);
+ rv1 = temp_sensor_read(TEMP_SENSOR_5V_REGULATOR, &thermal_sensor1);
+ rv2 = temp_sensor_read(TEMP_SENSOR_CPU, &thermal_sensor2);
if (rv2 == EC_SUCCESS) {
if ((!lid_is_open()) && (!extpower_is_present())) {
@@ -523,8 +521,8 @@ void thermal_protect(void)
}
if (rv1 == EC_SUCCESS) {
- if ((!lid_is_open()) && (!extpower_is_present())
- && thermal_sensor1 > C_TO_K(51))
+ if ((!lid_is_open()) && (!extpower_is_present()) &&
+ thermal_sensor1 > C_TO_K(51))
chipset_force_shutdown(CHIPSET_SHUTDOWN_THERMAL);
}
}
diff --git a/board/mrbland/base_detect.c b/board/mrbland/base_detect.c
index 70217868ea..82326ab456 100644
--- a/board/mrbland/base_detect.c
+++ b/board/mrbland/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,8 +20,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Make sure POGO VBUS starts later then PP3300_HUB when power on */
#define BASE_DETECT_EN_LATER_US (600 * MSEC)
@@ -85,7 +85,7 @@ static void base_detect_change(enum base_status status)
{
int connected = (status == BASE_CONNECTED);
bool base_enable_allow =
- !chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF);
+ !chipset_in_or_transitioning_to_state(CHIPSET_STATE_ANY_OFF);
if ((current_base_status == status) &&
(current_base_enable_allow == base_enable_allow))
@@ -109,8 +109,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -202,8 +202,7 @@ static void base_enable(void)
{
/* Enable base detection interrupt. */
base_detect_debounce_time = get_time().val;
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_EN_LATER_US);
+ hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_EN_LATER_US);
gpio_enable_interrupt(GPIO_BASE_DET_L);
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, base_enable, HOOK_PRIO_DEFAULT);
@@ -228,7 +227,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/mrbland/battery.c b/board/mrbland/battery.c
index ee58ff70bb..d6dda523be 100644
--- a/board/mrbland/battery.c
+++ b/board/mrbland/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/mrbland/board.c b/board/mrbland/board.c
index dd56bcd0cc..50ba008512 100644
--- a/board/mrbland/board.c
+++ b/board/mrbland/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,10 +39,10 @@
#include "task.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
+#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -107,34 +107,26 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -142,45 +134,25 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
/* Base detection */
- [ADC_BASE_DET] = {
- "BASE_DET",
- NPCX_ADC_CH5,
- ADC_MAX_VOLT,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH5, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -198,11 +170,9 @@ const struct ln9310_config_t ln9310_config = {
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -225,11 +195,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -256,17 +229,13 @@ enum lid_accelgyro_type {
static enum lid_accelgyro_type lid_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t lid_standard_ref_icm42607 = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref_icm42607 = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_lid_accel = {
.name = "Lid Accel",
@@ -458,9 +427,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
void board_hibernate(void)
{
@@ -470,8 +439,7 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 1+ has the hardware fix. Don't need the following
@@ -566,8 +534,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -595,7 +562,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -619,24 +585,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/mrbland/board.h b/board/mrbland/board.h
index bac5bf0ee1..0f78db50d9 100644
--- a/board/mrbland/board.h
+++ b/board/mrbland/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,13 +13,13 @@
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Switchcap */
#define CONFIG_LN9310
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -40,7 +40,7 @@
/* I2C */
#undef I2C_PORT_TCPC0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT2_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT2_0
/* Lid accel/gyro */
#define CONFIG_ACCELGYRO_BMI160
@@ -86,10 +86,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_DISPLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_DISPLIGHT = 0, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/mrbland/build.mk b/board/mrbland/build.mk
index 452abeb591..363ef59a16 100644
--- a/board/mrbland/build.mk
+++ b/board/mrbland/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/mrbland/ec.tasklist b/board/mrbland/ec.tasklist
index 493c39dc6c..fc40a8b684 100644
--- a/board/mrbland/ec.tasklist
+++ b/board/mrbland/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mrbland/gpio.inc b/board/mrbland/gpio.inc
index 6d09e87688..b5ff32f0b8 100644
--- a/board/mrbland/gpio.inc
+++ b/board/mrbland/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mrbland/led.c b/board/mrbland/led.c
index a8d2fcda30..07994b8f51 100644
--- a/board/mrbland/led.c
+++ b/board/mrbland/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -38,15 +38,15 @@ enum led_color {
LED_GREEN,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_R_C0,
- (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_G_C0,
- (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
if (color == LED_AMBER) {
gpio_set_level(GPIO_EC_CHG_LED_R_C0, BAT_LED_ON);
gpio_set_level(GPIO_EC_CHG_LED_G_C0, BAT_LED_ON);
@@ -56,7 +56,7 @@ static void led_set_color_battery(enum led_color color)
static void led_set_color_power(enum led_color color)
{
gpio_set_level(GPIO_EC_PWRBTN_LED,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -97,7 +97,6 @@ static void board_led_set_battery(void)
int color = LED_OFF;
int period = 0;
int percent = DIV_ROUND_NEAREST(charge_get_display_charge(), 10);
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -105,13 +104,13 @@ static void board_led_set_battery(void)
case PWR_STATE_CHARGE:
case PWR_STATE_CHARGE_NEAR_FULL:
if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND |
- CHIPSET_STATE_ANY_OFF)) {
+ CHIPSET_STATE_ANY_SUSPEND |
+ CHIPSET_STATE_ANY_OFF)) {
if (percent <= BATTERY_LEVEL_CRITICAL) {
/* battery capa <= 5%, Red */
color = LED_RED;
} else if (percent > BATTERY_LEVEL_CRITICAL &&
- percent < BATTERY_LEVEL_NEAR_FULL) {
+ percent < BATTERY_LEVEL_NEAR_FULL) {
/* 5% < battery capa < 97%, Orange */
color = LED_AMBER;
} else {
@@ -133,16 +132,16 @@ static void board_led_set_battery(void)
color = LED_OFF;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode, Red 2 sec, green 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_RED;
- else
- color = LED_GREEN;
- } else
+ color = LED_RED;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode, Red 2 sec, green 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_RED;
+ else
+ color = LED_GREEN;
break;
default:
/* Other states don't alter LED behavior */
@@ -203,7 +202,7 @@ void led_control(enum ec_led_id led_id, enum ec_led_state state)
enum led_color color;
if ((led_id != EC_LED_ID_RECOVERY_HW_REINIT_LED) &&
- (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
+ (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
return;
if (state == LED_STATE_RESET) {
diff --git a/board/mrbland/usbc_config.c b/board/mrbland/usbc_config.c
index aac136415d..5d30adb6e2 100644
--- a/board/mrbland/usbc_config.c
+++ b/board/mrbland/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "console.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/munna/battery.c b/board/munna/battery.c
index 1b162e93c7..1f5be3dbe3 100644
--- a/board/munna/battery.c
+++ b/board/munna/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/munna/board.c b/board/munna/board.c
index 8eca3f61f1..f6996b8460 100644
--- a/board/munna/board.c
+++ b/board/munna/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,6 +31,7 @@
#include "keyboard_scan.h"
#include "keyboard_backlight.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -44,8 +45,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -57,42 +58,36 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(5),
- STM32_RANK(1)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(15),
- STM32_RANK(2)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(5),
+ STM32_RANK(1) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(15),
+ STM32_RANK(2) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 2,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 2,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 3,
- .kbps = 100,
- .scl = GPIO_I2C4_SCL,
- .sda = GPIO_I2C4_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 3,
+ .kbps = 100,
+ .scl = GPIO_I2C4_SCL,
+ .sda = GPIO_I2C4_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -100,8 +95,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -157,8 +152,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -171,13 +165,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -239,12 +236,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -314,8 +311,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -333,8 +329,7 @@ static void board_spi_disable(void)
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
#endif
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -373,17 +368,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {0, FLOAT_TO_FP(1), 0},
- {FLOAT_TO_FP(-1), 0, 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(-1) }
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
/* Lid accel private data */
@@ -471,7 +462,7 @@ struct motion_sensor_t motion_sensors[] = {
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct it8801_pwm_t it8801_pwm_channels[] = {
- [IT8801_PWM_CH_KBLIGHT] = {.index = 4},
+ [IT8801_PWM_CH_KBLIGHT] = { .index = 4 },
};
void board_kblight_init(void)
@@ -487,11 +478,11 @@ bool board_has_kb_backlight(void)
#endif /* !VARIANT_KUKUI_NO_SENSORS */
/* Battery functions */
-#define SB_SMARTCHARGE 0x26
+#define SB_SMARTCHARGE 0x26
/* Quick charge enable bit */
-#define SMART_QUICK_CHARGE 0x02
+#define SMART_QUICK_CHARGE 0x02
/* Quick charge support bit */
-#define MODE_QUICK_CHARGE_SUPPORT 0x01
+#define MODE_QUICK_CHARGE_SUPPORT 0x01
static void sb_quick_charge_mode(int enable)
{
@@ -562,8 +553,8 @@ int board_get_battery_i2c(void)
}
#ifdef SECTION_IS_RW
-static int it8801_get_target_channel(enum pwm_channel *channel,
- int type, int index)
+static int it8801_get_target_channel(enum pwm_channel *channel, int type,
+ int index)
{
switch (type) {
case EC_PWM_TYPE_GENERIC:
@@ -586,14 +577,13 @@ host_command_pwm_set_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- duty = (uint32_t) p->duty * 255 / 65535;
+ duty = (uint32_t)p->duty * 255 / 65535;
it8801_pwm_set_raw_duty(channel, duty);
it8801_pwm_enable(channel, p->duty > 0);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY,
- host_command_pwm_set_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_SET_DUTY, host_command_pwm_set_duty,
EC_VER_MASK(0));
static enum ec_status
@@ -607,12 +597,11 @@ host_command_pwm_get_duty(struct host_cmd_handler_args *args)
if (it8801_get_target_channel(&channel, p->pwm_type, p->index))
return EC_RES_INVALID_PARAM;
- r->duty = (uint32_t) it8801_pwm_get_raw_duty(channel) * 65535 / 255;
+ r->duty = (uint32_t)it8801_pwm_get_raw_duty(channel) * 65535 / 255;
args->response_size = sizeof(*r);
return EC_RES_SUCCESS;
}
-DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY,
- host_command_pwm_get_duty,
+DECLARE_HOST_COMMAND(EC_CMD_PWM_GET_DUTY, host_command_pwm_get_duty,
EC_VER_MASK(0));
#endif
diff --git a/board/munna/board.h b/board/munna/board.h
index 322f145e33..5dc35c68df 100644
--- a/board/munna/board.h
+++ b/board/munna/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,13 +27,13 @@
#undef STM32_PLLM
#undef STM32_PLLN
#undef STM32_PLLR
-#define STM32_PLLM 1
+#define STM32_PLLM 1
#ifdef STM32_HSE_CLOCK
-#define STM32_PLLN 12
+#define STM32_PLLN 12
#else
-#define STM32_PLLN 10
+#define STM32_PLLN 10
#endif
-#define STM32_PLLR 2
+#define STM32_PLLR 2
#define STM32_USE_PLL
@@ -65,13 +65,12 @@
#define CONFIG_LED_ONOFF_STATES
#define CONFIG_LED_POWER_LED
-#undef CONFIG_WATCHDOG_PERIOD_MS
+#undef CONFIG_WATCHDOG_PERIOD_MS
#define CONFIG_WATCHDOG_PERIOD_MS 4000
-
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -93,34 +92,34 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_CHARGER 2
-#define I2C_PORT_SENSORS 2
-#define I2C_PORT_KB_DISCRETE 2
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_BATTERY 3
-#define I2C_PORT_TCPC0 0
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER 2
+#define I2C_PORT_SENSORS 2
+#define I2C_PORT_KB_DISCRETE 2
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BATTERY 3
+#define I2C_PORT_TCPC0 0
#undef I2C_CONTROLLER_COUNT
#undef I2C_PORT_COUNT
-#define I2C_CONTROLLER_COUNT 3
-#define I2C_PORT_COUNT 3
+#define I2C_CONTROLLER_COUNT 3
+#define I2C_PORT_COUNT 3
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
/* Define the MKBP events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON))
#undef CONFIG_GMR_TABLET_MODE
#undef GPIO_TABLET_MODE_L
diff --git a/board/munna/build.mk b/board/munna/build.mk
index 594bac4de9..aab7974af2 100644
--- a/board/munna/build.mk
+++ b/board/munna/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/munna/ec.tasklist b/board/munna/ec.tasklist
index 6b29595620..1e7e61108b 100644
--- a/board/munna/ec.tasklist
+++ b/board/munna/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/munna/gpio.inc b/board/munna/gpio.inc
index 50e5ee3a47..72de7677dc 100644
--- a/board/munna/gpio.inc
+++ b/board/munna/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/munna/led.c b/board/munna/led.c
index fa4f46b6ab..bd286b25a3 100644
--- a/board/munna/led.c
+++ b/board/munna/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,33 +18,38 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
-led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/mushu/battery.c b/board/mushu/battery.c
index 7e48dfdc19..d523d918f7 100644
--- a/board/mushu/battery.c
+++ b/board/mushu/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/mushu/board.c b/board/mushu/board.c
index 8e46caa2ed..7197f7e136 100644
--- a/board/mushu/board.c
+++ b/board/mushu/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* GPIO to enable/disable the USB Type-A port. */
const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
@@ -111,18 +111,19 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_FAN2] = {.channel = 6, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_FAN2] = { .channel = 6,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -148,16 +149,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -224,22 +229,18 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/*
* TODO(b/124337208): P0 boards don't have this sensor mounted so the rotation
* matrix can't be tested properly. This needs to be revisited after EVT to make
* sure the rotation matrix for the lid sensor is correct.
*/
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -363,14 +364,14 @@ BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
const struct fan_conf fan_conf_1 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_1, /* Use MFT id to control fan */
+ .ch = MFT_CH_1, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -394,61 +395,48 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
- [MFT_CH_1] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
+ [MFT_CH_1] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2 },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_5V", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_5V", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_CHARGER] = {
- .name = "CHARGER",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1
- },
- [TEMP_5V] = {
- .name = "5V",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2
- },
- [TEMP_GPU] = {
- .name = "GPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_R19ME4070,
- .idx = R19ME4070_LOCAL
- },
- [TEMP_F75303_LOCAL] = {
- .name = "F75303_Local",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = f75303_get_val,
- .idx = F75303_IDX_LOCAL
- },
- [TEMP_F75303_GPU] = {
- .name = "F75303_GPU",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = f75303_get_val,
- .idx = F75303_IDX_REMOTE1
- },
- [TEMP_F75303_GPU_POWER] = {
- .name = "F75303_GPU_Power",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = f75303_get_val,
- .idx = F75303_IDX_REMOTE2
- },
+ [TEMP_CHARGER] = { .name = "CHARGER",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_5V] = { .name = "5V",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_GPU] = { .name = "GPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_R19ME4070,
+ .idx = R19ME4070_LOCAL },
+ [TEMP_F75303_LOCAL] = { .name = "F75303_Local",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = f75303_get_val,
+ .idx = F75303_IDX_LOCAL },
+ [TEMP_F75303_GPU] = { .name = "F75303_GPU",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = f75303_get_val,
+ .idx = F75303_IDX_REMOTE1 },
+ [TEMP_F75303_GPU_POWER] = { .name = "F75303_GPU_Power",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = f75303_get_val,
+ .idx = F75303_IDX_REMOTE2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Hatch Temperature sensors */
/*
* TODO(b/124316213): These setting need to be reviewed and set appropriately
@@ -458,8 +446,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -478,8 +466,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -495,7 +483,6 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
}
__maybe_unused static const struct ec_thermal_config thermal_b = THERMAL_B;
-
struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
static void setup_fans(void)
@@ -536,7 +523,6 @@ static void board_gpio_set_pp5000(void)
} else if (board_id >= 1) {
reset_gpio_flags(GPIO_EN_PP5000_A_V1, GPIO_OUT_LOW);
}
-
}
static void board_init(void)
diff --git a/board/mushu/board.h b/board/mushu/board.h
index 5f80b4a2e6..02443bbfa3 100644
--- a/board/mushu/board.h
+++ b/board/mushu/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,10 +13,10 @@
/* Reduce flash usage */
#define CONFIG_USB_PD_DEBUG_LEVEL 2
-#undef CONFIG_CMD_ACCELSPOOF
-#undef CONFIG_CMD_CHARGER_DUMP
-#undef CONFIG_CMD_PPC_DUMP
-#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CMD_ACCELSPOOF
+#undef CONFIG_CMD_CHARGER_DUMP
+#undef CONFIG_CMD_PPC_DUMP
+#undef CONFIG_CONSOLE_CMDHELP
#define CONFIG_POWER_BUTTON
#define CONFIG_KEYBOARD_PROTOCOL_8042
@@ -26,14 +26,12 @@
#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_CMD_MFALLOW
-
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
/* Keyboard features */
#define CONFIG_PWM_KBLIGHT
-
/* Sensors */
/* BMI160 Base accel/gyro */
#define CONFIG_ACCELGYRO_BMI160
@@ -53,7 +51,7 @@
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
-#define I2C_PORT_ALS I2C_PORT_SENSOR
+#define I2C_PORT_ALS I2C_PORT_SENSOR
#define CONFIG_TEMP_SENSOR
/* AMD SMBUS Temp sensors */
#define CONFIG_TEMP_SENSOR_AMD_R19ME4070
@@ -64,7 +62,7 @@
#define I2C_PORT_THERMAL I2C_PORT_SENSOR
/* GPU features */
-#define I2C_PORT_GPU NPCX_I2C_PORT4_1
+#define I2C_PORT_GPU NPCX_I2C_PORT4_1
/* USB Type C and USB PD defines */
#undef CONFIG_USB_PD_TCPMV1
@@ -139,16 +137,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -160,8 +158,8 @@
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
ADC_CH_COUNT
};
@@ -174,12 +172,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_FAN2,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_FAN2, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
@@ -212,15 +205,14 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-
#undef PD_OPERATING_POWER_MW
-#define PD_OPERATING_POWER_MW 15000
+#define PD_OPERATING_POWER_MW 15000
#undef PD_MAX_POWER_MW
-#define PD_MAX_POWER_MW 100000
+#define PD_MAX_POWER_MW 100000
#undef PD_MAX_CURRENT_MA
-#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_CURRENT_MA 5000
#undef PD_MAX_VOLTAGE_MV
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_VOLTAGE_MV 20000
#endif /* !__ASSEMBLER__ */
diff --git a/board/mushu/build.mk b/board/mushu/build.mk
index 2d6118ea70..4e42a0616e 100644
--- a/board/mushu/build.mk
+++ b/board/mushu/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/mushu/ec.tasklist b/board/mushu/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/mushu/ec.tasklist
+++ b/board/mushu/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/mushu/gpio.inc b/board/mushu/gpio.inc
index cc8c7a0154..e1711a87e1 100644
--- a/board/mushu/gpio.inc
+++ b/board/mushu/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/mushu/led.c b/board/mushu/led.c
index a5d81fabd4..6d20ecdedf 100644
--- a/board/mushu/led.c
+++ b/board/mushu/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,22 +19,26 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/mushu/thermal.c b/board/mushu/thermal.c
index b61f36ab8a..da8f29de08 100644
--- a/board/mushu/thermal.c
+++ b/board/mushu/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,8 +23,7 @@ void fan_set_percent(int fan, int pct)
new_rpm = fan_percent_to_rpm(fan, pct);
actual_rpm = fan_get_rpm_actual(FAN_CH(fan));
- if (new_rpm &&
- actual_rpm < min_rpm &&
+ if (new_rpm && actual_rpm < min_rpm &&
new_rpm < fans[fan].rpm->rpm_start)
new_rpm = fans[fan].rpm->rpm_start;
diff --git a/board/nami/battery.c b/board/nami/battery.c
index 149272c8c1..18f03fc9de 100644
--- a/board/nami/battery.c
+++ b/board/nami/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -16,8 +16,8 @@
#include "hooks.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Default, Nami, Vayne */
static const struct battery_info info_0 = {
@@ -243,8 +243,9 @@ static int battery_init(void)
if (batt_status & STATUS_INITIALIZED)
return 1;
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
+ return battery_status(&batt_status) ?
+ 0 :
+ !!(batt_status & STATUS_INITIALIZED);
}
enum battery_disconnect_grace_period {
@@ -278,13 +279,13 @@ static int battery_check_disconnect_ti_bq40z50(void)
uint8_t data[6];
/* Check if battery charging + discharging is disabled. */
- rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return BATTERY_DISCONNECT_ERROR;
- if ((data[3] & (BATTERY_DISCHARGING_DISABLED |
- BATTERY_CHARGING_DISABLED)) ==
+ if ((data[3] &
+ (BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED)) ==
(BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED)) {
if (oem != PROJECT_SONA)
return BATTERY_DISCONNECTED;
@@ -298,10 +299,10 @@ static int battery_check_disconnect_ti_bq40z50(void)
* stop charging and avoid damaging the battery.
*/
if (disconnect_grace_period ==
- BATTERY_DISCONNECT_GRACE_PERIOD_OVER)
+ BATTERY_DISCONNECT_GRACE_PERIOD_OVER)
return BATTERY_DISCONNECTED;
if (disconnect_grace_period ==
- BATTERY_DISCONNECT_GRACE_PERIOD_OFF)
+ BATTERY_DISCONNECT_GRACE_PERIOD_OFF)
hook_call_deferred(&battery_disconnect_timer_data,
5 * SECOND);
ccprintf("Battery disconnect grace period\n");
diff --git a/board/nami/board.c b/board/nami/board.c
index 20882cff13..02fb27a283 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -65,11 +65,11 @@
#include "fan.h"
#include "fan_chip.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_PS8751 0
-#define USB_PD_PORT_ANX7447 1
+#define USB_PD_PORT_PS8751 0
+#define USB_PD_PORT_ANX7447 1
uint16_t board_version;
uint8_t oem = PROJECT_NAMI;
@@ -82,17 +82,16 @@ uint8_t model;
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -151,13 +150,14 @@ void usb1_evt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus sensing (10x voltage divider). PPVAR_BOOSTIN_SENSE */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {"AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1, 0},
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -166,7 +166,7 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -212,54 +212,42 @@ struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "tcpc1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "battery",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "charger",
- .port = NPCX_I2C_PORT2,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "pmic",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "accelgyro",
- .port = NPCX_I2C_PORT3,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "tcpc1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "battery",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "charger",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "pmic",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "accelgyro",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -294,16 +282,22 @@ static int ps8751_tune_mux(const struct usb_mux *me)
return EC_SUCCESS;
}
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux usb_mux_ps8751 = {
+ .usb_port = USB_PD_PORT_PS8751,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+};
+
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_PS8751] = {
- .usb_port = USB_PD_PORT_PS8751,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &usb_mux_ps8751,
},
[USB_PD_PORT_ANX7447] = {
- .usb_port = USB_PD_PORT_ANX7447,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_ANX7447,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
}
};
@@ -333,7 +327,6 @@ void board_reset_pd_mcu(void)
if (oem == PROJECT_AKALI && board_version < 0x0200) {
if (anx7447_flash_erase(USB_PD_PORT_ANX7447))
CPRINTS("Failed to erase OCM flash");
-
}
/* Assert reset */
@@ -358,7 +351,7 @@ void board_tcpc_init(void)
gpio_enable_interrupt(GPIO_USB_C1_PD_INT_ODL);
if (oem == PROJECT_SONA && model != MODEL_SYNDRA)
- usb_muxes[USB_PD_PORT_PS8751].board_init = ps8751_tune_mux;
+ usb_mux_ps8751.board_init = ps8751_tune_mux;
/*
* Initialize HPD to low; after sysjump SOC needs to see
@@ -366,7 +359,7 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2);
@@ -391,12 +384,12 @@ uint16_t tcpc_get_alert_status(void)
* F75303_Remote1 is near CPU, and F75303_Remote2 is near 5V power IC.
*/
const struct temp_sensor_t temp_sensors[TEMP_SENSOR_COUNT] = {
- {"F75303_Local", TEMP_SENSOR_TYPE_BOARD, f75303_get_val,
- F75303_IDX_LOCAL},
- {"F75303_Remote1", TEMP_SENSOR_TYPE_CPU, f75303_get_val,
- F75303_IDX_REMOTE1},
- {"F75303_Remote2", TEMP_SENSOR_TYPE_BOARD, f75303_get_val,
- F75303_IDX_REMOTE2},
+ { "F75303_Local", TEMP_SENSOR_TYPE_BOARD, f75303_get_val,
+ F75303_IDX_LOCAL },
+ { "F75303_Remote1", TEMP_SENSOR_TYPE_CPU, f75303_get_val,
+ F75303_IDX_REMOTE1 },
+ { "F75303_Remote2", TEMP_SENSOR_TYPE_BOARD, f75303_get_val,
+ F75303_IDX_REMOTE2 },
};
struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
@@ -405,8 +398,8 @@ struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -426,8 +419,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B1 \
- { \
+#define THERMAL_B1 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(82), \
@@ -447,8 +440,8 @@ __maybe_unused static const struct ec_thermal_config thermal_b1 = THERMAL_B1;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B2 \
- { \
+#define THERMAL_B2 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(84), \
@@ -468,8 +461,8 @@ __maybe_unused static const struct ec_thermal_config thermal_b2 = THERMAL_B2;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_C1 \
- { \
+#define THERMAL_C1 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(66), \
@@ -489,8 +482,8 @@ __maybe_unused static const struct ec_thermal_config thermal_c1 = THERMAL_C1;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_C2 \
- { \
+#define THERMAL_C2 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(74), \
@@ -510,8 +503,8 @@ __maybe_unused static const struct ec_thermal_config thermal_c2 = THERMAL_C2;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_D0 \
- { \
+#define THERMAL_D0 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = C_TO_K(79), \
[EC_TEMP_THRESH_HIGH] = 0, \
@@ -531,8 +524,8 @@ __maybe_unused static const struct ec_thermal_config thermal_d0 = THERMAL_D0;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_D1 \
- { \
+#define THERMAL_D1 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = C_TO_K(59), \
[EC_TEMP_THRESH_HIGH] = 0, \
@@ -552,8 +545,8 @@ __maybe_unused static const struct ec_thermal_config thermal_d1 = THERMAL_D1;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_D2 \
- { \
+#define THERMAL_D2 \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = C_TO_K(59), \
[EC_TEMP_THRESH_HIGH] = 0, \
@@ -570,11 +563,9 @@ __maybe_unused static const struct ec_thermal_config thermal_d1 = THERMAL_D1;
__maybe_unused static const struct ec_thermal_config thermal_d2 = THERMAL_D2;
#define I2C_PMIC_READ(reg, data) \
- i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS,\
- (reg), (data))
+ i2c_read8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS, (reg), (data))
#define I2C_PMIC_WRITE(reg, data) \
- i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS,\
- (reg), (data))
+ i2c_write8(I2C_PORT_PMIC, TPS650X30_I2C_ADDR1_FLAGS, (reg), (data))
static void board_pmic_init(void)
{
@@ -726,8 +717,8 @@ int board_set_active_charge_port(int charge_port)
charge_port < CONFIG_USB_PD_PORT_MAX_COUNT);
/* check if we are sourcing VBUS on the port */
/* dnojiri: revisit */
- int is_source = gpio_get_level(charge_port == 0 ?
- GPIO_USB_C0_5V_EN : GPIO_USB_C1_5V_EN);
+ int is_source = gpio_get_level(charge_port == 0 ? GPIO_USB_C0_5V_EN :
+ GPIO_USB_C1_5V_EN);
if (is_real_port && is_source) {
CPRINTF("No charging on source port p%d is ", charge_port);
@@ -745,17 +736,19 @@ int board_set_active_charge_port(int charge_port)
/* dnojiri: revisit. there is always this assumption that
* battery is present. If not, this may cause brownout. */
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L :
- GPIO_USB_C1_CHARGE_L, 1);
+ GPIO_USB_C1_CHARGE_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 0);
+ GPIO_USB_C0_CHARGE_L,
+ 0);
}
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Limit the input current to 96% negotiated limit,
@@ -764,12 +757,11 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
int factor = 96;
if (oem == PROJECT_AKALI &&
- (model == MODEL_EKKO || model == MODEL_BARD))
+ (model == MODEL_EKKO || model == MODEL_BARD))
factor = 95;
charge_ma = charge_ma * factor / 100;
charge_set_input_current_limit(
- MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
void board_hibernate(void)
@@ -782,9 +774,9 @@ void board_hibernate(void)
}
const struct pwm_t pwm_channels[] = {
- [PWM_CH_LED1] = { 3, PWM_CONFIG_DSLEEP, 1200 },
+ [PWM_CH_LED1] = { 3, PWM_CONFIG_DSLEEP, 1200 },
[PWM_CH_LED2] = { 5, PWM_CONFIG_DSLEEP, 1200 },
- [PWM_CH_FAN] = {4, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 4, PWM_CONFIG_OPEN_DRAIN, 25000 },
/*
* 1.2kHz is a multiple of both 50 and 60. So a video recorder
* (generally designed to ignore either 50 or 60 Hz flicker) will not
@@ -806,23 +798,17 @@ static struct kionix_accel_data g_kx022_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t rotation_x180_z90 = {
- { 0, FLOAT_TO_FP(-1), 0 },
- { FLOAT_TO_FP(-1), 0, 0 },
- { 0, 0, FLOAT_TO_FP(-1) }
-};
+const mat33_fp_t rotation_x180_z90 = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
const struct motion_sensor_t lid_accel_1 = {
.name = "Lid Accel",
@@ -1096,7 +1082,7 @@ static void board_init(void)
ISL9238_REG_CONTROL3, &reg) == EC_SUCCESS) {
reg |= ISL9238_C3_BB_SWITCHING_PERIOD;
if (i2c_write16(I2C_PORT_CHARGER, I2C_ADDR_CHARGER_FLAGS,
- ISL9238_REG_CONTROL3, reg))
+ ISL9238_REG_CONTROL3, reg))
CPRINTF("Failed to set isl9238\n");
}
@@ -1188,14 +1174,13 @@ void board_kblight_init(void)
}
}
-enum critical_shutdown board_critical_shutdown_check(
- struct charge_state_data *curr)
+enum critical_shutdown
+board_critical_shutdown_check(struct charge_state_data *curr)
{
if (oem == PROJECT_VAYNE)
return CRITICAL_SHUTDOWN_CUTOFF;
else
return CRITICAL_SHUTDOWN_HIBERNATE;
-
}
uint8_t board_set_battery_level_shutdown(void)
diff --git a/board/nami/board.h b/board/nami/board.h
index dde32b65f8..879fb443be 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages except ACPI and host event because
* the sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
/* EC */
#define CONFIG_ADC
@@ -74,8 +74,8 @@
#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
@@ -87,8 +87,8 @@
#define CONFIG_BATTERY_SMART
#define CONFIG_PWR_STATE_DISCHARGE_FULL
#define CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
-#undef CONFIG_BATT_HOST_FULL_FACTOR
-#define CONFIG_BATT_HOST_FULL_FACTOR 100
+#undef CONFIG_BATT_HOST_FULL_FACTOR
+#define CONFIG_BATT_HOST_FULL_FACTOR 100
/* Charger */
#define CONFIG_CHARGE_MANAGER
@@ -98,8 +98,8 @@
#define CONFIG_CHARGER_ISL9238
#define CONFIG_CHARGER_DISCHARGE_ON_AC
#define CONFIG_CHARGER_INPUT_CURRENT 512
-#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 27000
-#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT 15000
+#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 27000
+#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON_WITH_BATT 15000
/* AP's thresholds. */
#define CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT 3
#define CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW 27000
@@ -110,11 +110,11 @@
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
#define CONFIG_HOSTCMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6
#define CONFIG_POWER_COMMON
#define CONFIG_POWER_SIGNAL_INTERRUPT_STORM_DETECT_THRESHOLD 30
@@ -180,34 +180,33 @@
#define CONFIG_USBC_VCONN_SWAP
#define CONFIG_USB_MUX_RUNTIME_CONFIG
-
/* BC 1.2 charger */
#define CONFIG_BC12_DETECT_PI3USB9281
#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 2
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 1 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
-#define I2C_PORT_EEPROM NPCX_I2C_PORT0_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_KBLIGHT NPCX_I2C_PORT2
-#define I2C_PORT_GYRO NPCX_I2C_PORT3
-#define I2C_PORT_ACCEL NPCX_I2C_PORT3
-#define I2C_PORT_THERMAL NPCX_I2C_PORT3
-#define I2C_PORT_ALS NPCX_I2C_PORT3
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
+#define I2C_PORT_EEPROM NPCX_I2C_PORT0_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT1
+#define I2C_PORT_CHARGER NPCX_I2C_PORT1
+#define I2C_PORT_PMIC NPCX_I2C_PORT2
+#define I2C_PORT_KBLIGHT NPCX_I2C_PORT2
+#define I2C_PORT_GYRO NPCX_I2C_PORT3
+#define I2C_PORT_ACCEL NPCX_I2C_PORT3
+#define I2C_PORT_THERMAL NPCX_I2C_PORT3
+#define I2C_PORT_ALS NPCX_I2C_PORT3
/* I2C addresses */
-#define I2C_ADDR_MP2949_FLAGS 0x20
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#ifndef __ASSEMBLER__
@@ -284,26 +283,26 @@ enum model_id {
MODEL_BARD = 2,
};
-#define SKU_ID_MASK_KBLIGHT BIT(0)
-#define SKU_ID_MASK_CONVERTIBLE BIT(9)
-#define SKU_ID_MASK_KEYPAD BIT(15)
-#define SKU_ID_MASK_UK2 BIT(18)
+#define SKU_ID_MASK_KBLIGHT BIT(0)
+#define SKU_ID_MASK_CONVERTIBLE BIT(9)
+#define SKU_ID_MASK_KEYPAD BIT(15)
+#define SKU_ID_MASK_UK2 BIT(18)
/* TODO(crosbug.com/p/61098): Verify the numbers below. */
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 70000
-#define PD_MAX_CURRENT_MA 3500
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 70000
+#define PD_MAX_CURRENT_MA 3500
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
void board_reset_pd_mcu(void);
@@ -319,7 +318,7 @@ extern uint32_t sku;
extern uint8_t model;
/* SKU_ID[24:31] are dedicated to OEM customization */
-#define CBI_SKU_CUSTOM_FIELD(val) ((val) >> 24)
+#define CBI_SKU_CUSTOM_FIELD(val) ((val) >> 24)
void ccd_mode_isr(enum gpio_signal signal);
diff --git a/board/nami/build.mk b/board/nami/build.mk
index f4bf21113d..8f3a138f56 100644
--- a/board/nami/build.mk
+++ b/board/nami/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nami/ec.tasklist b/board/nami/ec.tasklist
index 93fcda9f91..99d0f15b70 100644
--- a/board/nami/ec.tasklist
+++ b/board/nami/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nami/gpio.inc b/board/nami/gpio.inc
index f4119c96a6..124af79f49 100644
--- a/board/nami/gpio.inc
+++ b/board/nami/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nami/led.c b/board/nami/led.c
index 17af4d5f82..ce9cefed7f 100644
--- a/board/nami/led.c
+++ b/board/nami/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -38,8 +38,8 @@
#include "timer.h"
#include "util.h"
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED, EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -79,19 +79,19 @@ struct led_pattern {
uint8_t pulse;
};
-#define PULSE_NO 0
-#define PULSE(interval) (BIT(7) | (interval))
-#define BLINK(interval) (interval)
-#define ALTERNATE(interval) (BIT(6) | (interval))
-#define IS_PULSING(pulse) ((pulse) & 0x80)
-#define IS_ALTERNATE(pulse) ((pulse) & 0x40)
-#define PULSE_INTERVAL(pulse) (((pulse) & 0x3f) * 100 * MSEC)
+#define PULSE_NO 0
+#define PULSE(interval) (BIT(7) | (interval))
+#define BLINK(interval) (interval)
+#define ALTERNATE(interval) (BIT(6) | (interval))
+#define IS_PULSING(pulse) ((pulse)&0x80)
+#define IS_ALTERNATE(pulse) ((pulse)&0x40)
+#define PULSE_INTERVAL(pulse) (((pulse)&0x3f) * 100 * MSEC)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
typedef struct led_pattern led_patterns[LED_CHARGE_STATE_COUNT]
- [LED_POWER_STATE_COUNT];
+ [LED_POWER_STATE_COUNT];
/*
* Nami/Vayne - One dual color LED:
@@ -105,11 +105,17 @@ typedef struct led_pattern led_patterns[LED_CHARGE_STATE_COUNT]
*/
const static led_patterns battery_pattern_0 = {
/* discharging: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE(10)}, {LED_OFF, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE(10) },
+ { LED_OFF, PULSE_NO } },
/* charging: s0, s3, s5 */
- {{LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}},
+ { { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO } },
/* full: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO } },
};
/*
@@ -117,11 +123,15 @@ const static led_patterns battery_pattern_0 = {
*/
const static led_patterns battery_pattern_1 = {
/* discharging: s0, s3, s5 */
- {{LED_OFF, PULSE_NO}, {LED_OFF, PULSE_NO}, {LED_OFF, PULSE_NO}},
+ { { LED_OFF, PULSE_NO }, { LED_OFF, PULSE_NO }, { LED_OFF, PULSE_NO } },
/* charging: s0, s3, s5 */
- {{LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}},
+ { { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO } },
/* full: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO } },
};
/*
@@ -132,11 +142,15 @@ const static led_patterns battery_pattern_1 = {
*/
const static led_patterns battery_pattern_2 = {
/* discharging: s0, s3, s5 */
- {{LED_OFF, PULSE_NO}, {LED_OFF, PULSE_NO}, {LED_OFF, PULSE_NO}},
+ { { LED_OFF, PULSE_NO }, { LED_OFF, PULSE_NO }, { LED_OFF, PULSE_NO } },
/* charging: s0, s3, s5 */
- {{LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}},
+ { { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO } },
/* full: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO } },
};
/*
@@ -144,11 +158,17 @@ const static led_patterns battery_pattern_2 = {
*/
const static led_patterns power_pattern_1 = {
/* discharging: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, BLINK(10)}, {LED_OFF, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, BLINK(10) },
+ { LED_OFF, PULSE_NO } },
/* charging: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, BLINK(10)}, {LED_OFF, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, BLINK(10) },
+ { LED_OFF, PULSE_NO } },
/* full: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, BLINK(10)}, {LED_OFF, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, BLINK(10) },
+ { LED_OFF, PULSE_NO } },
};
/*
@@ -159,11 +179,17 @@ const static led_patterns power_pattern_1 = {
*/
const static led_patterns power_pattern_2 = {
/* discharging: s0, s3, s5 */
- {{LED_WHITE, 0}, {LED_WHITE, ALTERNATE(BLINK(10))}, {LED_OFF, 0}},
+ { { LED_WHITE, 0 },
+ { LED_WHITE, ALTERNATE(BLINK(10)) },
+ { LED_OFF, 0 } },
/* charging: s0, s3, s5 */
- {{LED_WHITE, 0}, {LED_WHITE, ALTERNATE(BLINK(10))}, {LED_OFF, 0}},
+ { { LED_WHITE, 0 },
+ { LED_WHITE, ALTERNATE(BLINK(10)) },
+ { LED_OFF, 0 } },
/* full: s0, s3, s5 */
- {{LED_WHITE, 0}, {LED_WHITE, ALTERNATE(BLINK(10))}, {LED_OFF, 0}},
+ { { LED_WHITE, 0 },
+ { LED_WHITE, ALTERNATE(BLINK(10)) },
+ { LED_OFF, 0 } },
};
/*
@@ -178,30 +204,42 @@ const static led_patterns power_pattern_2 = {
*/
const static led_patterns battery_pattern_3 = {
/* discharging: s0, s3, s5 */
- {{LED_WHITE, 0}, {LED_AMBER, ALTERNATE(BLINK(10))}, {LED_OFF, 0}},
+ { { LED_WHITE, 0 },
+ { LED_AMBER, ALTERNATE(BLINK(10)) },
+ { LED_OFF, 0 } },
/* charging: s0, s3, s5 */
- {{LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}},
+ { { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO } },
/* full: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO } },
};
const static led_patterns battery_pattern_4 = {
/* discharging: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, BLINK(10)}, {LED_OFF, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, BLINK(10) },
+ { LED_OFF, PULSE_NO } },
/* charging: s0, s3, s5 */
- {{LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}, {LED_AMBER, PULSE_NO}},
+ { { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO },
+ { LED_AMBER, PULSE_NO } },
/* full: s0, s3, s5 */
- {{LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}, {LED_WHITE, PULSE_NO}},
+ { { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO },
+ { LED_WHITE, PULSE_NO } },
};
/* Patterns for battery LED and power LED. Initialized at run-time. */
static led_patterns const *patterns[2];
/* Pattern for battery error. Only blinking battery LED is supported. */
-static struct led_pattern battery_error = {LED_AMBER, BLINK(10)};
+static struct led_pattern battery_error = { LED_AMBER, BLINK(10) };
/* Pattern for low state of charge. Only battery LED is supported. */
-static struct led_pattern low_battery = {LED_WHITE, BLINK(10)};
+static struct led_pattern low_battery = { LED_WHITE, BLINK(10) };
/* Pattern for factory mode. Blinking 2-color battery LED. */
-static struct led_pattern battery_factory = {LED_FACTORY, BLINK(20)};
+static struct led_pattern battery_factory = { LED_FACTORY, BLINK(20) };
static int low_battery_soc;
static void led_charge_hook(void);
static enum led_power_state power_state;
@@ -222,7 +260,7 @@ static void led_init(void)
patterns[1] = &power_pattern_1;
}
battery_error.pulse = BLINK(5);
- low_battery_soc = 100; /* 10.0% */
+ low_battery_soc = 100; /* 10.0% */
break;
case PROJECT_PANTHEON:
patterns[0] = &battery_pattern_2;
@@ -452,7 +490,7 @@ void config_led(enum ec_led_id id, enum led_charge_state charge)
pattern = patterns[id];
if (!pattern)
- return; /* This LED isn't present */
+ return; /* This LED isn't present */
start_tick(id, &(*pattern)[charge][power_state]);
}
@@ -499,14 +537,15 @@ static void call_handler(void)
led_alert(1);
break;
case PWR_STATE_IDLE:
- /* External power connected in IDLE. This is also used to show
- * factory mode when 'ectool chargecontrol idle' is run during
- * factory process. */
- if (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)
- led_factory(1);
+ /* External power connected in IDLE. */
break;
- default:
- ;
+ case PWR_STATE_FORCED_IDLE:
+ /* This is used to show factory mode when
+ * 'ectool chargecontrol idle' is run during factory process.
+ */
+ led_factory(1);
+ break;
+ default:;
}
}
@@ -548,7 +587,7 @@ static void print_config(enum ec_led_id id)
ccprintf(" Interval:%d\n", tick[id].interval);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_BATTERY_LED;
static int alert = 0;
@@ -587,9 +626,10 @@ static int command_led(int argc, char **argv)
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(led, command_led,
- "[debug|red|green|amber|off|alert|s0|s3|s5|conf|factory]",
- "Turn on/off LED.");
+DECLARE_CONSOLE_COMMAND(
+ led, command_led,
+ "[debug|red|green|amber|off|alert|s0|s3|s5|conf|factory]",
+ "Turn on/off LED.");
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
diff --git a/board/nami/usb_pd_policy.c b/board/nami/usb_pd_policy.c
index c1d5591d7c..e022adc5d9 100644
--- a/board/nami/usb_pd_policy.c
+++ b/board/nami/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,12 +22,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
return vbus_en[port];
@@ -52,8 +52,7 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 1);
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_L : GPIO_USB_C0_CHARGE_L, 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
@@ -103,8 +102,7 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
diff --git a/board/nautilus/battery.c b/board/nautilus/battery.c
index aaa4a43c06..dd9b72e222 100644
--- a/board/nautilus/battery.c
+++ b/board/nautilus/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -17,19 +17,19 @@
static enum battery_present batt_pres_prev = BP_NOT_SURE;
/* Shutdown mode parameters to write to manufacturer access register */
-#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
+#define SB_SHUTDOWN_DATA 0x0010
/*
* Unlike other smart batteries, Nautilus battery uses different bit fields
* in manufacturer access register for the conditions of the CHG/DSG FETs.
*/
-#define BATFETS_SHIFT (14)
-#define BATFETS_MASK (0x3)
-#define BATFETS_DISABLED (0x2)
+#define BATFETS_SHIFT (14)
+#define BATFETS_MASK (0x3)
+#define BATFETS_DISABLED (0x2)
-#define CHARGING_VOLTAGE_MV_SAFE 8400
-#define CHARGING_CURRENT_MA_SAFE 1500
+#define CHARGING_VOLTAGE_MV_SAFE 8400
+#define CHARGING_CURRENT_MA_SAFE 1500
static const struct battery_info info = {
.voltage_max = 8700,
@@ -160,8 +160,9 @@ static int battery_init(void)
{
int batt_status;
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
+ return battery_status(&batt_status) ?
+ 0 :
+ !!(batt_status & STATUS_INITIALIZED);
}
/*
@@ -185,8 +186,7 @@ static int battery_check_disconnect(void)
if (rv)
return BATTERY_DISCONNECT_ERROR;
- if (((batt_mfgacc >> BATFETS_SHIFT) & BATFETS_MASK) ==
- BATFETS_DISABLED)
+ if (((batt_mfgacc >> BATFETS_SHIFT) & BATFETS_MASK) == BATFETS_DISABLED)
return BATTERY_DISCONNECTED;
return BATTERY_NOT_DISCONNECTED;
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index 73a40b8433..3cdd7abaf1 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,6 +35,7 @@
#include "motion_lid.h"
#include "motion_sense.h"
#include "pi3usb9281.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "spi.h"
@@ -52,8 +53,8 @@
#include "util.h"
#include "espi.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -75,9 +76,9 @@ static void vbus_discharge_handler(void)
{
if (system_get_board_version() >= 2) {
pd_set_vbus_discharge(0,
- gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L));
+ gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L));
pd_set_vbus_discharge(1,
- gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L));
+ gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L));
}
}
DECLARE_DEFERRED(vbus_discharge_handler);
@@ -122,56 +123,47 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Base detection */
- [ADC_BASE_DET] = {"BASE_DET", NPCX_ADC_CH0,
- ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
/* Vbus sensing (10x voltage divider). */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {"AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1, 0},
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "tcpc1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "charger",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "pmic",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "accelgyro",
- .port = NPCX_I2C_PORT3,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "tcpc1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "charger",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "pmic",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "accelgyro",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -195,16 +187,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -222,7 +220,7 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9281_chips) ==
CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT);
const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
- GPIO_USB1_ENABLE,
+ GPIO_USB1_ENABLE,
};
const struct charger_config_t chg_chips[] = {
@@ -260,9 +258,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
@@ -282,13 +280,13 @@ uint16_t tcpc_get_alert_status(void)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* These BD99992GW temp sensors are only readable in S0 */
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -304,8 +302,8 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
- != EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault) !=
+ EC_SUCCESS)
return;
if (!(vrfault & BIT(4)))
@@ -414,8 +412,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
@@ -463,13 +460,13 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_L);
/* Level of sensor's I2C and interrupt are 3.3V on proto board */
- if(system_get_board_version() < 2) {
+ if (system_get_board_version() < 2) {
/* ACCELGYRO3_INT_L */
gpio_set_flags(GPIO_ACCELGYRO3_INT_L, GPIO_INT_FALLING);
/* I2C3_SCL / I2C3_SDA */
gpio_set_flags(GPIO_I2C3_SCL, GPIO_INPUT);
gpio_set_flags(GPIO_I2C3_SDA, GPIO_INPUT);
- }
+ }
/* Enable Gyro interrupts */
gpio_enable_interrupt(GPIO_ACCELGYRO3_INT_L);
@@ -519,10 +516,12 @@ int board_set_active_charge_port(int charge_port)
} else {
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L :
- GPIO_USB_C1_CHARGE_L, 1);
+ GPIO_USB_C1_CHARGE_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 0);
+ GPIO_USB_C0_CHARGE_L,
+ 0);
}
return EC_SUCCESS;
@@ -536,16 +535,16 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- /*
- * Limit the input current to 96% negotiated limit,
- * to account for the charger chip margin.
- */
+ /*
+ * Limit the input current to 96% negotiated limit,
+ * to account for the charger chip margin.
+ */
charge_ma = charge_ma * 96 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -571,7 +570,7 @@ void board_hibernate(void)
CPRINTS("Triggering PMIC shutdown.");
uart_flush_output();
- /* Trigger PMIC shutdown. */
+ /* Trigger PMIC shutdown. */
if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
@@ -625,17 +624,13 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0 },
- { 0, FLOAT_TO_FP(1), 0 },
- { 0, 0, FLOAT_TO_FP(-1) }
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0 },
- { 0, FLOAT_TO_FP(1), 0 },
- { 0, 0, FLOAT_TO_FP(-1) }
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -779,13 +774,12 @@ int board_has_working_reset_flags(void)
* I2C callbacks to ensure bus free time for battery I2C transactions is at
* least 5ms.
*/
-#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
+#define BATTERY_FREE_MIN_DELTA_US (5 * MSEC)
static timestamp_t battery_last_i2c_time;
static int is_battery_i2c(const int port, const uint16_t addr_flags)
{
- return (port == I2C_PORT_BATTERY)
- && (addr_flags == BATTERY_ADDR_FLAGS);
+ return (port == I2C_PORT_BATTERY) && (addr_flags == BATTERY_ADDR_FLAGS);
}
void i2c_start_xfer_notify(const int port, const uint16_t addr_flags)
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 3af9ee9b03..10d31f8555 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -63,8 +63,8 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* Battery */
@@ -88,8 +88,8 @@
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
#define CONFIG_HOSTCMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
@@ -128,7 +128,7 @@
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-#undef CONFIG_UART_TX_BUF_SIZE
+#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 2048
#define CONFIG_TABLET_MODE
@@ -162,27 +162,27 @@
#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 2
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_MP2949 NPCX_I2C_PORT2
-#define I2C_PORT_GYRO NPCX_I2C_PORT3
-#define I2C_PORT_BARO NPCX_I2C_PORT3
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
+#define I2C_PORT_CHARGER NPCX_I2C_PORT1
+#define I2C_PORT_BATTERY NPCX_I2C_PORT1
+#define I2C_PORT_PMIC NPCX_I2C_PORT2
+#define I2C_PORT_MP2949 NPCX_I2C_PORT2
+#define I2C_PORT_GYRO NPCX_I2C_PORT3
+#define I2C_PORT_BARO NPCX_I2C_PORT3
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992_FLAGS 0x30
-#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
#ifndef __ASSEMBLER__
@@ -191,9 +191,9 @@
/* Nautilus doesn't have systherm0 and systherm3 */
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
TEMP_SENSOR_COUNT
};
@@ -211,28 +211,23 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum adc_channel {
- ADC_BASE_DET,
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_BASE_DET, ADC_VBUS, ADC_AMON_BMON, ADC_CH_COUNT };
/* TODO(crosbug.com/p/61098): Verify the numbers below. */
/*
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
int board_get_version(void);
diff --git a/board/nautilus/build.mk b/board/nautilus/build.mk
index f4bf21113d..8f3a138f56 100644
--- a/board/nautilus/build.mk
+++ b/board/nautilus/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nautilus/ec.tasklist b/board/nautilus/ec.tasklist
index 8257734572..bcc5fc37e5 100644
--- a/board/nautilus/ec.tasklist
+++ b/board/nautilus/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nautilus/gpio.inc b/board/nautilus/gpio.inc
index 9cfc1e0bfd..13305d50fb 100644
--- a/board/nautilus/gpio.inc
+++ b/board/nautilus/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,10 +14,10 @@ GPIO_INT(USB_C1_PD_INT_ODL, PIN(C, 5), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
/* Use VW signals instead of GPIOs */
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/nautilus/led.c b/board/nautilus/led.c
index 86567701f0..3fab136610 100644
--- a/board/nautilus/led.c
+++ b/board/nautilus/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -23,9 +23,8 @@
#define LED_TOTAL_TICKS 16
#define LED_ON_TICKS 8
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -67,7 +66,6 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
return EC_SUCCESS;
}
-
static void nautilus_led_set_power_battery(void)
{
static unsigned int power_ticks;
@@ -82,9 +80,10 @@ static void nautilus_led_set_power_battery(void)
/* Flash red on critical battery, which usually inhibits AP power-on. */
if (battery_is_present() != BP_YES ||
- charge_percent < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
- set_color(((power_ticks++ % LED_TOTAL_TICKS) < LED_ON_TICKS) ?
- LED_RED : LED_OFF);
+ charge_percent < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
+ set_color(((power_ticks++ % LED_TOTAL_TICKS) < LED_ON_TICKS) ?
+ LED_RED :
+ LED_OFF);
return;
}
@@ -92,7 +91,7 @@ static void nautilus_led_set_power_battery(void)
switch (chg_state) {
case PWR_STATE_DISCHARGE:
if ((charge_get_flags() & CHARGE_FLAG_EXTERNAL_POWER) &&
- charge_percent >= BATTERY_LEVEL_NEAR_FULL)
+ charge_percent >= BATTERY_LEVEL_NEAR_FULL)
cur_led_color = LED_GREEN;
else
cur_led_color = LED_OFF;
@@ -101,15 +100,17 @@ static void nautilus_led_set_power_battery(void)
cur_led_color = LED_RED;
break;
case PWR_STATE_ERROR:
- cur_led_color = ((power_ticks++ % LED_TOTAL_TICKS)
- < LED_ON_TICKS) ? LED_RED : LED_GREEN;
+ cur_led_color =
+ ((power_ticks++ % LED_TOTAL_TICKS) < LED_ON_TICKS) ?
+ LED_RED :
+ LED_GREEN;
break;
case PWR_STATE_CHARGE_NEAR_FULL:
case PWR_STATE_IDLE:
- if(charge_get_flags() & CHARGE_FLAG_EXTERNAL_POWER)
- cur_led_color = LED_GREEN;
- else
- cur_led_color = LED_OFF;
+ cur_led_color = LED_OFF;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ cur_led_color = LED_GREEN;
break;
default:
cur_led_color = LED_RED;
@@ -128,8 +129,8 @@ static void nautilus_led_set_power_battery(void)
static void led_tick(void)
{
if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED) &&
- led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
- nautilus_led_set_power_battery();
+ led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ nautilus_led_set_power_battery();
}
}
diff --git a/board/nautilus/usb_pd_policy.c b/board/nautilus/usb_pd_policy.c
index be4716b860..e01fd75f73 100644
--- a/board/nautilus/usb_pd_policy.c
+++ b/board/nautilus/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,12 +21,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -47,8 +47,8 @@ static void board_vbus_update_source_current(int port)
* is controlled by GPIO_USB_C0/1_5V_EN. Both of these signals
* can remain outputs.
*/
- gpio_set_level(gpio_3a_en, vbus_rp[port] == TYPEC_RP_3A0 ?
- 1 : 0);
+ gpio_set_level(gpio_3a_en,
+ vbus_rp[port] == TYPEC_RP_3A0 ? 1 : 0);
gpio_set_level(gpio_5v_en, vbus_en[port]);
} else {
/*
@@ -60,8 +60,8 @@ static void board_vbus_update_source_current(int port)
* 1505 mA.
*/
int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) :
- (GPIO_OUTPUT | GPIO_PULL_UP);
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
gpio_set_level(gpio_5v_en, vbus_en[port]);
gpio_set_flags(gpio_5v_en, flags);
}
@@ -78,8 +78,7 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 1);
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_L : GPIO_USB_C0_CHARGE_L, 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
@@ -124,22 +123,19 @@ int pd_snk_is_vbus_provided(int port)
GPIO_USB_C0_VBUS_WAKE_L);
}
-
int pd_check_vconn_swap(int port)
{
/* in G3, do not allow vconn swap since pp5000_A rail is off */
return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
return;
- gpio_set_level(GPIO_USB2_OTG_ID,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_OTG_ID, (data_role == PD_ROLE_UFP) ? 1 : 0);
gpio_set_level(GPIO_USB2_OTG_VBUSSENSE,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ (data_role == PD_ROLE_UFP) ? 1 : 0);
}
diff --git a/board/nightfury/battery.c b/board/nightfury/battery.c
index a3b251229b..9e9b9baa74 100644
--- a/board/nightfury/battery.c
+++ b/board/nightfury/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -111,10 +111,10 @@ enum battery_present variant_battery_present(void)
int charger_profile_override(struct charge_state_data *curr)
{
- if(chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
return 0;
- if(curr->requested_current > CHARGING_CURRENT_45C)
+ if (curr->requested_current > CHARGING_CURRENT_45C)
curr->requested_current = CHARGING_CURRENT_45C;
return 0;
@@ -124,13 +124,13 @@ int charger_profile_override(struct charge_state_data *curr)
#define PARAM_FASTCHARGE (CS_PARAM_CUSTOM_PROFILE_MIN + 0)
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
- return EC_RES_INVALID_PARAM;
+ return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
- return EC_RES_INVALID_PARAM;
+ return EC_RES_INVALID_PARAM;
}
diff --git a/board/nightfury/board.c b/board/nightfury/board.c
index faaea01042..bfcdd14628 100644
--- a/board/nightfury/board.c
+++ b/board/nightfury/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -101,23 +101,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 3,
- .flags = 0,
- .freq = 10000
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -142,14 +135,18 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -186,22 +183,18 @@ static struct opt3001_drv_data_t g_opt3001_data = {
static struct stprivate_data g_lis2ds_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/*
* TODO(b/124337208): P0 boards don't have this sensor mounted so the rotation
* matrix can't be tested properly. This needs to be revisited after EVT to make
* sure the rotation matrix for the lid sensor is correct.
*/
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -341,49 +334,49 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/**********************************************************************/
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_IA", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_GT", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_IA", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_GT", NPCX_ADC_CH3, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "IA",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "GT",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "IA",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "GT",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/* Nightfury Temperature sensors */
/*
* TODO(b/138578073): These setting need to be reviewed and set appropriately
- * for Nightfury. They matter when the EC is controlling the fan as opposed to DPTF
- * control.
+ * for Nightfury. They matter when the EC is controlling the fan as opposed to
+ * DPTF control.
*/
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
diff --git a/board/nightfury/board.h b/board/nightfury/board.h
index 67e55f974e..9831741d5a 100644
--- a/board/nightfury/board.h
+++ b/board/nightfury/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,7 +45,7 @@
/* BH1730 and TCS3400 ALS */
#define CONFIG_ALS
#define ALS_COUNT 1
-#define I2C_PORT_ALS I2C_PORT_SENSOR
+#define I2C_PORT_ALS I2C_PORT_SENSOR
#define CONFIG_ALS_OPT3001
#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
@@ -66,18 +66,18 @@
* Nightfury will not use both BH1730_LUXTH3_1K condition
* and BH1730_LUXTH4_1K condition.
*/
-#define BH1730_LUXTH1_1K 270
-#define BH1730_LUXTH1_D0_1K 19200
-#define BH1730_LUXTH1_D1_1K 30528
-#define BH1730_LUXTH2_1K 655360000
-#define BH1730_LUXTH2_D0_1K 11008
-#define BH1730_LUXTH2_D1_1K 10752
-#define BH1730_LUXTH3_1K 1030
-#define BH1730_LUXTH3_D0_1K 11008
-#define BH1730_LUXTH3_D1_1K 10752
-#define BH1730_LUXTH4_1K 3670
-#define BH1730_LUXTH4_D0_1K 11008
-#define BH1730_LUXTH4_D1_1K 10752
+#define BH1730_LUXTH1_1K 270
+#define BH1730_LUXTH1_D0_1K 19200
+#define BH1730_LUXTH1_D1_1K 30528
+#define BH1730_LUXTH2_1K 655360000
+#define BH1730_LUXTH2_D0_1K 11008
+#define BH1730_LUXTH2_D1_1K 10752
+#define BH1730_LUXTH3_1K 1030
+#define BH1730_LUXTH3_D0_1K 11008
+#define BH1730_LUXTH3_D1_1K 10752
+#define BH1730_LUXTH4_1K 3670
+#define BH1730_LUXTH4_D0_1K 11008
+#define BH1730_LUXTH4_D1_1K 10752
/* USB Type C and USB PD defines */
#define CONFIG_USB_MUX_RUNTIME_CONFIG
@@ -132,16 +132,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -152,9 +152,9 @@
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC3 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC3 */
ADC_CH_COUNT
};
@@ -166,11 +166,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/nightfury/build.mk b/board/nightfury/build.mk
index e91262fd43..169668e64c 100644
--- a/board/nightfury/build.mk
+++ b/board/nightfury/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nightfury/ec.tasklist b/board/nightfury/ec.tasklist
index 101713dc6e..507845b304 100644
--- a/board/nightfury/ec.tasklist
+++ b/board/nightfury/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nightfury/gpio.inc b/board/nightfury/gpio.inc
index 68d847fe92..710bf07c17 100644
--- a/board/nightfury/gpio.inc
+++ b/board/nightfury/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/nightfury/led.c b/board/nightfury/led.c
index dce39acfd6..9d2c367ab5 100644
--- a/board/nightfury/led.c
+++ b/board/nightfury/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,8 +12,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 1;
@@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100;
/* Nightfury : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -55,12 +58,11 @@ __override void led_set_color_power(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
- if (color == EC_LED_COLOR_BLUE)
- {
+ if (color == EC_LED_COLOR_BLUE) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_ON_LVL);
@@ -74,15 +76,14 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
/* Battery leds must be turn off when blue led is on
* because Nightfury has 3-in-1 led.
*/
- if(!gpio_get_level(GPIO_PWR_LED_BLUE_L))
- {
+ if (!gpio_get_level(GPIO_PWR_LED_BLUE_L)) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
return;
@@ -118,10 +119,13 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
- gpio_set_level(GPIO_BAT_LED_GREEN_L, !brightness[EC_LED_COLOR_GREEN]);
- gpio_set_level(GPIO_BAT_LED_RED_L, !brightness[EC_LED_COLOR_RED]);
+ gpio_set_level(GPIO_BAT_LED_GREEN_L,
+ !brightness[EC_LED_COLOR_GREEN]);
+ gpio_set_level(GPIO_BAT_LED_RED_L,
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
- gpio_set_level(GPIO_PWR_LED_BLUE_L, !brightness[EC_LED_COLOR_BLUE]);
+ gpio_set_level(GPIO_PWR_LED_BLUE_L,
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/nipperkin/battery.c b/board/nipperkin/battery.c
index 5a3656c734..b8bedb535e 100644
--- a/board/nipperkin/battery.c
+++ b/board/nipperkin/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c
index 93db38b7ec..e4f3c0db57 100644
--- a/board/nipperkin/board.c
+++ b/board/nipperkin/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,7 +17,7 @@
#include "driver/charger/isl9241.h"
#include "driver/retimer/pi3hdx1204.h"
#include "driver/retimer/ps8811.h"
-#include "driver/retimer/ps8818.h"
+#include "driver/retimer/ps8818_public.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/temp_sensor/pct2075.h"
#include "extpower.h"
@@ -45,16 +45,15 @@ static void hdmi_hpd_interrupt(enum gpio_signal signal);
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
__override enum ec_error_list
board_a1_ps8811_retimer_init(const struct usb_mux *me)
@@ -63,51 +62,46 @@ board_a1_ps8811_retimer_init(const struct usb_mux *me)
}
__override int board_c1_ps8818_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
/* Set the RX input termination */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_RX_PHY,
- PS8818_RX_INPUT_TERM_MASK,
- PS8818_RX_INPUT_TERM_112_OHM);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_RX_PHY,
+ PS8818_RX_INPUT_TERM_MASK,
+ PS8818_RX_INPUT_TERM_112_OHM);
if (rv)
return rv;
}
@@ -115,11 +109,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_DPEQ_LEVEL,
- PS8818_DPEQ_LEVEL_UP_MASK,
- PS8818_DPEQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_DPEQ_LEVEL,
+ PS8818_DPEQ_LEVEL_UP_MASK,
+ PS8818_DPEQ_LEVEL_UP_19DB);
if (rv)
return rv;
@@ -145,8 +138,7 @@ static void board_chipset_startup(void)
if (get_board_version() > 1)
pct2075_init();
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
int board_get_soc_temp_k(int idx, int *temp_k)
{
@@ -336,17 +328,15 @@ static void board_chipset_resume(void)
ioex_set_level(IOEX_EN_PWR_HDMI, 1);
ioex_set_level(IOEX_HDMI_DATA_EN, 1);
msleep(PI3HDX1204_POWER_ON_DELAY_MS);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- check_hdmi_hpd_status());
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
+ check_hdmi_hpd_status());
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
/* Called on AP suspend */
static void board_chipset_suspend(void)
{
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS, 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
ioex_set_level(IOEX_HDMI_DATA_EN, 0);
ioex_set_level(IOEX_EN_PWR_HDMI, 0);
ioex_set_level(IOEX_USB_A1_PD_R_L, 0);
@@ -499,10 +489,9 @@ static void hdmi_hpd_handler(void)
int hpd = check_hdmi_hpd_status();
ccprints("HDMI HPD %d", hpd);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON)
- && hpd);
+ pi3hdx1204_enable(
+ I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) && hpd);
}
DECLARE_DEFERRED(hdmi_hpd_handler);
diff --git a/board/nipperkin/board.h b/board/nipperkin/board.h
index ce458113b2..af684e1f49 100644
--- a/board/nipperkin/board.h
+++ b/board/nipperkin/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,11 +21,11 @@
#define CONFIG_CMD_BUTTON
/* USB Type C and USB PD defines */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Max Power = 100 W */
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
#define CONFIG_CHARGER_PROFILE_OVERRIDE
diff --git a/board/nipperkin/board_fw_config.c b/board/nipperkin/board_fw_config.c
index c9fa01bc7a..e21e42689f 100644
--- a/board/nipperkin/board_fw_config.c
+++ b/board/nipperkin/board_fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,8 @@
bool board_has_kblight(void)
{
return (get_fw_config_field(FW_CONFIG_KBLIGHT_OFFSET,
- FW_CONFIG_KBLIGHT_WIDTH) == FW_CONFIG_KBLIGHT_YES);
+ FW_CONFIG_KBLIGHT_WIDTH) ==
+ FW_CONFIG_KBLIGHT_YES);
}
enum board_usb_c1_mux board_get_usb_c1_mux(void)
@@ -25,6 +26,6 @@ enum board_usb_a1_retimer board_get_usb_a1_retimer(void)
bool board_has_privacy_panel(void)
{
return (get_fw_config_field(FW_CONFIG_KEYBOARD_OFFSET,
- FW_CONFIG_KEYBOARD_WIDTH) ==
- FW_CONFIG_KEYBOARD_PRIVACY_YES);
+ FW_CONFIG_KEYBOARD_WIDTH) ==
+ FW_CONFIG_KEYBOARD_PRIVACY_YES);
}
diff --git a/board/nipperkin/board_fw_config.h b/board/nipperkin/board_fw_config.h
index 77306ccb6f..f4673f732e 100644
--- a/board/nipperkin/board_fw_config.h
+++ b/board/nipperkin/board_fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,10 +13,10 @@
/*
* Keyboard Backlight (1 bit)
*/
-#define FW_CONFIG_KBLIGHT_OFFSET 0
-#define FW_CONFIG_KBLIGHT_WIDTH 1
-#define FW_CONFIG_KBLIGHT_NO 0
-#define FW_CONFIG_KBLIGHT_YES 1
+#define FW_CONFIG_KBLIGHT_OFFSET 0
+#define FW_CONFIG_KBLIGHT_WIDTH 1
+#define FW_CONFIG_KBLIGHT_NO 0
+#define FW_CONFIG_KBLIGHT_YES 1
/*
* Bit 1 ~ 6 not related to EC function
@@ -25,10 +25,10 @@
/*
* Keyboard (1 bit)
*/
-#define FW_CONFIG_KEYBOARD_OFFSET 7
-#define FW_CONFIG_KEYBOARD_WIDTH 1
-#define FW_CONFIG_KEYBOARD_PRIVACY_YES 0
-#define FW_CONFIG_KEYBOARD_PRIVACY_NO 1
+#define FW_CONFIG_KEYBOARD_OFFSET 7
+#define FW_CONFIG_KEYBOARD_WIDTH 1
+#define FW_CONFIG_KEYBOARD_PRIVACY_YES 0
+#define FW_CONFIG_KEYBOARD_PRIVACY_NO 1
bool board_has_privacy_panel(void);
diff --git a/board/nipperkin/build.mk b/board/nipperkin/build.mk
index 5f5ffb9ce4..aad8b2ae09 100644
--- a/board/nipperkin/build.mk
+++ b/board/nipperkin/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nipperkin/ec.tasklist b/board/nipperkin/ec.tasklist
index ccdff9847c..a127b13eba 100644
--- a/board/nipperkin/ec.tasklist
+++ b/board/nipperkin/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nipperkin/gpio.inc b/board/nipperkin/gpio.inc
index bd00c932af..0a8c6d9a65 100644
--- a/board/nipperkin/gpio.inc
+++ b/board/nipperkin/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nipperkin/led.c b/board/nipperkin/led.c
index 93131400d2..c7d6e0e0bc 100644
--- a/board/nipperkin/led.c
+++ b/board/nipperkin/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,22 +35,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- LED_LEFT_PORT = 0,
- LED_RIGHT_PORT
-};
+enum led_port { LED_LEFT_PORT = 0, LED_RIGHT_PORT };
static void led_set_color_battery(enum led_port port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == LED_LEFT_PORT ? GPIO_C0_CHARGE_LED_AMBER_L :
- GPIO_C1_CHARGE_LED_AMBER_L);
+ GPIO_C1_CHARGE_LED_AMBER_L);
white_led = (port == LED_LEFT_PORT ? GPIO_C0_CHARGE_LED_WHITE_L :
- GPIO_C1_CHARGE_LED_WHITE_L);
+ GPIO_C1_CHARGE_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -121,18 +118,19 @@ static void set_active_port_color(enum led_color color)
int port = charge_manager_get_active_charge_port();
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
- led_set_color_battery(LED_RIGHT_PORT,
- (port == LED_RIGHT_PORT) ? color : LED_OFF);
+ led_set_color_battery(LED_RIGHT_PORT, (port == LED_RIGHT_PORT) ?
+ color :
+ LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
- led_set_color_battery(LED_LEFT_PORT,
- (port == LED_LEFT_PORT) ? color : LED_OFF);
+ led_set_color_battery(LED_LEFT_PORT, (port == LED_LEFT_PORT) ?
+ color :
+ LED_OFF);
}
static void led_set_battery(void)
{
static int battery_ticks;
static int power_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -142,16 +140,19 @@ static void led_set_battery(void)
* system suspend with non-charging state.
*/
if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
-
+ charge_get_state() != PWR_STATE_CHARGE) {
power_ticks++;
- led_set_color_battery(LED_RIGHT_PORT, power_ticks
- % LED_TICKS_PER_CYCLE_S3 < POWER_LED_ON_S3_TICKS
- ? LED_WHITE : LED_OFF);
- led_set_color_battery(LED_LEFT_PORT, power_ticks
- % LED_TICKS_PER_CYCLE_S3 < POWER_LED_ON_S3_TICKS
- ? LED_WHITE : LED_OFF);
+ led_set_color_battery(LED_RIGHT_PORT,
+ power_ticks % LED_TICKS_PER_CYCLE_S3 <
+ POWER_LED_ON_S3_TICKS ?
+ LED_WHITE :
+ LED_OFF);
+ led_set_color_battery(LED_LEFT_PORT,
+ power_ticks % LED_TICKS_PER_CYCLE_S3 <
+ POWER_LED_ON_S3_TICKS ?
+ LED_WHITE :
+ LED_OFF);
return;
}
@@ -165,30 +166,38 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(LED_RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ LED_RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(LED_RIGHT_PORT, LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(LED_LEFT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ LED_LEFT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(LED_LEFT_PORT, LED_OFF);
}
break;
case PWR_STATE_ERROR:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
- led_set_color_battery(LED_RIGHT_PORT,
+ led_set_color_battery(
+ LED_RIGHT_PORT,
(battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
- led_set_color_battery(LED_LEFT_PORT,
+ led_set_color_battery(
+ LED_LEFT_PORT,
(battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
}
break;
@@ -197,12 +206,13 @@ static void led_set_battery(void)
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/nipperkin/thermal.c b/board/nipperkin/thermal.c
index eecf23a9e3..117a6d08fa 100644
--- a/board/nipperkin/thermal.c
+++ b/board/nipperkin/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,7 +18,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
@@ -59,52 +59,51 @@ struct fan_step {
static const struct fan_step fan_step_table[] = {
{
/* level 0 */
- .on = {51, 0, 44, -1, -1, -1},
- .off = {99, 99, 99, -1, -1, -1},
- .rpm = {0},
+ .on = { 51, 0, 44, -1, -1, -1 },
+ .off = { 99, 99, 99, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {52, 0, 47, -1, -1, -1},
- .off = {50, 99, 43, -1, -1, -1},
- .rpm = {3000},
+ .on = { 52, 0, 47, -1, -1, -1 },
+ .off = { 50, 99, 43, -1, -1, -1 },
+ .rpm = { 3000 },
},
{
/* level 2 */
- .on = {53, 0, 49, -1, -1, -1},
- .off = {51, 99, 45, -1, -1, -1},
- .rpm = {3400},
+ .on = { 53, 0, 49, -1, -1, -1 },
+ .off = { 51, 99, 45, -1, -1, -1 },
+ .rpm = { 3400 },
},
{
/* level 3 */
- .on = {54, 0, 51, -1, -1, -1},
- .off = {52, 99, 47, -1, -1, -1},
- .rpm = {3800},
+ .on = { 54, 0, 51, -1, -1, -1 },
+ .off = { 52, 99, 47, -1, -1, -1 },
+ .rpm = { 3800 },
},
{
/* level 4 */
- .on = {56, 50, 53, -1, -1, -1},
- .off = {53, 47, 49, -1, -1, -1},
- .rpm = {4100},
+ .on = { 56, 50, 53, -1, -1, -1 },
+ .off = { 53, 47, 49, -1, -1, -1 },
+ .rpm = { 4100 },
},
{
/* level 5 */
- .on = {57, 52, 55, -1, -1, -1},
- .off = {55, 49, 51, -1, -1, -1},
- .rpm = {4400},
+ .on = { 57, 52, 55, -1, -1, -1 },
+ .off = { 55, 49, 51, -1, -1, -1 },
+ .rpm = { 4400 },
},
{
/* level 6 */
- .on = {100, 100, 100, -1, -1, -1},
- .off = {56, 51, 53, -1, -1, -1},
- .rpm = {4900},
+ .on = { 100, 100, 100, -1, -1, -1 },
+ .off = { 56, 51, 53, -1, -1, -1 },
+ .rpm = { 4900 },
},
};
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_step_table)
-BUILD_ASSERT(ARRAY_SIZE(fan_step_table) ==
- ARRAY_SIZE(fan_step_table));
+BUILD_ASSERT(ARRAY_SIZE(fan_step_table) == ARRAY_SIZE(fan_step_table));
int fan_table_to_rpm(int fan, int *temp)
{
@@ -121,30 +120,29 @@ int fan_table_to_rpm(int fan, int *temp)
* 3. invariant path. (return the current RPM)
*/
if (temp[TEMP_SENSOR_CHARGER] < prev_tmp[TEMP_SENSOR_CHARGER] ||
- temp[TEMP_SENSOR_MEMORY] < prev_tmp[TEMP_SENSOR_MEMORY] ||
- temp[TEMP_SENSOR_SOC] < prev_tmp[TEMP_SENSOR_SOC]) {
+ temp[TEMP_SENSOR_MEMORY] < prev_tmp[TEMP_SENSOR_MEMORY] ||
+ temp[TEMP_SENSOR_SOC] < prev_tmp[TEMP_SENSOR_SOC]) {
for (i = current_level; i > 0; i--) {
if (temp[TEMP_SENSOR_CHARGER] <
- fan_step_table[i].off[TEMP_SENSOR_CHARGER] &&
- temp[TEMP_SENSOR_MEMORY] <
- fan_step_table[i].off[TEMP_SENSOR_MEMORY] &&
- temp[TEMP_SENSOR_SOC] <
- fan_step_table[i].off[TEMP_SENSOR_SOC]) {
+ fan_step_table[i].off[TEMP_SENSOR_CHARGER] &&
+ temp[TEMP_SENSOR_MEMORY] <
+ fan_step_table[i].off[TEMP_SENSOR_MEMORY] &&
+ temp[TEMP_SENSOR_SOC] <
+ fan_step_table[i].off[TEMP_SENSOR_SOC]) {
current_level = i - 1;
} else
break;
}
} else if (temp[TEMP_SENSOR_CHARGER] > prev_tmp[TEMP_SENSOR_CHARGER] ||
- temp[TEMP_SENSOR_MEMORY]
- > prev_tmp[TEMP_SENSOR_MEMORY] ||
- temp[TEMP_SENSOR_SOC] > prev_tmp[TEMP_SENSOR_SOC]) {
+ temp[TEMP_SENSOR_MEMORY] > prev_tmp[TEMP_SENSOR_MEMORY] ||
+ temp[TEMP_SENSOR_SOC] > prev_tmp[TEMP_SENSOR_SOC]) {
for (i = current_level; i < NUM_FAN_LEVELS; i++) {
if ((temp[TEMP_SENSOR_CHARGER] >
- fan_step_table[i].on[TEMP_SENSOR_CHARGER] &&
- temp[TEMP_SENSOR_MEMORY] >
- fan_step_table[i].on[TEMP_SENSOR_MEMORY]) ||
- temp[TEMP_SENSOR_SOC] >
- fan_step_table[i].on[TEMP_SENSOR_SOC]) {
+ fan_step_table[i].on[TEMP_SENSOR_CHARGER] &&
+ temp[TEMP_SENSOR_MEMORY] >
+ fan_step_table[i].on[TEMP_SENSOR_MEMORY]) ||
+ temp[TEMP_SENSOR_SOC] >
+ fan_step_table[i].on[TEMP_SENSOR_SOC]) {
current_level = i + 1;
} else
break;
@@ -167,15 +165,12 @@ int fan_table_to_rpm(int fan, int *temp)
void board_override_fan_control(int fan, int *tmp)
{
- if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, tmp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp));
}
}
-
struct chg_curr_step {
int on;
int off;
@@ -183,12 +178,11 @@ struct chg_curr_step {
};
static const struct chg_curr_step chg_curr_table[] = {
- {.on = 0, .off = 0, .curr_ma = 3566},
- {.on = 66, .off = 65, .curr_ma = 2500},
- {.on = 70, .off = 69, .curr_ma = 1500},
+ { .on = 0, .off = 0, .curr_ma = 3566 },
+ { .on = 66, .off = 65, .curr_ma = 2500 },
+ { .on = 70, .off = 69, .curr_ma = 1500 },
};
-
#define NUM_CHG_CURRENT_LEVELS ARRAY_SIZE(chg_curr_table)
int charger_profile_override(struct charge_state_data *curr)
@@ -200,7 +194,6 @@ int charger_profile_override(struct charge_state_data *curr)
static int current_level;
static int prev_tmp;
-
if (!(curr->batt.flags & BATT_FLAG_RESPONSIVE))
return 0;
@@ -214,12 +207,13 @@ int charger_profile_override(struct charge_state_data *curr)
if (chipset_in_state(CHIPSET_STATE_ON)) {
if (chg_temp_c < prev_tmp) {
- if ((chg_temp_c <= chg_curr_table[current_level].off)
- && (current_level > 0))
+ if ((chg_temp_c <= chg_curr_table[current_level].off) &&
+ (current_level > 0))
current_level -= 1;
} else if (chg_temp_c > prev_tmp) {
- if ((chg_temp_c >= chg_curr_table[current_level + 1].on)
- && (current_level < NUM_CHG_CURRENT_LEVELS - 1))
+ if ((chg_temp_c >=
+ chg_curr_table[current_level + 1].on) &&
+ (current_level < NUM_CHG_CURRENT_LEVELS - 1))
current_level += 1;
}
diff --git a/board/nocturne/base_detect.c b/board/nocturne/base_detect.c
index 48c7b1f9dd..807aa3e14a 100644
--- a/board/nocturne/base_detect.c
+++ b/board/nocturne/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,8 +26,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
#define DEFAULT_POLL_TIMEOUT_US (250 * MSEC)
#define DEBOUNCE_TIMEOUT_US (20 * MSEC)
@@ -62,7 +62,6 @@
*/
#define WINDOW_SIZE 5
-
enum base_detect_state {
BASE_DETACHED = 0,
BASE_ATTACHED_DEBOUNCE,
@@ -82,7 +81,7 @@ static timestamp_t detached_decision_deadline;
static void enable_base_interrupts(int enable)
{
int (*fn)(enum gpio_signal) = enable ? gpio_enable_interrupt :
- gpio_disable_interrupt;
+ gpio_disable_interrupt;
/* This pin is present on boards newer than rev 0. */
if (board_get_version() > 0)
@@ -141,28 +140,26 @@ static void base_detect_changed(void)
static int base_seems_attached(int attach_pin_mv, int detach_pin_mv)
{
/* We can't tell if we don't have good readings. */
- if (attach_pin_mv == ADC_READ_ERROR ||
- detach_pin_mv == ADC_READ_ERROR)
+ if (attach_pin_mv == ADC_READ_ERROR || detach_pin_mv == ADC_READ_ERROR)
return 0;
if (gpio_get_level(GPIO_BASE_PWR_EN))
return (attach_pin_mv >= PWREN_ATTACH_MIN_MV) &&
- (detach_pin_mv >= DETACH_MIN_MV);
+ (detach_pin_mv >= DETACH_MIN_MV);
else
return (attach_pin_mv <= ATTACH_MAX_MV) &&
- (attach_pin_mv >= ATTACH_MIN_MV) &&
- (detach_pin_mv <= DETACH_MIN_MV);
+ (attach_pin_mv >= ATTACH_MIN_MV) &&
+ (detach_pin_mv <= DETACH_MIN_MV);
}
static int base_seems_detached(int attach_pin_mv, int detach_pin_mv)
{
/* We can't tell if we don't have good readings. */
- if (attach_pin_mv == ADC_READ_ERROR ||
- detach_pin_mv == ADC_READ_ERROR)
+ if (attach_pin_mv == ADC_READ_ERROR || detach_pin_mv == ADC_READ_ERROR)
return 0;
return (attach_pin_mv >= PWREN_ATTACH_MIN_MV) &&
- (detach_pin_mv <= DETACH_MIN_MV);
+ (detach_pin_mv <= DETACH_MIN_MV);
}
static void set_state(enum base_detect_state new_state)
@@ -194,9 +191,9 @@ static void base_detect_deferred(void)
if (forced_state != BASE_NO_FORCED_STATE) {
if (state != forced_state) {
- CPRINTS("BD forced %s",
- forced_state == BASE_ATTACHED ?
- "attached" : "detached");
+ CPRINTS("BD forced %s", forced_state == BASE_ATTACHED ?
+ "attached" :
+ "detached");
set_state(forced_state);
base_detect_changed();
}
@@ -212,8 +209,7 @@ static void base_detect_deferred(void)
if (debug) {
int i;
- CPRINTS("BD st%d: att: %dmV det: %dmV", state,
- attach_reading,
+ CPRINTS("BD st%d: att: %dmV det: %dmV", state, attach_reading,
detach_reading);
CPRINTF("det readings = [");
for (i = 0; i < WINDOW_SIZE; i++)
@@ -341,7 +337,6 @@ static void check_and_reapply_base_power_deferred(void)
hook_call_deferred(&clear_base_power_on_attempts_deferred_data,
SECOND);
}
-
}
DECLARE_DEFERRED(check_and_reapply_base_power_deferred);
@@ -366,20 +361,19 @@ void base_pwr_fault_interrupt(enum gpio_signal s)
}
}
-static int command_basedetectdebug(int argc, char **argv)
+static int command_basedetectdebug(int argc, const char **argv)
{
if ((argc > 1) && !parse_bool(argv[1], &debug))
return EC_ERROR_PARAM1;
- CPRINTS("BD: %sst%d", forced_state != BASE_NO_FORCED_STATE ?
- "forced " : "", state);
+ CPRINTS("BD: %sst%d",
+ forced_state != BASE_NO_FORCED_STATE ? "forced " : "", state);
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(basedebug, command_basedetectdebug, "[ena|dis]",
"En/Disable base detection debug");
-
void base_force_state(enum ec_set_base_state_cmd state)
{
if (state == EC_SET_BASE_STATE_ATTACH)
diff --git a/board/nocturne/battery.c b/board/nocturne/battery.c
index 0e568ca6f9..c81640e983 100644
--- a/board/nocturne/battery.c
+++ b/board/nocturne/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -21,26 +21,26 @@
#include "usb_pd.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHUTDOWN_DATA 0x0010
/*
* We need to stop charging the battery when the DRAM temperature sensor gets
* over 47 C (320 K), and resume charging once it cools back down.
*/
-#define DRAM_STOPCHARGE_TEMP_K 320
+#define DRAM_STOPCHARGE_TEMP_K 320
/* Battery info */
static const struct battery_info info = {
- .voltage_max = 8880,
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 160,
- .start_charging_min_c = 10,
- .start_charging_max_c = 50,
- .charging_min_c = 10,
- .charging_max_c = 50,
- .discharging_min_c = -20,
- .discharging_max_c = 60,
+ .voltage_max = 8880,
+ .voltage_normal = 7700,
+ .voltage_min = 6000,
+ .precharge_current = 160,
+ .start_charging_min_c = 10,
+ .start_charging_max_c = 50,
+ .charging_min_c = 10,
+ .charging_max_c = 50,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
};
int board_cut_off_battery(void)
@@ -78,8 +78,8 @@ enum battery_disconnect_state battery_get_disconnect_state(void)
return BATTERY_NOT_DISCONNECTED;
/* Check if battery discharge FET is disabled. */
- rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return BATTERY_DISCONNECT_ERROR;
if (~data[3] & (BATTERY_DISCHARGING_DISABLED)) {
@@ -91,8 +91,8 @@ enum battery_disconnect_state battery_get_disconnect_state(void)
* Battery discharge FET is disabled. Verify that we didn't enter this
* state due to a safety fault.
*/
- rv = sb_read_mfgacc(PARAM_SAFETY_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_SAFETY_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv || data[2] || data[3] || data[4] || data[5])
return BATTERY_DISCONNECT_ERROR;
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index ac29dfb942..d32f036844 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,7 @@
#include "lpc.h"
#include "mkbp_event.h"
#include "motion_sense.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -46,8 +47,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal s)
{
@@ -101,80 +102,67 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_AC_PRESENT,
GPIO_POWER_BUTTON_L,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
const struct adc_t adc_channels[] = {
- [ADC_BASE_ATTACH] = {
- "BASE ATTACH", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
+ [ADC_BASE_ATTACH] = { "BASE ATTACH", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
- [ADC_BASE_DETACH] = {
- "BASE DETACH", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
+ [ADC_BASE_DETACH] = { "BASE DETACH", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_DB0_LED_RED] = { 3, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- 986 },
+ [PWM_CH_DB0_LED_RED] = { 3, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 986 },
[PWM_CH_DB0_LED_GREEN] = { 0, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
986 },
- [PWM_CH_DB0_LED_BLUE] = { 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- 986 },
- [PWM_CH_DB1_LED_RED] = { 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- 986 },
+ [PWM_CH_DB0_LED_BLUE] = { 2, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 986 },
+ [PWM_CH_DB1_LED_RED] = { 7, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 986 },
[PWM_CH_DB1_LED_GREEN] = { 5, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
986 },
- [PWM_CH_DB1_LED_BLUE] = { 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- 986 },
+ [PWM_CH_DB1_LED_BLUE] = { 6, PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ 986 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_EC_I2C4_BATTERY_SCL,
- .sda = GPIO_EC_I2C4_BATTERY_SDA
- },
-
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C0_POWER_SCL,
- .sda = GPIO_EC_I2C0_POWER_SDA
- },
-
- {
- .name = "als_gyro",
- .port = I2C_PORT_ALS_GYRO,
- .kbps = 400,
- .scl = GPIO_EC_I2C5_ALS_GYRO_SCL,
- .sda = GPIO_EC_I2C5_ALS_GYRO_SDA
- },
-
- {
- .name = "usbc0",
- .port = I2C_PORT_USB_C0,
- .kbps = 100,
- .scl = GPIO_USB_C0_SCL,
- .sda = GPIO_USB_C0_SDA
- },
-
- {
- .name = "usbc1",
- .port = I2C_PORT_USB_C1,
- .kbps = 100,
- .scl = GPIO_USB_C1_SCL,
- .sda = GPIO_USB_C1_SDA
- },
+ { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C4_BATTERY_SCL,
+ .sda = GPIO_EC_I2C4_BATTERY_SDA },
+
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C0_POWER_SCL,
+ .sda = GPIO_EC_I2C0_POWER_SDA },
+
+ { .name = "als_gyro",
+ .port = I2C_PORT_ALS_GYRO,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C5_ALS_GYRO_SCL,
+ .sda = GPIO_EC_I2C5_ALS_GYRO_SDA },
+
+ { .name = "usbc0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 100,
+ .scl = GPIO_USB_C0_SCL,
+ .sda = GPIO_USB_C0_SDA },
+
+ { .name = "usbc1",
+ .port = I2C_PORT_USB_C1,
+ .kbps = 100,
+ .scl = GPIO_USB_C1_SCL,
+ .sda = GPIO_USB_C1_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-
/*
* Motion Sense
*/
@@ -191,11 +179,9 @@ static struct opt3001_drv_data_t g_opt3001_data = {
};
/* Matrix to rotate accel/gyro into standard reference frame. */
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -303,11 +289,9 @@ static void enable_sensor_irqs(void)
DECLARE_HOOK(HOOK_CHIPSET_RESUME, enable_sensor_irqs, HOOK_PRIO_DEFAULT);
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
{
.i2c_port = I2C_PORT_USB_C1,
.i2c_addr_flags = SN5S330_ADDR0_FLAGS,
@@ -335,17 +319,23 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -366,8 +356,7 @@ DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
static void imvp8_tune_deferred(void)
{
/* For the IMVP8, reduce the steps during decay from 3 to 1. */
- if (i2c_write16(I2C_PORT_POWER, I2C_ADDR_MP2949_FLAGS,
- 0xFA, 0x0AC5))
+ if (i2c_write16(I2C_PORT_POWER, I2C_ADDR_MP2949_FLAGS, 0xFA, 0x0AC5))
CPRINTS("Failed to change step decay!");
}
DECLARE_DEFERRED(imvp8_tune_deferred);
@@ -522,8 +511,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x6a);
}
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
@@ -536,8 +524,7 @@ static void board_pmic_init(void)
int pgmask1;
/* Mask V5A_DS3_PG from PMIC PGMASK1. */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- 0x18, &pgmask1))
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x18, &pgmask1))
return;
pgmask1 |= BIT(2);
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x18, pgmask1);
@@ -611,19 +598,19 @@ static int read_gyro_sensor_temp(int idx, int *temp_ptr)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* These BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
+ { "eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM3 },
/* The Gyro temperature sensor is only readable in S0. */
- {"Gyro", TEMP_SENSOR_TYPE_BOARD, read_gyro_sensor_temp, LID_GYRO}
+ { "Gyro", TEMP_SENSOR_TYPE_BOARD, read_gyro_sensor_temp, LID_GYRO }
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -633,16 +620,15 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
*/
struct ec_thermal_config thermal_params[] = {
/* {Twarn, Thigh, Thalt}, fan_off, fan_max */
- {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* Battery */
- {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* Ambient */
- {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* Charger */
- {{0, C_TO_K(52), 0}, {0, 0, 0}, 0, 0}, /* DRAM */
- {{0, 0, 0}, {0, 0, 0}, 0, 0}, /* eMMC */
- {{0, 0, 0}, {0, 0, 0}, 0, 0} /* Gyro */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* Battery */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* Ambient */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* Charger */
+ { { 0, C_TO_K(52), 0 }, { 0, 0, 0 }, 0, 0 }, /* DRAM */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 }, /* eMMC */
+ { { 0, 0, 0 }, { 0, 0, 0 }, 0, 0 } /* Gyro */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
/*
* Check if PMIC fault registers indicate VR fault. If yes, print out fault
* register info to console. Additionally, set panic reason so that the OS can
@@ -655,8 +641,8 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
- != EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault) !=
+ EC_SUCCESS)
return;
if (!(vrfault & BIT(4)))
@@ -709,8 +695,7 @@ void board_set_tcpc_power_mode(int port, int mode)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int rv;
int old_port;
@@ -775,8 +760,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index 2a21392313..279016ec98 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,14 +12,14 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* NPCX7 config */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
-#define NPCX_TACH_SEL2 0 /* No tach. */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX_TACH_SEL2 0 /* No tach. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
#define CONFIG_HIBERNATE_PSL
/* Internal SPI flash on NPCX7 */
@@ -56,7 +56,7 @@
#define CONFIG_BATTERY_SMART
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_PRESENT_GPIO GPIO_BAT_PRESENT_L
-#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
/* Buttons / Switches */
#define CONFIG_BASE_ATTACHED_SWITCH
@@ -85,7 +85,7 @@
/* MKBP */
#define CONFIG_MKBP_EVENT
-#define CONFIG_MKBP_EVENT_WAKEUP_MASK (1<<EC_MKBP_EVENT_SWITCH)
+#define CONFIG_MKBP_EVENT_WAKEUP_MASK (1 << EC_MKBP_EVENT_SWITCH)
#define CONFIG_MKBP_INPUT_DEVICES
#define CONFIG_MKBP_USE_GPIO_AND_HOST_EVENT
@@ -104,8 +104,7 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
#define CONFIG_SYNC
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_BD99992GW
#define CONFIG_THERMISTOR_NCP15WB
@@ -160,9 +159,9 @@
#define CONFIG_USBC_VCONN_SWAP
/* Define typical operating power and max power. */
-#define PD_MAX_VOLTAGE_MV 20000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_POWER_MW 45000
+#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_POWER_MW 45000
#define PD_OPERATING_POWER_MW 15000
/* TODO(aaboagye): Verify these timings. */
@@ -170,52 +169,52 @@
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* I2C config */
-#define I2C_PORT_CHARGER I2C_PORT_POWER
-#define I2C_PORT_PMIC I2C_PORT_POWER
-#define I2C_PORT_POWER NPCX_I2C_PORT0_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT4_1
+#define I2C_PORT_CHARGER I2C_PORT_POWER
+#define I2C_PORT_PMIC I2C_PORT_POWER
+#define I2C_PORT_POWER NPCX_I2C_PORT0_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT4_1
#define I2C_PORT_ALS_GYRO NPCX_I2C_PORT5_0
-#define I2C_PORT_ACCEL I2C_PORT_ALS_GYRO
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
+#define I2C_PORT_ACCEL I2C_PORT_ALS_GYRO
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_THERMAL I2C_PORT_PMIC
#define GPIO_USB_C0_SCL GPIO_EC_I2C1_USB_C0_SCL
#define GPIO_USB_C0_SDA GPIO_EC_I2C1_USB_C0_SDA
#define GPIO_USB_C1_SCL GPIO_EC_I2C2_USB_C1_SCL
#define GPIO_USB_C1_SDA GPIO_EC_I2C2_USB_C1_SDA
-#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_MP2949_FLAGS 0x20
#define I2C_ADDR_BD99992_FLAGS 0x30
/*
* Remapping of schematic GPIO names to common GPIO names expected (hardcoded)
* in the EC code base.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
#define GPIO_ENABLE_BACKLIGHT GPIO_EC_BL_DISABLE_ODL
-#define GPIO_BAT_PRESENT_L GPIO_EC_BATT_PRES_L
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_L
-#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK_EC
-#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_IN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_BAT_PRESENT_L GPIO_EC_BATT_PRES_L
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_L
+#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK_EC
+#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_IN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
-#define GPIO_VOLUME_UP_L GPIO_H1_EC_VOL_UP_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_H1_EC_VOL_DOWN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_VOLUME_UP_L GPIO_H1_EC_VOL_UP_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_H1_EC_VOL_DOWN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
#define PORT_TO_HPD(port) ((port) ? GPIO_USB_C1_DP_HPD : GPIO_USB_C0_DP_HPD)
@@ -225,19 +224,15 @@
#include "registers.h"
/* ADC signal */
-enum adc_channel {
- ADC_BASE_ATTACH,
- ADC_BASE_DETACH,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_BASE_ATTACH, ADC_BASE_DETACH, ADC_CH_COUNT };
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
- TEMP_SENSOR_GYRO, /* BMI160 */
+ TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
+ TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
+ TEMP_SENSOR_GYRO, /* BMI160 */
TEMP_SENSOR_COUNT
};
diff --git a/board/nocturne/build.mk b/board/nocturne/build.mk
index 1c2e1e04f2..3a43716534 100644
--- a/board/nocturne/build.mk
+++ b/board/nocturne/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nocturne/ec.tasklist b/board/nocturne/ec.tasklist
index 4fb7a035a9..5c7988f1d6 100644
--- a/board/nocturne/ec.tasklist
+++ b/board/nocturne/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne/gpio.inc b/board/nocturne/gpio.inc
index 75d2275424..e820bca8f0 100644
--- a/board/nocturne/gpio.inc
+++ b/board/nocturne/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne/led.c b/board/nocturne/led.c
index b214a8df84..ba3320cd22 100644
--- a/board/nocturne/led.c
+++ b/board/nocturne/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,35 +19,35 @@ const enum ec_led_id supported_led_ids[] = {
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map_v3[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 36, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 15, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 36, 15, 0 },
- [EC_LED_COLOR_WHITE] = { 30, 9, 15 },
- [EC_LED_COLOR_AMBER] = { 30, 1, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 36, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 15, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ [EC_LED_COLOR_YELLOW] = { 36, 15, 0 },
+ [EC_LED_COLOR_WHITE] = { 30, 9, 15 },
+ [EC_LED_COLOR_AMBER] = { 30, 1, 0 },
};
/* Map for board rev 2 */
struct pwm_led_color_map led_color_map_v2[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 62, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 31, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 100, 54, 0 },
- [EC_LED_COLOR_WHITE] = { 70, 54, 100 },
- [EC_LED_COLOR_AMBER] = { 100, 15, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 62, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 31, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ [EC_LED_COLOR_YELLOW] = { 100, 54, 0 },
+ [EC_LED_COLOR_WHITE] = { 70, 54, 100 },
+ [EC_LED_COLOR_AMBER] = { 100, 15, 0 },
};
/* Map for board rev 0 and 1 */
struct pwm_led_color_map led_color_map_v0_1[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 1, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 1, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 1 },
- [EC_LED_COLOR_YELLOW] = { 1, 1, 0 },
- [EC_LED_COLOR_WHITE] = { 9, 15, 15 },
- [EC_LED_COLOR_AMBER] = { 15, 1, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 1, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 1, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 1 },
+ [EC_LED_COLOR_YELLOW] = { 1, 1, 0 },
+ [EC_LED_COLOR_WHITE] = { 9, 15, 15 },
+ [EC_LED_COLOR_AMBER] = { 15, 1, 0 },
};
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = { { 0 } };
@@ -135,4 +135,4 @@ static void select_color_map(void)
break;
}
}
-DECLARE_HOOK(HOOK_INIT, select_color_map, HOOK_PRIO_INIT_PWM-1);
+DECLARE_HOOK(HOOK_INIT, select_color_map, HOOK_PRIO_INIT_PWM - 1);
diff --git a/board/nocturne/usb_pd_policy.c b/board/nocturne/usb_pd_policy.c
index 14329b61b3..5f1e5af365 100644
--- a/board/nocturne/usb_pd_policy.c
+++ b/board/nocturne/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,8 +16,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -25,8 +25,7 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_EN_5V);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
int level;
@@ -96,9 +95,8 @@ int pd_set_power_supply_ready(int port)
__override void svdm_safe_dp_mode(int port)
{
/* make DP interface safe until configure */
- usb_mux_set(port, USB_PD_MUX_NONE,
- USB_SWITCH_CONNECT,
- polarity_rm_dts(pd_get_polarity(port)));
+ usb_mux_set(port, USB_PD_MUX_NONE, USB_SWITCH_CONNECT,
+ polarity_rm_dts(pd_get_polarity(port)));
/*
* Isolate the SBU lines.
diff --git a/board/nocturne_fp/board.h b/board/nocturne_fp/board.h
index 704c5a0565..e7d34445b0 100644
--- a/board/nocturne_fp/board.h
+++ b/board/nocturne_fp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -51,28 +51,28 @@
#undef CONFIG_WP_STORAGE_OFF
#undef CONFIG_WP_STORAGE_SIZE
-#define CONFIG_SHAREDLIB_SIZE 0
+#define CONFIG_SHAREDLIB_SIZE 0
-#define CONFIG_RO_MEM_OFF 0
-#define CONFIG_RO_STORAGE_OFF 0
-#define CONFIG_RO_SIZE (768*1024)
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_STORAGE_OFF 0
+#define CONFIG_RO_SIZE (768 * 1024)
/* EC rollback protection block */
#define CONFIG_ROLLBACK_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
#define CONFIG_ROLLBACK_SIZE (CONFIG_FLASH_BANK_SIZE * 2)
-#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
-#define CONFIG_RW_STORAGE_OFF 0
-#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - \
- (CONFIG_RW_MEM_OFF - CONFIG_RO_MEM_OFF))
+#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
+#define CONFIG_RW_STORAGE_OFF 0
+#define CONFIG_RW_SIZE \
+ (CONFIG_FLASH_SIZE_BYTES - (CONFIG_RW_MEM_OFF - CONFIG_RO_MEM_OFF))
-#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
-#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
-#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
-#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
+#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
+#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
+#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
-#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
-#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
+#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
+#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
/*
* We want to prevent flash readout, and use it as indicator of protection
@@ -106,7 +106,7 @@
#undef CONFIG_LID_SWITCH
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
-#define CONFIG_PRINTF_LEGACY_LI_FORMAT
+#define CONFIG_PRINTF_LONG_IS_32BITS
#define CONFIG_SHA256
#define CONFIG_SHA256_UNROLLED
#define CONFIG_SPI
@@ -155,7 +155,7 @@
/* SPI configuration for the fingerprint sensor */
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FP_PORT 2 /* SPI4: third master config */
+#define CONFIG_SPI_FP_PORT 2 /* SPI4: third master config */
#define CONFIG_FINGERPRINT_MCU
#ifdef SECTION_IS_RW
@@ -168,7 +168,7 @@
*/
#define CONFIG_MALLOC
/* Special memory regions to store large arrays */
-#define FP_FRAME_SECTION __SECTION(ahb4)
+#define FP_FRAME_SECTION __SECTION(ahb4)
#define FP_TEMPLATE_SECTION __SECTION(ahb)
#else /* SECTION_IS_RO */
diff --git a/board/nocturne_fp/board_ro.c b/board/nocturne_fp/board_ro.c
index 7f20002435..f215cd91cf 100644
--- a/board/nocturne_fp/board_ro.c
+++ b/board/nocturne_fp/board_ro.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,7 +15,6 @@
#error "This file should only be built for RO."
#endif
-
/**
* Disable restricted commands when the system is locked.
*
diff --git a/board/nocturne_fp/board_rw.c b/board/nocturne_fp/board_rw.c
index abc6bf88d8..fd5899c799 100644
--- a/board/nocturne_fp/board_rw.c
+++ b/board/nocturne_fp/board_rw.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/board_rw.h b/board/nocturne_fp/board_rw.h
index 6ef7cc29b4..1687da3737 100644
--- a/board/nocturne_fp/board_rw.h
+++ b/board/nocturne_fp/board_rw.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/build.mk b/board/nocturne_fp/build.mk
index cc985141d1..55f6f95b4b 100644
--- a/board/nocturne_fp/build.mk
+++ b/board/nocturne_fp/build.mk
@@ -1,4 +1,4 @@
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -31,6 +31,7 @@ test-list-y=\
compile_time_macros \
cortexm_fpu \
crc \
+ debug \
flash_physical \
flash_write_protect \
fpsensor \
@@ -49,6 +50,7 @@ test-list-y=\
sha256 \
sha256_unrolled \
static_if \
+ stdlib \
system_is_locked \
timer_dos \
utils \
diff --git a/board/nocturne_fp/ec.tasklist b/board/nocturne_fp/ec.tasklist
index ed1e6ed294..2a4771fa98 100644
--- a/board/nocturne_fp/ec.tasklist
+++ b/board/nocturne_fp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/fpsensor_detect.c b/board/nocturne_fp/fpsensor_detect.c
index 5a4b95e64c..2541aa3c68 100644
--- a/board/nocturne_fp/fpsensor_detect.c
+++ b/board/nocturne_fp/fpsensor_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/fpsensor_detect_rw.c b/board/nocturne_fp/fpsensor_detect_rw.c
index e4a670e211..d26927c187 100644
--- a/board/nocturne_fp/fpsensor_detect_rw.c
+++ b/board/nocturne_fp/fpsensor_detect_rw.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/gpio.inc b/board/nocturne_fp/gpio.inc
index dc15ab0ef0..b0e1c3a80b 100644
--- a/board/nocturne_fp/gpio.inc
+++ b/board/nocturne_fp/gpio.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/gpio_rw.inc b/board/nocturne_fp/gpio_rw.inc
index 2de4c3e92a..9ee3af139f 100644
--- a/board/nocturne_fp/gpio_rw.inc
+++ b/board/nocturne_fp/gpio_rw.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nocturne_fp/ro_workarounds.c b/board/nocturne_fp/ro_workarounds.c
index e6417ddc08..11f025fd5b 100644
--- a/board/nocturne_fp/ro_workarounds.c
+++ b/board/nocturne_fp/ro_workarounds.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,7 @@
#include "watchdog.h"
/* Console output macros */
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/*
* We only patch RW to ensure that future ROs have correct behavior.
@@ -30,7 +30,7 @@
* Add in ap-off flag to be able to detect on next boot.
* No other code in this build uses this ap-off reset flag.
*/
-#define FORGE_PORFLAG_FLAGS (EC_RESET_FLAG_POWER_ON|EC_RESET_FLAG_AP_OFF)
+#define FORGE_PORFLAG_FLAGS (EC_RESET_FLAG_POWER_ON | EC_RESET_FLAG_AP_OFF)
static void wp_change_deferred(void)
{
@@ -75,8 +75,7 @@ void wp_event(enum gpio_signal signal)
* This function is also called from system_reset to set the final save
* reset flags, before an actual planned reset.
*/
-__override
-void bkpdata_write_reset_flags(uint32_t save_flags)
+__override void bkpdata_write_reset_flags(uint32_t save_flags)
{
/* Preserve flags in case a reset pulse occurs */
if (!gpio_get_level(GPIO_WP))
diff --git a/board/npcx7_evb/board.c b/board/npcx7_evb/board.c
index 7909668d2c..c78a30f3de 100644
--- a/board/npcx7_evb/board.c
+++ b/board/npcx7_evb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,18 +36,23 @@
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_CH_0] = {"ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_1] = {"ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_2] = {"ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_3] = {"ADC3", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_4] = {"ADC4", NPCX_ADC_CH4, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_CH_0] = { "ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_1] = { "ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_2] = { "ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_3] = { "ADC3", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_4] = { "ADC4", NPCX_ADC_CH4, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000 },
[PWM_CH_KBLIGHT] = { 2, 0, 10000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -56,7 +61,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = 0, /* Use MFT id to control fan */
+ .ch = 0, /* Use MFT id to control fan */
.pgood_gpio = GPIO_PGOOD_FAN,
.enable_gpio = -1,
};
@@ -75,55 +80,45 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master0-0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL0,
- .sda = GPIO_I2C0_SDA0
- },
- {
- .name = "master1-0",
- .port = NPCX_I2C_PORT1_0,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL0,
- .sda = GPIO_I2C1_SDA0
- },
- {
- .name = "master2-0",
- .port = NPCX_I2C_PORT2_0,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL0,
- .sda = GPIO_I2C2_SDA0
- },
- {
- .name = "master3-0",
- .port = NPCX_I2C_PORT3_0,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL0,
- .sda = GPIO_I2C3_SDA0
- },
- {
- .name = "master7-0",
- .port = NPCX_I2C_PORT7_0,
- .kbps = 100,
- .scl = GPIO_I2C7_SCL0,
- .sda = GPIO_I2C7_SDA0
- },
+ { .name = "master0-0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL0,
+ .sda = GPIO_I2C0_SDA0 },
+ { .name = "master1-0",
+ .port = NPCX_I2C_PORT1_0,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL0,
+ .sda = GPIO_I2C1_SDA0 },
+ { .name = "master2-0",
+ .port = NPCX_I2C_PORT2_0,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL0,
+ .sda = GPIO_I2C2_SDA0 },
+ { .name = "master3-0",
+ .port = NPCX_I2C_PORT3_0,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL0,
+ .sda = GPIO_I2C3_SDA0 },
+ { .name = "master7-0",
+ .port = NPCX_I2C_PORT7_0,
+ .kbps = 100,
+ .scl = GPIO_I2C7_SCL0,
+ .sda = GPIO_I2C7_SDA0 },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/******************************************************************************/
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS_L},
+ { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS_L },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
diff --git a/board/npcx7_evb/board.h b/board/npcx7_evb/board.h
index ab8b850d94..8a7b0246e9 100644
--- a/board/npcx7_evb/board.h
+++ b/board/npcx7_evb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,11 +15,11 @@
* npcx7m6f/npcx7m6fb/npcx7m6fc/npcx7m7fc/npcx7m7wb/npcx7m7wc
*/
#if defined(CHIP_VARIANT_NPCX7M6G)
-#define BOARD_VERSION 1
-#elif defined(CHIP_VARIANT_NPCX7M6F) || defined(CHIP_VARIANT_NPCX7M6FB) || \
+#define BOARD_VERSION 1
+#elif defined(CHIP_VARIANT_NPCX7M6F) || defined(CHIP_VARIANT_NPCX7M6FB) || \
defined(CHIP_VARIANT_NPCX7M6FC) || defined(CHIP_VARIANT_NPCX7M7FC) || \
defined(CHIP_VARIANT_NPCX7M7WB) || defined(CHIP_VARIANT_NPCX7M7WC)
-#define BOARD_VERSION 2
+#define BOARD_VERSION 2
#endif
/* EC modules */
@@ -29,8 +29,8 @@
#define CONFIG_I2C
/* Features of eSPI */
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
/* Optional features */
#define CONFIG_ENABLE_JTAG_SELECTION
@@ -39,9 +39,9 @@
#define CONFIG_I2C_CONTROLLER
#define CONFIG_KEYBOARD_PROTOCOL_8042
-#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
+#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
#define CONFIG_POWER_BUTTON
-#undef CONFIG_PSTORE
+#undef CONFIG_PSTORE
#define CONFIG_PWM_KBLIGHT
#define CONFIG_VBOOT_HASH
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */
@@ -57,7 +57,7 @@
/* I2C port for CONFIG_CMD_I2CWEDGE */
#define I2C_PORT_MASTER NPCX_I2C_PORT0_0
-#define I2C_PORT_HOST 0
+#define I2C_PORT_HOST 0
/* Fans for testing */
#define CONFIG_FANS 1
@@ -95,20 +95,20 @@
/* Select which UART Controller is the Console UART */
#undef CONFIG_CONSOLE_UART
-#define CONFIG_CONSOLE_UART 0 /* 0:UART1 1:UART2 */
+#define CONFIG_CONSOLE_UART 0 /* 0:UART1 1:UART2 */
/*
* This definition below actually doesn't define which UART controller to be
* used. Instead, it defines which pinouts (GPIO10/11 or GPIO64/65) are
* connected to "UART1" controller.
*/
#if (BOARD_VERSION == 2)
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART1 */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART1 */
#else
-#define NPCX_UART_MODULE2 0 /* 0:GPIO10/11 as UART1 */
+#define NPCX_UART_MODULE2 0 /* 0:GPIO10/11 as UART1 */
#endif
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
-#define NPCX7_PWM1_SEL 0 /* 0:GPIOC2 as I2CSCL0 1:as PWM1 (only in npcx7) */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX7_PWM1_SEL 0 /* 0:GPIOC2 as I2CSCL0 1:as PWM1 (only in npcx7) */
#ifndef __ASSEMBLER__
diff --git a/board/npcx7_evb/build.mk b/board/npcx7_evb/build.mk
index 4bd829202c..e51c3bdc5c 100644
--- a/board/npcx7_evb/build.mk
+++ b/board/npcx7_evb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/npcx7_evb/ec.tasklist b/board/npcx7_evb/ec.tasklist
index 88b5ffaa62..24e3b42d7c 100644
--- a/board/npcx7_evb/ec.tasklist
+++ b/board/npcx7_evb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx7_evb/gpio.inc b/board/npcx7_evb/gpio.inc
index 145a48de85..b8cfa1d8d5 100644
--- a/board/npcx7_evb/gpio.inc
+++ b/board/npcx7_evb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx9_evb/board.c b/board/npcx9_evb/board.c
index b412fe8b30..d0c90ee9b1 100644
--- a/board/npcx9_evb/board.c
+++ b/board/npcx9_evb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,25 +36,37 @@
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_CH_0] = {"ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_1] = {"ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_2] = {"ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_3] = {"ADC3", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_4] = {"ADC4", NPCX_ADC_CH4, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_5] = {"ADC5", NPCX_ADC_CH5, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_6] = {"ADC6", NPCX_ADC_CH6, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_7] = {"ADC7", NPCX_ADC_CH7, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_8] = {"ADC8", NPCX_ADC_CH8, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_9] = {"ADC9", NPCX_ADC_CH9, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_10] = {"ADC10", NPCX_ADC_CH10, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_11] = {"ADC11", NPCX_ADC_CH11, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_CH_0] = { "ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_1] = { "ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_2] = { "ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_3] = { "ADC3", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_4] = { "ADC4", NPCX_ADC_CH4, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_5] = { "ADC5", NPCX_ADC_CH5, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_6] = { "ADC6", NPCX_ADC_CH6, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_7] = { "ADC7", NPCX_ADC_CH7, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_8] = { "ADC8", NPCX_ADC_CH8, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_9] = { "ADC9", NPCX_ADC_CH9, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_10] = { "ADC10", NPCX_ADC_CH10, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_11] = { "ADC11", NPCX_ADC_CH11, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000 },
[PWM_CH_KBLIGHT] = { 2, 0, 10000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -63,7 +75,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = 0, /* Use MFT id to control fan */
+ .ch = 0, /* Use MFT id to control fan */
.pgood_gpio = GPIO_PGOOD_FAN,
.enable_gpio = -1,
};
@@ -96,48 +108,38 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master0-0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL0,
- .sda = GPIO_I2C0_SDA0
- },
- {
- .name = "master1-0",
- .port = NPCX_I2C_PORT1_0,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL0,
- .sda = GPIO_I2C1_SDA0
- },
- {
- .name = "master2-0",
- .port = NPCX_I2C_PORT2_0,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL0,
- .sda = GPIO_I2C2_SDA0
- },
- {
- .name = "master3-0",
- .port = NPCX_I2C_PORT3_0,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL0,
- .sda = GPIO_I2C3_SDA0
- },
- {
- .name = "master7-0",
- .port = NPCX_I2C_PORT7_0,
- .kbps = 100,
- .scl = GPIO_I2C7_SCL0,
- .sda = GPIO_I2C7_SDA0
- },
+ { .name = "master0-0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL0,
+ .sda = GPIO_I2C0_SDA0 },
+ { .name = "master1-0",
+ .port = NPCX_I2C_PORT1_0,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL0,
+ .sda = GPIO_I2C1_SDA0 },
+ { .name = "master2-0",
+ .port = NPCX_I2C_PORT2_0,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL0,
+ .sda = GPIO_I2C2_SDA0 },
+ { .name = "master3-0",
+ .port = NPCX_I2C_PORT3_0,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL0,
+ .sda = GPIO_I2C3_SDA0 },
+ { .name = "master7-0",
+ .port = NPCX_I2C_PORT7_0,
+ .kbps = 100,
+ .scl = GPIO_I2C7_SCL0,
+ .sda = GPIO_I2C7_SDA0 },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/npcx9_evb/board.h b/board/npcx9_evb/board.h
index a0d209c938..681e36157a 100644
--- a/board/npcx9_evb/board.h
+++ b/board/npcx9_evb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,8 +14,8 @@
#define CONFIG_I2C
/* Features of eSPI */
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
/* Optional features */
#define CONFIG_ENABLE_JTAG_SELECTION
@@ -25,9 +25,9 @@
#define CONFIG_I2C_CONTROLLER
#define CONFIG_KEYBOARD_PROTOCOL_8042
-#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
+#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
#define CONFIG_POWER_BUTTON
-#undef CONFIG_PSTORE
+#undef CONFIG_PSTORE
#define CONFIG_PWM_KBLIGHT
#define CONFIG_VBOOT_HASH
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */
@@ -43,14 +43,14 @@
/* I2C port for CONFIG_CMD_I2CWEDGE */
#define I2C_PORT_MASTER NPCX_I2C_PORT0_0
-#define I2C_PORT_HOST 0
+#define I2C_PORT_HOST 0
/* Fans for testing */
#define CONFIG_FANS 1
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_TMP112
-#define I2C_PORT_THERMAL NPCX_I2C_PORT2_0
+#define I2C_PORT_THERMAL NPCX_I2C_PORT2_0
#define CONFIG_KEYBOARD_KSO_HIGH_DRIVE /* Quasi-bidirectional buf for KSOs */
#define CONFIG_HIBERNATE_PSL /* Use PSL (Power Switch Logic) for hibernate */
@@ -60,15 +60,15 @@
/* Select which UART Controller is the Console UART */
#undef CONFIG_CONSOLE_UART
-#define CONFIG_CONSOLE_UART 0 /* 0:UART1 1:UART2 */
+#define CONFIG_CONSOLE_UART 0 /* 0:UART1 1:UART2 */
/*
* This definition below actually doesn't define which UART controller to be
* used. Instead, it defines which pinouts (GPIO10/11 or GPIO64/65) are
* connected to "UART1" controller.
*/
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART1 */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
-#define NPCX9_PWM1_SEL 0 /* 0:GPIOC2 as I2CSCL0 1:as PWM1 */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART1 */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX9_PWM1_SEL 0 /* 0:GPIOC2 as I2CSCL0 1:as PWM1 */
#ifndef __ASSEMBLER__
@@ -94,7 +94,7 @@ enum tmp112_sensor {
};
enum temp_sensor_id {
- TEMP_SENSOR_SYSTHERM0, /* TMP100 */
+ TEMP_SENSOR_SYSTHERM0, /* TMP100 */
TEMP_SENSOR_COUNT
};
diff --git a/board/npcx9_evb/build.mk b/board/npcx9_evb/build.mk
index 92bcc84144..d2526afb1b 100644
--- a/board/npcx9_evb/build.mk
+++ b/board/npcx9_evb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/npcx9_evb/ec.tasklist b/board/npcx9_evb/ec.tasklist
index 9560b43561..d41f0ade2f 100644
--- a/board/npcx9_evb/ec.tasklist
+++ b/board/npcx9_evb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx9_evb/gpio.inc b/board/npcx9_evb/gpio.inc
index ec57c1afc5..28dbbba93a 100644
--- a/board/npcx9_evb/gpio.inc
+++ b/board/npcx9_evb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx_evb/board.c b/board/npcx_evb/board.c
index ee448bbbd2..06ab55f94a 100644
--- a/board/npcx_evb/board.c
+++ b/board/npcx_evb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,16 +35,19 @@
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_CH_0] = {"ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_1] = {"ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_2] = {"ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_CH_0] = { "ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_1] = { "ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_2] = { "ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000 },
#if (CONFIG_FANS == 2)
[PWM_CH_FAN2] = { 2, 0, 25000 },
#endif
@@ -56,14 +59,14 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = 0, /* Use MFT id to control fan */
+ .ch = 0, /* Use MFT id to control fan */
.pgood_gpio = GPIO_PGOOD_FAN,
.enable_gpio = -1,
};
const struct fan_conf fan_conf_1 = {
.flags = FAN_USE_RPM_MODE,
- .ch = 1, /* Use MFT id to control fan */
+ .ch = 1, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -91,9 +94,9 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
#if (CONFIG_FANS == 2)
- [MFT_CH_1] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2},
+ [MFT_CH_1] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN2 },
#endif
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -101,48 +104,38 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master0-0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL0,
- .sda = GPIO_I2C0_SDA0
- },
- {
- .name = "master0-1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL1,
- .sda = GPIO_I2C0_SDA1
- },
- {
- .name = "master1",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "master2",
- .port = NPCX_I2C_PORT2,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "master3",
- .port = NPCX_I2C_PORT3,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+ { .name = "master0-0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL0,
+ .sda = GPIO_I2C0_SDA0 },
+ { .name = "master0-1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL1,
+ .sda = GPIO_I2C0_SDA1 },
+ { .name = "master1",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "master2",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "master3",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/******************************************************************************/
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS_L},
+ { CONFIG_SPI_FLASH_PORT, 0, GPIO_SPI_CS_L },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
diff --git a/board/npcx_evb/board.h b/board/npcx_evb/board.h
index 5a22435396..82675ee9d8 100644
--- a/board/npcx_evb/board.h
+++ b/board/npcx_evb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,7 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
#define CONFIG_SPI_FLASH_PORT 0
#define CONFIG_SPI_FLASH
-#define CONFIG_FLASH_SIZE_BYTES 0x00800000 /* 8MB spi flash */
+#define CONFIG_FLASH_SIZE_BYTES 0x00800000 /* 8MB spi flash */
#define CONFIG_SPI_FLASH_REGS
#define CONFIG_SPI_FLASH_W25Q64
#define CONFIG_I2C
@@ -41,29 +41,24 @@
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_I2CWEDGE
-#define CONFIG_FANS 1
+#define CONFIG_FANS 1
/* Optional feature - used by nuvoton */
-#define NPCX_UART_MODULE2 0 /* 0:GPIO10/11 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_UART_MODULE2 0 /* 0:GPIO10/11 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* Optional for testing */
-#undef CONFIG_PSTORE
-#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
+#undef CONFIG_PSTORE
+#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
/* Single I2C port, where the EC is the master. */
-#define I2C_PORT_MASTER NPCX_I2C_PORT0_0
-#define I2C_PORT_HOST 0
+#define I2C_PORT_MASTER NPCX_I2C_PORT0_0
+#define I2C_PORT_HOST 0
#ifndef __ASSEMBLER__
-enum adc_channel {
- ADC_CH_0 = 0,
- ADC_CH_1,
- ADC_CH_2,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_CH_0 = 0, ADC_CH_1, ADC_CH_2, ADC_CH_COUNT };
enum pwm_channel {
PWM_CH_FAN,
diff --git a/board/npcx_evb/build.mk b/board/npcx_evb/build.mk
index 7dfc4544f2..c86457489f 100644
--- a/board/npcx_evb/build.mk
+++ b/board/npcx_evb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/npcx_evb/ec.tasklist b/board/npcx_evb/ec.tasklist
index b0d584174e..82d4d031a2 100644
--- a/board/npcx_evb/ec.tasklist
+++ b/board/npcx_evb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx_evb/gpio.inc b/board/npcx_evb/gpio.inc
index c4e673fd25..584cbfd9b2 100644
--- a/board/npcx_evb/gpio.inc
+++ b/board/npcx_evb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx_evb_arm/board.c b/board/npcx_evb_arm/board.c
index abb6e2279b..209bf047e2 100644
--- a/board/npcx_evb_arm/board.c
+++ b/board/npcx_evb_arm/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,16 +35,19 @@
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_CH_0] = {"ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_1] = {"ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_CH_2] = {"ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_CH_0] = { "ADC0", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_1] = { "ADC1", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
+ [ADC_CH_2] = { "ADC2", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX + 1,
+ 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000},
+ [PWM_CH_FAN] = { 0, PWM_CONFIG_OPEN_DRAIN, 25000 },
[PWM_CH_KBLIGHT] = { 1, 0, 10000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -53,7 +56,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = 0, /* Use MFT id to control fan */
+ .ch = 0, /* Use MFT id to control fan */
.pgood_gpio = GPIO_PGOOD_FAN,
.enable_gpio = -1,
};
@@ -72,48 +75,38 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master0-0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL0,
- .sda = GPIO_I2C0_SDA0
- },
- {
- .name = "master0-1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL1,
- .sda = GPIO_I2C0_SDA1
- },
- {
- .name = "master1",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "master2",
- .port = NPCX_I2C_PORT2,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "master3",
- .port = NPCX_I2C_PORT3,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+ { .name = "master0-0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL0,
+ .sda = GPIO_I2C0_SDA0 },
+ { .name = "master0-1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL1,
+ .sda = GPIO_I2C0_SDA1 },
+ { .name = "master1",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "master2",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "master3",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/npcx_evb_arm/board.h b/board/npcx_evb_arm/board.h
index a56cec9783..f342d5c37f 100644
--- a/board/npcx_evb_arm/board.h
+++ b/board/npcx_evb_arm/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,13 +15,14 @@
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
-#define CONFIG_FLASH_SIZE_BYTES 0x00800000 /* 8MB spi flash */
+#define CONFIG_FLASH_SIZE_BYTES 0x00800000 /* 8MB spi flash */
#define CONFIG_SPI_FLASH_REGS
#define CONFIG_SPI_FLASH_W25Q64
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define CONFIG_KEYBOARD_PROTOCOL_MKBP /* Instead of 8042 protocol of keyboard */
+#define CONFIG_KEYBOARD_PROTOCOL_MKBP /* Instead of 8042 protocol of keyboard \
+ */
#define CONFIG_MKBP_USE_GPIO
#define CONFIG_POWER_BUTTON
#define CONFIG_VBOOT_HASH
@@ -38,34 +39,29 @@
#define CONFIG_CMD_SCRATCHPAD
#define CONFIG_CMD_I2CWEDGE
-#define CONFIG_UART_HOST 0
-#define CONFIG_FANS 1
+#define CONFIG_UART_HOST 0
+#define CONFIG_FANS 1
/* Optional feature - used by nuvoton */
-#define NPCX_UART_MODULE2 0 /* 0:GPIO10/11 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_UART_MODULE2 0 /* 0:GPIO10/11 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* Enable SHI PU on transition to S0. Disable the PU otherwise for leakage. */
#define NPCX_SHI_CS_PU
/* Enable bypass since shi outputs invalid data when across 256B boundary */
#define NPCX_SHI_BYPASS_OVER_256B
/* Optional for testing */
-#undef CONFIG_PSTORE
-#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
+#undef CONFIG_PSTORE
+#undef CONFIG_LOW_POWER_IDLE /* Deep Sleep Support */
/* Single I2C port, where the EC is the master. */
-#define I2C_PORT_MASTER NPCX_I2C_PORT0_0
-#define I2C_PORT_HOST 0
+#define I2C_PORT_MASTER NPCX_I2C_PORT0_0
+#define I2C_PORT_HOST 0
#ifndef __ASSEMBLER__
-enum adc_channel {
- ADC_CH_0 = 0,
- ADC_CH_1,
- ADC_CH_2,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_CH_0 = 0, ADC_CH_1, ADC_CH_2, ADC_CH_COUNT };
enum pwm_channel {
PWM_CH_FAN,
diff --git a/board/npcx_evb_arm/build.mk b/board/npcx_evb_arm/build.mk
index 48116c5454..e1a3762504 100644
--- a/board/npcx_evb_arm/build.mk
+++ b/board/npcx_evb_arm/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/npcx_evb_arm/ec.tasklist b/board/npcx_evb_arm/ec.tasklist
index a014b86350..078059e9d8 100644
--- a/board/npcx_evb_arm/ec.tasklist
+++ b/board/npcx_evb_arm/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/npcx_evb_arm/gpio.inc b/board/npcx_evb_arm/gpio.inc
index 1cdda98300..dc94a8ac7b 100644
--- a/board/npcx_evb_arm/gpio.inc
+++ b/board/npcx_evb_arm/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2015 The Chromium OS Authors. All rights reserved.
+ * Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-dartmonkey/board.c b/board/nucleo-dartmonkey/board.c
index ea0d11eaf5..1cd6ef5dee 100644
--- a/board/nucleo-dartmonkey/board.c
+++ b/board/nucleo-dartmonkey/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -38,8 +38,8 @@ static void ap_deferred(void)
* in S0: SLP_ALT_L is 1 and SLP_L is 1.
* in S5/G3, the FP MCU should not be running.
*/
- int running = gpio_get_level(GPIO_SLP_ALT_L)
- && gpio_get_level(GPIO_SLP_L);
+ int running = gpio_get_level(GPIO_SLP_ALT_L) &&
+ gpio_get_level(GPIO_SLP_L);
if (running) { /* S0 */
disable_sleep(SLEEP_MASK_AP_RUN);
@@ -92,7 +92,7 @@ static void board_init(void)
spi_configure();
ccprints("TRANSPORT_SEL: %s",
- fp_transport_type_to_str(get_fp_transport_type()));
+ fp_transport_type_to_str(get_fp_transport_type()));
/* Enable interrupt on PCH power signals */
gpio_enable_interrupt(GPIO_SLP_ALT_L);
diff --git a/board/nucleo-dartmonkey/board.h b/board/nucleo-dartmonkey/board.h
index 9e220db7dc..76e278b4ca 100644
--- a/board/nucleo-dartmonkey/board.h
+++ b/board/nucleo-dartmonkey/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,27 +33,27 @@
/* SPI configuration for the fingerprint sensor */
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FP_PORT 2 /* SPI4: third master config */
+#define CONFIG_SPI_FP_PORT 2 /* SPI4: third master config */
#define CONFIG_FINGERPRINT_MCU
#ifdef SECTION_IS_RW
- /* Select fingerprint sensor */
-# define CONFIG_FP_SENSOR_FPC1145
-# define CONFIG_CMD_FPSENSOR_DEBUG
- /* Special memory regions to store large arrays */
-# define FP_FRAME_SECTION __SECTION(ahb4)
-# define FP_TEMPLATE_SECTION __SECTION(ahb)
- /*
- * Use the malloc code only in the RW section (for the private library),
- * we cannot enable it in RO since it is not compatible with the RW
- * verification (shared_mem_init done too late).
- */
-# define CONFIG_MALLOC
+/* Select fingerprint sensor */
+#define CONFIG_FP_SENSOR_FPC1145
+#define CONFIG_CMD_FPSENSOR_DEBUG
+/* Special memory regions to store large arrays */
+#define FP_FRAME_SECTION __SECTION(ahb4)
+#define FP_TEMPLATE_SECTION __SECTION(ahb)
+/*
+ * Use the malloc code only in the RW section (for the private library),
+ * we cannot enable it in RO since it is not compatible with the RW
+ * verification (shared_mem_init done too late).
+ */
+#define CONFIG_MALLOC
#endif /* SECTION_IS_RW */
#ifndef __ASSEMBLER__
- void fps_event(enum gpio_signal signal);
+void fps_event(enum gpio_signal signal);
#endif /* !__ASSEMBLER__ */
#endif /* __BOARD_H */
diff --git a/board/nucleo-dartmonkey/build.mk b/board/nucleo-dartmonkey/build.mk
index 4bc677e7e0..8aa93b8fe5 100644
--- a/board/nucleo-dartmonkey/build.mk
+++ b/board/nucleo-dartmonkey/build.mk
@@ -1,4 +1,4 @@
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -15,6 +15,7 @@ test-list-y=\
cec \
compile_time_macros \
crc \
+ debug \
flash_physical \
flash_write_protect \
fpsensor \
@@ -32,6 +33,7 @@ test-list-y=\
sha256 \
sha256_unrolled \
static_if \
+ stdlib \
timer_dos \
utils \
utils_str \
diff --git a/board/nucleo-dartmonkey/ec.tasklist b/board/nucleo-dartmonkey/ec.tasklist
index 80e226637b..7f35361949 100644
--- a/board/nucleo-dartmonkey/ec.tasklist
+++ b/board/nucleo-dartmonkey/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-dartmonkey/fpsensor_detect.c b/board/nucleo-dartmonkey/fpsensor_detect.c
index 72b9b89e11..7a9c128211 100644
--- a/board/nucleo-dartmonkey/fpsensor_detect.c
+++ b/board/nucleo-dartmonkey/fpsensor_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-dartmonkey/gpio.inc b/board/nucleo-dartmonkey/gpio.inc
index 11709fe738..a9e5101855 100644
--- a/board/nucleo-dartmonkey/gpio.inc
+++ b/board/nucleo-dartmonkey/gpio.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-f072rb/board.c b/board/nucleo-f072rb/board.c
index 078af171cb..729589a702 100644
--- a/board/nucleo-f072rb/board.c
+++ b/board/nucleo-f072rb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,12 @@ void button_event(enum gpio_signal signal)
* Mock interrupt handler. It's supposed to be overwritten by each suite
* if needed.
*/
-__attribute__((weak)) void cts_irq1(enum gpio_signal signal) {}
-__attribute__((weak)) void cts_irq2(enum gpio_signal signal) {}
+__attribute__((weak)) void cts_irq1(enum gpio_signal signal)
+{
+}
+__attribute__((weak)) void cts_irq2(enum gpio_signal signal)
+{
+}
#endif
#include "gpio_list.h"
@@ -38,14 +42,12 @@ void tick_event(void)
DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
#ifdef CTS_MODULE_I2C
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "test",
- .port = STM32_I2C1_PORT,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "test",
+ .port = STM32_I2C1_PORT,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -57,6 +59,5 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
static void board_init(void)
{
gpio_enable_interrupt(GPIO_USER_BUTTON);
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/nucleo-f072rb/board.h b/board/nucleo-f072rb/board.h
index 0ec675ab61..d807209564 100644
--- a/board/nucleo-f072rb/board.h
+++ b/board/nucleo-f072rb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,7 +20,7 @@
#ifdef CTS_MODULE
#undef STM32_IRQ_EXT2_3_PRIORITY
-#define STM32_IRQ_EXT2_3_PRIORITY 2
+#define STM32_IRQ_EXT2_3_PRIORITY 2
#ifdef CTS_MODULE_I2C
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
diff --git a/board/nucleo-f072rb/build.mk b/board/nucleo-f072rb/build.mk
index 0e069a31ad..7ac70706fc 100644
--- a/board/nucleo-f072rb/build.mk
+++ b/board/nucleo-f072rb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nucleo-f072rb/ec.tasklist b/board/nucleo-f072rb/ec.tasklist
index a6385530b5..3ddec80f41 100644
--- a/board/nucleo-f072rb/ec.tasklist
+++ b/board/nucleo-f072rb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-f072rb/gpio.inc b/board/nucleo-f072rb/gpio.inc
index 6f3b592845..a14c7a5470 100644
--- a/board/nucleo-f072rb/gpio.inc
+++ b/board/nucleo-f072rb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-f072rb/openocd-flash.cfg b/board/nucleo-f072rb/openocd-flash.cfg
index 91e3805c74..f06b3c22a2 100644
--- a/board/nucleo-f072rb/openocd-flash.cfg
+++ b/board/nucleo-f072rb/openocd-flash.cfg
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/nucleo-f411re/board.c b/board/nucleo-f411re/board.c
index 96e7fefb69..0c77a64e71 100644
--- a/board/nucleo-f411re/board.c
+++ b/board/nucleo-f411re/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,22 +43,20 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Arduino connectors analog pins */
- [ADC1_0] = {"ADC1_0", 3000, 4096, 0, STM32_AIN(0)},
- [ADC1_1] = {"ADC1_1", 3000, 4096, 0, STM32_AIN(1)},
- [ADC1_4] = {"ADC1_4", 3000, 4096, 0, STM32_AIN(4)},
- [ADC1_8] = {"ADC1_8", 3000, 4096, 0, STM32_AIN(8)},
+ [ADC1_0] = { "ADC1_0", 3000, 4096, 0, STM32_AIN(0) },
+ [ADC1_1] = { "ADC1_1", 3000, 4096, 0, STM32_AIN(1) },
+ [ADC1_4] = { "ADC1_4", 3000, 4096, 0, STM32_AIN(4) },
+ [ADC1_8] = { "ADC1_8", 3000, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -117,13 +115,12 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#ifdef CONFIG_DMA_HELP
#include "dma.h"
-static int command_dma_help(int argc, char **argv)
+static int command_dma_help(int argc, const char **argv)
{
dma_dump(STM32_DMA2_STREAM0);
dma_test(STM32_DMA2_STREAM0);
dma_dump(STM32_DMA2_STREAM0);
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(dmahelp, command_dma_help,
- NULL, "Run DMA test");
+DECLARE_CONSOLE_COMMAND(dmahelp, command_dma_help, NULL, "Run DMA test");
#endif
diff --git a/board/nucleo-f411re/board.h b/board/nucleo-f411re/board.h
index 56d2ad41d0..d4e299dcff 100644
--- a/board/nucleo-f411re/board.h
+++ b/board/nucleo-f411re/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,6 @@
#define CPU_CLOCK 84000000
#define CONFIG_FLASH_WRITE_SIZE STM32_FLASH_WRITE_SIZE_3300
-
/* the UART console is on USART2 (PA2/PA3) */
#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 2
@@ -43,7 +42,7 @@
#define CONFIG_I2C_CONTROLLER
#define CONFIG_I2C_DEBUG
#define I2C_PORT_MASTER 1
-#define I2C_PORT_SLAVE 0 /* needed for DMAC macros (ugh) */
+#define I2C_PORT_SLAVE 0 /* needed for DMAC macros (ugh) */
#define I2C_PORT_ACCEL I2C_PORT_MASTER
#ifndef __ASSEMBLER__
diff --git a/board/nucleo-f411re/build.mk b/board/nucleo-f411re/build.mk
index 3a5fc28558..93a0a02ecc 100644
--- a/board/nucleo-f411re/build.mk
+++ b/board/nucleo-f411re/build.mk
@@ -1,4 +1,4 @@
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nucleo-f411re/ec.tasklist b/board/nucleo-f411re/ec.tasklist
index b5e3cb82b2..a9566a92aa 100644
--- a/board/nucleo-f411re/ec.tasklist
+++ b/board/nucleo-f411re/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-f411re/gpio.inc b/board/nucleo-f411re/gpio.inc
index 83a9e51a08..2fd98f2a4a 100644
--- a/board/nucleo-f411re/gpio.inc
+++ b/board/nucleo-f411re/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2015 The Chromium OS Authors. All rights reserved.
+ * Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-f411re/openocd-flash.cfg b/board/nucleo-f411re/openocd-flash.cfg
index 7a6ea6316c..23da86c6ba 100644
--- a/board/nucleo-f411re/openocd-flash.cfg
+++ b/board/nucleo-f411re/openocd-flash.cfg
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/nucleo-f412zg/board.c b/board/nucleo-f412zg/board.c
index da3b4a3d4d..9ab9bfa190 100644
--- a/board/nucleo-f412zg/board.c
+++ b/board/nucleo-f412zg/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,8 +31,8 @@ static void ap_deferred(void)
* in S0: SLP_S3_L is 1 and SLP_S0_L is 1.
* in S5/G3, the FP MCU should not be running.
*/
- int running = gpio_get_level(GPIO_PCH_SLP_S3_L)
- && gpio_get_level(GPIO_PCH_SLP_S0_L);
+ int running = gpio_get_level(GPIO_PCH_SLP_S3_L) &&
+ gpio_get_level(GPIO_PCH_SLP_S0_L);
if (running) { /* S0 */
disable_sleep(SLEEP_MASK_AP_RUN);
diff --git a/board/nucleo-f412zg/board.h b/board/nucleo-f412zg/board.h
index f6e1368847..7e3c8d976d 100644
--- a/board/nucleo-f412zg/board.h
+++ b/board/nucleo-f412zg/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,6 +26,6 @@
* Enable the blink example that exercises the LEDs.
*/
#define CONFIG_BLINK
-#define CONFIG_BLINK_LEDS GPIO_LED1, GPIO_LED2, GPIO_LED3
+#define CONFIG_BLINK_LEDS GPIO_LED1, GPIO_LED2, GPIO_LED3
#endif /* __BOARD_H */
diff --git a/board/nucleo-f412zg/build.mk b/board/nucleo-f412zg/build.mk
index 6d46b6c289..be4f65063b 100644
--- a/board/nucleo-f412zg/build.mk
+++ b/board/nucleo-f412zg/build.mk
@@ -1,4 +1,4 @@
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -14,6 +14,7 @@ test-list-y=\
cec \
compile_time_macros \
crc \
+ debug \
flash_physical \
flash_write_protect \
mpu \
@@ -29,6 +30,7 @@ test-list-y=\
sha256 \
sha256_unrolled \
static_if \
+ stdlib \
stm32f_rtc \
timer_dos \
utils \
diff --git a/board/nucleo-f412zg/ec.tasklist b/board/nucleo-f412zg/ec.tasklist
index 896eb2fdb3..04e21000f9 100644
--- a/board/nucleo-f412zg/ec.tasklist
+++ b/board/nucleo-f412zg/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-f412zg/gpio.inc b/board/nucleo-f412zg/gpio.inc
index 57f78203ba..6cc09a20df 100644
--- a/board/nucleo-f412zg/gpio.inc
+++ b/board/nucleo-f412zg/gpio.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-g431rb/board.c b/board/nucleo-g431rb/board.c
index 2daf157e22..ef73c00924 100644
--- a/board/nucleo-g431rb/board.c
+++ b/board/nucleo-g431rb/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,7 +11,6 @@
#include "gpio_list.h" /* Must come after other header files. */
-
static void board_init(void)
{
/*
diff --git a/board/nucleo-g431rb/board.h b/board/nucleo-g431rb/board.h
index a65daa4364..905b4ea110 100644
--- a/board/nucleo-g431rb/board.h
+++ b/board/nucleo-g431rb/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,14 +14,13 @@
#define CPU_CLOCK 48000000
#define CONFIG_STM_HWTIMER32
#define TIM_CLOCK32 2
-#define TIM_CLOCK_MSB 3
+#define TIM_CLOCK_MSB 3
#define TIM_CLOCK_LSB 15
#define TIM_WATCHDOG 7
/* Nucelo platform does not have a lid switch */
#undef CONFIG_LID_SWITCH
-
/* Setup UART console */
/*
* The STM32G431 Nucleo-64 has two UARTs which can be connected to the virtual
@@ -49,24 +48,20 @@
#define CONFIG_UART_TX_DMA_PH DMAMUX_REQ_USART1_TX
#endif
-
/*
* Macros for GPIO signals used in common code that don't match the
* schematic names. Signal names in gpio.inc match the schematic and are
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_WP_L GPIO_EC_WP_L
-
-
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_WP_L GPIO_EC_WP_L
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
-
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/nucleo-g431rb/build.mk b/board/nucleo-g431rb/build.mk
index 8140048cdd..a5a00675ee 100644
--- a/board/nucleo-g431rb/build.mk
+++ b/board/nucleo-g431rb/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nucleo-g431rb/ec.tasklist b/board/nucleo-g431rb/ec.tasklist
index c272906fc7..682e6d8290 100644
--- a/board/nucleo-g431rb/ec.tasklist
+++ b/board/nucleo-g431rb/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-g431rb/gpio.inc b/board/nucleo-g431rb/gpio.inc
index 4dd4a6d966..4c7507eff9 100644
--- a/board/nucleo-g431rb/gpio.inc
+++ b/board/nucleo-g431rb/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-h743zi/board.c b/board/nucleo-h743zi/board.c
index c69a456425..f63c362d5f 100644
--- a/board/nucleo-h743zi/board.c
+++ b/board/nucleo-h743zi/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,8 +31,8 @@ static void ap_deferred(void)
* in S0: SLP_S3_L is 1 and SLP_S0_L is 1.
* in S5/G3, the FP MCU should not be running.
*/
- int running = gpio_get_level(GPIO_PCH_SLP_S3_L)
- && gpio_get_level(GPIO_PCH_SLP_S0_L);
+ int running = gpio_get_level(GPIO_PCH_SLP_S3_L) &&
+ gpio_get_level(GPIO_PCH_SLP_S0_L);
if (running) { /* S0 */
disable_sleep(SLEEP_MASK_AP_RUN);
diff --git a/board/nucleo-h743zi/board.h b/board/nucleo-h743zi/board.h
index 966f2a8c94..81cdd60fc9 100644
--- a/board/nucleo-h743zi/board.h
+++ b/board/nucleo-h743zi/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,6 +28,6 @@
* Enable the blink example that exercises the LEDs.
*/
#define CONFIG_BLINK
-#define CONFIG_BLINK_LEDS GPIO_LED1, GPIO_LED2, GPIO_LED3
+#define CONFIG_BLINK_LEDS GPIO_LED1, GPIO_LED2, GPIO_LED3
#endif /* __BOARD_H */
diff --git a/board/nucleo-h743zi/build.mk b/board/nucleo-h743zi/build.mk
index 1230d9b334..0fb7975f32 100644
--- a/board/nucleo-h743zi/build.mk
+++ b/board/nucleo-h743zi/build.mk
@@ -1,4 +1,4 @@
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -14,6 +14,7 @@ test-list-y=\
cec \
compile_time_macros \
crc \
+ debug \
flash_physical \
flash_write_protect \
mpu \
@@ -29,6 +30,7 @@ test-list-y=\
sha256 \
sha256_unrolled \
static_if \
+ stdlib \
timer_dos \
utils \
utils_str \
diff --git a/board/nucleo-h743zi/ec.tasklist b/board/nucleo-h743zi/ec.tasklist
index 9c37e0b58b..ed124cd672 100644
--- a/board/nucleo-h743zi/ec.tasklist
+++ b/board/nucleo-h743zi/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nucleo-h743zi/gpio.inc b/board/nucleo-h743zi/gpio.inc
index 0f2bb32d75..a93133abd7 100644
--- a/board/nucleo-h743zi/gpio.inc
+++ b/board/nucleo-h743zi/gpio.inc
@@ -1,5 +1,5 @@
/*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nuwani/battery.c b/board/nuwani/battery.c
index 5cbbeb5123..e24b442049 100644
--- a/board/nuwani/battery.c
+++ b/board/nuwani/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/nuwani/board.c b/board/nuwani/board.c
index 567a26c8ef..eb36ad9df8 100644
--- a/board/nuwani/board.c
+++ b/board/nuwani/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,45 +29,35 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_POWER_BUTTON_L,
GPIO_EC_RST_ODL,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL_AP,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -80,19 +70,15 @@ static struct stprivate_data g_lis2dwl_data;
/* Base accel private data */
static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA;
-
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t lsm6dsm_base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lsm6dsm_base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0,
+ FLOAT_TO_FP(1) } };
-static const mat33_fp_t treeya_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t treeya_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t lid_accel_1 = {
.name = "Lid Accel",
@@ -159,8 +145,7 @@ struct motion_sensor_t base_gyro_1 = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &lsm6dsm_drv,
.mutex = &g_base_mutex_1,
- .drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
- MOTIONSENSE_TYPE_GYRO),
+ .drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data, MOTIONSENSE_TYPE_GYRO),
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -188,10 +173,12 @@ void board_update_sensor_config_from_sku(void)
motion_sensors[LID_ACCEL] = lid_accel_1;
motion_sensors[BASE_ACCEL] = base_accel_1;
motion_sensors[BASE_GYRO] = base_gyro_1;
- } else{
+ } else {
/*Need to change matrix for treeya*/
- motion_sensors[BASE_ACCEL].rot_standard_ref = &treeya_standard_ref;
- motion_sensors[BASE_GYRO].rot_standard_ref = &treeya_standard_ref;
+ motion_sensors[BASE_ACCEL].rot_standard_ref =
+ &treeya_standard_ref;
+ motion_sensors[BASE_GYRO].rot_standard_ref =
+ &treeya_standard_ref;
}
/* Enable Gyro interrupts */
@@ -201,8 +188,7 @@ void board_update_sensor_config_from_sku(void)
/* Device is clamshell only */
tablet_set_mode(0, TABLET_TRIGGER_LID);
/* Gyro is not present, don't allow line to float */
- gpio_set_flags(GPIO_6AXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_6AXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
}
diff --git a/board/nuwani/board.h b/board/nuwani/board.h
index 6bdffa73ac..b58102efe7 100644
--- a/board/nuwani/board.h
+++ b/board/nuwani/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -47,7 +47,7 @@
/*
* Slew rate on the PP1800_SENSOR load switch requires a short delay on startup.
*/
-#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
+#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
#define CONFIG_MOTION_SENSE_RESUME_DELAY_US (10 * MSEC)
/* Second set of sensor drivers */
@@ -58,7 +58,6 @@
#ifndef __ASSEMBLER__
-
enum battery_type {
BATTERY_SMP,
BATTERY_LGC,
diff --git a/board/nuwani/build.mk b/board/nuwani/build.mk
index 85b141b15d..c754c96237 100644
--- a/board/nuwani/build.mk
+++ b/board/nuwani/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/nuwani/ec.tasklist b/board/nuwani/ec.tasklist
index 2874dff927..c5db864fe5 100644
--- a/board/nuwani/ec.tasklist
+++ b/board/nuwani/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nuwani/gpio.inc b/board/nuwani/gpio.inc
index 18c72c8125..e01af85e34 100644
--- a/board/nuwani/gpio.inc
+++ b/board/nuwani/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/nuwani/led.c b/board/nuwani/led.c
index 76156d66d4..4013f22bd5 100644
--- a/board/nuwani/led.c
+++ b/board/nuwani/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,40 +8,43 @@
#include "led_common.h"
#include "gpio.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/oak/battery.c b/board/oak/battery.c
index fffd2f7763..b9b410932d 100644
--- a/board/oak/battery.c
+++ b/board/oak/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -11,7 +11,7 @@
#include "util.h"
/* Shutdown mode parameter to write to manufacturer access register */
-#define PARAM_CUT_OFF_LOW 0x10
+#define PARAM_CUT_OFF_LOW 0x10
#define PARAM_CUT_OFF_HIGH 0x00
static const struct battery_info info = {
@@ -21,7 +21,7 @@ static const struct battery_info info = {
/*
* TODO(crosbug.com/p/44428):
* In order to compatible with 2S battery, set min voltage as 6V rather
- * than 9V. Should set voltage_min to 9V, when 2S battery
+ * than 9V. Should set voltage_min to 9V, when 2S battery
* phased out.
*/
.voltage_min = 6000,
@@ -57,10 +57,10 @@ static int cutoff(void)
buf[2] = PARAM_CUT_OFF_HIGH;
i2c_lock(I2C_PORT_BATTERY, 1);
- rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
- buf, 3, NULL, 0, I2C_XFER_SINGLE);
- rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS,
- buf, 3, NULL, 0, I2C_XFER_SINGLE);
+ rv = i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, 3,
+ NULL, 0, I2C_XFER_SINGLE);
+ rv |= i2c_xfer_unlocked(I2C_PORT_BATTERY, BATTERY_ADDR_FLAGS, buf, 3,
+ NULL, 0, I2C_XFER_SINGLE);
i2c_lock(I2C_PORT_BATTERY, 0);
return rv;
diff --git a/board/oak/board.c b/board/oak/board.c
index 1c2e65b12a..468b6e6677 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -52,8 +52,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Dispaly port hardware can connect to port 0, 1 or neither. */
#define PD_PORT_NONE -1
@@ -76,8 +76,8 @@ void usb_evt(enum gpio_signal signal)
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD"},
- {GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED"},
+ { GPIO_SOC_POWER_GOOD, POWER_SIGNAL_ACTIVE_HIGH, "POWER_GOOD" },
+ { GPIO_SUSPEND_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND#_ASSERTED" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -87,39 +87,32 @@ const struct adc_t adc_channels[] = {
* PSYS_MONITOR(PA2): ADC_IN2, 1.44 uA/W on 6.05k Ohm
* output in mW
*/
- [ADC_PSYS] = {"PSYS", 379415, 4096, 0, STM32_AIN(2)},
+ [ADC_PSYS] = { "PSYS", 379415, 4096, 0, STM32_AIN(2) },
/* AMON_BMON(PC0): ADC_IN10, output in uV */
- [ADC_AMON_BMON] = {"AMON_BMON", 183333, 4096, 0, STM32_AIN(10)},
+ [ADC_AMON_BMON] = { "AMON_BMON", 183333, 4096, 0, STM32_AIN(10) },
/* VDC_BOOSTIN_SENSE(PC1): ADC_IN11, output in mV */
- [ADC_VBUS] = {"VBUS", 33000, 4096, 0, STM32_AIN(11)},
+ [ADC_VBUS] = { "VBUS", 33000, 4096, 0, STM32_AIN(11) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "battery",
- .port = I2C_PORT_BATTERY,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "pd",
- .port = I2C_PORT_PD_MCU,
- .kbps = 1000,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- }
-};
+const struct i2c_port_t i2c_ports[] = { { .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "pd",
+ .port = I2C_PORT_PD_MCU,
+ .kbps = 1000,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA } };
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
#ifdef CONFIG_ACCELGYRO_BMI160
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_ACCEL_PORT, 1, GPIO_SPI2_NSS }
-};
+const struct spi_device_t spi_devices[] = { { CONFIG_SPI_ACCEL_PORT, 1,
+ GPIO_SPI2_NSS } };
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
#endif
@@ -184,42 +177,47 @@ const struct charger_config_t chg_chips[] = {
* src/mainboard/google/${board}/acpi/dptf.asl
*/
const struct temp_sensor_t temp_sensors[] = {
- {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL},
- {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1},
- {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE2},
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp,
- 0},
+ { "TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL },
+ { "TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1 },
+ { "TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE2 },
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
#ifdef HAS_TASK_ALS
/* ALS instances. Must be in same order as enum als_id. */
struct als_t als[] = {
- {"TI", opt3001_init, opt3001_read_lux, 5},
+ { "TI", opt3001_init, opt3001_read_lux, 5 },
};
BUILD_ASSERT(ARRAY_SIZE(als) == ALS_COUNT);
#endif
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_USB_MUX,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_USB_MUX,
#if (BOARD_REV <= OAK_REV4)
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR1,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR1,
+ .driver = &pi3usb3x532_usb_mux_driver,
#else
- .i2c_addr_flags = 0x10,
- .driver = &ps8740_usb_mux_driver,
+ .i2c_addr_flags = 0x10,
+ .driver = &ps8740_usb_mux_driver,
#endif
+ },
},
};
@@ -340,10 +338,12 @@ int board_set_active_charge_port(int charge_port)
} else {
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L :
- GPIO_USB_C1_CHARGE_L, 1);
+ GPIO_USB_C1_CHARGE_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 0);
+ GPIO_USB_C0_CHARGE_L,
+ 0);
}
return EC_SUCCESS;
@@ -357,11 +357,11 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
pd_send_host_event(PD_EVENT_POWER_CHANGE);
}
@@ -552,8 +552,8 @@ void vbus_task(void *u)
}
if (wake)
- usb_charger_task_set_event(
- port, USB_CHG_EVENT_BC12);
+ usb_charger_task_set_event(port,
+ USB_CHG_EVENT_BC12);
}
task_wait_event(-1);
}
@@ -569,15 +569,15 @@ void vbus_task(void *u)
#ifdef CONFIG_TEMP_SENSOR_TMP432
static void tmp432_set_power_deferred(void)
{
- /* Shut tmp432 down if not in S0 && no external power */
- if (!extpower_is_present() && !chipset_in_state(CHIPSET_STATE_ON)) {
- if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_OFF))
+ /* Shut tmp432 down if not in S0 && no external power */
+ if (!extpower_is_present() && !chipset_in_state(CHIPSET_STATE_ON)) {
+ if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_OFF))
CPRINTS("ERROR: Can't shutdown TMP432.");
- return;
- }
+ return;
+ }
- /* else, turn it on. */
- if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_ON))
+ /* else, turn it on. */
+ if (EC_SUCCESS != tmp432_set_power(TMP432_POWER_ON))
CPRINTS("ERROR: Can't turn on TMP432.");
}
DECLARE_DEFERRED(tmp432_set_power_deferred);
@@ -602,7 +602,7 @@ static void board_chipset_pre_init(void)
board_extpower_buffer_to_soc();
#if BOARD_REV >= OAK_REV5
/* Enable DP muxer */
- gpio_set_level(GPIO_DP_MUX_EN_L , 0);
+ gpio_set_level(GPIO_DP_MUX_EN_L, 0);
gpio_set_level(GPIO_PARADE_MUX_EN, 1);
#endif
}
@@ -615,13 +615,12 @@ static void board_chipset_shutdown(void)
gpio_set_level(GPIO_LEVEL_SHIFT_EN_L, 1);
#if BOARD_REV >= OAK_REV5
/* Disable DP muxer */
- gpio_set_level(GPIO_DP_MUX_EN_L , 1);
+ gpio_set_level(GPIO_DP_MUX_EN_L, 1);
gpio_set_level(GPIO_PARADE_MUX_EN, 0);
#endif
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
-
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{
@@ -650,11 +649,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
#endif
static struct kionix_accel_data g_kx022_data;
diff --git a/board/oak/board.h b/board/oak/board.h
index b40215a7bf..6f5ed3fc87 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,7 +23,7 @@
#endif
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#if BOARD_REV >= OAK_REV5
/* Add for Ambient Light Sensor */
@@ -107,10 +107,10 @@
#define CONFIG_SPI_CONTROLLER
#define CONFIG_STM_HWTIMER32
#define CONFIG_VBOOT_HASH
-#undef CONFIG_WATCHDOG_HELP
+#undef CONFIG_WATCHDOG_HELP
#define CONFIG_SWITCH
#define CONFIG_BOARD_VERSION_GPIO
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_TMP432
@@ -149,19 +149,19 @@
#define KB_OUT_PORT_LIST GPIO_A, GPIO_B, GPIO_C, GPIO_D
/* 2 I2C master ports, connect to battery, charger, pd and USB switches */
-#define I2C_PORT_MASTER 0
-#define I2C_PORT_ACCEL 0
-#define I2C_PORT_ALS 0
+#define I2C_PORT_MASTER 0
+#define I2C_PORT_ACCEL 0
+#define I2C_PORT_ALS 0
#define I2C_PORT_BATTERY 0
#define I2C_PORT_CHARGER 0
#define I2C_PORT_PERICOM 0
#define I2C_PORT_THERMAL 0
-#define I2C_PORT_PD_MCU 1
+#define I2C_PORT_PD_MCU 1
#define I2C_PORT_USB_MUX 1
-#define I2C_PORT_TCPC 1
+#define I2C_PORT_TCPC 1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */
/* Ambient Light Sensor address */
#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
@@ -171,12 +171,12 @@
#define TIM_WATCHDOG 4
/* Define the host events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_LID_OPEN) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEY_PRESSED) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_RECOVERY) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_KEYBOARD_FASTBOOT))
#include "gpio_signal.h"
@@ -194,9 +194,9 @@ enum pwm_channel {
};
enum adc_channel {
- ADC_PSYS = 0, /* PC1: STM32_AIN(2) */
+ ADC_PSYS = 0, /* PC1: STM32_AIN(2) */
ADC_AMON_BMON, /* PC0: STM32_AIN(10) */
- ADC_VBUS, /* PA2: STM32_AIN(11) */
+ ADC_VBUS, /* PA2: STM32_AIN(11) */
ADC_CH_COUNT
};
@@ -235,16 +235,16 @@ enum als_id {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT
+#define PD_MAX_VOLTAGE_MV 20000
/* Reset PD MCU */
void board_reset_pd_mcu(void);
@@ -256,6 +256,6 @@ void board_typec_dp_on(int port);
void board_typec_dp_off(int port, int *dp_flags);
void board_typec_dp_set(int port, int level);
-#endif /* !__ASSEMBLER__ */
+#endif /* !__ASSEMBLER__ */
-#endif /* __CROS_EC_BOARD_H */
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/oak/board_revs.h b/board/oak/board_revs.h
index 34fc4bfc88..6220a05fb0 100644
--- a/board/oak/board_revs.h
+++ b/board/oak/board_revs.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
#define OAK_REV3 3
#define OAK_REV4 4
#define OAK_REV5 5
-#define OAK_REV_LAST OAK_REV5
+#define OAK_REV_LAST OAK_REV5
#define OAK_REV_DEFAULT OAK_REV5
#if !defined(BOARD_REV)
diff --git a/board/oak/build.mk b/board/oak/build.mk
index dc21970df0..1cbbb2ac63 100644
--- a/board/oak/build.mk
+++ b/board/oak/build.mk
@@ -1,5 +1,5 @@
#-*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/oak/ec.tasklist b/board/oak/ec.tasklist
index 2af7da77eb..80c39f2617 100644
--- a/board/oak/ec.tasklist
+++ b/board/oak/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/oak/gpio.inc b/board/oak/gpio.inc
index 3789f3ec35..b2ce008363 100644
--- a/board/oak/gpio.inc
+++ b/board/oak/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2015 The Chromium OS Authors. All rights reserved.
+ * Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/oak/led.c b/board/oak/led.c
index 877f115a12..64f5123b3c 100644
--- a/board/oak/led.c
+++ b/board/oak/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,9 +14,7 @@
#include "util.h"
#include "system.h"
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -27,7 +25,7 @@ enum led_color {
BAT_LED_AMBER,
PWR_LED_GREEN,
PWR_LED_ORANGE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int bat_led_set(enum led_color color, int on)
@@ -113,7 +111,7 @@ static void oak_led_set_power(int board_version)
power_second++;
- switch(board_version) {
+ switch (board_version) {
case OAK_REV3:
case OAK_REV4:
/*
@@ -131,8 +129,7 @@ static void oak_led_set_power(int board_version)
bat_led_set(PWR_LED_ORANGE, 0);
} else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) {
bat_led_set(PWR_LED_GREEN, 0);
- bat_led_set(PWR_LED_ORANGE,
- (power_second & 3) ? 0 : 1);
+ bat_led_set(PWR_LED_ORANGE, (power_second & 3) ? 0 : 1);
}
break;
default:
@@ -146,7 +143,7 @@ static void oak_led_set_battery(int board_version)
battery_second++;
- switch(board_version) {
+ switch (board_version) {
case OAK_REV3:
case OAK_REV4:
/*
@@ -169,10 +166,10 @@ static void oak_led_set_battery(int board_version)
bat_led_set(BAT_LED_GREEN, 0);
if (charge_get_percent() < 3)
bat_led_set(BAT_LED_RED,
- (battery_second & 1) ? 0 : 1);
+ (battery_second & 1) ? 0 : 1);
else if (charge_get_percent() < 10)
bat_led_set(BAT_LED_RED,
- (battery_second & 3) ? 0 : 1);
+ (battery_second & 3) ? 0 : 1);
else
bat_led_set(BAT_LED_RED, 0);
break;
@@ -191,7 +188,8 @@ static void oak_led_set_battery(int board_version)
default:
/*
* Put power control here since we are using the "battery" LED.
- * This allows LED autocontrol to be turned off by cmd during factory test.
+ * This allows LED autocontrol to be turned off by cmd during
+ * factory test.
*
* PWR LED behavior:
* Power on: Green
@@ -205,8 +203,8 @@ static void oak_led_set_battery(int board_version)
else if (chipset_in_state(CHIPSET_STATE_SUSPEND)) {
int cycle_time = 4;
/* Oak rev5 with GlaDOS ID has a extremely power
- * comsuming LED. Increase LED blink cycle time to reduce
- * S3 power comsuption. */
+ * comsuming LED. Increase LED blink cycle time to
+ * reduce S3 power comsuption. */
if (board_version >= OAK_REV5)
cycle_time = 10;
bat_led_set(BAT_LED_GREEN,
@@ -231,10 +229,10 @@ static void oak_led_set_battery(int board_version)
case PWR_STATE_DISCHARGE:
if (charge_get_percent() < 3)
bat_led_set(BAT_LED_ORANGE,
- (battery_second & 1) ? 0 : 1);
+ (battery_second & 1) ? 0 : 1);
else if (charge_get_percent() < 10)
bat_led_set(BAT_LED_ORANGE,
- (battery_second & 3) ? 0 : 1);
+ (battery_second & 3) ? 0 : 1);
else
bat_led_set(BAT_LED_ORANGE, 0);
break;
diff --git a/board/oak/usb_pd_policy.c b/board/oak/usb_pd_policy.c
index a4e62ebe88..c337aa4b59 100644
--- a/board/oak/usb_pd_policy.c
+++ b/board/oak/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,17 +18,15 @@
#include "usb_mux.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 1);
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_L : GPIO_USB_C0_CHARGE_L, 1);
/* Provide VBUS */
- gpio_set_level(port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN, 1);
+ gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 1);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
@@ -39,8 +37,7 @@ int pd_set_power_supply_ready(int port)
void pd_power_supply_reset(int port)
{
/* Disable VBUS */
- gpio_set_level(port ? GPIO_USB_C1_5V_EN :
- GPIO_USB_C0_5V_EN, 0);
+ gpio_set_level(port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN, 0);
/* notify host of power info change */
pd_send_host_event(PD_EVENT_POWER_CHANGE);
diff --git a/board/osiris/battery.c b/board/osiris/battery.c
index 61c0f7f886..669b592b1b 100644
--- a/board/osiris/battery.c
+++ b/board/osiris/battery.c
@@ -1,12 +1,16 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Battery pack vendor provided charging profile
*/
+#include "battery.h"
#include "battery_fuel_gauge.h"
#include "cbi.h"
+#include "charge_ramp.h"
+#include "charge_state.h"
+#include "charger_profile_override.h"
#include "common.h"
#include "compile_time_macros.h"
#include "gpio.h"
@@ -33,39 +37,6 @@
* address, mask, and disconnect value need to be provided.
*/
const struct board_batt_params board_battery_info[] = {
- /*
- * TODO(b:229947325): Copy kano battery AP19B8M for early support,
- * It should remove before FSI.
- */
- /* LGC AP19B8M Battery Information */
- [BATTERY_AP19B8M] = {
- .fuel_gauge = {
- .manuf_name = "LGC KT0030G024",
- .ship_mode = {
- .reg_addr = 0x3A,
- .reg_data = { 0xC574, 0xC574 },
- },
- .fet = {
- .reg_addr = 0x43,
- .reg_mask = 0x0001,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0002,
- .cfet_off_val = 0x0000,
- }
- },
- .batt_info = {
- .voltage_max = 13350,
- .voltage_normal = 11610,
- .voltage_min = 9000,
- .precharge_current = 256,
- .start_charging_min_c = 0,
- .start_charging_max_c = 50,
- .charging_min_c = 0,
- .charging_max_c = 60,
- .discharging_min_c = -20,
- .discharging_max_c = 75,
- },
- },
/* COSMX AP22ABN Battery Information */
[BATTERY_COSMX_AP22ABN] = {
.fuel_gauge = {
@@ -107,3 +78,73 @@ enum battery_present battery_hw_present(void)
/* The GPIO is low when the battery is physically present */
return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES;
}
+
+static int charger_should_discharge_on_ac(struct charge_state_data *curr)
+{
+ /* can not discharge on AC without battery */
+ if (curr->batt.is_present != BP_YES)
+ return 0;
+
+ /* Do not discharge when battery disconnect */
+ if (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)
+ return 0;
+
+ /* Do not discharge on AC if the battery is still waking up */
+ if ((curr->batt.flags & BATT_FLAG_BAD_STATUS) ||
+ (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ !(curr->batt.status & STATUS_FULLY_CHARGED)))
+ return 0;
+
+ /*
+ * In heavy load (>3A being withdrawn from VSYS) the DCDC of the
+ * charger operates on hybrid mode. This causes a slight voltage
+ * ripple on VSYS that falls in the audible noise frequency (single
+ * digit kHz range). This small ripple generates audible noise in
+ * the output ceramic capacitors (caps on VSYS and any input of
+ * DCDC under VSYS).
+ *
+ * To overcome this issue, force battery discharging when battery
+ * full, So the battery MOS of NVDC charger will turn on always,
+ * it make the Vsys same as Vbat and the noise has been improved.
+ */
+ if (!battery_is_cut_off() &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ return 1;
+
+ return 0;
+}
+
+/*
+ * This can override the smart battery's charging profile. To make a change,
+ * modify one or more of requested_voltage, requested_current, or state.
+ * Leave everything else unchanged.
+ *
+ * Return the next poll period in usec, or zero to use the default (which is
+ * state dependent).
+ */
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int disch_on_ac = charger_should_discharge_on_ac(curr);
+
+ charger_discharge_on_ac(disch_on_ac);
+
+ if (disch_on_ac) {
+ curr->state = ST_DISCHARGE;
+ return 0;
+ }
+
+ return 0;
+}
+
+enum ec_status charger_profile_override_get_param(uint32_t param,
+ uint32_t *value)
+{
+ return EC_RES_INVALID_PARAM;
+}
+
+enum ec_status charger_profile_override_set_param(uint32_t param,
+ uint32_t value)
+{
+ return EC_RES_INVALID_PARAM;
+}
diff --git a/board/osiris/board.c b/board/osiris/board.c
index 8d20de1550..6cfd7d8c26 100644
--- a/board/osiris/board.c
+++ b/board/osiris/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,15 +20,14 @@
#include "power.h"
#include "registers.h"
#include "switch.h"
-#include "tablet_mode.h"
#include "throttle_ap.h"
#include "usbc_config.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
@@ -66,15 +65,14 @@ __override void board_kblight_init(void)
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/osiris/board.h b/board/osiris/board.h
index 292a540087..c35cdce314 100644
--- a/board/osiris/board.h
+++ b/board/osiris/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,11 +21,16 @@
#define CONFIG_MP2964
+/* Tablet mode is not supported */
+#undef CONFIG_TABLET_MODE
+#undef CONFIG_TABLET_MODE_SWITCH
+#undef CONFIG_LID_ANGLE
+
/* LED */
#define CONFIG_LED_ONOFF_STATES
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
#undef CONFIG_USB_PD_TCPM_NCT38XX
@@ -48,17 +53,20 @@
#define CONFIG_USBC_PPC_SYV682X
/* TODO: b/177608416 - measure and check these values on osiris */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
+
+#define CONFIG_CHARGER_PROFILE_OVERRIDE
+#define CONFIG_PWR_STATE_DISCHARGE_FULL
/*
* Macros for GPIO signals used in common code that don't match the
@@ -66,56 +74,55 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* I2C Bus Configuration */
-#define I2C_PORT_RGBKB NPCX_I2C_PORT0_0
+#define I2C_PORT_RGBKB NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/* Thermal features */
#define CONFIG_THERMISTOR
@@ -123,32 +130,37 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FAN_RPM_CUSTOM
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+
+/* shutdown if soc <= 3%, default is 4% */
+#undef CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE
+#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 3
#undef CONFIG_VOLUME_BUTTONS
/* RGB Keyboard */
#define CONFIG_KEYBOARD_BACKLIGHT
-#define GPIO_RGBKBD_SDB_L GPIO_EC_KB_BL_EN_L
+#define GPIO_RGBKBD_SDB_L GPIO_EC_KB_BL_EN_L
#ifdef SECTION_IS_RW
#define CONFIG_RGB_KEYBOARD
-#define CONFIG_LED_DRIVER_IS31FL3733B /* is31fl3733b on I2C */
+#define CONFIG_LED_DRIVER_IS31FL3733B /* is31fl3733b on I2C */
#endif
-#define RGB_GRID0_COL 12
-#define RGB_GRID0_ROW 1
-#define I2C_PORT_KBMCU I2C_PORT_RGBKB
+#define RGB_GRID0_COL 12
+#define RGB_GRID0_ROW 1
+#define I2C_PORT_KBMCU I2C_PORT_RGBKB
#define CONFIG_KEYBOARD_FACTORY_TEST
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -166,27 +178,17 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum battery_type {
- BATTERY_AP19B8M,
- BATTERY_COSMX_AP22ABN,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_COSMX_AP22ABN, BATTERY_TYPE_COUNT };
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_FAN = 0, /* PWM5 */
+ PWM_CH_FAN2, /* PWM3 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_1, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_1, MFT_CH_COUNT };
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
extern const int keyboard_factory_scan_pins[][2];
diff --git a/board/osiris/build.mk b/board/osiris/build.mk
index b4a75892a5..fc29a4bb0e 100644
--- a/board/osiris/build.mk
+++ b/board/osiris/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/osiris/charger.c b/board/osiris/charger.c
index 85e0de90fe..88f5b85a41 100644
--- a/board/osiris/charger.c
+++ b/board/osiris/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -84,7 +83,6 @@ int board_set_active_charge_port(int port)
__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/osiris/ec.tasklist b/board/osiris/ec.tasklist
index cc968777a2..1b6c9cb361 100644
--- a/board/osiris/ec.tasklist
+++ b/board/osiris/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/osiris/fans.c b/board/osiris/fans.c
index fa5a8dc09a..5878d4c4c5 100644
--- a/board/osiris/fans.c
+++ b/board/osiris/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,6 +12,7 @@
#include "fan.h"
#include "hooks.h"
#include "pwm.h"
+#include "util.h"
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
@@ -20,16 +21,28 @@ const struct mft_t mft_channels[] = {
.clk_src = TCKC_LFCLK,
.pwm_id = PWM_CH_FAN,
},
+ [MFT_CH_1] = {
+ .module = NPCX_MFT_MODULE_2,
+ .clk_src = TCKC_LFCLK,
+ .pwm_id = PWM_CH_FAN2,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
+static const struct fan_conf fan_conf_1 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_1, /* Use MFT id to control fan */
+ .pgood_gpio = -1,
+ .enable_gpio = GPIO_EN_PP5000_FAN2,
+};
+
/*
* TODO(b/234545460): thermistor placement and calibration
*
@@ -38,8 +51,14 @@ static const struct fan_conf fan_conf_0 = {
* boards as well.
*/
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 3000,
- .rpm_start = 3000,
+ .rpm_min = 2500,
+ .rpm_start = 2500,
+ .rpm_max = 6000,
+};
+
+static const struct fan_rpm fan_rpm_1 = {
+ .rpm_min = 2500,
+ .rpm_start = 2500,
.rpm_max = 6000,
};
@@ -48,4 +67,154 @@ const struct fan_t fans[FAN_CH_COUNT] = {
.conf = &fan_conf_0,
.rpm = &fan_rpm_0,
},
+ [FAN_CH_1] = {
+ .conf = &fan_conf_1,
+ .rpm = &fan_rpm_1,
+ },
+};
+
+/* fan control */
+
+struct fan_step {
+ int on;
+ int off;
+ int rpm;
+};
+
+struct fan_table_config {
+ /* number of control_table */
+ uint8_t step;
+ /* fan control table */
+ const struct fan_step *control_table;
+};
+
+const struct fan_step fan_table0[] = {
+ { .on = 25, .off = 0, .rpm = 0 },
+ { .on = 37, .off = 34, .rpm = 2500 },
+ { .on = 42, .off = 39, .rpm = 2800 },
+ { .on = 46, .off = 43, .rpm = 3000 },
+ { .on = 51, .off = 48, .rpm = 3200 },
+ { .on = 55, .off = 52, .rpm = 3600 },
+ { .on = 59, .off = 56, .rpm = 4000 },
+ { .on = 66, .off = 63, .rpm = 4600 },
+ { .on = 72, .off = 69, .rpm = 5000 },
+ { .on = 74, .off = 71, .rpm = 5500 },
+};
+const int fan_table0_count = ARRAY_SIZE(fan_table0);
+
+const struct fan_step fan_table1[] = {
+ { .on = 25, .off = 0, .rpm = 0 },
+ { .on = 51, .off = 48, .rpm = 3200 },
+ { .on = 55, .off = 52, .rpm = 3600 },
+ { .on = 59, .off = 56, .rpm = 4000 },
+ { .on = 66, .off = 63, .rpm = 4600 },
+ { .on = 72, .off = 69, .rpm = 5000 },
+ { .on = 74, .off = 71, .rpm = 5500 },
+};
+const int fan_table1_count = ARRAY_SIZE(fan_table1);
+
+/* Fan control configuration */
+static struct fan_table_config fan_tables[] = {
+ [FAN_CH_0] = {
+ .step = fan_table0_count,
+ .control_table = (const struct fan_step *) &fan_table0,
+ },
+ [FAN_CH_1] = {
+ .step = fan_table1_count,
+ .control_table = (const struct fan_step *) &fan_table1,
+ },
};
+BUILD_ASSERT(ARRAY_SIZE(fan_tables) == FAN_CH_COUNT);
+
+static int current_level[] = { 0, 0 };
+BUILD_ASSERT(ARRAY_SIZE(current_level) == FAN_CH_COUNT);
+
+static int previous_level[] = { 0, 0 };
+BUILD_ASSERT(ARRAY_SIZE(previous_level) == FAN_CH_COUNT);
+
+#undef BOARD_FAN_TEST
+
+#ifdef BOARD_FAN_TEST
+static int manual_temp = -1;
+#endif
+
+int fan_percent_to_rpm(int fan, int pct)
+{
+ static struct fan_table_config *fan_table;
+ static int previous_pct;
+ int i;
+
+ fan_table = &fan_tables[fan];
+
+#ifdef BOARD_FAN_TEST
+ if (manual_temp != -1)
+ pct = manual_temp;
+#endif
+
+ /*
+ * Compare the pct and previous pct, we have the three paths :
+ * 1. decreasing path. (check the off point)
+ * 2. increasing path. (check the on point)
+ * 3. invariant path. (return the current RPM)
+ */
+ if (pct < previous_pct) {
+ for (i = current_level[fan]; i >= 0; i--) {
+ if (pct <= fan_table->control_table[i].off)
+ current_level[fan] = i - 1;
+ else
+ break;
+ }
+ } else if (pct > previous_pct) {
+ for (i = current_level[fan] + 1; i < fan_table->step; i++) {
+ if (pct >= fan_table->control_table[i].on)
+ current_level[fan] = i;
+ else
+ break;
+ }
+ }
+
+ if (current_level[fan] < 0)
+ current_level[fan] = 0;
+
+ if (current_level[fan] != previous_level[fan])
+ cprints(CC_THERMAL, "Fan %d: Set fan RPM to %d", fan,
+ fan_table->control_table[current_level[fan]].rpm);
+
+ if (fan == (FAN_CH_COUNT - 1))
+ previous_pct = pct;
+
+#ifdef BOARD_FAN_TEST
+ if (manual_temp != -1)
+ ccprints("Fan%d: temps:%d curr:%d prev:%d rpm:%d", fan, pct,
+ current_level[fan], previous_level[fan],
+ fan_table->control_table[current_level[fan]].rpm);
+#endif
+
+ previous_level[fan] = current_level[fan];
+
+ return fan_table->control_table[current_level[fan]].rpm;
+}
+
+#ifdef BOARD_FAN_TEST
+static int command_fan_test(int argc, const char **argv)
+{
+ char *e;
+ int t;
+
+ if (argc > 1) {
+ t = strtoi(argv[1], &e, 0);
+ if (*e) {
+ ccprints("Invalid test temp");
+ return EC_ERROR_INVAL;
+ }
+ manual_temp = t;
+ ccprints("manual temp is %d", manual_temp);
+ return EC_SUCCESS;
+ }
+ manual_temp = -1;
+ ccprints("manual temp reset");
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(fan_test, command_fan_test, "[temperature]",
+ "set manual temperature for fan test");
+#endif
diff --git a/board/osiris/fw_config.c b/board/osiris/fw_config.c
index 6a4469163b..1fb085fe6e 100644
--- a/board/osiris/fw_config.c
+++ b/board/osiris/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static union osiris_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/osiris/fw_config.h b/board/osiris/fw_config.h
index c10e6a99ca..fb776dc5a4 100644
--- a/board/osiris/fw_config.h
+++ b/board/osiris/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,10 +21,10 @@ enum ec_cfg_keyboard_backlight_type {
union osiris_cbi_fw_config {
struct {
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t reserved_1 : 1;
- uint32_t audio : 2;
- uint32_t reserved_2 : 28;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t reserved_1 : 1;
+ uint32_t audio : 2;
+ uint32_t reserved_2 : 28;
};
uint32_t raw_value;
};
diff --git a/board/osiris/gpio.inc b/board/osiris/gpio.inc
index ca22ddba08..ea196571f8 100644
--- a/board/osiris/gpio.inc
+++ b/board/osiris/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,6 @@ GPIO_INT(SEQ_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)
GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt)
GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
@@ -59,7 +58,8 @@ GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_R_ODL, PIN(C, 0), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
-GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_HIGH)
+GPIO(EN_PP5000_FAN, PIN(6, 1), GPIO_OUT_LOW)
+GPIO(EN_PP5000_FAN2, PIN(9, 7), GPIO_OUT_LOW)
GPIO(EN_PP5000_USBA_R, PIN(D, 7), GPIO_OUT_LOW)
GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW)
GPIO(IMVP9_VRRDY_OD, PIN(4, 3), GPIO_INPUT)
@@ -74,7 +74,6 @@ GPIO(LED_1_L, PIN(C, 4), GPIO_OUT_HIGH)
GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH)
GPIO(KYBL_EN, PIN(A, 7), GPIO_OUT_LOW)
GPIO(AMP_PWR_EN, PIN(5, 7), GPIO_OUT_LOW)
-GPIO(EC_FAN_TACH_2, PIN(7, 3), GPIO_INPUT)
GPIO(RGB_KB_INT, PIN(5, 6), GPIO_INPUT)
/* UART alternate functions */
@@ -92,6 +91,7 @@ ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1
/* PWM alternate functions */
ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */
+ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* GPIO73/TA2 */
ALTERNATE(PIN_MASK(8, 0x01), 0, MODULE_PWM, 0) /* GPIO80/PWM3 */
ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */
@@ -122,9 +122,9 @@ UNUSED(PIN(8, 3)) /* GPIO83 */
UNUSED(PIN(7, 0)) /* GPIO70 */
UNUSED(PIN(8, 1)) /* GPIO81 */
UNUSED(PIN(9, 3)) /* GPIO93 */
-UNUSED(PIN(9, 7)) /* GPIO97 */
UNUSED(PIN(D, 0)) /* GPIOD0/I2C3_SDA0 */
UNUSED(PIN(D, 1)) /* GPIOD1/I2C3_SCL0 */
+UNUSED(PIN(9, 5)) /* GPIO95 */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/osiris/i2c.c b/board/osiris/i2c.c
index 7c88d306a7..2d0656c484 100644
--- a/board/osiris/i2c.c
+++ b/board/osiris/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "hooks.h"
#include "i2c.h"
-#define BOARD_ID_FAST_PLUS_CAPABLE 2
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
diff --git a/board/osiris/keyboard.c b/board/osiris/keyboard.c
index cf74661173..cd557760eb 100644
--- a/board/osiris/keyboard.c
+++ b/board/osiris/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,29 +12,28 @@
#include "rgb_keyboard.h"
#include "timer.h"
-
-#define CPRINTF(format, args...) cprintf(CC_KEYBOARD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_KEYBOARD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_KEYBOARD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_KEYBOARD, format, ##args)
const struct key {
uint8_t row;
uint8_t col;
} vivaldi_keys[] = {
- {.row = 4, .col = 2}, /* T1 */
- {.row = 3, .col = 2}, /* T2 */
- {.row = 2, .col = 2}, /* T3 */
- {.row = 1, .col = 2}, /* T4 */
- {.row = 4, .col = 4}, /* T5 */
- {.row = 3, .col = 4}, /* T6 */
- {.row = 2, .col = 4}, /* T7 */
- {.row = 2, .col = 9}, /* T8 */
- {.row = 1, .col = 9}, /* T9 */
- {.row = 1, .col = 4}, /* T10 */
- {.row = 0, .col = 4}, /* T11 */
- {.row = 1, .col = 5}, /* T12 */
- {.row = 3, .col = 5}, /* T13 */
- {.row = 2, .col = 1}, /* T14 */
- {.row = 0, .col = 1}, /* T15 */
+ { .row = 4, .col = 2 }, /* T1 */
+ { .row = 3, .col = 2 }, /* T2 */
+ { .row = 2, .col = 2 }, /* T3 */
+ { .row = 1, .col = 2 }, /* T4 */
+ { .row = 4, .col = 4 }, /* T5 */
+ { .row = 3, .col = 4 }, /* T6 */
+ { .row = 2, .col = 4 }, /* T7 */
+ { .row = 2, .col = 9 }, /* T8 */
+ { .row = 1, .col = 9 }, /* T9 */
+ { .row = 1, .col = 4 }, /* T10 */
+ { .row = 0, .col = 4 }, /* T11 */
+ { .row = 1, .col = 5 }, /* T12 */
+ { .row = 3, .col = 5 }, /* T13 */
+ { .row = 2, .col = 1 }, /* T14 */
+ { .row = 0, .col = 1 }, /* T15 */
};
BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
@@ -55,8 +54,8 @@ static const struct ec_response_keybd_config osiris_vivaldi_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &osiris_vivaldi_kb;
}
@@ -81,139 +80,16 @@ const uint8_t rgbkbd_count = ARRAY_SIZE(rgbkbds);
const uint8_t rgbkbd_hsize = RGB_GRID0_COL;
const uint8_t rgbkbd_vsize = RGB_GRID0_ROW;
-/* TODO(b/233323599): need to check and update */
-#define LED(x, y) RGBKBD_COORD((x), (y))
-#define DELM RGBKBD_DELM
+enum ec_rgbkbd_type rgbkbd_type = EC_RGBKBD_TYPE_FOUR_ZONES_12_LEDS;
+
+#define LED(x, y) RGBKBD_COORD((x), (y))
+#define DELM RGBKBD_DELM
+
const uint8_t rgbkbd_map[] = {
- DELM, /* 0: (null) */
- LED(0, 0), DELM, /* 1: ~ ` */
- LED(0, 0), DELM, /* 2: ! 1 */
- LED(1, 0), DELM, /* 3: @ 2 */
- LED(1, 0), DELM, /* 4: # 3 */
- LED(2, 0), DELM, /* 5: $ 4 */
- LED(3, 0), DELM, /* 6: % 5 */
- LED(5, 0), DELM, /* 7: ^ 6 */
- LED(6, 0), DELM, /* 8: & 7 */
- LED(6, 0), DELM, /* 9: * 8 */
- LED(7, 0), DELM, /* 10: ( 9 */
- LED(8, 0), DELM, /* 11: ) 0 */
- LED(9, 0), DELM, /* 12: _ - */
- LED(10, 0), DELM, /* 13: + = */
- DELM, /* 14: (null) */
- LED(11, 0), DELM, /* 15: backspace */
- LED(0, 0), DELM, /* 16: tab */
- LED(0, 0), DELM, /* 17: q */
- LED(1, 0), DELM, /* 18: w */
- LED(2, 0), DELM, /* 19: e */
- LED(3, 0), DELM, /* 20: r */
- LED(4, 0), DELM, /* 21: t */
- LED(5, 0), DELM, /* 22: y */
- LED(6, 0), DELM, /* 23: u */
- LED(7, 0), DELM, /* 24: i */
- LED(8, 0), DELM, /* 25: o */
- LED(9, 0), DELM, /* 26: p */
- LED(10, 0), DELM, /* 27: [ { */
- LED(11, 0), DELM, /* 28: ] } */
- LED(11, 0), DELM, /* 29: \ | */
- LED(0, 0), DELM, /* 30: caps lock */
- LED(1, 0), DELM, /* 31: a */
- LED(1, 0), DELM, /* 32: s */
- LED(2, 0), DELM, /* 33: d */
- LED(3, 0), DELM, /* 34: f */
- LED(4, 0), DELM, /* 35: g */
- LED(5, 0), DELM, /* 36: h */
- LED(6, 0), DELM, /* 37: j */
- LED(7, 0), DELM, /* 38: k */
- LED(8, 0), DELM, /* 39: l */
- LED(9, 0), DELM, /* 40: ; : */
- LED(10, 0), DELM, /* 41: " ' */
- DELM, /* 42: (null) */
- LED(11, 0), DELM, /* 43: enter */
- LED(0, 0), DELM, /* 44: L-shift */
- DELM, /* 45: (null) */
- LED(1, 0), DELM, /* 46: z */
- LED(2, 0), DELM, /* 47: x */
- LED(3, 0), DELM, /* 48: c */
- LED(3, 0), DELM, /* 49: v */
- LED(5, 0), DELM, /* 50: b */
- LED(6, 0), DELM, /* 51: n */
- LED(7, 0), DELM, /* 52: m */
- LED(8, 0), DELM, /* 53: , < */
- LED(9, 0), DELM, /* 54: . > */
- LED(10, 0), DELM, /* 55: / ? */
- DELM, /* 56: (null) */
- LED(11, 0), DELM, /* 57: R-shift */
- LED(0, 0), DELM, /* 58: L-ctrl */
- LED(11, 0), DELM, /* 59: power */
- LED(1, 0), LED(2, 0), DELM, /* 60: L-alt */
- LED(3, 0), LED(4, 0),
- LED(5, 0), LED(6, 0), DELM, /* 61: space */
- LED(8, 0), DELM, /* 62: R-alt */
- DELM, /* 63: (null) */
- LED(9, 0), DELM, /* 64: R-ctrl */
- DELM, /* 65: (null) */
- DELM, /* 66: (null) */
- DELM, /* 67: (null) */
- DELM, /* 68: (null) */
- DELM, /* 69: (null) */
- DELM, /* 70: (null) */
- DELM, /* 71: (null) */
- DELM, /* 72: (null) */
- DELM, /* 73: (null) */
- DELM, /* 74: (null) */
- DELM, /* 75: (null) */
- DELM, /* 76: delete */
- DELM, /* 77: (null) */
- DELM, /* 78: (null) */
- LED(10, 0), DELM, /* 79: left */
- DELM, /* 80: home */
- DELM, /* 81: end */
- DELM, /* 82: (null) */
- LED(11, 0), DELM, /* 83: up */
- LED(11, 0), DELM, /* 84: down */
- DELM, /* 85: page up */
- DELM, /* 86: page down */
- DELM, /* 87: (null) */
- DELM, /* 88: (null) */
- LED(11, 0), DELM, /* 89: right */
- DELM, /* 90: (null) */
- DELM, /* 91: numpad 7 */
- DELM, /* 92: numpad 4 */
- DELM, /* 93: numpad 1 */
- DELM, /* 94: (null) */
- DELM, /* 95: numpad / */
- DELM, /* 96: numpad 8 */
- DELM, /* 97: numpad 5 */
- DELM, /* 98: numpad 2 */
- DELM, /* 99: numpad 0 */
- DELM, /* 100: numpad * */
- DELM, /* 101: numpad 9 */
- DELM, /* 102: numpad 6 */
- DELM, /* 103: numpad 3 */
- DELM, /* 104: numpad . */
- DELM, /* 105: numpad - */
- DELM, /* 106: numpad + */
- DELM, /* 107: (null) */
- DELM, /* 108: numpad enter */
- DELM, /* 109: (null) */
- LED(0, 0), DELM, /* 110: esc */
- LED(0, 0), DELM, /* T1: back */
- LED(1, 0), DELM, /* T2: refresh */
- LED(2, 0), DELM, /* T3: full screen */
- LED(3, 0), DELM, /* T4: overview */
- LED(5, 0), DELM, /* T5: snapshot */
- LED(6, 0), DELM, /* T6: brightness down */
- LED(7, 0), DELM, /* T7: brightness up */
- LED(8, 0), DELM, /* T8: mute */
- LED(9, 0), DELM, /* T9: volume down */
- LED(10, 0), DELM, /* T10: volume up */
- DELM, /* T11: (null) */
- DELM, /* T12: (null) */
- DELM, /* T13: (null) */
- DELM, /* T14: (null) */
- DELM, /* T15: (null) */
- DELM, /* 126: (null) */
- DELM, /* 127: (null) */
+ DELM, LED(0, 0), DELM, LED(1, 0), DELM, LED(2, 0), DELM, LED(3, 0),
+ DELM, LED(4, 0), DELM, LED(5, 0), DELM, LED(6, 0), DELM, LED(7, 0),
+ DELM, LED(8, 0), DELM, LED(9, 0), DELM, LED(10, 0), DELM, LED(11, 0),
+ DELM, DELM,
};
#undef LED
#undef DELM
@@ -237,28 +113,28 @@ __override struct keyboard_scan_config keyscan_config = {
};
static uint16_t scancode_set2_rgb[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0xe007, 0x0000, 0x0000},
- {0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016},
- {0x006c, 0x000c, 0x0004, 0x0006, 0x0005, 0xe071, 0x0026, 0x002a},
- {0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d},
- {0x0078, 0x0009, 0x0083, 0x000b, 0x0003, 0x0041, 0x001e, 0x001d},
- {0x0051, 0x0007, 0x005b, 0x0000, 0x0042, 0x0022, 0x003e, 0x0043},
- {0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c},
- {0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059},
- {0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d},
- {0x0045, 0x0001, 0x000a, 0x002f, 0x004b, 0x0049, 0x0046, 0x001A},
- {0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000},
- {0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066},
- {0xe06b, 0xe074, 0xe069, 0x0067, 0xe0c6, 0x0064, 0x0015, 0xe07d},
- {0x0073, 0x0066, 0xe071, 0x005d, 0x005a, 0xe04a, 0x0070, 0x0021},
- {0x0023, 0xe05a, 0x0075, 0x0067, 0xe069, 0xe07a, 0x007d, 0x0069},
+ { 0x0000, 0x0000, 0x0014, 0xe01f, 0xe014, 0xe007, 0x0000, 0x0000 },
+ { 0x001f, 0x0076, 0x0017, 0x000e, 0x001c, 0x003a, 0x000d, 0x0016 },
+ { 0x006c, 0x000c, 0x0004, 0x0006, 0x0005, 0xe071, 0x0026, 0x002a },
+ { 0x0032, 0x0034, 0x002c, 0x002e, 0x002b, 0x0029, 0x0025, 0x002d },
+ { 0x0078, 0x0009, 0x0083, 0x000b, 0x0003, 0x0041, 0x001e, 0x001d },
+ { 0x0051, 0x0007, 0x005b, 0x0000, 0x0042, 0x0022, 0x003e, 0x0043 },
+ { 0x0031, 0x0033, 0x0035, 0x0036, 0x003b, 0x001b, 0x003d, 0x003c },
+ { 0x0000, 0x0012, 0x0061, 0x0000, 0x0000, 0x0000, 0x0000, 0x0059 },
+ { 0x0055, 0x0052, 0x0054, 0x004e, 0x004c, 0x0024, 0x0044, 0x004d },
+ { 0x0045, 0x0001, 0x000a, 0x002f, 0x004b, 0x0049, 0x0046, 0x001A },
+ { 0xe011, 0x0000, 0x006a, 0x0000, 0x005d, 0x0000, 0x0011, 0x0000 },
+ { 0xe07a, 0x005d, 0xe075, 0x006b, 0x005a, 0xe072, 0x004a, 0x0066 },
+ { 0xe06b, 0xe074, 0xe069, 0x0067, 0xe0c6, 0x0064, 0x0015, 0xe07d },
+ { 0x0073, 0x0066, 0xe071, 0x005d, 0x005a, 0xe04a, 0x0070, 0x0021 },
+ { 0x0023, 0xe05a, 0x0075, 0x0067, 0xe069, 0xe07a, 0x007d, 0x0069 },
};
static void keyboard_matrix_init(void)
{
CPRINTS("%s", __func__);
- register_scancode_set2((uint16_t *) &scancode_set2_rgb,
- sizeof(scancode_set2_rgb));
+ register_scancode_set2((uint16_t *)&scancode_set2_rgb,
+ sizeof(scancode_set2_rgb));
}
DECLARE_HOOK(HOOK_INIT, keyboard_matrix_init, HOOK_PRIO_PRE_DEFAULT);
diff --git a/board/osiris/led.c b/board/osiris/led.c
index 7c4efdf93f..993c2969d4 100644
--- a/board/osiris/led.c
+++ b/board/osiris/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
* Power and battery LED control for osiris
@@ -21,23 +21,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/osiris/pwm.c b/board/osiris/pwm.c
index 530a777a8f..eb178750e9 100644
--- a/board/osiris/pwm.c
+++ b/board/osiris/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,31 +11,11 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 3,
- .flags = 0,
- /*
- * Set PWM frequency to multiple of 50 Hz and 60 Hz to prevent
- * flicker. Higher frequencies consume similar average power to
- * lower PWM frequencies, but higher frequencies record a much
- * lower maximum power.
- */
- .freq = 25000,
- },
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_FAN2] = { .channel = 3,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
-
-static void board_pwm_init(void)
-{
- /*
- * Turn on the fan at 50%.
- */
- pwm_enable(PWM_CH_KBLIGHT, 1);
- pwm_set_duty(PWM_CH_KBLIGHT, 50);
-}
-DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT);
diff --git a/board/osiris/sensors.c b/board/osiris/sensors.c
index e02bee6a20..9ad528c069 100644
--- a/board/osiris/sensors.c
+++ b/board/osiris/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -63,30 +63,29 @@ const struct temp_sensor_t temp_sensors[] = {
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
- * TODO(b/234545460): update for Alder Lake/brya
- *
- * temperature limit, See thermal table in b/234545460#comment2
+ * Temperature limit, See thermal table in b/234545460#comment16
+ * For real temperature in fan control table, set temp_fan_off
+ * and temp_fan_max to 0 and 99.
*/
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(90), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(80), \
}, \
.temp_host_release = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
}, \
- .temp_fan_off = C_TO_K(25), \
- .temp_fan_max = C_TO_K(89), \
+ .temp_fan_off = C_TO_K(0), \
+ .temp_fan_max = C_TO_K(99), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
-
-#define THERMAL_UNUSED \
- { \
+#define THERMAL_UNUSED \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = 0, \
[EC_TEMP_THRESH_HALT] = 0, \
diff --git a/board/osiris/usbc_config.c b/board/osiris/usbc_config.c
index 9a165ecdcc..d116e080ad 100644
--- a/board/osiris/usbc_config.c
+++ b/board/osiris/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,8 +32,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -94,39 +94,48 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
-
/*
* USB3 MB/DB mux configuration - the top level mux still needs to be set
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc0_usb3_mb_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc0_usb3_mb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- /* PS8815 MB */
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc0_usb3_mb_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 MB */
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc0_usb3_mb_retimer,
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -144,7 +153,6 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
-
#ifdef CONFIG_CHARGE_RAMP_SW
/*
@@ -169,8 +177,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -220,7 +228,6 @@ static void board_tcpc_init(void)
/* Enable BC1.2 interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
-
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
diff --git a/board/osiris/usbc_config.h b/board/osiris/usbc_config.h
index 3ea16a6d56..dac4177f0c 100644
--- a/board/osiris/usbc_config.h
+++ b/board/osiris/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,14 +9,10 @@
#define __CROS_EC_USBC_CONFIG_H
#ifndef CONFIG_ZEPHYR
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#endif
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/palkia/battery.c b/board/palkia/battery.c
index 76e58aa618..ed7efdb423 100644
--- a/board/palkia/battery.c
+++ b/board/palkia/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/palkia/board.c b/board/palkia/board.c
index cbf0e3178e..e0aab014a0 100644
--- a/board/palkia/board.c
+++ b/board/palkia/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,13 +39,12 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static const uint8_t actual_key_mask[KEYBOARD_COLS_MAX] = {
- 0x01, 0x68, 0xbd, 0x03, 0x7e, 0xff, 0xff,
- 0xff, 0xff, 0x03, 0xfd, 0x48, 0x03, 0xff,
- 0xf7, 0x16 /* full set */
+ 0x01, 0x68, 0xbd, 0x03, 0x7e, 0xff, 0xff, 0xff,
+ 0xff, 0x03, 0xfd, 0x48, 0x03, 0xff, 0xf7, 0x16 /* full set */
};
/* GPIO to enable/disable the USB Type-A port. */
@@ -119,16 +118,16 @@ static void board_lid_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
[PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -145,11 +144,13 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
}
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -165,7 +166,7 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -184,40 +185,40 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_3] = {
- "TEMP_AMB", NPCX_ADC_CH3, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_4] = {
- "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_5V_REG", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_3] = { "TEMP_AMB", NPCX_ADC_CH3, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_4] = { "TEMP_CPU", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Temp1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Temp2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Temp3",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "Temp4",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Temp1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Temp2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Temp3",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "Temp4",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -225,8 +226,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
diff --git a/board/palkia/board.h b/board/palkia/board.h
index 783f01c444..d4de1aca39 100644
--- a/board/palkia/board.h
+++ b/board/palkia/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,7 +46,7 @@
* Palkia' battery takes several seconds to come back out of its disconnect
* state (~4.2 seconds on the unit I have, so give it a little more for margin).
*/
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 6
/* BC 1.2 */
@@ -70,16 +70,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -87,18 +87,14 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_TEMP_SENSOR_3, /* ADC3 */
- ADC_TEMP_SENSOR_4, /* ADC2 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_3, /* ADC3 */
+ ADC_TEMP_SENSOR_4, /* ADC2 */
ADC_CH_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
diff --git a/board/palkia/build.mk b/board/palkia/build.mk
index cf0939b776..3ad9efe889 100644
--- a/board/palkia/build.mk
+++ b/board/palkia/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/palkia/ec.tasklist b/board/palkia/ec.tasklist
index be39ae64a2..2a0d89d14e 100644
--- a/board/palkia/ec.tasklist
+++ b/board/palkia/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/palkia/gpio.inc b/board/palkia/gpio.inc
index ec7ce25538..dfe92f8a81 100644
--- a/board/palkia/gpio.inc
+++ b/board/palkia/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/palkia/keyboard_customization.c b/board/palkia/keyboard_customization.c
index b39bf09f08..da69078c35 100644
--- a/board/palkia/keyboard_customization.c
+++ b/board/palkia/keyboard_customization.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,22 +12,22 @@
#include "keyboard_raw.h"
static uint16_t scancode_set2[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x0000, 0x0000, 0x0000, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x0015, 0x0000, 0x0014, 0x000d, 0x000e, 0x0016, 0x0000, 0x001c},
- {0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x0000, 0x0029, 0x0024, 0x000c, 0xe01f, 0x0026, 0x0004, 0x0000},
- {0x0022, 0x001a, 0x0006, 0x0005, 0x001b, 0x001e, 0x001d, 0x0076},
- {0x002a, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b},
- {0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b},
- {0x0049, 0xe072, 0x005d, 0x0044, 0x0009, 0x0046, 0x0000, 0x004b},
- {0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x0041, 0x0000, 0x0083, 0x000b, 0x0003, 0x003e, 0x0043, 0x0042},
- {0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0xe06b, 0x0000},
- {0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
- {0x004a, 0xe075, 0x004e, 0x0000, 0x0045, 0x004d, 0x0054, 0x004c},
- {0x0052, 0x005a, 0x0000, 0x0000, 0x0055, 0x0066, 0x005b, 0x0023},
- {0x0000, 0x000a, 0xe074, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000},
+ { 0x0021, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x0000, 0x0000, 0x0000, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x0015, 0x0000, 0x0014, 0x000d, 0x000e, 0x0016, 0x0000, 0x001c },
+ { 0xe011, 0x0011, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x0000, 0x0029, 0x0024, 0x000c, 0xe01f, 0x0026, 0x0004, 0x0000 },
+ { 0x0022, 0x001a, 0x0006, 0x0005, 0x001b, 0x001e, 0x001d, 0x0076 },
+ { 0x002a, 0x0032, 0x0034, 0x002c, 0x002e, 0x0025, 0x002d, 0x002b },
+ { 0x003a, 0x0031, 0x0033, 0x0035, 0x0036, 0x003d, 0x003c, 0x003b },
+ { 0x0049, 0xe072, 0x005d, 0x0044, 0x0009, 0x0046, 0x0000, 0x004b },
+ { 0x0059, 0x0012, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x0041, 0x0000, 0x0083, 0x000b, 0x0003, 0x003e, 0x0043, 0x0042 },
+ { 0x0000, 0x0000, 0x0000, 0x0001, 0x0000, 0x0000, 0xe06b, 0x0000 },
+ { 0xe014, 0x0014, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
+ { 0x004a, 0xe075, 0x004e, 0x0000, 0x0045, 0x004d, 0x0054, 0x004c },
+ { 0x0052, 0x005a, 0x0000, 0x0000, 0x0055, 0x0066, 0x005b, 0x0023 },
+ { 0x0000, 0x000a, 0xe074, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
};
uint16_t get_scancode_set2(uint8_t row, uint8_t col)
@@ -64,38 +64,30 @@ void board_keyboard_drive_col(int col)
#ifdef CONFIG_KEYBOARD_DEBUG
static char keycap_label[KEYBOARD_COLS_MAX][KEYBOARD_ROWS] = {
- {'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`',
- '1', KLLI_UNKNO, 'a'},
- {KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4,
- KLLI_SEARC, '3', KLLI_F3, KLLI_UNKNO},
- {'x', 'z', KLLI_F2, KLLI_F1,
- 's', '2', 'w', KLLI_ESC},
- {'v', 'b', 'g', 't',
- '5', '4', 'r', 'f'},
- {'m', 'n', 'h', 'y',
- '6', '7', 'u', 'j'},
- {'.', KLLI_DOWN, '\\', 'o',
- KLLI_F10, '9', KLLI_UNKNO, 'l'},
- {KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {',', KLLI_UNKNO, KLLI_F7, KLLI_F6,
- KLLI_F5, '8', 'i', 'k'},
- {KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_LEFT, KLLI_UNKNO},
- {KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
- {'/', KLLI_UP, '-', KLLI_UNKNO,
- '0', 'p', '[', ';'},
- {'\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO,
- '=', KLLI_B_SPC, ']', 'd'},
- {KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO,
- KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO},
+ { 'c', KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { 'q', KLLI_UNKNO, KLLI_UNKNO, KLLI_TAB, '`', '1', KLLI_UNKNO, 'a' },
+ { KLLI_R_ALT, KLLI_L_ALT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { KLLI_UNKNO, KLLI_SPACE, 'e', KLLI_F4, KLLI_SEARC, '3', KLLI_F3,
+ KLLI_UNKNO },
+ { 'x', 'z', KLLI_F2, KLLI_F1, 's', '2', 'w', KLLI_ESC },
+ { 'v', 'b', 'g', 't', '5', '4', 'r', 'f' },
+ { 'm', 'n', 'h', 'y', '6', '7', 'u', 'j' },
+ { '.', KLLI_DOWN, '\\', 'o', KLLI_F10, '9', KLLI_UNKNO, 'l' },
+ { KLLI_R_SHT, KLLI_L_SHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { ',', KLLI_UNKNO, KLLI_F7, KLLI_F6, KLLI_F5, '8', 'i', 'k' },
+ { KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO, KLLI_F9, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_LEFT, KLLI_UNKNO },
+ { KLLI_R_CTR, KLLI_L_CTR, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO },
+ { '/', KLLI_UP, '-', KLLI_UNKNO, '0', 'p', '[', ';' },
+ { '\'', KLLI_ENTER, KLLI_UNKNO, KLLI_UNKNO, '=', KLLI_B_SPC, ']', 'd' },
+ { KLLI_UNKNO, KLLI_F8, KLLI_RIGHT, KLLI_UNKNO, KLLI_UNKNO, KLLI_UNKNO,
+ KLLI_UNKNO, KLLI_UNKNO },
};
char get_keycap_label(uint8_t row, uint8_t col)
diff --git a/board/palkia/keyboard_customization.h b/board/palkia/keyboard_customization.h
index 37ce1cf61f..fc97ffd728 100644
--- a/board/palkia/keyboard_customization.h
+++ b/board/palkia/keyboard_customization.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,47 +25,47 @@ extern uint8_t keyboard_cols;
#define KEYBOARD_ROW_TO_MASK(r) (1 << (r))
/* Columns and masks for keys we particularly care about */
-#define KEYBOARD_COL_DOWN 8
-#define KEYBOARD_ROW_DOWN 1
-#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
-#define KEYBOARD_COL_ESC 5
-#define KEYBOARD_ROW_ESC 7
-#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
-#define KEYBOARD_COL_KEY_H 7
-#define KEYBOARD_ROW_KEY_H 2
-#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
-#define KEYBOARD_COL_KEY_R 6
-#define KEYBOARD_ROW_KEY_R 6
-#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
-#define KEYBOARD_COL_LEFT_ALT 3
-#define KEYBOARD_ROW_LEFT_ALT 1
-#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
-#define KEYBOARD_COL_REFRESH 4
-#define KEYBOARD_ROW_REFRESH 6
-#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
-#define KEYBOARD_COL_RIGHT_ALT 3
-#define KEYBOARD_ROW_RIGHT_ALT 0
-#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
-#define KEYBOARD_DEFAULT_COL_VOL_UP 8
-#define KEYBOARD_DEFAULT_ROW_VOL_UP 4
-#define KEYBOARD_COL_LEFT_CTRL 12
-#define KEYBOARD_ROW_LEFT_CTRL 1
+#define KEYBOARD_COL_DOWN 8
+#define KEYBOARD_ROW_DOWN 1
+#define KEYBOARD_MASK_DOWN KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_DOWN)
+#define KEYBOARD_COL_ESC 5
+#define KEYBOARD_ROW_ESC 7
+#define KEYBOARD_MASK_ESC KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_ESC)
+#define KEYBOARD_COL_KEY_H 7
+#define KEYBOARD_ROW_KEY_H 2
+#define KEYBOARD_MASK_KEY_H KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_H)
+#define KEYBOARD_COL_KEY_R 6
+#define KEYBOARD_ROW_KEY_R 6
+#define KEYBOARD_MASK_KEY_R KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_R)
+#define KEYBOARD_COL_LEFT_ALT 3
+#define KEYBOARD_ROW_LEFT_ALT 1
+#define KEYBOARD_MASK_LEFT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_ALT)
+#define KEYBOARD_COL_REFRESH 4
+#define KEYBOARD_ROW_REFRESH 6
+#define KEYBOARD_MASK_REFRESH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_REFRESH)
+#define KEYBOARD_COL_RIGHT_ALT 3
+#define KEYBOARD_ROW_RIGHT_ALT 0
+#define KEYBOARD_MASK_RIGHT_ALT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_ALT)
+#define KEYBOARD_DEFAULT_COL_VOL_UP 8
+#define KEYBOARD_DEFAULT_ROW_VOL_UP 4
+#define KEYBOARD_COL_LEFT_CTRL 12
+#define KEYBOARD_ROW_LEFT_CTRL 1
#define KEYBOARD_MASK_LEFT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_CTRL)
#define KEYBOARD_COL_RIGHT_CTRL 12
#define KEYBOARD_ROW_RIGHT_CTRL 0
#define KEYBOARD_MASK_RIGHT_CTRL KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_RIGHT_CTRL)
-#define KEYBOARD_COL_SEARCH 2
-#define KEYBOARD_ROW_SEARCH 3
-#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
-#define KEYBOARD_COL_KEY_0 13
-#define KEYBOARD_ROW_KEY_0 4
-#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
-#define KEYBOARD_COL_KEY_1 2
-#define KEYBOARD_ROW_KEY_1 5
-#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
-#define KEYBOARD_COL_KEY_2 5
-#define KEYBOARD_ROW_KEY_2 5
-#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
+#define KEYBOARD_COL_SEARCH 2
+#define KEYBOARD_ROW_SEARCH 3
+#define KEYBOARD_MASK_SEARCH KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_SEARCH)
+#define KEYBOARD_COL_KEY_0 13
+#define KEYBOARD_ROW_KEY_0 4
+#define KEYBOARD_MASK_KEY_0 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_0)
+#define KEYBOARD_COL_KEY_1 2
+#define KEYBOARD_ROW_KEY_1 5
+#define KEYBOARD_MASK_KEY_1 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_1)
+#define KEYBOARD_COL_KEY_2 5
+#define KEYBOARD_ROW_KEY_2 5
+#define KEYBOARD_MASK_KEY_2 KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_KEY_2)
#define KEYBOARD_COL_LEFT_SHIFT 9
#define KEYBOARD_ROW_LEFT_SHIFT 1
#define KEYBOARD_MASK_LEFT_SHIFT KEYBOARD_ROW_TO_MASK(KEYBOARD_ROW_LEFT_SHIFT)
diff --git a/board/palkia/led.c b/board/palkia/led.c
index df74a38d52..f5242a04c0 100644
--- a/board/palkia/led.c
+++ b/board/palkia/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,29 +19,37 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/panqueque/board.c b/board/panqueque/board.c
index cea834c75e..786fe5f5aa 100644
--- a/board/panqueque/board.c
+++ b/board/panqueque/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,8 +28,8 @@
#include "usb_tc_sm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
#define QUICHE_PD_DEBUG_LVL 1
@@ -84,25 +84,25 @@ static void board_usbc_usb3_interrupt(enum gpio_signal signal)
* signals is driven by USB/MST hub power sequencing requirements.
*/
const struct power_seq board_power_seq[] = {
- {GPIO_EN_AC_JACK, 1, 20},
- {GPIO_EC_DFU_MUX_CTRL, 0, 0},
- {GPIO_EN_PP5000_A, 1, 31},
- {GPIO_MST_LP_CTL_L, 1, 0},
- {GPIO_EN_PP3300_B, 1, 1},
- {GPIO_EN_PP1100_A, 1, 100+30},
- {GPIO_EN_BB, 1, 30},
- {GPIO_EN_PP1050_A, 1, 30},
- {GPIO_EN_PP1200_A, 1, 20},
- {GPIO_EN_PP5000_C, 1, 20},
- {GPIO_EN_PP5000_HSPORT, 1, 31},
- {GPIO_EN_DP_SINK, 1, 80},
- {GPIO_MST_RST_L, 1, 61},
- {GPIO_EC_HUB2_RESET_L, 1, 41},
- {GPIO_EC_HUB3_RESET_L, 1, 33},
- {GPIO_DP_SINK_RESET, 1, 100},
- {GPIO_USBC_UF_RESET_L, 1, 33},
- {GPIO_DEMUX_DP_HDMI_PD_N, 1, 10},
- {GPIO_DEMUX_DP_HDMI_MODE, 1, 5},
+ { GPIO_EN_AC_JACK, 1, 20 },
+ { GPIO_EC_DFU_MUX_CTRL, 0, 0 },
+ { GPIO_EN_PP5000_A, 1, 31 },
+ { GPIO_MST_LP_CTL_L, 1, 0 },
+ { GPIO_EN_PP3300_B, 1, 1 },
+ { GPIO_EN_PP1100_A, 1, 100 + 30 },
+ { GPIO_EN_BB, 1, 30 },
+ { GPIO_EN_PP1050_A, 1, 30 },
+ { GPIO_EN_PP1200_A, 1, 20 },
+ { GPIO_EN_PP5000_C, 1, 20 },
+ { GPIO_EN_PP5000_HSPORT, 1, 31 },
+ { GPIO_EN_DP_SINK, 1, 80 },
+ { GPIO_MST_RST_L, 1, 61 },
+ { GPIO_EC_HUB2_RESET_L, 1, 41 },
+ { GPIO_EC_HUB3_RESET_L, 1, 33 },
+ { GPIO_DP_SINK_RESET, 1, 100 },
+ { GPIO_USBC_UF_RESET_L, 1, 33 },
+ { GPIO_DEMUX_DP_HDMI_PD_N, 1, 10 },
+ { GPIO_DEMUX_DP_HDMI_MODE, 1, 5 },
};
const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
@@ -110,13 +110,13 @@ const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Plugable"),
- [USB_STR_PRODUCT] = USB_STRING_DESC("UC-MSTHDC"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] =
- USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Plugable"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("UC-MSTHDC"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] =
+ USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -135,8 +135,7 @@ struct ppc_config_t ppc_chips[] = {
* PS8802 set mux board tuning.
* Adds in board specific gain and DP lane count configuration
*/
-static int board_ps8822_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8822_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
int rv = EC_SUCCESS;
@@ -155,28 +154,26 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_HOST] = {
- .usb_port = USB_PD_PORT_HOST,
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = PS8822_I2C_ADDR3_FLAG,
- .driver = &ps8822_usb_mux_driver,
- .board_set = &board_ps8822_mux_set,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_HOST,
+ .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = PS8822_I2C_ADDR3_FLAG,
+ .driver = &ps8822_usb_mux_driver,
+ .board_set = &board_ps8822_mux_set,
+ },
},
};
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_HOST] = {
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_USB3] = {
- .i2c_port = I2C_PORT_I2C3,
- .i2c_addr_flags = SN5S330_ADDR1_FLAGS,
- .drv = &sn5s330_drv
- },
+ [USB_PD_PORT_HOST] = { .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ [USB_PD_PORT_USB3] = { .i2c_port = I2C_PORT_I2C3,
+ .i2c_addr_flags = SN5S330_ADDR1_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -284,14 +281,13 @@ static void board_usb_tc_disconnect(void)
if (port == USB_PD_PORT_HOST)
gpio_set_level(GPIO_UFP_PLUG_DET, 1);
}
-DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect,\
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect,
HOOK_PRIO_DEFAULT);
#endif /* SECTION_IS_RW */
static void board_init(void)
{
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -328,7 +324,7 @@ void board_debug_gpio(enum debug_gpio trigger, int level, int pulse_usec)
}
}
-static int command_dplane(int argc, char **argv)
+static int command_dplane(int argc, const char **argv)
{
char *e;
int lane;
@@ -356,6 +352,4 @@ static int command_dplane(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(dplane, command_dplane,
- "<2 | 4>",
- "MST lane control.");
+DECLARE_CONSOLE_COMMAND(dplane, command_dplane, "<2 | 4>", "MST lane control.");
diff --git a/board/panqueque/board.h b/board/panqueque/board.h
index 39aed68f8e..24eeebabe5 100644
--- a/board/panqueque/board.h
+++ b/board/panqueque/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
#undef CONFIG_FLASH_PSTATE_LOCKED
/* USB Type C and USB PD defines */
-#define USB_PD_PORT_HOST 0
-#define USB_PD_PORT_USB3 1
+#define USB_PD_PORT_HOST 0
+#define USB_PD_PORT_USB3 1
/*
* Only the host and display usbc ports are usb-pd capable. There is a 2nd usbc
@@ -40,9 +40,9 @@
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
/* I2C port names */
-#define I2C_PORT_I2C1 0
-#define I2C_PORT_I2C2 1
-#define I2C_PORT_I2C3 2
+#define I2C_PORT_I2C1 0
+#define I2C_PORT_I2C2 1
+#define I2C_PORT_I2C3 2
/* Required symbolic I2C port names */
#define I2C_PORT_MP4245 I2C_PORT_I2C3
@@ -68,7 +68,7 @@
#define GPIO_TRIGGER_1 GPIO_USB3_A5_CDP_EN
#define GPIO_TRIGGER_2 GPIO_USB3_A6_CDP_EN
-enum debug_gpio {
+enum debug_gpio {
TRIGGER_1 = 0,
TRIGGER_2,
};
diff --git a/board/panqueque/build.mk b/board/panqueque/build.mk
index 49775523af..8f9795eca9 100644
--- a/board/panqueque/build.mk
+++ b/board/panqueque/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/panqueque/ec.tasklist b/board/panqueque/ec.tasklist
index 7a67fce776..7bd8acaa5f 100644
--- a/board/panqueque/ec.tasklist
+++ b/board/panqueque/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/panqueque/gpio.inc b/board/panqueque/gpio.inc
index fa1b900c82..4fd80ec754 100644
--- a/board/panqueque/gpio.inc
+++ b/board/panqueque/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pazquel/battery.c b/board/pazquel/battery.c
index e1415f5682..bd600aed5b 100644
--- a/board/pazquel/battery.c
+++ b/board/pazquel/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/pazquel/board.c b/board/pazquel/board.c
index d3568a4bcb..90dcc6cd0d 100644
--- a/board/pazquel/board.c
+++ b/board/pazquel/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,10 @@
#include "charge_manager.h"
#include "charge_state.h"
#include "extpower.h"
+#include "driver/accel_kionix.h"
#include "driver/accel_bma2x2.h"
#include "driver/accelgyro_bmi_common.h"
+#include "driver/accelgyro_bmi323.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
@@ -33,8 +35,8 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -127,10 +129,8 @@ __override struct keyboard_scan_config keyscan_config = {
* 2. T11 key not in keyboard (KSI_0,KSO_1):
* change actual_key_mask[1] from 0xff to 0xfe
*/
- .actual_key_mask = {
- 0x1c, 0xfe, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x1c, 0xfe, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -141,41 +141,31 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -183,58 +173,39 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
[PWM_CH_DISPLIGHT] = { .channel = 5, .flags = 0, .freq = 20000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -265,16 +236,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -293,19 +270,6 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
.i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
},
};
-
-static void board_update_sensor_config_clamshell(void)
-{
- motion_sensor_count = 0;
- gmr_tablet_switch_disable();
- /* The sensors are not stuffed; don't allow lines to float */
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_LID_ACCEL_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
-}
-DECLARE_HOOK(HOOK_INIT, board_update_sensor_config_clamshell,
- HOOK_PRIO_INIT_I2C + 2);
/* Initialize board. */
static void board_init(void)
{
@@ -352,9 +316,19 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ /*
+ * Pazquel/pazquel360 share the same firmware ,only pazquel360 has
+ * volume keys. So disable volume keys for pazquel board
+ */
+ if (!board_has_side_volume_buttons()) {
+ button_disable_gpio(BUTTON_VOLUME_UP);
+ button_disable_gpio(BUTTON_VOLUME_DOWN);
+ gpio_set_flags(GPIO_VOLUME_DOWN_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_VOLUME_UP_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ }
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
static void da9313_pvc_mode_ctrl(int enable)
{
@@ -364,12 +338,12 @@ static void da9313_pvc_mode_ctrl(int enable)
*/
if (enable)
i2c_update8(I2C_PORT_POWER, DA9313_I2C_ADDR_FLAGS,
- DA9313_REG_PVC_CTRL,
- DA9313_PVC_CTRL_PVC_MODE, MASK_SET);
+ DA9313_REG_PVC_CTRL, DA9313_PVC_CTRL_PVC_MODE,
+ MASK_SET);
else
i2c_update8(I2C_PORT_POWER, DA9313_I2C_ADDR_FLAGS,
- DA9313_REG_PVC_CTRL,
- DA9313_PVC_CTRL_PVC_MODE, MASK_CLR);
+ DA9313_REG_PVC_CTRL, DA9313_PVC_CTRL_PVC_MODE,
+ MASK_CLR);
}
void da9313_init(void)
@@ -377,7 +351,7 @@ void da9313_init(void)
/* PVC operates in fixed frequency mode in S0. */
da9313_pvc_mode_ctrl(0);
}
-DECLARE_HOOK(HOOK_INIT, da9313_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, da9313_init, HOOK_PRIO_DEFAULT + 1);
void board_hibernate(void)
{
@@ -387,10 +361,8 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_LID_ACCEL_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_LID_ACCEL_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Enable the PPC power sink path before EC enters hibernate;
@@ -435,8 +407,23 @@ static void board_shutdown_complete(void)
}
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN_COMPLETE, board_shutdown_complete,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
+__override uint32_t board_get_sku_id(void)
+{
+ static int sku_id = -1;
+
+ if (sku_id == -1) {
+ int bits[3];
+
+ bits[0] = gpio_get_ternary(GPIO_SKU_ID0);
+ bits[1] = gpio_get_ternary(GPIO_SKU_ID1);
+ bits[2] = gpio_get_ternary(GPIO_SKU_ID2);
+ sku_id = binary_first_base3_from_bits(bits, ARRAY_SIZE(bits));
+ }
+
+ return (uint32_t)sku_id;
+}
void board_set_switchcap_power(int enable)
{
@@ -495,8 +482,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -524,7 +510,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -548,23 +533,21 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
@@ -585,94 +568,157 @@ uint16_t tcpc_get_alert_status(void)
static struct mutex g_base_mutex;
static struct mutex g_lid_mutex;
-static struct bmi_drv_data_t g_bmi160_data;
-static struct accelgyro_saved_data_t g_bma255_data;
-
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static struct kionix_accel_data g_kx022_data;
+static const mat33_fp_t lid_standard_ref_kx022 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+
+static struct bmi_drv_data_t g_bmi_data;
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMA255,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bma2x2_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bma255_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
- .rot_standard_ref = &lid_standard_ref,
- .default_range = 2, /* g, to support lid angle calculation. */
- .min_frequency = BMA255_ACCEL_MIN_FREQ,
- .max_frequency = BMA255_ACCEL_MAX_FREQ,
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- /* Sensor on for lid angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
+ .name = "Lid Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_KX022,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &kionix_accel_drv,
+ .mutex = &g_lid_mutex,
+ .drv_data = &g_kx022_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
+ .rot_standard_ref = &lid_standard_ref_kx022,
+ .default_range = 2, /* g */
+ /* We only use 2g because its resolution is only 8-bits */
+ .min_frequency = KX022_ACCEL_MIN_FREQ,
+ .max_frequency = KX022_ACCEL_MAX_FREQ,
+ .config = {
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
},
- },
},
/*
- * Note: bmi160: supports accelerometer and gyro sensor
+ * Note: bmi232: supports accelerometer and gyro sensor
* Requirement: accelerometer sensor must init before gyro sensor
* DO NOT change the order of the following table.
*/
[BASE_ACCEL] = {
- .name = "Base Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi160_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
- .min_frequency = BMI_ACCEL_MIN_FREQ,
- .max_frequency = BMI_ACCEL_MAX_FREQ,
- .config = {
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- /* Sensor on for lid angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI323,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi3xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
+ .rot_standard_ref = &base_standard_ref,
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 12500 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ /* Sensor on in S3 */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 12500 | ROUND_UP_FLAG,
+ .ec_rate = 0,
+ },
+ },
},
[BASE_GYRO] = {
- .name = "Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI160,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi160_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_standard_ref,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI323,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi3xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_standard_ref,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
},
};
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+static void board_update_sensor_config_from_sku(void)
+{
+ if (board_is_clamshell()) {
+ motion_sensor_count = 0;
+ gmr_tablet_switch_disable();
+ /* The sensors are not stuffed; don't allow lines to float */
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
+ GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_LID_ACCEL_INT_L,
+ GPIO_INPUT | GPIO_PULL_DOWN);
+ } else {
+ motion_sensor_count = ARRAY_SIZE(motion_sensors);
+ /* Enable interrupt for the base accel sensor */
+ gpio_enable_interrupt(GPIO_ACCEL_GYRO_INT_L);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, board_update_sensor_config_from_sku,
+ HOOK_PRIO_INIT_I2C + 2);
+
+static uint8_t sku_id;
+
+enum board_model {
+ PAZQUEL,
+ PAZQUEL360,
+ UNKNOWN,
+};
+
+static const char *const model_name[] = {
+ "PAZQUEL",
+ "PAZQUEL360",
+ "UNKNOWN",
+};
+
+static enum board_model get_model(void)
+{
+ if (sku_id == 0 || sku_id == 1 || sku_id == 2 || sku_id == 3 ||
+ sku_id == 4 || sku_id == 5 || sku_id == 6)
+ return PAZQUEL;
+ if (sku_id >= 8)
+ return PAZQUEL360;
+ return UNKNOWN;
+}
+
+int board_is_clamshell(void)
+{
+ return get_model() == PAZQUEL;
+}
+
+/* Read SKU ID from GPIO and initialize variables for board variants */
+static void sku_init(void)
+{
+ sku_id = system_get_sku_id();
+ CPRINTS("SKU: %u (%s)", sku_id, model_name[get_model()]);
+}
+DECLARE_HOOK(HOOK_INIT, sku_init, HOOK_PRIO_INIT_I2C + 1);
+
+int board_has_side_volume_buttons(void)
+{
+ return get_model() == PAZQUEL360;
+}
+__override int mkbp_support_volume_buttons(void)
+{
+ return board_has_side_volume_buttons();
+}
diff --git a/board/pazquel/board.h b/board/pazquel/board.h
index dc80fc9829..414c8ab7dd 100644
--- a/board/pazquel/board.h
+++ b/board/pazquel/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,7 +11,7 @@
#include "baseboard.h"
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Keyboard */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
@@ -37,19 +37,16 @@
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
-/* No side volume button */
-#undef CONFIG_VOLUME_BUTTONS
-
/* Sensors */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-/* BMI160 Base accel/gyro */
-#define CONFIG_ACCELGYRO_BMI160
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
+/* BMI323 Base accel/gyro */
+#define CONFIG_ACCELGYRO_BMI3XX
+#define CONFIG_ACCELGYRO_BMI3XX_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define OPT3001_I2C_ADDR_FLAGS OPT3001_I2C_ADDR1_FLAGS
-/* BMA253 lid accel */
-#define CONFIG_ACCEL_BMA255
+/* KX022 lid accel */
+#define CONFIG_ACCEL_KX022
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_LID_ANGLE
@@ -72,17 +69,14 @@
#define DA9313_PVC_CTRL_PVC_MODE BIT(1)
#define DA9313_PVC_CTRL_PVC_EN BIT(0)
+/* Button Config*/
+#define CONFIG_BUTTONS_RUNTIME_CONFIG
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -92,11 +86,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
enum battery_type {
BATTERY_GANFENG,
@@ -106,6 +96,8 @@ enum battery_type {
/* Reset all TCPCs. */
void board_reset_pd_mcu(void);
void board_set_tcpc_power_mode(int port, int mode);
+int board_is_clamshell(void);
+int board_has_side_volume_buttons(void);
#endif /* !defined(__ASSEMBLER__) */
diff --git a/board/pazquel/build.mk b/board/pazquel/build.mk
index f130540bd4..3bc07db568 100644
--- a/board/pazquel/build.mk
+++ b/board/pazquel/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/pazquel/ec.tasklist b/board/pazquel/ec.tasklist
index 5beeb38feb..228828af3c 100644
--- a/board/pazquel/ec.tasklist
+++ b/board/pazquel/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pazquel/gpio.inc b/board/pazquel/gpio.inc
index 4ebd09b4ee..8d9a2827bc 100644
--- a/board/pazquel/gpio.inc
+++ b/board/pazquel/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,6 +21,8 @@ GPIO_INT(USB_A0_OC_ODL, PIN(D, 1), GPIO_INT_BOTH | GPIO_PULL_UP, usba_oc_
GPIO_INT(CHG_ACOK_OD, PIN(0, 0), GPIO_INT_BOTH, extpower_interrupt) /* ACOK */
GPIO_INT(CCD_MODE_ODL, PIN(E, 3), GPIO_INT_FALLING, board_connect_c0_sbu) /* Case Closed Debug Mode */
GPIO_INT(EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH, power_button_interrupt) /* Power button */
+GPIO_INT(EC_VOLDN_BTN_ODL, PIN(7, 0), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) /* Volume Down button */
+GPIO_INT(EC_VOLUP_BTN_ODL, PIN(F, 2), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt) /* Volume Up button */
GPIO_INT(EC_WP_ODL, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) /* Write protection */
GPIO_INT(LID_OPEN_EC, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt) /* Lid open */
GPIO_INT(AP_RST_L, PIN(C, 1), GPIO_INT_BOTH | GPIO_SEL_1P8V, chipset_ap_rst_interrupt) /* PMIC to signal AP reset */
@@ -39,7 +41,7 @@ GPIO_INT(AP_EC_SPI_CS_L, PIN(5, 3), GPIO_INT_FALLING | GPIO_PULL_DOWN, shi_cs
/* Sensor interrupts */
GPIO_INT(TABLET_MODE_L, PIN(C, 6), GPIO_INT_BOTH, gmr_tablet_switch_isr)
-GPIO_INT(ACCEL_GYRO_INT_L, PIN(A, 0), GPIO_INT_FALLING, bmi160_interrupt) /* Accelerometer/gyro interrupt */
+GPIO_INT(ACCEL_GYRO_INT_L, PIN(A, 0), GPIO_INT_FALLING, bmi3xx_interrupt) /* Accelerometer/gyro interrupt */
/*
* EC_RST_ODL used to be a wake source from PSL mode. However, we disabled
@@ -157,8 +159,6 @@ UNUSED(PIN(8, 3))
UNUSED(PIN(B, 1))
UNUSED(PIN(5, 0))
UNUSED(PIN(D, 3))
-UNUSED(PIN(7, 0))
-UNUSED(PIN(F, 2))
/* Alternate functions GPIO definitions */
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UART (GPIO64/65) */
diff --git a/board/pazquel/led.c b/board/pazquel/led.c
index aabf33f3f0..180e9829f5 100644
--- a/board/pazquel/led.c
+++ b/board/pazquel/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -31,15 +31,15 @@ enum led_color {
LED_OFF = 0,
LED_RED,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C1,
- (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_W_C1,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -65,7 +65,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
enum led_color color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -105,16 +104,16 @@ static void board_led_set_battery(void)
color = LED_BLUE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Red 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_RED;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Red 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_RED;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/pazquel/usbc_config.c b/board/pazquel/usbc_config.c
index aac136415d..5d30adb6e2 100644
--- a/board/pazquel/usbc_config.c
+++ b/board/pazquel/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "console.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/pdeval-stm32f072/PD_evaluation.md b/board/pdeval-stm32f072/PD_evaluation.md
index 4f1c8636c6..fd4763a849 100644
--- a/board/pdeval-stm32f072/PD_evaluation.md
+++ b/board/pdeval-stm32f072/PD_evaluation.md
@@ -43,12 +43,12 @@ also need to create/delete the corresponding `PD_Cx` tasks in
[board/pdeval-stm32f072/ec.tasklist](ec.tasklist).
By default, the firmware is using I2C1 with SCL/SDA on pins PB6 and PB7, running
-with a 100kHz clock, and tries to talk to TCPCs at i2c slave addresses 0x9c and
+with a 100kHz clock, and tries to talk to TCPCs at i2c target addresses 0x9c and
0x9e. To change the pins or speed, you need to edit `i2c_ports` in
[board/pdeval-stm32f072/board.c](board.c), update `I2C_PORT_TCPC` in
[board/pdeval-stm32f072/board.h](board.h) with the right controller number, and
change the pin mux in [board/pdeval-stm32f072/gpio.inc](gpio.inc). To change
-TCPC i2c slave addresses, update `TCPC1_I2C_ADDR` and `TCPC2_I2C_ADDR` in
+TCPC i2c target addresses, update `TCPC1_I2C_ADDR` and `TCPC2_I2C_ADDR` in
[board/pdeval-stm32f072/board.h](board.h).
The I2C bus needs pull-up resistors on SCL/SDA. If your setup doesn't have
diff --git a/board/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
index 525f14a4af..e1e75bcea7 100644
--- a/board/pdeval-stm32f072/board.c
+++ b/board/pdeval-stm32f072/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,10 +30,10 @@ void alert_event(enum gpio_signal signal)
#include "gpio_list.h"
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("PDeval-stm32f072"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("PDeval-stm32f072"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Shell"),
};
@@ -52,15 +52,11 @@ void board_reset_pd_mcu(void)
}
/* I2C ports */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc",
- .port = I2C_PORT_TCPC,
- .kbps = 400 /* kHz */,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- }
-};
+const struct i2c_port_t i2c_ports[] = { { .name = "tcpc",
+ .port = I2C_PORT_TCPC,
+ .kbps = 400 /* kHz */,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA } };
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
diff --git a/board/pdeval-stm32f072/board.h b/board/pdeval-stm32f072/board.h
index c075772e9f..4cb55573f4 100644
--- a/board/pdeval-stm32f072/board.h
+++ b/board/pdeval-stm32f072/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,6 +15,8 @@
#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 2
+#define CONFIG_LTO
+
/* Optional features */
#define CONFIG_HW_CRC
#define CONFIG_I2C
@@ -32,6 +34,7 @@
#define CONFIG_USB_PD_VBUS_DETECT_TCPC
#define CONFIG_USB_PD_TCPM_ANX7447
#define CONFIG_USB_PD_TCPM_MUX
+#define CONFIG_USBC_SS_MUX
#undef CONFIG_USB_PD_INITIAL_DRP_STATE
#define CONFIG_USB_PD_INITIAL_DRP_STATE PD_DRP_TOGGLE_ON
@@ -40,14 +43,14 @@
#define CONFIG_USB_PD_PULLUP TYPEC_RP_USB
/* fake board specific type-C power constants */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 650000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* I2C master port connected to the TCPC */
#define I2C_PORT_TCPC 0
@@ -66,12 +69,12 @@
/* USB interface indexes (use define rather than enum to expand them) */
#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_COUNT 1
+#define USB_IFACE_COUNT 1
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
#define USB_EP_CONSOLE 1
-#define USB_EP_COUNT 2
+#define USB_EP_COUNT 2
/* Remove console commands / features for flash / RAM savings */
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/pdeval-stm32f072/build.mk b/board/pdeval-stm32f072/build.mk
index 30d5bf8ac8..2238f8f59a 100644
--- a/board/pdeval-stm32f072/build.mk
+++ b/board/pdeval-stm32f072/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/pdeval-stm32f072/ec.tasklist b/board/pdeval-stm32f072/ec.tasklist
index 5003fc7ba1..e897969a55 100644
--- a/board/pdeval-stm32f072/ec.tasklist
+++ b/board/pdeval-stm32f072/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pdeval-stm32f072/gpio.inc b/board/pdeval-stm32f072/gpio.inc
index 5409077c34..fb8537ffbe 100644
--- a/board/pdeval-stm32f072/gpio.inc
+++ b/board/pdeval-stm32f072/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2015 The Chromium OS Authors. All rights reserved.
+ * Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pdeval-stm32f072/openocd-flash.cfg b/board/pdeval-stm32f072/openocd-flash.cfg
index ec32416934..05a697acf8 100644
--- a/board/pdeval-stm32f072/openocd-flash.cfg
+++ b/board/pdeval-stm32f072/openocd-flash.cfg
@@ -1,4 +1,4 @@
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/pdeval-stm32f072/usb_pd_pdo.c b/board/pdeval-stm32f072/usb_pd_pdo.c
index 442e708923..31d84f9785 100644
--- a/board/pdeval-stm32f072/usb_pd_pdo.c
+++ b/board/pdeval-stm32f072/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pdeval-stm32f072/usb_pd_pdo.h b/board/pdeval-stm32f072/usb_pd_pdo.h
index 58fd1f153c..13640a7471 100644
--- a/board/pdeval-stm32f072/usb_pd_pdo.h
+++ b/board/pdeval-stm32f072/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
index b7425ce66c..9ea36a1b0d 100644
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ b/board/pdeval-stm32f072/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2015 The Chromium OS Authors. All rights reserved.
+/* Copyright 2015 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,18 +17,21 @@
#include "usb_pd.h"
#include "usb_pd_pdo.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* Used to fake VBUS presence since no GPIO is available to read VBUS */
static int vbus_present;
-
#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &anx7447_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
};
#endif
@@ -81,8 +84,8 @@ void pd_power_supply_reset(int port)
void pd_set_input_current_limit(int port, uint32_t max_ma,
uint32_t supply_voltage)
{
- CPRINTS("USBPD current limit port %d max %d mA %d mV",
- port, max_ma, supply_voltage);
+ CPRINTS("USBPD current limit port %d max %d mA %d mV", port, max_ma,
+ supply_voltage);
/* do some LED coding of the power we can sink */
if (max_ma) {
if (supply_voltage > 6500)
@@ -98,8 +101,8 @@ void pd_set_input_current_limit(int port, uint32_t max_ma,
__override void typec_set_input_current_limit(int port, uint32_t max_ma,
uint32_t supply_voltage)
{
- CPRINTS("TYPEC current limit port %d max %d mA %d mV",
- port, max_ma, supply_voltage);
+ CPRINTS("TYPEC current limit port %d max %d mA %d mV", port, max_ma,
+ supply_voltage);
gpio_set_level(GPIO_LED_R, !!max_ma);
}
@@ -109,24 +112,21 @@ void button_event(enum gpio_signal signal)
CPRINTS("VBUS %d", vbus_present);
}
-static int command_vbus_toggle(int argc, char **argv)
+static int command_vbus_toggle(int argc, const char **argv)
{
vbus_present = !vbus_present;
CPRINTS("VBUS %d", vbus_present);
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(vbus, command_vbus_toggle,
- "",
- "Toggle VBUS detected");
+DECLARE_CONSOLE_COMMAND(vbus, command_vbus_toggle, "", "Toggle VBUS detected");
int pd_snk_is_vbus_provided(int port)
{
return vbus_present;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Always allow data swap */
return 1;
@@ -144,22 +144,18 @@ int pd_check_vconn_swap(int port)
}
#endif
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
}
/* ----------------- Vendor Defined Messages ------------------ */
const uint32_t vdo_idh = VDO_IDH(1, /* data caps as USB host */
0, /* data caps as USB device */
- IDH_PTYPE_PERIPH,
- 0, /* supports alt modes */
+ IDH_PTYPE_PERIPH, 0, /* supports alt modes */
0x0000);
const uint32_t vdo_product = VDO_PRODUCT(0x0000, 0x0000);
@@ -193,87 +189,62 @@ __override int svdm_dp_config(int port, uint32_t *payload)
{
int opos = pd_alt_mode(port, TCPCI_MSG_SOP, USB_SID_DISPLAYPORT);
int pin_mode = pd_dfp_dp_get_pin_mode(port, dp_status[port]);
- bool unused;
-#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
- const struct usb_mux *mux = &usb_muxes[port];
-#endif
-
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
mux_state_t mux_state = USB_PD_MUX_NONE;
- if (polarity_rm_dts(pd_get_polarity(port)))
- mux_state |= USB_PD_MUX_POLARITY_INVERTED;
-#endif
CPRINTS("pin_mode = %d", pin_mode);
if (!pin_mode)
return 0;
-#if defined(CONFIG_USB_PD_TCPM_MUX) && defined(CONFIG_USB_PD_TCPM_ANX7447)
switch (pin_mode) {
case MODE_DP_PIN_A:
case MODE_DP_PIN_C:
case MODE_DP_PIN_E:
mux_state |= USB_PD_MUX_DP_ENABLED;
- /*
- * Note: Direct mux driver calls are deprecated. Calls
- * should go through the usb_mux APIs instead.
- */
- mux->driver->set(mux, mux_state, &unused);
break;
case MODE_DP_PIN_B:
case MODE_DP_PIN_D:
case MODE_DP_PIN_F:
mux_state |= USB_PD_MUX_DOCK;
- mux->driver->set(mux, mux_state, &unused);
break;
}
-#endif
+ usb_mux_set(port, mux_state, USB_SWITCH_CONNECT,
+ polarity_rm_dts(pd_get_polarity(port)));
/*
* board_set_usb_mux(port, USB_PD_MUX_DP_ENABLED,
* polarity_rm_dts(pd_get_polarity(port)));
*/
- payload[0] = VDO(USB_SID_DISPLAYPORT, 1,
- CMD_DP_CONFIG | VDO_OPOS(opos));
+ payload[0] =
+ VDO(USB_SID_DISPLAYPORT, 1, CMD_DP_CONFIG | VDO_OPOS(opos));
payload[1] = VDO_DP_CFG(pin_mode, /* pin mode */
- 1, /* DPv1.3 signaling */
- 2); /* UFP connected */
+ 1, /* DPv1.3 signaling */
+ 2); /* UFP connected */
return 2;
}
__override void svdm_dp_post_config(int port)
{
- bool unused;
- const struct usb_mux *mux = &usb_muxes[port];
-
dp_flags[port] |= DP_FLAGS_DP_ON;
if (!(dp_flags[port] & DP_FLAGS_HPD_HI_PENDING))
return;
- /* Note: Usage is deprecated, use usb_mux_hpd_update instead */
- if (IS_ENABLED(CONFIG_USB_PD_TCPM_ANX7447))
- anx7447_tcpc_update_hpd_status(mux, USB_PD_MUX_HPD_LVL |
- USB_PD_MUX_HPD_IRQ_DEASSERTED,
- &unused);
+ usb_mux_hpd_update(port,
+ USB_PD_MUX_HPD_LVL | USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
__override int svdm_dp_attention(int port, uint32_t *payload)
{
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
int lvl = PD_VDO_DPSTS_HPD_LVL(payload[1]);
int irq = PD_VDO_DPSTS_HPD_IRQ(payload[1]);
- const struct usb_mux *mux = &usb_muxes[port];
- bool unused;
- mux_state_t mux_state = (lvl ? USB_PD_MUX_HPD_LVL :
- USB_PD_MUX_HPD_LVL_DEASSERTED) |
- (irq ? USB_PD_MUX_HPD_IRQ :
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ mux_state_t mux_state =
+ (lvl ? USB_PD_MUX_HPD_LVL : USB_PD_MUX_HPD_LVL_DEASSERTED) |
+ (irq ? USB_PD_MUX_HPD_IRQ : USB_PD_MUX_HPD_IRQ_DEASSERTED);
/* Note: Usage is deprecated, use usb_mux_hpd_update instead */
CPRINTS("Attention: 0x%x", payload[1]);
- anx7447_tcpc_update_hpd_status(mux, mux_state, &unused);
-#endif
+ usb_mux_hpd_update(port, mux_state);
+
dp_status[port] = payload[1];
/* ack */
@@ -282,8 +253,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
__override void svdm_exit_dp_mode(int port)
{
-#ifdef CONFIG_USB_PD_TCPM_ANX7447
- anx7447_tcpc_clear_hpd_status(port);
-#endif
+ usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
#endif /* CONFIG_USB_PD_ALT_MODE_DFP */
diff --git a/board/phaser/battery.c b/board/phaser/battery.c
index 2e1f77d552..25a0fbce92 100644
--- a/board/phaser/battery.c
+++ b/board/phaser/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 6259ad3cd7..6ebaab0b4a 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -6,6 +6,7 @@
/* Phaser board-specific configuration */
#include "adc.h"
+#include "builtin/stdnoreturn.h"
#include "button.h"
#include "charge_state.h"
#include "common.h"
@@ -34,11 +35,11 @@
#include "util.h"
#include "battery_smart.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX7447 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
static uint8_t sku_id;
static bool support_syv_ppc;
@@ -85,31 +86,31 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
/* Vbus sensing (1/10 voltage divider). */
- [ADC_VBUS_C0] = {
- "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
- [ADC_VBUS_C1] = {
- "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS_C0] = { "VBUS_C0", NPCX_ADC_CH9, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_VBUS_C1] = { "VBUS_C1", NPCX_ADC_CH4, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -119,11 +120,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate lid and base sensor into standard reference frame */
-const mat33_fp_t standard_rot_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t standard_rot_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct stprivate_data g_lis2dh_data;
@@ -212,8 +211,8 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
static int board_is_convertible(void)
{
- return sku_id == 2 || sku_id == 3 || sku_id == 4 || sku_id == 5 || \
- sku_id == 255;
+ return sku_id == 2 || sku_id == 3 || sku_id == 4 || sku_id == 5 ||
+ sku_id == 255;
}
static void board_update_sensor_config_from_sku(void)
@@ -331,7 +330,7 @@ void board_hibernate_late(void)
}
/* Clear all pending IRQ otherwise wfi will have no affect */
- for (i = NPCX_IRQ_0 ; i < NPCX_IRQ_COUNT ; i++)
+ for (i = NPCX_IRQ_0; i < NPCX_IRQ_COUNT; i++)
task_clear_pending_irq(i);
__enter_hibernate_in_psl();
@@ -358,11 +357,11 @@ int board_is_lid_angle_tablet_mode(void)
}
/* Battery functions */
-#define SB_OPTIONALMFG_FUNCTION2 0x3e
+#define SB_OPTIONALMFG_FUNCTION2 0x3e
/* Optional mfg function2 */
-#define SMART_QUICK_CHARGE (1<<12)
+#define SMART_QUICK_CHARGE (1 << 12)
/* Quick charge support */
-#define MODE_QUICK_CHARGE_SUPPORT (1<<4)
+#define MODE_QUICK_CHARGE_SUPPORT (1 << 4)
static void sb_quick_charge_mode(int enable)
{
@@ -411,15 +410,15 @@ void board_overcurrent_event(int port, int is_overcurrented)
}
static const struct ppc_config_t ppc_syv682x_port0 = {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static const struct ppc_config_t ppc_syv682x_port1 = {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
- .drv = &syv682x_drv,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
};
static void board_setup_ppc(void)
@@ -427,12 +426,10 @@ static void board_setup_ppc(void)
if (!support_syv_ppc)
return;
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_0],
- &ppc_syv682x_port0,
- sizeof(struct ppc_config_t));
- memcpy(&ppc_chips[USB_PD_PORT_TCPC_1],
- &ppc_syv682x_port1,
- sizeof(struct ppc_config_t));
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_0], &ppc_syv682x_port0,
+ sizeof(struct ppc_config_t));
+ memcpy(&ppc_chips[USB_PD_PORT_TCPC_1], &ppc_syv682x_port1,
+ sizeof(struct ppc_config_t));
gpio_set_flags(GPIO_USB_PD_C0_INT_ODL, GPIO_INT_BOTH);
gpio_set_flags(GPIO_USB_PD_C1_INT_ODL, GPIO_INT_BOTH);
diff --git a/board/phaser/board.h b/board/phaser/board.h
index a03782b245..54f3cf3b32 100644
--- a/board/phaser/board.h
+++ b/board/phaser/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,8 +44,8 @@
#define CONFIG_CMD_ACCEL_INFO
/* Sensors */
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -60,8 +60,8 @@
/* Additional PPC second source */
#define CONFIG_USBC_PPC_SYV682X
-#define CONFIG_USBC_PPC_DEDICATED_INT
-#undef CONFIG_SYV682X_HV_ILIM
+#define CONFIG_USBC_PPC_DEDICATED_INT
+#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* SYV682 isn't connected to CC, so TCPC must provide VCONN */
#define CONFIG_USBC_PPC_SYV682X_NO_CC
@@ -72,10 +72,10 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
- ADC_VBUS_C0, /* ADC9 */
- ADC_VBUS_C1, /* ADC4 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_VBUS_C0, /* ADC9 */
+ ADC_VBUS_C1, /* ADC4 */
ADC_CH_COUNT,
};
@@ -86,18 +86,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/phaser/build.mk b/board/phaser/build.mk
index 3d04b75731..998a65a3de 100644
--- a/board/phaser/build.mk
+++ b/board/phaser/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/phaser/ec.tasklist b/board/phaser/ec.tasklist
index d98db145e7..977b8b01be 100644
--- a/board/phaser/ec.tasklist
+++ b/board/phaser/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/phaser/gpio.inc b/board/phaser/gpio.inc
index 639ed914b6..c6d2be7fc6 100644
--- a/board/phaser/gpio.inc
+++ b/board/phaser/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/phaser/led.c b/board/phaser/led.c
index cce1c3289e..998b948804 100644
--- a/board/phaser/led.c
+++ b/board/phaser/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,32 +19,35 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/pico/battery.c b/board/pico/battery.c
index 6f6b49899a..5e1671f5f3 100644
--- a/board/pico/battery.c
+++ b/board/pico/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pico/board.c b/board/pico/board.c
index 093a34d54d..f884545b6d 100644
--- a/board/pico/board.c
+++ b/board/pico/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,6 +28,7 @@
#include "i2c.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -43,8 +44,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#include "gpio_list.h"
@@ -55,17 +56,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -171,18 +168,21 @@ int board_sensor_at_360(void)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {-1, -1}, {-1, -1},
- {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6}, {-1, -1}, {GPIO_KSO_L, 3},
- {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1}, {GPIO_KSO_L, 4},
- {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0}, {GPIO_KSI, 5},
- {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6}, {GPIO_KSI, 7},
- {GPIO_KSI, 1}, {-1, -1}, {GPIO_KSO_H, 5}, {-1, -1},
- {GPIO_KSO_H, 6}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { GPIO_KSO_H, 4 }, { GPIO_KSO_H, 0 },
+ { GPIO_KSO_H, 1 }, { GPIO_KSO_H, 3 }, { GPIO_KSO_H, 2 },
+ { -1, -1 }, { -1, -1 }, { GPIO_KSO_L, 5 },
+ { GPIO_KSO_L, 6 }, { -1, -1 }, { GPIO_KSO_L, 3 },
+ { GPIO_KSO_L, 2 }, { GPIO_KSI, 0 }, { GPIO_KSO_L, 1 },
+ { GPIO_KSO_L, 4 }, { GPIO_KSI, 3 }, { GPIO_KSI, 2 },
+ { GPIO_KSO_L, 0 }, { GPIO_KSI, 5 }, { GPIO_KSI, 4 },
+ { GPIO_KSO_L, 7 }, { GPIO_KSI, 6 }, { GPIO_KSI, 7 },
+ { GPIO_KSI, 1 }, { -1, -1 }, { GPIO_KSO_H, 5 },
+ { -1, -1 }, { GPIO_KSO_H, 6 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/* Wake-up pins for hibernate */
const enum gpio_signal hibernate_wake_pins[] = {
@@ -195,39 +195,33 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH1},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH2},
- [ADC_VBUS] = {"VBUS", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH0},
+ [ADC_BOARD_ID] = { "BOARD_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH1 },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH2 },
+ [ADC_VBUS] = { "VBUS", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = IT83XX_I2C_CH_C,
- .kbps = 400,
- .scl = GPIO_I2C_C_SCL,
- .sda = GPIO_I2C_C_SDA
- },
- {
- .name = "sensor",
- .port = IT83XX_I2C_CH_B,
- .kbps = 400,
- .scl = GPIO_I2C_B_SCL,
- .sda = GPIO_I2C_B_SDA
- },
- {
- .name = "battery",
- .port = IT83XX_I2C_CH_A,
- .kbps = 100,
- .scl = GPIO_I2C_A_SCL,
- .sda = GPIO_I2C_A_SDA
- },
+ { .name = "typec",
+ .port = IT83XX_I2C_CH_C,
+ .kbps = 400,
+ .scl = GPIO_I2C_C_SCL,
+ .sda = GPIO_I2C_C_SDA },
+ { .name = "sensor",
+ .port = IT83XX_I2C_CH_B,
+ .kbps = 400,
+ .scl = GPIO_I2C_B_SCL,
+ .sda = GPIO_I2C_B_SDA },
+ { .name = "battery",
+ .port = IT83XX_I2C_CH_A,
+ .kbps = 100,
+ .scl = GPIO_I2C_A_SCL,
+ .sda = GPIO_I2C_A_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -235,8 +229,8 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -259,8 +253,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -273,13 +266,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -324,12 +320,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -401,8 +397,7 @@ static void board_motion_init(void)
/* Disable tablet mode. */
tablet_set_mode(0, TABLET_TRIGGER_LID);
gmr_tablet_switch_disable();
- gpio_set_flags(GPIO_TABLET_MODE_L,
- GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_TABLET_MODE_L, GPIO_INPUT | GPIO_PULL_UP);
}
}
DECLARE_HOOK(HOOK_INIT, board_motion_init, HOOK_PRIO_DEFAULT + 1);
diff --git a/board/pico/board.h b/board/pico/board.h
index 6e1fe1d964..665cf59691 100644
--- a/board/pico/board.h
+++ b/board/pico/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,7 +50,7 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -68,14 +68,14 @@
#endif /* !VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 IT83XX_I2C_CH_C
-#define I2C_PORT_TCPC0 IT83XX_I2C_CH_C
-#define I2C_PORT_USB_MUX IT83XX_I2C_CH_C
-#define I2C_PORT_CHARGER IT83XX_I2C_CH_A
-#define I2C_PORT_SENSORS IT83XX_I2C_CH_B
-#define I2C_PORT_ACCEL I2C_PORT_SENSORS
-#define I2C_PORT_BATTERY IT83XX_I2C_CH_A
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 IT83XX_I2C_CH_C
+#define I2C_PORT_TCPC0 IT83XX_I2C_CH_C
+#define I2C_PORT_USB_MUX IT83XX_I2C_CH_C
+#define I2C_PORT_CHARGER IT83XX_I2C_CH_A
+#define I2C_PORT_SENSORS IT83XX_I2C_CH_B
+#define I2C_PORT_ACCEL I2C_PORT_SENSORS
+#define I2C_PORT_BATTERY IT83XX_I2C_CH_A
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
@@ -129,7 +129,7 @@ enum battery_type {
/* support factory keyboard test */
#define CONFIG_KEYBOARD_FACTORY_TEST
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
extern const int keyboard_factory_scan_pins[][2];
extern const int keyboard_factory_scan_pins_used;
diff --git a/board/pico/build.mk b/board/pico/build.mk
index 9ca7933e2a..a1ca27116e 100644
--- a/board/pico/build.mk
+++ b/board/pico/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/pico/ec.tasklist b/board/pico/ec.tasklist
index 5c272d04f4..883033408a 100644
--- a/board/pico/ec.tasklist
+++ b/board/pico/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pico/gpio.inc b/board/pico/gpio.inc
index 34ac5cf7af..359e25451e 100644
--- a/board/pico/gpio.inc
+++ b/board/pico/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pico/led.c b/board/pico/led.c
index 076199b2ed..bbbad7ceb8 100644
--- a/board/pico/led.c
+++ b/board/pico/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,22 +14,27 @@
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
{
diff --git a/board/pirika/battery.c b/board/pirika/battery.c
index 2da3296106..f753eba554 100644
--- a/board/pirika/battery.c
+++ b/board/pirika/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/pirika/board.c b/board/pirika/board.c
index 7a21d632d2..8913ec0f07 100644
--- a/board/pirika/board.c
+++ b/board/pirika/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -104,8 +104,8 @@ static const struct ec_response_keybd_config pasara_kb = {
},
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (get_cbi_fw_config_numeric_pad() == NUMERIC_PAD_ABSENT)
return &pirika_kb;
@@ -188,34 +188,26 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -275,40 +267,31 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Retimer */
-enum tusb544_conf {
- USB_DP = 0,
- USB_DP_INV,
- USB,
- USB_INV,
- DP,
- DP_INV
-};
+enum tusb544_conf { USB_DP = 0, USB_DP_INV, USB, USB_INV, DP, DP_INV };
-static int board_tusb544_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
{
- int rv = EC_SUCCESS;
+ int rv = EC_SUCCESS;
enum tusb544_conf usb_mode = 0;
/* USB */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* USB with DP */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_DP_INV
- : USB_DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_DP_INV :
+ USB_DP;
}
/* USB without DP */
else {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_INV
- : USB;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_INV :
+ USB;
}
}
/* DP without USB */
else if (mux_state & USB_PD_MUX_DP_ENABLED) {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? DP_INV
- : DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? DP_INV :
+ DP;
}
/* Nothing enabled */
else
@@ -377,28 +360,37 @@ static int board_tusb544_set(const struct usb_mux *me,
return rv;
}
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
- .driver = &tusb544_drv,
- .board_set = &board_tusb544_set,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
+ .driver = &tusb544_drv,
+ .board_set = &board_tusb544_set,
+ },
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
},
};
@@ -521,8 +513,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -584,12 +575,10 @@ int board_set_active_charge_port(int port)
charger_discharge_on_ac(0);
return EC_SUCCESS;
-
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -622,7 +611,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Sensor Data */
-static struct kionix_accel_data g_kx022_data;
+static struct kionix_accel_data g_kx022_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Drivers */
@@ -702,26 +691,26 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Vcore",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Vcore",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -735,8 +724,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_VCORE \
- { \
+#define THERMAL_VCORE \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -750,8 +739,8 @@ __maybe_unused static const struct ec_thermal_config thermal_vcore =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_AMBIENT \
- { \
+#define THERMAL_AMBIENT \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
diff --git a/board/pirika/board.h b/board/pirika/board.h
index 932653e1ae..c8e2f3eb35 100644
--- a/board/pirika/board.h
+++ b/board/pirika/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,15 @@
#define CONFIG_BC12_DETECT_PI3USB9201
/* Charger */
-#define CONFIG_CHARGER_RAA489000 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_RAA489000 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -38,14 +41,14 @@
/* LED */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* PWM */
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
@@ -83,10 +86,10 @@
#define CONFIG_CHIPSET_CAN_THROTTLE
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
-#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
+#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
/* Keyboard */
#define CONFIG_KEYBOARD_VIVALDI
@@ -110,19 +113,14 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
ADC_CH_COUNT
};
diff --git a/board/pirika/build.mk b/board/pirika/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/pirika/build.mk
+++ b/board/pirika/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/pirika/cbi_ssfc.c b/board/pirika/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/pirika/cbi_ssfc.c
+++ b/board/pirika/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/pirika/cbi_ssfc.h b/board/pirika/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/pirika/cbi_ssfc.h
+++ b/board/pirika/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/pirika/ec.tasklist b/board/pirika/ec.tasklist
index d6fa610141..f7c32f66bf 100644
--- a/board/pirika/ec.tasklist
+++ b/board/pirika/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pirika/gpio.inc b/board/pirika/gpio.inc
index 90e6de2607..5ec1003a70 100644
--- a/board/pirika/gpio.inc
+++ b/board/pirika/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pirika/led.c b/board/pirika/led.c
index 2fe70f5fe8..916f691dd6 100644
--- a/board/pirika/led.c
+++ b/board/pirika/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,28 +9,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {LED_OFF, 2 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { LED_OFF, 2 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/pirika/usb_pd_policy.c b/board/pirika/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/pirika/usb_pd_policy.c
+++ b/board/pirika/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/plankton/board.c b/board/plankton/board.c
index 5a62f63c86..2bf57084ce 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -78,14 +78,12 @@ void hpd_lvl_deferred(void)
/* Configure redriver's back side */
if (level)
sn75dp130_dpcd_init();
-
}
/* Send queued IRQ if the cable is attached */
if (hpd_possible_irq && level && dp_mode)
pd_send_hpd(0, hpd_irq);
hpd_possible_irq = 0;
-
}
DECLARE_DEFERRED(hpd_lvl_deferred);
@@ -103,8 +101,7 @@ void hpd_event(enum gpio_signal signal)
hpd_prev_ts = now.val;
/* All previous hpd level events need to be re-triggered */
- hook_call_deferred(&hpd_lvl_deferred_data,
- HPD_USTREAM_DEBOUNCE_LVL);
+ hook_call_deferred(&hpd_lvl_deferred_data, HPD_USTREAM_DEBOUNCE_LVL);
}
/* Debounce time for voltage buttons */
@@ -134,8 +131,7 @@ enum usbc_action {
USBC_ACT_COUNT
};
-enum board_src_cap src_cap_mapping[USBC_ACT_COUNT] =
-{
+enum board_src_cap src_cap_mapping[USBC_ACT_COUNT] = {
[USBC_ACT_5V_TO_DUT] = SRC_CAP_5V,
[USBC_ACT_12V_TO_DUT] = SRC_CAP_12V,
[USBC_ACT_20V_TO_DUT] = SRC_CAP_20V,
@@ -155,21 +151,21 @@ static void set_active_cc(int cc)
* disabled then only set the active CC line.
*/
/* Pull-up on CC2 */
- gpio_set_flags(GPIO_USBC_CC2_HOST,
- ((cc || drp_enable) && host_mode) ?
- GPIO_OUT_HIGH : GPIO_INPUT);
+ gpio_set_flags(GPIO_USBC_CC2_HOST, ((cc || drp_enable) && host_mode) ?
+ GPIO_OUT_HIGH :
+ GPIO_INPUT);
/* Pull-down on CC2 */
gpio_set_flags(GPIO_USBC_CC2_DEVICE_ODL,
- ((cc || drp_enable) && !host_mode) ?
- GPIO_OUT_LOW : GPIO_INPUT);
+ ((cc || drp_enable) && !host_mode) ? GPIO_OUT_LOW :
+ GPIO_INPUT);
/* Pull-up on CC1 */
- gpio_set_flags(GPIO_USBC_CC1_HOST,
- ((!cc || drp_enable) && host_mode) ?
- GPIO_OUT_HIGH : GPIO_INPUT);
+ gpio_set_flags(GPIO_USBC_CC1_HOST, ((!cc || drp_enable) && host_mode) ?
+ GPIO_OUT_HIGH :
+ GPIO_INPUT);
/* Pull-down on CC1 */
gpio_set_flags(GPIO_USBC_CC1_DEVICE_ODL,
- ((!cc || drp_enable) && !host_mode) ?
- GPIO_OUT_LOW : GPIO_INPUT);
+ ((!cc || drp_enable) && !host_mode) ? GPIO_OUT_LOW :
+ GPIO_INPUT);
}
/**
@@ -221,7 +217,7 @@ static void fake_disconnect_end(void)
board_pd_set_host_mode(fake_pd_host_mode);
/* Restart CC cable detection */
- hook_call_deferred(&detect_cc_cable_data, 500*MSEC);
+ hook_call_deferred(&detect_cc_cable_data, 500 * MSEC);
}
DECLARE_DEFERRED(fake_disconnect_end);
@@ -361,10 +357,10 @@ static void set_usbc_action(enum usbc_action act)
gpio_set_level(GPIO_CASE_CLOSE_EN, 1);
gpio_set_level(GPIO_CASE_CLOSE_DFU_L, 1);
break;
- case USBC_ACT_DRP_TOGGLE:
+ case USBC_ACT_DRP_TOGGLE:
/* Toggle dualrole mode setting. */
- update_usbc_dual_role(drp_enable ?
- PD_DRP_TOGGLE_OFF : PD_DRP_TOGGLE_ON);
+ update_usbc_dual_role(drp_enable ? PD_DRP_TOGGLE_OFF :
+ PD_DRP_TOGGLE_ON);
break;
default:
break;
@@ -424,8 +420,8 @@ static void button_deferred(void)
break;
}
- ccprintf("Button %d = %d\n",
- button_pressed, gpio_get_level(button_pressed));
+ ccprintf("Button %d = %d\n", button_pressed,
+ gpio_get_level(button_pressed));
}
DECLARE_DEFERRED(button_deferred);
@@ -453,20 +449,18 @@ void vbus_event(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CH_CC1_PD] = {"CC1_PD", 3300, 4096, 0, STM32_AIN(0)},
- [ADC_CH_CC2_PD] = {"CC2_PD", 3300, 4096, 0, STM32_AIN(4)},
+ [ADC_CH_CC1_PD] = { "CC1_PD", 3300, 4096, 0, STM32_AIN(0) },
+ [ADC_CH_CC2_PD] = { "CC2_PD", 3300, 4096, 0, STM32_AIN(4) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -476,12 +470,12 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
* Pin number for active-high reset from PCA9534 to CMOS pull-down to
* SN75DP130's RSTN (active-low)
*/
-#define REDRIVER_RST_PIN 0x1
+#define REDRIVER_RST_PIN 0x1
static int sn75dp130_i2c_write(uint8_t index, uint8_t value)
{
- return i2c_write8(I2C_PORT_MASTER, SN75DP130_I2C_ADDR_FLAGS,
- index, value);
+ return i2c_write8(I2C_PORT_MASTER, SN75DP130_I2C_ADDR_FLAGS, index,
+ value);
}
/**
@@ -494,17 +488,15 @@ static int sn75dp130_reset(void)
{
int rv;
- rv = pca9534_config_pin(I2C_PORT_MASTER, 0x20,
- REDRIVER_RST_PIN, PCA9534_OUTPUT);
+ rv = pca9534_config_pin(I2C_PORT_MASTER, 0x20, REDRIVER_RST_PIN,
+ PCA9534_OUTPUT);
/* Assert (its active high) */
- rv |= pca9534_set_level(I2C_PORT_MASTER, 0x20,
- REDRIVER_RST_PIN, 1);
+ rv |= pca9534_set_level(I2C_PORT_MASTER, 0x20, REDRIVER_RST_PIN, 1);
/* datasheet recommends > 100usec */
usleep(200);
/* De-assert */
- rv |= pca9534_set_level(I2C_PORT_MASTER, 0x20,
- REDRIVER_RST_PIN, 0);
+ rv |= pca9534_set_level(I2C_PORT_MASTER, 0x20, REDRIVER_RST_PIN, 0);
/* datasheet recommends > 400msec */
usleep(450 * MSEC);
return rv;
@@ -555,7 +547,7 @@ static int sn75dp130_redriver_init(void)
return rv;
}
-static int cmd_usbc_action(int argc, char *argv[])
+static int cmd_usbc_action(int argc, const char *argv[])
{
enum usbc_action act;
@@ -600,12 +592,10 @@ int board_in_hub_mode(void)
int ret;
int level;
- ret = pca9534_config_pin(I2C_PORT_MASTER, 0x20,
- 6, PCA9534_INPUT);
+ ret = pca9534_config_pin(I2C_PORT_MASTER, 0x20, 6, PCA9534_INPUT);
if (ret)
return -1;
- ret = pca9534_get_level(I2C_PORT_MASTER, 0x20,
- 6, &level);
+ ret = pca9534_get_level(I2C_PORT_MASTER, 0x20, 6, &level);
if (ret)
return -1;
return level;
@@ -615,17 +605,14 @@ static int board_usb_hub_reset(void)
{
int ret;
- ret = pca9534_config_pin(I2C_PORT_MASTER, 0x20,
- 7, PCA9534_OUTPUT);
+ ret = pca9534_config_pin(I2C_PORT_MASTER, 0x20, 7, PCA9534_OUTPUT);
if (ret)
return ret;
- ret = pca9534_set_level(I2C_PORT_MASTER, 0x20,
- 7, 0);
+ ret = pca9534_set_level(I2C_PORT_MASTER, 0x20, 7, 0);
if (ret)
return ret;
usleep(100 * MSEC);
- return pca9534_set_level(I2C_PORT_MASTER, 0x20,
- 7, 1);
+ return pca9534_set_level(I2C_PORT_MASTER, 0x20, 7, 1);
}
void board_maybe_reset_usb_hub(void)
@@ -634,12 +621,11 @@ void board_maybe_reset_usb_hub(void)
board_usb_hub_reset();
}
-static int cmd_usb_hub_reset(int argc, char *argv[])
+static int cmd_usb_hub_reset(int argc, const char *argv[])
{
return board_usb_hub_reset();
}
-DECLARE_CONSOLE_COMMAND(hub_reset, cmd_usb_hub_reset,
- NULL, "Reset USB hub");
+DECLARE_CONSOLE_COMMAND(hub_reset, cmd_usb_hub_reset, NULL, "Reset USB hub");
static void board_usb_hub_reset_no_return(void)
{
@@ -668,7 +654,7 @@ int board_fake_pd_adc_read(int cc)
* on other CC line. */
if (active_cc == cc)
return adc_read_channel(cc ? ADC_CH_CC2_PD :
- ADC_CH_CC1_PD);
+ ADC_CH_CC1_PD);
else
return host_mode ? 3000 : 0;
}
@@ -754,7 +740,7 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-static int cmd_fake_disconnect(int argc, char *argv[])
+static int cmd_fake_disconnect(int argc, const char *argv[])
{
int delay_ms, duration_ms;
char *e;
@@ -776,8 +762,8 @@ static int cmd_fake_disconnect(int argc, char *argv[])
fake_pd_disconnect_duration_us = duration_ms * MSEC;
hook_call_deferred(&fake_disconnect_start_data, delay_ms * MSEC);
- ccprintf("Fake disconnect for %d ms starting in %d ms.\n",
- duration_ms, delay_ms);
+ ccprintf("Fake disconnect for %d ms starting in %d ms.\n", duration_ms,
+ delay_ms);
return EC_SUCCESS;
}
@@ -791,7 +777,7 @@ static void trigger_dfu_release(void)
}
DECLARE_DEFERRED(trigger_dfu_release);
-static int cmd_trigger_dfu(int argc, char *argv[])
+static int cmd_trigger_dfu(int argc, const char *argv[])
{
gpio_set_level(GPIO_CASE_CLOSE_DFU_L, 0);
ccprintf("Asserting CASE_CLOSE_DFU_L.\n");
diff --git a/board/plankton/board.h b/board/plankton/board.h
index 39ab706cd2..224364269b 100644
--- a/board/plankton/board.h
+++ b/board/plankton/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -58,7 +58,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -77,18 +77,18 @@ enum board_src_cap {
};
/* 3.0A Rp */
-#define PD_SRC_VNC PD_SRC_3_0_VNC_MV
-#define PD_SNK_RD_THRESHOLD PD_SRC_3_0_RD_THRESH_MV
+#define PD_SRC_VNC PD_SRC_3_0_VNC_MV
+#define PD_SNK_RD_THRESHOLD PD_SRC_3_0_RD_THRESH_MV
/* delay necessary for the voltage transition on the power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 5000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Set USB PD source capability */
void board_set_source_cap(enum board_src_cap cap);
diff --git a/board/plankton/build.mk b/board/plankton/build.mk
index 662be139c7..0e597a478f 100644
--- a/board/plankton/build.mk
+++ b/board/plankton/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/plankton/ec.tasklist b/board/plankton/ec.tasklist
index 41fc047d6a..5a82344122 100644
--- a/board/plankton/ec.tasklist
+++ b/board/plankton/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/plankton/gpio.inc b/board/plankton/gpio.inc
index 9c618dbaa6..edccec814c 100644
--- a/board/plankton/gpio.inc
+++ b/board/plankton/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/plankton/usb_pd_config.h b/board/plankton/usb_pd_config.h
index fca6484069..47614c3fce 100644
--- a/board/plankton/usb_pd_config.h
+++ b/board/plankton/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,7 +50,7 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
#define EXTI_COMP_MASK(p) BIT(21)
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -92,9 +92,8 @@ static inline void pd_tx_disable(int port, int polarity)
{
/* output low on SPI TX to disable the FET */
/* PA6 is SPI1_MISO */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*6)))
- | (1 << (2*6));
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2 * 6))) | (1 << (2 * 6));
/* put the low level reference in Hi-Z */
gpio_set_level(GPIO_USBC_CC1_TX_EN, 0);
gpio_set_level(GPIO_USBC_CC2_TX_EN, 0);
@@ -104,11 +103,10 @@ static inline void pd_tx_disable(int port, int polarity)
static inline void pd_select_polarity(int port, int polarity)
{
/* use the right comparator non inverted input for COMP1 */
- STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK)
- | STM32_COMP_CMP1EN
- | (polarity ?
- STM32_COMP_CMP1INSEL_INM4 :
- STM32_COMP_CMP1INSEL_INM6);
+ STM32_COMP_CSR = (STM32_COMP_CSR & ~STM32_COMP_CMP1INSEL_MASK) |
+ STM32_COMP_CMP1EN |
+ (polarity ? STM32_COMP_CMP1INSEL_INM4 :
+ STM32_COMP_CMP1INSEL_INM6);
gpio_set_level(GPIO_USBC_POLARITY, polarity);
}
diff --git a/board/plankton/usb_pd_pdo.c b/board/plankton/usb_pd_pdo.c
index f51a40abdc..52dcc11352 100644
--- a/board/plankton/usb_pd_pdo.c
+++ b/board/plankton/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -7,28 +7,28 @@
#include "usb_pd.h"
#include "usb_pd_pdo.h"
-#define PDO_FIXED_FLAGS (PDO_FIXED_DATA_SWAP | PDO_FIXED_UNCONSTRAINED |\
- PDO_FIXED_COMM_CAP)
+#define PDO_FIXED_FLAGS \
+ (PDO_FIXED_DATA_SWAP | PDO_FIXED_UNCONSTRAINED | PDO_FIXED_COMM_CAP)
/* Source PDOs */
const uint32_t pd_src_pdo[] = {
- PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
- PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS),
- PDO_FIXED(20000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(20000, 3000, PDO_FIXED_FLAGS),
};
/* Fake PDOs : we just want our pre-defined voltages */
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
- PDO_FIXED(12000, 500, PDO_FIXED_FLAGS),
- PDO_FIXED(20000, 500, PDO_FIXED_FLAGS),
+ PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
+ PDO_FIXED(12000, 500, PDO_FIXED_FLAGS),
+ PDO_FIXED(20000, 500, PDO_FIXED_FLAGS),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
static const int pd_src_pdo_cnts[] = {
- [SRC_CAP_5V] = 1,
- [SRC_CAP_12V] = 2,
- [SRC_CAP_20V] = 3,
+ [SRC_CAP_5V] = 1,
+ [SRC_CAP_12V] = 2,
+ [SRC_CAP_20V] = 3,
};
static int pd_src_pdo_idx;
diff --git a/board/plankton/usb_pd_pdo.h b/board/plankton/usb_pd_pdo.h
index 20e8976348..030dab9287 100644
--- a/board/plankton/usb_pd_pdo.h
+++ b/board/plankton/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/plankton/usb_pd_policy.c b/board/plankton/usb_pd_policy.c
index 238f2297f5..355919e06a 100644
--- a/board/plankton/usb_pd_policy.c
+++ b/board/plankton/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,8 +18,8 @@
#include "usb_pd_pdo.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* Acceptable margin between requested VBUS and measured value */
#define MARGIN_MV 400 /* mV */
@@ -27,7 +27,6 @@
/* Whether alternate mode has been entered or not */
static int alt_mode;
-
void pd_set_input_current_limit(int port, uint32_t max_ma,
uint32_t supply_voltage)
{
@@ -77,22 +76,18 @@ __override int pd_check_power_swap(int port)
return 1;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Always allow data swap */
return 1;
}
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
/* If Plankton is in USB hub mode, always act as UFP */
if (board_in_hub_mode() && dr_role == PD_ROLE_DFP &&
@@ -110,8 +105,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
- CONFIG_USB_PD_IDENTITY_SW_VERS,
- 0, 0, 0, 0, /* SS[TR][12] */
+ CONFIG_USB_PD_IDENTITY_SW_VERS, 0, 0, 0,
+ 0, /* SS[TR][12] */
0, /* Vconn power */
0, /* Vconn power required */
1, /* Vbus power required */
@@ -139,13 +134,13 @@ static int svdm_response_svids(int port, uint32_t *payload)
#define MODE_CNT 1
#define OPOS 1
-const uint32_t vdo_dp_mode[MODE_CNT] = {
- VDO_MODE_DP(0, /* UFP pin cfg supported : none */
+const uint32_t vdo_dp_mode[MODE_CNT] = {
+ VDO_MODE_DP(0, /* UFP pin cfg supported : none */
MODE_DP_PIN_E, /* DFP pin cfg supported */
- 1, /* no usb2.0 signalling in AMode */
- CABLE_PLUG, /* its a plug */
- MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
- MODE_DP_SNK) /* Its a sink only */
+ 1, /* no usb2.0 signalling in AMode */
+ CABLE_PLUG, /* its a plug */
+ MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
+ MODE_DP_SNK) /* Its a sink only */
};
static int svdm_response_modes(int port, uint32_t *payload)
@@ -167,13 +162,13 @@ static int dp_status(int port, uint32_t *payload)
if (opos != OPOS)
return 0; /* nak */
- payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
- (hpd == 1), /* HPD_HI|LOW */
- 0, /* request exit DP */
- 0, /* request exit USB */
- 0, /* MF pref */
+ payload[1] = VDO_DP_STATUS(0, /* IRQ_HPD */
+ (hpd == 1), /* HPD_HI|LOW */
+ 0, /* request exit DP */
+ 0, /* request exit USB */
+ 0, /* MF pref */
!gpio_get_level(GPIO_USBC_SS_USB_MODE),
- 0, /* power low */
+ 0, /* power low */
0x2);
return 2;
}
diff --git a/board/polyberry/board.c b/board/polyberry/board.c
index 5bb811f82c..f9fdd44ff8 100644
--- a/board/polyberry/board.c
+++ b/board/polyberry/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,13 +24,13 @@
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Polyberry"),
- [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Polyberry EC Shell"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Polyberry"),
+ [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Polyberry EC Shell"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -47,15 +47,15 @@ struct dwc_usb usb_ctl = {
.irq = STM32_IRQ_OTG_HS,
};
-#define GPIO_SET_HS(bank, number) \
- (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number) * 2)))
+#define GPIO_SET_HS(bank, number) \
+ (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number)*2)))
void board_config_post_gpio_init(void)
{
/* We use MCO2 clock passthrough to provide a clock to USB HS */
gpio_config_module(MODULE_MCO, 1);
/* GPIO PC9 to high speed */
- GPIO_SET_HS(C, 9);
+ GPIO_SET_HS(C, 9);
if (usb_ctl.phy_type == USB_PHY_ULPI)
gpio_set_level(GPIO_USB_MUX_SEL, 0);
@@ -66,19 +66,19 @@ void board_config_post_gpio_init(void)
GPIO_SET_HS(A, 11);
GPIO_SET_HS(A, 12);
- GPIO_SET_HS(C, 3);
- GPIO_SET_HS(C, 2);
- GPIO_SET_HS(C, 0);
- GPIO_SET_HS(A, 5);
+ GPIO_SET_HS(C, 3);
+ GPIO_SET_HS(C, 2);
+ GPIO_SET_HS(C, 0);
+ GPIO_SET_HS(A, 5);
- GPIO_SET_HS(B, 5);
+ GPIO_SET_HS(B, 5);
GPIO_SET_HS(B, 13);
GPIO_SET_HS(B, 12);
- GPIO_SET_HS(B, 2);
+ GPIO_SET_HS(B, 2);
GPIO_SET_HS(B, 10);
- GPIO_SET_HS(B, 1);
- GPIO_SET_HS(B, 0);
- GPIO_SET_HS(A, 3);
+ GPIO_SET_HS(B, 1);
+ GPIO_SET_HS(B, 0);
+ GPIO_SET_HS(A, 3);
}
static void board_init(void)
diff --git a/board/polyberry/board.h b/board/polyberry/board.h
index 8e55967bf5..41069f2722 100644
--- a/board/polyberry/board.h
+++ b/board/polyberry/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,15 +44,15 @@
#define DEFAULT_SERIALNO "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_UPDATE 1
-#define USB_IFACE_COUNT 2
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_UPDATE 1
+#define USB_IFACE_COUNT 2
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_UPDATE 2
-#define USB_EP_COUNT 3
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_UPDATE 2
+#define USB_EP_COUNT 3
/* This is not actually a Chromium EC so disable some features. */
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/polyberry/build.mk b/board/polyberry/build.mk
index 6b06f2bb8f..61e4b79d47 100644
--- a/board/polyberry/build.mk
+++ b/board/polyberry/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/polyberry/ec.tasklist b/board/polyberry/ec.tasklist
index c1fb169118..c45a1e89a7 100644
--- a/board/polyberry/ec.tasklist
+++ b/board/polyberry/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/polyberry/gpio.inc b/board/polyberry/gpio.inc
index 536dccc5ff..d862155c4d 100644
--- a/board/polyberry/gpio.inc
+++ b/board/polyberry/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pompom/battery.c b/board/pompom/battery.c
index 7ce8eec202..2566813651 100644
--- a/board/pompom/battery.c
+++ b/board/pompom/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/pompom/board.c b/board/pompom/board.c
index 56241083d3..394f06be8e 100644
--- a/board/pompom/board.c
+++ b/board/pompom/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,8 +34,8 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -115,10 +115,8 @@ __override struct keyboard_scan_config keyscan_config = {
* as it uses the new location (KSO_00/KSI_03). And T11 key, which maps
* to KSO_01/KSI_00, is not there.
*/
- .actual_key_mask = {
- 0x1c, 0xfe, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x1c, 0xfe, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -129,34 +127,26 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -164,37 +154,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -207,11 +182,9 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -234,11 +207,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -299,10 +275,8 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_LID_ACCEL_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_LID_ACCEL_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 2+ has the hardware fix. Don't need the following
@@ -351,9 +325,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
/* Called on AP S0 -> S3 transition */
static void board_chipset_suspend(void)
@@ -431,8 +405,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -460,7 +433,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -484,24 +456,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
@@ -524,17 +494,13 @@ static struct accelgyro_saved_data_t g_bma255_data;
static struct stprivate_data g_lis2dwl_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -644,11 +610,11 @@ static void board_detect_motionsensor(void)
int val = 0;
/*
- * BMA253 and LIS2DWL have same slave address, so we check the
+ * BMA253 and LIS2DWL have same target address, so we check the
* LIS2DWL WHO AM I register to check the lid accel type
*/
- i2c_read8(I2C_PORT_SENSOR, LIS2DWL_ADDR0_FLAGS,
- LIS2DW12_WHO_AM_I_REG, &val);
+ i2c_read8(I2C_PORT_SENSOR, LIS2DWL_ADDR0_FLAGS, LIS2DW12_WHO_AM_I_REG,
+ &val);
if (val == LIS2DW12_WHO_AM_I) {
motion_sensors[LID_ACCEL] = lis2dwl_lid_accel;
diff --git a/board/pompom/board.h b/board/pompom/board.h
index 110774cb97..40e7185c16 100644
--- a/board/pompom/board.h
+++ b/board/pompom/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
#include "board_revs.h"
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Keyboard */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
@@ -72,12 +72,7 @@
#include "gpio_signal.h"
#include "registers.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -87,11 +82,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
enum battery_type {
BATTERY_BYD,
diff --git a/board/pompom/board_revs.h b/board/pompom/board_revs.h
index 1ac5ee1337..8edc249df0 100644
--- a/board/pompom/board_revs.h
+++ b/board/pompom/board_revs.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#define POMPOM_REV0 0
#define POMPOM_REV1 1
-#define POMPOM_REV_LAST POMPOM_REV1
+#define POMPOM_REV_LAST POMPOM_REV1
#define POMPOM_REV_DEFAULT POMPOM_REV1
#if !defined(BOARD_REV)
@@ -19,5 +19,4 @@
#error "Board revision out of range"
#endif
-
#endif /* __CROS_EC_BOARD_REVS_H */
diff --git a/board/pompom/build.mk b/board/pompom/build.mk
index 04c90da3fe..8d302988f4 100644
--- a/board/pompom/build.mk
+++ b/board/pompom/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/pompom/ec.tasklist b/board/pompom/ec.tasklist
index 7ec8b46059..9145e6dd84 100644
--- a/board/pompom/ec.tasklist
+++ b/board/pompom/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pompom/gpio.inc b/board/pompom/gpio.inc
index 531452eae3..3016f8b9d5 100644
--- a/board/pompom/gpio.inc
+++ b/board/pompom/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/pompom/led.c b/board/pompom/led.c
index db571a067c..31fccbf4e2 100644
--- a/board/pompom/led.c
+++ b/board/pompom/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -31,21 +31,21 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color_battery(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? LED_ON_LVL : LED_OFF_LVL);
+ (color == LED_AMBER) ? LED_ON_LVL : LED_OFF_LVL);
gpio_set_level(GPIO_EC_CHG_LED_W_C0,
- (color == LED_WHITE) ? LED_ON_LVL : LED_OFF_LVL);
+ (color == LED_WHITE) ? LED_ON_LVL : LED_OFF_LVL);
}
void led_set_color_power(enum led_color color)
{
gpio_set_level(GPIO_EC_PWR_LED_W,
- (color == LED_WHITE) ? LED_ON_LVL : LED_OFF_LVL);
+ (color == LED_WHITE) ? LED_ON_LVL : LED_OFF_LVL);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -82,7 +82,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -109,16 +108,16 @@ static void board_led_set_battery(void)
color = LED_WHITE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: White 2 sec, Amber 2 sec */
- period = (2 + 2);
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2)
- color = LED_WHITE;
- else
- color = LED_AMBER;
- } else
+ color = LED_WHITE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: White 2 sec, Amber 2 sec */
+ period = (2 + 2);
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2)
color = LED_WHITE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/pompom/usbc_config.c b/board/pompom/usbc_config.c
index aac136415d..5d30adb6e2 100644
--- a/board/pompom/usbc_config.c
+++ b/board/pompom/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "console.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/poppy/base_detect_lux.c b/board/poppy/base_detect_lux.c
index c348eb681d..8b799a3dbd 100644
--- a/board/poppy/base_detect_lux.c
+++ b/board/poppy/base_detect_lux.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,8 +20,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
/* Base detection and debouncing */
#define BASE_DETECT_DEBOUNCE_US (20 * MSEC)
@@ -44,7 +44,7 @@
#define BASE_DISCONNECTED_CONNECT_MAX_MV 600
#define BASE_DISCONNECTED_MIN_MV 2800
-#define BASE_DISCONNECTED_MAX_MV (ADC_MAX_VOLT+1)
+#define BASE_DISCONNECTED_MAX_MV (ADC_MAX_VOLT + 1)
/*
* When base is connected, then gets disconnected:
@@ -93,7 +93,7 @@ int board_is_base_connected(void)
void board_enable_base_power(int enable)
{
gpio_set_level(GPIO_PPVAR_VAR_BASE,
- enable && current_base_status == BASE_CONNECTED);
+ enable && current_base_status == BASE_CONNECTED);
}
/*
@@ -181,8 +181,7 @@ static void base_detect_deferred(void)
retry:
print_base_detect_value("status unclear", v);
/* Unclear base status, schedule again in a while. */
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_RETRY_US);
+ hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_RETRY_US);
}
void base_detect_interrupt(enum gpio_signal signal)
@@ -216,7 +215,7 @@ static void base_init(void)
hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_DEBOUNCE_US);
gpio_enable_interrupt(GPIO_BASE_DET_A);
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
@@ -230,7 +229,7 @@ void base_force_state(enum ec_set_base_state_cmd state)
CPRINTS("BD forced disconnected");
} else {
hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_DEBOUNCE_US);
+ BASE_DETECT_DEBOUNCE_US);
gpio_enable_interrupt(GPIO_BASE_DET_A);
CPRINTS("BD forced reset");
}
diff --git a/board/poppy/base_detect_poppy.c b/board/poppy/base_detect_poppy.c
index 0fde6fb8e6..e6ac6e8da7 100644
--- a/board/poppy/base_detect_poppy.c
+++ b/board/poppy/base_detect_poppy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
/* Base detection and debouncing */
#define BASE_DETECT_DEBOUNCE_US (20 * MSEC)
@@ -101,7 +101,6 @@ static void base_detect_change(enum base_status status)
acpi_dptf_set_profile_num(DPTF_PROFILE_BASE_ATTACHED);
else
acpi_dptf_set_profile_num(DPTF_PROFILE_BASE_DETACHED);
-
}
/* Measure detection pin pulse duration (used to wake AP from deep S3). */
@@ -110,8 +109,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -243,7 +242,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/poppy/battery.c b/board/poppy/battery.c
index 4085651cc2..5006edf123 100644
--- a/board/poppy/battery.c
+++ b/board/poppy/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -14,14 +14,14 @@
#include "gpio.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
static enum battery_present batt_pres_prev = BP_NOT_SURE;
/* Shutdown mode parameter to write to manufacturer access register */
-#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
-#define SB_SHUTDOWN_DATA 0x0010
-#define SB_REVIVE_DATA 0x23a7
+#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
+#define SB_SHUTDOWN_DATA 0x0010
+#define SB_REVIVE_DATA 0x23a7
#if defined(BOARD_SORAKA) || defined(BOARD_LUX)
static const struct battery_info info = {
@@ -86,8 +86,9 @@ static int battery_init(void)
{
int batt_status;
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
+ return battery_status(&batt_status) ?
+ 0 :
+ !!(batt_status & STATUS_INITIALIZED);
}
/*
@@ -108,13 +109,13 @@ static int battery_check_disconnect(void)
uint8_t data[6];
/* Check if battery charging + discharging is disabled. */
- rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return BATTERY_DISCONNECT_ERROR;
- if ((data[3] & (BATTERY_DISCHARGING_DISABLED |
- BATTERY_CHARGING_DISABLED)) ==
+ if ((data[3] &
+ (BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED)) ==
(BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED))
return BATTERY_DISCONNECTED;
diff --git a/board/poppy/board.c b/board/poppy/board.c
index 3aa99c1161..a69fdd3f16 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,6 +34,7 @@
#include "math_util.h"
#include "motion_lid.h"
#include "motion_sense.h"
+#include "panic.h"
#include "pi3usb9281.h"
#include "power.h"
#include "power_button.h"
@@ -52,10 +53,10 @@
#include "util.h"
#include "espi.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define USB_PD_PORT_ANX74XX 0
+#define USB_PD_PORT_ANX74XX 0
/* Minimum input current limit. */
#define ILIM_MIN_MA 472
@@ -80,9 +81,9 @@ static void vbus_discharge_handler(void)
{
if (system_get_board_version() >= 2) {
pd_set_vbus_discharge(0,
- gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L));
+ gpio_get_level(GPIO_USB_C0_VBUS_WAKE_L));
pd_set_vbus_discharge(1,
- gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L));
+ gpio_get_level(GPIO_USB_C1_VBUS_WAKE_L));
}
}
DECLARE_DEFERRED(vbus_discharge_handler);
@@ -154,16 +155,17 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Base detection */
- [ADC_BASE_DET] = {"BASE_DET", NPCX_ADC_CH0,
- ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
/* Vbus sensing (10x voltage divider). */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {"AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1, 0},
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
#ifdef BOARD_LUX
/*
* ISL9238 PSYS output is 1.44 uA/W over 12.4K resistor, to read
@@ -171,49 +173,39 @@ const struct adc_t adc_channels[] = {
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {"PSYS", NPCX_ADC_CH3,
- ADC_MAX_VOLT*56250*2/(ADC_READ_MAX+1), 2, 0},
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 56250 * 2 / (ADC_READ_MAX + 1), 2, 0 },
#endif
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "als",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "charger",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "pmic",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "accelgyro",
- .port = NPCX_I2C_PORT3,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "als",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "charger",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "pmic",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "accelgyro",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -237,16 +229,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &anx74xx_tcpm_usb_mux_driver,
+ .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -271,7 +269,6 @@ const struct charger_config_t chg_chips[] = {
},
};
-
/**
* Power on (or off) a single TCPC.
* minimum on/off delays are included.
@@ -349,9 +346,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
@@ -371,17 +368,17 @@ uint16_t tcpc_get_alert_status(void)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* These BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
+ { "eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -397,8 +394,8 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
- != EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault) !=
+ EC_SUCCESS)
return;
if (!(vrfault & BIT(4)))
@@ -507,8 +504,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
@@ -561,9 +557,9 @@ static void board_init(void)
* force detection on both ports.
*/
gpio_set_flags(GPIO_USB_C0_VBUS_WAKE_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
gpio_set_flags(GPIO_USB_C1_VBUS_WAKE_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
vbus0_evt(GPIO_USB_C0_VBUS_WAKE_L);
vbus1_evt(GPIO_USB_C1_VBUS_WAKE_L);
@@ -582,10 +578,9 @@ static void board_init(void)
*/
if (system_get_board_version() >= 5)
gpio_set_flags(GPIO_LED_YELLOW_C0_OLD,
- GPIO_INPUT | GPIO_PULL_UP);
+ GPIO_INPUT | GPIO_PULL_UP);
else
- gpio_set_flags(GPIO_LED_YELLOW_C0,
- GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_LED_YELLOW_C0, GPIO_INPUT | GPIO_PULL_UP);
#ifdef BOARD_SORAKA
/*
@@ -594,18 +589,12 @@ static void board_init(void)
* for better S0ix/S3 power
*/
if (system_get_board_version() >= 4) {
- gpio_set_flags(GPIO_WLAN_PE_RST,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_PP3300_DX_LTE,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_GPS_OFF_L,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_BODY_SAR_L,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_WAKE_L,
- GPIO_INPUT | GPIO_PULL_UP);
- gpio_set_flags(GPIO_LTE_OFF_ODL,
- GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_WLAN_PE_RST, GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_PP3300_DX_LTE, GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_LTE_GPS_OFF_L, GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_LTE_BODY_SAR_L, GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_LTE_WAKE_L, GPIO_INPUT | GPIO_PULL_UP);
+ gpio_set_flags(GPIO_LTE_OFF_ODL, GPIO_INPUT | GPIO_PULL_UP);
}
#endif
@@ -671,10 +660,12 @@ int board_set_active_charge_port(int charge_port)
#endif
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_USB_C0_CHARGE_L :
- GPIO_USB_C1_CHARGE_L, 1);
+ GPIO_USB_C1_CHARGE_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 0);
+ GPIO_USB_C0_CHARGE_L,
+ 0);
}
return EC_SUCCESS;
@@ -688,8 +679,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Adjust ILIM according to measurements to eliminate overshoot. */
charge_ma = (charge_ma - 500) * 31 / 32 + 472;
@@ -706,8 +697,7 @@ void board_hibernate(void)
uart_flush_output();
/* Trigger PMIC shutdown. */
- if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS,
- 0x49, 0x01)) {
+ if (i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x49, 0x01)) {
/*
* If we can't tell the PMIC to shutdown, instead reset
* and don't start the AP. Hopefully we'll be able to
@@ -763,31 +753,23 @@ static struct opt3001_drv_data_t g_opt3001_data = {
};
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t mag_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t mag_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
#ifdef BOARD_SORAKA
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- {FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* For rev3 and older */
-const mat33_fp_t lid_standard_ref_old = {
- {FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref_old = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
#else
-const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
#endif
struct motion_sensor_t motion_sensors[] = {
diff --git a/board/poppy/board.h b/board/poppy/board.h
index 46a6fa19d3..6f95a9abeb 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -64,8 +64,8 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
/* Battery */
@@ -101,8 +101,8 @@
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
#define CONFIG_HOSTCMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
@@ -141,7 +141,7 @@
#define CONFIG_TABLET_MODE
#define CONFIG_TABLET_MODE_SWITCH
-#undef CONFIG_UART_TX_BUF_SIZE
+#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 2048
/* USB */
@@ -172,28 +172,28 @@
#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 2
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_0
-#define I2C_PORT_ALS NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_MP2949 NPCX_I2C_PORT2
-#define I2C_PORT_GYRO NPCX_I2C_PORT3
-#define I2C_PORT_BARO NPCX_I2C_PORT3
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_0
+#define I2C_PORT_ALS NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
+#define I2C_PORT_CHARGER NPCX_I2C_PORT1
+#define I2C_PORT_BATTERY NPCX_I2C_PORT1
+#define I2C_PORT_PMIC NPCX_I2C_PORT2
+#define I2C_PORT_MP2949 NPCX_I2C_PORT2
+#define I2C_PORT_GYRO NPCX_I2C_PORT3
+#define I2C_PORT_BARO NPCX_I2C_PORT3
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992_FLAGS 0x30
-#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
#ifndef __ASSEMBLER__
@@ -201,11 +201,11 @@
#include "registers.h"
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
- TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
+ TEMP_SENSOR_BATTERY, /* BD99956GW TSENSE */
+ TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
TEMP_SENSOR_COUNT
};
@@ -238,16 +238,16 @@ enum adc_channel {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
int board_get_version(void);
diff --git a/board/poppy/build.mk b/board/poppy/build.mk
index df32a7ca8f..36c55d3048 100644
--- a/board/poppy/build.mk
+++ b/board/poppy/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/poppy/ec.tasklist b/board/poppy/ec.tasklist
index 7591137bc9..4ee0b53a32 100644
--- a/board/poppy/ec.tasklist
+++ b/board/poppy/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/poppy/gpio.inc b/board/poppy/gpio.inc
index 286085d39c..63a8d3ce99 100644
--- a/board/poppy/gpio.inc
+++ b/board/poppy/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,14 +13,14 @@ GPIO_INT(USB_C1_PD_INT_ODL, PIN(C, 5), GPIO_INT_FALLING, tcpc_alert_event)
#ifdef CONFIG_POWER_S0IX
GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
#ifdef BOARD_LUX
GPIO_INT(PCH_SLP_S3_L, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
#else
GPIO_INT(PCH_SLP_S3_L, PIN(7, 3), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#endif /* CONFIG_HOSTCMD_ESPI_VW_SLP_S3 */
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#endif /* CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3 */
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(PCH_SLP_S4_L, PIN(8, 6), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/poppy/led.c b/board/poppy/led.c
index 0c2d7f1832..f388dd0326 100644
--- a/board/poppy/led.c
+++ b/board/poppy/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -31,17 +31,18 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void side_led_set_color(int port, enum led_color color)
{
int yellow_c0 = (system_get_board_version() >= 5) ?
- GPIO_LED_YELLOW_C0 : GPIO_LED_YELLOW_C0_OLD;
+ GPIO_LED_YELLOW_C0 :
+ GPIO_LED_YELLOW_C0_OLD;
gpio_set_level(port ? GPIO_LED_YELLOW_C1 : yellow_c0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(port ? GPIO_LED_WHITE_C1 : GPIO_LED_WHITE_C0,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -92,7 +93,6 @@ static void set_active_port_color(enum led_color color)
static void board_led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -104,8 +104,9 @@ static void board_led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
if (charge_get_percent() <= 10)
- side_led_set_color(0,
- (battery_ticks & 0x4) ? LED_WHITE : LED_OFF);
+ side_led_set_color(0, (battery_ticks & 0x4) ?
+ LED_WHITE :
+ LED_OFF);
else
side_led_set_color(0, LED_OFF);
}
@@ -114,18 +115,18 @@ static void board_led_set_battery(void)
side_led_set_color(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks & 0x4) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color((battery_ticks & 0x4) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/poppy/usb_pd_policy.c b/board/poppy/usb_pd_policy.c
index a32b77bbe7..ec2ea00076 100644
--- a/board/poppy/usb_pd_policy.c
+++ b/board/poppy/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,12 +22,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -48,8 +48,8 @@ static void board_vbus_update_source_current(int port)
* is controlled by GPIO_USB_C0/1_5V_EN. Both of these signals
* can remain outputs.
*/
- gpio_set_level(gpio_3a_en, vbus_rp[port] == TYPEC_RP_3A0 ?
- 1 : 0);
+ gpio_set_level(gpio_3a_en,
+ vbus_rp[port] == TYPEC_RP_3A0 ? 1 : 0);
gpio_set_level(gpio_5v_en, vbus_en[port]);
} else {
/*
@@ -61,8 +61,8 @@ static void board_vbus_update_source_current(int port)
* 1505 mA.
*/
int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) :
- (GPIO_OUTPUT | GPIO_PULL_UP);
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
gpio_set_level(gpio_5v_en, vbus_en[port]);
gpio_set_flags(gpio_5v_en, flags);
}
@@ -79,8 +79,7 @@ void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
int pd_set_power_supply_ready(int port)
{
/* Disable charging */
- gpio_set_level(port ? GPIO_USB_C1_CHARGE_L :
- GPIO_USB_C0_CHARGE_L, 1);
+ gpio_set_level(port ? GPIO_USB_C1_CHARGE_L : GPIO_USB_C0_CHARGE_L, 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
@@ -131,15 +130,13 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_PMIC_SLP_SUS_L);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
return;
- gpio_set_level(GPIO_USB2_OTG_ID,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_OTG_ID, (data_role == PD_ROLE_UFP) ? 1 : 0);
gpio_set_level(GPIO_USB2_OTG_VBUSSENSE,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ (data_role == PD_ROLE_UFP) ? 1 : 0);
}
diff --git a/board/primus/battery.c b/board/primus/battery.c
index e9e822f2e8..1b0d74bed3 100644
--- a/board/primus/battery.c
+++ b/board/primus/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -32,7 +32,7 @@
* address, mask, and disconnect value need to be provided.
*/
const struct board_batt_params board_battery_info[] = {
- [BATTERY_SUNWODA] = {
+ [BATTERY_SUNWODA_5B11F21946] = {
.fuel_gauge = {
.manuf_name = "Sunwoda",
.device_name = "LNV-5B11F21946",
@@ -61,7 +61,36 @@ const struct board_batt_params board_battery_info[] = {
},
},
- [BATTERY_SMP] = {
+ [BATTERY_SUNWODA_5B11H56342] = {
+ .fuel_gauge = {
+ .manuf_name = "Sunwoda",
+ .device_name = "LNV-5B11H56342",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .mfgacc_support = 1,
+ .reg_addr = 0x0000,
+ .reg_mask = 0x6000,
+ .disconnect_val = 0x6000,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 13200, /* mV */
+ .voltage_normal = 11520, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 251, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 50,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
+ },
+ },
+
+ [BATTERY_SMP_5B11F21953] = {
.fuel_gauge = {
.manuf_name = "SMP",
.device_name = "LNV-5B11F21953",
@@ -90,7 +119,36 @@ const struct board_batt_params board_battery_info[] = {
},
},
- [BATTERY_CELXPERT] = {
+ [BATTERY_SMP_5B11H56344] = {
+ .fuel_gauge = {
+ .manuf_name = "SMP",
+ .device_name = "LNV-5B11H56344",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .mfgacc_support = 1,
+ .reg_addr = 0x0000,
+ .reg_mask = 0x6000,
+ .disconnect_val = 0x6000,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 13200, /* mV */
+ .voltage_normal = 11520, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 250, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 60,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
+ },
+ },
+
+ [BATTERY_CELXPERT_5B11F21941] = {
.fuel_gauge = {
.manuf_name = "Celxpert",
.device_name = "LNV-5B11F21941",
@@ -118,7 +176,36 @@ const struct board_batt_params board_battery_info[] = {
.discharging_max_c = 70,
},
},
+
+ [BATTERY_CELXPERT_5B11H56343] = {
+ .fuel_gauge = {
+ .manuf_name = "Celxpert",
+ .device_name = "LNV-5B11H56343",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .mfgacc_support = 1,
+ .reg_addr = 0x0000,
+ .reg_mask = 0x6000,
+ .disconnect_val = 0x6000,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 13200, /* mV */
+ .voltage_normal = 11520, /* mV */
+ .voltage_min = 9000, /* mV */
+ .precharge_current = 487, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 50,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 70,
+ },
+ },
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SUNWODA;
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SUNWODA_5B11F21946;
diff --git a/board/primus/board.c b/board/primus/board.c
index d0fa9f6cae..8b5f1a86fc 100644
--- a/board/primus/board.c
+++ b/board/primus/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,8 +30,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
#define KBLIGHT_LED_ON_LVL 100
#define KBLIGHT_LED_OFF_LVL 0
@@ -93,8 +93,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -123,7 +123,7 @@ static void keyboard_init(void)
DECLARE_HOOK(HOOK_INIT, keyboard_init, HOOK_PRIO_DEFAULT);
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Need to set different input current limit depend on system state.
@@ -131,15 +131,14 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
if (((max_ma == PD_MAX_CURRENT_MA) &&
- chipset_in_state(CHIPSET_STATE_ANY_OFF)) ||
- (max_ma != PD_MAX_CURRENT_MA))
+ chipset_in_state(CHIPSET_STATE_ANY_OFF)) ||
+ (max_ma != PD_MAX_CURRENT_MA))
charge_ma = charge_ma * 97 / 100;
else
charge_ma = charge_ma * 93 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
static void configure_input_current_limit(void)
@@ -155,16 +154,16 @@ static void configure_input_current_limit(void)
adapter_current_ma = charge_manager_get_charger_current();
if ((adapter_current_ma == PD_MAX_CURRENT_MA) &&
- chipset_in_or_transitioning_to_state(CHIPSET_STATE_SUSPEND))
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_SUSPEND))
adapter_current_ma = PD_MAX_SUSPEND_CURRENT_MA;
else
adapter_current_ma = adapter_current_ma * 97 / 100;
charge_set_input_current_limit(MAX(adapter_current_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- adapter_current_mv);
+ CONFIG_CHARGER_INPUT_CURRENT),
+ adapter_current_mv);
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, configure_input_current_limit,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN_COMPLETE, configure_input_current_limit,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
diff --git a/board/primus/board.h b/board/primus/board.h
index 0b118efb6d..7346acc2ab 100644
--- a/board/primus/board.h
+++ b/board/primus/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,29 +31,29 @@
#undef CONFIG_VOLUME_BUTTONS
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
-#undef CONFIG_USB_PD_TCPM_NCT38XX
+#undef CONFIG_USB_PD_TCPM_NCT38XX
#define CONFIG_USB_PD_TCPM_RT1715
#define CONFIG_USBC_RETIMER_INTEL_BB
#define CONFIG_USBC_PPC_SYV682X
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 65000
-#define PD_MAX_CURRENT_MA 3250
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 65000
+#define PD_MAX_CURRENT_MA 3250
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -61,33 +61,33 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
+#define GPIO_ID_1_EC_KB_BL_EN GPIO_EC_BATT_PRES_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
@@ -97,23 +97,23 @@
/* I2C Bus Configuration */
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C1_PPC_BC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C0_C1_RT NPCX_I2C_PORT3_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_USB_A0_A1_MIX NPCX_I2C_PORT6_1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C1_PPC_BC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C0_C1_RT NPCX_I2C_PORT3_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_USB_A0_A1_MIX NPCX_I2C_PORT6_1
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
@@ -135,19 +135,19 @@
/* Fan features */
#define CONFIG_CUSTOM_FAN_CONTROL
-#define CONFIG_FANS FAN_CH_COUNT
-#define RPM_DEVIATION 1
+#define CONFIG_FANS FAN_CH_COUNT
+#define RPM_DEVIATION 1
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
/* PROCHOT defines */
-#define BATT_MAX_CONTINUE_DISCHARGE_WATT 66
+#define BATT_MAX_CONTINUE_DISCHARGE_WATT 66
/* Prochot assertion/deassertion ratios*/
#define PROCHOT_ADAPTER_WATT_RATIO 97
@@ -164,11 +164,11 @@
#define CONFIG_8042_AUX
#define CONFIG_PS2
#define CONFIG_CMD_PS2
-#define PRIMUS_PS2_CH NPCX_PS2_CH1
+#define PRIMUS_PS2_CH NPCX_PS2_CH1
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -201,31 +201,28 @@ enum sensor_id {
};
enum battery_type {
- BATTERY_SUNWODA,
- BATTERY_SMP,
- BATTERY_CELXPERT,
+ BATTERY_SUNWODA_5B11F21946,
+ BATTERY_SUNWODA_5B11H56342,
+ BATTERY_SMP_5B11F21953,
+ BATTERY_SMP_5B11H56344,
+ BATTERY_CELXPERT_5B11F21941,
+ BATTERY_CELXPERT_5B11H56343,
BATTERY_TYPE_COUNT
};
enum pwm_channel {
- PWM_CH_LED2_WHITE = 0, /* PWM0 (white charger) */
- PWM_CH_TKP_A_LED_N, /* PWM1 (LOGO led on A cover) */
- PWM_CH_LED1_AMBER, /* PWM2 (orange charger) */
- PWM_CH_KBLIGHT, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED4, /* PWM7 (power) */
+ PWM_CH_LED2_WHITE = 0, /* PWM0 (white charger) */
+ PWM_CH_TKP_A_LED_N, /* PWM1 (LOGO led on A cover) */
+ PWM_CH_LED1_AMBER, /* PWM2 (orange charger) */
+ PWM_CH_KBLIGHT, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_LED4, /* PWM7 (power) */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
#endif /* !__ASSEMBLER__ */
diff --git a/board/primus/build.mk b/board/primus/build.mk
index ddf50b46e2..409a9dd45e 100644
--- a/board/primus/build.mk
+++ b/board/primus/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/primus/cbi_ssfc.c b/board/primus/cbi_ssfc.c
index dd59bb2c9f..45afa622ab 100644
--- a/board/primus/cbi_ssfc.c
+++ b/board/primus/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/cbi_ssfc.h b/board/primus/cbi_ssfc.h
index d1ad8c991f..fe4c2fb4e5 100644
--- a/board/primus/cbi_ssfc.h
+++ b/board/primus/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/charger.c b/board/primus/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/primus/charger.c
+++ b/board/primus/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/primus/ec.tasklist b/board/primus/ec.tasklist
index bf2ec04c62..3afcca805e 100644
--- a/board/primus/ec.tasklist
+++ b/board/primus/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/fans.c b/board/primus/fans.c
index 001c6fde5c..b3c72c074b 100644
--- a/board/primus/fans.c
+++ b/board/primus/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/primus/fw_config.c b/board/primus/fw_config.c
index 0384d05b9d..82ba396901 100644
--- a/board/primus/fw_config.c
+++ b/board/primus/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union primus_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/primus/fw_config.h b/board/primus/fw_config.h
index f8792f1443..81fa5481f8 100644
--- a/board/primus/fw_config.h
+++ b/board/primus/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,21 +25,18 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_mlb_usb {
- MLB_USB_TBT = 0,
- MLB_USB_USB4 = 1
-};
+enum ec_cfg_mlb_usb { MLB_USB_TBT = 0, MLB_USB_USB4 = 1 };
union primus_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
- uint32_t sd_db : 2;
- uint32_t reserved_0 : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t cellular_db : 2;
- enum ec_cfg_mlb_usb mlb_usb : 1;
- uint32_t reserved_1 : 18;
+ enum ec_cfg_usb_db_type usb_db : 4;
+ uint32_t sd_db : 2;
+ uint32_t reserved_0 : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t cellular_db : 2;
+ enum ec_cfg_mlb_usb mlb_usb : 1;
+ uint32_t reserved_1 : 18;
};
uint32_t raw_value;
};
diff --git a/board/primus/gpio.inc b/board/primus/gpio.inc
index ce66027514..9928eb0cc5 100644
--- a/board/primus/gpio.inc
+++ b/board/primus/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/i2c.c b/board/primus/i2c.c
index 019862f441..21939347b1 100644
--- a/board/primus/i2c.c
+++ b/board/primus/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/keyboard.c b/board/primus/keyboard.c
index 5b45b60b19..9c9a37e9fc 100644
--- a/board/primus/keyboard.c
+++ b/board/primus/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/led.c b/board/primus/led.c
index 3a8da5ac32..70c1c89188 100644
--- a/board/primus/led.c
+++ b/board/primus/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,32 +24,30 @@
#include "task.h"
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_LOGOLED, format, ## args)
-
-#define LED_ON_LVL 100
-#define LED_OFF_LVL 0
-#define LED_BAT_S3_OFF_TIME_MS 3000
-#define LED_BAT_S3_TICK_MS 50
-#define LED_BAT_S3_PWM_RESCALE 5
-#define LED_TOTAL_TICKS 6
-#define TICKS_STEP1_BRIGHTER 0
-#define TICKS_STEP2_DIMMER (1000 / LED_BAT_S3_TICK_MS)
-#define TICKS_STEP3_OFF (2 * TICKS_STEP2_DIMMER)
-#define LED_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
-#define LED_LOGO_TICK_SEC (LED_ONE_SEC / 4)
+#define CPRINTS(format, args...) cprints(CC_LOGOLED, format, ##args)
+
+#define LED_ON_LVL 100
+#define LED_OFF_LVL 0
+#define LED_BAT_S3_OFF_TIME_MS 3000
+#define LED_BAT_S3_TICK_MS 50
+#define LED_BAT_S3_PWM_RESCALE 5
+#define LED_TOTAL_TICKS 6
+#define TICKS_STEP1_BRIGHTER 0
+#define TICKS_STEP2_DIMMER (1000 / LED_BAT_S3_TICK_MS)
+#define TICKS_STEP3_OFF (2 * TICKS_STEP2_DIMMER)
+#define LED_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
+#define LED_LOGO_TICK_SEC (LED_ONE_SEC / 4)
/* Total on/off duration in a period */
-#define PERIOD (LED_LOGO_TICK_SEC * 2)
-#define LED_ON 1
-#define LED_OFF EC_LED_COLOR_COUNT
-#define LED_EVENT_SUSPEND TASK_EVENT_CUSTOM_BIT(0)
-#define LED_EVENT_200MS_TICK TASK_EVENT_CUSTOM_BIT(1)
+#define PERIOD (LED_LOGO_TICK_SEC * 2)
+#define LED_ON 1
+#define LED_OFF EC_LED_COLOR_COUNT
+#define LED_EVENT_SUSPEND TASK_EVENT_CUSTOM_BIT(0)
+#define LED_EVENT_200MS_TICK TASK_EVENT_CUSTOM_BIT(1)
static int tick;
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
static void led_set_color_battery(enum ec_led_colors color)
@@ -94,11 +92,11 @@ void led_set_color_power(int onoff_status)
/* primus logo led and power led have same behavior. */
if (onoff_status == LED_ON) {
pwm_set_duty(PWM_CH_TKP_A_LED_N, LED_ON_LVL);
- pwm_set_duty(PWM_CH_LED4, LED_ON_LVL);
+ pwm_set_duty(PWM_CH_LED4, LED_ON_LVL);
} else {
/* LED_OFF and unsupported colors */
pwm_set_duty(PWM_CH_TKP_A_LED_N, LED_OFF_LVL);
- pwm_set_duty(PWM_CH_LED4, LED_OFF_LVL);
+ pwm_set_duty(PWM_CH_LED4, LED_OFF_LVL);
}
}
@@ -176,7 +174,7 @@ static void suspend_led_update(void)
* if we are not transitioning to suspend, we should break here.
*/
if (!chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_ANY_SUSPEND))
+ CHIPSET_STATE_ANY_SUSPEND))
break;
/* 1s gradual on, 1s gradual off, 3s off */
@@ -187,9 +185,9 @@ static void suspend_led_update(void)
* behavior.
*/
pwm_set_duty(PWM_CH_TKP_A_LED_N,
- tick * LED_BAT_S3_PWM_RESCALE);
+ tick * LED_BAT_S3_PWM_RESCALE);
pwm_set_duty(PWM_CH_LED4,
- tick * LED_BAT_S3_PWM_RESCALE);
+ tick * LED_BAT_S3_PWM_RESCALE);
msleep(LED_BAT_S3_TICK_MS);
} else if (tick <= TICKS_STEP3_OFF) {
/* decrease 5 duty every 50ms until PWM=0
@@ -197,10 +195,12 @@ static void suspend_led_update(void)
* A-cover and power button led are shared same
* behavior.
*/
- pwm_set_duty(PWM_CH_TKP_A_LED_N, (TICKS_STEP3_OFF
- - tick) * LED_BAT_S3_PWM_RESCALE);
- pwm_set_duty(PWM_CH_LED4, (TICKS_STEP3_OFF
- - tick) * LED_BAT_S3_PWM_RESCALE);
+ pwm_set_duty(PWM_CH_TKP_A_LED_N,
+ (TICKS_STEP3_OFF - tick) *
+ LED_BAT_S3_PWM_RESCALE);
+ pwm_set_duty(PWM_CH_LED4,
+ (TICKS_STEP3_OFF - tick) *
+ LED_BAT_S3_PWM_RESCALE);
msleep(LED_BAT_S3_TICK_MS);
} else {
tick = TICKS_STEP1_BRIGHTER;
diff --git a/board/primus/ps2.c b/board/primus/ps2.c
index ba341f6be0..2a0a764d5e 100644
--- a/board/primus/ps2.c
+++ b/board/primus/ps2.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,7 +15,7 @@
#include "registers.h"
#include "time.h"
-#define PS2_TRANSMIT_DELAY_MS 10
+#define PS2_TRANSMIT_DELAY_MS 10
static uint8_t queue_data[3];
static int data_count;
@@ -39,8 +39,8 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
*/
static void enable_ps2(void)
{
- gpio_set_alternate_function(GPIO_PORT_6,
- BIT(2) | BIT(3), GPIO_ALT_FUNC_DEFAULT);
+ gpio_set_alternate_function(GPIO_PORT_6, BIT(2) | BIT(3),
+ GPIO_ALT_FUNC_DEFAULT);
}
DECLARE_DEFERRED(enable_ps2);
@@ -48,8 +48,8 @@ static void disable_ps2(void)
{
gpio_set_flags(GPIO_EC_PS2_SCL_TPAD, GPIO_ODR_LOW);
gpio_set_flags(GPIO_EC_PS2_SDA_TPAD, GPIO_ODR_LOW);
- gpio_set_alternate_function(GPIO_PORT_6,
- BIT(2) | BIT(3), GPIO_ALT_FUNC_NONE);
+ gpio_set_alternate_function(GPIO_PORT_6, BIT(2) | BIT(3),
+ GPIO_ALT_FUNC_NONE);
/* make sure PLTRST# goes high and re-enable PS2.*/
hook_call_deferred(&enable_ps2_data, 2 * SECOND);
}
@@ -96,7 +96,7 @@ uint8_t get_trackpoint_id(void)
* Also make sure only return the trackpoint device ID.
*/
if (queue_data[1] == TP_VARIANT_ELAN ||
- queue_data[1] == TP_VARIANT_SYNAPTICS)
+ queue_data[1] == TP_VARIANT_SYNAPTICS)
return queue_data[1];
else
return 0;
@@ -129,10 +129,10 @@ static void ps2_suspend(void)
*/
if (trackpoint_id == TP_VARIANT_ELAN)
send_command_to_trackpoint(TP_TOGGLE_BURST,
- TP_TOGGLE_ELAN_SLEEP);
+ TP_TOGGLE_ELAN_SLEEP);
else if (trackpoint_id == TP_VARIANT_SYNAPTICS)
send_command_to_trackpoint(TP_TOGGLE_SOURCE_TAG,
- TP_TOGGLE_SNAPTICS_SLEEP);
+ TP_TOGGLE_SNAPTICS_SLEEP);
/* Clear the data in queue and the counter */
memset(queue_data, 0, ARRAY_SIZE(queue_data));
@@ -154,7 +154,7 @@ static void ps2_resume(void)
*/
if (trackpoint_id == TP_VARIANT_SYNAPTICS)
send_command_to_trackpoint(TP_TOGGLE_SOURCE_TAG,
- TP_TOGGLE_SNAPTICS_SLEEP);
+ TP_TOGGLE_SNAPTICS_SLEEP);
/* Clear the data in queue and the counter */
memset(queue_data, 0, ARRAY_SIZE(queue_data));
diff --git a/board/primus/ps2.h b/board/primus/ps2.h
index 0943d5ba4b..a82d6d566a 100644
--- a/board/primus/ps2.h
+++ b/board/primus/ps2.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,20 +12,20 @@
* 0x01 was the original IBM trackpoint, others implement very limited
* subset of trackpoint features.
*/
-#define TP_READ_ID 0xE1 /* Sent for device identification */
+#define TP_READ_ID 0xE1 /* Sent for device identification */
-#define TP_COMMAND 0xE2 /* Commands start with this */
+#define TP_COMMAND 0xE2 /* Commands start with this */
/*
* Toggling Flag bits
*/
-#define TP_TOGGLE 0x47 /* Toggle command */
+#define TP_TOGGLE 0x47 /* Toggle command */
-#define TP_VARIANT_ELAN 0x03
-#define TP_VARIANT_SYNAPTICS 0x06
-#define TP_TOGGLE_SOURCE_TAG 0x20
-#define TP_TOGGLE_BURST 0x28
-#define TP_TOGGLE_SNAPTICS_SLEEP 0x10
-#define TP_TOGGLE_ELAN_SLEEP 0x8
+#define TP_VARIANT_ELAN 0x03
+#define TP_VARIANT_SYNAPTICS 0x06
+#define TP_TOGGLE_SOURCE_TAG 0x20
+#define TP_TOGGLE_BURST 0x28
+#define TP_TOGGLE_SNAPTICS_SLEEP 0x10
+#define TP_TOGGLE_ELAN_SLEEP 0x8
#endif /* __CROS_EC_PRIMUS_PS2_H */
diff --git a/board/primus/pwm.c b/board/primus/pwm.c
index 26ca6e5b92..f2889c2b8e 100644
--- a/board/primus/pwm.c
+++ b/board/primus/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/primus/sensors.c b/board/primus/sensors.c
index 60cfa1428f..9c0a9d69e8 100644
--- a/board/primus/sensors.c
+++ b/board/primus/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -59,36 +59,26 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_2_SSD] = {
- .name = "SSD",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_SSD
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
- [TEMP_SENSOR_4_MEMORY] = {
- .name = "MEMORY",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_MEMORY
- },
- [TEMP_SENSOR_5_USBC] = {
- .name = "USBC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_5_USBC
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_2_SSD] = { .name = "SSD",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_SSD },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
+ [TEMP_SENSOR_4_MEMORY] = { .name = "MEMORY",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_MEMORY },
+ [TEMP_SENSOR_5_USBC] = { .name = "USBC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_5_USBC },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -102,8 +92,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
@@ -119,8 +109,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_SSD \
- { \
+#define THERMAL_SSD \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(92), \
@@ -149,8 +139,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ssd = THERMAL_SSD;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(90), \
diff --git a/board/primus/thermal.c b/board/primus/thermal.c
index f5e200b14c..00e2dddf98 100644
--- a/board/primus/thermal.c
+++ b/board/primus/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,9 +14,7 @@
#include "util.h"
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
-
-
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -36,51 +34,51 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {40, -1, -1, -1, -1},
- .off = {0, -1, -1, -1, -1},
- .rpm = {0},
+ .on = { 40, -1, -1, -1, -1 },
+ .off = { 0, -1, -1, -1, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {42, -1, -1, -1, -1},
- .off = {40, -1, -1, -1, -1},
- .rpm = {1800},
+ .on = { 42, -1, -1, -1, -1 },
+ .off = { 40, -1, -1, -1, -1 },
+ .rpm = { 1800 },
},
{
/* level 2 */
- .on = {43, -1, -1, -1, -1},
- .off = {42, -1, -1, -1, -1},
- .rpm = {2000},
+ .on = { 43, -1, -1, -1, -1 },
+ .off = { 42, -1, -1, -1, -1 },
+ .rpm = { 2000 },
},
{
/* level 3 */
- .on = {44, -1, -1, -1, -1},
- .off = {43, -1, -1, -1, -1},
- .rpm = {2200},
+ .on = { 44, -1, -1, -1, -1 },
+ .off = { 43, -1, -1, -1, -1 },
+ .rpm = { 2200 },
},
{
/* level 4 */
- .on = {45, -1, -1, -1, -1},
- .off = {44, -1, -1, -1, -1},
- .rpm = {2500},
+ .on = { 45, -1, -1, -1, -1 },
+ .off = { 44, -1, -1, -1, -1 },
+ .rpm = { 2500 },
},
{
/* level 5 */
- .on = {46, -1, -1, -1, -1},
- .off = {45, -1, -1, -1, -1},
- .rpm = {2800},
+ .on = { 46, -1, -1, -1, -1 },
+ .off = { 45, -1, -1, -1, -1 },
+ .rpm = { 2800 },
},
{
/* level 6 */
- .on = {47, -1, -1, -1, -1},
- .off = {46, -1, -1, -1, -1},
- .rpm = {3000},
+ .on = { 47, -1, -1, -1, -1 },
+ .off = { 46, -1, -1, -1, -1 },
+ .rpm = { 3000 },
},
{
/* level 7 */
- .on = {75, -1, -1, -1, -1},
- .off = {72, -1, -1, -1, -1},
- .rpm = {3200},
+ .on = { 75, -1, -1, -1, -1 },
+ .off = { 72, -1, -1, -1, -1 },
+ .rpm = { 3200 },
},
};
const int num_fan_levels = ARRAY_SIZE(fan_table);
@@ -106,17 +104,14 @@ int fan_table_to_rpm(int fan, int *temp, enum temp_sensor_id temp_sensor)
*/
if (temp[temp_sensor] < prev_temp[temp_sensor]) {
for (i = current_level; i > 0; i--) {
- if (temp[temp_sensor] <
- fan_table[i].off[temp_sensor])
+ if (temp[temp_sensor] < fan_table[i].off[temp_sensor])
current_level = i - 1;
else
break;
}
- } else if (temp[temp_sensor] >
- prev_temp[temp_sensor]) {
+ } else if (temp[temp_sensor] > prev_temp[temp_sensor]) {
for (i = current_level; i < num_fan_levels; i++) {
- if (temp[temp_sensor] >
- fan_table[i].on[temp_sensor])
+ if (temp[temp_sensor] > fan_table[i].on[temp_sensor])
current_level = i + 1;
else
break;
@@ -148,7 +143,8 @@ void board_override_fan_control(int fan, int *temp)
if (chipset_in_state(CHIPSET_STATE_ON)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(FAN_CH(fan), temp, TEMP_SENSOR_1_DDR_SOC));
+ fan_table_to_rpm(FAN_CH(fan), temp,
+ TEMP_SENSOR_1_DDR_SOC));
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Stop fan when enter S0ix */
fan_set_rpm_mode(FAN_CH(fan), 1);
diff --git a/board/primus/usbc_config.c b/board/primus/usbc_config.c
index ecaac56b2d..a11a8d588f 100644
--- a/board/primus/usbc_config.c
+++ b/board/primus/usbc_config.c
@@ -1,9 +1,8 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-
#include <stdint.h>
#include <stdbool.h>
@@ -32,8 +31,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -75,33 +74,43 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_RT,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_RT,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_RT,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_RT,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -178,7 +187,6 @@ void board_reset_pd_mcu(void)
static void board_tcpc_init(void)
{
-
/* Don't reset TCPCs after initial reset */
if (!system_jumped_late()) {
board_reset_pd_mcu();
@@ -195,7 +203,6 @@ static void board_tcpc_init(void)
/* Enable BC1.2 interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
-
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
diff --git a/board/primus/usbc_config.h b/board/primus/usbc_config.h
index 8bc1918c02..1e087f083c 100644
--- a/board/primus/usbc_config.h
+++ b/board/primus/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/prism/board.c b/board/prism/board.c
index dc5c042db1..1c7778f72f 100644
--- a/board/prism/board.c
+++ b/board/prism/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,20 +37,20 @@
#define CROS_EC_SECTION "RO"
#endif
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/******************************************************************************
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Prism"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] =
- USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
- [USB_STR_HOSTCMD_NAME] = USB_STRING_DESC("Host command"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Prism"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] =
+ USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_HOSTCMD_NAME] = USB_STRING_DESC("Host command"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -61,10 +61,9 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
#ifdef SECTION_IS_RW
const struct spi_device_t spi_devices[] = {
- [SPI_RGB0_DEVICE_ID] = {
- CONFIG_SPI_RGB_PORT,
- 2, /* 2: Fpclk/8 = 48Mhz/8 = 6Mhz */
- GPIO_SPI1_CS1_L },
+ [SPI_RGB0_DEVICE_ID] = { CONFIG_SPI_RGB_PORT, 2, /* 2: Fpclk/8 = 48Mhz/8
+ = 6Mhz */
+ GPIO_SPI1_CS1_L },
[SPI_RGB1_DEVICE_ID] = { CONFIG_SPI_RGB_PORT, 2, GPIO_SPI1_CS2_L },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
@@ -103,143 +102,141 @@ const uint8_t rgbkbd_count = ARRAY_SIZE(rgbkbds);
const uint8_t rgbkbd_hsize = RGB_GRID0_COL + RGB_GRID1_COL;
const uint8_t rgbkbd_vsize = RGB_GRID0_ROW;
-#define LED(x, y) RGBKBD_COORD((x), (y))
-#define DELM RGBKBD_DELM
+enum ec_rgbkbd_type rgbkbd_type = EC_RGBKBD_TYPE_PER_KEY;
+
+#define LED(x, y) RGBKBD_COORD((x), (y))
+#define DELM RGBKBD_DELM
+
const uint8_t rgbkbd_map[] = {
- DELM, /* 0: (null) */
- LED( 0, 1), DELM, /* 1: ~ ` */
- LED( 1, 1), LED( 1, 2), DELM, /* 2: ! 1 */
- LED( 2, 1), LED( 2, 2), DELM, /* 3: @ 2 */
- LED( 3, 1), LED( 3, 2), DELM, /* 4: # 3 */
- LED( 4, 1), LED( 4, 2), DELM, /* 5: $ 4 */
- LED( 5, 1), LED( 5, 2), DELM, /* 6: % 5 */
- LED( 6, 1), LED( 6, 2), DELM, /* 7: ^ 6 */
- LED( 7, 1), LED( 7, 2), DELM, /* 8: & 7 */
- LED( 8, 1), LED( 8, 2), DELM, /* 9: * 8 */
- LED( 9, 1), LED( 9, 2), DELM, /* 10: ( 9 */
- LED(10, 1), LED(10, 2), DELM, /* 11: ) 0 */
- LED(11, 1), LED(11, 2), DELM, /* 12: _ - */
- LED(12, 1), LED(12, 2), DELM, /* 13: + = */
- DELM, /* 14: (null) */
- LED(13, 1), LED(13, 2), DELM, /* 15: backspace */
- LED( 0, 3), DELM, /* 16: tab */
- LED( 1, 3), DELM, /* 17: q */
- LED( 2, 3), DELM, /* 18: w */
- LED( 3, 3), DELM, /* 19: e */
- LED( 4, 3), DELM, /* 20: r */
- LED( 5, 3), DELM, /* 21: t */
- LED( 6, 3), DELM, /* 22: y */
- LED( 7, 3), DELM, /* 23: u */
- LED( 8, 3), DELM, /* 24: i */
- LED( 9, 3), DELM, /* 25: o */
- LED(10, 3), DELM, /* 26: p */
- LED(11, 3), LED(12, 3), DELM, /* 27: [ { */
- LED(13, 3), LED(14, 3), DELM, /* 28: ] } */
- LED(15, 3), LED(16, 3), DELM, /* 29: \ | */
- LED( 0, 4), LED( 1, 4), DELM, /* 30: caps lock */
- LED( 2, 4), DELM, /* 31: a */
- LED( 3, 4), DELM, /* 32: s */
- LED( 4, 4), DELM, /* 33: d */
- LED( 5, 4), DELM, /* 34: f */
- LED( 6, 4), DELM, /* 35: g */
- LED( 7, 4), DELM, /* 36: h */
- LED( 8, 4), DELM, /* 37: j */
- LED( 9, 4), DELM, /* 38: k */
- LED(10, 4), DELM, /* 39: l */
- LED(11, 4), LED(12, 4), DELM, /* 40: ; : */
- LED(13, 4), LED(14, 4), DELM, /* 41: " ' */
- DELM, /* 42: (null) */
- LED(15, 4), LED(16, 4), DELM, /* 43: enter */
- LED( 0, 5), LED( 1, 5),
- LED( 2, 5), DELM, /* 44: L-shift */
- DELM, /* 45: (null) */
- LED( 3, 5), DELM, /* 46: z */
- LED( 4, 5), DELM, /* 47: x */
- LED( 5, 5), DELM, /* 48: c */
- LED( 6, 5), DELM, /* 49: v */
- LED( 7, 5), DELM, /* 50: b */
- LED( 8, 5), DELM, /* 51: n */
- LED( 9, 5), DELM, /* 52: m */
- LED(10, 5), LED(11, 5), DELM, /* 53: , < */
- LED(12, 5), LED(13, 5), DELM, /* 54: . > */
- LED(14, 5), LED(15, 5), DELM, /* 55: / ? */
- DELM, /* 56: (null) */
- LED(16, 5), LED(17, 5),
- LED(18, 5), DELM, /* 57: R-shift */
- LED(17, 4), LED(18, 4),
- LED(19, 4), DELM, /* 58: L-ctrl */
- LED(15, 0), DELM, /* 59: power */
- LED(17, 2), LED(18, 2),
- LED(19, 2), DELM, /* 60: L-alt */
- LED(17, 3), LED(18, 3),
- LED(19, 3), LED(20, 3),
- LED(21, 3), DELM, /* 61: space */
- LED(20, 2), DELM, /* 62: R-alt */
- DELM, /* 63: (null) */
- LED(21, 2), DELM, /* 64: R-ctrl */
- DELM, /* 65: (null) */
- DELM, /* 66: (null) */
- DELM, /* 67: (null) */
- DELM, /* 68: (null) */
- DELM, /* 69: (null) */
- DELM, /* 70: (null) */
- DELM, /* 71: (null) */
- DELM, /* 72: (null) */
- DELM, /* 73: (null) */
- DELM, /* 74: (null) */
- DELM, /* 75: (null) */
- DELM, /* 76: (null) */
- DELM, /* 77: (null) */
- DELM, /* 78: (null) */
- LED(19, 5), DELM, /* 79: left */
- DELM, /* 80: (null) */
- DELM, /* 81: (null) */
- DELM, /* 82: (null) */
- LED(20, 4), DELM, /* 83: up */
- LED(20, 5), DELM, /* 84: down */
- DELM, /* 85: (null) */
- DELM, /* 86: (null) */
- DELM, /* 87: (null) */
- DELM, /* 88: (null) */
- LED(21, 5), DELM, /* 89: right */
- DELM, /* 90: (null) */
- DELM, /* 91: (null) */
- DELM, /* 92: (null) */
- DELM, /* 93: (null) */
- DELM, /* 94: (null) */
- DELM, /* 95: (null) */
- DELM, /* 96: (null) */
- DELM, /* 97: (null) */
- DELM, /* 98: (null) */
- DELM, /* 99: (null) */
- DELM, /* 100: (null) */
- DELM, /* 101: (null) */
- DELM, /* 102: (null) */
- DELM, /* 103: (null) */
- DELM, /* 104: (null) */
- DELM, /* 105: (null) */
- DELM, /* 106: (null) */
- DELM, /* 107: (null) */
- DELM, /* 108: (null) */
- DELM, /* 109: (null) */
- LED( 0, 0), DELM, /* 110: esc */
- LED( 1, 0), DELM, /* T1: previous page */
- LED( 2, 0), DELM, /* T2: refresh */
- LED( 3, 0), DELM, /* T3: full screen */
- LED( 4, 0), DELM, /* T4: windows */
- LED( 5, 0), DELM, /* T5: screenshot */
- LED( 6, 0), DELM, /* T6: brightness down */
- LED( 7, 0), DELM, /* T7: brightness up */
- LED( 8, 0), DELM, /* T8: KB backlight off */
- LED( 9, 0), DELM, /* T9: play/pause */
- LED(10, 0), DELM, /* T10: mute microphone */
- LED(11, 0), DELM, /* T11: mute speakers */
- LED(12, 0), DELM, /* T12: volume down */
- LED(13, 0), DELM, /* T13: volume up */
- DELM, /* T14: (null) */
- DELM, /* T15: (null) */
- DELM, /* 126: (null) */
- DELM, /* 127: (null) */
+ DELM, /* 0: (null) */
+ LED(0, 1), LED(0, 2), DELM, /* 1: ~ ` */
+ LED(1, 1), LED(1, 2), DELM, /* 2: ! 1 */
+ LED(2, 1), LED(2, 2), DELM, /* 3: @ 2 */
+ LED(3, 1), LED(3, 2), DELM, /* 4: # 3 */
+ LED(4, 1), LED(4, 2), DELM, /* 5: $ 4 */
+ LED(5, 1), LED(5, 2), DELM, /* 6: % 5 */
+ LED(6, 1), LED(6, 2), DELM, /* 7: ^ 6 */
+ LED(7, 1), LED(7, 2), DELM, /* 8: & 7 */
+ LED(8, 1), LED(8, 2), DELM, /* 9: * 8 */
+ LED(9, 1), LED(9, 2), DELM, /* 10: ( 9 */
+ LED(10, 1), LED(10, 2), DELM, /* 11: ) 0 */
+ LED(11, 1), LED(11, 2), DELM, /* 12: _ - */
+ LED(12, 1), LED(12, 2), DELM, /* 13: + = */
+ DELM, /* 14: (null) */
+ LED(13, 1), LED(13, 2), DELM, /* 15: backspace */
+ LED(0, 3), LED(15, 2), DELM, /* 16: tab */
+ LED(1, 3), DELM, /* 17: q */
+ LED(2, 3), DELM, /* 18: w */
+ LED(3, 3), DELM, /* 19: e */
+ LED(4, 3), DELM, /* 20: r */
+ LED(5, 3), DELM, /* 21: t */
+ LED(6, 3), DELM, /* 22: y */
+ LED(7, 3), DELM, /* 23: u */
+ LED(8, 3), DELM, /* 24: i */
+ LED(9, 3), DELM, /* 25: o */
+ LED(10, 3), DELM, /* 26: p */
+ LED(11, 3), LED(12, 3), DELM, /* 27: [ { */
+ LED(13, 3), LED(14, 3), DELM, /* 28: ] } */
+ LED(15, 3), LED(16, 3), DELM, /* 29: \ | */
+ LED(0, 4), LED(1, 4), DELM, /* 30: caps lock */
+ LED(2, 4), DELM, /* 31: a */
+ LED(3, 4), DELM, /* 32: s */
+ LED(4, 4), DELM, /* 33: d */
+ LED(5, 4), DELM, /* 34: f */
+ LED(6, 4), DELM, /* 35: g */
+ LED(7, 4), DELM, /* 36: h */
+ LED(8, 4), DELM, /* 37: j */
+ LED(9, 4), DELM, /* 38: k */
+ LED(10, 4), DELM, /* 39: l */
+ LED(11, 4), LED(12, 4), DELM, /* 40: ; : */
+ LED(13, 4), LED(14, 4), DELM, /* 41: " ' */
+ DELM, /* 42: (null) */
+ LED(15, 4), LED(16, 4), DELM, /* 43: enter */
+ LED(0, 5), LED(1, 5), LED(2, 5), DELM, /* 44: L-shift */
+ DELM, /* 45: (null) */
+ LED(3, 5), DELM, /* 46: z */
+ LED(4, 5), DELM, /* 47: x */
+ LED(5, 5), DELM, /* 48: c */
+ LED(6, 5), DELM, /* 49: v */
+ LED(7, 5), DELM, /* 50: b */
+ LED(8, 5), DELM, /* 51: n */
+ LED(9, 5), DELM, /* 52: m */
+ LED(10, 5), LED(11, 5), DELM, /* 53: , < */
+ LED(12, 5), LED(13, 5), DELM, /* 54: . > */
+ LED(14, 5), LED(15, 5), DELM, /* 55: / ? */
+ DELM, /* 56: (null) */
+ LED(16, 5), LED(17, 5), LED(18, 5), DELM, /* 57: R-shift */
+ LED(17, 4), LED(18, 4), LED(19, 4), DELM, /* 58: L-ctrl */
+ LED(15, 0), DELM, /* 59: power */
+ LED(17, 2), LED(18, 2), LED(19, 2), DELM, /* 60: L-alt */
+ LED(17, 3), LED(18, 3), LED(19, 3), LED(20, 3),
+ LED(21, 3), LED(16, 2), DELM, /* 61: space */
+ LED(20, 2), DELM, /* 62: R-alt */
+ DELM, /* 63: (null) */
+ LED(21, 2), DELM, /* 64: R-ctrl */
+ DELM, /* 65: (null) */
+ DELM, /* 66: (null) */
+ DELM, /* 67: (null) */
+ DELM, /* 68: (null) */
+ DELM, /* 69: (null) */
+ DELM, /* 70: (null) */
+ DELM, /* 71: (null) */
+ DELM, /* 72: (null) */
+ DELM, /* 73: (null) */
+ DELM, /* 74: (null) */
+ DELM, /* 75: (null) */
+ DELM, /* 76: (null) */
+ DELM, /* 77: (null) */
+ DELM, /* 78: (null) */
+ LED(19, 5), DELM, /* 79: left */
+ DELM, /* 80: (null) */
+ DELM, /* 81: (null) */
+ DELM, /* 82: (null) */
+ LED(20, 4), DELM, /* 83: up */
+ LED(20, 5), DELM, /* 84: down */
+ DELM, /* 85: (null) */
+ DELM, /* 86: (null) */
+ DELM, /* 87: (null) */
+ DELM, /* 88: (null) */
+ LED(21, 5), DELM, /* 89: right */
+ DELM, /* 90: (null) */
+ DELM, /* 91: (null) */
+ DELM, /* 92: (null) */
+ DELM, /* 93: (null) */
+ DELM, /* 94: (null) */
+ DELM, /* 95: (null) */
+ DELM, /* 96: (null) */
+ DELM, /* 97: (null) */
+ DELM, /* 98: (null) */
+ DELM, /* 99: (null) */
+ DELM, /* 100: (null) */
+ DELM, /* 101: (null) */
+ DELM, /* 102: (null) */
+ DELM, /* 103: (null) */
+ DELM, /* 104: (null) */
+ DELM, /* 105: (null) */
+ DELM, /* 106: (null) */
+ DELM, /* 107: (null) */
+ DELM, /* 108: (null) */
+ DELM, /* 109: (null) */
+ LED(0, 0), DELM, /* 110: esc */
+ LED(1, 0), DELM, /* T1: previous page */
+ LED(2, 0), DELM, /* T2: refresh */
+ LED(3, 0), DELM, /* T3: full screen */
+ LED(4, 0), DELM, /* T4: windows */
+ LED(5, 0), DELM, /* T5: screenshot */
+ LED(6, 0), DELM, /* T6: brightness down */
+ LED(7, 0), DELM, /* T7: brightness up */
+ LED(8, 0), DELM, /* T8: KB backlight off */
+ LED(9, 0), DELM, /* T9: play/pause */
+ LED(10, 0), DELM, /* T10: mute microphone */
+ LED(11, 0), DELM, /* T11: mute speakers */
+ LED(12, 0), DELM, /* T12: volume down */
+ LED(13, 0), DELM, /* T13: volume up */
+ DELM, /* T14: (null) */
+ DELM, /* T15: (null) */
+ DELM, /* 126: (null) */
+ DELM, /* 127: (null) */
};
#undef LED
#undef DELM
@@ -322,7 +319,7 @@ int board_get_entropy(void *buffer, int len)
uint8_t *data = buffer;
uint32_t start;
/* We expect one SOF per ms, so wait at most 2ms. */
- const uint32_t timeout = 2*MSEC;
+ const uint32_t timeout = 2 * MSEC;
for (i = 0; i < len; i++) {
STM32_CRS_ICR |= STM32_CRS_ICR_SYNCOKC;
@@ -353,8 +350,9 @@ __override const char *board_read_serial(void)
int i;
for (i = 0; i < idlen && pos < sizeof(str); i++, pos += 2) {
- snprintf(&str[pos], sizeof(str)-pos,
- "%02x", id[i]);
+ if (snprintf(&str[pos], sizeof(str) - pos, "%02x",
+ id[i]) < 0)
+ return NULL;
}
}
diff --git a/board/prism/board.h b/board/prism/board.h
index 1734624752..9cca111ba2 100644
--- a/board/prism/board.h
+++ b/board/prism/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,15 @@
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
-/* TODO: May remove CONFIG_SYSTEM_UNLOCKED prior to building MP FW. */
-#define CONFIG_SYSTEM_UNLOCKED
+/* Prism doesn't use WP GPIO, set WP enabled */
+#ifdef SECTION_IS_RO
+#define CONFIG_WP_ALWAYS
+#endif
/* TODO: May define FLASH_PSTATE_LOCKED prior to building MP FW. */
#undef CONFIG_FLASH_PSTATE_LOCKED
-/* USB ID. TODO: May need to find one for Prism. */
+/* USB ID for Prism */
#define CONFIG_USB_PID 0x5022
/* 48 MHz SYSCLK clock frequency */
@@ -24,15 +26,15 @@
#ifdef SECTION_IS_RW
#define CONFIG_KEYBOARD_BACKLIGHT
#define CONFIG_RGB_KEYBOARD
-#define GPIO_RGBKBD_SDB_L GPIO_SDB_L
-#define GPIO_RGBKBD_POWER GPIO_L_POWER
+#define GPIO_RGBKBD_SDB_L GPIO_SDB_L
+#define GPIO_RGBKBD_POWER GPIO_L_POWER
#define CONFIG_LED_DRIVER_IS31FL3743B
-#define SPI_RGB0_DEVICE_ID 0
-#define SPI_RGB1_DEVICE_ID 1
-#define RGB_GRID0_COL 11
-#define RGB_GRID0_ROW 6
-#define RGB_GRID1_COL 11
-#define RGB_GRID1_ROW 6
+#define SPI_RGB0_DEVICE_ID 0
+#define SPI_RGB1_DEVICE_ID 1
+#define RGB_GRID0_COL 11
+#define RGB_GRID0_ROW 6
+#define RGB_GRID1_COL 11
+#define RGB_GRID1_ROW 6
/* Enable control of SPI over USB */
#define CONFIG_SPI_CONTROLLER
@@ -74,27 +76,27 @@
/* Do not use a dedicated PSTATE bank */
#undef CONFIG_FLASH_PSTATE_BANK
-#define CONFIG_SHAREDLIB_SIZE 0
+#define CONFIG_SHAREDLIB_SIZE 0
-#define CONFIG_RO_MEM_OFF 0
-#define CONFIG_RO_STORAGE_OFF 0
-#define CONFIG_RO_SIZE (44*1024)
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_STORAGE_OFF 0
+#define CONFIG_RO_SIZE (44 * 1024)
/* EC rollback protection block */
#define CONFIG_ROLLBACK_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
#define CONFIG_ROLLBACK_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
-#define CONFIG_RW_STORAGE_OFF 0
-#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - CONFIG_RW_MEM_OFF)
+#define CONFIG_RW_MEM_OFF (CONFIG_ROLLBACK_OFF + CONFIG_ROLLBACK_SIZE)
+#define CONFIG_RW_STORAGE_OFF 0
+#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - CONFIG_RW_MEM_OFF)
-#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
-#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
-#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
-#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
+#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
+#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
+#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
-#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
-#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
+#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
+#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
/* The UART console is on USART1 (PA9/PA10) */
#undef CONFIG_UART_CONSOLE
@@ -120,24 +122,24 @@
#define CONFIG_USB_SERIALNO
/* Replaced at runtime (board_read_serial) by chip unique-id-based number. */
-#define DEFAULT_SERIALNO ""
+#define DEFAULT_SERIALNO "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#undef CONFIG_HOSTCMD_EVENTS
-#define USB_IFACE_UPDATE 0
+#undef CONFIG_HOSTCMD_EVENTS
+#define USB_IFACE_UPDATE 0
#ifdef SECTION_IS_RW
#define CONFIG_HOST_INTERFACE_USB
-#define USB_IFACE_HOSTCMD 1
-#define USB_IFACE_COUNT 2
+#define USB_IFACE_HOSTCMD 1
+#define USB_IFACE_COUNT 2
#else
-#define USB_IFACE_COUNT 1
+#define USB_IFACE_COUNT 1
#endif
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_UPDATE 1
-#define USB_EP_HOSTCMD 2
-#define USB_EP_COUNT 3
+#define USB_EP_CONTROL 0
+#define USB_EP_UPDATE 1
+#define USB_EP_HOSTCMD 2
+#define USB_EP_COUNT 3
/* Optional features */
#define CONFIG_BOARD_PRE_INIT
@@ -192,10 +194,10 @@
#endif
/* Maximum current to draw. */
-#define MAX_CURRENT_MA 2000
+#define MAX_CURRENT_MA 2000
/* Maximum current/voltage to provide over OTG. */
-#define MAX_OTG_CURRENT_MA 2000
-#define MAX_OTG_VOLTAGE_MV 20000
+#define MAX_OTG_CURRENT_MA 2000
+#define MAX_OTG_VOLTAGE_MV 20000
#ifndef __ASSEMBLER__
diff --git a/board/prism/build.mk b/board/prism/build.mk
index 824b05cab8..aed193a2e9 100644
--- a/board/prism/build.mk
+++ b/board/prism/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/prism/ec.tasklist b/board/prism/ec.tasklist
index 10fdb1b75f..aaf9b15a5e 100644
--- a/board/prism/ec.tasklist
+++ b/board/prism/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/prism/gpio.inc b/board/prism/gpio.inc
index 469ac690c6..2b8f2ee9b8 100644
--- a/board/prism/gpio.inc
+++ b/board/prism/gpio.inc
@@ -1,12 +1,10 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-GPIO(WP_L, PIN(A, 13), GPIO_INPUT | GPIO_PULL_UP)
-
#ifdef SECTION_IS_RW
GPIO(SDB_L, PIN(A, 0), GPIO_OUT_LOW)
@@ -24,3 +22,4 @@ ALTERNATE(PIN_MASK(A, 0x00e0), 0, MODULE_SPI_CONTROLLER, GPIO_PULL_UP)
ALTERNATE(PIN_MASK(A, 0x0600), 1, MODULE_UART, GPIO_PULL_UP)
UNIMPLEMENTED(ENTERING_RW)
+UNIMPLEMENTED(WP_L)
diff --git a/board/puff/board.c b/board/puff/board.c
index a893de33c3..d863b5fc0b 100644
--- a/board/puff/board.c
+++ b/board/puff/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,8 +45,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void power_monitor(void);
DECLARE_DEFERRED(power_monitor);
@@ -88,8 +88,8 @@ uint16_t tcpc_get_alert_status(void)
}
/* Called when the charge manager has switched to a new port. */
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Blink alert if insufficient power per system_can_boot_ap(). */
int insufficient_power =
@@ -105,14 +105,14 @@ static int32_t base_5v_power;
* Power usage for each port as measured or estimated.
* Units are milliwatts (5v x ma current)
*/
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1603)
-#define PWR_FRONT_LOW (5*963)
-#define PWR_REAR (5*1075)
-#define PWR_HDMI (5*562)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
+#define PWR_BASE_LOAD (5 * 1335)
+#define PWR_FRONT_HIGH (5 * 1603)
+#define PWR_FRONT_LOW (5 * 963)
+#define PWR_REAR (5 * 1075)
+#define PWR_HDMI (5 * 562)
+#define PWR_C_HIGH (5 * 3740)
+#define PWR_C_LOW (5 * 2090)
+#define PWR_MAX (5 * 10000)
/*
* Update the 5V power usage, assuming no throttling,
@@ -185,16 +185,14 @@ static const struct {
int current;
} bj_power[] = {
{ /* 0 - 65W (also default) */
- .voltage = 19000,
- .current = 3420
- },
+ .voltage = 19000,
+ .current = 3420 },
{ /* 1 - 90W */
- .voltage = 19000,
- .current = 4740
- },
+ .voltage = 19000,
+ .current = 4740 },
};
-#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
/* Debounced connection state of the barrel jack */
static int8_t adp_connected = -1;
static void adp_connect_deferred(void)
@@ -239,29 +237,26 @@ static void adp_state_init(void)
}
DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
-
#include "gpio_list.h" /* Must come after other header files. */
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_GREEN] = { .channel = 2,
- .flags = PWM_CONFIG_ACTIVE_LOW |
- PWM_CONFIG_DSLEEP,
- .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_LED_GREEN] = { .channel = 2,
+ .flags = PWM_CONFIG_ACTIVE_LOW |
+ PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
/******************************************************************************/
@@ -277,52 +272,44 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.flags = TCPC_FLAGS_RESET_ACTIVE_HIGH,
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
};
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "ina",
- .port = I2C_PORT_INA,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "ppc0",
- .port = I2C_PORT_PPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 400,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -378,15 +365,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
+const enum gpio_signal hibernate_wake_pins[] = {};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -405,7 +391,7 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -414,8 +400,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(68), \
@@ -434,8 +420,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
@@ -537,16 +523,13 @@ static void board_chipset_startup(void)
if (ppc_is_sourcing_vbus(0))
ppc_vbus_source_enable(0, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
/******************************************************************************/
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_TCPC_0] = {
- .i2c_port = I2C_PORT_PPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ [USB_PD_PORT_TCPC_0] = { .i2c_port = I2C_PORT_PPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -579,14 +562,12 @@ static void board_tcpc_init(void)
/*
* By default configured as output low.
*/
- gpio_set_flags(GPIO_USB_A4_OC_ODL,
- GPIO_INPUT | GPIO_INT_BOTH);
+ gpio_set_flags(GPIO_USB_A4_OC_ODL, GPIO_INPUT | GPIO_INT_BOTH);
gpio_enable_interrupt(GPIO_USB_A4_OC_ODL);
} else {
/* Ensure no interrupts from pin */
gpio_disable_interrupt(GPIO_USB_A4_OC_ODL);
}
-
}
/* Make sure this is called after fw_config is initialised */
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 2);
@@ -705,8 +686,8 @@ void board_enable_s0_rails(int enable)
unsigned int ec_config_get_bj_power(void)
{
- unsigned int bj =
- (fw_config & EC_CFG_BJ_POWER_MASK) >> EC_CFG_BJ_POWER_L;
+ unsigned int bj = (fw_config & EC_CFG_BJ_POWER_MASK) >>
+ EC_CFG_BJ_POWER_L;
/* Out of range value defaults to 0 */
if (bj >= ARRAY_SIZE(bj_power))
bj = 0;
@@ -781,23 +762,23 @@ DECLARE_HOOK(HOOK_INIT, setup_thermal, HOOK_PRIO_DEFAULT - 1);
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
+#define THROT_TYPE_A BIT(0)
+#define THROT_TYPE_C BIT(1)
+#define THROT_PROCHOT BIT(2)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -812,8 +793,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
@@ -841,7 +821,7 @@ static void power_monitor(void)
*/
power = (adc_read_channel(ADC_VBUS) *
adc_read_channel(ADC_PPVAR_IMON)) /
- 1000;
+ 1000;
/* Init power table */
if (history[0] == 0) {
for (i = 0; i < POWER_READINGS; i++)
@@ -868,8 +848,7 @@ static void power_monitor(void)
* For barrel-jack supplies, the rating can be
* exceeded briefly, so use the average.
*/
- if (charge_manager_get_supplier() ==
- CHARGE_SUPPLIER_PD)
+ if (charge_manager_get_supplier() == CHARGE_SUPPLIER_PD)
power = max;
else
power = total / POWER_READINGS;
@@ -961,8 +940,9 @@ static void power_monitor(void)
gpio_set_level(GPIO_EC_PROCHOT_ODL, prochot);
}
if (diff & THROT_TYPE_C) {
- enum tcpc_rp_value rp = (new_state & THROT_TYPE_C)
- ? TYPEC_RP_1A5 : TYPEC_RP_3A0;
+ enum tcpc_rp_value rp = (new_state & THROT_TYPE_C) ?
+ TYPEC_RP_1A5 :
+ TYPEC_RP_3A0;
ppc_set_vbus_source_current_limit(0, rp);
tcpm_select_rp_value(0, rp);
diff --git a/board/puff/board.h b/board/puff/board.h
index 185c3d0076..59c177c604 100644
--- a/board/puff/board.h
+++ b/board/puff/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
#define CONFIG_UART_TX_BUF_SIZE 4096
/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
/* Internal SPI flash on NPCX796FC is 512 kB */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
@@ -40,7 +40,7 @@
#undef CONFIG_HIBERNATE
#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
#define CONFIG_PWM
#define CONFIG_VBOOT_EFS2
@@ -85,7 +85,7 @@
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
/* Dedicated barreljack charger port */
-#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
#define DEDICATED_CHARGE_PORT 1
@@ -104,15 +104,15 @@
#define CONFIG_INA3221
/* b/143501304 */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 4000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 2000 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 8000 /* us */
-#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Fan and temp. */
#define CONFIG_FANS 1
@@ -136,7 +136,7 @@
#define CONFIG_USB_PD_DECODE_SOP
#undef CONFIG_USB_CHARGER
#define CONFIG_USB_POWER_DELIVERY
-#define CONFIG_USB_PID 0x5040
+#define CONFIG_USB_PID 0x5040
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_ALT_MODE_DFP
#define CONFIG_USB_PD_DISCHARGE_PPC
@@ -156,7 +156,7 @@
#define CONFIG_USBC_VCONN
#define CONFIG_USBC_VCONN_SWAP
-#define USB_PD_PORT_TCPC_0 0
+#define USB_PD_PORT_TCPC_0 0
#define BOARD_TCPC_C0_RESET_HOLD_DELAY ANX74XX_RESET_HOLD_MS
#define BOARD_TCPC_C0_RESET_POST_DELAY ANX74XX_RESET_HOLD_MS
@@ -168,12 +168,12 @@
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_INA NPCX_I2C_PORT0_0
+#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
@@ -191,11 +191,11 @@ enum charge_port {
};
enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_SNS_PP3300, /* ADC2 */
+ ADC_SNS_PP1050, /* ADC7 */
+ ADC_VBUS, /* ADC4 */
+ ADC_PPVAR_IMON, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
/* Number of ADC channels */
ADC_CH_COUNT
};
@@ -220,11 +220,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_CORE,
- TEMP_SENSOR_COUNT
-};
-
+enum temp_sensor_id { TEMP_SENSOR_CORE, TEMP_SENSOR_COUNT };
/* Board specific handlers */
void board_reset_pd_mcu(void);
@@ -238,20 +234,20 @@ void show_critical_error(void);
/*
* Barrel-jack power (4 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 3
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
/*
* USB Connector 4 not present (1 bit).
*/
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
+#define EC_CFG_NO_USB4_L 4
+#define EC_CFG_NO_USB4_H 4
#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
/*
* Thermal solution config (3 bits).
*/
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
+#define EC_CFG_THERMAL_L 5
+#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
unsigned int ec_config_get_bj_power(void);
@@ -261,30 +257,30 @@ unsigned int ec_config_get_thermal_solution(void);
#endif /* !__ASSEMBLER__ */
/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
/*
* There is no RSMRST input, so alias it to the output. This short-circuits
* common_intel_x86_handle_rsmrst.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/puff/build.mk b/board/puff/build.mk
index e9968d5710..3edfc84c2f 100644
--- a/board/puff/build.mk
+++ b/board/puff/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/puff/ec.tasklist b/board/puff/ec.tasklist
index ae10417dff..d579f65fd9 100644
--- a/board/puff/ec.tasklist
+++ b/board/puff/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/puff/gpio.inc b/board/puff/gpio.inc
index b51f595e81..5f7650a682 100644
--- a/board/puff/gpio.inc
+++ b/board/puff/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
/* EC output, but also interrupt so this can be polled as a power signal */
GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
#endif
GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/puff/led.c b/board/puff/led.c
index ba87f05460..9cca110467 100644
--- a/board/puff/led.c
+++ b/board/puff/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -89,9 +89,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -214,7 +214,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
diff --git a/board/puff/usb_pd_policy.c b/board/puff/usb_pd_policy.c
index 9b0a372400..e3fc86c8ca 100644
--- a/board/puff/usb_pd_policy.c
+++ b/board/puff/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,9 +19,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
-
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/quackingstick/base_detect.c b/board/quackingstick/base_detect.c
index d008226125..620381f09b 100644
--- a/board/quackingstick/base_detect.c
+++ b/board/quackingstick/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Base detection and debouncing */
#define BASE_DETECT_EN_DEBOUNCE_US (350 * MSEC)
@@ -93,8 +93,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -211,7 +211,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/quackingstick/battery.c b/board/quackingstick/battery.c
index 43cd8b9d8b..5376e74dc5 100644
--- a/board/quackingstick/battery.c
+++ b/board/quackingstick/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/quackingstick/board.c b/board/quackingstick/board.c
index 9756eb0651..6cdf814c74 100644
--- a/board/quackingstick/board.c
+++ b/board/quackingstick/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,10 +40,10 @@
#include "thermal.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
+#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -102,34 +102,26 @@ static void board_connect_c0_sbu(enum gpio_signal s)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -204,11 +196,9 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -231,11 +221,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
@@ -262,11 +255,9 @@ enum lid_accelgyro_type {
static enum lid_accelgyro_type lid_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
@@ -365,8 +356,7 @@ static void board_detect_motionsensor(void)
return;
/* Check base accelgyro chip */
- icm_read8(&motion_sensors_icm[LID_ACCEL], ICM42607_REG_WHO_AM_I,
- &val);
+ icm_read8(&motion_sensors_icm[LID_ACCEL], ICM42607_REG_WHO_AM_I, &val);
if (val == ICM42607_CHIP_ICM42607P) {
motion_sensors[LID_ACCEL] = motion_sensors_icm[LID_ACCEL];
motion_sensors[LID_GYRO] = motion_sensors_icm[LID_GYRO];
@@ -443,9 +433,31 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
+}
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
+
+enum battery_present battery_is_present(void)
+{
+ static int first_check_done;
+
+ /*
+ * b/231911921: It's found that the D-FET status is incorrect
+ * when the battery resume from cut off. The battery needs
+ * about 2s to ready to discharge so delay 2s before charge
+ * manager init.
+ */
+ if (!first_check_done) {
+ if (battery_get_disconnect_state() ==
+ BATTERY_NOT_DISCONNECTED) {
+ CPRINTS("Delay 2s on the first power on.");
+ sleep(2);
+ }
+ first_check_done = 1;
+ }
+
+ return gpio_get_level(GPIO_BATT_PRES_ODL) ? BP_NO : BP_YES;
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
void board_hibernate(void)
{
@@ -455,8 +467,7 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 1+ has the hardware fix. Don't need the following
@@ -550,8 +561,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -579,7 +589,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -603,24 +612,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -629,7 +636,7 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
static void pen_input_deferred(void)
{
bool pen_charge_enable = !gpio_get_level(GPIO_EC_PEN_PDCT_L) &&
- !chipset_in_state(CHIPSET_STATE_ANY_OFF);
+ !chipset_in_state(CHIPSET_STATE_ANY_OFF);
gpio_set_level(GPIO_PEN_PWR_EN, pen_charge_enable);
diff --git a/board/quackingstick/board.h b/board/quackingstick/board.h
index f537d6b472..9b50237b4d 100644
--- a/board/quackingstick/board.h
+++ b/board/quackingstick/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,7 +13,7 @@
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Save some flash space */
#define CONFIG_LTO
@@ -26,8 +26,9 @@
#undef CONFIG_CMD_TASK_RESET
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
-#define CONFIG_BATTERY_REVIVE_DISCONNECT
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#undef CONFIG_BATTERY_PRESENT_GPIO
+#define CONFIG_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -82,10 +83,7 @@ enum adc_channel {
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_SYS2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_SYS2, TEMP_SENSOR_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -94,10 +92,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_DISPLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_DISPLIGHT = 0, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/quackingstick/build.mk b/board/quackingstick/build.mk
index 452abeb591..363ef59a16 100644
--- a/board/quackingstick/build.mk
+++ b/board/quackingstick/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/quackingstick/ec.tasklist b/board/quackingstick/ec.tasklist
index 0b6b66ab71..6cc550374d 100644
--- a/board/quackingstick/ec.tasklist
+++ b/board/quackingstick/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/quackingstick/gpio.inc b/board/quackingstick/gpio.inc
index c126b59977..ee3cedf704 100644
--- a/board/quackingstick/gpio.inc
+++ b/board/quackingstick/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/quackingstick/led.c b/board/quackingstick/led.c
index e282459476..a18124f2be 100644
--- a/board/quackingstick/led.c
+++ b/board/quackingstick/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -35,15 +35,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_BLUE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_LED_ORANGE,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_LED_BLUE,
- (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -69,7 +69,6 @@ static void board_led_set_battery(void)
static int battery_ticks;
int color = LED_OFF;
int period = 0;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -80,7 +79,7 @@ static void board_led_set_battery(void)
break;
case PWR_STATE_DISCHARGE:
if (chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_ANY_SUSPEND)) {
+ CHIPSET_STATE_ANY_SUSPEND)) {
/* Discharging in S3: Amber 1 sec, off 3 sec */
period = (1 + 3) * LED_ONE_SEC;
battery_ticks = battery_ticks % period;
@@ -89,7 +88,7 @@ static void board_led_set_battery(void)
else
color = LED_OFF;
} else if (chipset_in_or_transitioning_to_state(
- CHIPSET_STATE_ANY_OFF)) {
+ CHIPSET_STATE_ANY_OFF)) {
/* Discharging in S5: off */
color = LED_OFF;
} else {
@@ -111,16 +110,16 @@ static void board_led_set_battery(void)
color = LED_BLUE;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode: Blue 2 sec, Amber 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_BLUE;
- else
- color = LED_AMBER;
- } else
+ color = LED_BLUE;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode: Blue 2 sec, Amber 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_BLUE;
+ else
+ color = LED_AMBER;
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/quackingstick/usbc_config.c b/board/quackingstick/usbc_config.c
index 1873e916ad..8107e2c286 100644
--- a/board/quackingstick/usbc_config.c
+++ b/board/quackingstick/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "usb_pd.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
@@ -25,16 +25,16 @@ const struct charger_config_t chg_chips[] = {
};
struct temp_chg_step {
- int low; /* temp thershold ('C) to lower level*/
- int high; /* temp thershold ('C) to higher level */
- int current; /* charging limitation (mA) */
+ int low; /* temp thershold ('C) to lower level*/
+ int high; /* temp thershold ('C) to higher level */
+ int current; /* charging limitation (mA) */
};
static const struct temp_chg_step temp_chg_table[] = {
- {.low = 0, .high = 50, .current = 3000}, /* Lv0: normal charge */
- {.low = 48, .high = 53, .current = 1500},
- {.low = 51, .high = 56, .current = 1000},
- {.low = 54, .high = 100, .current = 800},
+ { .low = 0, .high = 50, .current = 3000 }, /* Lv0: normal charge */
+ { .low = 48, .high = 53, .current = 1500 },
+ { .low = 51, .high = 56, .current = 1000 },
+ { .low = 54, .high = 100, .current = 800 },
};
#define NUM_TEMP_CHG_LEVELS ARRAY_SIZE(temp_chg_table)
@@ -64,8 +64,9 @@ int charger_profile_override(struct charge_state_data *curr)
if (current_level >= NUM_TEMP_CHG_LEVELS)
current_level = NUM_TEMP_CHG_LEVELS - 1;
- curr->requested_current = MIN(curr->requested_current,
- temp_chg_table[current_level].current);
+ curr->requested_current =
+ MIN(curr->requested_current,
+ temp_chg_table[current_level].current);
}
/* Lower the max requested voltage to 5V when battery is full. */
diff --git a/board/quiche/board.c b/board/quiche/board.c
index 67d4c00297..454cd2ce6a 100644
--- a/board/quiche/board.c
+++ b/board/quiche/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,8 +29,8 @@
#include "usb_tc_sm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
#define QUICHE_PD_DEBUG_LVL 1
@@ -104,29 +104,29 @@ static void board_usbc_usb3_interrupt(enum gpio_signal signal)
* signals is driven by USB/MST hub power sequencing requirements.
*/
const struct power_seq board_power_seq[] = {
- {GPIO_EN_AC_JACK, 1, 20},
- {GPIO_EC_DFU_MUX_CTRL, 0, 0},
- {GPIO_EN_PP5000_A, 1, 31},
- {GPIO_MST_LP_CTL_L, 1, 0},
- {GPIO_EN_PP3300_B, 1, 1},
- {GPIO_EN_PP1100_A, 1, 100+30},
- {GPIO_EN_BB, 1, 30},
- {GPIO_EN_PP1050_A, 1, 30},
- {GPIO_EN_PP1200_A, 1, 20},
- {GPIO_EN_PP5000_C, 1, 20},
- {GPIO_EN_PP5000_HSPORT, 1, 31},
- {GPIO_EN_DP_SINK, 1, 80},
- {GPIO_MST_RST_L, 1, 61},
- {GPIO_EC_HUB2_RESET_L, 1, 41},
- {GPIO_EC_HUB3_RESET_L, 1, 33},
- {GPIO_DP_SINK_RESET, 1, 100},
- {GPIO_USBC_DP_PD_RST_L, 1, 100},
- {GPIO_USBC_UF_RESET_L, 1, 33},
- {GPIO_DEMUX_DUAL_DP_PD_N, 1, 100},
- {GPIO_DEMUX_DUAL_DP_RESET_N, 1, 100},
- {GPIO_DEMUX_DP_HDMI_PD_N, 1, 10},
- {GPIO_DEMUX_DUAL_DP_MODE, 1, 10},
- {GPIO_DEMUX_DP_HDMI_MODE, 1, 5},
+ { GPIO_EN_AC_JACK, 1, 20 },
+ { GPIO_EC_DFU_MUX_CTRL, 0, 0 },
+ { GPIO_EN_PP5000_A, 1, 31 },
+ { GPIO_MST_LP_CTL_L, 1, 0 },
+ { GPIO_EN_PP3300_B, 1, 1 },
+ { GPIO_EN_PP1100_A, 1, 100 + 30 },
+ { GPIO_EN_BB, 1, 30 },
+ { GPIO_EN_PP1050_A, 1, 30 },
+ { GPIO_EN_PP1200_A, 1, 20 },
+ { GPIO_EN_PP5000_C, 1, 20 },
+ { GPIO_EN_PP5000_HSPORT, 1, 31 },
+ { GPIO_EN_DP_SINK, 1, 80 },
+ { GPIO_MST_RST_L, 1, 61 },
+ { GPIO_EC_HUB2_RESET_L, 1, 41 },
+ { GPIO_EC_HUB3_RESET_L, 1, 33 },
+ { GPIO_DP_SINK_RESET, 1, 100 },
+ { GPIO_USBC_DP_PD_RST_L, 1, 100 },
+ { GPIO_USBC_UF_RESET_L, 1, 33 },
+ { GPIO_DEMUX_DUAL_DP_PD_N, 1, 100 },
+ { GPIO_DEMUX_DUAL_DP_RESET_N, 1, 100 },
+ { GPIO_DEMUX_DP_HDMI_PD_N, 1, 10 },
+ { GPIO_DEMUX_DUAL_DP_MODE, 1, 10 },
+ { GPIO_DEMUX_DP_HDMI_MODE, 1, 5 },
};
const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
@@ -134,13 +134,13 @@ const size_t board_power_seq_count = ARRAY_SIZE(board_power_seq);
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Quiche"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] =
- USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Quiche"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] =
+ USB_STRING_DESC(CROS_EC_SECTION ":" CROS_EC_VERSION32),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -159,8 +159,7 @@ struct ppc_config_t ppc_chips[] = {
* PS8802 set mux board tuning.
* Adds in board specific gain and DP lane count configuration
*/
-static int board_ps8822_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8822_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
int rv = EC_SUCCESS;
@@ -187,40 +186,38 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_HOST] = {
- .usb_port = USB_PD_PORT_HOST,
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = PS8822_I2C_ADDR3_FLAG,
- .driver = &ps8822_usb_mux_driver,
- .board_set = &board_ps8822_mux_set,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_HOST,
+ .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = PS8822_I2C_ADDR3_FLAG,
+ .driver = &ps8822_usb_mux_driver,
+ .board_set = &board_ps8822_mux_set,
+ },
},
[USB_PD_PORT_DP] = {
- .usb_port = USB_PD_PORT_DP,
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR2_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_DP,
+ .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = PS8XXX_I2C_ADDR2_FLAGS,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
};
/* USB-C PPC Configuration */
struct ppc_config_t ppc_chips[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [USB_PD_PORT_HOST] = {
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_DP] = {
- .i2c_port = I2C_PORT_I2C1,
- .i2c_addr_flags = SN5S330_ADDR2_FLAGS,
- .drv = &sn5s330_drv
- },
- [USB_PD_PORT_USB3] = {
- .i2c_port = I2C_PORT_I2C3,
- .i2c_addr_flags = SN5S330_ADDR1_FLAGS,
- .drv = &sn5s330_drv
- },
+ [USB_PD_PORT_HOST] = { .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ [USB_PD_PORT_DP] = { .i2c_port = I2C_PORT_I2C1,
+ .i2c_addr_flags = SN5S330_ADDR2_FLAGS,
+ .drv = &sn5s330_drv },
+ [USB_PD_PORT_USB3] = { .i2c_port = I2C_PORT_I2C3,
+ .i2c_addr_flags = SN5S330_ADDR1_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -366,14 +363,13 @@ static void board_usb_tc_disconnect(void)
if (port == USB_PD_PORT_HOST)
gpio_set_level(GPIO_UFP_PLUG_DET, 1);
}
-DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect,
HOOK_PRIO_DEFAULT);
#endif /* SECTION_IS_RW */
static void board_init(void)
{
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -410,7 +406,7 @@ void board_debug_gpio(enum debug_gpio trigger, int level, int pulse_usec)
}
}
-static int command_dplane(int argc, char **argv)
+static int command_dplane(int argc, const char **argv)
{
char *e;
int lane;
@@ -438,6 +434,4 @@ static int command_dplane(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(dplane, command_dplane,
- "<2 | 4>",
- "MST lane control.");
+DECLARE_CONSOLE_COMMAND(dplane, command_dplane, "<2 | 4>", "MST lane control.");
diff --git a/board/quiche/board.h b/board/quiche/board.h
index 98feab31f6..b1ba0c5eba 100644
--- a/board/quiche/board.h
+++ b/board/quiche/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,11 +20,10 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */
#undef CONFIG_FLASH_PSTATE_LOCKED
-
/* USB Type C and USB PD defines */
-#define USB_PD_PORT_HOST 0
-#define USB_PD_PORT_DP 1
-#define USB_PD_PORT_USB3 2
+#define USB_PD_PORT_HOST 0
+#define USB_PD_PORT_DP 1
+#define USB_PD_PORT_USB3 2
/*
* The host (C0) and display (C1) usbc ports are usb-pd capable. There is
@@ -41,9 +40,9 @@
#define CONFIG_USB_PD_IDENTITY_SW_VERS 1
/* I2C port names */
-#define I2C_PORT_I2C1 0
-#define I2C_PORT_I2C2 1
-#define I2C_PORT_I2C3 2
+#define I2C_PORT_I2C1 0
+#define I2C_PORT_I2C2 1
+#define I2C_PORT_I2C3 2
/* Required symbolic I2C port names */
#define I2C_PORT_MP4245 I2C_PORT_I2C3
@@ -71,7 +70,7 @@
#define GPIO_TRIGGER_1 GPIO_EC_STATUS_LED1
#define GPIO_TRIGGER_2 GPIO_EC_STATUS_LED2
-enum debug_gpio {
+enum debug_gpio {
TRIGGER_1 = 0,
TRIGGER_2,
};
diff --git a/board/quiche/build.mk b/board/quiche/build.mk
index 1a8ec0d625..76a59e502a 100644
--- a/board/quiche/build.mk
+++ b/board/quiche/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/quiche/ec.tasklist b/board/quiche/ec.tasklist
index cc36bf5a74..ffd4a604c9 100644
--- a/board/quiche/ec.tasklist
+++ b/board/quiche/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/quiche/gpio.inc b/board/quiche/gpio.inc
index 9514858ca7..afd18e5bb6 100644
--- a/board/quiche/gpio.inc
+++ b/board/quiche/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/rainier/board.c b/board/rainier/board.c
index c992584d76..07a006b671 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,8 +40,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -65,41 +65,39 @@ static void warm_reset_request_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 16, 4096, 0, STM32_AIN(10)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 16, 4096, 0, STM32_AIN(10) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD"},
- {GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD"},
- {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
+ { GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD" },
+ { GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD" },
+ { GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD" },
+ { GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
#ifdef CONFIG_TEMP_SENSOR_TMP432
/* Temperature sensors data; must be in same order as enum temp_sensor_id. */
const struct temp_sensor_t temp_sensors[] = {
- {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL, 4},
- {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1, 4},
- {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE2, 4},
+ { "TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL, 4 },
+ { "TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1, 4 },
+ { "TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE2, 4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -108,9 +106,9 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
* same order as enum temp_sensor_id. To always ignore any temp, use 0.
*/
struct ec_thermal_config thermal_params[] = {
- {{0, 0, 0}, 0, 0}, /* TMP432_Internal */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Internal */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Sensor_1 */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Sensor_2 */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
#endif
@@ -125,9 +123,8 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* Wake-up pins for hibernate */
-const enum gpio_signal hibernate_wake_pins[] = {
- GPIO_POWER_BUTTON_L, GPIO_CHARGER_INT_L
-};
+const enum gpio_signal hibernate_wake_pins[] = { GPIO_POWER_BUTTON_L,
+ GPIO_CHARGER_INT_L };
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
@@ -142,11 +139,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
};
@@ -173,8 +173,8 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* NOP because there is no internal power therefore no charging.
@@ -190,7 +190,7 @@ int extpower_is_present(void)
int pd_snk_is_vbus_provided(int port)
{
- /* Must be, if we're at a stage where this function is called. */
+ /* Must be, if we're at a stage where this function is called. */
return 1;
}
@@ -207,8 +207,7 @@ static void board_spi_enable(void)
spi_enable(&spi_devices[0], 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -220,9 +219,8 @@ static void board_spi_disable(void)
gpio_config_module(MODULE_SPI_CONTROLLER, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
- MOTION_SENSE_HOOK_PRIO + 1);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
+ MOTION_SENSE_HOOK_PRIO + 1);
static void board_init(void)
{
@@ -255,8 +253,8 @@ void board_config_pre_init(void)
* Ch4: USART1_TX / Ch5: USART1_RX (1000)
* Ch6: SPI2_RX / Ch7: SPI2_TX (0011)
*/
- STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) |
- (3 << 20) | (3 << 24);
+ STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) | (3 << 20) |
+ (3 << 24);
}
void board_hibernate(void)
@@ -301,16 +299,16 @@ struct {
enum rainier_board_version version;
int expect_mv;
} const rainier_boards[] = {
- { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
- { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
- { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
- { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
- { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
- { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
- { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
- { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
- { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
- { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
+ { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
+ { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
+ { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
+ { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
+ { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
+ { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
+ { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
+ { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
+ { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
+ { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
{ BOARD_VERSION_REV10, 1240 }, /* 56K , 124K ohm */
{ BOARD_VERSION_REV11, 1343 }, /* 51.1K , 150K ohm */
{ BOARD_VERSION_REV12, 1457 }, /* 47K , 200K ohm */
@@ -358,11 +356,9 @@ static struct mutex g_base_mutex;
static struct bmi_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct bmp280_drv_data_t bmp280_drv_data;
@@ -436,9 +432,3 @@ int board_allow_i2c_passthru(const struct i2c_cmd_desc_t *cmd_desc)
*/
return 0;
}
-
-int charge_prevent_power_on(int power_button_pressed)
-{
- /* Assume there is always sufficient power from charger to power on. */
- return 0;
-}
diff --git a/board/rainier/board.h b/board/rainier/board.h
index e3d333e2f1..3cf5405f9a 100644
--- a/board/rainier/board.h
+++ b/board/rainier/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
/* Optional modules */
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#define CONFIG_CHIPSET_RK3399
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_RTC
@@ -30,11 +30,11 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
/* Region sizes are no longer a power of 2 so we can't enable MPU */
-#undef CONFIG_MPU
+#undef CONFIG_MPU
/* Enable a different power-on sequence than the one on gru */
#undef CONFIG_CHIPSET_POWER_SEQ_VERSION
@@ -104,38 +104,38 @@
#define CONFIG_USB_PD_COMM_LOCKED
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 12850
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 12850
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Timer selection */
-#define TIM_CLOCK32 2
+#define TIM_CLOCK32 2
#define TIM_WATCHDOG 7
/* 48 MHz SYSCLK clock frequency */
#define CPU_CLOCK 48000000
/* Optional for testing */
-#undef CONFIG_PECI
-#undef CONFIG_PSTORE
+#undef CONFIG_PECI
+#undef CONFIG_PSTORE
#define CONFIG_TASK_PROFILING
#define I2C_PORT_TCPC0 1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_MKBP_INPUT_DEVICES
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
/* Define the host events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
#ifndef __ASSEMBLER__
diff --git a/board/rainier/build.mk b/board/rainier/build.mk
index b77a900d56..b95d9dc46e 100644
--- a/board/rainier/build.mk
+++ b/board/rainier/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/rainier/ec.tasklist b/board/rainier/ec.tasklist
index ed574a1d6a..5008495942 100644
--- a/board/rainier/ec.tasklist
+++ b/board/rainier/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/rainier/gpio.inc b/board/rainier/gpio.inc
index f5a4f360b3..1cf1080e05 100644
--- a/board/rainier/gpio.inc
+++ b/board/rainier/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/rainier/usb_pd_policy.c b/board/rainier/usb_pd_policy.c
index 6de1dc9271..45a51015a6 100644
--- a/board/rainier/usb_pd_policy.c
+++ b/board/rainier/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -18,8 +18,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en;
diff --git a/board/rammus/battery.c b/board/rammus/battery.c
index 1ae15e9dcc..9a538cc5e6 100644
--- a/board/rammus/battery.c
+++ b/board/rammus/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -17,8 +17,8 @@
static enum battery_present batt_pres_prev = BP_NOT_SURE;
/* Shutdown mode parameters to write to manufacturer access register */
-#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
-#define SB_SHUTDOWN_DATA 0x0010
+#define SB_SHIP_MODE_REG SB_MANUFACTURER_ACCESS
+#define SB_SHUTDOWN_DATA 0x0010
static const struct battery_info info = {
.voltage_max = 13200,
@@ -63,8 +63,9 @@ static int battery_init(void)
{
int batt_status;
- return battery_status(&batt_status) ? 0 :
- !!(batt_status & STATUS_INITIALIZED);
+ return battery_status(&batt_status) ?
+ 0 :
+ !!(batt_status & STATUS_INITIALIZED);
}
/*
@@ -85,13 +86,13 @@ static int battery_check_disconnect(void)
uint8_t data[6];
/* Check if battery charging + discharging is disabled. */
- rv = sb_read_mfgacc(PARAM_OPERATION_STATUS,
- SB_ALT_MANUFACTURER_ACCESS, data, sizeof(data));
+ rv = sb_read_mfgacc(PARAM_OPERATION_STATUS, SB_ALT_MANUFACTURER_ACCESS,
+ data, sizeof(data));
if (rv)
return BATTERY_DISCONNECT_ERROR;
- if ((data[3] & (BATTERY_DISCHARGING_DISABLED |
- BATTERY_CHARGING_DISABLED)) ==
+ if ((data[3] &
+ (BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED)) ==
(BATTERY_DISCHARGING_DISABLED | BATTERY_CHARGING_DISABLED))
return BATTERY_DISCONNECTED;
diff --git a/board/rammus/board.c b/board/rammus/board.c
index a27828694d..8cbc6c6856 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,6 +39,7 @@
#include "math_util.h"
#include "motion_lid.h"
#include "motion_sense.h"
+#include "panic.h"
#include "pi3usb9281.h"
#include "power.h"
#include "power_button.h"
@@ -59,11 +60,11 @@
#include "util.h"
#include "espi.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
-#define USB_PD_PORT_PS8751 1
-#define USB_PD_PORT_ANX7447 0
+#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX7447 0
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -130,53 +131,44 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vbus sensing (10x voltage divider). */
- [ADC_VBUS] = {"VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT*10, ADC_READ_MAX+1, 0},
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH2, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {"AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT*1000/18,
- ADC_READ_MAX+1, 0},
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH1, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "i2c_0_0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_I2C0_0_SCL,
- .sda = GPIO_I2C0_0_SDA
- },
- {
- .name = "i2c_0_1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_I2C0_1_SCL,
- .sda = GPIO_I2C0_1_SDA
- },
- {
- .name = "i2c_1",
- .port = NPCX_I2C_PORT1,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "i2c_2",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "i2c_3",
- .port = NPCX_I2C_PORT3,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "i2c_0_0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_I2C0_0_SCL,
+ .sda = GPIO_I2C0_0_SDA },
+ { .name = "i2c_0_1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_I2C0_1_SCL,
+ .sda = GPIO_I2C0_1_SDA },
+ { .name = "i2c_1",
+ .port = NPCX_I2C_PORT1,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "i2c_2",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "i2c_3",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -210,16 +202,20 @@ struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_PS8751] = {
- .usb_port = USB_PD_PORT_PS8751,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_PS8751,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_ANX7447] = {
- .usb_port = USB_PD_PORT_ANX7447,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_ANX7447,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
}
};
@@ -262,7 +258,7 @@ static void ps8751_i2c_remap(void)
uint32_t board_version;
if (cbi_get_board_version(&board_version) != EC_SUCCESS ||
- board_version > 1)
+ board_version > 1)
return;
/*
* Due to b/118063849, we separate the ps8751 and anx3447 to
@@ -293,9 +289,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
uint16_t tcpc_get_alert_status(void)
{
@@ -315,17 +311,17 @@ uint16_t tcpc_get_alert_status(void)
}
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
/* These BD99992GW temp sensors are only readable in S0 */
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM1},
- {"DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM2},
- {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
- BD99992GW_ADC_CHANNEL_SYSTHERM3},
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM1 },
+ { "DRAM", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM2 },
+ { "eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val,
+ BD99992GW_ADC_CHANNEL_SYSTHERM3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -341,8 +337,8 @@ static void board_report_pmic_fault(const char *str)
uint32_t info;
/* RESETIRQ1 -- Bit 4: VRFAULT */
- if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault)
- != EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x8, &vrfault) !=
+ EC_SUCCESS)
return;
if (!(vrfault & BIT(4)))
@@ -433,8 +429,7 @@ static void board_pmic_enable_slp_s0_vr_decay(void)
i2c_write8(I2C_PORT_PMIC, I2C_ADDR_BD99992_FLAGS, 0x38, 0x7a);
}
-__override void power_board_handle_host_sleep_event(
- enum host_sleep_event state)
+__override void power_board_handle_host_sleep_event(enum host_sleep_event state)
{
if (state == HOST_SLEEP_EVENT_S0IX_SUSPEND)
board_pmic_enable_slp_s0_vr_decay();
@@ -508,7 +503,7 @@ static void usb_charge_mode_init(void)
* inhibit_charging_in_suspend.
*/
usb_charge_set_mode(0, CONFIG_USB_PORT_POWER_SMART_DEFAULT_MODE,
- USB_DISALLOW_SUSPEND_CHARGE);
+ USB_DISALLOW_SUSPEND_CHARGE);
}
DECLARE_HOOK(HOOK_INIT, usb_charge_mode_init, HOOK_PRIO_DEFAULT + 1);
@@ -552,10 +547,12 @@ int board_set_active_charge_port(int charge_port)
} else {
/* Make sure non-charging port is disabled */
gpio_set_level(charge_port ? GPIO_EN_USB_C0_CHARGE_EC_L :
- GPIO_EN_USB_C1_CHARGE_EC_L, 1);
+ GPIO_EN_USB_C1_CHARGE_EC_L,
+ 1);
/* Enable charging port */
gpio_set_level(charge_port ? GPIO_EN_USB_C1_CHARGE_EC_L :
- GPIO_EN_USB_C0_CHARGE_EC_L, 0);
+ GPIO_EN_USB_C0_CHARGE_EC_L,
+ 0);
}
return EC_SUCCESS;
@@ -569,8 +566,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Limit the input current to 96% negotiated limit,
@@ -578,8 +575,7 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 96 / 100;
charge_set_input_current_limit(
- MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
void board_hibernate(void)
@@ -625,23 +621,17 @@ static struct accelgyro_saved_data_t g_bma255_data;
static struct kionix_accel_data g_kx022_data;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0 },
- { 0, FLOAT_TO_FP(-1), 0 },
- { 0, 0, FLOAT_TO_FP(-1) }
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref_icm = {
- { 0, FLOAT_TO_FP(1), 0 },
- { FLOAT_TO_FP(1), 0, 0 },
- { 0, 0, FLOAT_TO_FP(-1) }
-};
+const mat33_fp_t base_standard_ref_icm = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0 },
- { 0, FLOAT_TO_FP(1), 0 },
- { 0, 0, FLOAT_TO_FP(-1) }
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t base_accel_icm = {
.name = "Base Accel",
diff --git a/board/rammus/board.h b/board/rammus/board.h
index e044148401..77515a40ba 100644
--- a/board/rammus/board.h
+++ b/board/rammus/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -29,7 +29,7 @@
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
#define CONFIG_KEYBOARD_COL2_INVERTED
-#undef CONFIG_KEYBOARD_VIVALDI
+#undef CONFIG_KEYBOARD_VIVALDI
#define CONFIG_KEYBOARD_PROTOCOL_8042
#define CONFIG_LED_COMMON
#define CONFIG_LID_SWITCH
@@ -67,8 +67,8 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_HOST_INTERFACE_ESPI
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
-#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
+#define CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
/* Battery */
@@ -92,8 +92,8 @@
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
#define CONFIG_HOSTCMD_PD_CONTROL
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_X86
#define CONFIG_POWER_COMMON
@@ -140,7 +140,7 @@
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-#undef CONFIG_UART_TX_BUF_SIZE
+#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 1024
#define CONFIG_TABLET_MODE
@@ -181,45 +181,45 @@
#define CONFIG_BC12_DETECT_PI3USB9281_CHIP_COUNT 2
/* Optional feature to configure npcx chip */
-#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
+#define NPCX_UART_MODULE2 1 /* 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 as JTAG */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 as TACH */
/* I2C ports */
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
-#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
-#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
-#define I2C_PORT_CHARGER NPCX_I2C_PORT1
-#define I2C_PORT_EEPROM NPCX_I2C_PORT0_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT1
-#define I2C_PORT_PMIC NPCX_I2C_PORT2
-#define I2C_PORT_MP2949 NPCX_I2C_PORT2
-#define I2C_PORT_GYRO NPCX_I2C_PORT3
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
-#define I2C_PORT_THERMAL I2C_PORT_PMIC
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT0_0
+#define I2C_PORT_TCPC1 NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_1 NPCX_I2C_PORT0_1
+#define I2C_PORT_USB_CHARGER_0 NPCX_I2C_PORT1
+#define I2C_PORT_CHARGER NPCX_I2C_PORT1
+#define I2C_PORT_EEPROM NPCX_I2C_PORT0_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT1
+#define I2C_PORT_PMIC NPCX_I2C_PORT2
+#define I2C_PORT_MP2949 NPCX_I2C_PORT2
+#define I2C_PORT_GYRO NPCX_I2C_PORT3
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_THERMAL I2C_PORT_PMIC
/* I2C addresses */
-#define I2C_ADDR_BD99992_FLAGS 0x30
-#define I2C_ADDR_MP2949_FLAGS 0x20
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_BD99992_FLAGS 0x30
+#define I2C_ADDR_MP2949_FLAGS 0x20
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/* Rename GPIOs */
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
-#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
-#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_PWR_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN
-#define GPIO_AC_PRESENT GPIO_ROP_EC_ACOK
-#define GPIO_ENABLE_BACKLIGHT GPIO_BL_DISABLE_L
-#define GPIO_CPU_PROCHOT GPIO_PCH_PROCHOT
-#define GPIO_PCH_PWRBTN_L GPIO_PCH_PWR_BTN_L
-#define GPIO_EC_PLATFORM_RST GPIO_PLATFORM_RST
-#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
-#define GPIO_USB_C0_5V_EN GPIO_EN_USB_C0_5V_OUT
-#define GPIO_USB_C1_5V_EN GPIO_EN_USB_C1_5V_OUT
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_SUS_L GPIO_SLP_SUS_L_PCH
+#define GPIO_PG_EC_RSMRST_ODL GPIO_ROP_EC_RSMRST_L
+#define GPIO_PMIC_DPWROK GPIO_ROP_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_PWR_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN
+#define GPIO_AC_PRESENT GPIO_ROP_EC_ACOK
+#define GPIO_ENABLE_BACKLIGHT GPIO_BL_DISABLE_L
+#define GPIO_CPU_PROCHOT GPIO_PCH_PROCHOT
+#define GPIO_PCH_PWRBTN_L GPIO_PCH_PWR_BTN_L
+#define GPIO_EC_PLATFORM_RST GPIO_PLATFORM_RST
+#define GPIO_PMIC_SLP_SUS_L GPIO_SLP_SUS_L_PMIC
+#define GPIO_USB_C0_5V_EN GPIO_EN_USB_C0_5V_OUT
+#define GPIO_USB_C1_5V_EN GPIO_EN_USB_C1_5V_OUT
#ifndef __ASSEMBLER__
@@ -227,11 +227,11 @@
#include "registers.h"
enum temp_sensor_id {
- TEMP_SENSOR_BATTERY, /* Smart Battery Temperature */
- TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
- TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
- TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
- TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
+ TEMP_SENSOR_BATTERY, /* Smart Battery Temperature */
+ TEMP_SENSOR_AMBIENT, /* BD99992GW SYSTHERM0 */
+ TEMP_SENSOR_CHARGER, /* BD99992GW SYSTHERM1 */
+ TEMP_SENSOR_DRAM, /* BD99992GW SYSTHERM2 */
+ TEMP_SENSOR_EMMC, /* BD99992GW SYSTHERM3 */
TEMP_SENSOR_COUNT
};
@@ -248,11 +248,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_CH_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
@@ -265,16 +261,16 @@ enum pwm_channel {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Board specific handlers */
void board_reset_pd_mcu(void);
diff --git a/board/rammus/build.mk b/board/rammus/build.mk
index 5a9cabdcae..9bc5e8a822 100644
--- a/board/rammus/build.mk
+++ b/board/rammus/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/rammus/cbi_ssfc.c b/board/rammus/cbi_ssfc.c
index e1f6fa4bd2..99c303eac5 100644
--- a/board/rammus/cbi_ssfc.c
+++ b/board/rammus/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,7 +23,7 @@ static void cbi_ssfc_init(void)
CPRINTS("Read CBI SSFC : 0x%04X", cached_ssfc.raw_value);
}
-DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_INIT_I2C + 1);
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
diff --git a/board/rammus/cbi_ssfc.h b/board/rammus/cbi_ssfc.h
index 2ca20f2376..e6351db03f 100644
--- a/board/rammus/cbi_ssfc.h
+++ b/board/rammus/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/rammus/ec.tasklist b/board/rammus/ec.tasklist
index f708a41386..c2738d28b5 100644
--- a/board/rammus/ec.tasklist
+++ b/board/rammus/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/rammus/gpio.inc b/board/rammus/gpio.inc
index 1e05cbe9a7..df12930ccd 100644
--- a/board/rammus/gpio.inc
+++ b/board/rammus/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/rammus/led.c b/board/rammus/led.c
index e6187ce4b5..5ae415a61a 100644
--- a/board/rammus/led.c
+++ b/board/rammus/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -23,9 +23,8 @@
#define LED_CHARGE_PULSE 10
#define LED_POWER_PULSE 15
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -47,24 +46,20 @@ enum led_power_state {
};
static const struct {
- uint8_t led1:1;
- uint8_t led2:1;
-} led_chg_state_table[] = {
- [LED_STATE_DISCHARGE] = {LED_OFF, LED_OFF},
- [LED_STATE_CHARGE] = {LED_OFF, LED_ON},
- [LED_STATE_FULL] = {LED_ON, LED_OFF},
- [LED_STATE_ERROR_PHASE0] = {LED_OFF, LED_OFF},
- [LED_STATE_ERROR_PHASE1] = {LED_OFF, LED_ON}
-};
+ uint8_t led1 : 1;
+ uint8_t led2 : 1;
+} led_chg_state_table[] = { [LED_STATE_DISCHARGE] = { LED_OFF, LED_OFF },
+ [LED_STATE_CHARGE] = { LED_OFF, LED_ON },
+ [LED_STATE_FULL] = { LED_ON, LED_OFF },
+ [LED_STATE_ERROR_PHASE0] = { LED_OFF, LED_OFF },
+ [LED_STATE_ERROR_PHASE1] = { LED_OFF, LED_ON } };
static const struct {
- uint8_t led:1;
-} led_pwr_state_table[] = {
- [LED_STATE_S0] = {LED_ON},
- [LED_STATE_S3_PHASE0] = {LED_OFF},
- [LED_STATE_S3_PHASE1] = {LED_ON},
- [LED_STATE_S5] = {LED_OFF}
-};
+ uint8_t led : 1;
+} led_pwr_state_table[] = { [LED_STATE_S0] = { LED_ON },
+ [LED_STATE_S3_PHASE0] = { LED_OFF },
+ [LED_STATE_S3_PHASE1] = { LED_ON },
+ [LED_STATE_S5] = { LED_OFF } };
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
@@ -100,7 +95,7 @@ static void rammus_led_set_power(void)
chipset_state = chipset_in_state(CHIPSET_STATE_HARD_OFF) |
(chipset_in_state(CHIPSET_STATE_SOFT_OFF) << 1) |
- (chipset_in_state(CHIPSET_STATE_SUSPEND) << 2) |
+ (chipset_in_state(CHIPSET_STATE_SUSPEND) << 2) |
(chipset_in_state(CHIPSET_STATE_ON) << 3) |
(chipset_in_state(CHIPSET_STATE_STANDBY) << 4);
@@ -136,7 +131,7 @@ static void rammus_led_set_battery(void)
switch (chg_state) {
case PWR_STATE_DISCHARGE:
if ((charge_get_flags() & CHARGE_FLAG_EXTERNAL_POWER) &&
- charge_percent >= BATTERY_LEVEL_NEAR_FULL)
+ charge_percent >= BATTERY_LEVEL_NEAR_FULL)
config_battery_led(LED_STATE_FULL);
else
config_battery_led(LED_STATE_DISCHARGE);
@@ -154,10 +149,11 @@ static void rammus_led_set_battery(void)
break;
case PWR_STATE_CHARGE_NEAR_FULL:
case PWR_STATE_IDLE:
- if(charge_get_flags() & CHARGE_FLAG_EXTERNAL_POWER)
- config_battery_led(LED_STATE_FULL);
- else
- config_battery_led(LED_STATE_DISCHARGE);
+ config_battery_led(LED_STATE_DISCHARGE);
+ charge_ticks = 0;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ config_battery_led(LED_STATE_FULL);
charge_ticks = 0;
break;
default:
diff --git a/board/rammus/usb_pd_policy.c b/board/rammus/usb_pd_policy.c
index 652c9bb259..6242625d26 100644
--- a/board/rammus/usb_pd_policy.c
+++ b/board/rammus/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,12 +21,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -53,7 +53,8 @@ int pd_set_power_supply_ready(int port)
{
/* Disable charging */
gpio_set_level(port ? GPIO_EN_USB_C1_CHARGE_EC_L :
- GPIO_EN_USB_C0_CHARGE_EC_L, 1);
+ GPIO_EN_USB_C0_CHARGE_EC_L,
+ 1);
/* Ensure we advertise the proper available current quota */
charge_manager_source_port(port, 1);
@@ -103,13 +104,11 @@ int pd_check_vconn_swap(int port)
return gpio_get_level(GPIO_SLP_SUS_L_PMIC);
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Only port 0 supports device mode. */
if (port != 0)
return;
- gpio_set_level(GPIO_USB2_ID2,
- (data_role == PD_ROLE_UFP) ? 1 : 0);
+ gpio_set_level(GPIO_USB2_ID2, (data_role == PD_ROLE_UFP) ? 1 : 0);
}
diff --git a/board/redrix/battery.c b/board/redrix/battery.c
index 4e74b92acb..c5c144113b 100644
--- a/board/redrix/battery.c
+++ b/board/redrix/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/redrix/board.c b/board/redrix/board.c
index 5cf76b5447..e66a1ce518 100644
--- a/board/redrix/board.c
+++ b/board/redrix/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,8 +31,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/* Battery discharging over-current limit is 8A */
#define BATT_OC_LIMIT -8000
diff --git a/board/redrix/board.h b/board/redrix/board.h
index 96b48bd6be..211af39816 100644
--- a/board/redrix/board.h
+++ b/board/redrix/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,15 +23,15 @@
#define CONFIG_CHIPSET_RESUME_INIT_HOOK
/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* TCS3400 ALS */
#define CONFIG_ALS
@@ -48,9 +48,7 @@
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
-
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
/* Sensor console commands */
#define CONFIG_CMD_ACCELS
@@ -65,7 +63,7 @@
#endif
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -73,7 +71,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 2
+#define CONFIG_IO_EXPANDER_PORT_COUNT 2
#define CONFIG_USB_PD_FRS_PPC
@@ -83,17 +81,17 @@
#define CONFIG_USBC_PPC_NX20P3483
/* TODO: b/193452481 - measure and check these values on redrix */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Macros for GPIO signals used in common code that don't match the
@@ -101,73 +99,74 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-
-#define GPIO_WLC_NRST_CONN GPIO_PEN_RST_L
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+
+#define GPIO_WLC_NRST_CONN GPIO_PEN_RST_L
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_WLC NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_WLC NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/*
* see b/174768555#comment22
*/
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x58
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
/* Retimer */
#define CONFIG_USBC_RETIMER_FW_UPDATE
@@ -179,9 +178,9 @@
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan features */
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
#define CONFIG_CUSTOM_FAN_CONTROL
-#define RPM_DEVIATION 1
+#define RPM_DEVIATION 1
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
@@ -192,12 +191,12 @@
* discharge current limit and what was tested to prevent the AP
* rebooting with low charge level batteries.
*/
-#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 8192
+#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 8192
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_PROFILE_OVERRIDE
/* Keyboard features */
@@ -207,7 +206,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -236,35 +235,20 @@ enum sensor_id {
SENSOR_COUNT
};
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_C1_NCT38XX,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_C1_NCT38XX, IOEX_PORT_COUNT };
-enum battery_type {
- BATTERY_DYNAPACK_COS,
- BATTERY_TYPE_COUNT
-};
+enum battery_type { BATTERY_DYNAPACK_COS, BATTERY_TYPE_COUNT };
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
- PWM_CH_FAN2, /* PWM7 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_FAN2, /* PWM7 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_1,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_1, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_1,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_1, MFT_CH_COUNT };
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
extern const int keyboard_factory_scan_pins[][2];
diff --git a/board/redrix/build.mk b/board/redrix/build.mk
index 7177a844ad..e021ebc4f4 100644
--- a/board/redrix/build.mk
+++ b/board/redrix/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/redrix/cbi_ssfc.c b/board/redrix/cbi_ssfc.c
index 364b3d96fe..e0e954a7a6 100644
--- a/board/redrix/cbi_ssfc.c
+++ b/board/redrix/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/redrix/cbi_ssfc.h b/board/redrix/cbi_ssfc.h
index ddcfbb9281..724daa3782 100644
--- a/board/redrix/cbi_ssfc.h
+++ b/board/redrix/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/redrix/charger.c b/board/redrix/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/redrix/charger.c
+++ b/board/redrix/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/redrix/ec.tasklist b/board/redrix/ec.tasklist
index cfc1fea6ea..f755b40858 100644
--- a/board/redrix/ec.tasklist
+++ b/board/redrix/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/redrix/fans.c b/board/redrix/fans.c
index d464eeab67..9adf3cabce 100644
--- a/board/redrix/fans.c
+++ b/board/redrix/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,14 +30,14 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
static const struct fan_conf fan_conf_1 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_1, /* Use MFT id to control fan */
+ .ch = MFT_CH_1, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN2,
};
diff --git a/board/redrix/fw_config.c b/board/redrix/fw_config.c
index e59688b17d..cfbf46291c 100644
--- a/board/redrix/fw_config.c
+++ b/board/redrix/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union redrix_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/redrix/fw_config.h b/board/redrix/fw_config.h
index 9a73890f7d..02157bf23e 100644
--- a/board/redrix/fw_config.h
+++ b/board/redrix/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,20 +19,17 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_eps_type {
- EPS_DISABLED = 0,
- EPS_ENABLED = 1
-};
+enum ec_cfg_eps_type { EPS_DISABLED = 0, EPS_ENABLED = 1 };
union redrix_cbi_fw_config {
struct {
- uint32_t sd_db : 2;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t lte_db : 2;
- uint32_t ufc : 2;
- enum ec_cfg_eps_type eps : 1;
- uint32_t reserved_1 : 21;
+ uint32_t sd_db : 2;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t lte_db : 2;
+ uint32_t ufc : 2;
+ enum ec_cfg_eps_type eps : 1;
+ uint32_t reserved_1 : 21;
};
uint32_t raw_value;
};
diff --git a/board/redrix/gpio.inc b/board/redrix/gpio.inc
index 99f5237003..0f39efe33b 100644
--- a/board/redrix/gpio.inc
+++ b/board/redrix/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/redrix/i2c.c b/board/redrix/i2c.c
index 5b71c4eb71..0d6f92ad90 100644
--- a/board/redrix/i2c.c
+++ b/board/redrix/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/redrix/keyboard.c b/board/redrix/keyboard.c
index e1a5381a6c..11cfaaa02d 100644
--- a/board/redrix/keyboard.c
+++ b/board/redrix/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -74,7 +74,6 @@ board_vivaldi_keybd_config(void)
return &keybd2;
}
-
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
/*
* Map keyboard connector pins to EC GPIO pins for factory test.
@@ -82,13 +81,13 @@ board_vivaldi_keybd_config(void)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/redrix/led.c b/board/redrix/led.c
index 86e60b725a..c8654b3589 100644
--- a/board/redrix/led.c
+++ b/board/redrix/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -24,16 +24,14 @@
#define POWER_LED_OFF 1
#define LED_TICK_INTERVAL_MS (500 * MSEC)
-#define LED_CYCLE_TIME_MS (2000 * MSEC)
-#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
-#define LED_ON_TIME_MS (1000 * MSEC)
-#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
-};
+#define LED_CYCLE_TIME_MS (2000 * MSEC)
+#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1000 * MSEC)
+#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -41,22 +39,19 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- LEFT_PORT = 0,
- RIGHT_PORT
-};
+enum led_port { LEFT_PORT = 0, RIGHT_PORT };
static void led_set_color_battery(int port, enum led_color color)
{
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_C1_CHARGE_LED_AMBER_L :
- GPIO_C0_CHARGE_LED_AMBER_L);
+ GPIO_C0_CHARGE_LED_AMBER_L);
white_led = (port == RIGHT_PORT ? GPIO_C1_CHARGE_LED_WHITE_L :
- GPIO_C0_CHARGE_LED_WHITE_L);
+ GPIO_C0_CHARGE_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -151,16 +146,15 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static unsigned int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -172,43 +166,52 @@ static void led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
if (charge_get_percent() < 10)
- led_set_color_battery(LEFT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ LEFT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(LEFT_PORT, LED_OFF);
}
break;
case PWR_STATE_ERROR:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
- led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1)
- ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
- led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1)
- ? LED_AMBER : LED_OFF);
+ led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) ?
+ LED_AMBER :
+ LED_OFF);
}
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/redrix/pwm.c b/board/redrix/pwm.c
index 8e3d9c4022..dac3991526 100644
--- a/board/redrix/pwm.c
+++ b/board/redrix/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/redrix/sensors.c b/board/redrix/sensors.c
index df0e94f518..db645e5942 100644
--- a/board/redrix/sensors.c
+++ b/board/redrix/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -57,17 +57,13 @@ static struct accelgyro_saved_data_t g_bma253_data;
static struct accelgyro_saved_data_t g_bma422_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* TCS3400 private data */
static struct als_drv_data_t g_tcs3400_data = {
@@ -118,7 +114,7 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
.cover_scale = ALS_CHANNEL_SCALE(1.6)
}
},
- .calibration.irt = INT_TO_FP(0.41),
+ .calibration.irt = FLOAT_TO_FP(0.41),
.saturation.again = TCS_DEFAULT_AGAIN,
.saturation.atime = TCS_DEFAULT_ATIME,
};
@@ -291,38 +287,30 @@ DECLARE_HOOK(HOOK_INIT, board_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR] = {
- .name = "DDR",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR
- },
- [TEMP_SENSOR_2_SOC] = {
- .name = "SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_SOC
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
- [TEMP_SENSOR_4_REGULATOR] = {
- .name = "Regulator",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_REGULATOR
- },
+ [TEMP_SENSOR_1_DDR] = { .name = "DDR",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR },
+ [TEMP_SENSOR_2_SOC] = { .name = "SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_SOC },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
+ [TEMP_SENSOR_4_REGULATOR] = { .name = "Regulator",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_REGULATOR },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_DDR \
- { \
+#define THERMAL_DDR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -341,8 +329,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ddr = THERMAL_DDR;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -356,8 +344,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
@@ -372,8 +360,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_REGULATOR \
- { \
+#define THERMAL_REGULATOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
diff --git a/board/redrix/thermal.c b/board/redrix/thermal.c
index 71902a5430..e192157943 100644
--- a/board/redrix/thermal.c
+++ b/board/redrix/thermal.c
@@ -1,8 +1,9 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "builtin/assert.h"
#include "chipset.h"
#include "common.h"
#include "console.h"
@@ -16,7 +17,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -40,97 +41,96 @@ static const struct fan_step *fan_step_table;
static const struct fan_step fan_table_clamshell[] = {
{
/* level 0 */
- .on = {53, 53, 0, -1},
- .off = {99, 99, 99, -1},
- .rpm = {0, 0},
+ .on = { 53, 53, 0, -1 },
+ .off = { 99, 99, 99, -1 },
+ .rpm = { 0, 0 },
},
{
/* level 1 */
- .on = {54, 54, 0, -1},
- .off = {53, 53, 99, -1},
- .rpm = {3900, 4300},
+ .on = { 54, 54, 0, -1 },
+ .off = { 53, 53, 99, -1 },
+ .rpm = { 3900, 4300 },
},
{
/* level 2 */
- .on = {55, 55, 0, -1},
- .off = {54, 54, 99, -1},
- .rpm = {4800, 5200},
+ .on = { 55, 55, 0, -1 },
+ .off = { 54, 54, 99, -1 },
+ .rpm = { 4800, 5200 },
},
{
/* level 3 */
- .on = {56, 56, 0, -1},
- .off = {54, 55, 99, -1},
- .rpm = {5000, 5500},
+ .on = { 56, 56, 0, -1 },
+ .off = { 54, 55, 99, -1 },
+ .rpm = { 5000, 5500 },
},
{
/* level 4 */
- .on = {57, 57, 61, -1},
- .off = {56, 56, 59, -1},
- .rpm = {5200, 5700},
+ .on = { 57, 57, 61, -1 },
+ .off = { 56, 56, 59, -1 },
+ .rpm = { 5200, 5700 },
},
{
/* level 5 */
- .on = {58, 58, 63, -1},
- .off = {57, 57, 61, -1},
- .rpm = {5700, 6200},
+ .on = { 58, 58, 63, -1 },
+ .off = { 57, 57, 61, -1 },
+ .rpm = { 5700, 6200 },
},
{
/* level 6 */
- .on = {100, 100, 100, -1},
- .off = {58, 58, 63, -1},
- .rpm = {6200, 6400},
+ .on = { 100, 100, 100, -1 },
+ .off = { 58, 58, 63, -1 },
+ .rpm = { 6200, 6400 },
},
};
static const struct fan_step fan_table_tablet[] = {
{
/* level 0 */
- .on = {52, 55, 0, -1},
- .off = {99, 99, 99, -1},
- .rpm = {0, 0},
+ .on = { 52, 55, 0, -1 },
+ .off = { 99, 99, 99, -1 },
+ .rpm = { 0, 0 },
},
{
/* level 1 */
- .on = {53, 56, 0, -1},
- .off = {52, 55, 99, -1},
- .rpm = {4100, 4200},
+ .on = { 53, 56, 0, -1 },
+ .off = { 52, 55, 99, -1 },
+ .rpm = { 4100, 4200 },
},
{
/* level 2 */
- .on = {54, 57, 0, -1},
- .off = {53, 56, 99, -1},
- .rpm = {4500, 4800},
+ .on = { 54, 57, 0, -1 },
+ .off = { 53, 56, 99, -1 },
+ .rpm = { 4500, 4800 },
},
{
/* level 3 */
- .on = {55, 58, 0, -1},
- .off = {54, 57, 99, -1},
- .rpm = {4800, 5200},
+ .on = { 55, 58, 0, -1 },
+ .off = { 54, 57, 99, -1 },
+ .rpm = { 4800, 5200 },
},
{
/* level 4 */
- .on = {56, 59, 61, -1},
- .off = {55, 58, 59, -1},
- .rpm = {5100, 5400},
+ .on = { 56, 59, 61, -1 },
+ .off = { 55, 58, 59, -1 },
+ .rpm = { 5100, 5400 },
},
{
/* level 5 */
- .on = {57, 60, 63, -1},
- .off = {56, 59, 61, -1},
- .rpm = {5500, 5800},
+ .on = { 57, 60, 63, -1 },
+ .off = { 56, 59, 61, -1 },
+ .rpm = { 5500, 5800 },
},
{
/* level 6 */
- .on = {100, 100, 100, -1},
- .off = {57, 60, 63, -1},
- .rpm = {6000, 6200},
+ .on = { 100, 100, 100, -1 },
+ .off = { 57, 60, 63, -1 },
+ .rpm = { 6000, 6200 },
},
};
#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table_clamshell)
-BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) ==
- ARRAY_SIZE(fan_table_tablet));
+BUILD_ASSERT(ARRAY_SIZE(fan_table_clamshell) == ARRAY_SIZE(fan_table_tablet));
int fan_table_to_rpm(int fan, int *temp)
{
@@ -156,11 +156,12 @@ int fan_table_to_rpm(int fan, int *temp)
temp[TEMP_SENSOR_3_CHARGER] < prev_tmp[TEMP_SENSOR_3_CHARGER]) {
for (i = current_level; i > 0; i--) {
if (temp[TEMP_SENSOR_1_DDR] <
- fan_step_table[i].off[TEMP_SENSOR_1_DDR] &&
+ fan_step_table[i].off[TEMP_SENSOR_1_DDR] &&
temp[TEMP_SENSOR_3_CHARGER] <
- fan_step_table[i].off[TEMP_SENSOR_3_CHARGER] &&
+ fan_step_table[i]
+ .off[TEMP_SENSOR_3_CHARGER] &&
temp[TEMP_SENSOR_2_SOC] <
- fan_step_table[i].off[TEMP_SENSOR_2_SOC])
+ fan_step_table[i].off[TEMP_SENSOR_2_SOC])
current_level = i - 1;
else
break;
@@ -168,14 +169,15 @@ int fan_table_to_rpm(int fan, int *temp)
} else if (temp[TEMP_SENSOR_1_DDR] > prev_tmp[TEMP_SENSOR_1_DDR] ||
temp[TEMP_SENSOR_2_SOC] > prev_tmp[TEMP_SENSOR_2_SOC] ||
temp[TEMP_SENSOR_3_CHARGER] >
- prev_tmp[TEMP_SENSOR_3_CHARGER]) {
+ prev_tmp[TEMP_SENSOR_3_CHARGER]) {
for (i = current_level; i < NUM_FAN_LEVELS; i++) {
if ((temp[TEMP_SENSOR_1_DDR] >
- fan_step_table[i].on[TEMP_SENSOR_1_DDR] &&
- temp[TEMP_SENSOR_3_CHARGER] >
- fan_step_table[i].on[TEMP_SENSOR_3_CHARGER]) ||
+ fan_step_table[i].on[TEMP_SENSOR_1_DDR] &&
+ temp[TEMP_SENSOR_3_CHARGER] >
+ fan_step_table[i]
+ .on[TEMP_SENSOR_3_CHARGER]) ||
temp[TEMP_SENSOR_2_SOC] >
- fan_step_table[i].on[TEMP_SENSOR_2_SOC])
+ fan_step_table[i].on[TEMP_SENSOR_2_SOC])
current_level = i + 1;
else
break;
@@ -206,10 +208,8 @@ int fan_table_to_rpm(int fan, int *temp)
void board_override_fan_control(int fan, int *tmp)
{
- if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, tmp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp));
}
}
diff --git a/board/redrix/usbc_config.c b/board/redrix/usbc_config.c
index e463c15da1..a53e2c8909 100644
--- a/board/redrix/usbc_config.c
+++ b/board/redrix/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -31,8 +31,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -78,33 +78,43 @@ BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/redrix/usbc_config.h b/board/redrix/usbc_config.h
index dcaa52d7a9..248e697572 100644
--- a/board/redrix/usbc_config.h
+++ b/board/redrix/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,12 +8,8 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/reef/battery.c b/board/reef/battery.c
index 83a3679b26..52ec2a0471 100644
--- a/board/reef/battery.c
+++ b/board/reef/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -20,7 +20,7 @@
#include "i2c.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
enum battery_type {
BATTERY_SONY_CORP,
@@ -135,7 +135,7 @@ const struct battery_info batt_info_smp_cos4870 = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 46,
.charging_min_c = 0,
@@ -183,7 +183,7 @@ const struct battery_info batt_info_sonycorp = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 50,
.charging_min_c = 0,
@@ -240,7 +240,7 @@ const struct battery_info batt_info_panasoic = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 50,
.charging_min_c = 0,
@@ -384,7 +384,7 @@ const struct battery_info batt_info_c22n1626 = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
@@ -398,7 +398,7 @@ static int batt_smp_cos4870_init(void)
int batt_status;
return battery_status(&batt_status) ? 0 :
- batt_status & STATUS_INITIALIZED;
+ batt_status & STATUS_INITIALIZED;
}
static int batt_sony_corp_init(void)
@@ -411,8 +411,9 @@ static int batt_sony_corp_init(void)
* : 0b - Allowed to Discharge
* : 1b - Not Allowed to Discharge
*/
- return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 :
- !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT);
+ return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ?
+ 0 :
+ !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT);
}
static int batt_panasonic_init(void)
@@ -425,8 +426,9 @@ static int batt_panasonic_init(void)
* : 0b - Not Allowed to Discharge
* : 1b - Allowed to Discharge
*/
- return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 :
- !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT);
+ return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ?
+ 0 :
+ !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT);
}
static int batt_c22n1626_init(void)
@@ -439,8 +441,9 @@ static int batt_c22n1626_init(void)
* : 0b - Not Allowed to Discharge
* : 1b - Allowed to Discharge
*/
- return sb_read(SB_PACK_STATUS, &batt_status) ? 0 :
- !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT);
+ return sb_read(SB_PACK_STATUS, &batt_status) ?
+ 0 :
+ !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT);
}
static const struct ship_mode_info ship_mode_info_smp_cos4870 = {
@@ -461,7 +464,7 @@ static const struct ship_mode_info ship_mode_info_panasonic = {
.batt_init = batt_panasonic_init,
};
-static const struct ship_mode_info ship_mode_info_c22n1626= {
+static const struct ship_mode_info ship_mode_info_c22n1626 = {
.ship_mode_reg = 0x00,
.ship_mode_data = 0x0010,
.batt_init = batt_c22n1626_init,
@@ -513,7 +516,8 @@ BUILD_ASSERT(ARRAY_SIZE(info) == BATTERY_TYPE_COUNT);
static inline const struct board_batt_params *board_get_batt_params(void)
{
return &info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type];
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type];
}
enum battery_present battery_hw_present(void)
@@ -540,8 +544,9 @@ static int board_get_battery_type(void)
/* Initialize fast charging parameters */
chg_params = board_get_batt_params()->fast_chg_params;
- prev_chg_profile_info = &chg_params->chg_profile_info[
- chg_params->default_temp_range_profile];
+ prev_chg_profile_info =
+ &chg_params->chg_profile_info
+ [chg_params->default_temp_range_profile];
return board_battery_type;
}
@@ -571,11 +576,11 @@ int board_cut_off_battery(void)
{
int rv;
const struct ship_mode_info *ship_mode_inf =
- board_get_batt_params()->ship_mode_inf;
+ board_get_batt_params()->ship_mode_inf;
/* Ship mode command must be sent twice to take effect */
rv = sb_write(ship_mode_inf->ship_mode_reg,
- ship_mode_inf->ship_mode_data);
+ ship_mode_inf->ship_mode_data);
if (rv != EC_SUCCESS)
return rv;
@@ -591,7 +596,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
/* Do not discharge on AC if the battery is still waking up */
if (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- !(curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.status & STATUS_FULLY_CHARGED))
return 0;
/*
@@ -608,8 +613,8 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
* and suspend USB charging and DC/DC converter.
*/
if (!battery_is_cut_off() &&
- !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
/*
@@ -642,10 +647,10 @@ int charger_profile_override(struct charge_state_data *curr)
return 0;
}
- return charger_profile_override_common(curr,
- board_get_batt_params()->fast_chg_params,
- &prev_chg_profile_info,
- board_get_batt_params()->batt_info->voltage_max);
+ return charger_profile_override_common(
+ curr, board_get_batt_params()->fast_chg_params,
+ &prev_chg_profile_info,
+ board_get_batt_params()->batt_info->voltage_max);
}
/*
@@ -671,7 +676,7 @@ enum battery_present battery_is_present(void)
* Battery status will be inactive until it is initialized.
*/
if (batt_pres == BP_YES && batt_pres_prev != batt_pres &&
- !battery_is_cut_off()) {
+ !battery_is_cut_off()) {
/* Re-init board battery if battery presence status changes */
if (board_get_battery_type() == BATTERY_TYPE_COUNT) {
if (bd9995x_get_battery_voltage() >=
diff --git a/board/reef/board.c b/board/reef/board.c
index e224169f3b..5e608ee4ee 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,6 +34,7 @@
#include "math_util.h"
#include "motion_sense.h"
#include "motion_lid.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -53,15 +54,15 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
-#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
-#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
+#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
+#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
+#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
-#define USB_PD_PORT_ANX74XX 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX74XX 0
+#define USB_PD_PORT_PS8751 1
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -126,61 +127,48 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Vfs = Vref = 2.816V, 10-bit unsigned reading */
- [ADC_TEMP_SENSOR_CHARGER] = {
- "CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
- [ADC_TEMP_SENSOR_AMB] = {
- "AMBIENT", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
- [ADC_BOARD_ID] = {
- "BRD_ID", NPCX_ADC_CH2, ADC_MAX_VOLT, ADC_READ_MAX + 1, 0
- },
+ [ADC_TEMP_SENSOR_CHARGER] = { "CHARGER", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_AMB] = { "AMBIENT", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_BOARD_ID] = { "BRD_ID", NPCX_ADC_CH2, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
[PWM_CH_LED_GREEN] = { 2, PWM_CONFIG_DSLEEP, 100 },
- [PWM_CH_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 100 },
+ [PWM_CH_LED_RED] = { 3, PWM_CONFIG_DSLEEP, 100 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = NPCX_I2C_PORT0_0,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = NPCX_I2C_PORT0_1,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "accelgyro",
- .port = I2C_PORT_GYRO,
- .kbps = 400,
- .scl = GPIO_EC_I2C_GYRO_SCL,
- .sda = GPIO_EC_I2C_GYRO_SDA
- },
- {
- .name = "sensors",
- .port = NPCX_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
- {
- .name = "batt",
- .port = NPCX_I2C_PORT3,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc0",
+ .port = NPCX_I2C_PORT0_0,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = NPCX_I2C_PORT0_1,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "accelgyro",
+ .port = I2C_PORT_GYRO,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_GYRO_SCL,
+ .sda = GPIO_EC_I2C_GYRO_SDA },
+ { .name = "sensors",
+ .port = NPCX_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
+ { .name = "batt",
+ .port = NPCX_I2C_PORT3,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -308,17 +296,21 @@ static int ps8751_tune_mux(const struct usb_mux *me)
return EC_SUCCESS;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
- .usb_port = USB_PD_PORT_ANX74XX,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_ANX74XX,
+ .driver = &anx74xx_tcpm_usb_mux_driver,
+ .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_PS8751] = {
- .usb_port = USB_PD_PORT_PS8751,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .board_init = &ps8751_tune_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_PS8751,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .board_init = &ps8751_tune_mux,
+ },
}
};
@@ -413,28 +405,28 @@ void board_tcpc_init(void)
gpio_enable_interrupt(GPIO_USB_C0_CABLE_DET);
#endif
/*
- * Initialize HPD to low; after sysjump SOC needs to see
- * HPD pulse to enable video path
- */
+ * Initialize HPD to low; after sysjump SOC needs to see
+ * HPD pulse to enable video path
+ */
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -551,8 +543,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
@@ -564,8 +556,8 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
return;
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -675,17 +667,17 @@ void board_hibernate_late(void)
int i;
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs in hibernate */
- {GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN},
+ { GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN },
/*
* BD99956 handles charge input automatically. We'll disable
* charge output in hibernate. Charger will assert ACOK_OD
* when VBUS or VCC are plugged in.
*/
- {GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
- {GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
+ { GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
+ { GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
};
/* Change GPIOs' state in hibernate for better power consumption */
@@ -712,17 +704,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t mag_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t mag_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -890,8 +878,8 @@ struct {
int thresh_mv;
} const reef_board_versions[] = {
/* Vin = 3.3V, R1 = 46.4K, R2 values listed below */
- { BOARD_VERSION_1, 328 * 1.03 }, /* 5.11 Kohm */
- { BOARD_VERSION_2, 670 * 1.03 }, /* 11.8 Kohm */
+ { BOARD_VERSION_1, 328 * 1.03 }, /* 5.11 Kohm */
+ { BOARD_VERSION_2, 670 * 1.03 }, /* 11.8 Kohm */
{ BOARD_VERSION_3, 1012 * 1.03 }, /* 20.5 Kohm */
{ BOARD_VERSION_4, 1357 * 1.03 }, /* 32.4 Kohm */
{ BOARD_VERSION_5, 1690 * 1.03 }, /* 48.7 Kohm */
diff --git a/board/reef/board.h b/board/reef/board.h
index d4cc2ccad2..fc25024dff 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,24 +12,23 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-
/* EC console commands */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_CMD_BATT_MFG_ACCESS
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define BD9995X_IOUT_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
#define CONFIG_CHARGER_PSYS_READ
#define BD9995X_PSYS_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
#define CONFIG_CMD_I2C_STRESS_TEST
#define CONFIG_CMD_I2C_STRESS_TEST_ACCEL
@@ -39,7 +38,7 @@
#define CONFIG_CMD_I2C_STRESS_TEST_TCPC
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_SMART
@@ -60,7 +59,7 @@
#define CONFIG_USB_CHARGER
#define CONFIG_CHARGER_PROFILE_OVERRIDE
#define CONFIG_CHARGER_PROFILE_OVERRIDE_COMMON
-#undef CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES
+#undef CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES
#define CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES 3
#define CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
@@ -87,7 +86,7 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
-#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
+#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
#define CONFIG_USB_PD_TCPM_ANX3429
#define CONFIG_USB_PD_TCPM_PS8751
#define CONFIG_USB_PD_TCPM_TCPCI
@@ -115,8 +114,8 @@
/* EC */
#define CONFIG_ADC
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_FPU
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
#define CONFIG_I2C
@@ -145,7 +144,7 @@
#define CONFIG_WIRELESS
#define CONFIG_WIRELESS_SUSPEND EC_WIRELESS_SWITCH_WLAN_POWER
#define CONFIG_WLAN_POWER_ACTIVE_LOW
-#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
+#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
#define CONFIG_PWR_STATE_DISCHARGE_FULL
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 512
@@ -165,7 +164,7 @@
#define CONFIG_FLASH_SIZE_BYTES 524288
#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */
+#define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */
/*
* Enable 1 slot of secure temporary storage to support
@@ -175,21 +174,21 @@
#define CONFIG_VSTORE_SLOT_COUNT 1
/* Optional feature - used by nuvoton */
-#define NPCX_UART_MODULE2 1 /* 0:GPIO10/11 1:GPIO64/65 as UART */
-#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
+#define NPCX_UART_MODULE2 1 /* 0:GPIO10/11 1:GPIO64/65 as UART */
+#define NPCX_JTAG_MODULE2 0 /* 0:GPIO21/17/16/20 1:GPIOD5/E2/D4/E5 as JTAG*/
/* FIXME(dhendrix): these pins are just normal GPIOs on Reef. Do we need
* to change some other setting to put them in GPIO mode? */
-#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
+#define NPCX_TACH_SEL2 0 /* 0:GPIO40/73 1:GPIO93/A6 as TACH */
/* I2C ports */
-#define I2C_PORT_GYRO NPCX_I2C_PORT1
-#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
-#define I2C_PORT_ALS NPCX_I2C_PORT2
-#define I2C_PORT_BARO NPCX_I2C_PORT2
-#define I2C_PORT_BATTERY NPCX_I2C_PORT3
-#define I2C_PORT_CHARGER NPCX_I2C_PORT3
+#define I2C_PORT_GYRO NPCX_I2C_PORT1
+#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
+#define I2C_PORT_ALS NPCX_I2C_PORT2
+#define I2C_PORT_BARO NPCX_I2C_PORT2
+#define I2C_PORT_BATTERY NPCX_I2C_PORT3
+#define I2C_PORT_CHARGER NPCX_I2C_PORT3
/* Accelerometer and Gyroscope are the same device. */
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
/* Sensors */
#define CONFIG_MKBP_EVENT
@@ -215,7 +214,6 @@
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -223,9 +221,9 @@
/* ADC signal */
enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER, /* ADC0 */
- ADC_TEMP_SENSOR_AMB, /* ADC1 */
- ADC_BOARD_ID, /* ADC2 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC0 */
+ ADC_TEMP_SENSOR_AMB, /* ADC1 */
+ ADC_BOARD_ID, /* ADC2 */
ADC_CH_COUNT
};
@@ -286,16 +284,16 @@ enum reef_board_version {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Reset PD MCU */
void board_reset_pd_mcu(void);
diff --git a/board/reef/build.mk b/board/reef/build.mk
index 728d027803..470e439b13 100644
--- a/board/reef/build.mk
+++ b/board/reef/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2015 The Chromium OS Authors. All rights reserved.
+# Copyright 2015 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/reef/ec.tasklist b/board/reef/ec.tasklist
index eeebc0cc59..bc8668a1db 100644
--- a/board/reef/ec.tasklist
+++ b/board/reef/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/reef/gpio.inc b/board/reef/gpio.inc
index f508d7a84e..5693274284 100644
--- a/board/reef/gpio.inc
+++ b/board/reef/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/reef/led.c b/board/reef/led.c
index 807b1c109c..95db062d10 100644
--- a/board/reef/led.c
+++ b/board/reef/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -27,8 +27,7 @@
#define LED_ON_1SEC_TICKS 1
#define LED_ON_2SECS_TICKS 2
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -36,7 +35,7 @@ enum led_color {
LED_OFF = 0,
LED_BLUE,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -112,27 +111,31 @@ static void led_set_battery(void)
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Blink once every four seconds. */
led_set_color_battery(
- (suspend_ticks % LED_TOTAL_4SECS_TICKS)
- < LED_ON_1SEC_TICKS ? LED_AMBER : LED_OFF);
+ (suspend_ticks % LED_TOTAL_4SECS_TICKS) <
+ LED_ON_1SEC_TICKS ?
+ LED_AMBER :
+ LED_OFF);
} else {
led_set_color_battery(LED_OFF);
}
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % LED_TOTAL_2SECS_TICKS <
- LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery((battery_ticks % LED_TOTAL_2SECS_TICKS <
+ LED_ON_1SEC_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_BLUE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks % LED_TOTAL_4SECS_TICKS <
- LED_ON_2SECS_TICKS) ? LED_AMBER : LED_BLUE);
- else
- led_set_color_battery(LED_BLUE);
+ led_set_color_battery(LED_BLUE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks % LED_TOTAL_4SECS_TICKS <
+ LED_ON_2SECS_TICKS) ?
+ LED_AMBER :
+ LED_BLUE);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/reef/usb_pd_policy.c b/board/reef/usb_pd_policy.c
index 2d2ef416b2..e21d4984c1 100644
--- a/board/reef/usb_pd_policy.c
+++ b/board/reef/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,12 +23,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -39,7 +39,8 @@ static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN;
int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) : (GPIO_OUTPUT | GPIO_PULL_UP);
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
/*
* Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
diff --git a/board/reef_it8320/battery.c b/board/reef_it8320/battery.c
index 1b16a672b2..f03000f3c7 100644
--- a/board/reef_it8320/battery.c
+++ b/board/reef_it8320/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -20,7 +20,7 @@
#include "i2c.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
enum battery_type {
BATTERY_SONY_CORP,
@@ -135,7 +135,7 @@ const struct battery_info batt_info_smp_cos4870 = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 46,
.charging_min_c = 0,
@@ -183,7 +183,7 @@ const struct battery_info batt_info_sonycorp = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 50,
.charging_min_c = 0,
@@ -240,7 +240,7 @@ const struct battery_info batt_info_panasoic = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 50,
.charging_min_c = 0,
@@ -384,7 +384,7 @@ const struct battery_info batt_info_c22n1626 = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
@@ -398,7 +398,7 @@ static int batt_smp_cos4870_init(void)
int batt_status;
return battery_status(&batt_status) ? 0 :
- batt_status & STATUS_INITIALIZED;
+ batt_status & STATUS_INITIALIZED;
}
static int batt_sony_corp_init(void)
@@ -411,8 +411,9 @@ static int batt_sony_corp_init(void)
* : 0b - Allowed to Discharge
* : 1b - Not Allowed to Discharge
*/
- return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 :
- !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT);
+ return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ?
+ 0 :
+ !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT);
}
static int batt_panasonic_init(void)
@@ -425,8 +426,9 @@ static int batt_panasonic_init(void)
* : 0b - Not Allowed to Discharge
* : 1b - Allowed to Discharge
*/
- return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 :
- !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT);
+ return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ?
+ 0 :
+ !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT);
}
static int batt_c22n1626_init(void)
@@ -439,8 +441,9 @@ static int batt_c22n1626_init(void)
* : 0b - Not Allowed to Discharge
* : 1b - Allowed to Discharge
*/
- return sb_read(SB_PACK_STATUS, &batt_status) ? 0 :
- !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT);
+ return sb_read(SB_PACK_STATUS, &batt_status) ?
+ 0 :
+ !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT);
}
static const struct ship_mode_info ship_mode_info_smp_cos4870 = {
@@ -513,7 +516,8 @@ BUILD_ASSERT(ARRAY_SIZE(info) == BATTERY_TYPE_COUNT);
static inline const struct board_batt_params *board_get_batt_params(void)
{
return &info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type];
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type];
}
enum battery_present battery_hw_present(void)
@@ -540,8 +544,9 @@ static int board_get_battery_type(void)
/* Initialize fast charging parameters */
chg_params = board_get_batt_params()->fast_chg_params;
- prev_chg_profile_info = &chg_params->chg_profile_info[
- chg_params->default_temp_range_profile];
+ prev_chg_profile_info =
+ &chg_params->chg_profile_info
+ [chg_params->default_temp_range_profile];
return board_battery_type;
}
@@ -571,11 +576,11 @@ int board_cut_off_battery(void)
{
int rv;
const struct ship_mode_info *ship_mode_inf =
- board_get_batt_params()->ship_mode_inf;
+ board_get_batt_params()->ship_mode_inf;
/* Ship mode command must be sent twice to take effect */
rv = sb_write(ship_mode_inf->ship_mode_reg,
- ship_mode_inf->ship_mode_data);
+ ship_mode_inf->ship_mode_data);
if (rv != EC_SUCCESS)
return rv;
@@ -591,7 +596,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
/* Do not discharge on AC if the battery is still waking up */
if (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- !(curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.status & STATUS_FULLY_CHARGED))
return 0;
/*
@@ -608,8 +613,8 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
* and suspend USB charging and DC/DC converter.
*/
if (!battery_is_cut_off() &&
- !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
/*
@@ -642,10 +647,10 @@ int charger_profile_override(struct charge_state_data *curr)
return 0;
}
- return charger_profile_override_common(curr,
- board_get_batt_params()->fast_chg_params,
- &prev_chg_profile_info,
- board_get_batt_params()->batt_info->voltage_max);
+ return charger_profile_override_common(
+ curr, board_get_batt_params()->fast_chg_params,
+ &prev_chg_profile_info,
+ board_get_batt_params()->batt_info->voltage_max);
}
/*
@@ -671,7 +676,7 @@ enum battery_present battery_is_present(void)
* Battery status will be inactive until it is initialized.
*/
if (batt_pres == BP_YES && batt_pres_prev != batt_pres &&
- !battery_is_cut_off()) {
+ !battery_is_cut_off()) {
/* Re-init board battery if battery presence status changes */
if (board_get_battery_type() == BATTERY_TYPE_COUNT) {
if (bd9995x_get_battery_voltage() >=
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 1b6bc3d137..b00e451842 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,6 +29,7 @@
#include "math_util.h"
#include "motion_sense.h"
#include "motion_lid.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -48,50 +49,40 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
-#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
-#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
+#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
+#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
+#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
#include "gpio_list.h"
const struct adc_t adc_channels[] = {
/* Convert to mV (3000mV/1024). */
- {"CHARGER", 3000, 1024, 0, CHIP_ADC_CH1}, /* GPI1 */
- {"AMBIENT", 3000, 1024, 0, CHIP_ADC_CH2}, /* GPI2 */
- {"BRD_ID", 3000, 1024, 0, CHIP_ADC_CH3}, /* GPI3 */
+ { "CHARGER", 3000, 1024, 0, CHIP_ADC_CH1 }, /* GPI1 */
+ { "AMBIENT", 3000, 1024, 0, CHIP_ADC_CH2 }, /* GPI2 */
+ { "BRD_ID", 3000, 1024, 0, CHIP_ADC_CH3 }, /* GPI3 */
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "mux",
- .port = IT83XX_I2C_CH_C,
- .kbps = 400,
- .scl = GPIO_EC_I2C_C_SCL,
- .sda = GPIO_EC_I2C_C_SDA
- },
- {
- .name = "batt",
- .port = IT83XX_I2C_CH_E,
- .kbps = 100,
- .scl = GPIO_EC_I2C_E_SCL,
- .sda = GPIO_EC_I2C_E_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "mux",
+ .port = IT83XX_I2C_CH_C,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_C_SCL,
+ .sda = GPIO_EC_I2C_C_SDA },
+ { .name = "batt",
+ .port = IT83XX_I2C_CH_E,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_E_SCL,
+ .sda = GPIO_EC_I2C_E_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .bus_type = EC_BUS_TYPE_EMBEDDED,
- .drv = &it83xx_tcpm_drv
- },
- {
- .bus_type = EC_BUS_TYPE_EMBEDDED,
- .drv = &it83xx_tcpm_drv
- },
+ { .bus_type = EC_BUS_TYPE_EMBEDDED, .drv = &it83xx_tcpm_drv },
+ { .bus_type = EC_BUS_TYPE_EMBEDDED, .drv = &it83xx_tcpm_drv },
};
void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
@@ -126,9 +117,8 @@ static void it83xx_tcpc_update_hpd_status(const struct usb_mux *me,
{
int hpd_lvl = (mux_state & USB_PD_MUX_HPD_LVL) ? 1 : 0;
int hpd_irq = (mux_state & USB_PD_MUX_HPD_IRQ) ? 1 : 0;
- enum gpio_signal gpio =
- me->usb_port ? GPIO_USB_C1_HPD_1P8_ODL
- : GPIO_USB_C0_HPD_1P8_ODL;
+ enum gpio_signal gpio = me->usb_port ? GPIO_USB_C1_HPD_1P8_ODL :
+ GPIO_USB_C0_HPD_1P8_ODL;
/* This driver does not use host command ACKs */
*ack_required = false;
@@ -143,20 +133,26 @@ static void it83xx_tcpc_update_hpd_status(const struct usb_mux *me,
}
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
- .hpd_update = &it83xx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ .hpd_update = &it83xx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = 0x10,
- .driver = &ps8740_usb_mux_driver,
- .hpd_update = &it83xx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = 0x10,
+ .driver = &ps8740_usb_mux_driver,
+ .hpd_update = &it83xx_tcpc_update_hpd_status,
+ },
},
};
@@ -165,18 +161,18 @@ const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
};
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -234,12 +230,12 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_CHARGER_INT_L);
/*
- * Initialize HPD to low; after sysjump SOC needs to see
- * HPD pulse to enable video path
- */
+ * Initialize HPD to low; after sysjump SOC needs to see
+ * HPD pulse to enable video path
+ */
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_INIT_I2C + 1);
@@ -303,8 +299,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
@@ -316,8 +312,8 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
return;
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -406,17 +402,17 @@ void board_hibernate_late(void)
int i;
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs in hibernate */
- {GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN},
+ { GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN },
/*
* BD99956 handles charge input automatically. We'll disable
* charge output in hibernate. Charger will assert ACOK_OD
* when VBUS or VCC are plugged in.
*/
- {GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
- {GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
+ { GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
+ { GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
};
/* Change GPIOs' state in hibernate for better power consumption */
@@ -447,8 +443,8 @@ struct {
int thresh_mv;
} const reef_it8320_board_versions[] = {
/* Vin = 3.3V, R1 = 46.4K, R2 values listed below */
- { BOARD_VERSION_1, 328 * 1.03 }, /* 5.11 Kohm */
- { BOARD_VERSION_2, 670 * 1.03 }, /* 11.8 Kohm */
+ { BOARD_VERSION_1, 328 * 1.03 }, /* 5.11 Kohm */
+ { BOARD_VERSION_2, 670 * 1.03 }, /* 11.8 Kohm */
{ BOARD_VERSION_3, 1012 * 1.03 }, /* 20.5 Kohm */
{ BOARD_VERSION_4, 1357 * 1.03 }, /* 32.4 Kohm */
{ BOARD_VERSION_5, 1690 * 1.03 }, /* 48.7 Kohm */
diff --git a/board/reef_it8320/board.h b/board/reef_it8320/board.h
index cf29faa8f8..45abf34151 100644
--- a/board/reef_it8320/board.h
+++ b/board/reef_it8320/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,24 +19,24 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* EC console commands */
#define CONFIG_CMD_BATT_MFG_ACCESS
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define BD9995X_IOUT_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
#define CONFIG_CHARGER_PSYS_READ
#define BD9995X_PSYS_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_SMART
@@ -57,7 +57,7 @@
#define CONFIG_USB_CHARGER
#define CONFIG_CHARGER_PROFILE_OVERRIDE
#define CONFIG_CHARGER_PROFILE_OVERRIDE_COMMON
-#undef CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES
+#undef CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES
#define CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES 3
#define CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
@@ -89,7 +89,7 @@
#define CONFIG_USB_PD_TCPMV2
#define CONFIG_USB_DRP_ACC_TRYSRC
#define CONFIG_USB_PD_REV30
-#define CONFIG_USB_PID 0x1234 /* Invalid PID for development board */
+#define CONFIG_USB_PID 0x1234 /* Invalid PID for development board */
#define CONFIG_USB_PD_DECODE_SOP
#define CONFIG_USB_PD_DEBUG_LEVEL 2
#define CONFIG_USB_PD_COMM_LOCKED
@@ -112,7 +112,7 @@
/* EC */
#define CONFIG_ADC
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
@@ -162,15 +162,15 @@
#include "registers.h"
/* I2C ports */
-#define I2C_PORT_USB_MUX IT83XX_I2C_CH_C
-#define I2C_PORT_BATTERY IT83XX_I2C_CH_E
-#define I2C_PORT_CHARGER IT83XX_I2C_CH_E
+#define I2C_PORT_USB_MUX IT83XX_I2C_CH_C
+#define I2C_PORT_BATTERY IT83XX_I2C_CH_E
+#define I2C_PORT_CHARGER IT83XX_I2C_CH_E
/* ADC signal */
enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER, /* ADC CH1 */
- ADC_TEMP_SENSOR_AMB, /* ADC CH2 */
- ADC_BOARD_ID, /* ADC CH3 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC CH1 */
+ ADC_TEMP_SENSOR_AMB, /* ADC CH2 */
+ ADC_BOARD_ID, /* ADC CH3 */
ADC_CH_COUNT
};
@@ -200,16 +200,16 @@ enum reef_it8320_board_version {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Reset PD MCU */
void board_reset_pd_mcu(void);
diff --git a/board/reef_it8320/build.mk b/board/reef_it8320/build.mk
index e5c12f9090..0c2fcec14f 100644
--- a/board/reef_it8320/build.mk
+++ b/board/reef_it8320/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/reef_it8320/ec.tasklist b/board/reef_it8320/ec.tasklist
index fdaf792a17..7faf124d53 100644
--- a/board/reef_it8320/ec.tasklist
+++ b/board/reef_it8320/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/reef_it8320/gpio.inc b/board/reef_it8320/gpio.inc
index ac2fbf486e..54528d3818 100644
--- a/board/reef_it8320/gpio.inc
+++ b/board/reef_it8320/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/reef_it8320/led.c b/board/reef_it8320/led.c
index a1ea5964a8..1b521b9409 100644
--- a/board/reef_it8320/led.c
+++ b/board/reef_it8320/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -27,8 +27,7 @@
#define LED_ON_1SEC_TICKS 1
#define LED_ON_2SECS_TICKS 2
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -36,7 +35,7 @@ enum led_color {
LED_OFF = 0,
LED_BLUE,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -113,27 +112,31 @@ static void led_set_battery(void)
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Blink once every four seconds. */
led_set_color_battery(
- (suspend_ticks % LED_TOTAL_4SECS_TICKS)
- < LED_ON_1SEC_TICKS ? LED_AMBER : LED_OFF);
+ (suspend_ticks % LED_TOTAL_4SECS_TICKS) <
+ LED_ON_1SEC_TICKS ?
+ LED_AMBER :
+ LED_OFF);
} else {
led_set_color_battery(LED_OFF);
}
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % LED_TOTAL_2SECS_TICKS <
- LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery((battery_ticks % LED_TOTAL_2SECS_TICKS <
+ LED_ON_1SEC_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_BLUE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks % LED_TOTAL_4SECS_TICKS <
- LED_ON_2SECS_TICKS) ? LED_AMBER : LED_BLUE);
- else
- led_set_color_battery(LED_BLUE);
+ led_set_color_battery(LED_BLUE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ led_set_color_battery((battery_ticks % LED_TOTAL_4SECS_TICKS <
+ LED_ON_2SECS_TICKS) ?
+ LED_AMBER :
+ LED_BLUE);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/reef_it8320/usb_pd_policy.c b/board/reef_it8320/usb_pd_policy.c
index 7fec6bc975..ce909520a2 100644
--- a/board/reef_it8320/usb_pd_policy.c
+++ b/board/reef_it8320/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,12 +23,12 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -39,7 +39,7 @@ static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN;
enum gpio_signal gpio_3a_en = port ? GPIO_EN_USB_C1_3A :
- GPIO_EN_USB_C0_3A;
+ GPIO_EN_USB_C0_3A;
gpio_set_level(gpio_3a_en, vbus_rp[port] == TYPEC_RP_3A0 ? 1 : 0);
gpio_set_level(gpio, vbus_en[port]);
diff --git a/board/reef_mchp/battery.c b/board/reef_mchp/battery.c
index c557533c9d..d18caec5d0 100644
--- a/board/reef_mchp/battery.c
+++ b/board/reef_mchp/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -22,7 +22,7 @@
#include "tfdp_chip.h"
#define CPUTS(outstr) cputs(CC_CHARGER, outstr)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
enum battery_type {
BATTERY_SONY_CORP,
@@ -137,7 +137,7 @@ const struct battery_info batt_info_smp_cos4870 = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 46,
.charging_min_c = 0,
@@ -185,7 +185,7 @@ const struct battery_info batt_info_sonycorp = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 50,
.charging_min_c = 0,
@@ -242,7 +242,7 @@ const struct battery_info batt_info_panasoic = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 50,
.charging_min_c = 0,
@@ -386,7 +386,7 @@ const struct battery_info batt_info_c22n1626 = {
* unwanted low VSYS_Prochot# assertion can be avoided.
*/
.voltage_min = 6100,
- .precharge_current = 256, /* mA */
+ .precharge_current = 256, /* mA */
.start_charging_min_c = 0,
.start_charging_max_c = 45,
.charging_min_c = 0,
@@ -400,7 +400,7 @@ static int batt_smp_cos4870_init(void)
int batt_status;
return battery_status(&batt_status) ? 0 :
- batt_status & STATUS_INITIALIZED;
+ batt_status & STATUS_INITIALIZED;
}
static int batt_sony_corp_init(void)
@@ -413,8 +413,9 @@ static int batt_sony_corp_init(void)
* : 0b - Allowed to Discharge
* : 1b - Not Allowed to Discharge
*/
- return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 :
- !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT);
+ return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ?
+ 0 :
+ !(batt_status & SONY_DISCHARGE_DISABLE_FET_BIT);
}
static int batt_panasonic_init(void)
@@ -427,8 +428,9 @@ static int batt_panasonic_init(void)
* : 0b - Not Allowed to Discharge
* : 1b - Allowed to Discharge
*/
- return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ? 0 :
- !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT);
+ return sb_read(SB_MANUFACTURER_ACCESS, &batt_status) ?
+ 0 :
+ !!(batt_status & PANASONIC_DISCHARGE_ENABLE_FET_BIT);
}
static int batt_c22n1626_init(void)
@@ -441,8 +443,9 @@ static int batt_c22n1626_init(void)
* : 0b - Not Allowed to Discharge
* : 1b - Allowed to Discharge
*/
- return sb_read(SB_PACK_STATUS, &batt_status) ? 0 :
- !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT);
+ return sb_read(SB_PACK_STATUS, &batt_status) ?
+ 0 :
+ !!(batt_status & C22N1626_DISCHARGE_ENABLE_FET_BIT);
}
static const struct ship_mode_info ship_mode_info_smp_cos4870 = {
@@ -515,7 +518,8 @@ BUILD_ASSERT(ARRAY_SIZE(info) == BATTERY_TYPE_COUNT);
static inline const struct board_batt_params *board_get_batt_params(void)
{
return &info[board_battery_type == BATTERY_TYPE_COUNT ?
- DEFAULT_BATTERY_TYPE : board_battery_type];
+ DEFAULT_BATTERY_TYPE :
+ board_battery_type];
}
enum battery_present battery_hw_present(void)
@@ -545,8 +549,9 @@ static int board_get_battery_type(void)
/* Initialize fast charging parameters */
chg_params = board_get_batt_params()->fast_chg_params;
- prev_chg_profile_info = &chg_params->chg_profile_info[
- chg_params->default_temp_range_profile];
+ prev_chg_profile_info =
+ &chg_params->chg_profile_info
+ [chg_params->default_temp_range_profile];
return board_battery_type;
}
@@ -561,8 +566,7 @@ static int board_get_battery_type(void)
static void board_init_battery_type(void)
{
if (board_get_battery_type() != BATTERY_TYPE_COUNT)
- CPRINTS("found batt:%s",
- info[board_battery_type].manuf_name);
+ CPRINTS("found batt:%s", info[board_battery_type].manuf_name);
else
CPUTS("battery not found");
}
@@ -577,16 +581,16 @@ int board_cut_off_battery(void)
{
int rv;
const struct ship_mode_info *ship_mode_inf =
- board_get_batt_params()->ship_mode_inf;
+ board_get_batt_params()->ship_mode_inf;
/* Ship mode command must be sent twice to take effect */
rv = sb_write(ship_mode_inf->ship_mode_reg,
- ship_mode_inf->ship_mode_data);
+ ship_mode_inf->ship_mode_data);
if (rv != EC_SUCCESS)
return rv;
rv = sb_write(ship_mode_inf->ship_mode_reg,
- ship_mode_inf->ship_mode_data);
+ ship_mode_inf->ship_mode_data);
return rv;
}
@@ -599,7 +603,7 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
/* Do not discharge on AC if the battery is still waking up */
if (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- !(curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.status & STATUS_FULLY_CHARGED))
return 0;
/*
@@ -616,8 +620,8 @@ static int charger_should_discharge_on_ac(struct charge_state_data *curr)
* and suspend USB charging and DC/DC converter.
*/
if (!battery_is_cut_off() &&
- !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
- (curr->batt.status & STATUS_FULLY_CHARGED))
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
return 1;
/*
@@ -650,10 +654,10 @@ int charger_profile_override(struct charge_state_data *curr)
return 0;
}
- return charger_profile_override_common(curr,
- board_get_batt_params()->fast_chg_params,
- &prev_chg_profile_info,
- board_get_batt_params()->batt_info->voltage_max);
+ return charger_profile_override_common(
+ curr, board_get_batt_params()->fast_chg_params,
+ &prev_chg_profile_info,
+ board_get_batt_params()->batt_info->voltage_max);
}
/*
@@ -679,7 +683,7 @@ enum battery_present battery_is_present(void)
* Battery status will be inactive until it is initialized.
*/
if (batt_pres == BP_YES && batt_pres_prev != batt_pres &&
- !battery_is_cut_off()) {
+ !battery_is_cut_off()) {
/* Re-init board battery if battery presence status changes */
if (board_get_battery_type() == BATTERY_TYPE_COUNT) {
if (bd9995x_get_battery_voltage() >=
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index c9293ad080..39196cb308 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,6 +35,7 @@
#include "math_util.h"
#include "motion_sense.h"
#include "motion_lid.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -57,17 +58,16 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-
#define CPUTS(outstr) cputs(CC_USBCHARGE, outstr)
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
-#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
-#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
+#define IN_ALL_SYS_PG POWER_SIGNAL_MASK(X86_ALL_SYS_PG)
+#define IN_PGOOD_PP3300 POWER_SIGNAL_MASK(X86_PGOOD_PP3300)
+#define IN_PGOOD_PP5000 POWER_SIGNAL_MASK(X86_PGOOD_PP5000)
-#define USB_PD_PORT_ANX74XX 0
-#define USB_PD_PORT_PS8751 1
+#define USB_PD_PORT_ANX74XX 0
+#define USB_PD_PORT_PS8751 1
#ifdef CONFIG_BOARD_PRE_INIT
/*
@@ -161,7 +161,7 @@ void tablet_mode_interrupt(enum gpio_signal signal)
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { QMSPI0_PORT, 4, GPIO_QMSPI_CS0},
+ { QMSPI0_PORT, 4, GPIO_QMSPI_CS0 },
#if defined(CONFIG_SPI_ACCEL_PORT)
{ GPSPI0_PORT, 2, GPIO_SPI0_CS0 },
#endif
@@ -175,15 +175,9 @@ const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
*/
const struct adc_t adc_channels[] = {
/* Vref = 3.000V, 10-bit unsigned reading */
- [ADC_TEMP_SENSOR_CHARGER] = {
- "CHARGER", 3000, 1024, 0, 0
- },
- [ADC_TEMP_SENSOR_AMB] = {
- "AMBIENT", 3000, 1024, 0, 1
- },
- [ADC_BOARD_ID] = {
- "BRD_ID", 3000, 1024, 0, 2
- },
+ [ADC_TEMP_SENSOR_CHARGER] = { "CHARGER", 3000, 1024, 0, 0 },
+ [ADC_TEMP_SENSOR_AMB] = { "AMBIENT", 3000, 1024, 0, 1 },
+ [ADC_BOARD_ID] = { "BRD_ID", 3000, 1024, 0, 2 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -192,7 +186,7 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct pwm_t pwm_channels[] = {
/* channel, flags */
[PWM_CH_LED_GREEN] = { 4, PWM_CONFIG_DSLEEP },
- [PWM_CH_LED_RED] = { 5, PWM_CONFIG_DSLEEP },
+ [PWM_CH_LED_RED] = { 5, PWM_CONFIG_DSLEEP },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
#endif /* #ifdef CONFIG_PWM */
@@ -203,42 +197,32 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
* Due to added RC of interposer board temporarily reduce
* 400 to 100 kHz.
*/
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "tcpc0",
- .port = MCHP_I2C_PORT0,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = MCHP_I2C_PORT2,
- .kbps = 400,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "accelgyro",
- .port = I2C_PORT_GYRO,
- .kbps = 400,
- .scl = GPIO_EC_I2C_GYRO_SCL,
- .sda = GPIO_EC_I2C_GYRO_SDA
- },
- {
- .name = "sensors",
- .port = MCHP_I2C_PORT7,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
- {
- .name = "batt",
- .port = MCHP_I2C_PORT3,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "tcpc0",
+ .port = MCHP_I2C_PORT0,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = MCHP_I2C_PORT2,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "accelgyro",
+ .port = I2C_PORT_GYRO,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_GYRO_SCL,
+ .sda = GPIO_EC_I2C_GYRO_SDA },
+ { .name = "sensors",
+ .port = MCHP_I2C_PORT7,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
+ { .name = "batt",
+ .port = MCHP_I2C_PORT3,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -415,17 +399,21 @@ static int ps8751_tune_mux(const struct usb_mux *me)
* tcpc_config array. The tcpc_config array contains the actual EC I2C
* port, device address, and a function pointer into the driver code.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_ANX74XX] = {
- .usb_port = USB_PD_PORT_ANX74XX,
- .driver = &anx74xx_tcpm_usb_mux_driver,
- .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_ANX74XX,
+ .driver = &anx74xx_tcpm_usb_mux_driver,
+ .hpd_update = &anx74xx_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_PS8751] = {
- .usb_port = USB_PD_PORT_PS8751,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .board_init = &ps8751_tune_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_PS8751,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .board_init = &ps8751_tune_mux,
+ },
}
};
@@ -534,9 +522,9 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
-DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
/*
* Data derived from Seinhart-Hart equation in a resistor divider circuit with
@@ -573,8 +561,7 @@ int board_get_charger_temp(int idx, int *temp_ptr)
if (mv < 0)
return -1;
- *temp_ptr = thermistor_linear_interpolate(mv,
- &charger_thermistor_info);
+ *temp_ptr = thermistor_linear_interpolate(mv, &charger_thermistor_info);
*temp_ptr = C_TO_K(*temp_ptr);
return 0;
}
@@ -614,8 +601,7 @@ int board_get_ambient_temp(int idx, int *temp_ptr)
if (mv < 0)
return -1;
- *temp_ptr = thermistor_linear_interpolate(mv,
- &amb_thermistor_info);
+ *temp_ptr = thermistor_linear_interpolate(mv, &amb_thermistor_info);
*temp_ptr = C_TO_K(*temp_ptr);
return 0;
}
@@ -626,9 +612,9 @@ int board_get_ambient_temp(int idx, int *temp_ptr)
* delay from read to taking action
*/
const struct temp_sensor_t temp_sensors[] = {
- {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0},
- {"Ambient", TEMP_SENSOR_TYPE_BOARD, board_get_ambient_temp, 0},
- {"Charger", TEMP_SENSOR_TYPE_BOARD, board_get_charger_temp, 1},
+ { "Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0 },
+ { "Ambient", TEMP_SENSOR_TYPE_BOARD, board_get_ambient_temp, 0 },
+ { "Charger", TEMP_SENSOR_TYPE_BOARD, board_get_charger_temp, 1 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -750,8 +736,8 @@ int board_set_active_charge_port(int charge_port)
* @param charge_ma Desired charge limit (mA).
* @param charge_mv Negotiated charge voltage (mV).
*/
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/* Enable charging trigger by BC1.2 detection */
int bc12_enable = (supplier == CHARGE_SUPPLIER_BC12_CDP ||
@@ -763,8 +749,8 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
return;
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
/**
@@ -890,17 +876,17 @@ void board_hibernate_late(void)
int i;
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs in hibernate */
- {GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN},
+ { GPIO_BAT_LED_BLUE, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_AMBER, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_LID_OPEN, GPIO_INT_RISING | GPIO_PULL_DOWN },
/*
* BD99956 handles charge input automatically. We'll disable
* charge output in hibernate. Charger will assert ACOK_OD
* when VBUS or VCC are plugged in.
*/
- {GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
- {GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN},
+ { GPIO_USB_C0_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
+ { GPIO_USB_C1_5V_EN, GPIO_INPUT | GPIO_PULL_DOWN },
};
/* Change GPIOs' state in hibernate for better power consumption */
@@ -927,17 +913,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t mag_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t mag_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -1113,8 +1095,8 @@ struct {
int thresh_mv;
} const reef_board_versions[] = {
/* Vin = 3.3V, R1 = 46.4K, R2 values listed below */
- { BOARD_VERSION_1, 328 * 1.03 }, /* 5.11 Kohm */
- { BOARD_VERSION_2, 670 * 1.03 }, /* 11.8 Kohm */
+ { BOARD_VERSION_1, 328 * 1.03 }, /* 5.11 Kohm */
+ { BOARD_VERSION_2, 670 * 1.03 }, /* 11.8 Kohm */
{ BOARD_VERSION_3, 1012 * 1.03 }, /* 20.5 Kohm */
{ BOARD_VERSION_4, 1357 * 1.03 }, /* 32.4 Kohm */
{ BOARD_VERSION_5, 1690 * 1.03 }, /* 48.7 Kohm */
diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h
index ad98fac829..bde2d831d3 100644
--- a/board/reef_mchp/board.h
+++ b/board/reef_mchp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -24,14 +24,14 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_CMD_BATT_MFG_ACCESS
#define CONFIG_CMD_CHARGER_ADC_AMON_BMON
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define BD9995X_IOUT_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_IOUT_GAIN_SET_20V
#define CONFIG_CHARGER_PSYS_READ
#define BD9995X_PSYS_GAIN_SELECT \
- BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
+ BD9995X_CMD_PMON_IOUT_CTRL_SET_PMON_GAIN_SET_02UAW
#define CONFIG_CMD_I2C_STRESS_TEST
#define CONFIG_CMD_I2C_STRESS_TEST_ACCEL
@@ -41,7 +41,7 @@
#define CONFIG_CMD_I2C_STRESS_TEST_TCPC
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_CUT_OFF
#define CONFIG_BATTERY_PRESENT_CUSTOM
#define CONFIG_BATTERY_SMART
@@ -62,7 +62,7 @@
#define CONFIG_USB_CHARGER
#define CONFIG_CHARGER_PROFILE_OVERRIDE
#define CONFIG_CHARGER_PROFILE_OVERRIDE_COMMON
-#undef CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES
+#undef CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES
#define CONFIG_CHARGER_PROFILE_VOLTAGE_RANGES 3
#define CONFIG_CHARGE_MANAGER_EXTERNAL_POWER_LIMIT
@@ -89,7 +89,7 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_TCPC_LOW_POWER
-#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
+#define CONFIG_USB_PD_TCPM_MUX /* for both PS8751 and ANX3429 */
#define CONFIG_USB_PD_TCPM_ANX3429 /* Silicon on Reef is ANX3429 */
#define CONFIG_USB_PD_TCPM_PS8751
#define CONFIG_USB_PD_TCPM_TCPCI
@@ -117,8 +117,8 @@
/* EC */
#define CONFIG_ADC
#define CONFIG_EXTPOWER_GPIO
-#undef CONFIG_EXTPOWER_DEBOUNCE_MS
-#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
+#undef CONFIG_EXTPOWER_DEBOUNCE_MS
+#define CONFIG_EXTPOWER_DEBOUNCE_MS 1000
#define CONFIG_FPU
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
#define CONFIG_I2C
@@ -145,7 +145,7 @@
#define CONFIG_WIRELESS
#define CONFIG_WIRELESS_SUSPEND EC_WIRELESS_SWITCH_WLAN_POWER
#define CONFIG_WLAN_POWER_ACTIVE_LOW
-#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
+#define WIRELESS_GPIO_WLAN_POWER GPIO_WIRELESS_GPIO_WLAN_POWER
#define CONFIG_PWR_STATE_DISCHARGE_FULL
/*
@@ -171,7 +171,7 @@
#define CONFIG_FLASH_SIZE_BYTES 524288
#define CONFIG_SPI_FLASH_REGS
-#define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */
+#define CONFIG_SPI_FLASH_W25Q40 /* FIXME: Should be GD25LQ40? */
/*
* Enable 1 slot of secure temporary storage to support
@@ -186,17 +186,17 @@
#define CONFIG_BOARD_PRE_INIT
/* I2C ports */
-#define I2C_CONTROLLER_COUNT 4
-#define I2C_PORT_COUNT 5
-
-#define I2C_PORT_GYRO MCHP_I2C_PORT6
-#define I2C_PORT_LID_ACCEL MCHP_I2C_PORT7
-#define I2C_PORT_ALS MCHP_I2C_PORT7
-#define I2C_PORT_BARO MCHP_I2C_PORT7
-#define I2C_PORT_BATTERY MCHP_I2C_PORT3
-#define I2C_PORT_CHARGER MCHP_I2C_PORT3
+#define I2C_CONTROLLER_COUNT 4
+#define I2C_PORT_COUNT 5
+
+#define I2C_PORT_GYRO MCHP_I2C_PORT6
+#define I2C_PORT_LID_ACCEL MCHP_I2C_PORT7
+#define I2C_PORT_ALS MCHP_I2C_PORT7
+#define I2C_PORT_BARO MCHP_I2C_PORT7
+#define I2C_PORT_BATTERY MCHP_I2C_PORT3
+#define I2C_PORT_CHARGER MCHP_I2C_PORT3
/* Accelerometer and Gyroscope are the same device. */
-#define I2C_PORT_ACCEL I2C_PORT_GYRO
+#define I2C_PORT_ACCEL I2C_PORT_GYRO
/* Sensors */
#define CONFIG_MKBP_EVENT
@@ -222,7 +222,6 @@
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -230,9 +229,9 @@
/* ADC signal */
enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER, /* ADC0 */
- ADC_TEMP_SENSOR_AMB, /* ADC1 */
- ADC_BOARD_ID, /* ADC2 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC0 */
+ ADC_TEMP_SENSOR_AMB, /* ADC1 */
+ ADC_BOARD_ID, /* ADC2 */
ADC_CH_COUNT
};
@@ -271,7 +270,7 @@ enum sensor_id {
BASE_GYRO,
BASE_MAG,
BASE_BARO,
- LID_ALS, /* firmware-reef-9042.B doesn't have this */
+ LID_ALS, /* firmware-reef-9042.B doesn't have this */
SENSOR_COUNT,
};
@@ -294,16 +293,16 @@ enum reef_board_version {
* delay to turn on the power supply max is ~16ms.
* delay to turn off the power supply max is about ~180ms.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
/* delay to turn on/off vconn */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Reset PD MCU */
void board_reset_pd_mcu(void);
diff --git a/board/reef_mchp/build.mk b/board/reef_mchp/build.mk
index 19fffbaf0d..afc530837e 100644
--- a/board/reef_mchp/build.mk
+++ b/board/reef_mchp/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/reef_mchp/ec.tasklist b/board/reef_mchp/ec.tasklist
index adf63fae62..8611d09301 100644
--- a/board/reef_mchp/ec.tasklist
+++ b/board/reef_mchp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/reef_mchp/gpio.inc b/board/reef_mchp/gpio.inc
index 3274af3bff..9783649e25 100644
--- a/board/reef_mchp/gpio.inc
+++ b/board/reef_mchp/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/reef_mchp/led.c b/board/reef_mchp/led.c
index ca49fe4ed5..469758dc26 100644
--- a/board/reef_mchp/led.c
+++ b/board/reef_mchp/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -27,8 +27,7 @@
#define LED_ON_1SEC_TICKS 1
#define LED_ON_2SECS_TICKS 2
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -36,7 +35,7 @@ enum led_color {
LED_OFF = 0,
LED_BLUE,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int led_set_color_battery(enum led_color color)
@@ -113,16 +112,19 @@ static void led_set_battery(void)
} else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
/* Blink once every four seconds. */
led_set_color_battery(
- (suspend_ticks % LED_TOTAL_4SECS_TICKS)
- < LED_ON_1SEC_TICKS ? LED_AMBER : LED_OFF);
+ (suspend_ticks % LED_TOTAL_4SECS_TICKS) <
+ LED_ON_1SEC_TICKS ?
+ LED_AMBER :
+ LED_OFF);
} else {
led_set_color_battery(LED_OFF);
}
break;
case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % LED_TOTAL_2SECS_TICKS <
- LED_ON_1SEC_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery((battery_ticks % LED_TOTAL_2SECS_TICKS <
+ LED_ON_1SEC_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
led_set_color_battery(LED_BLUE);
@@ -131,7 +133,9 @@ static void led_set_battery(void)
if (charge_get_flags() & CHARGE_FLAG_FORCE_IDLE)
led_set_color_battery(
(battery_ticks % LED_TOTAL_4SECS_TICKS <
- LED_ON_2SECS_TICKS) ? LED_AMBER : LED_BLUE);
+ LED_ON_2SECS_TICKS) ?
+ LED_AMBER :
+ LED_BLUE);
else
led_set_color_battery(LED_BLUE);
break;
diff --git a/board/reef_mchp/usb_pd_policy.c b/board/reef_mchp/usb_pd_policy.c
index 90f44f8580..478f760989 100644
--- a/board/reef_mchp/usb_pd_policy.c
+++ b/board/reef_mchp/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@
#include "tfdp_chip.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en[CONFIG_USB_PD_PORT_MAX_COUNT];
-static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = {TYPEC_RP_1A5,
- TYPEC_RP_1A5};
+static uint8_t vbus_rp[CONFIG_USB_PD_PORT_MAX_COUNT] = { TYPEC_RP_1A5,
+ TYPEC_RP_1A5 };
int board_vbus_source_enabled(int port)
{
@@ -41,7 +41,8 @@ static void board_vbus_update_source_current(int port)
{
enum gpio_signal gpio = port ? GPIO_USB_C1_5V_EN : GPIO_USB_C0_5V_EN;
int flags = (vbus_rp[port] == TYPEC_RP_1A5 && vbus_en[port]) ?
- (GPIO_INPUT | GPIO_PULL_UP) : (GPIO_OUTPUT | GPIO_PULL_UP);
+ (GPIO_INPUT | GPIO_PULL_UP) :
+ (GPIO_OUTPUT | GPIO_PULL_UP);
/*
* Driving USB_Cx_5V_EN high, actually put a 16.5k resistance
diff --git a/board/sasuke/battery.c b/board/sasuke/battery.c
index ad7ea9c2fe..c06f88ddfd 100644
--- a/board/sasuke/battery.c
+++ b/board/sasuke/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,7 +12,7 @@
#include "usb_pd.h"
#include "util.h"
-#define CHARGING_CURRENT_REDUCE 4000
+#define CHARGING_CURRENT_REDUCE 4000
/*
* Battery info for all sasuke battery types. Note that the fields
* start_charging_min/max and charging_min/max are not used for the charger.
@@ -152,7 +152,7 @@ static void reduce_input_voltage_when_full(void)
int port;
if (charge_get_percent() == 100 &&
- chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
+ chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
if (max_pd_voltage_mv != PD_VOLTAGE_WHEN_FULL) {
saved_input_voltage = max_pd_voltage_mv;
max_pd_voltage_mv = PD_VOLTAGE_WHEN_FULL;
@@ -168,5 +168,4 @@ static void reduce_input_voltage_when_full(void)
pd_set_external_voltage_limit(port, max_pd_voltage_mv);
}
}
-DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full,
- HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_SECOND, reduce_input_voltage_when_full, HOOK_PRIO_DEFAULT);
diff --git a/board/sasuke/board.c b/board/sasuke/board.c
index 830c92eb47..ddd5279d62 100644
--- a/board/sasuke/board.c
+++ b/board/sasuke/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,8 +42,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -83,7 +83,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -118,7 +117,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
{
@@ -164,22 +162,21 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
static int board_id = -1;
static int mux_c1 = SSFC_USB_SS_MUX_DEFAULT;
-extern const struct usb_mux usbc0_retimer;
+extern const struct usb_mux_chain usbc0_retimer;
extern const struct usb_mux usbmux_ps8743;
void board_init(void)
@@ -191,16 +188,17 @@ void board_init(void)
if (get_cbi_fw_config_db() == DB_1A_HDMI) {
/* Disable i2c on HDMI pins */
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0);
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
+ 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
+ 0);
/* Set HDMI and sub-rail enables to output */
gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
chipset_in_state(CHIPSET_STATE_ON) ?
- GPIO_ODR_LOW : GPIO_ODR_HIGH);
- gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
+ GPIO_ODR_LOW :
+ GPIO_ODR_HIGH);
+ gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
/* Select HDMI option */
gpio_set_level(GPIO_HDMI_SEL_L, 0);
@@ -209,8 +207,7 @@ void board_init(void)
gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL);
} else {
/* Set SDA as an input */
- gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
- GPIO_INPUT);
+ gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, GPIO_INPUT);
/* Enable C1 interrupts */
gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
@@ -229,18 +226,19 @@ void board_init(void)
board_id = val;
if (board_id == 2) {
nb7v904m_lpm_disable = 1;
- nb7v904m_set_aux_ch_switch(&usbc0_retimer,
- NB7V904M_AUX_CH_FLIPPED);
+ nb7v904m_set_aux_ch_switch(
+ usbc0_retimer.mux,
+ NB7V904M_AUX_CH_FLIPPED);
}
}
}
mux_c1 = get_cbi_ssfc_usb_ss_mux();
- if (mux_c1 == SSFC_USB_SS_MUX_PS8743)
- memcpy(&usb_muxes[1],
- &usbmux_ps8743,
- sizeof(struct usb_mux));
+ if (mux_c1 == SSFC_USB_SS_MUX_PS8743) {
+ usb_muxes[1].mux = &usbmux_ps8743;
+ usb_muxes[1].next = NULL;
+ }
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -302,10 +300,9 @@ __override void board_power_5v_enable(int enable)
gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
} else {
if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTS("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
-
}
__override uint8_t board_get_usb_pd_port_count(void)
@@ -330,13 +327,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -400,8 +395,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -421,9 +416,8 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
raa489000_set_output_current(port, rp);
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -489,24 +483,30 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
static int board_nb7v904m_mux_set_c0(const struct usb_mux *me,
- mux_state_t mux_state);
+ mux_state_t mux_state);
static int board_nb7v904m_mux_set(const struct usb_mux *me,
- mux_state_t mux_state);
+ mux_state_t mux_state);
static int ps8743_tune_mux(const struct usb_mux *me);
-const struct usb_mux usbc0_retimer = {
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
- .board_set = &board_nb7v904m_mux_set_c0,
+const struct usb_mux_chain usbc0_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ .board_set = &board_nb7v904m_mux_set_c0,
+ },
};
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
- .board_set = &board_nb7v904m_mux_set,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ .board_set = &board_nb7v904m_mux_set,
+ },
};
const struct usb_mux usbmux_ps8743 = {
@@ -517,35 +517,40 @@ const struct usb_mux usbmux_ps8743 = {
.board_init = &ps8743_tune_mux,
};
-struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
- .next_mux = &usbc0_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
+ .next = &usbc0_retimer,
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
}
};
/* USB Mux C1 : board_init of PS8743 */
static int ps8743_tune_mux(const struct usb_mux *me)
{
- ps8743_tune_usb_eq(me,
- PS8743_USB_EQ_TX_3_6_DB,
- PS8743_USB_EQ_RX_16_0_DB);
+ ps8743_tune_usb_eq(me, PS8743_USB_EQ_TX_3_6_DB,
+ PS8743_USB_EQ_RX_16_0_DB);
return EC_SUCCESS;
}
/* USB Mux C0 */
static int board_nb7v904m_mux_set_c0(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
int flipped = !!(mux_state & USB_PD_MUX_POLARITY_INVERTED);
@@ -563,79 +568,74 @@ static int board_nb7v904m_mux_set_c0(const struct usb_mux *me,
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* USB with DP */
if (flipped) {
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_10_DB,
- NB7V904M_CH_B_EQ_0_DB,
- NB7V904M_CH_C_EQ_2_DB,
- NB7V904M_CH_D_EQ_2_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_1P5_DB,
- NB7V904M_CH_C_GAIN_0_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_C,
- NB7V904M_LOSS_PROFILE_C);
- }
- else {
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_2_DB,
- NB7V904M_CH_B_EQ_2_DB,
- NB7V904M_CH_C_EQ_0_DB,
- NB7V904M_CH_D_EQ_10_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_0_DB,
- NB7V904M_CH_C_GAIN_1P5_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_C,
- NB7V904M_LOSS_PROFILE_C,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A);
+ rv |= nb7v904m_tune_usb_set_eq(
+ me, NB7V904M_CH_A_EQ_10_DB,
+ NB7V904M_CH_B_EQ_0_DB,
+ NB7V904M_CH_C_EQ_2_DB,
+ NB7V904M_CH_D_EQ_2_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_1P5_DB,
+ NB7V904M_CH_C_GAIN_0_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_C,
+ NB7V904M_LOSS_PROFILE_C);
+ } else {
+ rv |= nb7v904m_tune_usb_set_eq(
+ me, NB7V904M_CH_A_EQ_2_DB,
+ NB7V904M_CH_B_EQ_2_DB,
+ NB7V904M_CH_C_EQ_0_DB,
+ NB7V904M_CH_D_EQ_10_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_0_DB,
+ NB7V904M_CH_C_GAIN_1P5_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_C,
+ NB7V904M_LOSS_PROFILE_C,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A);
}
} else {
/* USB only */
if (board_id == 2)
- rv |= nb7v904m_set_aux_ch_switch(me,
- NB7V904M_AUX_CH_FLIPPED);
+ rv |= nb7v904m_set_aux_ch_switch(
+ me, NB7V904M_AUX_CH_FLIPPED);
rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_10_DB,
- NB7V904M_CH_B_EQ_0_DB,
- NB7V904M_CH_C_EQ_0_DB,
- NB7V904M_CH_D_EQ_10_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_1P5_DB,
- NB7V904M_CH_C_GAIN_1P5_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A);
+ NB7V904M_CH_A_EQ_10_DB,
+ NB7V904M_CH_B_EQ_0_DB,
+ NB7V904M_CH_C_EQ_0_DB,
+ NB7V904M_CH_D_EQ_10_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_1P5_DB,
+ NB7V904M_CH_C_GAIN_1P5_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A);
}
} else if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* 4 lanes DP */
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_2_DB,
- NB7V904M_CH_B_EQ_2_DB,
- NB7V904M_CH_C_EQ_2_DB,
- NB7V904M_CH_D_EQ_2_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_A_GAIN_0_DB,
- NB7V904M_CH_B_GAIN_0_DB,
- NB7V904M_CH_C_GAIN_0_DB,
- NB7V904M_CH_D_GAIN_0_DB);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_C,
- NB7V904M_LOSS_PROFILE_C,
- NB7V904M_LOSS_PROFILE_C,
- NB7V904M_LOSS_PROFILE_C);
+ rv |= nb7v904m_tune_usb_set_eq(me, NB7V904M_CH_A_EQ_2_DB,
+ NB7V904M_CH_B_EQ_2_DB,
+ NB7V904M_CH_C_EQ_2_DB,
+ NB7V904M_CH_D_EQ_2_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(me, NB7V904M_CH_A_GAIN_0_DB,
+ NB7V904M_CH_B_GAIN_0_DB,
+ NB7V904M_CH_C_GAIN_0_DB,
+ NB7V904M_CH_D_GAIN_0_DB);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_C, NB7V904M_LOSS_PROFILE_C,
+ NB7V904M_LOSS_PROFILE_C, NB7V904M_LOSS_PROFILE_C);
}
return rv;
@@ -643,7 +643,7 @@ static int board_nb7v904m_mux_set_c0(const struct usb_mux *me,
/* USB Mux */
static int board_nb7v904m_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
int rv = EC_SUCCESS;
int flipped = !!(mux_state & USB_PD_MUX_POLARITY_INVERTED);
@@ -652,75 +652,70 @@ static int board_nb7v904m_mux_set(const struct usb_mux *me,
/* USB with DP */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
if (flipped) {
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_10_DB,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_D_EQ_4_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_ALL_SKIP_GAIN,
- NB7V904M_CH_B_GAIN_3P5_DB,
- NB7V904M_CH_C_GAIN_0_DB,
- NB7V904M_CH_ALL_SKIP_GAIN);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D);
- }
- else {
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_4_DB,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_D_EQ_10_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_ALL_SKIP_GAIN,
- NB7V904M_CH_B_GAIN_0_DB,
- NB7V904M_CH_C_GAIN_3P5_DB,
- NB7V904M_CH_ALL_SKIP_GAIN);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A);
+ rv |= nb7v904m_tune_usb_set_eq(
+ me, NB7V904M_CH_A_EQ_10_DB,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_D_EQ_4_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_ALL_SKIP_GAIN,
+ NB7V904M_CH_B_GAIN_3P5_DB,
+ NB7V904M_CH_C_GAIN_0_DB,
+ NB7V904M_CH_ALL_SKIP_GAIN);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_D);
+ } else {
+ rv |= nb7v904m_tune_usb_set_eq(
+ me, NB7V904M_CH_A_EQ_4_DB,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_D_EQ_10_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_ALL_SKIP_GAIN,
+ NB7V904M_CH_B_GAIN_0_DB,
+ NB7V904M_CH_C_GAIN_3P5_DB,
+ NB7V904M_CH_ALL_SKIP_GAIN);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A);
}
} else {
/* USB only */
rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_10_DB,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_D_EQ_10_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_ALL_SKIP_GAIN,
- NB7V904M_CH_B_GAIN_3P5_DB,
- NB7V904M_CH_C_GAIN_3P5_DB,
- NB7V904M_CH_ALL_SKIP_GAIN);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A,
- NB7V904M_LOSS_PROFILE_A);
+ NB7V904M_CH_A_EQ_10_DB,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_D_EQ_10_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(
+ me, NB7V904M_CH_ALL_SKIP_GAIN,
+ NB7V904M_CH_B_GAIN_3P5_DB,
+ NB7V904M_CH_C_GAIN_3P5_DB,
+ NB7V904M_CH_ALL_SKIP_GAIN);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A,
+ NB7V904M_LOSS_PROFILE_A);
}
} else if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* 4 lanes DP */
- rv |= nb7v904m_tune_usb_set_eq(me,
- NB7V904M_CH_A_EQ_4_DB,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_ALL_SKIP_EQ,
- NB7V904M_CH_D_EQ_4_DB);
- rv |= nb7v904m_tune_usb_flat_gain(me,
- NB7V904M_CH_ALL_SKIP_GAIN,
- NB7V904M_CH_B_GAIN_0_DB,
- NB7V904M_CH_C_GAIN_0_DB,
- NB7V904M_CH_ALL_SKIP_GAIN);
- rv |= nb7v904m_set_loss_profile_match(me,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D,
- NB7V904M_LOSS_PROFILE_D);
+ rv |= nb7v904m_tune_usb_set_eq(me, NB7V904M_CH_A_EQ_4_DB,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_ALL_SKIP_EQ,
+ NB7V904M_CH_D_EQ_4_DB);
+ rv |= nb7v904m_tune_usb_flat_gain(me, NB7V904M_CH_ALL_SKIP_GAIN,
+ NB7V904M_CH_B_GAIN_0_DB,
+ NB7V904M_CH_C_GAIN_0_DB,
+ NB7V904M_CH_ALL_SKIP_GAIN);
+ rv |= nb7v904m_set_loss_profile_match(
+ me, NB7V904M_LOSS_PROFILE_D, NB7V904M_LOSS_PROFILE_D,
+ NB7V904M_LOSS_PROFILE_D, NB7V904M_LOSS_PROFILE_D);
}
return rv;
@@ -748,7 +743,7 @@ uint16_t tcpc_get_alert_status(void)
}
if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
+ !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
@@ -778,8 +773,8 @@ static const struct ec_response_keybd_config keybd1 = {
},
/* No function keys, no numeric keypad and no screenlock key */
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
/*
* Future boards should use fw_config if needed.
diff --git a/board/sasuke/board.h b/board/sasuke/board.h
index 4d70cda5ab..64c830df0f 100644
--- a/board/sasuke/board.h
+++ b/board/sasuke/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,13 +23,16 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
#define CONFIG_CHARGER_PROFILE_OVERRIDE
#define CONFIG_CHARGE_RAMP_HW
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_BATTERY_CHECK_CHARGE_TEMP_LIMITS
@@ -50,9 +53,8 @@
#define GPIO_BAT_LED_GREEN_L GPIO_LED_G_ODL
#define GPIO_PWR_LED_BLUE_L GPIO_LED_B_ODL
-
/* PWM */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
/* Thermistors */
#define CONFIG_TEMP_SENSOR
@@ -85,10 +87,10 @@
#undef PD_POWER_SUPPLY_TURN_OFF_DELAY
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
/* 20% margin added for these timings */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
/* USB Type A Features */
#define USB_PORT_COUNT 1
@@ -101,16 +103,16 @@
#define GPIO_USB1_ILIM_SEL GPIO_EN_USB_A0_5V_SUB
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -142,17 +144,13 @@ enum chg_id {
CHARGER_NUM,
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
diff --git a/board/sasuke/build.mk b/board/sasuke/build.mk
index cd002a20e7..1531d1f3ae 100644
--- a/board/sasuke/build.mk
+++ b/board/sasuke/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/sasuke/cbi_ssfc.c b/board/sasuke/cbi_ssfc.c
index 61db1ef4f6..4f726ce6a3 100644
--- a/board/sasuke/cbi_ssfc.c
+++ b/board/sasuke/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,15 +27,15 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
enum ec_ssfc_usb_ss_mux get_cbi_ssfc_usb_ss_mux(void)
{
- return (enum ec_ssfc_usb_ss_mux) cached_ssfc.usb_ss_mux;
+ return (enum ec_ssfc_usb_ss_mux)cached_ssfc.usb_ss_mux;
}
diff --git a/board/sasuke/cbi_ssfc.h b/board/sasuke/cbi_ssfc.h
index af47a1c2cd..7cf6e954a1 100644
--- a/board/sasuke/cbi_ssfc.h
+++ b/board/sasuke/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -73,5 +73,4 @@ enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
*/
enum ec_ssfc_usb_ss_mux get_cbi_ssfc_usb_ss_mux(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/sasuke/ec.tasklist b/board/sasuke/ec.tasklist
index a867bdbbae..17d4f989b3 100644
--- a/board/sasuke/ec.tasklist
+++ b/board/sasuke/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/sasuke/gpio.inc b/board/sasuke/gpio.inc
index 4b970f9798..46069c35eb 100644
--- a/board/sasuke/gpio.inc
+++ b/board/sasuke/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/sasuke/led.c b/board/sasuke/led.c
index 37cbad75e5..8ccce58d4c 100644
--- a/board/sasuke/led.c
+++ b/board/sasuke/led.c
@@ -1,8 +1,8 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
- * Power and battery LED control for sasuke
+ * Power and battery LED control for sasuke
*/
#include "chipset.h"
@@ -12,8 +12,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 1;
@@ -21,33 +21,36 @@ __override const int led_charge_lvl_2 = 100;
/* sasuke : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -55,14 +58,13 @@ __override void led_set_color_power(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
- }
+ }
- if (color == EC_LED_COLOR_BLUE)
- {
- gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
- gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
+ if (color == EC_LED_COLOR_BLUE) {
+ gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
+ gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_ON_LVL);
} else {
/* LED_OFF and unsupported colors */
@@ -74,17 +76,16 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
- }
+ }
/* Battery leds must be turn off when blue led is on
* because casta has 3-in-1 led.
*/
- if(!gpio_get_level(GPIO_PWR_LED_BLUE_L))
- {
+ if (!gpio_get_level(GPIO_PWR_LED_BLUE_L)) {
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL); /*red*/
- gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); /*green*/
+ gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL); /*green*/
return;
}
@@ -118,10 +119,13 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
- gpio_set_level(GPIO_BAT_LED_GREEN_L, !brightness[EC_LED_COLOR_GREEN]);
- gpio_set_level(GPIO_BAT_LED_RED_L, !brightness[EC_LED_COLOR_RED]);
+ gpio_set_level(GPIO_BAT_LED_GREEN_L,
+ !brightness[EC_LED_COLOR_GREEN]);
+ gpio_set_level(GPIO_BAT_LED_RED_L,
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
- gpio_set_level(GPIO_PWR_LED_BLUE_L, !brightness[EC_LED_COLOR_BLUE]);
+ gpio_set_level(GPIO_PWR_LED_BLUE_L,
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/sasuke/usb_pd_policy.c b/board/sasuke/usb_pd_policy.c
index 3190595596..23166f7fca 100644
--- a/board/sasuke/usb_pd_policy.c
+++ b/board/sasuke/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/sasukette/battery.c b/board/sasukette/battery.c
index 652c04a651..7a4670816e 100644
--- a/board/sasukette/battery.c
+++ b/board/sasukette/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -12,8 +12,8 @@
#include "common.h"
#include "util.h"
-#define CHARGING_VOLTAGE_MV_SAFE 8400
-#define CHARGING_CURRENT_MA_SAFE 1500
+#define CHARGING_VOLTAGE_MV_SAFE 8400
+#define CHARGING_CURRENT_MA_SAFE 1500
/*
* Battery info for all sasukette battery types. Note that the fields
@@ -165,13 +165,13 @@ int charger_profile_override(struct charge_state_data *curr)
}
enum ec_status charger_profile_override_get_param(uint32_t param,
- uint32_t *value)
+ uint32_t *value)
{
return EC_RES_INVALID_PARAM;
}
enum ec_status charger_profile_override_set_param(uint32_t param,
- uint32_t value)
+ uint32_t value)
{
return EC_RES_INVALID_PARAM;
}
diff --git a/board/sasukette/board.c b/board/sasukette/board.c
index cbc786b892..e45213a63a 100644
--- a/board/sasukette/board.c
+++ b/board/sasukette/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,7 +41,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -90,45 +90,35 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* BC 1.2 chips */
-const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
- {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- .flags = PI3USB9201_ALWAYS_POWERED,
- }
-};
+const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { {
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
+ .flags = PI3USB9201_ALWAYS_POWERED,
+} };
int pd_snk_is_vbus_provided(int port)
{
@@ -136,13 +126,11 @@ int pd_snk_is_vbus_provided(int port)
}
/* Charger chips */
-const struct charger_config_t chg_chips[] = {
- {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = ISL923X_ADDR_FLAGS,
- .drv = &isl923x_drv,
- }
-};
+const struct charger_config_t chg_chips[] = { {
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+} };
/* TCPCs */
const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
@@ -158,14 +146,15 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- }
-};
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
+} };
static uint32_t board_id;
@@ -285,8 +274,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -359,17 +347,17 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Cpu",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Cpu",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/sasukette/board.h b/board/sasukette/board.h
index a1d987aaf3..44cb65239a 100644
--- a/board/sasukette/board.h
+++ b/board/sasukette/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,6 +29,7 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
#define CONFIG_CHARGER_SINGLE_CHIP
@@ -60,8 +61,8 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
#ifndef __ASSEMBLER__
@@ -70,10 +71,10 @@
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_TEMP_SENSOR_3, /* ADC15*/
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_TEMP_SENSOR_3, /* ADC15*/
ADC_CH_COUNT
};
diff --git a/board/sasukette/build.mk b/board/sasukette/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/sasukette/build.mk
+++ b/board/sasukette/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/sasukette/cbi_ssfc.c b/board/sasukette/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/sasukette/cbi_ssfc.c
+++ b/board/sasukette/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/sasukette/cbi_ssfc.h b/board/sasukette/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/sasukette/cbi_ssfc.h
+++ b/board/sasukette/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/sasukette/ec.tasklist b/board/sasukette/ec.tasklist
index bb4d9c6a61..d4a6c2cab3 100644
--- a/board/sasukette/ec.tasklist
+++ b/board/sasukette/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/sasukette/gpio.inc b/board/sasukette/gpio.inc
index 396a5595fa..de63737e75 100644
--- a/board/sasukette/gpio.inc
+++ b/board/sasukette/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/sasukette/led.c b/board/sasukette/led.c
index 28643a7b87..af6d3635ac 100644
--- a/board/sasukette/led.c
+++ b/board/sasukette/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -13,8 +13,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 1;
@@ -22,33 +22,36 @@ __override const int led_charge_lvl_2 = 100;
/* Sasukette : There are 3 leds for AC, Battery and Power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 0.5 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED,
+ 0.5 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_BLUE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -56,7 +59,7 @@ __override void led_set_color_power(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
@@ -74,7 +77,7 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
/* Don't set led if led_auto_control is disabled. */
if (!led_auto_control_is_enabled(EC_LED_ID_POWER_LED) ||
- !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
+ !led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED)) {
return;
}
@@ -118,12 +121,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_GREEN_L,
- !brightness[EC_LED_COLOR_GREEN]);
+ !brightness[EC_LED_COLOR_GREEN]);
gpio_set_level(GPIO_BAT_LED_RED_L,
- !brightness[EC_LED_COLOR_RED]);
+ !brightness[EC_LED_COLOR_RED]);
} else if (led_id == EC_LED_ID_POWER_LED) {
gpio_set_level(GPIO_PWR_LED_BLUE_L,
- !brightness[EC_LED_COLOR_BLUE]);
+ !brightness[EC_LED_COLOR_BLUE]);
gpio_set_level(GPIO_BAT_LED_GREEN_L, LED_OFF_LVL);
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
}
diff --git a/board/sasukette/usb_pd_policy.c b/board/sasukette/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/sasukette/usb_pd_policy.c
+++ b/board/sasukette/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/scarlet/battery.c b/board/scarlet/battery.c
index 0be4cc93e2..5d4412f66c 100644
--- a/board/scarlet/battery.c
+++ b/board/scarlet/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -32,11 +32,7 @@
static uint8_t batt_id = 0xff;
/* Do not change the enum values. We directly use strap gpio level to index. */
-enum battery_type {
- BATTERY_SIMPLO = 0,
- BATTERY_AETECH,
- BATTERY_COUNT
-};
+enum battery_type { BATTERY_SIMPLO = 0, BATTERY_AETECH, BATTERY_COUNT };
static const struct battery_info info[] = {
[BATTERY_SIMPLO] = {
@@ -192,7 +188,7 @@ int charger_profile_override(struct charge_state_data *curr)
else {
for (temp_zone = 0; temp_zone < TEMP_ZONE_COUNT; temp_zone++) {
if (bat_temp_c <
- temp_zones[batt_id][temp_zone].temp_max)
+ temp_zones[batt_id][temp_zone].temp_max)
break;
}
}
@@ -233,9 +229,10 @@ int charger_profile_override(struct charge_state_data *curr)
curr->requested_voltage =
temp_zones[batt_id][temp_zone].desired_voltage;
- curr->requested_current = (charge_phase) ?
- CHARGE_PHASE_CHANGED_CURRENT_MA :
- temp_zones[batt_id][temp_zone].desired_current;
+ curr->requested_current =
+ (charge_phase) ?
+ CHARGE_PHASE_CHANGED_CURRENT_MA :
+ temp_zones[batt_id][temp_zone].desired_current;
break;
case TEMP_OUT_OF_RANGE:
curr->requested_current = curr->requested_voltage = 0;
@@ -281,8 +278,7 @@ static void board_charge_termination(void)
te = 1;
}
}
-DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE,
- board_charge_termination,
+DECLARE_HOOK(HOOK_BATTERY_SOC_CHANGE, board_charge_termination,
HOOK_PRIO_DEFAULT);
/* Customs options controllable by host command. */
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index 3d9049c983..34e5cc456c 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,6 +24,7 @@
#include "hooks.h"
#include "host_command.h"
#include "i2c.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -43,8 +44,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -68,27 +69,23 @@ static void warm_reset_request_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "charger",
- .port = I2C_PORT_CHARGER,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
+ { .name = "charger",
+ .port = I2C_PORT_CHARGER,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -104,22 +101,22 @@ const struct charger_config_t chg_chips[] = {
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD"},
- {GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD"},
- {GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD"},
- {GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED"},
+ { GPIO_PP1250_S3_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP1250_S3_PWR_GOOD" },
+ { GPIO_PP900_S0_PG, POWER_SIGNAL_ACTIVE_HIGH, "PP900_S0_PWR_GOOD" },
+ { GPIO_AP_CORE_PG, POWER_SIGNAL_ACTIVE_HIGH, "AP_PWR_GOOD" },
+ { GPIO_AP_EC_S3_S0_L, POWER_SIGNAL_ACTIVE_LOW, "SUSPEND_DEASSERTED" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
#ifdef CONFIG_TEMP_SENSOR_TMP432
/* Temperature sensors data; must be in same order as enum temp_sensor_id. */
const struct temp_sensor_t temp_sensors[] = {
- {"TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_LOCAL, 4},
- {"TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE1, 4},
- {"TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
- TMP432_IDX_REMOTE2, 4},
+ { "TMP432_Internal", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_LOCAL, 4 },
+ { "TMP432_Sensor_1", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE1, 4 },
+ { "TMP432_Sensor_2", TEMP_SENSOR_TYPE_BOARD, tmp432_get_val,
+ TMP432_IDX_REMOTE2, 4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -128,9 +125,9 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
* same order as enum temp_sensor_id. To always ignore any temp, use 0.
*/
struct ec_thermal_config thermal_params[] = {
- {{0, 0, 0}, 0, 0}, /* TMP432_Internal */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_1 */
- {{0, 0, 0}, 0, 0}, /* TMP432_Sensor_2 */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Internal */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Sensor_1 */
+ { { 0, 0, 0 }, 0, 0 }, /* TMP432_Sensor_2 */
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
#endif
@@ -154,11 +151,14 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
};
@@ -166,11 +166,11 @@ void board_reset_pd_mcu(void)
{
}
-enum critical_shutdown board_critical_shutdown_check(
- struct charge_state_data *curr)
+enum critical_shutdown
+board_critical_shutdown_check(struct charge_state_data *curr)
{
if ((curr->batt.flags & BATT_FLAG_BAD_VOLTAGE) ||
- (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH))
+ (curr->batt.voltage <= BAT_LOW_VOLTAGE_THRESH))
return CRITICAL_SHUTDOWN_CUTOFF;
else
return CRITICAL_SHUTDOWN_IGNORE;
@@ -212,11 +212,11 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int extpower_is_present(void)
@@ -252,8 +252,7 @@ static void board_spi_enable(void)
spi_enable(&spi_devices[0], 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -265,8 +264,7 @@ static void board_spi_disable(void)
gpio_config_module(MODULE_SPI_CONTROLLER, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
static void board_init(void)
@@ -306,8 +304,8 @@ void board_config_pre_init(void)
* Ch4: USART1_TX / Ch5: USART1_RX (1000)
* Ch6: SPI2_RX / Ch7: SPI2_TX (0011)
*/
- STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) |
- (3 << 20) | (3 << 24);
+ STM32_DMA_CSELR(STM32_DMAC_CH4) = (8 << 12) | (8 << 16) | (3 << 20) |
+ (3 << 24);
}
enum scarlet_board_version {
@@ -335,16 +333,16 @@ struct {
enum scarlet_board_version version;
int expect_mv;
} const scarlet_boards[] = {
- { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
- { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
- { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
- { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
- { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
- { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
- { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
- { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
- { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
- { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
+ { BOARD_VERSION_REV0, 109 }, /* 51.1K , 2.2K(gru 3.3K) ohm */
+ { BOARD_VERSION_REV1, 211 }, /* 51.1k , 6.8K ohm */
+ { BOARD_VERSION_REV2, 319 }, /* 51.1K , 11K ohm */
+ { BOARD_VERSION_REV3, 427 }, /* 56K , 17.4K ohm */
+ { BOARD_VERSION_REV4, 542 }, /* 51.1K , 22K ohm */
+ { BOARD_VERSION_REV5, 666 }, /* 51.1K , 30K ohm */
+ { BOARD_VERSION_REV6, 781 }, /* 51.1K , 39.2K ohm */
+ { BOARD_VERSION_REV7, 900 }, /* 56K , 56K ohm */
+ { BOARD_VERSION_REV8, 1023 }, /* 47K , 61.9K ohm */
+ { BOARD_VERSION_REV9, 1137 }, /* 47K , 80.6K ohm */
{ BOARD_VERSION_REV10, 1240 }, /* 56K , 124K ohm */
{ BOARD_VERSION_REV11, 1343 }, /* 51.1K , 150K ohm */
{ BOARD_VERSION_REV12, 1457 }, /* 47K , 200K ohm */
@@ -400,11 +398,9 @@ static struct mutex g_base_mutex;
static struct bmi_drv_data_t g_bmi160_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
/*
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index 19fda5382f..1d1a7ced79 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,12 +15,12 @@
/* Optional modules */
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#define CONFIG_CHIPSET_RK3399
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_RTC
#define CONFIG_EMULATED_SYSRQ
-#undef CONFIG_HIBERNATE
+#undef CONFIG_HIBERNATE
#define CONFIG_HOSTCMD_RTC
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
@@ -40,7 +40,7 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
-#undef CONFIG_UART_CONSOLE
+#undef CONFIG_UART_CONSOLE
#define CONFIG_UART_CONSOLE 1
#define CONFIG_UART_RX_DMA
@@ -92,8 +92,7 @@
/* Camera VSYNC */
#define CONFIG_SYNC
#define CONFIG_SYNC_COMMAND
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
/* To be able to indicate the device is in tablet mode. */
#define CONFIG_TABLET_MODE
@@ -137,33 +136,33 @@
#endif
/* Battery parameters for max17055 ModelGauge m5 algorithm. */
-#define BATTERY_MAX17055_RSENSE 5 /* m-ohm */
-#define BATTERY_DESIRED_CHARGING_CURRENT 4000 /* mA */
+#define BATTERY_MAX17055_RSENSE 5 /* m-ohm */
+#define BATTERY_DESIRED_CHARGING_CURRENT 4000 /* mA */
#define CONFIG_THROTTLE_AP_ON_BAT_DISCHG_CURRENT
-#define BAT_MAX_DISCHG_CURRENT 5000 /* mA */
+#define BAT_MAX_DISCHG_CURRENT 5000 /* mA */
#define CONFIG_THROTTLE_AP_ON_BAT_VOLTAGE
#define BAT_LOW_VOLTAGE_THRESH 3200 /* mV */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 12850
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 12850
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Timer selection */
-#define TIM_CLOCK32 2
+#define TIM_CLOCK32 2
#define TIM_WATCHDOG 7
/* 48 MHz SYSCLK clock frequency */
#define CPU_CLOCK 48000000
/* Optional for testing */
-#undef CONFIG_PECI
-#undef CONFIG_PSTORE
+#undef CONFIG_PECI
+#undef CONFIG_PSTORE
/* Modules we want to exclude */
#undef CONFIG_CMD_BATTFAKE
@@ -176,24 +175,24 @@
#define CONFIG_TASK_PROFILING
-#define I2C_PORT_CHARGER 0
-#define I2C_PORT_BATTERY 0
+#define I2C_PORT_CHARGER 0
+#define I2C_PORT_BATTERY 0
#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_TCPC0 1
+#define I2C_PORT_TCPC0 1
/* Route sbs host requests to virtual battery driver */
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_MKBP_INPUT_DEVICES
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_GPIO
/* Define the host events which are allowed to wakeup AP in S3. */
-#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
- (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) |\
- EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
+#define CONFIG_MKBP_HOST_EVENT_WAKEUP_MASK \
+ (EC_HOST_EVENT_MASK(EC_HOST_EVENT_POWER_BUTTON) | \
+ EC_HOST_EVENT_MASK(EC_HOST_EVENT_RTC))
#ifndef __ASSEMBLER__
diff --git a/board/scarlet/build.mk b/board/scarlet/build.mk
index f2966fea6a..adecf6b4ea 100644
--- a/board/scarlet/build.mk
+++ b/board/scarlet/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/scarlet/ec.tasklist b/board/scarlet/ec.tasklist
index 1548272184..08baec1e86 100644
--- a/board/scarlet/ec.tasklist
+++ b/board/scarlet/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/scarlet/gpio.inc b/board/scarlet/gpio.inc
index 9c45295a7f..15ce1cb681 100644
--- a/board/scarlet/gpio.inc
+++ b/board/scarlet/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/scarlet/led.c b/board/scarlet/led.c
index d327ee46d6..6f42f462cf 100644
--- a/board/scarlet/led.c
+++ b/board/scarlet/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -28,7 +28,7 @@ enum led_color {
LED_RED,
LED_AMBER,
LED_GREEN,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static int bat_led_set_color(enum led_color color)
@@ -69,13 +69,13 @@ static void scarlet_led_set_battery(void)
break;
case PWR_STATE_DISCHARGE:
if (charge_get_percent() < 3)
- bat_led_set_color((battery_second & 1)
- ? LED_OFF : LED_AMBER);
+ bat_led_set_color((battery_second & 1) ? LED_OFF :
+ LED_AMBER);
else if (charge_get_percent() < 10)
- bat_led_set_color((battery_second & 3)
- ? LED_OFF : LED_AMBER);
+ bat_led_set_color((battery_second & 3) ? LED_OFF :
+ LED_AMBER);
else if (charge_get_percent() >= BATTERY_LEVEL_NEAR_FULL &&
- (chflags & CHARGE_FLAG_EXTERNAL_POWER))
+ (chflags & CHARGE_FLAG_EXTERNAL_POWER))
bat_led_set_color(LED_GREEN);
else
bat_led_set_color(LED_OFF);
@@ -87,11 +87,11 @@ static void scarlet_led_set_battery(void)
bat_led_set_color(LED_GREEN);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE. */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- bat_led_set_color(
- (battery_second & 0x2) ? LED_GREEN : LED_AMBER);
- else
- bat_led_set_color(LED_GREEN);
+ bat_led_set_color(LED_GREEN);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ bat_led_set_color((battery_second & 0x2) ? LED_GREEN :
+ LED_AMBER);
break;
default:
/* Other states don't alter LED behavior */
@@ -112,10 +112,12 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
if (led_id == EC_LED_ID_BATTERY_LED) {
gpio_set_level(GPIO_BAT_LED_RED,
(brightness[EC_LED_COLOR_RED] != 0) ?
- BAT_LED_ON : BAT_LED_OFF);
+ BAT_LED_ON :
+ BAT_LED_OFF);
gpio_set_level(GPIO_BAT_LED_GREEN,
(brightness[EC_LED_COLOR_GREEN] != 0) ?
- BAT_LED_ON : BAT_LED_OFF);
+ BAT_LED_ON :
+ BAT_LED_OFF);
return EC_SUCCESS;
}
return EC_ERROR_UNKNOWN;
diff --git a/board/scarlet/usb_pd_policy.c b/board/scarlet/usb_pd_policy.c
index cba4540ecd..919e7a8864 100644
--- a/board/scarlet/usb_pd_policy.c
+++ b/board/scarlet/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
static uint8_t vbus_en;
@@ -33,7 +33,6 @@ int board_vbus_source_enabled(int port)
int pd_set_power_supply_ready(int port)
{
-
pd_set_vbus_discharge(port, 0);
/* Provide VBUS */
vbus_en = 1;
diff --git a/board/scout/board.c b/board/scout/board.c
index ce0ee8ceae..2c391ecd32 100644
--- a/board/scout/board.c
+++ b/board/scout/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,8 +37,8 @@
#include "usb_common.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Sensors */
@@ -147,14 +147,14 @@ static int32_t base_5v_power;
* Power usage for each port as measured or estimated.
* Units are milliwatts (5v x ma current)
*/
-#define PWR_BASE_LOAD (5*1335)
-#define PWR_FRONT_HIGH (5*1603)
-#define PWR_FRONT_LOW (5*963)
-#define PWR_REAR (5*1075)
-#define PWR_HDMI (5*562)
-#define PWR_C_HIGH (5*3740)
-#define PWR_C_LOW (5*2090)
-#define PWR_MAX (5*10000)
+#define PWR_BASE_LOAD (5 * 1335)
+#define PWR_FRONT_HIGH (5 * 1603)
+#define PWR_FRONT_LOW (5 * 963)
+#define PWR_REAR (5 * 1075)
+#define PWR_HDMI (5 * 562)
+#define PWR_C_HIGH (5 * 3740)
+#define PWR_C_LOW (5 * 2090)
+#define PWR_MAX (5 * 10000)
/*
* Update the 5V power usage, assuming no throttling,
@@ -212,69 +212,56 @@ static void port_ocp_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = { .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
- [PWM_CH_LED_RED] = { .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq = 2000 },
- [PWM_CH_LED_WHITE] = { .channel = 2,
- .flags = PWM_CONFIG_DSLEEP,
- .freq = 2000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
+ [PWM_CH_LED_RED] = { .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
+ [PWM_CH_LED_WHITE] = { .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP,
+ .freq = 2000 },
};
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "ina",
- .port = I2C_PORT_INA,
- .kbps = 400,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "ppc0",
- .port = I2C_PORT_PPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "scaler",
- .port = I2C_PORT_SCALER,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 400,
- .scl = GPIO_I2C5_SCL,
- .sda = GPIO_I2C5_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "ina",
+ .port = I2C_PORT_INA,
+ .kbps = 400,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "ppc0",
+ .port = I2C_PORT_PPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "scaler",
+ .port = I2C_PORT_SCALER,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 400,
+ .scl = GPIO_I2C5_SCL,
+ .sda = GPIO_I2C5_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -342,15 +329,14 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/******************************************************************************/
/* Wake up pins */
-const enum gpio_signal hibernate_wake_pins[] = {
-};
+const enum gpio_signal hibernate_wake_pins[] = {};
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/******************************************************************************/
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -369,7 +355,7 @@ BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_2, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
@@ -378,8 +364,8 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
@@ -398,8 +384,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(78), \
@@ -650,23 +636,23 @@ DECLARE_HOOK(HOOK_INIT, setup_thermal, HOOK_PRIO_DEFAULT - 1);
*
* All measurements are in milliwatts.
*/
-#define THROT_TYPE_A BIT(0)
-#define THROT_TYPE_C BIT(1)
-#define THROT_PROCHOT BIT(2)
+#define THROT_TYPE_A BIT(0)
+#define THROT_TYPE_C BIT(1)
+#define THROT_PROCHOT BIT(2)
/*
* Power gain if front USB A ports are limited.
*/
-#define POWER_GAIN_TYPE_A 3200
+#define POWER_GAIN_TYPE_A 3200
/*
* Power gain if Type C port is limited.
*/
-#define POWER_GAIN_TYPE_C 8800
+#define POWER_GAIN_TYPE_C 8800
/*
* Power is averaged over 10 ms, with a reading every 2 ms.
*/
-#define POWER_DELAY_MS 2
-#define POWER_READINGS (10/POWER_DELAY_MS)
+#define POWER_DELAY_MS 2
+#define POWER_READINGS (10 / POWER_DELAY_MS)
static void power_monitor(void)
{
@@ -679,8 +665,7 @@ static void power_monitor(void)
* If CPU is off or suspended, no need to throttle
* or restrict power.
*/
- if (chipset_in_state(CHIPSET_STATE_ANY_OFF |
- CHIPSET_STATE_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF | CHIPSET_STATE_SUSPEND)) {
/*
* Slow down monitoring, assume no throttling required.
*/
diff --git a/board/scout/board.h b/board/scout/board.h
index 53958b1686..41a93845d7 100644
--- a/board/scout/board.h
+++ b/board/scout/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,8 +12,8 @@
#define CONFIG_UART_TX_BUF_SIZE 4096
/* NPCX7 config */
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
-#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX_UART_MODULE2 1 /* GPIO64/65 are used as UART pins. */
/* Internal SPI flash on NPCX796FC is 512 kB */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024)
@@ -40,7 +40,7 @@
#undef CONFIG_HIBERNATE
#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
-#undef CONFIG_LID_SWITCH
+#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
#define CONFIG_PWM
#define CONFIG_VBOOT_EFS2
@@ -50,7 +50,7 @@
#define CONFIG_SHA256
/* Sensor */
-#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
+#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
#define CONFIG_MOTION_SENSE_RESUME_DELAY_US (1000 * MSEC)
#define CONFIG_CMD_ACCEL_INFO
/* Enable sensor fifo, must also define the _SIZE and _THRES */
@@ -139,14 +139,14 @@
/* I2C Bus Configuration */
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_INA NPCX_I2C_PORT0_0
-#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
-#define I2C_PORT_SCALER NPCX_I2C_PORT2_0
-#define I2C_PORT_SENSORS NPCX_I2C_PORT3_0
-#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_INA NPCX_I2C_PORT0_0
+#define I2C_PORT_PPC0 NPCX_I2C_PORT1_0
+#define I2C_PORT_SCALER NPCX_I2C_PORT2_0
+#define I2C_PORT_SENSORS NPCX_I2C_PORT3_0
+#define I2C_PORT_TCPC0 NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
@@ -164,12 +164,12 @@ enum board_version {
};
enum adc_channel {
- ADC_SNS_PP3300, /* ADC2 */
- ADC_SNS_PP1050, /* ADC7 */
- ADC_VBUS, /* ADC4 */
- ADC_PPVAR_IMON, /* ADC9 */
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SNS_PP3300, /* ADC2 */
+ ADC_SNS_PP1050, /* ADC7 */
+ ADC_VBUS, /* ADC4 */
+ ADC_PPVAR_IMON, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
/* Number of ADC channels */
ADC_CH_COUNT
};
@@ -194,11 +194,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_CORE,
- TEMP_SENSOR_WIFI,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_CORE, TEMP_SENSOR_WIFI, TEMP_SENSOR_COUNT };
enum sensor_id {
CLEAR_ALS,
@@ -218,20 +214,20 @@ void show_critical_error(void);
/*
* Barrel-jack power (4 bits).
*/
-#define EC_CFG_BJ_POWER_L 0
-#define EC_CFG_BJ_POWER_H 3
+#define EC_CFG_BJ_POWER_L 0
+#define EC_CFG_BJ_POWER_H 3
#define EC_CFG_BJ_POWER_MASK GENMASK(EC_CFG_BJ_POWER_H, EC_CFG_BJ_POWER_L)
/*
* USB Connector 4 not present (1 bit).
*/
-#define EC_CFG_NO_USB4_L 4
-#define EC_CFG_NO_USB4_H 4
+#define EC_CFG_NO_USB4_L 4
+#define EC_CFG_NO_USB4_H 4
#define EC_CFG_NO_USB4_MASK GENMASK(EC_CFG_NO_USB4_H, EC_CFG_NO_USB4_L)
/*
* Thermal solution config (3 bits).
*/
-#define EC_CFG_THERMAL_L 5
-#define EC_CFG_THERMAL_H 7
+#define EC_CFG_THERMAL_L 5
+#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
int ec_config_get_usb4_present(void);
@@ -240,30 +236,30 @@ unsigned int ec_config_get_thermal_solution(void);
#endif /* !__ASSEMBLER__ */
/* Pin renaming */
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
-#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
-#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PP5000_A_PG_OD GPIO_PG_PP5000_A_OD
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_ROA_RAILS
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
/*
* There is no RSMRST input, so alias it to the output. This short-circuits
* common_intel_x86_handle_rsmrst.
*/
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PCH_RSMRST_L
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/scout/build.mk b/board/scout/build.mk
index cf964a2d15..7b9d891a0c 100644
--- a/board/scout/build.mk
+++ b/board/scout/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/scout/ec.tasklist b/board/scout/ec.tasklist
index 0e4ec4d284..0c3296d173 100644
--- a/board/scout/ec.tasklist
+++ b/board/scout/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/scout/gpio.inc b/board/scout/gpio.inc
index 914dbe8639..8a6b5bb074 100644
--- a/board/scout/gpio.inc
+++ b/board/scout/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,12 +25,12 @@ GPIO_INT(PG_VPRIM_CORE_A_OD, PIN(2, 3), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1050_A_OD, PIN(2, 2), GPIO_INT_BOTH, power_signal_interrupt)
/* EC output, but also interrupt so this can be polled as a power signal */
GPIO_INT(EC_PCH_RSMRST_L, PIN(A, 6), GPIO_OUTPUT | GPIO_INT_F_RISING | GPIO_INT_F_FALLING, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_PP2500_DRAM_U_OD, PIN(2, 0), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PG_PP1200_U_OD, PIN(2, 1), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, slp_s3_interrupt)
#endif
GPIO_INT(PG_PP950_VCCIO_OD, PIN(1, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/scout/led.c b/board/scout/led.c
index 3066c182d1..ad244ab99e 100644
--- a/board/scout/led.c
+++ b/board/scout/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_GPIO, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_GPIO, format, ##args)
/*
* Due to the CSME-Lite processing, upon startup the CPU transitions through
* S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
* delay turning off the LED during suspend/shutdown.
*/
-#define LED_CPU_DELAY_MS (2000 * MSEC)
+#define LED_CPU_DELAY_MS (2000 * MSEC)
-const enum ec_led_id supported_led_ids[] = {EC_LED_ID_POWER_LED};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
@@ -89,9 +89,9 @@ static int set_color(enum ec_led_id id, enum led_color color, int duty)
}
}
-#define LED_PULSE_US (2 * SECOND)
+#define LED_PULSE_US (2 * SECOND)
/* 40 msec for nice and smooth transition. */
-#define LED_PULSE_TICK_US (40 * MSEC)
+#define LED_PULSE_TICK_US (40 * MSEC)
/* When pulsing is enabled, brightness is incremented by <duty_inc> every
* <interval> usec from 0 to 100% in LED_PULSE_US usec. Then it's decremented
@@ -233,7 +233,7 @@ void show_critical_error(void)
set_color(EC_LED_ID_POWER_LED, LED_RED, 100);
}
-static int command_led(int argc, char **argv)
+static int command_led(int argc, const char **argv)
{
enum ec_led_id id = EC_LED_ID_POWER_LED;
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index f82376a15a..b51c522277 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,21 +45,20 @@ void board_config_pre_init(void)
* i2c : no dma
* tim16/17: no dma
*/
- STM32_SYSCFG_CFGR1 |= BIT(26); /* Remap USART3 RX/TX DMA */
+ STM32_SYSCFG_CFGR1 |= BIT(26); /* Remap USART3 RX/TX DMA */
/* Remap SPI2 to DMA channels 6 and 7 */
/* STM32F072 SPI2 defaults to using DMA channels 4 and 5 */
/* but cros_ec hardcodes a 6/7 assumption in registers.h */
STM32_SYSCFG_CFGR1 |= BIT(24);
-
}
/******************************************************************************
* Forward UARTs as a USB serial interface.
*/
-#define USB_STREAM_RX_SIZE 32
-#define USB_STREAM_TX_SIZE 64
+#define USB_STREAM_RX_SIZE 32
+#define USB_STREAM_TX_SIZE 64
/******************************************************************************
* Forward USART2 (EC) as a simple USB serial interface.
@@ -68,33 +67,22 @@ void board_config_pre_init(void)
static struct usart_config const usart2;
struct usb_stream_config const usart2_usb;
-static struct queue const usart2_to_usb = QUEUE_DIRECT(1024, uint8_t,
- usart2.producer, usart2_usb.consumer);
-static struct queue const usb_to_usart2 = QUEUE_DIRECT(64, uint8_t,
- usart2_usb.producer, usart2.consumer);
+static struct queue const usart2_to_usb =
+ QUEUE_DIRECT(1024, uint8_t, usart2.producer, usart2_usb.consumer);
+static struct queue const usb_to_usart2 =
+ QUEUE_DIRECT(64, uint8_t, usart2_usb.producer, usart2.consumer);
static struct usart_rx_dma const usart2_rx_dma =
USART_RX_DMA(STM32_DMAC_CH5, 32);
static struct usart_config const usart2 =
- USART_CONFIG(usart2_hw,
- usart2_rx_dma.usart_rx,
- usart_tx_interrupt,
- 115200,
- 0,
- usart2_to_usb,
- usb_to_usart2);
-
-USB_STREAM_CONFIG_USART_IFACE(usart2_usb,
- USB_IFACE_USART2_STREAM,
- USB_STR_USART2_STREAM_NAME,
- USB_EP_USART2_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart2,
- usart2_to_usb,
- usart2)
+ USART_CONFIG(usart2_hw, usart2_rx_dma.usart_rx, usart_tx_interrupt,
+ 115200, 0, usart2_to_usb, usb_to_usart2);
+USB_STREAM_CONFIG_USART_IFACE(usart2_usb, USB_IFACE_USART2_STREAM,
+ USB_STR_USART2_STREAM_NAME, USB_EP_USART2_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart2, usart2_to_usb, usart2)
/******************************************************************************
* Forward USART3 (CPU) as a simple USB serial interface.
@@ -103,33 +91,22 @@ USB_STREAM_CONFIG_USART_IFACE(usart2_usb,
static struct usart_config const usart3;
struct usb_stream_config const usart3_usb;
-static struct queue const usart3_to_usb = QUEUE_DIRECT(1024, uint8_t,
- usart3.producer, usart3_usb.consumer);
-static struct queue const usb_to_usart3 = QUEUE_DIRECT(64, uint8_t,
- usart3_usb.producer, usart3.consumer);
+static struct queue const usart3_to_usb =
+ QUEUE_DIRECT(1024, uint8_t, usart3.producer, usart3_usb.consumer);
+static struct queue const usb_to_usart3 =
+ QUEUE_DIRECT(64, uint8_t, usart3_usb.producer, usart3.consumer);
static struct usart_rx_dma const usart3_rx_dma =
USART_RX_DMA(STM32_DMAC_CH3, 32);
static struct usart_config const usart3 =
- USART_CONFIG(usart3_hw,
- usart3_rx_dma.usart_rx,
- usart_tx_interrupt,
- 115200,
- 0,
- usart3_to_usb,
- usb_to_usart3);
-
-USB_STREAM_CONFIG_USART_IFACE(usart3_usb,
- USB_IFACE_USART3_STREAM,
- USB_STR_USART3_STREAM_NAME,
- USB_EP_USART3_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart3,
- usart3_to_usb,
- usart3)
+ USART_CONFIG(usart3_hw, usart3_rx_dma.usart_rx, usart_tx_interrupt,
+ 115200, 0, usart3_to_usb, usb_to_usart3);
+USB_STREAM_CONFIG_USART_IFACE(usart3_usb, USB_IFACE_USART3_STREAM,
+ USB_STR_USART3_STREAM_NAME, USB_EP_USART3_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart3, usart3_to_usb, usart3)
/******************************************************************************
* Forward USART4 (cr50) as a simple USB serial interface.
@@ -139,34 +116,24 @@ USB_STREAM_CONFIG_USART_IFACE(usart3_usb,
static struct usart_config const usart4;
struct usb_stream_config const usart4_usb;
-static struct queue const usart4_to_usb = QUEUE_DIRECT(64, uint8_t,
- usart4.producer, usart4_usb.consumer);
-static struct queue const usb_to_usart4 = QUEUE_DIRECT(64, uint8_t,
- usart4_usb.producer, usart4.consumer);
+static struct queue const usart4_to_usb =
+ QUEUE_DIRECT(1024, uint8_t, usart4.producer, usart4_usb.consumer);
+static struct queue const usb_to_usart4 =
+ QUEUE_DIRECT(64, uint8_t, usart4_usb.producer, usart4.consumer);
static struct usart_config const usart4 =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 115200,
- 0,
- usart4_to_usb,
- usb_to_usart4);
-
-USB_STREAM_CONFIG_USART_IFACE(usart4_usb,
- USB_IFACE_USART4_STREAM,
- USB_STR_USART4_STREAM_NAME,
- USB_EP_USART4_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart4,
- usart4_to_usb,
- usart4)
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart4_to_usb, usb_to_usart4);
+
+USB_STREAM_CONFIG_USART_IFACE(usart4_usb, USB_IFACE_USART4_STREAM,
+ USB_STR_USART4_STREAM_NAME, USB_EP_USART4_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart4, usart4_to_usb, usart4)
/******************************************************************************
* Check parity setting on usarts.
*/
-static int command_uart_parity(int argc, char **argv)
+static int command_uart_parity(int argc, const char **argv)
{
int parity = 0, newparity;
struct usart_config const *usart;
@@ -200,14 +167,13 @@ static int command_uart_parity(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(parity, command_uart_parity,
- "usart[2|3|4] [0|1|2]",
+DECLARE_CONSOLE_COMMAND(parity, command_uart_parity, "usart[2|3|4] [0|1|2]",
"Set parity on uart");
/******************************************************************************
* Set baud rate setting on usarts.
*/
-static int command_uart_baud(int argc, char **argv)
+static int command_uart_baud(int argc, const char **argv)
{
int baud = 0;
struct usart_config const *usart;
@@ -233,14 +199,13 @@ static int command_uart_baud(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(baud, command_uart_baud,
- "usart[2|3|4] rate",
+DECLARE_CONSOLE_COMMAND(baud, command_uart_baud, "usart[2|3|4] rate",
"Set baud rate on uart");
/******************************************************************************
* Hold the usart pins low while disabling it, or return it to normal.
*/
-static int command_hold_usart_low(int argc, char **argv)
+static int command_hold_usart_low(int argc, const char **argv)
{
/* Each bit represents if that port rx is being held low */
static int usart_status;
@@ -297,7 +262,7 @@ static int command_hold_usart_low(int argc, char **argv)
/* Print status for get and set case. */
ccprintf("USART status: %s\n",
- usart_status & usart_mask ? "held low" : "normal");
+ usart_status & usart_mask ? "held low" : "normal");
return EC_SUCCESS;
}
@@ -309,18 +274,18 @@ DECLARE_CONSOLE_COMMAND(hold_usart_low, command_hold_usart_low,
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Servo Micro"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
- [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("UART3"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Servo Micro"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_SPI_NAME] = USB_STRING_DESC("SPI"),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("UART3"),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo Shell"),
- [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("CPU"),
- [USB_STR_USART2_STREAM_NAME] = USB_STRING_DESC("EC"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("CPU"),
+ [USB_STR_USART2_STREAM_NAME] = USB_STRING_DESC("EC"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -332,7 +297,7 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
/* SPI devices */
const struct spi_device_t spi_devices[] = {
- { CONFIG_SPI_FLASH_PORT, 1, GPIO_SPI_CS},
+ { CONFIG_SPI_FLASH_PORT, 1, GPIO_SPI_CS },
};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
@@ -373,17 +338,18 @@ USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI, 0);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-int usb_i2c_board_is_enabled(void) { return 1; }
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
/* Configure ITE flash support module */
const struct ite_dfu_config_t ite_dfu_config = {
diff --git a/board/servo_micro/board.h b/board/servo_micro/board.h
index 1983ee13e3..801b67e07e 100644
--- a/board/servo_micro/board.h
+++ b/board/servo_micro/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,9 +33,10 @@
#define CONFIG_STM_HWTIMER32
#define CONFIG_HW_CRC
#define CONFIG_PVD
-/* See 'Programmable voltage detector characteristics' in the STM32F072x8 Datasheet.
- PVD Threshold 1 corresponds to a falling voltage threshold of min:2.09V, max:2.27V. */
-#define PVD_THRESHOLD (1)
+/* See 'Programmable voltage detector characteristics' in the STM32F072x8
+ Datasheet. PVD Threshold 1 corresponds to a falling voltage threshold of
+ min:2.09V, max:2.27V. */
+#define PVD_THRESHOLD (1)
/* USB Configuration */
#define CONFIG_USB
@@ -50,25 +51,25 @@
#define DEFAULT_SERIALNO "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_USART4_STREAM 0
-#define USB_IFACE_UPDATE 1
-#define USB_IFACE_SPI 2
-#define USB_IFACE_CONSOLE 3
-#define USB_IFACE_I2C 4
-#define USB_IFACE_USART3_STREAM 5
-#define USB_IFACE_USART2_STREAM 6
-#define USB_IFACE_COUNT 7
+#define USB_IFACE_USART4_STREAM 0
+#define USB_IFACE_UPDATE 1
+#define USB_IFACE_SPI 2
+#define USB_IFACE_CONSOLE 3
+#define USB_IFACE_I2C 4
+#define USB_IFACE_USART3_STREAM 5
+#define USB_IFACE_USART2_STREAM 6
+#define USB_IFACE_COUNT 7
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_USART4_STREAM 1
-#define USB_EP_UPDATE 2
-#define USB_EP_SPI 3
-#define USB_EP_CONSOLE 4
-#define USB_EP_I2C 5
-#define USB_EP_USART3_STREAM 6
-#define USB_EP_USART2_STREAM 7
-#define USB_EP_COUNT 8
+#define USB_EP_CONTROL 0
+#define USB_EP_USART4_STREAM 1
+#define USB_EP_UPDATE 2
+#define USB_EP_SPI 3
+#define USB_EP_CONSOLE 4
+#define USB_EP_I2C 5
+#define USB_EP_USART3_STREAM 6
+#define USB_EP_USART2_STREAM 7
+#define USB_EP_COUNT 8
/* Enable console recasting of GPIO type. */
#define CONFIG_CMD_GPIO_EXTENDED
@@ -76,7 +77,7 @@
/* Enable control of SPI over USB */
#define CONFIG_USB_SPI
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FLASH_PORT 0 /* First SPI controller port */
+#define CONFIG_SPI_FLASH_PORT 0 /* First SPI controller port */
/* This is not actually an EC so disable some features. */
#undef CONFIG_WATCHDOG_HELP
@@ -93,8 +94,8 @@
#define CONFIG_I2C_XFER_LARGE_TRANSFER
#undef CONFIG_USB_I2C_MAX_WRITE_COUNT
#undef CONFIG_USB_I2C_MAX_READ_COUNT
-#define CONFIG_USB_I2C_MAX_WRITE_COUNT ((1<<9) - 4)
-#define CONFIG_USB_I2C_MAX_READ_COUNT ((1<<9) - 6)
+#define CONFIG_USB_I2C_MAX_WRITE_COUNT ((1 << 9) - 4)
+#define CONFIG_USB_I2C_MAX_READ_COUNT ((1 << 9) - 6)
/*
* Allow dangerous commands all the time, since we don't have a write protect
diff --git a/board/servo_micro/build.mk b/board/servo_micro/build.mk
index 0e069a31ad..7ac70706fc 100644
--- a/board/servo_micro/build.mk
+++ b/board/servo_micro/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/servo_micro/ccd.md b/board/servo_micro/ccd.md
index 267da66776..2398e1dd46 100644
--- a/board/servo_micro/ccd.md
+++ b/board/servo_micro/ccd.md
@@ -1,5 +1,5 @@
<!--
- Copyright 2018 The Chromium OS Authors. All rights reserved.
+ Copyright 2018 The ChromiumOS Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
diff --git a/board/servo_micro/ec.tasklist b/board/servo_micro/ec.tasklist
index c1fb169118..c45a1e89a7 100644
--- a/board/servo_micro/ec.tasklist
+++ b/board/servo_micro/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_micro/gpio.inc b/board/servo_micro/gpio.inc
index 10e411c5f2..ad1739f1e6 100644
--- a/board/servo_micro/gpio.inc
+++ b/board/servo_micro/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c
index b304408f74..5320d7fd1c 100644
--- a/board/servo_v4/board.c
+++ b/board/servo_v4/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -33,8 +33,8 @@
#include "usb-stream.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/******************************************************************************
* GPIO interrupt handlers.
@@ -175,23 +175,22 @@ void board_config_pre_init(void)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CHG_CC1_PD] = {"CHG_CC1_PD", 3300, 4096, 0, STM32_AIN(2)},
- [ADC_CHG_CC2_PD] = {"CHG_CC2_PD", 3300, 4096, 0, STM32_AIN(4)},
- [ADC_DUT_CC1_PD] = {"DUT_CC1_PD", 3300, 4096, 0, STM32_AIN(0)},
- [ADC_DUT_CC2_PD] = {"DUT_CC2_PD", 3300, 4096, 0, STM32_AIN(5)},
- [ADC_SBU1_DET] = {"SBU1_DET", 3300, 4096, 0, STM32_AIN(3)},
- [ADC_SBU2_DET] = {"SBU2_DET", 3300, 4096, 0, STM32_AIN(7)},
- [ADC_SUB_C_REF] = {"SUB_C_REF", 3300, 4096, 0, STM32_AIN(1)},
+ [ADC_CHG_CC1_PD] = { "CHG_CC1_PD", 3300, 4096, 0, STM32_AIN(2) },
+ [ADC_CHG_CC2_PD] = { "CHG_CC2_PD", 3300, 4096, 0, STM32_AIN(4) },
+ [ADC_DUT_CC1_PD] = { "DUT_CC1_PD", 3300, 4096, 0, STM32_AIN(0) },
+ [ADC_DUT_CC2_PD] = { "DUT_CC2_PD", 3300, 4096, 0, STM32_AIN(5) },
+ [ADC_SBU1_DET] = { "SBU1_DET", 3300, 4096, 0, STM32_AIN(3) },
+ [ADC_SBU2_DET] = { "SBU2_DET", 3300, 4096, 0, STM32_AIN(7) },
+ [ADC_SUB_C_REF] = { "SUB_C_REF", 3300, 4096, 0, STM32_AIN(1) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
/******************************************************************************
* Forward UARTs as a USB serial interface.
*/
-#define USB_STREAM_RX_SIZE 16
-#define USB_STREAM_TX_SIZE 16
+#define USB_STREAM_RX_SIZE 16
+#define USB_STREAM_TX_SIZE 16
/******************************************************************************
* Forward USART3 as a simple USB serial interface.
@@ -200,29 +199,19 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
static struct usart_config const usart3;
struct usb_stream_config const usart3_usb;
-static struct queue const usart3_to_usb = QUEUE_DIRECT(64, uint8_t,
- usart3.producer, usart3_usb.consumer);
-static struct queue const usb_to_usart3 = QUEUE_DIRECT(64, uint8_t,
- usart3_usb.producer, usart3.consumer);
+static struct queue const usart3_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart3.producer, usart3_usb.consumer);
+static struct queue const usb_to_usart3 =
+ QUEUE_DIRECT(64, uint8_t, usart3_usb.producer, usart3.consumer);
static struct usart_config const usart3 =
- USART_CONFIG(usart3_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 115200,
- 0,
- usart3_to_usb,
- usb_to_usart3);
-
-USB_STREAM_CONFIG(usart3_usb,
- USB_IFACE_USART3_STREAM,
- USB_STR_USART3_STREAM_NAME,
- USB_EP_USART3_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart3,
- usart3_to_usb)
+ USART_CONFIG(usart3_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart3_to_usb, usb_to_usart3);
+USB_STREAM_CONFIG(usart3_usb, USB_IFACE_USART3_STREAM,
+ USB_STR_USART3_STREAM_NAME, USB_EP_USART3_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart3,
+ usart3_to_usb)
/******************************************************************************
* Forward USART4 as a simple USB serial interface.
@@ -231,44 +220,34 @@ USB_STREAM_CONFIG(usart3_usb,
static struct usart_config const usart4;
struct usb_stream_config const usart4_usb;
-static struct queue const usart4_to_usb = QUEUE_DIRECT(64, uint8_t,
- usart4.producer, usart4_usb.consumer);
-static struct queue const usb_to_usart4 = QUEUE_DIRECT(64, uint8_t,
- usart4_usb.producer, usart4.consumer);
+static struct queue const usart4_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart4.producer, usart4_usb.consumer);
+static struct queue const usb_to_usart4 =
+ QUEUE_DIRECT(64, uint8_t, usart4_usb.producer, usart4.consumer);
static struct usart_config const usart4 =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 9600,
- 0,
- usart4_to_usb,
- usb_to_usart4);
-
-USB_STREAM_CONFIG(usart4_usb,
- USB_IFACE_USART4_STREAM,
- USB_STR_USART4_STREAM_NAME,
- USB_EP_USART4_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart4,
- usart4_to_usb)
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, usart_tx_interrupt, 9600, 0,
+ usart4_to_usb, usb_to_usart4);
+
+USB_STREAM_CONFIG(usart4_usb, USB_IFACE_USART4_STREAM,
+ USB_STR_USART4_STREAM_NAME, USB_EP_USART4_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart4,
+ usart4_to_usb)
/*
* Define usb interface descriptor for the `EMPTY` usb interface, to satisfy
* UEFI and kernel requirements (see b/183857501).
*/
-const struct usb_interface_descriptor
-USB_IFACE_DESC(USB_IFACE_EMPTY) = {
- .bLength = USB_DT_INTERFACE_SIZE,
- .bDescriptorType = USB_DT_INTERFACE,
- .bInterfaceNumber = USB_IFACE_EMPTY,
- .bAlternateSetting = 0,
- .bNumEndpoints = 0,
- .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
+const struct usb_interface_descriptor USB_IFACE_DESC(USB_IFACE_EMPTY) = {
+ .bLength = USB_DT_INTERFACE_SIZE,
+ .bDescriptorType = USB_DT_INTERFACE,
+ .bInterfaceNumber = USB_IFACE_EMPTY,
+ .bAlternateSetting = 0,
+ .bNumEndpoints = 0,
+ .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
- .iInterface = 0,
+ .iInterface = 0,
};
/******************************************************************************
@@ -276,39 +255,38 @@ USB_IFACE_DESC(USB_IFACE_EMPTY) = {
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Servo V4"),
- [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Servo V4"),
+ [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo EC Shell"),
- [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
- [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Atmega UART"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
+ [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Atmega UART"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
-
-
/******************************************************************************
* Support I2C bridging over USB.
*/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-int usb_i2c_board_is_enabled(void) { return 1; }
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
/******************************************************************************
* Initialize board.
@@ -317,14 +295,13 @@ int usb_i2c_board_is_enabled(void) { return 1; }
/*
* Support tca6416 I2C ioexpander.
*/
-#define GPIOX_I2C_ADDR_FLAGS 0x20
-#define GPIOX_IN_PORT_A 0x0
-#define GPIOX_IN_PORT_B 0x1
-#define GPIOX_OUT_PORT_A 0x2
-#define GPIOX_OUT_PORT_B 0x3
-#define GPIOX_DIR_PORT_A 0x6
-#define GPIOX_DIR_PORT_B 0x7
-
+#define GPIOX_I2C_ADDR_FLAGS 0x20
+#define GPIOX_IN_PORT_A 0x0
+#define GPIOX_IN_PORT_B 0x1
+#define GPIOX_OUT_PORT_A 0x2
+#define GPIOX_OUT_PORT_B 0x3
+#define GPIOX_DIR_PORT_A 0x6
+#define GPIOX_DIR_PORT_B 0x7
/* Write a GPIO output on the tca6416 I2C ioexpander. */
static void write_ioexpander(int bank, int gpio, int val)
@@ -394,15 +371,15 @@ static void init_ioexpander(void)
* Max observed USB low across sampled systems: 666mV
* Min observed USB high across sampled systems: 3026mV
*/
-#define GND_MAX_MV 700
-#define USB_HIGH_MV 2500
-#define SBU_DIRECT 0
-#define SBU_FLIP 1
+#define GND_MAX_MV 700
+#define USB_HIGH_MV 2500
+#define SBU_DIRECT 0
+#define SBU_FLIP 1
-#define MODE_SBU_DISCONNECT 0
-#define MODE_SBU_CONNECT 1
-#define MODE_SBU_FLIP 2
-#define MODE_SBU_OTHER 3
+#define MODE_SBU_DISCONNECT 0
+#define MODE_SBU_CONNECT 1
+#define MODE_SBU_FLIP 2
+#define MODE_SBU_OTHER 3
static void ccd_measure_sbu(void);
DECLARE_DEFERRED(ccd_measure_sbu);
@@ -445,12 +422,12 @@ static void ccd_measure_sbu(void)
} else {
count++;
}
- /*
- * If SuzyQ is enabled, we'll poll for a persistent no-signal for
- * 500ms. Since USB is differential, we should never see GND/GND
- * while the device is connected.
- * If disconnected, electrically remove SuzyQ.
- */
+ /*
+ * If SuzyQ is enabled, we'll poll for a persistent no-signal
+ * for 500ms. Since USB is differential, we should never see
+ * GND/GND while the device is connected. If disconnected,
+ * electrically remove SuzyQ.
+ */
} else if ((mux_en) && (sbu1 < GND_MAX_MV) && (sbu2 < GND_MAX_MV)) {
/* Check for SBU disconnect if connected. */
if (last != MODE_SBU_DISCONNECT) {
diff --git a/board/servo_v4/board.h b/board/servo_v4/board.h
index 910d6caacc..289c117989 100644
--- a/board/servo_v4/board.h
+++ b/board/servo_v4/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -38,9 +38,10 @@
#define CONFIG_STM_HWTIMER32
#define CONFIG_HW_CRC
#define CONFIG_PVD
-/* See 'Programmable voltage detector characteristics' in the STM32F072x8 Datasheet.
- PVD Threshold 1 corresponds to a falling voltage threshold of min:2.09V, max:2.27V. */
-#define PVD_THRESHOLD (1)
+/* See 'Programmable voltage detector characteristics' in the STM32F072x8
+ Datasheet. PVD Threshold 1 corresponds to a falling voltage threshold of
+ min:2.09V, max:2.27V. */
+#define PVD_THRESHOLD (1)
/* USB Configuration */
#define CONFIG_USB
@@ -60,23 +61,23 @@
#define DEFAULT_MAC_ADDR "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_EMPTY 1
-#define USB_IFACE_I2C 2
-#define USB_IFACE_USART3_STREAM 3
-#define USB_IFACE_USART4_STREAM 4
-#define USB_IFACE_UPDATE 5
-#define USB_IFACE_COUNT 6
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_EMPTY 1
+#define USB_IFACE_I2C 2
+#define USB_IFACE_USART3_STREAM 3
+#define USB_IFACE_USART4_STREAM 4
+#define USB_IFACE_UPDATE 5
+#define USB_IFACE_COUNT 6
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_EMPTY 2
-#define USB_EP_I2C 3
-#define USB_EP_USART3_STREAM 4
-#define USB_EP_USART4_STREAM 5
-#define USB_EP_UPDATE 6
-#define USB_EP_COUNT 7
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_EMPTY 2
+#define USB_EP_I2C 3
+#define USB_EP_USART3_STREAM 4
+#define USB_EP_USART4_STREAM 5
+#define USB_EP_UPDATE 6
+#define USB_EP_COUNT 7
/* Enable console recasting of GPIO type. */
#define CONFIG_CMD_GPIO_EXTENDED
@@ -113,7 +114,7 @@
/* PD features */
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#define CONFIG_BOARD_PRE_INIT
/*
* If task profiling is enabled then the rx falling edge detection interrupts
@@ -122,7 +123,7 @@
#undef CONFIG_TASK_PROFILING
#define CONFIG_CHARGE_MANAGER
-#undef CONFIG_CHARGE_MANAGER_SAFE_MODE
+#undef CONFIG_CHARGE_MANAGER_SAFE_MODE
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_TCPMV1
#define CONFIG_CMD_PD
@@ -144,22 +145,22 @@
#define CONFIG_USB_PD_INITIAL_DRP_STATE PD_DRP_FORCE_SINK
/* Variable-current Rp no connect and Ra attach macros */
-#define CC_NC(port, cc, sel) (pd_tcpc_cc_nc(port, cc, sel))
-#define CC_RA(port, cc, sel) (pd_tcpc_cc_ra(port, cc, sel))
+#define CC_NC(port, cc, sel) (pd_tcpc_cc_nc(port, cc, sel))
+#define CC_RA(port, cc, sel) (pd_tcpc_cc_ra(port, cc, sel))
/*
* TODO(crosbug.com/p/60792): The delay values are currently just place holders
* and the delay will need to be relative to the circuitry that allows VBUS to
* be supplied to the DUT port from the CHG port.
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/*
* Define PDO selection logic for SourceCap.
* On a 45W PD charger, it might provide PDOs with 15V/3A and 20V/2.25A.
@@ -180,8 +181,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
-
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -200,7 +200,6 @@ enum usb_strings {
USB_STR_COUNT
};
-
/* ADC signal */
enum adc_channel {
ADC_CHG_CC1_PD,
diff --git a/board/servo_v4/build.mk b/board/servo_v4/build.mk
index 6c39be0475..05a0684696 100644
--- a/board/servo_v4/build.mk
+++ b/board/servo_v4/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/servo_v4/ec.tasklist b/board/servo_v4/ec.tasklist
index 2111c6b761..f51780dce4 100644
--- a/board/servo_v4/ec.tasklist
+++ b/board/servo_v4/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4/gpio.inc b/board/servo_v4/gpio.inc
index 76b9a06d0f..afc5789636 100644
--- a/board/servo_v4/gpio.inc
+++ b/board/servo_v4/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4/usb_pd_config.h b/board/servo_v4/usb_pd_config.h
index af9d84922c..8437af3118 100644
--- a/board/servo_v4/usb_pd_config.h
+++ b/board/servo_v4/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,22 +56,22 @@
#define CONFIG_HW_CRC
/* Servo v4 CC configuration */
-#define CC_DETACH BIT(0) /* Emulate detach: both CC open */
-#define CC_DISABLE_DTS BIT(1) /* Apply resistors to single or both CC? */
-#define CC_ALLOW_SRC BIT(2) /* Allow charge through by policy? */
-#define CC_ENABLE_DRP BIT(3) /* Enable dual-role port */
-#define CC_SNK_WITH_PD BIT(4) /* Force enabling PD comm for sink role */
-#define CC_POLARITY BIT(5) /* CC polarity */
+#define CC_DETACH BIT(0) /* Emulate detach: both CC open */
+#define CC_DISABLE_DTS BIT(1) /* Apply resistors to single or both CC? */
+#define CC_ALLOW_SRC BIT(2) /* Allow charge through by policy? */
+#define CC_ENABLE_DRP BIT(3) /* Enable dual-role port */
+#define CC_SNK_WITH_PD BIT(4) /* Force enabling PD comm for sink role */
+#define CC_POLARITY BIT(5) /* CC polarity */
/* Servo v4 DP alt-mode configuration */
-#define ALT_DP_ENABLE BIT(0) /* Enable DP alt-mode or not */
-#define ALT_DP_PIN_C BIT(1) /* Pin assignment C supported */
-#define ALT_DP_PIN_D BIT(2) /* Pin assignment D supported */
-#define ALT_DP_PIN_E BIT(3) /* Pin assignment E supported */
-#define ALT_DP_MF_PREF BIT(4) /* Multi-Function preferred */
-#define ALT_DP_PLUG BIT(5) /* Plug or receptacle */
-#define ALT_DP_OVERRIDE_HPD BIT(6) /* Override the HPD signal */
-#define ALT_DP_HPD_LVL BIT(7) /* HPD level if overridden */
+#define ALT_DP_ENABLE BIT(0) /* Enable DP alt-mode or not */
+#define ALT_DP_PIN_C BIT(1) /* Pin assignment C supported */
+#define ALT_DP_PIN_D BIT(2) /* Pin assignment D supported */
+#define ALT_DP_PIN_E BIT(3) /* Pin assignment E supported */
+#define ALT_DP_MF_PREF BIT(4) /* Multi-Function preferred */
+#define ALT_DP_PLUG BIT(5) /* Plug or receptacle */
+#define ALT_DP_OVERRIDE_HPD BIT(6) /* Override the HPD signal */
+#define ALT_DP_HPD_LVL BIT(7) /* HPD level if overridden */
/* TX uses SPI1 on PB3-4 for CHG port, SPI2 on PB 13-14 for DUT port */
#define SPI_REGS(p) ((p) ? STM32_SPI2_REGS : STM32_SPI1_REGS)
@@ -94,14 +94,14 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) ((p) ? TIM_TX_CCR_DUT : TIM_TX_CCR_CHG)
#define TIM_RX_CCR_IDX(p) ((p) ? TIM_RX_CCR_DUT : TIM_RX_CCR_CHG)
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
/*
* EXTI line 21 is connected to the CMP1 output,
* EXTI line 22 is connected to the CMP2 output,
* CHG uses CMP2, and DUT uses CMP1.
*/
-#define EXTI_COMP_MASK(p) ((p) ? (1<<21) : BIT(22))
+#define EXTI_COMP_MASK(p) ((p) ? (1 << 21) : BIT(22))
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -193,13 +193,25 @@ static inline void pd_select_polarity(int port, int polarity)
if (port == 0) {
/* CHG use the right comparator inverted input for COMP2 */
STM32_COMP_CSR = (val & ~STM32_COMP_CMP2INSEL_MASK) |
- (polarity ? STM32_COMP_CMP2INSEL_INM4 /* PA4: C0_CC2 */
- : STM32_COMP_CMP2INSEL_INM6);/* PA2: C0_CC1 */
+ (polarity ?
+ STM32_COMP_CMP2INSEL_INM4 /* PA4:
+ C0_CC2
+ */
+ :
+ STM32_COMP_CMP2INSEL_INM6); /* PA2:
+ C0_CC1
+ */
} else {
/* DUT use the right comparator inverted input for COMP1 */
STM32_COMP_CSR = (val & ~STM32_COMP_CMP1INSEL_MASK) |
- (polarity ? STM32_COMP_CMP1INSEL_INM5 /* PA5: C1_CC2 */
- : STM32_COMP_CMP1INSEL_INM6);/* PA0: C1_CC1 */
+ (polarity ?
+ STM32_COMP_CMP1INSEL_INM5 /* PA5:
+ C1_CC2
+ */
+ :
+ STM32_COMP_CMP1INSEL_INM6); /* PA0:
+ C1_CC1
+ */
}
}
@@ -279,7 +291,6 @@ static inline void pd_config_init(int port, uint8_t power_role)
/* Initialize TX pins and put them in Hi-Z */
pd_tx_init();
-
}
int pd_adc_read(int port, int cc);
diff --git a/board/servo_v4/usb_pd_pdo.c b/board/servo_v4/usb_pd_pdo.c
index 8df0eac2c2..b2eeee8e52 100644
--- a/board/servo_v4/usb_pd_pdo.c
+++ b/board/servo_v4/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,9 +12,9 @@
#define CHG_PDO_FIXED_FLAGS (PDO_FIXED_DATA_SWAP)
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, CHG_PDO_FIXED_FLAGS),
- PDO_BATT(4750, 21000, 15000),
- PDO_VAR(4750, 21000, 3000),
+ PDO_FIXED(5000, 500, CHG_PDO_FIXED_FLAGS),
+ PDO_BATT(4750, 21000, 15000),
+ PDO_VAR(4750, 21000, 3000),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
@@ -48,7 +48,7 @@ int charge_manager_get_source_pdo(const uint32_t **src_pdo, const int port)
* port, otherwise we provide no power.
*/
if (charge_port_is_active()) {
- *src_pdo = pd_src_chg_pdo;
+ *src_pdo = pd_src_chg_pdo;
pdo_cnt = chg_pdo_cnt;
}
diff --git a/board/servo_v4/usb_pd_pdo.h b/board/servo_v4/usb_pd_pdo.h
index bb9d8adca6..acab299690 100644
--- a/board/servo_v4/usb_pd_pdo.h
+++ b/board/servo_v4/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4/usb_pd_policy.c b/board/servo_v4/usb_pd_policy.c
index 61931cda8b..1dbe586585 100644
--- a/board/servo_v4/usb_pd_policy.c
+++ b/board/servo_v4/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,55 +28,57 @@
#include "usb_pd_pdo.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
-#define DUT_PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\
- PDO_FIXED_COMM_CAP)
+#define DUT_PDO_FIXED_FLAGS \
+ (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP)
-#define VBUS_UNCHANGED(curr, pend, new) (curr == new && pend == new)
+#define VBUS_UNCHANGED(curr, pend, new) (curr == new &&pend == new)
/* Macros to config the PD role */
#define CONF_SET_CLEAR(c, set, clear) ((c | (set)) & ~(clear))
-#define CONF_SRC(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS | CC_ALLOW_SRC, \
- CC_ENABLE_DRP | CC_SNK_WITH_PD)
-#define CONF_SNK(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS, \
- CC_ALLOW_SRC | CC_ENABLE_DRP | CC_SNK_WITH_PD)
-#define CONF_PDSNK(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS | CC_SNK_WITH_PD, \
- CC_ALLOW_SRC | CC_ENABLE_DRP)
-#define CONF_DRP(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS | CC_ALLOW_SRC | CC_ENABLE_DRP, \
- CC_SNK_WITH_PD)
-#define CONF_SRCDTS(c) CONF_SET_CLEAR(c, \
- CC_ALLOW_SRC, \
- CC_ENABLE_DRP | CC_DISABLE_DTS | CC_SNK_WITH_PD)
-#define CONF_SNKDTS(c) CONF_SET_CLEAR(c, \
- 0, \
- CC_ALLOW_SRC | CC_ENABLE_DRP | \
- CC_DISABLE_DTS | CC_SNK_WITH_PD)
-#define CONF_PDSNKDTS(c) CONF_SET_CLEAR(c, \
- CC_SNK_WITH_PD, \
- CC_ALLOW_SRC | CC_ENABLE_DRP | CC_DISABLE_DTS)
-#define CONF_DRPDTS(c) CONF_SET_CLEAR(c, \
- CC_ALLOW_SRC | CC_ENABLE_DRP, \
- CC_DISABLE_DTS | CC_SNK_WITH_PD)
+#define CONF_SRC(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS | CC_ALLOW_SRC, \
+ CC_ENABLE_DRP | CC_SNK_WITH_PD)
+#define CONF_SNK(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP | CC_SNK_WITH_PD)
+#define CONF_PDSNK(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS | CC_SNK_WITH_PD, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP)
+#define CONF_DRP(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS | CC_ALLOW_SRC | CC_ENABLE_DRP, \
+ CC_SNK_WITH_PD)
+#define CONF_SRCDTS(c) \
+ CONF_SET_CLEAR(c, CC_ALLOW_SRC, \
+ CC_ENABLE_DRP | CC_DISABLE_DTS | CC_SNK_WITH_PD)
+#define CONF_SNKDTS(c) \
+ CONF_SET_CLEAR(c, 0, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP | CC_DISABLE_DTS | \
+ CC_SNK_WITH_PD)
+#define CONF_PDSNKDTS(c) \
+ CONF_SET_CLEAR(c, CC_SNK_WITH_PD, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP | CC_DISABLE_DTS)
+#define CONF_DRPDTS(c) \
+ CONF_SET_CLEAR(c, CC_ALLOW_SRC | CC_ENABLE_DRP, \
+ CC_DISABLE_DTS | CC_SNK_WITH_PD)
+#define CONF_DTSOFF(c) CONF_SET_CLEAR(c, CC_DISABLE_DTS, 0)
+#define CONF_DTSON(c) CONF_SET_CLEAR(c, 0, CC_DISABLE_DTS)
/* Macros to apply Rd/Rp to CC lines */
-#define DUT_ACTIVE_CC_SET(r, flags) \
- gpio_set_flags(cc_config & CC_POLARITY ? \
- CONCAT2(GPIO_USB_DUT_CC2_, r) : \
- CONCAT2(GPIO_USB_DUT_CC1_, r), \
+#define DUT_ACTIVE_CC_SET(r, flags) \
+ gpio_set_flags(cc_config &CC_POLARITY ? \
+ CONCAT2(GPIO_USB_DUT_CC2_, r) : \
+ CONCAT2(GPIO_USB_DUT_CC1_, r), \
flags)
-#define DUT_INACTIVE_CC_SET(r, flags) \
- gpio_set_flags(cc_config & CC_POLARITY ? \
- CONCAT2(GPIO_USB_DUT_CC1_, r) : \
- CONCAT2(GPIO_USB_DUT_CC2_, r), \
+#define DUT_INACTIVE_CC_SET(r, flags) \
+ gpio_set_flags(cc_config &CC_POLARITY ? \
+ CONCAT2(GPIO_USB_DUT_CC1_, r) : \
+ CONCAT2(GPIO_USB_DUT_CC2_, r), \
flags)
-#define DUT_BOTH_CC_SET(r, flags) \
- do { \
+#define DUT_BOTH_CC_SET(r, flags) \
+ do { \
gpio_set_flags(CONCAT2(GPIO_USB_DUT_CC1_, r), flags); \
gpio_set_flags(CONCAT2(GPIO_USB_DUT_CC2_, r), flags); \
} while (0)
@@ -94,15 +96,15 @@ static int cc_config = CC_ALLOW_SRC;
/* Voltage thresholds for no connect in DTS mode */
static int pd_src_vnc_dts[TYPEC_RP_RESERVED][2] = {
- {PD_SRC_3_0_VNC_MV, PD_SRC_1_5_VNC_MV},
- {PD_SRC_1_5_VNC_MV, PD_SRC_DEF_VNC_MV},
- {PD_SRC_3_0_VNC_MV, PD_SRC_DEF_VNC_MV},
+ { PD_SRC_3_0_VNC_MV, PD_SRC_1_5_VNC_MV },
+ { PD_SRC_1_5_VNC_MV, PD_SRC_DEF_VNC_MV },
+ { PD_SRC_3_0_VNC_MV, PD_SRC_DEF_VNC_MV },
};
/* Voltage thresholds for Ra attach in DTS mode */
static int pd_src_rd_threshold_dts[TYPEC_RP_RESERVED][2] = {
- {PD_SRC_3_0_RD_THRESH_MV, PD_SRC_1_5_RD_THRESH_MV},
- {PD_SRC_1_5_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV},
- {PD_SRC_3_0_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV},
+ { PD_SRC_3_0_RD_THRESH_MV, PD_SRC_1_5_RD_THRESH_MV },
+ { PD_SRC_1_5_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV },
+ { PD_SRC_3_0_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV },
};
/* Voltage thresholds for no connect in normal SRC mode */
static int pd_src_vnc[TYPEC_RP_RESERVED] = {
@@ -139,7 +141,8 @@ static uint8_t allow_dr_swap = 1;
static uint32_t max_supported_voltage(void)
{
int board_max_mv = board_get_version() >= BOARD_VERSION_BLACK ?
- PD_MAX_VOLTAGE_MV : MAX_MV_RED_BLUE;
+ PD_MAX_VOLTAGE_MV :
+ MAX_MV_RED_BLUE;
return board_max_mv < user_limited_max_mv ? board_max_mv :
user_limited_max_mv;
@@ -263,8 +266,8 @@ static void update_ports(void)
break;
/* Find the 'best' PDO <= voltage */
- pdo_index =
- pd_find_pdo_index(pd_get_src_cap_cnt(CHG),
+ pdo_index = pd_find_pdo_index(
+ pd_get_src_cap_cnt(CHG),
pd_get_src_caps(CHG),
pd_src_voltages_mv[i], &pdo);
/* Don't duplicate PDOs */
@@ -287,9 +290,9 @@ static void update_ports(void)
} else {
/* 5V PDO */
pd_src_chg_pdo[0] = PDO_FIXED_VOLT(PD_MIN_MV) |
- PDO_FIXED_CURR(vbus[CHG].ma) |
- DUT_PDO_FIXED_FLAGS |
- PDO_FIXED_UNCONSTRAINED;
+ PDO_FIXED_CURR(vbus[CHG].ma) |
+ DUT_PDO_FIXED_FLAGS |
+ PDO_FIXED_UNCONSTRAINED;
chg_pdo_cnt = 1;
}
@@ -314,8 +317,8 @@ int board_set_active_charge_port(int charge_port)
return 0;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
if (port != CHG)
return;
@@ -361,8 +364,9 @@ int pd_tcpc_cc_nc(int port, int cc_volt, int cc_sel)
if (cc_config & CC_DISABLE_DTS)
nc = cc_volt >= pd_src_vnc[rp_index];
else
- nc = cc_volt >= pd_src_vnc_dts[rp_index][
- cc_config & CC_POLARITY ? !cc_sel : cc_sel];
+ nc = cc_volt >=
+ pd_src_vnc_dts[rp_index]
+ [cc_config & CC_POLARITY ? !cc_sel : cc_sel];
return nc;
}
@@ -388,8 +392,10 @@ int pd_tcpc_cc_ra(int port, int cc_volt, int cc_sel)
if (cc_config & CC_DISABLE_DTS)
ra = cc_volt < pd_src_rd_threshold[rp_index];
else
- ra = cc_volt < pd_src_rd_threshold_dts[rp_index][
- cc_config & CC_POLARITY ? !cc_sel : cc_sel];
+ ra = cc_volt <
+ pd_src_rd_threshold_dts[rp_index]
+ [cc_config & CC_POLARITY ? !cc_sel :
+ cc_sel];
return ra;
}
@@ -548,7 +554,6 @@ int pd_set_rp_rd(int port, int cc_pull, int rp_value)
DUT_ACTIVE_CC_PD(RD);
else
DUT_BOTH_CC_PD(RD);
-
}
rp_value_stored = rp_value;
@@ -591,8 +596,7 @@ __override void pd_transition_voltage(int idx)
/* Wait for CHG transition */
deadline.val = get_time().val + PD_T_PS_TRANSITION;
CPRINTS("Waiting for CHG port transition");
- while (charge_port_is_active() &&
- vbus[CHG].mv != mv &&
+ while (charge_port_is_active() && vbus[CHG].mv != mv &&
get_time().val < deadline.val)
msleep(10);
@@ -652,9 +656,7 @@ void pd_power_supply_reset(int port)
int pd_snk_is_vbus_provided(int port)
{
-
- return gpio_get_level(port ? GPIO_USB_DET_PP_DUT :
- GPIO_USB_DET_PP_CHG);
+ return gpio_get_level(port ? GPIO_USB_DET_PP_DUT : GPIO_USB_DET_PP_CHG);
}
__override int pd_check_power_swap(int port)
@@ -671,7 +673,8 @@ __override int pd_check_power_swap(int port)
if (port == CHG)
return 0;
- if (pd_get_power_role(port) == PD_ROLE_SINK && !(cc_config & CC_ALLOW_SRC))
+ if (pd_get_power_role(port) == PD_ROLE_SINK &&
+ !(cc_config & CC_ALLOW_SRC))
return 0;
if (pd_snk_is_vbus_provided(CHG))
@@ -680,8 +683,7 @@ __override int pd_check_power_swap(int port)
return 0;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/*
* Servo should allow data role swaps to let DUT see the USB hub, but
@@ -693,8 +695,7 @@ __override int pd_check_data_swap(int port,
return allow_dr_swap;
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/*
* TODO(b/137887386): Turn on the fastboot/DFU path when data swap to
@@ -702,8 +703,7 @@ __override void pd_execute_data_swap(int port,
*/
}
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
/*
@@ -714,9 +714,7 @@ __override void pd_check_pr_role(int port,
*/
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
if (port == CHG)
return;
@@ -726,15 +724,14 @@ __override void pd_check_dr_role(int port,
pd_request_data_swap(port);
}
-
/* ----------------- Vendor Defined Messages ------------------ */
/*
* DP alt-mode config, user configurable.
* Default is the mode disabled, supporting the C and D pin assignment,
* multi-function preferred, and a plug.
*/
-static int alt_dp_config = (ALT_DP_PIN_C | ALT_DP_PIN_D | ALT_DP_MF_PREF |
- ALT_DP_PLUG);
+static int alt_dp_config =
+ (ALT_DP_PIN_C | ALT_DP_PIN_D | ALT_DP_MF_PREF | ALT_DP_PLUG);
/**
* Get the pins based on the user config.
@@ -769,8 +766,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
- CONFIG_USB_PD_IDENTITY_SW_VERS,
- 0, 0, 0, 0, /* SS[TR][12] */
+ CONFIG_USB_PD_IDENTITY_SW_VERS, 0, 0, 0,
+ 0, /* SS[TR][12] */
0, /* Vconn power */
0, /* Vconn power required */
0, /* Vbus power required */
@@ -808,13 +805,13 @@ uint32_t vdo_dp_mode[MODE_CNT];
static int svdm_response_modes(int port, uint32_t *payload)
{
- vdo_dp_mode[0] =
- VDO_MODE_DP(0, /* UFP pin cfg supported: none */
- alt_dp_config_pins(), /* DFP pin */
- 1, /* no usb2.0 signalling in AMode */
- alt_dp_config_cable(), /* plug or receptacle */
- MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
- MODE_DP_SNK); /* Its a sink only */
+ vdo_dp_mode[0] = VDO_MODE_DP(0, /* UFP pin cfg supported: none */
+ alt_dp_config_pins(), /* DFP pin */
+ 1, /* no usb2.0 signalling in AMode */
+ alt_dp_config_cable(), /* plug or
+ receptacle */
+ MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
+ MODE_DP_SNK); /* Its a sink only */
/* CCD uses the SBU lines; don't enable DP when dts-mode enabled */
if (!(cc_config & CC_DISABLE_DTS))
@@ -881,17 +878,18 @@ static int dp_status(int port, uint32_t *payload)
int hpd = get_hpd_level();
if (opos != OPOS)
- return 0; /* NAK */
-
- payload[1] = VDO_DP_STATUS(
- 0, /* IRQ_HPD */
- hpd, /* HPD_HI|LOW */
- 0, /* request exit DP */
- 0, /* request exit USB */
- (alt_dp_config & ALT_DP_MF_PREF) != 0, /* MF pref */
- is_typec_dp_muxed(),
- 0, /* power low */
- hpd ? 0x2 : 0);
+ return 0; /* NAK */
+
+ payload[1] =
+ VDO_DP_STATUS(0, /* IRQ_HPD */
+ hpd, /* HPD_HI|LOW */
+ 0, /* request exit DP */
+ 0, /* request exit USB */
+ (alt_dp_config & ALT_DP_MF_PREF) != 0, /* MF
+ pref
+ */
+ is_typec_dp_muxed(), 0, /* power low */
+ hpd ? 0x2 : 0);
return 2;
}
@@ -911,7 +909,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
/* SID & mode request is valid */
if ((PD_VDO_VID(payload[0]) != USB_SID_DISPLAYPORT) ||
(PD_VDO_OPOS(payload[0]) != OPOS))
- return 0; /* NAK */
+ return 0; /* NAK */
alt_mode = OPOS;
return 1;
@@ -950,7 +948,7 @@ const struct svdm_response svdm_rsp = {
};
__override int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+ uint32_t **rpayload)
{
int cmd = PD_VDO_CMD(payload[0]);
@@ -962,7 +960,7 @@ __override int pd_custom_vdm(int port, int cnt, uint32_t *payload,
case VDO_CMD_VERSION:
/* guarantee last byte of payload is null character */
*(payload + cnt - 1) = 0;
- CPRINTF("ver: %s\n", (char *)(payload+1));
+ CPRINTF("ver: %s\n", (char *)(payload + 1));
break;
case VDO_CMD_CURRENT:
CPRINTF("Current: %dmA\n", payload[1]);
@@ -984,12 +982,10 @@ static void print_cc_mode(void)
gpio_get_level(GPIO_DUT_CHG_EN) ? "on" : "off");
ccprintf("chg allowed: %s\n", cc_config & CC_ALLOW_SRC ? "on" : "off");
ccprintf("drp enabled: %s\n", cc_config & CC_ENABLE_DRP ? "on" : "off");
- ccprintf("cc polarity: %s\n", cc_config & CC_POLARITY ? "cc2" :
- "cc1");
+ ccprintf("cc polarity: %s\n", cc_config & CC_POLARITY ? "cc2" : "cc1");
ccprintf("pd enabled: %s\n", pd_comm_is_enabled(DUT) ? "on" : "off");
}
-
static void do_cc(int cc_config_new)
{
int chargeable;
@@ -1059,7 +1055,7 @@ static void do_cc(int cc_config_new)
}
}
-static int command_cc(int argc, char **argv)
+static int command_cc(int argc, const char **argv)
{
int cc_config_new = cc_config;
@@ -1090,6 +1086,10 @@ static int command_cc(int argc, char **argv)
cc_config_new = CONF_PDSNKDTS(cc_config_new);
else if (!strcasecmp(argv[1], "drpdts"))
cc_config_new = CONF_DRPDTS(cc_config_new);
+ else if (!strcasecmp(argv[1], "dtsoff"))
+ cc_config_new = CONF_DTSOFF(cc_config_new);
+ else if (!strcasecmp(argv[1], "dtson"))
+ cc_config_new = CONF_DTSON(cc_config_new);
else
return EC_ERROR_PARAM2;
}
@@ -1108,7 +1108,7 @@ static int command_cc(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(cc, command_cc,
"[off|on|src|snk|pdsnk|drp|srcdts|snkdts|pdsnkdts|"
- "drpdts] [cc1|cc2]",
+ "drpdts|dtsoff|dtson] [cc1|cc2]",
"Servo_v4 DTS and CHG mode");
static void fake_disconnect_end(void)
@@ -1128,7 +1128,7 @@ static void fake_disconnect_start(void)
}
DECLARE_DEFERRED(fake_disconnect_start);
-static int cmd_fake_disconnect(int argc, char *argv[])
+static int cmd_fake_disconnect(int argc, const char *argv[])
{
int delay_ms, duration_ms;
char *e;
@@ -1150,18 +1150,18 @@ static int cmd_fake_disconnect(int argc, char *argv[])
fake_pd_disconnect_duration_us = duration_ms * MSEC;
hook_call_deferred(&fake_disconnect_start_data, delay_ms * MSEC);
- ccprintf("Fake disconnect for %d ms starting in %d ms.\n",
- duration_ms, delay_ms);
+ ccprintf("Fake disconnect for %d ms starting in %d ms.\n", duration_ms,
+ delay_ms);
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(fakedisconnect, cmd_fake_disconnect,
"<delay_ms> <duration_ms>", NULL);
-static int cmd_ada_srccaps(int argc, char *argv[])
+static int cmd_ada_srccaps(int argc, const char *argv[])
{
int i;
- const uint32_t * const ada_srccaps = pd_get_src_caps(CHG);
+ const uint32_t *const ada_srccaps = pd_get_src_caps(CHG);
for (i = 0; i < pd_get_src_cap_cnt(CHG); ++i) {
uint32_t max_ma, max_mv, unused;
@@ -1176,11 +1176,10 @@ static int cmd_ada_srccaps(int argc, char *argv[])
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(ada_srccaps, cmd_ada_srccaps,
- "",
+DECLARE_CONSOLE_COMMAND(ada_srccaps, cmd_ada_srccaps, "",
"Print adapter SrcCap");
-static int cmd_dp_action(int argc, char *argv[])
+static int cmd_dp_action(int argc, const char *argv[])
{
int i;
char *e;
@@ -1199,8 +1198,8 @@ static int cmd_dp_action(int argc, char *argv[])
alt_dp_config &= ~ALT_DP_ENABLE;
} else if (!strcasecmp(argv[1], "pins")) {
if (argc >= 3) {
- alt_dp_config &= ~(ALT_DP_PIN_C | ALT_DP_PIN_D |
- ALT_DP_PIN_E);
+ alt_dp_config &=
+ ~(ALT_DP_PIN_C | ALT_DP_PIN_D | ALT_DP_PIN_E);
for (i = 0; i < 3; i++) {
if (!argv[2][i])
break;
@@ -1273,10 +1272,10 @@ static int cmd_dp_action(int argc, char *argv[])
}
}
CPRINTS("HPD source: %s",
- (alt_dp_config & ALT_DP_OVERRIDE_HPD) ? "overridden"
- : "external");
+ (alt_dp_config & ALT_DP_OVERRIDE_HPD) ? "overridden" :
+ "external");
CPRINTS("HPD level: %d", get_hpd_level());
- } else if (!strcasecmp(argv[1], "help")) {
+ } else if (!strcasecmp(argv[1], "help")) {
CPRINTS("Usage: usbc_action dp [enable|disable|hpd|mf|pins|"
"plug]");
}
@@ -1284,7 +1283,7 @@ static int cmd_dp_action(int argc, char *argv[])
return EC_SUCCESS;
}
-static int cmd_usbc_action(int argc, char *argv[])
+static int cmd_usbc_action(int argc, const char *argv[])
{
if (argc >= 2 && !strcasecmp(argv[1], "dp"))
return cmd_dp_action(argc - 1, &argv[1]);
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c
index 3284b4ef58..c3caa1eff1 100644
--- a/board/servo_v4p1/board.c
+++ b/board/servo_v4p1/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -85,14 +85,20 @@ static int board_tusb1064_dp_rx_eq_set(const struct usb_mux *me,
return rv;
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- [CHG] = { /* CHG port connected directly to USB 3.0 hub, no mux */ },
- [DUT] = { /* DUT port with UFP mux */
- .usb_port = DUT,
- .i2c_port = I2C_PORT_MASTER,
- .i2c_addr_flags = TUSB1064_I2C_ADDR10_FLAGS,
- .driver = &tusb1064_usb_mux_driver,
- .board_set = &board_tusb1064_dp_rx_eq_set,
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ [CHG] = {
+ /* CHG port connected directly to USB 3.0 hub, no mux */
+ },
+ [DUT] = {
+ /* DUT port with UFP mux */
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = DUT,
+ .i2c_port = I2C_PORT_MASTER,
+ .i2c_addr_flags = TUSB1064_I2C_ADDR10_FLAGS,
+ .driver = &tusb1064_usb_mux_driver,
+ .board_set = &board_tusb1064_dp_rx_eq_set,
+ },
}
};
@@ -182,9 +188,9 @@ static void tcpc_evt(enum gpio_signal signal)
update_status_fusb302b();
}
-#define HOST_HUB 0
+#define HOST_HUB 0
struct uhub_i2c_iface_t uhub_config[] = {
- {I2C_PORT_MASTER, GL3590_I2C_ADDR0},
+ { I2C_PORT_MASTER, GL3590_I2C_ADDR0 },
};
static void host_hub_evt(void)
@@ -231,8 +237,8 @@ void ext_hpd_detection_enable(int enable)
#include "gpio_list.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/******************************************************************************
* Board pre-init function.
@@ -276,23 +282,22 @@ void board_config_pre_init(void)
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CHG_CC1_PD] = {"CHG_CC1_PD", 3300, 4096, 0, STM32_AIN(2)},
- [ADC_CHG_CC2_PD] = {"CHG_CC2_PD", 3300, 4096, 0, STM32_AIN(4)},
- [ADC_DUT_CC1_PD] = {"DUT_CC1_PD", 3300, 4096, 0, STM32_AIN(0)},
- [ADC_DUT_CC2_PD] = {"DUT_CC2_PD", 3300, 4096, 0, STM32_AIN(5)},
- [ADC_SBU1_DET] = {"SBU1_DET", 3300, 4096, 0, STM32_AIN(3)},
- [ADC_SBU2_DET] = {"SBU2_DET", 3300, 4096, 0, STM32_AIN(7)},
- [ADC_SUB_C_REF] = {"SUB_C_REF", 3300, 4096, 0, STM32_AIN(1)},
+ [ADC_CHG_CC1_PD] = { "CHG_CC1_PD", 3300, 4096, 0, STM32_AIN(2) },
+ [ADC_CHG_CC2_PD] = { "CHG_CC2_PD", 3300, 4096, 0, STM32_AIN(4) },
+ [ADC_DUT_CC1_PD] = { "DUT_CC1_PD", 3300, 4096, 0, STM32_AIN(0) },
+ [ADC_DUT_CC2_PD] = { "DUT_CC2_PD", 3300, 4096, 0, STM32_AIN(5) },
+ [ADC_SBU1_DET] = { "SBU1_DET", 3300, 4096, 0, STM32_AIN(3) },
+ [ADC_SBU2_DET] = { "SBU2_DET", 3300, 4096, 0, STM32_AIN(7) },
+ [ADC_SUB_C_REF] = { "SUB_C_REF", 3300, 4096, 0, STM32_AIN(1) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
/******************************************************************************
* Forward UARTs as a USB serial interface.
*/
-#define USB_STREAM_RX_SIZE 16
-#define USB_STREAM_TX_SIZE 16
+#define USB_STREAM_RX_SIZE 16
+#define USB_STREAM_TX_SIZE 16
/******************************************************************************
* Forward USART3 as a simple USB serial interface.
@@ -301,29 +306,19 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
static struct usart_config const usart3;
struct usb_stream_config const usart3_usb;
-static struct queue const usart3_to_usb = QUEUE_DIRECT(64, uint8_t,
- usart3.producer, usart3_usb.consumer);
-static struct queue const usb_to_usart3 = QUEUE_DIRECT(64, uint8_t,
- usart3_usb.producer, usart3.consumer);
+static struct queue const usart3_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart3.producer, usart3_usb.consumer);
+static struct queue const usb_to_usart3 =
+ QUEUE_DIRECT(64, uint8_t, usart3_usb.producer, usart3.consumer);
static struct usart_config const usart3 =
- USART_CONFIG(usart3_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 115200,
- 0,
- usart3_to_usb,
- usb_to_usart3);
-
-USB_STREAM_CONFIG(usart3_usb,
- USB_IFACE_USART3_STREAM,
- USB_STR_USART3_STREAM_NAME,
- USB_EP_USART3_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart3,
- usart3_to_usb)
+ USART_CONFIG(usart3_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart3_to_usb, usb_to_usart3);
+USB_STREAM_CONFIG(usart3_usb, USB_IFACE_USART3_STREAM,
+ USB_STR_USART3_STREAM_NAME, USB_EP_USART3_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart3,
+ usart3_to_usb)
/******************************************************************************
* Forward USART4 as a simple USB serial interface.
@@ -332,46 +327,34 @@ USB_STREAM_CONFIG(usart3_usb,
static struct usart_config const usart4;
struct usb_stream_config const usart4_usb;
-static struct queue const usart4_to_usb = QUEUE_DIRECT(64, uint8_t,
- usart4.producer, usart4_usb.consumer);
-static struct queue const usb_to_usart4 = QUEUE_DIRECT(64, uint8_t,
- usart4_usb.producer, usart4.consumer);
+static struct queue const usart4_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart4.producer, usart4_usb.consumer);
+static struct queue const usb_to_usart4 =
+ QUEUE_DIRECT(64, uint8_t, usart4_usb.producer, usart4.consumer);
static struct usart_config const usart4 =
- USART_CONFIG(usart4_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 9600,
- 0,
- usart4_to_usb,
- usb_to_usart4);
-
-USB_STREAM_CONFIG_USART_IFACE(usart4_usb,
- USB_IFACE_USART4_STREAM,
- USB_STR_USART4_STREAM_NAME,
- USB_EP_USART4_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart4,
- usart4_to_usb,
- usart4)
+ USART_CONFIG(usart4_hw, usart_rx_interrupt, usart_tx_interrupt, 9600, 0,
+ usart4_to_usb, usb_to_usart4);
+USB_STREAM_CONFIG_USART_IFACE(usart4_usb, USB_IFACE_USART4_STREAM,
+ USB_STR_USART4_STREAM_NAME, USB_EP_USART4_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE,
+ usb_to_usart4, usart4_to_usb, usart4)
/*
* Define usb interface descriptor for the `EMPTY` usb interface, to satisfy
* UEFI and kernel requirements (see b/183857501).
*/
-const struct usb_interface_descriptor
-USB_IFACE_DESC(USB_IFACE_EMPTY) = {
- .bLength = USB_DT_INTERFACE_SIZE,
- .bDescriptorType = USB_DT_INTERFACE,
- .bInterfaceNumber = USB_IFACE_EMPTY,
- .bAlternateSetting = 0,
- .bNumEndpoints = 0,
- .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
+const struct usb_interface_descriptor USB_IFACE_DESC(USB_IFACE_EMPTY) = {
+ .bLength = USB_DT_INTERFACE_SIZE,
+ .bDescriptorType = USB_DT_INTERFACE,
+ .bInterfaceNumber = USB_IFACE_EMPTY,
+ .bAlternateSetting = 0,
+ .bNumEndpoints = 0,
+ .bInterfaceClass = USB_CLASS_VENDOR_SPEC,
.bInterfaceSubClass = 0,
.bInterfaceProtocol = 0,
- .iInterface = 0,
+ .iInterface = 0,
};
/******************************************************************************
@@ -379,40 +362,38 @@ USB_IFACE_DESC(USB_IFACE_EMPTY) = {
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Servo V4p1"),
- [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Servo V4p1"),
+ [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Servo EC Shell"),
- [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
- [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Atmega UART"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_USART3_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
+ [USB_STR_USART4_STREAM_NAME] = USB_STRING_DESC("Atmega UART"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
-
-
/******************************************************************************
* Support I2C bridging over USB.
*/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-int usb_i2c_board_is_enabled(void) { return 1; }
-
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
/******************************************************************************
* Initialize board.
@@ -547,18 +528,14 @@ void tick_event(void)
DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
struct ioexpander_config_t ioex_config[] = {
- [0] = {
- .drv = &tca64xxa_ioexpander_drv,
+ [0] = { .drv = &tca64xxa_ioexpander_drv,
.i2c_host_port = TCA6416A_PORT,
.i2c_addr_flags = TCA6416A_ADDR,
- .flags = IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6416A
- },
- [1] = {
- .drv = &tca64xxa_ioexpander_drv,
+ .flags = IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6416A },
+ [1] = { .drv = &tca64xxa_ioexpander_drv,
.i2c_host_port = TCA6424A_PORT,
.i2c_addr_flags = TCA6424A_ADDR,
- .flags = IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6424A
- }
+ .flags = IOEX_FLAGS_TCA64XXA_FLAG_VER_TCA6424A }
};
#endif /* SECTION_IS_RO */
diff --git a/board/servo_v4p1/board.h b/board/servo_v4p1/board.h
index 86367a5d0b..b6c7915c6c 100644
--- a/board/servo_v4p1/board.h
+++ b/board/servo_v4p1/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -58,31 +58,30 @@
#define CONFIG_RAM_BANK_SIZE CONFIG_RAM_SIZE
-
#define CONFIG_FLASH_PSTATE
#define CONFIG_FLASH_PSTATE_BANK
-#define CONFIG_SHAREDLIB_SIZE 0
+#define CONFIG_SHAREDLIB_SIZE 0
-#define CONFIG_RO_MEM_OFF 0
-#define CONFIG_RO_STORAGE_OFF 0
-#define CONFIG_RO_SIZE (92*1024)
+#define CONFIG_RO_MEM_OFF 0
+#define CONFIG_RO_STORAGE_OFF 0
+#define CONFIG_RO_SIZE (92 * 1024)
-#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
-#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
+#define CONFIG_FW_PSTATE_OFF (CONFIG_RO_MEM_OFF + CONFIG_RO_SIZE)
+#define CONFIG_FW_PSTATE_SIZE CONFIG_FLASH_BANK_SIZE
-#define CONFIG_RW_MEM_OFF (CONFIG_FW_PSTATE_OFF + CONFIG_FW_PSTATE_SIZE)
-#define CONFIG_RW_STORAGE_OFF 0
-#define CONFIG_RW_SIZE (CONFIG_FLASH_SIZE_BYTES - \
- (CONFIG_RW_MEM_OFF - CONFIG_RO_MEM_OFF))
+#define CONFIG_RW_MEM_OFF (CONFIG_FW_PSTATE_OFF + CONFIG_FW_PSTATE_SIZE)
+#define CONFIG_RW_STORAGE_OFF 0
+#define CONFIG_RW_SIZE \
+ (CONFIG_FLASH_SIZE_BYTES - (CONFIG_RW_MEM_OFF - CONFIG_RO_MEM_OFF))
-#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
-#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
-#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
-#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
+#define CONFIG_EC_PROTECTED_STORAGE_OFF CONFIG_RO_MEM_OFF
+#define CONFIG_EC_PROTECTED_STORAGE_SIZE CONFIG_RO_SIZE
+#define CONFIG_EC_WRITABLE_STORAGE_OFF CONFIG_RW_MEM_OFF
+#define CONFIG_EC_WRITABLE_STORAGE_SIZE CONFIG_RW_SIZE
-#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
-#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
+#define CONFIG_WP_STORAGE_OFF CONFIG_EC_PROTECTED_STORAGE_OFF
+#define CONFIG_WP_STORAGE_SIZE CONFIG_EC_PROTECTED_STORAGE_SIZE
/* Enable USART1,3,4 and USB streams */
#define CONFIG_STREAM_USART
@@ -106,7 +105,7 @@
* STM32F072x8 Datasheet. PVD Threshold 1 corresponds to a
* falling voltage threshold of min:2.09V, max:2.27V.
*/
-#define PVD_THRESHOLD (1)
+#define PVD_THRESHOLD (1)
/* USB Configuration */
#define CONFIG_USB
@@ -125,23 +124,23 @@
#define DEFAULT_MAC_ADDR "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_EMPTY 1
-#define USB_IFACE_I2C 2
-#define USB_IFACE_USART3_STREAM 3
-#define USB_IFACE_USART4_STREAM 4
-#define USB_IFACE_UPDATE 5
-#define USB_IFACE_COUNT 6
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_EMPTY 1
+#define USB_IFACE_I2C 2
+#define USB_IFACE_USART3_STREAM 3
+#define USB_IFACE_USART4_STREAM 4
+#define USB_IFACE_UPDATE 5
+#define USB_IFACE_COUNT 6
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_EMPTY 2
-#define USB_EP_I2C 3
-#define USB_EP_USART3_STREAM 4
-#define USB_EP_USART4_STREAM 5
-#define USB_EP_UPDATE 6
-#define USB_EP_COUNT 7
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_EMPTY 2
+#define USB_EP_I2C 3
+#define USB_EP_USART3_STREAM 4
+#define USB_EP_USART4_STREAM 5
+#define USB_EP_UPDATE 6
+#define USB_EP_COUNT 7
/* Enable console recasting of GPIO type. */
#define CONFIG_CMD_GPIO_EXTENDED
@@ -182,7 +181,7 @@
/* PD features */
#define CONFIG_ADC
-#undef CONFIG_ADC_WATCHDOG
+#undef CONFIG_ADC_WATCHDOG
#define CONFIG_BOARD_PRE_INIT
/*
* If task profiling is enabled then the rx falling edge detection interrupts
@@ -196,7 +195,7 @@
#define CONFIG_USB_HUB_GL3590
#define CONFIG_INA231
#define CONFIG_CHARGE_MANAGER
-#undef CONFIG_CHARGE_MANAGER_SAFE_MODE
+#undef CONFIG_CHARGE_MANAGER_SAFE_MODE
#define CONFIG_USB_MUX_TUSB1064
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_TCPMV1
@@ -221,8 +220,8 @@
#define CONFIG_USB_PD_INITIAL_DRP_STATE PD_DRP_FORCE_SINK
/* Variable-current Rp no connect and Ra attach macros */
-#define CC_NC(port, cc, sel) (pd_tcpc_cc_nc(port, cc, sel))
-#define CC_RA(port, cc, sel) (pd_tcpc_cc_ra(port, cc, sel))
+#define CC_NC(port, cc, sel) (pd_tcpc_cc_nc(port, cc, sel))
+#define CC_RA(port, cc, sel) (pd_tcpc_cc_ra(port, cc, sel))
/*
* These power-supply timing values are now set towards maximum spec limit,
@@ -231,14 +230,14 @@
* Currently tuned with the Apple 96W adapter.
* TODO: Change to EVENT-based PS_RDY notification (b/214216304)
*/
-#define PD_POWER_SUPPLY_TURN_ON_DELAY (121*MSEC)
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY (461*MSEC)
+#define PD_POWER_SUPPLY_TURN_ON_DELAY (121 * MSEC)
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY (461 * MSEC)
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 100000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 100000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Add the raw option to the i2c_xfer command */
#define CONFIG_CMD_I2C_XFER_RAW
@@ -266,8 +265,7 @@
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
-
+#define TIM_ADC 3
#include "gpio_signal.h"
@@ -286,7 +284,6 @@ enum usb_strings {
USB_STR_COUNT
};
-
/* ADC signal */
enum adc_channel {
ADC_CHG_CC1_PD,
diff --git a/board/servo_v4p1/build.mk b/board/servo_v4p1/build.mk
index 872b4d4281..c1e8db9cd8 100644
--- a/board/servo_v4p1/build.mk
+++ b/board/servo_v4p1/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/servo_v4p1/ccd_measure_sbu.c b/board/servo_v4p1/ccd_measure_sbu.c
index b9c9680cc9..41d53ab597 100644
--- a/board/servo_v4p1/ccd_measure_sbu.c
+++ b/board/servo_v4p1/ccd_measure_sbu.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "ioexpanders.h"
#include "timer.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/*
* Define voltage thresholds for SBU USB detection.
@@ -20,15 +20,15 @@
* Max observed USB low across sampled systems: 666mV
* Min observed USB high across sampled systems: 3026mV
*/
-#define GND_MAX_MV 700
-#define USB_HIGH_MV 2500
-#define SBU_DIRECT 0
-#define SBU_FLIP 1
+#define GND_MAX_MV 700
+#define USB_HIGH_MV 2500
+#define SBU_DIRECT 0
+#define SBU_FLIP 1
-#define MODE_SBU_DISCONNECT 0
-#define MODE_SBU_CONNECT 1
-#define MODE_SBU_FLIP 2
-#define MODE_SBU_OTHER 3
+#define MODE_SBU_DISCONNECT 0
+#define MODE_SBU_CONNECT 1
+#define MODE_SBU_FLIP 2
+#define MODE_SBU_OTHER 3
static void ccd_measure_sbu(void);
DECLARE_DEFERRED(ccd_measure_sbu);
diff --git a/board/servo_v4p1/ccd_measure_sbu.h b/board/servo_v4p1/ccd_measure_sbu.h
index 0dd1ce0de7..8635f892a4 100644
--- a/board/servo_v4p1/ccd_measure_sbu.h
+++ b/board/servo_v4p1/ccd_measure_sbu.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/chg_control.c b/board/servo_v4p1/chg_control.c
index 19be03a755..76f3dc9649 100644
--- a/board/servo_v4p1/chg_control.c
+++ b/board/servo_v4p1/chg_control.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "timer.h"
#include "usb_pd.h"
-#define CHG_P5V_POWER 0
+#define CHG_P5V_POWER 0
#define CHG_VBUS_POWER 1
void chg_reset(void)
@@ -55,9 +55,11 @@ void chg_attach_cc_rds(bool en)
* Configure USB_CHG_CC1_MCU and USB_CHG_CC2_MCU as
* ANALOG input
*/
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- | (3 << (2*2)) | /* PA2 in ANALOG mode */
- (3 << (2*4))); /* PA4 in ANALOG mode */
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) | (3 << (2 * 2)) | /* PA2 in
+ ANALOG
+ mode */
+ (3 << (2 * 4))); /* PA4 in ANALOG mode */
} else {
/*
* Configure USB_CHG_CC1_MCU and USB_CHG_CC2_MCU as GPIO and
@@ -71,10 +73,12 @@ void chg_attach_cc_rds(bool en)
gpio_set_level(GPIO_USB_CHG_CC2_MCU, 1);
/* Disable Analog mode and Enable GPO */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A)
- & ~(3 << (2*2) | /* PA2 disable ADC */
- 3 << (2*4))) /* PA4 disable ADC */
- | (1 << (2*2) | /* Set as GPO */
- 1 << (2*4)); /* Set as GPO */
+ STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A) &
+ ~(3 << (2 * 2) | /* PA2 disable ADC
+ */
+ 3 << (2 * 4))) /* PA4 disable ADC
+ */
+ | (1 << (2 * 2) | /* Set as GPO */
+ 1 << (2 * 4)); /* Set as GPO */
}
}
diff --git a/board/servo_v4p1/chg_control.h b/board/servo_v4p1/chg_control.h
index 8b81708ccc..91e3601ac8 100644
--- a/board/servo_v4p1/chg_control.h
+++ b/board/servo_v4p1/chg_control.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,11 +8,7 @@
#include <stdbool.h>
-enum chg_cc_t {
- CHG_OPEN,
- CHG_CC1,
- CHG_CC2
-};
+enum chg_cc_t { CHG_OPEN, CHG_CC1, CHG_CC2 };
enum chg_power_select_t {
CHG_POWER_OFF,
diff --git a/board/servo_v4p1/dacs.c b/board/servo_v4p1/dacs.c
index 838cdbbc8b..355e27684b 100644
--- a/board/servo_v4p1/dacs.c
+++ b/board/servo_v4p1/dacs.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,17 +14,17 @@
#define CC1_DAC_ADDR 0x48
#define CC2_DAC_ADDR 0x49
-#define REG_NOOP 0
-#define REG_DEVID 1
-#define REG_SYNC 2
-#define REG_CONFIG 3
-#define REG_GAIN 4
+#define REG_NOOP 0
+#define REG_DEVID 1
+#define REG_SYNC 2
+#define REG_CONFIG 3
+#define REG_GAIN 4
#define REG_TRIGGER 5
-#define REG_STATUS 7
-#define REG_DAC 8
+#define REG_STATUS 7
+#define REG_DAC 8
-#define DAC1 BIT(0)
-#define DAC2 BIT(1)
+#define DAC1 BIT(0)
+#define DAC2 BIT(1)
static uint8_t dac_enabled;
@@ -103,7 +103,7 @@ int write_dac(enum dac_t dac, uint16_t value)
}
#ifdef SECTION_IS_RO
-static int cmd_cc_dac(int argc, char *argv[])
+static int cmd_cc_dac(int argc, const char *argv[])
{
uint8_t dac;
uint64_t mv;
@@ -135,7 +135,6 @@ static int cmd_cc_dac(int argc, char *argv[])
}
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(cc_dac, cmd_cc_dac,
- "dac <\"on\"|\"off\"|mv>",
+DECLARE_CONSOLE_COMMAND(cc_dac, cmd_cc_dac, "dac <\"on\"|\"off\"|mv>",
"Set Servo v4.1 CC dacs");
#endif
diff --git a/board/servo_v4p1/dacs.h b/board/servo_v4p1/dacs.h
index bd0ecd67da..4b2028c648 100644
--- a/board/servo_v4p1/dacs.h
+++ b/board/servo_v4p1/dacs.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/ec.tasklist b/board/servo_v4p1/ec.tasklist
index 07250f018e..6c9abf1c07 100644
--- a/board/servo_v4p1/ec.tasklist
+++ b/board/servo_v4p1/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/fusb302b.c b/board/servo_v4p1/fusb302b.c
index 4e144dec05..e8fdbde68b 100644
--- a/board/servo_v4p1/fusb302b.c
+++ b/board/servo_v4p1/fusb302b.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -72,7 +72,6 @@ int init_fusb302b(int p)
if (ret)
return ret;
-
ret = tcpc_read(TCPC_REG_INTERRUPTA, &interrupta);
if (ret)
return ret;
@@ -159,7 +158,6 @@ int get_cc(int *cc1, int *cc2)
else
orig_meas_cc2 = 0;
-
/* Disable CC2 measurement switch, enable CC1 measurement switch */
reg &= ~TCPC_REG_SWITCHES0_MEAS_CC2;
reg |= TCPC_REG_SWITCHES0_MEAS_CC1;
diff --git a/board/servo_v4p1/fusb302b.h b/board/servo_v4p1/fusb302b.h
index ec89c0c207..cebf5409f5 100644
--- a/board/servo_v4p1/fusb302b.h
+++ b/board/servo_v4p1/fusb302b.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,173 +22,173 @@
/* FUSB302B11MPX */
#define FUSB302_I2C_ADDR_B11_FLAGS 0x25
-#define TCPC_REG_DEVICE_ID 0x01
-
-#define TCPC_REG_SWITCHES0 0x02
-#define TCPC_REG_SWITCHES0_CC2_PU_EN (1<<7)
-#define TCPC_REG_SWITCHES0_CC1_PU_EN (1<<6)
-#define TCPC_REG_SWITCHES0_VCONN_CC2 (1<<5)
-#define TCPC_REG_SWITCHES0_VCONN_CC1 (1<<4)
-#define TCPC_REG_SWITCHES0_MEAS_CC2 (1<<3)
-#define TCPC_REG_SWITCHES0_MEAS_CC1 (1<<2)
-#define TCPC_REG_SWITCHES0_CC2_PD_EN (1<<1)
-#define TCPC_REG_SWITCHES0_CC1_PD_EN (1<<0)
-
-#define TCPC_REG_SWITCHES1 0x03
-#define TCPC_REG_SWITCHES1_POWERROLE (1<<7)
-#define TCPC_REG_SWITCHES1_SPECREV1 (1<<6)
-#define TCPC_REG_SWITCHES1_SPECREV0 (1<<5)
-#define TCPC_REG_SWITCHES1_DATAROLE (1<<4)
-#define TCPC_REG_SWITCHES1_AUTO_GCRC (1<<2)
-#define TCPC_REG_SWITCHES1_TXCC2_EN (1<<1)
-#define TCPC_REG_SWITCHES1_TXCC1_EN (1<<0)
-
-#define TCPC_REG_MEASURE 0x04
-#define TCPC_REG_MEASURE_MDAC_MASK 0x3F
-#define TCPC_REG_MEASURE_VBUS (1<<6)
+#define TCPC_REG_DEVICE_ID 0x01
+
+#define TCPC_REG_SWITCHES0 0x02
+#define TCPC_REG_SWITCHES0_CC2_PU_EN (1 << 7)
+#define TCPC_REG_SWITCHES0_CC1_PU_EN (1 << 6)
+#define TCPC_REG_SWITCHES0_VCONN_CC2 (1 << 5)
+#define TCPC_REG_SWITCHES0_VCONN_CC1 (1 << 4)
+#define TCPC_REG_SWITCHES0_MEAS_CC2 (1 << 3)
+#define TCPC_REG_SWITCHES0_MEAS_CC1 (1 << 2)
+#define TCPC_REG_SWITCHES0_CC2_PD_EN (1 << 1)
+#define TCPC_REG_SWITCHES0_CC1_PD_EN (1 << 0)
+
+#define TCPC_REG_SWITCHES1 0x03
+#define TCPC_REG_SWITCHES1_POWERROLE (1 << 7)
+#define TCPC_REG_SWITCHES1_SPECREV1 (1 << 6)
+#define TCPC_REG_SWITCHES1_SPECREV0 (1 << 5)
+#define TCPC_REG_SWITCHES1_DATAROLE (1 << 4)
+#define TCPC_REG_SWITCHES1_AUTO_GCRC (1 << 2)
+#define TCPC_REG_SWITCHES1_TXCC2_EN (1 << 1)
+#define TCPC_REG_SWITCHES1_TXCC1_EN (1 << 0)
+
+#define TCPC_REG_MEASURE 0x04
+#define TCPC_REG_MEASURE_MDAC_MASK 0x3F
+#define TCPC_REG_MEASURE_VBUS (1 << 6)
/*
* MDAC reference voltage step size is 42 mV. Round our thresholds to reduce
* maximum error, which also matches suggested thresholds in datasheet
* (Table 3. Host Interrupt Summary).
*/
-#define TCPC_REG_MEASURE_MDAC_MV(mv) (DIV_ROUND_NEAREST((mv), 42) & 0x3f)
-
-#define TCPC_REG_CONTROL0 0x06
-#define TCPC_REG_CONTROL0_TX_FLUSH (1<<6)
-#define TCPC_REG_CONTROL0_INT_MASK (1<<5)
-#define TCPC_REG_CONTROL0_HOST_CUR_MASK (3<<2)
-#define TCPC_REG_CONTROL0_HOST_CUR_3A0 (3<<2)
-#define TCPC_REG_CONTROL0_HOST_CUR_1A5 (2<<2)
-#define TCPC_REG_CONTROL0_HOST_CUR_USB (1<<2)
-#define TCPC_REG_CONTROL0_TX_START (1<<0)
-
-#define TCPC_REG_CONTROL1 0x07
-#define TCPC_REG_CONTROL1_ENSOP2DB (1<<6)
-#define TCPC_REG_CONTROL1_ENSOP1DB (1<<5)
-#define TCPC_REG_CONTROL1_BIST_MODE2 (1<<4)
-#define TCPC_REG_CONTROL1_RX_FLUSH (1<<2)
-#define TCPC_REG_CONTROL1_ENSOP2 (1<<1)
-#define TCPC_REG_CONTROL1_ENSOP1 (1<<0)
-
-#define TCPC_REG_CONTROL2 0x08
+#define TCPC_REG_MEASURE_MDAC_MV(mv) (DIV_ROUND_NEAREST((mv), 42) & 0x3f)
+
+#define TCPC_REG_CONTROL0 0x06
+#define TCPC_REG_CONTROL0_TX_FLUSH (1 << 6)
+#define TCPC_REG_CONTROL0_INT_MASK (1 << 5)
+#define TCPC_REG_CONTROL0_HOST_CUR_MASK (3 << 2)
+#define TCPC_REG_CONTROL0_HOST_CUR_3A0 (3 << 2)
+#define TCPC_REG_CONTROL0_HOST_CUR_1A5 (2 << 2)
+#define TCPC_REG_CONTROL0_HOST_CUR_USB (1 << 2)
+#define TCPC_REG_CONTROL0_TX_START (1 << 0)
+
+#define TCPC_REG_CONTROL1 0x07
+#define TCPC_REG_CONTROL1_ENSOP2DB (1 << 6)
+#define TCPC_REG_CONTROL1_ENSOP1DB (1 << 5)
+#define TCPC_REG_CONTROL1_BIST_MODE2 (1 << 4)
+#define TCPC_REG_CONTROL1_RX_FLUSH (1 << 2)
+#define TCPC_REG_CONTROL1_ENSOP2 (1 << 1)
+#define TCPC_REG_CONTROL1_ENSOP1 (1 << 0)
+
+#define TCPC_REG_CONTROL2 0x08
/* two-bit field, valid values below */
-#define TCPC_REG_CONTROL2_MODE_MASK (0x3<<TCPC_REG_CONTROL2_MODE_POS)
-#define TCPC_REG_CONTROL2_MODE_DFP (0x3)
-#define TCPC_REG_CONTROL2_MODE_UFP (0x2)
-#define TCPC_REG_CONTROL2_MODE_DRP (0x1)
-#define TCPC_REG_CONTROL2_MODE_POS (1)
-#define TCPC_REG_CONTROL2_TOGGLE (1<<0)
-
-#define TCPC_REG_CONTROL3 0x09
-#define TCPC_REG_CONTROL3_SEND_HARDRESET (1<<6)
-#define TCPC_REG_CONTROL3_BIST_TMODE (1<<5) /* 302B Only */
-#define TCPC_REG_CONTROL3_AUTO_HARDRESET (1<<4)
-#define TCPC_REG_CONTROL3_AUTO_SOFTRESET (1<<3)
+#define TCPC_REG_CONTROL2_MODE_MASK (0x3 << TCPC_REG_CONTROL2_MODE_POS)
+#define TCPC_REG_CONTROL2_MODE_DFP (0x3)
+#define TCPC_REG_CONTROL2_MODE_UFP (0x2)
+#define TCPC_REG_CONTROL2_MODE_DRP (0x1)
+#define TCPC_REG_CONTROL2_MODE_POS (1)
+#define TCPC_REG_CONTROL2_TOGGLE (1 << 0)
+
+#define TCPC_REG_CONTROL3 0x09
+#define TCPC_REG_CONTROL3_SEND_HARDRESET (1 << 6)
+#define TCPC_REG_CONTROL3_BIST_TMODE (1 << 5) /* 302B Only */
+#define TCPC_REG_CONTROL3_AUTO_HARDRESET (1 << 4)
+#define TCPC_REG_CONTROL3_AUTO_SOFTRESET (1 << 3)
/* two-bit field */
-#define TCPC_REG_CONTROL3_N_RETRIES (1<<1)
-#define TCPC_REG_CONTROL3_N_RETRIES_POS (1)
-#define TCPC_REG_CONTROL3_N_RETRIES_SIZE (2)
-#define TCPC_REG_CONTROL3_AUTO_RETRY (1<<0)
-
-#define TCPC_REG_MASK 0x0A
-#define TCPC_REG_MASK_VBUSOK (1<<7)
-#define TCPC_REG_MASK_ACTIVITY (1<<6)
-#define TCPC_REG_MASK_COMP_CHNG (1<<5)
-#define TCPC_REG_MASK_CRC_CHK (1<<4)
-#define TCPC_REG_MASK_ALERT (1<<3)
-#define TCPC_REG_MASK_WAKE (1<<2)
-#define TCPC_REG_MASK_COLLISION (1<<1)
-#define TCPC_REG_MASK_BC_LVL (1<<0)
-
-#define TCPC_REG_POWER 0x0B
-#define TCPC_REG_POWER_PWR (1<<0) /* four-bit field */
-#define TCPC_REG_POWER_PWR_LOW 0x1 /* Bandgap + Wake circuitry */
-#define TCPC_REG_POWER_PWR_MEDIUM 0x3 /* LOW + Receiver + Current refs */
-#define TCPC_REG_POWER_PWR_HIGH 0x7 /* MEDIUM + Measure block */
-#define TCPC_REG_POWER_PWR_ALL 0xF /* HIGH + Internal Oscillator */
-
-#define TCPC_REG_RESET 0x0C
-#define TCPC_REG_RESET_PD_RESET (1<<1)
-#define TCPC_REG_RESET_SW_RESET (1<<0)
-
-#define TCPC_REG_MASKA 0x0E
-#define TCPC_REG_MASKA_OCP_TEMP (1<<7)
-#define TCPC_REG_MASKA_TOGDONE (1<<6)
-#define TCPC_REG_MASKA_SOFTFAIL (1<<5)
-#define TCPC_REG_MASKA_RETRYFAIL (1<<4)
-#define TCPC_REG_MASKA_HARDSENT (1<<3)
-#define TCPC_REG_MASKA_TX_SUCCESS (1<<2)
-#define TCPC_REG_MASKA_SOFTRESET (1<<1)
-#define TCPC_REG_MASKA_HARDRESET (1<<0)
-
-#define TCPC_REG_MASKB 0x0F
-#define TCPC_REG_MASKB_GCRCSENT (1<<0)
-
-#define TCPC_REG_STATUS0A 0x3C
-#define TCPC_REG_STATUS0A_SOFTFAIL (1<<5)
-#define TCPC_REG_STATUS0A_RETRYFAIL (1<<4)
-#define TCPC_REG_STATUS0A_POWER (1<<2) /* two-bit field */
-#define TCPC_REG_STATUS0A_RX_SOFT_RESET (1<<1)
-#define TCPC_REG_STATUS0A_RX_HARD_RESEt (1<<0)
-
-#define TCPC_REG_STATUS1A 0x3D
+#define TCPC_REG_CONTROL3_N_RETRIES (1 << 1)
+#define TCPC_REG_CONTROL3_N_RETRIES_POS (1)
+#define TCPC_REG_CONTROL3_N_RETRIES_SIZE (2)
+#define TCPC_REG_CONTROL3_AUTO_RETRY (1 << 0)
+
+#define TCPC_REG_MASK 0x0A
+#define TCPC_REG_MASK_VBUSOK (1 << 7)
+#define TCPC_REG_MASK_ACTIVITY (1 << 6)
+#define TCPC_REG_MASK_COMP_CHNG (1 << 5)
+#define TCPC_REG_MASK_CRC_CHK (1 << 4)
+#define TCPC_REG_MASK_ALERT (1 << 3)
+#define TCPC_REG_MASK_WAKE (1 << 2)
+#define TCPC_REG_MASK_COLLISION (1 << 1)
+#define TCPC_REG_MASK_BC_LVL (1 << 0)
+
+#define TCPC_REG_POWER 0x0B
+#define TCPC_REG_POWER_PWR (1 << 0) /* four-bit field */
+#define TCPC_REG_POWER_PWR_LOW 0x1 /* Bandgap + Wake circuitry */
+#define TCPC_REG_POWER_PWR_MEDIUM 0x3 /* LOW + Receiver + Current refs */
+#define TCPC_REG_POWER_PWR_HIGH 0x7 /* MEDIUM + Measure block */
+#define TCPC_REG_POWER_PWR_ALL 0xF /* HIGH + Internal Oscillator */
+
+#define TCPC_REG_RESET 0x0C
+#define TCPC_REG_RESET_PD_RESET (1 << 1)
+#define TCPC_REG_RESET_SW_RESET (1 << 0)
+
+#define TCPC_REG_MASKA 0x0E
+#define TCPC_REG_MASKA_OCP_TEMP (1 << 7)
+#define TCPC_REG_MASKA_TOGDONE (1 << 6)
+#define TCPC_REG_MASKA_SOFTFAIL (1 << 5)
+#define TCPC_REG_MASKA_RETRYFAIL (1 << 4)
+#define TCPC_REG_MASKA_HARDSENT (1 << 3)
+#define TCPC_REG_MASKA_TX_SUCCESS (1 << 2)
+#define TCPC_REG_MASKA_SOFTRESET (1 << 1)
+#define TCPC_REG_MASKA_HARDRESET (1 << 0)
+
+#define TCPC_REG_MASKB 0x0F
+#define TCPC_REG_MASKB_GCRCSENT (1 << 0)
+
+#define TCPC_REG_STATUS0A 0x3C
+#define TCPC_REG_STATUS0A_SOFTFAIL (1 << 5)
+#define TCPC_REG_STATUS0A_RETRYFAIL (1 << 4)
+#define TCPC_REG_STATUS0A_POWER (1 << 2) /* two-bit field */
+#define TCPC_REG_STATUS0A_RX_SOFT_RESET (1 << 1)
+#define TCPC_REG_STATUS0A_RX_HARD_RESEt (1 << 0)
+
+#define TCPC_REG_STATUS1A 0x3D
/* three-bit field, valid values below */
-#define TCPC_REG_STATUS1A_TOGSS (1<<3)
-#define TCPC_REG_STATUS1A_TOGSS_RUNNING 0x0
-#define TCPC_REG_STATUS1A_TOGSS_SRC1 0x1
-#define TCPC_REG_STATUS1A_TOGSS_SRC2 0x2
-#define TCPC_REG_STATUS1A_TOGSS_SNK1 0x5
-#define TCPC_REG_STATUS1A_TOGSS_SNK2 0x6
-#define TCPC_REG_STATUS1A_TOGSS_AA 0x7
-#define TCPC_REG_STATUS1A_TOGSS_POS (3)
-#define TCPC_REG_STATUS1A_TOGSS_MASK (0x7)
-
-#define TCPC_REG_STATUS1A_RXSOP2DB (1<<2)
-#define TCPC_REG_STATUS1A_RXSOP1DB (1<<1)
-#define TCPC_REG_STATUS1A_RXSOP (1<<0)
-
-#define TCPC_REG_INTERRUPTA 0x3E
-#define TCPC_REG_INTERRUPTA_OCP_TEMP (1<<7)
-#define TCPC_REG_INTERRUPTA_TOGDONE (1<<6)
-#define TCPC_REG_INTERRUPTA_SOFTFAIL (1<<5)
-#define TCPC_REG_INTERRUPTA_RETRYFAIL (1<<4)
-#define TCPC_REG_INTERRUPTA_HARDSENT (1<<3)
-#define TCPC_REG_INTERRUPTA_TX_SUCCESS (1<<2)
-#define TCPC_REG_INTERRUPTA_SOFTRESET (1<<1)
-#define TCPC_REG_INTERRUPTA_HARDRESET (1<<0)
-
-#define TCPC_REG_INTERRUPTB 0x3F
-#define TCPC_REG_INTERRUPTB_GCRCSENT (1<<0)
-
-#define TCPC_REG_STATUS0 0x40
-#define TCPC_REG_STATUS0_VBUSOK (1<<7)
-#define TCPC_REG_STATUS0_ACTIVITY (1<<6)
-#define TCPC_REG_STATUS0_COMP (1<<5)
-#define TCPC_REG_STATUS0_CRC_CHK (1<<4)
-#define TCPC_REG_STATUS0_ALERT (1<<3)
-#define TCPC_REG_STATUS0_WAKE (1<<2)
-#define TCPC_REG_STATUS0_BC_LVL1 (1<<1) /* two-bit field */
-#define TCPC_REG_STATUS0_BC_LVL0 (1<<0) /* two-bit field */
-
-#define TCPC_REG_STATUS1 0x41
-#define TCPC_REG_STATUS1_RXSOP2 (1<<7)
-#define TCPC_REG_STATUS1_RXSOP1 (1<<6)
-#define TCPC_REG_STATUS1_RX_EMPTY (1<<5)
-#define TCPC_REG_STATUS1_RX_FULL (1<<4)
-#define TCPC_REG_STATUS1_TX_EMPTY (1<<3)
-#define TCPC_REG_STATUS1_TX_FULL (1<<2)
-
-#define TCPC_REG_INTERRUPT 0x42
-#define TCPC_REG_INTERRUPT_VBUSOK (1<<7)
-#define TCPC_REG_INTERRUPT_ACTIVITY (1<<6)
-#define TCPC_REG_INTERRUPT_COMP_CHNG (1<<5)
-#define TCPC_REG_INTERRUPT_CRC_CHK (1<<4)
-#define TCPC_REG_INTERRUPT_ALERT (1<<3)
-#define TCPC_REG_INTERRUPT_WAKE (1<<2)
-#define TCPC_REG_INTERRUPT_COLLISION (1<<1)
-#define TCPC_REG_INTERRUPT_BC_LVL (1<<0)
-
-#define TCPC_REG_FIFOS 0x43
+#define TCPC_REG_STATUS1A_TOGSS (1 << 3)
+#define TCPC_REG_STATUS1A_TOGSS_RUNNING 0x0
+#define TCPC_REG_STATUS1A_TOGSS_SRC1 0x1
+#define TCPC_REG_STATUS1A_TOGSS_SRC2 0x2
+#define TCPC_REG_STATUS1A_TOGSS_SNK1 0x5
+#define TCPC_REG_STATUS1A_TOGSS_SNK2 0x6
+#define TCPC_REG_STATUS1A_TOGSS_AA 0x7
+#define TCPC_REG_STATUS1A_TOGSS_POS (3)
+#define TCPC_REG_STATUS1A_TOGSS_MASK (0x7)
+
+#define TCPC_REG_STATUS1A_RXSOP2DB (1 << 2)
+#define TCPC_REG_STATUS1A_RXSOP1DB (1 << 1)
+#define TCPC_REG_STATUS1A_RXSOP (1 << 0)
+
+#define TCPC_REG_INTERRUPTA 0x3E
+#define TCPC_REG_INTERRUPTA_OCP_TEMP (1 << 7)
+#define TCPC_REG_INTERRUPTA_TOGDONE (1 << 6)
+#define TCPC_REG_INTERRUPTA_SOFTFAIL (1 << 5)
+#define TCPC_REG_INTERRUPTA_RETRYFAIL (1 << 4)
+#define TCPC_REG_INTERRUPTA_HARDSENT (1 << 3)
+#define TCPC_REG_INTERRUPTA_TX_SUCCESS (1 << 2)
+#define TCPC_REG_INTERRUPTA_SOFTRESET (1 << 1)
+#define TCPC_REG_INTERRUPTA_HARDRESET (1 << 0)
+
+#define TCPC_REG_INTERRUPTB 0x3F
+#define TCPC_REG_INTERRUPTB_GCRCSENT (1 << 0)
+
+#define TCPC_REG_STATUS0 0x40
+#define TCPC_REG_STATUS0_VBUSOK (1 << 7)
+#define TCPC_REG_STATUS0_ACTIVITY (1 << 6)
+#define TCPC_REG_STATUS0_COMP (1 << 5)
+#define TCPC_REG_STATUS0_CRC_CHK (1 << 4)
+#define TCPC_REG_STATUS0_ALERT (1 << 3)
+#define TCPC_REG_STATUS0_WAKE (1 << 2)
+#define TCPC_REG_STATUS0_BC_LVL1 (1 << 1) /* two-bit field */
+#define TCPC_REG_STATUS0_BC_LVL0 (1 << 0) /* two-bit field */
+
+#define TCPC_REG_STATUS1 0x41
+#define TCPC_REG_STATUS1_RXSOP2 (1 << 7)
+#define TCPC_REG_STATUS1_RXSOP1 (1 << 6)
+#define TCPC_REG_STATUS1_RX_EMPTY (1 << 5)
+#define TCPC_REG_STATUS1_RX_FULL (1 << 4)
+#define TCPC_REG_STATUS1_TX_EMPTY (1 << 3)
+#define TCPC_REG_STATUS1_TX_FULL (1 << 2)
+
+#define TCPC_REG_INTERRUPT 0x42
+#define TCPC_REG_INTERRUPT_VBUSOK (1 << 7)
+#define TCPC_REG_INTERRUPT_ACTIVITY (1 << 6)
+#define TCPC_REG_INTERRUPT_COMP_CHNG (1 << 5)
+#define TCPC_REG_INTERRUPT_CRC_CHK (1 << 4)
+#define TCPC_REG_INTERRUPT_ALERT (1 << 3)
+#define TCPC_REG_INTERRUPT_WAKE (1 << 2)
+#define TCPC_REG_INTERRUPT_COLLISION (1 << 1)
+#define TCPC_REG_INTERRUPT_BC_LVL (1 << 0)
+
+#define TCPC_REG_FIFOS 0x43
/* Tokens defined for the FUSB302 TX FIFO */
enum fusb302_txfifo_tokens {
diff --git a/board/servo_v4p1/gpio.inc b/board/servo_v4p1/gpio.inc
index 070aa90098..fe631aca80 100644
--- a/board/servo_v4p1/gpio.inc
+++ b/board/servo_v4p1/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/ina231s.c b/board/servo_v4p1/ina231s.c
index 3382686f3f..637a878ef7 100644
--- a/board/servo_v4p1/ina231s.c
+++ b/board/servo_v4p1/ina231s.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -7,9 +7,9 @@
#include "ina2xx.h"
#include "util.h"
-#define PP_DUT_IDX 0
-#define PP_CHG_IDX 1
-#define SR_CHG_IDX 2
+#define PP_DUT_IDX 0
+#define PP_CHG_IDX 1
+#define SR_CHG_IDX 2
void init_ina231s(void)
{
diff --git a/board/servo_v4p1/ina231s.h b/board/servo_v4p1/ina231s.h
index 9c3804e769..6f0828127b 100644
--- a/board/servo_v4p1/ina231s.h
+++ b/board/servo_v4p1/ina231s.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/ioexpanders.c b/board/servo_v4p1/ioexpanders.c
index 46dcbcc167..275804de89 100644
--- a/board/servo_v4p1/ioexpanders.c
+++ b/board/servo_v4p1/ioexpanders.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,22 +9,22 @@
#include "ioexpander.h"
#include "ioexpanders.h"
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/******************************************************************************
* Initialize IOExpanders.
*/
-#define PCAL6524HE_PORT TCA6424A_PORT
-#define PCAL6524HE_ADDR TCA6424A_ADDR
-#define PCAL6524HE_DEVICE_ID_ADDR 0x7c
-#define PCAL6524HE_DEVICE_ID_REG 0x46
-#define PCAL6524HE_DEVICE_ID0 0
-#define PCAL6524HE_DEVICE_ID1 0x08
-#define PCAL6524HE_DEVICE_ID2 0x30
-#define PCAL6524HE_INT_MASK_REG_PORT1 0x55
-#define PCAL6524HE_INT_MASK_REG_PORT2 0x56
+#define PCAL6524HE_PORT TCA6424A_PORT
+#define PCAL6524HE_ADDR TCA6424A_ADDR
+#define PCAL6524HE_DEVICE_ID_ADDR 0x7c
+#define PCAL6524HE_DEVICE_ID_REG 0x46
+#define PCAL6524HE_DEVICE_ID0 0
+#define PCAL6524HE_DEVICE_ID1 0x08
+#define PCAL6524HE_DEVICE_ID2 0x30
+#define PCAL6524HE_INT_MASK_REG_PORT1 0x55
+#define PCAL6524HE_INT_MASK_REG_PORT2 0x56
static enum servo_board_id board_id_val = BOARD_ID_UNSET;
@@ -51,16 +51,16 @@ int init_ioexpanders(void)
/* Attempt to read the device id register of the PCAL6524HE device */
i2c_read_block(PCAL6524HE_PORT, PCAL6524HE_DEVICE_ID_ADDR,
- PCAL6524HE_DEVICE_ID_REG, dat, 3);
+ PCAL6524HE_DEVICE_ID_REG, dat, 3);
if (dat[2] == PCAL6524HE_DEVICE_ID2 &&
- dat[1] == PCAL6524HE_DEVICE_ID1 &&
- dat[0] == PCAL6524HE_DEVICE_ID0) {
+ dat[1] == PCAL6524HE_DEVICE_ID1 &&
+ dat[0] == PCAL6524HE_DEVICE_ID0) {
ccprintf("Detected PCAL6524HE\n");
i2c_write8(PCAL6524HE_PORT, PCAL6524HE_ADDR,
- PCAL6524HE_INT_MASK_REG_PORT1, 0);
+ PCAL6524HE_INT_MASK_REG_PORT1, 0);
i2c_write8(PCAL6524HE_PORT, PCAL6524HE_ADDR,
- PCAL6524HE_INT_MASK_REG_PORT2, 0xbe);
+ PCAL6524HE_INT_MASK_REG_PORT2, 0xbe);
} else {
ccprintf("Detected TCA6424A\n");
}
@@ -74,7 +74,7 @@ int init_ioexpanders(void)
}
if ((!!(irqs & HOST_CHRG_DET) != bc12_charger) &&
- (board_id_det() <= BOARD_ID_REV1)) {
+ (board_id_det() <= BOARD_ID_REV1)) {
CPRINTF("BC1.2 charger %s\n",
(irqs & HOST_CHRG_DET) ? "plugged" : "unplugged");
bc12_charger = !!(irqs & HOST_CHRG_DET);
@@ -220,8 +220,7 @@ inline int board_id_det(void)
/* Cache board ID at init */
if (ioex_get_port(IOEX_GET_INFO(IOEX_BOARD_ID_DET0)->ioex,
- IOEX_GET_INFO(IOEX_BOARD_ID_DET0)->port,
- &id))
+ IOEX_GET_INFO(IOEX_BOARD_ID_DET0)->port, &id))
return id;
/* Board ID consists of bits 5, 4, and 3 */
@@ -296,8 +295,7 @@ inline int read_faults(void)
int val;
ioex_get_port(IOEX_GET_INFO(IOEX_USERVO_FAULT_L)->ioex,
- IOEX_GET_INFO(IOEX_USERVO_FAULT_L)->port,
- &val);
+ IOEX_GET_INFO(IOEX_USERVO_FAULT_L)->port, &val);
return val;
}
@@ -307,8 +305,7 @@ inline int read_irqs(void)
int val;
ioex_get_port(IOEX_GET_INFO(IOEX_SYS_PWR_IRQ_ODL)->ioex,
- IOEX_GET_INFO(IOEX_SYS_PWR_IRQ_ODL)->port,
- &val);
+ IOEX_GET_INFO(IOEX_SYS_PWR_IRQ_ODL)->port, &val);
return val;
}
@@ -343,9 +340,7 @@ inline int board_id_det(void)
int res;
/* Cache board ID at init */
- res = i2c_read8(TCA6416A_PORT,
- TCA6416A_ADDR,
- BOARD_ID_DET_PORT,
+ res = i2c_read8(TCA6416A_PORT, TCA6416A_ADDR, BOARD_ID_DET_PORT,
&id);
if (res != EC_SUCCESS)
return res;
diff --git a/board/servo_v4p1/ioexpanders.h b/board/servo_v4p1/ioexpanders.h
index 6565992857..313fea46a4 100644
--- a/board/servo_v4p1/ioexpanders.h
+++ b/board/servo_v4p1/ioexpanders.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,10 +10,7 @@
#define BOARD_ID_DET_OFFSET 3
#define BOARD_ID_DET_PORT 1
-enum uservo_fastboot_mux_sel_t {
- MUX_SEL_USERVO = 0,
- MUX_SEL_FASTBOOT = 1
-};
+enum uservo_fastboot_mux_sel_t { MUX_SEL_USERVO = 0, MUX_SEL_FASTBOOT = 1 };
/*
* Initialize Ioexpanders
@@ -236,14 +233,14 @@ int get_dut_chg_en(void);
*/
int host_or_chg_ctl(int en);
-#define USERVO_FAULT_L BIT(0)
-#define USB3_A0_FAULT_L BIT(1)
-#define USB3_A1_FAULT_L BIT(2)
-#define USB_DUTCHG_FLT_ODL BIT(3)
-#define PP3300_DP_FAULT_L BIT(4)
-#define DAC_BUF1_LATCH_FAULT_L BIT(5)
-#define DAC_BUF2_LATCH_FAULT_L BIT(6)
-#define PP5000_SRC_SEL BIT(7)
+#define USERVO_FAULT_L BIT(0)
+#define USB3_A0_FAULT_L BIT(1)
+#define USB3_A1_FAULT_L BIT(2)
+#define USB_DUTCHG_FLT_ODL BIT(3)
+#define PP3300_DP_FAULT_L BIT(4)
+#define DAC_BUF1_LATCH_FAULT_L BIT(5)
+#define DAC_BUF2_LATCH_FAULT_L BIT(6)
+#define PP5000_SRC_SEL BIT(7)
/**
* Read any faults that may have occurred. A fault has occurred if the
@@ -271,8 +268,8 @@ int host_or_chg_ctl(int en);
*/
int read_faults(void);
-#define HOST_CHRG_DET BIT(0)
-#define SYS_PWR_IRQ_ODL BIT(6)
+#define HOST_CHRG_DET BIT(0)
+#define SYS_PWR_IRQ_ODL BIT(6)
/**
* Read irqs which indicate some system event.
diff --git a/board/servo_v4p1/pathsel.c b/board/servo_v4p1/pathsel.c
index 7b71fba169..eba1733e05 100644
--- a/board/servo_v4p1/pathsel.c
+++ b/board/servo_v4p1/pathsel.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/pathsel.h b/board/servo_v4p1/pathsel.h
index 7365d3adf3..5f228aceb9 100644
--- a/board/servo_v4p1/pathsel.h
+++ b/board/servo_v4p1/pathsel.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/servo_v4p1/pi3usb9201.c b/board/servo_v4p1/pi3usb9201.c
index 102eaf790d..976c213c49 100644
--- a/board/servo_v4p1/pi3usb9201.c
+++ b/board/servo_v4p1/pi3usb9201.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -6,7 +6,7 @@
#include "i2c.h"
#include "pi3usb9201.h"
-#define PI3USB9201_ADDR 0x5f
+#define PI3USB9201_ADDR 0x5f
inline void init_pi3usb9201(void)
{
@@ -19,7 +19,7 @@ inline void init_pi3usb9201(void)
}
inline void write_pi3usb9201(enum pi3usb9201_reg_t reg,
- enum pi3usb9201_dat_t dat)
+ enum pi3usb9201_dat_t dat)
{
i2c_write8(1, PI3USB9201_ADDR, reg, dat);
}
diff --git a/board/servo_v4p1/pi3usb9201.h b/board/servo_v4p1/pi3usb9201.h
index 826db8b871..863fc4129a 100644
--- a/board/servo_v4p1/pi3usb9201.h
+++ b/board/servo_v4p1/pi3usb9201.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -6,35 +6,29 @@
#ifndef __CROS_EC_PI3USB9201_H
#define __CROS_EC_PI3USB9201_H
-enum pi3usb9201_reg_t {
- CTRL_REG1,
- CTRL_REG2,
- CLIENT_STATUS,
- HOST_STATUS
-};
+enum pi3usb9201_reg_t { CTRL_REG1, CTRL_REG2, CLIENT_STATUS, HOST_STATUS };
enum pi3usb9201_dat_t {
- POWER_DOWN = 0x0,
- SDP_HOST_MODE = 0x2,
- DCP_HOST_MODE = 0x4,
- CDP_HOST_MODE = 0x6,
- CLIENT_MODE = 0x8,
- USB_PATH_ON = 0xe
+ POWER_DOWN = 0x0,
+ SDP_HOST_MODE = 0x2,
+ DCP_HOST_MODE = 0x4,
+ CDP_HOST_MODE = 0x6,
+ CLIENT_MODE = 0x8,
+ USB_PATH_ON = 0xe
};
-
/* Client Status bits */
-#define CS_DCP BIT(7)
-#define CS_SDP BIT(6)
-#define CS_CDP BIT(5)
-#define CS_1A_CHARGER BIT(3)
-#define CS_2A_CHARGER BIT(2)
-#define CS_2_4A_CHARGER BIT(1)
+#define CS_DCP BIT(7)
+#define CS_SDP BIT(6)
+#define CS_CDP BIT(5)
+#define CS_1A_CHARGER BIT(3)
+#define CS_2A_CHARGER BIT(2)
+#define CS_2_4A_CHARGER BIT(1)
/* Host Status bits */
-#define HS_USB_UNPLUGGED BIT(2)
-#define HS_USB_PLUGGED BIT(1)
-#define HS_BC1_2 BIT(0)
+#define HS_USB_UNPLUGGED BIT(2)
+#define HS_USB_PLUGGED BIT(1)
+#define HS_BC1_2 BIT(0)
/**
* Selects Client Mode and client mode detection
diff --git a/board/servo_v4p1/usb_pd_config.h b/board/servo_v4p1/usb_pd_config.h
index 7e97d68a11..e65ed3cd62 100644
--- a/board/servo_v4p1/usb_pd_config.h
+++ b/board/servo_v4p1/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -47,26 +47,27 @@
#define CONFIG_HW_CRC
/* Servo v4 CC configuration */
-#define CC_DETACH BIT(0) /* Emulate detach: both CC open */
-#define CC_DISABLE_DTS BIT(1) /* Apply resistors to single or both CC? */
-#define CC_ALLOW_SRC BIT(2) /* Allow charge through by policy? */
-#define CC_ENABLE_DRP BIT(3) /* Enable dual-role port */
-#define CC_SNK_WITH_PD BIT(4) /* Force enabling PD comm for sink role */
-#define CC_POLARITY BIT(5) /* CC polarity */
-#define CC_EMCA_SERVO BIT(6) /*
- * Emulate Electronically Marked Cable Assembly
- * (EMCA) servo (or non-EMCA)
- */
-#define CC_FASTBOOT_DFP BIT(7) /* Allow mux uServo->Fastboot on DFP */
+#define CC_DETACH BIT(0) /* Emulate detach: both CC open */
+#define CC_DISABLE_DTS BIT(1) /* Apply resistors to single or both CC? */
+#define CC_ALLOW_SRC BIT(2) /* Allow charge through by policy? */
+#define CC_ENABLE_DRP BIT(3) /* Enable dual-role port */
+#define CC_SNK_WITH_PD BIT(4) /* Force enabling PD comm for sink role */
+#define CC_POLARITY BIT(5) /* CC polarity */
+#define CC_EMCA_SERVO \
+ BIT(6) /* \
+ * Emulate Electronically Marked Cable Assembly \
+ * (EMCA) servo (or non-EMCA) \
+ */
+#define CC_FASTBOOT_DFP BIT(7) /* Allow mux uServo->Fastboot on DFP */
/* Servo v4 DP alt-mode configuration */
-#define ALT_DP_ENABLE BIT(0) /* Enable DP alt-mode or not */
-#define ALT_DP_PIN_C BIT(1) /* Pin assignment C supported */
-#define ALT_DP_PIN_D BIT(2) /* Pin assignment D supported */
-#define ALT_DP_MF_PREF BIT(3) /* Multi-Function preferred */
-#define ALT_DP_PLUG BIT(4) /* Plug or receptacle */
-#define ALT_DP_OVERRIDE_HPD BIT(5) /* Override the HPD signal */
-#define ALT_DP_HPD_LVL BIT(6) /* HPD level if overridden */
+#define ALT_DP_ENABLE BIT(0) /* Enable DP alt-mode or not */
+#define ALT_DP_PIN_C BIT(1) /* Pin assignment C supported */
+#define ALT_DP_PIN_D BIT(2) /* Pin assignment D supported */
+#define ALT_DP_MF_PREF BIT(3) /* Multi-Function preferred */
+#define ALT_DP_PLUG BIT(4) /* Plug or receptacle */
+#define ALT_DP_OVERRIDE_HPD BIT(5) /* Override the HPD signal */
+#define ALT_DP_HPD_LVL BIT(6) /* HPD level if overridden */
/* TX uses SPI1 on PB3-4 for CHG port, SPI2 on PB 13-14 for DUT port */
#define SPI_REGS(p) ((p) ? STM32_SPI2_REGS : STM32_SPI1_REGS)
@@ -89,14 +90,14 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) ((p) ? TIM_TX_CCR_DUT : TIM_TX_CCR_CHG)
#define TIM_RX_CCR_IDX(p) ((p) ? TIM_RX_CCR_DUT : TIM_RX_CCR_CHG)
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
/*
* EXTI line 21 is connected to the CMP1 output,
* EXTI line 22 is connected to the CMP2 output,
* CHG uses CMP2, and DUT uses CMP1.
*/
-#define EXTI_COMP_MASK(p) ((p) ? (1<<21) : BIT(22))
+#define EXTI_COMP_MASK(p) ((p) ? (1 << 21) : BIT(22))
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -188,13 +189,25 @@ static inline void pd_select_polarity(int port, int polarity)
if (port == CHG) {
/* CHG use the right comparator inverted input for COMP2 */
STM32_COMP_CSR = (val & ~STM32_COMP_CMP2INSEL_MASK) |
- (polarity ? STM32_COMP_CMP2INSEL_INM4 /* PA4: C0_CC2 */
- : STM32_COMP_CMP2INSEL_INM6);/* PA2: C0_CC1 */
+ (polarity ?
+ STM32_COMP_CMP2INSEL_INM4 /* PA4:
+ C0_CC2
+ */
+ :
+ STM32_COMP_CMP2INSEL_INM6); /* PA2:
+ C0_CC1
+ */
} else {
/* DUT use the right comparator inverted input for COMP1 */
STM32_COMP_CSR = (val & ~STM32_COMP_CMP1INSEL_MASK) |
- (polarity ? STM32_COMP_CMP1INSEL_INM5 /* PA5: C1_CC2 */
- : STM32_COMP_CMP1INSEL_INM6);/* PA0: C1_CC1 */
+ (polarity ?
+ STM32_COMP_CMP1INSEL_INM5 /* PA5:
+ C1_CC2
+ */
+ :
+ STM32_COMP_CMP1INSEL_INM6); /* PA0:
+ C1_CC1
+ */
}
}
@@ -274,7 +287,6 @@ static inline void pd_config_init(int port, uint8_t power_role)
/* Initialize TX pins and put them in Hi-Z */
pd_tx_init();
-
}
int pd_adc_read(int port, int cc);
diff --git a/board/servo_v4p1/usb_pd_policy.c b/board/servo_v4p1/usb_pd_policy.c
index 26dc64c7d5..98d6255c29 100644
--- a/board/servo_v4p1/usb_pd_policy.c
+++ b/board/servo_v4p1/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,57 +26,59 @@
#include "usb_pd_config.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
-#define DUT_PDO_FIXED_FLAGS (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP |\
- PDO_FIXED_COMM_CAP)
+#define DUT_PDO_FIXED_FLAGS \
+ (PDO_FIXED_DUAL_ROLE | PDO_FIXED_DATA_SWAP | PDO_FIXED_COMM_CAP)
#define CHG_PDO_FIXED_FLAGS (PDO_FIXED_DATA_SWAP)
-#define VBUS_UNCHANGED(curr, pend, new) (curr == new && pend == new)
+#define VBUS_UNCHANGED(curr, pend, new) (curr == new &&pend == new)
/* Macros to config the PD role */
#define CONF_SET_CLEAR(c, set, clear) ((c | (set)) & ~(clear))
-#define CONF_SRC(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS | CC_ALLOW_SRC, \
- CC_ENABLE_DRP | CC_SNK_WITH_PD)
-#define CONF_SNK(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS, \
- CC_ALLOW_SRC | CC_ENABLE_DRP | CC_SNK_WITH_PD)
-#define CONF_PDSNK(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS | CC_SNK_WITH_PD, \
- CC_ALLOW_SRC | CC_ENABLE_DRP)
-#define CONF_DRP(c) CONF_SET_CLEAR(c, \
- CC_DISABLE_DTS | CC_ALLOW_SRC | CC_ENABLE_DRP, \
- CC_SNK_WITH_PD)
-#define CONF_SRCDTS(c) CONF_SET_CLEAR(c, \
- CC_ALLOW_SRC, \
- CC_ENABLE_DRP | CC_DISABLE_DTS | CC_SNK_WITH_PD)
-#define CONF_SNKDTS(c) CONF_SET_CLEAR(c, \
- 0, \
- CC_ALLOW_SRC | CC_ENABLE_DRP | \
- CC_DISABLE_DTS | CC_SNK_WITH_PD)
-#define CONF_PDSNKDTS(c) CONF_SET_CLEAR(c, \
- CC_SNK_WITH_PD, \
- CC_ALLOW_SRC | CC_ENABLE_DRP | CC_DISABLE_DTS)
-#define CONF_DRPDTS(c) CONF_SET_CLEAR(c, \
- CC_ALLOW_SRC | CC_ENABLE_DRP, \
- CC_DISABLE_DTS | CC_SNK_WITH_PD)
+#define CONF_SRC(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS | CC_ALLOW_SRC, \
+ CC_ENABLE_DRP | CC_SNK_WITH_PD)
+#define CONF_SNK(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP | CC_SNK_WITH_PD)
+#define CONF_PDSNK(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS | CC_SNK_WITH_PD, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP)
+#define CONF_DRP(c) \
+ CONF_SET_CLEAR(c, CC_DISABLE_DTS | CC_ALLOW_SRC | CC_ENABLE_DRP, \
+ CC_SNK_WITH_PD)
+#define CONF_SRCDTS(c) \
+ CONF_SET_CLEAR(c, CC_ALLOW_SRC, \
+ CC_ENABLE_DRP | CC_DISABLE_DTS | CC_SNK_WITH_PD)
+#define CONF_SNKDTS(c) \
+ CONF_SET_CLEAR(c, 0, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP | CC_DISABLE_DTS | \
+ CC_SNK_WITH_PD)
+#define CONF_PDSNKDTS(c) \
+ CONF_SET_CLEAR(c, CC_SNK_WITH_PD, \
+ CC_ALLOW_SRC | CC_ENABLE_DRP | CC_DISABLE_DTS)
+#define CONF_DRPDTS(c) \
+ CONF_SET_CLEAR(c, CC_ALLOW_SRC | CC_ENABLE_DRP, \
+ CC_DISABLE_DTS | CC_SNK_WITH_PD)
+#define CONF_DTSOFF(c) CONF_SET_CLEAR(c, CC_DISABLE_DTS, 0)
+#define CONF_DTSON(c) CONF_SET_CLEAR(c, 0, CC_DISABLE_DTS)
/* Macros to apply Rd/Rp to CC lines */
-#define DUT_ACTIVE_CC_SET(r, flags) \
- gpio_set_flags(cc_config & CC_POLARITY ? \
- CONCAT2(GPIO_USB_DUT_CC2_, r) : \
- CONCAT2(GPIO_USB_DUT_CC1_, r), \
+#define DUT_ACTIVE_CC_SET(r, flags) \
+ gpio_set_flags(cc_config &CC_POLARITY ? \
+ CONCAT2(GPIO_USB_DUT_CC2_, r) : \
+ CONCAT2(GPIO_USB_DUT_CC1_, r), \
flags)
-#define DUT_INACTIVE_CC_SET(r, flags) \
- gpio_set_flags(cc_config & CC_POLARITY ? \
- CONCAT2(GPIO_USB_DUT_CC1_, r) : \
- CONCAT2(GPIO_USB_DUT_CC2_, r), \
+#define DUT_INACTIVE_CC_SET(r, flags) \
+ gpio_set_flags(cc_config &CC_POLARITY ? \
+ CONCAT2(GPIO_USB_DUT_CC1_, r) : \
+ CONCAT2(GPIO_USB_DUT_CC2_, r), \
flags)
-#define DUT_BOTH_CC_SET(r, flags) \
- do { \
+#define DUT_BOTH_CC_SET(r, flags) \
+ do { \
gpio_set_flags(CONCAT2(GPIO_USB_DUT_CC1_, r), flags); \
gpio_set_flags(CONCAT2(GPIO_USB_DUT_CC2_, r), flags); \
} while (0)
@@ -98,15 +100,15 @@
* than 5V.
*/
static const uint16_t pd_src_voltages_mv[] = {
- 5000, 9000, 10000, 12000, 15000, 20000,
+ 5000, 9000, 10000, 12000, 15000, 20000,
};
static uint32_t pd_src_chg_pdo[ARRAY_SIZE(pd_src_voltages_mv)];
static uint8_t chg_pdo_cnt;
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, CHG_PDO_FIXED_FLAGS),
- PDO_BATT(4750, 21000, 15000),
- PDO_VAR(4750, 21000, 3000),
+ PDO_FIXED(5000, 500, CHG_PDO_FIXED_FLAGS),
+ PDO_BATT(4750, 21000, 15000),
+ PDO_VAR(4750, 21000, 3000),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
@@ -123,15 +125,15 @@ static int cc_config = CC_ALLOW_SRC | CC_EMCA_SERVO;
/* Voltage thresholds for no connect in DTS mode */
static int pd_src_vnc_dts[TYPEC_RP_RESERVED][2] = {
- {PD_SRC_3_0_VNC_MV, PD_SRC_1_5_VNC_MV},
- {PD_SRC_1_5_VNC_MV, PD_SRC_DEF_VNC_MV},
- {PD_SRC_3_0_VNC_MV, PD_SRC_DEF_VNC_MV},
+ { PD_SRC_3_0_VNC_MV, PD_SRC_1_5_VNC_MV },
+ { PD_SRC_1_5_VNC_MV, PD_SRC_DEF_VNC_MV },
+ { PD_SRC_3_0_VNC_MV, PD_SRC_DEF_VNC_MV },
};
/* Voltage thresholds for Ra attach in DTS mode */
static int pd_src_rd_threshold_dts[TYPEC_RP_RESERVED][2] = {
- {PD_SRC_3_0_RD_THRESH_MV, PD_SRC_1_5_RD_THRESH_MV},
- {PD_SRC_1_5_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV},
- {PD_SRC_3_0_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV},
+ { PD_SRC_3_0_RD_THRESH_MV, PD_SRC_1_5_RD_THRESH_MV },
+ { PD_SRC_1_5_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV },
+ { PD_SRC_3_0_RD_THRESH_MV, PD_SRC_DEF_RD_THRESH_MV },
};
/* Voltage thresholds for no connect in normal SRC mode */
static int pd_src_vnc[TYPEC_RP_RESERVED] = {
@@ -291,8 +293,8 @@ static void update_ports(void)
break;
/* Find the 'best' PDO <= voltage */
- pdo_index =
- pd_find_pdo_index(pd_get_src_cap_cnt(CHG),
+ pdo_index = pd_find_pdo_index(
+ pd_get_src_cap_cnt(CHG),
pd_get_src_caps(CHG),
pd_src_voltages_mv[i], &pdo);
/* Don't duplicate PDOs */
@@ -315,9 +317,9 @@ static void update_ports(void)
} else {
/* 5V PDO */
pd_src_chg_pdo[0] = PDO_FIXED_VOLT(PD_MIN_MV) |
- PDO_FIXED_CURR(vbus[CHG].ma) |
- DUT_PDO_FIXED_FLAGS |
- PDO_FIXED_UNCONSTRAINED;
+ PDO_FIXED_CURR(vbus[CHG].ma) |
+ DUT_PDO_FIXED_FLAGS |
+ PDO_FIXED_UNCONSTRAINED;
chg_pdo_cnt = 1;
}
@@ -342,8 +344,8 @@ int board_set_active_charge_port(int charge_port)
return 0;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
if (port != CHG)
return;
@@ -389,8 +391,9 @@ int pd_tcpc_cc_nc(int port, int cc_volt, int cc_sel)
if (cc_config & CC_DISABLE_DTS)
nc = cc_volt >= pd_src_vnc[rp_index];
else
- nc = cc_volt >= pd_src_vnc_dts[rp_index][
- cc_config & CC_POLARITY ? !cc_sel : cc_sel];
+ nc = cc_volt >=
+ pd_src_vnc_dts[rp_index]
+ [cc_config & CC_POLARITY ? !cc_sel : cc_sel];
return nc;
}
@@ -416,8 +419,10 @@ int pd_tcpc_cc_ra(int port, int cc_volt, int cc_sel)
if (cc_config & CC_DISABLE_DTS)
ra = cc_volt < pd_src_rd_threshold[rp_index];
else
- ra = cc_volt < pd_src_rd_threshold_dts[rp_index][
- cc_config & CC_POLARITY ? !cc_sel : cc_sel];
+ ra = cc_volt <
+ pd_src_rd_threshold_dts[rp_index]
+ [cc_config & CC_POLARITY ? !cc_sel :
+ cc_sel];
return ra;
}
@@ -459,13 +464,11 @@ int pd_adc_read(int port, int cc)
*
* This is basically a hack faking "vOpen" from TCPCI spec.
*/
- if ((cc_config & CC_DISABLE_DTS) &&
- port == DUT &&
+ if ((cc_config & CC_DISABLE_DTS) && port == DUT &&
cc == ((cc_config & CC_POLARITY) ? 0 : 1)) {
-
- if ((cc_pull_stored == TYPEC_CC_RD) ||
- (cc_pull_stored == TYPEC_CC_RA) ||
- (cc_pull_stored == TYPEC_CC_RA_RD))
+ if ((cc_pull_stored == TYPEC_CC_RD) ||
+ (cc_pull_stored == TYPEC_CC_RA) ||
+ (cc_pull_stored == TYPEC_CC_RA_RD))
mv = -1;
else if (cc_pull_stored == TYPEC_CC_RP)
mv = 3301;
@@ -594,7 +597,7 @@ int pd_set_rp_rd(int port, int cc_pull, int rp_value)
if (cc_pull == TYPEC_CC_RP) {
rv = board_set_rp(rp_value);
} else if ((cc_pull == TYPEC_CC_RD) || (cc_pull == TYPEC_CC_RA_RD) ||
- (cc_pull == TYPEC_CC_RA)) {
+ (cc_pull == TYPEC_CC_RA)) {
/*
* The DUT port uses a captive cable. It can present Rd on both
* CC1 and CC2. If DTS mode is enabled, then present Rd on both
@@ -673,7 +676,7 @@ int charge_manager_get_source_pdo(const uint32_t **src_pdo, const int port)
* port, otherwise we provide no power.
*/
if (charge_port_is_active()) {
- *src_pdo = pd_src_chg_pdo;
+ *src_pdo = pd_src_chg_pdo;
pdo_cnt = chg_pdo_cnt;
}
@@ -697,8 +700,7 @@ __override void pd_transition_voltage(int idx)
/* Wait for CHG transition */
deadline.val = get_time().val + PD_T_PS_TRANSITION;
CPRINTS("Waiting for CHG port transition");
- while (charge_port_is_active() &&
- vbus[CHG].mv != mv &&
+ while (charge_port_is_active() && vbus[CHG].mv != mv &&
get_time().val < deadline.val)
msleep(10);
@@ -760,8 +762,7 @@ void pd_power_supply_reset(int port)
int pd_snk_is_vbus_provided(int port)
{
- return gpio_get_level(port ? GPIO_USB_DET_PP_DUT :
- GPIO_USB_DET_PP_CHG);
+ return gpio_get_level(port ? GPIO_USB_DET_PP_DUT : GPIO_USB_DET_PP_CHG);
}
__override int pd_check_power_swap(int port)
@@ -778,7 +779,8 @@ __override int pd_check_power_swap(int port)
if (port == CHG)
return 0;
- if (pd_get_power_role(port) == PD_ROLE_SINK && !(cc_config & CC_ALLOW_SRC))
+ if (pd_get_power_role(port) == PD_ROLE_SINK &&
+ !(cc_config & CC_ALLOW_SRC))
return 0;
if (pd_snk_is_vbus_provided(CHG))
@@ -787,8 +789,7 @@ __override int pd_check_power_swap(int port)
return 0;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/*
* Servo should allow data role swaps to let DUT see the USB hub, but
@@ -800,8 +801,7 @@ __override int pd_check_data_swap(int port,
return allow_dr_swap;
}
-__override void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+__override void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
if (port == CHG)
return;
@@ -838,12 +838,12 @@ __override void pd_execute_data_swap(int port,
uservo_to_host();
break;
default:
- CPRINTS("C%d: %s: Invalid data_role:%d", port, __func__, data_role);
+ CPRINTS("C%d: %s: Invalid data_role:%d", port, __func__,
+ data_role);
}
}
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
/*
@@ -854,9 +854,7 @@ __override void pd_check_pr_role(int port,
*/
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
if (port == CHG)
return;
@@ -866,15 +864,14 @@ __override void pd_check_dr_role(int port,
pd_request_data_swap(port);
}
-
/* ----------------- Vendor Defined Messages ------------------ */
/*
* DP alt-mode config, user configurable.
* Default is the mode disabled, supporting the C and D pin assignment,
* multi-function preferred, and a plug.
*/
-static int alt_dp_config = (ALT_DP_PIN_C | ALT_DP_PIN_D | ALT_DP_MF_PREF |
- ALT_DP_PLUG);
+static int alt_dp_config =
+ (ALT_DP_PIN_C | ALT_DP_PIN_D | ALT_DP_MF_PREF | ALT_DP_PLUG);
/**
* Get the pins based on the user config.
@@ -907,8 +904,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
- CONFIG_USB_PD_IDENTITY_SW_VERS,
- 0, 0, 0, 0, /* SS[TR][12] */
+ CONFIG_USB_PD_IDENTITY_SW_VERS, 0, 0, 0,
+ 0, /* SS[TR][12] */
0, /* Vconn power */
0, /* Vconn power required */
0, /* Vbus power required */
@@ -946,13 +943,13 @@ uint32_t vdo_dp_mode[MODE_CNT];
static int svdm_response_modes(int port, uint32_t *payload)
{
- vdo_dp_mode[0] =
- VDO_MODE_DP(0, /* UFP pin cfg supported: none */
- alt_dp_config_pins(), /* DFP pin */
- 1, /* no usb2.0 signalling in AMode */
- alt_dp_config_cable(), /* plug or receptacle */
- MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
- MODE_DP_SNK); /* Its a sink only */
+ vdo_dp_mode[0] = VDO_MODE_DP(0, /* UFP pin cfg supported: none */
+ alt_dp_config_pins(), /* DFP pin */
+ 1, /* no usb2.0 signalling in AMode */
+ alt_dp_config_cable(), /* plug or
+ receptacle */
+ MODE_DP_V13, /* DPv1.3 Support, no Gen2 */
+ MODE_DP_SNK); /* Its a sink only */
/* CCD uses the SBU lines; don't enable DP when dts-mode enabled */
if (!(cc_config & CC_DISABLE_DTS))
@@ -1007,17 +1004,18 @@ static int dp_status(int port, uint32_t *payload)
int dp_enabled = !!(state & USB_PD_MUX_DP_ENABLED);
if (opos != OPOS)
- return 0; /* NAK */
-
- payload[1] = VDO_DP_STATUS(
- 0, /* IRQ_HPD */
- hpd, /* HPD_HI|LOW */
- 0, /* request exit DP */
- 0, /* request exit USB */
- (alt_dp_config & ALT_DP_MF_PREF) != 0, /* MF pref */
- dp_enabled,
- 0, /* power low */
- hpd ? 0x2 : 0);
+ return 0; /* NAK */
+
+ payload[1] =
+ VDO_DP_STATUS(0, /* IRQ_HPD */
+ hpd, /* HPD_HI|LOW */
+ 0, /* request exit DP */
+ 0, /* request exit USB */
+ (alt_dp_config & ALT_DP_MF_PREF) != 0, /* MF
+ pref
+ */
+ dp_enabled, 0, /* power low */
+ hpd ? 0x2 : 0);
return 2;
}
@@ -1038,7 +1036,7 @@ static int svdm_enter_mode(int port, uint32_t *payload)
/* SID & mode request is valid */
if ((PD_VDO_VID(payload[0]) != USB_SID_DISPLAYPORT) ||
(PD_VDO_OPOS(payload[0]) != OPOS))
- return 0; /* NAK */
+ return 0; /* NAK */
alt_mode = OPOS;
return 1;
@@ -1080,7 +1078,7 @@ const struct svdm_response svdm_rsp = {
};
__override int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+ uint32_t **rpayload)
{
int cmd = PD_VDO_CMD(payload[0]);
@@ -1092,7 +1090,7 @@ __override int pd_custom_vdm(int port, int cnt, uint32_t *payload,
case VDO_CMD_VERSION:
/* guarantee last byte of payload is null character */
*(payload + cnt - 1) = 0;
- CPRINTF("ver: %s\n", (char *)(payload+1));
+ CPRINTF("ver: %s\n", (char *)(payload + 1));
break;
case VDO_CMD_CURRENT:
CPRINTF("Current: %dmA\n", payload[1]);
@@ -1110,18 +1108,15 @@ static void print_cc_mode(void)
/* Get current CCD status */
ccprintf("cc: %s\n", cc_config & CC_DETACH ? "off" : "on");
ccprintf("dts mode: %s\n", cc_config & CC_DISABLE_DTS ? "off" : "on");
- ccprintf("chg mode: %s\n",
- get_dut_chg_en() ? "on" : "off");
+ ccprintf("chg mode: %s\n", get_dut_chg_en() ? "on" : "off");
ccprintf("chg allowed: %s\n", cc_config & CC_ALLOW_SRC ? "on" : "off");
ccprintf("drp enabled: %s\n", cc_config & CC_ENABLE_DRP ? "on" : "off");
- ccprintf("cc polarity: %s\n", cc_config & CC_POLARITY ? "cc2" :
- "cc1");
+ ccprintf("cc polarity: %s\n", cc_config & CC_POLARITY ? "cc2" : "cc1");
ccprintf("pd enabled: %s\n", pd_comm_is_enabled(DUT) ? "on" : "off");
- ccprintf("emca: %s\n", cc_config & CC_EMCA_SERVO ?
- "emarked" : "non-emarked");
+ ccprintf("emca: %s\n",
+ cc_config & CC_EMCA_SERVO ? "emarked" : "non-emarked");
}
-
static void do_cc(int cc_config_new)
{
int chargeable;
@@ -1192,7 +1187,7 @@ static void do_cc(int cc_config_new)
}
}
-static int command_cc(int argc, char **argv)
+static int command_cc(int argc, const char **argv)
{
int cc_config_new = cc_config;
@@ -1223,6 +1218,10 @@ static int command_cc(int argc, char **argv)
cc_config_new = CONF_PDSNKDTS(cc_config_new);
else if (!strcasecmp(argv[1], "drpdts"))
cc_config_new = CONF_DRPDTS(cc_config_new);
+ else if (!strcasecmp(argv[1], "dtsoff"))
+ cc_config_new = CONF_DTSOFF(cc_config_new);
+ else if (!strcasecmp(argv[1], "dtson"))
+ cc_config_new = CONF_DTSON(cc_config_new);
else if (!strcasecmp(argv[1], "emca"))
cc_config_new |= CC_EMCA_SERVO;
else if (!strcasecmp(argv[1], "nonemca"))
@@ -1245,7 +1244,7 @@ static int command_cc(int argc, char **argv)
}
DECLARE_CONSOLE_COMMAND(cc, command_cc,
"[off|on|src|snk|pdsnk|drp|srcdts|snkdts|pdsnkdts|"
- "drpdts|emca|nonemca] [cc1|cc2]",
+ "drpdts|dtsoff|dtson|emca|nonemca] [cc1|cc2]",
"Servo_v4 DTS and CHG mode");
static void fake_disconnect_end(void)
@@ -1265,7 +1264,7 @@ static void fake_disconnect_start(void)
}
DECLARE_DEFERRED(fake_disconnect_start);
-static int cmd_fake_disconnect(int argc, char *argv[])
+static int cmd_fake_disconnect(int argc, const char *argv[])
{
int delay_ms, duration_ms;
char *e;
@@ -1287,18 +1286,18 @@ static int cmd_fake_disconnect(int argc, char *argv[])
fake_pd_disconnect_duration_us = duration_ms * MSEC;
hook_call_deferred(&fake_disconnect_start_data, delay_ms * MSEC);
- ccprintf("Fake disconnect for %d ms starting in %d ms.\n",
- duration_ms, delay_ms);
+ ccprintf("Fake disconnect for %d ms starting in %d ms.\n", duration_ms,
+ delay_ms);
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(fakedisconnect, cmd_fake_disconnect,
"<delay_ms> <duration_ms>", NULL);
-static int cmd_ada_srccaps(int argc, char *argv[])
+static int cmd_ada_srccaps(int argc, const char *argv[])
{
int i;
- const uint32_t * const ada_srccaps = pd_get_src_caps(CHG);
+ const uint32_t *const ada_srccaps = pd_get_src_caps(CHG);
for (i = 0; i < pd_get_src_cap_cnt(CHG); ++i) {
uint32_t max_ma, max_mv, unused;
@@ -1314,11 +1313,10 @@ static int cmd_ada_srccaps(int argc, char *argv[])
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(ada_srccaps, cmd_ada_srccaps,
- "",
+DECLARE_CONSOLE_COMMAND(ada_srccaps, cmd_ada_srccaps, "",
"Print adapter SrcCap");
-static int cmd_dp_action(int argc, char *argv[])
+static int cmd_dp_action(int argc, const char *argv[])
{
int i;
char *e;
@@ -1354,8 +1352,7 @@ static int cmd_dp_action(int argc, char *argv[])
}
}
}
- CPRINTS("Pins: %s%s",
- (alt_dp_config & ALT_DP_PIN_C) ? "C" : "",
+ CPRINTS("Pins: %s%s", (alt_dp_config & ALT_DP_PIN_C) ? "C" : "",
(alt_dp_config & ALT_DP_PIN_D) ? "D" : "");
} else if (!strcasecmp(argv[1], "mf")) {
if (argc >= 3) {
@@ -1405,10 +1402,10 @@ static int cmd_dp_action(int argc, char *argv[])
}
}
CPRINTS("HPD source: %s",
- (alt_dp_config & ALT_DP_OVERRIDE_HPD) ? "overridden"
- : "external");
+ (alt_dp_config & ALT_DP_OVERRIDE_HPD) ? "overridden" :
+ "external");
CPRINTS("HPD level: %d", get_hpd_level());
- } else if (!strcasecmp(argv[1], "help")) {
+ } else if (!strcasecmp(argv[1], "help")) {
CPRINTS("Usage: usbc_action dp [enable|disable|hpd|mf|pins|"
"plug]");
}
@@ -1416,7 +1413,7 @@ static int cmd_dp_action(int argc, char *argv[])
return EC_SUCCESS;
}
-static int cmd_usbc_action(int argc, char *argv[])
+static int cmd_usbc_action(int argc, const char *argv[])
{
if (argc >= 2 && !strcasecmp(argv[1], "dp"))
return cmd_dp_action(argc - 1, &argv[1]);
diff --git a/board/servo_v4p1/usb_sm.c b/board/servo_v4p1/usb_sm.c
index 94b5e0c08d..4c448b7c9d 100644
--- a/board/servo_v4p1/usb_sm.c
+++ b/board/servo_v4p1/usb_sm.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "util.h"
#ifdef CONFIG_COMMON_RUNTIME
-#define CPRINTF(format, args...) cprintf(CC_USB, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USB, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USB, format, ##args)
#else /* CONFIG_COMMON_RUNTIME */
#define CPRINTF(format, args...)
#define CPRINTS(format, args...)
@@ -22,8 +22,8 @@
struct internal_ctx {
usb_state_ptr last_entered;
uint32_t running : 1;
- uint32_t enter : 1;
- uint32_t exit : 1;
+ uint32_t enter : 1;
+ uint32_t exit : 1;
};
BUILD_ASSERT(sizeof(struct internal_ctx) ==
member_size(struct sm_ctx, internal));
@@ -64,9 +64,9 @@ static usb_state_ptr shared_parent_state(usb_state_ptr a, usb_state_ptr b)
* functions.
*/
static void call_entry_functions(const int port,
- struct internal_ctx *const internal,
- const usb_state_ptr stop,
- const usb_state_ptr current)
+ struct internal_ctx *const internal,
+ const usb_state_ptr stop,
+ const usb_state_ptr current)
{
if (current == stop)
return;
@@ -91,7 +91,7 @@ static void call_entry_functions(const int port,
* during an exit function.
*/
static void call_exit_functions(const int port, const usb_state_ptr stop,
- const usb_state_ptr current)
+ const usb_state_ptr current)
{
if (current == stop)
return;
@@ -105,7 +105,7 @@ static void call_exit_functions(const int port, const usb_state_ptr stop,
void set_state(const int port, struct sm_ctx *const ctx,
const usb_state_ptr new_state)
{
- struct internal_ctx * const internal = (void *) ctx->internal;
+ struct internal_ctx *const internal = (void *)ctx->internal;
usb_state_ptr last_state;
usb_state_ptr shared_parent;
@@ -115,8 +115,8 @@ void set_state(const int port, struct sm_ctx *const ctx,
* intended state to transition into.
*/
if (internal->exit) {
- CPRINTF("C%d: Ignoring set state to 0x%pP within 0x%pP",
- port, new_state, ctx->current);
+ CPRINTF("C%d: Ignoring set state to 0x%p within 0x%p", port,
+ new_state, ctx->current);
return;
}
@@ -167,8 +167,8 @@ void set_state(const int port, struct sm_ctx *const ctx,
* functions.
*/
static void call_run_functions(const int port,
- const struct internal_ctx *const internal,
- const usb_state_ptr current)
+ const struct internal_ctx *const internal,
+ const usb_state_ptr current)
{
if (!current)
return;
@@ -185,7 +185,7 @@ static void call_run_functions(const int port,
void run_state(const int port, struct sm_ctx *const ctx)
{
- struct internal_ctx * const internal = (void *) ctx->internal;
+ struct internal_ctx *const internal = (void *)ctx->internal;
internal->running = true;
call_run_functions(port, internal, ctx->current);
diff --git a/board/servo_v4p1/usb_tc_snk_sm.c b/board/servo_v4p1/usb_tc_snk_sm.c
index 95586943bf..d76c2fe24f 100644
--- a/board/servo_v4p1/usb_tc_snk_sm.c
+++ b/board/servo_v4p1/usb_tc_snk_sm.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,15 +14,15 @@
#include "usb_sm.h"
#include "usb_tc_sm.h"
-#define EVT_TIMEOUT_NEVER (-1)
-#define EVT_TIMEOUT_5MS (5 * MSEC)
+#define EVT_TIMEOUT_NEVER (-1)
+#define EVT_TIMEOUT_5MS (5 * MSEC)
/*
* USB Type-C Sink
* See Figure 4-13 in Release 1.4 of USB Type-C Spec.
*/
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* Type-C Layer Flags */
@@ -36,9 +36,9 @@ enum usb_tc_state {
static const struct usb_state tc_states[];
/* TypeC Power strings */
-static const char * const pwr2_5_str = "5V/0.5A";
-static const char * const pwr7_5_str = "5V/1.5A";
-static const char * const pwr15_str = "5V/3A";
+static const char *const pwr2_5_str = "5V/0.5A";
+static const char *const pwr7_5_str = "5V/1.5A";
+static const char *const pwr15_str = "5V/3A";
static struct type_c {
/* state machine context */
@@ -101,8 +101,8 @@ static void print_alt_power(void)
char const *pwr;
cc = tc.polarity ? tc.cc2 : tc.cc1;
- if (cc == TYPEC_CC_VOLT_OPEN ||
- cc == TYPEC_CC_VOLT_RA || cc == TYPEC_CC_VOLT_RD) {
+ if (cc == TYPEC_CC_VOLT_OPEN || cc == TYPEC_CC_VOLT_RA ||
+ cc == TYPEC_CC_VOLT_RD) {
/* Supply removed or not detected */
return;
}
diff --git a/board/shotzo/battery.c b/board/shotzo/battery.c
deleted file mode 100644
index f71533accf..0000000000
--- a/board/shotzo/battery.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* Copyright 2022 The ChromiumOS Authors.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- *
- * Battery pack vendor provided charging profile
- */
-
-#include "battery_fuel_gauge.h"
-#include "charge_state.h"
-#include "common.h"
-
-/*
- * Battery info for all shotzo battery types. Note that the fields
- * start_charging_min/max and charging_min/max are not used for the charger.
- * The effective temperature limits are given by discharging_min/max_c.
- *
- * Fuel Gauge (FG) parameters which are used for determining if the battery
- * is connected, the appropriate ship mode (battery cutoff) command, and the
- * charge/discharge FETs status.
- *
- * Ship mode (battery cutoff) requires 2 writes to the appropriate smart battery
- * register. For some batteries, the charge/discharge FET bits are set when
- * charging/discharging is active, in other types, these bits set mean that
- * charging/discharging is disabled. Therefore, in addition to the mask for
- * these bits, a disconnect value must be specified. Note that for TI fuel
- * gauge, the charge/discharge FET status is found in Operation Status (0x54),
- * but a read of Manufacturer Access (0x00) will return the lower 16 bits of
- * Operation status which contains the FET status bits.
- *
- * The assumption for battery types supported is that the charge/discharge FET
- * status can be read with a sb_read() command and therefore, only the register
- * address, mask, and disconnect value need to be provided.
- */
-const struct board_batt_params board_battery_info[] = {
- /* DynaPack CosMX Battery Information */
- [BATTERY_DYNAPACK_COS] = {
- .fuel_gauge = {
- .manuf_name = "333-2C-DA-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* DynaPack ATL Battery Information */
- [BATTERY_DYNAPACK_ATL] = {
- .fuel_gauge = {
- .manuf_name = "333-27-DA-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* DynaPack HIGHPOWER Battery Information */
- [BATTERY_DYNAPACK_HIGHPOWER] = {
- .fuel_gauge = {
- .manuf_name = "333-2D-0D-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* DynaPack BYD Battery Information */
- [BATTERY_DYNAPACK_BYD] = {
- .fuel_gauge = {
- .manuf_name = "333-2E-0D-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* Samsung SDI Battery Information */
- [BATTERY_SAMSUNG_SDI] = {
- .fuel_gauge = {
- .manuf_name = "333-54-DA-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* Simplo CosMX Battery Information */
- [BATTERY_SIMPLO_COS] = {
- .fuel_gauge = {
- .manuf_name = "333-1C-DA-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* Simplo HIGHPOWER Battery Information */
- [BATTERY_SIMPLO_HIGHPOWER] = {
- .fuel_gauge = {
- .manuf_name = "333-1D-DA-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* CosMX Battery Information */
- [BATTERY_COS] = {
- .fuel_gauge = {
- .manuf_name = "333-AC-0D-A",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* CosMX B00C4473A9D0002 Battery Information */
- [BATTERY_COS_2] = {
- .fuel_gauge = {
- .manuf_name = "333-AC-DA-A",
- .ship_mode = {
- .reg_addr = 0x0,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 1,
- .reg_addr = 0x0,
- .reg_mask = 0x0006,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0004,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700, /* mV */
- .voltage_min = 6000, /* mV */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-
- /* ATL GB-S20-4473A9-01H&020H Battery Information
- * Gauge IC : RAJ240045
- */
- [BATTERY_ATL] = {
- .fuel_gauge = {
- .manuf_name = "313-B7-0D-A",
- .ship_mode = {
- .reg_addr = 0x0,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
- .mfgacc_support = 0,
- .reg_addr = 0x43,
- .reg_mask = 0x0003,
- .disconnect_val = 0x0,
- .cfet_mask = 0x0002,
- .cfet_off_val = 0x0,
- },
- },
- .batt_info = {
- .voltage_max = 8800, /* mV */
- .voltage_normal = 7700, /* mV */
- .voltage_min = 6000, /* mV */
- .precharge_current = 256, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 45,
- .discharging_min_c = -10,
- .discharging_max_c = 60,
- },
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_DYNAPACK_COS;
diff --git a/board/shotzo/board.c b/board/shotzo/board.c
index a7cd45c7c6..dea75ee7d2 100644
--- a/board/shotzo/board.c
+++ b/board/shotzo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,16 +8,12 @@
#include "adc_chip.h"
#include "button.h"
#include "cbi_fw_config.h"
-#include "cbi_ssfc.h"
#include "charge_manager.h"
#include "charge_state_v2.h"
#include "charger.h"
#include "cros_board_info.h"
-#include "driver/accel_bma2x2.h"
-#include "driver/accel_bma422.h"
-#include "driver/accelgyro_lsm6dsm.h"
-#include "driver/bc12/pi3usb9201.h"
#include "driver/charger/sm5803.h"
+#include "driver/led/oz554.h"
#include "driver/temp_sensor/thermistor.h"
#include "driver/tcpm/it83xx_pd.h"
#include "driver/tcpm/ps8xxx.h"
@@ -25,25 +21,19 @@
#include "gpio.h"
#include "hooks.h"
#include "intc.h"
-#include "keyboard_scan.h"
-#include "lid_switch.h"
#include "power.h"
#include "power_button.h"
-#include "pwm.h"
-#include "pwm_chip.h"
#include "switch.h"
#include "system.h"
-#include "tablet_mode.h"
#include "task.h"
#include "tcpm/tcpci.h"
#include "temp_sensor.h"
#include "uart.h"
-#include "usb_charge.h"
#include "usb_mux.h"
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -54,28 +44,12 @@ const int usb_port_enable[USB_PORT_COUNT] = {
GPIO_EN_USB_A_5V,
};
-__override void board_process_pd_alert(int port)
-{
- /*
- * PD_INT task will process this alert, and that task is only needed on
- * C1.
- */
- if (port != 1)
- return;
-
- if (gpio_get_level(GPIO_USB_C1_INT_ODL))
- return;
-
- sm5803_handle_interrupt(port);
-}
-
-/* C0 interrupt line shared by BC 1.2 and charger */
+/* C0 interrupt line triggered by charger */
static void check_c0_line(void);
DECLARE_DEFERRED(check_c0_line);
static void notify_c0_chips(void)
{
- usb_charger_task_set_event(0, USB_CHG_EVENT_BC12);
sm5803_interrupt(0);
}
@@ -103,337 +77,196 @@ static void usb_c0_interrupt(enum gpio_signal s)
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
}
-/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
-static void check_c1_line(void);
-DECLARE_DEFERRED(check_c1_line);
-
-static void notify_c1_chips(void)
+static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
{
- schedule_deferred_pd_interrupt(1);
- usb_charger_task_set_event(1, USB_CHG_EVENT_BC12);
+ cprints(CC_USBPD, "C0: CC OVP, SBU OVP, or thermal event");
+ pd_handle_cc_overvoltage(0);
}
-static void check_c1_line(void)
-{
- /*
- * If line is still being held low, see if there's more to process from
- * one of the chips.
- */
- if (!gpio_get_level(GPIO_USB_C1_INT_ODL)) {
- notify_c1_chips();
- hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
- }
-}
+/******************************************************************************/
+/*
+ * Barrel jack power supply handling
+ *
+ * EN_PPVAR_BJ_ADP_L must default active to ensure we can power on when the
+ * barrel jack is connected, and the USB-C port can bring the EC up fine in
+ * dead-battery mode. Both the USB-C and barrel jack switches do reverse
+ * protection, so we're safe to turn one on then the other off- but we should
+ * only do that if the system is off since it might still brown out.
+ */
-static void usb_c1_interrupt(enum gpio_signal s)
+static int barrel_jack_adapter_is_present(void)
{
- /* Cancel any previous calls to check the interrupt line */
- hook_call_deferred(&check_c1_line_data, -1);
+ /* Shotzo barrel jack adapter present pin is active low. */
+ return !gpio_get_level(GPIO_BJ_ADP_PRESENT_L);
+}
- /* Notify all chips using this line that an interrupt came in */
- notify_c1_chips();
+/*
+ * Barrel-jack power adapter ratings.
+ */
- /* Check the line again in 5ms */
- hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
-}
+#define BJ_ADP_RATING_DEFAULT 0 /* BJ power ratings default */
+static const struct {
+ int voltage;
+ int current;
+} bj_power[] = {
+ { /* 0 - 90W (also default) */
+ .voltage = 19500,
+ .current = 4500 },
+};
-static void board_enable_hdmi_hpd(int enable)
+/* Debounced connection state of the barrel jack */
+static int8_t adp_connected = -1;
+static void adp_connect_deferred(void)
{
- enum fw_config_db db = get_cbi_fw_config_db();
- int hdmi_hpd = gpio_get_level(GPIO_VOLUP_BTN_ODL_HDMI_HPD);
-
- if (db == DB_1A_HDMI || db == DB_LTE_HDMI || db == DB_1A_HDMI_LTE) {
- /* Check if we can report HDMI_HPD signal to CPU */
- if (enable)
- gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, hdmi_hpd);
- else
- gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, 0);
+ struct charge_port_info pi = { 0 };
+ int connected = barrel_jack_adapter_is_present();
+
+ /* Debounce */
+ if (connected == adp_connected)
+ return;
+ if (connected) {
+ unsigned int bj = BJ_ADP_RATING_DEFAULT;
+
+ pi.voltage = bj_power[bj].voltage;
+ pi.current = bj_power[bj].current;
}
+ charge_manager_update_charge(CHARGE_SUPPLIER_DEDICATED,
+ DEDICATED_CHARGE_PORT, &pi);
+ adp_connected = connected;
}
+DECLARE_DEFERRED(adp_connect_deferred);
-static void button_sub_hdmi_hpd_interrupt(enum gpio_signal s)
+#define ADP_DEBOUNCE_MS 1000 /* Debounce time for BJ plug/unplug */
+/* IRQ for BJ plug/unplug. It shouldn't be called if BJ is the power source. */
+static void adp_connect_interrupt(enum gpio_signal signal)
{
- enum fw_config_db db = get_cbi_fw_config_db();
- int hdmi_hpd = gpio_get_level(GPIO_VOLUP_BTN_ODL_HDMI_HPD);
-
- if (db == DB_1A_HDMI || db == DB_LTE_HDMI || db == DB_1A_HDMI_LTE) {
- /* Do not report HDMI_HPD signal to CPU when system off. */
- if (!chipset_in_state(CHIPSET_STATE_ANY_OFF))
- gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, hdmi_hpd);
- } else
- button_interrupt(s);
+ hook_call_deferred(&adp_connect_deferred_data, ADP_DEBOUNCE_MS * MSEC);
}
-
-static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
+static void adp_state_init(void)
{
- cprints(CC_USBPD, "C0: CC OVP, SBU OVP, or thermal event");
- pd_handle_cc_overvoltage(0);
-}
-
-static void pen_detect_interrupt(enum gpio_signal s)
-{
- int pen_detect = !gpio_get_level(GPIO_PEN_DET_ODL);
+ /*
+ * Initialize all charge suppliers to 0. The charge manager waits until
+ * all ports have reported in before doing anything.
+ */
+ for (int i = 0; i < CHARGE_PORT_COUNT; i++) {
+ for (int j = 0; j < CHARGE_SUPPLIER_COUNT; j++)
+ charge_manager_update_charge(j, i, NULL);
+ }
- gpio_set_level(GPIO_EN_PP5000_PEN, pen_detect);
+ /* Report charge state from the barrel jack. */
+ adp_connect_deferred();
}
+DECLARE_HOOK(HOOK_INIT, adp_state_init, HOOK_PRIO_INIT_CHARGE_MANAGER + 1);
/* Must come after other header files and interrupt handler declarations */
#include "gpio_list.h"
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
- [ADC_TEMP_SENSOR_4] = {
- .name = "TEMP_SENSOR4",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH16
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
+ [ADC_TEMP_SENSOR_4] = { .name = "TEMP_SENSOR4",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH16 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-/* BC 1.2 chips */
-const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = {
- {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- .flags = PI3USB9201_ALWAYS_POWERED,
- },
- {
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PI3USB9201_I2C_ADDR_3_FLAGS,
- .flags = PI3USB9201_ALWAYS_POWERED,
- },
-};
-
/* Charger chips */
-const struct charger_config_t chg_chips[] = {
- [CHARGER_PRIMARY] = {
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = SM5803_ADDR_CHARGER_FLAGS,
- .drv = &sm5803_drv,
- },
- [CHARGER_SECONDARY] = {
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = SM5803_ADDR_CHARGER_FLAGS,
- .drv = &sm5803_drv,
- },
-};
+const struct charger_config_t
+ chg_chips[] = { [CHARGER_SOLO] = {
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = SM5803_ADDR_CHARGER_FLAGS,
+ .drv = &sm5803_drv,
+ } };
/* TCPCs */
-const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .bus_type = EC_BUS_TYPE_EMBEDDED,
- .drv = &it83xx_tcpm_drv,
- },
- {
- .bus_type = EC_BUS_TYPE_I2C,
- .i2c_info = {
- .port = I2C_PORT_SUB_USB_C1,
- .addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- },
- .drv = &ps8xxx_tcpm_drv,
- },
-};
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = { {
+ .bus_type = EC_BUS_TYPE_EMBEDDED,
+ .drv = &it83xx_tcpm_drv,
+} };
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
- {
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- },
- {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8XXX_I2C_ADDR1_FLAGS,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- },
-};
-
-/* Sensor Mutexes */
-static struct mutex g_lid_mutex;
-static struct mutex g_base_mutex;
-
-/* Sensor Data */
-static struct accelgyro_saved_data_t g_bma253_data;
-static struct accelgyro_saved_data_t g_bma422_data;
-static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
-
-/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-/* Drivers */
-struct motion_sensor_t motion_sensors[] = {
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMA255,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bma2x2_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bma253_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS,
- .rot_standard_ref = &lid_standard_ref,
- .default_range = 2,
- .min_frequency = BMA255_ACCEL_MIN_FREQ,
- .max_frequency = BMA255_ACCEL_MAX_FREQ,
- .config = {
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
- [BASE_ACCEL] = {
- .name = "Base Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LSM6DSM,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &lsm6dsm_drv,
- .mutex = &g_base_mutex,
- .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
- MOTIONSENSE_TYPE_ACCEL),
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = LSM6DSM_ODR_MIN_VAL,
- .max_frequency = LSM6DSM_ODR_MAX_VAL,
- .config = {
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 13000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = { {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
},
- },
- [BASE_GYRO] = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LSM6DSM,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &lsm6dsm_drv,
- .mutex = &g_base_mutex,
- .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
- MOTIONSENSE_TYPE_GYRO),
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
- .default_range = 1000 | ROUND_UP_FLAG, /* dps */
- .rot_standard_ref = &base_standard_ref,
- .min_frequency = LSM6DSM_ODR_MIN_VAL,
- .max_frequency = LSM6DSM_ODR_MAX_VAL,
- },
-};
+} };
-unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-struct motion_sensor_t bma422_lid_accel = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMA422,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bma4_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bma422_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY,
- .rot_standard_ref = &lid_standard_ref,
- .default_range = 2,
- .min_frequency = BMA4_ACCEL_MIN_FREQ,
- .max_frequency = BMA4_ACCEL_MAX_FREQ,
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 12500 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- /* Sensor on in S3 */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 12500 | ROUND_UP_FLAG,
- .ec_rate = 0,
- },
- },
-};
-
-static void board_update_motion_sensor_config(void)
+void oz554_board_init(void)
{
- if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_BMA422)
- motion_sensors[LID_ACCEL] = bma422_lid_accel;
+ int panel_id = 0;
+ int oz554_id;
+
+ oz554_id = gpio_get_level(GPIO_BL_OZ554_ID);
+ panel_id |= gpio_get_level(GPIO_PANEL_ID0) << 0;
+ panel_id |= gpio_get_level(GPIO_PANEL_ID1) << 1;
+ panel_id |= gpio_get_level(GPIO_PANEL_ID2) << 2;
+ panel_id |= gpio_get_level(GPIO_PANEL_ID3) << 3;
+
+ if (oz554_id == 0)
+ CPRINTUSB("OZ554ELN");
+ else if (oz554_id == 1)
+ CPRINTUSB("OZ554ALN");
+ else
+ CPRINTUSB("OZ554A UNKNOWN");
+
+ switch (panel_id) {
+ case 0x00:
+ CPRINTUSB("PANEL M238HAN");
+ oz554_set_config(0, 0xF1);
+ oz554_set_config(1, 0x43);
+ oz554_set_config(2, 0x44);
+ oz554_set_config(5, 0xBF);
+ break;
+ case 0x08:
+ CPRINTUSB("PANEL MV238FHM");
+ oz554_set_config(0, 0xF1);
+ oz554_set_config(1, 0x43);
+ oz554_set_config(2, 0x3C);
+ oz554_set_config(5, 0xD7);
+ break;
+ default:
+ CPRINTUSB("PANEL UNKNOWN");
+ break;
+ }
}
void board_init(void)
{
int on;
- enum fw_config_db db = get_cbi_fw_config_db();
-
- if (db == DB_1A_HDMI || db == DB_LTE_HDMI || db == DB_1A_HDMI_LTE) {
- /* Select HDMI option */
- gpio_set_level(GPIO_HDMI_SEL_L, 0);
- } else {
- /* Select AUX option */
- gpio_set_level(GPIO_HDMI_SEL_L, 1);
- }
+
+ gpio_enable_interrupt(GPIO_BJ_ADP_PRESENT_L);
gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_INT_ODL);
/* Store board version for use in determining charge limits */
cbi_get_board_version(&board_version);
@@ -444,42 +277,15 @@ void board_init(void)
*/
if (!gpio_get_level(GPIO_USB_C0_INT_ODL))
hook_call_deferred(&check_c0_line_data, 0);
- if (!gpio_get_level(GPIO_USB_C1_INT_ODL))
- hook_call_deferred(&check_c1_line_data, 0);
gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL);
- if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_PRESENT) {
- motion_sensor_count = ARRAY_SIZE(motion_sensors);
- /* Enable Base Accel interrupt */
- gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
-
- board_update_motion_sensor_config();
- } else {
- motion_sensor_count = 0;
- gmr_tablet_switch_disable();
- /* Base accel is not stuffed, don't allow line to float */
- gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- }
-
- gpio_enable_interrupt(GPIO_PEN_DET_ODL);
-
- /* Make sure pen detection is triggered or not at sysjump */
- if (!gpio_get_level(GPIO_PEN_DET_ODL))
- gpio_set_level(GPIO_EN_PP5000_PEN, 1);
-
- /* Make sure HDMI_HPD signal can be reported to CPU at sysjump */
- board_enable_hdmi_hpd(1);
+ oz554_board_init();
+ gpio_enable_interrupt(GPIO_PANEL_BACKLIGHT_EN);
/* Charger on the MB will be outputting PROCHOT_ODL and OD CHG_DET */
- sm5803_configure_gpio0(CHARGER_PRIMARY, GPIO0_MODE_PROCHOT, 1);
- sm5803_configure_chg_det_od(CHARGER_PRIMARY, 1);
-
- if (board_get_charger_chip_count() > 1) {
- /* Charger on the sub-board will be a push-pull GPIO */
- sm5803_configure_gpio0(CHARGER_SECONDARY, GPIO0_MODE_OUTPUT, 0);
- }
+ sm5803_configure_gpio0(CHARGER_SOLO, GPIO0_MODE_PROCHOT, 1);
+ sm5803_configure_chg_det_od(CHARGER_SOLO, 1);
/* Turn on 5V if the system is on, otherwise turn it off */
on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
@@ -490,47 +296,21 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
static void board_resume(void)
{
- sm5803_disable_low_power_mode(CHARGER_PRIMARY);
- if (board_get_charger_chip_count() > 1)
- sm5803_disable_low_power_mode(CHARGER_SECONDARY);
-
- /* Enable reporting HDMI_HPD to CPU when system resume */
- board_enable_hdmi_hpd(1);
+ sm5803_disable_low_power_mode(CHARGER_SOLO);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_resume, HOOK_PRIO_DEFAULT);
static void board_suspend(void)
{
- sm5803_enable_low_power_mode(CHARGER_PRIMARY);
- if (board_get_charger_chip_count() > 1)
- sm5803_enable_low_power_mode(CHARGER_SECONDARY);
+ sm5803_enable_low_power_mode(CHARGER_SOLO);
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_suspend, HOOK_PRIO_DEFAULT);
static void board_shutdown(void)
{
- /* Disable reporting HDMI_HPD to CPU at shutdown */
- board_enable_hdmi_hpd(0);
}
DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_shutdown, HOOK_PRIO_DEFAULT);
-void board_hibernate(void)
-{
- /*
- * Put all charger ICs present into low power mode before entering
- * z-state.
- */
- sm5803_hibernate(CHARGER_PRIMARY);
- if (board_get_charger_chip_count() > 1)
- sm5803_hibernate(CHARGER_SECONDARY);
-}
-
-__override void board_ocpc_init(struct ocpc_data *ocpc)
-{
- /* There's no provision to measure Isys */
- ocpc->chg_flags[CHARGER_SECONDARY] |= OCPC_NO_ISYS_MEAS_CAP;
-}
-
__override void board_pulse_entering_rw(void)
{
/*
@@ -549,8 +329,7 @@ __override void board_pulse_entering_rw(void)
void board_reset_pd_mcu(void)
{
/*
- * Nothing to do. TCPC C0 is internal, TCPC C1 reset pin is not
- * connected to the EC.
+ * Nothing to do. TCPC C0 is internal.
*/
}
@@ -561,111 +340,104 @@ __override void board_power_5v_enable(int enable)
* sets it through the charger GPIO.
*/
gpio_set_level(GPIO_EN_PP5000, !!enable);
-
- if (board_get_charger_chip_count() > 1) {
- if (sm5803_set_gpio0_level(1, !!enable))
- CPRINTUSB("Failed to %sable sub rails!", enable ?
- "en" : "dis");
- }
}
-__override uint8_t board_get_usb_pd_port_count(void)
+uint16_t tcpc_get_alert_status(void)
{
- enum fw_config_db db = get_cbi_fw_config_db();
-
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
- return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
- return CONFIG_USB_PD_PORT_MAX_COUNT;
-
- ccprints("Unhandled DB configuration: %d", db);
+ /*
+ * TCPC 0 is embedded in the EC and processes interrupts in the chip
+ * code (it83xx/intc.c)
+ */
return 0;
}
-__override uint8_t board_get_charger_chip_count(void)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
- enum fw_config_db db = get_cbi_fw_config_db();
-
- if (db == DB_1A_HDMI || db == DB_NONE || db == DB_LTE_HDMI
- || db == DB_1A_HDMI_LTE)
- return CHARGER_NUM - 1;
- else if (db == DB_1C || db == DB_1C_LTE || db == DB_1C_1A
- || db == DB_1C_1A_LTE)
- return CHARGER_NUM;
-
- ccprints("Unhandled DB configuration: %d", db);
- return 0;
+ if (port == CHARGER_SOLO) {
+ charger_set_input_current_limit(CHARGER_SOLO, max_ma);
+ }
}
-uint16_t tcpc_get_alert_status(void)
+__override int extpower_is_present(void)
{
- /*
- * TCPC 0 is embedded in the EC and processes interrupts in the chip
- * code (it83xx/intc.c)
- */
+ int port;
+ int rv;
+ bool acok;
+
+ for (port = 0; port < board_get_usb_pd_port_count(); port++) {
+ rv = sm5803_is_acok(port, &acok);
+ if ((rv == EC_SUCCESS) && acok)
+ return 1;
+ }
- uint16_t status = 0;
- int regval;
+ if (!gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L))
+ return 1;
- /* Check whether TCPC 1 pulled the shared interrupt line */
- if (!gpio_get_level(GPIO_USB_C1_INT_ODL)) {
- if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
- if (regval)
- status = PD_STATUS_TCPC_ALERT_1;
- }
- }
+ CPRINTUSB("No external power present.");
- return status;
+ return 0;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
- int charge_mv)
+int board_set_active_charge_port(int port)
{
- int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
+ CPRINTUSB("Requested charge port change to %d", port);
- /* Limit C1 on board version 0 to 2.0 A */
- if ((board_version == 0) && (port == 1))
- icl = MIN(icl, 2000);
/*
- * TODO(b/151955431): Characterize the input current limit in case a
- * scaling needs to be applied here
+ * The charge manager may ask us to switch to no charger if we're
+ * running off USB-C only but upstream doesn't support PD. It requires
+ * that we accept this switch otherwise it triggers an assert and EC
+ * reset; it's not possible to boot the AP anyway, but we want to avoid
+ * resetting the EC so we can continue to do the "low power" LED blink.
*/
- charge_set_input_current_limit(icl, charge_mv);
-}
-
-int board_set_active_charge_port(int port)
-{
- int is_valid_port = (port >= 0 && port < board_get_usb_pd_port_count());
+ if (port == CHARGE_PORT_NONE)
+ return EC_SUCCESS;
- if (!is_valid_port && port != CHARGE_PORT_NONE)
+ if (port < 0 || CHARGE_PORT_COUNT <= port)
return EC_ERROR_INVAL;
- if (port == CHARGE_PORT_NONE) {
- CPRINTUSB("Disabling all charge ports");
+ if (port == charge_manager_get_active_charge_port())
+ return EC_SUCCESS;
- sm5803_vbus_sink_enable(CHARGER_PRIMARY, 0);
+ /* Don't charge from a source port */
+ if (board_vbus_source_enabled(port))
+ return EC_ERROR_INVAL;
- if (board_get_charger_chip_count() > 1)
- sm5803_vbus_sink_enable(CHARGER_SECONDARY, 0);
+ if (!chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+ int bj_active, bj_requested;
- return EC_SUCCESS;
- }
+ if (charge_manager_get_active_charge_port() != CHARGE_PORT_NONE)
+ /* Change is only permitted while the system is off */
+ return EC_ERROR_INVAL;
- CPRINTUSB("New chg p%d", port);
+ /*
+ * Current setting is no charge port but the AP is on, so the
+ * charge manager is out of sync (probably because we're
+ * reinitializing after sysjump). Reject requests that aren't
+ * in sync with our outputs.
+ */
+ bj_active = !gpio_get_level(GPIO_EN_PPVAR_BJ_ADP_L);
+ bj_requested = port == CHARGE_PORT_BARRELJACK;
+ if (bj_active != bj_requested)
+ return EC_ERROR_INVAL;
+ }
- /*
- * Ensure other port is turned off, then enable new charge port
- */
- if (port == 0) {
- if (board_get_charger_chip_count() > 1)
- sm5803_vbus_sink_enable(CHARGER_SECONDARY, 0);
- sm5803_vbus_sink_enable(CHARGER_PRIMARY, 1);
-
- } else {
- sm5803_vbus_sink_enable(CHARGER_PRIMARY, 0);
- sm5803_vbus_sink_enable(CHARGER_SECONDARY, 1);
+ CPRINTUSB("New charger p%d", port);
+
+ switch (port) {
+ case CHARGE_PORT_TYPEC0:
+ sm5803_vbus_sink_enable(CHARGER_SOLO, 1);
+ gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 1);
+ break;
+ case CHARGE_PORT_BARRELJACK:
+ /* Make sure BJ adapter is sourcing power */
+ if (!barrel_jack_adapter_is_present())
+ return EC_ERROR_INVAL;
+ gpio_set_level(GPIO_EN_PPVAR_BJ_ADP_L, 0);
+ sm5803_vbus_sink_enable(CHARGER_SOLO, 0);
+ break;
+ default:
+ return EC_ERROR_INVAL;
}
return EC_SUCCESS;
@@ -696,92 +468,23 @@ __override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
charger_set_otg_current_voltage(port, current, 5000);
}
-/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
-const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = 0,
- .flags = PWM_CONFIG_DSLEEP,
- .freq_hz = 10000,
- }
-};
-BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
-
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
- [TEMP_SENSOR_4] = {.name = "5V regular",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
+ [TEMP_SENSOR_4] = { .name = "5V regular",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
-/* This callback disables keyboard when convertibles are fully open */
-__override void lid_angle_peripheral_enable(int enable)
-{
- int chipset_in_s0 = chipset_in_state(CHIPSET_STATE_ON);
-
- /*
- * If the lid is in tablet position via other sensors,
- * ignore the lid angle, which might be faulty then
- * disable keyboard.
- */
- if (tablet_get_mode())
- enable = 0;
-
- if (enable) {
- keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE);
- } else {
- /*
- * Ensure that the chipset is off before disabling the keyboard.
- * When the chipset is on, the EC keeps the keyboard enabled and
- * the AP decides whether to ignore input devices or not.
- */
- if (!chipset_in_s0)
- keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE);
- }
-}
-
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
-{
- *kp = 3;
- *kp_div = 20;
-
- *ki = 3;
- *ki_div = 125;
-
- *kd = 4;
- *kd_div = 40;
-}
-
-#ifdef CONFIG_KEYBOARD_FACTORY_TEST
-/*
- * Map keyboard connector pins to EC GPIO pins for factory test.
- * Pins mapped to {-1, -1} are skipped.
- * The connector has 24 pins total, and there is no pin 0.
- */
-const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {GPIO_KSO_H, 4}, {GPIO_KSO_H, 0}, {GPIO_KSO_H, 1},
- {GPIO_KSO_H, 3}, {GPIO_KSO_H, 2}, {GPIO_KSO_L, 5}, {GPIO_KSO_L, 6},
- {GPIO_KSO_L, 3}, {GPIO_KSO_L, 2}, {GPIO_KSI, 0}, {GPIO_KSO_L, 1},
- {GPIO_KSO_L, 4}, {GPIO_KSI, 3}, {GPIO_KSI, 2}, {GPIO_KSO_L, 0},
- {GPIO_KSI, 5}, {GPIO_KSI, 4}, {GPIO_KSO_L, 7}, {GPIO_KSI, 6},
- {GPIO_KSI, 7}, {GPIO_KSI, 1}, {-1, -1}, {-1, -1}, {-1, -1},
-};
-
-const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
-#endif
diff --git a/board/shotzo/board.h b/board/shotzo/board.h
index 7235499624..c6fcceb045 100644
--- a/board/shotzo/board.h
+++ b/board/shotzo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,66 +12,17 @@
#define VARIANT_DEDEDE_EC_IT8320
#include "baseboard.h"
-#undef GPIO_VOLUME_UP_L
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL_HDMI_HPD
-
-/* Battery */
-#define CONFIG_BATTERY_FUEL_GAUGE
-
-/* BC 1.2 */
-#define CONFIG_BC12_DETECT_PI3USB9201
-
/* Charger */
-#define CONFIG_CHARGE_RAMP_HW
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
-#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
-
-/* PWM */
-#define CONFIG_PWM
-
-/* Sensors */
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCEL_BMA4XX /* 2nd source Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
-/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
-
-#define CONFIG_CMD_ACCELS
-#define CONFIG_CMD_ACCEL_INFO
-
-/* Enable sensor fifo, must also define the _SIZE and _THRES */
-#define CONFIG_ACCEL_FIFO
-/* Power of 2 - Too large of a fifo causes too much timestamp jitter */
-#define CONFIG_ACCEL_FIFO_SIZE 256
-#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
-
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-
-#define CONFIG_LID_ANGLE
-#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-
-#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-
-#define CONFIG_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-#define CONFIG_GMR_TABLET_MODE
-
-/* Keyboard */
-#define CONFIG_KEYBOARD_FACTORY_TEST
-#define CONFIG_PWM_KBLIGHT
/* TCPC */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_PS8705 /* C1: PS8705 TCPC*/
+#define CONFIG_USB_PD_PORT_MAX_COUNT 1
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
#define CONFIG_USB_PD_TCPC_LOW_POWER
@@ -82,45 +33,59 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
/* USB Type A Features */
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
+/* Buttons */
+#define CONFIG_DEDICATED_RECOVERY_BUTTON
+#define CONFIG_DEDICATED_RECOVERY_BUTTON_2
+#define CONFIG_EMULATED_SYSRQ
+#define CONFIG_POWER_BUTTON_IGNORE_LID
+
+/* Dedicated barreljack charger port */
+#undef CONFIG_DEDICATED_CHARGE_PORT_COUNT
+#define CONFIG_DEDICATED_CHARGE_PORT_COUNT 1
+#define DEDICATED_CHARGE_PORT 1
+
+/* LED backlight controller */
+#define CONFIG_LED_DRIVER_OZ554
+
+/* Unused Features */
+#undef CONFIG_BACKLIGHT_LID
+#undef CONFIG_BATTERY_CUT_OFF
+#undef CONFIG_BATTERY_PRESENT_GPIO
+#undef CONFIG_BATTERY_SMART
+#undef CONFIG_BATTERY_REQUESTS_NIL_WHEN_DEAD
+#undef CONFIG_BATTERY_REVIVE_DISCONNECT
+#undef CONFIG_CMD_KEYBOARD
+#undef CONFIG_HIBERNATE
+#undef CONFIG_KEYBOARD_BOOT_KEYS
+#undef CONFIG_KEYBOARD_RUNTIME_KEYS
+#undef CONFIG_LID_SWITCH
+#undef CONFIG_USB_CHARGER
+#undef CONFIG_VOLUME_BUTTONS
+#undef GPIO_USB_C1_DP_HPD
+
+/* I2C Bus Configuration */
+#define I2C_PORT_BACKLIGHT I2C_PORT_SENSOR
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
-enum chg_id {
- CHARGER_PRIMARY,
- CHARGER_SECONDARY,
- CHARGER_NUM,
-};
-
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT,
-};
-
-/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
-
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
- ADC_TEMP_SENSOR_3, /* ADC15 */
- ADC_TEMP_SENSOR_4, /* ADC16 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
+ ADC_TEMP_SENSOR_3, /* ADC15 */
+ ADC_TEMP_SENSOR_4, /* ADC16 */
ADC_CH_COUNT
};
@@ -132,21 +97,20 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-/* List of possible batteries */
-enum battery_type {
- BATTERY_DYNAPACK_COS,
- BATTERY_DYNAPACK_ATL,
- BATTERY_DYNAPACK_HIGHPOWER,
- BATTERY_DYNAPACK_BYD,
- BATTERY_SAMSUNG_SDI,
- BATTERY_SIMPLO_COS,
- BATTERY_SIMPLO_HIGHPOWER,
- BATTERY_COS,
- BATTERY_COS_2,
- BATTERY_ATL,
- BATTERY_TYPE_COUNT,
+enum charge_port {
+ CHARGE_PORT_TYPEC0,
+ CHARGE_PORT_BARRELJACK,
};
+/* Board specific handlers */
+void led_alert(int enable);
+#define PORT_TO_HPD(port) (GPIO_USB_C0_DP_HPD)
+
+/* Pin renaming */
+#define GPIO_AC_PRESENT GPIO_BJ_ADP_PRESENT_L
+#define GPIO_RECOVERY_L GPIO_EC_RECOVERY_BTN_ODL
+#define GPIO_RECOVERY_L_2 GPIO_H1_EC_RECOVERY_BTN_ODL
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/shotzo/build.mk b/board/shotzo/build.mk
index 4d677400a9..07ea50c392 100644
--- a/board/shotzo/build.mk
+++ b/board/shotzo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The ChromiumOS Authors.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
@@ -11,5 +11,4 @@ CHIP_FAMILY:=it8320
CHIP_VARIANT:=it8320dx
BASEBOARD:=dedede
-board-y=board.o cbi_ssfc.o led.o usb_pd_policy.o
-board-$(CONFIG_BATTERY_SMART)+=battery.o
+board-y=board.o led.o usb_pd_policy.o
diff --git a/board/shotzo/ec.tasklist b/board/shotzo/ec.tasklist
index 99f42b5579..1447f9db15 100644
--- a/board/shotzo/ec.tasklist
+++ b/board/shotzo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,16 +9,8 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, LARGER_TASK_STACK_SIZE) \
- TASK_ALWAYS(CHARGER, charger_task, NULL, TRENTA_TASK_STACK_SIZE) \
TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(POWERBTN, power_button_task, NULL, ULTRA_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, ULTRA_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, ULTRA_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, ULTRA_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, ULTRA_TASK_STACK_SIZE)
+ TASK_ALWAYS(PD_C0, pd_task, NULL, ULTRA_TASK_STACK_SIZE)
diff --git a/board/shotzo/gpio.inc b/board/shotzo/gpio.inc
index 5d00a0b0e7..4a26d2631a 100644
--- a/board/shotzo/gpio.inc
+++ b/board/shotzo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The ChromiumOS Authors.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,18 +29,15 @@ GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_BOTH, uart_deepsleep_interrupt) /* UART_
#endif
/* USB-C interrupts */
-GPIO_INT(USB_C0_INT_ODL, PIN(K, 0), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c0_interrupt) /* BC12 and charger */
-GPIO_INT(USB_C1_INT_ODL, PIN(E, 6), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c1_interrupt) /* TCPC, charger, BC12 */
+GPIO_INT(USB_C0_INT_ODL, PIN(K, 0), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c0_interrupt) /* charger */
GPIO_INT(USB_C0_CCSBU_OVP_ODL, PIN(K, 6), GPIO_INT_FALLING | GPIO_PULL_UP, c0_ccsbu_ovp_interrupt) /* Fault protection */
/* Other interrupts */
-GPIO_INT(LID_OPEN, PIN(F, 3), GPIO_INT_BOTH, lid_interrupt)
-GPIO_INT(LID_360_L, PIN(A, 7), GPIO_INT_BOTH, gmr_tablet_switch_isr)
-GPIO_INT(VOLDN_BTN_ODL, PIN(I, 6), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
-GPIO_INT(VOLUP_BTN_ODL_HDMI_HPD, PIN(I, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_sub_hdmi_hpd_interrupt)
-GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 0), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt)
GPIO_INT(EC_WP_OD, PIN(A, 6), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(PEN_DET_ODL, PIN(J, 1), GPIO_INT_BOTH | GPIO_PULL_UP, pen_detect_interrupt)
+GPIO_INT(BJ_ADP_PRESENT_L, PIN(J, 1), GPIO_INT_BOTH | GPIO_PULL_UP, adp_connect_interrupt)
+GPIO_INT(PANEL_BACKLIGHT_EN, PIN(J, 3), GPIO_INT_RISING, oz554_interrupt)
+GPIO_INT(EC_RECOVERY_BTN_ODL, PIN(F, 1), GPIO_INT_BOTH, button_interrupt)
+GPIO_INT(H1_EC_RECOVERY_BTN_ODL, PIN(KSI, 5), GPIO_INT_BOTH, button_interrupt)
/* Power sequence GPIOs */
GPIO(EC_AP_RTCRST, PIN(K, 2), GPIO_OUT_LOW)
@@ -84,50 +81,71 @@ GPIO(EN_USB_A_5V, PIN(L, 6), GPIO_OUT_LOW)
GPIO(EN_USB_C0_CC1_VCONN, PIN(H, 4), GPIO_OUT_LOW)
GPIO(EN_USB_C0_CC2_VCONN, PIN(H, 6), GPIO_OUT_LOW)
GPIO(EC_AP_USB_C0_HPD, PIN(L, 4), GPIO_OUT_LOW)
-GPIO(EC_AP_USB_C1_HDMI_HPD, PIN(K, 7), GPIO_OUT_LOW)
GPIO(USB_C0_FRS, PIN(C, 4), GPIO_OUT_LOW)
GPIO(HDMI_SEL_L, PIN(C, 6), GPIO_OUT_HIGH)
/* MKBP event synchronization */
GPIO(EC_AP_MKBP_INT_L, PIN(L, 5), GPIO_ODR_HIGH)
-/* Misc pins which will run to the I/O board */
-GPIO(EC_SUB_IO_1_2, PIN(F, 0), GPIO_INPUT)
-GPIO(EC_SUB_IO_2_1, PIN(F, 1), GPIO_INPUT)
-
/* Misc */
-GPIO(EN_BL_OD, PIN(K, 4), GPIO_ODR_LOW)
GPIO(EC_ENTERING_RW, PIN(G, 0), GPIO_OUT_LOW)
GPIO(EC_ENTERING_RW2, PIN(C, 7), GPIO_OUT_LOW)
GPIO(CCD_MODE_ODL, PIN(H, 5), GPIO_ODR_HIGH)
-GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT)
-GPIO(EN_KB_BL, PIN(J, 3), GPIO_OUT_LOW) /* Currently unused */
GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW)
-GPIO(EN_PP5000_PEN, PIN(B, 5), GPIO_OUT_LOW)
+GPIO(EN_PPVAR_BJ_ADP_L, PIN(J, 0), GPIO_OUT_LOW)
+GPIO(EN_VBUS_PWR, PIN(F, 3), GPIO_OUT_HIGH)
+GPIO(PANEL_ID0, PIN(K, 4), GPIO_INPUT)
+GPIO(PANEL_ID1, PIN(J, 4), GPIO_INPUT)
+GPIO(PANEL_ID2, PIN(J, 5), GPIO_INPUT)
+GPIO(PANEL_ID3, PIN(J, 6), GPIO_INPUT)
+GPIO(BL_OZ554_ID, PIN(A, 7), GPIO_INPUT)
+GPIO(EC_CRTL, PIN(F, 0), GPIO_OUT_LOW)
+GPIO(EC_EDID_WRITE_EN_L, PIN(B, 5), GPIO_ODR_HIGH)
/* NC pins, enable internal pull-down to avoid floating state. */
+GPIO(GPIOA0_NC, PIN(A, 0), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOA2_NC, PIN(A, 2), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOA3_NC, PIN(A, 3), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOC3_NC, PIN(C, 3), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOE6_NC, PIN(E, 6), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG3_NC, PIN(G, 3), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG4_NC, PIN(G, 4), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG5_NC, PIN(G, 5), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG6_NC, PIN(G, 6), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOG7_NC, PIN(G, 7), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(GPIOJ4_NC, PIN(J, 4), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(GPIOJ5_NC, PIN(J, 5), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(GPIOJ6_NC, PIN(J, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOI4_NC, PIN(I, 4), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOI6_NC, PIN(I, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOI7_NC, PIN(I, 7), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOK7_NC, PIN(K, 7), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(GPIOM6_NC, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI0_NC, PIN(KSI, 0), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI1_NC, PIN(KSI, 1), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI2_NC, PIN(KSI, 2), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI3_NC, PIN(KSI, 3), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI4_NC, PIN(KSI, 4), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI6_NC, PIN(KSI, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSI7_NC, PIN(KSI, 7), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO0_NC, PIN(KSO_L, 0), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO1_NC, PIN(KSO_L, 1), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO3_NC, PIN(KSO_L, 3), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO4_NC, PIN(KSO_L, 4), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO5_NC, PIN(KSO_L, 5), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO6_NC, PIN(KSO_L, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO7_NC, PIN(KSO_L, 7), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO8_NC, PIN(KSO_H, 0), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO9_NC, PIN(KSO_H, 1), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO10_NC, PIN(KSO_H, 2), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO11_NC, PIN(KSO_H, 3), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO12_NC, PIN(KSO_H, 4), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO13_NC, PIN(KSO_H, 5), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO14_NC, PIN(KSO_H, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(KSO15_NC, PIN(KSO_H, 7), GPIO_INPUT | GPIO_PULL_DOWN)
/* LED */
-GPIO(BAT_LED_AMBER_L, PIN(A, 1), GPIO_OUT_HIGH)
-GPIO(BAT_LED_WHITE_L, PIN(A, 2), GPIO_OUT_HIGH)
-GPIO(PWR_LED_WHITE_L, PIN(A, 3), GPIO_OUT_HIGH)
+GPIO(PWR_LED_WHITE_L, PIN(A, 1), GPIO_OUT_HIGH)
/* Alternate functions GPIO definitions */
-/* Keyboard */
-ALTERNATE(PIN_MASK(KSI, 0xFF), 0, MODULE_KEYBOARD_SCAN, 0) /* KSI0-7 */
-ALTERNATE(PIN_MASK(KSO_H, 0xFF), 0, MODULE_KEYBOARD_SCAN, 0) /* KSO8-15 */
-ALTERNATE(PIN_MASK(KSO_L, 0xFB), 0, MODULE_KEYBOARD_SCAN, 0) /* KSO0-1, 3-7 */
GPIO(EC_KSO_02_INV, PIN(KSO_L, 2), GPIO_OUT_HIGH) /* KSO2 inverted */
/* UART */
@@ -143,6 +161,3 @@ ALTERNATE(PIN_MASK(A, BIT(4) | BIT(5)), 0, MODULE_I2C, 0) /* I2C5 */
/* ADC */
ALTERNATE(PIN_MASK(L, BIT(0) | BIT(2) | BIT(3)), 0, MODULE_ADC, 0) /* ADC13: EC_SUB_ANALOG, ADC15: TEMP_SENSOR_3, ADC16: TEMP_SENSOR_4 */
ALTERNATE(PIN_MASK(I, BIT(0) | BIT(2) | BIT(3)), 0, MODULE_ADC, 0) /* ADC0: EC_VSNS_PP3300_A, ADC2: TEMP_SENSOR_1, ADC3: TEMP_SENSOR_2 */
-
-/* PWM */
-ALTERNATE(PIN_MASK(A, BIT(0)), 0, MODULE_PWM, 0) /* KB_BL_PWM */
diff --git a/board/shotzo/led.c b/board/shotzo/led.c
index 761b4b4047..9ca9e7a498 100644
--- a/board/shotzo/led.c
+++ b/board/shotzo/led.c
@@ -1,58 +1,45 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-/* Shotzo specific LED settings. */
+/* Power LED control for Shotzo.
+ * Solid white - active power
+ * 25% duty cycle white, 1s on and 3s off- suspend
+ * Blinking quicky white, 0.5s on and 0.5s off - alert
+ * 2 long 2 short white, long for 1s, short for 0.5s and interval
+ * is 0.5s - critical
+ * Off - shut down
+ */
-#include "cbi_fw_config.h"
-#include "charge_state.h"
-#include "extpower.h"
+#include "chipset.h"
+#include "console.h"
#include "gpio.h"
#include "hooks.h"
#include "led_common.h"
+#include "timer.h"
+#include "util.h"
-#define BAT_LED_ON 0
-#define BAT_LED_OFF 1
+/*
+ * Due to the CSME-Lite processing, upon startup the CPU transitions through
+ * S0->S3->S5->S3->S0, causing the LED to turn on/off/on, so
+ * delay turning off the LED during suspend/shutdown.
+ */
+#define LED_CPU_DELAY_MS (2000 * MSEC)
#define POWER_LED_ON 0
#define POWER_LED_OFF 1
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
enum led_color {
LED_OFF = 0,
- LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-static int led_set_color_battery(enum led_color color)
-{
- switch (color) {
- case LED_OFF:
- gpio_set_level(GPIO_BAT_LED_WHITE_L, BAT_LED_OFF);
- gpio_set_level(GPIO_BAT_LED_AMBER_L, BAT_LED_OFF);
- break;
- case LED_WHITE:
- gpio_set_level(GPIO_BAT_LED_WHITE_L, BAT_LED_ON);
- gpio_set_level(GPIO_BAT_LED_AMBER_L, BAT_LED_OFF);
- break;
- case LED_AMBER:
- gpio_set_level(GPIO_BAT_LED_WHITE_L, BAT_LED_OFF);
- gpio_set_level(GPIO_BAT_LED_AMBER_L, BAT_LED_ON);
- break;
- default:
- return EC_ERROR_UNKNOWN;
- }
- return EC_SUCCESS;
-}
-
static int led_set_color_power(enum led_color color)
{
switch (color) {
@@ -68,29 +55,11 @@ static int led_set_color_power(enum led_color color)
return EC_SUCCESS;
}
-void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
-{
- switch (led_id) {
- case EC_LED_ID_BATTERY_LED:
- brightness_range[EC_LED_COLOR_WHITE] = 1;
- brightness_range[EC_LED_COLOR_AMBER] = 1;
- break;
- case EC_LED_ID_POWER_LED:
- brightness_range[EC_LED_COLOR_WHITE] = 1;
- break;
- default:
- break;
- }
-}
-
static int led_set_color(enum ec_led_id led_id, enum led_color color)
{
int rv;
switch (led_id) {
- case EC_LED_ID_BATTERY_LED:
- rv = led_set_color_battery(color);
- break;
case EC_LED_ID_POWER_LED:
rv = led_set_color_power(color);
break;
@@ -100,105 +69,174 @@ static int led_set_color(enum ec_led_id led_id, enum led_color color)
return rv;
}
-int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
+/* When blinking is enabled, led will blinking according to led_blinking_array.
+ * 1 means led on, 0 means led off, restart from head after reaching the tail.
+ * The interval is LED_BLINKING_MS.
+ */
+#define LED_BLINKING_MS (500 * MSEC)
+static int *led_blinking_array;
+static int led_blinking_count;
+static int led_blinking_index;
+static void led_blinking(void);
+DECLARE_DEFERRED(led_blinking);
+static void led_blinking(void)
{
- if (brightness[EC_LED_COLOR_WHITE] != 0)
- led_set_color(led_id, LED_WHITE);
- else if (brightness[EC_LED_COLOR_AMBER] != 0)
- led_set_color(led_id, LED_AMBER);
- else
- led_set_color(led_id, LED_OFF);
+ uint32_t elapsed;
+ uint32_t next = 0;
+ uint32_t start = get_time().le.lo;
+ int signal;
- return EC_SUCCESS;
+ if (led_blinking_array == NULL)
+ return;
+
+ if (led_blinking_index > (led_blinking_count - 1))
+ led_blinking_index = 0;
+
+ signal = *(led_blinking_array + led_blinking_index);
+
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED)) {
+ switch (signal) {
+ case 0:
+ led_set_color(EC_LED_ID_POWER_LED, LED_OFF);
+ led_blinking_index += 1;
+ break;
+ case 1:
+ led_set_color(EC_LED_ID_POWER_LED, LED_WHITE);
+ led_blinking_index += 1;
+ break;
+ default:
+ led_blinking_index = 0;
+ }
+ }
+
+ elapsed = get_time().le.lo - start;
+ next = elapsed < LED_BLINKING_MS ? LED_BLINKING_MS - elapsed : 0;
+ hook_call_deferred(&led_blinking_data, next);
}
-static void led_set_battery(void)
+static int led_suspend_array[] = { 1, 1, 0, 0, 0, 0, 0, 0 };
+const int led_suspend_count = ARRAY_SIZE(led_suspend_array);
+static void led_suspend(void)
{
- static int battery_ticks;
- static int power_ticks;
- uint32_t chflags = charge_get_flags();
-
- battery_ticks++;
-
- /*
- * Override battery LED for Drawlet/Drawman, Drawlet/Drawman
- * don't have power LED, blinking battery white LED to indicate
- * system suspend without charging.
- */
- if (get_cbi_fw_config_tablet_mode() == TABLET_MODE_ABSENT) {
- if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
- charge_get_state() != PWR_STATE_CHARGE) {
- led_set_color_battery(power_ticks++ & 0x2 ?
- LED_WHITE : LED_OFF);
- return;
- }
+ led_blinking_array = led_suspend_array;
+ led_blinking_count = led_suspend_count;
+ led_blinking_index = 0;
+ led_blinking();
+}
+DECLARE_DEFERRED(led_suspend);
+
+static void led_shutdown(void)
+{
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ led_set_color(EC_LED_ID_POWER_LED, LED_OFF);
+}
+DECLARE_DEFERRED(led_shutdown);
+
+static void led_suspend_hook(void)
+{
+ hook_call_deferred(&led_blinking_data, -1);
+ hook_call_deferred(&led_shutdown_data, -1);
+ hook_call_deferred(&led_suspend_data, LED_CPU_DELAY_MS);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, led_suspend_hook, HOOK_PRIO_DEFAULT);
+
+static void led_shutdown_hook(void)
+{
+ hook_call_deferred(&led_blinking_data, -1);
+ hook_call_deferred(&led_suspend_data, -1);
+ hook_call_deferred(&led_shutdown_data, LED_CPU_DELAY_MS);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, led_shutdown_hook, HOOK_PRIO_DEFAULT);
+
+static void led_resume_hook(void)
+{
+ hook_call_deferred(&led_blinking_data, -1);
+ hook_call_deferred(&led_suspend_data, -1);
+ hook_call_deferred(&led_shutdown_data, -1);
+
+ if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
+ led_set_color(EC_LED_ID_POWER_LED, LED_WHITE);
+}
+DECLARE_HOOK(HOOK_CHIPSET_RESUME, led_resume_hook, HOOK_PRIO_DEFAULT);
+
+static int led_alert_array[] = { 1, 0 };
+const int led_alert_count = ARRAY_SIZE(led_alert_array);
+void led_alert(int enable)
+{
+ if (enable) {
+ /* Overwrite the current signal */
+ hook_call_deferred(&led_blinking_data, -1);
+ led_blinking_array = led_alert_array;
+ led_blinking_count = led_alert_count;
+ led_blinking_index = 0;
+ led_blinking();
+ } else {
+ /* Restore the previous signal */
+ if (chipset_in_state(CHIPSET_STATE_ON))
+ led_resume_hook();
+ else if (chipset_in_state(CHIPSET_STATE_SUSPEND))
+ led_suspend_hook();
+ else if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ led_shutdown_hook();
}
+}
- power_ticks = 0;
+static int led_critical_array[] = { 1, 1, 0, 1, 1, 0, 1, 0, 1, 0 };
+const int led_critical_count = ARRAY_SIZE(led_critical_array);
+void show_critical_error(void)
+{
+ hook_call_deferred(&led_blinking_data, -1);
+ led_blinking_array = led_critical_array;
+ led_blinking_count = led_critical_count;
+ led_blinking_index = 0;
+ led_blinking();
+}
- switch (charge_get_state()) {
- case PWR_STATE_CHARGE:
- led_set_color_battery(LED_AMBER);
- break;
- case PWR_STATE_DISCHARGE_FULL:
- if (extpower_is_present()) {
- led_set_color_battery(LED_WHITE);
- break;
- }
- /* Intentional fall-through */
- case PWR_STATE_DISCHARGE:
- /*
- * Blink white light (1 sec on, 1 sec off)
- * when battery capacity is less than 10%
- */
- if (charge_get_percent() < 10)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_WHITE : LED_OFF);
- else
- led_set_color_battery(LED_OFF);
- break;
- case PWR_STATE_ERROR:
- led_set_color_battery(
- (battery_ticks % 0x2) ? LED_WHITE : LED_OFF);
- break;
- case PWR_STATE_CHARGE_NEAR_FULL:
- led_set_color_battery(LED_WHITE);
- break;
- case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- led_set_color_battery(
- (battery_ticks & 0x2) ? LED_AMBER : LED_OFF);
- else
- led_set_color_battery(LED_WHITE);
+void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
+{
+ switch (led_id) {
+ case EC_LED_ID_POWER_LED:
+ brightness_range[EC_LED_COLOR_WHITE] = 1;
break;
default:
- /* Other states don't alter LED behavior */
break;
}
}
-static void led_set_power(void)
+int led_set_brightness(enum ec_led_id id, const uint8_t *brightness)
{
- static int power_tick;
-
- power_tick++;
-
- if (chipset_in_state(CHIPSET_STATE_ON))
- led_set_color_power(LED_WHITE);
- else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- led_set_color_power(
- (power_tick & 0x2) ? LED_WHITE : LED_OFF);
+ if (brightness[EC_LED_COLOR_WHITE] != 0)
+ led_set_color(id, LED_WHITE);
else
- led_set_color_power(LED_OFF);
+ led_set_color(id, LED_OFF);
+
+ return EC_SUCCESS;
}
-/* Called by hook task every TICK */
-static void led_tick(void)
+static int command_led(int argc, const char **argv)
{
- if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- led_set_power();
-
- if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
- led_set_battery();
+ enum ec_led_id id = EC_LED_ID_POWER_LED;
+
+ if (argc < 2)
+ return EC_ERROR_PARAM_COUNT;
+
+ if (!strcasecmp(argv[1], "debug")) {
+ led_auto_control(id, !led_auto_control_is_enabled(id));
+ ccprintf("o%s\n", led_auto_control_is_enabled(id) ? "ff" : "n");
+ } else if (!strcasecmp(argv[1], "off")) {
+ led_set_color(id, LED_OFF);
+ } else if (!strcasecmp(argv[1], "white")) {
+ led_set_color(id, LED_WHITE);
+ } else if (!strcasecmp(argv[1], "alert")) {
+ led_alert(1);
+ } else if (!strcasecmp(argv[1], "crit")) {
+ show_critical_error();
+ } else if (!strcasecmp(argv[1], "resume")) {
+ led_resume_hook();
+ } else {
+ return EC_ERROR_PARAM1;
+ }
+ return EC_SUCCESS;
}
-DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);
+DECLARE_CONSOLE_COMMAND(led, command_led, "[debug|white|off|alert|crit|resume]",
+ "Turn on/off LED.");
diff --git a/board/shotzo/usb_pd_policy.c b/board/shotzo/usb_pd_policy.c
index 1bba648eba..8c2b840121 100644
--- a/board/shotzo/usb_pd_policy.c
+++ b/board/shotzo/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The ChromiumOS Authors.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,21 +65,18 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
{
return sm5803_is_vbus_present(port);
}
+
+int board_vbus_source_enabled(int port)
+{
+ /* Ignore non-PD ports (the barrel jack). */
+ if (port >= CONFIG_USB_PD_PORT_MAX_COUNT)
+ return 0;
+ return charger_is_sourcing_otg_power(port);
+}
diff --git a/board/shuboz/battery.c b/board/shuboz/battery.c
index 155cadab41..f24c50d931 100644
--- a/board/shuboz/battery.c
+++ b/board/shuboz/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -133,7 +133,7 @@ int charger_profile_override(struct charge_state_data *curr)
return 0;
if (current_level != 0) {
- if (curr->requested_current > current_table[current_level-1])
+ if (curr->requested_current > current_table[current_level - 1])
curr->requested_current =
current_table[current_level - 1];
}
diff --git a/board/shuboz/board.c b/board/shuboz/board.c
index 027a6ee634..41d985df7c 100644
--- a/board/shuboz/board.c
+++ b/board/shuboz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,7 +13,7 @@
#include "driver/accel_kionix.h"
#include "driver/accel_kx022.h"
#include "driver/bc12/pi3usb9201.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/ppc/nx20p348x.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/usb_mux/amd_fp5.h"
@@ -39,8 +39,8 @@
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* This I2C moved. Temporarily detect and support the V0 HW. */
int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1;
@@ -62,15 +62,13 @@ static const mat33_fp_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0 },
{ 0, 0, FLOAT_TO_FP(-1) },
};
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static const mat33_fp_t base_standard_ref_icm = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(-1)},
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
@@ -226,8 +224,7 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-static int board_ps8743_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+static int board_ps8743_mux_set(const struct usb_mux *me, mux_state_t mux_state)
{
int res;
@@ -242,7 +239,6 @@ static int board_ps8743_mux_set(const struct usb_mux *me,
return res;
}
-
/*****************************************************************************
* USB-C
*/
@@ -280,34 +276,44 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since FSUSB42UMX is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
-struct usb_mux usbc1_amd_fp5_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+struct usb_mux_chain usbc1_amd_fp5_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ .flags = USB_MUX_FLAG_SET_WITHOUT_FLIP,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
- .driver = &ps8743_usb_mux_driver,
- .board_set = &board_ps8743_mux_set,
- .next_mux = &usbc1_amd_fp5_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = PS8743_I2C_ADDR1_FLAG,
+ .driver = &ps8743_usb_mux_driver,
+ .board_set = &board_ps8743_mux_set,
+ },
+ .next = &usbc1_amd_fp5_usb_mux,
}
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -350,8 +356,7 @@ void ppc_interrupt(enum gpio_signal signal)
int board_set_active_charge_port(int port)
{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (port == CHARGE_PORT_NONE) {
@@ -372,7 +377,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
/* Check if the port is sourcing VBUS. */
if (ppc_is_sourcing_vbus(port)) {
CPRINTFUSB("Skip enable C%d", port);
@@ -474,7 +478,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -545,11 +548,9 @@ int board_pd_set_frs_enable(int port, int enable)
/* Use the TCPC to enable fast switch when FRS included */
if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable);
} else {
- rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C1_TCPC_FASTSW_CTL_EN, !!enable);
}
return rv;
diff --git a/board/shuboz/board.h b/board/shuboz/board.h
index 6573273b93..ada5b1499d 100644
--- a/board/shuboz/board.h
+++ b/board/shuboz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,11 +21,11 @@
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
#define CONFIG_USB_PORT_ENABLE_DYNAMIC
-#undef PD_MAX_POWER_MW
-#define PD_MAX_POWER_MW 45000
-#undef PD_MAX_CURRENT_MA
-#define PD_MAX_CURRENT_MA 3000
-#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
+#undef PD_MAX_POWER_MW
+#define PD_MAX_POWER_MW 45000
+#undef PD_MAX_CURRENT_MA
+#define PD_MAX_CURRENT_MA 3000
+#undef CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON
#define CONFIG_CHARGER_MIN_POWER_MW_FOR_POWER_ON 40000
#define CONFIG_CHARGER_PROFILE_OVERRIDE
@@ -61,59 +61,46 @@
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 5
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
/* This I2C moved. Temporarily detect and support the V0 HW. */
extern int I2C_PORT_BATTERY;
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_CM1500,
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
-enum ioex_port {
- IOEX_C0_NCT3807 = 0,
- IOEX_C1_NCT3807,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT3807 = 0, IOEX_C1_NCT3807, IOEX_PORT_COUNT };
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB3_C0_DP2_HPD \
- : GPIO_DP1_HPD)
+#define PORT_TO_HPD(port) ((port == 0) ? GPIO_USB3_C0_DP2_HPD : GPIO_DP1_HPD)
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -122,17 +109,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
diff --git a/board/shuboz/build.mk b/board/shuboz/build.mk
index 1c0cbc4f63..45c71f962c 100644
--- a/board/shuboz/build.mk
+++ b/board/shuboz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/shuboz/ec.tasklist b/board/shuboz/ec.tasklist
index d9c1606eb2..abc796f74f 100644
--- a/board/shuboz/ec.tasklist
+++ b/board/shuboz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/shuboz/gpio.inc b/board/shuboz/gpio.inc
index b093a7e6d6..c824a80cd4 100644
--- a/board/shuboz/gpio.inc
+++ b/board/shuboz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/shuboz/led.c b/board/shuboz/led.c
index af91f32ec6..dc3361ba5a 100644
--- a/board/shuboz/led.c
+++ b/board/shuboz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,28 +9,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {LED_OFF, 2 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { LED_OFF, 2 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
diff --git a/board/spherion/battery.c b/board/spherion/battery.c
index 3613a4750c..83361bd9fc 100644
--- a/board/spherion/battery.c
+++ b/board/spherion/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -88,11 +88,12 @@ int charger_profile_override(struct charge_state_data *curr)
temp_sensor_read(TEMP_SENSOR_CHARGER, &charger_temp);
charger_temp_c = K_TO_C(charger_temp);
if (charger_temp_c > 52)
- curr->requested_current = MIN(curr->requested_current,
- 2200);
+ curr->requested_current =
+ MIN(curr->requested_current, 2200);
else if (charger_temp_c > 48)
- curr->requested_current = MIN(curr->requested_current,
- CONFIG_CHARGER_MAX_INPUT_CURRENT);
+ curr->requested_current =
+ MIN(curr->requested_current,
+ CONFIG_CHARGER_MAX_INPUT_CURRENT);
}
return 0;
diff --git a/board/spherion/board.c b/board/spherion/board.c
index 95fa0a06de..0170a8998e 100644
--- a/board/spherion/board.c
+++ b/board/spherion/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -46,30 +46,30 @@
#include "usb_pd_tcpm.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
/* Convert to mV (3000mV/1024). */
- {"VBUS_C0", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH0},
- {"BOARD_ID_0", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1},
- {"BOARD_ID_1", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2},
+ { "VBUS_C0", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH0 },
+ { "BOARD_ID_0", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH1 },
+ { "BOARD_ID_1", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH2 },
/* AMON/BMON gain = 17.97 */
- {"CHARGER_AMON_R", ADC_MAX_MVOLT * 1000 / 17.97, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH3},
- {"VBUS_C1", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5},
- {"CHARGER_PMON", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH6},
- {"TEMP_SENSOR_CHARGER", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
- CHIP_ADC_CH7},
+ { "CHARGER_AMON_R", ADC_MAX_MVOLT * 1000 / 17.97, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH3 },
+ { "VBUS_C1", ADC_MAX_MVOLT * 10, ADC_READ_MAX + 1, 0, CHIP_ADC_CH5 },
+ { "CHARGER_PMON", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0, CHIP_ADC_CH6 },
+ { "TEMP_SENSOR_CHARGER", ADC_MAX_MVOLT, ADC_READ_MAX + 1, 0,
+ CHIP_ADC_CH7 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -82,12 +82,10 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
* number of pwm channel greater than three.
*/
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = {
- .channel = PWM_HW_CH_DCR2,
- .flags = 0,
- .freq_hz = 10000,
- .pcfsr_sel = PWM_PRESCALER_C4
- },
+ [PWM_CH_KBLIGHT] = { .channel = PWM_HW_CH_DCR2,
+ .flags = 0,
+ .freq_hz = 10000,
+ .pcfsr_sel = PWM_PRESCALER_C4 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -106,13 +104,11 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, kb_backlight_disable, HOOK_PRIO_DEFAULT);
void board_usb_mux_init(void)
{
if (board_get_sub_board() == SUB_BOARD_TYPEC) {
- ps8743_tune_usb_eq(&usb_muxes[1],
- PS8743_USB_EQ_TX_12_8_DB,
+ ps8743_tune_usb_eq(usb_muxes[1].mux, PS8743_USB_EQ_TX_12_8_DB,
PS8743_USB_EQ_RX_12_8_DB);
- ps8743_field_update(&usb_muxes[1],
- PS8743_REG_DCI_CONFIG_2,
- PS8743_AUTO_DCI_MODE_MASK,
- PS8743_AUTO_DCI_MODE_FORCE_USB);
+ ps8743_field_update(usb_muxes[1].mux, PS8743_REG_DCI_CONFIG_2,
+ PS8743_AUTO_DCI_MODE_MASK,
+ PS8743_AUTO_DCI_MODE_FORCE_USB);
}
}
DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/spherion/board.h b/board/spherion/board.h
index a27258bc94..07f36a4efc 100644
--- a/board/spherion/board.h
+++ b/board/spherion/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,7 +45,7 @@
#define PD_MAX_CURRENT_MA CONFIG_CHARGER_MAX_INPUT_CURRENT
#define PD_MAX_VOLTAGE_MV 20000
#define PD_OPERATING_POWER_MW 15000
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
@@ -75,18 +75,15 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_CHARGER,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_CHARGER, TEMP_SENSOR_COUNT };
enum adc_channel {
- ADC_VBUS_C0, /* ADC 0 */
- ADC_BOARD_ID_0, /* ADC 1 */
- ADC_BOARD_ID_1, /* ADC 2 */
- ADC_CHARGER_AMON_R, /* ADC 3 */
- ADC_VBUS_C1, /* ADC 5 */
- ADC_CHARGER_PMON, /* ADC 6 */
+ ADC_VBUS_C0, /* ADC 0 */
+ ADC_BOARD_ID_0, /* ADC 1 */
+ ADC_BOARD_ID_1, /* ADC 2 */
+ ADC_CHARGER_AMON_R, /* ADC 3 */
+ ADC_VBUS_C1, /* ADC 5 */
+ ADC_CHARGER_PMON, /* ADC 6 */
ADC_TEMP_SENSOR_CHARGER, /* ADC 7 */
/* Number of ADC channels */
ADC_CH_COUNT,
diff --git a/board/spherion/build.mk b/board/spherion/build.mk
index 4dc5a3e62e..9126acf43f 100644
--- a/board/spherion/build.mk
+++ b/board/spherion/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/spherion/ec.tasklist b/board/spherion/ec.tasklist
index c92920ade6..ea717385a0 100644
--- a/board/spherion/ec.tasklist
+++ b/board/spherion/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/spherion/gpio.inc b/board/spherion/gpio.inc
index b618911e02..177ccd07ca 100644
--- a/board/spherion/gpio.inc
+++ b/board/spherion/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/spherion/led.c b/board/spherion/led.c
index aad85d02c1..54f073b8cb 100644
--- a/board/spherion/led.c
+++ b/board/spherion/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -16,19 +16,26 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
@@ -61,9 +68,8 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
if (led_id == EC_LED_ID_BATTERY_LED) {
brightness_range[EC_LED_COLOR_AMBER] =
- MT6360_LED_BRIGHTNESS_MAX;
- brightness_range[EC_LED_COLOR_BLUE] =
- MT6360_LED_BRIGHTNESS_MAX;
+ MT6360_LED_BRIGHTNESS_MAX;
+ brightness_range[EC_LED_COLOR_BLUE] = MT6360_LED_BRIGHTNESS_MAX;
}
}
diff --git a/board/stern/battery.c b/board/stern/battery.c
index 50d2bf397c..9edab52867 100644
--- a/board/stern/battery.c
+++ b/board/stern/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stern/board.c b/board/stern/board.c
index fd3a95a987..26576ede86 100644
--- a/board/stern/board.c
+++ b/board/stern/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "pwm.h"
@@ -46,8 +47,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -59,40 +60,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -100,8 +95,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -157,8 +152,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -171,13 +165,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -239,12 +236,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -301,8 +298,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -316,8 +312,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -356,17 +351,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(-1), 0},
- {0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(1) }
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
/* Lid accel private data */
diff --git a/board/stern/board.h b/board/stern/board.h
index f113969d3d..eedbc2a44c 100644
--- a/board/stern/board.h
+++ b/board/stern/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -55,7 +55,7 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
+#define CONFIG_ACCEL_LIS2DWL /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -71,20 +71,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_BATTERY 2
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_BATTERY 2
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/stern/build.mk b/board/stern/build.mk
index a6e1c010d7..f583684804 100644
--- a/board/stern/build.mk
+++ b/board/stern/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/stern/ec.tasklist b/board/stern/ec.tasklist
index 36be2e96a4..e77603a8e2 100644
--- a/board/stern/ec.tasklist
+++ b/board/stern/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stern/gpio.inc b/board/stern/gpio.inc
index 3a162d6124..85d080b2e9 100644
--- a/board/stern/gpio.inc
+++ b/board/stern/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stern/led.c b/board/stern/led.c
index ac4813c8c0..8a5f9d26d8 100644
--- a/board/stern/led.c
+++ b/board/stern/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -18,32 +18,37 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_POWER_LED,
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_POWER_LED,
+ EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
diff --git a/board/stm32f446e-eval/board.c b/board/stm32f446e-eval/board.c
index fd6ff8bbe2..7039064cbf 100644
--- a/board/stm32f446e-eval/board.c
+++ b/board/stm32f446e-eval/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,12 +20,12 @@
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("stm32f446-eval"),
- [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("EC Shell"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("stm32f446-eval"),
+ [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("EC Shell"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -43,25 +43,21 @@ struct dwc_usb usb_ctl = {
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "i2c1",
- .port = I2C_PORT_0,
- .kbps = 100,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "fmpi2c4",
- .port = FMPI2C_PORT_3,
- .kbps = 100,
- .scl = GPIO_FMPI2C_SCL,
- .sda = GPIO_FMPI2C_SDA
- },
+ { .name = "i2c1",
+ .port = I2C_PORT_0,
+ .kbps = 100,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "fmpi2c4",
+ .port = FMPI2C_PORT_3,
+ .kbps = 100,
+ .scl = GPIO_FMPI2C_SCL,
+ .sda = GPIO_FMPI2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-#define GPIO_SET_HS(bank, number) \
- (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number) * 2)))
+#define GPIO_SET_HS(bank, number) \
+ (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number)*2)))
void board_config_post_gpio_init(void)
{
@@ -74,27 +70,27 @@ void board_config_post_gpio_init(void)
GPIO_SET_HS(A, 11);
GPIO_SET_HS(A, 12);
- GPIO_SET_HS(C, 3);
- GPIO_SET_HS(C, 2);
- GPIO_SET_HS(C, 0);
- GPIO_SET_HS(A, 5);
+ GPIO_SET_HS(C, 3);
+ GPIO_SET_HS(C, 2);
+ GPIO_SET_HS(C, 0);
+ GPIO_SET_HS(A, 5);
- GPIO_SET_HS(B, 5);
+ GPIO_SET_HS(B, 5);
GPIO_SET_HS(B, 13);
GPIO_SET_HS(B, 12);
- GPIO_SET_HS(B, 2);
+ GPIO_SET_HS(B, 2);
GPIO_SET_HS(B, 10);
- GPIO_SET_HS(B, 1);
- GPIO_SET_HS(B, 0);
- GPIO_SET_HS(A, 3);
+ GPIO_SET_HS(B, 1);
+ GPIO_SET_HS(B, 0);
+ GPIO_SET_HS(A, 3);
/* Set I2C GPIO to HS */
- GPIO_SET_HS(B, 6);
- GPIO_SET_HS(B, 7);
- GPIO_SET_HS(F, 1);
- GPIO_SET_HS(F, 0);
- GPIO_SET_HS(A, 8);
- GPIO_SET_HS(B, 4);
- GPIO_SET_HS(C, 6);
- GPIO_SET_HS(C, 7);
+ GPIO_SET_HS(B, 6);
+ GPIO_SET_HS(B, 7);
+ GPIO_SET_HS(F, 1);
+ GPIO_SET_HS(F, 0);
+ GPIO_SET_HS(A, 8);
+ GPIO_SET_HS(B, 4);
+ GPIO_SET_HS(C, 6);
+ GPIO_SET_HS(C, 7);
}
diff --git a/board/stm32f446e-eval/board.h b/board/stm32f446e-eval/board.h
index aa498d6caa..4ae9117829 100644
--- a/board/stm32f446e-eval/board.h
+++ b/board/stm32f446e-eval/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,12 +43,12 @@
/* USB interface indexes (use define rather than enum to expand them) */
#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_COUNT 1
+#define USB_IFACE_COUNT 1
/* USB endpoint indexes (use define rather than enum to expand them) */
#define USB_EP_CONTROL 0
#define USB_EP_CONSOLE 1
-#define USB_EP_COUNT 2
+#define USB_EP_COUNT 2
/* This is not actually an EC so disable some features. */
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/stm32f446e-eval/build.mk b/board/stm32f446e-eval/build.mk
index 6b06f2bb8f..61e4b79d47 100644
--- a/board/stm32f446e-eval/build.mk
+++ b/board/stm32f446e-eval/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/stm32f446e-eval/ec.tasklist b/board/stm32f446e-eval/ec.tasklist
index 2a1ffbf652..6a12f02976 100644
--- a/board/stm32f446e-eval/ec.tasklist
+++ b/board/stm32f446e-eval/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stm32f446e-eval/gpio.inc b/board/stm32f446e-eval/gpio.inc
index afc8d1e486..8eb7c6090d 100644
--- a/board/stm32f446e-eval/gpio.inc
+++ b/board/stm32f446e-eval/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stm32l476g-eval/board.c b/board/stm32l476g-eval/board.c
index 70375abe95..e3f467ac50 100644
--- a/board/stm32l476g-eval/board.c
+++ b/board/stm32l476g-eval/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,14 +32,12 @@ void tick_event(void)
DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
#ifdef CTS_MODULE_I2C
-const struct i2c_port_t i2c_ports[] = {
- {
- .name = "test",
- .port = STM32_I2C2_PORT,
- .kbps = 100,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+const struct i2c_port_t i2c_ports[] = {
+ { .name = "test",
+ .port = STM32_I2C2_PORT,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
#endif
diff --git a/board/stm32l476g-eval/board.h b/board/stm32l476g-eval/board.h
index e8ce99845f..26ea530e4e 100644
--- a/board/stm32l476g-eval/board.h
+++ b/board/stm32l476g-eval/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,8 @@
#ifdef CTS_MODULE
/* CTS tests are small. We can use smaller size to expedite flash time. */
-#undef CONFIG_FLASH_SIZE_BYTES
-#define CONFIG_FLASH_SIZE_BYTES 0x00040000 /* 256k */
+#undef CONFIG_FLASH_SIZE_BYTES
+#define CONFIG_FLASH_SIZE_BYTES 0x00040000 /* 256k */
#endif
/* Optional features */
@@ -54,18 +54,18 @@
#undef CONFIG_FLASH_PHYSICAL
/* Timer selection */
-#define TIM_CLOCK32 5
+#define TIM_CLOCK32 5
/* External clock speeds (8 MHz) */
#define STM32_HSE_CLOCK 8000000
/* PLL configuration. Freq = STM32_HSE_CLOCK * n/m/r */
#undef STM32_PLLM
-#define STM32_PLLM 1
+#define STM32_PLLM 1
#undef STM32_PLLN
-#define STM32_PLLN 10
+#define STM32_PLLN 10
#undef STM32_PLLR
-#define STM32_PLLR 2
+#define STM32_PLLR 2
#include "gpio_signal.h"
diff --git a/board/stm32l476g-eval/build.mk b/board/stm32l476g-eval/build.mk
index 23c7cd9d38..d453ea9979 100644
--- a/board/stm32l476g-eval/build.mk
+++ b/board/stm32l476g-eval/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/stm32l476g-eval/ec.tasklist b/board/stm32l476g-eval/ec.tasklist
index adfd7c7e92..f580a9d9e5 100644
--- a/board/stm32l476g-eval/ec.tasklist
+++ b/board/stm32l476g-eval/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stm32l476g-eval/gpio.inc b/board/stm32l476g-eval/gpio.inc
index 9cf5bc0aa4..e84543f8f6 100644
--- a/board/stm32l476g-eval/gpio.inc
+++ b/board/stm32l476g-eval/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stm32l476g-eval/openocd-flash.cfg b/board/stm32l476g-eval/openocd-flash.cfg
index a347f88b79..2f6a266d93 100644
--- a/board/stm32l476g-eval/openocd-flash.cfg
+++ b/board/stm32l476g-eval/openocd-flash.cfg
@@ -1,4 +1,4 @@
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
diff --git a/board/storo/battery.c b/board/storo/battery.c
index b28e5bbf37..5a927ffc26 100644
--- a/board/storo/battery.c
+++ b/board/storo/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/storo/board.c b/board/storo/board.c
index d7e0305d1f..f6f3ed5750 100644
--- a/board/storo/board.c
+++ b/board/storo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,8 +48,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprints(CC_SYSTEM, format, ##args)
#define INT_RECHECK_US 5000
@@ -139,34 +139,26 @@ static void pen_detect_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_TEMP_SENSOR_3] = {
- .name = "TEMP_SENSOR3",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH15
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_TEMP_SENSOR_3] = { .name = "TEMP_SENSOR3",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH15 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -226,14 +218,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Retimer */
-enum tusb544_conf {
- USB_DP = 0,
- USB_DP_INV,
- USB,
- USB_INV,
- DP,
- DP_INV
-};
+enum tusb544_conf { USB_DP = 0, USB_DP_INV, USB, USB_INV, DP, DP_INV };
/*
* Registers we care about of are all the same between NCS8510 and TUSB544,
@@ -246,33 +231,32 @@ enum tusb544_conf {
*/
static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
{
- int rv = EC_SUCCESS;
+ int rv = EC_SUCCESS;
int reg;
enum tusb544_conf usb_mode = 0;
if (mux_state & USB_PD_MUX_USB_ENABLED) {
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* USB with DP */
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_DP_INV
- : USB_DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_DP_INV :
+ USB_DP;
} else {
/* USB without DP */
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_INV
- : USB;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_INV :
+ USB;
}
} else if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* DP without USB */
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? DP_INV
- : DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? DP_INV :
+ DP;
} else {
return EC_SUCCESS;
}
- rv = i2c_read8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL6, &reg);
+ rv = i2c_read8(me->i2c_port, me->i2c_addr_flags, TUSB544_REG_GENERAL6,
+ &reg);
if (rv)
return rv;
@@ -280,52 +264,52 @@ static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
reg &= ~TUSB544_VOD_DCGAIN_SEL;
reg |= (TUSB544_VOD_DCGAIN_SETTING_5 << 2);
- rv = i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL6, reg);
+ rv = i2c_write8(me->i2c_port, me->i2c_addr_flags, TUSB544_REG_GENERAL6,
+ reg);
if (rv)
return rv;
/* Write the retimer config byte */
if (usb_mode == USB_INV) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x15);
+ TUSB544_REG_GENERAL4, 0x15);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == USB) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x11);
+ TUSB544_REG_GENERAL4, 0x11);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == USB_DP_INV) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1F);
+ TUSB544_REG_GENERAL4, 0x1F);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == USB_DP) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1B);
+ TUSB544_REG_GENERAL4, 0x1B);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_1, 0xff);
+ TUSB544_REG_USB3_1_1, 0xff);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_USB3_1_2, 0xff);
+ TUSB544_REG_USB3_1_2, 0xff);
} else if (usb_mode == DP_INV) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1E);
+ TUSB544_REG_GENERAL4, 0x1E);
} else if (usb_mode == DP) {
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_GENERAL4, 0x1A);
+ TUSB544_REG_GENERAL4, 0x1A);
}
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_DISPLAYPORT_1, 0x66);
+ TUSB544_REG_DISPLAYPORT_1, 0x66);
rv |= i2c_write8(me->i2c_port, me->i2c_addr_flags,
- TUSB544_REG_DISPLAYPORT_2, 0x66);
+ TUSB544_REG_DISPLAYPORT_2, 0x66);
if (rv)
return EC_ERROR_UNKNOWN;
else
@@ -333,28 +317,37 @@ static int board_tusb544_set(const struct usb_mux *me, mux_state_t mux_state)
}
/* USB Retimer */
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
- .driver = &tusb544_drv,
- .board_set = &board_tusb544_set,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
+ .driver = &tusb544_drv,
+ .board_set = &board_tusb544_set,
+ },
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
},
};
@@ -461,8 +454,7 @@ int board_is_sourcing_vbus(int port)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -526,9 +518,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 14;
@@ -553,17 +544,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
@@ -639,11 +626,9 @@ struct motion_sensor_t motion_sensors[] = {
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-static const mat33_fp_t lid_lis2dwl_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_lis2dwl_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Lid accel private data */
static struct stprivate_data g_lis2dwl_data;
@@ -675,11 +660,9 @@ struct motion_sensor_t lis2dwl_lid_accel = {
},
};
-static const mat33_fp_t lid_KX022_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_KX022_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
static struct kionix_accel_data g_kx022_data;
struct motion_sensor_t kx022_lid_accel = {
@@ -710,11 +693,9 @@ struct motion_sensor_t kx022_lid_accel = {
};
static struct icm_drv_data_t g_icm42607_data;
-const mat33_fp_t based_ref_icm42607 = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t based_ref_icm42607 = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -743,29 +724,26 @@ struct motion_sensor_t icm42607_base_accel = {
};
struct motion_sensor_t icm42607_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM42607,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm42607_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm42607_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &based_ref_icm42607,
- .min_frequency = ICM42607_GYRO_MIN_FREQ,
- .max_frequency = ICM42607_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm42607_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &based_ref_icm42607,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
};
-
static struct bmi_drv_data_t g_bmi220_data;
-const mat33_fp_t based_ref_bmi220 = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t based_ref_bmi220 = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t bmi220_base_accel = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -794,20 +772,20 @@ struct motion_sensor_t bmi220_base_accel = {
};
struct motion_sensor_t bmi220_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI220,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi260_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi220_data,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &based_ref_bmi220,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_BMI220,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi260_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi220_data,
+ .port = I2C_PORT_ACCEL,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &based_ref_bmi220,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
};
void board_init(void)
@@ -846,13 +824,13 @@ void board_init(void)
if (board_id > 2) {
if (get_cbi_fw_config_tablet_mode()) {
if (get_cbi_ssfc_base_sensor() ==
- SSFC_SENSOR_ICM42607) {
+ SSFC_SENSOR_ICM42607) {
motion_sensors[BASE_ACCEL] =
- icm42607_base_accel;
+ icm42607_base_accel;
motion_sensors[BASE_GYRO] = icm42607_base_gyro;
CPRINTF("BASE GYRO is ICM42607");
} else if (get_cbi_ssfc_base_sensor() ==
- SSFC_SENSOR_BMI220) {
+ SSFC_SENSOR_BMI220) {
motion_sensors[BASE_ACCEL] = bmi220_base_accel;
motion_sensors[BASE_GYRO] = bmi220_base_gyro;
CPRINTF("BASE GYRO is BMI220");
@@ -864,7 +842,7 @@ void board_init(void)
motion_sensors[LID_ACCEL] = lis2dwl_lid_accel;
CPRINTF("LID_ACCEL is LIS2DWL");
} else if (get_cbi_ssfc_lid_sensor() ==
- SSFC_SENSOR_KX022) {
+ SSFC_SENSOR_KX022) {
motion_sensors[LID_ACCEL] = kx022_lid_accel;
CPRINTF("LID_ACCEL is KX022");
} else {
@@ -878,7 +856,7 @@ void board_init(void)
* line to float.
*/
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
}
} else {
if (get_cbi_ssfc_base_sensor() == SSFC_SENSOR_ICM42607) {
@@ -908,34 +886,34 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void motion_interrupt(enum gpio_signal signal)
{
- switch (get_cbi_ssfc_base_sensor()) {
- case SSFC_SENSOR_ICM42607:
- icm42607_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI220:
- bmi260_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI160:
- default:
- bmi160_interrupt(signal);
- break;
- }
+ switch (get_cbi_ssfc_base_sensor()) {
+ case SSFC_SENSOR_ICM42607:
+ icm42607_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI220:
+ bmi260_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI160:
+ default:
+ bmi160_interrupt(signal);
+ break;
+ }
}
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
- [TEMP_SENSOR_3] = {.name = "Cpu",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
+ [TEMP_SENSOR_3] = { .name = "Cpu",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/storo/board.h b/board/storo/board.h
index 4532d11b4e..93dd573ba1 100644
--- a/board/storo/board.h
+++ b/board/storo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,11 +25,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -37,19 +40,19 @@
/* LED */
#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
+#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
/* Sensors */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
#define CONFIG_ACCEL_LIS2DWL
#define CONFIG_ACCEL_KX022
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_ICM42607
#define CONFIG_ACCELGYRO_BMI220
#define CONFIG_I2C_XFER_LARGE_TRANSFER
@@ -57,7 +60,7 @@
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -95,12 +98,10 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
-
-#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
-
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
#ifndef __ASSEMBLER__
@@ -113,22 +114,15 @@ enum chg_id {
CHARGER_NUM,
};
-
-
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_TEMP_SENSOR_3, /* ADC15*/
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_TEMP_SENSOR_3, /* ADC15*/
ADC_CH_COUNT
};
diff --git a/board/storo/build.mk b/board/storo/build.mk
index 8167ca9966..01b890bf29 100644
--- a/board/storo/build.mk
+++ b/board/storo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/storo/cbi_ssfc.c b/board/storo/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/storo/cbi_ssfc.c
+++ b/board/storo/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/storo/cbi_ssfc.h b/board/storo/cbi_ssfc.h
index f4a51b8e91..bc6bc92286 100644
--- a/board/storo/cbi_ssfc.h
+++ b/board/storo/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -57,5 +57,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/storo/ec.tasklist b/board/storo/ec.tasklist
index d54ff847e6..8abd36b4be 100644
--- a/board/storo/ec.tasklist
+++ b/board/storo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/storo/gpio.inc b/board/storo/gpio.inc
index b7541c5259..cb07474f52 100644
--- a/board/storo/gpio.inc
+++ b/board/storo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/storo/led.c b/board/storo/led.c
index d5094f1f30..76bfc05861 100644
--- a/board/storo/led.c
+++ b/board/storo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,28 +10,37 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0_BAT_LOW] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0_BAT_LOW] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/storo/usb_pd_policy.c b/board/storo/usb_pd_policy.c
index 15faf41ffc..83c09bb99e 100644
--- a/board/storo/usb_pd_policy.c
+++ b/board/storo/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/stryke/battery.c b/board/stryke/battery.c
index 0144c049b5..7690cd420f 100644
--- a/board/stryke/battery.c
+++ b/board/stryke/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/stryke/board.c b/board/stryke/board.c
index 783f73a666..1d1bbbe949 100644
--- a/board/stryke/board.c
+++ b/board/stryke/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,8 +41,8 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* GPIO to enable/disable the USB Type-A port. */
const int usb_port_enable[CONFIG_USB_PORT_POWER_SMART_PORT_COUNT] = {
@@ -108,16 +108,16 @@ static void bc12_interrupt(enum gpio_signal signal)
/******************************************************************************/
/* SPI devices */
-const struct spi_device_t spi_devices[] = {
-};
+const struct spi_device_t spi_devices[] = {};
const unsigned int spi_devices_used = ARRAY_SIZE(spi_devices);
/******************************************************************************/
/* PWM channels. Must be in the exactly same order as in enum pwm_channel. */
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- [PWM_CH_FAN] = {.channel = 5, .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000},
+ [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -143,16 +143,20 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
[USB_PD_PORT_TCPC_0] = {
- .usb_port = USB_PD_PORT_TCPC_0,
- .driver = &anx7447_usb_mux_driver,
- .hpd_update = &anx7447_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_0,
+ .driver = &anx7447_usb_mux_driver,
+ .hpd_update = &anx7447_tcpc_update_hpd_status,
+ },
},
[USB_PD_PORT_TCPC_1] = {
- .usb_port = USB_PD_PORT_TCPC_1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USB_PD_PORT_TCPC_1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -181,22 +185,18 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/*
* TODO(b/124337208): P0 boards don't have this sensor mounted so the rotation
* matrix can't be tested properly. This needs to be revisited after EVT to make
* sure the rotaiton matrix for the lid sensor is correct.
*/
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -277,7 +277,7 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -296,32 +296,31 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/******************************************************************************/
/* MFT channels. These are logically separate from pwm_channels. */
const struct mft_t mft_channels[] = {
- [MFT_CH_0] = {NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN},
+ [MFT_CH_0] = { NPCX_MFT_MODULE_1, TCKC_LFCLK, PWM_CH_FAN },
};
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_1] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_2] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_1] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_2] = { "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Temp1",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Temp2",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Temp1",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Temp2",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-
/* Stryke Temperature sensors */
/*
* TODO(b/124316213): These setting need to be reviewed and set appropriately
@@ -331,8 +330,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
@@ -387,7 +386,6 @@ static void board_gpio_set_pp5000(void)
} else if (board_id >= 1) {
reset_gpio_flags(GPIO_EN_PP5000_A_V1, GPIO_OUT_LOW);
}
-
}
static void board_init(void)
diff --git a/board/stryke/board.h b/board/stryke/board.h
index 205c3bbd4a..165cdd53a8 100644
--- a/board/stryke/board.h
+++ b/board/stryke/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -100,16 +100,16 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_PG_EC_RSMRST_ODL GPIO_PG_EC_RSMRST_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_PCH_SYS_PWROK
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S4_L GPIO_SLP_S4_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_A_RAILS
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
#ifndef __ASSEMBLER__
@@ -121,8 +121,8 @@
extern enum gpio_signal gpio_en_pp5000_a;
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
ADC_CH_COUNT
};
@@ -133,11 +133,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_FAN, PWM_CH_COUNT };
enum fan_channel {
FAN_CH_0 = 0,
@@ -151,11 +147,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/stryke/build.mk b/board/stryke/build.mk
index 733912454f..13153c1526 100644
--- a/board/stryke/build.mk
+++ b/board/stryke/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/stryke/ec.tasklist b/board/stryke/ec.tasklist
index 4a1024a091..829be2b7c8 100644
--- a/board/stryke/ec.tasklist
+++ b/board/stryke/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/stryke/gpio.inc b/board/stryke/gpio.inc
index 8b241b2850..f839d16f84 100644
--- a/board/stryke/gpio.inc
+++ b/board/stryke/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,10 +16,10 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S4
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S4
GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(PG_EC_RSMRST_L, PIN(E, 2), GPIO_INT_BOTH, intel_x86_rsmrst_signal_interrupt)
diff --git a/board/stryke/led.c b/board/stryke/led.c
index 4e210f34e2..d49e29782c 100644
--- a/board/stryke/led.c
+++ b/board/stryke/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,22 +19,26 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/sweetberry/board.c b/board/sweetberry/board.c
index bee8f91a22..0fdfcda7be 100644
--- a/board/sweetberry/board.c
+++ b/board/sweetberry/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,14 +28,14 @@
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Sweetberry"),
- [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
- [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Sweetberry EC Shell"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Sweetberry"),
+ [USB_STR_SERIALNO] = USB_STRING_DESC("1234-a"),
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Sweetberry EC Shell"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -59,48 +59,43 @@ struct dwc_usb usb_ctl = {
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "i2c1",
- .port = I2C_PORT_0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "i2c2",
- .port = I2C_PORT_1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "i2c3",
- .port = I2C_PORT_2,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "fmpi2c4",
- .port = FMPI2C_PORT_3,
- .kbps = 900,
- .scl = GPIO_FMPI2C_SCL,
- .sda = GPIO_FMPI2C_SDA
- },
+ { .name = "i2c1",
+ .port = I2C_PORT_0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "i2c2",
+ .port = I2C_PORT_1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "i2c3",
+ .port = I2C_PORT_2,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "fmpi2c4",
+ .port = FMPI2C_PORT_3,
+ .kbps = 900,
+ .scl = GPIO_FMPI2C_SCL,
+ .sda = GPIO_FMPI2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-int usb_i2c_board_is_enabled(void) { return 1; }
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
-#define GPIO_SET_HS(bank, number) \
- (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number) * 2)))
+#define GPIO_SET_HS(bank, number) \
+ (STM32_GPIO_OSPEEDR(GPIO_##bank) |= (0x3 << ((number)*2)))
void board_config_post_gpio_init(void)
{
/* We use MCO2 clock passthrough to provide a clock to USB HS */
gpio_config_module(MODULE_MCO, 1);
/* GPIO PC9 to high speed */
- GPIO_SET_HS(C, 9);
+ GPIO_SET_HS(C, 9);
if (usb_ctl.phy_type == USB_PHY_ULPI)
gpio_set_level(GPIO_USB_MUX_SEL, 0);
@@ -111,29 +106,29 @@ void board_config_post_gpio_init(void)
GPIO_SET_HS(A, 11);
GPIO_SET_HS(A, 12);
- GPIO_SET_HS(C, 3);
- GPIO_SET_HS(C, 2);
- GPIO_SET_HS(C, 0);
- GPIO_SET_HS(A, 5);
+ GPIO_SET_HS(C, 3);
+ GPIO_SET_HS(C, 2);
+ GPIO_SET_HS(C, 0);
+ GPIO_SET_HS(A, 5);
- GPIO_SET_HS(B, 5);
+ GPIO_SET_HS(B, 5);
GPIO_SET_HS(B, 13);
GPIO_SET_HS(B, 12);
- GPIO_SET_HS(B, 2);
+ GPIO_SET_HS(B, 2);
GPIO_SET_HS(B, 10);
- GPIO_SET_HS(B, 1);
- GPIO_SET_HS(B, 0);
- GPIO_SET_HS(A, 3);
+ GPIO_SET_HS(B, 1);
+ GPIO_SET_HS(B, 0);
+ GPIO_SET_HS(A, 3);
/* Set I2C GPIO to HS */
- GPIO_SET_HS(B, 6);
- GPIO_SET_HS(B, 7);
- GPIO_SET_HS(F, 1);
- GPIO_SET_HS(F, 0);
- GPIO_SET_HS(A, 8);
- GPIO_SET_HS(B, 4);
- GPIO_SET_HS(C, 6);
- GPIO_SET_HS(C, 7);
+ GPIO_SET_HS(B, 6);
+ GPIO_SET_HS(B, 7);
+ GPIO_SET_HS(F, 1);
+ GPIO_SET_HS(F, 0);
+ GPIO_SET_HS(A, 8);
+ GPIO_SET_HS(B, 4);
+ GPIO_SET_HS(C, 6);
+ GPIO_SET_HS(C, 7);
}
static void board_init(void)
diff --git a/board/sweetberry/board.h b/board/sweetberry/board.h
index 55aab7d1ee..4387cd4094 100644
--- a/board/sweetberry/board.h
+++ b/board/sweetberry/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,28 +48,28 @@
#define DEFAULT_SERIALNO "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_UPDATE 1
-#define USB_IFACE_POWER 2
-#define USB_IFACE_I2C 3
-#define USB_IFACE_COUNT 4
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_UPDATE 1
+#define USB_IFACE_POWER 2
+#define USB_IFACE_I2C 3
+#define USB_IFACE_COUNT 4
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_UPDATE 2
-#define USB_EP_POWER 3
-#define USB_EP_I2C 4
-#define USB_EP_COUNT 5
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_UPDATE 2
+#define USB_EP_POWER 3
+#define USB_EP_I2C 4
+#define USB_EP_COUNT 5
#define CONFIG_USB_I2C
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define I2C_PORT_0 0
-#define I2C_PORT_1 1
-#define I2C_PORT_2 2
-#define FMPI2C_PORT_3 3
-#define I2C_PORT_COUNT 4
+#define I2C_PORT_0 0
+#define I2C_PORT_1 1
+#define I2C_PORT_2 2
+#define FMPI2C_PORT_3 3
+#define I2C_PORT_COUNT 4
/* This is not actually a Chromium EC so disable some features. */
#undef CONFIG_WATCHDOG_HELP
diff --git a/board/sweetberry/build.mk b/board/sweetberry/build.mk
index 6b06f2bb8f..61e4b79d47 100644
--- a/board/sweetberry/build.mk
+++ b/board/sweetberry/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2016 The Chromium OS Authors. All rights reserved.
+# Copyright 2016 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/sweetberry/ec.tasklist b/board/sweetberry/ec.tasklist
index c1fb169118..c45a1e89a7 100644
--- a/board/sweetberry/ec.tasklist
+++ b/board/sweetberry/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2016 The Chromium OS Authors. All rights reserved.
+/* Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/sweetberry/gpio.inc b/board/sweetberry/gpio.inc
index cfab7fc1f3..28b91d0dec 100644
--- a/board/sweetberry/gpio.inc
+++ b/board/sweetberry/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2016 The Chromium OS Authors. All rights reserved.
+ * Copyright 2016 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/taeko/battery.c b/board/taeko/battery.c
index 0fd9c9fab2..24ce4c1bdf 100644
--- a/board/taeko/battery.c
+++ b/board/taeko/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -151,7 +151,9 @@ __override bool board_battery_is_initialized(void)
bool batt_initialization_state;
int batt_status;
- batt_initialization_state = (battery_status(&batt_status) ? false :
- !!(batt_status & STATUS_INITIALIZED));
+ batt_initialization_state =
+ (battery_status(&batt_status) ?
+ false :
+ !!(batt_status & STATUS_INITIALIZED));
return batt_initialization_state;
}
diff --git a/board/taeko/board.c b/board/taeko/board.c
index f4f29e1199..79ef4029d6 100644
--- a/board/taeko/board.c
+++ b/board/taeko/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,8 +35,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -121,8 +121,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -138,7 +138,7 @@ enum battery_present battery_hw_present(void)
}
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Follow OEM request to limit the input current to
@@ -146,7 +146,6 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/taeko/board.h b/board/taeko/board.h
index a6395ffc61..c3193c8847 100644
--- a/board/taeko/board.h
+++ b/board/taeko/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,18 +30,17 @@
#define CONFIG_LED_ONOFF_STATES
/* Sensors */
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Button */
#define CONFIG_BUTTONS_RUNTIME_CONFIG
-
/* Change Request (b/199529373)
* GYRO sensor change from ST LSM6DSOETR3TR to ST LSM6DS3TR-C
* LSM6DSOETR3TR base accel/gyro if board id = 0
* LSM6DS3TR-C Base accel/gyro if board id > 0
*/
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_LSM6DSM
@@ -56,14 +55,13 @@
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL))
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_BMA4XX
#define CONFIG_ACCEL_LIS2DWL
@@ -72,7 +70,7 @@
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -80,7 +78,7 @@
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 1
+#define CONFIG_IO_EXPANDER_PORT_COUNT 1
#define CONFIG_USB_PD_FRS_PPC
#define CONFIG_USB_PD_FRS
@@ -88,6 +86,7 @@
#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
#define CONFIG_USBC_PPC_SYV682X
#define CONFIG_USBC_PPC_NX20P3483
+#define CONFIG_USBC_NX20P348X_RCP_5VSRC_MASK_ENABLE
/* I2C speed console command */
#define CONFIG_CMD_I2C_SPEED
@@ -96,76 +95,77 @@
#define CONFIG_HOSTCMD_I2C_CONTROL
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* The lower the input voltage, the higher the power efficiency. */
#define PD_PREFER_LOW_VOLTAGE
+#undef CONFIG_CMD_POWERINDEBUG
+
/*
* Macros for GPIO signals used in common code that don't match the
* schematic names. Signal names in gpio.inc match the schematic and are
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
-
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+
+#define I2C_ADDR_MP2964_FLAGS 0x20
/* Thermal features */
#define CONFIG_THERMISTOR
@@ -174,16 +174,16 @@
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan */
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
/* 37h BIT7:2 VSYS_TH2 6.0V */
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 60
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 60
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
/* 30h BIT13:12 Enable PSYS 00b */
#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
/* 31h BIT3 = 1 Enable ACOC */
@@ -200,15 +200,14 @@
#define CONFIG_CHARGER_BQ25710_PP_COMP
/* 36h UVP 5600mV */
#define CONFIG_CHARGER_BQ25720_VSYS_UVP_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_UVP \
- BQ25720_CHARGE_OPTION_4_VSYS_UVP__5P6
+#define CONFIG_CHARGER_BQ25720_VSYS_UVP BQ25720_CHARGE_OPTION_4_VSYS_UVP__5P6
/* 3Eh BIT15:8 VSYS_MIN 6.1V */
#define CONFIG_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_CUSTOM
#define CONFIG_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_MV 6100
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -228,17 +227,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_PORT_COUNT };
enum battery_type {
BATTERY_SMP_51W,
@@ -249,20 +240,14 @@ enum battery_type {
};
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/taeko/build.mk b/board/taeko/build.mk
index 442d30718f..9d193faf4e 100644
--- a/board/taeko/build.mk
+++ b/board/taeko/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/taeko/charger.c b/board/taeko/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/taeko/charger.c
+++ b/board/taeko/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/taeko/ec.tasklist b/board/taeko/ec.tasklist
index 6d995d6b44..29fd0bf4cb 100644
--- a/board/taeko/ec.tasklist
+++ b/board/taeko/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/taeko/fans.c b/board/taeko/fans.c
index e6273ec210..de3a49d45d 100644
--- a/board/taeko/fans.c
+++ b/board/taeko/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/taeko/fw_config.c b/board/taeko/fw_config.c
index 02480a6205..e04386051d 100644
--- a/board/taeko/fw_config.c
+++ b/board/taeko/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "fw_config.h"
#include "gpio.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union taeko_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/taeko/fw_config.h b/board/taeko/fw_config.h
index 4062946868..5217a72d0a 100644
--- a/board/taeko/fw_config.h
+++ b/board/taeko/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,20 +14,14 @@
* Source of truth is the project/taeko/taeko/config.star configuration file.
*/
-enum ec_cfg_usb_db_type {
- DB_USB_ABSENT = 0,
- DB_USB3_PS8815 = 1
-};
+enum ec_cfg_usb_db_type { DB_USB_ABSENT = 0, DB_USB3_PS8815 = 1 };
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_tabletmode_type {
- TABLETMODE_DISABLED = 0,
- TABLETMODE_ENABLED = 1
-};
+enum ec_cfg_tabletmode_type { TABLETMODE_DISABLED = 0, TABLETMODE_ENABLED = 1 };
enum ec_cfg_kbnumpad {
KEYBOARD_NUMBER_PAD_ABSENT = 0,
@@ -46,11 +40,11 @@ enum ec_cfg_emmc_status {
union taeko_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 2;
- uint32_t sd_db : 2;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 4;
+ enum ec_cfg_usb_db_type usb_db : 2;
+ uint32_t sd_db : 2;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 4;
/* b/194515356 - Fw config structure
* b/203630618 - Move tablet mode to bit14
* bit8-9: kb_layout
@@ -58,11 +52,11 @@ union taeko_cbi_fw_config {
* bit12: nvme
* bit13: emmc
*/
- enum ec_cfg_nvme_status nvme_status : 1;
- enum ec_cfg_emmc_status emmc_status : 1;
- enum ec_cfg_tabletmode_type tabletmode : 1;
- enum ec_cfg_kbnumpad kbnumpad : 1;
- uint32_t reserved_2 : 16;
+ enum ec_cfg_nvme_status nvme_status : 1;
+ enum ec_cfg_emmc_status emmc_status : 1;
+ enum ec_cfg_tabletmode_type tabletmode : 1;
+ enum ec_cfg_kbnumpad kbnumpad : 1;
+ uint32_t reserved_2 : 16;
};
uint32_t raw_value;
};
diff --git a/board/taeko/gpio.inc b/board/taeko/gpio.inc
index 216ecfe99d..44cb489257 100644
--- a/board/taeko/gpio.inc
+++ b/board/taeko/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/taeko/i2c.c b/board/taeko/i2c.c
index 2c990254fa..79eddd663d 100644
--- a/board/taeko/i2c.c
+++ b/board/taeko/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/taeko/keyboard.c b/board/taeko/keyboard.c
index 5ad9a6cdf3..943f9f2635 100644
--- a/board/taeko/keyboard.c
+++ b/board/taeko/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@ static const struct ec_response_keybd_config taeko_kb = {
};
static const struct ec_response_keybd_config tarlo_kb = {
- .num_top_row_keys = 14,
+ .num_top_row_keys = 11,
.action_keys = {
TK_BACK, /* T1 */
TK_REFRESH, /* T2 */
@@ -52,22 +52,58 @@ static const struct ec_response_keybd_config tarlo_kb = {
TK_SNAPSHOT, /* T5 */
TK_BRIGHTNESS_DOWN, /* T6 */
TK_BRIGHTNESS_UP, /* T7 */
- TK_ABSENT, /* T8 */
- TK_ABSENT, /* T9 */
- TK_ABSENT, /* T10 */
- TK_MICMUTE, /* T11 */
- TK_VOL_MUTE, /* T12 */
- TK_VOL_DOWN, /* T13 */
- TK_VOL_UP, /* T14 */
+ TK_MICMUTE, /* T8 */
+ TK_VOL_MUTE, /* T9 */
+ TK_VOL_DOWN, /* T10 */
+ TK_VOL_UP, /* T11 */
},
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+/*
+ * Row Column info for Top row keys T1 - T15.
+ * Since tarlo keyboard top row keys have some issue when press with search
+ * key together.
+ * Needs to add row and col setting for top row.
+ * Change T8 row, col to (0,1)
+ * Change T9 row, col to (1,5)
+ * Change T10 row, col to (3,5)
+ * Change T11 row, col to (0,9)
+ */
+__override struct key {
+ uint8_t row;
+ uint8_t col;
+} vivaldi_keys[] = {
+ { .row = 0, .col = 2 }, /* T1 */
+ { .row = 3, .col = 2 }, /* T2 */
+ { .row = 2, .col = 2 }, /* T3 */
+ { .row = 1, .col = 2 }, /* T4 */
+ { .row = 3, .col = 4 }, /* T5 */
+ { .row = 2, .col = 4 }, /* T6 */
+ { .row = 1, .col = 4 }, /* T7 */
+ { .row = 0, .col = 1 }, /* T8 */
+ { .row = 1, .col = 5 }, /* T9 */
+ { .row = 3, .col = 5 }, /* T10 */
+ { .row = 0, .col = 9 }, /* T11 */
+ { .row = 2, .col = 9 }, /* T12 */
+ { .row = 1, .col = 9 }, /* T13 */
+ { .row = 0, .col = 4 }, /* T14 */
+ { .row = 0, .col = 11 }, /* T15 */
+};
+BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
+
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (ec_cfg_has_keyboard_number_pad())
return &tarlo_kb;
- else
+ else {
+ vivaldi_keys[7].row = 2; /* T8 */
+ vivaldi_keys[7].col = 9;
+ vivaldi_keys[8].row = 1; /* T9 */
+ vivaldi_keys[8].col = 9;
+ vivaldi_keys[9].row = 0; /* T10 */
+ vivaldi_keys[9].col = 4;
return &taeko_kb;
+ }
}
diff --git a/board/taeko/led.c b/board/taeko/led.c
index 35d4fe4146..7a58e486b0 100644
--- a/board/taeko/led.c
+++ b/board/taeko/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,44 +14,49 @@
#include "led_common.h"
#include "gpio.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/taeko/pwm.c b/board/taeko/pwm.c
index b5fef384f9..899cf1db15 100644
--- a/board/taeko/pwm.c
+++ b/board/taeko/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,7 +32,6 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
static void board_pwm_init(void)
{
-
pwm_enable(PWM_CH_KBLIGHT, 1);
pwm_set_duty(PWM_CH_KBLIGHT, 50);
}
diff --git a/board/taeko/sensors.c b/board/taeko/sensors.c
index 22a349d95f..f695862fa8 100644
--- a/board/taeko/sensors.c
+++ b/board/taeko/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,8 +22,8 @@
#include "tablet_mode.h"
#if 0
-#define CPRINTS(format, args...) ccprints(format, ## args)
-#define CPRINTF(format, args...) ccprintf(format, ## args)
+#define CPRINTS(format, args...) ccprints(format, ##args)
+#define CPRINTF(format, args...) ccprintf(format, ##args)
#else
#define CPRINTS(format, args...)
#define CPRINTF(format, args...)
@@ -70,23 +70,17 @@ static struct lsm6dso_data lsm6dso_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* The matrix for new DB */
-static const mat33_fp_t lid_ref_for_new_DB = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_ref_for_new_DB = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* Matrix to rotate lid and base sensor into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t bma422_lid_accel = {
.name = "Lid Accel - BMA",
@@ -243,7 +237,6 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#endif
-
static void board_detect_motionsensor(void)
{
int ret;
@@ -260,8 +253,8 @@ static void board_detect_motionsensor(void)
return;
/* Check lid accel chip */
- ret = i2c_read8(I2C_PORT_SENSOR, LIS2DW12_ADDR1,
- LIS2DW12_WHO_AM_I_REG, &val);
+ ret = i2c_read8(I2C_PORT_SENSOR, LIS2DW12_ADDR1, LIS2DW12_WHO_AM_I_REG,
+ &val);
if (ret == 0 && val == LIS2DW12_WHO_AM_I) {
CPRINTS("LID_ACCEL is LIS2DW12");
return;
@@ -281,8 +274,7 @@ static void board_detect_motionsensor(void)
*/
if (get_board_id() >= 2) {
/* Need to change matrix when board ID >= 2 */
- bma422_lid_accel.rot_standard_ref =
- &lid_ref_for_new_DB;
+ bma422_lid_accel.rot_standard_ref = &lid_ref_for_new_DB;
}
return;
}
@@ -293,7 +285,7 @@ static void board_detect_motionsensor(void)
CPRINTS("No LID_ACCEL are detected");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsensor,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
static void baseboard_sensors_init(void)
{
@@ -316,7 +308,7 @@ static void baseboard_sensors_init(void)
if (get_board_id() >= 2) {
/* Need to change matrix when board ID >= 2 */
motion_sensors[LID_ACCEL].rot_standard_ref =
- &lid_ref_for_new_DB;
+ &lid_ref_for_new_DB;
}
/* Enable gpio interrupt for base accelgyro sensor */
@@ -327,41 +319,32 @@ static void baseboard_sensors_init(void)
gmr_tablet_switch_disable();
gpio_set_flags(GPIO_TABLET_MODE_L, GPIO_INPUT | GPIO_PULL_DOWN);
/* Gyro is not present, don't allow line to float */
- gpio_set_flags(GPIO_EC_IMU_INT_R_L, GPIO_INPUT |
- GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_EC_IMU_INT_R_L,
+ GPIO_INPUT | GPIO_PULL_DOWN);
}
}
DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_2_FAN] = {
- .name = "FAN",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_FAN
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "CHARGER",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
- [TEMP_SENSOR_4_CPUCHOKE] = {
- .name = "CPU CHOKE",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_CPUCHOKE
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_2_FAN] = { .name = "FAN",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2_FAN },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "CHARGER",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
+ [TEMP_SENSOR_4_CPUCHOKE] = { .name = "CPU CHOKE",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_CPUCHOKE },
};
-
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
@@ -374,8 +357,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -384,7 +367,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
}, \
.temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+ .temp_fan_max = C_TO_K(70), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
@@ -404,8 +387,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -414,7 +397,7 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
}, \
.temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+ .temp_fan_max = C_TO_K(70), \
}
__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
diff --git a/board/taeko/usbc_config.c b/board/taeko/usbc_config.c
index 0a1b7ff194..71a495c402 100644
--- a/board/taeko/usbc_config.c
+++ b/board/taeko/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,13 +34,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#if 0
/* Debug only! */
-#define CPRINTSUSB(format, args...) cprints(CC_USBPD, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBPD, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBPD, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBPD, format, ##args)
#else
#define CPRINTSUSB(format, args...)
#define CPRINTFUSB(format, args...)
@@ -99,24 +99,31 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -169,21 +176,20 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x0f,
+ &val) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
else {
CPRINTS("delay 10ms to make sure PS8815 is waken from idle");
msleep(10);
}
-
- if (i2c_write8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x0f,
+ &val) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -209,10 +215,11 @@ static void board_init_ps8815_detection(void)
CPRINTSUSB("%s", __func__);
- rv = i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x00, &val);
+ rv = i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x00,
+ &val);
- db_usb_hw_pres = (rv == EC_SUCCESS)?DB_USB_PRESENT:DB_USB_NOT_PRESENT;
+ db_usb_hw_pres = (rv == EC_SUCCESS) ? DB_USB_PRESENT :
+ DB_USB_NOT_PRESENT;
if (db_usb_hw_pres == DB_USB_NOT_PRESENT)
CPRINTS("DB isn't plugged or something went wrong!");
@@ -230,7 +237,7 @@ static bool board_detect_ps8815_db(void)
return true;
if (ec_cfg_usb_db_type() == DB_USB3_PS8815 &&
- db_usb_hw_pres == DB_USB_PRESENT)
+ db_usb_hw_pres == DB_USB_PRESENT)
return true;
CPRINTSUSB("No PS8815 DB");
@@ -257,8 +264,7 @@ void board_reset_pd_mcu(void)
/*
* delay for power-on to reset-off and min. assertion time
*/
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 1);
gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
@@ -274,7 +280,7 @@ void board_reset_pd_mcu(void)
*/
board_init_ps8815_detection();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
static void board_tcpc_init(void)
@@ -385,7 +391,7 @@ __override bool board_is_dts_port(int port)
__override uint8_t board_get_usb_pd_port_count(void)
{
- CPRINTSUSB("%s is called by task_id:%d", __func__, task_get_current());
+ CPRINTSUSB("%s is called by task_id:%d", __func__, task_get_current());
if (board_detect_ps8815_db())
return CONFIG_USB_PD_PORT_MAX_COUNT;
diff --git a/board/taeko/usbc_config.h b/board/taeko/usbc_config.h
index 9030333dbc..9a35b4880f 100644
--- a/board/taeko/usbc_config.h
+++ b/board/taeko/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/taniks/battery.c b/board/taniks/battery.c
index f62aae62a1..013c27602c 100644
--- a/board/taniks/battery.c
+++ b/board/taniks/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -124,7 +124,9 @@ __override bool board_battery_is_initialized(void)
bool batt_initialization_state;
int batt_status;
- batt_initialization_state = (battery_status(&batt_status) ? false :
- !!(batt_status & STATUS_INITIALIZED));
+ batt_initialization_state =
+ (battery_status(&batt_status) ?
+ false :
+ !!(batt_status & STATUS_INITIALIZED));
return batt_initialization_state;
}
diff --git a/board/taniks/board.c b/board/taniks/board.c
index 894e055b9a..5da998524b 100644
--- a/board/taniks/board.c
+++ b/board/taniks/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,8 +34,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
/******************************************************************************/
/* USB-A charging control */
@@ -60,9 +60,7 @@ __override void board_cbi_init(void)
void board_init(void)
{
-#ifdef SECTION_IS_RW
rgbkbd_register_init_setting(&rgbkbd_init_taniks);
-#endif
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -102,8 +100,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -119,7 +117,7 @@ enum battery_present battery_hw_present(void)
}
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Follow OEM request to limit the input current to
@@ -127,7 +125,6 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/taniks/board.h b/board/taniks/board.h
index 0756395afa..6cd42ad7bb 100644
--- a/board/taniks/board.h
+++ b/board/taniks/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,15 +40,14 @@
#define CONFIG_LED_ONOFF_STATES
/* Sensors */
-#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Change Request (b/211078551)
* GYRO sensor change from ST LSM6DSOETR3TR to ST LSM6DS3TR-C
* LSM6DSOETR3TR base accel/gyro if board id = 0
* LSM6DS3TR-C Base accel/gyro if board id > 0
*/
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_LSM6DSM
@@ -63,35 +62,34 @@
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL))
/* Lid accel */
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_ACCEL_BMA4XX
#define CONFIG_ACCEL_LIS2DWL
-
/* Sensor console commands */
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 1
+#define CONFIG_IO_EXPANDER_PORT_COUNT 1
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_TCPM_PS8815
#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
#define CONFIG_USBC_PPC_SYV682X
#define CONFIG_USBC_PPC_NX20P3483
+#define CONFIG_USBC_NX20P348X_RCP_5VSRC_MASK_ENABLE
#define CONFIG_USB_PD_FRS_PPC
#define CONFIG_USB_PD_FRS
@@ -103,17 +101,17 @@
#define CONFIG_HOSTCMD_I2C_CONTROL
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* The lower the input voltage, the higher the power efficiency. */
#define PD_PREFER_LOW_VOLTAGE
@@ -124,94 +122,94 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KSI_00 GPIO_EC_KSI_00
-#define GPIO_KSI_01 GPIO_EC_KSI_01
-#define GPIO_KSI_02 GPIO_EC_KSI_02
-#define GPIO_KSI_03 GPIO_EC_KSI_03
-#define GPIO_KSI_04 GPIO_EC_KSI_04
-#define GPIO_KSI_05 GPIO_EC_KSI_05
-#define GPIO_KSI_06 GPIO_EC_KSI_06
-#define GPIO_KSI_07 GPIO_EC_KSI_07
-#define GPIO_KSO_00 GPIO_EC_KSO_00
-#define GPIO_KSO_01 GPIO_EC_KSO_01
-#define GPIO_KSO_02 GPIO_EC_KSO_02_R
-#define GPIO_KSO_03 GPIO_EC_KSO_03
-#define GPIO_KSO_04 GPIO_EC_KSO_04
-#define GPIO_KSO_05 GPIO_EC_KSO_05
-#define GPIO_KSO_06 GPIO_EC_KSO_06_R
-#define GPIO_KSO_07 GPIO_EC_KSO_07_R
-#define GPIO_KSO_08 GPIO_EC_KSO_08
-#define GPIO_KSO_09 GPIO_EC_KSO_09
-#define GPIO_KSO_10 GPIO_EC_KSO_10
-#define GPIO_KSO_11 GPIO_EC_KSO_11
-#define GPIO_KSO_12 GPIO_EC_KSO_12
-#define GPIO_KSO_13 GPIO_EC_KSO_13
-#define GPIO_KSO_14 GPIO_EC_KSO_14
-#define GPIO_RFR_KEY_L GPIO_EC_RFR_KEY_ODL_R
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KSI_00 GPIO_EC_KSI_00
+#define GPIO_KSI_01 GPIO_EC_KSI_01
+#define GPIO_KSI_02 GPIO_EC_KSI_02
+#define GPIO_KSI_03 GPIO_EC_KSI_03
+#define GPIO_KSI_04 GPIO_EC_KSI_04
+#define GPIO_KSI_05 GPIO_EC_KSI_05
+#define GPIO_KSI_06 GPIO_EC_KSI_06
+#define GPIO_KSI_07 GPIO_EC_KSI_07
+#define GPIO_KSO_00 GPIO_EC_KSO_00
+#define GPIO_KSO_01 GPIO_EC_KSO_01
+#define GPIO_KSO_02 GPIO_EC_KSO_02_R
+#define GPIO_KSO_03 GPIO_EC_KSO_03
+#define GPIO_KSO_04 GPIO_EC_KSO_04
+#define GPIO_KSO_05 GPIO_EC_KSO_05
+#define GPIO_KSO_06 GPIO_EC_KSO_06_R
+#define GPIO_KSO_07 GPIO_EC_KSO_07_R
+#define GPIO_KSO_08 GPIO_EC_KSO_08
+#define GPIO_KSO_09 GPIO_EC_KSO_09
+#define GPIO_KSO_10 GPIO_EC_KSO_10
+#define GPIO_KSO_11 GPIO_EC_KSO_11
+#define GPIO_KSO_12 GPIO_EC_KSO_12
+#define GPIO_KSO_13 GPIO_EC_KSO_13
+#define GPIO_KSO_14 GPIO_EC_KSO_14
+#define GPIO_RFR_KEY_L GPIO_EC_RFR_KEY_ODL_R
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM
#define CONFIG_KEYBOARD_BACKLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_PORT_KBMCU NPCX_I2C_PORT3_0
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
-
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_KBMCU NPCX_I2C_PORT3_0
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
+
+#define I2C_ADDR_MP2964_FLAGS 0x20
/* Thermal features */
#define CONFIG_THERMISTOR
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_SEQ_EC_DSW_PWROK
+#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_SEQ_EC_DSW_PWROK
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan */
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
/* 37h BIT7:2 VSYS_TH2 6.0V */
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 60
+#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 60
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
/* 30h BIT13:12 Enable PSYS 00b */
#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
/* 30h BIT7 1.2V enable*/
@@ -232,24 +230,23 @@
#define CONFIG_CHARGER_BQ25710_PP_COMP
/* 36h UVP 5600mV */
#define CONFIG_CHARGER_BQ25720_VSYS_UVP_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_UVP \
- BQ25720_CHARGE_OPTION_4_VSYS_UVP__5P6
+#define CONFIG_CHARGER_BQ25720_VSYS_UVP BQ25720_CHARGE_OPTION_4_VSYS_UVP__5P6
/* 3Eh BIT15:8 VSYS_MIN 6.1V */
#define CONFIG_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_CUSTOM
#define CONFIG_CHARGER_BQ25710_VSYS_MIN_VOLTAGE_MV 6100
/* RGB Keyboard */
-#define GPIO_RGBKBD_SDB_L GPIO_KBMCU_INT_ODL
-#ifdef SECTION_IS_RW
+#define GPIO_RGBKBD_SDB_L GPIO_KBMCU_INT_ODL
+
#define CONFIG_RGB_KEYBOARD
-#define CONFIG_LED_DRIVER_AW20198 /* Awinic AW20198 on I2C */
-#endif
-#define RGB_GRID0_COL 8
-#define RGB_GRID0_ROW 6
+#define CONFIG_LED_DRIVER_AW20198 /* Awinic AW20198 on I2C */
+
+#define RGB_GRID0_COL 8
+#define RGB_GRID0_ROW 6
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -275,17 +272,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL = 0, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
-enum ioex_port {
- IOEX_C0_NCT38XX = 0,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT38XX = 0, IOEX_PORT_COUNT };
enum battery_type {
BATTERY_SMP_51W,
@@ -295,19 +284,13 @@ enum battery_type {
};
enum pwm_channel {
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/taniks/build.mk b/board/taniks/build.mk
index 2afcd5a0f8..7d01cfff96 100644
--- a/board/taniks/build.mk
+++ b/board/taniks/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/taniks/charger.c b/board/taniks/charger.c
index 476ce97df2..a4fa209246 120000..100644
--- a/board/taniks/charger.c
+++ b/board/taniks/charger.c
@@ -1 +1,90 @@
-../../baseboard/brya/charger_bq25720.c \ No newline at end of file
+/* Copyright 2021 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "common.h"
+
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/charger/bq25710.h"
+#include "usbc_ppc.h"
+#include "usb_pd.h"
+#include "util.h"
+
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
+
+#ifndef CONFIG_ZEPHYR
+/* Charger Chip Configuration */
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
+ .drv = &bq25710_drv,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
+#endif
+
+int board_set_active_charge_port(int port)
+{
+ int is_valid_port = board_is_usb_pd_port_present(port);
+ int i;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTSUSB("Disabling all charger ports");
+
+ /* Disable all ports. */
+ for (i = 0; i < ppc_cnt; i++) {
+ /*
+ * Do not return early if one fails otherwise we can
+ * get into a boot loop assertion failure.
+ */
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("Disabling C%d as sink failed.", i);
+ }
+
+ return EC_SUCCESS;
+ } else if (!is_valid_port) {
+ return EC_ERROR_INVAL;
+ }
+
+ /* Check if the port is sourcing VBUS. */
+ if (ppc_is_sourcing_vbus(port)) {
+ CPRINTFUSB("Skip enable C%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ CPRINTSUSB("New charge port: C%d", port);
+
+ /*
+ * Turn off the other ports' sink path FETs, before enabling the
+ * requested charge port.
+ */
+ for (i = 0; i < ppc_cnt; i++) {
+ if (i == port)
+ continue;
+
+ if (ppc_vbus_sink_enable(i, 0))
+ CPRINTSUSB("C%d: sink path disable failed.", i);
+ }
+
+ /* Enable requested charge port. */
+ if (ppc_vbus_sink_enable(port, 1)) {
+ CPRINTSUSB("C%d: sink path enable failed.", port);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ return EC_SUCCESS;
+}
+
+__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+}
diff --git a/board/taniks/ec.tasklist b/board/taniks/ec.tasklist
index 13a5229984..c879d3f77c 100644
--- a/board/taniks/ec.tasklist
+++ b/board/taniks/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -12,7 +12,7 @@
#define CONFIG_TASK_LIST \
TASK_ALWAYS(HOOKS, hook_task, NULL, HOOKS_TASK_STACK_SIZE) \
- TASK_ALWAYS_RW(RGBKBD, rgbkbd_task, NULL, BASEBOARD_RGBKBD_TASK_STACK_SIZE) \
+ TASK_ALWAYS(RGBKBD, rgbkbd_task, NULL, BASEBOARD_RGBKBD_TASK_STACK_SIZE) \
TASK_ALWAYS(CHG_RAMP, chg_ramp_task, NULL, BASEBOARD_CHG_RAMP_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 0, TASK_STACK_SIZE) \
diff --git a/board/taniks/fans.c b/board/taniks/fans.c
index d50d3e5506..aeb2ff2caa 100644
--- a/board/taniks/fans.c
+++ b/board/taniks/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/taniks/fw_config.c b/board/taniks/fw_config.c
index cf1e27ad83..7d6323c868 100644
--- a/board/taniks/fw_config.c
+++ b/board/taniks/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "fw_config.h"
#include "gpio.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union taniks_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
@@ -65,7 +65,7 @@ void board_init_fw_config(void)
CPRINTS("CBI: Using board defaults for early board");
if (ec_cfg_has_tabletmode()) {
fw_config = fw_config_defaults;
- }
+ }
}
determine_storage();
diff --git a/board/taniks/fw_config.h b/board/taniks/fw_config.h
index 9e1b0ebdf1..05ca552538 100644
--- a/board/taniks/fw_config.h
+++ b/board/taniks/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,20 +14,14 @@
* Source of truth is the project/taniks/taniks/config.star configuration file.
*/
-enum ec_cfg_usb_db_type {
- DB_USB_ABSENT = 0,
- DB_USB3_PS8815 = 1
-};
+enum ec_cfg_usb_db_type { DB_USB_ABSENT = 0, DB_USB3_PS8815 = 1 };
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-enum ec_cfg_tabletmode_type {
- TABLETMODE_DISABLED = 0,
- TABLETMODE_ENABLED = 1
-};
+enum ec_cfg_tabletmode_type { TABLETMODE_DISABLED = 0, TABLETMODE_ENABLED = 1 };
enum ec_cfg_nvme_status {
NVME_DISABLED = 0,
@@ -40,11 +34,11 @@ enum ec_cfg_emmc_status {
union taniks_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 2;
- uint32_t sd_db : 2;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 4;
+ enum ec_cfg_usb_db_type usb_db : 2;
+ uint32_t sd_db : 2;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 4;
/* b/211079131 - Fw config structure
* b/211076082 - Move tablet mode to bit14
* bit8-9: kb_layout
@@ -52,10 +46,10 @@ union taniks_cbi_fw_config {
* bit12: nvme
* bit13: emmc
*/
- enum ec_cfg_nvme_status nvme_status : 1;
- enum ec_cfg_emmc_status emmc_status : 1;
- enum ec_cfg_tabletmode_type tabletmode : 1;
- uint32_t reserved_2 : 17;
+ enum ec_cfg_nvme_status nvme_status : 1;
+ enum ec_cfg_emmc_status emmc_status : 1;
+ enum ec_cfg_tabletmode_type tabletmode : 1;
+ uint32_t reserved_2 : 17;
};
uint32_t raw_value;
};
diff --git a/board/taniks/gpio.inc b/board/taniks/gpio.inc
index 0dff3216de..d2c2bdffb9 100644
--- a/board/taniks/gpio.inc
+++ b/board/taniks/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/taniks/i2c.c b/board/taniks/i2c.c
index 769385c46f..5be2ad4b85 100644
--- a/board/taniks/i2c.c
+++ b/board/taniks/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,7 +44,8 @@ const struct i2c_port_t i2c_ports[] = {
},
{
/* I2C4 C1 TCPC */
- /* TODO(b/211080526): Change TCPC1's (PS8815) I2C frequency from 400Khz to 1000Khz */
+ /* TODO(b/211080526): Change TCPC1's (PS8815) I2C frequency from
+ 400Khz to 1000Khz */
.name = "tcpc1",
.port = I2C_PORT_USB_C1_TCPC,
.kbps = 1000,
diff --git a/board/taniks/keyboard.c b/board/taniks/keyboard.c
index 99099b4661..069627a168 100644
--- a/board/taniks/keyboard.c
+++ b/board/taniks/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -28,7 +28,7 @@ __override struct keyboard_scan_config keyscan_config = {
};
static const struct ec_response_keybd_config taniks_kb = {
- .num_top_row_keys = 14,
+ .num_top_row_keys = 11,
.action_keys = {
TK_BACK, /* T1 */
TK_REFRESH, /* T2 */
@@ -37,17 +37,47 @@ static const struct ec_response_keybd_config taniks_kb = {
TK_SNAPSHOT, /* T5 */
TK_BRIGHTNESS_DOWN, /* T6 */
TK_BRIGHTNESS_UP, /* T7 */
- TK_ABSENT, /* T8 */
- TK_ABSENT, /* T9 */
- TK_ABSENT, /* T10 */
- TK_MICMUTE, /* T11 */
- TK_VOL_MUTE, /* T12 */
- TK_VOL_DOWN, /* T13 */
- TK_VOL_UP, /* T14 */
+ TK_MICMUTE, /* T8 */
+ TK_VOL_MUTE, /* T9 */
+ TK_VOL_DOWN, /* T10 */
+ TK_VOL_UP, /* T11 */
},
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
+/*
+ * Row Column info for Top row keys T1 - T15.
+ * For taniks keyboard layout(T11 - T14) and
+ * printing(F8 - F11) are different issue.
+ * Move T11 - T14 row and col setting to T8 - T11.
+ * Need define row col to mapping matrix layout.
+ * Change T8 row, col to (0,1)
+ * Change T9 row, col to (1,5)
+ * Change T10 row, col to (3,5)
+ * Change T11 row, col to (0,9)
+ */
+__override const struct key {
+ uint8_t row;
+ uint8_t col;
+} vivaldi_keys[] = {
+ { .row = 0, .col = 2 }, /* T1 */
+ { .row = 3, .col = 2 }, /* T2 */
+ { .row = 2, .col = 2 }, /* T3 */
+ { .row = 1, .col = 2 }, /* T4 */
+ { .row = 3, .col = 4 }, /* T5 */
+ { .row = 2, .col = 4 }, /* T6 */
+ { .row = 1, .col = 4 }, /* T7 */
+ { .row = 0, .col = 1 }, /* T8 */
+ { .row = 1, .col = 5 }, /* T9 */
+ { .row = 3, .col = 5 }, /* T10 */
+ { .row = 0, .col = 9 }, /* T11 */
+ { .row = 2, .col = 9 }, /* T12 */
+ { .row = 1, .col = 9 }, /* T13 */
+ { .row = 0, .col = 4 }, /* T14 */
+ { .row = 0, .col = 11 }, /* T15 */
+};
+BUILD_ASSERT(ARRAY_SIZE(vivaldi_keys) == MAX_TOP_ROW_KEYS);
+
static struct rgb_s grid0[RGB_GRID0_COL * RGB_GRID0_ROW];
struct rgbkbd rgbkbds[] = {
@@ -66,146 +96,30 @@ const uint8_t rgbkbd_count = ARRAY_SIZE(rgbkbds);
const uint8_t rgbkbd_hsize = RGB_GRID0_COL;
const uint8_t rgbkbd_vsize = RGB_GRID0_ROW;
-#define LED(x, y) RGBKBD_COORD((x), (y))
-#define DELM RGBKBD_DELM
+enum ec_rgbkbd_type rgbkbd_type = EC_RGBKBD_TYPE_FOUR_ZONES_40_LEDS;
+
+#define LED(x, y) RGBKBD_COORD((x), (y))
+#define DELM RGBKBD_DELM
+
const uint8_t rgbkbd_map[] = {
- DELM, /* 0: (null) */
- LED( 0, 0), DELM, /* 1: ~ ` */
- LED( 2, 0), LED( 4, 0), DELM, /* 2: ! 1 */
- LED( 6, 0), DELM, /* 3: @ 2 */
- LED( 0, 1), DELM, /* 4: # 3 */
- LED( 2, 1), DELM, /* 5: $ 4 */
- LED( 4, 1), LED( 6, 1), DELM, /* 6: % 5 */
- LED( 0, 2), DELM, /* 7: ^ 6 */
- LED( 2, 2), DELM, /* 8: & 7 */
- LED( 4, 2), DELM, /* 9: * 8 */
- LED( 6, 2), DELM, /* 10: ( 9 */
- LED( 0, 3), DELM, /* 11: ) 0 */
- LED( 1, 3), DELM, /* 12: _ - */
- LED( 3, 3), DELM, /* 13: + = */
- DELM, /* 14: (null) */
- LED( 5, 3), LED( 6, 3), DELM, /* 15: backspace */
- LED( 0, 0), DELM, /* 16: tab */
- LED( 2, 0), LED( 4, 0), DELM, /* 17: q */
- LED( 6, 0), DELM, /* 18: w */
- LED( 0, 1), DELM, /* 19: e */
- LED( 2, 1), DELM, /* 20: r */
- LED( 4, 1), LED( 6, 1), DELM, /* 21: t */
- LED( 0, 2), DELM, /* 22: y */
- LED( 2, 2), DELM, /* 23: u */
- LED( 4, 2), DELM, /* 24: i */
- LED( 6, 2), DELM, /* 25: o */
- LED( 0, 3), LED( 1, 3), DELM, /* 26: p */
- LED( 3, 3), DELM, /* 27: [ { */
- LED( 5, 3), DELM, /* 28: ] } */
- LED( 6, 3), DELM, /* 29: \ | */
- LED( 0, 0), DELM, /* 30: caps lock */
- LED( 2, 0), LED( 4, 0), DELM, /* 31: a */
- LED( 6, 0), DELM, /* 32: s */
- LED( 0, 1), DELM, /* 33: d */
- LED( 2, 1), DELM, /* 34: f */
- LED( 4, 1), LED( 6, 1), DELM, /* 35: g */
- LED( 0, 2), DELM, /* 36: h */
- LED( 2, 2), DELM, /* 37: j */
- LED( 4, 2), DELM, /* 38: k */
- LED( 6, 4), DELM, /* 39: l */
- LED( 0, 3), LED( 1, 3), DELM, /* 40: ; : */
- LED( 3, 3), DELM, /* 41: " ' */
- DELM, /* 42: (null) */
- LED( 5, 3), LED( 6, 3), DELM, /* 43: enter */
- LED( 1, 0), LED( 3, 0), DELM, /* 44: L-shift */
- DELM, /* 45: (null) */
- LED( 5, 0), DELM, /* 46: z */
- LED( 7, 0), DELM, /* 47: x */
- LED( 1, 1), DELM, /* 48: c */
- LED( 3, 1), DELM, /* 49: v */
- LED( 5, 1), LED( 7, 1), DELM, /* 50: b */
- LED( 1, 2), DELM, /* 51: n */
- LED( 3, 2), DELM, /* 52: m */
- LED( 5, 2), DELM, /* 53: , < */
- LED( 7, 2), DELM, /* 54: . > */
- LED( 2, 3), DELM, /* 55: / ? */
- DELM, /* 56: (null) */
- LED( 4, 3), LED( 7, 3), DELM, /* 57: R-shift */
- LED( 1, 0), LED( 3, 0), DELM, /* 58: L-ctrl */
- LED( 5, 3), LED( 6, 3), DELM, /* 59: power */
- LED( 5, 0), LED( 7, 0), DELM, /* 60: L-alt */
- LED( 1, 1), LED( 3, 1),
- LED( 5, 1), LED( 7, 1),
- LED( 1, 2), LED( 3, 2), DELM, /* 61: space */
- LED( 5, 2), DELM, /* 62: R-alt */
- DELM, /* 63: (null) */
- LED( 7, 2), DELM, /* 64: R-ctrl */
- DELM, /* 65: (null) */
- DELM, /* 66: (null) */
- DELM, /* 67: (null) */
- DELM, /* 68: (null) */
- DELM, /* 69: (null) */
- DELM, /* 70: (null) */
- DELM, /* 71: (null) */
- DELM, /* 72: (null) */
- DELM, /* 73: (null) */
- DELM, /* 74: (null) */
- DELM, /* 75: (null) */
- LED( 0, 4), DELM, /* 76: delete */
- DELM, /* 77: (null) */
- DELM, /* 78: (null) */
- LED( 2, 3), DELM, /* 79: left */
- LED( 4, 4), DELM, /* 80: home */
- LED( 6, 4), DELM, /* 81: end */
- DELM, /* 82: (null) */
- LED( 4, 3), DELM, /* 83: up */
- LED( 4, 3), DELM, /* 84: down */
- LED( 0, 4), DELM, /* 85: page up */
- LED( 2, 4), DELM, /* 86: page down */
- DELM, /* 87: (null) */
- DELM, /* 88: (null) */
- LED( 7, 3), DELM, /* 89: right */
- DELM, /* 90: (null) */
- LED( 0, 4), DELM, /* 91: numpad 7 */
- LED( 0, 4), DELM, /* 92: numpad 4 */
- LED( 1, 4), DELM, /* 93: numpad 1 */
- DELM, /* 94: (null) */
- LED( 2, 4), DELM, /* 95: numpad / */
- LED( 2, 4), DELM, /* 96: numpad 8 */
- LED( 2, 4), DELM, /* 97: numpad 5 */
- LED( 3, 4), DELM, /* 98: numpad 2 */
- LED( 3, 4), DELM, /* 99: numpad 0 */
- LED( 4, 4), DELM, /* 100: numpad * */
- LED( 4, 4), DELM, /* 101: numpad 9 */
- LED( 4, 4), DELM, /* 102: numpad 6 */
- LED( 5, 4), DELM, /* 103: numpad 3 */
- LED( 5, 4), DELM, /* 104: numpad . */
- LED( 6, 4), DELM, /* 105: numpad - */
- LED( 6, 4), DELM, /* 106: numpad + */
- DELM, /* 107: (null) */
- LED( 7, 4), DELM, /* 108: numpad enter */
- DELM, /* 109: (null) */
- LED( 0, 0), DELM, /* 110: esc */
- LED( 2, 0), LED( 4, 0), DELM, /* T1: back */
- LED( 6, 0), DELM, /* T2: refresh */
- LED( 0, 1), DELM, /* T3: full screen */
- LED( 2, 1), DELM, /* T4: overview */
- LED( 4, 1), LED( 6, 1), DELM, /* T5: snapshot */
- LED( 0, 2), DELM, /* T6: brightness down */
- LED( 2, 2), DELM, /* T7: brightness up */
- DELM, /* T8: (null) */
- DELM, /* T9: (null) */
- DELM, /* T10: (null) */
- LED( 4, 2), DELM, /* T11: mic mute */
- LED( 6, 2), DELM, /* T12: volume mute */
- LED( 0, 3), LED( 1, 3), DELM, /* T13: volume down */
- LED( 3, 3), DELM, /* T14: volume up */
- DELM, /* T15: (null) */
- DELM, /* 126: (null) */
- DELM, /* 127: (null) */
+ DELM, LED(0, 0), DELM, LED(1, 0), DELM, LED(2, 0), DELM, LED(3, 0),
+ DELM, LED(4, 0), DELM, LED(5, 0), DELM, LED(6, 0), DELM, LED(7, 0),
+ DELM, LED(0, 1), DELM, LED(1, 1), DELM, LED(2, 1), DELM, LED(3, 1),
+ DELM, LED(4, 1), DELM, LED(5, 1), DELM, LED(6, 1), DELM, LED(7, 1),
+ DELM, LED(0, 2), DELM, LED(1, 2), DELM, LED(2, 2), DELM, LED(3, 2),
+ DELM, LED(4, 2), DELM, LED(5, 2), DELM, LED(6, 2), DELM, LED(7, 2),
+ DELM, LED(0, 3), DELM, LED(1, 3), DELM, LED(2, 3), DELM, LED(3, 3),
+ DELM, LED(4, 3), DELM, LED(5, 3), DELM, LED(6, 3), DELM, LED(7, 3),
+ DELM, LED(0, 4), DELM, LED(1, 4), DELM, LED(2, 4), DELM, LED(3, 4),
+ DELM, LED(4, 4), DELM, LED(5, 4), DELM, LED(6, 4), DELM, LED(7, 4),
+ DELM, DELM,
};
#undef LED
#undef DELM
const size_t rgbkbd_map_size = ARRAY_SIZE(rgbkbd_map);
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &taniks_kb;
}
diff --git a/board/taniks/led.c b/board/taniks/led.c
index 1631bce51f..6b7e0bb6cd 100644
--- a/board/taniks/led.c
+++ b/board/taniks/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,44 +14,49 @@
#include "led_common.h"
#include "gpio.h"
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/taniks/pwm.c b/board/taniks/pwm.c
index 7e834385bf..d23358db5f 100644
--- a/board/taniks/pwm.c
+++ b/board/taniks/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,10 +11,8 @@
#include "pwm_chip.h"
const struct pwm_t pwm_channels[] = {
- [PWM_CH_FAN] = {
- .channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
- },
+ [PWM_CH_FAN] = { .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000 },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/taniks/sensors.c b/board/taniks/sensors.c
index d480849036..5371f94081 100644
--- a/board/taniks/sensors.c
+++ b/board/taniks/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,8 +22,8 @@
#include "tablet_mode.h"
#if 1
-#define CPRINTS(format, args...) ccprints(format, ## args)
-#define CPRINTF(format, args...) ccprintf(format, ## args)
+#define CPRINTS(format, args...) ccprints(format, ##args)
+#define CPRINTF(format, args...) ccprintf(format, ##args)
#else
#define CPRINTS(format, args...)
#define CPRINTF(format, args...)
@@ -119,17 +119,13 @@ static struct lsm6dso_data lsm6dso_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate lid and base sensor into standard reference frame */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t bma422_lid_accel = {
.name = "Lid Accel - BMA",
@@ -287,7 +283,6 @@ unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#endif
-
static void board_detect_motionsensor(void)
{
int ret;
@@ -304,8 +299,8 @@ static void board_detect_motionsensor(void)
return;
/* Check lid accel chip */
- ret = i2c_read8(I2C_PORT_SENSOR, LIS2DW12_ADDR1,
- LIS2DW12_WHO_AM_I_REG, &val);
+ ret = i2c_read8(I2C_PORT_SENSOR, LIS2DW12_ADDR1, LIS2DW12_WHO_AM_I_REG,
+ &val);
if (ret == 0 && val == LIS2DW12_WHO_AM_I) {
CPRINTS("LID_ACCEL is LIS2DW12");
return;
@@ -332,7 +327,7 @@ static void board_detect_motionsensor(void)
CPRINTS("No LID_ACCEL are detected");
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsensor,
- HOOK_PRIO_DEFAULT);
+ HOOK_PRIO_DEFAULT);
static void baseboard_sensors_init(void)
{
@@ -344,27 +339,20 @@ DECLARE_HOOK(HOOK_INIT, baseboard_sensors_init, HOOK_PRIO_INIT_I2C + 1);
/* Temperature sensor configuration */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1_DDR_SOC] = {
- .name = "DDR and SOC",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1_DDR_SOC
- },
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "CHARGER",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER
- },
- [TEMP_SENSOR_4_CPUCHOKE] = {
- .name = "CPU CHOKE",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_CPUCHOKE
- },
+ [TEMP_SENSOR_1_DDR_SOC] = { .name = "DDR and SOC",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1_DDR_SOC },
+ [TEMP_SENSOR_3_CHARGER] = { .name = "CHARGER",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_3_CHARGER },
+ [TEMP_SENSOR_4_CPUCHOKE] = { .name = "CPU CHOKE",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_4_CPUCHOKE },
};
-
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
@@ -377,8 +365,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -387,7 +375,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
}, \
.temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+ .temp_fan_max = C_TO_K(70), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
@@ -407,8 +395,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -417,7 +405,7 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
[EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
}, \
.temp_fan_off = C_TO_K(35), \
- .temp_fan_max = C_TO_K(60), \
+ .temp_fan_max = C_TO_K(70), \
}
__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
diff --git a/board/taniks/usbc_config.c b/board/taniks/usbc_config.c
index 0a1b7ff194..71a495c402 100644
--- a/board/taniks/usbc_config.c
+++ b/board/taniks/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,13 +34,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
#if 0
/* Debug only! */
-#define CPRINTSUSB(format, args...) cprints(CC_USBPD, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBPD, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBPD, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBPD, format, ##args)
#else
#define CPRINTSUSB(format, args...)
#define CPRINTFUSB(format, args...)
@@ -99,24 +99,31 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -169,21 +176,20 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x0f,
+ &val) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
else {
CPRINTS("delay 10ms to make sure PS8815 is waken from idle");
msleep(10);
}
-
- if (i2c_write8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x0f,
+ &val) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -209,10 +215,11 @@ static void board_init_ps8815_detection(void)
CPRINTSUSB("%s", __func__);
- rv = i2c_read8(I2C_PORT_USB_C1_TCPC,
- PS8XXX_I2C_ADDR1_FLAGS, 0x00, &val);
+ rv = i2c_read8(I2C_PORT_USB_C1_TCPC, PS8XXX_I2C_ADDR1_FLAGS, 0x00,
+ &val);
- db_usb_hw_pres = (rv == EC_SUCCESS)?DB_USB_PRESENT:DB_USB_NOT_PRESENT;
+ db_usb_hw_pres = (rv == EC_SUCCESS) ? DB_USB_PRESENT :
+ DB_USB_NOT_PRESENT;
if (db_usb_hw_pres == DB_USB_NOT_PRESENT)
CPRINTS("DB isn't plugged or something went wrong!");
@@ -230,7 +237,7 @@ static bool board_detect_ps8815_db(void)
return true;
if (ec_cfg_usb_db_type() == DB_USB3_PS8815 &&
- db_usb_hw_pres == DB_USB_PRESENT)
+ db_usb_hw_pres == DB_USB_PRESENT)
return true;
CPRINTSUSB("No PS8815 DB");
@@ -257,8 +264,7 @@ void board_reset_pd_mcu(void)
/*
* delay for power-on to reset-off and min. assertion time
*/
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 1);
gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
@@ -274,7 +280,7 @@ void board_reset_pd_mcu(void)
*/
board_init_ps8815_detection();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
static void board_tcpc_init(void)
@@ -385,7 +391,7 @@ __override bool board_is_dts_port(int port)
__override uint8_t board_get_usb_pd_port_count(void)
{
- CPRINTSUSB("%s is called by task_id:%d", __func__, task_get_current());
+ CPRINTSUSB("%s is called by task_id:%d", __func__, task_get_current());
if (board_detect_ps8815_db())
return CONFIG_USB_PD_PORT_MAX_COUNT;
diff --git a/board/taniks/usbc_config.h b/board/taniks/usbc_config.h
index 8bcf365e8d..c9b8a8d71c 100644
--- a/board/taniks/usbc_config.h
+++ b/board/taniks/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/terrador/battery.c b/board/terrador/battery.c
index d129ede528..caaf3d6d55 100644
--- a/board/terrador/battery.c
+++ b/board/terrador/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/terrador/board.c b/board/terrador/board.c
index d6378d6aaa..8426216e79 100644
--- a/board/terrador/board.c
+++ b/board/terrador/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -43,7 +43,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -71,7 +71,6 @@ union volteer_cbi_fw_config fw_config_defaults = {
static void board_init(void)
{
-
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -173,8 +172,8 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -201,8 +200,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -244,12 +243,15 @@ void board_reset_pd_mcu(void)
}
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc0_usb4_mb_retimer = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_0_MIX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+struct usb_mux_chain usbc0_usb4_mb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_0_MIX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
};
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration.
@@ -258,7 +260,7 @@ static void setup_mux(void)
{
CPRINTS("C0 supports bb-retimer");
/* USB-C port 0 have a retimer */
- usb_muxes[USBC_PORT_C0].next_mux = &usbc0_usb4_mb_retimer;
+ usb_muxes[USBC_PORT_C0].next = &usbc0_usb4_mb_retimer;
}
__override void board_cbi_init(void)
@@ -270,7 +272,6 @@ __override void board_cbi_init(void)
/* Reassign USB_C0_RT_RST_ODL */
bb_controls[USBC_PORT_C0].usb_ls_en_gpio = GPIO_USB_C0_LS_EN;
bb_controls[USBC_PORT_C0].retimer_rst_gpio = GPIO_USB_C0_RT_RST_ODL;
-
}
/******************************************************************************/
@@ -344,24 +345,31 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .next_mux = &usbc1_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/terrador/board.h b/board/terrador/board.h
index 4572a544c8..e0a075df9c 100644
--- a/board/terrador/board.h
+++ b/board/terrador/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -14,6 +14,8 @@
/* Free flash space */
#define CONFIG_USB_PD_DEBUG_LEVEL 2
#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CMD_BATTFAKE
+#define CONFIG_DEBUG_ASSERT_BRIEF
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */
@@ -46,49 +48,48 @@
/* TCS3400 ALS */
#define CONFIG_ALS
-#define ALS_COUNT 1
+#define ALS_COUNT 1
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
/* BC 1.2 */
@@ -98,8 +99,8 @@
#undef CONFIG_FANS
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -107,47 +108,46 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_PG_EC_DSW_PWROK GPIO_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -176,11 +176,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/terrador/build.mk b/board/terrador/build.mk
index b78172d3cf..824bac888e 100644
--- a/board/terrador/build.mk
+++ b/board/terrador/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/terrador/ec.tasklist b/board/terrador/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/terrador/ec.tasklist
+++ b/board/terrador/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/terrador/gpio.inc b/board/terrador/gpio.inc
index f32b8328e3..6d3c4cb720 100644
--- a/board/terrador/gpio.inc
+++ b/board/terrador/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/terrador/led.c b/board/terrador/led.c
index 640312bd64..ce2d497ea7 100644
--- a/board/terrador/led.c
+++ b/board/terrador/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@ const enum ec_led_id supported_led_ids[] = {
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map[] = {
- /* Green, Red, Blue */
- [EC_LED_COLOR_GREEN] = { 100, 0, 0 },
- [EC_LED_COLOR_RED] = { 0, 100, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ /* Green, Red, Blue */
+ [EC_LED_COLOR_GREEN] = { 100, 0, 0 },
+ [EC_LED_COLOR_RED] = { 0, 100, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
/* The green LED seems to be brighter than the others, so turn down
* green from its natural level for these secondary colors.
*/
- [EC_LED_COLOR_YELLOW] = { 70, 100, 0 },
- [EC_LED_COLOR_WHITE] = { 70, 100, 100 },
- [EC_LED_COLOR_AMBER] = { 20, 100, 0 },
+ [EC_LED_COLOR_YELLOW] = { 70, 100, 0 },
+ [EC_LED_COLOR_WHITE] = { 70, 100, 100 },
+ [EC_LED_COLOR_AMBER] = { 20, 100, 0 },
};
struct pwm_led pwm_leds[] = {
diff --git a/board/terrador/sensors.c b/board/terrador/sensors.c
index 77b26515c0..8f187f904c 100644
--- a/board/terrador/sensors.c
+++ b/board/terrador/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -85,17 +85,13 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/tglrvp_ish/board.c b/board/tglrvp_ish/board.c
index a0584410b3..f05d7d337c 100644
--- a/board/tglrvp_ish/board.c
+++ b/board/tglrvp_ish/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,11 +19,7 @@
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 1000
- },
+ { .name = "sensor", .port = I2C_PORT_SENSOR, .kbps = 1000 },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/tglrvp_ish/board.h b/board/tglrvp_ish/board.h
index 12f4b5992a..702494cdcc 100644
--- a/board/tglrvp_ish/board.h
+++ b/board/tglrvp_ish/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,7 +22,7 @@
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* ISH specific */
-#undef CONFIG_DEBUG_ASSERT
+#undef CONFIG_DEBUG_ASSERT
#define CONFIG_CLOCK_CRYSTAL
#define CONFIG_ISH_UART_0
/* EC */
@@ -31,7 +31,7 @@
#define CONFIG_I2C
#define CONFIG_I2C_CONTROLLER
-#define CONFIG_ACCELGYRO_LSM6DSM /* For LSM6DS3 */
+#define CONFIG_ACCELGYRO_LSM6DSM /* For LSM6DS3 */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(BASE_ACCEL)
/* Host command over HECI */
@@ -81,8 +81,8 @@
#define CONFIG_ISH_IPAPG
-#define CONFIG_ISH_D0I2_MIN_USEC (15*MSEC)
-#define CONFIG_ISH_D0I3_MIN_USEC (50*MSEC)
+#define CONFIG_ISH_D0I2_MIN_USEC (15 * MSEC)
+#define CONFIG_ISH_D0I3_MIN_USEC (50 * MSEC)
#define CONFIG_ISH_NEW_PM
@@ -92,10 +92,7 @@
#include "registers.h"
/* Motion sensors */
-enum sensor_id {
- BASE_ACCEL,
- SENSOR_COUNT
-};
+enum sensor_id { BASE_ACCEL, SENSOR_COUNT };
#endif /* !__ASSEMBLER__ */
diff --git a/board/tglrvp_ish/build.mk b/board/tglrvp_ish/build.mk
index 74ec3c865f..4a84a1f475 100644
--- a/board/tglrvp_ish/build.mk
+++ b/board/tglrvp_ish/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/tglrvp_ish/ec.tasklist b/board/tglrvp_ish/ec.tasklist
index a4db486e9a..de7d256324 100644
--- a/board/tglrvp_ish/ec.tasklist
+++ b/board/tglrvp_ish/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/tglrvp_ish/gpio.inc b/board/tglrvp_ish/gpio.inc
index 286309e388..8b25af63cb 100644
--- a/board/tglrvp_ish/gpio.inc
+++ b/board/tglrvp_ish/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/tigertail/board.c b/board/tigertail/board.c
index e7679a125d..abdd3df10b 100644
--- a/board/tigertail/board.c
+++ b/board/tigertail/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,16 +27,14 @@
#include "gpio_list.h"
-
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
/******************************************************************************
* Forward UARTs as a USB serial interface.
*/
-#define USB_STREAM_RX_SIZE 16
-#define USB_STREAM_TX_SIZE 16
+#define USB_STREAM_RX_SIZE 16
+#define USB_STREAM_TX_SIZE 16
/******************************************************************************
* Forward USART1 as a simple USB serial interface.
@@ -44,43 +42,33 @@
static struct usart_config const usart1;
struct usb_stream_config const usart1_usb;
-static struct queue const usart1_to_usb = QUEUE_DIRECT(64, uint8_t,
- usart1.producer, usart1_usb.consumer);
-static struct queue const usb_to_usart1 = QUEUE_DIRECT(64, uint8_t,
- usart1_usb.producer, usart1.consumer);
+static struct queue const usart1_to_usb =
+ QUEUE_DIRECT(64, uint8_t, usart1.producer, usart1_usb.consumer);
+static struct queue const usb_to_usart1 =
+ QUEUE_DIRECT(64, uint8_t, usart1_usb.producer, usart1.consumer);
static struct usart_config const usart1 =
- USART_CONFIG(usart1_hw,
- usart_rx_interrupt,
- usart_tx_interrupt,
- 115200,
- 0,
- usart1_to_usb,
- usb_to_usart1);
-
-USB_STREAM_CONFIG(usart1_usb,
- USB_IFACE_USART1_STREAM,
- USB_STR_USART1_STREAM_NAME,
- USB_EP_USART1_STREAM,
- USB_STREAM_RX_SIZE,
- USB_STREAM_TX_SIZE,
- usb_to_usart1,
- usart1_to_usb)
+ USART_CONFIG(usart1_hw, usart_rx_interrupt, usart_tx_interrupt, 115200,
+ 0, usart1_to_usb, usb_to_usart1);
+USB_STREAM_CONFIG(usart1_usb, USB_IFACE_USART1_STREAM,
+ USB_STR_USART1_STREAM_NAME, USB_EP_USART1_STREAM,
+ USB_STREAM_RX_SIZE, USB_STREAM_TX_SIZE, usb_to_usart1,
+ usart1_to_usb)
/******************************************************************************
* Define the strings used in our USB descriptors.
*/
const void *const usb_strings[] = {
- [USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
- [USB_STR_PRODUCT] = USB_STRING_DESC("Tigertail"),
- [USB_STR_SERIALNO] = 0,
- [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
- [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
- [USB_STR_USART1_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
+ [USB_STR_DESC] = usb_string_desc,
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
+ [USB_STR_PRODUCT] = USB_STRING_DESC("Tigertail"),
+ [USB_STR_SERIALNO] = 0,
+ [USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
+ [USB_STR_I2C_NAME] = USB_STRING_DESC("I2C"),
+ [USB_STR_USART1_STREAM_NAME] = USB_STRING_DESC("DUT UART"),
[USB_STR_CONSOLE_NAME] = USB_STRING_DESC("Tigertail Console"),
- [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
+ [USB_STR_UPDATE_NAME] = USB_STRING_DESC("Firmware update"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
@@ -90,30 +78,29 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
*/
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_SBU1] = {"SBU1", 3300, 4096, 0, STM32_AIN(6)},
- [ADC_SBU2] = {"SBU2", 3300, 4096, 0, STM32_AIN(7)},
+ [ADC_SBU1] = { "SBU1", 3300, 4096, 0, STM32_AIN(6) },
+ [ADC_SBU2] = { "SBU2", 3300, 4096, 0, STM32_AIN(7) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-
/******************************************************************************
* Support I2C bridging over USB.
*/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_MASTER_I2C_SCL,
- .sda = GPIO_MASTER_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_MASTER_I2C_SCL,
+ .sda = GPIO_MASTER_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-int usb_i2c_board_is_enabled(void) { return 1; }
+int usb_i2c_board_is_enabled(void)
+{
+ return 1;
+}
/******************************************************************************
* Console commands.
@@ -138,7 +125,7 @@ static void set_uart_gpios(int state)
{
int uart = GPIO_INPUT;
int dir = 0;
- int voltage = 1; /* 1: 1.8v, 0: 3.3v */
+ int voltage = 1; /* 1: 1.8v, 0: 3.3v */
int enabled = 0;
gpio_set_level(GPIO_ST_UART_LVL_DIS, 1);
@@ -287,7 +274,7 @@ void set_uart_state(int state)
*/
void uart_sbu_tick(void)
{
- static int debounce; /* = 0 */
+ static int debounce; /* = 0 */
if (uart_detect != UART_DETECT_AUTO)
return;
@@ -324,7 +311,7 @@ void uart_sbu_tick(void)
}
DECLARE_HOOK(HOOK_TICK, uart_sbu_tick, HOOK_PRIO_DEFAULT);
-static int command_uart(int argc, char **argv)
+static int command_uart(int argc, const char **argv)
{
const char *uart_state_str = "off";
const char *uart_detect_str = "manual";
@@ -349,15 +336,15 @@ static int command_uart(int argc, char **argv)
uart_state_str = uart_state_names[uart_state];
if (uart_detect == UART_DETECT_AUTO)
uart_detect_str = "auto";
- ccprintf("UART mux is: %s, setting: %s\n",
- uart_state_str, uart_detect_str);
+ ccprintf("UART mux is: %s, setting: %s\n", uart_state_str,
+ uart_detect_str);
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(uart, command_uart,
- "[off|on18|on33|flip18|flip33|auto]",
- "Set the sbu uart state\n"
- "WARNING: 3.3v may damage 1.8v devices.\n");
+ "[off|on18|on33|flip18|flip33|auto]",
+ "Set the sbu uart state\n"
+ "WARNING: 3.3v may damage 1.8v devices.\n");
static void set_led_a(int r, int g, int b)
{
@@ -422,7 +409,6 @@ void set_mux_state(int state)
set_led_b(1, 0, 0);
}
-
/* On button press, toggle between mux A, B, off. */
static int button_ready = 1;
void button_interrupt_deferred(void)
@@ -461,7 +447,7 @@ void button_interrupt(enum gpio_signal signal)
hook_call_deferred(&button_interrupt_deferred_data, 0);
}
-static int command_mux(int argc, char **argv)
+static int command_mux(int argc, const char **argv)
{
char *mux_state_str = "off";
@@ -484,9 +470,8 @@ static int command_mux(int argc, char **argv)
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(mux, command_mux,
- "[off|A|B]",
- "Get/set the mux and enable state of the TYPE-C mux");
+DECLARE_CONSOLE_COMMAND(mux, command_mux, "[off|A|B]",
+ "Get/set the mux and enable state of the TYPE-C mux");
/******************************************************************************
* Initialize board.
diff --git a/board/tigertail/board.h b/board/tigertail/board.h
index 3b15c4c774..ea4d11db06 100644
--- a/board/tigertail/board.h
+++ b/board/tigertail/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,19 +40,19 @@
#define DEFAULT_SERIALNO "Uninitialized"
/* USB interface indexes (use define rather than enum to expand them) */
-#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_UPDATE 1
-#define USB_IFACE_USART1_STREAM 2
-#define USB_IFACE_I2C 3
-#define USB_IFACE_COUNT 4
+#define USB_IFACE_CONSOLE 0
+#define USB_IFACE_UPDATE 1
+#define USB_IFACE_USART1_STREAM 2
+#define USB_IFACE_I2C 3
+#define USB_IFACE_COUNT 4
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
-#define USB_EP_UPDATE 2
-#define USB_EP_USART1_STREAM 3
-#define USB_EP_I2C 4
-#define USB_EP_COUNT 5
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
+#define USB_EP_UPDATE 2
+#define USB_EP_USART1_STREAM 3
+#define USB_EP_I2C 4
+#define USB_EP_COUNT 5
/* Enable console recasting of GPIO type. */
#define CONFIG_CMD_GPIO_EXTENDED
@@ -77,14 +77,11 @@
*/
#define CONFIG_SYSTEM_UNLOCKED
-
#ifndef __ASSEMBLER__
/* Timer selection */
#define TIM_CLOCK32 2
-#define TIM_ADC 3
-
-
+#define TIM_ADC 3
#include "gpio_signal.h"
diff --git a/board/tigertail/build.mk b/board/tigertail/build.mk
index 9e7fae1c07..7766dd5e6b 100644
--- a/board/tigertail/build.mk
+++ b/board/tigertail/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2017 The Chromium OS Authors. All rights reserved.
+# Copyright 2017 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/tigertail/ec.tasklist b/board/tigertail/ec.tasklist
index afdb5dedc7..c254025ebc 100644
--- a/board/tigertail/ec.tasklist
+++ b/board/tigertail/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+/* Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/tigertail/gpio.inc b/board/tigertail/gpio.inc
index 107d3b2a2e..41c96cba46 100644
--- a/board/tigertail/gpio.inc
+++ b/board/tigertail/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Copyright 2017 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/treeya/battery.c b/board/treeya/battery.c
index a98a38d3e9..8dce09612b 100644
--- a/board/treeya/battery.c
+++ b/board/treeya/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/treeya/board.c b/board/treeya/board.c
index 642948dbd0..9a887a9f2d 100644
--- a/board/treeya/board.c
+++ b/board/treeya/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -32,45 +32,35 @@ const enum gpio_signal hibernate_wake_pins[] = {
GPIO_POWER_BUTTON_L,
GPIO_EC_RST_ODL,
};
-const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
+const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_I2C0_SCL,
- .sda = GPIO_I2C0_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
- {
- .name = "thermal",
- .port = I2C_PORT_THERMAL_AP,
- .kbps = 400,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_I2C7_SCL,
- .sda = GPIO_I2C7_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_I2C0_SCL,
+ .sda = GPIO_I2C0_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
+ { .name = "thermal",
+ .port = I2C_PORT_THERMAL_AP,
+ .kbps = 400,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_I2C7_SCL,
+ .sda = GPIO_I2C7_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -83,19 +73,15 @@ static struct stprivate_data g_lis2dwl_data;
/* Base accel private data */
static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA;
-
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t lsm6dsm_base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lsm6dsm_base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0,
+ FLOAT_TO_FP(1) } };
-static const mat33_fp_t treeya_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t treeya_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t lid_accel_1 = {
.name = "Lid Accel",
@@ -162,8 +148,7 @@ struct motion_sensor_t base_gyro_1 = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &lsm6dsm_drv,
.mutex = &g_base_mutex_1,
- .drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
- MOTIONSENSE_TYPE_GYRO),
+ .drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data, MOTIONSENSE_TYPE_GYRO),
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -177,8 +162,8 @@ static int board_use_st_sensor(void)
/* sku_id 0xa8-0xa9, 0xbe, 0xbf use ST sensors */
uint32_t sku_id = system_get_sku_id();
- if (sku_id == 0xa8 || sku_id == 0xa9 ||
- sku_id == 0xbe || sku_id == 0xbf)
+ if (sku_id == 0xa8 || sku_id == 0xa9 || sku_id == 0xbe ||
+ sku_id == 0xbf)
return 1;
else
return 0;
@@ -197,10 +182,12 @@ void board_update_sensor_config_from_sku(void)
motion_sensors[LID_ACCEL] = lid_accel_1;
motion_sensors[BASE_ACCEL] = base_accel_1;
motion_sensors[BASE_GYRO] = base_gyro_1;
- } else{
+ } else {
/*Need to change matrix for treeya*/
- motion_sensors[BASE_ACCEL].rot_standard_ref = &treeya_standard_ref;
- motion_sensors[BASE_GYRO].rot_standard_ref = &treeya_standard_ref;
+ motion_sensors[BASE_ACCEL].rot_standard_ref =
+ &treeya_standard_ref;
+ motion_sensors[BASE_GYRO].rot_standard_ref =
+ &treeya_standard_ref;
}
/* Enable Gyro interrupts */
@@ -210,12 +197,11 @@ void board_update_sensor_config_from_sku(void)
/* Device is clamshell only */
tablet_set_mode(0, TABLET_TRIGGER_LID);
/* Gyro is not present, don't allow line to float */
- gpio_set_flags(GPIO_6AXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_6AXIS_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
- if (sku_id == 160 || sku_id == 168 || sku_id == 169 ||
- sku_id == 190 || sku_id == 191) {
+ if (sku_id == 160 || sku_id == 168 || sku_id == 169 || sku_id == 190 ||
+ sku_id == 191) {
is_psl_hibernate = 0;
} else {
is_psl_hibernate = 1;
@@ -312,7 +298,7 @@ void board_hibernate_late(void)
}
/* Clear all pending IRQ otherwise wfi will have no affect */
- for (i = NPCX_IRQ_0 ; i < NPCX_IRQ_COUNT ; i++)
+ for (i = NPCX_IRQ_0; i < NPCX_IRQ_COUNT; i++)
task_clear_pending_irq(i);
__enter_hibernate_in_psl();
diff --git a/board/treeya/board.h b/board/treeya/board.h
index e1bae50532..75c093cd71 100644
--- a/board/treeya/board.h
+++ b/board/treeya/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,7 +30,7 @@
* By default, enable all console messages excepted HC, ACPI and event:
* The sensor stack is generating a lot of activity.
*/
-#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
+#define CC_DEFAULT (CC_ALL & ~(CC_MASK(CC_EVENTS) | CC_MASK(CC_LPC)))
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -61,7 +61,7 @@
/*
* Slew rate on the PP1800_SENSOR load switch requires a short delay on startup.
*/
-#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
+#undef CONFIG_MOTION_SENSE_RESUME_DELAY_US
#define CONFIG_MOTION_SENSE_RESUME_DELAY_US (10 * MSEC)
/* Second set of sensor drivers */
@@ -72,7 +72,6 @@
#ifndef __ASSEMBLER__
-
enum battery_type {
BATTERY_SMP,
BATTERY_LGC,
diff --git a/board/treeya/build.mk b/board/treeya/build.mk
index 250abe6712..618554c11f 100644
--- a/board/treeya/build.mk
+++ b/board/treeya/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/treeya/ec.tasklist b/board/treeya/ec.tasklist
index fb6e2f75a1..7c9bfc2aff 100644
--- a/board/treeya/ec.tasklist
+++ b/board/treeya/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/treeya/gpio.inc b/board/treeya/gpio.inc
index 70e2e1b29c..f0de3fc62c 100644
--- a/board/treeya/gpio.inc
+++ b/board/treeya/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/treeya/led.c b/board/treeya/led.c
index 9647b45e74..74d3bdef7e 100644
--- a/board/treeya/led.c
+++ b/board/treeya/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,40 +8,43 @@
#include "led_common.h"
#include "gpio.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{LED_OFF, LED_INDEFINITE} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { LED_OFF, LED_INDEFINITE } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/trembyle/battery.c b/board/trembyle/battery.c
index 33e4e9ce5d..22724f11b4 100644
--- a/board/trembyle/battery.c
+++ b/board/trembyle/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/trembyle/board.c b/board/trembyle/board.c
index ae81323902..d9d71a0895 100644
--- a/board/trembyle/board.c
+++ b/board/trembyle/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -37,8 +37,8 @@
#include "gpio_list.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Motion sensors */
static struct mutex g_lid_mutex;
@@ -205,8 +205,8 @@ static void board_chipset_resume(void)
int val;
rv = i2c_read8(I2C_PORT_USBA0,
- PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
- PS8811_REG1_USB_BEQ_LEVEL, &val);
+ PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
+ PS8811_REG1_USB_BEQ_LEVEL, &val);
if (!rv)
break;
}
@@ -220,10 +220,10 @@ static void board_chipset_resume(void)
rv = i2c_write8(I2C_PORT_USBA1,
PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
PS8811_REG1_USB_BEQ_LEVEL,
- (PS8811_BEQ_I2C_LEVEL_UP_13DB <<
- PS8811_BEQ_I2C_LEVEL_UP_SHIFT) |
- (PS8811_BEQ_PIN_LEVEL_UP_18DB <<
- PS8811_BEQ_PIN_LEVEL_UP_SHIFT));
+ (PS8811_BEQ_I2C_LEVEL_UP_13DB
+ << PS8811_BEQ_I2C_LEVEL_UP_SHIFT) |
+ (PS8811_BEQ_PIN_LEVEL_UP_18DB
+ << PS8811_BEQ_PIN_LEVEL_UP_SHIFT));
if (!rv)
break;
}
@@ -233,9 +233,7 @@ static void board_chipset_resume(void)
}
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 1);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 1);
}
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
@@ -246,9 +244,7 @@ static void board_chipset_suspend(void)
ioex_set_level(IOEX_USB_A1_RETIMER_EN, 0);
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
}
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
@@ -256,6 +252,10 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/*****************************************************************************
* USB-C MUX/Retimer dynamic configuration
*/
+
+/* Place holder for second mux in USBC1 chain */
+struct usb_mux_chain usbc1_mux1;
+
static void setup_mux(void)
{
if (ec_config_has_usbc1_retimer_ps8802()) {
@@ -265,12 +265,10 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the PS8802
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_ps8802,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_ps8802;
/* Set the AMD FP5 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux;
+ usbc1_mux1.mux = &usbc1_amd_fp5_usb_mux;
/* Don't have the AMD FP5 flip */
usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
@@ -282,12 +280,10 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the AMD FP5
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_amd_fp5_usb_mux,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux;
/* Set the PS8818 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_ps8818;
+ usbc1_mux1.mux = &usbc1_ps8818;
}
}
@@ -301,23 +297,29 @@ const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pi3dpx1207_controls) == USBC_PORT_COUNT);
-const struct usb_mux usbc0_pi3dpx1207_usb_retimer = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
- .driver = &pi3dpx1207_usb_retimer,
+const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
+ .driver = &pi3dpx1207_usb_retimer,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_pi3dpx1207_usb_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_pi3dpx1207_usb_retimer,
},
[USBC_PORT_C1] = {
/* Filled in dynamically at startup */
+ .next = &usbc1_mux1,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -361,7 +363,7 @@ DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -452,8 +454,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_THERMISTOR \
- { \
+#define THERMAL_THERMISTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(92), \
@@ -470,8 +472,8 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(92), \
diff --git a/board/trembyle/board.h b/board/trembyle/board.h
index 6d3382af08..2e3d40ac8f 100644
--- a/board/trembyle/board.h
+++ b/board/trembyle/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -29,36 +29,32 @@
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_AP18F4M,
@@ -71,11 +67,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_FAN, PWM_CH_COUNT };
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -84,11 +76,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
@@ -153,61 +141,51 @@ enum ec_cfg_usb_db_type {
#include "cbi_ec_fw_config.h"
-#define HAS_USBC1_RETIMER_PS8802 \
- (BIT(TREMBYLE_DB_T_OPT2_USBAC) | \
- BIT(TREMBYLE_DB_T_OPT3_USBAC_HDMI_MSTHUB))
+#define HAS_USBC1_RETIMER_PS8802 \
+ (BIT(TREMBYLE_DB_T_OPT2_USBAC) | \
+ BIT(TREMBYLE_DB_T_OPT3_USBAC_HDMI_MSTHUB))
static inline bool ec_config_has_usbc1_retimer_ps8802(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8802);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8802);
}
-#define HAS_USBC1_RETIMER_PS8818 \
- (BIT(TREMBYLE_DB_T_OPT1_USBAC_HMDI))
+#define HAS_USBC1_RETIMER_PS8818 (BIT(TREMBYLE_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_usbc1_retimer_ps8818(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8818);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8818);
}
-#define HAS_HDMI_RETIMER_PI3HDX1204 \
- (BIT(TREMBYLE_DB_T_OPT1_USBAC_HMDI))
+#define HAS_HDMI_RETIMER_PI3HDX1204 (BIT(TREMBYLE_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_RETIMER_PI3HDX1204);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_RETIMER_PI3HDX1204);
}
-#define HAS_MST_HUB_RTD2141B \
- (BIT(TREMBYLE_DB_T_OPT3_USBAC_HDMI_MSTHUB))
+#define HAS_MST_HUB_RTD2141B (BIT(TREMBYLE_DB_T_OPT3_USBAC_HDMI_MSTHUB))
static inline bool ec_config_has_mst_hub_rtd2141b(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_MST_HUB_RTD2141B);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_MST_HUB_RTD2141B);
}
-#define HAS_HDMI_CONN_HPD \
- (BIT(TREMBYLE_DB_T_OPT1_USBAC_HMDI))
+#define HAS_HDMI_CONN_HPD (BIT(TREMBYLE_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_hdmi_conn_hpd(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_CONN_HPD);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_CONN_HPD);
}
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB_C0_HPD \
- : (ec_config_has_usbc1_retimer_ps8802()) \
- ? GPIO_DP1_HPD \
- : GPIO_DP2_HPD)
+#define PORT_TO_HPD(port) \
+ ((port == 0) ? GPIO_USB_C0_HPD : \
+ (ec_config_has_usbc1_retimer_ps8802()) ? GPIO_DP1_HPD : \
+ GPIO_DP2_HPD)
-extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer;
-extern const struct usb_mux usbc1_ps8802;
+extern const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer;
extern const struct usb_mux usbc1_ps8818;
+extern struct usb_mux usbc1_ps8802;
extern struct usb_mux usbc1_amd_fp5_usb_mux;
void hdmi_hpd_interrupt(enum ioex_signal signal);
diff --git a/board/trembyle/build.mk b/board/trembyle/build.mk
index 4ca0cbd96f..cd58c2b91b 100644
--- a/board/trembyle/build.mk
+++ b/board/trembyle/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/trembyle/ec.tasklist b/board/trembyle/ec.tasklist
index 41b83cf4f3..4bb60ed55d 100644
--- a/board/trembyle/ec.tasklist
+++ b/board/trembyle/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/trembyle/gpio.inc b/board/trembyle/gpio.inc
index 6cc3e6fe09..7c49eef74e 100644
--- a/board/trembyle/gpio.inc
+++ b/board/trembyle/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/trembyle/led.c b/board/trembyle/led.c
index 3e2d195a06..ec4e93dca5 100644
--- a/board/trembyle/led.c
+++ b/board/trembyle/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,26 +8,34 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
__override const int led_charge_lvl_2 = 100;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_RED, 2 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_RED, 2 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_BLUE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_RED,
+ 2 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_BLUE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_RED,
+ 2 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/trogdor/battery.c b/board/trogdor/battery.c
index e95735eda7..cffda632bc 100644
--- a/board/trogdor/battery.c
+++ b/board/trogdor/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/trogdor/board.c b/board/trogdor/board.c
index 7036e57c4a..863f2884b8 100644
--- a/board/trogdor/board.c
+++ b/board/trogdor/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,8 +26,8 @@
#include "usbc_config.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#include "gpio_list.h"
@@ -39,10 +39,8 @@ __override struct keyboard_scan_config keyscan_config = {
* Unmask 0x08 in [0] (KSO_00/KSI_03, the new location of Search key);
* as it still uses the legacy location (KSO_01/KSI_00).
*/
- .actual_key_mask = {
- 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff,
- 0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca
- },
+ .actual_key_mask = { 0x14, 0xff, 0xff, 0xff, 0xff, 0xf5, 0xff, 0xa4,
+ 0xff, 0xfe, 0x55, 0xfa, 0xca },
/* Other values should be the same as the default configuration. */
.debounce_down_us = 9 * MSEC,
.debounce_up_us = 30 * MSEC,
@@ -53,41 +51,31 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -95,37 +83,22 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -177,17 +150,13 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct accelgyro_saved_data_t g_bma255_data;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/trogdor/board.h b/board/trogdor/board.h
index 0faa3a8bf0..2c8e67d26b 100644
--- a/board/trogdor/board.h
+++ b/board/trogdor/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,7 @@
#define CONFIG_I2C_DEBUG
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Keyboard */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
@@ -27,7 +27,7 @@
#define CONFIG_PWM_KBLIGHT
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
@@ -74,12 +74,7 @@
#include "gpio_signal.h"
#include "registers.h"
-enum adc_channel {
- ADC_VBUS,
- ADC_AMON_BMON,
- ADC_PSYS,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_VBUS, ADC_AMON_BMON, ADC_PSYS, ADC_CH_COUNT };
/* Motion sensors */
enum sensor_id {
@@ -89,11 +84,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_DISPLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_DISPLIGHT, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/trogdor/build.mk b/board/trogdor/build.mk
index 7fe4452669..becaf09262 100644
--- a/board/trogdor/build.mk
+++ b/board/trogdor/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/trogdor/ec.tasklist b/board/trogdor/ec.tasklist
index eb14fab204..97b5046f7f 100644
--- a/board/trogdor/ec.tasklist
+++ b/board/trogdor/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/trogdor/gpio.inc b/board/trogdor/gpio.inc
index aaac15839e..63d6e84963 100644
--- a/board/trogdor/gpio.inc
+++ b/board/trogdor/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/trogdor/hibernate.c b/board/trogdor/hibernate.c
index 504a295463..9b64e85053 100644
--- a/board/trogdor/hibernate.c
+++ b/board/trogdor/hibernate.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,6 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
- gpio_set_flags(GPIO_LID_ACCEL_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_LID_ACCEL_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
diff --git a/board/trogdor/led.c b/board/trogdor/led.c
index 3af5776e12..3a7d8df108 100644
--- a/board/trogdor/led.c
+++ b/board/trogdor/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -31,15 +31,15 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void side_led_set_color(int port, enum led_color color)
{
gpio_set_level(port ? GPIO_EC_CHG_LED_Y_C1 : GPIO_EC_CHG_LED_Y_C0,
- (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_AMBER) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(port ? GPIO_EC_CHG_LED_W_C1 : GPIO_EC_CHG_LED_W_C0,
- (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_WHITE) ? BAT_LED_ON : BAT_LED_OFF);
}
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
@@ -90,7 +90,6 @@ static void set_active_port_color(enum led_color color)
static void board_led_set_battery(void)
{
static int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -102,8 +101,9 @@ static void board_led_set_battery(void)
case PWR_STATE_DISCHARGE:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() <= 10)
- side_led_set_color(0,
- (battery_ticks & 0x4) ? LED_WHITE : LED_OFF);
+ side_led_set_color(0, (battery_ticks & 0x4) ?
+ LED_WHITE :
+ LED_OFF);
else
side_led_set_color(0, LED_OFF);
}
@@ -112,18 +112,18 @@ static void board_led_set_battery(void)
side_led_set_color(1, LED_OFF);
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ set_active_port_color((battery_ticks & 0x2) ? LED_WHITE :
+ LED_OFF);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks & 0x4) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color((battery_ticks & 0x4) ? LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/trogdor/switchcap.c b/board/trogdor/switchcap.c
index 16b0db6ef6..5173e27f75 100644
--- a/board/trogdor/switchcap.c
+++ b/board/trogdor/switchcap.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/trogdor/usbc_config.c b/board/trogdor/usbc_config.c
index a25b63bff9..39a54f659e 100644
--- a/board/trogdor/usbc_config.c
+++ b/board/trogdor/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,8 +25,8 @@
#include "usbc_ocp.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
@@ -132,16 +132,12 @@ void ppc_interrupt(enum gpio_signal signal)
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -172,16 +168,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -234,7 +236,7 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
@@ -280,8 +282,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -309,7 +310,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
CPRINTS("New charge port: p%d", port);
/*
@@ -333,23 +333,21 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/trogdor/usbc_config.h b/board/trogdor/usbc_config.h
index 75adf93b3c..c9b676fc61 100644
--- a/board/trogdor/usbc_config.h
+++ b/board/trogdor/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/twinkie/board.c b/board/twinkie/board.c
index f3f8460c8d..97c69fb126 100644
--- a/board/twinkie/board.c
+++ b/board/twinkie/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -36,7 +36,7 @@ void board_config_pre_init(void)
STM32_RCC_APB2ENR |= BIT(0);
/* Remap USART DMA to match the USART driver and TIM2 DMA */
STM32_SYSCFG_CFGR1 |= BIT(9) | BIT(10) /* Remap USART1 RX/TX DMA */
- | BIT(29);/* Remap TIM2 DMA */
+ | BIT(29); /* Remap TIM2 DMA */
/* 40 MHz pin speed on UART PA9/PA10 */
STM32_GPIO_OSPEEDR(GPIO_A) |= 0x003C0000;
/* 40 MHz pin speed on TX clock out PB9 */
@@ -59,26 +59,24 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* USB PD CC lines sensing. Converted to mV (3300mV/4096). */
- [ADC_CH_CC1_PD] = {"CC1_PD", 3300, 4096, 0, STM32_AIN(1)},
- [ADC_CH_CC2_PD] = {"CC2_PD", 3300, 4096, 0, STM32_AIN(3)},
+ [ADC_CH_CC1_PD] = { "CC1_PD", 3300, 4096, 0, STM32_AIN(1) },
+ [ADC_CH_CC2_PD] = { "CC2_PD", 3300, 4096, 0, STM32_AIN(3) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "master",
- .port = I2C_PORT_MASTER,
- .kbps = 100,
- .scl = GPIO_I2C_SCL,
- .sda = GPIO_I2C_SDA
- },
+ { .name = "master",
+ .port = I2C_PORT_MASTER,
+ .kbps = 100,
+ .scl = GPIO_I2C_SCL,
+ .sda = GPIO_I2C_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
-const void * const usb_strings[] = {
+const void *const usb_strings[] = {
[USB_STR_DESC] = usb_string_desc,
- [USB_STR_VENDOR] = USB_STRING_DESC("Google Inc."),
+ [USB_STR_VENDOR] = USB_STRING_DESC("Google LLC"),
[USB_STR_PRODUCT] = USB_STRING_DESC("Twinkie"),
[USB_STR_VERSION] = USB_STRING_DESC(CROS_EC_VERSION32),
[USB_STR_SNIFFER] = USB_STRING_DESC("USB-PD Sniffer"),
diff --git a/board/twinkie/board.h b/board/twinkie/board.h
index 3d601ee979..b1379fb15b 100644
--- a/board/twinkie/board.h
+++ b/board/twinkie/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -54,7 +54,7 @@
/* USB configuration */
#define CONFIG_USB_PID 0x500A
/* By default, enable all console messages excepted USB */
-#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_USB))
+#define CC_DEFAULT (CC_ALL & ~CC_MASK(CC_USB))
/*
* Allow dangerous commands all the time, since we don't have a write protect
@@ -79,9 +79,9 @@ void trace_packets(void);
void set_trace_mode(int mode);
/* Timer selection */
-#define TIM_CLOCK_MSB 3
+#define TIM_CLOCK_MSB 3
#define TIM_CLOCK_LSB 15
-#define TIM_ADC 16
+#define TIM_ADC 16
#include "gpio_signal.h"
@@ -106,28 +106,28 @@ enum usb_strings {
};
/* Standard-current Rp */
-#define PD_SRC_VNC PD_SRC_DEF_VNC_MV
-#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV
+#define PD_SRC_VNC PD_SRC_DEF_VNC_MV
+#define PD_SRC_RD_THRESHOLD PD_SRC_DEF_RD_THRESH_MV
/* delay necessary for the voltage transition on the power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Define typical operating power and max power */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#endif /* !__ASSEMBLER__ */
/* USB interface indexes (use define rather than enum to expand them) */
#define USB_IFACE_CONSOLE 0
-#define USB_IFACE_VENDOR 1
+#define USB_IFACE_VENDOR 1
/* USB endpoint indexes (use define rather than enum to expand them) */
-#define USB_EP_CONTROL 0
-#define USB_EP_CONSOLE 1
+#define USB_EP_CONTROL 0
+#define USB_EP_CONSOLE 1
/*
* Endpoint 2 is missing because the console used to use two bidirectional
@@ -137,13 +137,13 @@ enum usb_strings {
*/
#ifdef HAS_TASK_SNIFFER
-#define USB_EP_SNIFFER 3
-#define USB_EP_COUNT 4
-#define USB_IFACE_COUNT 2
+#define USB_EP_SNIFFER 3
+#define USB_EP_COUNT 4
+#define USB_IFACE_COUNT 2
#else
-#define USB_EP_COUNT 2
+#define USB_EP_COUNT 2
/* No IFACE_VENDOR for the sniffer */
-#define USB_IFACE_COUNT 1
+#define USB_IFACE_COUNT 1
#endif
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/twinkie/build.mk b/board/twinkie/build.mk
index 3ced5f2966..f710000486 100644
--- a/board/twinkie/build.mk
+++ b/board/twinkie/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/twinkie/ec.tasklist b/board/twinkie/ec.tasklist
index 600df47c60..0dcfd38308 100644
--- a/board/twinkie/ec.tasklist
+++ b/board/twinkie/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/twinkie/gpio.inc b/board/twinkie/gpio.inc
index 551cb73748..45b34de766 100644
--- a/board/twinkie/gpio.inc
+++ b/board/twinkie/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2014 The Chromium OS Authors. All rights reserved.
+ * Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/twinkie/injector.c b/board/twinkie/injector.c
index ef5bfb3e32..7688b68128 100644
--- a/board/twinkie/injector.c
+++ b/board/twinkie/injector.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,20 +48,25 @@ static const struct res_cfg {
uint32_t flags;
} cfgs[2];
} res_cfg[] = {
- [INJ_RES_NONE] = {"NONE"},
- [INJ_RES_RA] = {"RA", {{GPIO_CC1_RA, GPIO_ODR_LOW},
- {GPIO_CC2_RA, GPIO_ODR_LOW} } },
- [INJ_RES_RD] = {"RD", {{GPIO_CC1_RD, GPIO_ODR_LOW},
- {GPIO_CC2_RD, GPIO_ODR_LOW} } },
- [INJ_RES_RPUSB] = {"RPUSB", {{GPIO_CC1_RPUSB, GPIO_OUT_HIGH},
- {GPIO_CC2_RPUSB, GPIO_OUT_HIGH} } },
- [INJ_RES_RP1A5] = {"RP1A5", {{GPIO_CC1_RP1A5, GPIO_OUT_HIGH},
- {GPIO_CC2_RP1A5, GPIO_OUT_HIGH} } },
- [INJ_RES_RP3A0] = {"RP3A0", {{GPIO_CC1_RP3A0, GPIO_OUT_HIGH},
- {GPIO_CC2_RP3A0, GPIO_OUT_HIGH} } },
+ [INJ_RES_NONE] = { "NONE" },
+ [INJ_RES_RA] = { "RA",
+ { { GPIO_CC1_RA, GPIO_ODR_LOW },
+ { GPIO_CC2_RA, GPIO_ODR_LOW } } },
+ [INJ_RES_RD] = { "RD",
+ { { GPIO_CC1_RD, GPIO_ODR_LOW },
+ { GPIO_CC2_RD, GPIO_ODR_LOW } } },
+ [INJ_RES_RPUSB] = { "RPUSB",
+ { { GPIO_CC1_RPUSB, GPIO_OUT_HIGH },
+ { GPIO_CC2_RPUSB, GPIO_OUT_HIGH } } },
+ [INJ_RES_RP1A5] = { "RP1A5",
+ { { GPIO_CC1_RP1A5, GPIO_OUT_HIGH },
+ { GPIO_CC2_RP1A5, GPIO_OUT_HIGH } } },
+ [INJ_RES_RP3A0] = { "RP3A0",
+ { { GPIO_CC1_RP3A0, GPIO_OUT_HIGH },
+ { GPIO_CC2_RP3A0, GPIO_OUT_HIGH } } },
};
-#define CC_RA(cc) (cc < PD_SRC_RD_THRESHOLD)
+#define CC_RA(cc) (cc < PD_SRC_RD_THRESHOLD)
#define CC_RD(cc) ((cc > PD_SRC_RD_THRESHOLD) && (cc < PD_SRC_VNC))
#define GET_POLARITY(cc1, cc2) (CC_RD(cc2) || CC_RA(cc1))
@@ -103,8 +108,8 @@ static inline void enable_tracing_ifneeded(int flag)
pd_rx_enable_monitoring(0);
}
-static int send_message(int polarity, uint16_t header,
- uint8_t cnt, const uint32_t *data)
+static int send_message(int polarity, uint16_t header, uint8_t cnt,
+ const uint32_t *data)
{
int bit_len;
@@ -215,7 +220,7 @@ static void fsm_wait(uint32_t w)
uint32_t timeout_ms = INJ_ARG0(w);
uint32_t min_edges = INJ_ARG12(w);
- wait_packet(inj_polarity, min_edges, timeout_ms * 1000);
+ wait_packet(inj_polarity, min_edges, timeout_ms * 1000);
#endif
}
@@ -224,7 +229,7 @@ static void fsm_expect(uint32_t w)
uint32_t timeout_ms = INJ_ARG0(w);
uint8_t cmd = INJ_ARG2(w);
- expect_packet(inj_polarity, cmd, timeout_ms * 1000);
+ expect_packet(inj_polarity, cmd, timeout_ms * 1000);
}
static void fsm_get(uint32_t w)
{
@@ -242,11 +247,11 @@ static void fsm_get(uint32_t w)
break;
case INJ_GET_VBUS:
*store_ptr = (ina2xx_get_voltage(0) & 0xffff) |
- ((ina2xx_get_current(0) & 0xffff) << 16);
+ ((ina2xx_get_current(0) & 0xffff) << 16);
break;
case INJ_GET_VCONN:
*store_ptr = (ina2xx_get_voltage(1) & 0xffff) |
- ((ina2xx_get_current(1) & 0xffff) << 16);
+ ((ina2xx_get_current(1) & 0xffff) << 16);
break;
case INJ_GET_POLARITY:
*store_ptr = inj_polarity;
@@ -336,9 +341,9 @@ static int fsm_run(int index)
/* ------ Console commands ------ */
-static int hex8tou32(char *str, uint32_t *val)
+static int hex8tou32(const char *str, uint32_t *val)
{
- char *ptr = str;
+ const char *ptr = str;
uint32_t tmp = 0;
while (*ptr) {
@@ -358,7 +363,7 @@ static int hex8tou32(char *str, uint32_t *val)
return EC_SUCCESS;
}
-static int cmd_fsm(int argc, char **argv)
+static int cmd_fsm(int argc, const char **argv)
{
int index;
char *e;
@@ -375,8 +380,7 @@ static int cmd_fsm(int argc, char **argv)
return EC_SUCCESS;
}
-
-static int cmd_send(int argc, char **argv)
+static int cmd_send(int argc, const char **argv)
{
int pol, cnt, i;
uint16_t header;
@@ -396,7 +400,7 @@ static int cmd_send(int argc, char **argv)
return EC_ERROR_PARAM3;
for (i = 0; i < cnt; i++)
- if (hex8tou32(argv[i+2], data + i))
+ if (hex8tou32(argv[i + 2], data + i))
return EC_ERROR_INVAL;
bit_len = send_message(pol, header, cnt, data);
@@ -405,15 +409,15 @@ static int cmd_send(int argc, char **argv)
return EC_SUCCESS;
}
-static int cmd_cc_level(int argc, char **argv)
+static int cmd_cc_level(int argc, const char **argv)
{
- ccprintf("CC1 = %d mV ; CC2 = %d mV\n",
- pd_adc_read(0, 0), pd_adc_read(0, 1));
+ ccprintf("CC1 = %d mV ; CC2 = %d mV\n", pd_adc_read(0, 0),
+ pd_adc_read(0, 1));
return EC_SUCCESS;
}
-static int cmd_resistor(int argc, char **argv)
+static int cmd_resistor(int argc, const char **argv)
{
int p, r;
@@ -435,7 +439,7 @@ static int cmd_resistor(int argc, char **argv)
return EC_SUCCESS;
}
-static int cmd_tx_clock(int argc, char **argv)
+static int cmd_tx_clock(int argc, const char **argv)
{
int freq;
char *e;
@@ -452,7 +456,7 @@ static int cmd_tx_clock(int argc, char **argv)
return EC_SUCCESS;
}
-static int cmd_rx_threshold(int argc, char **argv)
+static int cmd_rx_threshold(int argc, const char **argv)
{
int mv;
char *e;
@@ -471,7 +475,7 @@ static int cmd_rx_threshold(int argc, char **argv)
return EC_SUCCESS;
}
-static int cmd_ina_dump(int argc, char **argv, int index)
+static int cmd_ina_dump(int argc, const char **argv, int index)
{
if (index == 1) { /* VCONN INA is off by default, switch it on */
ina2xx_write(index, INA2XX_REG_CONFIG, 0x4123);
@@ -483,7 +487,7 @@ static int cmd_ina_dump(int argc, char **argv, int index)
}
ccprintf("%s = %d mV ; %d mA\n", index == 0 ? "VBUS" : "VCONN",
- ina2xx_get_voltage(index), ina2xx_get_current(index));
+ ina2xx_get_voltage(index), ina2xx_get_current(index));
if (index == 1) /* power off VCONN INA */
ina2xx_write(index, INA2XX_REG_CONFIG, 0);
@@ -491,7 +495,7 @@ static int cmd_ina_dump(int argc, char **argv, int index)
return EC_SUCCESS;
}
-static int cmd_bufwr(int argc, char **argv)
+static int cmd_bufwr(int argc, const char **argv)
{
int idx, cnt, i;
char *e;
@@ -505,13 +509,13 @@ static int cmd_bufwr(int argc, char **argv)
return EC_ERROR_PARAM2;
for (i = 0; i < cnt; i++)
- if (hex8tou32(argv[i+1], inj_cmds + idx + i))
+ if (hex8tou32(argv[i + 1], inj_cmds + idx + i))
return EC_ERROR_INVAL;
return EC_SUCCESS;
}
-static int cmd_bufrd(int argc, char **argv)
+static int cmd_bufrd(int argc, const char **argv)
{
int idx, i;
int cnt = 1;
@@ -537,7 +541,7 @@ static int cmd_bufrd(int argc, char **argv)
return EC_SUCCESS;
}
-static int cmd_sink(int argc, char **argv)
+static int cmd_sink(int argc, const char **argv)
{
/*
* Jump to the RW section which should contain a firmware acting
@@ -548,18 +552,16 @@ static int cmd_sink(int argc, char **argv)
return EC_SUCCESS;
}
-static int cmd_trace(int argc, char **argv)
+static int cmd_trace(int argc, const char **argv)
{
if (argc < 1)
return EC_ERROR_PARAM_COUNT;
- if (!strcasecmp(argv[0], "on") ||
- !strcasecmp(argv[0], "1"))
+ if (!strcasecmp(argv[0], "on") || !strcasecmp(argv[0], "1"))
set_trace_mode(TRACE_MODE_ON);
else if (!strcasecmp(argv[0], "raw"))
set_trace_mode(TRACE_MODE_RAW);
- else if (!strcasecmp(argv[0], "off") ||
- !strcasecmp(argv[0], "0"))
+ else if (!strcasecmp(argv[0], "off") || !strcasecmp(argv[0], "0"))
set_trace_mode(TRACE_MODE_OFF);
else
return EC_ERROR_PARAM2;
@@ -567,7 +569,7 @@ static int cmd_trace(int argc, char **argv)
return EC_SUCCESS;
}
-static int command_tw(int argc, char **argv)
+static int command_tw(int argc, const char **argv)
{
if (!strcasecmp(argv[1], "send"))
return cmd_send(argc - 2, argv + 2);
diff --git a/board/twinkie/injector.h b/board/twinkie/injector.h
index 4a33f8ecf0..ed39522969 100644
--- a/board/twinkie/injector.h
+++ b/board/twinkie/injector.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,50 +21,50 @@
/* Macros to extract values from FSM command words */
#define INJ_CMD(w) ((w) >> 28)
-#define INJ_ARG(w) ((w) & 0x0FFFFFFF)
-#define INJ_ARG0(w) ((w) & 0x0000FFFF)
+#define INJ_ARG(w) ((w)&0x0FFFFFFF)
+#define INJ_ARG0(w) ((w)&0x0000FFFF)
#define INJ_ARG1(w) (((w) >> 16) & 0xFF)
#define INJ_ARG2(w) (((w) >> 24) & 0xF)
#define INJ_ARG12(w) (((w) >> 16) & 0xFFF)
enum inj_cmd {
- INJ_CMD_END = 0x0, /* stop the FSM */
- INJ_CMD_SEND = 0x1, /* Send message on CCx */
- /* arg0: header arg1/2:payload index/count */
- INJ_CMD_WAVE = 0x2, /* Send arbitrary waveform */
- /* stored at index arg1 of len arg0 */
- INJ_CMD_HRST = 0x3, /* Send Hard Reset on CCx */
- INJ_CMD_WAIT = 0x4, /* Wait for arg12 edges if arg12 != 0 */
- /* and timeout after arg0 ms */
- INJ_CMD_GET = 0x5, /* Get parameter arg1 (INJ_GET_x) at index arg0 */
- INJ_CMD_SET = 0x6, /* Set parameter arg1 (INJ_SET_x) with arg0 */
- INJ_CMD_JUMP = 0x8, /* Jump to index (as arg0) */
+ INJ_CMD_END = 0x0, /* stop the FSM */
+ INJ_CMD_SEND = 0x1, /* Send message on CCx */
+ /* arg0: header arg1/2:payload index/count */
+ INJ_CMD_WAVE = 0x2, /* Send arbitrary waveform */
+ /* stored at index arg1 of len arg0 */
+ INJ_CMD_HRST = 0x3, /* Send Hard Reset on CCx */
+ INJ_CMD_WAIT = 0x4, /* Wait for arg12 edges if arg12 != 0 */
+ /* and timeout after arg0 ms */
+ INJ_CMD_GET = 0x5, /* Get parameter arg1 (INJ_GET_x) at index arg0 */
+ INJ_CMD_SET = 0x6, /* Set parameter arg1 (INJ_SET_x) with arg0 */
+ INJ_CMD_JUMP = 0x8, /* Jump to index (as arg0) */
INJ_CMD_EXPCT = 0xC, /* Expect a packet with command arg2 */
- /* and timeout after arg0 ms */
- INJ_CMD_NOP = 0xF, /* No-Operation */
+ /* and timeout after arg0 ms */
+ INJ_CMD_NOP = 0xF, /* No-Operation */
};
enum inj_set {
- INJ_SET_RESISTOR1 = 0, /* CC1 resistor as arg0 (INJ_RES_x) */
- INJ_SET_RESISTOR2 = 1, /* CC2 resistor as arg0 (INJ_RES_x) */
- INJ_SET_RECORD = 2, /* Recording on/off */
- INJ_SET_TX_SPEED = 3, /* TX frequency is arg0 kHz */
- INJ_SET_RX_THRESH = 4, /* RX voltage threshold is arg0 mV */
- INJ_SET_POLARITY = 5, /* Polarity for other operations (INJ_POL_CC) */
- INJ_SET_TRACE = 6, /* Text packet trace on/raw/off */
+ INJ_SET_RESISTOR1 = 0, /* CC1 resistor as arg0 (INJ_RES_x) */
+ INJ_SET_RESISTOR2 = 1, /* CC2 resistor as arg0 (INJ_RES_x) */
+ INJ_SET_RECORD = 2, /* Recording on/off */
+ INJ_SET_TX_SPEED = 3, /* TX frequency is arg0 kHz */
+ INJ_SET_RX_THRESH = 4, /* RX voltage threshold is arg0 mV */
+ INJ_SET_POLARITY = 5, /* Polarity for other operations (INJ_POL_CC) */
+ INJ_SET_TRACE = 6, /* Text packet trace on/raw/off */
};
enum inj_get {
- INJ_GET_CC = 0, /* CC1/CC2 voltages in mV */
- INJ_GET_VBUS = 1, /* VBUS voltage in mV and current in mA */
- INJ_GET_VCONN = 2, /* VCONN voltage in mV and current in mA */
+ INJ_GET_CC = 0, /* CC1/CC2 voltages in mV */
+ INJ_GET_VBUS = 1, /* VBUS voltage in mV and current in mA */
+ INJ_GET_VCONN = 2, /* VCONN voltage in mV and current in mA */
INJ_GET_POLARITY = 3, /* Current polarity (INJ_POL_CC) */
};
enum inj_res {
- INJ_RES_NONE = 0,
- INJ_RES_RA = 1,
- INJ_RES_RD = 2,
+ INJ_RES_NONE = 0,
+ INJ_RES_RA = 1,
+ INJ_RES_RD = 2,
INJ_RES_RPUSB = 3,
INJ_RES_RP1A5 = 4,
INJ_RES_RP3A0 = 5,
@@ -79,7 +79,7 @@ enum inj_pol {
enum trace_mode {
TRACE_MODE_OFF = 0,
TRACE_MODE_RAW = 1,
- TRACE_MODE_ON = 2,
+ TRACE_MODE_ON = 2,
};
/* Number of words in the FSM command/data buffer */
diff --git a/board/twinkie/simpletrace.c b/board/twinkie/simpletrace.c
index 811bd428fd..fdc4cbfbb2 100644
--- a/board/twinkie/simpletrace.c
+++ b/board/twinkie/simpletrace.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,6 +11,7 @@
#include "hooks.h"
#include "hwtimer.h"
#include "injector.h"
+#include "printf.h"
#include "registers.h"
#include "system.h"
#include "task.h"
@@ -25,61 +26,57 @@ int trace_mode;
/* The FSM is waiting for the following command (0 == None) */
uint8_t expected_cmd;
-static const char * const ctrl_msg_name[] = {
- [0] = "RSVD-C0",
- [PD_CTRL_GOOD_CRC] = "GOODCRC",
- [PD_CTRL_GOTO_MIN] = "GOTOMIN",
- [PD_CTRL_ACCEPT] = "ACCEPT",
- [PD_CTRL_REJECT] = "REJECT",
- [PD_CTRL_PING] = "PING",
- [PD_CTRL_PS_RDY] = "PSRDY",
+static const char *const ctrl_msg_name[] = {
+ [0] = "RSVD-C0",
+ [PD_CTRL_GOOD_CRC] = "GOODCRC",
+ [PD_CTRL_GOTO_MIN] = "GOTOMIN",
+ [PD_CTRL_ACCEPT] = "ACCEPT",
+ [PD_CTRL_REJECT] = "REJECT",
+ [PD_CTRL_PING] = "PING",
+ [PD_CTRL_PS_RDY] = "PSRDY",
[PD_CTRL_GET_SOURCE_CAP] = "GSRCCAP",
- [PD_CTRL_GET_SINK_CAP] = "GSNKCAP",
- [PD_CTRL_DR_SWAP] = "DRSWAP",
- [PD_CTRL_PR_SWAP] = "PRSWAP",
- [PD_CTRL_VCONN_SWAP] = "VCONNSW",
- [PD_CTRL_WAIT] = "WAIT",
- [PD_CTRL_SOFT_RESET] = "SFT-RST",
- [14] = "RSVD-C14",
- [15] = "RSVD-C15",
+ [PD_CTRL_GET_SINK_CAP] = "GSNKCAP",
+ [PD_CTRL_DR_SWAP] = "DRSWAP",
+ [PD_CTRL_PR_SWAP] = "PRSWAP",
+ [PD_CTRL_VCONN_SWAP] = "VCONNSW",
+ [PD_CTRL_WAIT] = "WAIT",
+ [PD_CTRL_SOFT_RESET] = "SFT-RST",
+ [14] = "RSVD-C14",
+ [15] = "RSVD-C15",
};
-static const char * const data_msg_name[] = {
- [0] = "RSVD-D0",
- [PD_DATA_SOURCE_CAP] = "SRCCAP",
- [PD_DATA_REQUEST] = "REQUEST",
- [PD_DATA_BIST] = "BIST",
- [PD_DATA_SINK_CAP] = "SNKCAP",
+static const char *const data_msg_name[] = {
+ [0] = "RSVD-D0",
+ [PD_DATA_SOURCE_CAP] = "SRCCAP",
+ [PD_DATA_REQUEST] = "REQUEST",
+ [PD_DATA_BIST] = "BIST",
+ [PD_DATA_SINK_CAP] = "SNKCAP",
/* 5-14 Reserved */
- [PD_DATA_VENDOR_DEF] = "VDM",
+ [PD_DATA_VENDOR_DEF] = "VDM",
};
-static const char * const svdm_cmd_name[] = {
- [CMD_DISCOVER_IDENT] = "DISCID",
- [CMD_DISCOVER_SVID] = "DISCSVID",
- [CMD_DISCOVER_MODES] = "DISCMODE",
- [CMD_ENTER_MODE] = "ENTER",
- [CMD_EXIT_MODE] = "EXIT",
- [CMD_ATTENTION] = "ATTN",
- [CMD_DP_STATUS] = "DPSTAT",
- [CMD_DP_CONFIG] = "DPCFG",
+static const char *const svdm_cmd_name[] = {
+ [CMD_DISCOVER_IDENT] = "DISCID", [CMD_DISCOVER_SVID] = "DISCSVID",
+ [CMD_DISCOVER_MODES] = "DISCMODE", [CMD_ENTER_MODE] = "ENTER",
+ [CMD_EXIT_MODE] = "EXIT", [CMD_ATTENTION] = "ATTN",
+ [CMD_DP_STATUS] = "DPSTAT", [CMD_DP_CONFIG] = "DPCFG",
};
-static const char * const svdm_cmdt_name[] = {
- [CMDT_INIT] = "INI",
- [CMDT_RSP_ACK] = "ACK",
- [CMDT_RSP_NAK] = "NAK",
+static const char *const svdm_cmdt_name[] = {
+ [CMDT_INIT] = "INI",
+ [CMDT_RSP_ACK] = "ACK",
+ [CMDT_RSP_NAK] = "NAK",
[CMDT_RSP_BUSY] = "BSY",
};
static void print_pdo(uint32_t word)
{
if ((word & PDO_TYPE_MASK) == PDO_TYPE_BATTERY)
- ccprintf(" %dmV/%dmW", ((word>>10)&0x3ff)*50,
- (word&0x3ff)*250);
+ ccprintf(" %dmV/%dmW", ((word >> 10) & 0x3ff) * 50,
+ (word & 0x3ff) * 250);
else
- ccprintf(" %dmV/%dmA", ((word>>10)&0x3ff)*50,
- (word&0x3ff)*10);
+ ccprintf(" %dmV/%dmA", ((word >> 10) & 0x3ff) * 50,
+ (word & 0x3ff) * 10);
}
static void print_rdo(uint32_t word)
@@ -109,9 +106,11 @@ static void print_packet(int head, uint32_t *payload)
int id = PD_HEADER_ID(head);
const char *name;
const char *prole;
+ char ts_str[PRINTF_TIMESTAMP_BUF_SIZE];
if (trace_mode == TRACE_MODE_RAW) {
- ccprintf("%pT[%04x]", PRINTF_TIMESTAMP_NOW, head);
+ snprintf_timestamp_now(ts_str, sizeof(ts_str));
+ ccprintf("%s[%04x]", ts_str, head);
for (i = 0; i < cnt; i++)
ccprintf(" %08x", payload[i]);
ccputs("\n");
@@ -119,8 +118,8 @@ static void print_packet(int head, uint32_t *payload)
}
name = cnt ? data_msg_name[typ] : ctrl_msg_name[typ];
prole = head & (PD_ROLE_SOURCE << 8) ? "SRC" : "SNK";
- ccprintf("%pT %s/%d [%04x]%s",
- PRINTF_TIMESTAMP_NOW, prole, id, head, name);
+ snprintf_timestamp_now(ts_str, sizeof(ts_str));
+ ccprintf("%s %s/%d [%04x]%s", ts_str, prole, id, head, name);
if (!cnt) { /* Control message : we are done */
ccputs("\n");
return;
@@ -144,18 +143,22 @@ static void print_packet(int head, uint32_t *payload)
break;
default:
ccprintf(" %08x", payload[i]);
- }
+ }
ccputs("\n");
}
static void print_error(enum pd_rx_errors err)
{
+ char ts_str[PRINTF_TIMESTAMP_BUF_SIZE];
+
+ snprintf_timestamp_now(ts_str, sizeof(ts_str));
+
if (err == PD_RX_ERR_INVAL)
- ccprintf("%pT TMOUT\n", PRINTF_TIMESTAMP_NOW);
+ ccprintf("%s TMOUT\n", ts_str);
else if (err == PD_RX_ERR_HARD_RESET)
- ccprintf("%pT HARD-RST\n", PRINTF_TIMESTAMP_NOW);
+ ccprintf("%s HARD-RST\n", ts_str);
else if (err == PD_RX_ERR_UNSUPPORTED_SOP)
- ccprintf("%pT SOP*\n", PRINTF_TIMESTAMP_NOW);
+ ccprintf("%s SOP*\n", ts_str);
else
ccprintf("ERR %d\n", err);
}
@@ -176,19 +179,20 @@ static void rx_event(void)
if (pending & (1 << (21 + i))) {
rx_edge_ts[i][rx_edge_ts_idx[i]].val = get_time().val;
next_idx = (rx_edge_ts_idx[i] ==
- PD_RX_TRANSITION_COUNT - 1) ?
- 0 : rx_edge_ts_idx[i] + 1;
+ PD_RX_TRANSITION_COUNT - 1) ?
+ 0 :
+ rx_edge_ts_idx[i] + 1;
/*
* If we have seen enough edges in a certain amount of
* time, then trigger RX start.
*/
if ((rx_edge_ts[i][rx_edge_ts_idx[i]].val -
- rx_edge_ts[i][next_idx].val)
- < PD_RX_TRANSITION_WINDOW) {
+ rx_edge_ts[i][next_idx].val) <
+ PD_RX_TRANSITION_WINDOW) {
/* acquire the message only on the active CC */
- STM32_COMP_CSR &= ~(i ? STM32_COMP_CMP1EN
- : STM32_COMP_CMP2EN);
+ STM32_COMP_CSR &= ~(i ? STM32_COMP_CMP1EN :
+ STM32_COMP_CMP2EN);
/* start sampling */
pd_rx_start(0);
/*
diff --git a/board/twinkie/sniffer.c b/board/twinkie/sniffer.c
index 7d2d8d439f..ff7ad02f87 100644
--- a/board/twinkie/sniffer.c
+++ b/board/twinkie/sniffer.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -105,8 +105,8 @@ static void ep_tx(void)
btable_ep[USB_EP_SNIFFER].tx_addr = usb_sram_addr(ep_buf[b]);
}
/* re-enable data transmission if we have available data */
- btable_ep[USB_EP_SNIFFER].tx_count = (free_usb & (1<<b)) ? 0
- : EP_BUF_SIZE;
+ btable_ep[USB_EP_SNIFFER].tx_count =
+ (free_usb & (1 << b)) ? 0 : EP_BUF_SIZE;
STM32_TOGGLE_EP(USB_EP_SNIFFER, EP_TX_MASK, EP_TX_VALID, 0);
/* wake up the processing */
task_set_event(TASK_ID_SNIFFER, USB_EVENT);
@@ -127,7 +127,6 @@ static void ep_event(enum usb_ep_event evt)
}
USB_DECLARE_EP(USB_EP_SNIFFER, ep_tx, ep_tx, ep_event);
-
/* --- RX operation using comparator linked to timer --- */
/* RX on CC1 is using COMP1 triggering TIM1 CH1 */
#define TIM_RX1 1
@@ -144,13 +143,13 @@ USB_DECLARE_EP(USB_EP_SNIFFER, ep_tx, ep_tx, ep_event);
static const struct dma_option dma_tim_cc1 = {
DMAC_TIM_RX1, (void *)&STM32_TIM_CCRx(TIM_RX1, TIM_RX1_CCR_IDX),
STM32_DMA_CCR_MSIZE_8_BIT | STM32_DMA_CCR_PSIZE_8_BIT |
- STM32_DMA_CCR_CIRC | STM32_DMA_CCR_TCIE | STM32_DMA_CCR_HTIE
+ STM32_DMA_CCR_CIRC | STM32_DMA_CCR_TCIE | STM32_DMA_CCR_HTIE
};
static const struct dma_option dma_tim_cc2 = {
DMAC_TIM_RX2, (void *)&STM32_TIM_CCRx(TIM_RX2, TIM_RX2_CCR_IDX),
STM32_DMA_CCR_MSIZE_8_BIT | STM32_DMA_CCR_PSIZE_8_BIT |
- STM32_DMA_CCR_CIRC | STM32_DMA_CCR_TCIE | STM32_DMA_CCR_HTIE
+ STM32_DMA_CCR_CIRC | STM32_DMA_CCR_TCIE | STM32_DMA_CCR_HTIE
};
/* sequence number for sample buffers */
@@ -161,7 +160,7 @@ static uint32_t oflow;
#define SNIFFER_CHANNEL_CC1 0
#define SNIFFER_CHANNEL_CC2 1
-#define get_channel(b) (((b) >> 12) & 0x1)
+#define get_channel(b) (((b) >> 12) & 0x1)
void tim_rx1_handler(uint32_t stat)
{
@@ -171,8 +170,7 @@ void tim_rx1_handler(uint32_t stat)
uint32_t next = idx ? 0x0001 : 0x0100;
sample_tstamp[idx] = __hw_clock_source_read();
- sample_seq[idx] = ((seq++ << 3) & 0x0ff8) |
- (SNIFFER_CHANNEL_CC1<<12);
+ sample_seq[idx] = ((seq++ << 3) & 0x0ff8) | (SNIFFER_CHANNEL_CC1 << 12);
if (filled_dma & next) {
oflow++;
sample_seq[idx] |= 0x8000;
@@ -193,8 +191,7 @@ void tim_rx2_handler(uint32_t stat)
idx += 2;
sample_tstamp[idx] = __hw_clock_source_read();
- sample_seq[idx] = ((seq++ << 3) & 0x0ff8) |
- (SNIFFER_CHANNEL_CC2<<12);
+ sample_seq[idx] = ((seq++ << 3) & 0x0ff8) | (SNIFFER_CHANNEL_CC2 << 12);
if (filled_dma & next) {
oflow++;
sample_seq[idx] |= 0x8000;
@@ -209,10 +206,10 @@ void tim_rx2_handler(uint32_t stat)
static void tim_dma_handler(void)
{
stm32_dma_regs_t *dma = STM32_DMA1_REGS;
- uint32_t stat = dma->isr & (STM32_DMA_ISR_HTIF(DMAC_TIM_RX1)
- | STM32_DMA_ISR_TCIF(DMAC_TIM_RX1)
- | STM32_DMA_ISR_HTIF(DMAC_TIM_RX2)
- | STM32_DMA_ISR_TCIF(DMAC_TIM_RX2));
+ uint32_t stat = dma->isr & (STM32_DMA_ISR_HTIF(DMAC_TIM_RX1) |
+ STM32_DMA_ISR_TCIF(DMAC_TIM_RX1) |
+ STM32_DMA_ISR_HTIF(DMAC_TIM_RX2) |
+ STM32_DMA_ISR_TCIF(DMAC_TIM_RX2));
if (stat & STM32_DMA_ISR_ALL(DMAC_TIM_RX2))
tim_rx2_handler(stat);
else
@@ -251,30 +248,26 @@ static void rx_timer_init(int tim_id, timer_ctlr_t *tim, int ch_idx, int up_idx)
tim->sr = 0;
}
-
-
void sniffer_init(void)
{
/* remap TIM1 CH1/2/3 to DMA channel 6 */
STM32_SYSCFG_CFGR1 |= BIT(28);
/* TIM1 CH1 for CC1 RX */
- rx_timer_init(TIM_RX1, (void *)STM32_TIM_BASE(TIM_RX1),
- TIM_RX1_CCR_IDX, 2);
+ rx_timer_init(TIM_RX1, (void *)STM32_TIM_BASE(TIM_RX1), TIM_RX1_CCR_IDX,
+ 2);
/* TIM3 CH4 for CC2 RX */
- rx_timer_init(TIM_RX2, (void *)STM32_TIM_BASE(TIM_RX2),
- TIM_RX2_CCR_IDX, 2);
+ rx_timer_init(TIM_RX2, (void *)STM32_TIM_BASE(TIM_RX2), TIM_RX2_CCR_IDX,
+ 2);
/* turn on COMP/SYSCFG */
STM32_RCC_APB2ENR |= BIT(0);
- STM32_COMP_CSR = STM32_COMP_CMP1EN | STM32_COMP_CMP1MODE_HSPEED |
- STM32_COMP_CMP1INSEL_VREF12 |
- STM32_COMP_CMP1OUTSEL_TIM1_IC1 |
- STM32_COMP_CMP1HYST_HI |
- STM32_COMP_CMP2EN | STM32_COMP_CMP2MODE_HSPEED |
- STM32_COMP_CMP2INSEL_VREF12 |
- STM32_COMP_CMP2OUTSEL_TIM2_IC4 |
- STM32_COMP_CMP2HYST_HI;
+ STM32_COMP_CSR =
+ STM32_COMP_CMP1EN | STM32_COMP_CMP1MODE_HSPEED |
+ STM32_COMP_CMP1INSEL_VREF12 | STM32_COMP_CMP1OUTSEL_TIM1_IC1 |
+ STM32_COMP_CMP1HYST_HI | STM32_COMP_CMP2EN |
+ STM32_COMP_CMP2MODE_HSPEED | STM32_COMP_CMP2INSEL_VREF12 |
+ STM32_COMP_CMP2OUTSEL_TIM2_IC4 | STM32_COMP_CMP2HYST_HI;
/* start sampling the edges on the CC lines using the RX timers */
dma_start_rx(&dma_tim_cc1, RX_COUNT, samples[0]);
@@ -311,11 +304,11 @@ void sniffer_task(void)
ep_buf[u][0] = sample_seq[d >> 3] | (d & 7);
ep_buf[u][1] = sample_tstamp[d >> 3];
- memcpy_to_usbram(
- ((void *)usb_sram_addr(ep_buf[u]
- + (EP_PACKET_HEADER_SIZE>>1))),
- samples[d >> 4]+off,
- EP_PAYLOAD_SIZE);
+ memcpy_to_usbram(((void *)usb_sram_addr(
+ ep_buf[u] +
+ (EP_PACKET_HEADER_SIZE >> 1))),
+ samples[d >> 4] + off,
+ EP_PAYLOAD_SIZE);
atomic_clear_bits((atomic_t *)&free_usb, 1 << u);
u = !u;
atomic_clear_bits((atomic_t *)&filled_dma, 1 << d);
@@ -332,8 +325,8 @@ void sniffer_task(void)
int wait_packet(int pol, uint32_t min_edges, uint32_t timeout_us)
{
- stm32_dma_chan_t *chan = dma_get_channel(pol ? DMAC_TIM_RX2
- : DMAC_TIM_RX1);
+ stm32_dma_chan_t *chan =
+ dma_get_channel(pol ? DMAC_TIM_RX2 : DMAC_TIM_RX1);
uint32_t t0 = __hw_clock_source_read();
uint32_t c0 = chan->cndtr;
uint32_t t_gap = t0;
@@ -355,7 +348,7 @@ int wait_packet(int pol, uint32_t min_edges, uint32_t timeout_us)
total_edges += nb;
} else {
if ((t - t_gap) > 20 &&
- (total_edges - (t - t0)/256) >= min_edges)
+ (total_edges - (t - t0) / 256) >= min_edges)
/* real gap after the packet */
break;
}
@@ -392,11 +385,10 @@ static void sniffer_sysjump(void)
}
DECLARE_HOOK(HOOK_SYSJUMP, sniffer_sysjump, HOOK_PRIO_DEFAULT);
-static int command_sniffer(int argc, char **argv)
+static int command_sniffer(int argc, const char **argv)
{
ccprintf("Seq number:%d Overflows: %d\n", seq, oflow);
return EC_SUCCESS;
}
-DECLARE_CONSOLE_COMMAND(sniffer, command_sniffer,
- "[]", "Buffering status");
+DECLARE_CONSOLE_COMMAND(sniffer, command_sniffer, "[]", "Buffering status");
diff --git a/board/twinkie/usb_pd_config.h b/board/twinkie/usb_pd_config.h
index 1c20a9df77..062c174d8a 100644
--- a/board/twinkie/usb_pd_config.h
+++ b/board/twinkie/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,7 +50,7 @@ static inline void spi_enable_clock(int port)
#define DMAC_TIM_RX(p) STM32_DMAC_CH2
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
-#define TIM_CCR_CS 1
+#define TIM_CCR_CS 1
#define EXTI_COMP_MASK(p) (BIT(21) | BIT(22))
#define IRQ_COMP STM32_IRQ_COMP
/* triggers packet detection on comparator falling edge */
@@ -102,11 +102,11 @@ static inline void pd_tx_enable(int port, int polarity)
static inline void pd_tx_disable(int port, int polarity)
{
/* TX_DATA on PB4 is an output low GPIO to disable the FET */
- STM32_GPIO_MODER(GPIO_B) = (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2*4)))
- | (1 << (2*4));
+ STM32_GPIO_MODER(GPIO_B) =
+ (STM32_GPIO_MODER(GPIO_B) & ~(3 << (2 * 4))) | (1 << (2 * 4));
/* TX_DATA on PA6 is an output low GPIO to disable the FET */
- STM32_GPIO_MODER(GPIO_A) = (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2*6)))
- | (1 << (2*6));
+ STM32_GPIO_MODER(GPIO_A) =
+ (STM32_GPIO_MODER(GPIO_A) & ~(3 << (2 * 6))) | (1 << (2 * 6));
/*
* Tri-state the low side after the high side
* to ensure we are not going above Vnc
@@ -119,11 +119,12 @@ static inline void pd_tx_disable(int port, int polarity)
static inline void pd_select_polarity(int port, int polarity)
{
/* use the right comparator */
- STM32_COMP_CSR = (STM32_COMP_CSR
- & ~(STM32_COMP_CMP1INSEL_MASK | STM32_COMP_CMP2INSEL_MASK
- |STM32_COMP_CMP1EN | STM32_COMP_CMP2EN))
- | STM32_COMP_CMP1INSEL_INM4 | STM32_COMP_CMP2INSEL_INM4
- | (polarity ? STM32_COMP_CMP2EN : STM32_COMP_CMP1EN);
+ STM32_COMP_CSR =
+ (STM32_COMP_CSR &
+ ~(STM32_COMP_CMP1INSEL_MASK | STM32_COMP_CMP2INSEL_MASK |
+ STM32_COMP_CMP1EN | STM32_COMP_CMP2EN)) |
+ STM32_COMP_CMP1INSEL_INM4 | STM32_COMP_CMP2INSEL_INM4 |
+ (polarity ? STM32_COMP_CMP2EN : STM32_COMP_CMP1EN);
}
/* Initialize pins used for clocking */
diff --git a/board/twinkie/usb_pd_pdo.c b/board/twinkie/usb_pd_pdo.c
index 120c13125b..fbc0624f80 100644
--- a/board/twinkie/usb_pd_pdo.c
+++ b/board/twinkie/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,15 +10,15 @@
#define PDO_FIXED_FLAGS (PDO_FIXED_UNCONSTRAINED | PDO_FIXED_DATA_SWAP)
const uint32_t pd_src_pdo[] = {
- PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
- PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS),
- PDO_FIXED(20000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(5000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(12000, 3000, PDO_FIXED_FLAGS),
+ PDO_FIXED(20000, 3000, PDO_FIXED_FLAGS),
};
const int pd_src_pdo_cnt = ARRAY_SIZE(pd_src_pdo);
const uint32_t pd_snk_pdo[] = {
- PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
- PDO_BATT(4750, 21000, 15000),
- PDO_VAR(4750, 21000, 3000),
+ PDO_FIXED(5000, 500, PDO_FIXED_FLAGS),
+ PDO_BATT(4750, 21000, 15000),
+ PDO_VAR(4750, 21000, 3000),
};
const int pd_snk_pdo_cnt = ARRAY_SIZE(pd_snk_pdo);
diff --git a/board/twinkie/usb_pd_pdo.h b/board/twinkie/usb_pd_pdo.h
index 377ccce1b5..0badd0f7bf 100644
--- a/board/twinkie/usb_pd_pdo.h
+++ b/board/twinkie/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/twinkie/usb_pd_policy.c b/board/twinkie/usb_pd_policy.c
index a8f76b40e5..c99dfb5750 100644
--- a/board/twinkie/usb_pd_policy.c
+++ b/board/twinkie/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,8 +15,8 @@
#include "usb_pd.h"
#include "usb_pd_pdo.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
void pd_set_input_current_limit(int port, uint32_t max_ma,
uint32_t supply_voltage)
@@ -50,27 +50,23 @@ __override int pd_check_power_swap(int port)
return 0;
}
-__override int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+__override int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Always allow data swap */
return 1;
}
-__override void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
+__override void pd_check_pr_role(int port, enum pd_power_role pr_role,
int flags)
{
}
-__override void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+__override void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
}
__override int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+ uint32_t **rpayload)
{
return 0;
}
diff --git a/board/vell/battery.c b/board/vell/battery.c
index 15041415a1..0ffb7fb015 100644
--- a/board/vell/battery.c
+++ b/board/vell/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/vell/board.c b/board/vell/board.c
index 47774afec5..7496df1b86 100644
--- a/board/vell/board.c
+++ b/board/vell/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,6 +17,7 @@
#include "fw_config.h"
#include "hooks.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power_button.h"
#include "power.h"
#include "registers.h"
@@ -27,8 +28,8 @@
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
static void board_chipset_startup(void)
{
diff --git a/board/vell/board.h b/board/vell/board.h
index eabb09d75a..a17be43a50 100644
--- a/board/vell/board.h
+++ b/board/vell/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,13 +45,14 @@
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(CLEAR_ALS)
-
/* USB Type C and USB PD defines */
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
#define CONFIG_IO_EXPANDER
#define CONFIG_IO_EXPANDER_NCT38XX
-#define CONFIG_IO_EXPANDER_PORT_COUNT 4
+#define CONFIG_IO_EXPANDER_PORT_COUNT 4
+
+#define CONFIG_USB_PD_FRS_PPC
#define CONFIG_USBC_RETIMER_INTEL_BB
@@ -61,16 +62,16 @@
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/* USB Type C and USB PD defines */
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_CURRENT_MA 5000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_CURRENT_MA 5000
+#define PD_MAX_VOLTAGE_MV 20000
/* Max Power = 100 W */
-#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
+#define PD_MAX_POWER_MW ((PD_MAX_VOLTAGE_MV * PD_MAX_CURRENT_MA) / 1000)
/*
* Macros for GPIO signals used in common code that don't match the
@@ -78,84 +79,78 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
-#define GPIO_RIGHT_LED_AMBER_L GPIO_LED_1_L
-#define GPIO_RIGHT_LED_WHITE_L GPIO_LED_2_L
-#define GPIO_LEFT_LED_AMBER_L GPIO_LED_3_L
-#define GPIO_LEFT_LED_WHITE_L GPIO_LED_4_L
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_RIGHT_LED_AMBER_L GPIO_LED_1_L
+#define GPIO_RIGHT_LED_WHITE_L GPIO_LED_2_L
+#define GPIO_LEFT_LED_AMBER_L GPIO_LED_3_L
+#define GPIO_LEFT_LED_WHITE_L GPIO_LED_4_L
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C2_C3_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C1_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C2_C3_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C2_C3_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C1_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C2_C3_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C2_C3_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C1_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C2_C3_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C0_C1_MUX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_C2_C3_MUX NPCX_I2C_PORT3_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
/*
* see b/174768555#comment22
*/
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
-#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
-#define USBC_PORT_C3_BB_RETIMER_I2C_ADDR 0x59
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x56
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x57
+#define USBC_PORT_C2_BB_RETIMER_I2C_ADDR 0x58
+#define USBC_PORT_C3_BB_RETIMER_I2C_ADDR 0x59
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
+#define CONFIG_USB_PD_DATA_RESET_MSG
-/*
- * TODO: b/220634230, Disable BBR firmware update temporally,
- * revert this patch once confirm BBR firmware update is ready
- * on kernel.
- */
/* Retimer */
-#if 0
#define CONFIG_USBC_RETIMER_FW_UPDATE
-#endif
/* Thermal features */
#define CONFIG_THERMISTOR
@@ -164,22 +159,23 @@
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan features */
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FAN_BYPASS_SLOW_RESPONSE
#define CONFIG_CUSTOM_FAN_CONTROL
-#define RPM_DEVIATION 1
+#define RPM_DEVIATION 1
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 5
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 5
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Keyboard features */
#define CONFIG_KEYBOARD_FACTORY_TEST
#define CONFIG_KEYBOARD_REFRESH_ROW3
#undef CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE
-#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 3
+#define CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE 3
/*
* Older boards have a different ADC assignment.
@@ -189,7 +185,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -211,11 +207,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum sensor_id {
- CLEAR_ALS = 0,
- RGB_ALS,
- SENSOR_COUNT
-};
+enum sensor_id { CLEAR_ALS = 0, RGB_ALS, SENSOR_COUNT };
enum ioex_port {
IOEX_C0_NCT38XX = 0,
@@ -232,20 +224,14 @@ enum battery_type {
};
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
extern const int keyboard_factory_scan_pins[][2];
diff --git a/board/vell/build.mk b/board/vell/build.mk
index c43f37b4dd..cad0da2a4e 100644
--- a/board/vell/build.mk
+++ b/board/vell/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/vell/charger.c b/board/vell/charger.c
index 0b35b7ba29..e33a0ed44a 100644
--- a/board/vell/charger.c
+++ b/board/vell/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,9 +16,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -82,17 +81,16 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Limit the input current to 96% negotiated limit,
* to account for the charger chip margin.
*/
charge_ma = charge_ma * 96 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
static void set_ac_prochot(void)
diff --git a/board/vell/ec.tasklist b/board/vell/ec.tasklist
index 924d708a6b..0bae104a07 100644
--- a/board/vell/ec.tasklist
+++ b/board/vell/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/vell/fans.c b/board/vell/fans.c
index fb2b29f502..b3fc2f8585 100644
--- a/board/vell/fans.c
+++ b/board/vell/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
diff --git a/board/vell/fw_config.c b/board/vell/fw_config.c
index 9c28c3ca58..bf5e29fe05 100644
--- a/board/vell/fw_config.c
+++ b/board/vell/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union brya_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/vell/fw_config.h b/board/vell/fw_config.h
index 6e4eb3ef58..fea6c9a8da 100644
--- a/board/vell/fw_config.h
+++ b/board/vell/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,12 +27,12 @@ enum ec_cfg_keyboard_backlight_type {
union brya_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
- uint32_t sd_db : 2;
- uint32_t lte_db : 1;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ enum ec_cfg_usb_db_type usb_db : 4;
+ uint32_t sd_db : 2;
+ uint32_t lte_db : 1;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t reserved_1 : 21;
};
uint32_t raw_value;
};
diff --git a/board/vell/gpio.inc b/board/vell/gpio.inc
index 4c5b630658..9f6ce7cc7e 100644
--- a/board/vell/gpio.inc
+++ b/board/vell/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -142,23 +142,23 @@ GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW)
/* GPIO02_P1 to PU */
/* GPIO03_P1 to PU */
IOEX(USB_C0_OC_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_LOW)
+IOEX(USB_C0_FRS_EN, EXPIN(IOEX_C0_NCT38XX, 0, 6), GPIO_OUT_LOW)
IOEX(USB_C0_RT_RST_ODL, EXPIN(IOEX_C0_NCT38XX, 0, 7), GPIO_ODR_LOW)
IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 2), GPIO_ODR_LOW)
/* GPIO03_P2 to PU */
IOEX(USB_C1_OC_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_LOW)
+IOEX(USB_C1_FRS_EN, EXPIN(IOEX_C1_NCT38XX, 0, 6), GPIO_OUT_LOW)
/* GPIO07_P2 to PU */
/* GPIO02_P1 to PU */
/* GPIO03_P1 to PU */
IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_LOW)
+IOEX(USB_C2_FRS_EN, EXPIN(IOEX_C2_NCT38XX, 0, 6), GPIO_OUT_LOW)
IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 7), GPIO_ODR_LOW)
IOEX(USB_C3_RT_RST_ODL, EXPIN(IOEX_C3_NCT38XX, 0, 2), GPIO_ODR_LOW)
/* GPIO03_P2 to PU */
IOEX(USB_C3_OC_ODL, EXPIN(IOEX_C3_NCT38XX, 0, 4), GPIO_ODR_HIGH)
-IOEX(USB_C3_FRS_EN, EXPIN(IOEX_C3_NCT38XX, 0, 6), GPIO_LOW)
+IOEX(USB_C3_FRS_EN, EXPIN(IOEX_C3_NCT38XX, 0, 6), GPIO_OUT_LOW)
/* GPIO07_P2 to PU */
diff --git a/board/vell/i2c.c b/board/vell/i2c.c
index 4f505d74c7..822de9a0d1 100644
--- a/board/vell/i2c.c
+++ b/board/vell/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/vell/keyboard.c b/board/vell/keyboard.c
index 7a51f8dd39..f541f51e3b 100644
--- a/board/vell/keyboard.c
+++ b/board/vell/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -48,7 +48,6 @@ __override const struct ec_response_keybd_config *
board_vivaldi_keybd_config(void)
{
return &keybd1;
-
}
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
@@ -58,13 +57,13 @@ board_vivaldi_keybd_config(void)
* The connector has 24 pins total, and there is no pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {1, 4}, {1, 3}, {1, 6}, {1, 7},
- {3, 1}, {2, 0}, {1, 5}, {2, 6}, {2, 7},
- {2, 1}, {2, 4}, {2, 5}, {1, 2}, {2, 3},
- {2, 2}, {3, 0}, {-1, -1}, {-1, -1}, {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 },
+ { 0, 7 }, { 1, 4 }, { 1, 3 }, { 1, 6 }, { 1, 7 },
+ { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 },
+ { 2, 2 }, { 3, 0 }, { -1, -1 }, { -1, -1 }, { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/vell/led.c b/board/vell/led.c
index 4387d1a6d7..cd9304b2cf 100644
--- a/board/vell/led.c
+++ b/board/vell/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -22,15 +22,13 @@
#define BATT_LOW_BCT 10
#define LED_TICK_INTERVAL_MS (500 * MSEC)
-#define LED_CYCLE_TIME_MS (2000 * MSEC)
-#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
-#define LED_ON_TIME_MS (1000 * MSEC)
-#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
-
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED
-};
+#define LED_CYCLE_TIME_MS (2000 * MSEC)
+#define LED_TICKS_PER_CYCLE (LED_CYCLE_TIME_MS / LED_TICK_INTERVAL_MS)
+#define LED_ON_TIME_MS (1000 * MSEC)
+#define LED_ON_TICKS (LED_ON_TIME_MS / LED_TICK_INTERVAL_MS)
+
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_LEFT_LED,
+ EC_LED_ID_RIGHT_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -38,13 +36,10 @@ enum led_color {
LED_OFF = 0,
LED_AMBER,
LED_WHITE,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
-enum led_port {
- RIGHT_PORT = 0,
- LEFT_PORT
-};
+enum led_port { RIGHT_PORT = 0, LEFT_PORT };
uint8_t bat_led_on;
uint8_t bat_led_off;
@@ -66,9 +61,9 @@ static void led_set_color_battery(int port, enum led_color color)
enum gpio_signal amber_led, white_led;
amber_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_AMBER_L :
- GPIO_LEFT_LED_AMBER_L);
+ GPIO_LEFT_LED_AMBER_L);
white_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_WHITE_L :
- GPIO_LEFT_LED_WHITE_L);
+ GPIO_LEFT_LED_WHITE_L);
switch (color) {
case LED_WHITE:
@@ -148,16 +143,15 @@ static void set_active_port_color(enum led_color color)
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
led_set_color_battery(RIGHT_PORT,
- (port == RIGHT_PORT) ? color : LED_OFF);
+ (port == RIGHT_PORT) ? color : LED_OFF);
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
led_set_color_battery(LEFT_PORT,
- (port == LEFT_PORT) ? color : LED_OFF);
+ (port == LEFT_PORT) ? color : LED_OFF);
}
static void led_set_battery(void)
{
static unsigned int battery_ticks;
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -173,43 +167,52 @@ static void led_set_battery(void)
*/
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
if (charge_get_percent() < BATT_LOW_BCT)
- led_set_color_battery(RIGHT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
if (charge_get_percent() < BATT_LOW_BCT)
- led_set_color_battery(LEFT_PORT,
- (battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ LEFT_PORT,
+ (battery_ticks % LED_TICKS_PER_CYCLE <
+ LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
else
led_set_color_battery(LEFT_PORT, LED_OFF);
}
break;
case PWR_STATE_ERROR:
if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
- led_set_color_battery(RIGHT_PORT, (battery_ticks & 0x1)
- ? LED_AMBER : LED_OFF);
+ led_set_color_battery(
+ RIGHT_PORT,
+ (battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
}
if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED)) {
- led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1)
- ? LED_AMBER : LED_OFF);
+ led_set_color_battery(LEFT_PORT, (battery_ticks & 0x1) ?
+ LED_AMBER :
+ LED_OFF);
}
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE)
- set_active_port_color((battery_ticks %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_AMBER : LED_OFF);
- else
- set_active_port_color(LED_WHITE);
+ set_active_port_color(LED_WHITE);
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ set_active_port_color(
+ (battery_ticks % LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_AMBER :
+ LED_OFF);
break;
default:
/* Other states don't alter LED behavior */
diff --git a/board/vell/pwm.c b/board/vell/pwm.c
index 90fb4dac68..94fb4e8929 100644
--- a/board/vell/pwm.c
+++ b/board/vell/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/vell/sensors.c b/board/vell/sensors.c
index 0528a62717..f088fc8867 100644
--- a/board/vell/sensors.c
+++ b/board/vell/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -61,7 +61,7 @@ static struct als_drv_data_t g_tcs3400_data = {
.als_cal.offset = 0,
.als_cal.channel_scale = {
.k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kc from VPD */
- .cover_scale = ALS_CHANNEL_SCALE(1.0), /* CT */
+ .cover_scale = ALS_CHANNEL_SCALE(0.23), /* CT */
},
};
@@ -71,39 +71,39 @@ static struct als_drv_data_t g_tcs3400_data = {
*/
static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
.calibration.rgb_cal[X] = {
- .offset = 0,
- .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(1.0),
+ .offset = 448, /* 447.5509362 */
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.45511034),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.21956361),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0.32628044),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.3610898),
.scale = {
.k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ .cover_scale = ALS_CHANNEL_SCALE(0.08)
}
},
.calibration.rgb_cal[Y] = {
- .offset = 0,
- .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(1.0),
+ .offset = 436, /* 435.9025807*/
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.50765776),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.34142269),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0.55352908),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.35923454),
.scale = {
.k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kg */
.cover_scale = ALS_CHANNEL_SCALE(1.0)
},
},
.calibration.rgb_cal[Z] = {
- .offset = 0,
- .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0),
- .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(1.0),
+ .offset = 287, /* 286.51472391*/
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.11635731),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.76700456),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(1.36663521),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.18494607),
.scale = {
.k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ .cover_scale = ALS_CHANNEL_SCALE(0.54)
}
},
- .calibration.irt = INT_TO_FP(1),
+ .calibration.irt = FLOAT_TO_FP(0.06),
.saturation.again = TCS_DEFAULT_AGAIN,
.saturation.atime = TCS_DEFAULT_ATIME,
};
@@ -207,8 +207,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(95), \
@@ -225,8 +225,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
[EC_TEMP_THRESH_HALT] = C_TO_K(95), \
@@ -244,8 +244,8 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_WWAN \
- { \
+#define THERMAL_WWAN \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -264,8 +264,8 @@ __maybe_unused static const struct ec_thermal_config thermal_wwan =
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_DDR \
- { \
+#define THERMAL_DDR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
@@ -274,8 +274,7 @@ __maybe_unused static const struct ec_thermal_config thermal_wwan =
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
}, \
}
-__maybe_unused static const struct ec_thermal_config thermal_ddr =
- THERMAL_DDR;
+__maybe_unused static const struct ec_thermal_config thermal_ddr = THERMAL_DDR;
/*
* TODO(b/203839956): update for Alder Lake/vell
@@ -284,8 +283,8 @@ __maybe_unused static const struct ec_thermal_config thermal_ddr =
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_REGULATOR \
- { \
+#define THERMAL_REGULATOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
@@ -299,7 +298,7 @@ __maybe_unused static const struct ec_thermal_config thermal_regulator =
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_SOC] = thermal_cpu,
- [TEMP_SENSOR_2_CHARGER] = thermal_charger,
+ [TEMP_SENSOR_2_CHARGER] = thermal_charger,
[TEMP_SENSOR_3_WWAN] = thermal_wwan,
[TEMP_SENSOR_4_DDR] = thermal_ddr,
[TEMP_SENSOR_5_REGULATOR] = thermal_regulator,
diff --git a/board/vell/thermal.c b/board/vell/thermal.c
index e72b86e3b1..29d438761b 100644
--- a/board/vell/thermal.c
+++ b/board/vell/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,7 +15,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -37,27 +37,27 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {48, 60, 48, 47, -1},
- .off = {99, 99, 99, 99, -1},
- .rpm = {0},
+ .on = { 48, 62, 48, 50, -1 },
+ .off = { 99, 99, 99, 99, -1 },
+ .rpm = { 0 },
},
{
/* level 1 */
- .on = {50, 60, 50, 49, -1},
- .off = {47, 99, 47, 46, -1},
- .rpm = {3600},
+ .on = { 50, 62, 50, 52, -1 },
+ .off = { 47, 99, 47, 49, -1 },
+ .rpm = { 3200 },
},
{
/* level 2 */
- .on = {53, 60, 53, 52, -1},
- .off = {49, 99, 49, 48, -1},
- .rpm = {4100},
+ .on = { 53, 62, 53, 54, -1 },
+ .off = { 49, 99, 49, 51, -1 },
+ .rpm = { 4050 },
},
{
/* level 3 */
- .on = {100, 100, 100, 100, -1},
- .off = {51, 59, 51, 50, -1},
- .rpm = {5500},
+ .on = { 100, 100, 100, 100, -1 },
+ .off = { 51, 60, 51, 52, -1 },
+ .rpm = { 5800 },
},
};
@@ -82,33 +82,31 @@ static int fan_table_to_rpm(int fan, int *temp)
temp[TEMP_SENSOR_4_DDR] < prev_tmp[TEMP_SENSOR_4_DDR]) {
for (i = current_level; i > 0; i--) {
if (temp[TEMP_SENSOR_1_SOC] <
- fan_table[i].off[TEMP_SENSOR_1_SOC] &&
+ fan_table[i].off[TEMP_SENSOR_1_SOC] &&
temp[TEMP_SENSOR_2_CHARGER] <
- fan_table[i].off[TEMP_SENSOR_2_CHARGER] &&
+ fan_table[i].off[TEMP_SENSOR_2_CHARGER] &&
temp[TEMP_SENSOR_3_WWAN] <
- fan_table[i].off[TEMP_SENSOR_3_WWAN] &&
+ fan_table[i].off[TEMP_SENSOR_3_WWAN] &&
temp[TEMP_SENSOR_4_DDR] <
- fan_table[i].off[TEMP_SENSOR_4_DDR])
+ fan_table[i].off[TEMP_SENSOR_4_DDR])
current_level = i - 1;
else
break;
}
} else if (temp[TEMP_SENSOR_1_SOC] > prev_tmp[TEMP_SENSOR_1_SOC] ||
temp[TEMP_SENSOR_2_CHARGER] >
- prev_tmp[TEMP_SENSOR_2_CHARGER] ||
- temp[TEMP_SENSOR_3_WWAN] >
- prev_tmp[TEMP_SENSOR_3_WWAN] ||
- temp[TEMP_SENSOR_4_DDR] >
- prev_tmp[TEMP_SENSOR_4_DDR]) {
+ prev_tmp[TEMP_SENSOR_2_CHARGER] ||
+ temp[TEMP_SENSOR_3_WWAN] > prev_tmp[TEMP_SENSOR_3_WWAN] ||
+ temp[TEMP_SENSOR_4_DDR] > prev_tmp[TEMP_SENSOR_4_DDR]) {
for (i = current_level; i < NUM_FAN_LEVELS; i++) {
if (temp[TEMP_SENSOR_1_SOC] >
- fan_table[i].on[TEMP_SENSOR_1_SOC] ||
+ fan_table[i].on[TEMP_SENSOR_1_SOC] ||
(temp[TEMP_SENSOR_2_CHARGER] >
- fan_table[i].on[TEMP_SENSOR_2_CHARGER] &&
- temp[TEMP_SENSOR_3_WWAN] >
- fan_table[i].on[TEMP_SENSOR_3_WWAN]) ||
+ fan_table[i].on[TEMP_SENSOR_2_CHARGER] &&
+ temp[TEMP_SENSOR_3_WWAN] >
+ fan_table[i].on[TEMP_SENSOR_3_WWAN]) ||
temp[TEMP_SENSOR_4_DDR] >
- fan_table[i].on[TEMP_SENSOR_4_DDR])
+ fan_table[i].on[TEMP_SENSOR_4_DDR])
current_level = i + 1;
else
break;
@@ -129,10 +127,8 @@ static int fan_table_to_rpm(int fan, int *temp)
void board_override_fan_control(int fan, int *tmp)
{
- if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, tmp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp));
}
}
diff --git a/board/vell/usbc_config.c b/board/vell/usbc_config.c
index 6da618b42e..694ce202d1 100644
--- a/board/vell/usbc_config.c
+++ b/board/vell/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -35,8 +35,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -85,21 +85,25 @@ struct ppc_config_t ppc_chips[] = {
[USBC_PORT_C0] = {
.i2c_port = I2C_PORT_USB_C0_C1_PPC,
.i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .frs_en = IOEX_USB_C0_FRS_EN,
.drv = &syv682x_drv,
},
[USBC_PORT_C1] = {
.i2c_port = I2C_PORT_USB_C0_C1_PPC,
.i2c_addr_flags = SYV682X_ADDR1_FLAGS,
+ .frs_en = IOEX_USB_C1_FRS_EN,
.drv = &syv682x_drv,
},
[USBC_PORT_C2] = {
.i2c_port = I2C_PORT_USB_C2_C3_PPC,
.i2c_addr_flags = SYV682X_ADDR2_FLAGS,
+ .frs_en = IOEX_USB_C2_FRS_EN,
.drv = &syv682x_drv,
},
[USBC_PORT_C3] = {
.i2c_port = I2C_PORT_USB_C2_C3_PPC,
.i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .frs_en = IOEX_USB_C3_FRS_EN,
.drv = &syv682x_drv,
},
};
@@ -110,63 +114,84 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
struct ppc_config_t ppc_chips_old_c3 = {
.i2c_port = I2C_PORT_USB_C2_C3_PPC,
.i2c_addr_flags = SYV682X_ADDR3_FLAGS,
+ .frs_en = IOEX_USB_C3_FRS_EN,
.drv = &syv682x_drv,
};
/* USBC mux configuration - Alder Lake includes internal mux */
-static const struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc2_tcss_usb_mux = {
- .usb_port = USBC_PORT_C2,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc2_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-static const struct usb_mux usbc3_tcss_usb_mux = {
- .usb_port = USBC_PORT_C3,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain usbc3_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C3,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc0_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C1_MUX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc1_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
[USBC_PORT_C2] = {
- .usb_port = USBC_PORT_C2,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C2_C3_MUX,
- .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc2_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C2,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C2_C3_MUX,
+ .i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc2_tcss_usb_mux,
},
[USBC_PORT_C3] = {
- .usb_port = USBC_PORT_C3,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C2_C3_MUX,
- .i2c_addr_flags = USBC_PORT_C3_BB_RETIMER_I2C_ADDR,
- .next_mux = &usbc3_tcss_usb_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C3,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_C2_C3_MUX,
+ .i2c_addr_flags = USBC_PORT_C3_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc3_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -253,8 +278,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
diff --git a/board/vell/usbc_config.h b/board/vell/usbc_config.h
index 447c03efb3..694b316ee8 100644
--- a/board/vell/usbc_config.h
+++ b/board/vell/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 4
+#define CONFIG_USB_PD_PORT_MAX_COUNT 4
enum usbc_port {
USBC_PORT_C0 = 0,
diff --git a/board/vilboz/battery.c b/board/vilboz/battery.c
index 6f6bca7662..a119ce38e8 100644
--- a/board/vilboz/battery.c
+++ b/board/vilboz/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -387,9 +387,9 @@ struct chg_curr_step {
};
static const struct chg_curr_step chg_curr_table[] = {
- {.on = 0, .off = 35, .curr_ma = 2800},
- {.on = 36, .off = 35, .curr_ma = 1500},
- {.on = 39, .off = 38, .curr_ma = 1000},
+ { .on = 0, .off = 35, .curr_ma = 2800 },
+ { .on = 36, .off = 35, .curr_ma = 1500 },
+ { .on = 39, .off = 38, .curr_ma = 1000 },
};
/* All charge current tables must have the same number of levels */
diff --git a/board/vilboz/board.c b/board/vilboz/board.c
index 4e0461469d..7c74794d9d 100644
--- a/board/vilboz/board.c
+++ b/board/vilboz/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,7 +11,7 @@
#include "driver/accelgyro_lsm6dsm.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/ioexpander/pcal6408.h"
-#include "driver/ppc/aoz1380.h"
+#include "driver/ppc/aoz1380_public.h"
#include "driver/tcpm/nct38xx.h"
#include "driver/usb_mux/amd_fp5.h"
#include "extpower.h"
@@ -33,8 +33,8 @@
#include "usb_mux.h"
#include "usbc_ppc.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* This I2C moved. Temporarily detect and support the V0 HW. */
int I2C_PORT_BATTERY = I2C_PORT_BATTERY_V1;
@@ -55,17 +55,13 @@ static struct stprivate_data g_lis2dwl_data;
static struct lsm6dsm_data g_lsm6dsm_data = LSM6DSM_DATA;
/* Matrix to rotate accelrator into standard reference frame */
-static const mat33_fp_t base_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
struct motion_sensor_t motion_sensors[] = {
@@ -180,18 +176,23 @@ const struct usb_mux_driver usbc0_sbu_mux_driver = {
* Since FSUSB42UMX is not a i2c device, .i2c_port and
* .i2c_addr_flags are not required here.
*/
-const struct usb_mux usbc0_sbu_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &usbc0_sbu_mux_driver,
+const struct usb_mux_chain usbc0_sbu_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &usbc0_sbu_mux_driver,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_sbu_mux,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_sbu_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -219,8 +220,7 @@ void ppc_interrupt(enum gpio_signal signal)
int board_set_active_charge_port(int port)
{
- int is_valid_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_valid_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (port == CHARGE_PORT_NONE) {
@@ -241,7 +241,6 @@ int board_set_active_charge_port(int port)
return EC_ERROR_INVAL;
}
-
/* Check if the port is sourcing VBUS. */
if (ppc_is_sourcing_vbus(port)) {
CPRINTFUSB("Skip enable C%d", port);
@@ -323,7 +322,6 @@ static void reset_nct38xx_port(int port)
msleep(NCT3807_RESET_POST_DELAY_MS);
}
-
void board_reset_pd_mcu(void)
{
/* Reset TCPC0 */
@@ -367,8 +365,7 @@ int board_pd_set_frs_enable(int port, int enable)
/* Use the TCPC to enable fast switch when FRS included */
if (port == USBC_PORT_C0) {
- rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN,
- !!enable);
+ rv = ioex_set_level(IOEX_USB_C0_TCPC_FASTSW_CTL_EN, !!enable);
}
return rv;
@@ -509,7 +506,7 @@ const int usb_port_enable[USBA_PORT_COUNT] = {
};
__override void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+ int max_ma, int charge_mv)
{
/*
* Limit the input current to 95% negotiated limit,
@@ -517,7 +514,6 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
*/
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/vilboz/board.h b/board/vilboz/board.h
index 91a7d6e868..5160abbc26 100644
--- a/board/vilboz/board.h
+++ b/board/vilboz/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,39 +42,35 @@
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 4
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
/* This I2C moved. Temporarily detect and support the V0 HW. */
extern int I2C_PORT_BATTERY;
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_SMP,
@@ -91,19 +87,11 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_COUNT };
-enum ioex_port {
- IOEX_C0_NCT3807 = 0,
- IOEX_PORT_COUNT
-};
+enum ioex_port { IOEX_C0_NCT3807 = 0, IOEX_PORT_COUNT };
-#define PORT_TO_HPD(port) ((port == 0) \
- ? GPIO_USB3_C0_DP2_HPD \
- : GPIO_DP1_HPD)
+#define PORT_TO_HPD(port) ((port == 0) ? GPIO_USB3_C0_DP2_HPD : GPIO_DP1_HPD)
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -112,16 +100,9 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_A1,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_A1, USBA_PORT_COUNT };
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
diff --git a/board/vilboz/build.mk b/board/vilboz/build.mk
index 1c0cbc4f63..45c71f962c 100644
--- a/board/vilboz/build.mk
+++ b/board/vilboz/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/vilboz/ec.tasklist b/board/vilboz/ec.tasklist
index 08801d1786..864ca42492 100644
--- a/board/vilboz/ec.tasklist
+++ b/board/vilboz/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/vilboz/gpio.inc b/board/vilboz/gpio.inc
index 78baa0eccc..6897f16890 100644
--- a/board/vilboz/gpio.inc
+++ b/board/vilboz/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/vilboz/led.c b/board/vilboz/led.c
index 4e9697ddbb..fa28eb5f40 100644
--- a/board/vilboz/led.c
+++ b/board/vilboz/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,44 +8,49 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_RED, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_GREEN, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_RED, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_RED, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_GREEN, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_RED,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_GREEN,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_RED, 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_RED, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_GREEN,
+ 2 * LED_ONE_SEC } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 3 * LED_ONE_SEC},
- {LED_OFF, 0.5 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF, 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 3 * LED_ONE_SEC },
+ { LED_OFF,
+ 0.5 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_pwr_state_table) == PWR_LED_NUM_STATES);
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED,
- EC_LED_ID_POWER_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED,
+ EC_LED_ID_POWER_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/voema/battery.c b/board/voema/battery.c
index d345cb72ec..dcd45d31fd 100644
--- a/board/voema/battery.c
+++ b/board/voema/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/voema/board.c b/board/voema/board.c
index c5afc2dee7..c4563df105 100644
--- a/board/voema/board.c
+++ b/board/voema/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,7 +42,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
/* Keyboard scan setting */
__override struct keyboard_scan_config keyscan_config = {
@@ -77,8 +77,8 @@ static const struct ec_response_keybd_config voema_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &voema_kb;
}
@@ -89,16 +89,15 @@ __override const struct ec_response_keybd_config
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
/******************************************************************************/
/*
@@ -124,8 +123,8 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -150,8 +149,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -241,8 +240,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -253,16 +251,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -272,7 +270,7 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
ps8815_reset();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
__override void board_cbi_init(void)
@@ -360,26 +358,33 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/voema/board.h b/board/voema/board.h
index b5f8dc4ec8..f10192b0b6 100644
--- a/board/voema/board.h
+++ b/board/voema/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -45,7 +45,7 @@
/* TCS3400 ALS */
#define CONFIG_ALS
-#define ALS_COUNT 1
+#define ALS_COUNT 1
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
@@ -55,36 +55,36 @@
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 65000
-#define PD_MAX_CURRENT_MA 3250
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 65000
+#define PD_MAX_CURRENT_MA 3250
+#define PD_MAX_VOLTAGE_MV 20000
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
#undef CONFIG_SYV682X_HV_ILIM
#define CONFIG_SYV682X_HV_ILIM SYV682X_HV_ILIM_5_50
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
#define CONFIG_USB_PD_FRS_PPC
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#undef CONFIG_USB_PD_TCPM_TUSB422
@@ -98,8 +98,8 @@
#undef CONFIG_FANS
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Retimer */
#undef CONFIG_USBC_RETIMER_INTEL_BB
@@ -111,45 +111,44 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -161,10 +160,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -175,11 +171,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/voema/build.mk b/board/voema/build.mk
index d7d771ebab..7d375fe291 100644
--- a/board/voema/build.mk
+++ b/board/voema/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/voema/ec.tasklist b/board/voema/ec.tasklist
index 3e20d8ae39..c29125d517 100644
--- a/board/voema/ec.tasklist
+++ b/board/voema/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/voema/gpio.inc b/board/voema/gpio.inc
index 7506ccdbd1..e1a931094c 100644
--- a/board/voema/gpio.inc
+++ b/board/voema/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/voema/led.c b/board/voema/led.c
index 25e71c262d..bb808e6d72 100644
--- a/board/voema/led.c
+++ b/board/voema/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/voema/sensors.c b/board/voema/sensors.c
index b55890b074..d532a64148 100644
--- a/board/voema/sensors.c
+++ b/board/voema/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -90,23 +90,17 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
struct motion_sensor_t kx022_lid_accel = {
.name = "Lid Accel",
@@ -256,20 +250,20 @@ struct motion_sensor_t icm_base_accel = {
};
struct motion_sensor_t icm_base_gyro = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_ICM426XX,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &icm426xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_icm426xx_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_icm_ref,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM426XX,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm426xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm426xx_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_icm_ref,
+ .min_frequency = ICM426XX_GYRO_MIN_FREQ,
+ .max_frequency = ICM426XX_GYRO_MAX_FREQ,
};
/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
diff --git a/board/volet/battery.c b/board/volet/battery.c
index 2e4fb7dc71..89769e8364 100644
--- a/board/volet/battery.c
+++ b/board/volet/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/volet/board.c b/board/volet/board.c
index 94bfa447b4..474ec9cb0e 100644
--- a/board/volet/board.c
+++ b/board/volet/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,7 +44,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static const struct ec_response_keybd_config volet_kb = {
.num_top_row_keys = 10,
@@ -80,8 +80,8 @@ static const struct ec_response_keybd_config volet_kb_num = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (!ec_cfg_has_numeric_pad())
return &volet_kb;
@@ -112,16 +112,15 @@ __override struct keyboard_scan_config keyscan_config = {
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
__override uint32_t board_override_feature_flags0(uint32_t flags0)
{
@@ -147,7 +146,7 @@ union volteer_cbi_fw_config fw_config_defaults = {
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -184,8 +183,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
@@ -299,8 +298,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -311,16 +309,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -332,7 +330,7 @@ void board_reset_pd_mcu(void)
*/
ps8815_reset();
usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
/******************************************************************************/
@@ -432,26 +430,33 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/volet/board.h b/board/volet/board.h
index c75eeed31f..c616b1cbe1 100644
--- a/board/volet/board.h
+++ b/board/volet/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,7 +13,7 @@
/* Optional features */
#undef NPCX7_PWM1_SEL
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
/*
* The RAM and flash size combination on the the NPCX797FC does not leave
@@ -47,7 +47,7 @@
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* BMI160 Base accel/gyro */
#define CONFIG_ACCELGYRO_BMI160
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
@@ -57,27 +57,27 @@
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
/* BMA253 Lid accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCEL_BMA255
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
#ifdef BOARD_VOXEL_ECMODEENTRY
@@ -88,11 +88,11 @@
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
#define CONFIG_USB_PD_FRS_PPC
#undef CONFIG_USB_PD_TCPC_RUNTIME_CONFIG
#undef CONFIG_USB_PD_TCPM_TUSB422
@@ -105,8 +105,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/* Retimer */
#undef CONFIG_USBC_RETIMER_INTEL_BB
@@ -118,44 +118,43 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -168,11 +167,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_FAN,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_FAN, PWM_CH_KBLIGHT, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -181,11 +176,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/volet/build.mk b/board/volet/build.mk
index 546bcba8d2..18397fdec3 100644
--- a/board/volet/build.mk
+++ b/board/volet/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/volet/ec.tasklist b/board/volet/ec.tasklist
index ca6d9fbf14..07a91894ed 100644
--- a/board/volet/ec.tasklist
+++ b/board/volet/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/volet/gpio.inc b/board/volet/gpio.inc
index 16471d0817..079c731785 100644
--- a/board/volet/gpio.inc
+++ b/board/volet/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/volet/led.c b/board/volet/led.c
index ba4af36163..dceadd416f 100644
--- a/board/volet/led.c
+++ b/board/volet/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/volet/sensors.c b/board/volet/sensors.c
index fb093729d3..0ea3f4b74a 100644
--- a/board/volet/sensors.c
+++ b/board/volet/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,7 +24,7 @@
#include "tablet_mode.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ##args)
/******************************************************************************/
/* Sensors */
static struct mutex g_lid_accel_mutex;
@@ -39,23 +39,17 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct icm_drv_data_t g_icm426xx_data;
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t kx022_lid_accel = {
.name = "Lid Accel",
@@ -228,8 +222,7 @@ static void board_sensors_init(void)
motion_sensor_count = 0;
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
- gpio_set_flags(GPIO_EC_IMU_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_EC_IMU_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
}
DECLARE_HOOK(HOOK_INIT, board_sensors_init, HOOK_PRIO_DEFAULT);
diff --git a/board/volmar/battery.c b/board/volmar/battery.c
index 3832fd8edf..852ed4b137 100644
--- a/board/volmar/battery.c
+++ b/board/volmar/battery.c
@@ -1,12 +1,16 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
* Battery pack vendor provided charging profile
*/
+#include "battery.h"
#include "battery_fuel_gauge.h"
#include "cbi.h"
+#include "charge_ramp.h"
+#include "charge_state.h"
+#include "charger_profile_override.h"
#include "common.h"
#include "compile_time_macros.h"
#include "gpio.h"
@@ -64,6 +68,37 @@ const struct board_batt_params board_battery_info[] = {
.discharging_max_c = 75,
},
},
+ /* COSMX AP20CBL Battery Information (new firmware ver) */
+ [BATTERY_COSMX_AP20CBL_004] = {
+ .fuel_gauge = {
+ .manuf_name = "COSMX KT0030B004",
+ .device_name = "AP20CBL",
+ .ship_mode = {
+ .reg_addr = 0x3A,
+ .reg_data = { 0xC574, 0xC574 },
+ },
+ .fet = {
+ .mfgacc_support = 1,
+ .reg_addr = 0x0,
+ .reg_mask = 0x2000,
+ .disconnect_val = 0x2000,
+ .cfet_mask = 0x4000,
+ .cfet_off_val = 0x4000,
+ },
+ },
+ .batt_info = {
+ .voltage_max = 13200,
+ .voltage_normal = 11550,
+ .voltage_min = 9000,
+ .precharge_current = 256,
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 50,
+ .charging_min_c = 0,
+ .charging_max_c = 60,
+ .discharging_min_c = -20,
+ .discharging_max_c = 75,
+ },
+ },
/* LGC AP18C8K Battery Information */
[BATTERY_LGC_AP18C8K] = {
.fuel_gauge = {
@@ -131,3 +166,73 @@ enum battery_present battery_hw_present(void)
/* The GPIO is low when the battery is physically present */
return gpio_get_level(GPIO_EC_BATT_PRES_ODL) ? BP_NO : BP_YES;
}
+
+static int charger_should_discharge_on_ac(struct charge_state_data *curr)
+{
+ /* can not discharge on AC without battery */
+ if (curr->batt.is_present != BP_YES)
+ return 0;
+
+ /* Do not discharge when battery disconnect */
+ if (battery_get_disconnect_state() != BATTERY_NOT_DISCONNECTED)
+ return 0;
+
+ /* Do not discharge on AC if the battery is still waking up */
+ if ((curr->batt.flags & BATT_FLAG_BAD_STATUS) ||
+ (!(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ !(curr->batt.status & STATUS_FULLY_CHARGED)))
+ return 0;
+
+ /*
+ * In heavy load (>3A being withdrawn from VSYS) the DCDC of the
+ * charger operates on hybrid mode. This causes a slight voltage
+ * ripple on VSYS that falls in the audible noise frequency (single
+ * digit kHz range). This small ripple generates audible noise in
+ * the output ceramic capacitors (caps on VSYS and any input of
+ * DCDC under VSYS).
+ *
+ * To overcome this issue, force battery discharging when battery
+ * full, So the battery MOS of NVDC charger will turn on always,
+ * it make the Vsys same as Vbat and the noise has been improved.
+ */
+ if (!battery_is_cut_off() &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ return 1;
+
+ return 0;
+}
+
+/*
+ * This can override the smart battery's charging profile. To make a change,
+ * modify one or more of requested_voltage, requested_current, or state.
+ * Leave everything else unchanged.
+ *
+ * Return the next poll period in usec, or zero to use the default (which is
+ * state dependent).
+ */
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int disch_on_ac = charger_should_discharge_on_ac(curr);
+
+ charger_discharge_on_ac(disch_on_ac);
+
+ if (disch_on_ac) {
+ curr->state = ST_DISCHARGE;
+ return 0;
+ }
+
+ return 0;
+}
+
+enum ec_status charger_profile_override_get_param(uint32_t param,
+ uint32_t *value)
+{
+ return EC_RES_INVALID_PARAM;
+}
+
+enum ec_status charger_profile_override_set_param(uint32_t param,
+ uint32_t value)
+{
+ return EC_RES_INVALID_PARAM;
+}
diff --git a/board/volmar/board.c b/board/volmar/board.c
index 8875d49caf..865e1ce5bb 100644
--- a/board/volmar/board.c
+++ b/board/volmar/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,15 +20,14 @@
#include "power.h"
#include "registers.h"
#include "switch.h"
-#include "tablet_mode.h"
#include "throttle_ap.h"
#include "usbc_config.h"
#include "gpio_list.h" /* Must come after other header files. */
/* Console output macros */
-#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_CHARGER, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_CHARGER, format, ##args)
__override void board_cbi_init(void)
{
@@ -53,7 +52,6 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
-
/* keyboard factory test */
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
/*
@@ -62,15 +60,14 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
#endif
diff --git a/board/volmar/board.h b/board/volmar/board.h
index e8b355d4b5..12561dc314 100644
--- a/board/volmar/board.h
+++ b/board/volmar/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,11 +21,16 @@
#define CONFIG_MP2964
+/* Tablet mode is not supported */
+#undef CONFIG_TABLET_MODE
+#undef CONFIG_TABLET_MODE_SWITCH
+#undef CONFIG_LID_ANGLE
+
/* LED */
#define CONFIG_LED_ONOFF_STATES
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USB Type C and USB PD defines */
@@ -46,17 +51,20 @@
#define CONFIG_USBC_PPC_SYV682X
/* TODO: b/177608416 - measure and check these values on brya */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
-#define PD_VCONN_SWAP_DELAY 5000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_VCONN_SWAP_DELAY 5000 /* us */
/*
* Passive USB-C cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
+
+#define CONFIG_CHARGER_PROFILE_OVERRIDE
+#define CONFIG_PWR_STATE_DISCHARGE_FULL
/*
* Macros for GPIO signals used in common code that don't match the
@@ -64,60 +72,60 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT GPIO_EC_EN_EDP_BL
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_GSC_PACKET_MODE
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_L
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SYS_SLP_S0IX_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_TEMP_SENSOR_POWER GPIO_SEQ_EC_DSW_PWROK
/*
* GPIO_EC_PCH_INT_ODL is used for MKBP events as well as a PCH wakeup
* signal.
*/
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
-#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
-#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
-#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
-#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_ODL
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_INT_ODL
+#define GPIO_PG_EC_ALL_SYS_PWRGD GPIO_SEQ_EC_ALL_SYS_PG
+#define GPIO_PG_EC_DSW_PWROK GPIO_SEQ_EC_DSW_PWROK
+#define GPIO_PG_EC_RSMRST_ODL GPIO_SEQ_EC_RSMRST_ODL
+#define GPIO_POWER_BUTTON_L GPIO_GSC_EC_PWR_BTN_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_ODL
/* System has back-lit keyboard */
#define CONFIG_PWM_KBLIGHT
/* I2C Bus Configuration */
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
+#define I2C_PORT_USB_C0_C2_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1_TCPC NPCX_I2C_PORT4_1
-#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_PPC NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C0_C2_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C1_BC12 NPCX_I2C_PORT6_1
-#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
+#define I2C_PORT_USB_C1_MUX NPCX_I2C_PORT6_1
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_CHARGER NPCX_I2C_PORT7_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_MP2964 NPCX_I2C_PORT7_0
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_ADDR_EEPROM_FLAGS 0x50
-#define I2C_ADDR_MP2964_FLAGS 0x20
+#define I2C_ADDR_MP2964_FLAGS 0x20
/* Thermal features */
#define CONFIG_THERMISTOR
@@ -125,15 +133,15 @@
#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
-#define CONFIG_FANS FAN_CH_COUNT
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
-#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
+#undef CONFIG_POWER_BUTTON_INIT_TIMEOUT
#define CONFIG_POWER_BUTTON_INIT_TIMEOUT 2
/* Keyboard */
@@ -142,7 +150,7 @@
#ifndef __ASSEMBLER__
-#include "gpio_signal.h" /* needed by registers.h */
+#include "gpio_signal.h" /* needed by registers.h */
#include "registers.h"
#include "usbc_config.h"
@@ -162,26 +170,21 @@ enum temp_sensor_id {
enum battery_type {
BATTERY_COSMX_AP20CBL,
+ BATTERY_COSMX_AP20CBL_004,
BATTERY_LGC_AP18C8K,
BATTERY_AP19B8M,
BATTERY_TYPE_COUNT
};
enum pwm_channel {
- PWM_CH_KBLIGHT = 0, /* PWM3 */
- PWM_CH_FAN, /* PWM5 */
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
PWM_CH_COUNT
};
-enum fan_channel {
- FAN_CH_0 = 0,
- FAN_CH_COUNT
-};
+enum fan_channel { FAN_CH_0 = 0, FAN_CH_COUNT };
-enum mft_channel {
- MFT_CH_0 = 0,
- MFT_CH_COUNT
-};
+enum mft_channel { MFT_CH_0 = 0, MFT_CH_COUNT };
#ifdef CONFIG_KEYBOARD_FACTORY_TEST
extern const int keyboard_factory_scan_pins[][2];
diff --git a/board/volmar/build.mk b/board/volmar/build.mk
index 82ffaa9fe2..ed25f9c9aa 100644
--- a/board/volmar/build.mk
+++ b/board/volmar/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2022 The Chromium OS Authors. All rights reserved.
+# Copyright 2022 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/volmar/charger.c b/board/volmar/charger.c
index 85e0de90fe..88f5b85a41 100644
--- a/board/volmar/charger.c
+++ b/board/volmar/charger.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -15,9 +15,8 @@
#include "usb_pd.h"
#include "util.h"
-
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Charger Chip Configuration */
const struct charger_config_t chg_chips[] = {
@@ -84,7 +83,6 @@ int board_set_active_charge_port(int port)
__overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
diff --git a/board/volmar/ec.tasklist b/board/volmar/ec.tasklist
index b6470bf76b..70b64bc757 100644
--- a/board/volmar/ec.tasklist
+++ b/board/volmar/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/volmar/fans.c b/board/volmar/fans.c
index 4fb92f2cf4..404e6f60df 100644
--- a/board/volmar/fans.c
+++ b/board/volmar/fans.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
static const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -38,9 +38,9 @@ static const struct fan_conf fan_conf_0 = {
* boards as well.
*/
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 0,
- .rpm_start = 5000,
- .rpm_max = 6500,
+ .rpm_min = 3000,
+ .rpm_start = 3000,
+ .rpm_max = 6000,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/volmar/fw_config.c b/board/volmar/fw_config.c
index da56362496..5c62ed17b8 100644
--- a/board/volmar/fw_config.c
+++ b/board/volmar/fw_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
#include "cros_board_info.h"
#include "fw_config.h"
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static union volmar_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/volmar/fw_config.h b/board/volmar/fw_config.h
index ba8c807a66..4dddec9273 100644
--- a/board/volmar/fw_config.h
+++ b/board/volmar/fw_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,12 +27,12 @@ enum ec_cfg_keyboard_backlight_type {
union volmar_cbi_fw_config {
struct {
- enum ec_cfg_usb_db_type usb_db : 4;
- enum ec_cfg_keyboard_backlight_type kb_bl : 1;
- uint32_t audio : 3;
- uint32_t boot_nvme_mask : 1;
- uint32_t boot_emmc_mask : 1;
- uint32_t reserved_1 : 22;
+ enum ec_cfg_usb_db_type usb_db : 4;
+ enum ec_cfg_keyboard_backlight_type kb_bl : 1;
+ uint32_t audio : 3;
+ uint32_t boot_nvme_mask : 1;
+ uint32_t boot_emmc_mask : 1;
+ uint32_t reserved_1 : 22;
};
uint32_t raw_value;
};
diff --git a/board/volmar/gpio.inc b/board/volmar/gpio.inc
index ac5be5fb17..b1d4e8c3dc 100644
--- a/board/volmar/gpio.inc
+++ b/board/volmar/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,7 +21,6 @@ GPIO_INT(SEQ_EC_RSMRST_ODL, PIN(E, 2), GPIO_INT_BOTH, power_signal_
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(SLP_SUS_L, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(SYS_SLP_S0IX_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-GPIO_INT(TABLET_MODE_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)
GPIO_INT(USB_C0_BC12_INT_ODL, PIN(C, 6), GPIO_INT_FALLING, bc12_interrupt)
GPIO_INT(USB_C0_C2_TCPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
@@ -124,6 +123,7 @@ UNUSED(PIN(5, 6)) /* GPIO56 */
UNUSED(PIN(B, 1)) /* GPIOB1 */
UNUSED(PIN(D, 0)) /* GPIOD0/I2C3_SDA0 */
UNUSED(PIN(D, 1)) /* GPIOD1/I2C3_SCL0 */
+UNUSED(PIN(9, 5)) /* GPIO95 */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/volmar/i2c.c b/board/volmar/i2c.c
index 890a578788..29dd2904c1 100644
--- a/board/volmar/i2c.c
+++ b/board/volmar/i2c.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,7 +8,7 @@
#include "hooks.h"
#include "i2c.h"
-#define BOARD_ID_FAST_PLUS_CAPABLE 2
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
diff --git a/board/volmar/keyboard.c b/board/volmar/keyboard.c
index 598e187d00..16857b53c9 100644
--- a/board/volmar/keyboard.c
+++ b/board/volmar/keyboard.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,8 +40,8 @@ static const struct ec_response_keybd_config volmar_kb = {
},
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &volmar_kb;
}
diff --git a/board/volmar/led.c b/board/volmar/led.c
index 7634437b0d..6c8c20299b 100644
--- a/board/volmar/led.c
+++ b/board/volmar/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
* Power and battery LED control for volmar
@@ -21,23 +21,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/volmar/pwm.c b/board/volmar/pwm.c
index 47986f1ec8..ad4093ed0e 100644
--- a/board/volmar/pwm.c
+++ b/board/volmar/pwm.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/volmar/sensors.c b/board/volmar/sensors.c
index 720771c360..f03469cef4 100644
--- a/board/volmar/sensors.c
+++ b/board/volmar/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -70,17 +70,17 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
}, \
.temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
}, \
- .temp_fan_off = C_TO_K(25), \
- .temp_fan_max = C_TO_K(50), \
+ .temp_fan_off = C_TO_K(30), \
+ .temp_fan_max = C_TO_K(84), \
}
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
@@ -100,17 +100,17 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_FAN \
- { \
+#define THERMAL_FAN \
+ { \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(85), \
+ [EC_TEMP_THRESH_HIGH] = 0, \
+ [EC_TEMP_THRESH_HALT] = 0, \
}, \
.temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
+ [EC_TEMP_THRESH_HIGH] = 0, \
}, \
- .temp_fan_off = C_TO_K(25), \
- .temp_fan_max = C_TO_K(50), \
+ .temp_fan_off = 0, \
+ .temp_fan_max = 0, \
}
__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
@@ -128,25 +128,25 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CHARGER \
- { \
+#define THERMAL_CHARGER \
+ { \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(85), \
+ [EC_TEMP_THRESH_HIGH] = 0, \
+ [EC_TEMP_THRESH_HALT] = 0, \
}, \
.temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(65), \
+ [EC_TEMP_THRESH_HIGH] = 0, \
}, \
- .temp_fan_off = C_TO_K(25), \
- .temp_fan_max = C_TO_K(50), \
+ .temp_fan_off = 0, \
+ .temp_fan_max = 0, \
}
__maybe_unused static const struct ec_thermal_config thermal_charger =
- THERMAL_CHARGER;
+ THERMAL_CHARGER;
/* this should really be "const" */
struct ec_thermal_config thermal_params[] = {
[TEMP_SENSOR_1_DDR_SOC] = THERMAL_CPU,
[TEMP_SENSOR_2_FAN] = THERMAL_FAN,
- [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
+ [TEMP_SENSOR_3_CHARGER] = THERMAL_CHARGER,
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/volmar/usbc_config.c b/board/volmar/usbc_config.c
index 5f70a16c21..6a6c5c709f 100644
--- a/board/volmar/usbc_config.c
+++ b/board/volmar/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -34,8 +34,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
/* USBC TCPC configuration */
const struct tcpc_config_t tcpc_config[] = {
@@ -97,24 +97,31 @@ unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
* to the virtual_usb_mux_driver so the AP gets notified of mux changes
* and updates the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
};
-const struct usb_mux usb_muxes[] = {
+const struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- /* PS8815 DB */
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+ .mux = &(const struct usb_mux) {
+ /* PS8815 DB */
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -156,8 +163,8 @@ int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
}
if (voltage < BC12_MIN_VOLTAGE) {
- CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
- port, voltage, BC12_MIN_VOLTAGE);
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__, port,
+ voltage, BC12_MIN_VOLTAGE);
return 1;
}
@@ -177,7 +184,6 @@ void config_usb_db_type(void)
CPRINTS("Configured USB DB type number is %d", db_type);
}
-
void board_reset_pd_mcu(void)
{
/*
diff --git a/board/volmar/usbc_config.h b/board/volmar/usbc_config.h
index 69300a9354..0722d00d6b 100644
--- a/board/volmar/usbc_config.h
+++ b/board/volmar/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2022 The Chromium OS Authors. All rights reserved.
+/* Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,13 +8,9 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void config_usb_db_type(void);
diff --git a/board/volteer/battery.c b/board/volteer/battery.c
index 1c24e1ec24..31cb7faaf9 100644
--- a/board/volteer/battery.c
+++ b/board/volteer/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/volteer/board.c b/board/volteer/board.c
index 0e7a1d21e0..ecf3e12e5e 100644
--- a/board/volteer/board.c
+++ b/board/volteer/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -64,7 +64,7 @@ __override struct keyboard_scan_config keyscan_config = {
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -100,8 +100,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
@@ -128,8 +128,8 @@ __maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_INDUCTOR \
- { \
+#define THERMAL_INDUCTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
diff --git a/board/volteer/board.h b/board/volteer/board.h
index 936bc9ddc5..bf46543e90 100644
--- a/board/volteer/board.h
+++ b/board/volteer/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -23,7 +23,7 @@
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */
/* Remove PRL state names to free flash space */
-#define CONFIG_USB_PD_DEBUG_LEVEL 1
+#define CONFIG_USB_PD_DEBUG_LEVEL 0
#define CONFIG_VBOOT_EFS2
@@ -54,51 +54,53 @@
/* TCS3400 ALS */
#define CONFIG_ALS
-#define ALS_COUNT 1
+#define ALS_COUNT 1
#define CONFIG_ALS_TCS3400
#define CONFIG_ALS_TCS3400_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
/* Sensors without hardware FIFO are in forced mode */
-#define CONFIG_ACCEL_FORCE_MODE_MASK \
- (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
+#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
/* TODO: b/144165680 - measure and check these values on Volteer */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 60000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
/* Enabling Thunderbolt-compatible mode */
#define CONFIG_USB_PD_TBT_COMPAT_MODE
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x40
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
+#define CONFIG_USBC_PPC_SN5S330 /* USBC port C0 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C1 */
#define CONFIG_USB_PD_FRS_PPC
+/* Disable PPC logging to reduce EC image size */
+#undef CONFIG_USBC_PPC_LOGGING
+
/* BC 1.2 */
/* Volume Button feature */
@@ -106,8 +108,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -115,42 +117,42 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
#define CONFIG_DEBUG_ASSERT_BRIEF
@@ -163,7 +165,11 @@
#undef CONFIG_CMD_CBI
#undef CONFIG_CMD_CHARGER
#undef CONFIG_CMD_CHARGE_SUPPLIER_INFO
+#undef CONFIG_CMD_CRASH
+#undef CONFIG_CMD_DEVICE_EVENT
+#undef CONFIG_CMD_FLASH_WP
#undef CONFIG_CMD_HASH
+#undef CONFIG_CMD_I2C_XFER
#undef CONFIG_CMD_IDLE_STATS
#undef CONFIG_CMD_INA
#undef CONFIG_CMD_MFALLOW
@@ -173,6 +179,7 @@
#undef CONFIG_CMD_REGULATOR
#undef CONFIG_CMD_USB_PD_CABLE
#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CONSOLE_HISTORY
/* Disable volume button in ectool */
#undef CONFIG_HOSTCMD_BUTTON
diff --git a/board/volteer/build.mk b/board/volteer/build.mk
index 5adcffff56..fc7828e29b 100644
--- a/board/volteer/build.mk
+++ b/board/volteer/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/volteer/cbi.c b/board/volteer/cbi.c
index b39f0d7d2f..46c7dae7bf 100644
--- a/board/volteer/cbi.c
+++ b/board/volteer/cbi.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/volteer/ec.tasklist b/board/volteer/ec.tasklist
index d94a4445b9..0492fcc3c0 100644
--- a/board/volteer/ec.tasklist
+++ b/board/volteer/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/volteer/gpio.inc b/board/volteer/gpio.inc
index 45aa5b28c4..04982595fe 100644
--- a/board/volteer/gpio.inc
+++ b/board/volteer/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/volteer/led.c b/board/volteer/led.c
index 52a6b9d890..adc8f7b4a6 100644
--- a/board/volteer/led.c
+++ b/board/volteer/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,16 +19,16 @@ const enum ec_led_id supported_led_ids[] = {
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 100, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 100, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
/* The green LED seems to be brighter than the others, so turn down
* green from its natural level for these secondary colors.
*/
- [EC_LED_COLOR_YELLOW] = { 100, 70, 0 },
- [EC_LED_COLOR_WHITE] = { 100, 70, 100 },
- [EC_LED_COLOR_AMBER] = { 100, 20, 0 },
+ [EC_LED_COLOR_YELLOW] = { 100, 70, 0 },
+ [EC_LED_COLOR_WHITE] = { 100, 70, 100 },
+ [EC_LED_COLOR_AMBER] = { 100, 20, 0 },
};
struct pwm_led pwm_leds[] = {
diff --git a/board/volteer/sensors.c b/board/volteer/sensors.c
index c3e42cbf05..b6ed795777 100644
--- a/board/volteer/sensors.c
+++ b/board/volteer/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -84,17 +84,13 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
diff --git a/board/volteer/usbc_config.c b/board/volteer/usbc_config.c
index 748e1e9599..f5e21cb9f4 100644
--- a/board/volteer/usbc_config.c
+++ b/board/volteer/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,24 +41,33 @@ static const struct tcpc_config_t tcpc_config_p1_usb3 = {
* virtual_usb_mux_driver so the AP gets notified of mux changes and updates
* the TCSS configuration on state changes.
*/
-static const struct usb_mux usbc1_usb3_db_retimer = {
- .usb_port = USBC_PORT_C1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
- .next_mux = NULL,
+static const struct usb_mux_chain usbc1_usb3_db_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
+ .next = NULL,
};
-static const struct usb_mux mux_config_p1_usb3_active = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
- .next_mux = &usbc1_usb3_db_retimer,
+static const struct usb_mux_chain mux_config_p1_usb3_active = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
+ .next = &usbc1_usb3_db_retimer,
};
-static const struct usb_mux mux_config_p1_usb3_passive = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+static const struct usb_mux_chain mux_config_p1_usb3_passive = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ }
};
/*
@@ -208,25 +217,32 @@ const int usb_port_enable[USB_PORT_COUNT] = {
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ }
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .next_mux = &usbc1_tcss_usb_mux,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -279,8 +295,8 @@ __override bool board_is_tbt_usb4_port(int port)
* TODO (b/147732807): All the USB-C ports need to support same
* features. Need to fix once USB-C feature set is known for Volteer.
*/
- return ((port == USBC_PORT_C1)
- && ((usb_db == DB_USB4_GEN2) || (usb_db == DB_USB4_GEN3)));
+ return ((port == USBC_PORT_C1) &&
+ ((usb_db == DB_USB4_GEN2) || (usb_db == DB_USB4_GEN3)));
}
static void ps8815_reset(void)
@@ -288,8 +304,7 @@ static void ps8815_reset(void)
int val;
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 0);
- msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS,
- PS8815_PWR_H_RST_H_DELAY_MS));
+ msleep(GENERIC_MAX(PS8XXX_RESET_DELAY_MS, PS8815_PWR_H_RST_H_DELAY_MS));
gpio_set_level(GPIO_USB_C1_RT_RST_ODL, 1);
msleep(PS8815_FW_INIT_DELAY_MS);
@@ -300,16 +315,16 @@ static void ps8815_reset(void)
CPRINTS("%s: patching ps8815 registers", __func__);
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f was %02x", val);
- if (i2c_write8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ if (i2c_write8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f,
+ 0x31) == EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f set to 0x31");
- if (i2c_read8(I2C_PORT_USB_C1,
- PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ if (i2c_read8(I2C_PORT_USB_C1, PS8XXX_I2C_ADDR1_P2_FLAGS, 0x0f, &val) ==
+ EC_SUCCESS)
CPRINTS("ps8815: reg 0x0f now %02x", val);
}
@@ -321,8 +336,9 @@ void board_reset_pd_mcu(void)
/* Daughterboard specific reset for port 1 */
if (usb_db == DB_USB3_ACTIVE) {
ps8815_reset();
- usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ usb_mux_hpd_update(USBC_PORT_C1,
+ USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
}
diff --git a/board/volteer/usbc_config.h b/board/volteer/usbc_config.h
index 55dfce7621..7428d0c436 100644
--- a/board/volteer/usbc_config.h
+++ b/board/volteer/usbc_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -8,11 +8,7 @@
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
/* Configure the USB3 daughterboard type */
void config_usb3_db_type(void);
diff --git a/board/volteer_ish/board.c b/board/volteer_ish/board.c
index 76c127056b..1f209dfb4d 100644
--- a/board/volteer_ish/board.c
+++ b/board/volteer_ish/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,11 +20,7 @@
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 1000
- },
+ { .name = "sensor", .port = I2C_PORT_SENSOR, .kbps = 1000 },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/volteer_ish/board.h b/board/volteer_ish/board.h
index 2e2b7e7276..6f7d3bd1b7 100644
--- a/board/volteer_ish/board.h
+++ b/board/volteer_ish/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,7 +22,7 @@
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
/* ISH specific */
-#undef CONFIG_DEBUG_ASSERT
+#undef CONFIG_DEBUG_ASSERT
#define CONFIG_CLOCK_CRYSTAL
#define CONFIG_ISH_UART_0
/* EC */
@@ -40,7 +40,6 @@
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HECI
-
/* Enable sensor fifo, must also define the _SIZE and _THRES */
#define CONFIG_ACCEL_FIFO
/* FIFO size is in power of 2. */
@@ -87,10 +86,7 @@
#include "registers.h"
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, SENSOR_COUNT };
#endif /* !__ASSEMBLER__ */
diff --git a/board/volteer_ish/build.mk b/board/volteer_ish/build.mk
index 74ec3c865f..4a84a1f475 100644
--- a/board/volteer_ish/build.mk
+++ b/board/volteer_ish/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2019 The Chromium OS Authors. All rights reserved.
+# Copyright 2019 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/volteer_ish/ec.tasklist b/board/volteer_ish/ec.tasklist
index a4db486e9a..de7d256324 100644
--- a/board/volteer_ish/ec.tasklist
+++ b/board/volteer_ish/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2019 The Chromium OS Authors. All rights reserved.
+/* Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/volteer_ish/gpio.inc b/board/volteer_ish/gpio.inc
index 286309e388..8b25af63cb 100644
--- a/board/volteer_ish/gpio.inc
+++ b/board/volteer_ish/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2019 The Chromium OS Authors. All rights reserved.
+ * Copyright 2019 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/voxel/battery.c b/board/voxel/battery.c
index 4f51b79ad9..887ba27344 100644
--- a/board/voxel/battery.c
+++ b/board/voxel/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/voxel/board.c b/board/voxel/board.c
index c57d03b9d3..40dfbe8dc4 100644
--- a/board/voxel/board.c
+++ b/board/voxel/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -44,7 +44,7 @@
#include "gpio_list.h" /* Must come after other header files. */
-#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ##args)
static const struct ec_response_keybd_config zbu_new_kb = {
.num_top_row_keys = 10,
@@ -80,8 +80,8 @@ static const struct ec_response_keybd_config zbu_old_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override
-const struct ec_response_keybd_config *board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
if (get_board_id() > 2)
return &zbu_new_kb;
@@ -111,16 +111,15 @@ __override struct keyboard_scan_config keyscan_config = {
* that we don't have pin 0.
*/
const int keyboard_factory_scan_pins[][2] = {
- {-1, -1}, {0, 5}, {1, 1}, {1, 0}, {0, 6},
- {0, 7}, {-1, -1}, {-1, -1}, {1, 4}, {1, 3},
- {-1, -1}, {1, 6}, {1, 7}, {3, 1}, {2, 0},
- {1, 5}, {2, 6}, {2, 7}, {2, 1}, {2, 4},
- {2, 5}, {1, 2}, {2, 3}, {2, 2}, {3, 0},
- {-1, -1}, {0, 4}, {-1, -1}, {8, 2}, {-1, -1},
- {-1, -1},
+ { -1, -1 }, { 0, 5 }, { 1, 1 }, { 1, 0 }, { 0, 6 }, { 0, 7 },
+ { -1, -1 }, { -1, -1 }, { 1, 4 }, { 1, 3 }, { -1, -1 }, { 1, 6 },
+ { 1, 7 }, { 3, 1 }, { 2, 0 }, { 1, 5 }, { 2, 6 }, { 2, 7 },
+ { 2, 1 }, { 2, 4 }, { 2, 5 }, { 1, 2 }, { 2, 3 }, { 2, 2 },
+ { 3, 0 }, { -1, -1 }, { 0, 4 }, { -1, -1 }, { 8, 2 }, { -1, -1 },
+ { -1, -1 },
};
const int keyboard_factory_scan_pins_used =
- ARRAY_SIZE(keyboard_factory_scan_pins);
+ ARRAY_SIZE(keyboard_factory_scan_pins);
__override uint32_t board_override_feature_flags0(uint32_t flags0)
{
@@ -146,7 +145,7 @@ union volteer_cbi_fw_config fw_config_defaults = {
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = GPIO_EN_PP5000_FAN,
};
@@ -183,8 +182,8 @@ const struct fan_t fans[FAN_CH_COUNT] = {
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(85), \
@@ -314,12 +313,12 @@ static void setup_board_tcpc(void)
if (board_id == 0) {
/* config typec C0 prot TUSB422 TCPC */
- tcpc_config[USBC_PORT_C0].i2c_info.addr_flags
- = TUSB422_I2C_ADDR_FLAGS;
+ tcpc_config[USBC_PORT_C0].i2c_info.addr_flags =
+ TUSB422_I2C_ADDR_FLAGS;
tcpc_config[USBC_PORT_C0].drv = &tusb422_tcpm_drv;
/* config typec C1 prot TUSB422 TCPC */
- tcpc_config[USBC_PORT_C1].i2c_info.addr_flags
- = TUSB422_I2C_ADDR_FLAGS;
+ tcpc_config[USBC_PORT_C1].i2c_info.addr_flags =
+ TUSB422_I2C_ADDR_FLAGS;
tcpc_config[USBC_PORT_C1].drv = &tusb422_tcpm_drv;
}
}
@@ -429,33 +428,43 @@ BUILD_ASSERT(CONFIG_USB_PD_PORT_MAX_COUNT == USBC_PORT_COUNT);
/******************************************************************************/
/* USBC mux configuration - Tiger Lake includes internal mux */
-struct usb_mux usbc0_tcss_usb_mux = {
- .usb_port = USBC_PORT_C0,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc0_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usbc1_tcss_usb_mux = {
- .usb_port = USBC_PORT_C1,
- .driver = &virtual_usb_mux_driver,
- .hpd_update = &virtual_hpd_update,
+struct usb_mux_chain usbc1_tcss_usb_mux = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .next_mux = &usbc0_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_0_MIX,
- .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_0_MIX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc0_tcss_usb_mux,
},
[USBC_PORT_C1] = {
- .usb_port = USBC_PORT_C1,
- .next_mux = &usbc1_tcss_usb_mux,
- .driver = &bb_usb_retimer,
- .hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_1_MIX,
- .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C1,
+ .driver = &bb_usb_retimer,
+ .hpd_update = bb_retimer_hpd_update,
+ .i2c_port = I2C_PORT_USB_1_MIX,
+ .i2c_addr_flags = USBC_PORT_C1_BB_RETIMER_I2C_ADDR,
+ },
+ .next = &usbc1_tcss_usb_mux,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
diff --git a/board/voxel/board.h b/board/voxel/board.h
index 7d7109330c..1b866a5749 100644
--- a/board/voxel/board.h
+++ b/board/voxel/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,7 +13,7 @@
/* Optional features */
#undef NPCX7_PWM1_SEL
-#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
+#define NPCX7_PWM1_SEL 0 /* GPIO C2 is not used as PWM1. */
/*
* The RAM and flash size combination on the the NPCX797FC does not leave
@@ -47,8 +47,8 @@
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* BMI160 Base accel/gyro */
#define CONFIG_ACCELGYRO_BMI160
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
-#define CONFIG_ACCELGYRO_ICM42607 /* Base accel second source*/
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_ACCELGYRO_ICM42607 /* Base accel second source*/
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
@@ -60,27 +60,27 @@
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
/* BMA253 Lid accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCEL_BMA255
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
/* USB Type C and USB PD defines */
-#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 30000 /* us */
/*
* SN5S30 PPC supports up to 24V VBUS source and sink, however passive USB-C
* cables only support up to 60W.
*/
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_MAX_CURRENT_MA 3000
-#define PD_MAX_VOLTAGE_MV 20000
+#define PD_OPERATING_POWER_MW 15000
+#define PD_MAX_POWER_MW 45000
+#define PD_MAX_CURRENT_MA 3000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_USB_PD_REQUIRE_AP_MODE_ENTRY
#ifdef BOARD_VOXEL_ECMODEENTRY
@@ -92,16 +92,16 @@
/* Enabling USB4 mode */
#define CONFIG_USB_PD_USB4
-#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
-#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
+#define USBC_PORT_C0_BB_RETIMER_I2C_ADDR 0x40
+#define USBC_PORT_C1_BB_RETIMER_I2C_ADDR 0x41
#define CONFIG_USB_PD_DATA_RESET_MSG
/* USB Type A Features */
-#define USB_PORT_COUNT 1
+#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
/* USBC PPC*/
-#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
+#define CONFIG_USBC_PPC_SYV682X /* USBC port C0/C1 */
#define CONFIG_USB_PD_FRS_PPC
/* BC 1.2 */
@@ -114,8 +114,8 @@
/* Fan features */
/* charger defines */
-#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
/*
* Macros for GPIO signals used in common code that don't match the
@@ -123,46 +123,45 @@
* then redefined here to so it's more clear which signal is being used for
* which purpose.
*/
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
-#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
-#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
-#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
-#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
-#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
-#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
-#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
-#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
-#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
-#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
-#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_EC_INT_L GPIO_EC_PCH_INT_ODL
+#define GPIO_EN_PP5000 GPIO_EN_PP5000_A
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_LID_OPEN GPIO_EC_LID_OPEN
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define GPIO_PCH_WAKE_L GPIO_EC_PCH_WAKE_ODL
+#define GPIO_PCH_PWRBTN_L GPIO_EC_PCH_PWR_BTN_ODL
+#define GPIO_PCH_RSMRST_L GPIO_EC_PCH_RSMRST_ODL
+#define GPIO_PCH_RTCRST GPIO_EC_PCH_RTCRST
+#define GPIO_PCH_SLP_S0_L GPIO_SLP_S0_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_DSW_PWROK GPIO_EC_PCH_DSW_PWROK
+#define GPIO_POWER_BUTTON_L GPIO_H1_EC_PWR_BTN_ODL
+#define GPIO_CPU_PROCHOT GPIO_EC_PROCHOT_ODL
+#define GPIO_SYS_RESET_L GPIO_SYS_RST_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_USB_C1_BC12_INT_ODL GPIO_USB_C1_MIX_INT_ODL
+#define GPIO_VOLUME_UP_L GPIO_EC_VOLUP_BTN_ODL
+#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* I2C Bus Configuration */
#define CONFIG_I2C
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
-#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
-#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
-#define I2C_PORT_POWER NPCX_I2C_PORT5_0
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-
-#define I2C_PORT_BATTERY I2C_PORT_POWER
-#define I2C_PORT_CHARGER I2C_PORT_EEPROM
-
-#define I2C_ADDR_EEPROM_FLAGS 0x50
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C1 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_0_MIX NPCX_I2C_PORT3_0
+#define I2C_PORT_USB_1_MIX NPCX_I2C_PORT4_1
+#define I2C_PORT_POWER NPCX_I2C_PORT5_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+
+#define I2C_PORT_BATTERY I2C_PORT_POWER
+#define I2C_PORT_CHARGER I2C_PORT_EEPROM
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50
#define CONFIG_I2C_CONTROLLER
-
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -175,11 +174,7 @@ enum battery_type {
BATTERY_TYPE_COUNT,
};
-enum pwm_channel {
- PWM_CH_FAN,
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_FAN, PWM_CH_KBLIGHT, PWM_CH_COUNT };
enum sensor_id {
LID_ACCEL = 0,
@@ -188,11 +183,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum usbc_port {
- USBC_PORT_C0 = 0,
- USBC_PORT_C1,
- USBC_PORT_COUNT
-};
+enum usbc_port { USBC_PORT_C0 = 0, USBC_PORT_C1, USBC_PORT_COUNT };
void board_reset_pd_mcu(void);
diff --git a/board/voxel/build.mk b/board/voxel/build.mk
index 838d6a16ce..c994631759 100644
--- a/board/voxel/build.mk
+++ b/board/voxel/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/voxel/ec.tasklist b/board/voxel/ec.tasklist
index 174a47eea3..ebcf47c499 100644
--- a/board/voxel/ec.tasklist
+++ b/board/voxel/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/voxel/gpio.inc b/board/voxel/gpio.inc
index 3b0c04d21d..171288a639 100644
--- a/board/voxel/gpio.inc
+++ b/board/voxel/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@ GPIO_INT(ACOK_OD, PIN(0, 0), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH, ex
/* Power sequencing interrupts */
GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI_VW_SLP_S3
+#ifndef CONFIG_HOST_INTERFACE_ESPI_VW_SLP_S3
GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, power_signal_interrupt)
#endif
GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/voxel/led.c b/board/voxel/led.c
index 4be69689f7..5b15c9620f 100644
--- a/board/voxel/led.c
+++ b/board/voxel/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/voxel/sensors.c b/board/voxel/sensors.c
index ac444ad840..c3c074da9d 100644
--- a/board/voxel/sensors.c
+++ b/board/voxel/sensors.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -25,7 +25,7 @@
#include "tablet_mode.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_MOTION_SENSE, format, ##args)
/******************************************************************************/
/* Sensors */
static struct mutex g_lid_accel_mutex;
@@ -40,23 +40,17 @@ static struct bmi_drv_data_t g_bmi160_data;
static struct icm_drv_data_t g_icm426xx_data;
/* Rotation matrix for the lid accelerometer */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t kx022_lid_accel = {
.name = "Lid Accel",
@@ -283,8 +277,7 @@ static void board_sensors_init(void)
motion_sensor_count = 0;
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
- gpio_set_flags(GPIO_EC_IMU_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_EC_IMU_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
}
}
DECLARE_HOOK(HOOK_INIT, board_sensors_init, HOOK_PRIO_DEFAULT);
diff --git a/board/waddledee/battery.c b/board/waddledee/battery.c
index 8f1ccc1ade..37b2dd2e3d 100644
--- a/board/waddledee/battery.c
+++ b/board/waddledee/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/waddledee/board.c b/board/waddledee/board.c
index 90d1f7f2bd..d7abda740c 100644
--- a/board/waddledee/board.c
+++ b/board/waddledee/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,7 +40,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -127,34 +127,26 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -204,27 +196,36 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Retimer */
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
- .driver = &tusb544_drv,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
+ .driver = &tusb544_drv,
+ },
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
- .driver = &anx7447_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
+ .driver = &anx7447_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
},
};
@@ -239,7 +240,6 @@ void board_init(void)
c1_int_line = GPIO_USB_C1_INT_V1_ODL;
}
-
gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
gpio_enable_interrupt(c1_int_line);
@@ -403,9 +403,8 @@ void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
gpio_set_level(GPIO_EN_USB_C0_CC2_VCONN, !!enabled);
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 3;
*kp_div = 14;
@@ -463,7 +462,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Sensor Data */
-static struct kionix_accel_data g_kx022_data;
+static struct kionix_accel_data g_kx022_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
/* Drivers */
@@ -543,14 +542,14 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/waddledee/board.h b/board/waddledee/board.h
index 9cdfcc1e06..1ac3fc76da 100644
--- a/board/waddledee/board.h
+++ b/board/waddledee/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -24,13 +24,16 @@
#define CONFIG_BC12_DETECT_PI3USB9201
/* Charger */
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#define CONFIG_OCPC
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 21 /* R_DS(on) 10.7mOhm + 10mOhm sns rstr \
+ */
/*
* GPIO for C1 interrupts, for baseboard use
@@ -47,8 +50,8 @@
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
@@ -71,8 +74,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: ANX TCPC + Mux */
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: ANX TCPC + Mux */
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
/* Thermistors */
@@ -81,10 +84,10 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
-#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
+#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
#ifndef __ASSEMBLER__
@@ -106,27 +109,18 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/waddledee/build.mk b/board/waddledee/build.mk
index 806168ea0d..9b862c7624 100644
--- a/board/waddledee/build.mk
+++ b/board/waddledee/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/waddledee/cbi_ssfc.c b/board/waddledee/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/waddledee/cbi_ssfc.c
+++ b/board/waddledee/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/waddledee/cbi_ssfc.h b/board/waddledee/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/waddledee/cbi_ssfc.h
+++ b/board/waddledee/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/waddledee/ec.tasklist b/board/waddledee/ec.tasklist
index 2edf48ee05..c3c360febb 100644
--- a/board/waddledee/ec.tasklist
+++ b/board/waddledee/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/waddledee/gpio.inc b/board/waddledee/gpio.inc
index 63e0055199..b0c8d8cd03 100644
--- a/board/waddledee/gpio.inc
+++ b/board/waddledee/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/waddledee/led.c b/board/waddledee/led.c
index 058d23d761..1a2bc16898 100644
--- a/board/waddledee/led.c
+++ b/board/waddledee/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,13 +20,13 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* Board has one physical LED with red, green, and blue
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 100, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 50, 50, 0 },
- [EC_LED_COLOR_WHITE] = { 50, 50, 50 },
- [EC_LED_COLOR_AMBER] = { 70, 30, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 100, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ [EC_LED_COLOR_YELLOW] = { 50, 50, 0 },
+ [EC_LED_COLOR_WHITE] = { 50, 50, 50 },
+ [EC_LED_COLOR_AMBER] = { 70, 30, 0 },
};
/* One logical LED with red, green, and blue channels. */
diff --git a/board/waddledee/usb_pd_policy.c b/board/waddledee/usb_pd_policy.c
index 7046e25d6c..2433b25431 100644
--- a/board/waddledee/usb_pd_policy.c
+++ b/board/waddledee/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
@@ -65,18 +65,7 @@ int pd_set_power_supply_ready(int port)
__override bool pd_check_vbus_level(int port, enum vbus_level level)
{
- int vbus_voltage;
-
- /* If we're unable to speak to the charger, best to guess false */
- if (charger_get_vbus_voltage(port, &vbus_voltage))
- return false;
-
- if (level == VBUS_SAFE0V)
- return vbus_voltage < PD_V_SAFE0V_MAX;
- else if (level == VBUS_PRESENT)
- return vbus_voltage > PD_V_SAFE5V_MIN;
- else
- return vbus_voltage < PD_V_SINK_DISCONNECT_MAX;
+ return sm5803_check_vbus_level(port, level);
}
int pd_snk_is_vbus_provided(int port)
diff --git a/board/waddledoo/battery.c b/board/waddledoo/battery.c
index 64af3b4302..29eac40158 100644
--- a/board/waddledoo/battery.c
+++ b/board/waddledoo/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c
index 3dcfc29bdc..e207e59456 100644
--- a/board/waddledoo/board.c
+++ b/board/waddledoo/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -42,8 +42,8 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
@@ -83,7 +83,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -118,7 +117,6 @@ static void sub_usb_c1_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
-
}
static void sub_hdmi_hpd_interrupt(enum gpio_signal s)
@@ -173,16 +171,17 @@ void board_init(void)
if (get_cbi_fw_config_db() == DB_1A_HDMI) {
/* Disable i2c on HDMI pins */
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, 0);
- gpio_config_pin(MODULE_I2C,
- GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
+ 0);
+ gpio_config_pin(MODULE_I2C, GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
+ 0);
/* Set HDMI and sub-rail enables to output */
gpio_set_flags(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL,
chipset_in_state(CHIPSET_STATE_ON) ?
- GPIO_ODR_LOW : GPIO_ODR_HIGH);
- gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
+ GPIO_ODR_LOW :
+ GPIO_ODR_HIGH);
+ gpio_set_flags(GPIO_SUB_C1_INT_EN_RAILS_ODL, GPIO_ODR_HIGH);
/* Select HDMI option */
gpio_set_level(GPIO_HDMI_SEL_L, 0);
@@ -191,8 +190,7 @@ void board_init(void)
gpio_enable_interrupt(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL);
} else {
/* Set SDA as an input */
- gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL,
- GPIO_INPUT);
+ gpio_set_flags(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, GPIO_INPUT);
/* Enable C1 interrupt and check if it needs processing */
gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
@@ -256,7 +254,7 @@ static void reconfigure_5v_gpio(void)
gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_OUT_LOW);
}
}
-DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C + 1);
#endif /* BOARD_WADDLEDOO */
static void set_5v_gpio(int level)
@@ -297,10 +295,9 @@ __override void board_power_5v_enable(int enable)
gpio_set_level(GPIO_SUB_C1_INT_EN_RAILS_ODL, !enable);
} else {
if (isl923x_set_comparator_inversion(1, !!enable))
- CPRINTS("Failed to %sable sub rails!", enable ?
- "en" : "dis");
+ CPRINTS("Failed to %sable sub rails!",
+ enable ? "en" : "dis");
}
-
}
__override uint8_t board_get_usb_pd_port_count(void)
@@ -325,13 +322,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < board_get_usb_pd_port_count());
+ int is_real_port = (port >= 0 && port < board_get_usb_pd_port_count());
int i;
int old_port;
@@ -395,8 +390,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -421,17 +416,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t lid_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
static struct accelgyro_saved_data_t g_bma253_data;
static struct bmi_drv_data_t g_bmi160_data;
@@ -507,9 +498,8 @@ struct motion_sensor_t motion_sensors[] = {
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -596,25 +586,34 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = NB7V904M_I2C_ADDR0,
- .driver = &nb7v904m_usb_redriver_drv,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = NB7V904M_I2C_ADDR0,
+ .driver = &nb7v904m_usb_redriver_drv,
+ },
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
}
};
@@ -640,7 +639,7 @@ uint16_t tcpc_get_alert_status(void)
}
if (board_get_usb_pd_port_count() > 1 &&
- !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
+ !gpio_get_level(GPIO_SUB_C1_INT_EN_RAILS_ODL)) {
if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
/* TCPCI spec Rev 1.0 says to ignore bits 14:12. */
if (!(tcpc_config[1].flags & TCPC_FLAGS_TCPCI_REV2_0))
diff --git a/board/waddledoo/board.h b/board/waddledoo/board.h
index 37004c2efe..727f1bdb33 100644
--- a/board/waddledoo/board.h
+++ b/board/waddledoo/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,7 @@
/* Save some flash space */
#define CONFIG_CHIP_INIT_ROM_REGION
-#undef CONFIG_CONSOLE_CMDHELP
+#undef CONFIG_CONSOLE_CMDHELP
#define CONFIG_DEBUG_ASSERT_BRIEF
#define CONFIG_USB_PD_DEBUG_LEVEL 2
@@ -35,11 +35,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -68,7 +71,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* USB */
#define CONFIG_BC12_DETECT_PI3USB9201
@@ -91,23 +94,22 @@
#undef PD_POWER_SUPPLY_TURN_OFF_DELAY
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
/* 20% margin added for these timings */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 13080 /* us */
+#define PD_POWER_SUPPLY_TURN_OFF_DELAY 16080 /* us */
#undef CONFIG_USBC_VCONN_SWAP_DELAY_US
-#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
-
+#define CONFIG_USBC_VCONN_SWAP_DELAY_US 787 /* us */
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -124,13 +126,13 @@
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -157,19 +159,14 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
diff --git a/board/waddledoo/build.mk b/board/waddledoo/build.mk
index d467fee6e6..6f205ebcf4 100644
--- a/board/waddledoo/build.mk
+++ b/board/waddledoo/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/waddledoo/cbi_ssfc.c b/board/waddledoo/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/waddledoo/cbi_ssfc.c
+++ b/board/waddledoo/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/waddledoo/cbi_ssfc.h b/board/waddledoo/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/waddledoo/cbi_ssfc.h
+++ b/board/waddledoo/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/waddledoo/ec.tasklist b/board/waddledoo/ec.tasklist
index 0aba1fabeb..ba5855412d 100644
--- a/board/waddledoo/ec.tasklist
+++ b/board/waddledoo/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/waddledoo/gpio.inc b/board/waddledoo/gpio.inc
index 69f6bc6307..6b55d890b2 100644
--- a/board/waddledoo/gpio.inc
+++ b/board/waddledoo/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/waddledoo/led.c b/board/waddledoo/led.c
index b9ff2e74e8..4315e0b87d 100644
--- a/board/waddledoo/led.c
+++ b/board/waddledoo/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,13 +20,10 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* both LEDs being off.
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Amber, White */
- [EC_LED_COLOR_RED] = { 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0 },
- [EC_LED_COLOR_YELLOW] = { 0, 0 },
- [EC_LED_COLOR_WHITE] = { 0, 100 },
- [EC_LED_COLOR_AMBER] = { 100, 0 },
+ /* Amber, White */
+ [EC_LED_COLOR_RED] = { 0, 0 }, [EC_LED_COLOR_GREEN] = { 0, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0 }, [EC_LED_COLOR_YELLOW] = { 0, 0 },
+ [EC_LED_COLOR_WHITE] = { 0, 100 }, [EC_LED_COLOR_AMBER] = { 100, 0 },
};
/* One logical LED with amber and white channels. */
diff --git a/board/waddledoo/usb_pd_policy.c b/board/waddledoo/usb_pd_policy.c
index 3190595596..23166f7fca 100644
--- a/board/waddledoo/usb_pd_policy.c
+++ b/board/waddledoo/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/waddledoo2/battery.c b/board/waddledoo2/battery.c
index 887c66e355..3696d4e38c 100644
--- a/board/waddledoo2/battery.c
+++ b/board/waddledoo2/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/waddledoo2/board.c b/board/waddledoo2/board.c
index 1f7ad2da92..fd12aec449 100644
--- a/board/waddledoo2/board.c
+++ b/board/waddledoo2/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -51,13 +51,13 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
#define INT_RECHECK_US 5000
-#define ADC_VOL_UP_MASK BIT(0)
-#define ADC_VOL_DOWN_MASK BIT(1)
+#define ADC_VOL_UP_MASK BIT(0)
+#define ADC_VOL_DOWN_MASK BIT(1)
static uint8_t new_adc_key_state;
@@ -110,8 +110,8 @@ static const struct ec_response_keybd_config waddledoo2_keybd = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &waddledoo2_keybd;
}
@@ -152,7 +152,6 @@ static void usb_c0_interrupt(enum gpio_signal s)
/* Check the line again in 5ms */
hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
-
}
/* C1 interrupt line shared by BC 1.2, TCPC, and charger */
@@ -226,22 +225,22 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_A \
- { \
+#define THERMAL_A \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
@@ -258,8 +257,8 @@ __maybe_unused static const struct ec_thermal_config thermal_a = THERMAL_A;
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_B \
- { \
+#define THERMAL_B \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_WARN] = 0, \
[EC_TEMP_THRESH_HIGH] = C_TO_K(73), \
@@ -334,13 +333,11 @@ int board_is_sourcing_vbus(int port)
tcpc_read(port, TCPC_REG_POWER_STATUS, &regval);
return !!(regval & TCPC_REG_POWER_STATUS_SOURCING_VBUS);
-
}
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
int old_port;
@@ -400,8 +397,8 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
int icl = MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT);
@@ -426,18 +423,13 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrices to rotate accelerometers into the standard reference. */
-static const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
-
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
+static const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* BMA253 private data */
static struct accelgyro_saved_data_t g_bma253_data;
@@ -445,11 +437,9 @@ static struct accelgyro_saved_data_t g_bma253_data;
/* BMI160 private data */
static struct bmi_drv_data_t g_bmi160_data;
-static const mat33_fp_t base_icm_ref = {
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(-1)}
-};
+static const mat33_fp_t base_icm_ref = { { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) } };
/* ICM426 private data */
static struct icm_drv_data_t g_icm426xx_data;
@@ -633,7 +623,7 @@ void board_init(void)
gmr_tablet_switch_disable();
/* Base accel is not stuffed, don't allow line to float */
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ GPIO_INPUT | GPIO_PULL_DOWN);
}
/* Turn on 5V if the system is on, otherwise turn it off. */
@@ -648,20 +638,19 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
void motion_interrupt(enum gpio_signal signal)
{
- switch (get_cbi_ssfc_base_sensor()) {
- case SSFC_SENSOR_ICM426XX:
- icm426xx_interrupt(signal);
- break;
- case SSFC_SENSOR_BMI160:
- default:
- bmi160_interrupt(signal);
- break;
- }
+ switch (get_cbi_ssfc_base_sensor()) {
+ case SSFC_SENSOR_ICM426XX:
+ icm426xx_interrupt(signal);
+ break;
+ case SSFC_SENSOR_BMI160:
+ default:
+ bmi160_interrupt(signal);
+ break;
+ }
}
-__override void ocpc_get_pid_constants(int *kp, int *kp_div,
- int *ki, int *ki_div,
- int *kd, int *kd_div)
+__override void ocpc_get_pid_constants(int *kp, int *kp_div, int *ki,
+ int *ki_div, int *kd, int *kd_div)
{
*kp = 1;
*kp_div = 20;
@@ -737,18 +726,24 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
- .driver = &pi3usb3x532_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = PI3USB3X532_I2C_ADDR0,
+ .driver = &pi3usb3x532_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM,
- .driver = &ps8802_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = PS8802_I2C_ADDR_FLAGS_CUSTOM,
+ .driver = &ps8802_usb_mux_driver,
+ },
}
};
diff --git a/board/waddledoo2/board.h b/board/waddledoo2/board.h
index e55539bc3e..93f0a0f108 100644
--- a/board/waddledoo2/board.h
+++ b/board/waddledoo2/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,11 +22,14 @@
/* Charger */
#define CONFIG_CHARGER_RAA489000
+#define PD_MAX_VOLTAGE_MV 20000
#define CONFIG_CHARGER_SENSE_RESISTOR_AC 10
#define CONFIG_CHARGER_SENSE_RESISTOR 10
-#define CONFIG_OCPC_DEF_RBATT_MOHMS 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr */
+#define CONFIG_OCPC_DEF_RBATT_MOHMS \
+ 22 /* R_DS(on) 11.6mOhm + 10mOhm sns rstr \
+ */
#define CONFIG_OCPC
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
#undef CONFIG_CMD_CHARGER_DUMP
#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
@@ -44,7 +47,7 @@
/* PWM */
#define CONFIG_PWM
-#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
/* Temp sensor */
#define CONFIG_TEMP_SENSOR
@@ -81,16 +84,16 @@
#define CONFIG_USB_PD_5V_EN_CUSTOM
/* I2C configuration */
-#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
-#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
-#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
-#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
+#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
+#define I2C_PORT_BATTERY NPCX_I2C_PORT5_0
+#define I2C_PORT_SENSOR NPCX_I2C_PORT0_0
+#define I2C_PORT_USB_C0 NPCX_I2C_PORT1_0
#define I2C_PORT_SUB_USB_C1 NPCX_I2C_PORT2_0
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0
/* TODO(b:147440290): Need to handle multiple charger ICs */
-#define I2C_PORT_CHARGER I2C_PORT_USB_C0
+#define I2C_PORT_CHARGER I2C_PORT_USB_C0
-#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
@@ -99,15 +102,15 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
-#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
+#define CONFIG_ACCEL_BMA255 /* Lid accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_ICM426XX /* Base accel second source*/
/* Lid operates in forced mode, base in FIFO */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_ACCEL_FIFO
-#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
+#define CONFIG_ACCEL_FIFO_SIZE 256 /* Must be a power of 2 */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
@@ -143,25 +146,16 @@ enum chg_id {
};
enum adc_channel {
- ADC_TEMP_SENSOR_1, /* ADC0 */
- ADC_TEMP_SENSOR_2, /* ADC1 */
- ADC_SUB_ANALOG, /* ADC2 */
- ADC_VSNS_PP3300_A, /* ADC9 */
+ ADC_TEMP_SENSOR_1, /* ADC0 */
+ ADC_TEMP_SENSOR_2, /* ADC1 */
+ ADC_SUB_ANALOG, /* ADC2 */
+ ADC_VSNS_PP3300_A, /* ADC9 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
enum pwm_channel {
PWM_CH_KBLIGHT,
diff --git a/board/waddledoo2/build.mk b/board/waddledoo2/build.mk
index b012d8d502..eb422dae93 100644
--- a/board/waddledoo2/build.mk
+++ b/board/waddledoo2/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/waddledoo2/cbi_ssfc.c b/board/waddledoo2/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/waddledoo2/cbi_ssfc.c
+++ b/board/waddledoo2/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/waddledoo2/cbi_ssfc.h b/board/waddledoo2/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/waddledoo2/cbi_ssfc.h
+++ b/board/waddledoo2/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/waddledoo2/ec.tasklist b/board/waddledoo2/ec.tasklist
index d4fb416bce..29666dd959 100644
--- a/board/waddledoo2/ec.tasklist
+++ b/board/waddledoo2/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/waddledoo2/gpio.inc b/board/waddledoo2/gpio.inc
index f0e345a81c..f2a95f9762 100644
--- a/board/waddledoo2/gpio.inc
+++ b/board/waddledoo2/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/waddledoo2/led.c b/board/waddledoo2/led.c
index 85bd75ce99..33e900f2ca 100644
--- a/board/waddledoo2/led.c
+++ b/board/waddledoo2/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -19,23 +19,28 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
diff --git a/board/waddledoo2/usb_pd_policy.c b/board/waddledoo2/usb_pd_policy.c
index fd9018a3f0..3410726e87 100644
--- a/board/waddledoo2/usb_pd_policy.c
+++ b/board/waddledoo2/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,8 +10,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/wheelie/battery.c b/board/wheelie/battery.c
index 96d967abec..bc2c5bec4d 100644
--- a/board/wheelie/battery.c
+++ b/board/wheelie/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/wheelie/board.c b/board/wheelie/board.c
index 0ad7590a31..9708dcca82 100644
--- a/board/wheelie/board.c
+++ b/board/wheelie/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -40,7 +40,7 @@
#include "usb_pd.h"
#include "usb_pd_tcpm.h"
-#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
+#define CPRINTUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
/* C0 interrupt line shared by BC 1.2 and charger */
static void usb_c0_interrupt(enum gpio_signal s)
@@ -68,34 +68,26 @@ static void c0_ccsbu_ovp_interrupt(enum gpio_signal s)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_VSNS_PP3300_A] = {
- .name = "PP3300_A_PGOOD",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH0
- },
- [ADC_TEMP_SENSOR_1] = {
- .name = "TEMP_SENSOR1",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH2
- },
- [ADC_TEMP_SENSOR_2] = {
- .name = "TEMP_SENSOR2",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH3
- },
- [ADC_SUB_ANALOG] = {
- .name = "SUB_ANALOG",
- .factor_mul = ADC_MAX_MVOLT,
- .factor_div = ADC_READ_MAX + 1,
- .shift = 0,
- .channel = CHIP_ADC_CH13
- },
+ [ADC_VSNS_PP3300_A] = { .name = "PP3300_A_PGOOD",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH0 },
+ [ADC_TEMP_SENSOR_1] = { .name = "TEMP_SENSOR1",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH2 },
+ [ADC_TEMP_SENSOR_2] = { .name = "TEMP_SENSOR2",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH3 },
+ [ADC_SUB_ANALOG] = { .name = "SUB_ANALOG",
+ .factor_mul = ADC_MAX_MVOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ .channel = CHIP_ADC_CH13 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -143,27 +135,36 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
};
/* USB Retimer */
-const struct usb_mux usbc1_retimer = {
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
- .driver = &tusb544_drv,
+const struct usb_mux_chain usbc1_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = TUSB544_I2C_ADDR_FLAGS0,
+ .driver = &tusb544_drv,
+ },
};
/* USB Muxes */
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_C0,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ },
},
{
- .usb_port = 1,
- .i2c_port = I2C_PORT_SUB_USB_C1,
- .i2c_addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
- .driver = &anx7447_usb_mux_driver,
- .next_mux = &usbc1_retimer,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = AN7447_TCPC0_I2C_ADDR_FLAGS,
+ .driver = &anx7447_usb_mux_driver,
+ },
+ .next = &usbc1_retimer,
},
};
@@ -445,14 +446,14 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Thermistors */
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_1] = {.name = "Memory",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_1},
- [TEMP_SENSOR_2] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2},
+ [TEMP_SENSOR_1] = { .name = "Memory",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_1 },
+ [TEMP_SENSOR_2] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_2 },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/wheelie/board.h b/board/wheelie/board.h
index 194c49adb6..c53f22b512 100644
--- a/board/wheelie/board.h
+++ b/board/wheelie/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -22,12 +22,13 @@
#define CONFIG_BC12_DETECT_PI3USB9201
/* Charger */
-#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
-#define CONFIG_FPU /* For charger calculations */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#define PD_MAX_VOLTAGE_MV 15000
+#define CONFIG_FPU /* For charger calculations */
#define CONFIG_USB_PD_VBUS_DETECT_CHARGER
#define CONFIG_USB_PD_5V_CHARGER_CTRL
#define CONFIG_CHARGER_OTG
-#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_CHARGER_SINGLE_CHIP
/* LED */
#define CONFIG_LED_PWM
@@ -37,9 +38,9 @@
#define CONFIG_PWM
/* Sensors */
-#define CONFIG_ACCEL_LIS2DE /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
-#define CONFIG_SYNC /* Camera VSYNC */
+#define CONFIG_ACCEL_LIS2DE /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_SYNC /* Camera VSYNC */
#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
/* Sensors without hardware FIFO are in forced mode */
@@ -56,8 +57,7 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-#define CONFIG_SYNC_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
+#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_TABLET_MODE
#define CONFIG_TABLET_MODE_SWITCH
@@ -65,8 +65,8 @@
/* TCPC */
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
-#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
-#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: ANX TCPC + Mux */
+#define CONFIG_USB_PD_TCPM_ITE_ON_CHIP /* C0: ITE EC TCPC */
+#define CONFIG_USB_PD_TCPM_ANX7447 /* C1: ANX TCPC + Mux */
#define CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT 1
/* Thermistors */
@@ -75,10 +75,10 @@
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
/* USB Mux and Retimer */
-#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
-#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
+#define CONFIG_USB_MUX_IT5205 /* C1: ITE Mux */
+#define I2C_PORT_USB_MUX I2C_PORT_USB_C0 /* Required for ITE Mux */
-#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
+#define CONFIG_USBC_RETIMER_TUSB544 /* C1 Redriver: TUSB544 */
#ifndef __ASSEMBLER__
@@ -100,28 +100,18 @@ enum pwm_channel {
};
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- VSYNC,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, VSYNC, SENSOR_COUNT };
/* ADC channels */
enum adc_channel {
- ADC_VSNS_PP3300_A, /* ADC0 */
- ADC_TEMP_SENSOR_1, /* ADC2 */
- ADC_TEMP_SENSOR_2, /* ADC3 */
- ADC_SUB_ANALOG, /* ADC13 */
+ ADC_VSNS_PP3300_A, /* ADC0 */
+ ADC_TEMP_SENSOR_1, /* ADC2 */
+ ADC_TEMP_SENSOR_2, /* ADC3 */
+ ADC_SUB_ANALOG, /* ADC13 */
ADC_CH_COUNT
};
-enum temp_sensor_id {
- TEMP_SENSOR_1,
- TEMP_SENSOR_2,
- TEMP_SENSOR_COUNT
-};
+enum temp_sensor_id { TEMP_SENSOR_1, TEMP_SENSOR_2, TEMP_SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/wheelie/build.mk b/board/wheelie/build.mk
index 806168ea0d..9b862c7624 100644
--- a/board/wheelie/build.mk
+++ b/board/wheelie/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/wheelie/cbi_ssfc.c b/board/wheelie/cbi_ssfc.c
index c4b859f133..81f3ee0dad 100644
--- a/board/wheelie/cbi_ssfc.c
+++ b/board/wheelie/cbi_ssfc.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -27,10 +27,10 @@ DECLARE_HOOK(HOOK_INIT, cbi_ssfc_init, HOOK_PRIO_FIRST);
enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void)
{
- return (enum ec_ssfc_base_sensor) cached_ssfc.base_sensor;
+ return (enum ec_ssfc_base_sensor)cached_ssfc.base_sensor;
}
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
{
- return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+ return (enum ec_ssfc_lid_sensor)cached_ssfc.lid_sensor;
}
diff --git a/board/wheelie/cbi_ssfc.h b/board/wheelie/cbi_ssfc.h
index 935049b6ae..bf8853a43a 100644
--- a/board/wheelie/cbi_ssfc.h
+++ b/board/wheelie/cbi_ssfc.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -56,5 +56,4 @@ enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
*/
enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void);
-
#endif /* _DEDEDE_CBI_SSFC__H_ */
diff --git a/board/wheelie/ec.tasklist b/board/wheelie/ec.tasklist
index 75181a4531..701c1fa099 100644
--- a/board/wheelie/ec.tasklist
+++ b/board/wheelie/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/wheelie/gpio.inc b/board/wheelie/gpio.inc
index 8979ca6ab9..eb96828e07 100644
--- a/board/wheelie/gpio.inc
+++ b/board/wheelie/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/wheelie/led.c b/board/wheelie/led.c
index 9524a68a84..59518dbe6c 100644
--- a/board/wheelie/led.c
+++ b/board/wheelie/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -20,13 +20,13 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
* Board has one physical LED with red, green, and blue
*/
struct pwm_led_color_map led_color_map[EC_LED_COLOR_COUNT] = {
- /* Red, Green, Blue */
- [EC_LED_COLOR_RED] = { 100, 0, 0 },
- [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
- [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
- [EC_LED_COLOR_YELLOW] = { 50, 50, 0 },
- [EC_LED_COLOR_WHITE] = { 50, 50, 50 },
- [EC_LED_COLOR_AMBER] = { 70, 30, 0 },
+ /* Red, Green, Blue */
+ [EC_LED_COLOR_RED] = { 100, 0, 0 },
+ [EC_LED_COLOR_GREEN] = { 0, 100, 0 },
+ [EC_LED_COLOR_BLUE] = { 0, 0, 100 },
+ [EC_LED_COLOR_YELLOW] = { 50, 50, 0 },
+ [EC_LED_COLOR_WHITE] = { 50, 50, 50 },
+ [EC_LED_COLOR_AMBER] = { 70, 30, 0 },
};
/* One logical LED with red, green, and blue channels. */
diff --git a/board/wheelie/usb_pd_policy.c b/board/wheelie/usb_pd_policy.c
index 02ae21a420..3c7564fa12 100644
--- a/board/wheelie/usb_pd_policy.c
+++ b/board/wheelie/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,8 +13,8 @@
#include "driver/tcpm/tcpci.h"
#include "usb_pd.h"
-#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ## args)
-#define CPRINTS(format, args...) cprints(CC_USBPD, format, ## args)
+#define CPRINTF(format, args...) cprintf(CC_USBPD, format, ##args)
+#define CPRINTS(format, args...) cprints(CC_USBPD, format, ##args)
int pd_check_vconn_swap(int port)
{
diff --git a/board/willow/battery.c b/board/willow/battery.c
index cc97838f48..a79785aaf8 100644
--- a/board/willow/battery.c
+++ b/board/willow/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/willow/board.c b/board/willow/board.c
index fcf679f108..826df6940c 100644
--- a/board/willow/board.c
+++ b/board/willow/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -30,6 +30,7 @@
#include "it8801.h"
#include "keyboard_scan.h"
#include "lid_switch.h"
+#include "panic.h"
#include "power.h"
#include "power_button.h"
#include "registers.h"
@@ -43,8 +44,8 @@
#include "usb_pd_tcpm.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
static void tcpc_alert_event(enum gpio_signal signal)
{
@@ -56,40 +57,34 @@ static void tcpc_alert_event(enum gpio_signal signal)
/******************************************************************************/
/* ADC channels. Must be in the exactly same order as in enum adc_channel. */
const struct adc_t adc_channels[] = {
- [ADC_BOARD_ID] = {"BOARD_ID", 3300, 4096, 0, STM32_AIN(10)},
- [ADC_EC_SKU_ID] = {"EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8)},
+ [ADC_BOARD_ID] = { "BOARD_ID", 3300, 4096, 0, STM32_AIN(10) },
+ [ADC_EC_SKU_ID] = { "EC_SKU_ID", 3300, 4096, 0, STM32_AIN(8) },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "typec",
- .port = 0,
- .kbps = 400,
- .scl = GPIO_I2C1_SCL,
- .sda = GPIO_I2C1_SDA
- },
- {
- .name = "other",
- .port = 1,
- .kbps = 400,
- .scl = GPIO_I2C2_SCL,
- .sda = GPIO_I2C2_SDA
- },
+ { .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA },
+ { .name = "other",
+ .port = 1,
+ .kbps = 400,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
const struct i2c_port_t i2c_bitbang_ports[] = {
- {
- .name = "battery",
- .port = 2,
- .kbps = 100,
- .scl = GPIO_I2C3_SCL,
- .sda = GPIO_I2C3_SDA,
- .drv = &bitbang_drv
- },
+ { .name = "battery",
+ .port = 2,
+ .kbps = 100,
+ .scl = GPIO_I2C3_SCL,
+ .sda = GPIO_I2C3_SDA,
+ .drv = &bitbang_drv },
};
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
@@ -97,8 +92,8 @@ const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
/* power signal list. Must match order of enum power_signal. */
const struct power_signal_info power_signal_list[] = {
- {GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L"},
- {GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD"},
+ { GPIO_AP_IN_SLEEP_L, POWER_SIGNAL_ACTIVE_LOW, "AP_IN_S3_L" },
+ { GPIO_PMIC_EC_RESETB, POWER_SIGNAL_ACTIVE_HIGH, "PMIC_PWR_GOOD" },
};
BUILD_ASSERT(ARRAY_SIZE(power_signal_list) == POWER_SIGNAL_COUNT);
@@ -154,8 +149,7 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
},
};
-static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state,
+static void board_hpd_status(const struct usb_mux *me, mux_state_t mux_state,
bool *ack_required)
{
/* This driver does not use host command ACKs */
@@ -168,13 +162,16 @@ static void board_hpd_status(const struct usb_mux *me,
host_set_single_event(EC_HOST_EVENT_USB_MUX);
}
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .i2c_port = I2C_PORT_USB_MUX,
- .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
- .driver = &it5205_usb_mux_driver,
- .hpd_update = &board_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .i2c_port = I2C_PORT_USB_MUX,
+ .i2c_addr_flags = IT5205_I2C_ADDR1_FLAGS,
+ .driver = &it5205_usb_mux_driver,
+ .hpd_update = &board_hpd_status,
+ },
},
};
@@ -237,12 +234,12 @@ int board_set_active_charge_port(int charge_port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
charge_ma = (charge_ma * 95) / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
int board_discharge_on_ac(int enable)
@@ -299,8 +296,7 @@ static void board_spi_enable(void)
/* Pin mux spi peripheral toward the sensor. */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_STARTUP,
- board_spi_enable,
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable,
MOTION_SENSE_HOOK_PRIO - 1);
static void board_spi_disable(void)
@@ -314,8 +310,7 @@ static void board_spi_disable(void)
spi_enable(&spi_devices[0], 0);
STM32_RCC_APB1ENR &= ~STM32_RCC_PB1_SPI2;
}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN,
- board_spi_disable,
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable,
MOTION_SENSE_HOOK_PRIO + 1);
#endif /* !VARIANT_KUKUI_NO_SENSORS */
@@ -354,11 +349,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Rotation matrixes */
-static const mat33_fp_t base_standard_ref = {
- {FLOAT_TO_FP(1), 0, 0},
- {0, FLOAT_TO_FP(1), 0},
- {0, 0, FLOAT_TO_FP(1)}
-};
+static const mat33_fp_t base_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
diff --git a/board/willow/board.h b/board/willow/board.h
index 5bfc06d615..18745a07a4 100644
--- a/board/willow/board.h
+++ b/board/willow/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,7 +50,7 @@
/* Motion Sensors */
#ifndef VARIANT_KUKUI_NO_SENSORS
-#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
@@ -67,20 +67,20 @@
#endif /* VARIANT_KUKUI_NO_SENSORS */
/* I2C ports */
-#define I2C_PORT_BC12 0
-#define I2C_PORT_TCPC0 0
-#define I2C_PORT_USB_MUX 0
-#define I2C_PORT_CHARGER board_get_charger_i2c()
-#define I2C_PORT_SENSORS 1
-#define I2C_PORT_KB_DISCRETE 1
-#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
-#define I2C_PORT_BATTERY 2
+#define I2C_PORT_BC12 0
+#define I2C_PORT_TCPC0 0
+#define I2C_PORT_USB_MUX 0
+#define I2C_PORT_CHARGER board_get_charger_i2c()
+#define I2C_PORT_SENSORS 1
+#define I2C_PORT_KB_DISCRETE 1
+#define I2C_PORT_VIRTUAL_BATTERY I2C_PORT_BATTERY
+#define I2C_PORT_BATTERY 2
/* IT8801 I2C address */
-#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
+#define KB_DISCRETE_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_KEYBOARD_PROTOCOL_MKBP
#define CONFIG_MKBP_EVENT
diff --git a/board/willow/build.mk b/board/willow/build.mk
index a6e1c010d7..f583684804 100644
--- a/board/willow/build.mk
+++ b/board/willow/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/willow/ec.tasklist b/board/willow/ec.tasklist
index c1330b86f8..fb131b8eb4 100644
--- a/board/willow/ec.tasklist
+++ b/board/willow/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/willow/gpio.inc b/board/willow/gpio.inc
index 9c1bffe194..684e1997c9 100644
--- a/board/willow/gpio.inc
+++ b/board/willow/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/willow/led.c b/board/willow/led.c
index c579cb6165..fc74d4ba8b 100644
--- a/board/willow/led.c
+++ b/board/willow/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -15,22 +15,27 @@
__override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
-const enum ec_led_id supported_led_ids[] = {
- EC_LED_ID_BATTERY_LED
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
+const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_battery(enum ec_led_colors color)
{
diff --git a/board/woomax/battery.c b/board/woomax/battery.c
index bd46c51cc7..0bed2f03f5 100644
--- a/board/woomax/battery.c
+++ b/board/woomax/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/woomax/board.c b/board/woomax/board.c
index e45fd91623..747c576fc2 100644
--- a/board/woomax/board.c
+++ b/board/woomax/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,7 +19,7 @@
#include "driver/retimer/pi3hdx1204.h"
#include "driver/retimer/ps8802.h"
#include "driver/retimer/ps8811.h"
-#include "driver/retimer/ps8818.h"
+#include "driver/retimer/ps8818_public.h"
#include "driver/temp_sensor/sb_tsi.h"
#include "driver/usb_mux/amd_fp5.h"
#include "extpower.h"
@@ -44,8 +44,8 @@
#include "gpio_list.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
/* Motion sensors */
static struct mutex g_lid_mutex;
@@ -64,15 +64,15 @@ static const mat33_fp_t lid_standard_ref = {
};
static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(-1)},
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(-1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
static const mat33_fp_t base_standard_ref_icm = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(-1)},
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(-1), 0 },
+ { 0, 0, FLOAT_TO_FP(-1) },
};
/* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */
@@ -294,8 +294,8 @@ static void board_chipset_resume(void)
int val;
rv = i2c_read8(I2C_PORT_USBA0,
- PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
- PS8811_REG1_USB_BEQ_LEVEL, &val);
+ PS8811_I2C_ADDR_FLAGS3 + PS8811_REG_PAGE1,
+ PS8811_REG1_USB_BEQ_LEVEL, &val);
if (!rv)
break;
}
@@ -307,8 +307,7 @@ static void board_chipset_resume(void)
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 1);
msleep(PI3HDX1204_POWER_ON_DELAY_MS);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
hpd);
}
}
@@ -319,9 +318,7 @@ static void board_chipset_suspend(void)
ioex_set_level(IOEX_USB_A0_RETIMER_EN, 0);
if (ec_config_has_hdmi_retimer_pi3hdx1204()) {
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- 0);
+ pi3hdx1204_enable(I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS, 0);
ioex_set_level(IOEX_HDMI_POWER_EN_DB, 0);
}
@@ -340,35 +337,31 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me,
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_18DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_18DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_18DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_18DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX1EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX1EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_APTX2EQ_5G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_APTX2EQ_5G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
if (rv)
return rv;
}
@@ -376,11 +369,10 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me,
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/* Boost the DP gain */
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_DPEQ_LEVEL,
- PS8818_DPEQ_LEVEL_UP_MASK,
- PS8818_DPEQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_DPEQ_LEVEL,
+ PS8818_DPEQ_LEVEL_UP_MASK,
+ PS8818_DPEQ_LEVEL_UP_19DB);
if (rv)
return rv;
@@ -391,21 +383,18 @@ static int woomax_ps8818_mux_set(const struct usb_mux *me,
}
if (!(mux_state & USB_PD_MUX_POLARITY_INVERTED)) {
- rv = ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_CRX1EQ_10G_LEVEL,
- PS8818_EQ_LEVEL_UP_MASK,
- PS8818_EQ_LEVEL_UP_19DB);
+ rv = ps8818_i2c_field_update8(me, PS8818_REG_PAGE1,
+ PS8818_REG1_CRX1EQ_10G_LEVEL,
+ PS8818_EQ_LEVEL_UP_MASK,
+ PS8818_EQ_LEVEL_UP_19DB);
rv |= ps8818_i2c_write(me, PS8818_REG_PAGE1,
- PS8818_REG1_APRX1_DE_LEVEL, 0x02);
+ PS8818_REG1_APRX1_DE_LEVEL, 0x02);
}
/* set the RX input termination */
- rv |= ps8818_i2c_field_update8(me,
- PS8818_REG_PAGE1,
- PS8818_REG1_RX_PHY,
- PS8818_RX_INPUT_TERM_MASK,
- PS8818_RX_INPUT_TERM_85_OHM);
+ rv |= ps8818_i2c_field_update8(me, PS8818_REG_PAGE1, PS8818_REG1_RX_PHY,
+ PS8818_RX_INPUT_TERM_MASK,
+ PS8818_RX_INPUT_TERM_85_OHM);
/* set register 0x40 ICP1 for 1G PD loop */
rv |= ps8818_i2c_write(me, PS8818_REG_PAGE1, 0x40, 0x84);
@@ -425,11 +414,10 @@ static int woomax_ps8802_mux_set(const struct usb_mux *me,
/* USB specific config */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* Boost the USB gain */
- rv = ps8802_i2c_field_update16(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_USB_SSEQ_LEVEL,
- PS8802_USBEQ_LEVEL_UP_MASK,
- PS8802_USBEQ_LEVEL_UP_19DB);
+ rv = ps8802_i2c_field_update16(me, PS8802_REG_PAGE2,
+ PS8802_REG2_USB_SSEQ_LEVEL,
+ PS8802_USBEQ_LEVEL_UP_MASK,
+ PS8802_USBEQ_LEVEL_UP_19DB);
if (rv)
return rv;
}
@@ -437,11 +425,10 @@ static int woomax_ps8802_mux_set(const struct usb_mux *me,
/* DP specific config */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
/*Boost the DP gain */
- rv = ps8802_i2c_field_update16(me,
- PS8802_REG_PAGE2,
- PS8802_REG2_DPEQ_LEVEL,
- PS8802_DPEQ_LEVEL_UP_MASK,
- PS8802_DPEQ_LEVEL_UP_19DB);
+ rv = ps8802_i2c_field_update16(me, PS8802_REG_PAGE2,
+ PS8802_REG2_DPEQ_LEVEL,
+ PS8802_DPEQ_LEVEL_UP_MASK,
+ PS8802_DPEQ_LEVEL_UP_19DB);
if (rv)
return rv;
@@ -453,11 +440,10 @@ static int woomax_ps8802_mux_set(const struct usb_mux *me,
}
/* Set extra swing level tuning at 800mV/P0 */
- rv = ps8802_i2c_field_update8(me,
- PS8802_REG_PAGE1,
- PS8802_800MV_LEVEL_TUNING,
- PS8802_EXTRA_SWING_LEVEL_P0_MASK,
- PS8802_EXTRA_SWING_LEVEL_P0_UP_1);
+ rv = ps8802_i2c_field_update8(me, PS8802_REG_PAGE1,
+ PS8802_800MV_LEVEL_TUNING,
+ PS8802_EXTRA_SWING_LEVEL_P0_MASK,
+ PS8802_EXTRA_SWING_LEVEL_P0_UP_1);
return rv;
}
@@ -470,6 +456,9 @@ const struct usb_mux usbc1_woomax_ps8818 = {
.board_set = &woomax_ps8818_mux_set,
};
+/* Place holder for second mux in USBC1 chain */
+struct usb_mux_chain usbc1_mux1;
+
static void setup_mux(void)
{
if (ec_config_has_usbc1_retimer_ps8802()) {
@@ -481,13 +470,11 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the PS8802
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_ps8802,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_ps8802;
/* Set the AMD FP5 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_amd_fp5_usb_mux;
- usb_muxes[USBC_PORT_C1].board_set = &woomax_ps8802_mux_set;
+ usbc1_mux1.mux = &usbc1_amd_fp5_usb_mux;
+ usbc1_ps8802.board_set = &woomax_ps8802_mux_set;
/* Don't have the AMD FP5 flip */
usbc1_amd_fp5_usb_mux.flags = USB_MUX_FLAG_SET_WITHOUT_FLIP;
@@ -501,91 +488,213 @@ static void setup_mux(void)
* Replace usb_muxes[USBC_PORT_C1] with the AMD FP5
* table entry.
*/
- memcpy(&usb_muxes[USBC_PORT_C1],
- &usbc1_amd_fp5_usb_mux,
- sizeof(struct usb_mux));
+ usb_muxes[USBC_PORT_C1].mux = &usbc1_amd_fp5_usb_mux;
/* Set the PS8818 as the secondary MUX */
- usb_muxes[USBC_PORT_C1].next_mux = &usbc1_woomax_ps8818;
+ usbc1_mux1.mux = &usbc1_woomax_ps8818;
}
}
-enum pi3dpx1207_usb_conf {
- USB_DP = 0,
- USB_DP_INV,
- USB,
- USB_INV,
- DP,
- DP_INV
-};
+enum pi3dpx1207_usb_conf { USB_DP = 0, USB_DP_INV, USB, USB_INV, DP, DP_INV };
static uint8_t pi3dpx1207_picasso_eq[] = {
/*usb_dp*/
- 0x13, 0x11, 0x20, 0x62, 0x06, 0x5B, 0x5B,
- 0x07, 0x03, 0x40, 0xFC, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x62,
+ 0x06,
+ 0x5B,
+ 0x5B,
+ 0x07,
+ 0x03,
+ 0x40,
+ 0xFC,
+ 0x42,
+ 0x71,
/*usb_dp_inv */
- 0x13, 0x11, 0x20, 0x72, 0x06, 0x03, 0x07,
- 0x5B, 0x5B, 0x23, 0xFC, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x72,
+ 0x06,
+ 0x03,
+ 0x07,
+ 0x5B,
+ 0x5B,
+ 0x23,
+ 0xFC,
+ 0x42,
+ 0x71,
/*usb*/
- 0x13, 0x11, 0x20, 0x42, 0x00, 0x03, 0x07,
- 0x07, 0x03, 0x00, 0x42, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x42,
+ 0x00,
+ 0x03,
+ 0x07,
+ 0x07,
+ 0x03,
+ 0x00,
+ 0x42,
+ 0x42,
+ 0x71,
/*usb_inv*/
- 0x13, 0x11, 0x20, 0x52, 0x00, 0x03, 0x07,
- 0x07, 0x03, 0x02, 0x42, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x52,
+ 0x00,
+ 0x03,
+ 0x07,
+ 0x07,
+ 0x03,
+ 0x02,
+ 0x42,
+ 0x42,
+ 0x71,
/*dp*/
- 0x13, 0x11, 0x20, 0x22, 0x06, 0x5B, 0x5B,
- 0x5B, 0x5B, 0x60, 0xFC, 0xFC, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x22,
+ 0x06,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x60,
+ 0xFC,
+ 0xFC,
+ 0x71,
/*dp_inv*/
- 0x13, 0x11, 0x20, 0x32, 0x06, 0x5B, 0x5B,
- 0x5B, 0x5B, 0x63, 0xFC, 0xFC, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x32,
+ 0x06,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x63,
+ 0xFC,
+ 0xFC,
+ 0x71,
};
static uint8_t pi3dpx1207_dali_eq[] = {
/*usb_dp*/
- 0x13, 0x11, 0x20, 0x62, 0x06, 0x5B, 0x5B,
- 0x07, 0x07, 0x40, 0xFC, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x62,
+ 0x06,
+ 0x5B,
+ 0x5B,
+ 0x07,
+ 0x07,
+ 0x40,
+ 0xFC,
+ 0x42,
+ 0x71,
/*usb_dp_inv*/
- 0x13, 0x11, 0x20, 0x72, 0x06, 0x07, 0x07,
- 0x5B, 0x5B, 0x23, 0xFC, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x72,
+ 0x06,
+ 0x07,
+ 0x07,
+ 0x5B,
+ 0x5B,
+ 0x23,
+ 0xFC,
+ 0x42,
+ 0x71,
/*usb*/
- 0x13, 0x11, 0x20, 0x42, 0x00, 0x07, 0x07,
- 0x07, 0x07, 0x00, 0x42, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x42,
+ 0x00,
+ 0x07,
+ 0x07,
+ 0x07,
+ 0x07,
+ 0x00,
+ 0x42,
+ 0x42,
+ 0x71,
/*usb_inv*/
- 0x13, 0x11, 0x20, 0x52, 0x00, 0x07, 0x07,
- 0x07, 0x07, 0x02, 0x42, 0x42, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x52,
+ 0x00,
+ 0x07,
+ 0x07,
+ 0x07,
+ 0x07,
+ 0x02,
+ 0x42,
+ 0x42,
+ 0x71,
/*dp*/
- 0x13, 0x11, 0x20, 0x22, 0x06, 0x5B, 0x5B,
- 0x5B, 0x5B, 0x60, 0xFC, 0xFC, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x22,
+ 0x06,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x60,
+ 0xFC,
+ 0xFC,
+ 0x71,
/*dp_inv*/
- 0x13, 0x11, 0x20, 0x32, 0x06, 0x5B, 0x5B,
- 0x5B, 0x5B, 0x63, 0xFC, 0xFC, 0x71,
+ 0x13,
+ 0x11,
+ 0x20,
+ 0x32,
+ 0x06,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x5B,
+ 0x63,
+ 0xFC,
+ 0xFC,
+ 0x71,
};
static int board_pi3dpx1207_mux_set(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state)
{
- int rv = EC_SUCCESS;
+ int rv = EC_SUCCESS;
enum pi3dpx1207_usb_conf usb_mode = 0;
/* USB */
if (mux_state & USB_PD_MUX_USB_ENABLED) {
/* USB with DP */
if (mux_state & USB_PD_MUX_DP_ENABLED) {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_DP_INV
- : USB_DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_DP_INV :
+ USB_DP;
}
/* USB without DP */
else {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? USB_INV
- : USB;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ?
+ USB_INV :
+ USB;
}
}
/* DP without USB */
else if (mux_state & USB_PD_MUX_DP_ENABLED) {
- usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED)
- ? DP_INV
- : DP;
+ usb_mode = (mux_state & USB_PD_MUX_POLARITY_INVERTED) ? DP_INV :
+ DP;
}
/* Nothing enabled */
else
@@ -594,10 +703,11 @@ static int board_pi3dpx1207_mux_set(const struct usb_mux *me,
/* Write the retimer config byte */
if (ec_config_has_usbc1_retimer_ps8802())
rv = i2c_xfer(me->i2c_port, me->i2c_addr_flags,
- &pi3dpx1207_dali_eq[usb_mode*13], 13, NULL, 0);
+ &pi3dpx1207_dali_eq[usb_mode * 13], 13, NULL, 0);
else
rv = i2c_xfer(me->i2c_port, me->i2c_addr_flags,
- &pi3dpx1207_picasso_eq[usb_mode*13], 13, NULL, 0);
+ &pi3dpx1207_picasso_eq[usb_mode * 13], 13, NULL,
+ 0);
return rv;
}
@@ -612,24 +722,30 @@ const struct pi3dpx1207_usb_control pi3dpx1207_controls[] = {
};
BUILD_ASSERT(ARRAY_SIZE(pi3dpx1207_controls) == USBC_PORT_COUNT);
-const struct usb_mux usbc0_pi3dpx1207_usb_retimer = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
- .driver = &pi3dpx1207_usb_retimer,
- .board_set = &board_pi3dpx1207_mux_set,
+const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer = {
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = PI3DPX1207_I2C_ADDR_FLAGS,
+ .driver = &pi3dpx1207_usb_retimer,
+ .board_set = &board_pi3dpx1207_mux_set,
+ },
};
-struct usb_mux usb_muxes[] = {
+struct usb_mux_chain usb_muxes[] = {
[USBC_PORT_C0] = {
- .usb_port = USBC_PORT_C0,
- .i2c_port = I2C_PORT_USB_AP_MUX,
- .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
- .driver = &amd_fp5_usb_mux_driver,
- .next_mux = &usbc0_pi3dpx1207_usb_retimer,
+ .mux = &(const struct usb_mux) {
+ .usb_port = USBC_PORT_C0,
+ .i2c_port = I2C_PORT_USB_AP_MUX,
+ .i2c_addr_flags = AMD_FP5_MUX_I2C_ADDR_FLAGS,
+ .driver = &amd_fp5_usb_mux_driver,
+ },
+ .next = &usbc0_pi3dpx1207_usb_retimer,
},
[USBC_PORT_C1] = {
/* Filled in dynamically at startup */
+ .next = &usbc1_mux1,
},
};
BUILD_ASSERT(ARRAY_SIZE(usb_muxes) == USBC_PORT_COUNT);
@@ -667,7 +783,7 @@ DECLARE_HOOK(HOOK_INIT, setup_fw_config, HOOK_PRIO_INIT_I2C + 2);
/* Physical fans. These are logically separate from pwm_channels. */
const struct fan_conf fan_conf_0 = {
.flags = FAN_USE_RPM_MODE,
- .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
.pgood_gpio = -1,
.enable_gpio = -1,
};
@@ -758,8 +874,8 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_THERMISTOR \
- { \
+#define THERMAL_THERMISTOR \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(95), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -774,8 +890,8 @@ __maybe_unused static const struct ec_thermal_config thermal_thermistor =
/*
* TODO(b/202062363): Remove when clang is fixed.
*/
-#define THERMAL_CPU \
- { \
+#define THERMAL_CPU \
+ { \
.temp_host = { \
[EC_TEMP_THRESH_HIGH] = C_TO_K(95), \
[EC_TEMP_THRESH_HALT] = C_TO_K(100), \
@@ -813,8 +929,8 @@ static const struct ec_response_keybd_config woomax_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY | KEYBD_CAP_NUMERIC_KEYPAD,
};
-__override const struct ec_response_keybd_config
-*board_vivaldi_keybd_config(void)
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
{
return &woomax_kb;
}
@@ -833,10 +949,9 @@ static void hdmi_hpd_handler(void)
{
int hpd = gpio_get_level(GPIO_DP1_HPD_EC_IN);
- pi3hdx1204_enable(I2C_PORT_TCPC1,
- PI3HDX1204_I2C_ADDR_FLAGS,
- chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON)
- && hpd);
+ pi3hdx1204_enable(
+ I2C_PORT_TCPC1, PI3HDX1204_I2C_ADDR_FLAGS,
+ chipset_in_or_transitioning_to_state(CHIPSET_STATE_ON) && hpd);
}
DECLARE_DEFERRED(hdmi_hpd_handler);
@@ -856,9 +971,8 @@ int board_usbc_port_to_hpd_gpio_or_ioex(int port)
* USB-C1 OPT3 DB use GPIO_USB_C1_HPD_IN_DB for board version 2
*/
else if (ec_config_has_mst_hub_rtd2141b())
- return (board_ver >= 2)
- ? GPIO_USB_C1_HPD_IN_DB
- : IOEX_USB_C1_HPD_IN_DB;
+ return (board_ver >= 2) ? GPIO_USB_C1_HPD_IN_DB :
+ IOEX_USB_C1_HPD_IN_DB;
/* USB-C1 OPT1 DB use DP2_HPD. */
return GPIO_DP2_HPD;
diff --git a/board/woomax/board.h b/board/woomax/board.h
index 2c249d7781..20bbb8417a 100644
--- a/board/woomax/board.h
+++ b/board/woomax/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -50,36 +50,32 @@
#define CONFIG_CUSTOM_FAN_CONTROL
/* GPIO mapping from board specific name to EC common name. */
-#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
-#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
-#define GPIO_AC_PRESENT GPIO_ACOK_OD
-#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
-#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
-#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
-#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
-#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
-#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
-#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
-#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
-#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
-#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
-#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
-#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
-#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
-#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
-#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
-#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
-#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
-#define GPIO_WP_L GPIO_EC_WP_L
-#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
+#define CONFIG_BATTERY_PRESENT_GPIO GPIO_EC_BATT_PRES_ODL
+#define CONFIG_SCI_GPIO GPIO_EC_FCH_SCI_ODL
+#define GPIO_AC_PRESENT GPIO_ACOK_OD
+#define GPIO_CPU_PROCHOT GPIO_PROCHOT_ODL
+#define GPIO_EC_INT_L GPIO_EC_AP_INT_ODL
+#define GPIO_ENABLE_BACKLIGHT_L GPIO_EC_EDP_BL_DISABLE
+#define GPIO_ENTERING_RW GPIO_EC_ENTERING_RW
+#define GPIO_KBD_KSO2 GPIO_EC_KSO_02_INV
+#define GPIO_PCH_PWRBTN_L GPIO_EC_FCH_PWR_BTN_L
+#define GPIO_PCH_RSMRST_L GPIO_EC_FCH_RSMRST_L
+#define GPIO_PCH_SLP_S3_L GPIO_SLP_S3_L
+#define GPIO_PCH_SLP_S5_L GPIO_SLP_S5_L
+#define GPIO_PCH_SYS_PWROK GPIO_EC_FCH_PWROK
+#define GPIO_PCH_WAKE_L GPIO_EC_FCH_WAKE_L
+#define GPIO_POWER_BUTTON_L GPIO_EC_PWR_BTN_ODL
+#define GPIO_S0_PGOOD GPIO_S0_PWROK_OD
+#define GPIO_S5_PGOOD GPIO_EC_PWROK_OD
+#define GPIO_SYS_RESET_L GPIO_EC_SYS_RST_L
+#define GPIO_VOLUME_DOWN_L GPIO_VOLDN_BTN_ODL
+#define GPIO_VOLUME_UP_L GPIO_VOLUP_BTN_ODL
+#define GPIO_WP_L GPIO_EC_WP_L
+#define GPIO_PACKET_MODE_EN GPIO_EC_H1_PACKET_MODE
#ifndef __ASSEMBLER__
-enum adc_channel {
- ADC_TEMP_SENSOR_CHARGER,
- ADC_TEMP_SENSOR_SOC,
- ADC_CH_COUNT
-};
+enum adc_channel { ADC_TEMP_SENSOR_CHARGER, ADC_TEMP_SENSOR_SOC, ADC_CH_COUNT };
enum battery_type {
BATTERY_C536,
@@ -92,11 +88,7 @@ enum mft_channel {
MFT_CH_COUNT,
};
-enum pwm_channel {
- PWM_CH_KBLIGHT = 0,
- PWM_CH_FAN,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT = 0, PWM_CH_FAN, PWM_CH_COUNT };
enum temp_sensor_id {
TEMP_SENSOR_CHARGER = 0,
@@ -105,10 +97,7 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum usba_port {
- USBA_PORT_A0 = 0,
- USBA_PORT_COUNT
-};
+enum usba_port { USBA_PORT_A0 = 0, USBA_PORT_COUNT };
/*****************************************************************************
* CBI EC FW Configuration
@@ -156,40 +145,32 @@ enum ec_cfg_usb_db_type {
#include "cbi_ec_fw_config.h"
-#define HAS_USBC1_RETIMER_PS8802 \
- (BIT(WOOMAX_DB_T_OPT3_USBAC_HDMI_MSTHUB))
+#define HAS_USBC1_RETIMER_PS8802 (BIT(WOOMAX_DB_T_OPT3_USBAC_HDMI_MSTHUB))
static inline bool ec_config_has_usbc1_retimer_ps8802(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8802);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8802);
}
-#define HAS_USBC1_RETIMER_PS8818 \
- (BIT(WOOMAX_DB_T_OPT1_USBAC_HMDI))
+#define HAS_USBC1_RETIMER_PS8818 (BIT(WOOMAX_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_usbc1_retimer_ps8818(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_USBC1_RETIMER_PS8818);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_USBC1_RETIMER_PS8818);
}
-#define HAS_HDMI_RETIMER_PI3HDX1204 \
- (BIT(WOOMAX_DB_T_OPT1_USBAC_HMDI))
+#define HAS_HDMI_RETIMER_PI3HDX1204 (BIT(WOOMAX_DB_T_OPT1_USBAC_HMDI))
static inline bool ec_config_has_hdmi_retimer_pi3hdx1204(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_HDMI_RETIMER_PI3HDX1204);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_HDMI_RETIMER_PI3HDX1204);
}
-#define HAS_MST_HUB_RTD2141B \
- (BIT(WOOMAX_DB_T_OPT3_USBAC_HDMI_MSTHUB))
+#define HAS_MST_HUB_RTD2141B (BIT(WOOMAX_DB_T_OPT3_USBAC_HDMI_MSTHUB))
static inline bool ec_config_has_mst_hub_rtd2141b(void)
{
- return !!(BIT(ec_config_get_usb_db()) &
- HAS_MST_HUB_RTD2141B);
+ return !!(BIT(ec_config_get_usb_db()) & HAS_MST_HUB_RTD2141B);
}
/**
@@ -206,9 +187,9 @@ static inline bool ec_config_has_mst_hub_rtd2141b(void)
int board_usbc_port_to_hpd_gpio_or_ioex(int port);
#define PORT_TO_HPD(port) board_usbc_port_to_hpd_gpio_or_ioex(port)
-extern const struct usb_mux usbc0_pi3dpx1207_usb_retimer;
-extern const struct usb_mux usbc1_ps8802;
+extern const struct usb_mux_chain usbc0_pi3dpx1207_usb_retimer;
extern const struct usb_mux usbc1_ps8818;
+extern struct usb_mux usbc1_ps8802;
extern struct usb_mux usbc1_amd_fp5_usb_mux;
void hdmi_hpd_interrupt(enum gpio_signal signal);
void motion_interrupt(enum gpio_signal signal);
diff --git a/board/woomax/build.mk b/board/woomax/build.mk
index a674573a4d..61be1882bf 100644
--- a/board/woomax/build.mk
+++ b/board/woomax/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2020 The Chromium OS Authors. All rights reserved.
+# Copyright 2020 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/woomax/ec.tasklist b/board/woomax/ec.tasklist
index d9c1606eb2..abc796f74f 100644
--- a/board/woomax/ec.tasklist
+++ b/board/woomax/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/woomax/gpio.inc b/board/woomax/gpio.inc
index ade15d3d4a..f085134b2e 100644
--- a/board/woomax/gpio.inc
+++ b/board/woomax/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2020 The Chromium OS Authors. All rights reserved.
+ * Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/woomax/led.c b/board/woomax/led.c
index 4c229d86f5..9a761bde38 100644
--- a/board/woomax/led.c
+++ b/board/woomax/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -17,29 +17,37 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 95;
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 1 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_WHITE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_WHITE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 1 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_WHITE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ };
__override const struct led_descriptor
- led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
- [PWR_LED_STATE_ON] = {{EC_LED_COLOR_WHITE, LED_INDEFINITE} },
- [PWR_LED_STATE_SUSPEND_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_SUSPEND_NO_AC] = {{EC_LED_COLOR_WHITE, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [PWR_LED_STATE_OFF] = {{LED_OFF, LED_INDEFINITE} },
-};
-
+ led_pwr_state_table[PWR_LED_NUM_STATES][LED_NUM_PHASES] = {
+ [PWR_LED_STATE_ON] = { { EC_LED_COLOR_WHITE, LED_INDEFINITE } },
+ [PWR_LED_STATE_SUSPEND_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_SUSPEND_NO_AC] = { { EC_LED_COLOR_WHITE,
+ 1 * LED_ONE_SEC },
+ { LED_OFF,
+ 3 * LED_ONE_SEC } },
+ [PWR_LED_STATE_OFF] = { { LED_OFF, LED_INDEFINITE } },
+ };
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_BATTERY_LED,
diff --git a/board/woomax/thermal.c b/board/woomax/thermal.c
index 98a46aad11..a2ab52cc74 100644
--- a/board/woomax/thermal.c
+++ b/board/woomax/thermal.c
@@ -1,4 +1,4 @@
-/* Copyright 2020 The Chromium OS Authors. All rights reserved.
+/* Copyright 2020 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -16,7 +16,7 @@
/* Console output macros */
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
-#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ##args)
struct fan_step {
/*
@@ -38,56 +38,56 @@ struct fan_step {
static const struct fan_step fan_step_table[] = {
{
/* level 0 */
- .on = {-1, -1, 36},
- .off = {-1, -1, 99},
+ .on = { -1, -1, 36 },
+ .off = { -1, -1, 99 },
.rpm = 0,
},
{
/* level 1 */
- .on = {-1, -1, 40},
- .off = {-1, -1, 32},
+ .on = { -1, -1, 40 },
+ .off = { -1, -1, 32 },
.rpm = 2244,
},
{
/* level 2 */
- .on = {-1, -1, 45},
- .off = {-1, -1, 35},
+ .on = { -1, -1, 45 },
+ .off = { -1, -1, 35 },
.rpm = 2580,
},
{
/* level 3 */
- .on = {-1, -1, 50},
- .off = {-1, -1, 40},
+ .on = { -1, -1, 50 },
+ .off = { -1, -1, 40 },
.rpm = 2824,
},
{
/* level 4 */
- .on = {-1, -1, 55},
- .off = {-1, -1, 45},
+ .on = { -1, -1, 55 },
+ .off = { -1, -1, 45 },
.rpm = 3120,
},
{
/* level 5 */
- .on = {-1, -1, 60},
- .off = {-1, -1, 50},
+ .on = { -1, -1, 60 },
+ .off = { -1, -1, 50 },
.rpm = 3321,
},
{
/* level 6 */
- .on = {-1, -1, 70},
- .off = {-1, -1, 55},
+ .on = { -1, -1, 70 },
+ .off = { -1, -1, 55 },
.rpm = 3780,
},
{
/* level 7 */
- .on = {-1, -1, 80},
- .off = {-1, -1, 60},
+ .on = { -1, -1, 80 },
+ .off = { -1, -1, 60 },
.rpm = 4330,
},
{
/* level 8 */
- .on = {-1, -1, 99},
- .off = {-1, -1, 74},
+ .on = { -1, -1, 99 },
+ .off = { -1, -1, 74 },
.rpm = 4915,
},
};
@@ -109,11 +109,11 @@ int fan_table_to_rpm(int fan, int *temp)
*/
if (temp[TEMP_SENSOR_CPU] < prev_tmp[TEMP_SENSOR_CPU]) {
if (temp[TEMP_SENSOR_CPU] <
- fan_step_table[current_level].off[TEMP_SENSOR_CPU])
+ fan_step_table[current_level].off[TEMP_SENSOR_CPU])
current_level = current_level - 1;
} else if (temp[TEMP_SENSOR_CPU] > prev_tmp[TEMP_SENSOR_CPU]) {
if (temp[TEMP_SENSOR_CPU] >
- fan_step_table[current_level].on[TEMP_SENSOR_CPU])
+ fan_step_table[current_level].on[TEMP_SENSOR_CPU])
current_level = current_level + 1;
}
@@ -130,10 +130,8 @@ int fan_table_to_rpm(int fan, int *temp)
void board_override_fan_control(int fan, int *tmp)
{
- if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND)) {
+ if (chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND)) {
fan_set_rpm_mode(FAN_CH(fan), 1);
- fan_set_rpm_target(FAN_CH(fan),
- fan_table_to_rpm(fan, tmp));
+ fan_set_rpm_target(FAN_CH(fan), fan_table_to_rpm(fan, tmp));
}
}
diff --git a/board/wormdingler/base_detect.c b/board/wormdingler/base_detect.c
index 87d6ab8046..dca23b4d2e 100644
--- a/board/wormdingler/base_detect.c
+++ b/board/wormdingler/base_detect.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -19,8 +19,8 @@
#include "timer.h"
#include "util.h"
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ##args)
/* Make sure POGO VBUS starts later then PP3300_HUB when power on */
#define BASE_DETECT_EN_LATER_US (600 * MSEC)
@@ -95,8 +95,8 @@ static uint32_t pulse_width;
static void print_base_detect_value(int v, int tmp_pulse_width)
{
- CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name,
- v, tmp_pulse_width);
+ CPRINTS("%s = %d (pulse %d)", adc_channels[ADC_BASE_DET].name, v,
+ tmp_pulse_width);
}
static void base_detect_deferred(void)
@@ -187,8 +187,7 @@ static void base_enable(void)
{
/* Enable base detection interrupt. */
base_detect_debounce_time = get_time().val;
- hook_call_deferred(&base_detect_deferred_data,
- BASE_DETECT_EN_LATER_US);
+ hook_call_deferred(&base_detect_deferred_data, BASE_DETECT_EN_LATER_US);
gpio_enable_interrupt(GPIO_BASE_DET_L);
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, base_enable, HOOK_PRIO_DEFAULT);
@@ -214,7 +213,7 @@ static void base_init(void)
if (system_jumped_late() && chipset_in_state(CHIPSET_STATE_ON))
base_enable();
}
-DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT+1);
+DECLARE_HOOK(HOOK_INIT, base_init, HOOK_PRIO_DEFAULT + 1);
void base_force_state(enum ec_set_base_state_cmd state)
{
diff --git a/board/wormdingler/battery.c b/board/wormdingler/battery.c
index bb444e59ee..001cd0474b 100644
--- a/board/wormdingler/battery.c
+++ b/board/wormdingler/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/wormdingler/board.c b/board/wormdingler/board.c
index 4ece983255..3c4dfe4b3c 100644
--- a/board/wormdingler/board.c
+++ b/board/wormdingler/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,10 +39,10 @@
#include "task.h"
#include "usbc_ppc.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
+#define KS_DEBOUNCE_US (30 * MSEC) /* Debounce time for kickstand switch */
/* Forward declaration */
static void tcpc_alert_event(enum gpio_signal signal);
@@ -119,41 +119,31 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {
- .name = "power",
- .port = I2C_PORT_POWER,
- .kbps = 100,
- .scl = GPIO_EC_I2C_POWER_SCL,
- .sda = GPIO_EC_I2C_POWER_SDA
- },
- {
- .name = "tcpc0",
- .port = I2C_PORT_TCPC0,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C0_PD_SDA
- },
- {
- .name = "tcpc1",
- .port = I2C_PORT_TCPC1,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
- .sda = GPIO_EC_I2C_USB_C1_PD_SDA
- },
- {
- .name = "eeprom",
- .port = I2C_PORT_EEPROM,
- .kbps = 400,
- .scl = GPIO_EC_I2C_EEPROM_SCL,
- .sda = GPIO_EC_I2C_EEPROM_SDA
- },
- {
- .name = "sensor",
- .port = I2C_PORT_SENSOR,
- .kbps = 400,
- .scl = GPIO_EC_I2C_SENSOR_SCL,
- .sda = GPIO_EC_I2C_SENSOR_SDA
- },
+ { .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_POWER_SCL,
+ .sda = GPIO_EC_I2C_POWER_SDA },
+ { .name = "tcpc0",
+ .port = I2C_PORT_TCPC0,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PD_SDA },
+ { .name = "tcpc1",
+ .port = I2C_PORT_TCPC1,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_PD_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_PD_SDA },
+ { .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA },
+ { .name = "sensor",
+ .port = I2C_PORT_SENSOR,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_SENSOR_SCL,
+ .sda = GPIO_EC_I2C_SENSOR_SDA },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
@@ -161,45 +151,25 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
/* ADC channels */
const struct adc_t adc_channels[] = {
/* Measure VBUS through a 1/10 voltage divider */
- [ADC_VBUS] = {
- "VBUS",
- NPCX_ADC_CH1,
- ADC_MAX_VOLT * 10,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_VBUS] = { "VBUS", NPCX_ADC_CH1, ADC_MAX_VOLT * 10,
+ ADC_READ_MAX + 1, 0 },
/*
* Adapter current output or battery charging/discharging current (uV)
* 18x amplification on charger side.
*/
- [ADC_AMON_BMON] = {
- "AMON_BMON",
- NPCX_ADC_CH2,
- ADC_MAX_VOLT * 1000 / 18,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_AMON_BMON] = { "AMON_BMON", NPCX_ADC_CH2, ADC_MAX_VOLT * 1000 / 18,
+ ADC_READ_MAX + 1, 0 },
/*
* ISL9238 PSYS output is 1.44 uA/W over 5.6K resistor, to read
* 0.8V @ 99 W, i.e. 124000 uW/mV. Using ADC_MAX_VOLT*124000 and
* ADC_READ_MAX+1 as multiplier/divider leads to overflows, so we
* only divide by 2 (enough to avoid precision issues).
*/
- [ADC_PSYS] = {
- "PSYS",
- NPCX_ADC_CH3,
- ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1),
- 2,
- 0
- },
+ [ADC_PSYS] = { "PSYS", NPCX_ADC_CH3,
+ ADC_MAX_VOLT * 124000 * 2 / (ADC_READ_MAX + 1), 2, 0 },
/* Base detection */
- [ADC_BASE_DET] = {
- "BASE_DET",
- NPCX_ADC_CH5,
- ADC_MAX_VOLT,
- ADC_READ_MAX + 1,
- 0
- },
+ [ADC_BASE_DET] = { "BASE_DET", NPCX_ADC_CH5, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
@@ -217,16 +187,12 @@ const struct ln9310_config_t ln9310_config = {
/* Power Path Controller */
struct ppc_config_t ppc_chips[] = {
- {
- .i2c_port = I2C_PORT_TCPC0,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
- {
- .i2c_port = I2C_PORT_TCPC1,
- .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
- .drv = &sn5s330_drv
- },
+ { .i2c_port = I2C_PORT_TCPC0,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
+ { .i2c_port = I2C_PORT_TCPC1,
+ .i2c_addr_flags = SN5S330_ADDR0_FLAGS,
+ .drv = &sn5s330_drv },
};
unsigned int ppc_cnt = ARRAY_SIZE(ppc_chips);
@@ -257,16 +223,22 @@ const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
* to AP. But the TCPC chip is also needed to know the HPD status; otherwise,
* the mux misbehaves.
*/
-const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+const struct usb_mux_chain usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
{
- .usb_port = 0,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 0,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
},
{
- .usb_port = 1,
- .driver = &tcpci_tcpm_usb_mux_driver,
- .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ .mux =
+ &(const struct usb_mux){
+ .usb_port = 1,
+ .driver = &tcpci_tcpm_usb_mux_driver,
+ .hpd_update = &ps8xxx_tcpc_update_hpd_status,
+ },
}
};
@@ -297,17 +269,13 @@ enum lid_accelgyro_type {
static enum lid_accelgyro_type lid_accelgyro_config;
/* Matrix to rotate accelerometer into standard reference frame */
-const mat33_fp_t lid_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref = { { FLOAT_TO_FP(1), 0, 0 },
+ { 0, FLOAT_TO_FP(1), 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
-const mat33_fp_t lid_standard_ref_icm42607 = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t lid_standard_ref_icm42607 = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
struct motion_sensor_t icm42607_lid_accel = {
.name = "Lid Accel",
@@ -501,7 +469,7 @@ void board_tcpc_init(void)
*/
for (int port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; ++port)
usb_mux_hpd_update(port, USB_PD_MUX_HPD_LVL_DEASSERTED |
- USB_PD_MUX_HPD_IRQ_DEASSERTED);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_I2C + 1);
@@ -513,8 +481,7 @@ void board_hibernate(void)
* Sensors are unpowered in hibernate. Apply PD to the
* interrupt lines such that they don't float.
*/
- gpio_set_flags(GPIO_ACCEL_GYRO_INT_L,
- GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_ACCEL_GYRO_INT_L, GPIO_INPUT | GPIO_PULL_DOWN);
/*
* Board rev 1+ has the hardware fix. Don't need the following
@@ -611,8 +578,7 @@ void board_overcurrent_event(int port, int is_overcurrented)
int board_set_active_charge_port(int port)
{
- int is_real_port = (port >= 0 &&
- port < CONFIG_USB_PD_PORT_MAX_COUNT);
+ int is_real_port = (port >= 0 && port < CONFIG_USB_PD_PORT_MAX_COUNT);
int i;
if (!is_real_port && port != CHARGE_PORT_NONE)
@@ -663,24 +629,22 @@ int board_set_active_charge_port(int port)
return EC_SUCCESS;
}
-void board_set_charge_limit(int port, int supplier, int charge_ma,
- int max_ma, int charge_mv)
+void board_set_charge_limit(int port, int supplier, int charge_ma, int max_ma,
+ int charge_mv)
{
/*
* Ignore lower charge ceiling on PD transition if our battery is
* critical, as we may brownout.
*/
- if (supplier == CHARGE_SUPPLIER_PD &&
- charge_ma < 1500 &&
+ if (supplier == CHARGE_SUPPLIER_PD && charge_ma < 1500 &&
charge_get_percent() < CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON) {
CPRINTS("Using max ilim %d", max_ma);
charge_ma = max_ma;
}
charge_ma = charge_ma * 95 / 100;
- charge_set_input_current_limit(MAX(charge_ma,
- CONFIG_CHARGER_INPUT_CURRENT),
- charge_mv);
+ charge_set_input_current_limit(
+ MAX(charge_ma, CONFIG_CHARGER_INPUT_CURRENT), charge_mv);
}
uint16_t tcpc_get_alert_status(void)
diff --git a/board/wormdingler/board.h b/board/wormdingler/board.h
index e6415bccce..3c3ba6ead5 100644
--- a/board/wormdingler/board.h
+++ b/board/wormdingler/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -13,13 +13,13 @@
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
-#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
+#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
/* Switchcap */
#define CONFIG_LN9310
/* Battery */
-#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
+#define CONFIG_BATTERY_DEVICE_CHEMISTRY "LION"
#define CONFIG_BATTERY_REVIVE_DISCONNECT
#define CONFIG_BATTERY_FUEL_GAUGE
#define CONFIG_BATTERY_VENDOR_PARAM
@@ -80,10 +80,7 @@ enum sensor_id {
SENSOR_COUNT,
};
-enum pwm_channel {
- PWM_CH_DISPLIGHT = 0,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_DISPLIGHT = 0, PWM_CH_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/wormdingler/build.mk b/board/wormdingler/build.mk
index 452abeb591..363ef59a16 100644
--- a/board/wormdingler/build.mk
+++ b/board/wormdingler/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2021 The Chromium OS Authors. All rights reserved.
+# Copyright 2021 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/wormdingler/ec.tasklist b/board/wormdingler/ec.tasklist
index ea2aaa97f5..8fc8115afc 100644
--- a/board/wormdingler/ec.tasklist
+++ b/board/wormdingler/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/wormdingler/gpio.inc b/board/wormdingler/gpio.inc
index 77a69a5faa..37e71977ac 100644
--- a/board/wormdingler/gpio.inc
+++ b/board/wormdingler/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2021 The Chromium OS Authors. All rights reserved.
+ * Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/wormdingler/led.c b/board/wormdingler/led.c
index 40de6257fa..c314d584c3 100644
--- a/board/wormdingler/led.c
+++ b/board/wormdingler/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -36,15 +36,15 @@ enum led_color {
LED_RED,
LED_GREEN,
LED_AMBER,
- LED_COLOR_COUNT /* Number of colors, not a color itself */
+ LED_COLOR_COUNT /* Number of colors, not a color itself */
};
static void led_set_color(enum led_color color)
{
gpio_set_level(GPIO_EC_CHG_LED_R_C0,
- (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_RED) ? BAT_LED_ON : BAT_LED_OFF);
gpio_set_level(GPIO_EC_CHG_LED_G_C0,
- (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
+ (color == LED_GREEN) ? BAT_LED_ON : BAT_LED_OFF);
if (color == LED_AMBER) {
gpio_set_level(GPIO_EC_CHG_LED_R_C0, BAT_LED_ON);
gpio_set_level(GPIO_EC_CHG_LED_G_C0, BAT_LED_ON);
@@ -78,7 +78,6 @@ static void board_led_set_battery(void)
int color = LED_OFF;
int period = 0;
int percent = DIV_ROUND_NEAREST(charge_get_display_charge(), 10);
- uint32_t chflags = charge_get_flags();
battery_ticks++;
@@ -86,13 +85,13 @@ static void board_led_set_battery(void)
case PWR_STATE_CHARGE:
case PWR_STATE_CHARGE_NEAR_FULL:
if (chipset_in_state(CHIPSET_STATE_ON |
- CHIPSET_STATE_ANY_SUSPEND |
- CHIPSET_STATE_ANY_OFF)) {
+ CHIPSET_STATE_ANY_SUSPEND |
+ CHIPSET_STATE_ANY_OFF)) {
if (percent <= BATTERY_LEVEL_CRITICAL) {
/* battery capa <= 5%, Red */
color = LED_RED;
} else if (percent > BATTERY_LEVEL_CRITICAL &&
- percent < BATTERY_LEVEL_NEAR_FULL) {
+ percent < BATTERY_LEVEL_NEAR_FULL) {
/* 5% < battery capa < 97%, Orange */
color = LED_AMBER;
} else {
@@ -102,8 +101,8 @@ static void board_led_set_battery(void)
}
break;
case PWR_STATE_DISCHARGE:
- /* Always indicate off on when discharging */
- color = LED_OFF;
+ /* Always indicate off on when discharging */
+ color = LED_OFF;
break;
case PWR_STATE_ERROR:
/* Battery error, Red on 1sec off 1sec */
@@ -115,16 +114,16 @@ static void board_led_set_battery(void)
color = LED_OFF;
break;
case PWR_STATE_IDLE: /* External power connected in IDLE */
- if (chflags & CHARGE_FLAG_FORCE_IDLE) {
- /* Factory mode, Red 2 sec, green 2 sec */
- period = (2 + 2) * LED_ONE_SEC;
- battery_ticks = battery_ticks % period;
- if (battery_ticks < 2 * LED_ONE_SEC)
- color = LED_RED;
- else
- color = LED_GREEN;
- } else
+ color = LED_RED;
+ break;
+ case PWR_STATE_FORCED_IDLE:
+ /* Factory mode, Red 2 sec, green 2 sec */
+ period = (2 + 2) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 2 * LED_ONE_SEC)
color = LED_RED;
+ else
+ color = LED_GREEN;
break;
default:
/* Other states don't alter LED behavior */
@@ -147,7 +146,7 @@ void led_control(enum ec_led_id led_id, enum ec_led_state state)
enum led_color color;
if ((led_id != EC_LED_ID_RECOVERY_HW_REINIT_LED) &&
- (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
+ (led_id != EC_LED_ID_SYSRQ_DEBUG_LED))
return;
if (state == LED_STATE_RESET) {
diff --git a/board/wormdingler/usbc_config.c b/board/wormdingler/usbc_config.c
index aac136415d..5d30adb6e2 100644
--- a/board/wormdingler/usbc_config.c
+++ b/board/wormdingler/usbc_config.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -11,8 +11,8 @@
#include "console.h"
#include "usb_pd.h"
-#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTF(format, args...) cprintf(CC_USBCHARGE, format, ##args)
const struct charger_config_t chg_chips[] = {
{
diff --git a/board/yorp/battery.c b/board/yorp/battery.c
index 1d8ec33d3d..d391942ab3 100644
--- a/board/yorp/battery.c
+++ b/board/yorp/battery.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
diff --git a/board/yorp/board.c b/board/yorp/board.c
index 137100aec3..475ced087c 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -38,10 +38,10 @@
#include "usbc_ppc.h"
#include "util.h"
-#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ## args)
-#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ## args)
+#define CPRINTSUSB(format, args...) cprints(CC_USBCHARGE, format, ##args)
+#define CPRINTFUSB(format, args...) cprintf(CC_USBCHARGE, format, ##args)
-#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args)
+#define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ##args)
static void ppc_interrupt(enum gpio_signal signal)
{
@@ -64,26 +64,26 @@ static void ppc_interrupt(enum gpio_signal signal)
/* ADC channels */
const struct adc_t adc_channels[] = {
- [ADC_TEMP_SENSOR_AMB] = {
- "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
- [ADC_TEMP_SENSOR_CHARGER] = {
- "TEMP_CHARGER", NPCX_ADC_CH1, ADC_MAX_VOLT, ADC_READ_MAX+1, 0},
+ [ADC_TEMP_SENSOR_AMB] = { "TEMP_AMB", NPCX_ADC_CH0, ADC_MAX_VOLT,
+ ADC_READ_MAX + 1, 0 },
+ [ADC_TEMP_SENSOR_CHARGER] = { "TEMP_CHARGER", NPCX_ADC_CH1,
+ ADC_MAX_VOLT, ADC_READ_MAX + 1, 0 },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct temp_sensor_t temp_sensors[] = {
- [TEMP_SENSOR_BATTERY] = {.name = "Battery",
- .type = TEMP_SENSOR_TYPE_BATTERY,
- .read = charge_get_battery_temp,
- .idx = 0},
- [TEMP_SENSOR_AMBIENT] = {.name = "Ambient",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_51k1_47k_4050b,
- .idx = ADC_TEMP_SENSOR_AMB},
- [TEMP_SENSOR_CHARGER] = {.name = "Charger",
- .type = TEMP_SENSOR_TYPE_BOARD,
- .read = get_temp_3v3_13k7_47k_4050b,
- .idx = ADC_TEMP_SENSOR_CHARGER},
+ [TEMP_SENSOR_BATTERY] = { .name = "Battery",
+ .type = TEMP_SENSOR_TYPE_BATTERY,
+ .read = charge_get_battery_temp,
+ .idx = 0 },
+ [TEMP_SENSOR_AMBIENT] = { .name = "Ambient",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_51k1_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_AMB },
+ [TEMP_SENSOR_CHARGER] = { .name = "Charger",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_13k7_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_CHARGER },
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
@@ -93,11 +93,9 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Matrix to rotate accelrator into standard reference frame */
-const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(-1), 0},
- { FLOAT_TO_FP(1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
+const mat33_fp_t base_standard_ref = { { 0, FLOAT_TO_FP(-1), 0 },
+ { FLOAT_TO_FP(1), 0, 0 },
+ { 0, 0, FLOAT_TO_FP(1) } };
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
@@ -191,14 +189,14 @@ static void board_init(void)
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-void board_hibernate_late(void) {
-
+void board_hibernate_late(void)
+{
int i;
const uint32_t hibernate_pins[][2] = {
/* Turn off LEDs before going to hibernate */
- {GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP},
- {GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP},
+ { GPIO_BAT_LED_BLUE_L, GPIO_INPUT | GPIO_PULL_UP },
+ { GPIO_BAT_LED_ORANGE_L, GPIO_INPUT | GPIO_PULL_UP },
};
for (i = 0; i < ARRAY_SIZE(hibernate_pins); ++i)
@@ -220,7 +218,7 @@ static void post_old_board_warning(void)
* warning.
*/
CPRINTS("\n\n\n ***** BOARD ID 0 is not officially supported!!! *****"
- "\n\n\n");
+ "\n\n\n");
}
DECLARE_HOOK(HOOK_INIT, post_old_board_warning, HOOK_PRIO_INIT_I2C + 1);
#endif
diff --git a/board/yorp/board.h b/board/yorp/board.h
index 7e4dea76df..8ffb6d2781 100644
--- a/board/yorp/board.h
+++ b/board/yorp/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -26,8 +26,8 @@
#define CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT
/* Sensors */
-#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCEL_KX022 /* Lid accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
@@ -50,8 +50,8 @@
#include "registers.h"
enum adc_channel {
- ADC_TEMP_SENSOR_AMB, /* ADC0 */
- ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
+ ADC_TEMP_SENSOR_AMB, /* ADC0 */
+ ADC_TEMP_SENSOR_CHARGER, /* ADC1 */
ADC_CH_COUNT
};
@@ -62,18 +62,10 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
-enum pwm_channel {
- PWM_CH_KBLIGHT,
- PWM_CH_COUNT
-};
+enum pwm_channel { PWM_CH_KBLIGHT, PWM_CH_COUNT };
/* Motion sensors */
-enum sensor_id {
- LID_ACCEL,
- BASE_ACCEL,
- BASE_GYRO,
- SENSOR_COUNT
-};
+enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, SENSOR_COUNT };
/* List of possible batteries */
enum battery_type {
diff --git a/board/yorp/build.mk b/board/yorp/build.mk
index 3d04b75731..998a65a3de 100644
--- a/board/yorp/build.mk
+++ b/board/yorp/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2018 The Chromium OS Authors. All rights reserved.
+# Copyright 2018 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/yorp/ec.tasklist b/board/yorp/ec.tasklist
index d98db145e7..977b8b01be 100644
--- a/board/yorp/ec.tasklist
+++ b/board/yorp/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/yorp/gpio.inc b/board/yorp/gpio.inc
index 9edd6107c6..b3dbf60ab8 100644
--- a/board/yorp/gpio.inc
+++ b/board/yorp/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2018 The Chromium OS Authors. All rights reserved.
+ * Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/yorp/led.c b/board/yorp/led.c
index 37ce7446b0..f8b9898046 100644
--- a/board/yorp/led.c
+++ b/board/yorp/led.c
@@ -1,4 +1,4 @@
-/* Copyright 2018 The Chromium OS Authors. All rights reserved.
+/* Copyright 2018 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*
@@ -10,8 +10,8 @@
#include "led_common.h"
#include "led_onoff_states.h"
-#define LED_OFF_LVL 1
-#define LED_ON_LVL 0
+#define LED_OFF_LVL 1
+#define LED_ON_LVL 0
__override const int led_charge_lvl_1;
@@ -19,19 +19,28 @@ __override const int led_charge_lvl_2 = 100;
/* Yorp: Note there is only LED for charge / power */
__override struct led_descriptor
- led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
- [STATE_CHARGING_LVL_1] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
- [STATE_CHARGING_LVL_2] = {{EC_LED_COLOR_AMBER, LED_INDEFINITE} },
- [STATE_CHARGING_FULL_CHARGE] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S0] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
- [STATE_DISCHARGE_S3] = {{EC_LED_COLOR_AMBER, 1 * LED_ONE_SEC},
- {LED_OFF, 3 * LED_ONE_SEC} },
- [STATE_DISCHARGE_S5] = {{LED_OFF, LED_INDEFINITE} },
- [STATE_BATTERY_ERROR] = {{EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC},
- {EC_LED_COLOR_AMBER, 2 * LED_ONE_SEC} },
- [STATE_FACTORY_TEST] = {{EC_LED_COLOR_BLUE, LED_INDEFINITE} },
-};
+ led_bat_state_table[LED_NUM_STATES][LED_NUM_PHASES] = {
+ [STATE_CHARGING_LVL_1] = { { EC_LED_COLOR_BLUE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ [STATE_CHARGING_LVL_2] = { { EC_LED_COLOR_AMBER,
+ LED_INDEFINITE } },
+ [STATE_CHARGING_FULL_CHARGE] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S0] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ [STATE_DISCHARGE_S3] = { { EC_LED_COLOR_AMBER,
+ 1 * LED_ONE_SEC },
+ { LED_OFF, 3 * LED_ONE_SEC } },
+ [STATE_DISCHARGE_S5] = { { LED_OFF, LED_INDEFINITE } },
+ [STATE_BATTERY_ERROR] = { { EC_LED_COLOR_BLUE,
+ 2 * LED_ONE_SEC },
+ { EC_LED_COLOR_AMBER,
+ 2 * LED_ONE_SEC } },
+ [STATE_FACTORY_TEST] = { { EC_LED_COLOR_BLUE,
+ LED_INDEFINITE } },
+ };
BUILD_ASSERT(ARRAY_SIZE(led_bat_state_table) == LED_NUM_STATES);
const enum ec_led_id supported_led_ids[] = { EC_LED_ID_BATTERY_LED };
diff --git a/board/zinger/board.c b/board/zinger/board.c
index f1249d6917..41d91ab438 100644
--- a/board/zinger/board.c
+++ b/board/zinger/board.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -21,8 +21,8 @@
static uint32_t rsa_workbuf[3 * RSANUMWORDS];
/* RW firmware reset vector */
-static uint32_t * const rw_rst =
- (uint32_t *)(CONFIG_PROGRAM_MEMORY_BASE+CONFIG_RW_MEM_OFF+4);
+static uint32_t *const rw_rst =
+ (uint32_t *)(CONFIG_PROGRAM_MEMORY_BASE + CONFIG_RW_MEM_OFF + 4);
/* External interrupt EXTINT7 for external comparator on PA7 */
static void pd_rx_interrupt(void)
@@ -57,8 +57,8 @@ static int check_rw_valid(void *rw_hash)
return 0;
good = rsa_verify((const struct rsa_public_key *)CONFIG_RO_PUBKEY_ADDR,
- (const uint8_t *)CONFIG_RW_SIG_ADDR,
- rw_hash, rsa_workbuf);
+ (const uint8_t *)CONFIG_RW_SIG_ADDR, rw_hash,
+ rsa_workbuf);
if (!good) {
debug_printf("RSA FAILED\n");
pd_log_event(PD_EVENT_ACC_RW_FAIL, 0, 0, NULL);
@@ -75,8 +75,7 @@ int main(void)
void *rw_hash;
hardware_init();
- debug_printf("%s started\n",
- is_ro_mode() ? "RO" : "RW");
+ debug_printf("%s started\n", is_ro_mode() ? "RO" : "RW");
/* the RO partition protection is not enabled : do it */
if (!flash_physical_is_permanently_protected())
diff --git a/board/zinger/board.h b/board/zinger/board.h
index 0be755eb5c..1ca83354bc 100644
--- a/board/zinger/board.h
+++ b/board/zinger/board.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -41,7 +41,7 @@
#undef CONFIG_FLASH_PHYSICAL
#undef CONFIG_FMAP
/* Not using pstate but keep some space for the public key */
-#undef CONFIG_FW_PSTATE_SIZE
+#undef CONFIG_FW_PSTATE_SIZE
#define CONFIG_FW_PSTATE_SIZE 544
#define CONFIG_HIBERNATE
#define CONFIG_HIBERNATE_WAKEUP_PINS STM32_PWR_CSR_EWUP1
@@ -59,7 +59,7 @@
#undef CONFIG_USB_PD_DUAL_ROLE
#undef CONFIG_USB_PD_INTERNAL_COMP
#define CONFIG_USB_PD_LOGGING
-#undef CONFIG_EVENT_LOG_SIZE
+#undef CONFIG_EVENT_LOG_SIZE
#define CONFIG_EVENT_LOG_SIZE 256
#define CONFIG_USB_PD_LOW_POWER_IDLE_WHEN_CONNECTED
#define CONFIG_USB_PD_PORT_MAX_COUNT 1
@@ -105,10 +105,11 @@ enum adc_channel {
#define ADC_CH_CC2_PD ADC_CH_CC1_PD
/* 3.0A Rp */
-#define PD_SRC_VNC (PD_SRC_3_0_VNC_MV * 4096 / 3300/* 12-bit ADC, 3.3V range */)
+#define PD_SRC_VNC \
+ (PD_SRC_3_0_VNC_MV * 4096 / 3300 /* 12-bit ADC, 3.3V range */)
/* delay necessary for the voltage transition on the power supply */
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
+#define PD_POWER_SUPPLY_TURN_ON_DELAY 50000 /* us */
#define PD_POWER_SUPPLY_TURN_OFF_DELAY 50000 /* us */
/* Initialize all useful registers */
diff --git a/board/zinger/build.mk b/board/zinger/build.mk
index c85eb9df4b..da1878efe9 100644
--- a/board/zinger/build.mk
+++ b/board/zinger/build.mk
@@ -1,5 +1,5 @@
# -*- makefile -*-
-# Copyright 2014 The Chromium OS Authors. All rights reserved.
+# Copyright 2014 The ChromiumOS Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
#
diff --git a/board/zinger/ec.irqlist b/board/zinger/ec.irqlist
index 690fa950fc..186c0f6338 100644
--- a/board/zinger/ec.irqlist
+++ b/board/zinger/ec.irqlist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/zinger/ec.tasklist b/board/zinger/ec.tasklist
index 091eb90a22..89d9ffab76 100644
--- a/board/zinger/ec.tasklist
+++ b/board/zinger/ec.tasklist
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/zinger/gpio.inc b/board/zinger/gpio.inc
index 6b96e08645..65e3066695 100644
--- a/board/zinger/gpio.inc
+++ b/board/zinger/gpio.inc
@@ -1,6 +1,6 @@
/* -*- mode:c -*-
*
- * Copyright 2022 The Chromium OS Authors. All rights reserved.
+ * Copyright 2022 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/zinger/hardware.c b/board/zinger/hardware.c
index 7e6e1f8f4c..0ad5b7ff94 100644
--- a/board/zinger/hardware.c
+++ b/board/zinger/hardware.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -39,16 +39,16 @@ static void power_init(void)
/* enable TIM2, TIM3, TIM14, PWR */
STM32_RCC_APB1ENR = 0x10000103;
/* enable DMA, SRAM, CRC, GPA, GPB, GPF */
- STM32_RCC_AHBENR = 0x460045;
+ STM32_RCC_AHBENR = 0x460045;
}
/* GPIO setting helpers */
-#define OUT(n) (1 << ((n) * 2))
-#define AF(n) (2 << ((n) * 2))
-#define ANALOG(n) (3 << ((n) * 2))
+#define OUT(n) (1 << ((n)*2))
+#define AF(n) (2 << ((n)*2))
+#define ANALOG(n) (3 << ((n)*2))
#define HIGH(n) (1 << (n))
#define ODR(n) (1 << (n))
-#define HISPEED(n) (3 << ((n) * 2))
+#define HISPEED(n) (3 << ((n)*2))
#define AFx(n, x) (x << (((n) % 8) * 4))
static void pins_init(void)
@@ -83,9 +83,9 @@ static void pins_init(void)
STM32_GPIO_AFRH(GPIO_A) = AFx(9, 1) | AFx(10, 1);
STM32_GPIO_OTYPER(GPIO_A) = ODR(4);
STM32_GPIO_OSPEEDR(GPIO_A) = HISPEED(5) | HISPEED(6) | HISPEED(7);
- STM32_GPIO_MODER(GPIO_A) = OUT(0) | ANALOG(1) | ANALOG(2) | ANALOG(3)
- | OUT(4) | AF(5) /*| AF(6)*/ | AF(7) | AF(9)
- | AF(10) | OUT(13) | OUT(14);
+ STM32_GPIO_MODER(GPIO_A) = OUT(0) | ANALOG(1) | ANALOG(2) | ANALOG(3) |
+ OUT(4) | AF(5) /*| AF(6)*/ | AF(7) | AF(9) |
+ AF(10) | OUT(13) | OUT(14);
/* set PF0 / PF1 as output */
STM32_GPIO_ODR(GPIO_F) = 0;
STM32_GPIO_MODER(GPIO_F) = OUT(0) | OUT(1);
@@ -107,7 +107,8 @@ static void adc_init(void)
;
}
/* Single conversion, right aligned, 12-bit */
- STM32_ADC_CFGR1 = BIT(12); /* BIT(15) => AUTOOFF */;
+ STM32_ADC_CFGR1 = BIT(12); /* BIT(15) => AUTOOFF */
+ ;
/* clock is ADCCLK (ADEN must be off when writing this reg) */
STM32_ADC_CFGR2 = 0;
/* Sampling time : 71.5 ADC clock cycles, about 5us */
@@ -132,8 +133,8 @@ static void uart_init(void)
STM32_USART_BRR(UARTN_BASE) =
DIV_ROUND_NEAREST(CPU_CLOCK, CONFIG_UART_BAUD_RATE);
/* UART enabled, 8 Data bits, oversampling x16, no parity */
- STM32_USART_CR1(UARTN_BASE) =
- STM32_USART_CR1_UE | STM32_USART_CR1_TE | STM32_USART_CR1_RE;
+ STM32_USART_CR1(UARTN_BASE) = STM32_USART_CR1_UE | STM32_USART_CR1_TE |
+ STM32_USART_CR1_RE;
/* 1 stop bit, no fancy stuff */
STM32_USART_CR2(UARTN_BASE) = 0x0000;
/* DMA disabled, special modes disabled, error interrupt disabled */
@@ -200,7 +201,7 @@ static int watchdog_ain_id, watchdog_ain_high, watchdog_ain_low;
static int adc_enable_last_watchdog(void)
{
return adc_enable_watchdog(watchdog_ain_id, watchdog_ain_high,
- watchdog_ain_low);
+ watchdog_ain_low);
}
static inline int adc_watchdog_enabled(void)
@@ -248,8 +249,7 @@ int adc_enable_watchdog(int ch, int high, int low)
/* Clear flags */
STM32_ADC_ISR = 0x8e;
/* Set Watchdog enable bit on a single channel / continuous mode */
- STM32_ADC_CFGR1 = (ch << 26) | BIT(23) | BIT(22)
- | BIT(13) | BIT(12);
+ STM32_ADC_CFGR1 = (ch << 26) | BIT(23) | BIT(22) | BIT(13) | BIT(12);
/* Enable watchdog interrupt */
STM32_ADC_IER = BIT(7);
/* Start continuous conversion */
@@ -289,17 +289,17 @@ int adc_disable_watchdog(void)
(FLASH_TIMEOUT_US * (CPU_CLOCK / SECOND) / CYCLE_PER_FLASH_LOOP)
/* Flash unlocking keys */
-#define KEY1 0x45670123
-#define KEY2 0xCDEF89AB
+#define KEY1 0x45670123
+#define KEY2 0xCDEF89AB
/* Lock bits for FLASH_CR register */
-#define PG BIT(0)
-#define PER BIT(1)
-#define OPTPG BIT(4)
-#define OPTER BIT(5)
-#define STRT BIT(6)
-#define CR_LOCK BIT(7)
-#define OPTWRE BIT(9)
+#define PG BIT(0)
+#define PER BIT(1)
+#define OPTPG BIT(4)
+#define OPTER BIT(5)
+#define STRT BIT(6)
+#define CR_LOCK BIT(7)
+#define OPTWRE BIT(9)
int crec_flash_physical_write(int offset, int size, const char *data)
{
@@ -369,14 +369,13 @@ int crec_flash_physical_erase(int offset, int size)
STM32_FLASH_CR |= PER;
for (; size > 0; size -= CONFIG_FLASH_ERASE_SIZE,
- offset += CONFIG_FLASH_ERASE_SIZE) {
+ offset += CONFIG_FLASH_ERASE_SIZE) {
int i;
/* select page to erase */
STM32_FLASH_AR = CONFIG_PROGRAM_MEMORY_BASE + offset;
/* set STRT bit : start erase */
STM32_FLASH_CR |= STRT;
-
/* Wait for erase to complete */
for (i = 0; (STM32_FLASH_SR & 1) && (i < FLASH_TIMEOUT_LOOP);
i++)
@@ -434,7 +433,6 @@ static void unlock_erase_optb(void)
STM32_FLASH_CR = OPTWRE;
}
-
static void write_optb(int byte, uint8_t value)
{
volatile int16_t *hword = (uint16_t *)(STM32_OPTB_BASE + byte);
@@ -475,6 +473,6 @@ int flash_physical_is_permanently_protected(void)
{
/* if RDP is still at level 0, the flash protection is not in place */
return (STM32_FLASH_OBR & STM32_FLASH_OBR_RDP_MASK) &&
- /* the low 16KB (RO partition) are write-protected */
- !(STM32_FLASH_WRPR & 0xF);
+ /* the low 16KB (RO partition) are write-protected */
+ !(STM32_FLASH_WRPR & 0xF);
}
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c
index 900c7b8c2f..19c33c7f0f 100644
--- a/board/zinger/runtime.c
+++ b/board/zinger/runtime.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -106,7 +106,7 @@ static void zinger_config_hispeed_clock(void)
STM32_RCC_CR |= BIT(24);
/* Wait for PLL to be ready */
while (!(STM32_RCC_CR & BIT(25)))
- ;
+ ;
/* switch SYSCLK to PLL */
STM32_RCC_CFGR = 0x00288002;
@@ -135,7 +135,7 @@ void runtime_init(void)
* SET_RTC_MATCH_DELAY: max time to set RTC match alarm. if we set the alarm
* in the past, it will never wake up and cause a watchdog.
*/
-#define STOP_MODE_LATENCY 300 /* us */
+#define STOP_MODE_LATENCY 300 /* us */
#define SET_RTC_MATCH_DELAY 200 /* us */
#define MAX_LATENCY (STOP_MODE_LATENCY + SET_RTC_MATCH_DELAY)
@@ -161,10 +161,10 @@ uint32_t task_wait_event(int timeout_us)
while (1) {
/* set timeout on timer */
if (timeout_us < 0) {
- asm volatile ("wfi");
+ asm volatile("wfi");
} else if (timeout_us <= MAX_LATENCY ||
- t1.le.lo - timeout_us > t1.le.lo + MAX_LATENCY ||
- !DEEP_SLEEP_ALLOWED) {
+ t1.le.lo - timeout_us > t1.le.lo + MAX_LATENCY ||
+ !DEEP_SLEEP_ALLOWED) {
STM32_TIM32_CCR1(2) = STM32_TIM32_CNT(2) + timeout_us;
STM32_TIM_DIER(2) = 3; /* match interrupt and UIE */
@@ -177,8 +177,8 @@ uint32_t task_wait_event(int timeout_us)
/* set deep sleep bit */
CPU_SCB_SYSCTRL |= 0x4;
- set_rtc_alarm(0, timeout_us - STOP_MODE_LATENCY,
- &rtc0, 0);
+ set_rtc_alarm(0, timeout_us - STOP_MODE_LATENCY, &rtc0,
+ 0);
asm volatile("wfi");
@@ -233,8 +233,7 @@ uint32_t task_wait_event_mask(uint32_t event_mask, int timeout_us)
return evt & event_mask;
}
-noreturn
-void __keep cpu_reset(void)
+noreturn void __keep cpu_reset(void)
{
/* Disable interrupts */
interrupt_disable();
@@ -267,7 +266,8 @@ void exception_panic(void)
"bl debug_printf\n"
#endif
"bl cpu_reset\n"
- : : "r"("PANIC PC=%08x LR=%08x\n\n"));
+ :
+ : "r"("PANIC PC=%08x LR=%08x\n\n"));
}
void panic_reboot(void)
@@ -286,7 +286,9 @@ enum ec_image system_get_image_copy(void)
/* --- stubs --- */
void __hw_timer_enable_clock(int n, int enable)
-{ /* Done in hardware init */ }
+{ /* Done in hardware init */
+}
void usleep(unsigned us)
-{ /* Used only as a workaround */ }
+{ /* Used only as a workaround */
+}
diff --git a/board/zinger/usb_pd_config.h b/board/zinger/usb_pd_config.h
index d0797b3d80..c3d86e2c2b 100644
--- a/board/zinger/usb_pd_config.h
+++ b/board/zinger/usb_pd_config.h
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -10,7 +10,7 @@
/* Timer selection for baseband PD communication */
#define TIM_CLOCK_PD_TX_C0 14
-#define TIM_CLOCK_PD_RX_C0 3
+#define TIM_CLOCK_PD_RX_C0 3
#define TIM_CLOCK_PD_TX(p) TIM_CLOCK_PD_TX_C0
#define TIM_CLOCK_PD_RX(p) TIM_CLOCK_PD_RX_C0
@@ -46,7 +46,7 @@ static inline void spi_enable_clock(int port)
#define TIM_TX_CCR_IDX(p) TIM_TX_CCR_C0
#define TIM_RX_CCR_IDX(p) TIM_RX_CCR_C0
/* connect TIM3 CH1 to TIM3_CH2 input */
-#define TIM_CCR_CS 2
+#define TIM_CCR_CS 2
#define EXTI_COMP_MASK(p) BIT(7)
#define IRQ_COMP STM32_IRQ_EXTI4_15
/* the RX is inverted, triggers on rising edge */
@@ -72,7 +72,7 @@ static inline void pd_tx_spi_reset(int port)
static inline void pd_tx_enable(int port, int polarity)
{
/* Drive SPI MISO on PA6 by putting it in AF mode */
- STM32_GPIO_MODER(GPIO_A) |= 0x2 << (2*6);
+ STM32_GPIO_MODER(GPIO_A) |= 0x2 << (2 * 6);
/* Drive TX GND on PA4 */
STM32_GPIO_BSRR(GPIO_A) = 1 << (4 + 16 /* Reset */);
}
@@ -83,7 +83,7 @@ static inline void pd_tx_disable(int port, int polarity)
/* Put TX GND (PA4) in Hi-Z state */
STM32_GPIO_BSRR(GPIO_A) = BIT(4) /* Set */;
/* Put SPI MISO (PA6) in Hi-Z by putting it in input mode */
- STM32_GPIO_MODER(GPIO_A) &= ~(0x3 << (2*6));
+ STM32_GPIO_MODER(GPIO_A) &= ~(0x3 << (2 * 6));
}
/* we know the plug polarity, do the right configuration */
@@ -98,7 +98,9 @@ static inline void pd_tx_init(void)
/* Already done in hardware_init() */
}
-static inline void pd_config_init(int port, uint8_t power_role) {}
+static inline void pd_config_init(int port, uint8_t power_role)
+{
+}
static inline int pd_adc_read(int port, int cc)
{
diff --git a/board/zinger/usb_pd_pdo.c b/board/zinger/usb_pd_pdo.c
index 13f8407d6d..36be87bd78 100644
--- a/board/zinger/usb_pd_pdo.c
+++ b/board/zinger/usb_pd_pdo.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,7 +9,7 @@
/* Power Delivery Objects */
const uint32_t pd_src_pdo[] = {
- [PDO_IDX_5V] = PDO_FIXED(5000, RATED_CURRENT, PDO_FIXED_FLAGS),
+ [PDO_IDX_5V] = PDO_FIXED(5000, RATED_CURRENT, PDO_FIXED_FLAGS),
[PDO_IDX_12V] = PDO_FIXED(12000, RATED_CURRENT, PDO_FIXED_FLAGS),
[PDO_IDX_20V] = PDO_FIXED(20000, RATED_CURRENT, PDO_FIXED_FLAGS),
};
diff --git a/board/zinger/usb_pd_pdo.h b/board/zinger/usb_pd_pdo.h
index 07b7129202..45f6668077 100644
--- a/board/zinger/usb_pd_pdo.h
+++ b/board/zinger/usb_pd_pdo.h
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* Copyright 2021 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c
index 08314e7aa6..7f60ce8772 100644
--- a/board/zinger/usb_pd_policy.c
+++ b/board/zinger/usb_pd_policy.c
@@ -1,4 +1,4 @@
-/* Copyright 2014 The Chromium OS Authors. All rights reserved.
+/* Copyright 2014 The ChromiumOS Authors
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
@@ -9,6 +9,7 @@
#include "debug_printf.h"
#include "ec_commands.h"
#include "hooks.h"
+#include "printf.h"
#include "registers.h"
#include "system.h"
#include "task.h"
@@ -20,15 +21,15 @@
/* ------------------------- Power supply control ------------------------ */
/* GPIO level setting helpers through BSRR register */
-#define GPIO_SET(n) (1 << (n))
+#define GPIO_SET(n) (1 << (n))
#define GPIO_RESET(n) (1 << ((n) + 16))
/* Output voltage selection */
enum volt {
- VO_5V = GPIO_RESET(13) | GPIO_RESET(14),
- VO_12V = GPIO_SET(13) | GPIO_RESET(14),
+ VO_5V = GPIO_RESET(13) | GPIO_RESET(14),
+ VO_12V = GPIO_SET(13) | GPIO_RESET(14),
VO_13V = GPIO_RESET(13) | GPIO_SET(14),
- VO_20V = GPIO_SET(13) | GPIO_SET(14),
+ VO_20V = GPIO_SET(13) | GPIO_SET(14),
};
static inline void set_output_voltage(enum volt v)
@@ -73,26 +74,27 @@ static timestamp_t fault_deadline;
/* ADC in 12-bit mode */
#define ADC_SCALE BIT(12)
/* ADC power supply : VDDA = 3.3V */
-#define VDDA_MV 3300
+#define VDDA_MV 3300
/* Current sense resistor : 5 milliOhm */
-#define R_SENSE 5
+#define R_SENSE 5
/* VBUS voltage is measured through 10k / 100k voltage divider = /11 */
-#define VOLT_DIV ((10+100)/10)
+#define VOLT_DIV ((10 + 100) / 10)
/* The current sensing op-amp has a x100 gain */
#define CURR_GAIN 100
/* convert VBUS voltage in raw ADC value */
-#define VBUS_MV(mv) ((mv)*ADC_SCALE/VOLT_DIV/VDDA_MV)
+#define VBUS_MV(mv) ((mv)*ADC_SCALE / VOLT_DIV / VDDA_MV)
/* convert VBUS current in raw ADC value */
-#define VBUS_MA(ma) ((ma)*ADC_SCALE*R_SENSE/1000*CURR_GAIN/VDDA_MV)
+#define VBUS_MA(ma) ((ma)*ADC_SCALE * R_SENSE / 1000 * CURR_GAIN / VDDA_MV)
/* convert raw ADC value to mA */
-#define ADC_TO_CURR_MA(vbus) ((vbus)*1000/(ADC_SCALE*R_SENSE)*VDDA_MV/CURR_GAIN)
+#define ADC_TO_CURR_MA(vbus) \
+ ((vbus)*1000 / (ADC_SCALE * R_SENSE) * VDDA_MV / CURR_GAIN)
/* convert raw ADC value to mV */
-#define ADC_TO_VOLT_MV(vbus) ((vbus)*VOLT_DIV*VDDA_MV/ADC_SCALE)
+#define ADC_TO_VOLT_MV(vbus) ((vbus)*VOLT_DIV * VDDA_MV / ADC_SCALE)
/* Max current : 20% over rated current */
-#define MAX_CURRENT VBUS_MA(RATED_CURRENT * 6/5)
+#define MAX_CURRENT VBUS_MA(RATED_CURRENT * 6 / 5)
/* Fast short circuit protection : 50% over rated current */
-#define MAX_CURRENT_FAST VBUS_MA(RATED_CURRENT * 3/2)
+#define MAX_CURRENT_FAST VBUS_MA(RATED_CURRENT * 3 / 2)
/* reset over-current after 1 second */
#define OCP_TIMEOUT SECOND
@@ -100,19 +102,19 @@ static timestamp_t fault_deadline;
#define SINK_IDLE_CURRENT VBUS_MA(500 /* mA */)
/* Under-voltage limit is 0.8x Vnom */
-#define UVP_MV(mv) VBUS_MV((mv) * 8 / 10)
+#define UVP_MV(mv) VBUS_MV((mv)*8 / 10)
/* Over-voltage limit is 1.2x Vnom */
-#define OVP_MV(mv) VBUS_MV((mv) * 12 / 10)
+#define OVP_MV(mv) VBUS_MV((mv)*12 / 10)
/* Over-voltage recovery threshold is 1.1x Vnom */
-#define OVP_REC_MV(mv) VBUS_MV((mv) * 11 / 10)
+#define OVP_REC_MV(mv) VBUS_MV((mv)*11 / 10)
/* Maximum discharging delay */
-#define DISCHARGE_TIMEOUT (275*MSEC)
+#define DISCHARGE_TIMEOUT (275 * MSEC)
/* Voltage overshoot below the OVP threshold for discharging to avoid OVP */
#define DISCHARGE_OVERSHOOT_MV VBUS_MV(200)
/* Time to wait after last RX edge interrupt before allowing deep sleep */
-#define PD_RX_SLEEP_TIMEOUT (100*MSEC)
+#define PD_RX_SLEEP_TIMEOUT (100 * MSEC)
/* ----- output voltage discharging ----- */
@@ -151,16 +153,15 @@ static void discharge_voltage(int target_volt)
/* PDO voltages (should match the table above) */
static const struct {
enum volt select; /* GPIO configuration to select the voltage */
- int uvp; /* under-voltage limit in mV */
- int ovp; /* over-voltage limit in mV */
- int ovp_rec;/* over-voltage recovery threshold in mV */
+ int uvp; /* under-voltage limit in mV */
+ int ovp; /* over-voltage limit in mV */
+ int ovp_rec; /* over-voltage recovery threshold in mV */
} voltages[ARRAY_SIZE(pd_src_pdo)] = {
- [PDO_IDX_5V] = {VO_5V, UVP_MV(5000), OVP_MV(5000),
- OVP_REC_MV(5000)},
- [PDO_IDX_12V] = {VO_12V, UVP_MV(12000), OVP_MV(12000),
- OVP_REC_MV(12000)},
- [PDO_IDX_20V] = {VO_20V, UVP_MV(20000), OVP_MV(20000),
- OVP_REC_MV(20000)},
+ [PDO_IDX_5V] = { VO_5V, UVP_MV(5000), OVP_MV(5000), OVP_REC_MV(5000) },
+ [PDO_IDX_12V] = { VO_12V, UVP_MV(12000), OVP_MV(12000),
+ OVP_REC_MV(12000) },
+ [PDO_IDX_20V] = { VO_20V, UVP_MV(20000), OVP_MV(20000),
+ OVP_REC_MV(20000) },
};
/* current and previous selected PDO entry */
@@ -199,8 +200,8 @@ void pd_transition_voltage(int idx)
/* Make sure discharging is disabled */
discharge_disable();
/* Enable over-current monitoring */
- adc_enable_watchdog(ADC_CH_A_SENSE,
- MAX_CURRENT_FAST, 0);
+ adc_enable_watchdog(ADC_CH_A_SENSE, MAX_CURRENT_FAST,
+ 0);
}
}
set_output_voltage(voltages[volt_idx].select);
@@ -241,28 +242,22 @@ void pd_power_supply_reset(int port)
}
}
-int pd_check_data_swap(int port,
- enum pd_data_role data_role)
+int pd_check_data_swap(int port, enum pd_data_role data_role)
{
/* Allow data swap if we are a DFP, otherwise don't allow */
return (data_role == PD_ROLE_DFP) ? 1 : 0;
}
-void pd_execute_data_swap(int port,
- enum pd_data_role data_role)
+void pd_execute_data_swap(int port, enum pd_data_role data_role)
{
/* Do nothing */
}
-void pd_check_pr_role(int port,
- enum pd_power_role pr_role,
- int flags)
+void pd_check_pr_role(int port, enum pd_power_role pr_role, int flags)
{
}
-void pd_check_dr_role(int port,
- enum pd_data_role dr_role,
- int flags)
+void pd_check_dr_role(int port, enum pd_data_role dr_role, int flags)
{
/* If DFP, try to switch to UFP */
if ((flags & PD_FLAGS_PARTNER_DR_DATA) && dr_role == PD_ROLE_DFP)
@@ -289,7 +284,7 @@ int pd_board_checks(void)
__enter_hibernate(0, 0);
}
} else {
- hib_to.val = get_time().val + 60*SECOND;
+ hib_to.val = get_time().val + 60 * SECOND;
hib_to_ready = 1;
}
#endif
@@ -319,8 +314,8 @@ int pd_board_checks(void)
/* trigger the slow OCP iff all 4 samples are above the max */
if (count == 3) {
debug_printf("OCP %d mA\n",
- vbus_amp * VDDA_MV / CURR_GAIN * 1000
- / R_SENSE / ADC_SCALE);
+ vbus_amp * VDDA_MV / CURR_GAIN * 1000 /
+ R_SENSE / ADC_SCALE);
pd_log_event(PD_EVENT_PS_FAULT, 0, PS_FAULT_OCP, NULL);
fault = FAULT_OCP;
/* reset over-current after 1 second */
@@ -349,8 +344,7 @@ int pd_board_checks(void)
if ((output_is_enabled() && (vbus_volt > voltages[ovp_idx].ovp)) ||
(fault && (vbus_volt > voltages[ovp_idx].ovp_rec))) {
if (!fault) {
- debug_printf("OVP %d mV\n",
- ADC_TO_VOLT_MV(vbus_volt));
+ debug_printf("OVP %d mV\n", ADC_TO_VOLT_MV(vbus_volt));
pd_log_event(PD_EVENT_PS_FAULT, 0, PS_FAULT_OVP, NULL);
}
fault = FAULT_OVP;
@@ -361,7 +355,7 @@ int pd_board_checks(void)
/* the discharge did not work properly */
if (discharge_is_enabled() &&
- (get_time().val > discharge_deadline.val)) {
+ (get_time().val > discharge_deadline.val)) {
/* ensure we always finish a 2-step discharge */
volt_idx = discharge_volt_idx;
set_output_voltage(voltages[volt_idx].select);
@@ -369,8 +363,7 @@ int pd_board_checks(void)
discharge_disable();
/* enable over-current monitoring */
adc_enable_watchdog(ADC_CH_A_SENSE, MAX_CURRENT_FAST, 0);
- debug_printf("Disch FAIL %d mV\n",
- ADC_TO_VOLT_MV(vbus_volt));
+ debug_printf("Disch FAIL %d mV\n", ADC_TO_VOLT_MV(vbus_volt));
pd_log_event(PD_EVENT_PS_FAULT, 0, PS_FAULT_DISCH, NULL);
fault = FAULT_DISCHARGE;
/* reset it after 1 second */
@@ -390,7 +383,6 @@ int pd_board_checks(void)
}
return EC_SUCCESS;
-
}
static void pd_adc_interrupt(void)
@@ -407,10 +399,10 @@ static void pd_adc_interrupt(void)
} else { /* discharge complete */
discharge_disable();
/* enable over-current monitoring */
- adc_enable_watchdog(ADC_CH_A_SENSE,
- MAX_CURRENT_FAST, 0);
+ adc_enable_watchdog(ADC_CH_A_SENSE, MAX_CURRENT_FAST,
+ 0);
}
- } else {/* Over-current detection */
+ } else { /* Over-current detection */
/* cut the power output */
pd_power_supply_reset(0);
/* record a special fault */
@@ -453,9 +445,7 @@ static int svdm_response_svids(int port, uint32_t *payload)
#define MODE_CNT 1
#define OPOS 1
-const uint32_t vdo_dp_mode[MODE_CNT] = {
- VDO_MODE_GOOGLE(MODE_GOOGLE_FU)
-};
+const uint32_t vdo_dp_mode[MODE_CNT] = { VDO_MODE_GOOGLE(MODE_GOOGLE_FU) };
static int svdm_response_modes(int port, uint32_t *payload)
{
@@ -499,16 +489,17 @@ const struct svdm_response svdm_rsp = {
};
__override int pd_custom_vdm(int port, int cnt, uint32_t *payload,
- uint32_t **rpayload)
+ uint32_t **rpayload)
{
int cmd = PD_VDO_CMD(payload[0]);
int rsize;
+ char ts_str[PRINTF_TIMESTAMP_BUF_SIZE];
if (PD_VDO_VID(payload[0]) != USB_VID_GOOGLE || !gfu_mode)
return 0;
- debug_printf("%pT] VDM/%d [%d] %08x\n",
- PRINTF_TIMESTAMP_NOW, cnt, cmd, payload[0]);
+ snprintf_timestamp_now(ts_str, sizeof(ts_str));
+ debug_printf("%s] VDM/%d [%d] %08x\n", ts_str, cnt, cmd, payload[0]);
*rpayload = payload;
rsize = pd_custom_flash_vdm(port, cnt, payload);