summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
Diffstat (limited to 'board')
-rw-r--r--board/adlrvpp_ite/gpio.inc6
-rw-r--r--board/adlrvpp_mchp1521/gpio.inc2
-rw-r--r--board/adlrvpp_mchp1727/board.c3
-rw-r--r--board/adlrvpp_mchp1727/board.h4
-rw-r--r--board/adlrvpp_mchp1727/gpio.inc2
-rw-r--r--board/adlrvpp_npcx/gpio.inc2
-rw-r--r--board/akemi/board.c4
-rw-r--r--board/akemi/board.h5
-rw-r--r--board/aleena/board.c48
-rw-r--r--board/ambassador/board.c40
-rw-r--r--board/ambassador/board.h5
-rw-r--r--board/ambassador/gpio.inc2
-rw-r--r--board/ampton/battery.c28
-rw-r--r--board/ampton/board.c83
-rw-r--r--board/ampton/board.h9
-rw-r--r--board/ampton/gpio.inc4
-rw-r--r--board/anahera/board.c14
-rw-r--r--board/anahera/board.h3
-rw-r--r--board/anahera/ec.tasklist1
-rw-r--r--board/anahera/gpio.inc2
-rw-r--r--board/anahera/i2c.c4
-rw-r--r--board/anahera/led.c67
-rw-r--r--board/anahera/sensors.c21
-rw-r--r--board/anahera/thermal.c36
-rw-r--r--board/anahera/usbc_config.c12
-rw-r--r--board/arcada_ish/board.c4
-rw-r--r--board/arcada_ish/board.h2
-rw-r--r--board/asurada/board.c2
-rw-r--r--board/asurada/usbc_config.c4
-rw-r--r--board/atlas/board.c45
-rw-r--r--board/atlas/board.h2
-rw-r--r--board/baklava/board.c25
-rw-r--r--board/bds/board.c6
-rw-r--r--board/bds/board.h2
-rw-r--r--board/beadrix/battery.c66
-rw-r--r--board/beadrix/board.c589
-rw-r--r--board/beadrix/board.h131
-rw-r--r--board/beadrix/build.mk (renamed from board/krabby/build.mk)13
-rw-r--r--board/beadrix/cbi_ssfc.c36
-rw-r--r--board/beadrix/cbi_ssfc.h60
-rw-r--r--board/beadrix/ec.tasklist24
-rw-r--r--board/beadrix/gpio.inc142
-rw-r--r--board/beadrix/led.c154
-rw-r--r--board/beadrix/usb_pd_policy.c85
-rw-r--r--board/beadrix/vif_override.xml (renamed from board/kingler/vif_override.xml)0
-rw-r--r--board/beetley/board.c4
-rw-r--r--board/blipper/board.c8
-rw-r--r--board/blipper/board.h3
-rw-r--r--board/bloog/board.c4
-rw-r--r--board/boldar/ec.tasklist1
-rw-r--r--board/boten/board.c6
-rw-r--r--board/boten/board.h1
-rw-r--r--board/brask/board.h12
-rw-r--r--board/brask/build.mk1
-rw-r--r--board/brask/fans.c50
-rw-r--r--board/brask/gpio.inc14
-rw-r--r--board/brask/usbc_config.c12
-rw-r--r--board/brya/board.h3
-rw-r--r--board/brya/ec.tasklist1
-rw-r--r--board/brya/fw_config.c2
-rw-r--r--board/brya/generated-gpio.inc1
-rw-r--r--board/brya/sensors.c6
-rw-r--r--board/brya/usbc_config.c30
-rw-r--r--board/bugzzy/board.c23
-rw-r--r--board/bugzzy/board.h10
-rw-r--r--board/bugzzy/led.c21
-rw-r--r--board/burnet/board.c31
-rw-r--r--board/burnet/board.h2
-rw-r--r--board/c2d2/board.c1
-rw-r--r--board/c2d2/board.h1
-rw-r--r--board/cappy2/board.h3
-rw-r--r--board/careena/board.c40
-rw-r--r--board/cerise/board.c31
-rw-r--r--board/cerise/board.h2
-rw-r--r--board/cherry/board.h3
-rw-r--r--board/cherry_scp/board.h2
-rw-r--r--board/chronicler/battery.c36
-rw-r--r--board/chronicler/board.h1
-rw-r--r--board/chronicler/ec.tasklist1
-rw-r--r--board/coachz/board.c54
-rw-r--r--board/coachz/build.mk2
-rw-r--r--board/coachz/usbc_config.c60
-rw-r--r--board/coffeecake/board.c8
-rw-r--r--board/coffeecake/board.h2
-rw-r--r--board/collis/ec.tasklist1
-rw-r--r--board/copano/ec.tasklist1
-rw-r--r--board/coral/board.c45
-rw-r--r--board/coral/board.h2
-rw-r--r--board/coral/gpio.inc2
-rw-r--r--board/corori/board.c35
-rw-r--r--board/corori2/battery.c100
-rw-r--r--board/corori2/board.c745
-rw-r--r--board/corori2/board.h203
-rw-r--r--board/corori2/build.mk14
-rw-r--r--board/corori2/cbi_ssfc.c36
-rw-r--r--board/corori2/cbi_ssfc.h60
-rw-r--r--board/corori2/ec.tasklist25
-rw-r--r--board/corori2/gpio.inc139
-rw-r--r--board/corori2/led.c70
-rw-r--r--board/corori2/usb_pd_policy.c61
-rw-r--r--board/corori2/vif_override.xml (renamed from board/krabby/vif_override.xml)0
-rw-r--r--board/cret/board.c4
-rw-r--r--board/dalboz/board.c4
-rw-r--r--board/damu/board.c31
-rw-r--r--board/damu/board.h2
-rw-r--r--board/delbin/ec.tasklist1
-rw-r--r--board/dewatt/board.c178
-rw-r--r--board/dewatt/board.h21
-rw-r--r--board/dewatt/board_fw_config.c18
-rw-r--r--board/dewatt/build.mk2
-rw-r--r--board/dewatt/led.c58
-rw-r--r--board/dewatt/thermal.c145
-rw-r--r--board/discovery-stm32f072/board.c1
-rw-r--r--board/discovery-stm32f072/board.h3
-rw-r--r--board/dojo/battery.c126
-rw-r--r--board/dojo/board.c179
-rw-r--r--board/dojo/board.h (renamed from board/krabby/board.h)69
-rw-r--r--board/dojo/build.mk (renamed from board/kingler/build.mk)6
-rw-r--r--board/dojo/ec.tasklist (renamed from board/krabby/ec.tasklist)3
-rw-r--r--board/dojo/gpio.inc (renamed from board/kingler/gpio.inc)106
-rw-r--r--board/dojo/led.c87
-rw-r--r--board/dojo/vif_override.xml3
-rw-r--r--board/dooly/board.c121
-rw-r--r--board/dooly/board.h26
-rw-r--r--board/dooly/gpio.inc4
-rw-r--r--board/draco/battery.c107
-rw-r--r--board/draco/board.c51
-rw-r--r--board/draco/board.h204
-rw-r--r--board/draco/build.mk25
-rw-r--r--board/draco/charger_isl9241.c90
-rw-r--r--board/draco/ec.tasklist31
-rw-r--r--board/draco/fans.c74
-rw-r--r--board/draco/fw_config.c46
-rw-r--r--board/draco/fw_config.h54
-rw-r--r--board/draco/gpio.inc135
-rw-r--r--board/draco/i2c.c98
-rw-r--r--board/draco/keyboard.c25
-rw-r--r--board/draco/led.c93
-rw-r--r--board/draco/pwm.c71
-rw-r--r--board/draco/sensors.c151
-rw-r--r--board/draco/usbc_config.c367
-rw-r--r--board/draco/usbc_config.h22
-rw-r--r--board/draco/vif_override.xml3
-rw-r--r--board/drallion_ish/board.c4
-rw-r--r--board/drallion_ish/board.h2
-rw-r--r--board/dratini/board.h5
-rw-r--r--board/drawcia/board.c39
-rw-r--r--board/drawcia_riscv/board.c4
-rw-r--r--board/drobit/ec.tasklist1
l---------board/duck1
-rw-r--r--board/eldrid/ec.tasklist1
-rw-r--r--board/elemi/ec.tasklist1
-rw-r--r--board/elm/board.c18
-rw-r--r--board/elm/board.h3
-rw-r--r--board/endeavour/board.c32
-rw-r--r--board/endeavour/board.h2
-rw-r--r--board/eve/board.c40
-rw-r--r--board/eve/board.h2
-rw-r--r--board/felwinter/board.c52
-rw-r--r--board/felwinter/board.h15
-rw-r--r--board/felwinter/ec.tasklist1
-rw-r--r--board/felwinter/fans.c12
-rw-r--r--board/felwinter/fw_config.c5
-rw-r--r--board/felwinter/fw_config.h14
-rw-r--r--board/felwinter/gpio.inc7
-rw-r--r--board/felwinter/i2c.c1
-rw-r--r--board/felwinter/pwm.c4
-rw-r--r--board/felwinter/sensors.c6
-rw-r--r--board/felwinter/usbc_config.c5
-rw-r--r--board/fennel/board.c31
-rw-r--r--board/fennel/board.h2
-rw-r--r--board/fizz/board.c40
-rw-r--r--board/fizz/board.h2
-rw-r--r--board/fleex/board.c4
-rw-r--r--board/foob/board.c4
-rw-r--r--board/fusb307bgevb/board.c8
-rw-r--r--board/genesis/board.c48
-rw-r--r--board/genesis/board.h5
-rw-r--r--board/genesis/gpio.inc2
-rw-r--r--board/gimble/board.h10
-rw-r--r--board/gimble/ec.tasklist1
-rw-r--r--board/gimble/gpio.inc1
-rw-r--r--board/gimble/i2c.c13
-rw-r--r--board/gimble/led.c4
-rw-r--r--board/gimble/sensors.c4
-rw-r--r--board/gimble/usbc_config.c3
-rw-r--r--board/gingerbread/board.c51
-rw-r--r--board/gingerbread/gpio.inc4
-rw-r--r--board/gooey/board.c4
-rw-r--r--board/goroh/gpio.inc4
-rw-r--r--board/grunt/board.c48
-rw-r--r--board/gumboz/board.c4
-rw-r--r--board/guybrush/board.c4
-rw-r--r--board/guybrush/board.h3
-rw-r--r--board/guybrush/build.mk2
-rw-r--r--board/guybrush/thermal.c34
-rw-r--r--board/haboki/board.c4
-rw-r--r--board/hammer/board.c38
-rw-r--r--board/hammer/board.h1
-rw-r--r--board/hammer/variants.h25
-rw-r--r--board/hatch/board.h5
-rw-r--r--board/hatch_fp/board_rw.c4
-rw-r--r--board/helios/board.h5
-rw-r--r--board/herobrine_npcx9/board.c54
-rw-r--r--board/hoho/board.h2
-rw-r--r--board/homestar/board.c45
-rw-r--r--board/homestar/build.mk2
-rw-r--r--board/homestar/usbc_config.c60
-rw-r--r--board/host/board.c40
-rw-r--r--board/icarus/board.c30
-rw-r--r--board/it83xx_evb/gpio.inc2
-rw-r--r--board/it8xxx2_evb/gpio.inc2
-rw-r--r--board/it8xxx2_pdevb/board.h2
-rw-r--r--board/jacuzzi/board.c42
-rw-r--r--board/jacuzzi/board.h2
-rw-r--r--board/jinlon/board.h5
-rw-r--r--board/jslrvp_ite/gpio.inc6
-rw-r--r--board/kakadu/board.c37
-rw-r--r--board/kano/board.h15
-rw-r--r--board/kano/build.mk1
-rw-r--r--board/kano/ec.tasklist1
-rw-r--r--board/kano/fans.c38
-rw-r--r--board/kano/fw_config.c21
-rw-r--r--board/kano/fw_config.h33
-rw-r--r--board/kano/gpio.inc1
-rw-r--r--board/kano/sensors.c9
-rw-r--r--board/kano/usbc_config.h2
-rw-r--r--board/kappa/board.c31
-rw-r--r--board/karma/board.c10
-rw-r--r--board/karma/gpio.inc2
-rw-r--r--board/katsu/board.c37
-rw-r--r--board/kindred/board.h5
-rw-r--r--board/kingler/battery.c47
-rw-r--r--board/kingler/board.c188
-rw-r--r--board/kingler/board.h118
-rw-r--r--board/kingler/ec.tasklist22
-rw-r--r--board/kingler/led.c120
-rw-r--r--board/kingler/usbc_config.c28
-rw-r--r--board/kingoftown/board.c45
-rw-r--r--board/kingoftown/board.h8
-rw-r--r--board/kingoftown/led.c30
-rw-r--r--board/kingoftown/usbc_config.c48
-rw-r--r--board/kodama/board.c35
-rw-r--r--board/kohaku/board.h5
-rw-r--r--board/krabby/battery.c47
-rw-r--r--board/krabby/board.c176
-rw-r--r--board/krabby/gpio.inc157
-rw-r--r--board/krabby/hooks.c19
-rw-r--r--board/krabby/led.c120
-rw-r--r--board/krabby/usbc_config.c40
-rw-r--r--board/kracko/board.c4
-rw-r--r--board/kukui/board.c22
-rw-r--r--board/lantis/board.c4
-rw-r--r--board/lazor/board.c45
-rw-r--r--board/lazor/usbc_config.c48
-rw-r--r--board/liara/board.c48
-rw-r--r--board/lick/board.c4
-rw-r--r--board/lindar/board.c4
-rw-r--r--board/lindar/ec.tasklist1
-rw-r--r--board/madoo/board.c4
-rw-r--r--board/magolor/board.c41
-rw-r--r--board/magolor/board.h1
-rw-r--r--board/magolor/gpio.inc3
-rw-r--r--board/makomo/board.c31
-rw-r--r--board/makomo/board.h2
-rw-r--r--board/marzipan/board.c45
-rw-r--r--board/marzipan/usbc_config.c52
-rw-r--r--board/mchpevb1/board.c16
-rw-r--r--board/mchpevb1/board.h2
-rw-r--r--board/mchpevb1/gpio.inc4
-rw-r--r--board/meep/board.c4
-rw-r--r--board/metaknight/board.c39
-rw-r--r--board/moonbuggy/board.c48
-rw-r--r--board/moonbuggy/board.h5
-rw-r--r--board/moonbuggy/gpio.inc2
-rw-r--r--board/morphius/board.h3
-rw-r--r--board/morphius/thermal.c28
-rw-r--r--board/mrbland/board.c36
-rw-r--r--board/mrbland/build.mk2
-rw-r--r--board/mrbland/usbc_config.c60
-rw-r--r--board/munna/board.c33
-rw-r--r--board/munna/board.h2
-rw-r--r--board/mushu/board.h5
-rw-r--r--board/nami/board.c48
-rw-r--r--board/nami/board.h2
-rw-r--r--board/nautilus/board.c40
-rw-r--r--board/nautilus/board.h2
-rw-r--r--board/nightfury/board.h5
-rw-r--r--board/nipperkin/board.c29
-rw-r--r--board/nipperkin/board.h10
-rw-r--r--board/nipperkin/led.c24
-rw-r--r--board/nipperkin/thermal.c19
-rw-r--r--board/nocturne/board.c33
-rw-r--r--board/nocturne/board.h2
-rw-r--r--board/nocturne_fp/board_rw.c6
-rw-r--r--board/npcx7_evb/board.c40
-rw-r--r--board/npcx7_evb/board.h2
-rw-r--r--board/npcx9_evb/board.c40
-rw-r--r--board/npcx9_evb/board.h2
-rw-r--r--board/npcx_evb/board.c40
-rw-r--r--board/npcx_evb/board.h2
-rw-r--r--board/npcx_evb_arm/board.c40
-rw-r--r--board/npcx_evb_arm/board.h2
-rw-r--r--board/nucleo-dartmonkey/board.c6
-rw-r--r--board/nucleo-f072rb/board.c8
-rw-r--r--board/nucleo-f411re/board.c9
-rw-r--r--board/nucleo-f412zg/board.c2
-rw-r--r--board/nucleo-h743zi/board.c2
-rw-r--r--board/nuwani/board.c44
-rw-r--r--board/oak/board.c16
-rw-r--r--board/oak/board.h2
-rw-r--r--board/palkia/board.h5
-rw-r--r--board/pazquel/board.c50
-rw-r--r--board/pazquel/board.h1
-rw-r--r--board/pazquel/build.mk1
-rw-r--r--board/pazquel/usbc_config.c60
-rw-r--r--board/pdeval-stm32f072/board.c8
-rw-r--r--board/pdeval-stm32f072/usb_pd_policy.c8
-rw-r--r--board/phaser/board.c9
-rw-r--r--board/phaser/board.h14
-rw-r--r--board/pico/board.c30
-rw-r--r--board/pirika/board.c4
-rw-r--r--board/plankton/board.c9
-rw-r--r--board/pompom/board.c36
-rw-r--r--board/pompom/build.mk2
-rw-r--r--board/pompom/usbc_config.c60
-rw-r--r--board/poppy/board.c40
-rw-r--r--board/poppy/board.h2
-rw-r--r--board/primus/board.c42
-rw-r--r--board/primus/board.h9
-rw-r--r--board/primus/build.mk1
-rw-r--r--board/primus/ec.tasklist1
-rw-r--r--board/primus/fans.c11
-rw-r--r--board/primus/fw_config.c5
-rw-r--r--board/primus/fw_config.h18
-rw-r--r--board/primus/i2c.c4
-rw-r--r--board/primus/thermal.c157
-rw-r--r--board/primus/usbc_config.c8
-rw-r--r--board/puff/board.c40
-rw-r--r--board/puff/board.h5
-rw-r--r--board/puff/gpio.inc2
-rw-r--r--board/quackingstick/board.c87
-rw-r--r--board/quackingstick/board.h1
-rw-r--r--board/quackingstick/build.mk2
-rw-r--r--board/quackingstick/gpio.inc4
-rw-r--r--board/quackingstick/usbc_config.c98
-rw-r--r--board/quiche/board.c24
-rw-r--r--board/rainier/board.c8
-rw-r--r--board/rainier/board.h2
-rw-r--r--board/rammus/board.c40
-rw-r--r--board/rammus/board.h2
-rw-r--r--board/redrix/board.h6
-rw-r--r--board/redrix/ec.tasklist1
-rw-r--r--board/redrix/fw_config.h6
-rw-r--r--board/redrix/gpio.inc5
-rw-r--r--board/redrix/i2c.c4
-rw-r--r--board/redrix/led.c23
-rw-r--r--board/redrix/sensors.c42
-rw-r--r--board/redrix/thermal.c52
-rw-r--r--board/redrix/usbc_config.c12
-rw-r--r--board/reef/board.c45
-rw-r--r--board/reef/board.h2
-rw-r--r--board/reef/gpio.inc3
-rw-r--r--board/reef_it8320/board.c24
-rw-r--r--board/reef_it8320/board.h2
-rw-r--r--board/reef_it8320/gpio.inc2
-rw-r--r--board/reef_mchp/board.c45
-rw-r--r--board/reef_mchp/board.h2
-rw-r--r--board/reef_mchp/gpio.inc3
-rw-r--r--board/scarlet/board.c16
-rw-r--r--board/scarlet/board.h4
-rw-r--r--board/scout/board.c54
-rw-r--r--board/scout/board.h5
-rw-r--r--board/scout/gpio.inc6
-rw-r--r--board/scout/led.c10
-rw-r--r--board/servo_micro/board.c10
-rw-r--r--board/servo_micro/board.h3
-rw-r--r--board/servo_v4/board.c9
-rw-r--r--board/servo_v4p1/board.c30
-rw-r--r--board/shuboz/board.c1
-rw-r--r--board/spherion/board.c7
-rw-r--r--board/stern/board.c31
-rw-r--r--board/stern/board.h2
-rw-r--r--board/stm32f446e-eval/board.c18
-rw-r--r--board/stm32l476g-eval/board.c8
-rw-r--r--board/storo/battery.c37
-rw-r--r--board/storo/board.c6
-rw-r--r--board/storo/board.h3
-rw-r--r--board/stryke/board.h6
-rw-r--r--board/sweetberry/board.c36
-rw-r--r--board/taeko/board.c16
-rw-r--r--board/taeko/board.h35
-rw-r--r--board/taeko/ec.tasklist1
-rw-r--r--board/taeko/gpio.inc3
-rw-r--r--board/taeko/i2c.c5
-rw-r--r--board/taeko/sensors.c52
-rw-r--r--board/taeko/usbc_config.c19
-rw-r--r--board/taniks/battery.c103
-rw-r--r--board/taniks/board.c127
-rw-r--r--board/taniks/board.h262
-rw-r--r--board/taniks/build.mk25
l---------board/taniks/charger.c1
-rw-r--r--board/taniks/ec.tasklist30
-rw-r--r--board/taniks/fans.c88
-rw-r--r--board/taniks/fw_config.c65
-rw-r--r--board/taniks/fw_config.h82
-rw-r--r--board/taniks/gpio.inc146
-rw-r--r--board/taniks/i2c.c79
-rw-r--r--board/taniks/keyboard.c48
-rw-r--r--board/taniks/led.c119
-rw-r--r--board/taniks/pwm.c39
-rw-r--r--board/taniks/sensors.c436
-rw-r--r--board/taniks/usbc_config.c392
-rw-r--r--board/taniks/usbc_config.h21
-rw-r--r--board/taniks/vif_override.xml3
-rw-r--r--board/terrador/ec.tasklist1
-rw-r--r--board/tglrvp_ish/board.h2
-rw-r--r--board/tglrvpu_ite/gpio.inc6
-rw-r--r--board/tigertail/board.c9
-rw-r--r--board/treeya/board.c52
-rw-r--r--board/trogdor/board.c45
-rw-r--r--board/trogdor/usbc_config.c48
-rw-r--r--board/twinkie/board.c8
-rw-r--r--board/twinkie/sniffer.c4
-rw-r--r--board/vell/battery.c65
-rw-r--r--board/vell/board.c17
-rw-r--r--board/vell/board.h143
-rw-r--r--board/vell/charger.c13
-rw-r--r--board/vell/ec.tasklist8
-rw-r--r--board/vell/gpio.inc85
-rw-r--r--board/vell/i2c.c72
-rw-r--r--board/vell/keyboard.c29
-rw-r--r--board/vell/led.c223
-rw-r--r--board/vell/pwm.c30
-rw-r--r--board/vell/sensors.c252
-rw-r--r--board/vell/usbc_config.c232
-rw-r--r--board/vell/usbc_config.h3
-rw-r--r--board/vilboz/board.c4
-rw-r--r--board/voema/ec.tasklist1
-rw-r--r--board/volet/ec.tasklist1
-rw-r--r--board/volmar/battery.c112
-rw-r--r--board/volmar/board.c108
-rw-r--r--board/volmar/board.h286
-rw-r--r--board/volmar/build.mk26
-rw-r--r--board/volmar/charger.c90
-rw-r--r--board/volmar/ec.tasklist32
-rw-r--r--board/volmar/fans.c89
-rw-r--r--board/volmar/fw_config.c61
-rw-r--r--board/volmar/fw_config.h54
-rw-r--r--board/volmar/generated-gpio.inc125
-rw-r--r--board/volmar/gpio.inc74
-rw-r--r--board/volmar/i2c.c98
-rw-r--r--board/volmar/keyboard.c25
-rw-r--r--board/volmar/led.c93
-rw-r--r--board/volmar/pwm.c71
-rw-r--r--board/volmar/sensors.c412
-rw-r--r--board/volmar/tune_mp2964.c (renamed from board/kano/tune_mp2964.c)2
-rw-r--r--board/volmar/usbc_config.c506
-rw-r--r--board/volmar/usbc_config.h22
-rw-r--r--board/volmar/vif_override.xml3
-rw-r--r--board/volteer/ec.tasklist1
-rw-r--r--board/volteer_ish/board.h2
-rw-r--r--board/voxel/ec.tasklist3
-rw-r--r--board/waddledee/board.c4
-rw-r--r--board/wheelie/board.c4
-rw-r--r--board/willow/board.c31
-rw-r--r--board/willow/board.h2
-rw-r--r--board/wormdingler/board.c45
-rw-r--r--board/wormdingler/board.h8
-rw-r--r--board/wormdingler/build.mk2
-rw-r--r--board/wormdingler/usbc_config.c60
-rw-r--r--board/yorp/board.c4
-rw-r--r--board/zinger/runtime.c3
473 files changed, 14579 insertions, 3210 deletions
diff --git a/board/adlrvpp_ite/gpio.inc b/board/adlrvpp_ite/gpio.inc
index 59af6cf877..00b4aefa3e 100644
--- a/board/adlrvpp_ite/gpio.inc
+++ b/board/adlrvpp_ite/gpio.inc
@@ -77,11 +77,11 @@ GPIO(USBC_TCPC_ALRT_P3, PIN(J, 3), GPIO_INPUT)
GPIO(USBC_TCPC_PPC_ALRT_P3, PIN(E, 6), GPIO_INPUT)
#endif
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(ESPI_RST_R, PIN(D, 2), GPIO_INPUT)
#endif
-#ifdef CONFIG_HOSTCMD_ESPI
+#ifdef CONFIG_HOST_INTERFACE_ESPI
/* enable 1.8v input of EC's espi_reset pin, and then this pin takes effect. */
GPIO_INT(ESPI_RST_R, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset_pin_asserted_interrupt) /* eSPI_reset# */
#endif
@@ -112,7 +112,7 @@ GPIO(SYS_PWROK_EC, PIN(D, 1), GPIO_OUT_LOW)
GPIO(DSW_PWROK_EC, PIN(L, 6), GPIO_OUT_LOW)
/* Host communication GPIOs */
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO(PLT_RST_L, PIN(H, 6), GPIO_INPUT | GPIO_PULL_UP) /* PCH_PLTRST_L */
#endif
GPIO(PCH_WAKE_N, PIN(J, 0), GPIO_ODR_HIGH)
diff --git a/board/adlrvpp_mchp1521/gpio.inc b/board/adlrvpp_mchp1521/gpio.inc
index fd20e16568..5ec398903e 100644
--- a/board/adlrvpp_mchp1521/gpio.inc
+++ b/board/adlrvpp_mchp1521/gpio.inc
@@ -105,7 +105,7 @@ UNIMPLEMENTED(EN_PP5000)
GPIO(SMC_WAKE_SCI_N, PIN(0114), GPIO_ODR_HIGH)
/* EC_INT_L pin */
GPIO(EC_TRACE_DATA_0, PIN(0200), GPIO_ODR_HIGH)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO(ESPI_RST_EC_R_N, PIN(061), GPIO_INPUT)
#endif
diff --git a/board/adlrvpp_mchp1727/board.c b/board/adlrvpp_mchp1727/board.c
index 05ff3664c4..5d850c8e10 100644
--- a/board/adlrvpp_mchp1727/board.c
+++ b/board/adlrvpp_mchp1727/board.c
@@ -64,6 +64,8 @@ const struct i2c_port_t i2c_ports[] = {
BUILD_ASSERT(ARRAY_SIZE(i2c_ports) == I2C_CHAN_COUNT);
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
+/* I2C access in polling mode before task is initialized */
+#ifdef CONFIG_I2C_BITBANG
const struct i2c_port_t i2c_bitbang_ports[] = {
[I2C_BITBANG_CHAN_BRD_ID] = {
.name = "bitbang_brd_id",
@@ -84,6 +86,7 @@ const struct i2c_port_t i2c_bitbang_ports[] = {
};
BUILD_ASSERT(ARRAY_SIZE(i2c_bitbang_ports) == I2C_BITBANG_CHAN_COUNT);
const unsigned int i2c_bitbang_ports_used = ARRAY_SIZE(i2c_bitbang_ports);
+#endif
/* USB-C TCPC Configuration */
const struct tcpc_config_t tcpc_config[] = {
diff --git a/board/adlrvpp_mchp1727/board.h b/board/adlrvpp_mchp1727/board.h
index 2ec76f1fe2..f3854090cd 100644
--- a/board/adlrvpp_mchp1727/board.h
+++ b/board/adlrvpp_mchp1727/board.h
@@ -17,6 +17,10 @@
#include "adlrvp.h"
+/* Heavy I2C communication as POR, increase WDT expired time */
+#undef CONFIG_WATCHDOG_PERIOD_MS
+#define CONFIG_WATCHDOG_PERIOD_MS 5000
+
/*
* External parallel crystal between XTAL1 and XTAL2 pins.
* #define CONFIG_CLOCK_SRC_EXTERNAL
diff --git a/board/adlrvpp_mchp1727/gpio.inc b/board/adlrvpp_mchp1727/gpio.inc
index 1eea86462c..42973648b4 100644
--- a/board/adlrvpp_mchp1727/gpio.inc
+++ b/board/adlrvpp_mchp1727/gpio.inc
@@ -83,7 +83,7 @@ GPIO(USBC_TCPC_PPC_ALRT_P3, PIN(0142), GPIO_INPUT)
/* Host communication GPIOs */
GPIO(SMC_WAKE_SCI_N_MECC, PIN(051), GPIO_ODR_HIGH)
GPIO(EC_PCH_MKBP_INT_ODL, PIN(0127), GPIO_ODR_HIGH)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO(LPC_ESPI_RST_N, PIN(061), GPIO_INPUT)
GPIO(PLT_RST_L, PIN(052), GPIO_INPUT) /* PCH_PLTRST_L */
#endif
diff --git a/board/adlrvpp_npcx/gpio.inc b/board/adlrvpp_npcx/gpio.inc
index a059b1c6b6..4a696e4c09 100644
--- a/board/adlrvpp_npcx/gpio.inc
+++ b/board/adlrvpp_npcx/gpio.inc
@@ -62,7 +62,7 @@ GPIO(USBC_TCPC_PPC_ALRT_P3, PIN(F, 3), GPIO_INPUT)
/* Host communication GPIOs */
GPIO(SMC_WAKE_SCI_N_MECC, PIN(A, 4), GPIO_ODR_HIGH)
GPIO(EC_PCH_MKBP_INT_ODL, PIN(F, 5), GPIO_ODR_HIGH)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO(LPC_ESPI_RST_N, PIN(5, 4), GPIO_INPUT | GPIO_SEL_1P8V)
GPIO(PLT_RST_L, PIN(A, 2), GPIO_INPUT | GPIO_SEL_1P8V) /* PCH_PLTRST_L */
#endif
diff --git a/board/akemi/board.c b/board/akemi/board.c
index 1cfdedb626..e591e862b0 100644
--- a/board/akemi/board.c
+++ b/board/akemi/board.c
@@ -227,8 +227,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -259,8 +257,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/akemi/board.h b/board/akemi/board.h
index 524607d8bb..49bb8b2837 100644
--- a/board/akemi/board.h
+++ b/board/akemi/board.h
@@ -16,7 +16,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -91,7 +91,7 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
@@ -111,6 +111,7 @@
#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__
diff --git a/board/aleena/board.c b/board/aleena/board.c
index 0343a399c5..460c73fcdd 100644
--- a/board/aleena/board.c
+++ b/board/aleena/board.c
@@ -35,12 +35,48 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL_AP, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"kblight", I2C_PORT_KBLIGHT, 100, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, 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/ambassador/board.c b/board/ambassador/board.c
index 698acf70bb..a5abbaa130 100644
--- a/board/ambassador/board.c
+++ b/board/ambassador/board.c
@@ -286,11 +286,41 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, 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);
diff --git a/board/ambassador/board.h b/board/ambassador/board.h
index 4ca9966873..c6aac262c5 100644
--- a/board/ambassador/board.h
+++ b/board/ambassador/board.h
@@ -38,7 +38,7 @@
#define CONFIG_MKBP_USE_HOST_EVENT
#undef CONFIG_KEYBOARD_RUNTIME_KEYS
#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
@@ -119,7 +119,7 @@
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 0
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
@@ -278,6 +278,7 @@ unsigned int ec_config_get_thermal_solution(void);
#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
/*
diff --git a/board/ambassador/gpio.inc b/board/ambassador/gpio.inc
index 9d718bb110..871031ebf9 100644
--- a/board/ambassador/gpio.inc
+++ b/board/ambassador/gpio.inc
@@ -64,7 +64,7 @@ GPIO_INT(USB_A4_OC_ODL, PIN(B, 0), GPIO_OUT_LOW | GPIO_INT_BOTH, port_ocp
GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
diff --git a/board/ampton/battery.c b/board/ampton/battery.c
index ee9b9b96e9..f52f0d5d7a 100644
--- a/board/ampton/battery.c
+++ b/board/ampton/battery.c
@@ -116,6 +116,34 @@ const struct board_batt_params board_battery_info[] = {
.discharging_max_c = 60,
},
},
+ [BATTERY_C204_SECOND] = {
+ .fuel_gauge = {
+ .manuf_name = "AS3FXXd3KB",
+ .device_name = "C214-43",
+ .ship_mode = {
+ .reg_addr = 0x0,
+ .reg_data = { 0x10, 0x10 },
+ },
+ .fet = {
+ .reg_addr = 0x99,
+ .reg_mask = 0x000C,
+ .disconnect_val = 0x000C,
+ .cfet_mask = 0x0004,
+ .cfet_off_val = 0x0004
+ },
+ },
+ .batt_info = {
+ .voltage_max = 13200,
+ .voltage_normal = 11550,
+ .voltage_min = 9000,
+ .precharge_current = 256,
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 45,
+ .charging_min_c = 0,
+ .discharging_min_c = -20,
+ .discharging_max_c = 60,
+ },
+ },
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 1634f02991..588cc72485 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -13,6 +13,8 @@
#include "driver/accel_bma2x2.h"
#include "driver/accel_kionix.h"
#include "driver/accelgyro_bmi_common.h"
+#include "driver/accelgyro_icm_common.h"
+#include "driver/accelgyro_icm42607.h"
#include "driver/ppc/sn5s330.h"
#include "driver/sync.h"
#include "driver/tcpm/it83xx_pd.h"
@@ -172,9 +174,21 @@ const mat33_fp_t gyro_standard_ref = {
{ 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)}
+};
/* sensor private 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_icm42607_data;
/* BMA253 private data */
static struct accelgyro_saved_data_t g_bma253_data;
@@ -208,6 +222,49 @@ static const struct motion_sensor_t motion_sensor_bma253 = {
},
};
+struct motion_sensor_t motion_sensor_accel_icm42607 = {
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_ICM42607,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &icm42607_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_icm42607_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs. */
+ .rot_standard_ref = &base_standard_ref_icm42607,
+ .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,
+ },
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+};
+
+struct motion_sensor_t motion_sensor_gyro_icm42607 = {
+ .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_SENSOR,
+ .i2c_spi_addr_flags = ICM42607_ADDR0_FLAGS,
+ .default_range = 1000, /* dps */
+ .rot_standard_ref = &base_standard_ref_icm42607,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
+};
+
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -299,7 +356,7 @@ 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 == 255;
+ || sku_id == 57 || sku_id == 255;
}
static int board_with_sensor_bma253(void)
@@ -308,6 +365,20 @@ static int board_with_sensor_bma253(void)
return sku_id == 3 || sku_id == 4;
}
+static int board_with_sensor_icm42607(void)
+{
+ /* SKU ID 3 and 4 of Ampton with BMA253 */
+ return sku_id == 57;
+}
+
+void motion_interrupt(enum gpio_signal signal)
+{
+ if (board_with_sensor_icm42607())
+ icm42607_interrupt(signal);
+ else
+ bmi160_interrupt(signal);
+}
+
static void board_update_sensor_config_from_sku(void)
{
if (board_is_convertible()) {
@@ -315,6 +386,16 @@ static void board_update_sensor_config_from_sku(void)
if (board_with_sensor_bma253())
motion_sensors[LID_ACCEL] = motion_sensor_bma253;
+ if (board_with_sensor_icm42607()) {
+ motion_sensors[BASE_ACCEL] =
+ motion_sensor_accel_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;
/* 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 697e7221bc..d0a3cf5bc0 100644
--- a/board/ampton/board.h
+++ b/board/ampton/board.h
@@ -35,11 +35,13 @@
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
#define CONFIG_STEINHART_HART_3V3_13K7_47K_4050B
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PP3300
+#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_ACCELGYRO_ICM42607 /* Base accel */
#define CONFIG_SYNC /* Camera VSYNC */
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
@@ -53,6 +55,8 @@
#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
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)
@@ -99,9 +103,12 @@ enum battery_type {
BATTERY_C214,
BATTERY_C204EE,
BATTERY_C424,
+ BATTERY_C204_SECOND,
BATTERY_TYPE_COUNT,
};
+void motion_interrupt(enum gpio_signal signal);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/ampton/gpio.inc b/board/ampton/gpio.inc
index 724d9a98d9..854a28655d 100644
--- a/board/ampton/gpio.inc
+++ b/board/ampton/gpio.inc
@@ -32,7 +32,7 @@ GPIO_INT(RSMRST_L_PGOOD, PIN(F, 1), GPIO_INT_BOTH, power_signal_interrupt) /* PM
GPIO_INT(ALL_SYS_PGOOD, PIN(F, 0), GPIO_INT_BOTH, power_signal_interrupt) /* PMIC_EC_PWROK_OD */
GPIO_INT(AC_PRESENT, PIN(A, 7), GPIO_INT_BOTH, extpower_interrupt) /* ACOK_OD */
-#ifdef CONFIG_HOSTCMD_ESPI
+#ifdef CONFIG_HOST_INTERFACE_ESPI
/* enable 1.8v input of EC's espi_reset pin, and then this pin takes effect. */
GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset_pin_asserted_interrupt) /* eSPI_reset# */
#endif
@@ -41,7 +41,7 @@ GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset
GPIO_INT(TABLET_MODE_L, PIN(H, 4), GPIO_INT_BOTH, gmr_tablet_switch_isr)
GPIO_INT(EC_VOLDN_BTN_ODL, PIN(D, 6), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(EC_VOLUP_BTN_ODL, PIN(D, 5), GPIO_INT_BOTH, button_interrupt)
-GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
+GPIO_INT(BASE_SIXAXIS_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, motion_interrupt)
GPIO(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INPUT | GPIO_SEL_1P8V)
GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT) /* PLT_RST_L: Platform Reset from SoC */
diff --git a/board/anahera/board.c b/board/anahera/board.c
index c1de2df6ac..dfa4e73846 100644
--- a/board/anahera/board.c
+++ b/board/anahera/board.c
@@ -6,6 +6,7 @@
#include "battery.h"
#include "button.h"
#include "charge_ramp.h"
+#include "charge_state_v2.h"
#include "charger.h"
#include "common.h"
#include "compile_time_macros.h"
@@ -61,3 +62,16 @@ 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;
}
+
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ 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);
+}
diff --git a/board/anahera/board.h b/board/anahera/board.h
index 591e18bced..ab362edbf7 100644
--- a/board/anahera/board.h
+++ b/board/anahera/board.h
@@ -71,6 +71,7 @@
#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
@@ -126,7 +127,7 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan features */
diff --git a/board/anahera/ec.tasklist b/board/anahera/ec.tasklist
index bfcf0a6416..187609f36e 100644
--- a/board/anahera/ec.tasklist
+++ b/board/anahera/ec.tasklist
@@ -18,6 +18,7 @@
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) \
diff --git a/board/anahera/gpio.inc b/board/anahera/gpio.inc
index ceb5087bd4..9aba64311c 100644
--- a/board/anahera/gpio.inc
+++ b/board/anahera/gpio.inc
@@ -76,7 +76,6 @@ GPIO(C0_CHARGE_LED_AMBER_L, PIN(C, 4), GPIO_OUT_HIGH) /* Amber C0 port
GPIO(C0_CHARGE_LED_WHITE_L, PIN(C, 3), GPIO_OUT_HIGH) /* White C0 port */
GPIO(C1_CHARGE_LED_AMBER_L, PIN(5, 7), GPIO_OUT_HIGH) /* Amber C1 port */
GPIO(C1_CHARGE_LED_WHITE_L, PIN(9, 4), GPIO_OUT_HIGH) /* White C1 port */
-GPIO(PWR_LED_WHITE_L, PIN(C, 2), GPIO_OUT_HIGH) /* Power LED */
/* UART alternate functions */
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
@@ -128,6 +127,7 @@ UNUSED(PIN(8, 1)) /* GPIO81/PECI_DATA */
UNUSED(PIN(9, 5)) /* GPIO95/SPIP_MISO */
UNUSED(PIN(B, 4)) /* GPIOB4/I2C0_SDA0 */
UNUSED(PIN(B, 5)) /* GPIOB5/I2C0_SCL0 */
+UNUSED(PIN(C, 2)) /* GPIOC2/PWM1/I2C6_SCL0 */
UNUSED(PIN(D, 4)) /* GPIOD4/CR_SIN3 */
UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1 */
diff --git a/board/anahera/i2c.c b/board/anahera/i2c.c
index 74208f4575..8c648416ab 100644
--- a/board/anahera/i2c.c
+++ b/board/anahera/i2c.c
@@ -38,7 +38,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C4 C1 TCPC */
.name = "tcpc1",
.port = I2C_PORT_USB_C1_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
},
@@ -54,7 +54,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C6 */
.name = "ppc1,retimer1",
.port = I2C_PORT_USB_C1_PPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_MIX_SCL,
.sda = GPIO_EC_I2C_USB_C1_MIX_SDA,
},
diff --git a/board/anahera/led.c b/board/anahera/led.c
index c794bc8b5f..64c9ff7ba9 100644
--- a/board/anahera/led.c
+++ b/board/anahera/led.c
@@ -31,8 +31,7 @@
const enum ec_led_id supported_led_ids[] = {
EC_LED_ID_LEFT_LED,
- EC_LED_ID_RIGHT_LED,
- EC_LED_ID_POWER_LED
+ EC_LED_ID_RIGHT_LED
};
const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
@@ -76,20 +75,6 @@ static void led_set_color_battery(int port, enum led_color color)
}
}
-void led_set_color_power(enum led_color color)
-{
- switch (color) {
- case LED_OFF:
- gpio_set_level(GPIO_PWR_LED_WHITE_L, POWER_LED_OFF);
- break;
- case LED_WHITE:
- gpio_set_level(GPIO_PWR_LED_WHITE_L, POWER_LED_ON);
- break;
- default:
- break;
- }
-}
-
void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
{
switch (led_id) {
@@ -101,9 +86,6 @@ void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
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;
}
@@ -128,12 +110,6 @@ int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
else
led_set_color_battery(RIGHT_PORT, LED_OFF);
break;
- case EC_LED_ID_POWER_LED:
- if (brightness[EC_LED_COLOR_WHITE] != 0)
- led_set_color_power(LED_WHITE);
- else
- led_set_color_power(LED_OFF);
- break;
default:
return EC_ERROR_PARAM1;
}
@@ -160,10 +136,32 @@ static void set_active_port_color(enum led_color color)
static void led_set_battery(void)
{
static unsigned int battery_ticks;
+ static unsigned int suspend_ticks;
uint32_t chflags = charge_get_flags();
battery_ticks++;
+ /*
+ * Override battery LEDs for Anahera, Anahera doesn't have power LED,
+ * blinking both two side battery white LEDs to indicate
+ * system suspend without charging state.
+ */
+ if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND) &&
+ charge_get_state() != PWR_STATE_CHARGE) {
+
+ suspend_ticks++;
+
+ led_set_color_battery(RIGHT_PORT, (suspend_ticks %
+ LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE : LED_OFF);
+ led_set_color_battery(LEFT_PORT, (suspend_ticks %
+ LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
+ LED_WHITE : LED_OFF);
+ return;
+ }
+
+ suspend_ticks = 0;
+
switch (charge_get_state()) {
case PWR_STATE_CHARGE:
/* Always indicate when charging, even in suspend. */
@@ -203,22 +201,6 @@ static void led_set_battery(void)
}
}
-static void led_set_power(void)
-{
- static unsigned 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 %
- LED_TICKS_PER_CYCLE < LED_ON_TICKS) ?
- LED_WHITE : LED_OFF);
- else
- led_set_color_power(LED_OFF);
-}
-
void led_task(void *u)
{
uint32_t start_time;
@@ -227,9 +209,6 @@ void led_task(void *u)
while (1) {
start_time = get_time().le.lo;
- if (led_auto_control_is_enabled(EC_LED_ID_POWER_LED))
- led_set_power();
-
led_set_battery();
/* Compute time for this iteration */
diff --git a/board/anahera/sensors.c b/board/anahera/sensors.c
index 7f388579e2..7ec78642e7 100644
--- a/board/anahera/sensors.c
+++ b/board/anahera/sensors.c
@@ -72,15 +72,12 @@ const struct temp_sensor_t temp_sensors[] = {
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
- * TODO(b/199246802): Need to update for Alder Lake/anahera
- */
-/*
* TODO(b/202062363): Remove when clang is fixed.
*/
#define THERMAL_FAN \
{ \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
}, \
.temp_host_release = { \
@@ -90,8 +87,6 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
/*
- * TODO(b/199246802): Need to update for Alder Lake/anahera
- *
* Tiger Lake specifies 100 C as maximum TDP temperature. THRMTRIP# occurs at
* 130 C. However, sensor is located next to SOC, so we need to use the lower
* SOC temperature limit (85 C)
@@ -102,7 +97,7 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
#define THERMAL_CPU \
{ \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
[EC_TEMP_THRESH_HALT] = C_TO_K(80), \
}, \
.temp_host_release = { \
@@ -112,9 +107,6 @@ __maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
__maybe_unused static const struct ec_thermal_config thermal_cpu = THERMAL_CPU;
/*
- * TODO(b/199246802): Need to update for Alder Lake/anahera
- */
-/*
* TODO(b/202062363): Remove when clang is fixed.
*/
#define THERMAL_CHARGER \
@@ -131,19 +123,16 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
THERMAL_CHARGER;
/*
- * TODO(b/199246802): Need to update for Alder Lake/anahera
- */
-/*
* TODO(b/202062363): Remove when clang is fixed.
*/
#define THERMAL_REGULATOR \
{ \
.temp_host = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
- [EC_TEMP_THRESH_HALT] = C_TO_K(85), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(52), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(55), \
}, \
.temp_host_release = { \
- [EC_TEMP_THRESH_HIGH] = C_TO_K(75), \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(47), \
}, \
}
__maybe_unused static const struct ec_thermal_config thermal_regulator =
diff --git a/board/anahera/thermal.c b/board/anahera/thermal.c
index c26379e356..03f3f789e8 100644
--- a/board/anahera/thermal.c
+++ b/board/anahera/thermal.c
@@ -37,45 +37,45 @@ struct fan_step {
static const struct fan_step fan_table[] = {
{
/* level 0 */
- .on = {51, 51, 0, -1},
+ .on = {53, 52, 0, -1},
.off = {99, 99, 99, -1},
.rpm = {0},
},
{
/* level 1 */
- .on = {52, 52, 0, -1},
- .off = {50, 50, 99, -1},
- .rpm = {3000},
+ .on = {54, 53, 0, -1},
+ .off = {52, 51, 99, -1},
+ .rpm = {3100},
},
{
/* level 2 */
- .on = {53, 53, 0, -1},
- .off = {51, 51, 99, -1},
- .rpm = {3200},
+ .on = {55, 54, 0, -1},
+ .off = {53, 52, 99, -1},
+ .rpm = {3500},
},
{
/* level 3 */
- .on = {54, 54, 0, -1},
- .off = {52, 52, 99, -1},
- .rpm = {3600},
+ .on = {56, 55, 0, -1},
+ .off = {54, 53, 99, -1},
+ .rpm = {3800},
},
{
/* level 4 */
- .on = {55, 56, 56, -1},
- .off = {53, 53, 54, -1},
- .rpm = {3900},
+ .on = {58, 57, 56, -1},
+ .off = {55, 54, 54, -1},
+ .rpm = {4100},
},
{
/* level 5 */
- .on = {56, 57, 58, -1},
- .off = {54, 55, 55, -1},
- .rpm = {4200},
+ .on = {59, 58, 58, -1},
+ .off = {57, 56, 55, -1},
+ .rpm = {4400},
},
{
/* level 6 */
.on = {100, 100, 100, -1},
- .off = {55, 56, 57, -1},
- .rpm = {4600},
+ .off = {58, 57, 57, -1},
+ .rpm = {4900},
},
};
diff --git a/board/anahera/usbc_config.c b/board/anahera/usbc_config.c
index 00b6589a46..aae3a4493b 100644
--- a/board/anahera/usbc_config.c
+++ b/board/anahera/usbc_config.c
@@ -208,12 +208,16 @@ static void board_tcpc_init(void)
int i;
/* Don't reset TCPCs after initial reset */
- if (!system_jumped_late()) {
+ if (!system_jumped_late())
board_reset_pd_mcu();
- for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; ++i)
- ioex_init(i);
- }
+ /*
+ * These IO expander pins are implemented using the
+ * C0/C1 TCPCs, so they must be set up after the TCPCs has
+ * been taken out of reset.
+ */
+ for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; ++i)
+ ioex_init(i);
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
diff --git a/board/arcada_ish/board.c b/board/arcada_ish/board.c
index 624a376dca..d4a8dbddbf 100644
--- a/board/arcada_ish/board.c
+++ b/board/arcada_ish/board.c
@@ -60,8 +60,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_ACCEL_GYRO_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR1_FLAGS,
.rot_standard_ref = &lid_rot_ref,
@@ -90,8 +88,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_ACCEL_GYRO_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR1_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/arcada_ish/board.h b/board/arcada_ish/board.h
index ce735bd268..0064086619 100644
--- a/board/arcada_ish/board.h
+++ b/board/arcada_ish/board.h
@@ -62,7 +62,7 @@
#define CONFIG_DMA_PAGING
/* Host command over HECI */
-#define CONFIG_HOSTCMD_HECI
+#define CONFIG_HOST_INTERFACE_HECI
/* I2C ports */
#define I2C_PORT_SENSOR ISH_I2C0
diff --git a/board/asurada/board.c b/board/asurada/board.c
index ea7da39fa6..4d2cb81239 100644
--- a/board/asurada/board.c
+++ b/board/asurada/board.c
@@ -262,10 +262,8 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lis2dw12_drv,
.mutex = &g_lid_mutex,
.drv_data = &g_lis2dwl_data,
- .int_signal = GPIO_LID_ACCEL_INT_L,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.rot_standard_ref = NULL, /* identity matrix */
.default_range = 2, /* g */
.min_frequency = LIS2DW12_ODR_MIN_VAL,
diff --git a/board/asurada/usbc_config.c b/board/asurada/usbc_config.c
index 2f35816abb..63552980c3 100644
--- a/board/asurada/usbc_config.c
+++ b/board/asurada/usbc_config.c
@@ -23,6 +23,10 @@ void board_usb_mux_init(void)
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);
}
}
DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/atlas/board.c b/board/atlas/board.c
index 4881ed6898..64d0789dd9 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -139,16 +139,41 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100,
- GPIO_EC_I2C0_POWER_SCL, GPIO_EC_I2C0_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000,
- GPIO_EC_I2C1_USB_C0_SCL, GPIO_EC_I2C1_USB_C0_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000,
- GPIO_EC_I2C2_USB_C1_SCL, GPIO_EC_I2C2_USB_C1_SDA},
- {"sensor", I2C_PORT_SENSOR, 100,
- GPIO_EC_I2C3_SENSOR_3V3_SCL, GPIO_EC_I2C3_SENSOR_3V3_SDA},
- {"battery", I2C_PORT_BATTERY, 100,
- GPIO_EC_I2C4_BATTERY_SCL, 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 = "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);
diff --git a/board/atlas/board.h b/board/atlas/board.h
index df2a2ee2c2..6fdf77b0f0 100644
--- a/board/atlas/board.h
+++ b/board/atlas/board.h
@@ -54,7 +54,7 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_CPU_PROCHOT_ACTIVE_LOW
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
diff --git a/board/baklava/board.c b/board/baklava/board.c
index 35a27d0c21..12365e0ff6 100644
--- a/board/baklava/board.c
+++ b/board/baklava/board.c
@@ -262,6 +262,31 @@ int dock_get_mf_preference(void)
{
return MF_ON;
}
+
+static void board_usb_tc_connect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /*
+ * The EC needs to indicate to the MST hub when the host port is
+ * attached. GPIO_UFP_PLUG_DET is used for this purpose.
+ */
+ if (port == USB_PD_PORT_HOST)
+ gpio_set_level(GPIO_UFP_PLUG_DET, 0);
+}
+DECLARE_HOOK(HOOK_USB_PD_CONNECT, board_usb_tc_connect, HOOK_PRIO_DEFAULT);
+
+static void board_usb_tc_disconnect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /* Only the host port disconnect is relevant */
+ if (port == USB_PD_PORT_HOST)
+ gpio_set_level(GPIO_UFP_PLUG_DET, 1);
+}
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+ HOOK_PRIO_DEFAULT);
+
#endif /* SECTION_IS_RW */
static void board_init(void)
diff --git a/board/bds/board.c b/board/bds/board.c
index 91da893a52..aedc570d51 100644
--- a/board/bds/board.c
+++ b/board/bds/board.c
@@ -33,7 +33,11 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"lightbar", 5, 400},
+ {
+ .name = "lightbar",
+ .port = 5,
+ .kbps = 400
+ },
};
const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports);
diff --git a/board/bds/board.h b/board/bds/board.h
index c859089f04..21dc2ad598 100644
--- a/board/bds/board.h
+++ b/board/bds/board.h
@@ -19,7 +19,7 @@
/* Modules we want to exclude */
#undef CONFIG_LID_SWITCH
-#undef CONFIG_HOSTCMD_LPC
+#undef CONFIG_HOST_INTERFACE_LPC
#undef CONFIG_PECI
#undef CONFIG_SWITCH
diff --git a/board/beadrix/battery.c b/board/beadrix/battery.c
new file mode 100644
index 0000000000..8ebdaf466d
--- /dev/null
+++ b/board/beadrix/battery.c
@@ -0,0 +1,66 @@
+/* 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.
+ *
+ * Battery pack vendor provided charging profile
+ */
+
+#include "battery_fuel_gauge.h"
+#include "charge_state.h"
+#include "common.h"
+
+/*
+ * Battery info for all beadrix 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[] = {
+ /* GanFeng SG20 Battery Information */
+ [BATTERY_GANFENG] = {
+ .fuel_gauge = {
+ .manuf_name = "Ganfeng",
+ .device_name = "SG20",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .reg_addr = 0x43,
+ .reg_mask = 0x0003,
+ .disconnect_val = 0x0000,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 8700, /* mV */
+ .voltage_normal = 7600, /* mV */
+ .voltage_min = 6000, /* mV */
+ .precharge_current = 256, /* 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,
+ },
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
+
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_GANFENG;
diff --git a/board/beadrix/board.c b/board/beadrix/board.c
new file mode 100644
index 0000000000..4312141fe7
--- /dev/null
+++ b/board/beadrix/board.c
@@ -0,0 +1,589 @@
+/* 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.
+ */
+
+/* Waddledee board-specific configuration */
+
+#include "adc_chip.h"
+#include "button.h"
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "driver/accel_kionix.h"
+#include "driver/accelgyro_lsm6dsm.h"
+#include "driver/bc12/pi3usb9201.h"
+#include "driver/charger/sm5803.h"
+#include "driver/retimer/tusb544.h"
+#include "driver/temp_sensor/thermistor.h"
+#include "driver/tcpm/anx7447.h"
+#include "driver/tcpm/it83xx_pd.h"
+#include "driver/usb_mux/it5205.h"
+#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 INT_RECHECK_US 5000
+
+/* C1 interrupt line swapped between board versions, track it in a variable */
+static enum gpio_signal c1_int_line;
+
+/* C0 interrupt line shared by BC 1.2 and charger */
+static void check_c0_line(void);
+DECLARE_DEFERRED(check_c0_line);
+
+static void notify_c0_chips(void)
+{
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
+ sm5803_interrupt(0);
+}
+
+static void check_c0_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_C0_INT_ODL)) {
+ notify_c0_chips();
+ hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
+ }
+}
+
+static void usb_c0_interrupt(enum gpio_signal s)
+{
+ /* Cancel any previous calls to check the interrupt line */
+ hook_call_deferred(&check_c0_line_data, -1);
+
+ /* Notify all chips using this line that an interrupt came in */
+ notify_c0_chips();
+
+ /* 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 */
+static void check_c1_line(void);
+DECLARE_DEFERRED(check_c1_line);
+
+static void notify_c1_chips(void)
+{
+ schedule_deferred_pd_interrupt(1);
+ task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
+ sm5803_interrupt(1);
+}
+
+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(c1_int_line)) {
+ notify_c1_chips();
+ hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
+ }
+}
+
+static void usb_c1_interrupt(enum gpio_signal s)
+{
+ /* Cancel any previous calls to check the interrupt line */
+ hook_call_deferred(&check_c1_line_data, -1);
+
+ /* Notify all chips using this line that an interrupt came in */
+ notify_c1_chips();
+
+ /* 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)
+{
+ cprints(CC_USBPD, "C0: CC OVP, SBU OVP, or thermal event");
+ pd_handle_cc_overvoltage(0);
+}
+
+/* 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
+ },
+};
+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,
+ },
+};
+
+/* 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 = AN7447_TCPC0_I2C_ADDR_FLAGS,
+ },
+ .drv = &anx7447_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+};
+
+/* 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,
+};
+
+/* 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 = AN7447_TCPC0_I2C_ADDR_FLAGS,
+ .driver = &anx7447_usb_mux_driver,
+ .next_mux = &usbc1_retimer,
+ },
+};
+
+void board_init(void)
+{
+ int on;
+
+ if (system_get_board_version() <= 0) {
+ pd_set_max_voltage(5000);
+ c1_int_line = GPIO_USB_C1_INT_V0_ODL;
+ } else {
+ c1_int_line = GPIO_USB_C1_INT_V1_ODL;
+ }
+
+
+ gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
+ gpio_enable_interrupt(c1_int_line);
+
+ /*
+ * If interrupt lines are already low, schedule them to be processed
+ * after inits are completed.
+ */
+ check_c0_line();
+ check_c1_line();
+
+ gpio_enable_interrupt(GPIO_USB_C0_CCSBU_OVP_ODL);
+ /* Enable Base Accel interrupt */
+ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+
+ /* 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);
+
+ /* Charger on the sub-board will be a push-pull GPIO */
+ sm5803_configure_gpio0(CHARGER_SECONDARY, GPIO0_MODE_OUTPUT, 0);
+
+ /* Turn on 5V if the system is on, otherwise turn it off */
+ on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
+ CHIPSET_STATE_SOFT_OFF);
+ board_power_5v_enable(on);
+}
+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);
+}
+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);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_suspend, 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;
+}
+
+void board_reset_pd_mcu(void)
+{
+ /*
+ * Nothing to do. TCPC C0 is internal, TCPC C1 reset pin is not
+ * connected to the EC.
+ */
+}
+
+__override void board_power_5v_enable(int enable)
+{
+ /*
+ * Motherboard has a GPIO to turn on the 5V regulator, but the sub-board
+ * sets it through the charger GPIO.
+ */
+ gpio_set_level(GPIO_EN_PP5000, !!enable);
+ gpio_set_level(GPIO_EN_USB_A0_VBUS, !!enable);
+ if (sm5803_set_gpio0_level(1, !!enable))
+ CPRINTUSB("Failed to %sable sub rails!", enable ? "en" : "dis");
+}
+
+uint16_t tcpc_get_alert_status(void)
+{
+ /*
+ * TCPC 0 is embedded in the EC and processes interrupts in the chip
+ * code (it83xx/intc.c)
+ */
+
+ uint16_t status = 0;
+ int regval;
+
+ /* Check whether TCPC 1 pulled the shared interrupt line */
+ if (!gpio_get_level(c1_int_line)) {
+ if (!tcpc_read16(1, TCPC_REG_ALERT, &regval)) {
+ if (regval)
+ status = PD_STATUS_TCPC_ALERT_1;
+ }
+ }
+
+ return status;
+}
+
+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);
+
+ /*
+ * TODO(b/151955431): Characterize the input current limit in case a
+ * scaling needs to be applied here
+ */
+ 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 (!is_valid_port && port != CHARGE_PORT_NONE)
+ return EC_ERROR_INVAL;
+
+ if (port == CHARGE_PORT_NONE) {
+ CPRINTUSB("Disabling all charge ports");
+
+ sm5803_vbus_sink_enable(CHARGER_PRIMARY, 0);
+
+ if (board_get_charger_chip_count() > 1)
+ sm5803_vbus_sink_enable(CHARGER_SECONDARY, 0);
+
+ return EC_SUCCESS;
+ }
+
+ CPRINTUSB("New chg p%d", port);
+
+ /*
+ * 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);
+ }
+
+ return EC_SUCCESS;
+}
+
+/* Vconn control for integrated ITE TCPC */
+void board_pd_vconn_ctrl(int port, enum usbpd_cc_pin cc_pin, int enabled)
+{
+ /* Vconn control is only for port 0 */
+ if (port)
+ return;
+
+ if (cc_pin == USBPD_CC_PIN_1)
+ gpio_set_level(GPIO_EN_USB_C0_CC1_VCONN, !!enabled);
+ else
+ 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)
+{
+ *kp = 3;
+ *kp_div = 14;
+
+ *ki = 3;
+ *ki_div = 500;
+
+ *kd = 4;
+ *kd_div = 40;
+}
+
+__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
+{
+ int current;
+
+ if (port < 0 || port > CONFIG_USB_PD_PORT_MAX_COUNT)
+ return;
+
+ current = (rp == TYPEC_RP_3A0) ? 3000 : 1500;
+
+ 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);
+
+/* Sensor Mutexes */
+static struct mutex g_lid_mutex;
+static struct mutex g_base_mutex;
+
+/* Sensor Data */
+static struct kionix_accel_data g_kx022_data;
+static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
+
+/* Drivers */
+struct motion_sensor_t motion_sensors[] = {
+ [LID_ACCEL] = {
+ .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 = NULL,
+ .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,
+ },
+ },
+ },
+ [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 = NULL,
+ .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,
+ },
+ },
+ },
+ [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 = NULL,
+ .min_frequency = LSM6DSM_ODR_MIN_VAL,
+ .max_frequency = LSM6DSM_ODR_MAX_VAL,
+ },
+};
+
+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},
+};
+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);
+ }
+}
+
+static const struct ec_response_keybd_config keybd1 = {
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
+ },
+ /* No function keys, no numeric keypad and no screenlock key */
+};
+
+__override const struct ec_response_keybd_config
+*board_vivaldi_keybd_config(void)
+{
+ /*
+ * Future boards should use fw_config if needed.
+ */
+
+ return &keybd1;
+}
diff --git a/board/beadrix/board.h b/board/beadrix/board.h
new file mode 100644
index 0000000000..e9787c9373
--- /dev/null
+++ b/board/beadrix/board.h
@@ -0,0 +1,131 @@
+/* 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.
+ */
+
+/* Waddledee board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+/* Select Baseboard features */
+#define VARIANT_DEDEDE_EC_IT8320
+#include "baseboard.h"
+
+/* System unlocked in early development */
+#define CONFIG_SYSTEM_UNLOCKED
+
+#define CONFIG_CMD_CHARGER_DUMP
+
+/* Battery */
+#define CONFIG_BATTERY_FUEL_GAUGE
+
+/* BC 1.2 */
+#define CONFIG_BC12_DETECT_PI3USB9201
+
+/* Charger */
+#define CONFIG_CHARGER_SM5803 /* C0 and C1: Charger */
+#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 */
+
+/*
+ * GPIO for C1 interrupts, for baseboard use
+ *
+ * Note this will only be valid for board revision 1
+ */
+#define GPIO_USB_C1_INT_ODL GPIO_USB_C1_INT_V1_ODL
+
+/* PWM */
+#define CONFIG_PWM
+
+/* Sensors */
+#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)
+
+#define CONFIG_ACCEL_INTERRUPTS
+/* 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_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_TABLET_MODE
+#define CONFIG_TABLET_MODE_SWITCH
+#define CONFIG_GMR_TABLET_MODE
+
+/* 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_ITE_ACTIVE_PORT_COUNT 1
+
+/* Thermistors */
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_THERMISTOR
+#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 */
+
+#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_CH_COUNT
+};
+
+enum temp_sensor_id {
+ TEMP_SENSOR_1,
+ TEMP_SENSOR_2,
+ TEMP_SENSOR_COUNT
+};
+
+/* List of possible batteries */
+enum battery_type {
+ BATTERY_GANFENG,
+ BATTERY_TYPE_COUNT,
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/krabby/build.mk b/board/beadrix/build.mk
index 86903344a1..8167ca9966 100644
--- a/board/krabby/build.mk
+++ b/board/beadrix/build.mk
@@ -4,13 +4,12 @@
# found in the LICENSE file.
#
# Board specific files build
+#
-# the IC is ITE IT8xxx2
CHIP:=it83xx
-CHIP_FAMILY:=it8xxx2
-CHIP_VARIANT:=it81202bx_1024
-BASEBOARD:=corsola
+CHIP_FAMILY:=it8320
+CHIP_VARIANT:=it8320dx
+BASEBOARD:=dedede
-board-y=led.o
-board-y+=battery.o board.o hooks.o
-board-y+=usbc_config.o
+board-y=board.o cbi_ssfc.o led.o usb_pd_policy.o
+board-$(CONFIG_BATTERY_SMART)+=battery.o
diff --git a/board/beadrix/cbi_ssfc.c b/board/beadrix/cbi_ssfc.c
new file mode 100644
index 0000000000..c4b859f133
--- /dev/null
+++ b/board/beadrix/cbi_ssfc.c
@@ -0,0 +1,36 @@
+/* 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.
+ */
+
+#include "cbi_ssfc.h"
+#include "common.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "hooks.h"
+
+#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;
+BUILD_ASSERT(sizeof(cached_ssfc) == sizeof(uint32_t));
+
+static void cbi_ssfc_init(void)
+{
+ if (cbi_get_ssfc(&cached_ssfc.raw_value) != EC_SUCCESS)
+ /* Default to 0 when CBI isn't populated */
+ cached_ssfc.raw_value = 0;
+
+ CPRINTS("Read CBI SSFC : 0x%04X", cached_ssfc.raw_value);
+}
+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;
+}
+
+enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
+{
+ return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+}
diff --git a/board/beadrix/cbi_ssfc.h b/board/beadrix/cbi_ssfc.h
new file mode 100644
index 0000000000..935049b6ae
--- /dev/null
+++ b/board/beadrix/cbi_ssfc.h
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+#ifndef _DEDEDE_CBI_SSFC__H_
+#define _DEDEDE_CBI_SSFC__H_
+
+#include "stdint.h"
+
+/****************************************************************************
+ * Dedede CBI Second Source Factory Cache
+ */
+
+/*
+ * Base Sensor (Bits 0-2)
+ */
+enum ec_ssfc_base_sensor {
+ SSFC_SENSOR_BASE_DEFAULT = 0,
+ SSFC_SENSOR_BMI160 = 1,
+ SSFC_SENSOR_ICM426XX = 2,
+ SSFC_SENSOR_LSM6DSM = 3,
+ SSFC_SENSOR_ICM42607 = 4
+};
+
+/*
+ * Lid Sensor (Bits 3-5)
+ */
+enum ec_ssfc_lid_sensor {
+ SSFC_SENSOR_LID_DEFAULT = 0,
+ SSFC_SENSOR_BMA255 = 1,
+ SSFC_SENSOR_KX022 = 2,
+ SSFC_SENSOR_LIS2DWL = 3
+};
+
+union dedede_cbi_ssfc {
+ struct {
+ uint32_t base_sensor : 3;
+ uint32_t lid_sensor : 3;
+ uint32_t reserved_2 : 26;
+ };
+ uint32_t raw_value;
+};
+
+/**
+ * Get the Base sensor type from SSFC_CONFIG.
+ *
+ * @return the Base sensor board type.
+ */
+enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
+
+/**
+ * Get the Lid sensor type from SSFC_CONFIG.
+ *
+ * @return the Lid sensor board type.
+ */
+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
new file mode 100644
index 0000000000..5c9a2d1a01
--- /dev/null
+++ b/board/beadrix/ec.tasklist
@@ -0,0 +1,24 @@
+/* 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.
+ */
+
+/*
+ * 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(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)
diff --git a/board/beadrix/gpio.inc b/board/beadrix/gpio.inc
new file mode 100644
index 0000000000..7b14151e12
--- /dev/null
+++ b/board/beadrix/gpio.inc
@@ -0,0 +1,142 @@
+/* -*- mode:c -*-
+ *
+ * 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.
+ */
+
+/* Declare symbolic names for all the GPIOs that we care about.
+ * Note: Those with interrupt handlers must be declared first. */
+
+/* Power State interrupts */
+GPIO_INT(SLP_S4_L, PIN(I, 5), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SLP_S3_L, PIN(H, 3), GPIO_INT_BOTH, baseboard_all_sys_pgood_interrupt)
+GPIO_INT(SLP_S0_L, PIN(E, 4), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SLP_SUS_L, PIN(G, 2), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(VCCIN_AUX_VID0, PIN(D, 0), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(RSMRST_PWRGD_L, PIN(E, 1), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(CPU_C10_GATE_L, PIN(G, 1), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(PG_DRAM_OD, PIN(D, 3), GPIO_INT_BOTH, baseboard_all_sys_pgood_interrupt)
+GPIO_INT(PG_PP1050_ST_OD, PIN(L, 1), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(VCCIN_AUX_VID1, PIN(K, 1), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(PG_VCCIO_EXT_OD, PIN(D, 7), GPIO_INT_BOTH, baseboard_all_sys_pgood_interrupt)
+GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset_pin_asserted_interrupt)
+
+GPIO_INT(H1_EC_PWR_BTN_ODL, PIN(E, 2), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt)
+#ifdef CONFIG_LOW_POWER_IDLE
+/* Used to wake up the EC from Deep Doze mode when writing to console */
+GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_BOTH, uart_deepsleep_interrupt) /* UART_DBG_TX_EC_RX */
+#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_V0_ODL, PIN(B, 5), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c1_interrupt) /* TCPC, charger, BC12 - board version 0 */
+GPIO_INT(USB_C1_INT_V1_ODL, PIN(E, 6), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c1_interrupt) /* TCPC, charger, BC12 - board version 1 */
+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, PIN(I, 7), GPIO_INT_BOTH | GPIO_PULL_UP, button_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)
+
+/* Power sequence GPIOs */
+GPIO(EC_AP_RTCRST, PIN(K, 2), GPIO_OUT_LOW)
+GPIO(EC_AP_PWR_BTN_ODL, PIN(B, 6), GPIO_ODR_HIGH)
+GPIO(EC_AP_DPWROK, PIN(L, 7), GPIO_OUT_LOW)
+GPIO(EC_AP_RSMRST_L, PIN(H, 0), GPIO_OUT_LOW)
+GPIO(EC_AP_WAKE_ODL, PIN(D, 5), GPIO_ODR_HIGH)
+GPIO(SYS_RST_ODL, PIN(D, 1), GPIO_ODR_HIGH)
+GPIO(EC_AP_SYS_PWROK, PIN(F, 2), GPIO_OUT_LOW)
+GPIO(PG_PP5000_U_OD, PIN(E, 3), GPIO_INPUT)
+GPIO(EN_PP3300_A, PIN(C, 5), GPIO_OUT_LOW)
+GPIO(EC_AP_PCH_PWROK_OD, PIN(D, 6), GPIO_ODR_LOW)
+GPIO(EN_PP5000_U, PIN(K, 5), GPIO_OUT_LOW)
+/* TODO(b:149775160) - Modify if needed if we ever use this signal. */
+GPIO(EN_VCCST, PIN(D, 4), GPIO_INPUT)
+GPIO(EN_VCCIO_EXT, PIN(B, 2), GPIO_OUT_LOW)
+GPIO(EC_PROCHOT_ODL, PIN(I, 1), GPIO_ODR_HIGH | GPIO_SEL_1P8V)
+GPIO(EC_AP_VCCST_PWRGD_OD, PIN(E, 5), GPIO_ODR_LOW)
+GPIO(ALL_SYS_PWRGD, PIN(B, 7), GPIO_OUT_LOW)
+GPIO(EN_SLP_Z, PIN(K, 3), GPIO_OUT_LOW)
+
+/* Required for icelake chipset code, but implemented through other means for dedede */
+UNIMPLEMENTED(AC_PRESENT)
+UNIMPLEMENTED(PG_EC_DSW_PWROK)
+UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
+
+/* I2C pins - Alternate function below configures I2C module on these pins */
+GPIO(EC_I2C_EEPROM_SCL, PIN(B, 3), GPIO_INPUT)
+GPIO(EC_I2C_EEPROM_SDA, PIN(B, 4), GPIO_INPUT)
+GPIO(EC_I2C_BATTERY_SCL, PIN(C, 1), GPIO_INPUT)
+GPIO(EC_I2C_BATTERY_SDA, PIN(C, 2), GPIO_INPUT)
+GPIO(EC_I2C_SENSOR_SCL, PIN(F, 6), GPIO_INPUT | GPIO_SEL_1P8V)
+GPIO(EC_I2C_SENSOR_SDA, PIN(F, 7), GPIO_INPUT | GPIO_SEL_1P8V)
+GPIO(EC_I2C_SUB_USB_C1_SCL, PIN(E, 0), GPIO_INPUT)
+GPIO(EC_I2C_SUB_USB_C1_SDA, PIN(E, 7), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_SCL, PIN(A, 4), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_SDA, PIN(A, 5), GPIO_INPUT)
+
+/* USB pins */
+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)
+GPIO(EN_USB_A0_VBUS, PIN(L, 6), GPIO_OUT_LOW) /* Board rev 1, NC board rev 0 */
+
+/* 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_1, PIN(L, 3), GPIO_INPUT)
+GPIO(EC_SUB_IO_1_2, PIN(F, 0), GPIO_INPUT)
+GPIO(EC_SUB_IO_2_1, PIN(F, 1), GPIO_INPUT)
+GPIO(EC_SUB_IO_2_2, PIN(L, 2), GPIO_INPUT)
+
+/* Misc */
+GPIO(EN_BL_OD, PIN(K, 4), GPIO_ODR_LOW)
+GPIO(EC_ENTERING_RW, PIN(G, 0), GPIO_OUT_LOW)
+GPIO(CCD_MODE_ODL, PIN(H, 5), GPIO_ODR_HIGH)
+GPIO(EC_BATTERY_PRES_ODL, PIN(I, 4), GPIO_INPUT)
+GPIO(PEN_DET_ODL, PIN(J, 1), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(EN_KB_BL, PIN(J, 3), GPIO_OUT_LOW) /* Currently unused */
+GPIO(ECH1_PACKET_MODE, PIN(H, 1), GPIO_OUT_LOW)
+
+/* LEDs */
+GPIO(EC_LED_R_ODL, PIN(A, 1), GPIO_OUT_LOW)
+GPIO(EC_LED_B_ODL, PIN(A, 3), GPIO_OUT_LOW)
+
+/* NC pins, enable internal pull-down to avoid floating state. */
+GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(GPIOC3_NC, PIN(C, 3), 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(GPIOM6_NC, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+
+/* Alternate functions GPIO definitions */
+/* UART */
+ALTERNATE(PIN_MASK(B, BIT(0) | BIT(1)), 0, MODULE_UART, 0) /* UART for debug */
+
+/* I2C */
+ALTERNATE(PIN_MASK(B, BIT(3) | BIT(4)), 0, MODULE_I2C, 0) /* I2C0 */
+ALTERNATE(PIN_MASK(C, BIT(1) | BIT(2)), 0, MODULE_I2C, 0) /* I2C1 */
+ALTERNATE(PIN_MASK(F, BIT(6) | BIT(7)), 0, MODULE_I2C, GPIO_SEL_1P8V) /* I2C2 - 1.8V */
+ALTERNATE(PIN_MASK(E, BIT(0) | BIT(7)), 0, MODULE_I2C, 0) /* I2C4 */
+ALTERNATE(PIN_MASK(A, BIT(4) | BIT(5)), 0, MODULE_I2C, 0) /* I2C5 */
+
+/* ADC */
+ALTERNATE(PIN_MASK(L, BIT(0)), 0, MODULE_ADC, 0) /* ADC13: EC_SUB_ANALOG */
+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/beadrix/led.c b/board/beadrix/led.c
new file mode 100644
index 0000000000..ab011d49d4
--- /dev/null
+++ b/board/beadrix/led.c
@@ -0,0 +1,154 @@
+/* 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.
+ */
+
+/* Beadrix specific LED settings. */
+
+#include "battery.h"
+#include "charge_manager.h"
+#include "charge_state.h"
+#include "chipset.h"
+#include "common.h"
+#include "ec_commands.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "led_common.h"
+#include "system.h"
+#include "util.h"
+
+#define LED_ONE_SEC (1000 / HOOK_TICK_INTERVAL_MS)
+#define BAT_LED_ON 0
+#define BAT_LED_OFF 1
+
+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 */
+};
+
+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);
+ gpio_set_level(GPIO_EC_LED_B_ODL,
+ (color == LED_BLUE) ? BAT_LED_ON : BAT_LED_OFF);
+}
+
+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_BLUE] = 1;
+}
+
+int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
+{
+ if (brightness[EC_LED_COLOR_BLUE] != 0)
+ led_set_color(LED_BLUE);
+ else if (brightness[EC_LED_COLOR_RED] != 0)
+ led_set_color(LED_RED);
+ else
+ led_set_color(LED_OFF);
+
+ return EC_SUCCESS;
+}
+
+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++;
+
+ switch (charge_get_state()) {
+ case PWR_STATE_CHARGE:
+ /* Always indicate amber on when charging. */
+ color = LED_RED;
+ break;
+ case PWR_STATE_DISCHARGE:
+ if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND)) {
+ /* Discharging in S3: Red 1 sec, off 3 sec */
+ period = (1 + 3) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 1 * LED_ONE_SEC)
+ color = LED_RED;
+ else
+ color = LED_OFF;
+ } else if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) {
+ /* Discharging in S5: off */
+ color = LED_OFF;
+ } else if (chipset_in_state(CHIPSET_STATE_ON)) {
+ /* Discharging in S0: Blue on */
+ color = LED_BLUE;
+ }
+ break;
+ case PWR_STATE_ERROR:
+ /* Battery error: Red 1 sec, off 1 sec */
+ period = (1 + 1) * LED_ONE_SEC;
+ battery_ticks = battery_ticks % period;
+ if (battery_ticks < 1 * LED_ONE_SEC)
+ color = LED_RED;
+ else
+ color = LED_OFF;
+ break;
+ case PWR_STATE_CHARGE_NEAR_FULL:
+ /* Full Charged: Blue on */
+ 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;
+ default:
+ /* Other states don't alter LED behavior */
+ break;
+ }
+
+ led_set_color(color);
+}
+
+/* Called by hook task every TICK */
+static void led_tick(void)
+{
+ if (led_auto_control_is_enabled(EC_LED_ID_BATTERY_LED))
+ board_led_set_battery();
+}
+DECLARE_HOOK(HOOK_TICK, led_tick, HOOK_PRIO_DEFAULT);
+
+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))
+ return;
+
+ if (state == LED_STATE_RESET) {
+ led_auto_control(EC_LED_ID_BATTERY_LED, 1);
+ board_led_set_battery();
+ return;
+ }
+
+ color = state ? LED_BLUE : LED_OFF;
+
+ led_auto_control(EC_LED_ID_BATTERY_LED, 0);
+
+ led_set_color(color);
+}
diff --git a/board/beadrix/usb_pd_policy.c b/board/beadrix/usb_pd_policy.c
new file mode 100644
index 0000000000..3ff7152541
--- /dev/null
+++ b/board/beadrix/usb_pd_policy.c
@@ -0,0 +1,85 @@
+/* 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.
+ */
+
+#include "battery_smart.h"
+#include "charge_manager.h"
+#include "charger.h"
+#include "chipset.h"
+#include "common.h"
+#include "console.h"
+#include "driver/charger/sm5803.h"
+#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)
+
+int pd_check_vconn_swap(int port)
+{
+ /* Allow VCONN swaps if the AP is on */
+ return chipset_in_state(CHIPSET_STATE_ANY_SUSPEND | CHIPSET_STATE_ON);
+}
+
+void pd_power_supply_reset(int port)
+{
+ int prev_en;
+
+ if (port < 0 || port >= board_get_usb_pd_port_count())
+ return;
+
+ prev_en = charger_is_sourcing_otg_power(port);
+
+ /* Disable Vbus */
+ charger_enable_otg_power(port, 0);
+
+ /* Discharge Vbus if previously enabled */
+ if (prev_en)
+ sm5803_set_vbus_disch(port, 1);
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+}
+
+int pd_set_power_supply_ready(int port)
+{
+ enum ec_error_list rv;
+
+ /* Disable sinking */
+ rv = sm5803_vbus_sink_enable(port, 0);
+ if (rv)
+ return rv;
+
+ /* Disable Vbus discharge */
+ sm5803_set_vbus_disch(port, 0);
+
+ /* Provide Vbus */
+ charger_enable_otg_power(port, 1);
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
+ return EC_SUCCESS;
+}
+
+__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;
+}
+
+int pd_snk_is_vbus_provided(int port)
+{
+ return sm5803_is_vbus_present(port);
+}
diff --git a/board/kingler/vif_override.xml b/board/beadrix/vif_override.xml
index 32736caf64..32736caf64 100644
--- a/board/kingler/vif_override.xml
+++ b/board/beadrix/vif_override.xml
diff --git a/board/beetley/board.c b/board/beetley/board.c
index 08c9ba5066..096e590a70 100644
--- a/board/beetley/board.c
+++ b/board/beetley/board.c
@@ -266,8 +266,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_lsm6dsm_ref,
@@ -295,8 +293,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/blipper/board.c b/board/blipper/board.c
index 0f19763ebd..047e28f277 100644
--- a/board/blipper/board.c
+++ b/board/blipper/board.c
@@ -273,8 +273,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = NULL, /* identity matrix */
@@ -302,8 +300,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -454,9 +450,11 @@ void board_init(void)
gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
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);
} else {
diff --git a/board/blipper/board.h b/board/blipper/board.h
index 9f0865b66b..b4dc85d9fa 100644
--- a/board/blipper/board.h
+++ b/board/blipper/board.h
@@ -110,6 +110,9 @@
#define USB_PORT_COUNT 1
#define CONFIG_USB_PORT_POWER_DUMB
+/* Button Config*/
+#define CONFIG_BUTTONS_RUNTIME_CONFIG
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/bloog/board.c b/board/bloog/board.c
index dfad4ab281..47802bf584 100644
--- a/board/bloog/board.c
+++ b/board/bloog/board.c
@@ -167,8 +167,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -199,8 +197,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/boldar/ec.tasklist b/board/boldar/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/boldar/ec.tasklist
+++ b/board/boldar/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/boten/board.c b/board/boten/board.c
index 17436a0091..f4c951a7c4 100644
--- a/board/boten/board.c
+++ b/board/boten/board.c
@@ -397,8 +397,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -426,8 +424,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -472,6 +468,8 @@ void board_init(void)
gpio_set_flags(GPIO_LID_360_L, 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);
+ button_disable_gpio(BUTTON_VOLUME_UP);
+ button_disable_gpio(BUTTON_VOLUME_DOWN);
}
/* Set LEDs luminance */
diff --git a/board/boten/board.h b/board/boten/board.h
index 8c2b1d4417..bebc7d37c5 100644
--- a/board/boten/board.h
+++ b/board/boten/board.h
@@ -94,6 +94,7 @@
#define CONFIG_USB_PORT_POWER_DUMB
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+#define CONFIG_BUTTONS_RUNTIME_CONFIG
#ifndef __ASSEMBLER__
diff --git a/board/brask/board.h b/board/brask/board.h
index df15615bdd..a9bb47c3b0 100644
--- a/board/brask/board.h
+++ b/board/brask/board.h
@@ -38,11 +38,12 @@
#define CONFIG_USB_PD_PPC
#define CONFIG_USB_PD_TCPM_RT1715
#define CONFIG_USBC_RETIMER_INTEL_BB
-/* TODO: Do not add CONFIG_KB800X_CUSTOM_XBAR until find out how
- * to config ss_lane.
- */
+
#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 */
@@ -74,6 +75,7 @@
#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
@@ -128,7 +130,7 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
/* ADC */
@@ -138,7 +140,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
diff --git a/board/brask/build.mk b/board/brask/build.mk
index 442a708d78..81ecfa4164 100644
--- a/board/brask/build.mk
+++ b/board/brask/build.mk
@@ -13,6 +13,7 @@ BASEBOARD:=brask
board-y=
board-y+=board.o
+board-y+=fans.o
board-y+=i2c.o
board-y+=led.o
board-y+=pwm.o
diff --git a/board/brask/fans.c b/board/brask/fans.c
new file mode 100644
index 0000000000..f2a70636d0
--- /dev/null
+++ b/board/brask/fans.c
@@ -0,0 +1,50 @@
+/* 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"
+
+/* 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/brask/gpio.inc b/board/brask/gpio.inc
index 49403519c6..fddf0ee837 100644
--- a/board/brask/gpio.inc
+++ b/board/brask/gpio.inc
@@ -73,6 +73,7 @@ GPIO(GSC_EC_RECOVERY_BTN_OD, PIN(2, 2), GPIO_INPUT)
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 */
/* TODO(b/191418683): Implement Qi Driver */
@@ -82,7 +83,7 @@ GPIO(EC_I2C_QI_INT_ODL, PIN(9, 6), GPIO_INPUT)
/* HDMI CEC */
/* TODO(b/197474873): Enable HDMI CEC */
-GPIO(HDMI_CEC_IN, PIN(7, 3), GPIO_INPUT)
+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)
@@ -106,7 +107,7 @@ 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_OC_ODL, PIN(3, 1), GPIO_INPUT)
+GPIO(USB_A0_OC_ODL, PIN(3, 1), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A1_OC_ODL, PIN(3, 0), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A2_OC_ODL, PIN(2, 7), GPIO_INPUT | GPIO_PULL_UP)
GPIO(USB_A3_OC_ODL, PIN(2, 6), GPIO_INPUT | GPIO_PULL_UP)
@@ -118,6 +119,7 @@ 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 */
@@ -128,7 +130,7 @@ GPIO(LED_RED_L, PIN(C, 4), GPIO_OUT_LOW)
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_ODL, PIN(0, 2), GPIO_ODR_LOW)
+GPIO(USB_C1_RT_RST_R_L, PIN(0, 2), GPIO_OUT_LOW)
/* GPIO02_P2 to PU */
/* GPIO03_P2 to PU */
@@ -156,7 +158,7 @@ ALTERNATE(PIN_MASK(E, 0x18), 0, MODULE_I2C, 0) /* GPIOE4/I2C6_SCL1
ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */
/* 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(B, 0x80), 0, MODULE_PWM, 0) /* GPIOB7/PWM5 */
ALTERNATE(PIN_MASK(C, 0x18), 0, MODULE_PWM, 0) /* GPIOC4/PWM2, GPIOC3/PWM0 */
@@ -177,6 +179,4 @@ 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, 5)) /* KSO12/GPIO05 */
-UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */
-UNUSED(PIN(8, 0)) /* GPIO80/PWM3 */
+UNUSED(PIN(0, 4)) /* KSO13/GPIO04 */ \ No newline at end of file
diff --git a/board/brask/usbc_config.c b/board/brask/usbc_config.c
index 8363c71f88..6e5ac609f3 100644
--- a/board/brask/usbc_config.c
+++ b/board/brask/usbc_config.c
@@ -111,7 +111,13 @@ struct kb800x_control_t kb800x_control[] = {
[USBC_PORT_C0] = {
},
[USBC_PORT_C1] = {
- .retimer_rst_gpio = GPIO_USB_C1_RT_RST_R_ODL,
+ .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] = {
},
@@ -249,7 +255,7 @@ void board_reset_pd_mcu(void)
*/
gpio_set_level(tcpc_rst, 0);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 0);
/*
* delay for power-on to reset-off and min. assertion time
@@ -258,7 +264,7 @@ void board_reset_pd_mcu(void)
msleep(20);
gpio_set_level(tcpc_rst, 1);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_L, 1);
/* wait for chips to come up */
diff --git a/board/brya/board.h b/board/brya/board.h
index f7ce860fe9..a599476530 100644
--- a/board/brya/board.h
+++ b/board/brya/board.h
@@ -132,6 +132,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
/*
@@ -196,7 +197,7 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_FANS FAN_CH_COUNT
diff --git a/board/brya/ec.tasklist b/board/brya/ec.tasklist
index e4ad7a05a8..260f6561d9 100644
--- a/board/brya/ec.tasklist
+++ b/board/brya/ec.tasklist
@@ -20,6 +20,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
diff --git a/board/brya/fw_config.c b/board/brya/fw_config.c
index 9c28c3ca58..414908a1f1 100644
--- a/board/brya/fw_config.c
+++ b/board/brya/fw_config.c
@@ -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_SYSTEM, format, ## args)
static union brya_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
diff --git a/board/brya/generated-gpio.inc b/board/brya/generated-gpio.inc
index 4daa60c5c9..f4772188a5 100644
--- a/board/brya/generated-gpio.inc
+++ b/board/brya/generated-gpio.inc
@@ -120,5 +120,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 */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/brya/sensors.c b/board/brya/sensors.c
index 0a4b0198bd..b68a2b6d3d 100644
--- a/board/brya/sensors.c
+++ b/board/brya/sensors.c
@@ -131,10 +131,8 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lis2dw12_drv,
.mutex = &g_lid_accel_mutex,
.drv_data = &g_lis2dw12_data,
- .int_signal = GPIO_EC_ACCEL_INT_R_L,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LIS2DW12_ADDR0,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.rot_standard_ref = &lid_standard_ref, /* identity matrix */
.default_range = 2, /* g */
.min_frequency = LIS2DW12_ODR_MIN_VAL,
@@ -161,8 +159,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -191,8 +187,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/brya/usbc_config.c b/board/brya/usbc_config.c
index f653a93d1f..7f54cde5a5 100644
--- a/board/brya/usbc_config.c
+++ b/board/brya/usbc_config.c
@@ -354,29 +354,23 @@ void board_reset_pd_mcu(void)
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()) {
+ 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.
- */
- if (get_board_id() == 1) {
- enable_ioex(IOEX_ID_1_C0_NCT38XX);
- enable_ioex(IOEX_ID_1_C2_NCT38XX);
- } else {
- enable_ioex(IOEX_C0_NCT38XX);
- enable_ioex(IOEX_C2_NCT38XX);
- }
+ /*
+ * 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.
+ */
+ 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);
}
/* Enable PPC interrupts. */
diff --git a/board/bugzzy/board.c b/board/bugzzy/board.c
index 315f3a738b..64a24f0618 100644
--- a/board/bugzzy/board.c
+++ b/board/bugzzy/board.c
@@ -438,6 +438,12 @@ static const mat33_fp_t base_standard_ref = {
{ 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",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -448,11 +454,9 @@ struct motion_sensor_t ldm6dsm_base_accel = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
+ .rot_standard_ref = &base_standard_ref_lsm,
.default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
@@ -479,12 +483,10 @@ struct motion_sensor_t ldm6dsm_base_gyro = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
- .rot_standard_ref = &base_standard_ref,
+ .rot_standard_ref = &base_standard_ref_lsm,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
@@ -871,6 +873,11 @@ static void lcd_reset_change_deferred(void)
if (signal != 0)
return;
+ signal = gpio_get_level(GPIO_EN_PP1800_PANEL_S0);
+
+ if (signal == 0)
+ return;
+
i2c_write8(I2C_PORT_LCD, I2C_ADDR_ISL98607_FLAGS,
ISL98607_REG_ENABLE, ISL97607_VP_VN_VBST_DIS);
@@ -878,7 +885,7 @@ static void lcd_reset_change_deferred(void)
DECLARE_DEFERRED(lcd_reset_change_deferred);
void lcd_reset_change_interrupt(enum gpio_signal signal)
{
- hook_call_deferred(&lcd_reset_change_deferred_data, 10 * MSEC);
+ hook_call_deferred(&lcd_reset_change_deferred_data, 45 * MSEC);
}
/**
@@ -921,7 +928,7 @@ 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_19P4_CHEN_ALL);
+ 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 9b9f6cf015..7782cecbe0 100644
--- a/board/bugzzy/board.h
+++ b/board/bugzzy/board.h
@@ -11,12 +11,7 @@
#define VARIANT_DEDEDE_EC_NPCX796FC
#include "baseboard.h"
-/*
- * Keep the system unlocked in early development.
- * TODO(b/151264302): Make sure to remove this before production!
- */
-#define CONFIG_SYSTEM_UNLOCKED
-
+#undef CONFIG_I2C_DEBUG
/*
* The RAM and flash size combination on the the NPCX797FC does not leave
* any unused flash space that can be used to store the .init_rom section.
@@ -147,6 +142,9 @@
#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
*
diff --git a/board/bugzzy/led.c b/board/bugzzy/led.c
index d04026e0f0..17da244534 100644
--- a/board/bugzzy/led.c
+++ b/board/bugzzy/led.c
@@ -53,12 +53,23 @@ const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
__override void led_set_color_power(enum ec_led_colors color)
{
+ static enum ec_led_colors prev_color = EC_LED_COLOR_COUNT;
+
/* 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)) {
return;
}
+ /*
+ * Sometimes system wakes and sleeps automatically.
+ * Add LED debounce time to prevent blinking led by this.
+ */
+ if (prev_color != color) {
+ prev_color = color;
+ return;
+ }
+
if (color == EC_LED_COLOR_BLUE)
{
gpio_set_level(GPIO_BAT_LED_RED_L, LED_OFF_LVL);
@@ -72,6 +83,8 @@ __override void led_set_color_power(enum ec_led_colors color)
__override void led_set_color_battery(enum ec_led_colors color)
{
+ static enum ec_led_colors prev_color = EC_LED_COLOR_COUNT;
+
/* 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)) {
@@ -79,6 +92,14 @@ __override void led_set_color_battery(enum ec_led_colors color)
}
/*
+ * Sometimes system wakes and sleeps automatically.
+ * Add LED debounce time to prevent blinking led by this.
+ */
+ if (prev_color != color) {
+ prev_color = color;
+ return;
+ }
+ /*
* Battery leds must be turn off when blue led is on
* because bugzzy has 3-in-1 led.
*/
diff --git a/board/burnet/board.c b/board/burnet/board.c
index f98955a19d..5ee2ad3965 100644
--- a/board/burnet/board.c
+++ b/board/burnet/board.c
@@ -69,13 +69,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 100, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -141,8 +160,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/burnet/board.h b/board/burnet/board.h
index 3f92864907..f59d3d5972 100644
--- a/board/burnet/board.h
+++ b/board/burnet/board.h
@@ -89,7 +89,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/c2d2/board.c b/board/c2d2/board.c
index 3327ea43b6..7e83c58013 100644
--- a/board/c2d2/board.c
+++ b/board/c2d2/board.c
@@ -155,6 +155,7 @@ const void *const usb_strings[] = {
[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"),
diff --git a/board/c2d2/board.h b/board/c2d2/board.h
index a8095ece4d..ada5b01ab6 100644
--- a/board/c2d2/board.h
+++ b/board/c2d2/board.h
@@ -128,6 +128,7 @@ enum usb_strings {
USB_STR_USART4_STREAM_NAME,
USB_STR_UPDATE_NAME,
USB_STR_CONSOLE_NAME,
+ USB_STR_SPI_NAME,
USB_STR_I2C_NAME,
USB_STR_USART3_STREAM_NAME,
USB_STR_USART1_STREAM_NAME,
diff --git a/board/cappy2/board.h b/board/cappy2/board.h
index be34d2b906..5a2fa75bba 100644
--- a/board/cappy2/board.h
+++ b/board/cappy2/board.h
@@ -77,7 +77,8 @@
#define CONFIG_TEMP_SENSOR
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PP3300_A
+#define CONFIG_TEMP_SENSOR_POWER
+#define GPIO_TEMP_SENSOR_POWER GPIO_EN_PP3300_A
/* I2C configuration */
#define I2C_PORT_EEPROM NPCX_I2C_PORT7_0
diff --git a/board/careena/board.c b/board/careena/board.c
index ea2a886c03..e8171b1be0 100644
--- a/board/careena/board.c
+++ b/board/careena/board.c
@@ -30,11 +30,41 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL_AP, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, 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);
diff --git a/board/cerise/board.c b/board/cerise/board.c
index 78ab8f6de8..9f2f93e12d 100644
--- a/board/cerise/board.c
+++ b/board/cerise/board.c
@@ -67,13 +67,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 100, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -139,8 +158,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/cerise/board.h b/board/cerise/board.h
index 5cf8c06f01..ce2b692ae8 100644
--- a/board/cerise/board.h
+++ b/board/cerise/board.h
@@ -86,7 +86,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/cherry/board.h b/board/cherry/board.h
index 9db5042085..1c52eac8ba 100644
--- a/board/cherry/board.h
+++ b/board/cherry/board.h
@@ -15,6 +15,7 @@
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED
#define CONFIG_LTO
+#define CONFIG_PRESERVE_LOGS
/*
* TODO: Remove this option once the VBAT no longer keeps high when
@@ -29,7 +30,7 @@
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* PD / USB-C / PPC */
-#define CONFIG_USB_PD_DEBUG_LEVEL 3
+#define CONFIG_USB_PD_DEBUG_LEVEL 0
/* Optional console commands */
#define CONFIG_CMD_FLASH
diff --git a/board/cherry_scp/board.h b/board/cherry_scp/board.h
index a698ff2bb3..dcf7f09a6f 100644
--- a/board/cherry_scp/board.h
+++ b/board/cherry_scp/board.h
@@ -14,7 +14,7 @@
* RW only, no flash
* +-------------------- 0x0
* | ROM vectortable, .text, .rodata, .data LMA
- * +-------------------- 0x58000
+ * +-------------------- 0x68000
* | RAM .bss, .data
* +-------------------- 0xbfc00
* | Reserved (padding for 1k-alignment)
diff --git a/board/chronicler/battery.c b/board/chronicler/battery.c
index 82347953ba..aee0095765 100644
--- a/board/chronicler/battery.c
+++ b/board/chronicler/battery.c
@@ -32,41 +32,7 @@
* address, mask, and disconnect value need to be provided.
*/
const struct board_batt_params board_battery_info[] = {
- /* Fujitsu CP813907-01 Battery Information */
- [BATTERY_FUJITSU_CP813907] = {
- .fuel_gauge = {
- .manuf_name = "Fujitsu",
- .device_name = "CP813907-01",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x10, 0x10 },
- },
- .fet = {
- .reg_addr = 0x00,
- .reg_mask = 0x2000,
- .disconnect_val = 0x2000,
- }
- },
- .batt_info = {
- .voltage_max = 13200, /* mV */
- .voltage_normal = 11550, /* mV */
- .voltage_min = 9000, /* mV */
- .precharge_current = 128, /* mA */
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 55,
- .discharging_min_c = -20,
- .discharging_max_c = 60,
- },
- },
-
/* NVT CP813907-01 Battery Information */
- /*
- * NVT CP813907-01 Battery only use to support early
- * stage battery, all battery for PVT will update
- * manufacturer name to Fujitsu. See b/190685811.
- */
[BATTERY_NVT_CP813907] = {
.fuel_gauge = {
.manuf_name = "NVT",
@@ -97,4 +63,4 @@ 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_FUJITSU_CP813907;
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_NVT_CP813907;
diff --git a/board/chronicler/board.h b/board/chronicler/board.h
index 1a205d06ae..87d1c2a21f 100644
--- a/board/chronicler/board.h
+++ b/board/chronicler/board.h
@@ -137,7 +137,6 @@
#include "usbc_config.h"
enum battery_type {
- BATTERY_FUJITSU_CP813907,
BATTERY_NVT_CP813907,
BATTERY_TYPE_COUNT
};
diff --git a/board/chronicler/ec.tasklist b/board/chronicler/ec.tasklist
index c7a977f0ff..df7495f2a1 100644
--- a/board/chronicler/ec.tasklist
+++ b/board/chronicler/ec.tasklist
@@ -15,6 +15,7 @@
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/coachz/board.c b/board/coachz/board.c
index 81a749c1d1..01c4d85b95 100644
--- a/board/coachz/board.c
+++ b/board/coachz/board.c
@@ -191,18 +191,48 @@ static void ks_interrupt(enum gpio_signal s)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"wlc", I2C_PORT_WLC, 400, GPIO_EC_I2C_WLC_SCL,
- GPIO_EC_I2C_WLC_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/coachz/build.mk b/board/coachz/build.mk
index 5b6ecb0398..e8e293064e 100644
--- a/board/coachz/build.mk
+++ b/board/coachz/build.mk
@@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7
CHIP_VARIANT:=npcx7m6fc
BASEBOARD:=trogdor
-board-y=battery.o board.o led.o base_detect.o
+board-y=battery.o board.o led.o base_detect.o usbc_config.o
diff --git a/board/coachz/usbc_config.c b/board/coachz/usbc_config.c
new file mode 100644
index 0000000000..8f3fb02c30
--- /dev/null
+++ b/board/coachz/usbc_config.c
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "usb_pd.h"
+
+#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/coffeecake/board.c b/board/coffeecake/board.c
index 2939a65125..b344a5f745 100644
--- a/board/coffeecake/board.c
+++ b/board/coffeecake/board.c
@@ -31,7 +31,13 @@ void vbus_event(enum gpio_signal signal);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"charger", I2C_PORT_SY21612, 400, GPIO_I2C0_SCL, 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);
diff --git a/board/coffeecake/board.h b/board/coffeecake/board.h
index d655466a14..cabbb0bf4e 100644
--- a/board/coffeecake/board.h
+++ b/board/coffeecake/board.h
@@ -32,7 +32,7 @@
#define CONFIG_RWSIG
#define CONFIG_RWSIG_TYPE_USBPD1
#define CONFIG_SHA256
-/* TODO(tbroch) Re-enable once STM spi master can be inhibited at boot so it
+/* TODO(tbroch) Re-enable once STM spi controller can be inhibited at boot so it
doesn't interfere with HDMI loading its f/w */
#undef CONFIG_SPI_FLASH
#define CONFIG_SPI_CS_GPIO GPIO_PD_MCDP_SPI_CS_L
diff --git a/board/collis/ec.tasklist b/board/collis/ec.tasklist
index e76bd368eb..ca6d9fbf14 100644
--- a/board/collis/ec.tasklist
+++ b/board/collis/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/copano/ec.tasklist b/board/copano/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/copano/ec.tasklist
+++ b/board/copano/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/coral/board.c b/board/coral/board.c
index a563071294..17fd01da0e 100644
--- a/board/coral/board.c
+++ b/board/coral/board.c
@@ -154,16 +154,41 @@ const struct pwm_t pwm_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", NPCX_I2C_PORT0_0, 400,
- GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", NPCX_I2C_PORT0_1, 400,
- GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA},
- {"accelgyro", I2C_PORT_GYRO, 400,
- GPIO_EC_I2C_GYRO_SCL, GPIO_EC_I2C_GYRO_SDA},
- {"sensors", NPCX_I2C_PORT2, 400,
- GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA},
- {"batt", NPCX_I2C_PORT3, 100,
- GPIO_EC_I2C_POWER_SCL, GPIO_EC_I2C_POWER_SDA},
+ {
+ .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);
diff --git a/board/coral/board.h b/board/coral/board.h
index 0def402993..bac1a2c5f5 100644
--- a/board/coral/board.h
+++ b/board/coral/board.h
@@ -105,7 +105,7 @@
#define CONFIG_USBC_VCONN_SWAP
/* SoC / PCH */
-#define CONFIG_HOSTCMD_LPC
+#define CONFIG_HOST_INTERFACE_LPC
#define CONFIG_CHIPSET_APOLLOLAKE
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_POWER_BUTTON
diff --git a/board/coral/gpio.inc b/board/coral/gpio.inc
index 0f3acc3375..da15615c86 100644
--- a/board/coral/gpio.inc
+++ b/board/coral/gpio.inc
@@ -62,7 +62,7 @@ GPIO(EC_I2C_POWER_SCL, PIN(D, 1), GPIO_INPUT)
* Pin 57 (SER_IRQ) defaults to LPC mode, but we also have EC_PCH_KB_INT_ODL
* (Pin B0) in case it doesn't work (Set CONFIG_KEYBOARD_IRQ_GPIO in this case).
*
- * See also the NO_LPC_ESPI bit in DEVALT1 and the CONFIG_HOSTCMD_SHI option.
+ * See also the NO_LPC_ESPI bit in DEVALT1 and the CONFIG_HOST_INTERFACE_SHI option.
*/
GPIO(PCH_SMI_L, PIN(A, 6), GPIO_ODR_HIGH | GPIO_SEL_1P8V) /* EC_SMI_ODL */
diff --git a/board/corori/board.c b/board/corori/board.c
index 03f9641d9f..dc946fa4f9 100644
--- a/board/corori/board.c
+++ b/board/corori/board.c
@@ -447,30 +447,45 @@ DECLARE_HOOK(HOOK_AC_CHANGE, board_extpower, HOOK_PRIO_DEFAULT);
const struct i2c_port_t i2c_ports[] = {
{
- "eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA
},
{
- "battery", I2C_PORT_BATTERY, 100, GPIO_EC_I2C_BATTERY_SCL,
- GPIO_EC_I2C_BATTERY_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
{
- "sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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
{
- "usbc0", I2C_PORT_USB_C0, 1000, GPIO_EC_I2C_USB_C0_SCL,
- 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
{
- "sub_usbc1", I2C_PORT_SUB_USB_C1, 1000,
- GPIO_EC_I2C_SUB_USB_C1_SCL, 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/corori2/battery.c b/board/corori2/battery.c
new file mode 100644
index 0000000000..1263e4cef0
--- /dev/null
+++ b/board/corori2/battery.c
@@ -0,0 +1,100 @@
+/* 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.
+ *
+ * Battery pack vendor provided charging profile
+ */
+
+#include "battery.h"
+#include "battery_fuel_gauge.h"
+#include "charge_state.h"
+#include "common.h"
+#include "util.h"
+
+/*
+ * Battery info for all waddledoo 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[] = {
+ /* C21N2018 Battery Information*/
+ [BATTERY_C21N2018] = {
+ .fuel_gauge = {
+ .manuf_name = "AS3GXXD3KA",
+ .device_name = "C110160",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .reg_addr = 0x0,
+ .reg_mask = 0x2000,
+ .disconnect_val = 0x2000,
+ .cfet_mask = 0x4000,
+ .cfet_off_val = 0x4000,
+ },
+ },
+ .batt_info = {
+ .voltage_max = 8800,
+ .voltage_normal = 7890,
+ .voltage_min = 6000,
+ .precharge_current = 256,
+ .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,
+ },
+ },
+ /* C21N2018 second Battery Information*/
+ [BATTERY_C21N2018_2ND] = {
+ .fuel_gauge = {
+ .manuf_name = "AS3FXXD3KA",
+ .device_name = "C110160",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .reg_addr = 0x0,
+ .reg_mask = 0x2000,
+ .disconnect_val = 0x2000,
+ .cfet_mask = 0x4000,
+ .cfet_off_val = 0x4000,
+ },
+ },
+ .batt_info = {
+ .voltage_max = 8800,
+ .voltage_normal = 7890,
+ .voltage_min = 6000,
+ .precharge_current = 256,
+ .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);
+
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_C21N2018;
diff --git a/board/corori2/board.c b/board/corori2/board.c
new file mode 100644
index 0000000000..df2fac683f
--- /dev/null
+++ b/board/corori2/board.c
@@ -0,0 +1,745 @@
+/* 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.
+ */
+
+/* Waddledoo board-specific configuration */
+
+#include "adc_chip.h"
+#include "button.h"
+#include "cbi_fw_config.h"
+#include "charge_manager.h"
+#include "charge_state_v2.h"
+#include "charger.h"
+#include "chipset.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "driver/temp_sensor/thermistor.h"
+#include "temp_sensor.h"
+#include "driver/accel_bma2x2.h"
+#include "driver/accelgyro_bmi_common.h"
+#include "driver/bc12/pi3usb9201.h"
+#include "driver/charger/isl923x.h"
+#include "driver/retimer/nb7v904m.h"
+#include "driver/tcpm/raa489000.h"
+#include "driver/tcpm/tcpci.h"
+#include "driver/usb_mux/pi3usb3x532.h"
+#include "extpower.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "i2c.h"
+#include "keyboard_scan.h"
+#include "lid_switch.h"
+#include "motion_sense.h"
+#include "power.h"
+#include "power_button.h"
+#include "pwm.h"
+#include "pwm_chip.h"
+#include "stdbool.h"
+#include "switch.h"
+#include "system.h"
+#include "tablet_mode.h"
+#include "task.h"
+#include "usb_mux.h"
+#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 INT_RECHECK_US 5000
+
+/* C0 interrupt line shared by BC 1.2 and charger */
+static void check_c0_line(void);
+DECLARE_DEFERRED(check_c0_line);
+
+static void notify_c0_chips(void)
+{
+ /*
+ * The interrupt line is shared between the TCPC and BC 1.2 detection
+ * chip. Therefore we'll need to check both ICs.
+ */
+ schedule_deferred_pd_interrupt(0);
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
+}
+
+static void check_c0_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_C0_INT_ODL)) {
+ notify_c0_chips();
+ hook_call_deferred(&check_c0_line_data, INT_RECHECK_US);
+ }
+}
+
+static void usb_c0_interrupt(enum gpio_signal s)
+{
+ /* Cancel any previous calls to check the interrupt line */
+ hook_call_deferred(&check_c0_line_data, -1);
+
+ /* Notify all chips using this line that an interrupt came in */
+ notify_c0_chips();
+
+ /* 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 */
+static void check_c1_line(void);
+DECLARE_DEFERRED(check_c1_line);
+
+static void notify_c1_chips(void)
+{
+ schedule_deferred_pd_interrupt(1);
+ task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
+}
+
+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_SUB_C1_INT_EN_RAILS_ODL)) {
+ notify_c1_chips();
+ hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
+ }
+}
+
+static void sub_usb_c1_interrupt(enum gpio_signal s)
+{
+ /* Cancel any previous calls to check the interrupt line */
+ hook_call_deferred(&check_c1_line_data, -1);
+
+ /* Notify all chips using this line that an interrupt came in */
+ notify_c1_chips();
+
+ /* 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)
+{
+ int hdmi_hpd_odl = gpio_get_level(GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL);
+
+ gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, !hdmi_hpd_odl);
+}
+
+#include "gpio_list.h"
+
+/* ADC channels */
+const struct adc_t adc_channels[] = {
+ [ADC_TEMP_SENSOR_1] = {
+ .name = "TEMP_SENSOR1",
+ .input_ch = NPCX_ADC_CH0,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_TEMP_SENSOR_2] = {
+ .name = "TEMP_SENSOR2",
+ .input_ch = NPCX_ADC_CH1,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_SUB_ANALOG] = {
+ .name = "SUB_ANALOG",
+ .input_ch = NPCX_ADC_CH2,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+ [ADC_VSNS_PP3300_A] = {
+ .name = "PP3300_A_PGOOD",
+ .input_ch = NPCX_ADC_CH9,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
+};
+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},
+};
+BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
+
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
+#define THERMAL_MEMORY \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_WARN] = 0, \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(95), \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_WARN] = 0, \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(70), \
+ [EC_TEMP_THRESH_HALT] = 0, \
+ }, \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_memory =
+ THERMAL_MEMORY;
+
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
+#define THERMAL_CHARGER \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_WARN] = 0, \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(80), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(85), \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_WARN] = 0, \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(55), \
+ [EC_TEMP_THRESH_HALT] = 0, \
+ }, \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_charger =
+ THERMAL_CHARGER;
+
+struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT];
+
+static void setup_thermal(void)
+{
+ thermal_params[ADC_TEMP_SENSOR_1] = thermal_memory;
+ thermal_params[ADC_TEMP_SENSOR_2] = thermal_charger;
+}
+
+void board_init(void)
+{
+ int on;
+
+ /* Enable C0 interrupt and check if it needs processing */
+ gpio_enable_interrupt(GPIO_USB_C0_INT_ODL);
+ check_c0_line();
+
+ 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);
+
+ /* 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);
+
+ /* Select HDMI option */
+ gpio_set_level(GPIO_HDMI_SEL_L, 0);
+
+ /* Enable interrupt for passing through HPD */
+ 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);
+
+ /* Enable C1 interrupt and check if it needs processing */
+ gpio_enable_interrupt(GPIO_SUB_C1_INT_EN_RAILS_ODL);
+ check_c1_line();
+ }
+ /* Enable gpio interrupt for base accelgyro sensor */
+ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+
+ /* Turn on 5V if the system is on, otherwise turn it off. */
+ on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
+ CHIPSET_STATE_SOFT_OFF);
+ board_power_5v_enable(on);
+
+ /* Initialize THERMAL */
+ setup_thermal();
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
+
+/* Enable HDMI any time the SoC is on */
+static void hdmi_enable(void)
+{
+ if (get_cbi_fw_config_db() == DB_1A_HDMI)
+ gpio_set_level(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, hdmi_enable, HOOK_PRIO_DEFAULT);
+
+static void hdmi_disable(void)
+{
+ if (get_cbi_fw_config_db() == DB_1A_HDMI)
+ gpio_set_level(GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, 1);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, hdmi_disable, HOOK_PRIO_DEFAULT);
+
+void board_hibernate(void)
+{
+ /*
+ * Both charger ICs need to be put into their "low power mode" before
+ * entering the Z-state.
+ */
+ if (board_get_charger_chip_count() > 1)
+ raa489000_hibernate(1, true);
+ raa489000_hibernate(0, true);
+}
+
+void board_reset_pd_mcu(void)
+{
+ /*
+ * TODO(b:147316511): Here we could issue a digital reset to the IC,
+ * unsure if we actually want to do that or not yet.
+ */
+}
+
+#ifdef BOARD_WADDLEDOO
+static void reconfigure_5v_gpio(void)
+{
+ /*
+ * b/147257497: On early waddledoo boards, GPIO_EN_PP5000 was swapped
+ * with GPIO_VOLUP_BTN_ODL. Therefore, we'll actually need to set that
+ * GPIO instead for those boards. Note that this breaks the volume up
+ * button functionality.
+ */
+ if (system_get_board_version() < 0) {
+ CPRINTS("old board - remapping 5V en");
+ gpio_set_flags(GPIO_VOLUP_BTN_ODL, GPIO_OUT_LOW);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, reconfigure_5v_gpio, HOOK_PRIO_INIT_I2C+1);
+#endif /* BOARD_WADDLEDOO */
+
+static void set_5v_gpio(int level)
+{
+ int version;
+ enum gpio_signal gpio = GPIO_EN_PP5000;
+
+ /*
+ * b/147257497: On early waddledoo boards, GPIO_EN_PP5000 was swapped
+ * with GPIO_VOLUP_BTN_ODL. Therefore, we'll actually need to set that
+ * GPIO instead for those boards. Note that this breaks the volume up
+ * button functionality.
+ */
+ if (IS_ENABLED(BOARD_WADDLEDOO)) {
+ version = system_get_board_version();
+
+ /*
+ * If the CBI EEPROM wasn't formatted, assume it's a very early
+ * board.
+ */
+ gpio = version < 0 ? GPIO_VOLUP_BTN_ODL : GPIO_EN_PP5000;
+ }
+
+ gpio_set_level(gpio, level);
+}
+
+__override void board_power_5v_enable(int enable)
+{
+ /*
+ * Port 0 simply has a GPIO to turn on the 5V regulator, however, 5V is
+ * generated locally on the sub board and we need to set the comparator
+ * polarity on the sub board charger IC, or send enable signal to HDMI
+ * DB.
+ */
+ set_5v_gpio(!!enable);
+
+ if (get_cbi_fw_config_db() == DB_1A_HDMI) {
+ 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");
+ }
+
+}
+
+__override uint8_t board_get_usb_pd_port_count(void)
+{
+ if (get_cbi_fw_config_db() == DB_1A_HDMI)
+ return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
+ else
+ return CONFIG_USB_PD_PORT_MAX_COUNT;
+}
+
+__override uint8_t board_get_charger_chip_count(void)
+{
+ if (get_cbi_fw_config_db() == DB_1A_HDMI)
+ return CHARGER_NUM - 1;
+ else
+ return CHARGER_NUM;
+}
+
+int board_is_sourcing_vbus(int port)
+{
+ int regval;
+
+ 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 i;
+ int old_port;
+
+ if (!is_real_port && port != CHARGE_PORT_NONE)
+ return EC_ERROR_INVAL;
+
+ old_port = charge_manager_get_active_charge_port();
+
+ CPRINTS("New chg p%d", port);
+
+ /* Disable all ports. */
+ if (port == CHARGE_PORT_NONE) {
+ for (i = 0; i < board_get_usb_pd_port_count(); i++) {
+ tcpc_write(i, TCPC_REG_COMMAND,
+ TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ raa489000_enable_asgate(i, false);
+ }
+
+ return EC_SUCCESS;
+ }
+
+ /* Check if port is sourcing VBUS. */
+ if (board_is_sourcing_vbus(port)) {
+ CPRINTS("Skip enable p%d", port);
+ return EC_ERROR_INVAL;
+ }
+
+ /*
+ * 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);
+ }
+
+ /*
+ * 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)
+ charger_discharge_on_ac(1);
+
+ /* Enable requested charge port. */
+ if (raa489000_enable_asgate(port, true) ||
+ 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);
+ return EC_ERROR_UNKNOWN;
+ }
+
+ /* Allow the charger IC to begin/continue switching. */
+ charger_discharge_on_ac(0);
+
+ return EC_SUCCESS;
+}
+
+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);
+
+ /*
+ * b/147463641: The charger IC seems to overdraw ~4%, therefore we
+ * reduce our target accordingly.
+ */
+ icl = icl * 96 / 100;
+ charge_set_input_current_limit(icl, charge_mv);
+}
+
+__override void typec_set_source_current_limit(int port, enum tcpc_rp_value rp)
+{
+ if (port < 0 || port > board_get_usb_pd_port_count())
+ return;
+
+ raa489000_set_output_current(port, rp);
+}
+
+/* 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 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 struct accelgyro_saved_data_t g_bma253_data;
+static struct bmi_drv_data_t g_bmi160_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_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_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,
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
+ .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,
+ },
+ },
+ },
+ [BASE_GYRO] = {
+ .name = "Base 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,
+ },
+};
+
+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)
+{
+ *kp = 1;
+ *kp_div = 20;
+ *ki = 1;
+ *ki_div = 250;
+ *kd = 0;
+ *kd_div = 1;
+}
+
+int pd_snk_is_vbus_provided(int port)
+{
+ return pd_check_vbus_level(port, VBUS_PRESENT);
+}
+
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_USB_C0,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+
+ {
+ .i2c_port = I2C_PORT_SUB_USB_C1,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+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,
+ },
+};
+
+/* 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 = PWM_CONFIG_DSLEEP,
+ .freq = 10000,
+ },
+
+ [PWM_CH_LED1_AMBER] = {
+ .channel = 2,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq = 2400,
+ },
+
+ [PWM_CH_LED2_WHITE] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_DSLEEP | PWM_CONFIG_ACTIVE_LOW,
+ .freq = 2400,
+ }
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+const struct tcpc_config_t tcpc_config[CONFIG_USB_PD_PORT_MAX_COUNT] = {
+ {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C0,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ .drv = &raa489000_tcpm_drv,
+ },
+
+ {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_SUB_USB_C1,
+ .addr_flags = RAA489000_TCPC0_I2C_FLAGS,
+ },
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ .drv = &raa489000_tcpm_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 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,
+ },
+ {
+ .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,
+ }
+};
+
+uint16_t tcpc_get_alert_status(void)
+{
+ uint16_t status = 0;
+ int regval;
+
+ /*
+ * The interrupt line is shared between the TCPC and BC1.2 detector IC.
+ * Therefore, go out and actually read the alert registers to report the
+ * alert status.
+ */
+ if (!gpio_get_level(GPIO_USB_C0_INT_ODL)) {
+ if (!tcpc_read16(0, TCPC_REG_ALERT, &regval)) {
+ /* The TCPCI Rev 1.0 spec says to ignore bits 14:12. */
+ if (!(tcpc_config[0].flags & TCPC_FLAGS_TCPCI_REV2_0))
+ regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
+
+ if (regval)
+ status |= PD_STATUS_TCPC_ALERT_0;
+ }
+ }
+
+ if (board_get_usb_pd_port_count() > 1 &&
+ !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))
+ regval &= ~((1 << 14) | (1 << 13) | (1 << 12));
+
+ if (regval)
+ status |= PD_STATUS_TCPC_ALERT_1;
+ }
+ }
+
+ return status;
+}
+
+/* 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);
+ }
+}
diff --git a/board/corori2/board.h b/board/corori2/board.h
new file mode 100644
index 0000000000..35bfd0d3da
--- /dev/null
+++ b/board/corori2/board.h
@@ -0,0 +1,203 @@
+/* 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.
+ */
+
+/* Waddledoo board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#define VARIANT_DEDEDE_EC_NPCX796FC
+#include "baseboard.h"
+
+/*
+ * Keep the system unlocked in early development.
+ * TODO(b/151264302): Make sure to remove this before production!
+ */
+#define CONFIG_SYSTEM_UNLOCKED
+
+/* Save some flash space */
+#define CONFIG_CHIP_INIT_ROM_REGION
+#undef CONFIG_CONSOLE_CMDHELP
+#define CONFIG_DEBUG_ASSERT_BRIEF
+#define CONFIG_USB_PD_DEBUG_LEVEL 2
+
+/* EC console commands */
+#define CONFIG_CMD_CHARGER_DUMP
+
+/* Remove default commands to free flash space */
+#undef CONFIG_CMD_ACCELSPOOF
+#undef CONFIG_CMD_BATTFAKE
+
+/* Battery */
+#define CONFIG_BATTERY_FUEL_GAUGE
+
+/* Charger */
+#define CONFIG_CHARGER_RAA489000
+#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
+#undef CONFIG_CHARGER_SINGLE_CHIP
+#undef CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE
+#define CONFIG_USB_PD_TCPC_LPM_EXIT_DEBOUNCE (100 * MSEC)
+
+/*
+ * GPIO for C1 interrupts, for baseboard use
+ *
+ * Note this line might already have its pull up disabled for HDMI DBs, but
+ * it should be fine to set again before z-state.
+ */
+#define GPIO_USB_C1_INT_ODL GPIO_SUB_C1_INT_EN_RAILS_ODL
+
+/* Keyboard */
+#define CONFIG_PWM_KBLIGHT
+
+/* 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
+
+/* PWM */
+#define CONFIG_PWM
+#define NPCX7_PWM1_SEL 1 /* GPIO C2 is used as PWM1. */
+
+/* Temp sensor */
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_THERMISTOR
+#define CONFIG_STEINHART_HART_3V3_51K1_47K_4050B
+#define CONFIG_THROTTLE_AP
+#define CONFIG_CHIPSET_CAN_THROTTLE
+
+/* USB */
+#define CONFIG_BC12_DETECT_PI3USB9201
+#define CONFIG_USBC_RETIMER_NB7V904M
+
+/* USB PD */
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+#define CONFIG_USB_PD_TCPM_RAA489000
+
+/* USB defines specific to external TCPCs */
+#define CONFIG_USB_PD_DUAL_ROLE_AUTO_TOGGLE
+#define CONFIG_USB_PD_VBUS_DETECT_TCPC
+#define CONFIG_USB_PD_DISCHARGE_TCPC
+#define CONFIG_USB_PD_TCPC_LOW_POWER
+
+/* Variant references the TCPCs to determine Vbus sourcing */
+#define CONFIG_USB_PD_5V_EN_CUSTOM
+
+#undef PD_POWER_SUPPLY_TURN_ON_DELAY
+#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 */
+#undef CONFIG_USBC_VCONN_SWAP_DELAY_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_SUB_USB_C1 NPCX_I2C_PORT2_0
+#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_ACCEL I2C_PORT_SENSOR
+
+#define I2C_ADDR_EEPROM_FLAGS 0x50 /* 7b address */
+
+/*
+ * I2C pin names for baseboard
+ *
+ * Note: these lines will be set as i2c on start-up, but this should be
+ * okay since they're ODL.
+ */
+#define GPIO_EC_I2C_SUB_USB_C1_SCL GPIO_EC_I2C_SUB_C1_SCL_HDMI_EN_ODL
+#define GPIO_EC_I2C_SUB_USB_C1_SDA GPIO_EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL
+
+/* Sensors */
+#define CONFIG_CMD_ACCELS
+#define CONFIG_CMD_ACCEL_INFO
+
+#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_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
+
+#define CONFIG_ACCEL_INTERRUPTS
+#define CONFIG_ACCELGYRO_BMI160_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_TABLET_MODE
+#define CONFIG_TABLET_MODE_SWITCH
+#define CONFIG_GMR_TABLET_MODE
+
+#ifndef __ASSEMBLER__
+
+#include "gpio_signal.h"
+#include "registers.h"
+
+enum chg_id {
+ CHARGER_PRIMARY,
+ CHARGER_SECONDARY,
+ CHARGER_NUM,
+};
+
+enum adc_channel {
+ 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 sensor_id {
+ LID_ACCEL,
+ BASE_ACCEL,
+ BASE_GYRO,
+ SENSOR_COUNT
+};
+
+enum pwm_channel {
+ PWM_CH_KBLIGHT,
+ PWM_CH_LED1_AMBER,
+ PWM_CH_LED2_WHITE,
+ PWM_CH_COUNT,
+};
+
+/* List of possible batteries */
+enum battery_type {
+ BATTERY_C21N2018,
+ BATTERY_C21N2018_2ND,
+ BATTERY_TYPE_COUNT,
+};
+
+#endif /* !__ASSEMBLER__ */
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/corori2/build.mk b/board/corori2/build.mk
new file mode 100644
index 0000000000..af526189dd
--- /dev/null
+++ b/board/corori2/build.mk
@@ -0,0 +1,14 @@
+# -*- makefile -*-
+# 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.
+#
+# Board specific files build
+#
+
+CHIP:=npcx
+CHIP_FAMILY:=npcx7
+CHIP_VARIANT:=npcx7m6fc
+BASEBOARD:=dedede
+
+board-y=board.o battery.o cbi_ssfc.o led.o usb_pd_policy.o
diff --git a/board/corori2/cbi_ssfc.c b/board/corori2/cbi_ssfc.c
new file mode 100644
index 0000000000..c4b859f133
--- /dev/null
+++ b/board/corori2/cbi_ssfc.c
@@ -0,0 +1,36 @@
+/* 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.
+ */
+
+#include "cbi_ssfc.h"
+#include "common.h"
+#include "console.h"
+#include "cros_board_info.h"
+#include "hooks.h"
+
+#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;
+BUILD_ASSERT(sizeof(cached_ssfc) == sizeof(uint32_t));
+
+static void cbi_ssfc_init(void)
+{
+ if (cbi_get_ssfc(&cached_ssfc.raw_value) != EC_SUCCESS)
+ /* Default to 0 when CBI isn't populated */
+ cached_ssfc.raw_value = 0;
+
+ CPRINTS("Read CBI SSFC : 0x%04X", cached_ssfc.raw_value);
+}
+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;
+}
+
+enum ec_ssfc_lid_sensor get_cbi_ssfc_lid_sensor(void)
+{
+ return (enum ec_ssfc_lid_sensor) cached_ssfc.lid_sensor;
+}
diff --git a/board/corori2/cbi_ssfc.h b/board/corori2/cbi_ssfc.h
new file mode 100644
index 0000000000..935049b6ae
--- /dev/null
+++ b/board/corori2/cbi_ssfc.h
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+#ifndef _DEDEDE_CBI_SSFC__H_
+#define _DEDEDE_CBI_SSFC__H_
+
+#include "stdint.h"
+
+/****************************************************************************
+ * Dedede CBI Second Source Factory Cache
+ */
+
+/*
+ * Base Sensor (Bits 0-2)
+ */
+enum ec_ssfc_base_sensor {
+ SSFC_SENSOR_BASE_DEFAULT = 0,
+ SSFC_SENSOR_BMI160 = 1,
+ SSFC_SENSOR_ICM426XX = 2,
+ SSFC_SENSOR_LSM6DSM = 3,
+ SSFC_SENSOR_ICM42607 = 4
+};
+
+/*
+ * Lid Sensor (Bits 3-5)
+ */
+enum ec_ssfc_lid_sensor {
+ SSFC_SENSOR_LID_DEFAULT = 0,
+ SSFC_SENSOR_BMA255 = 1,
+ SSFC_SENSOR_KX022 = 2,
+ SSFC_SENSOR_LIS2DWL = 3
+};
+
+union dedede_cbi_ssfc {
+ struct {
+ uint32_t base_sensor : 3;
+ uint32_t lid_sensor : 3;
+ uint32_t reserved_2 : 26;
+ };
+ uint32_t raw_value;
+};
+
+/**
+ * Get the Base sensor type from SSFC_CONFIG.
+ *
+ * @return the Base sensor board type.
+ */
+enum ec_ssfc_base_sensor get_cbi_ssfc_base_sensor(void);
+
+/**
+ * Get the Lid sensor type from SSFC_CONFIG.
+ *
+ * @return the Lid sensor board type.
+ */
+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
new file mode 100644
index 0000000000..d4fb416bce
--- /dev/null
+++ b/board/corori2/ec.tasklist
@@ -0,0 +1,25 @@
+/* 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.
+ */
+
+/*
+ * 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(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, VENTI_TASK_STACK_SIZE) \
+ TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
+ TASK_ALWAYS(CONSOLE, console_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(HOSTCMD, host_command_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, VENTI_TASK_STACK_SIZE) \
+ TASK_ALWAYS(POWERBTN, power_button_task, NULL, VENTI_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_C0, pd_interrupt_handler_task, 0, ULTRA_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, ULTRA_TASK_STACK_SIZE)
diff --git a/board/corori2/gpio.inc b/board/corori2/gpio.inc
new file mode 100644
index 0000000000..78d41aab16
--- /dev/null
+++ b/board/corori2/gpio.inc
@@ -0,0 +1,139 @@
+/* -*- mode:c -*-
+ *
+ * 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.
+ */
+
+/*
+ * Declare symbolic names for all the GPIOs that we care about.
+ * Note: Those with interrupt handlers must be declared first.
+ */
+
+/* Power Interrupts */
+GPIO_INT(SLP_S0_L, PIN(D, 5), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SLP_S3_L, PIN(A, 5), GPIO_INT_BOTH, baseboard_all_sys_pgood_interrupt)
+GPIO_INT(SLP_S4_L, PIN(D, 4), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(SLP_SUS_L, PIN(D, 7), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(RSMRST_PWRGD_L, PIN(C, 6), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(VCCIN_AUX_VID1, PIN(C, 7), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(CPU_C10_GATE_L, PIN(6, 7), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(VCCIN_AUX_VID0, PIN(F, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt)
+GPIO_INT(PG_VCCIO_EXT_OD, PIN(B, 0), GPIO_INT_BOTH, baseboard_all_sys_pgood_interrupt)
+GPIO_INT(PG_PP5000_U_OD, PIN(E, 2), GPIO_INT_BOTH, power_signal_interrupt)
+GPIO_INT(PG_DRAM_OD, PIN(E, 4), GPIO_INT_BOTH, baseboard_all_sys_pgood_interrupt)
+GPIO_INT(PG_PP1050_ST_OD, PIN(4, 2), GPIO_INT_BOTH, power_signal_interrupt)
+
+/* USB-C interrupts */
+GPIO_INT(USB_C0_INT_ODL, PIN(6, 2), GPIO_INT_FALLING | GPIO_PULL_UP, usb_c0_interrupt)
+GPIO_INT(SUB_C1_INT_EN_RAILS_ODL, PIN(F, 5), GPIO_INT_FALLING | GPIO_PULL_UP, sub_usb_c1_interrupt) /* C1 interrupt OR 5V power en */
+GPIO_INT(EC_I2C_SUB_C1_SDA_HDMI_HPD_ODL, PIN(9, 1), GPIO_INT_BOTH, sub_hdmi_hpd_interrupt) /* C1 I2C SDA OR HDMI_HPD */
+
+/* Button interrupts */
+GPIO_INT(H1_EC_PWR_BTN_ODL, PIN(0, 1), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt)
+GPIO_INT(VOLDN_BTN_ODL, PIN(4, 0), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
+GPIO_INT(VOLUP_BTN_ODL, PIN(7, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interrupt)
+
+/* Other interrupts */
+GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt)
+GPIO_INT(EC_WP_OD, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
+GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
+GPIO_INT(LID_360_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)
+
+/* I2C Ports */
+GPIO(EC_I2C_EEPROM_SCL, PIN(B, 3), GPIO_INPUT)
+GPIO(EC_I2C_EEPROM_SDA, PIN(B, 2), GPIO_INPUT)
+GPIO(EC_I2C_BATTERY_SCL, PIN(3, 3), GPIO_INPUT)
+GPIO(EC_I2C_BATTERY_SDA, PIN(3, 6), GPIO_INPUT)
+GPIO(EC_I2C_SENSOR_SCL, PIN(B, 5), GPIO_INPUT)
+GPIO(EC_I2C_SENSOR_SDA, PIN(B, 4), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_SCL, PIN(9, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_SDA, PIN(8, 7), GPIO_INPUT)
+GPIO(EC_I2C_SUB_C1_SCL_HDMI_EN_ODL, PIN(9, 2), GPIO_INPUT) /* C1 I2C SCL OR HDMI en */
+
+/* Extra Sub-board I/O pins */
+GPIO(EC_SUB_IO_1, PIN(3, 7), GPIO_OUT_LOW)
+GPIO(EC_SUB_IO_2, PIN(3, 4), GPIO_OUT_LOW)
+
+/* Misc Enables */
+GPIO(EN_VCCIO_EXT, PIN(6, 1), GPIO_OUT_LOW)
+/* TODO(b:149775160) - Modify if needed if we ever use this signal. */
+GPIO(EN_VCCST, PIN(A, 7), GPIO_INPUT)
+GPIO(EN_PP3300_PEN, PIN(6, 3), GPIO_OUT_LOW)
+GPIO(EN_PP3300_A, PIN(0, 3), GPIO_OUT_LOW)
+GPIO(EN_PP5000_U, PIN(A, 4), GPIO_OUT_LOW)
+GPIO(EN_SLP_Z, PIN(8, 3), GPIO_OUT_LOW)
+GPIO(EN_KB_BL, PIN(6, 0), GPIO_OUT_LOW)
+GPIO(EN_BL_OD, PIN(D, 3), GPIO_ODR_LOW)
+GPIO(IMVP9_PE, PIN(E, 0), GPIO_OUT_LOW)
+GPIO(ECH1_PACKET_MODE, PIN(7, 5), GPIO_OUT_LOW)
+
+/* Power Sequencing */
+GPIO(EC_AP_PSYS, PIN(B, 7), GPIO_OUT_LOW)
+GPIO(EC_AP_RSMRST_L, PIN(A, 6), GPIO_OUT_LOW)
+GPIO(EC_AP_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
+GPIO(EC_AP_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
+GPIO(EC_AP_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
+GPIO(EC_AP_DPWROK, PIN(A, 3), GPIO_OUT_LOW)
+GPIO(EC_AP_PCH_PWROK_OD, PIN(9, 4), GPIO_ODR_LOW)
+GPIO(EC_AP_VCCST_PWRGD_OD, PIN(B, 1), GPIO_ODR_LOW)
+GPIO(EC_AP_SYS_PWROK, PIN(0, 2), GPIO_OUT_LOW)
+GPIO(EC_AP_MKBP_INT_L, PIN(7, 0), GPIO_ODR_HIGH)
+GPIO(EC_PROCHOT_ODL, PIN(F, 1), GPIO_ODR_HIGH | GPIO_SEL_1P8V)
+GPIO(EC_ENTERING_RW, PIN(E, 3), GPIO_OUT_LOW)
+GPIO(ALL_SYS_PWRGD, PIN(A, 0), GPIO_OUT_LOW)
+GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
+GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_ODR_HIGH)
+
+GPIO(USB_C0_RST_ODL, PIN(9, 7), GPIO_OUT_HIGH) /* currently unused */
+GPIO(EC_AP_USB_C1_HDMI_HPD, PIN(9, 6), GPIO_OUT_LOW)
+GPIO(EC_AP_USB_C0_HPD, PIN(9, 3), GPIO_OUT_LOW)
+GPIO(HDMI_SEL_L, PIN(7, 2), GPIO_OUT_HIGH)
+GPIO(EC_BATTERY_PRES_ODL, PIN(E, 1), GPIO_INPUT)
+
+/*
+ * Waddledoo doesn't have these physical pins coming to the EC but uses other
+ * logic.
+ */
+UNIMPLEMENTED(AC_PRESENT)
+UNIMPLEMENTED(PG_EC_DSW_PWROK)
+UNIMPLEMENTED(PG_EC_ALL_SYS_PWRGD)
+
+/* Alternate Functions */
+/* ADC */
+ALTERNATE(PIN_MASK(F, BIT(0)), 0, MODULE_ADC, 0) /* ADC9 */
+ALTERNATE(PIN_MASK(4, 0x38), 0, MODULE_ADC, 0) /* ADC0-2 */
+
+/* Keyboard */
+ALTERNATE(PIN_MASK(3, 0x03), 0, MODULE_KEYBOARD_SCAN, GPIO_INPUT | GPIO_PULL_UP) /* KSI0, KSI1 */
+ALTERNATE(PIN_MASK(2, 0xFC), 0, MODULE_KEYBOARD_SCAN, GPIO_INPUT | GPIO_PULL_UP) /* KSI2-7 */
+ALTERNATE(PIN_MASK(2, 0x03), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO0, KSO1 */
+ALTERNATE(PIN_MASK(1, 0x7F), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO3-9 */
+ALTERNATE(PIN_MASK(0, 0xF0), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO10-13 */
+ALTERNATE(PIN_MASK(8, 0x04), 0, MODULE_KEYBOARD_SCAN, GPIO_ODR_HIGH) /* KSO14 */
+GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW) /* KSO2 inverted */
+
+/* PWM */
+ALTERNATE(PIN_MASK(C, 0x1C), 0, MODULE_PWM, 0) /* PWM0-2 */
+ALTERNATE(PIN_MASK(8, BIT(0)), 0, MODULE_PWM, 0) /* PWM3 */
+
+/* UART */
+ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UART1 */
+
+/* I2C */
+ALTERNATE(PIN_MASK(B, 0x3C), 0, MODULE_I2C, 0) /* I2C7,I2C0 */
+ALTERNATE(PIN_MASK(3, 0x48), 0, MODULE_I2C, 0) /* I2C5 */
+ALTERNATE(PIN_MASK(9, 0x07), 0, MODULE_I2C, 0) /* I2C2, I2C1 SCL */
+ALTERNATE(PIN_MASK(8, 0x80), 0, MODULE_I2C, 0) /* I2C1 SDA */
+
+/* NC pins, enable internal pull-up to avoid floating state. */
+GPIO(GPIO32_NC, PIN(3, 2), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIO35_NC, PIN(3, 5), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIO41_NC, PIN(4, 1), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIO57_NC, PIN(5, 7), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIO81_NC, PIN(8, 1), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIO86_NC, PIN(8, 6), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIOC0_NC, PIN(C, 0), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIOD0_NC, PIN(D, 0), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIOD1_NC, PIN(D, 1), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(GPIOD6_NC, PIN(D, 6), GPIO_INPUT | GPIO_PULL_UP)
diff --git a/board/corori2/led.c b/board/corori2/led.c
new file mode 100644
index 0000000000..3c27bf0f8e
--- /dev/null
+++ b/board/corori2/led.c
@@ -0,0 +1,70 @@
+/* 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.
+ */
+
+/* Waddledoo specific PWM LED settings. */
+
+#include "common.h"
+#include "ec_commands.h"
+#include "led_pwm.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);
+/*
+ * We only have a white and an amber LED, so setting any other colour results in
+ * 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 },
+};
+
+/* One logical LED with amber and white channels. */
+struct pwm_led pwm_leds[CONFIG_LED_PWM_COUNT] = {
+ {
+ .ch0 = PWM_CH_LED1_AMBER,
+ .ch1 = PWM_CH_LED2_WHITE,
+ .ch2 = PWM_LED_NO_CHANNEL,
+ .enable = &pwm_enable,
+ .set_duty = &pwm_set_duty,
+ },
+};
+
+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;
+}
+
+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. */
+ if (led_id == EC_LED_ID_POWER_LED)
+ pwm_id = PWM_LED0;
+ else
+ return EC_ERROR_UNKNOWN;
+
+ 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;
+}
diff --git a/board/corori2/usb_pd_policy.c b/board/corori2/usb_pd_policy.c
new file mode 100644
index 0000000000..15faf41ffc
--- /dev/null
+++ b/board/corori2/usb_pd_policy.c
@@ -0,0 +1,61 @@
+/* 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.
+ */
+
+#include "charge_manager.h"
+#include "chipset.h"
+#include "common.h"
+#include "console.h"
+#include "driver/charger/isl923x_public.h"
+#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)
+
+int pd_check_vconn_swap(int port)
+{
+ /* Allow VCONN swaps if the AP is on. */
+ return chipset_in_state(CHIPSET_STATE_ANY_SUSPEND | CHIPSET_STATE_ON);
+}
+
+void pd_power_supply_reset(int port)
+{
+ /* Disable VBUS */
+ tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_LOW);
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+}
+
+int pd_set_power_supply_ready(int port)
+{
+ int rv;
+
+ if (port >= board_get_usb_pd_port_count())
+ return EC_ERROR_INVAL;
+
+ /* Disable charging. */
+ rv = tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SNK_CTRL_LOW);
+ if (rv)
+ return rv;
+
+ /* Our policy is not to source VBUS when the AP is off. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ return EC_ERROR_NOT_POWERED;
+
+ /* Provide Vbus. */
+ rv = tcpc_write(port, TCPC_REG_COMMAND, TCPC_REG_COMMAND_SRC_CTRL_HIGH);
+ if (rv)
+ return rv;
+
+ rv = raa489000_enable_asgate(port, true);
+ if (rv)
+ return rv;
+
+ /* Notify host of power info change. */
+ pd_send_host_event(PD_EVENT_POWER_CHANGE);
+
+ return EC_SUCCESS;
+}
diff --git a/board/krabby/vif_override.xml b/board/corori2/vif_override.xml
index 32736caf64..32736caf64 100644
--- a/board/krabby/vif_override.xml
+++ b/board/corori2/vif_override.xml
diff --git a/board/cret/board.c b/board/cret/board.c
index 34091c0518..b8deb52b10 100644
--- a/board/cret/board.c
+++ b/board/cret/board.c
@@ -384,8 +384,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -413,8 +411,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/dalboz/board.c b/board/dalboz/board.c
index 5e65298b82..45eb468b2e 100644
--- a/board/dalboz/board.c
+++ b/board/dalboz/board.c
@@ -129,8 +129,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
@@ -161,8 +159,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/damu/board.c b/board/damu/board.c
index ca3979949a..f66d05eb5b 100644
--- a/board/damu/board.c
+++ b/board/damu/board.c
@@ -67,13 +67,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 100, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -139,8 +158,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/damu/board.h b/board/damu/board.h
index 6df8bb2a7a..f127df251f 100644
--- a/board/damu/board.h
+++ b/board/damu/board.h
@@ -85,7 +85,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/delbin/ec.tasklist b/board/delbin/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/delbin/ec.tasklist
+++ b/board/delbin/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/dewatt/board.c b/board/dewatt/board.c
index 60c2bba17a..54af97b342 100644
--- a/board/dewatt/board.c
+++ b/board/dewatt/board.c
@@ -12,13 +12,12 @@
#include "common.h"
#include "cros_board_info.h"
#include "driver/accelgyro_bmi_common.h"
-#include "driver/accelgyro_bmi160.h"
-#include "driver/accelgyro_bmi323.h"
+#include "driver/accelgyro_bmi260.h"
#include "driver/accel_bma422.h"
#include "driver/retimer/ps8811.h"
#include "driver/retimer/ps8818.h"
#include "driver/temp_sensor/sb_tsi.h"
-#include "driver/temp_sensor/tmp112.h"
+#include "driver/temp_sensor/pct2075.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -31,7 +30,7 @@
#include "tablet_mode.h"
#include "temp_sensor.h"
#include "temp_sensor/thermistor.h"
-#include "temp_sensor/tmp112.h"
+#include "temp_sensor/pct2075.h"
#include "thermal.h"
#include "usb_mux.h"
@@ -48,14 +47,14 @@ 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)}
+ { 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)}
+ { 0, FLOAT_TO_FP(-1), 0},
+ { 0, 0, FLOAT_TO_FP(1)}
};
/*
@@ -79,14 +78,14 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_ACCEL] = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI323,
+ .chip = MOTIONSENSE_CHIP_BMI260,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi3xx_drv,
+ .drv = &bmi260_drv,
.mutex = &g_base_mutex,
.drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI_ACCEL_MIN_FREQ,
.max_frequency = BMI_ACCEL_MAX_FREQ,
@@ -94,12 +93,12 @@ struct motion_sensor_t motion_sensors[] = {
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
- .odr = 12500 | ROUND_UP_FLAG,
+ .odr = 10000 | ROUND_UP_FLAG,
.ec_rate = 100 * MSEC,
},
/* Sensor on in S3 */
[SENSOR_CONFIG_EC_S3] = {
- .odr = 12500 | ROUND_UP_FLAG,
+ .odr = 10000 | ROUND_UP_FLAG,
.ec_rate = 0,
},
},
@@ -135,14 +134,14 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_GYRO] = {
.name = "Base Gyro",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI323,
+ .chip = MOTIONSENSE_CHIP_BMI260,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi3xx_drv,
+ .drv = &bmi260_drv,
.mutex = &g_base_mutex,
.drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
+ .i2c_spi_addr_flags = BMI260_ADDR0_FLAGS,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
.min_frequency = BMI_GYRO_MIN_FREQ,
@@ -151,52 +150,6 @@ struct motion_sensor_t motion_sensors[] = {
};
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-struct motion_sensor_t bmi160_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_bmi_data,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .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 = 10000 | ROUND_UP_FLAG,
- .ec_rate = 100 * MSEC,
- },
- /* Sensor on in S3 */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- .ec_rate = 0,
- },
- },
-};
-
-struct motion_sensor_t bmi160_base_gyro = {
- .name = "Base 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_bmi_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,
-};
-
__override enum ec_error_list
board_a1_ps8811_retimer_init(const struct usb_mux *me)
{
@@ -289,10 +242,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
return rv;
/* Enable HPD on the DB */
- gpio_set_level(GPIO_USB_C1_HPD, 1);
+ ioex_set_level(IOEX_USB_C1_IN_HPD, 1);
} else {
/* Disable HPD on the DB */
- gpio_set_level(GPIO_USB_C1_HPD, 0);
+ ioex_set_level(IOEX_USB_C1_IN_HPD, 0);
}
return rv;
@@ -317,15 +270,8 @@ static int base_gyro_config;
static void board_update_motion_sensor_config(void)
{
if (board_is_convertible()) {
- if (get_board_version() == 1) {
- motion_sensors[BASE_ACCEL] = bmi160_base_accel;
- motion_sensors[BASE_GYRO] = bmi160_base_gyro;
- base_gyro_config = BASE_GYRO_BMI160;
- ccprints("BASE GYRO is BMI160");
- } else {
- base_gyro_config = BASE_GYRO_BMI323;
- ccprints("BASE GYRO is BMI323");
- }
+ base_gyro_config = BASE_GYRO_BMI260;
+ ccprints("BASE GYRO is BMI260");
motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Enable Base Accel and Gyro interrupt */
@@ -341,12 +287,9 @@ static void board_update_motion_sensor_config(void)
void motion_interrupt(enum gpio_signal signal)
{
switch (base_gyro_config) {
- case BASE_GYRO_BMI160:
- bmi160_interrupt(signal);
- break;
- case BASE_GYRO_BMI323:
+ case BASE_GYRO_BMI260:
default:
- bmi3xx_interrupt(signal);
+ bmi260_interrupt(signal);
break;
}
}
@@ -360,7 +303,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
static void board_chipset_startup(void)
{
if (get_board_version() > 1)
- tmp112_init();
+ pct2075_init();
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
HOOK_PRIO_DEFAULT);
@@ -370,7 +313,7 @@ int board_get_soc_temp_k(int idx, int *temp_k)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_k(idx, temp_k);
+ return pct2075_get_val_k(idx, temp_k);
}
int board_get_soc_temp_mk(int *temp_mk)
@@ -378,7 +321,7 @@ int board_get_soc_temp_mk(int *temp_mk)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_mk(TMP112_SOC, temp_mk);
+ return pct2075_get_val_mk(PCT2075_SOC, temp_mk);
}
int board_get_ambient_temp_mk(int *temp_mk)
@@ -386,7 +329,7 @@ int board_get_ambient_temp_mk(int *temp_mk)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_mk(TMP112_AMB, temp_mk);
+ return pct2075_get_val_mk(PCT2075_AMB, temp_mk);
}
/* ADC Channels */
@@ -432,18 +375,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temp Sensors */
static int board_get_memory_temp(int, int *);
-const struct tmp112_sensor_t tmp112_sensors[] = {
- { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS0 },
- { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS1 },
+const struct pct2075_sensor_t pct2075_sensors[] = {
+ { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS0 },
+ { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS7 },
};
-BUILD_ASSERT(ARRAY_SIZE(tmp112_sensors) == TMP112_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(pct2075_sensors) == PCT2075_COUNT);
const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_SOC] = {
.name = "SOC",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = board_get_soc_temp_k,
- .idx = TMP112_SOC,
+ .idx = PCT2075_SOC,
},
[TEMP_SENSOR_CHARGER] = {
.name = "Charger",
@@ -466,69 +409,12 @@ const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_AMBIENT] = {
.name = "Ambient",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = tmp112_get_val_k,
- .idx = TMP112_AMB,
+ .read = pct2075_get_val_k,
+ .idx = PCT2075_AMB,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
-struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
- [TEMP_SENSOR_SOC] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100),
- [EC_TEMP_THRESH_HALT] = C_TO_K(105),
- },
- .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_max = C_TO_K(70),
- },
- [TEMP_SENSOR_CHARGER] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100),
- [EC_TEMP_THRESH_HALT] = C_TO_K(105),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
- },
- .temp_fan_off = 0,
- .temp_fan_max = 0,
- },
- [TEMP_SENSOR_MEMORY] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100),
- [EC_TEMP_THRESH_HALT] = C_TO_K(105),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
- },
- .temp_fan_off = 0,
- .temp_fan_max = 0,
- },
- [TEMP_SENSOR_CPU] = {
- .temp_host = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(100),
- [EC_TEMP_THRESH_HALT] = C_TO_K(105),
- },
- .temp_host_release = {
- [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
- },
- /*
- * CPU temp sensor fan thresholds are high because they are a
- * backup for the SOC temp sensor fan thresholds.
- */
- .temp_fan_off = C_TO_K(60),
- .temp_fan_max = C_TO_K(90),
- },
- /*
- * Note: Leave ambient entries at 0, both as it does not represent a
- * hotspot and as not all boards have this sensor
- */
-};
-BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
-
static int board_get_memory_temp(int idx, int *temp_k)
{
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
diff --git a/board/dewatt/board.h b/board/dewatt/board.h
index 0743103a66..c89ce748ee 100644
--- a/board/dewatt/board.h
+++ b/board/dewatt/board.h
@@ -18,11 +18,8 @@
#define CONFIG_KEYBOARD_REFRESH_ROW3
/* Sensors */
-#define CONFIG_ACCELGYRO_BMI160
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_BMI3XX
-#define CONFIG_ACCELGYRO_BMI3XX_INT_EVENT \
+#define CONFIG_ACCELGYRO_BMI260
+#define CONFIG_ACCELGYRO_BMI260_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_ACCEL_INTERRUPTS
#define CONFIG_ACCEL_BMA4XX
@@ -51,11 +48,15 @@
/* Volume Button feature */
/* Fan features */
+#define CONFIG_FAN_RPM_CUSTOM
/* LED features */
#define CONFIG_LED_COMMON
#define CONFIG_LED_ONOFF_STATES
+/* Thermal Config */
+#define CONFIG_TEMP_SENSOR_PCT2075
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -72,8 +73,7 @@ enum battery_type {
enum base_accelgyro_type {
BASE_GYRO_NONE = 0,
- BASE_GYRO_BMI160 = 1,
- BASE_GYRO_BMI323 = 2,
+ BASE_GYRO_BMI260 = 1,
};
/* ADC Channels */
@@ -96,6 +96,13 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
+/* PCT2075 sensors */
+enum pct2075_sensor {
+ PCT2075_SOC,
+ PCT2075_AMB,
+ PCT2075_COUNT,
+};
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/dewatt/board_fw_config.c b/board/dewatt/board_fw_config.c
index c919d82851..e6dbcadb92 100644
--- a/board/dewatt/board_fw_config.c
+++ b/board/dewatt/board_fw_config.c
@@ -8,9 +8,7 @@
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);
+ return 1;
}
bool board_has_kblight(void)
@@ -21,22 +19,10 @@ bool board_has_kblight(void)
enum board_usb_c1_mux board_get_usb_c1_mux(void)
{
- int usb_db = get_fw_config_field(FW_CONFIG_USB_DB_OFFSET,
- FW_CONFIG_USB_DB_WIDTH);
- if (usb_db == FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818)
- return USB_C1_MUX_PS8818;
- if (usb_db == FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451)
- return USB_C1_MUX_ANX7451;
- return USB_C1_MUX_UNKNOWN;
+ return USB_C1_MUX_PS8818;
};
enum board_usb_a1_retimer board_get_usb_a1_retimer(void)
{
- int usb_db = get_fw_config_field(FW_CONFIG_USB_DB_OFFSET,
- FW_CONFIG_USB_DB_WIDTH);
- if (usb_db == FW_CONFIG_USB_DB_A1_PS8811_C1_PS8818)
- return USB_A1_RETIMER_PS8811;
- if (usb_db == FW_CONFIG_USB_DB_A1_ANX7491_C1_ANX7451)
- return USB_A1_RETIMER_ANX7491;
return USB_A1_RETIMER_UNKNOWN;
};
diff --git a/board/dewatt/build.mk b/board/dewatt/build.mk
index e4fdcf4afd..8f2b78ddc8 100644
--- a/board/dewatt/build.mk
+++ b/board/dewatt/build.mk
@@ -9,4 +9,4 @@
BASEBOARD:=guybrush
board-y=board.o
-board-y+=board_fw_config.o led.o battery.o
+board-y+=board_fw_config.o led.o battery.o thermal.o
diff --git a/board/dewatt/led.c b/board/dewatt/led.c
index b17c8be488..7cbb9133bf 100644
--- a/board/dewatt/led.c
+++ b/board/dewatt/led.c
@@ -6,6 +6,8 @@
*/
#include "common.h"
+#include "cros_board_info.h"
+#include "hooks.h"
#include "led_onoff_states.h"
#include "led_common.h"
#include "gpio.h"
@@ -21,19 +23,41 @@ __override const int led_charge_lvl_1 = 5;
__override const int led_charge_lvl_2 = 97;
+static enum pwm_channel pwm_ch_led_blue;
+static enum pwm_channel pwm_ch_led_amber;
+
+static void led_pwm_ch_init(void)
+{
+ int val;
+
+ pwm_ch_led_blue = PWM_CH_LED_FULL;
+ pwm_ch_led_amber = PWM_CH_LED_CHRG;
+
+ /*
+ * Ver1: GPIOC4(PWM2) -> Blue LED
+ * GPIO80(PWM3) -> Amber LED
+ */
+ if (cbi_get_board_version(&val) == EC_SUCCESS && val <= 1) {
+ pwm_ch_led_blue = PWM_CH_LED_CHRG;
+ pwm_ch_led_amber = PWM_CH_LED_FULL;
+ }
+}
+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_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_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_WHITE, 2 * LED_ONE_SEC} },
+ {EC_LED_COLOR_BLUE, 2 * LED_ONE_SEC} },
};
const enum ec_led_id supported_led_ids[] = {
@@ -46,21 +70,21 @@ __override void led_set_color_battery(enum ec_led_colors color)
{
switch (color) {
case EC_LED_COLOR_AMBER:
- pwm_enable(PWM_CH_LED_CHRG, LED_ON_LVL);
- pwm_enable(PWM_CH_LED_FULL, LED_OFF_LVL);
+ pwm_enable(pwm_ch_led_amber, LED_ON_LVL);
+ pwm_enable(pwm_ch_led_blue, LED_OFF_LVL);
break;
- case EC_LED_COLOR_WHITE:
- pwm_enable(PWM_CH_LED_CHRG, LED_OFF_LVL);
- pwm_enable(PWM_CH_LED_FULL, LED_ON_LVL);
+ case EC_LED_COLOR_BLUE:
+ pwm_enable(pwm_ch_led_amber, LED_OFF_LVL);
+ pwm_enable(pwm_ch_led_blue, LED_ON_LVL);
break;
case LED_OFF:
- pwm_enable(PWM_CH_LED_CHRG, LED_OFF_LVL);
- pwm_enable(PWM_CH_LED_FULL, LED_OFF_LVL);
+ pwm_enable(pwm_ch_led_amber, LED_OFF_LVL);
+ pwm_enable(pwm_ch_led_blue, LED_OFF_LVL);
break;
default: /* Unsupported colors */
CPRINTS("Unsupported LED color: %d", color);
- pwm_enable(PWM_CH_LED_CHRG, LED_OFF_LVL);
- pwm_enable(PWM_CH_LED_FULL, LED_OFF_LVL);
+ pwm_enable(pwm_ch_led_amber, LED_OFF_LVL);
+ pwm_enable(pwm_ch_led_blue, LED_OFF_LVL);
break;
}
}
@@ -69,15 +93,15 @@ 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] = 1;
- brightness_range[EC_LED_COLOR_WHITE] = 1;
+ brightness_range[EC_LED_COLOR_BLUE] = 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_WHITE] != 0)
- led_set_color_battery(EC_LED_COLOR_WHITE);
+ if (brightness[EC_LED_COLOR_BLUE] != 0)
+ led_set_color_battery(EC_LED_COLOR_BLUE);
else if (brightness[EC_LED_COLOR_AMBER] != 0)
led_set_color_battery(EC_LED_COLOR_AMBER);
else
diff --git a/board/dewatt/thermal.c b/board/dewatt/thermal.c
new file mode 100644
index 0000000000..39be5bfd6b
--- /dev/null
+++ b/board/dewatt/thermal.c
@@ -0,0 +1,145 @@
+/* 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.
+ */
+
+/* Guybrush board-specific configuration */
+
+#include "console.h"
+#include "fan.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)
+
+const struct fan_conf fan_conf_0 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .pgood_gpio = GPIO_S0_PGOOD,
+ .enable_gpio = -1,
+};
+const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 3000,
+ .rpm_start = 3000,
+ .rpm_max = 6000,
+};
+const struct fan_t fans[] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
+
+struct ec_thermal_config thermal_params[TEMP_SENSOR_COUNT] = {
+ [TEMP_SENSOR_SOC] = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(85),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
+ },
+ .temp_fan_off = C_TO_K(27),
+ .temp_fan_max = C_TO_K(80),
+ },
+ [TEMP_SENSOR_CHARGER] = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(85),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
+ },
+ .temp_fan_off = 0,
+ .temp_fan_max = 0,
+ },
+ [TEMP_SENSOR_MEMORY] = {
+ .temp_host = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(80),
+ [EC_TEMP_THRESH_HALT] = C_TO_K(85),
+ },
+ .temp_host_release = {
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(75),
+ },
+ .temp_fan_off = 0,
+ .temp_fan_max = 0,
+ },
+ [TEMP_SENSOR_CPU] = {
+ .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,
+ },
+ /*
+ * Note: Leave ambient entries at 0, both as it does not represent a
+ * hotspot and as not all boards have this sensor
+ */
+};
+BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
+
+struct fan_step {
+ int on;
+ int off;
+ int rpm;
+};
+
+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},
+};
+#define NUM_FAN_LEVELS ARRAY_SIZE(fan_table)
+
+int fan_percent_to_rpm(int fan, int pct)
+{
+ static int current_level;
+ static int previous_pct;
+ int i;
+
+ /*
+ * 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; i >= 0; i--) {
+ if (pct <= fan_table[i].off)
+ current_level = i - 1;
+ else
+ break;
+ }
+ } else if (pct > previous_pct) {
+ for (i = current_level + 1; i < NUM_FAN_LEVELS; i++) {
+ if (pct >= fan_table[i].on)
+ current_level = i;
+ else
+ break;
+ }
+ }
+
+ if (current_level < 0)
+ current_level = 0;
+
+ 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);
+
+ return fan_table[current_level].rpm;
+}
diff --git a/board/discovery-stm32f072/board.c b/board/discovery-stm32f072/board.c
index c7099f55d1..086e5260a2 100644
--- a/board/discovery-stm32f072/board.c
+++ b/board/discovery-stm32f072/board.c
@@ -141,6 +141,7 @@ const void *const usb_strings[] = {
[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"),
};
BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
diff --git a/board/discovery-stm32f072/board.h b/board/discovery-stm32f072/board.h
index d3f51f6691..b889ebc8fe 100644
--- a/board/discovery-stm32f072/board.h
+++ b/board/discovery-stm32f072/board.h
@@ -51,7 +51,7 @@
/* Enable control of SPI over USB */
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FLASH_PORT 0 /* First SPI master port */
+#define CONFIG_SPI_FLASH_PORT 0 /* First SPI controller port */
#define CONFIG_USB_SPI
@@ -80,6 +80,7 @@ enum usb_strings {
USB_STR_VERSION,
USB_STR_STREAM_NAME,
USB_STR_CONSOLE_NAME,
+ USB_STR_SPI_NAME,
USB_STR_COUNT
};
diff --git a/board/dojo/battery.c b/board/dojo/battery.c
new file mode 100644
index 0000000000..72daf4966d
--- /dev/null
+++ b/board/dojo/battery.c
@@ -0,0 +1,126 @@
+/* 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.
+ */
+
+#include "battery.h"
+#include "battery_fuel_gauge.h"
+#include "battery_smart.h"
+
+const struct board_batt_params board_battery_info[] = {
+ /* Panasonic AP16L5J Battery Information */
+ [BATTERY_PANASONIC_AC16L5J] = {
+ .fuel_gauge = {
+ .manuf_name = "PANASONIC",
+ .device_name = "AP16L5J",
+ .ship_mode = {
+ .reg_addr = 0x3A,
+ .reg_data = { 0xC574, 0xC574 },
+ },
+ .fet = {
+ .reg_addr = 0x0,
+ .reg_mask = 0x4000,
+ .disconnect_val = 0x0,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 8800,
+ .voltage_normal = 7700,
+ .voltage_min = 6000,
+ .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,
+ },
+ },
+ [BATTERY_PANASONIC_AC16L5J_KT00205009] = {
+ .fuel_gauge = {
+ .manuf_name = "PANASONIC KT00205009",
+ .device_name = "AP16L5J",
+ .ship_mode = {
+ .reg_addr = 0x3A,
+ .reg_data = { 0xC574, 0xC574 },
+ },
+ .fet = {
+ .reg_addr = 0x0,
+ .reg_mask = 0x4000,
+ .disconnect_val = 0x0,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 8800,
+ .voltage_normal = 7700,
+ .voltage_min = 6000,
+ .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,
+ },
+ },
+ /* AP16L8J */
+ [BATTERY_AP16L8J] = {
+ .fuel_gauge = {
+ .manuf_name = "LGC KT0020G010",
+ .device_name = "AP16L8J",
+ .ship_mode = {
+ .reg_addr = 0x3A,
+ .reg_data = { 0xC574, 0xC574 },
+ },
+ .fet = {
+ .mfgacc_support = 1,
+ .reg_addr = 0x0,
+ .reg_mask = 0x0002,
+ .disconnect_val = 0x0,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 8700,
+ .voltage_normal = 7500, /* mV */
+ .voltage_min = 6000, /* mV */
+ .precharge_current = 256, /* 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 = 75,
+ },
+ },
+ /* LGC AP18C8K Battery Information */
+ [BATTERY_LGC_AP18C8K] = {
+ .fuel_gauge = {
+ .manuf_name = "LGC KT0030G020",
+ .device_name = "AP18C8K",
+ .ship_mode = {
+ .reg_addr = 0x3A,
+ .reg_data = { 0xC574, 0xC574 },
+ },
+ .fet = {
+ .reg_addr = 0x43,
+ .reg_mask = 0x0001,
+ .disconnect_val = 0x0,
+ },
+ },
+ .batt_info = {
+ .voltage_max = 13050,
+ .voltage_normal = 11250,
+ .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,
+ },
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
+
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_PANASONIC_AC16L5J;
diff --git a/board/dojo/board.c b/board/dojo/board.c
new file mode 100644
index 0000000000..35dae9ed36
--- /dev/null
+++ b/board/dojo/board.c
@@ -0,0 +1,179 @@
+/* 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.
+ */
+/* Cherry board configuration */
+
+#include "common.h"
+#include "console.h"
+#include "driver/accel_bma422.h"
+#include "driver/accel_kionix.h"
+#include "driver/accel_kx022.h"
+#include "driver/accelgyro_icm42607.h"
+#include "driver/accelgyro_icm_common.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "motion_sense.h"
+#include "pwm.h"
+#include "pwm_chip.h"
+#include "system.h"
+
+#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;
+static struct mutex g_lid_mutex;
+
+static struct icm_drv_data_t g_icm42607_data;
+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 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[] = {
+ /*
+ * Note: bmi160: 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_ICM42607,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .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 = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
+ .rot_standard_ref = &base_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 use accel for angle detection */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+ },
+ [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 = &base_standard_ref,
+ .min_frequency = ICM42607_GYRO_MIN_FREQ,
+ .max_frequency = ICM42607_GYRO_MAX_FREQ,
+ },
+ [LID_ACCEL] = {
+ .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_ACCEL,
+ .i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
+ .rot_standard_ref = &lid_standard_ref,
+ .default_range = 2, /* g, enough for laptop. */
+ .min_frequency = KX022_ACCEL_MIN_FREQ,
+ .max_frequency = KX022_ACCEL_MAX_FREQ,
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100,
+ },
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+ },
+};
+const 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_ACCEL,
+ .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY,
+ .rot_standard_ref = &lid_standard_ref,
+ .min_frequency = BMA4_ACCEL_MIN_FREQ,
+ .max_frequency = BMA4_ACCEL_MAX_FREQ,
+ .default_range = 2, /* g, enough for laptop. */
+ .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)
+{
+ if (system_get_board_version() >= 2) {
+ motion_sensors[LID_ACCEL] = bma422_lid_accel;
+ ccprints("LID ACCEL is BMA422");
+ } else {
+ ccprints("LID ACCEL is KX022");
+ }
+}
+
+/* Initialize board. */
+static void board_init(void)
+{
+ /* Enable motion sensor interrupt */
+ gpio_enable_interrupt(GPIO_BASE_IMU_INT_L);
+ gpio_enable_interrupt(GPIO_LID_ACCEL_INT_L);
+
+ /* Disable PWM_CH_LED2(Green) for unuse */
+ pwm_enable(PWM_CH_LED2, 0);
+
+ board_update_motion_sensor_config();
+
+ if (board_get_version() >= 2) {
+ gpio_set_flags(GPIO_I2C_H_SCL, GPIO_INPUT | GPIO_PULL_DOWN);
+ gpio_set_flags(GPIO_I2C_H_SDA, GPIO_INPUT | GPIO_PULL_DOWN);
+ }
+}
+DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/krabby/board.h b/board/dojo/board.h
index 4e3dfc43d6..1c52eac8ba 100644
--- a/board/krabby/board.h
+++ b/board/dojo/board.h
@@ -2,7 +2,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
-/* Krabby board configuration */
+/* Cherry board configuration */
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
@@ -10,9 +10,12 @@
#include "baseboard.h"
/* Chipset config */
+#define CONFIG_BRINGUP
/* Optional features */
+#define CONFIG_SYSTEM_UNLOCKED
#define CONFIG_LTO
+#define CONFIG_PRESERVE_LOGS
/*
* TODO: Remove this option once the VBAT no longer keeps high when
@@ -27,13 +30,7 @@
#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
/* PD / USB-C / PPC */
-#define CONFIG_USB_PD_DEBUG_LEVEL 3
-#define PD_MAX_CURRENT_MA 3000
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_VOLTAGE_MV 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
+#define CONFIG_USB_PD_DEBUG_LEVEL 0
/* Optional console commands */
#define CONFIG_CMD_FLASH
@@ -42,31 +39,34 @@
#define CONFIG_BATT_FULL_CHIPSET_OFF_INPUT_LIMIT_MV 9000
+/* Keyboard */
+#define GPIO_EN_KEYBOARD_BACKLIGHT GPIO_EN_KB_BL
+#define CONFIG_KEYBOARD_REFRESH_ROW3
+
/* Sensor */
#define CONFIG_GMR_TABLET_MODE
#define CONFIG_TABLET_MODE
#define CONFIG_TABLET_MODE_SWITCH
#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel */
-#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
+/* ICM426XX Base accel/gyro */
+#define CONFIG_ACCELGYRO_ICM42607
+#define CONFIG_ACCELGYRO_ICM42607_INT_EVENT \
TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCEL_LIS2DWL
-#define CONFIG_ACCEL_LIS2DW_AS_BASE
-#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
+/* KX022 Lid accel */
+#define CONFIG_ACCEL_KX022
+
+/* BMA422 Lid accel */
+#define CONFIG_ACCEL_BMA4XX
+
+#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_ACCEL_FORCE_MODE_MASK 0
-
/* SPI / Host Command */
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
@@ -74,13 +74,21 @@
/* USB-A */
#define USBA_PORT_COUNT 1
+/* Temperature */
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_THERMISTOR
+#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
#include "registers.h"
enum battery_type {
- BATTERY_C235,
+ BATTERY_PANASONIC_AC16L5J,
+ BATTERY_PANASONIC_AC16L5J_KT00205009,
+ BATTERY_AP16L8J,
+ BATTERY_LGC_AP18C8K,
BATTERY_TYPE_COUNT,
};
@@ -91,26 +99,7 @@ enum sensor_id {
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 */
-
- /* Number of ADC channels */
- ADC_CH_COUNT,
-};
-
-enum pwm_channel {
- PWM_CH_LED1,
- PWM_CH_LED2,
- PWM_CH_LED3,
- PWM_CH_COUNT,
-};
-
-void motion_interrupt(enum gpio_signal signal);
+int board_accel_force_mode_mask(void);
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/kingler/build.mk b/board/dojo/build.mk
index b355dfd90d..0b0569c6d8 100644
--- a/board/kingler/build.mk
+++ b/board/dojo/build.mk
@@ -9,8 +9,6 @@
CHIP:=it83xx
CHIP_FAMILY:=it8xxx2
CHIP_VARIANT:=it81202bx_1024
-BASEBOARD:=corsola
+BASEBOARD:=cherry
-board-y=led.o
-board-y+=battery.o board.o
-board-y+=usbc_config.o
+board-y+=led.o battery.o board.o
diff --git a/board/krabby/ec.tasklist b/board/dojo/ec.tasklist
index 75dbb1a828..f9050fef87 100644
--- a/board/krabby/ec.tasklist
+++ b/board/dojo/ec.tasklist
@@ -13,10 +13,11 @@
TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_NOTEST(PDCMD, pd_command_task, NULL, 1024) \
TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \
TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
+ TASK_ALWAYS(DPS, dps_task, NULL, 1280) \
TASK_ALWAYS(PD_C0, pd_task, NULL, 1280) \
TASK_ALWAYS(PD_C1, pd_task, NULL, 1280) \
+ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, 1024) \
diff --git a/board/kingler/gpio.inc b/board/dojo/gpio.inc
index 1d4700c1c1..296e3a418e 100644
--- a/board/kingler/gpio.inc
+++ b/board/dojo/gpio.inc
@@ -10,7 +10,7 @@
/* Wake Source interrupts */
GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH | GPIO_PULL_UP |
- GPIO_HIB_WAKE_HIGH, power_button_interrupt) /* H1_EC_PWR_BTN_ODL */
+ GPIO_HIB_WAKE_HIGH, power_button_interrupt) /* GSC_EC_PWR_BTN_ODL */
GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
lid_interrupt)
GPIO_INT(TABLET_MODE_L, PIN(J, 7), GPIO_INT_BOTH,
@@ -29,17 +29,18 @@ GPIO_INT(PMIC_EC_PWRGD, PIN(F, 3),
GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V, power_signal_interrupt)
/* Sensor Interrupts */
-GPIO_INT(BASE_IMU_INT_L, PIN(J, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- motion_interrupt)
-GPIO_INT(LID_ACCEL_INT_L, PIN(J, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- lis2dw12_interrupt)
-GPIO(ALS_RGB_INT_ODL, PIN(F, 0), GPIO_INPUT)
-
+GPIO_INT(BASE_IMU_INT_L, PIN(M, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V,
+ icm42607_interrupt)
/* USB-C interrupts */
-/* TODO: driver not ready */
-GPIO(USB_C0_PPC_INT_ODL, PIN(D, 1), GPIO_INT_BOTH)
-GPIO_INT(USB_C0_BC12_INT_ODL,PIN(J, 6), GPIO_INT_FALLING, bc12_interrupt)
-GPIO_INT(USB_C1_BC12_INT_L, PIN(J, 4), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C0_PPC_INT_ODL, PIN(D, 1), GPIO_INT_BOTH, ppc_interrupt)
+#ifdef BOARD_CHERRY
+GPIO_INT(USB_C0_BC12_INT_ODL,PIN(J, 4), GPIO_INT_FALLING, bc12_interrupt)
+#else /* TOMATO */
+GPIO_INT(USB_C0_BC12_INT_ODL,PIN(I, 5), GPIO_INT_FALLING, bc12_interrupt)
+#endif
+GPIO_INT(USB_C1_INT_ODL, PIN(B, 2), GPIO_INT_FALLING, rt1718s_tcpc_interrupt)
+/* TODO: not used in other devices? */
+GPIO(LID_ACCEL_INT_L, PIN(M, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V)
/* Volume button interrupts */
GPIO_INT(VOLUME_DOWN_L, PIN(D, 5), GPIO_INT_BOTH | GPIO_PULL_UP,
@@ -48,8 +49,6 @@ GPIO_INT(VOLUME_UP_L, PIN(D, 6), GPIO_INT_BOTH | GPIO_PULL_UP,
button_interrupt) /* EC_VOLUP_BTN_ODL */
/* Other interrupts */
-GPIO_INT(AP_XHCI_INIT_DONE, PIN(D, 2), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V,
- usb_a0_interrupt)
GPIO_INT(AC_PRESENT, PIN(E, 5), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
extpower_interrupt) /* AC_OK / AC_PRESENT in rev1+ */
GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_FALLING,
@@ -58,16 +57,18 @@ GPIO_INT(WP, PIN(I, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V,
switch_interrupt) /* EC_FLASH_WP_OD */
GPIO_INT(SPI0_CS, PIN(M, 5), GPIO_INT_FALLING,
spi_event) /* SPI slave Chip Select -- AP_SPI_EC_CS_L */
-GPIO_INT(X_EC_GPIO2, PIN(B, 2), GPIO_ODR_HIGH, x_ec_interrupt)
+#ifndef BOARD_CHERRY
+GPIO_INT(AP_XHCI_INIT_DONE, PIN(J, 5), GPIO_INT_BOTH | GPIO_PULL_DOWN | GPIO_SEL_1P8V,
+ xhci_init_done_interrupt)
+#endif
/* Power Sequencing Signals */
GPIO(EC_PMIC_EN_ODL, PIN(D, 0), GPIO_ODR_HIGH | GPIO_SEL_1P8V)
GPIO(EC_PMIC_WATCHDOG_L, PIN(H, 0), GPIO_ODR_LOW | GPIO_SEL_1P8V)
GPIO(EN_PP5000_A, PIN(C, 6), GPIO_OUT_HIGH)
-GPIO(PG_MT6315_PROC_ODL, PIN(E, 1), GPIO_INPUT)
+GPIO(PG_MT6315_PROC_B_ODL, PIN(E, 1), GPIO_INPUT)
GPIO(PG_MT6360_ODL, PIN(F, 1), GPIO_INPUT)
-GPIO(PG_PP5000_A_ODL, PIN(A, 6), GPIO_INPUT)
-GPIO(EN_ULP, PIN(E, 3), GPIO_OUT_LOW)
+GPIO(EN_SLP_Z, PIN(E, 3), GPIO_OUT_LOW)
GPIO(SYS_RST_ODL, PIN(B, 6), GPIO_ODR_LOW)
GPIO(EC_BL_EN_OD, PIN(B, 5), GPIO_ODR_LOW | GPIO_SEL_1P8V)
@@ -75,17 +76,22 @@ GPIO(EC_BL_EN_OD, PIN(B, 5), GPIO_ODR_LOW | GPIO_SEL_1P8V)
GPIO(EC_INT_L, PIN(E, 6), GPIO_ODR_HIGH | GPIO_SEL_1P8V) /* EC_AP_INT_ODL */
/* USB and USBC Signals */
-GPIO(DP_AUX_PATH_SEL, PIN(G, 0), GPIO_OUT_HIGH)
-GPIO(EC_AP_DP_HPD_ODL, PIN(J, 0), GPIO_ODR_HIGH | GPIO_SEL_1P8V)
-GPIO(EN_PP5000_USB_A0_VBUS, PIN(B, 7), GPIO_OUT_LOW)
-GPIO(USB_C0_FRS_EN, PIN(H, 3), GPIO_OUT_LOW)
+GPIO(DP_PATH_SEL, PIN(G, 0), GPIO_OUT_HIGH)
+GPIO(DP_DEMUX_EN, PIN(G, 1), GPIO_OUT_LOW)
+GPIO(EC_AP_DP_HPD_ODL, PIN(J, 0), GPIO_ODR_HIGH)
+GPIO(EN_PP5000_USB_A0_VBUS_X,PIN(B, 7), GPIO_OUT_LOW)
+GPIO(USB_C0_DP_IN_HPD, PIN(H, 4), GPIO_OUT_LOW)
+GPIO(USB_C1_DP_IN_HPD, PIN(J, 1), GPIO_OUT_LOW)
+GPIO(USB_C0_FRS_EN, PIN(F, 0), GPIO_OUT_LOW)
/* Misc Signals */
+GPIO(EN_KB_BL, PIN(A, 6), GPIO_OUT_LOW)
GPIO(EC_BATT_PRES_ODL, PIN(C, 0), GPIO_INPUT)
-GPIO(BC12_DET_EN, PIN(J, 5), GPIO_OUT_LOW) /* EN_USB_C0_BC12_DET */
GPIO(EN_EC_ID_ODL, PIN(H, 5), GPIO_ODR_LOW)
GPIO(ENTERING_RW, PIN(C, 5), GPIO_OUT_LOW) /* EC_ENTERING_RW */
-GPIO(EN_5V_USM, PIN(D, 7), GPIO_OUT_LOW)
+GPIO(EN_5V_USM, PIN(G, 3), GPIO_OUT_LOW)
+GPIO(USB_A0_FAULT_ODL, PIN(J, 6), GPIO_INPUT)
+GPIO(PACKET_MODE_EN, PIN(D, 4), GPIO_OUT_LOW) /* EC_GSC_PACKET_MODE */
/* I2C pins - Alternate function below configures I2C module on these pins */
GPIO(I2C_A_SCL, PIN(B, 3), GPIO_INPUT) /* I2C_CHG_BATT_SCL */
@@ -93,19 +99,13 @@ GPIO(I2C_A_SDA, PIN(B, 4), GPIO_INPUT) /* I2C_CHG_BATT_SDA */
GPIO(I2C_B_SCL, PIN(C, 1), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C_SENSOR_SCL */
GPIO(I2C_B_SDA, PIN(C, 2), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C_SENSOR_SDA */
GPIO(I2C_C_SCL, PIN(F, 6), GPIO_INPUT) /* I2C_USB_C0_SCL */
-GPIO(I2C_C_SDA, PIN(F, 7), GPIO_INPUT) /* I2C_USB_C0_SCL */
+GPIO(I2C_C_SDA, PIN(F, 7), GPIO_INPUT) /* I2C_USB_C0_SDA */
GPIO(I2C_E_SCL, PIN(E, 0), GPIO_INPUT) /* I2C_USB_C1_SCL */
GPIO(I2C_E_SDA, PIN(E, 7), GPIO_INPUT) /* I2C_USB_C1_SDA */
-
-/* SPI pins - Alternate function below configures SPI module on these pins */
-
-/* NC / TP */
-
-/* Keyboard pins */
-
-/* Subboards HDMI/TYPEC */
-GPIO(EC_X_GPIO1, PIN(H, 4), GPIO_OUT_LOW)
-GPIO(EC_X_GPIO3, PIN(J, 1), GPIO_INPUT)
+GPIO(I2C_F_SCL, PIN(A, 4), GPIO_INPUT) /* Rev 2+ I2C_PROG_SCL */
+GPIO(I2C_F_SDA, PIN(A, 5), GPIO_INPUT) /* Rev 2+ I2C_PROG_SDA */
+GPIO(I2C_H_SCL, PIN(H, 1), GPIO_INPUT) /* Rev 0,1 I2C_PROG_SCL */
+GPIO(I2C_H_SDA, PIN(H, 2), GPIO_INPUT) /* Rev 0,1 I2C_PROG_SDA */
/* Alternate functions GPIO definitions */
ALTERNATE(PIN_MASK(B, 0x18), 1, MODULE_I2C, 0) /* I2C A */
@@ -117,44 +117,48 @@ ALTERNATE(PIN_MASK(E, 0x81), 1, MODULE_I2C, 0) /* I2C E */
ALTERNATE(PIN_MASK(B, 0x03), 1, MODULE_UART, 0) /* EC to Servo */
/* PWM */
-ALTERNATE(PIN_MASK(A, 0x07), 1, MODULE_PWM, 0) /* PWM 0~2 */
+ALTERNATE(PIN_MASK(A, 0b1111), 1, MODULE_PWM, 0) /* PWM 0,1,2,3 */
/* ADC */
-ALTERNATE(PIN_MASK(I, 0x6F), 0, MODULE_ADC, 0) /* ADC 0,1,2,3,5,6 */
+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 */
/* Unimplemented Pins */
-GPIO(SET_VMC_VOLT_AT_1V8, PIN(D, 4), GPIO_INPUT | GPIO_PULL_DOWN | GPIO_SEL_1P8V)
-GPIO(PACKET_MODE_EN, PIN(A, 3), GPIO_INPUT | GPIO_PULL_DOWN)
-/* b/160218054: behavior not defined */
+GPIO(PG_PP5000_S5_OD, PIN(D, 2), GPIO_INPUT)
/* *_ODL pin has external pullup so don't pull it down. */
-GPIO(USB_A0_FAULT_ODL, PIN(A, 7), GPIO_INPUT)
-GPIO(CHARGER_PROCHOT_ODL, PIN(C, 3), GPIO_INPUT)
GPIO(PG_MT6315_GPU_ODL, PIN(H, 6), GPIO_INPUT)
-GPIO(EN_PP3000_SD_U, PIN(G, 1), GPIO_INPUT | GPIO_PULL_DOWN | GPIO_SEL_1P8V)
/* reserved for future use */
GPIO(CCD_MODE_ODL, PIN(C, 4), GPIO_INPUT)
/*
* ADC pins don't have internal pull-down capability,
* so we set them as output low.
*/
-GPIO(NC_GPI7, PIN(I, 7), GPIO_OUT_LOW)
+#ifdef BOARD_CHERRY
+GPIO(NC_GPI5, PIN(I, 5), GPIO_OUT_LOW)
+#else
+GPIO(NC_GPJ4, PIN(J, 4), GPIO_INPUT | GPIO_PULL_DOWN)
+#endif
/* NC pins, enable internal pull-up/down to avoid floating state. */
-GPIO(NC_GPM2, PIN(M, 2), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPM3, PIN(M, 3), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPM6, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(NC_GPA1, PIN(A, 1), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(PWM7, PIN(A, 7), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(EC_NVME_PLN_ODL, PIN(D, 7), GPIO_INPUT | GPIO_PULL_DOWN)
GPIO(SPI_CLK_GPG6, PIN(G, 6), GPIO_INPUT | GPIO_PULL_UP)
+GPIO(PG_NVME_OD, PIN(H, 3), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(EN_PP2500_NVME_X, PIN(J, 2), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(EN_PP1200_NVME_X, PIN(J, 3), GPIO_INPUT | GPIO_PULL_DOWN)
+GPIO(NC_GPM6, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN)
/*
- * These 4 pins don't have internal pull-down capability,
+ * These pins don't have internal pull-down capability,
* so we set them as output low.
*/
-GPIO(NC_GPG3, PIN(G, 3), GPIO_OUT_LOW)
GPIO(SPI_MOSI_GPG4, PIN(G, 4), GPIO_OUT_LOW)
GPIO(SPI_MISO_GPG5, PIN(G, 5), GPIO_OUT_LOW)
GPIO(SPI_CS_GPG7, PIN(G, 7), GPIO_OUT_LOW)
+GPIO(EC_ID0, PIN(I, 1), GPIO_OUT_LOW)
+GPIO(EC_ID1, PIN(I, 2), GPIO_OUT_LOW)
+
+/* Other unused pins */
+GPIO(NVME_EC_PLA_S3_ODL, PIN(I, 7), GPIO_INPUT)
-UNIMPLEMENTED(USB_C0_PPC_BC12_INT_ODL)
-UNIMPLEMENTED(USB_C0_PPC_FRSINFO)
-UNIMPLEMENTED(USB_C1_BC12_CHARGER_INT_ODL)
diff --git a/board/dojo/led.c b/board/dojo/led.c
new file mode 100644
index 0000000000..c177a1b48f
--- /dev/null
+++ b/board/dojo/led.c
@@ -0,0 +1,87 @@
+/* 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.
+ */
+
+#include "chipset.h"
+#include "common.h"
+#include "gpio.h"
+#include "led_common.h"
+#include "led_onoff_states.h"
+#include "pwm.h"
+
+#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} },
+};
+
+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)
+{
+ switch (color) {
+ case EC_LED_COLOR_AMBER:
+ pwm_enable(PWM_CH_LED1, LED_ON_LVL);
+ pwm_enable(PWM_CH_LED3, LED_OFF_LVL);
+ break;
+ case EC_LED_COLOR_BLUE:
+ pwm_enable(PWM_CH_LED1, LED_OFF_LVL);
+ pwm_enable(PWM_CH_LED3, LED_ON_LVL);
+ break;
+ default: /* LED_OFF and other unsupported colors */
+ pwm_enable(PWM_CH_LED1, LED_OFF_LVL);
+ pwm_enable(PWM_CH_LED3, LED_OFF_LVL);
+ break;
+ }
+}
+
+void led_get_brightness_range(enum ec_led_id led_id, uint8_t *brightness_range)
+{
+ brightness_range[EC_LED_COLOR_AMBER] = 1;
+ brightness_range[EC_LED_COLOR_BLUE] = 1;
+}
+
+int led_set_brightness(enum ec_led_id led_id, const uint8_t *brightness)
+{
+ if (brightness[EC_LED_COLOR_AMBER] != 0)
+ led_set_color_battery(EC_LED_COLOR_AMBER);
+ else if (brightness[EC_LED_COLOR_BLUE] != 0)
+ led_set_color_battery(EC_LED_COLOR_BLUE);
+ else
+ led_set_color_battery(LED_OFF);
+ return EC_SUCCESS;
+}
+
+__override enum led_states board_led_get_state(enum led_states desired_state)
+{
+ if (desired_state == STATE_BATTERY_ERROR) {
+ if (chipset_in_state(CHIPSET_STATE_ON))
+ return desired_state;
+ else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
+ return STATE_DISCHARGE_S3;
+ else
+ return STATE_DISCHARGE_S5;
+ }
+ return desired_state;
+}
diff --git a/board/dojo/vif_override.xml b/board/dojo/vif_override.xml
new file mode 100644
index 0000000000..32736caf64
--- /dev/null
+++ b/board/dojo/vif_override.xml
@@ -0,0 +1,3 @@
+<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
+ Definition from the USB-IF.
+-->
diff --git a/board/dooly/board.c b/board/dooly/board.c
index 5f854ca647..06e479649d 100644
--- a/board/dooly/board.c
+++ b/board/dooly/board.c
@@ -18,6 +18,7 @@
#include "driver/als_tcs3400.h"
#include "driver/ina3221.h"
#include "driver/led/oz554.h"
+#include "driver/led/mp3385.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx7447.h"
#include "driver/tcpm/ps8xxx.h"
@@ -532,13 +533,55 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"ppc1", I2C_PORT_PPC1, 400, GPIO_I2C2_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C4_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, 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);
@@ -663,6 +706,7 @@ const unsigned int ina3221_count = ARRAY_SIZE(ina3221);
static uint16_t board_version;
static uint32_t sku_id;
static uint32_t fw_config;
+static uint32_t ssfc;
static void cbi_init(void)
{
@@ -680,8 +724,11 @@ static void cbi_init(void)
sku_id = val;
if (cbi_get_fw_config(&val) == EC_SUCCESS)
fw_config = val;
- CPRINTS("Board Version: %d, SKU ID: 0x%08x, F/W config: 0x%08x",
- board_version, sku_id, fw_config);
+ 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 ",
+ board_version, sku_id, fw_config, ssfc);
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
@@ -715,6 +762,13 @@ static void board_init(void)
/* Always claim AC is online, because we don't have a battery. */
memmap_batt_flags = host_get_memmap(EC_MEMMAP_BATT_FLAG);
*memmap_batt_flags |= EC_BATT_FLAG_AC_PRESENT;
+
+ /* Initial backlight ic setting by ssfc */
+ if (ec_ssfc_get_led_ic() == SSFC_LED_MP3385)
+ mp3385_board_init();
+ else
+ oz554_board_init();
+ gpio_enable_interrupt(GPIO_PANEL_BACKLIGHT_EN);
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
@@ -922,6 +976,11 @@ unsigned int ec_config_get_thermal_solution(void)
return (fw_config & EC_CFG_THERMAL_MASK) >> EC_CFG_THERMAL_L;
}
+unsigned int ec_ssfc_get_led_ic(void)
+{
+ return (ssfc & EC_SSFC_LED_MASK) >> EC_SSFC_LED_L;
+}
+
/*
* Power monitoring and management.
*
@@ -1176,7 +1235,7 @@ static void power_monitor(void)
hook_call_deferred(&power_monitor_data, delay);
}
-__override void oz554_board_init(void)
+void oz554_board_init(void)
{
int pin_status = 0;
@@ -1201,3 +1260,45 @@ __override void oz554_board_init(void)
break;
}
}
+
+void mp3385_board_init(void)
+{
+ int pin_status = 0;
+
+ pin_status |= gpio_get_level(GPIO_PANEL_ID0) << 0;
+ pin_status |= gpio_get_level(GPIO_PANEL_ID1) << 1;
+
+ switch (pin_status) {
+ case 0x00:
+ CPRINTS("PANEL_HAN01.10A");
+ mp3385_set_config(0, 0xF1);
+ mp3385_set_config(2, 0x4C);
+ mp3385_set_config(5, 0xB7);
+ break;
+ case 0x02:
+ CPRINTS("PANEL_WF9_SSA2");
+ mp3385_set_config(0, 0xF1);
+ mp3385_set_config(2, 0x55);
+ mp3385_set_config(5, 0x87);
+ break;
+ default:
+ CPRINTS("PANEL UNKNOWN");
+ break;
+ }
+}
+
+void board_backlight_enable_interrupt(enum gpio_signal signal)
+{
+ switch (ec_ssfc_get_led_ic()) {
+ case SSFC_LED_OZ554:
+ oz554_interrupt(signal);
+ break;
+ case SSFC_LED_MP3385:
+ mp3385_interrupt(signal);
+ break;
+ default:
+ oz554_interrupt(signal);
+ break;
+ }
+
+}
diff --git a/board/dooly/board.h b/board/dooly/board.h
index 4e0f4a5481..55422449b8 100644
--- a/board/dooly/board.h
+++ b/board/dooly/board.h
@@ -73,7 +73,7 @@
#define CONFIG_MKBP_USE_HOST_EVENT
#undef CONFIG_KEYBOARD_RUNTIME_KEYS
#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
@@ -157,7 +157,7 @@
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 0
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
@@ -224,6 +224,7 @@
* LED backlight controller
*/
#define CONFIG_LED_DRIVER_OZ554
+#define CONFIG_LED_DRIVER_MP3385
#define PP5000_PGOOD_POWER_SIGNAL_MASK POWER_SIGNAL_MASK(PP5000_A_PGOOD)
@@ -280,6 +281,12 @@ enum sensor_id {
SENSOR_COUNT,
};
+enum ssfc_led_id {
+ SSFC_LED_OZ554 = 0,
+ SSFC_LED_MP3385,
+ SSFC_LED_COUNT,
+};
+
/* Board specific handlers */
void board_reset_pd_mcu(void);
@@ -309,8 +316,22 @@ void show_critical_error(void);
#define EC_CFG_THERMAL_H 7
#define EC_CFG_THERMAL_MASK GENMASK(EC_CFG_THERMAL_H, EC_CFG_THERMAL_L)
+/*
+ * Second Source Factory Cache (SSFC) CBI field
+ */
+/*
+ * Led driver IC (2 bits).
+ */
+#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);
+
+void board_backlight_enable_interrupt(enum gpio_signal signal);
#endif /* !__ASSEMBLER__ */
@@ -333,6 +354,7 @@ unsigned int ec_config_get_thermal_solution(void);
#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
/*
diff --git a/board/dooly/gpio.inc b/board/dooly/gpio.inc
index 1d9b143486..65488936b7 100644
--- a/board/dooly/gpio.inc
+++ b/board/dooly/gpio.inc
@@ -42,7 +42,7 @@ GPIO_INT(USB_C0_TCPPC_INT_ODL, PIN(E, 0), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C0_TCPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, tcpc_alert_event)
GPIO_INT(USB_C1_TCPPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, ppc_interrupt)
GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(E, 4), GPIO_INT_FALLING, tcpc_alert_event)
-GPIO_INT(PANEL_BACKLIGHT_EN, PIN(B, 1), GPIO_INT_RISING, backlight_enable_interrupt)
+GPIO_INT(PANEL_BACKLIGHT_EN, PIN(B, 1), GPIO_INT_RISING, board_backlight_enable_interrupt)
/* Sensor Interrupts */
GPIO_INT(ALS_GSENSOR_INT_ODL, PIN(9, 6), GPIO_INT_FALLING, tcs3400_interrupt)
@@ -69,7 +69,7 @@ GPIO_INT(EC_VOLUP_BTN_ODL, PIN(8, 0), GPIO_INT_BOTH | GPIO_PULL_UP, button_i
GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
diff --git a/board/draco/battery.c b/board/draco/battery.c
new file mode 100644
index 0000000000..fbada9a9f1
--- /dev/null
+++ b/board/draco/battery.c
@@ -0,0 +1,107 @@
+/* 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.
+ *
+ * Battery pack vendor provided charging profile
+ */
+
+#include "battery_fuel_gauge.h"
+#include "cbi.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "gpio.h"
+/*
+ * Battery info for all Draco 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 COSMAX Battery Information */
+ [BATTERY_DYNAPACK_COSMX] = {
+ /* RAJ240045 Fuel Gauge */
+ .fuel_gauge = {
+ .manuf_name = "333-2C-4C-A",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .mfgacc_support = 0,
+ .reg_addr = 0x43,
+ .reg_mask = 0x0003,
+ .disconnect_val = 0x0,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 17600,
+ .voltage_normal = 15400, /* mV */
+ .voltage_min = 12000, /* mV */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 45,
+ .charging_min_c = 0,
+ .charging_max_c = 50,
+ .discharging_min_c = -10,
+ .discharging_max_c = 60,
+ },
+ },
+ /* DYNAPACK HIGHPOWER Battery Information */
+ [BATTERY_DYNAPACK_HIGHPOWER] = {
+ /* RAJ240045 Fuel Gauge */
+ .fuel_gauge = {
+ .manuf_name = "333-2D-4C-A",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .mfgacc_support = 0,
+ .reg_addr = 0x43,
+ .reg_mask = 0x0003,
+ .disconnect_val = 0x0,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 17600,
+ .voltage_normal = 15400, /* mV */
+ .voltage_min = 12000, /* mV */
+ .precharge_current = 256, /* mA */
+ .start_charging_min_c = 0,
+ .start_charging_max_c = 45,
+ .charging_min_c = 0,
+ .charging_max_c = 50,
+ .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_COSMX;
+
+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/draco/board.c b/board/draco/board.c
new file mode 100644
index 0000000000..261aebf80c
--- /dev/null
+++ b/board/draco/board.c
@@ -0,0 +1,51 @@
+/* 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.
+ */
+
+#include "battery.h"
+#include "button.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 "fw_config.h"
+#include "hooks.h"
+#include "lid_switch.h"
+#include "power_button.h"
+#include "power.h"
+#include "registers.h"
+#include "switch.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)
+
+__override void board_cbi_init(void)
+{
+ config_usb_db_type();
+}
+
+/* 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_L, 0);
+}
+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);
diff --git a/board/draco/board.h b/board/draco/board.h
new file mode 100644
index 0000000000..58abc1e694
--- /dev/null
+++ b/board/draco/board.h
@@ -0,0 +1,204 @@
+/* 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.
+ */
+
+/* Draco board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#include "compile_time_macros.h"
+
+/*
+ * Early draco boards are not set up for vivaldi
+ */
+#undef CONFIG_KEYBOARD_VIVALDI
+
+/* Baseboard features */
+#include "baseboard.h"
+
+/*
+ * This will happen automatically on NPCX9 ES2 and later. Do not remove
+ * until we can confirm all earlier chips are out of service.
+ */
+#define CONFIG_HIBERNATE_PSL_VCC1_RST_WAKEUP
+
+/* LED */
+#define CONFIG_LED_PWM
+#define CONFIG_LED_PWM_COUNT 2
+#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
+#undef CONFIG_GMR_TABLET_MODE
+
+/* Buttons */
+#undef CONFIG_VOLUME_BUTTONS
+
+/* USB Type A Features */
+#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
+
+#define CONFIG_USB_PD_TCPM_PS8815
+#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+
+/* I2C speed console command */
+#define CONFIG_CMD_I2C_SPEED
+
+/* I2C control host command */
+#define CONFIG_HOSTCMD_I2C_CONTROL
+
+#define CONFIG_USBC_PPC_SYV682X
+#define CONFIG_USBC_PPC_NX20P3483
+
+#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
+
+/*
+ * 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
+
+/* 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_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_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
+
+/* Thermal features */
+#define CONFIG_THERMISTOR
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_SEQ_EC_DSW_PWROK
+#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
+
+#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
+
+/*
+ * Older boards have a different ADC assignment.
+ */
+
+#define CONFIG_ADC_CHANNELS_RUNTIME_CONFIG
+
+#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 battery_type {
+ BATTERY_DYNAPACK_COSMX,
+ BATTERY_DYNAPACK_HIGHPOWER,
+ 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_COUNT
+};
+
+enum fan_channel {
+ FAN_CH_0 = 0,
+ FAN_CH_COUNT
+};
+
+enum mft_channel {
+ MFT_CH_0 = 0,
+ MFT_CH_COUNT
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/draco/build.mk b/board/draco/build.mk
new file mode 100644
index 0000000000..61485378cd
--- /dev/null
+++ b/board/draco/build.mk
@@ -0,0 +1,25 @@
+# -*- makefile -*-
+# 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.
+#
+# Draco board specific files build
+#
+
+CHIP:=npcx
+CHIP_FAMILY:=npcx9
+CHIP_VARIANT:=npcx9m3f
+BASEBOARD:=brya
+
+board-y=
+board-y+=battery.o
+board-y+=board.o
+board-y+=charger_isl9241.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
+board-y+=usbc_config.o
diff --git a/board/draco/charger_isl9241.c b/board/draco/charger_isl9241.c
new file mode 100644
index 0000000000..85e0de90fe
--- /dev/null
+++ b/board/draco/charger_isl9241.c
@@ -0,0 +1,90 @@
+/* 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)
+
+/* 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);
+
+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/draco/ec.tasklist b/board/draco/ec.tasklist
new file mode 100644
index 0000000000..d866e2349e
--- /dev/null
+++ b/board/draco/ec.tasklist
@@ -0,0 +1,31 @@
+/* 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.
+ */
+
+/*
+ * 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(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) \
+ TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, 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_C2, pd_task, NULL, BASEBOARD_PD_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), BASEBOARD_PD_INT_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, BASEBOARD_PD_INT_TASK_STACK_SIZE)
diff --git a/board/draco/fans.c b/board/draco/fans.c
new file mode 100644
index 0000000000..ca816af8ab
--- /dev/null
+++ b/board/draco/fans.c
@@ -0,0 +1,74 @@
+/* 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.
+ */
+
+/* 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_1,
+ .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,
+};
+
+static const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 2200,
+ .rpm_start = 2200,
+ .rpm_max = 4200,
+};
+
+const struct fan_t fans[FAN_CH_COUNT] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
+
+#ifndef CONFIG_FANS
+
+static void fan_slow(void)
+{
+ const int duty_pct = 33;
+
+ ccprints("%s: speed %d%%", __func__, duty_pct);
+
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, duty_pct);
+}
+
+static void fan_max(void)
+{
+ const int duty_pct = 100;
+
+ ccprints("%s: speed %d%%", __func__, duty_pct);
+
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, 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/draco/fw_config.c b/board/draco/fw_config.c
new file mode 100644
index 0000000000..7dd00954e8
--- /dev/null
+++ b/board/draco/fw_config.c
@@ -0,0 +1,46 @@
+/* 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.
+ */
+
+#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_CHIPSET, format, ## args)
+
+static union draco_cbi_fw_config fw_config;
+BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
+
+/*
+ * FW_CONFIG defaults for draco if the CBI.FW_CONFIG data is not
+ * initialized.
+ */
+static const union draco_cbi_fw_config fw_config_defaults = {
+ .usb_db = DB_USB3_PS8815,
+ .kb_bl = KEYBOARD_BACKLIGHT_ENABLED,
+};
+
+/****************************************************************************
+ * Draco 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 draco_cbi_fw_config get_fw_config(void)
+{
+ return fw_config;
+}
+
+enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void)
+{
+ return fw_config.usb_db;
+}
diff --git a/board/draco/fw_config.h b/board/draco/fw_config.h
new file mode 100644
index 0000000000..eea18a6e14
--- /dev/null
+++ b/board/draco/fw_config.h
@@ -0,0 +1,54 @@
+/* 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.
+ */
+
+#ifndef __BOARD_DRACO_FW_CONFIG_H_
+#define __BOARD_DRACO_FW_CONFIG_H_
+
+#include <stdint.h>
+
+/****************************************************************************
+ * CBI FW_CONFIG layout for Draco board.
+ *
+ * Source of truth is the project/brya/draco/config.star configuration file.
+ */
+
+enum ec_cfg_usb_db_type {
+ DB_USB_ABSENT = 0,
+ DB_USB3_PS8815 = 1,
+ DB_USB_ABSENT2 = 15
+};
+
+enum ec_cfg_keyboard_backlight_type {
+ KEYBOARD_BACKLIGHT_DISABLED = 0,
+ KEYBOARD_BACKLIGHT_ENABLED = 1
+};
+
+union draco_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;
+ };
+ uint32_t raw_value;
+};
+
+/**
+ * Read the cached FW_CONFIG. Guaranteed to have valid values.
+ *
+ * @return the FW_CONFIG for the board.
+ */
+union draco_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_DRACO_FW_CONFIG_H_ */
diff --git a/board/draco/gpio.inc b/board/draco/gpio.inc
new file mode 100644
index 0000000000..715bff4f67
--- /dev/null
+++ b/board/draco/gpio.inc
@@ -0,0 +1,135 @@
+/* -*- mode:c -*-
+ *
+ * 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.
+ */
+
+#define MODULE_KB MODULE_KEYBOARD_SCAN
+
+/* 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_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)
+
+/* USED GPIOs: */
+GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
+GPIO(CHARGER_VAP_OTG_EN, PIN(7, 3), GPIO_OUT_LOW)
+GPIO(CPU_C10_GATE_L, PIN(6, 7), 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(D, 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_C2_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_PPC_BC_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)
+GPIO(EC_KB_BL_EN_L, PIN(8, 6), 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_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)
+GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
+GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
+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_RST_ODL, PIN(9, 6), GPIO_ODR_LOW)
+GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT)
+GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), GPIO_ODR_LOW)
+GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
+
+/*
+ * 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)
+
+/* 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 */
+ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */
+
+/* PWM alternate functions */
+ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */
+ALTERNATE(PIN_MASK(6, 0x01), 0, MODULE_PWM, 0) /* GPIO60/PWM7 */
+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) /* GPIOC4/PWM2, GPIOC3/PWM0, GPIOC2/PWM1/I2C6_SCL0 */
+
+/* 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, 0xf0), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO10&P80_CLK/GPIO07, KSO11&P80_DAT/GPIO06, KSO12/GPIO05, KSO13/GPIO04 */
+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) /* KSI2/GPIO27/TRACEDATA1, KSI3/GPIO26/TRACEDATA0, 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 */
+ALTERNATE(PIN_MASK(8, 0x04), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO14/GPIO82 */
+
+/* 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 */
+
+/* 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(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
+UNUSED(PIN(8, 1)) /* GPIO81 */
+UNUSED(PIN(D, 4)) /* GPIOD4 */
+UNUSED(PIN(5, 6)) /* GPIO56 */
+UNUSED(PIN(9, 3)) /* GPIO93 */
+UNUSED(PIN(9, 7)) /* GPIO97 */
+UNUSED(PIN(9, 5)) /* GPIO95 */
diff --git a/board/draco/i2c.c b/board/draco/i2c.c
new file mode 100644
index 0000000000..3db2e0c17b
--- /dev/null
+++ b/board/draco/i2c.c
@@ -0,0 +1,98 @@
+/* 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.
+ */
+
+#include "common.h"
+#include "compile_time_macros.h"
+#include "hooks.h"
+#include "i2c.h"
+
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
+
+/* 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,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_BC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C2_PPC_BC_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 = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
+ },
+ {
+ /* I2C5 */
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BAT_SCL,
+ .sda = GPIO_EC_I2C_BAT_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,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
+ },
+ {
+ /* 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);
+
+/*
+ * 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/draco/keyboard.c b/board/draco/keyboard.c
new file mode 100644
index 0000000000..a9f033130d
--- /dev/null
+++ b/board/draco/keyboard.c
@@ -0,0 +1,25 @@
+/* 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.
+ */
+
+#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/draco/led.c b/board/draco/led.c
new file mode 100644
index 0000000000..74764a8ef4
--- /dev/null
+++ b/board/draco/led.c
@@ -0,0 +1,93 @@
+/* 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.
+ */
+
+/* Draco 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.
+ */
+
+#include <stdint.h>
+
+#include "common.h"
+#include "compile_time_macros.h"
+#include "ec_commands.h"
+#include "led_pwm.h"
+#include "pwm.h"
+#include "util.h"
+
+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);
+
+/*
+ * 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 },
+};
+
+/* 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,
+ },
+ {
+ .ch0 = PWM_CH_LED3,
+ .ch1 = PWM_CH_LED4,
+ .ch2 = PWM_LED_NO_CHANNEL,
+ .enable = &pwm_enable,
+ .set_duty = &pwm_set_duty,
+ },
+};
+
+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;
+}
+
+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;
+ break;
+ case EC_LED_ID_RIGHT_LED:
+ pwm_id = PWM_LED1;
+ break;
+ default:
+ return EC_ERROR_UNKNOWN;
+ }
+
+ 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;
+}
diff --git a/board/draco/pwm.c b/board/draco/pwm.c
new file mode 100644
index 0000000000..2203f14c8d
--- /dev/null
+++ b/board/draco/pwm.c
@@ -0,0 +1,71 @@
+/* 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.
+ */
+
+#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_LED2] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 4800,
+ },
+ [PWM_CH_LED3] = {
+ .channel = 1,
+ .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,
+ /*
+ * 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_FAN] = {
+ .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
+ .freq = 1000
+ },
+ [PWM_CH_LED4] = {
+ .channel = 7,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 4800,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+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_LED3, 1);
+ pwm_set_duty(PWM_CH_LED3, 0);
+ pwm_enable(PWM_CH_LED4, 1);
+ pwm_set_duty(PWM_CH_LED4, 0);
+
+ 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/draco/sensors.c b/board/draco/sensors.c
new file mode 100644
index 0000000000..b68984c95c
--- /dev/null
+++ b/board/draco/sensors.c
@@ -0,0 +1,151 @@
+/* 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.
+ */
+
+#include "common.h"
+#include "adc.h"
+#include "hooks.h"
+#include "temp_sensor.h"
+#include "thermal.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);
+
+#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;
+
+#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;
+
+/*
+ * 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
+ */
+#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;
+
+#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/draco/usbc_config.c b/board/draco/usbc_config.c
new file mode 100644
index 0000000000..1475e1f536
--- /dev/null
+++ b/board/draco/usbc_config.c
@@ -0,0 +1,367 @@
+/* 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.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "cbi.h"
+#include "charger.h"
+#include "charge_ramp.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/bc12/pi3usb9201_public.h"
+#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/syv682x_public.h"
+#include "driver/tcpm/nct38xx.h"
+#include "driver/tcpm/ps8xxx_public.h"
+#include "driver/tcpm/tcpci.h"
+#include "ec_commands.h"
+#include "fw_config.h"
+#include "gpio.h"
+#include "gpio_signal.h"
+#include "hooks.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 = PS8751_I2C_ADDR1_FLAGS,
+ },
+ .drv = &ps8xxx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
+ TCPC_FLAGS_CONTROL_VCONN,
+ },
+ [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);
+
+/******************************************************************************/
+/* USB-A charging control */
+
+const int usb_port_enable[USB_PORT_COUNT] = {
+ GPIO_EN_PP5000_USBA_R,
+};
+BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_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] = {
+ /* Compatible with Silicon Mitus SM536A0 */
+ .i2c_port = I2C_PORT_USB_C1_PPC,
+ .i2c_addr_flags = NX20P3483_ADDR2_FLAGS,
+ .drv = &nx20p348x_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 usbc2_tcss_usb_mux = {
+ .usb_port = USBC_PORT_C2,
+ .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,
+};
+
+const struct usb_mux usb_muxes[] = {
+ [USBC_PORT_C0] = {
+ .usb_port = USBC_PORT_C0,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ .next_mux = &usbc0_tcss_usb_mux,
+ },
+ [USBC_PORT_C1] = {
+ .usb_port = USBC_PORT_C1,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
+ .next_mux = &usbc1_usb3_db_retimer,
+ },
+ [USBC_PORT_C2] = {
+ .usb_port = USBC_PORT_C2,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = virtual_hpd_update,
+ .next_mux = &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);
+
+#ifdef CONFIG_CHARGE_RAMP_SW
+
+#define BC12_MIN_VOLTAGE 4400
+
+/**
+ * Return true if VBUS is too low
+ */
+int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
+{
+ int voltage;
+
+ if (charger_get_vbus_voltage(port, &voltage))
+ voltage = 0;
+
+ if (voltage == 0) {
+ CPRINTS("%s: must be disconnected", __func__);
+ return 1;
+ }
+
+ if (voltage < BC12_MIN_VOLTAGE) {
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
+ port, voltage, BC12_MIN_VOLTAGE);
+ return 1;
+ }
+
+ return 0;
+}
+
+#endif /* CONFIG_CHARGE_RAMP_SW */
+
+void config_usb_db_type(void)
+{
+ enum ec_cfg_usb_db_type db_type = ec_cfg_usb_db_type();
+
+ CPRINTS("Configured USB DB type number is %d", db_type);
+}
+
+void board_reset_pd_mcu(void)
+{
+ enum gpio_signal tcpc_rst;
+
+ tcpc_rst = GPIO_USB_C0_C2_TCPC_RST_ODL;
+
+ gpio_set_level(tcpc_rst, 0);
+ if (ec_cfg_usb_db_type() != DB_USB_ABSENT) {
+ gpio_set_level(GPIO_USB_C1_RST_ODL, 0);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+ }
+
+ /*
+ * delay for power-on to reset-off and min. assertion time
+ */
+
+ msleep(20);
+
+ gpio_set_level(tcpc_rst, 1);
+ if (ec_cfg_usb_db_type() != DB_USB_ABSENT) {
+ gpio_set_level(GPIO_USB_C1_RST_ODL, 1);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
+ }
+
+ /* wait for chips to come up */
+
+ msleep(50);
+}
+
+static void board_tcpc_init(void)
+{
+ /* Don't reset TCPCs after initial reset */
+ if (!system_jumped_late())
+ board_reset_pd_mcu();
+
+ /* 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);
+
+ /* Enable BC1.2 interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C2_BC12_INT_ODL);
+
+ if (ec_cfg_usb_db_type() != DB_USB_ABSENT) {
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_BC12_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 ((ec_cfg_usb_db_type() != DB_USB_ABSENT) &&
+ 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) &&
+ (ec_cfg_usb_db_type() != DB_USB_ABSENT))
+ 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:
+ if (ec_cfg_usb_db_type() == DB_USB_ABSENT)
+ break;
+ 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:
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C1_BC12_INT_ODL:
+ if (ec_cfg_usb_db_type() == DB_USB_ABSENT)
+ break;
+ task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C2_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P2, 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:
+ switch (ec_cfg_usb_db_type()) {
+ case DB_USB_ABSENT:
+ case DB_USB_ABSENT2:
+ break;
+ case DB_USB3_PS8815:
+ nx20p348x_interrupt(USBC_PORT_C1);
+ break;
+ }
+ break;
+ case GPIO_USB_C2_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C2);
+ break;
+ default:
+ break;
+ }
+}
+
+void retimer_interrupt(enum gpio_signal signal)
+{
+}
+
+__override bool board_is_dts_port(int port)
+{
+ return port == USBC_PORT_C0;
+}
+
+__override bool board_is_tbt_usb4_port(int port)
+{
+ 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/draco/usbc_config.h b/board/draco/usbc_config.h
new file mode 100644
index 0000000000..512580d704
--- /dev/null
+++ b/board/draco/usbc_config.h
@@ -0,0 +1,22 @@
+/* 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.
+ */
+
+/* Draco board-specific USB-C configuration */
+
+#ifndef __CROS_EC_USBC_CONFIG_H
+#define __CROS_EC_USBC_CONFIG_H
+
+#define CONFIG_USB_PD_PORT_MAX_COUNT 3
+
+enum usbc_port {
+ USBC_PORT_C0 = 0,
+ USBC_PORT_C1,
+ USBC_PORT_C2,
+ USBC_PORT_COUNT
+};
+
+void config_usb_db_type(void);
+
+#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/draco/vif_override.xml b/board/draco/vif_override.xml
new file mode 100644
index 0000000000..32736caf64
--- /dev/null
+++ b/board/draco/vif_override.xml
@@ -0,0 +1,3 @@
+<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
+ Definition from the USB-IF.
+-->
diff --git a/board/drallion_ish/board.c b/board/drallion_ish/board.c
index c9a683e36d..fba8a622a9 100644
--- a/board/drallion_ish/board.c
+++ b/board/drallion_ish/board.c
@@ -61,8 +61,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_ACCEL_GYRO_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = NULL,
@@ -91,8 +89,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_lid_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_a_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_ACCEL_GYRO_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/drallion_ish/board.h b/board/drallion_ish/board.h
index dab93426a6..53da677775 100644
--- a/board/drallion_ish/board.h
+++ b/board/drallion_ish/board.h
@@ -60,7 +60,7 @@
#define CONFIG_DMA_PAGING
/* Host command over HECI */
-#define CONFIG_HOSTCMD_HECI
+#define CONFIG_HOST_INTERFACE_HECI
/* I2C ports */
#define I2C_PORT_SENSOR ISH_I2C0
diff --git a/board/dratini/board.h b/board/dratini/board.h
index 12074e3447..c23cbd1f2d 100644
--- a/board/dratini/board.h
+++ b/board/dratini/board.h
@@ -17,7 +17,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 2048
@@ -95,7 +95,7 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 10
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -122,6 +122,7 @@
#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__
diff --git a/board/drawcia/board.c b/board/drawcia/board.c
index 80f93e4d1d..c6c581c436 100644
--- a/board/drawcia/board.c
+++ b/board/drawcia/board.c
@@ -135,14 +135,30 @@ static void usb_c1_interrupt(enum gpio_signal s)
hook_call_deferred(&check_c1_line_data, INT_RECHECK_US);
}
+static void board_enable_hdmi_hpd(int enable)
+{
+ 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);
+ }
+}
+
static void button_sub_hdmi_hpd_interrupt(enum gpio_signal s)
{
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)
- gpio_set_level(GPIO_EC_AP_USB_C1_HDMI_HPD, hdmi_hpd);
- else
+ 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);
}
@@ -327,8 +343,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -356,8 +370,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -417,6 +429,9 @@ void board_init(void)
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);
+
/* 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);
@@ -438,6 +453,9 @@ 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);
}
DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_resume, HOOK_PRIO_DEFAULT);
@@ -449,6 +467,13 @@ static void board_suspend(void)
}
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)
{
/*
diff --git a/board/drawcia_riscv/board.c b/board/drawcia_riscv/board.c
index ffa7da0bea..f57bc4e49f 100644
--- a/board/drawcia_riscv/board.c
+++ b/board/drawcia_riscv/board.c
@@ -328,8 +328,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -357,8 +355,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/drobit/ec.tasklist b/board/drobit/ec.tasklist
index 2c9a9e8e32..c1b0295d37 100644
--- a/board/drobit/ec.tasklist
+++ b/board/drobit/ec.tasklist
@@ -15,6 +15,7 @@
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/duck b/board/duck
new file mode 120000
index 0000000000..7f4a914148
--- /dev/null
+++ b/board/duck
@@ -0,0 +1 @@
+hammer \ No newline at end of file
diff --git a/board/eldrid/ec.tasklist b/board/eldrid/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/eldrid/ec.tasklist
+++ b/board/eldrid/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/elemi/ec.tasklist b/board/elemi/ec.tasklist
index 2c9a9e8e32..c1b0295d37 100644
--- a/board/elemi/ec.tasklist
+++ b/board/elemi/ec.tasklist
@@ -15,6 +15,7 @@
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/elm/board.c b/board/elm/board.c
index f4f1e3be2e..4e1a680659 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -108,9 +108,21 @@ int anx7688_passthru_allowed(const struct i2c_port_t *port,
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"battery", I2C_PORT_BATTERY, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA,
- anx7688_passthru_allowed}
+ {
+ .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);
diff --git a/board/elm/board.h b/board/elm/board.h
index 319241642c..8bb8c2bf15 100644
--- a/board/elm/board.h
+++ b/board/elm/board.h
@@ -16,6 +16,7 @@
/* Free up flash space */
#undef CONFIG_USB_PD_TCPMV1_DEBUG
+#define CONFIG_LTO
/* Accelero meter and gyro sensor */
#define CONFIG_ACCEL_KX022
@@ -170,7 +171,7 @@
#define I2C_PORT_TCPC 1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI master port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI controller port (SPI2) */
/* Timer selection */
#define TIM_CLOCK32 2
diff --git a/board/endeavour/board.c b/board/endeavour/board.c
index f208da3819..98d805f60a 100644
--- a/board/endeavour/board.c
+++ b/board/endeavour/board.c
@@ -85,10 +85,34 @@ const struct mft_t mft_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"pse", I2C_PORT_PSE, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"pmic", I2C_PORT_PMIC, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/endeavour/board.h b/board/endeavour/board.h
index fd1b3e5b9c..9b0107b2c4 100644
--- a/board/endeavour/board.h
+++ b/board/endeavour/board.h
@@ -58,7 +58,7 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
diff --git a/board/eve/board.c b/board/eve/board.c
index f73118e8f2..a972cb4ebc 100644
--- a/board/eve/board.c
+++ b/board/eve/board.c
@@ -192,11 +192,41 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"accelgyro", I2C_PORT_GYRO, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"sensors", I2C_PORT_LID_ACCEL, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"batt", I2C_PORT_BATTERY, 100, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/eve/board.h b/board/eve/board.h
index 64e299bc54..5dcb9fc32f 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -72,7 +72,7 @@
#define CONFIG_CHIPSET_SKYLAKE
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
diff --git a/board/felwinter/board.c b/board/felwinter/board.c
index cd7768d0ea..8eac363159 100644
--- a/board/felwinter/board.c
+++ b/board/felwinter/board.c
@@ -63,6 +63,13 @@ static void board_chipset_suspend(void)
}
DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+/* Called on AP S5 -> S3 transition */
+static void board_chipset_startup(void)
+{
+ pen_config();
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
+
#ifdef CONFIG_CHARGE_RAMP_SW
/*
@@ -114,5 +121,50 @@ static void board_init(void)
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
+ */
+static void pendetect_deferred(void)
+{
+ static int debounced_pen_detect;
+ int pen_detect = !gpio_get_level(GPIO_PEN_DET_ODL);
+
+ if (pen_detect == debounced_pen_detect)
+ return;
+
+ debounced_pen_detect = pen_detect;
+
+ if (!chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ gpio_set_level(GPIO_EN_PP5000_PEN, debounced_pen_detect);
+}
+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);
+}
+
+void pen_config(void)
+{
+ if (ec_cfg_stylus() == STYLUS_PRSENT) {
+ /* Make sure pen detection is triggered or not at resume */
+ if (!gpio_get_level(GPIO_PEN_DET_ODL))
+ gpio_set_level(GPIO_EN_PP5000_PEN, 1);
+ else
+ gpio_set_level(GPIO_EN_PP5000_PEN, 0);
+ }
+}
+
+static void board_chipset_shutdown(void)
+{
+ gpio_set_level(GPIO_EN_PP5000_PEN, 0);
+}
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
diff --git a/board/felwinter/board.h b/board/felwinter/board.h
index 8f7c03dfb7..064ce51e54 100644
--- a/board/felwinter/board.h
+++ b/board/felwinter/board.h
@@ -10,11 +10,6 @@
#include "compile_time_macros.h"
-/*
- * Early brya boards are not set up for vivaldi
- */
-#undef CONFIG_KEYBOARD_VIVALDI
-
/* Baseboard features */
#include "baseboard.h"
@@ -77,6 +72,9 @@
#define CONFIG_USB_PD_TCPM_PS8815
#define CONFIG_USBC_RETIMER_INTEL_BB
+/* I2C control host command */
+#define CONFIG_HOSTCMD_I2C_CONTROL
+
#define CONFIG_USBC_PPC_SYV682X
#define CONFIG_USBC_PPC_NX20P3483
@@ -111,6 +109,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
/*
@@ -173,7 +172,7 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_FANS FAN_CH_COUNT
@@ -239,6 +238,10 @@ enum mft_channel {
MFT_CH_COUNT
};
+void pen_detect_interrupt(enum gpio_signal s);
+
+void pen_config(void);
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/felwinter/ec.tasklist b/board/felwinter/ec.tasklist
index 41d86da3d6..6d995d6b44 100644
--- a/board/felwinter/ec.tasklist
+++ b/board/felwinter/ec.tasklist
@@ -19,6 +19,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
diff --git a/board/felwinter/fans.c b/board/felwinter/fans.c
index d966056331..9a29f0f1d1 100644
--- a/board/felwinter/fans.c
+++ b/board/felwinter/fans.c
@@ -30,16 +30,10 @@ static const struct fan_conf fan_conf_0 = {
.enable_gpio = GPIO_EN_PP5000_FAN,
};
-/*
- * TOOD(b/180681346): 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 = 2000,
+ .rpm_start = 2000,
+ .rpm_max = 5200,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/felwinter/fw_config.c b/board/felwinter/fw_config.c
index d733df3208..4228394d5b 100644
--- a/board/felwinter/fw_config.c
+++ b/board/felwinter/fw_config.c
@@ -48,3 +48,8 @@ enum ec_cfg_usb_mb_type ec_cfg_usb_mb_type(void)
{
return fw_config.usb_mb;
}
+
+enum ec_cfg_stylus_type ec_cfg_stylus(void)
+{
+ return fw_config.stylus;
+}
diff --git a/board/felwinter/fw_config.h b/board/felwinter/fw_config.h
index fb5c374b5d..5f5f956b61 100644
--- a/board/felwinter/fw_config.h
+++ b/board/felwinter/fw_config.h
@@ -29,11 +29,16 @@ enum ec_cfg_usb_mb_type {
MB_USB3_NON_TBT = 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;
- uint32_t stylus : 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;
@@ -66,3 +71,10 @@ enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void);
enum ec_cfg_usb_mb_type ec_cfg_usb_mb_type(void);
#endif /* __BOARD_BRYA_FW_CONFIG_H_ */
+
+/**
+ * Get the stylus type from FW_CONFIG.
+ *
+ * @return the stylus type.
+ */
+enum ec_cfg_stylus_type ec_cfg_stylus(void);
diff --git a/board/felwinter/gpio.inc b/board/felwinter/gpio.inc
index ba7116847a..86f71a9ea3 100644
--- a/board/felwinter/gpio.inc
+++ b/board/felwinter/gpio.inc
@@ -31,6 +31,7 @@ GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert
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(PEN_DET_ODL, PIN(D, 4), GPIO_INT_BOTH, pen_detect_interrupt)
/* USED GPIOs: */
GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
@@ -67,6 +68,7 @@ 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_USBA_R, PIN(D, 7), GPIO_OUT_LOW)
+GPIO(EN_PP5000_PEN, PIN(E, 1), GPIO_OUT_LOW)
GPIO(EN_S5_RAILS, PIN(B, 6), GPIO_OUT_LOW)
GPIO(IMVP9_VRRDY_OD, PIN(4, 3), GPIO_INPUT)
GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
@@ -124,11 +126,10 @@ UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
UNUSED(PIN(6, 6)) /* GPIO66 */
UNUSED(PIN(C, 3)) /* GPIOC3 */
-UNUSED(PIN(E, 1)) /* GPIOE1 */
-UNUSED(PIN(D, 4)) /* GPIOD4 */
UNUSED(PIN(C, 6)) /* GPIOC6 */
UNUSED(PIN(6, 2)) /* GPIO62 */
UNUSED(PIN(B, 1)) /* GPIOB1 */
+UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
/* Pre-configured PSL balls: J8 K6 */
@@ -143,7 +144,9 @@ GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW)
/* GPIO02_P2 to PU */
/* GPIO03_P2 to PU */
+IOEX(USB_C1_RT_RST_ODL, EXPIN(IOEX_C1_NCT38XX, 0, 2), GPIO_ODR_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_LOW)
IOEX(USB_C2_RT_RST_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 2), GPIO_ODR_LOW)
IOEX(USB_C2_OC_ODL, EXPIN(IOEX_C2_NCT38XX, 0, 4), GPIO_ODR_HIGH)
diff --git a/board/felwinter/i2c.c b/board/felwinter/i2c.c
index b54cc98de8..a850c12544 100644
--- a/board/felwinter/i2c.c
+++ b/board/felwinter/i2c.c
@@ -49,6 +49,7 @@ const struct i2c_port_t i2c_ports[] = {
.kbps = 400,
.scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
},
{
/* I2C5 */
diff --git a/board/felwinter/pwm.c b/board/felwinter/pwm.c
index 985305449b..1312135a2c 100644
--- a/board/felwinter/pwm.c
+++ b/board/felwinter/pwm.c
@@ -24,8 +24,8 @@ const struct pwm_t pwm_channels[] = {
},
[PWM_CH_FAN] = {
.channel = 5,
- .flags = PWM_CONFIG_OPEN_DRAIN,
- .freq = 25000
+ .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
+ .freq = 1000
},
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
diff --git a/board/felwinter/sensors.c b/board/felwinter/sensors.c
index b25d39f136..437fc8bcde 100644
--- a/board/felwinter/sensors.c
+++ b/board/felwinter/sensors.c
@@ -68,10 +68,8 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lis2dw12_drv,
.mutex = &g_lid_accel_mutex,
.drv_data = &g_lis2dw12_data,
- .int_signal = GPIO_EC_ACCEL_INT_R_L,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LIS2DW12_ADDR0,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.rot_standard_ref = &lid_standard_ref, /* identity matrix */
.default_range = 2, /* g */
.min_frequency = LIS2DW12_ODR_MIN_VAL,
@@ -98,8 +96,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -128,8 +124,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/felwinter/usbc_config.c b/board/felwinter/usbc_config.c
index bb2e6c2218..5fa144e364 100644
--- a/board/felwinter/usbc_config.c
+++ b/board/felwinter/usbc_config.c
@@ -56,7 +56,8 @@ struct tcpc_config_t tcpc_config[] = {
},
.drv = &ps8xxx_tcpm_drv,
.flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V,
+ TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
+ TCPC_FLAGS_CONTROL_VCONN,
},
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
@@ -210,7 +211,7 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
int rst_signal;
if (me->usb_port == USBC_PORT_C1)
- rst_signal = GPIO_USB_C1_RT_RST_R_ODL;
+ rst_signal = IOEX_USB_C1_RT_RST_ODL;
else if (me->usb_port == USBC_PORT_C2)
rst_signal = IOEX_USB_C2_RT_RST_ODL;
else
diff --git a/board/fennel/board.c b/board/fennel/board.c
index 0706813592..3335c80240 100644
--- a/board/fennel/board.c
+++ b/board/fennel/board.c
@@ -68,13 +68,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -140,8 +159,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/fennel/board.h b/board/fennel/board.h
index 697480770c..dc73b2e132 100644
--- a/board/fennel/board.h
+++ b/board/fennel/board.h
@@ -91,7 +91,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/fizz/board.c b/board/fizz/board.c
index 5b830b9150..975401d5a1 100644
--- a/board/fizz/board.c
+++ b/board/fizz/board.c
@@ -164,11 +164,41 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"eeprom", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/fizz/board.h b/board/fizz/board.h
index 8e8cbcd823..ad1ca85cac 100644
--- a/board/fizz/board.h
+++ b/board/fizz/board.h
@@ -70,7 +70,7 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
diff --git a/board/fleex/board.c b/board/fleex/board.c
index 7e11d671c6..4464d45730 100644
--- a/board/fleex/board.c
+++ b/board/fleex/board.c
@@ -199,8 +199,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -231,8 +229,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/foob/board.c b/board/foob/board.c
index 3e7725ac2e..91d66d88d7 100644
--- a/board/foob/board.c
+++ b/board/foob/board.c
@@ -144,8 +144,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &standard_rot_ref,
@@ -176,8 +174,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/fusb307bgevb/board.c b/board/fusb307bgevb/board.c
index 41b12d5a82..f3f4da1a74 100644
--- a/board/fusb307bgevb/board.c
+++ b/board/fusb307bgevb/board.c
@@ -241,7 +241,13 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
* I2C interface.
*/
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", I2C_PORT_TCPC, 400 /* kHz */, GPIO_I2C2_SCL, GPIO_I2C2_SDA}
+ {
+ .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);
diff --git a/board/genesis/board.c b/board/genesis/board.c
index a846478ecb..5305c8d630 100644
--- a/board/genesis/board.c
+++ b/board/genesis/board.c
@@ -133,12 +133,48 @@ const struct pwm_t pwm_channels[] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"pse", I2C_PORT_PSE, 400, GPIO_I2C4_SCL, GPIO_I2C4_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, 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);
diff --git a/board/genesis/board.h b/board/genesis/board.h
index 7c32579440..9c9233590e 100644
--- a/board/genesis/board.h
+++ b/board/genesis/board.h
@@ -38,7 +38,7 @@
#define CONFIG_MKBP_USE_HOST_EVENT
#undef CONFIG_KEYBOARD_RUNTIME_KEYS
#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
@@ -103,7 +103,7 @@
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 0
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
@@ -217,6 +217,7 @@ unsigned int ec_config_get_thermal_solution(void);
#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
/*
diff --git a/board/genesis/gpio.inc b/board/genesis/gpio.inc
index 6a905fdf04..d8f2989b8e 100644
--- a/board/genesis/gpio.inc
+++ b/board/genesis/gpio.inc
@@ -58,7 +58,7 @@ GPIO_INT(USB_A3_OC_ODL, PIN(0, 3), GPIO_INT_BOTH, port_ocp_interrupt)
GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
diff --git a/board/gimble/board.h b/board/gimble/board.h
index 96c8e6326d..561dfddab1 100644
--- a/board/gimble/board.h
+++ b/board/gimble/board.h
@@ -77,6 +77,12 @@
#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
+
+/* I2C control host command */
+#define CONFIG_HOSTCMD_I2C_CONTROL
+
/*
* Passive USB-C cables only support up to 60W.
*/
@@ -103,6 +109,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
/*
@@ -164,7 +171,7 @@
#define CONFIG_FANS FAN_CH_COUNT
#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_STEINHART_HART_3V3_30K9_47K_4050B
/* LED defines */
@@ -184,6 +191,7 @@
#define CONFIG_CHARGE_RAMP_SW
#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
diff --git a/board/gimble/ec.tasklist b/board/gimble/ec.tasklist
index 23753ee899..9207f8729d 100644
--- a/board/gimble/ec.tasklist
+++ b/board/gimble/ec.tasklist
@@ -19,6 +19,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
diff --git a/board/gimble/gpio.inc b/board/gimble/gpio.inc
index faec39af08..dfd3b472a6 100644
--- a/board/gimble/gpio.inc
+++ b/board/gimble/gpio.inc
@@ -125,6 +125,7 @@ UNUSED(PIN(A, 0)) /* F_CS0_L/GPIOA0 */
UNUSED(PIN(9, 6)) /* F_DIO1/GPIO96 */
UNUSED(PIN(7, 0)) /* GPIO70/PS2_DAT0 */
UNUSED(PIN(8, 1)) /* PECI DATA/GPIO81 */
+UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/gimble/i2c.c b/board/gimble/i2c.c
index ed763fffca..7bedcc05db 100644
--- a/board/gimble/i2c.c
+++ b/board/gimble/i2c.c
@@ -18,14 +18,10 @@ const struct i2c_port_t i2c_ports[] = {
.sda = GPIO_EC_I2C_SENSOR_SDA,
},
{
- /* I2C1
- * TODO(b/194264003) Need to check the signals with a scope
- * before raising to 1MHz.
- */
/* I2C1 */
.name = "tcpc0",
.port = I2C_PORT_USB_C0_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C0_C2_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C0_C2_TCPC_SDA,
},
@@ -38,16 +34,13 @@ const struct i2c_port_t i2c_ports[] = {
.sda = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SDA,
},
{
- /* I2C4
- * TODO(b/194264003) Need to check the signals with a scope
- * before raising to 1MHz.
- */
/* I2C4 C1 TCPC */
.name = "tcpc1",
.port = I2C_PORT_USB_C1_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
},
{
/* I2C5 */
diff --git a/board/gimble/led.c b/board/gimble/led.c
index 924aa53aff..4dc4e81759 100644
--- a/board/gimble/led.c
+++ b/board/gimble/led.c
@@ -33,12 +33,12 @@ __override struct led_descriptor
[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},
+ [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_WHITE, 0.5 * LED_ONE_SEC},
+ {EC_LED_COLOR_AMBER, 0.5 * LED_ONE_SEC},
{LED_OFF, 0.5 * LED_ONE_SEC}
},
[STATE_FACTORY_TEST] = {
diff --git a/board/gimble/sensors.c b/board/gimble/sensors.c
index 07f18950f0..1620f3c348 100644
--- a/board/gimble/sensors.c
+++ b/board/gimble/sensors.c
@@ -206,8 +206,6 @@ struct motion_sensor_t lsm6dsm_base_accel = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref_id_1,
@@ -236,8 +234,6 @@ struct motion_sensor_t lsm6dsm_base_gyro = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/gimble/usbc_config.c b/board/gimble/usbc_config.c
index 312f735003..189f6419cf 100644
--- a/board/gimble/usbc_config.c
+++ b/board/gimble/usbc_config.c
@@ -55,7 +55,8 @@ const struct tcpc_config_t tcpc_config[] = {
},
.drv = &ps8xxx_tcpm_drv,
.flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V,
+ TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
+ TCPC_FLAGS_CONTROL_VCONN,
},
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
diff --git a/board/gingerbread/board.c b/board/gingerbread/board.c
index 6a2ae0c683..b32ed85459 100644
--- a/board/gingerbread/board.c
+++ b/board/gingerbread/board.c
@@ -152,6 +152,20 @@ struct ppc_config_t ppc_chips[] = {
#endif
#ifdef SECTION_IS_RW
+
+/* TUSB1064 set mux board tuning for DP Rx path */
+static int board_tusb1064_dp_rx_eq_set(const struct usb_mux *me,
+ mux_state_t mux_state)
+{
+ int rv = EC_SUCCESS;
+
+ /* DP specific config */
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
+ rv = tusb1064_set_dp_rx_eq(me, TUSB1064_DP_EQ_RX_8_9_DB);
+
+ return rv;
+}
+
/*
* TCPCs: 2 USBC/PD ports
* port 0 -> host port -> STM32G4 UCPD
@@ -178,6 +192,7 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.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,
@@ -311,12 +326,46 @@ int dock_get_mf_preference(void)
return mf;
}
+static void board_usb_tc_connect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /*
+ * The EC needs to keep the USB hubs in reset until the host port is
+ * attached so that the USB-EP can be properly enumerated.
+ */
+ if (port == USB_PD_PORT_HOST) {
+ gpio_set_level(GPIO_EC_HUB1_RESET_L, 1);
+ gpio_set_level(GPIO_EC_HUB2_RESET_L, 1);
+ }
+}
+DECLARE_HOOK(HOOK_USB_PD_CONNECT, board_usb_tc_connect, HOOK_PRIO_DEFAULT);
+
+static void board_usb_tc_disconnect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /* Only the host port disconnect is relevant */
+ if (port == USB_PD_PORT_HOST) {
+ gpio_set_level(GPIO_EC_HUB1_RESET_L, 0);
+ gpio_set_level(GPIO_EC_HUB2_RESET_L, 0);
+ }
+}
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+ HOOK_PRIO_DEFAULT);
+
#endif /* SECTION_IS_RW */
static void board_init(void)
{
#ifdef SECTION_IS_RW
-
+ /*
+ * Set current limit for USB 3.1 Gen 2 ports to 1.5 A. Note, this is
+ * also done in gpio.inc, but needs to be in RW for platforms which
+ * shipped with RO that set these 2 lines to the 900 mA level.
+ */
+ gpio_set_level(GPIO_USB3_P3_CDP_EN, 1);
+ gpio_set_level(GPIO_USB3_P4_CDP_EN, 1);
#endif
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/gingerbread/gpio.inc b/board/gingerbread/gpio.inc
index 5b7b3a9619..6226ff747e 100644
--- a/board/gingerbread/gpio.inc
+++ b/board/gingerbread/gpio.inc
@@ -57,8 +57,8 @@ GPIO(DEBUG_GPIO1, PIN(B, 13), GPIO_OUT_LOW)
* USB CDP enables. */
GPIO(USB3_A1_CDP_EN, PIN(E, 7), GPIO_OUT_LOW)
GPIO(USB3_A2_CDP_EN, PIN(E, 8), GPIO_OUT_LOW)
-GPIO(USB3_P3_CDP_EN, PIN(D, 1), GPIO_OUT_LOW)
-GPIO(USB3_P4_CDP_EN, PIN(E, 12), GPIO_OUT_LOW)
+GPIO(USB3_P3_CDP_EN, PIN(D, 1), GPIO_OUT_HIGH)
+GPIO(USB3_P4_CDP_EN, PIN(E, 12), GPIO_OUT_HIGH)
/* Write protect */
GPIO(EC_FLASH_WP_ODL, PIN(A, 3), GPIO_ODR_HIGH)
diff --git a/board/gooey/board.c b/board/gooey/board.c
index 518e159f9d..0f610400b6 100644
--- a/board/gooey/board.c
+++ b/board/gooey/board.c
@@ -412,8 +412,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -441,8 +439,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/goroh/gpio.inc b/board/goroh/gpio.inc
index fe454d035e..9d10ea37bd 100644
--- a/board/goroh/gpio.inc
+++ b/board/goroh/gpio.inc
@@ -81,8 +81,8 @@ GPIO(EN_PP1800_VDDIO_PMC_X, PIN(B, 7), GPIO_OUT_LOW)
GPIO(EC_INT_L, PIN(E, 6), GPIO_ODR_HIGH | GPIO_SEL_1P8V) /* EC_AP_INT_ODL */
/* USB and USBC Signals */
-GPIO(USB_C0_HPD_3V3, PIN(J, 0), GPIO_OUT_LOW)
-GPIO(USB_C1_HPD_3V3, PIN(J, 1), GPIO_OUT_LOW)
+GPIO(USB_C1_HPD_3V3, PIN(J, 0), GPIO_OUT_LOW)
+GPIO(USB_C0_HPD_3V3, PIN(J, 1), GPIO_OUT_LOW)
GPIO(USB_C1_HPD_IN, PIN(J, 2), GPIO_OUT_LOW)
GPIO(EN_USB_C1_MUX_PWR, PIN(F, 0), GPIO_OUT_LOW)
GPIO(USB_C0_SBU1_DC, PIN(H, 4), GPIO_OUT_LOW)
diff --git a/board/grunt/board.c b/board/grunt/board.c
index 45aa4f4421..0efa8b9696 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -29,12 +29,48 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL_AP, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"kblight", I2C_PORT_KBLIGHT, 100, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, 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/gumboz/board.c b/board/gumboz/board.c
index 4428819415..fb4fdcee95 100644
--- a/board/gumboz/board.c
+++ b/board/gumboz/board.c
@@ -103,8 +103,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
@@ -135,8 +133,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/guybrush/board.c b/board/guybrush/board.c
index 75fb5a8607..922be3ca21 100644
--- a/board/guybrush/board.c
+++ b/board/guybrush/board.c
@@ -288,10 +288,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
return rv;
/* Enable HPD on the DB */
- gpio_set_level(GPIO_USB_C1_HPD, 1);
+ ioex_set_level(IOEX_USB_C1_IN_HPD, 1);
} else {
/* Disable HPD on the DB */
- gpio_set_level(GPIO_USB_C1_HPD, 0);
+ ioex_set_level(IOEX_USB_C1_IN_HPD, 0);
}
return rv;
diff --git a/board/guybrush/board.h b/board/guybrush/board.h
index f3900adc43..dc6a7e882a 100644
--- a/board/guybrush/board.h
+++ b/board/guybrush/board.h
@@ -55,6 +55,9 @@
#define CONFIG_LED_COMMON
#define CONFIG_LED_ONOFF_STATES
+/* Thermal Config */
+#define CONFIG_TEMP_SENSOR_TMP112
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/guybrush/build.mk b/board/guybrush/build.mk
index 5c8bde1a2b..a7865db889 100644
--- a/board/guybrush/build.mk
+++ b/board/guybrush/build.mk
@@ -9,4 +9,4 @@
BASEBOARD:=guybrush
board-y=board.o
-board-y+=board_fw_config.o led.o battery.o
+board-y+=board_fw_config.o led.o battery.o thermal.o
diff --git a/board/guybrush/thermal.c b/board/guybrush/thermal.c
new file mode 100644
index 0000000000..606d21cfdf
--- /dev/null
+++ b/board/guybrush/thermal.c
@@ -0,0 +1,34 @@
+/* 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.
+ */
+
+/* Guybrush board-specific configuration */
+
+#include "console.h"
+#include "fan.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)
+
+const struct fan_conf fan_conf_0 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .pgood_gpio = GPIO_S0_PGOOD,
+ .enable_gpio = -1,
+};
+const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 1000,
+ .rpm_start = 1000,
+ .rpm_max = 6500,
+};
+const struct fan_t fans[] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
diff --git a/board/haboki/board.c b/board/haboki/board.c
index f748cf90a6..84e22390e0 100644
--- a/board/haboki/board.c
+++ b/board/haboki/board.c
@@ -327,8 +327,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -356,8 +354,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/hammer/board.c b/board/hammer/board.c
index b68498acfb..ad525f9e67 100644
--- a/board/hammer/board.c
+++ b/board/hammer/board.c
@@ -60,6 +60,7 @@ const void *const usb_strings[] = {
[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
@@ -90,11 +91,21 @@ void usb_spi_board_disable(struct usb_spi_config const *config) {}
#ifdef CONFIG_I2C
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 400,
- GPIO_MASTER_I2C_SCL, 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
- {"charger", I2C_PORT_CHARGER, 100,
- GPIO_CHARGER_I2C_SCL, 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);
@@ -362,6 +373,23 @@ static const struct ec_response_keybd_config bland_kb = {
.capabilities = KEYBD_CAP_SCRNLOCK_KEY,
};
+static const struct ec_response_keybd_config duck_kb = {
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK,
+ TK_FORWARD,
+ TK_REFRESH,
+ TK_FULLSCREEN,
+ TK_OVERVIEW,
+ TK_BRIGHTNESS_DOWN,
+ TK_BRIGHTNESS_UP,
+ TK_VOL_MUTE,
+ TK_VOL_DOWN,
+ TK_VOL_UP,
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
__override
const struct ec_response_keybd_config *board_vivaldi_keybd_config(void)
{
@@ -369,6 +397,8 @@ const struct ec_response_keybd_config *board_vivaldi_keybd_config(void)
return &zed_kb;
if (IS_ENABLED(BOARD_BLAND) || IS_ENABLED(BOARD_EEL))
return &bland_kb;
+ if (IS_ENABLED(BOARD_DUCK))
+ return &duck_kb;
return NULL;
}
diff --git a/board/hammer/board.h b/board/hammer/board.h
index 3282425d9e..dd5d8d1507 100644
--- a/board/hammer/board.h
+++ b/board/hammer/board.h
@@ -338,6 +338,7 @@ enum usb_strings {
USB_STR_PRODUCT,
USB_STR_SERIALNO,
USB_STR_VERSION,
+ USB_STR_SPI_NAME,
USB_STR_I2C_NAME,
USB_STR_UPDATE_NAME,
#ifdef CONFIG_USB_ISOCHRONOUS
diff --git a/board/hammer/variants.h b/board/hammer/variants.h
index 2a8c831ef5..5d928295ac 100644
--- a/board/hammer/variants.h
+++ b/board/hammer/variants.h
@@ -19,6 +19,8 @@
#define CONFIG_USB_PID 0x5056
#elif defined(BOARD_DON)
#define CONFIG_USB_PID 0x5050
+#elif defined(BOARD_DUCK)
+#define CONFIG_USB_PID 0x505b
#elif defined(BOARD_EEL)
#define CONFIG_USB_PID 0x5057
#elif defined(BOARD_MAGNEMITE)
@@ -56,12 +58,11 @@
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
#define HAS_I2C_TOUCHPAD
-/* TODO: update correct parameters */
-#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 3282
-#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1793
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2644
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1440
#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_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)
#elif defined(BOARD_DON)
#define HAS_I2C_TOUCHPAD
@@ -71,17 +72,27 @@
#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)
-#elif defined(BOARD_EEL)
+#elif defined(BOARD_DUCK)
#define CONFIG_USB_HID_KEYBOARD_VIVALDI
#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
+/* b/208588161: update correct parameters */
#define HAS_I2C_TOUCHPAD
-/* TODO: update correct parameters */
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 3282
#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1793
#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)
+#elif defined(BOARD_EEL)
+#define CONFIG_USB_HID_KEYBOARD_VIVALDI
+#define CONFIG_USB_HID_KB_NUM_TOP_ROW_KEYS 10
+#define HAS_I2C_TOUCHPAD
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_X 2644
+#define CONFIG_USB_HID_TOUCHPAD_LOGICAL_MAX_Y 1440
+#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)
#elif defined(BOARD_MAGNEMITE)
#define HAS_NO_TOUCHPAD
#elif defined(BOARD_MASTERBALL)
diff --git a/board/hatch/board.h b/board/hatch/board.h
index 487c8c25eb..dd573212cd 100644
--- a/board/hatch/board.h
+++ b/board/hatch/board.h
@@ -16,7 +16,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -89,7 +89,7 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -116,6 +116,7 @@
#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__
diff --git a/board/hatch_fp/board_rw.c b/board/hatch_fp/board_rw.c
index 4c83c8723c..00a6b89b19 100644
--- a/board/hatch_fp/board_rw.c
+++ b/board/hatch_fp/board_rw.c
@@ -35,7 +35,9 @@ static void configure_fp_sensor_spi(void)
/* Configure SPI GPIOs */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
- /* Set all SPI master signal pins to very high speed: B12/13/14/15 */
+ /* Set all SPI controller signal pins to very high speed:
+ * B12/13/14/15
+ */
STM32_GPIO_OSPEEDR(GPIO_B) |= 0xff000000;
/* Enable clocks to SPI2 module (master) */
diff --git a/board/helios/board.h b/board/helios/board.h
index dcda6e01fe..fa65957ecc 100644
--- a/board/helios/board.h
+++ b/board/helios/board.h
@@ -16,7 +16,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -73,7 +73,7 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -95,6 +95,7 @@
#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__
diff --git a/board/herobrine_npcx9/board.c b/board/herobrine_npcx9/board.c
index f63f5c7991..fea8bf3a88 100644
--- a/board/herobrine_npcx9/board.c
+++ b/board/herobrine_npcx9/board.c
@@ -64,18 +64,48 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"rtc", I2C_PORT_RTC, 400, GPIO_EC_I2C_RTC_SCL,
- GPIO_EC_I2C_RTC_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/hoho/board.h b/board/hoho/board.h
index 8e6ec34b3d..635abfbeda 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -24,7 +24,7 @@
#define CONFIG_RWSIG
#define CONFIG_RWSIG_TYPE_USBPD1
#define CONFIG_SHA256
-/* TODO(tbroch) Re-enable once STM spi master can be inhibited at boot so it
+/* TODO(tbroch) Re-enable once STM spi controller can be inhibited at boot so it
doesn't interfere with HDMI loading its f/w */
#undef CONFIG_SPI_FLASH
#define CONFIG_SPI_CS_GPIO GPIO_PD_MCDP_SPI_CS_L
diff --git a/board/homestar/board.c b/board/homestar/board.c
index 47ac34af2c..6fb748e168 100644
--- a/board/homestar/board.c
+++ b/board/homestar/board.c
@@ -119,16 +119,41 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/homestar/build.mk b/board/homestar/build.mk
index 74b6b95e4d..452abeb591 100644
--- a/board/homestar/build.mk
+++ b/board/homestar/build.mk
@@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7
CHIP_VARIANT:=npcx7m6fc
BASEBOARD:=trogdor
-board-y=battery.o board.o led.o base_detect.o
+board-y=battery.o board.o led.o base_detect.o usbc_config.o
diff --git a/board/homestar/usbc_config.c b/board/homestar/usbc_config.c
new file mode 100644
index 0000000000..8f3fb02c30
--- /dev/null
+++ b/board/homestar/usbc_config.c
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "usb_pd.h"
+
+#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/host/board.c b/board/host/board.c
index 191fd832e1..b681ca98fb 100644
--- a/board/host/board.c
+++ b/board/host/board.c
@@ -62,15 +62,45 @@ test_mockable void fps_event(enum gpio_signal signal)
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
#ifdef I2C_PORT_BATTERY
- {"battery", I2C_PORT_BATTERY, 100, 0, 0},
+ {
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_LIGHTBAR
- {"lightbar", I2C_PORT_LIGHTBAR, 100, 0, 0},
+ {
+ .name = "lightbar",
+ .port = I2C_PORT_LIGHTBAR,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_HOST_TCPC
- {"tcpc", I2C_PORT_HOST_TCPC, 100, 0, 0},
+ {
+ .name = "tcpc",
+ .port = I2C_PORT_HOST_TCPC,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_EEPROM
- {"eeprom", I2C_PORT_EEPROM, 100, 0, 0},
+ {
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#elif defined I2C_PORT_WLC
- {"wlc", I2C_PORT_WLC, 100, 0, 0},
+ {
+ .name = "wlc",
+ .port = I2C_PORT_WLC,
+ .kbps = 100,
+ .scl = 0,
+ .sda = 0
+ },
#endif
};
diff --git a/board/icarus/board.c b/board/icarus/board.c
index bffad091fa..a95b94c8c9 100644
--- a/board/icarus/board.c
+++ b/board/icarus/board.c
@@ -87,9 +87,27 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", IT83XX_I2C_CH_C, 400, GPIO_I2C_C_SCL, GPIO_I2C_C_SDA},
- {"other", IT83XX_I2C_CH_B, 100, GPIO_I2C_B_SCL, GPIO_I2C_B_SDA},
- {"battery", IT83XX_I2C_CH_A, 100, GPIO_I2C_A_SCL, 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);
@@ -122,8 +140,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/it83xx_evb/gpio.inc b/board/it83xx_evb/gpio.inc
index 52df89e5cb..505f91ad64 100644
--- a/board/it83xx_evb/gpio.inc
+++ b/board/it83xx_evb/gpio.inc
@@ -9,7 +9,7 @@
* Note: Those with interrupt handlers must be declared first. */
GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(PCH_PLTRST_L, PIN(E, 3), GPIO_INT_BOTH | GPIO_PULL_UP, lpcrst_interrupt)
#endif
GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH | GPIO_PULL_DOWN, lid_interrupt)
diff --git a/board/it8xxx2_evb/gpio.inc b/board/it8xxx2_evb/gpio.inc
index 8a7f593ab6..e5e7d5e942 100644
--- a/board/it8xxx2_evb/gpio.inc
+++ b/board/it8xxx2_evb/gpio.inc
@@ -9,7 +9,7 @@
* Note: Those with interrupt handlers must be declared first. */
GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH | GPIO_PULL_UP, power_button_interrupt)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(PCH_PLTRST_L, PIN(E, 3), GPIO_INT_BOTH | GPIO_PULL_UP, lpcrst_interrupt)
#endif
GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH | GPIO_PULL_UP, lid_interrupt)
diff --git a/board/it8xxx2_pdevb/board.h b/board/it8xxx2_pdevb/board.h
index 8646c6c7b3..d23898f3aa 100644
--- a/board/it8xxx2_pdevb/board.h
+++ b/board/it8xxx2_pdevb/board.h
@@ -31,7 +31,7 @@
#undef CONFIG_SPI_CONTROLLER
#undef CONFIG_SPI_FLASH_PORT
#undef CONFIG_UART_HOST
-#undef CONFIG_HOSTCMD_LPC
+#undef CONFIG_HOST_INTERFACE_LPC
#undef CONFIG_CMD_MMAPINFO
#undef CONFIG_SWITCH
diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c
index ec6515544d..4563bc2f2c 100644
--- a/board/jacuzzi/board.c
+++ b/board/jacuzzi/board.c
@@ -67,17 +67,42 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
+ {
+ .name = "typec",
+ .port = 0,
+ .kbps = 400,
+ .scl = GPIO_I2C1_SCL,
+ .sda = GPIO_I2C1_SDA
+ },
#ifdef BOARD_JACUZZI
- {"other", 1, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
+ {
+ .name = "other",
+ .port = 1,
+ .kbps = 100,
+ .scl = GPIO_I2C2_SCL,
+ .sda = GPIO_I2C2_SDA
+ },
#else /* Juniper */
- {"other", 1, 400, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -143,8 +168,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
@@ -291,6 +320,9 @@ 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);
+ /* Pull SPI_NSS pin to low to prevent a leakage. */
+ 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. */
diff --git a/board/jacuzzi/board.h b/board/jacuzzi/board.h
index ef8a02a3dc..6270b308f6 100644
--- a/board/jacuzzi/board.h
+++ b/board/jacuzzi/board.h
@@ -102,7 +102,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/jinlon/board.h b/board/jinlon/board.h
index 944413591b..c071bfc144 100644
--- a/board/jinlon/board.h
+++ b/board/jinlon/board.h
@@ -19,7 +19,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -100,7 +100,7 @@
#define CONFIG_FAN_INIT_SPEED 50
#define RPM_DEVIATION 1
#define CONFIG_TEMP_SENSOR_OTI502
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -127,6 +127,7 @@
#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__
diff --git a/board/jslrvp_ite/gpio.inc b/board/jslrvp_ite/gpio.inc
index 5c0219263e..387020100e 100644
--- a/board/jslrvp_ite/gpio.inc
+++ b/board/jslrvp_ite/gpio.inc
@@ -37,7 +37,7 @@ GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_FALLING, uart_deepsleep_interrupt) /* UAR
GPIO_INT(WP_L, PIN(I, 4), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */
-#ifdef CONFIG_HOSTCMD_ESPI
+#ifdef CONFIG_HOST_INTERFACE_ESPI
/* enable 1.8v input of EC's espi_reset pin, and then this pin takes effect. */
GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset_pin_asserted_interrupt) /* eSPI_reset# */
#endif
@@ -72,7 +72,7 @@ UNIMPLEMENTED(EN_VCCIO_EXT)
/* Host communication GPIOs */
GPIO(PCH_WAKE_L, PIN(J, 0), GPIO_ODR_HIGH)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT | GPIO_PULL_UP)
#endif
@@ -139,7 +139,7 @@ GPIO(NC_PMIC_EN, PIN(H, 3), GPIO_INPUT)
/* Used if Base EC is present */
GPIO(NC_EC_BASE_DET, PIN(I, 3), GPIO_INPUT)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INPUT)
#endif
diff --git a/board/kakadu/board.c b/board/kakadu/board.c
index 8d91d06832..89905aa4a3 100644
--- a/board/kakadu/board.c
+++ b/board/kakadu/board.c
@@ -71,8 +71,20 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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);
@@ -108,8 +120,12 @@ struct mt6370_thermal_bound thermal_bound = {
};
static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
@@ -519,3 +535,18 @@ void board_fill_source_power_info(int port,
r->meas.current_lim = 1500;
r->max_power = r->meas.voltage_now * r->meas.current_max;
}
+
+/* b/207456334: bugged reserved bits causes device not charging */
+static void mt6370_reg_fix(void)
+{
+ i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
+ 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);
+}
+DECLARE_HOOK(HOOK_INIT, mt6370_reg_fix, HOOK_PRIO_DEFAULT);
diff --git a/board/kano/board.h b/board/kano/board.h
index 6b65edf174..4ed3d3f885 100644
--- a/board/kano/board.h
+++ b/board/kano/board.h
@@ -3,18 +3,13 @@
* found in the LICENSE file.
*/
-/* Brya board configuration */
+/* Kano board configuration */
#ifndef __CROS_EC_BOARD_H
#define __CROS_EC_BOARD_H
#include "compile_time_macros.h"
-/*
- * Early brya boards are not set up for vivaldi
- */
-#undef CONFIG_KEYBOARD_VIVALDI
-
/* Baseboard features */
#include "baseboard.h"
@@ -112,6 +107,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
/*
@@ -177,13 +173,10 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
-/*
- * TODO(b/181271666): no fan control loop until sensors are tuned
- */
-/* #define CONFIG_FANS FAN_CH_COUNT */
+#define CONFIG_FANS FAN_CH_COUNT
/* Charger defines */
#define CONFIG_CHARGER_ISL9241
diff --git a/board/kano/build.mk b/board/kano/build.mk
index 6d1303a15a..df453187bf 100644
--- a/board/kano/build.mk
+++ b/board/kano/build.mk
@@ -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/kano/ec.tasklist b/board/kano/ec.tasklist
index 7634667963..f52567d9fa 100644
--- a/board/kano/ec.tasklist
+++ b/board/kano/ec.tasklist
@@ -19,6 +19,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
diff --git a/board/kano/fans.c b/board/kano/fans.c
index d966056331..a71758ea96 100644
--- a/board/kano/fans.c
+++ b/board/kano/fans.c
@@ -48,41 +48,3 @@ const struct fan_t fans[FAN_CH_COUNT] = {
.rpm = &fan_rpm_0,
},
};
-
-#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)
-{
- const int duty_pct = 33;
-
- ccprints("%s: speed %d%%", __func__, duty_pct);
-
- pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, duty_pct);
-}
-
-static void fan_max(void)
-{
- const int duty_pct = 100;
-
- ccprints("%s: speed %d%%", __func__, duty_pct);
-
- pwm_enable(PWM_CH_FAN, 1);
- pwm_set_duty(PWM_CH_FAN, 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/kano/fw_config.c b/board/kano/fw_config.c
index fb8acb635d..a13dadeb5d 100644
--- a/board/kano/fw_config.c
+++ b/board/kano/fw_config.c
@@ -11,20 +11,19 @@
#define CPRINTS(format, args...) cprints(CC_CHIPSET, format, ## args)
-static union brya_cbi_fw_config fw_config;
+static union kano_cbi_fw_config fw_config;
BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
/*
- * FW_CONFIG defaults for brya if the CBI.FW_CONFIG data is not
+ * FW_CONFIG defaults for kano if the CBI.FW_CONFIG data is not
* initialized.
*/
-static const union brya_cbi_fw_config fw_config_defaults = {
- .usb_db = DB_USB3_PS8815,
+static const union kano_cbi_fw_config fw_config_defaults = {
.kb_bl = KEYBOARD_BACKLIGHT_ENABLED,
};
/****************************************************************************
- * Brya FW_CONFIG access
+ * Kano FW_CONFIG access
*/
void board_init_fw_config(void)
{
@@ -36,25 +35,21 @@ void board_init_fw_config(void)
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.
+ * it with a sensible default value.
*/
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)
+union kano_cbi_fw_config get_fw_config(void)
{
return fw_config;
}
-enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void)
+bool ec_cfg_has_kblight(void)
{
- return fw_config.usb_db;
+ return (fw_config.kb_bl == KEYBOARD_BACKLIGHT_ENABLED);
}
diff --git a/board/kano/fw_config.h b/board/kano/fw_config.h
index 6e4eb3ef58..8402b5568d 100644
--- a/board/kano/fw_config.h
+++ b/board/kano/fw_config.h
@@ -3,36 +3,28 @@
* found in the LICENSE file.
*/
-#ifndef __BOARD_BRYA_FW_CONFIG_H_
-#define __BOARD_BRYA_FW_CONFIG_H_
+#ifndef __BOARD_KANO_FW_CONFIG_H_
+#define __BOARD_KANO_FW_CONFIG_H_
#include <stdint.h>
/****************************************************************************
- * CBI FW_CONFIG layout for Brya board.
+ * CBI FW_CONFIG layout for Kano board.
*
- * Source of truth is the project/brya/brya/config.star configuration file.
+ * Source of truth is the project/brya/kano/config.star configuration file.
*/
-enum ec_cfg_usb_db_type {
- DB_USB_ABSENT = 0,
- DB_USB3_PS8815 = 1,
- DB_USB_ABSENT2 = 15
-};
-
enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_DISABLED = 0,
KEYBOARD_BACKLIGHT_ENABLED = 1
};
-union brya_cbi_fw_config {
+union kano_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;
+ uint32_t ufc : 2;
+ uint32_t reserved_1 : 26;
};
uint32_t raw_value;
};
@@ -42,13 +34,14 @@ union brya_cbi_fw_config {
*
* @return the FW_CONFIG for the board.
*/
-union brya_cbi_fw_config get_fw_config(void);
+union kano_cbi_fw_config get_fw_config(void);
/**
- * Get the USB daughter board type from FW_CONFIG.
+ * Check if the FW_CONFIG has enabled keyboard backlight.
*
- * @return the USB daughter board type.
+ * @return true if board supports keyboard backlight, false if the board
+ * doesn't support it.
*/
-enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void);
+bool ec_cfg_has_kblight(void);
-#endif /* __BOARD_BRYA_FW_CONFIG_H_ */
+#endif /* __BOARD_KANO_FW_CONFIG_H_ */
diff --git a/board/kano/gpio.inc b/board/kano/gpio.inc
index e5b452ced3..cfcc6bbd3f 100644
--- a/board/kano/gpio.inc
+++ b/board/kano/gpio.inc
@@ -117,6 +117,7 @@ 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 */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/kano/sensors.c b/board/kano/sensors.c
index 9a5812a9be..a47c9a782b 100644
--- a/board/kano/sensors.c
+++ b/board/kano/sensors.c
@@ -80,8 +80,8 @@ static const mat33_fp_t lid_bma422_standard_ref = {
{ 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, FLOAT_TO_FP(1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
@@ -172,7 +172,6 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_kx022_data,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = KX022_ADDR1_FLAGS,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.rot_standard_ref = &lid_standard_ref, /* identity matrix */
.default_range = 2, /* g */
.min_frequency = KX022_ACCEL_MIN_FREQ,
@@ -198,8 +197,6 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &icm426xx_drv,
.mutex = &g_base_accel_mutex,
.drv_data = &g_icm426xx_data,
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -227,8 +224,6 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &icm426xx_drv,
.mutex = &g_base_accel_mutex,
.drv_data = &g_icm426xx_data,
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/kano/usbc_config.h b/board/kano/usbc_config.h
index 87e601ee3e..38fce7d2cf 100644
--- a/board/kano/usbc_config.h
+++ b/board/kano/usbc_config.h
@@ -3,7 +3,7 @@
* found in the LICENSE file.
*/
-/* Brya board-specific USB-C configuration */
+/* Kano board-specific USB-C configuration */
#ifndef __CROS_EC_USBC_CONFIG_H
#define __CROS_EC_USBC_CONFIG_H
diff --git a/board/kappa/board.c b/board/kappa/board.c
index 963ade7430..e70054b18f 100644
--- a/board/kappa/board.c
+++ b/board/kappa/board.c
@@ -65,13 +65,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 100, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -137,8 +156,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/karma/board.c b/board/karma/board.c
index 7bac35bd64..4e9f9166ff 100644
--- a/board/karma/board.c
+++ b/board/karma/board.c
@@ -5,12 +5,13 @@
#include "console.h"
#include "gpio.h"
+#include "hooks.h"
#include "oz554.h"
#define CPRINTS(format, args...) cprints(CC_I2C, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_I2C, format, ## args)
-__override void oz554_board_init(void)
+void oz554_board_init(void)
{
int pin_status = 0;
@@ -40,3 +41,10 @@ __override void oz554_board_init(void)
break;
}
}
+
+static void init_oz554(void)
+{
+ oz554_board_init();
+ gpio_enable_interrupt(GPIO_PANEL_BACKLIGHT_EN);
+}
+DECLARE_HOOK(HOOK_INIT, init_oz554, HOOK_PRIO_DEFAULT);
diff --git a/board/karma/gpio.inc b/board/karma/gpio.inc
index 1b265ed6ca..bdf0ab93be 100644
--- a/board/karma/gpio.inc
+++ b/board/karma/gpio.inc
@@ -11,7 +11,7 @@
GPIO_INT(USB_C0_PD_INT_ODL, PIN(3, 7), GPIO_INT_FALLING | GPIO_PULL_UP, tcpc_alert_event)
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(PANEL_BACKLIGHT_EN, PIN(4, 4), GPIO_INT_RISING, backlight_enable_interrupt)
+GPIO_INT(PANEL_BACKLIGHT_EN, PIN(4, 4), GPIO_INT_RISING, oz554_interrupt)
GPIO_INT(PCH_SLP_S0_L, PIN(7, 5), GPIO_INT_BOTH, power_signal_interrupt)
GPIO_INT(PCH_SLP_SUS_L, PIN(6, 2), GPIO_INT_BOTH, power_signal_interrupt)
diff --git a/board/katsu/board.c b/board/katsu/board.c
index 6484778b13..5e1147c919 100644
--- a/board/katsu/board.c
+++ b/board/katsu/board.c
@@ -70,8 +70,20 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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);
@@ -107,8 +119,12 @@ struct mt6370_thermal_bound thermal_bound = {
};
static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
@@ -421,3 +437,18 @@ void board_fill_source_power_info(int port,
r->meas.current_lim = 1500;
r->max_power = r->meas.voltage_now * r->meas.current_max;
}
+
+/* b/207456334: bugged reserved bits causes device not charging */
+static void mt6370_reg_fix(void)
+{
+ i2c_update8(chg_chips[CHARGER_SOLO].i2c_port,
+ 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);
+}
+DECLARE_HOOK(HOOK_INIT, mt6370_reg_fix, HOOK_PRIO_DEFAULT);
diff --git a/board/kindred/board.h b/board/kindred/board.h
index dd63efb390..efb325b3ab 100644
--- a/board/kindred/board.h
+++ b/board/kindred/board.h
@@ -18,7 +18,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -93,7 +93,7 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -120,6 +120,7 @@
#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__
diff --git a/board/kingler/battery.c b/board/kingler/battery.c
deleted file mode 100644
index f07c38e1b8..0000000000
--- a/board/kingler/battery.c
+++ /dev/null
@@ -1,47 +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.
- */
-
-#include "battery.h"
-#include "battery_fuel_gauge.h"
-#include "battery_smart.h"
-#include "charge_manager.h"
-#include "chipset.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "system.h"
-#include "usb_pd.h"
-
-const struct board_batt_params board_battery_info[] = {
- [BATTERY_C235] = {
- .fuel_gauge = {
- .manuf_name = "AS3GWRc3KA",
- .device_name = "C235-41",
- .ship_mode = {
- .reg_addr = 0x0,
- .reg_data = { 0x10, 0x10 },
- },
- .fet = {
- .reg_addr = 0x99,
- .reg_mask = 0x0c,
- .disconnect_val = 0x0c,
- }
- },
- .batt_info = {
- .voltage_max = 8800,
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256,
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 60,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
- },
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_C235;
diff --git a/board/kingler/board.c b/board/kingler/board.c
deleted file mode 100644
index e01d64c386..0000000000
--- a/board/kingler/board.c
+++ /dev/null
@@ -1,188 +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.
- */
-/* Corsola board configuration */
-
-#include "adc.h"
-#include "button.h"
-#include "charge_manager.h"
-#include "charge_state_v2.h"
-#include "charger.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "driver/accel_lis2dw12.h"
-#include "driver/accelgyro_icm_common.h"
-#include "driver/accelgyro_icm426xx.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "keyboard_scan.h"
-#include "lid_switch.h"
-#include "motion_sense.h"
-#include "power.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-#include "regulator.h"
-#include "spi.h"
-#include "switch.h"
-#include "tablet_mode.h"
-#include "task.h"
-#include "timer.h"
-#include "uart.h"
-
-/* Initialize board. */
-static void board_init(void)
-{
- /* Enable motion sensor interrupt */
- gpio_enable_interrupt(GPIO_BASE_IMU_INT_L);
- gpio_enable_interrupt(GPIO_LID_ACCEL_INT_L);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-/* Sensor */
-static struct mutex g_base_mutex;
-static struct mutex g_lid_mutex;
-
-static struct stprivate_data g_lis2dwl_data;
-static struct icm_drv_data_t g_icm426xx_data;
-
-struct motion_sensor_t motion_sensors[] = {
- /*
- * Note: icm426xx: 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_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 = NULL,
- .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,
- },
- },
- },
- [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,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = NULL,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
- },
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LIS2DWL,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &lis2dw12_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_lis2dwl_data,
- .int_signal = GPIO_LID_ACCEL_INT_L,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .rot_standard_ref = NULL, /* identity matrix */
- .default_range = 2, /* g */
- .min_frequency = LIS2DW12_ODR_MIN_VAL,
- .max_frequency = LIS2DW12_ODR_MAX_VAL,
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 12500 | ROUND_UP_FLAG,
- },
- /* Sensor on for lid angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
-};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-void motion_interrupt(enum gpio_signal signal)
-{
- icm426xx_interrupt(signal);
-}
-
-/* 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},
- /* 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},
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-/* PWM */
-
-/*
- * PWM channels. Must be in the exactly same order as in enum pwm_channel.
- * There total three 16 bits clock prescaler registers for all pwm channels,
- * 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[] = {
- [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);
-
-static void board_suspend(void)
-{
- gpio_set_level(GPIO_EN_5V_USM, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_suspend, HOOK_PRIO_DEFAULT);
-
-static void board_resume(void)
-{
- gpio_set_level(GPIO_EN_5V_USM, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_resume, HOOK_PRIO_DEFAULT);
diff --git a/board/kingler/board.h b/board/kingler/board.h
deleted file mode 100644
index 857e654787..0000000000
--- a/board/kingler/board.h
+++ /dev/null
@@ -1,118 +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.
- */
-/* Krabby board configuration */
-
-#ifndef __CROS_EC_BOARD_H
-#define __CROS_EC_BOARD_H
-
-#include "baseboard.h"
-
-/* Chipset config */
-
-/* Optional features */
-#define CONFIG_LTO
-
-/*
- * TODO: Remove this option once the VBAT no longer keeps high when
- * system's power isn't presented.
- */
-#define CONFIG_IT83XX_RESET_PD_CONTRACT_IN_BRAM
-
-/* BC12 */
-/* TODO(b/159583342): remove after rev0 deprecated */
-#define CONFIG_MT6360_BC12_GPIO
-
-/* LED */
-#define CONFIG_LED_ONOFF_STATES
-#define CONFIG_LED_ONOFF_STATES_BAT_LOW 10
-
-/* PD / USB-C / PPC */
-#define CONFIG_USB_PD_DEBUG_LEVEL 3
-#define PD_MAX_CURRENT_MA 3000
-#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_VOLTAGE_MV 15000
-#define PD_MAX_POWER_MW 45000
-#define PD_POWER_SUPPLY_TURN_ON_DELAY 30000 /* us */
-#define PD_POWER_SUPPLY_TURN_OFF_DELAY 250000 /* us */
-
-/* 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
-
-/* Sensor */
-#define CONFIG_GMR_TABLET_MODE
-#define CONFIG_TABLET_MODE
-#define CONFIG_TABLET_MODE_SWITCH
-#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
-
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-#define CONFIG_ACCELGYRO_ICM426XX /* Base accel */
-#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
-
-#define CONFIG_ACCEL_LIS2DWL
-#define CONFIG_ACCEL_LIS2DW_AS_BASE
-#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
-
-#define CONFIG_LID_ANGLE
-#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
-#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-#define CONFIG_LID_ANGLE_UPDATE
-
-#define CONFIG_ACCEL_FORCE_MODE_MASK 0
-
-/* SPI / Host Command */
-#undef CONFIG_HOSTCMD_DEBUG_MODE
-#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
-
-/* USB-A */
-#define USBA_PORT_COUNT 1
-
-#ifndef __ASSEMBLER__
-
-#include "gpio_signal.h"
-#include "registers.h"
-
-enum battery_type {
- BATTERY_C235,
- BATTERY_TYPE_COUNT,
-};
-
-enum sensor_id {
- BASE_ACCEL = 0,
- BASE_GYRO,
- LID_ACCEL,
- 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 */
-
- /* Number of ADC channels */
- ADC_CH_COUNT,
-};
-
-enum pwm_channel {
- PWM_CH_LED1,
- PWM_CH_LED2,
- PWM_CH_LED3,
- PWM_CH_COUNT,
-};
-
-void motion_interrupt(enum gpio_signal signal);
-
-#endif /* !__ASSEMBLER__ */
-#endif /* __CROS_EC_BOARD_H */
diff --git a/board/kingler/ec.tasklist b/board/kingler/ec.tasklist
deleted file mode 100644
index 75dbb1a828..0000000000
--- a/board/kingler/ec.tasklist
+++ /dev/null
@@ -1,22 +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.
- */
-
-/**
- * See CONFIG_TASK_LIST in config.h for details.
- */
-#define CONFIG_TASK_LIST \
- TASK_ALWAYS(HOOKS, hook_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P0, usb_charger_task, 0, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(USB_CHG_P1, usb_charger_task, 1, VENTI_TASK_STACK_SIZE) \
- TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
- TASK_NOTEST(PDCMD, pd_command_task, NULL, 1024) \
- TASK_ALWAYS(HOSTCMD, host_command_task, NULL, 1024) \
- TASK_ALWAYS(CONSOLE, console_task, NULL, LARGER_TASK_STACK_SIZE) \
- TASK_NOTEST(KEYSCAN, keyboard_scan_task, NULL, TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_C0, pd_task, NULL, 1280) \
- TASK_ALWAYS(PD_C1, pd_task, NULL, 1280) \
-
diff --git a/board/kingler/led.c b/board/kingler/led.c
deleted file mode 100644
index 1d3108c47b..0000000000
--- a/board/kingler/led.c
+++ /dev/null
@@ -1,120 +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.
- */
-
-#include "ec_commands.h"
-#include "gpio.h"
-#include "led_common.h"
-#include "led_onoff_states.h"
-#include "chipset.h"
-#include "driver/bc12/mt6360.h"
-
-__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} },
-};
-
-__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,
-};
-
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-__override void led_set_color_battery(enum ec_led_colors color)
-{
- mt6360_led_set_brightness(MT6360_LED_RGB2, 50);
- mt6360_led_set_brightness(MT6360_LED_RGB3, 50);
-
- switch (color) {
- case EC_LED_COLOR_AMBER:
- mt6360_led_enable(MT6360_LED_RGB2, 0);
- mt6360_led_enable(MT6360_LED_RGB3, 1);
- break;
- case EC_LED_COLOR_WHITE:
- mt6360_led_enable(MT6360_LED_RGB2, 1);
- mt6360_led_enable(MT6360_LED_RGB3, 0);
- break;
- default: /* LED_OFF and other unsupported colors */
- mt6360_led_enable(MT6360_LED_RGB2, 0);
- mt6360_led_enable(MT6360_LED_RGB3, 0);
- break;
- }
-}
-
-__override void led_set_color_power(enum ec_led_colors color)
-{
- mt6360_led_set_brightness(MT6360_LED_RGB1, 1);
- mt6360_led_enable(MT6360_LED_RGB1, color == EC_LED_COLOR_WHITE);
-}
-
-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_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
- } else if (led_id == EC_LED_ID_POWER_LED) {
- brightness_range[EC_LED_COLOR_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
- }
-}
-
-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)
- led_set_color_battery(EC_LED_COLOR_AMBER);
- 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) {
- if (brightness[EC_LED_COLOR_WHITE] != 0)
- led_set_color_power(EC_LED_COLOR_WHITE);
- else
- led_set_color_power(LED_OFF);
- }
-
- return EC_SUCCESS;
-}
-
-__override enum led_states board_led_get_state(enum led_states desired_state)
-{
- if (desired_state == STATE_BATTERY_ERROR) {
- if (chipset_in_state(CHIPSET_STATE_ON))
- return desired_state;
- else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- return STATE_DISCHARGE_S3;
- else
- return STATE_DISCHARGE_S5;
- }
- return desired_state;
-}
diff --git a/board/kingler/usbc_config.c b/board/kingler/usbc_config.c
deleted file mode 100644
index 485a02c10f..0000000000
--- a/board/kingler/usbc_config.c
+++ /dev/null
@@ -1,28 +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.
- */
-
-/* Krabby board-specific USB-C configuration */
-
-#include "driver/tcpm/it83xx_pd.h"
-#include "driver/usb_mux/ps8743.h"
-#include "hooks.h"
-
-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_USB_EQ_RX_12_8_DB);
- ps8743_write(&usb_muxes[1],
- PS8743_REG_HS_DET_THRESHOLD,
- PS8743_USB_HS_THRESH_NEG_10);
- }
-}
-DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
-
-const struct cc_para_t *board_get_cc_tuning_parameter(enum usbpd_port port)
-{
- return NULL;
-}
diff --git a/board/kingoftown/board.c b/board/kingoftown/board.c
index cc0005d775..cea9b9efe9 100644
--- a/board/kingoftown/board.c
+++ b/board/kingoftown/board.c
@@ -53,16 +53,41 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/kingoftown/board.h b/board/kingoftown/board.h
index 1ba0ed0c34..ee773f8c7c 100644
--- a/board/kingoftown/board.h
+++ b/board/kingoftown/board.h
@@ -10,14 +10,6 @@
#include "baseboard.h"
-/* TODO(waihong): Remove the following bringup features */
-#define CONFIG_BRINGUP
-#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands. */
-#define CONFIG_USB_PD_DEBUG_LEVEL 3
-#define CONFIG_CMD_GPIO_EXTENDED
-#define CONFIG_CMD_POWERINDEBUG
-#define CONFIG_I2C_DEBUG
-
/* Internal SPI flash on NPCX7 */
#define CONFIG_FLASH_SIZE_BYTES (512 * 1024) /* 512KB internal spi flash */
diff --git a/board/kingoftown/led.c b/board/kingoftown/led.c
index 09c1f89598..a543bb5403 100644
--- a/board/kingoftown/led.c
+++ b/board/kingoftown/led.c
@@ -127,25 +127,31 @@ static void board_led_set_battery(void)
set_active_port_color(LED_AMBER);
break;
case PWR_STATE_DISCHARGE:
- if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
- if (charge_get_percent() <= 10) {
- led_blink_cycle =
- battery_ticks % (2 * TIMES_TICK_ONE_SEC);
+ if (charge_get_percent() <= 10) {
+ 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_WHITE : LED_OFF);
- }
- else
+ 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);
+ } else {
+ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
side_led_set_color(1, LED_OFF);
+ if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
+ side_led_set_color(0, LED_OFF);
}
-
- if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
- side_led_set_color(0, LED_OFF);
break;
case PWR_STATE_ERROR:
led_blink_cycle = battery_ticks % TIMES_TICK_ONE_SEC;
- set_active_port_color((led_blink_cycle < TIMES_TICK_HALF_SEC) ?
- LED_WHITE : LED_OFF);
+ 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);
+ 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);
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
diff --git a/board/kingoftown/usbc_config.c b/board/kingoftown/usbc_config.c
index 81a63be9b3..3d13f6158e 100644
--- a/board/kingoftown/usbc_config.c
+++ b/board/kingoftown/usbc_config.c
@@ -6,6 +6,8 @@
/* Kingoftown board-specific USB-C configuration */
#include "bc12/pi3usb9201_public.h"
+#include "charger.h"
+#include "charger/isl923x_public.h"
#include "charge_manager.h"
#include "charge_state.h"
#include "common.h"
@@ -26,6 +28,52 @@
#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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;
+}
+
/* GPIO Interrupt Handlers */
void tcpc_alert_event(enum gpio_signal signal)
{
diff --git a/board/kodama/board.c b/board/kodama/board.c
index 33ecbba384..2fa3ae8a3e 100644
--- a/board/kodama/board.c
+++ b/board/kodama/board.c
@@ -62,14 +62,33 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -104,8 +123,12 @@ struct mt6370_thermal_bound thermal_bound = {
};
static void board_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
@@ -322,8 +345,6 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lsm6dsm_drv,
.mutex = &g_lid_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_ACCEL_INT_ODL,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &lid_standard_ref,
diff --git a/board/kohaku/board.h b/board/kohaku/board.h
index b8470d9ba7..4bc1f4a517 100644
--- a/board/kohaku/board.h
+++ b/board/kohaku/board.h
@@ -19,7 +19,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -120,7 +120,7 @@
#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* Thermal features */
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -139,6 +139,7 @@
#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__
diff --git a/board/krabby/battery.c b/board/krabby/battery.c
deleted file mode 100644
index f07c38e1b8..0000000000
--- a/board/krabby/battery.c
+++ /dev/null
@@ -1,47 +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.
- */
-
-#include "battery.h"
-#include "battery_fuel_gauge.h"
-#include "battery_smart.h"
-#include "charge_manager.h"
-#include "chipset.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "system.h"
-#include "usb_pd.h"
-
-const struct board_batt_params board_battery_info[] = {
- [BATTERY_C235] = {
- .fuel_gauge = {
- .manuf_name = "AS3GWRc3KA",
- .device_name = "C235-41",
- .ship_mode = {
- .reg_addr = 0x0,
- .reg_data = { 0x10, 0x10 },
- },
- .fet = {
- .reg_addr = 0x99,
- .reg_mask = 0x0c,
- .disconnect_val = 0x0c,
- }
- },
- .batt_info = {
- .voltage_max = 8800,
- .voltage_normal = 7700,
- .voltage_min = 6000,
- .precharge_current = 256,
- .start_charging_min_c = 0,
- .start_charging_max_c = 45,
- .charging_min_c = 0,
- .charging_max_c = 60,
- .discharging_min_c = 0,
- .discharging_max_c = 60,
- },
- },
-};
-BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_C235;
diff --git a/board/krabby/board.c b/board/krabby/board.c
deleted file mode 100644
index 1e81aed838..0000000000
--- a/board/krabby/board.c
+++ /dev/null
@@ -1,176 +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.
- */
-/* Corsola board configuration */
-
-#include "adc.h"
-#include "button.h"
-#include "charge_manager.h"
-#include "charge_state_v2.h"
-#include "charger.h"
-#include "chipset.h"
-#include "common.h"
-#include "console.h"
-#include "driver/accel_lis2dw12.h"
-#include "driver/accelgyro_icm_common.h"
-#include "driver/accelgyro_icm426xx.h"
-#include "gpio.h"
-#include "hooks.h"
-#include "i2c.h"
-#include "keyboard_scan.h"
-#include "lid_switch.h"
-#include "motion_sense.h"
-#include "power.h"
-#include "pwm.h"
-#include "pwm_chip.h"
-#include "regulator.h"
-#include "spi.h"
-#include "switch.h"
-#include "tablet_mode.h"
-#include "task.h"
-#include "timer.h"
-#include "uart.h"
-
-/* Initialize board. */
-static void board_init(void)
-{
- /* Enable motion sensor interrupt */
- gpio_enable_interrupt(GPIO_BASE_IMU_INT_L);
- gpio_enable_interrupt(GPIO_LID_ACCEL_INT_L);
-}
-DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
-
-/* Sensor */
-static struct mutex g_base_mutex;
-static struct mutex g_lid_mutex;
-
-static struct stprivate_data g_lis2dwl_data;
-static struct icm_drv_data_t g_icm426xx_data;
-
-struct motion_sensor_t motion_sensors[] = {
- /*
- * Note: icm426xx: 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_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 = NULL,
- .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,
- },
- },
- },
- [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,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = NULL,
- .min_frequency = ICM426XX_GYRO_MIN_FREQ,
- .max_frequency = ICM426XX_GYRO_MAX_FREQ,
- },
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LIS2DWL,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &lis2dw12_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_lis2dwl_data,
- .int_signal = GPIO_LID_ACCEL_INT_L,
- .port = I2C_PORT_ACCEL,
- .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .rot_standard_ref = NULL, /* identity matrix */
- .default_range = 2, /* g */
- .min_frequency = LIS2DW12_ODR_MIN_VAL,
- .max_frequency = LIS2DW12_ODR_MAX_VAL,
- .config = {
- /* EC use accel for angle detection */
- [SENSOR_CONFIG_EC_S0] = {
- .odr = 12500 | ROUND_UP_FLAG,
- },
- /* Sensor on for lid angle detection */
- [SENSOR_CONFIG_EC_S3] = {
- .odr = 10000 | ROUND_UP_FLAG,
- },
- },
- },
-};
-const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
-
-void motion_interrupt(enum gpio_signal signal)
-{
- icm426xx_interrupt(signal);
-}
-
-/* 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},
- /* 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},
-};
-BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-
-/* PWM */
-
-/*
- * PWM channels. Must be in the exactly same order as in enum pwm_channel.
- * There total three 16 bits clock prescaler registers for all pwm channels,
- * 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[] = {
- [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/krabby/gpio.inc b/board/krabby/gpio.inc
deleted file mode 100644
index be37d43fb8..0000000000
--- a/board/krabby/gpio.inc
+++ /dev/null
@@ -1,157 +0,0 @@
-/* -*- mode:c -*-
- *
- * 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.
- */
-
-/* Declare symbolic names for all the GPIOs that we care about.
- * Note: Those with interrupt handlers must be declared first. */
-
-/* Wake Source interrupts */
-GPIO_INT(POWER_BUTTON_L, PIN(E, 4),
- GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
- power_button_interrupt) /* GSC_EC_PWR_BTN_ODL */
-GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
- lid_interrupt) /* LID_OPEN_3V3 */
-GPIO_INT(TABLET_MODE_L, PIN(J, 7), GPIO_INT_BOTH,
- gmr_tablet_switch_isr)
-
-/* Chipset interrupts */
-GPIO_INT(AP_EC_WARM_RST_REQ, PIN(D, 3), GPIO_INT_RISING | GPIO_SEL_1P8V,
- chipset_reset_request_interrupt)
-
-/* Power sequencing interrupts */
-GPIO_INT(AP_IN_SLEEP_L, PIN(B, 6),
- GPIO_INT_BOTH | GPIO_SEL_1P8V, power_signal_interrupt)
-
-/* Sensor Interrupts */
-GPIO_INT(BASE_IMU_INT_L, PIN(M, 3), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- motion_interrupt)
-GPIO_INT(LID_ACCEL_INT_L, PIN(M, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- lis2dw12_interrupt)
-
-/* Volume button interrupts */
-GPIO_INT(VOLUME_DOWN_L, PIN(D, 5), GPIO_INT_BOTH,
- button_interrupt) /* EC_VOLDN_BTN_ODL */
-GPIO_INT(VOLUME_UP_L, PIN(D, 6), GPIO_INT_BOTH,
- button_interrupt) /* EC_VOLUP_BTN_ODL */
-
-/* Other interrupts */
-GPIO_INT(AP_XHCI_INIT_DONE, PIN(J, 5),
- GPIO_INT_BOTH | GPIO_SEL_1P8V,
- usb_a0_interrupt)
-GPIO_INT(AC_PRESENT, PIN(E, 5), GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH,
- extpower_interrupt) /* GSC_ACOK_OD */
-GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_FALLING,
- uart_deepsleep_interrupt) /* UART_DEBUG_TX_EC_RX */
-GPIO_INT(WP, PIN(I, 4), GPIO_INT_BOTH | GPIO_SEL_1P8V,
- switch_interrupt) /* EC_FLASH_WP_OD */
-GPIO_INT(SPI0_CS, PIN(M, 5), GPIO_INT_FALLING | GPIO_SEL_1P8V,
- spi_event) /* SPI slave Chip Select -- AP_EC_SPI_CS_L */
-GPIO_INT(X_EC_GPIO2, PIN(B, 2), GPIO_INT_BOTH | GPIO_ODR_HIGH,
- x_ec_interrupt)
-
-/* USB-C interrupts */
-/* TODO: interrupt function not ready */
-GPIO(USB_C0_PPC_BC12_INT_ODL, PIN(D, 1), GPIO_INT_FALLING)
-GPIO(USB_C1_BC12_CHARGER_INT_ODL, PIN(J, 4), GPIO_INT_FALLING)
-
-/* Power Sequencing Signals */
-GPIO(EC_PMIC_EN_ODL, PIN(D, 0), GPIO_ODR_HIGH | GPIO_SEL_1P8V)
-GPIO(EN_PP5000_Z2, PIN(C, 6), GPIO_OUT_HIGH)
-GPIO(EN_ULP, PIN(E, 3), GPIO_OUT_LOW)
-GPIO(SYS_RST_ODL, PIN(G, 1), GPIO_ODR_LOW)
-GPIO(EC_BL_EN_OD, PIN(B, 5), GPIO_ODR_LOW | GPIO_SEL_1P8V)
-GPIO(AP_EC_SYSRST_ODL, PIN(J, 2), GPIO_INPUT | GPIO_SEL_1P8V)
-GPIO(AP_EC_WDTRST_L, PIN(C, 7), GPIO_INPUT | GPIO_SEL_1P8V)
-
-/* MKBP event synchronization */
-GPIO(EC_INT_L, PIN(E, 6), GPIO_ODR_HIGH | GPIO_SEL_1P8V) /* EC_AP_INT_ODL */
-
-/* USB and USBC Signals */
-GPIO(DP_AUX_PATH_SEL, PIN(G, 0), GPIO_OUT_HIGH)
-GPIO(EC_AP_DP_HPD_ODL, PIN(J, 0), GPIO_ODR_HIGH)
-GPIO(EN_PP5000_USB_A0_VBUS, PIN(B, 7), GPIO_OUT_LOW)
-GPIO(USB_C0_PPC_FRSINFO, PIN(F, 0), GPIO_INPUT)
-
-/* Misc Signals */
-GPIO(EC_BATT_PRES_ODL, PIN(C, 0), GPIO_INPUT)
-GPIO(EN_EC_ID_ODL, PIN(H, 5), GPIO_ODR_LOW)
-GPIO(ENTERING_RW, PIN(C, 5), GPIO_OUT_LOW) /* EC_ENTERING_RW */
-GPIO(EN_5V_USM, PIN(G, 3), GPIO_OUT_LOW)
-GPIO(USB_A0_FAULT_ODL, PIN(J, 6), GPIO_INPUT)
-
-/* I2C pins - Alternate function below configures I2C module on these pins */
-GPIO(I2C_A_SCL, PIN(B, 3), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C_PWR_CBI_SCL */
-GPIO(I2C_A_SDA, PIN(B, 4), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C_PWR_CBI_SDA */
-GPIO(I2C_B_SCL, PIN(C, 1), GPIO_INPUT) /* I2C_BATT_SCL_3V3 */
-GPIO(I2C_B_SDA, PIN(C, 2), GPIO_INPUT) /* I2C_BATT_SDA_3V3 */
-GPIO(I2C_C_SCL, PIN(F, 6), GPIO_INPUT) /* I2C_USB_C0_SCL */
-GPIO(I2C_C_SDA, PIN(F, 7), GPIO_INPUT) /* I2C_USB_C0_SDA */
-GPIO(I2C_D_SCL, PIN(F, 2), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C_SENSOR_SCL */
-GPIO(I2C_D_SDA, PIN(F, 3), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C_SENSOR_SDA */
-GPIO(I2C_E_SCL, PIN(E, 0), GPIO_INPUT) /* I2C_USB_C1_SCL */
-GPIO(I2C_E_SDA, PIN(E, 7), GPIO_INPUT) /* I2C_USB_C1_SDA */
-GPIO(I2C_F_SCL, PIN(A, 4), GPIO_INPUT) /* I2C_PROG_SCL */
-GPIO(I2C_F_SDA, PIN(A, 5), GPIO_INPUT) /* I2C_PROG_SDA */
-
-/* SPI pins - Alternate function below configures SPI module on these pins */
-
-/* Keyboard pins */
-
-/* Subboards HDMI/TYPEC */
-GPIO(EC_X_GPIO1, PIN(H, 4), GPIO_OUT_LOW)
-GPIO(EC_X_GPIO3, PIN(J, 1), GPIO_INPUT)
-GPIO(HDMI_PRSNT_ODL, PIN(J, 3), GPIO_INPUT) /* low -> hdmi, other -> usb */
-
-/* Alternate functions GPIO definitions */
-ALTERNATE(PIN_MASK(B, 0x18), 1, MODULE_I2C, 0) /* I2C A */
-ALTERNATE(PIN_MASK(C, 0x06), 1, MODULE_I2C, GPIO_SEL_1P8V) /* I2C B */
-ALTERNATE(PIN_MASK(F, 0xCC), 1, MODULE_I2C, 0) /* I2C C, D */
-ALTERNATE(PIN_MASK(E, 0x81), 1, MODULE_I2C, 0) /* I2C E */
-
-/* UART */
-ALTERNATE(PIN_MASK(B, 0x03), 1, MODULE_UART, 0) /* EC to Servo */
-
-/* PWM */
-ALTERNATE(PIN_MASK(A, 0x07), 1, MODULE_PWM, 0) /* PWM 0~2 */
-
-/* ADC */
-ALTERNATE(PIN_MASK(I, 0b10010111), 0, MODULE_ADC, 0) /* ADC 0,1,2,4,7 */
-
-/* SPI */
-ALTERNATE(PIN_MASK(M, 0x33), 0, MODULE_SPI, GPIO_SEL_1P8V) /* SPI */
-
-/* Unimplemented Pins */
-GPIO(PACKET_MODE_EN, PIN(D, 4), GPIO_OUT_LOW)
-GPIO(PG_PP5000_Z2_OD, PIN(D, 2), GPIO_INPUT)
-GPIO(PG_MT6315_PROC_B_ODL, PIN(E, 1), GPIO_INPUT)
-GPIO(EC_PEN_CHG_DIS_ODL, PIN(H, 3), GPIO_ODR_HIGH) /* 5V output */
-/* reserved for future use */
-GPIO(CCD_MODE_ODL, PIN(C, 4), GPIO_INPUT)
-
-/* NC pins, enable internal pull-up/down to avoid floating state. */
-GPIO(NC_GPA3, PIN(A, 3), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPA6, PIN(A, 6), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPA7, PIN(A, 7), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPC3, PIN(C, 3), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPD7, PIN(D, 7), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPF1, PIN(F, 1), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(SPI_CLK_GPG6, PIN(G, 6), GPIO_INPUT | GPIO_PULL_UP)
-GPIO(NC_GPH0, PIN(H, 0), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPH6, PIN(H, 6), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPI7, PIN(I, 7), GPIO_INPUT | GPIO_PULL_DOWN)
-GPIO(NC_GPM6, PIN(M, 6), GPIO_INPUT | GPIO_PULL_DOWN)
-/*
- * These pins don't have internal pull-down capability,
- * so we set them as output low.
- */
-GPIO(SPI_MOSI_GPG4, PIN(G, 4), GPIO_OUT_LOW)
-GPIO(SPI_MISO_GPG5, PIN(G, 5), GPIO_OUT_LOW)
-GPIO(SPI_CS_GPG7, PIN(G, 7), GPIO_OUT_LOW)
-
-/* pins used in power/mt8192, will be removed after mt8186 code ready */
-UNIMPLEMENTED(AP_EC_WATCHDOG_L)
-UNIMPLEMENTED(EC_PMIC_WATCHDOG_L)
-UNIMPLEMENTED(PMIC_EC_PWRGD)
diff --git a/board/krabby/hooks.c b/board/krabby/hooks.c
deleted file mode 100644
index cea6667650..0000000000
--- a/board/krabby/hooks.c
+++ /dev/null
@@ -1,19 +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.
- */
-
-#include "gpio.h"
-#include "hooks.h"
-
-static void board_suspend(void)
-{
- gpio_set_level(GPIO_EN_5V_USM, 0);
-}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_suspend, HOOK_PRIO_DEFAULT);
-
-static void board_resume(void)
-{
- gpio_set_level(GPIO_EN_5V_USM, 1);
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_resume, HOOK_PRIO_DEFAULT);
diff --git a/board/krabby/led.c b/board/krabby/led.c
deleted file mode 100644
index 1d3108c47b..0000000000
--- a/board/krabby/led.c
+++ /dev/null
@@ -1,120 +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.
- */
-
-#include "ec_commands.h"
-#include "gpio.h"
-#include "led_common.h"
-#include "led_onoff_states.h"
-#include "chipset.h"
-#include "driver/bc12/mt6360.h"
-
-__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} },
-};
-
-__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,
-};
-
-const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
-
-__override void led_set_color_battery(enum ec_led_colors color)
-{
- mt6360_led_set_brightness(MT6360_LED_RGB2, 50);
- mt6360_led_set_brightness(MT6360_LED_RGB3, 50);
-
- switch (color) {
- case EC_LED_COLOR_AMBER:
- mt6360_led_enable(MT6360_LED_RGB2, 0);
- mt6360_led_enable(MT6360_LED_RGB3, 1);
- break;
- case EC_LED_COLOR_WHITE:
- mt6360_led_enable(MT6360_LED_RGB2, 1);
- mt6360_led_enable(MT6360_LED_RGB3, 0);
- break;
- default: /* LED_OFF and other unsupported colors */
- mt6360_led_enable(MT6360_LED_RGB2, 0);
- mt6360_led_enable(MT6360_LED_RGB3, 0);
- break;
- }
-}
-
-__override void led_set_color_power(enum ec_led_colors color)
-{
- mt6360_led_set_brightness(MT6360_LED_RGB1, 1);
- mt6360_led_enable(MT6360_LED_RGB1, color == EC_LED_COLOR_WHITE);
-}
-
-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_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
- } else if (led_id == EC_LED_ID_POWER_LED) {
- brightness_range[EC_LED_COLOR_WHITE] =
- MT6360_LED_BRIGHTNESS_MAX;
- }
-}
-
-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)
- led_set_color_battery(EC_LED_COLOR_AMBER);
- 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) {
- if (brightness[EC_LED_COLOR_WHITE] != 0)
- led_set_color_power(EC_LED_COLOR_WHITE);
- else
- led_set_color_power(LED_OFF);
- }
-
- return EC_SUCCESS;
-}
-
-__override enum led_states board_led_get_state(enum led_states desired_state)
-{
- if (desired_state == STATE_BATTERY_ERROR) {
- if (chipset_in_state(CHIPSET_STATE_ON))
- return desired_state;
- else if (chipset_in_state(CHIPSET_STATE_ANY_SUSPEND))
- return STATE_DISCHARGE_S3;
- else
- return STATE_DISCHARGE_S5;
- }
- return desired_state;
-}
diff --git a/board/krabby/usbc_config.c b/board/krabby/usbc_config.c
deleted file mode 100644
index ee5d9483eb..0000000000
--- a/board/krabby/usbc_config.c
+++ /dev/null
@@ -1,40 +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.
- */
-
-/* Krabby board-specific USB-C configuration */
-
-#include "driver/tcpm/it83xx_pd.h"
-#include "driver/usb_mux/ps8743.h"
-#include "hooks.h"
-
-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_USB_EQ_RX_12_8_DB);
- ps8743_write(&usb_muxes[1],
- PS8743_REG_HS_DET_THRESHOLD,
- PS8743_USB_HS_THRESH_NEG_10);
- }
-}
-DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
-
-const struct cc_para_t *board_get_cc_tuning_parameter(enum usbpd_port port)
-{
- const static struct cc_para_t
- cc_parameter[CONFIG_USB_PD_ITE_ACTIVE_PORT_COUNT] = {
- {
- .rising_time = IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
- .falling_time = IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
- },
- {
- .rising_time = IT83XX_TX_PRE_DRIVING_TIME_1_UNIT,
- .falling_time = IT83XX_TX_PRE_DRIVING_TIME_2_UNIT,
- },
- };
-
- return &cc_parameter[port];
-}
diff --git a/board/kracko/board.c b/board/kracko/board.c
index 99dcd56810..566ecdf3b4 100644
--- a/board/kracko/board.c
+++ b/board/kracko/board.c
@@ -364,8 +364,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -393,8 +391,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 8d386815c6..a3468b62ca 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -75,8 +75,20 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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);
@@ -123,8 +135,12 @@ void board_set_dp_mux_control(int output_enable, int polarity)
}
static void board_hpd_update(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/lantis/board.c b/board/lantis/board.c
index a64d8fa17a..6ddc1c3f89 100644
--- a/board/lantis/board.c
+++ b/board/lantis/board.c
@@ -328,8 +328,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -357,8 +355,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/lazor/board.c b/board/lazor/board.c
index 1118f3a845..03192e1bbc 100644
--- a/board/lazor/board.c
+++ b/board/lazor/board.c
@@ -77,16 +77,41 @@ const int keyboard_factory_scan_pins_used =
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/lazor/usbc_config.c b/board/lazor/usbc_config.c
index f8c9662136..b489c2b8ed 100644
--- a/board/lazor/usbc_config.c
+++ b/board/lazor/usbc_config.c
@@ -7,6 +7,8 @@
#include "battery_fuel_gauge.h"
#include "bc12/pi3usb9201_public.h"
+#include "charger.h"
+#include "charger/isl923x_public.h"
#include "charge_manager.h"
#include "charge_state.h"
#include "common.h"
@@ -28,6 +30,52 @@
#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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;
+}
+
void usb0_evt(enum gpio_signal signal)
{
task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
diff --git a/board/liara/board.c b/board/liara/board.c
index 4f8b552d1f..c8fdeff2cd 100644
--- a/board/liara/board.c
+++ b/board/liara/board.c
@@ -29,12 +29,48 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL_AP, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"kblight", I2C_PORT_KBLIGHT, 100, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, 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/lick/board.c b/board/lick/board.c
index 4b5608b7b0..678634f785 100644
--- a/board/lick/board.c
+++ b/board/lick/board.c
@@ -144,8 +144,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &standard_rot_ref,
@@ -176,8 +174,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/lindar/board.c b/board/lindar/board.c
index e1975260df..3b18845b36 100644
--- a/board/lindar/board.c
+++ b/board/lindar/board.c
@@ -180,8 +180,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -212,8 +210,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/lindar/ec.tasklist b/board/lindar/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/lindar/ec.tasklist
+++ b/board/lindar/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/madoo/board.c b/board/madoo/board.c
index 1c989b859e..31b0c5309e 100644
--- a/board/madoo/board.c
+++ b/board/madoo/board.c
@@ -394,8 +394,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -423,8 +421,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/magolor/board.c b/board/magolor/board.c
index 3d3765dbe0..ca656fcf0d 100644
--- a/board/magolor/board.c
+++ b/board/magolor/board.c
@@ -805,6 +805,37 @@ struct motion_sensor_t motion_sensors[] = {
unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+/**
+ * Handle debounced pen input changing state.
+ */
+static void pendetect_deferred(void)
+{
+ int pen_charge_enable = !gpio_get_level(GPIO_PEN_DET_ODL) &&
+ !chipset_in_state(CHIPSET_STATE_ANY_OFF);
+
+ if (pen_charge_enable)
+ gpio_set_level(GPIO_EN_PP5000_PEN, 1);
+ else
+ gpio_set_level(GPIO_EN_PP5000_PEN, 0);
+
+ CPRINTS("Pen charge %sable", pen_charge_enable ? "en" : "dis");
+}
+DECLARE_DEFERRED(pendetect_deferred);
+
+void pen_detect_interrupt(enum gpio_signal signal)
+{
+ /* pen input debounce time */
+ hook_call_deferred(&pendetect_deferred_data, (100 * MSEC));
+}
+
+static void pen_charge_check(void)
+{
+ if (get_cbi_fw_config_stylus() == STYLUS_PRESENT)
+ hook_call_deferred(&pendetect_deferred_data, (100 * MSEC));
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pen_charge_check, HOOK_PRIO_LAST);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pen_charge_check, HOOK_PRIO_LAST);
+
void board_init(void)
{
int on;
@@ -874,6 +905,16 @@ void board_init(void)
GPIO_INPUT | GPIO_PULL_DOWN);
}
+ if (get_cbi_fw_config_stylus() == STYLUS_PRESENT) {
+ gpio_enable_interrupt(GPIO_PEN_DET_ODL);
+ /* Make sure pen detection is triggered or not at sysjump */
+ pen_charge_check();
+ } else {
+ gpio_disable_interrupt(GPIO_PEN_DET_ODL);
+ gpio_set_flags(GPIO_PEN_DET_ODL,
+ GPIO_INPUT | GPIO_PULL_DOWN);
+ }
+
/* Turn on 5V if the system is on, otherwise turn it off. */
on = chipset_in_state(CHIPSET_STATE_ON | CHIPSET_STATE_ANY_SUSPEND |
CHIPSET_STATE_SOFT_OFF);
diff --git a/board/magolor/board.h b/board/magolor/board.h
index c1ef73cc64..9b7117fa0c 100644
--- a/board/magolor/board.h
+++ b/board/magolor/board.h
@@ -208,5 +208,6 @@ enum battery_type {
};
void motion_interrupt(enum gpio_signal signal);
+void pen_detect_interrupt(enum gpio_signal s);
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/magolor/gpio.inc b/board/magolor/gpio.inc
index b7b692ca56..00a6b4effc 100644
--- a/board/magolor/gpio.inc
+++ b/board/magolor/gpio.inc
@@ -37,6 +37,7 @@ GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt)
GPIO_INT(EC_WP_OD, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, motion_interrupt)
GPIO_INT(LID_360_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)
+GPIO_INT(PEN_DET_ODL, PIN(5, 0), GPIO_INT_BOTH, pen_detect_interrupt)
/* I2C Ports */
GPIO(EC_I2C_EEPROM_SCL, PIN(B, 3), GPIO_INPUT)
@@ -57,7 +58,7 @@ GPIO(EC_SUB_IO_2, PIN(3, 4), GPIO_OUT_LOW)
GPIO(EN_VCCIO_EXT, PIN(6, 1), GPIO_OUT_LOW)
/* TODO(b:149775160) - Modify if needed if we ever use this signal. */
GPIO(EN_VCCST, PIN(A, 7), GPIO_INPUT)
-GPIO(EN_PP3300_PEN, PIN(6, 3), GPIO_OUT_LOW)
+GPIO(EN_PP5000_PEN, PIN(6, 3), GPIO_OUT_LOW)
GPIO(EN_PP3300_A, PIN(0, 3), GPIO_OUT_LOW)
GPIO(EN_PP5000_U, PIN(A, 4), GPIO_OUT_LOW)
GPIO(EN_SLP_Z, PIN(8, 3), GPIO_OUT_LOW)
diff --git a/board/makomo/board.c b/board/makomo/board.c
index 1bb6b134a7..616b50003d 100644
--- a/board/makomo/board.c
+++ b/board/makomo/board.c
@@ -66,13 +66,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -138,8 +157,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/makomo/board.h b/board/makomo/board.h
index 844fd95292..3c620cd823 100644
--- a/board/makomo/board.h
+++ b/board/makomo/board.h
@@ -90,7 +90,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/marzipan/board.c b/board/marzipan/board.c
index 915f96743d..753d7a2e2a 100644
--- a/board/marzipan/board.c
+++ b/board/marzipan/board.c
@@ -105,16 +105,41 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/marzipan/usbc_config.c b/board/marzipan/usbc_config.c
index 3704a94197..e8fc9e76a3 100644
--- a/board/marzipan/usbc_config.c
+++ b/board/marzipan/usbc_config.c
@@ -5,9 +5,61 @@
/* Marzipan board-specific USB-C configuration */
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
#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)
+
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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;
+}
+
/* GPIO Interrupt Handlers */
void tcpc_alert_event(enum gpio_signal signal)
{
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index aa74d07a0d..99e3ac9328 100644
--- a/board/mchpevb1/board.c
+++ b/board/mchpevb1/board.c
@@ -230,8 +230,20 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
* MCHP EVB connected to KBL RVP3
*/
const struct i2c_port_t i2c_ports[] = {
- {"sensors", MCHP_I2C_PORT4, 100, GPIO_SMB04_SCL, GPIO_SMB04_SDA},
- {"batt", MCHP_I2C_PORT5, 100, GPIO_SMB05_SCL, GPIO_SMB05_SDA},
+ {
+ .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);
diff --git a/board/mchpevb1/board.h b/board/mchpevb1/board.h
index de1e7a75e9..e16d0bb10f 100644
--- a/board/mchpevb1/board.h
+++ b/board/mchpevb1/board.h
@@ -163,7 +163,7 @@
#define CONFIG_CHIPSET_SKYLAKE
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
diff --git a/board/mchpevb1/gpio.inc b/board/mchpevb1/gpio.inc
index 8be1099fbd..3949e31843 100644
--- a/board/mchpevb1/gpio.inc
+++ b/board/mchpevb1/gpio.inc
@@ -27,8 +27,8 @@
#define GPIO_BOTH_EDGES_PU (GPIO_INT_BOTH | GPIO_PULL_UP)
-/* Only needed if CONFIG_HOSTCMD_ESPI is not set, using LPC interface to PCH */
-#ifndef CONFIG_HOSTCMD_ESPI
+/* Only needed if CONFIG_HOST_INTERFACE_ESPI is not set, using LPC interface to PCH */
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(PCH_PLTRST_L, PIN(064), GPIO_BOTH_EDGES_PU, lpcrst_interrupt)
#endif
diff --git a/board/meep/board.c b/board/meep/board.c
index daac19a89a..3771c72072 100644
--- a/board/meep/board.c
+++ b/board/meep/board.c
@@ -176,8 +176,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -208,8 +206,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/metaknight/board.c b/board/metaknight/board.c
index 253ce31571..fc138bbbe2 100644
--- a/board/metaknight/board.c
+++ b/board/metaknight/board.c
@@ -567,8 +567,6 @@ struct motion_sensor_t lsm6dsm_base_accel = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_lsm6dsm_ref,
@@ -597,8 +595,6 @@ struct motion_sensor_t lsm6dsm_base_gyro = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -878,28 +874,43 @@ void motion_interrupt(enum gpio_signal signal)
const struct i2c_port_t i2c_ports[] = {
{
- "eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA
+ .name = "eeprom",
+ .port = I2C_PORT_EEPROM,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_EEPROM_SCL,
+ .sda = GPIO_EC_I2C_EEPROM_SDA
},
{
- "battery", I2C_PORT_BATTERY, 100, GPIO_EC_I2C_BATTERY_SCL,
- GPIO_EC_I2C_BATTERY_SDA
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BATTERY_SCL,
+ .sda = GPIO_EC_I2C_BATTERY_SDA
},
{
- "sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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
},
{
- "usbc0", I2C_PORT_USB_C0, 1000, GPIO_EC_I2C_USB_C0_SCL,
- 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
{
- "sub_usbc1", I2C_PORT_SUB_USB_C1, 1000,
- GPIO_EC_I2C_SUB_USB_C1_SCL, 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/moonbuggy/board.c b/board/moonbuggy/board.c
index 0ebf1380cb..889f4de898 100644
--- a/board/moonbuggy/board.c
+++ b/board/moonbuggy/board.c
@@ -135,12 +135,48 @@ const struct pwm_t pwm_channels[] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"pse", I2C_PORT_PSE, 400, GPIO_I2C4_SCL, GPIO_I2C4_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, 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);
diff --git a/board/moonbuggy/board.h b/board/moonbuggy/board.h
index 4ec5233f6f..64db35874e 100644
--- a/board/moonbuggy/board.h
+++ b/board/moonbuggy/board.h
@@ -38,7 +38,7 @@
#define CONFIG_MKBP_USE_HOST_EVENT
#undef CONFIG_KEYBOARD_RUNTIME_KEYS
#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
@@ -104,7 +104,7 @@
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 0
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
@@ -218,6 +218,7 @@ unsigned int ec_config_get_thermal_solution(void);
#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
/*
diff --git a/board/moonbuggy/gpio.inc b/board/moonbuggy/gpio.inc
index 6a905fdf04..d8f2989b8e 100644
--- a/board/moonbuggy/gpio.inc
+++ b/board/moonbuggy/gpio.inc
@@ -58,7 +58,7 @@ GPIO_INT(USB_A3_OC_ODL, PIN(0, 3), GPIO_INT_BOTH, port_ocp_interrupt)
GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
diff --git a/board/morphius/board.h b/board/morphius/board.h
index a38fd93fc1..343f1055e5 100644
--- a/board/morphius/board.h
+++ b/board/morphius/board.h
@@ -42,7 +42,7 @@
#define CONFIG_TABLET_MODE
#define CONFIG_TEMP_SENSOR
#define CONFIG_TEMP_SENSOR_TMP432
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_PWR_A
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
@@ -71,6 +71,7 @@
#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
diff --git a/board/morphius/thermal.c b/board/morphius/thermal.c
index 449fd92d5d..329157b6ec 100644
--- a/board/morphius/thermal.c
+++ b/board/morphius/thermal.c
@@ -495,16 +495,16 @@ void board_override_fan_control(int fan, int *tmp)
void thermal_protect(void)
{
- if ((!lid_is_open()) && (!extpower_is_present())) {
- int rv1, rv2;
- int thermal_sensor1, thermal_sensor2;
+ 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 (rv2 == EC_SUCCESS) {
+ if ((!lid_is_open()) && (!extpower_is_present())) {
if (thermal_sensor2 > C_TO_K(70)) {
chipset_throttle_cpu(1);
throttle_on = 1;
@@ -513,9 +513,17 @@ void thermal_protect(void)
chipset_throttle_cpu(0);
throttle_on = 0;
}
+ } else {
+ if (throttle_on == 1) {
+ chipset_throttle_cpu(0);
+ throttle_on = 0;
+ }
}
- if (rv1 == EC_SUCCESS &&
- thermal_sensor1 > C_TO_K(51))
+ }
+
+ if (rv1 == EC_SUCCESS) {
+ if ((!lid_is_open()) && (!extpower_is_present())
+ && thermal_sensor1 > C_TO_K(51))
chipset_force_shutdown(CHIPSET_SHUTDOWN_THERMAL);
}
}
diff --git a/board/mrbland/board.c b/board/mrbland/board.c
index d367b82521..b94717b5a4 100644
--- a/board/mrbland/board.c
+++ b/board/mrbland/board.c
@@ -107,14 +107,34 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/mrbland/build.mk b/board/mrbland/build.mk
index 74b6b95e4d..452abeb591 100644
--- a/board/mrbland/build.mk
+++ b/board/mrbland/build.mk
@@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7
CHIP_VARIANT:=npcx7m6fc
BASEBOARD:=trogdor
-board-y=battery.o board.o led.o base_detect.o
+board-y=battery.o board.o led.o base_detect.o usbc_config.o
diff --git a/board/mrbland/usbc_config.c b/board/mrbland/usbc_config.c
new file mode 100644
index 0000000000..8f3fb02c30
--- /dev/null
+++ b/board/mrbland/usbc_config.c
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "usb_pd.h"
+
+#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/munna/board.c b/board/munna/board.c
index f31c7a7e39..6cba87ada2 100644
--- a/board/munna/board.c
+++ b/board/munna/board.c
@@ -67,13 +67,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 2, 400, GPIO_I2C3_SCL, 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[] = {
- {"battery", 3, 100, GPIO_I2C4_SCL, 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);
@@ -139,8 +158,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
@@ -267,7 +290,7 @@ static void board_spi_enable(void)
#ifdef CHIP_FAMILY_STM32L4
/* Set I/O speed before AF configured */
/* EMMC SPI SLAVE: PB13/14/15 */
- /* SENSORS SPI MASTER: PB10, PB12, PC2, PC3 */
+ /* SENSORS SPI controller: PB10, PB12, PC2, PC3 */
STM32_GPIO_OSPEEDR(GPIO_B) |= 0xFF300000;
STM32_GPIO_OSPEEDR(GPIO_C) |= 0x000000F0;
diff --git a/board/munna/board.h b/board/munna/board.h
index baf68470e4..96a76b11b5 100644
--- a/board/munna/board.h
+++ b/board/munna/board.h
@@ -113,7 +113,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/mushu/board.h b/board/mushu/board.h
index 493ef442df..a91040962c 100644
--- a/board/mushu/board.h
+++ b/board/mushu/board.h
@@ -23,7 +23,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_CMD_MFALLOW
@@ -121,7 +121,7 @@
#define CONFIG_CUSTOM_FAN_CONTROL
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -148,6 +148,7 @@
#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__
diff --git a/board/nami/board.c b/board/nami/board.c
index 70e85fd83b..d5b585b526 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -218,12 +218,48 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"tcpc1", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"battery", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"charger", NPCX_I2C_PORT2, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"accelgyro", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/nami/board.h b/board/nami/board.h
index 1753ec538f..5952b1a754 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -73,7 +73,7 @@
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_HAS_PRE_INIT_CALLBACK
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
diff --git a/board/nautilus/board.c b/board/nautilus/board.c
index bcdaf568e7..f08dc20097 100644
--- a/board/nautilus/board.c
+++ b/board/nautilus/board.c
@@ -137,11 +137,41 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"tcpc1", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"accelgyro", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 6be7167538..b4a05e46d1 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -62,7 +62,7 @@
#define CONFIG_CHIPSET_SKYLAKE
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
diff --git a/board/nightfury/board.h b/board/nightfury/board.h
index 86191e104d..0b50ed75b9 100644
--- a/board/nightfury/board.h
+++ b/board/nightfury/board.h
@@ -20,7 +20,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -117,7 +117,7 @@
#define GPIO_VOLUME_DOWN_L GPIO_EC_VOLDN_BTN_ODL
/* Thermal features */
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -141,6 +141,7 @@
#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__
diff --git a/board/nipperkin/board.c b/board/nipperkin/board.c
index a065dad5c0..3fe31fdfd8 100644
--- a/board/nipperkin/board.c
+++ b/board/nipperkin/board.c
@@ -16,7 +16,7 @@
#include "driver/retimer/ps8811.h"
#include "driver/retimer/ps8818.h"
#include "driver/temp_sensor/sb_tsi.h"
-#include "driver/temp_sensor/tmp112.h"
+#include "driver/temp_sensor/pct2075.h"
#include "extpower.h"
#include "gpio.h"
#include "hooks.h"
@@ -28,7 +28,6 @@
#include "tablet_mode.h"
#include "temp_sensor.h"
#include "temp_sensor/thermistor.h"
-#include "temp_sensor/tmp112.h"
#include "thermal.h"
#include "timer.h"
#include "usb_mux.h"
@@ -127,10 +126,10 @@ __override int board_c1_ps8818_mux_set(const struct usb_mux *me,
return rv;
/* Enable HPD on the DB */
- gpio_set_level(GPIO_USB_C1_HPD, 1);
+ ioex_set_level(IOEX_USB_C1_IN_HPD, 1);
} else {
/* Disable HPD on the DB */
- gpio_set_level(GPIO_USB_C1_HPD, 0);
+ ioex_set_level(IOEX_USB_C1_IN_HPD, 0);
}
return rv;
@@ -146,7 +145,7 @@ DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
static void board_chipset_startup(void)
{
if (get_board_version() > 1)
- tmp112_init();
+ pct2075_init();
}
DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup,
HOOK_PRIO_DEFAULT);
@@ -156,7 +155,7 @@ int board_get_soc_temp_k(int idx, int *temp_k)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_k(idx, temp_k);
+ return pct2075_get_val_k(idx, temp_k);
}
int board_get_soc_temp_mk(int *temp_mk)
@@ -164,7 +163,7 @@ int board_get_soc_temp_mk(int *temp_mk)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_mk(TMP112_SOC, temp_mk);
+ return pct2075_get_val_mk(PCT2075_SOC, temp_mk);
}
int board_get_ambient_temp_mk(int *temp_mk)
@@ -172,7 +171,7 @@ int board_get_ambient_temp_mk(int *temp_mk)
if (chipset_in_state(CHIPSET_STATE_HARD_OFF))
return EC_ERROR_NOT_POWERED;
- return tmp112_get_val_mk(TMP112_AMB, temp_mk);
+ return pct2075_get_val_mk(PCT2075_AMB, temp_mk);
}
/* ADC Channels */
@@ -218,18 +217,18 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* Temp Sensors */
static int board_get_temp(int, int *);
-const struct tmp112_sensor_t tmp112_sensors[] = {
- { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS0 },
- { I2C_PORT_SENSOR, TMP112_I2C_ADDR_FLAGS1 },
+const struct pct2075_sensor_t pct2075_sensors[] = {
+ { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS0 },
+ { I2C_PORT_SENSOR, PCT2075_I2C_ADDR_FLAGS7 },
};
-BUILD_ASSERT(ARRAY_SIZE(tmp112_sensors) == TMP112_COUNT);
+BUILD_ASSERT(ARRAY_SIZE(pct2075_sensors) == PCT2075_COUNT);
const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_SOC] = {
.name = "SOC",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = board_get_soc_temp_k,
- .idx = TMP112_SOC,
+ .idx = PCT2075_SOC,
},
[TEMP_SENSOR_CHARGER] = {
.name = "Charger",
@@ -258,8 +257,8 @@ const struct temp_sensor_t temp_sensors[] = {
[TEMP_SENSOR_AMBIENT] = {
.name = "Ambient",
.type = TEMP_SENSOR_TYPE_BOARD,
- .read = tmp112_get_val_k,
- .idx = TMP112_AMB,
+ .read = pct2075_get_val_k,
+ .idx = PCT2075_AMB,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
diff --git a/board/nipperkin/board.h b/board/nipperkin/board.h
index f9495857d5..6521188c20 100644
--- a/board/nipperkin/board.h
+++ b/board/nipperkin/board.h
@@ -40,6 +40,9 @@
#define CONFIG_LED_COMMON
#define CONFIG_LED_ONOFF_STATES
+/* Thermal Config */
+#define CONFIG_TEMP_SENSOR_PCT2075
+
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -73,6 +76,13 @@ enum temp_sensor_id {
TEMP_SENSOR_COUNT
};
+/* PCT2075 sensors */
+enum pct2075_sensor {
+ PCT2075_SOC,
+ PCT2075_AMB,
+ PCT2075_COUNT,
+};
+
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */
diff --git a/board/nipperkin/led.c b/board/nipperkin/led.c
index 59d03dbe83..93131400d2 100644
--- a/board/nipperkin/led.c
+++ b/board/nipperkin/led.c
@@ -167,18 +167,32 @@ static void led_set_battery(void)
if (charge_get_percent() < 10)
led_set_color_battery(LED_RIGHT_PORT,
(battery_ticks % LED_TICKS_PER_CYCLE
- < LED_ON_TICKS) ? LED_WHITE : LED_OFF);
+ < 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))
- led_set_color_battery(LED_LEFT_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);
+ else
+ led_set_color_battery(LED_LEFT_PORT, LED_OFF);
+ }
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x2) ?
- LED_WHITE : LED_OFF);
+ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
+ 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,
+ (battery_ticks & 0x1) ? LED_AMBER : LED_OFF);
+ }
break;
+
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
break;
diff --git a/board/nipperkin/thermal.c b/board/nipperkin/thermal.c
index 7266e80b14..3ead6da3e5 100644
--- a/board/nipperkin/thermal.c
+++ b/board/nipperkin/thermal.c
@@ -18,6 +18,25 @@
#define CPUTS(outstr) cputs(CC_THERMAL, outstr)
#define CPRINTS(format, args...) cprints(CC_THERMAL, format, ## args)
+const struct fan_conf fan_conf_0 = {
+ .flags = FAN_USE_RPM_MODE,
+ .ch = MFT_CH_0, /* Use MFT id to control fan */
+ .pgood_gpio = GPIO_S0_PGOOD,
+ .enable_gpio = -1,
+};
+const struct fan_rpm fan_rpm_0 = {
+ .rpm_min = 1000,
+ .rpm_start = 1000,
+ .rpm_max = 6500,
+};
+const struct fan_t fans[] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(fans) == FAN_CH_COUNT);
+
struct fan_step {
/*
* Sensor 1~4 trigger point, set -1 if we're not using this
diff --git a/board/nocturne/board.c b/board/nocturne/board.c
index 5987bae025..7cdebfe18b 100644
--- a/board/nocturne/board.c
+++ b/board/nocturne/board.c
@@ -133,26 +133,43 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
{
- "battery", I2C_PORT_BATTERY, 100, GPIO_EC_I2C4_BATTERY_SCL,
- GPIO_EC_I2C4_BATTERY_SDA
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C4_BATTERY_SCL,
+ .sda = GPIO_EC_I2C4_BATTERY_SDA
},
{
- "power", I2C_PORT_POWER, 100, GPIO_EC_I2C0_POWER_SCL,
- GPIO_EC_I2C0_POWER_SDA
+ .name = "power",
+ .port = I2C_PORT_POWER,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C0_POWER_SCL,
+ .sda = GPIO_EC_I2C0_POWER_SDA
},
{
- "als_gyro", I2C_PORT_ALS_GYRO, 400, GPIO_EC_I2C5_ALS_GYRO_SCL,
- GPIO_EC_I2C5_ALS_GYRO_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
},
{
- "usbc0", I2C_PORT_USB_C0, 100, GPIO_USB_C0_SCL, GPIO_USB_C0_SDA
+ .name = "usbc0",
+ .port = I2C_PORT_USB_C0,
+ .kbps = 100,
+ .scl = GPIO_USB_C0_SCL,
+ .sda = GPIO_USB_C0_SDA
},
{
- "usbc1", I2C_PORT_USB_C1, 100, GPIO_USB_C1_SCL, GPIO_USB_C1_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);
diff --git a/board/nocturne/board.h b/board/nocturne/board.h
index 70da6ac3ae..7f44e0d48e 100644
--- a/board/nocturne/board.h
+++ b/board/nocturne/board.h
@@ -30,7 +30,7 @@
/* EC modules */
#define CONFIG_ADC
#define CONFIG_BACKLIGHT_LID
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_I2C
#define CONFIG_I2C_BUS_MAY_BE_UNPOWERED
#define CONFIG_I2C_CONTROLLER
diff --git a/board/nocturne_fp/board_rw.c b/board/nocturne_fp/board_rw.c
index 0a7b38b97d..abc6bf88d8 100644
--- a/board/nocturne_fp/board_rw.c
+++ b/board/nocturne_fp/board_rw.c
@@ -86,7 +86,9 @@ static void spi_configure(enum fp_sensor_spi_select spi_select)
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
}
- /* Set all SPI master signal pins to very high speed: pins E2/4/5/6 */
+ /* Set all SPI controller signal pins to very high speed:
+ * pins E2/4/5/6
+ */
STM32_GPIO_OSPEEDR(GPIO_E) |= 0x00003f30;
/* Enable clocks to SPI4 module (master) */
STM32_RCC_APB2ENR |= STM32_RCC_PB2_SPI4;
@@ -125,7 +127,7 @@ void board_init(void)
gpio_enable_interrupt(GPIO_SLP_L);
/*
- * Enable the SPI slave interface if the PCH is up.
+ * Enable the SPI peripheral interface if the PCH is up.
* Do not use hook_call_deferred(), because ap_deferred() will be
* called after tasks with priority higher than HOOK task (very late).
*/
diff --git a/board/npcx7_evb/board.c b/board/npcx7_evb/board.c
index 9ddaf9bd51..7909668d2c 100644
--- a/board/npcx7_evb/board.c
+++ b/board/npcx7_evb/board.c
@@ -82,11 +82,41 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master0-0", NPCX_I2C_PORT0_0, 100, GPIO_I2C0_SCL0, GPIO_I2C0_SDA0},
- {"master1-0", NPCX_I2C_PORT1_0, 100, GPIO_I2C1_SCL0, GPIO_I2C1_SDA0},
- {"master2-0", NPCX_I2C_PORT2_0, 100, GPIO_I2C2_SCL0, GPIO_I2C2_SDA0},
- {"master3-0", NPCX_I2C_PORT3_0, 100, GPIO_I2C3_SCL0, GPIO_I2C3_SDA0},
- {"master7-0", NPCX_I2C_PORT7_0, 100, GPIO_I2C7_SCL0, 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/npcx7_evb/board.h b/board/npcx7_evb/board.h
index 4bad61b152..ab8b850d94 100644
--- a/board/npcx7_evb/board.h
+++ b/board/npcx7_evb/board.h
@@ -28,7 +28,7 @@
#define CONFIG_SPI
#define CONFIG_I2C
/* Features of eSPI */
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
diff --git a/board/npcx9_evb/board.c b/board/npcx9_evb/board.c
index 8bfc053fa5..b412fe8b30 100644
--- a/board/npcx9_evb/board.c
+++ b/board/npcx9_evb/board.c
@@ -103,11 +103,41 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master0-0", NPCX_I2C_PORT0_0, 100, GPIO_I2C0_SCL0, GPIO_I2C0_SDA0},
- {"master1-0", NPCX_I2C_PORT1_0, 100, GPIO_I2C1_SCL0, GPIO_I2C1_SDA0},
- {"master2-0", NPCX_I2C_PORT2_0, 100, GPIO_I2C2_SCL0, GPIO_I2C2_SDA0},
- {"master3-0", NPCX_I2C_PORT3_0, 100, GPIO_I2C3_SCL0, GPIO_I2C3_SDA0},
- {"master7-0", NPCX_I2C_PORT7_0, 100, GPIO_I2C7_SCL0, 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 e7e1190480..a0d209c938 100644
--- a/board/npcx9_evb/board.h
+++ b/board/npcx9_evb/board.h
@@ -13,7 +13,7 @@
#define CONFIG_PWM
#define CONFIG_I2C
/* Features of eSPI */
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
diff --git a/board/npcx_evb/board.c b/board/npcx_evb/board.c
index 61e0665b7f..ee448bbbd2 100644
--- a/board/npcx_evb/board.c
+++ b/board/npcx_evb/board.c
@@ -101,11 +101,41 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master0-0", NPCX_I2C_PORT0_0, 100, GPIO_I2C0_SCL0, GPIO_I2C0_SDA0},
- {"master0-1", NPCX_I2C_PORT0_1, 100, GPIO_I2C0_SCL1, GPIO_I2C0_SDA1},
- {"master1", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"master2", NPCX_I2C_PORT2, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"master3", NPCX_I2C_PORT3, 100, GPIO_I2C3_SCL, 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/board.h b/board/npcx_evb/board.h
index fc12b6d80a..5a22435396 100644
--- a/board/npcx_evb/board.h
+++ b/board/npcx_evb/board.h
@@ -12,7 +12,7 @@
#define CONFIG_ADC
#define CONFIG_PWM
#define CONFIG_SPI
-#define CONFIG_HOSTCMD_LPC
+#define CONFIG_HOST_INTERFACE_LPC
#define CONFIG_PECI
/* Optional features */
diff --git a/board/npcx_evb_arm/board.c b/board/npcx_evb_arm/board.c
index 4ee03e7a00..abb6e2279b 100644
--- a/board/npcx_evb_arm/board.c
+++ b/board/npcx_evb_arm/board.c
@@ -79,11 +79,41 @@ BUILD_ASSERT(ARRAY_SIZE(mft_channels) == MFT_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master0-0", NPCX_I2C_PORT0_0, 100, GPIO_I2C0_SCL0, GPIO_I2C0_SDA0},
- {"master0-1", NPCX_I2C_PORT0_1, 100, GPIO_I2C0_SCL1, GPIO_I2C0_SDA1},
- {"master1", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"master2", NPCX_I2C_PORT2, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"master3", NPCX_I2C_PORT3, 100, GPIO_I2C3_SCL, 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 c3fd341365..a56cec9783 100644
--- a/board/npcx_evb_arm/board.h
+++ b/board/npcx_evb_arm/board.h
@@ -11,7 +11,7 @@
/* Optional modules */
#define CONFIG_ADC
#define CONFIG_PWM
-#define CONFIG_HOSTCMD_SHI /* Used in ARM-based platform for host interface */
+#define CONFIG_HOST_INTERFACE_SHI /* ARM-based platform for host interface */
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands for testing */
diff --git a/board/nucleo-dartmonkey/board.c b/board/nucleo-dartmonkey/board.c
index a7851ec00b..ea0d11eaf5 100644
--- a/board/nucleo-dartmonkey/board.c
+++ b/board/nucleo-dartmonkey/board.c
@@ -76,7 +76,9 @@ static void spi_configure(void)
{
/* Configure SPI GPIOs */
gpio_config_module(MODULE_SPI_CONTROLLER, 1);
- /* Set all SPI master signal pins to very high speed: pins E2/4/5/6 */
+ /* Set all SPI controller signal pins to very high speed:
+ * pins E2/4/5/6
+ */
STM32_GPIO_OSPEEDR(GPIO_E) |= 0x00003f30;
/* Enable clocks to SPI4 module (master) */
STM32_RCC_APB2ENR |= STM32_RCC_PB2_SPI4;
@@ -97,7 +99,7 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_SLP_L);
/*
- * Enable the SPI slave interface if the PCH is up.
+ * Enable the SPI peripheral interface if the PCH is up.
* Do not use hook_call_deferred(), because ap_deferred() will be
* called after tasks with priority higher than HOOK task (very late).
*/
diff --git a/board/nucleo-f072rb/board.c b/board/nucleo-f072rb/board.c
index 66e8960ce7..078af171cb 100644
--- a/board/nucleo-f072rb/board.c
+++ b/board/nucleo-f072rb/board.c
@@ -39,7 +39,13 @@ DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
#ifdef CTS_MODULE_I2C
const struct i2c_port_t i2c_ports[] = {
- {"test", STM32_I2C1_PORT, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
+ {
+ .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);
diff --git a/board/nucleo-f411re/board.c b/board/nucleo-f411re/board.c
index 074507e039..96e7fefb69 100644
--- a/board/nucleo-f411re/board.c
+++ b/board/nucleo-f411re/board.c
@@ -52,8 +52,13 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100,
- GPIO_MASTER_I2C_SCL, 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);
diff --git a/board/nucleo-f412zg/board.c b/board/nucleo-f412zg/board.c
index 4324101da9..da3b4a3d4d 100644
--- a/board/nucleo-f412zg/board.c
+++ b/board/nucleo-f412zg/board.c
@@ -60,7 +60,7 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_PCH_SLP_S0_L);
/*
- * Enable the SPI slave interface if the PCH is up.
+ * Enable the SPI peripheral interface if the PCH is up.
* Do not use hook_call_deferred(), because ap_deferred() will be
* called after tasks with priority higher than HOOK task (very late).
*/
diff --git a/board/nucleo-h743zi/board.c b/board/nucleo-h743zi/board.c
index f1493658aa..c69a456425 100644
--- a/board/nucleo-h743zi/board.c
+++ b/board/nucleo-h743zi/board.c
@@ -60,7 +60,7 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_PCH_SLP_S0_L);
/*
- * Enable the SPI slave interface if the PCH is up.
+ * Enable the SPI peripheral interface if the PCH is up.
* Do not use hook_call_deferred(), because ap_deferred() will be
* called after tasks with priority higher than HOOK task (very late).
*/
diff --git a/board/nuwani/board.c b/board/nuwani/board.c
index 8004e25b37..a2d659af27 100644
--- a/board/nuwani/board.c
+++ b/board/nuwani/board.c
@@ -32,11 +32,41 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL_AP, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, 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);
@@ -100,8 +130,6 @@ struct motion_sensor_t base_accel_1 = {
.mutex = &g_base_mutex_1,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &lsm6dsm_base_standard_ref,
@@ -132,8 +160,6 @@ struct motion_sensor_t base_gyro_1 = {
.mutex = &g_base_mutex_1,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/oak/board.c b/board/oak/board.c
index e8eba6d45b..0275981446 100644
--- a/board/oak/board.c
+++ b/board/oak/board.c
@@ -97,8 +97,20 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"battery", I2C_PORT_BATTERY, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"pd", I2C_PORT_PD_MCU, 1000, GPIO_I2C1_SCL, GPIO_I2C1_SDA}
+ {
+ .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);
diff --git a/board/oak/board.h b/board/oak/board.h
index e82907a508..2c30e6185e 100644
--- a/board/oak/board.h
+++ b/board/oak/board.h
@@ -163,7 +163,7 @@
#define I2C_PORT_TCPC 1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* First SPI master 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
diff --git a/board/palkia/board.h b/board/palkia/board.h
index 010bfb908b..783f01c444 100644
--- a/board/palkia/board.h
+++ b/board/palkia/board.h
@@ -16,7 +16,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -56,7 +56,7 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -78,6 +78,7 @@
#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__
diff --git a/board/pazquel/board.c b/board/pazquel/board.c
index 8d7e679190..8cab9ee887 100644
--- a/board/pazquel/board.c
+++ b/board/pazquel/board.c
@@ -141,16 +141,41 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
@@ -193,9 +218,8 @@ const struct adc_t adc_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct pwm_t pwm_channels[] = {
- [PWM_CH_KBLIGHT] = { .channel = 3, .flags = 0, .freq = 10000 },
- /* TODO(waihong): Assign a proper frequency. */
- [PWM_CH_DISPLIGHT] = { .channel = 5, .flags = 0, .freq = 4800 },
+ [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);
diff --git a/board/pazquel/board.h b/board/pazquel/board.h
index a143a3fe7f..fa1ab621f8 100644
--- a/board/pazquel/board.h
+++ b/board/pazquel/board.h
@@ -37,6 +37,7 @@
/* USB */
#define CONFIG_USB_PD_TCPM_PS8805
+#define CONFIG_USB_PD_TCPM_PS8805_FORCE_DID
#define CONFIG_USBC_PPC_SN5S330
#define CONFIG_USB_PD_PORT_MAX_COUNT 2
diff --git a/board/pazquel/build.mk b/board/pazquel/build.mk
index f03287a2ee..f130540bd4 100644
--- a/board/pazquel/build.mk
+++ b/board/pazquel/build.mk
@@ -14,3 +14,4 @@ BASEBOARD:=trogdor
board-y+=battery.o
board-y+=board.o
board-y+=led.o
+board-y+=usbc_config.o
diff --git a/board/pazquel/usbc_config.c b/board/pazquel/usbc_config.c
new file mode 100644
index 0000000000..8f3fb02c30
--- /dev/null
+++ b/board/pazquel/usbc_config.c
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "usb_pd.h"
+
+#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/pdeval-stm32f072/board.c b/board/pdeval-stm32f072/board.c
index 8c62c10b79..525f14a4af 100644
--- a/board/pdeval-stm32f072/board.c
+++ b/board/pdeval-stm32f072/board.c
@@ -53,7 +53,13 @@ void board_reset_pd_mcu(void)
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", I2C_PORT_TCPC, 400 /* kHz */, GPIO_I2C0_SCL, GPIO_I2C0_SDA}
+ {
+ .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);
diff --git a/board/pdeval-stm32f072/usb_pd_policy.c b/board/pdeval-stm32f072/usb_pd_policy.c
index 6fdb894eed..b7425ce66c 100644
--- a/board/pdeval-stm32f072/usb_pd_policy.c
+++ b/board/pdeval-stm32f072/usb_pd_policy.c
@@ -243,6 +243,7 @@ __override int svdm_dp_config(int port, uint32_t *payload)
__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;
@@ -252,7 +253,8 @@ __override void svdm_dp_post_config(int port)
/* 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);
+ USB_PD_MUX_HPD_IRQ_DEASSERTED,
+ &unused);
}
__override int svdm_dp_attention(int port, uint32_t *payload)
@@ -261,6 +263,8 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
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 :
@@ -268,7 +272,7 @@ __override int svdm_dp_attention(int port, uint32_t *payload)
/* Note: Usage is deprecated, use usb_mux_hpd_update instead */
CPRINTS("Attention: 0x%x", payload[1]);
- anx7447_tcpc_update_hpd_status(mux, mux_state);
+ anx7447_tcpc_update_hpd_status(mux, mux_state, &unused);
#endif
dp_status[port] = payload[1];
diff --git a/board/phaser/board.c b/board/phaser/board.c
index 488880c1fc..3db1dc2345 100644
--- a/board/phaser/board.c
+++ b/board/phaser/board.c
@@ -167,8 +167,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &standard_rot_ref,
@@ -199,8 +197,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -247,6 +243,11 @@ static void cbi_init(void)
}
DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
+void board_hibernate_late(void)
+{
+ NPCX_KBSINPU = 0x0A;
+}
+
/* This callback disables keyboard when convertibles are fully open */
__override void lid_angle_peripheral_enable(int enable)
{
diff --git a/board/phaser/board.h b/board/phaser/board.h
index 443dbf37c1..a03782b245 100644
--- a/board/phaser/board.h
+++ b/board/phaser/board.h
@@ -13,6 +13,20 @@
#define VARIANT_OCTOPUS_CHARGER_ISL9238
#include "baseboard.h"
+/* b/203442963
+ * It's workaround to reduce keyboard's "Silver Migration".
+ * From keyboard vendor's feedback, there are two factors to cause
+ * "Silver Migration".
+ * 1. A voltage potential between trace.
+ * 2. The presence of an electrolyte , such as moisture.
+ * The reason cause voltage potential between KSIxx trace is EC enter ec
+ * hibernate PSL and turn EC's VCC1 power off. Besides KSI2, the other
+ * KSIxx will be turn off. KSI2 is powered by H1.
+ * To avoid voltage potential is keep KSIxx on. That means not to enter
+ * ec hibernate PSL.
+ */
+#undef CONFIG_HIBERNATE_PSL
+
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
#define CONFIG_VOLUME_BUTTONS
diff --git a/board/pico/board.c b/board/pico/board.c
index e930c7c998..eaecf77f31 100644
--- a/board/pico/board.c
+++ b/board/pico/board.c
@@ -207,9 +207,27 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", IT83XX_I2C_CH_C, 400, GPIO_I2C_C_SCL, GPIO_I2C_C_SDA},
- {"sensor", IT83XX_I2C_CH_B, 400, GPIO_I2C_B_SCL, GPIO_I2C_B_SDA},
- {"battery", IT83XX_I2C_CH_A, 100, GPIO_I2C_A_SCL, 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);
@@ -242,8 +260,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/pirika/board.c b/board/pirika/board.c
index 098e6baa9b..7da53b686c 100644
--- a/board/pirika/board.c
+++ b/board/pirika/board.c
@@ -631,8 +631,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = NULL,
@@ -660,8 +658,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/plankton/board.c b/board/plankton/board.c
index a361f5fff3..5a62f63c86 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -460,8 +460,13 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100,
- GPIO_MASTER_I2C_SCL, 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);
diff --git a/board/pompom/board.c b/board/pompom/board.c
index 855a8c305d..f961a12921 100644
--- a/board/pompom/board.c
+++ b/board/pompom/board.c
@@ -129,14 +129,34 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/pompom/build.mk b/board/pompom/build.mk
index a044fa58cb..04c90da3fe 100644
--- a/board/pompom/build.mk
+++ b/board/pompom/build.mk
@@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7
CHIP_VARIANT:=npcx7m6fc
BASEBOARD:=trogdor
-board-y=battery.o board.o led.o
+board-y=battery.o board.o led.o usbc_config.o
diff --git a/board/pompom/usbc_config.c b/board/pompom/usbc_config.c
new file mode 100644
index 0000000000..8f3fb02c30
--- /dev/null
+++ b/board/pompom/usbc_config.c
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "usb_pd.h"
+
+#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/poppy/board.c b/board/poppy/board.c
index 2124faa421..9dc0250e80 100644
--- a/board/poppy/board.c
+++ b/board/poppy/board.c
@@ -179,11 +179,41 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"als", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"charger", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"pmic", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"accelgyro", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/poppy/board.h b/board/poppy/board.h
index 98fcfdbfa9..ca287c7c6e 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -63,7 +63,7 @@
#define CONFIG_CHIPSET_SKYLAKE
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define GPIO_PG_EC_RSMRST_ODL GPIO_RSMRST_L_PGOOD
diff --git a/board/primus/board.c b/board/primus/board.c
index 0881ab1c86..d0fa9f6cae 100644
--- a/board/primus/board.c
+++ b/board/primus/board.c
@@ -8,6 +8,7 @@
#include "charge_ramp.h"
#include "charger.h"
#include "common.h"
+#include "charge_manager.h"
#include "charge_state_v2.h"
#include "compile_time_macros.h"
#include "console.h"
@@ -35,6 +36,8 @@
#define KBLIGHT_LED_ON_LVL 100
#define KBLIGHT_LED_OFF_LVL 0
+#define PD_MAX_SUSPEND_CURRENT_MA 3000
+
/******************************************************************************/
/* USB-A charging control */
@@ -123,12 +126,45 @@ __override void board_set_charge_limit(int port, int supplier, int charge_ma,
int max_ma, int charge_mv)
{
/*
- * Follow OEM request to limit the input current to
- * 97% negotiated limit.
+ * Need to set different input current limit depend on system state.
+ * Guard adapter plug/ un-plug here.
*/
- charge_ma = charge_ma * 97 / 100;
+
+ if (((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);
}
+
+static void configure_input_current_limit(void)
+{
+ /*
+ * If adapter == 3250mA, we need system be charged at 3150mA in S5.
+ * And system be charged at 3000mA in S0.
+ */
+ int adapter_current_ma;
+ int adapter_current_mv;
+ /* Get adapter voltage/ current */
+ adapter_current_mv = charge_manager_get_charger_voltage();
+ 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))
+ 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);
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, configure_input_current_limit,
+ HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN_COMPLETE, configure_input_current_limit,
+ HOOK_PRIO_DEFAULT);
diff --git a/board/primus/board.h b/board/primus/board.h
index 5b87eb6477..830ad20529 100644
--- a/board/primus/board.h
+++ b/board/primus/board.h
@@ -49,8 +49,8 @@
* 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_POWER_MW 65000
+#define PD_MAX_CURRENT_MA 3250
#define PD_MAX_VOLTAGE_MV 20000
/*
@@ -71,6 +71,7 @@
#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
@@ -124,12 +125,14 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
/* LED */
#define CONFIG_BATTERY_LEVEL_NEAR_FULL 91
+/* Fan features */
+#define CONFIG_CUSTOM_FAN_CONTROL
#define CONFIG_FANS FAN_CH_COUNT
#define RPM_DEVIATION 1
diff --git a/board/primus/build.mk b/board/primus/build.mk
index d6fe9b4808..217f95da10 100644
--- a/board/primus/build.mk
+++ b/board/primus/build.mk
@@ -23,4 +23,5 @@ board-y+=led.o
board-y+=pwm.o
board-y+=ps2.o
board-y+=sensors.o
+board-y+=thermal.o
board-y+=usbc_config.o
diff --git a/board/primus/ec.tasklist b/board/primus/ec.tasklist
index 2a9c288ee6..bf2ec04c62 100644
--- a/board/primus/ec.tasklist
+++ b/board/primus/ec.tasklist
@@ -18,6 +18,7 @@
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) \
diff --git a/board/primus/fans.c b/board/primus/fans.c
index d966056331..001c6fde5c 100644
--- a/board/primus/fans.c
+++ b/board/primus/fans.c
@@ -31,15 +31,12 @@ static const struct fan_conf fan_conf_0 = {
};
/*
- * TOOD(b/180681346): need to update for real fan
- *
- * Prototype fan spins at about 7200 RPM at 100% PWM.
- * Set minimum at around 30% PWM.
+ * Set maximum rpm at 4800/ minimum rpm at 1800.
*/
static const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 2200,
- .rpm_start = 2200,
- .rpm_max = 7200,
+ .rpm_min = 1800,
+ .rpm_start = 1800,
+ .rpm_max = 4800,
};
const struct fan_t fans[FAN_CH_COUNT] = {
diff --git a/board/primus/fw_config.c b/board/primus/fw_config.c
index 9506e778b5..0384d05b9d 100644
--- a/board/primus/fw_config.c
+++ b/board/primus/fw_config.c
@@ -54,6 +54,11 @@ union primus_cbi_fw_config get_fw_config(void)
return fw_config;
}
+enum ec_cfg_mlb_usb ec_cfg_mlb_usb(void)
+{
+ return fw_config.mlb_usb;
+}
+
enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void)
{
return fw_config.usb_db;
diff --git a/board/primus/fw_config.h b/board/primus/fw_config.h
index cbccbd07a9..f8792f1443 100644
--- a/board/primus/fw_config.h
+++ b/board/primus/fw_config.h
@@ -25,14 +25,21 @@ enum ec_cfg_keyboard_backlight_type {
KEYBOARD_BACKLIGHT_ENABLED = 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 lte_db : 1;
+ uint32_t reserved_0 : 1;
enum ec_cfg_keyboard_backlight_type kb_bl : 1;
uint32_t audio : 3;
- uint32_t reserved_1 : 21;
+ uint32_t cellular_db : 2;
+ enum ec_cfg_mlb_usb mlb_usb : 1;
+ uint32_t reserved_1 : 18;
};
uint32_t raw_value;
};
@@ -45,6 +52,13 @@ union primus_cbi_fw_config {
union primus_cbi_fw_config get_fw_config(void);
/**
+ * Get MLB USB type from FW_CONFIG.
+ *
+ * @return the MLB USB type.
+ */
+enum ec_cfg_mlb_usb ec_cfg_mlb_usb(void);
+
+/**
* Get the USB daughter board type from FW_CONFIG.
*
* @return the USB daughter board type.
diff --git a/board/primus/i2c.c b/board/primus/i2c.c
index 3a4fe69b0c..019862f441 100644
--- a/board/primus/i2c.c
+++ b/board/primus/i2c.c
@@ -17,7 +17,7 @@ const struct i2c_port_t i2c_ports[] = {
*/
.name = "tcpc0",
.port = I2C_PORT_USB_C0_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C0_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C0_TCPC_SDA,
},
@@ -44,7 +44,7 @@ const struct i2c_port_t i2c_ports[] = {
*/
.name = "tcpc1",
.port = I2C_PORT_USB_C1_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
},
diff --git a/board/primus/thermal.c b/board/primus/thermal.c
new file mode 100644
index 0000000000..f5e200b14c
--- /dev/null
+++ b/board/primus/thermal.c
@@ -0,0 +1,157 @@
+/* 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.
+ */
+
+#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 = {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},
+ },
+ {
+ /* level 2 */
+ .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},
+ },
+ {
+ /* level 4 */
+ .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},
+ },
+ {
+ /* level 6 */
+ .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},
+ },
+};
+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 + 1;
+ else
+ break;
+ }
+ }
+ if (current_level < 0)
+ current_level = 0;
+
+ 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_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);
+ fan_set_rpm_target(FAN_CH(fan), 0);
+ }
+}
diff --git a/board/primus/usbc_config.c b/board/primus/usbc_config.c
index 2207b1b085..44f58c184e 100644
--- a/board/primus/usbc_config.c
+++ b/board/primus/usbc_config.c
@@ -274,3 +274,11 @@ __override bool board_is_dts_port(int port)
{
return port == USBC_PORT_C0;
}
+
+__override enum tbt_compat_cable_speed board_get_max_tbt_speed(int port)
+{
+ if (ec_cfg_mlb_usb())
+ return TBT_SS_U32_GEN1_GEN2;
+
+ return TBT_SS_TBT_GEN3;
+}
diff --git a/board/puff/board.c b/board/puff/board.c
index b30ca74221..bf22657bf4 100644
--- a/board/puff/board.c
+++ b/board/puff/board.c
@@ -288,11 +288,41 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, 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);
diff --git a/board/puff/board.h b/board/puff/board.h
index 9330d128ef..185c3d0076 100644
--- a/board/puff/board.h
+++ b/board/puff/board.h
@@ -38,7 +38,7 @@
#define CONFIG_MKBP_USE_HOST_EVENT
#undef CONFIG_KEYBOARD_RUNTIME_KEYS
#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
@@ -119,7 +119,7 @@
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 0
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
@@ -278,6 +278,7 @@ unsigned int ec_config_get_thermal_solution(void);
#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
/*
diff --git a/board/puff/gpio.inc b/board/puff/gpio.inc
index 7e62488cee..b51f595e81 100644
--- a/board/puff/gpio.inc
+++ b/board/puff/gpio.inc
@@ -64,7 +64,7 @@ GPIO_INT(USB_A4_OC_ODL, PIN(B, 0), GPIO_OUT_LOW | GPIO_INT_BOTH, port_ocp
GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
diff --git a/board/quackingstick/board.c b/board/quackingstick/board.c
index 11fbb6cb12..749bcdc4fd 100644
--- a/board/quackingstick/board.c
+++ b/board/quackingstick/board.c
@@ -102,14 +102,34 @@ static void board_connect_c0_sbu(enum gpio_signal s)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
@@ -243,8 +263,8 @@ 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, FLOAT_TO_FP(1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
@@ -373,13 +393,15 @@ void motion_interrupt(enum gpio_signal signal)
static void board_init(void)
{
/*
- * The rev-1 hardware doesn't have the external pull-up fix for the bug
- * b/177611071. It requires rework to stuff the resistor. For people who
- * has difficulty to do the rework, this is a workaround, which makes
- * the GPIO push-pull, instead of open-drain.
+ * The rev-1 hardware use PP1800_SENSORS as the power of the hall IC,
+ * it cause the LID_OPEN_EC wake EC immediately when EC enter hibernate.
*/
- if (system_get_board_version() == 1)
- gpio_set_flags(GPIO_HIBERNATE_L, GPIO_OUTPUT);
+ if (system_get_board_version() <= 1) {
+ hibernate_wake_pins[0] = GPIO_AC_PRESENT;
+ hibernate_wake_pins[1] = GPIO_POWER_BUTTON_L;
+ hibernate_wake_pins[2] = GPIO_EC_RST_ODL;
+ hibernate_wake_pins_used = 3;
+ }
/* Enable BC1.2 interrupts */
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_L);
@@ -392,6 +414,10 @@ static void board_init(void)
*/
gpio_enable_interrupt(GPIO_CCD_MODE_ODL);
+ /* Enable pen input detect interrupt */
+ if (system_get_board_version() >= 2)
+ gpio_enable_interrupt(GPIO_EC_PEN_PDCT_L);
+
/* Set the backlight duty cycle to 0. AP will override it later. */
pwm_set_duty(PWM_CH_DISPLIGHT, 0);
}
@@ -445,7 +471,7 @@ void board_hibernate(void)
* Board rev 1+ has the hardware fix. Don't need the following
* workaround.
*/
- if (system_get_board_version() >= 1)
+ if (system_get_board_version() > 1)
return;
/*
@@ -606,6 +632,33 @@ void board_set_charge_limit(int port, int supplier, int charge_ma,
charge_mv);
}
+/**
+ * Handle debounced pen input changing state.
+ */
+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);
+
+ gpio_set_level(GPIO_PEN_PWR_EN, pen_charge_enable);
+
+ CPRINTS("Pen charge %sable", pen_charge_enable ? "en" : "dis");
+}
+DECLARE_DEFERRED(pen_input_deferred);
+
+void pen_input_interrupt(enum gpio_signal signal)
+{
+ /* pen input debounce time */
+ hook_call_deferred(&pen_input_deferred_data, (100 * MSEC));
+}
+
+static void pen_charge_check(void)
+{
+ hook_call_deferred(&pen_input_deferred_data, (100 * MSEC));
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, pen_charge_check, HOOK_PRIO_LAST);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, pen_charge_check, HOOK_PRIO_LAST);
+
uint16_t tcpc_get_alert_status(void)
{
uint16_t status = 0;
diff --git a/board/quackingstick/board.h b/board/quackingstick/board.h
index 7ad8cd227c..0d412246ec 100644
--- a/board/quackingstick/board.h
+++ b/board/quackingstick/board.h
@@ -116,6 +116,7 @@ void board_set_tcpc_power_mode(int port, int mode);
void base_detect_interrupt(enum gpio_signal signal);
/* motion sensor interrupt */
void motion_interrupt(enum gpio_signal signal);
+void pen_input_interrupt(enum gpio_signal signal);
#endif /* !defined(__ASSEMBLER__) */
diff --git a/board/quackingstick/build.mk b/board/quackingstick/build.mk
index 74b6b95e4d..452abeb591 100644
--- a/board/quackingstick/build.mk
+++ b/board/quackingstick/build.mk
@@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7
CHIP_VARIANT:=npcx7m6fc
BASEBOARD:=trogdor
-board-y=battery.o board.o led.o base_detect.o
+board-y=battery.o board.o led.o base_detect.o usbc_config.o
diff --git a/board/quackingstick/gpio.inc b/board/quackingstick/gpio.inc
index 09983989d2..c126b59977 100644
--- a/board/quackingstick/gpio.inc
+++ b/board/quackingstick/gpio.inc
@@ -39,6 +39,7 @@ GPIO_INT(BASE_DET_L, PIN(3, 7), GPIO_INT_BOTH, base_detect_interrupt) /*
/* Sensor interrupts */
GPIO_INT(ACCEL_GYRO_INT_L, PIN(A, 0), GPIO_INT_FALLING, motion_interrupt) /* Accelerometer/gyro interrupt */
+GPIO_INT(EC_PEN_PDCT_L, PIN(5, 0), GPIO_INT_BOTH, pen_input_interrupt) /* Pen input detect */
/*
* EC_RST_ODL acts as a wake source from hibernate mode. However, it does not
@@ -62,6 +63,7 @@ GPIO(EC_BL_DISABLE_L, PIN(B, 6), GPIO_OUT_LOW) /* Backlight disable sign
/* Base detection */
GPIO(EN_BASE, PIN(0, 4), GPIO_OUT_LOW) /* Enable power to detachable base */
+GPIO(PEN_PWR_EN, PIN(8, 2), GPIO_OUT_LOW) /* Pen input charge */
/* USB-C */
GPIO(USB_C0_PD_RST_L, PIN(F, 1), GPIO_ODR_HIGH) /* Port-0 TCPC chip reset, actaully Open-Drain */
@@ -122,12 +124,10 @@ GPIO(ARM_X86, PIN(6, 6), GPIO_OUT_LOW) /* NC, low for power savin
/* Unused GPIOs, NC. Apply PU for power saving */
UNUSED(PIN(F, 5))
UNUSED(PIN(4, 0))
-UNUSED(PIN(8, 2))
UNUSED(PIN(7, 4))
UNUSED(PIN(7, 3))
UNUSED(PIN(D, 7))
UNUSED(PIN(6, 0))
-UNUSED(PIN(5, 0))
UNUSED(PIN(C, 5))
UNUSED(PIN(3, 0))
UNUSED(PIN(E, 4))
diff --git a/board/quackingstick/usbc_config.c b/board/quackingstick/usbc_config.c
new file mode 100644
index 0000000000..b41eb2ecf1
--- /dev/null
+++ b/board/quackingstick/usbc_config.c
@@ -0,0 +1,98 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "temp_sensor.h"
+#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)
+
+const struct charger_config_t chg_chips[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+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) */
+};
+
+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},
+};
+#define NUM_TEMP_CHG_LEVELS ARRAY_SIZE(temp_chg_table)
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ static int current_level;
+ int charger_temp, charger_temp_c;
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* charge current control depends on temp if the system is on */
+ if (chipset_in_state(CHIPSET_STATE_ON)) {
+ temp_sensor_read(TEMP_SENSOR_SYS2, &charger_temp);
+ charger_temp_c = K_TO_C(charger_temp);
+
+ if (charger_temp_c <= temp_chg_table[current_level].low)
+ current_level--;
+ else if (charger_temp_c >= temp_chg_table[current_level].high)
+ current_level++;
+
+ if (current_level < 0)
+ current_level = 0;
+
+ 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);
+ }
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/quiche/board.c b/board/quiche/board.c
index e49b2e1b1a..76004ee37e 100644
--- a/board/quiche/board.c
+++ b/board/quiche/board.c
@@ -345,6 +345,30 @@ int dock_get_mf_preference(void)
return mf;
}
+static void board_usb_tc_connect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /*
+ * The EC needs to indicate to the MST hub when the host port is
+ * attached. GPIO_UFP_PLUG_DET is used for this purpose.
+ */
+ if (port == USB_PD_PORT_HOST)
+ gpio_set_level(GPIO_UFP_PLUG_DET, 0);
+}
+DECLARE_HOOK(HOOK_USB_PD_CONNECT, board_usb_tc_connect, HOOK_PRIO_DEFAULT);
+
+static void board_usb_tc_disconnect(void)
+{
+ int port = TASK_ID_TO_PD_PORT(task_get_current());
+
+ /* Only the host port disconnect is relevant */
+ if (port == USB_PD_PORT_HOST)
+ gpio_set_level(GPIO_UFP_PLUG_DET, 1);
+}
+DECLARE_HOOK(HOOK_USB_PD_DISCONNECT, board_usb_tc_disconnect, \
+ HOOK_PRIO_DEFAULT);
+
#endif /* SECTION_IS_RW */
static void board_init(void)
diff --git a/board/rainier/board.c b/board/rainier/board.c
index 0f9c388399..15fbfeb8ef 100644
--- a/board/rainier/board.c
+++ b/board/rainier/board.c
@@ -72,7 +72,13 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_I2C1_SCL, 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);
diff --git a/board/rainier/board.h b/board/rainier/board.h
index a323a90889..a980afba50 100644
--- a/board/rainier/board.h
+++ b/board/rainier/board.h
@@ -128,7 +128,7 @@
#define I2C_PORT_TCPC0 1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_MKBP_INPUT_DEVICES
#define CONFIG_MKBP_EVENT
diff --git a/board/rammus/board.c b/board/rammus/board.c
index c4e32a9791..2f45cf6d41 100644
--- a/board/rammus/board.c
+++ b/board/rammus/board.c
@@ -142,11 +142,41 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"i2c_0_0", NPCX_I2C_PORT0_0, 400, GPIO_I2C0_0_SCL, GPIO_I2C0_0_SDA},
- {"i2c_0_1", NPCX_I2C_PORT0_1, 400, GPIO_I2C0_1_SCL, GPIO_I2C0_1_SDA},
- {"i2c_1", NPCX_I2C_PORT1, 100, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"i2c_2", NPCX_I2C_PORT2, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"i2c_3", NPCX_I2C_PORT3, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
+ {
+ .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);
diff --git a/board/rammus/board.h b/board/rammus/board.h
index c084d98fb0..24df8218ca 100644
--- a/board/rammus/board.h
+++ b/board/rammus/board.h
@@ -58,7 +58,7 @@
#define CONFIG_CHIPSET_SKYLAKE
#define CONFIG_CHIPSET_HAS_PLATFORM_PMIC_RESET
#define CONFIG_CHIPSET_RESET_HOOK
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S3
#define CONFIG_HOSTCMD_ESPI_VW_SLP_S4
#define CONFIG_HOSTCMD_FLASH_SPI_INFO
diff --git a/board/redrix/board.h b/board/redrix/board.h
index fa6a5b7dd5..8037a14d41 100644
--- a/board/redrix/board.h
+++ b/board/redrix/board.h
@@ -19,6 +19,9 @@
*/
#define CONFIG_HIBERNATE_PSL_VCC1_RST_WAKEUP
+/* Chipset */
+#define CONFIG_CHIPSET_RESUME_INIT_HOOK
+
/* Sensors */
#define CONFIG_ACCEL_BMA255 /* Lid accel */
#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
@@ -107,6 +110,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
/*
@@ -169,7 +173,7 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan features */
diff --git a/board/redrix/ec.tasklist b/board/redrix/ec.tasklist
index 769b73d365..cfc1fea6ea 100644
--- a/board/redrix/ec.tasklist
+++ b/board/redrix/ec.tasklist
@@ -20,6 +20,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
diff --git a/board/redrix/fw_config.h b/board/redrix/fw_config.h
index 6480f07b35..9a73890f7d 100644
--- a/board/redrix/fw_config.h
+++ b/board/redrix/fw_config.h
@@ -3,8 +3,8 @@
* found in the LICENSE file.
*/
-#ifndef __BOARD_BRYA_FW_CONFIG_H_
-#define __BOARD_BRYA_FW_CONFIG_H_
+#ifndef __BOARD_REDRIX_FW_CONFIG_H_
+#define __BOARD_REDRIX_FW_CONFIG_H_
#include <stdint.h>
@@ -52,4 +52,4 @@ union redrix_cbi_fw_config get_fw_config(void);
*/
bool ec_cfg_has_eps(void);
-#endif /* __BOARD_BRYA_FW_CONFIG_H_ */
+#endif /* __BOARD_REDRIX_FW_CONFIG_H_ */
diff --git a/board/redrix/gpio.inc b/board/redrix/gpio.inc
index 21f8b51ee1..a658ec5927 100644
--- a/board/redrix/gpio.inc
+++ b/board/redrix/gpio.inc
@@ -82,6 +82,7 @@ GPIO(USB_C0_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
GPIO(USB_C1_TCPC_RST_ODL, PIN(A, 0), GPIO_ODR_LOW)
GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
GPIO(PEN_RST_L, PIN(0, 2), GPIO_ODR_HIGH)
+GPIO(LRA_DIS_ODL, PIN(0, 4), GPIO_ODR_HIGH) /* Reserved for disable haptic pad LRA */
/* LED */
GPIO(C0_CHARGE_LED_AMBER_L, PIN(C, 4), GPIO_OUT_HIGH) /* Amber C0 port */
@@ -116,12 +117,11 @@ ALTERNATE(PIN_MASK(4, 0x34), 0, MODULE_ADC, 0) /* GPIO42/ADC3/RI_L
ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
/* 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 */
+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) /* KSI2/GPIO27/TRACEDATA1, KSI3/GPIO26/TRACEDATA0, 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 */
-ALTERNATE(PIN_MASK(8, 0x04), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO14/GPIO82 */
/* PMU alternate functions */
ALTERNATE(PIN_MASK(0, 0x01), 0, MODULE_PMU, GPIO_INT_BOTH | GPIO_HIB_WAKE_HIGH) /* PSL_IN2_L&GPI00/GPIO00 */
@@ -133,6 +133,7 @@ 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)) /* GPO66/ARM_L_x86 */
+UNUSED(PIN(8, 2)) /* KSO14/GPIO82 */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/redrix/i2c.c b/board/redrix/i2c.c
index b993a7978e..5b71c4eb71 100644
--- a/board/redrix/i2c.c
+++ b/board/redrix/i2c.c
@@ -46,7 +46,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C4 C1 TCPC */
.name = "tcpc1",
.port = I2C_PORT_USB_C1_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
},
@@ -62,7 +62,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C6 */
.name = "ppc1,retimer1",
.port = I2C_PORT_USB_C1_PPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_MIX_SCL,
.sda = GPIO_EC_I2C_USB_C1_MIX_SDA,
},
diff --git a/board/redrix/led.c b/board/redrix/led.c
index c794bc8b5f..96ccae2689 100644
--- a/board/redrix/led.c
+++ b/board/redrix/led.c
@@ -174,17 +174,30 @@ static void led_set_battery(void)
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_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))
- led_set_color_battery(LEFT_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);
+ else
+ led_set_color_battery(LEFT_PORT, LED_OFF);
+ }
break;
case PWR_STATE_ERROR:
- set_active_port_color((battery_ticks & 0x1) ?
- LED_WHITE : LED_OFF);
+ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED)) {
+ 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);
+ }
break;
case PWR_STATE_CHARGE_NEAR_FULL:
set_active_port_color(LED_WHITE);
diff --git a/board/redrix/sensors.c b/board/redrix/sensors.c
index 8a92b8825f..df152b8d1c 100644
--- a/board/redrix/sensors.c
+++ b/board/redrix/sensors.c
@@ -72,7 +72,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.98), /* CT */
},
};
@@ -82,39 +82,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(0),
+ .offset = 66, /* 66.47729532 */
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(0.00222243),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0.51877192),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(-0.28664117),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.0586877),
.scale = {
.k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ .cover_scale = ALS_CHANNEL_SCALE(0.61)
}
},
.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(0),
+ .offset = 41, /* 40.95355984 */
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.15384715),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(0.40454969),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(-0.237452),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.13102168),
.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(0),
+ .offset = 5, /* 5.08596128 */
+ .coeff[TCS_RED_COEFF_IDX] = FLOAT_TO_FP(-0.79005309),
+ .coeff[TCS_GREEN_COEFF_IDX] = FLOAT_TO_FP(-0.35553576),
+ .coeff[TCS_BLUE_COEFF_IDX] = FLOAT_TO_FP(0.13997097),
+ .coeff[TCS_CLEAR_COEFF_IDX] = FLOAT_TO_FP(0.40223911),
.scale = {
.k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
- .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ .cover_scale = ALS_CHANNEL_SCALE(1.6)
}
},
- .calibration.irt = INT_TO_FP(1),
+ .calibration.irt = INT_TO_FP(0.41),
.saturation.again = TCS_DEFAULT_AGAIN,
.saturation.atime = TCS_DEFAULT_ATIME,
};
@@ -157,8 +157,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -187,8 +185,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/redrix/thermal.c b/board/redrix/thermal.c
index d35d81b02d..8e1b39a521 100644
--- a/board/redrix/thermal.c
+++ b/board/redrix/thermal.c
@@ -40,44 +40,44 @@ static const struct fan_step *fan_step_table;
static const struct fan_step fan_table_clamshell[] = {
{
/* level 0 */
- .on = {44, 46, 0, -1},
+ .on = {48, 51, 0, -1},
.off = {99, 99, 99, -1},
.rpm = {0, 0},
},
{
/* level 1 */
- .on = {45, 47, 0, -1},
- .off = {44, 46, 99, -1},
+ .on = {49, 52, 0, -1},
+ .off = {48, 51, 99, -1},
.rpm = {4000, 4400},
},
{
/* level 2 */
- .on = {46, 48, 0, -1},
- .off = {45, 47, 99, -1},
+ .on = {50, 53, 0, -1},
+ .off = {49, 52, 99, -1},
.rpm = {4700, 5000},
},
{
/* level 3 */
- .on = {47, 49, 0, -1},
- .off = {46, 48, 99, -1},
- .rpm = {5000, 5400},
+ .on = {51, 54, 0, -1},
+ .off = {50, 53, 99, -1},
+ .rpm = {5100, 5400},
},
{
/* level 4 */
- .on = {48, 50, 50, -1},
- .off = {47, 49, 48, -1},
+ .on = {52, 55, 53, -1},
+ .off = {51, 54, 51, -1},
.rpm = {5300, 5600},
},
{
/* level 5 */
- .on = {49, 51, 52, -1},
- .off = {48, 50, 50, -1},
+ .on = {53, 56, 55, -1},
+ .off = {52, 55, 53, -1},
.rpm = {5700, 6000},
},
{
/* level 6 */
.on = {100, 100, 100, -1},
- .off = {49, 51, 52, -1},
+ .off = {53, 56, 55, -1},
.rpm = {6200, 6400},
},
};
@@ -85,44 +85,44 @@ static const struct fan_step fan_table_clamshell[] = {
static const struct fan_step fan_table_tablet[] = {
{
/* level 0 */
- .on = {44, 46, 0, -1},
+ .on = {50, 53, 0, -1},
.off = {99, 99, 99, -1},
.rpm = {0, 0},
},
{
/* level 1 */
- .on = {45, 47, 0, -1},
- .off = {44, 46, 99, -1},
- .rpm = {4200, 4400},
+ .on = {51, 54, 0, -1},
+ .off = {50, 53, 99, -1},
+ .rpm = {4200, 4300},
},
{
/* level 2 */
- .on = {46, 48, 0, -1},
- .off = {45, 47, 99, -1},
+ .on = {52, 55, 0, -1},
+ .off = {51, 54, 99, -1},
.rpm = {4700, 4900},
},
{
/* level 3 */
- .on = {47, 49, 0, -1},
- .off = {46, 48, 99, -1},
+ .on = {53, 56, 0, -1},
+ .off = {52, 55, 99, -1},
.rpm = {5000, 5300},
},
{
/* level 4 */
- .on = {48, 50, 50, -1},
- .off = {47, 49, 48, -1},
+ .on = {54, 57, 55, -1},
+ .off = {53, 56, 53, -1},
.rpm = {5200, 5500},
},
{
/* level 5 */
- .on = {49, 51, 52, -1},
- .off = {48, 50, 50, -1},
+ .on = {55, 58, 57, -1},
+ .off = {54, 57, 55, -1},
.rpm = {5700, 5900},
},
{
/* level 6 */
.on = {100, 100, 100, -1},
- .off = {49, 51, 52, -1},
+ .off = {55, 58, 57, -1},
.rpm = {6100, 6300},
},
};
diff --git a/board/redrix/usbc_config.c b/board/redrix/usbc_config.c
index 00b6589a46..aae3a4493b 100644
--- a/board/redrix/usbc_config.c
+++ b/board/redrix/usbc_config.c
@@ -208,12 +208,16 @@ static void board_tcpc_init(void)
int i;
/* Don't reset TCPCs after initial reset */
- if (!system_jumped_late()) {
+ if (!system_jumped_late())
board_reset_pd_mcu();
- for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; ++i)
- ioex_init(i);
- }
+ /*
+ * These IO expander pins are implemented using the
+ * C0/C1 TCPCs, so they must be set up after the TCPCs has
+ * been taken out of reset.
+ */
+ for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; ++i)
+ ioex_init(i);
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
diff --git a/board/reef/board.c b/board/reef/board.c
index ed8e83d0a8..92ff6a7764 100644
--- a/board/reef/board.c
+++ b/board/reef/board.c
@@ -147,16 +147,41 @@ const struct pwm_t pwm_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", NPCX_I2C_PORT0_0, 400,
- GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", NPCX_I2C_PORT0_1, 400,
- GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA},
- {"accelgyro", I2C_PORT_GYRO, 400,
- GPIO_EC_I2C_GYRO_SCL, GPIO_EC_I2C_GYRO_SDA},
- {"sensors", NPCX_I2C_PORT2, 400,
- GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA},
- {"batt", NPCX_I2C_PORT3, 100,
- GPIO_EC_I2C_POWER_SCL, GPIO_EC_I2C_POWER_SDA},
+ {
+ .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);
diff --git a/board/reef/board.h b/board/reef/board.h
index 6b05bbc1ed..00544f7bf9 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -102,7 +102,7 @@
#define CONFIG_USBC_VCONN_SWAP
/* SoC / PCH */
-#define CONFIG_HOSTCMD_LPC
+#define CONFIG_HOST_INTERFACE_LPC
#define CONFIG_CHIPSET_APOLLOLAKE
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_POWER_BUTTON
diff --git a/board/reef/gpio.inc b/board/reef/gpio.inc
index 5bf83f88bc..f508d7a84e 100644
--- a/board/reef/gpio.inc
+++ b/board/reef/gpio.inc
@@ -67,7 +67,8 @@ GPIO(EC_I2C_POWER_SCL, PIN(D, 1), GPIO_INPUT)
* Pin 57 (SER_IRQ) defaults to LPC mode, but we also have EC_PCH_KB_INT_ODL
* (Pin B0) in case it doesn't work (Set CONFIG_KEYBOARD_IRQ_GPIO in this case).
*
- * See also the NO_LPC_ESPI bit in DEVALT1 and the CONFIG_HOSTCMD_SHI option.
+ * See also the NO_LPC_ESPI bit in DEVALT1 and the
+ * CONFIG_HOST_INTERFACE_SHI option.
*/
GPIO(PCH_SMI_L, PIN(A, 6), GPIO_ODR_HIGH | GPIO_SEL_1P8V) /* EC_SMI_ODL */
diff --git a/board/reef_it8320/board.c b/board/reef_it8320/board.c
index 92fdc66806..db5bf728fd 100644
--- a/board/reef_it8320/board.c
+++ b/board/reef_it8320/board.c
@@ -66,10 +66,20 @@ const struct adc_t adc_channels[] = {
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
const struct i2c_port_t i2c_ports[] = {
- {"mux", IT83XX_I2C_CH_C, 400,
- GPIO_EC_I2C_C_SCL, GPIO_EC_I2C_C_SDA},
- {"batt", IT83XX_I2C_CH_E, 100,
- GPIO_EC_I2C_E_SCL, GPIO_EC_I2C_E_SDA},
+ {
+ .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);
@@ -111,7 +121,8 @@ const enum gpio_signal hibernate_wake_pins[] = {
const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
static void it83xx_tcpc_update_hpd_status(const struct usb_mux *me,
- mux_state_t mux_state)
+ mux_state_t mux_state,
+ bool *ack_required)
{
int hpd_lvl = (mux_state & USB_PD_MUX_HPD_LVL) ? 1 : 0;
int hpd_irq = (mux_state & USB_PD_MUX_HPD_IRQ) ? 1 : 0;
@@ -119,6 +130,9 @@ static void it83xx_tcpc_update_hpd_status(const struct usb_mux *me,
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;
+
hpd_lvl = !hpd_lvl;
gpio_set_level(gpio, hpd_lvl);
diff --git a/board/reef_it8320/board.h b/board/reef_it8320/board.h
index 3598aee233..cf29faa8f8 100644
--- a/board/reef_it8320/board.h
+++ b/board/reef_it8320/board.h
@@ -99,7 +99,7 @@
#define CONFIG_USBC_VCONN_SWAP
/* SoC / PCH */
-#define CONFIG_HOSTCMD_LPC
+#define CONFIG_HOST_INTERFACE_LPC
#define CONFIG_CHIPSET_APOLLOLAKE
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_POWER_BUTTON
diff --git a/board/reef_it8320/gpio.inc b/board/reef_it8320/gpio.inc
index 9882065d50..ac2fbf486e 100644
--- a/board/reef_it8320/gpio.inc
+++ b/board/reef_it8320/gpio.inc
@@ -20,7 +20,7 @@ GPIO_INT(PCH_SLP_S0_L, PIN(B, 7), GPIO_INT_BOTH, power_signal_interrupt) /*
#endif
GPIO_INT(SUSPWRDNACK, PIN(E, 1), GPIO_INT_BOTH, power_signal_interrupt) /* SUSPWRNACK */
GPIO_INT(LID_OPEN, PIN(E, 2), GPIO_INT_BOTH, lid_interrupt) /* LID_OPEN */
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(PCH_PLTRST_L, PIN(E, 3), GPIO_INT_BOTH | GPIO_PULL_UP, lpcrst_interrupt) /* PLT_RST_L */
#endif
GPIO_INT(POWER_BUTTON_L, PIN(E, 4), GPIO_INT_BOTH, power_button_interrupt) /* MECH_PWR_BTN_ODL */
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index b934264510..be24f34aa8 100644
--- a/board/reef_mchp/board.c
+++ b/board/reef_mchp/board.c
@@ -205,16 +205,41 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
* 400 to 100 kHz.
*/
const struct i2c_port_t i2c_ports[] = {
- {"tcpc0", MCHP_I2C_PORT0, 400,
- GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", MCHP_I2C_PORT2, 400,
- GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA},
- {"accelgyro", I2C_PORT_GYRO, 400,
- GPIO_EC_I2C_GYRO_SCL, GPIO_EC_I2C_GYRO_SDA},
- {"sensors", MCHP_I2C_PORT7, 400,
- GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA},
- {"batt", MCHP_I2C_PORT3, 100,
- GPIO_EC_I2C_POWER_SCL, GPIO_EC_I2C_POWER_SDA},
+ {
+ .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);
diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h
index 5e31c5de98..5ae0cdf214 100644
--- a/board/reef_mchp/board.h
+++ b/board/reef_mchp/board.h
@@ -104,7 +104,7 @@
#define CONFIG_USBC_VCONN_SWAP
/* SoC / PCH */
-#define CONFIG_HOSTCMD_LPC
+#define CONFIG_HOST_INTERFACE_LPC
#define CONFIG_CHIPSET_APOLLOLAKE
#define CONFIG_CHIPSET_RESET_HOOK
#define CONFIG_POWER_BUTTON
diff --git a/board/reef_mchp/gpio.inc b/board/reef_mchp/gpio.inc
index 0385d82102..3274af3bff 100644
--- a/board/reef_mchp/gpio.inc
+++ b/board/reef_mchp/gpio.inc
@@ -84,7 +84,8 @@ GPIO(EC_I2C_POWER_SCL, PIN(010), GPIO_INPUT)
* Pin 57 (SER_IRQ) defaults to LPC mode, but we also have EC_PCH_KB_INT_ODL
* (Pin B0) in case it doesn't work (Set CONFIG_KEYBOARD_IRQ_GPIO in this case).
*
- * See also the NO_LPC_ESPI bit in DEVALT1 and the CONFIG_HOSTCMD_SHI option.
+ * See also the NO_LPC_ESPI bit in DEVALT1 and the
+ * CONFIG_HOST_INTERFACE_SHI option.
*/
GPIO(PCH_SMI_L, PIN(0227), GPIO_ODR_HIGH | GPIO_SEL_1P8V) /* EC_SMI_ODL */
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index f109d0ada3..3120ef1efb 100644
--- a/board/scarlet/board.c
+++ b/board/scarlet/board.c
@@ -75,8 +75,20 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"charger", I2C_PORT_CHARGER, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_I2C1_SCL, 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);
diff --git a/board/scarlet/board.h b/board/scarlet/board.h
index f8d1ba7011..8d810d3217 100644
--- a/board/scarlet/board.h
+++ b/board/scarlet/board.h
@@ -10,6 +10,7 @@
/* Free up flash space */
#define CONFIG_DEBUG_ASSERT_BRIEF
+#define CONFIG_LTO
#define CONFIG_USB_PD_DEBUG_LEVEL 0
/* Optional modules */
@@ -61,7 +62,6 @@
#undef CONFIG_HOSTCMD_DEBUG_MODE
#define CONFIG_HOSTCMD_DEBUG_MODE HCDEBUG_OFF
#undef CONFIG_LID_SWITCH
-#undef CONFIG_LTO
#define CONFIG_POWER_BUTTON
#define CONFIG_POWER_BUTTON_IGNORE_LID
#define CONFIG_POWER_TRACK_HOST_SLEEP_STATE
@@ -186,7 +186,7 @@
#define VIRTUAL_BATTERY_ADDR_FLAGS 0x0B
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master port (SPI2) */
+#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI controller port (SPI2) */
#define CONFIG_MKBP_INPUT_DEVICES
#define CONFIG_MKBP_EVENT
diff --git a/board/scout/board.c b/board/scout/board.c
index d45b627ce1..8c9de5da64 100644
--- a/board/scout/board.c
+++ b/board/scout/board.c
@@ -233,12 +233,48 @@ const struct pwm_t pwm_channels[] = {
/******************************************************************************/
/* I2C port map configuration */
const struct i2c_port_t i2c_ports[] = {
- {"ina", I2C_PORT_INA, 400, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"ppc0", I2C_PORT_PPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"scaler", I2C_PORT_SCALER, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"power", I2C_PORT_POWER, 400, GPIO_I2C5_SCL, GPIO_I2C5_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_I2C7_SCL, 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);
@@ -320,8 +356,8 @@ const struct fan_conf fan_conf_0 = {
};
const struct fan_rpm fan_rpm_0 = {
- .rpm_min = 2500,
- .rpm_start = 2500,
+ .rpm_min = 2400,
+ .rpm_start = 2400,
.rpm_max = 5300,
};
@@ -519,6 +555,8 @@ void board_enable_s0_rails(int enable)
gpio_set_level(GPIO_EC_CAM_V3P3_EN, enable);
gpio_set_level(GPIO_PP3300_TPU_A_EN, enable);
+
+ gpio_set_level(GPIO_EN_LOAD_SWITCH, enable);
}
int ec_config_get_usb4_present(void)
diff --git a/board/scout/board.h b/board/scout/board.h
index 5a09624b15..67b9c3bdeb 100644
--- a/board/scout/board.h
+++ b/board/scout/board.h
@@ -38,7 +38,7 @@
#define CONFIG_MKBP_USE_HOST_EVENT
#undef CONFIG_KEYBOARD_RUNTIME_KEYS
#undef CONFIG_HIBERNATE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#define CONFIG_LED_COMMON
#undef CONFIG_LID_SWITCH
#define CONFIG_LTO
@@ -123,7 +123,7 @@
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 0
#define CONFIG_TEMP_SENSOR
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_ROA_RAILS
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
#define CONFIG_THROTTLE_AP
@@ -256,6 +256,7 @@ unsigned int ec_config_get_thermal_solution(void);
#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
/*
diff --git a/board/scout/gpio.inc b/board/scout/gpio.inc
index 583e4159bd..fa3530a401 100644
--- a/board/scout/gpio.inc
+++ b/board/scout/gpio.inc
@@ -60,7 +60,7 @@ GPIO_INT(USB_A3_OC_ODL, PIN(0, 3), GPIO_INT_BOTH, port_ocp_interrupt)
GPIO(EC_PCH_PWROK, PIN(0, 5), GPIO_OUT_LOW)
GPIO(EC_PCH_SYS_PWROK, PIN(3, 7), GPIO_OUT_LOW)
GPIO(EC_PCH_PWR_BTN_ODL, PIN(C, 1), GPIO_ODR_HIGH)
-GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_ODR_HIGH)
+GPIO(EC_PCH_RTCRST, PIN(7, 6), GPIO_OUT_LOW)
GPIO(EC_PCH_WAKE_ODL, PIN(7, 4), GPIO_ODR_HIGH)
GPIO(EC_PROCHOT_IN_OD, PIN(3, 4), GPIO_INPUT)
GPIO(EC_PROCHOT_ODL, PIN(6, 3), GPIO_ODR_HIGH)
@@ -87,6 +87,7 @@ GPIO(EC_MX8M_ONOFF, PIN(9, 3), GPIO_OUT_LOW)
GPIO(EC_SCALER_EN, PIN(E, 0), GPIO_OUT_LOW)
GPIO(PP3300_TPU_A_EN, PIN(B, 0), GPIO_OUT_LOW)
GPIO(PWR_CTRL, PIN(6, 2), GPIO_OUT_LOW)
+GPIO(EN_LOAD_SWITCH, PIN(4, 2), GPIO_OUT_LOW)
/* Barreljack */
GPIO(EN_PPVAR_BJ_ADP_L, PIN(0, 4), GPIO_OUT_LOW)
@@ -143,7 +144,7 @@ ALTERNATE(PIN_MASK(B, 0x80), 0, MODULE_PWM, 0) /* PWM5 - Fan 1
ALTERNATE(PIN_MASK(7, 0x08), 0, MODULE_PWM, 0) /* TA2 - Fan Tachometer */
/* ADC */
-ALTERNATE(PIN_MASK(4, 0x3E), 0, MODULE_ADC, 0) /* ADC0, ADC1, ADC2, ADC4 */
+ALTERNATE(PIN_MASK(4, 0x3A), 0, MODULE_ADC, 0) /* ADC0, ADC1, ADC2, ADC4 */
ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* ADC7 */
ALTERNATE(PIN_MASK(F, 0x01), 0, MODULE_ADC, 0) /* ADC9 */
@@ -154,7 +155,6 @@ ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* UART from EC
UNUSED(PIN(1, 3)) /* EC_GP_SEL1_ODL */
UNUSED(PIN(C, 0)) /* FAN_PWM_2 */
UNUSED(PIN(8, 0)) /* LED_BLUE_L */
-UNUSED(PIN(4, 2)) /* ADC3/TEMP_SENSOR_3 */
UNUSED(PIN(C, 2)) /* A12 NC */
UNUSED(PIN(1, 2)) /* C6 NC */
UNUSED(PIN(6, 6)) /* H4 NC */
diff --git a/board/scout/led.c b/board/scout/led.c
index a9f70d2d40..3066c182d1 100644
--- a/board/scout/led.c
+++ b/board/scout/led.c
@@ -199,6 +199,16 @@ static void led_init(void)
}
DECLARE_HOOK(HOOK_INIT, led_init, HOOK_PRIO_INIT_PWM + 1);
+void board_led_auto_control(void)
+{
+ 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 led_alert(int enable)
{
if (enable) {
diff --git a/board/servo_micro/board.c b/board/servo_micro/board.c
index 8074ba38ab..f82376a15a 100644
--- a/board/servo_micro/board.c
+++ b/board/servo_micro/board.c
@@ -314,6 +314,7 @@ const void *const usb_strings[] = {
[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"),
@@ -372,8 +373,13 @@ USB_SPI_CONFIG(usb_spi, USB_IFACE_SPI, USB_EP_SPI, 0);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100,
- GPIO_MASTER_I2C_SCL, 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);
diff --git a/board/servo_micro/board.h b/board/servo_micro/board.h
index 306bc0e5d7..1983ee13e3 100644
--- a/board/servo_micro/board.h
+++ b/board/servo_micro/board.h
@@ -76,7 +76,7 @@
/* Enable control of SPI over USB */
#define CONFIG_USB_SPI
#define CONFIG_SPI_CONTROLLER
-#define CONFIG_SPI_FLASH_PORT 0 /* First SPI master 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
@@ -120,6 +120,7 @@ enum usb_strings {
USB_STR_PRODUCT,
USB_STR_SERIALNO,
USB_STR_VERSION,
+ USB_STR_SPI_NAME,
USB_STR_I2C_NAME,
USB_STR_USART4_STREAM_NAME,
USB_STR_CONSOLE_NAME,
diff --git a/board/servo_v4/board.c b/board/servo_v4/board.c
index 8540de710f..b304408f74 100644
--- a/board/servo_v4/board.c
+++ b/board/servo_v4/board.c
@@ -298,8 +298,13 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100,
- GPIO_MASTER_I2C_SCL, 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);
diff --git a/board/servo_v4p1/board.c b/board/servo_v4p1/board.c
index d9d48a42ce..3284b4ef58 100644
--- a/board/servo_v4p1/board.c
+++ b/board/servo_v4p1/board.c
@@ -65,6 +65,26 @@ static void tca_evt(enum gpio_signal signal)
irq_ioexpanders();
}
+/*
+ * TUSB1064 set mux board tuning.
+ * Adds in board specific gain and DP lane count configuration
+ */
+static int board_tusb1064_dp_rx_eq_set(const struct usb_mux *me,
+ mux_state_t mux_state)
+{
+ int rv = EC_SUCCESS;
+
+ /*
+ * Apply 10dB gain. Note, this value is selected to match the gain that
+ * would be set by default if the 2 GPIO gain set pins are left
+ * floating.
+ */
+ if (mux_state & USB_PD_MUX_DP_ENABLED)
+ rv = tusb1064_set_dp_rx_eq(me, TUSB1064_DP_EQ_RX_10_0_DB);
+
+ 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 */
@@ -72,6 +92,7 @@ const struct usb_mux usb_muxes[CONFIG_USB_PD_PORT_MAX_COUNT] = {
.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,
}
};
@@ -380,8 +401,13 @@ BUILD_ASSERT(ARRAY_SIZE(usb_strings) == USB_STR_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100,
- GPIO_MASTER_I2C_SCL, 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);
diff --git a/board/shuboz/board.c b/board/shuboz/board.c
index 3008434ea4..615193b8f4 100644
--- a/board/shuboz/board.c
+++ b/board/shuboz/board.c
@@ -153,7 +153,6 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &bmi160_drv,
.mutex = &g_base_mutex,
.drv_data = &g_bmi160_data,
- .int_signal = GPIO_6AXIS_INT_L,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
diff --git a/board/spherion/board.c b/board/spherion/board.c
index 1119b1f077..95fa0a06de 100644
--- a/board/spherion/board.c
+++ b/board/spherion/board.c
@@ -105,10 +105,15 @@ 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)
+ if (board_get_sub_board() == SUB_BOARD_TYPEC) {
ps8743_tune_usb_eq(&usb_muxes[1],
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);
+ }
}
DECLARE_HOOK(HOOK_INIT, board_usb_mux_init, HOOK_PRIO_INIT_I2C + 1);
diff --git a/board/stern/board.c b/board/stern/board.c
index 609dfdf7e5..53690e8c94 100644
--- a/board/stern/board.c
+++ b/board/stern/board.c
@@ -67,13 +67,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 100, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -139,8 +158,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/stern/board.h b/board/stern/board.h
index 5bf23a6733..f682f2bb2b 100644
--- a/board/stern/board.h
+++ b/board/stern/board.h
@@ -85,7 +85,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/stm32f446e-eval/board.c b/board/stm32f446e-eval/board.c
index f4cf28898c..fd6ff8bbe2 100644
--- a/board/stm32f446e-eval/board.c
+++ b/board/stm32f446e-eval/board.c
@@ -43,10 +43,20 @@ struct dwc_usb usb_ctl = {
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"i2c1", I2C_PORT_0, 100,
- GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"fmpi2c4", FMPI2C_PORT_3, 100,
- GPIO_FMPI2C_SCL, 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);
diff --git a/board/stm32l476g-eval/board.c b/board/stm32l476g-eval/board.c
index c7ebc2c6b8..70375abe95 100644
--- a/board/stm32l476g-eval/board.c
+++ b/board/stm32l476g-eval/board.c
@@ -33,7 +33,13 @@ DECLARE_HOOK(HOOK_TICK, tick_event, HOOK_PRIO_DEFAULT);
#ifdef CTS_MODULE_I2C
const struct i2c_port_t i2c_ports[] = {
- {"test", STM32_I2C2_PORT, 100, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
+ {
+ .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/storo/battery.c b/board/storo/battery.c
index d273b391e7..b28e5bbf37 100644
--- a/board/storo/battery.c
+++ b/board/storo/battery.c
@@ -32,8 +32,8 @@
* address, mask, and disconnect value need to be provided.
*/
const struct board_batt_params board_battery_info[] = {
- /* C21N2018 Battery Information */
- [BATTERY_C21N2018] = {
+ /* C21N2018_AS3GXXD3KA Battery Information */
+ [BATTERY_AS3GXXD3KA] = {
.fuel_gauge = {
.manuf_name = "AS3GXXD3KA",
.device_name = "C110160",
@@ -61,8 +61,39 @@ const struct board_batt_params board_battery_info[] = {
.discharging_min_c = -20,
.discharging_max_c = 60,
},
+ },
+
+ /* C21N2018_AS3FXXD3KA Battery Information */
+ [BATTERY_AS3FXXD3KA] = {
+ .fuel_gauge = {
+ .manuf_name = "AS3FXXD3KA",
+ .device_name = "C110160",
+ .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 = 8800,
+ .voltage_normal = 7890, /* 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 = 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_C21N2018;
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_AS3GXXD3KA;
diff --git a/board/storo/board.c b/board/storo/board.c
index f864d230c2..280a85fd99 100644
--- a/board/storo/board.c
+++ b/board/storo/board.c
@@ -462,10 +462,6 @@ int board_set_active_charge_port(int port)
old_port = charge_manager_get_active_charge_port();
- /* If the port is not changing, we should do nothing */
- if (old_port == port)
- return EC_SUCCESS;
-
CPRINTS("New chg p%d", port);
/* Disable all ports. */
@@ -503,7 +499,7 @@ int board_set_active_charge_port(int port)
* 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 ((old_port != CHARGE_PORT_NONE) && (old_port != port))
charger_discharge_on_ac(1);
/* Enable requested charge port. */
diff --git a/board/storo/board.h b/board/storo/board.h
index cb738e8245..3ee8791e80 100644
--- a/board/storo/board.h
+++ b/board/storo/board.h
@@ -141,7 +141,8 @@ enum temp_sensor_id {
/* List of possible batteries */
enum battery_type {
- BATTERY_C21N2018,
+ BATTERY_AS3GXXD3KA,
+ BATTERY_AS3FXXD3KA,
BATTERY_TYPE_COUNT,
};
diff --git a/board/stryke/board.h b/board/stryke/board.h
index d84a09fe36..3ad04aad96 100644
--- a/board/stryke/board.h
+++ b/board/stryke/board.h
@@ -16,7 +16,7 @@
#define CONFIG_LED_COMMON
#define CONFIG_LOW_POWER_IDLE
-#define CONFIG_HOSTCMD_ESPI
+#define CONFIG_HOST_INTERFACE_ESPI
#undef CONFIG_UART_TX_BUF_SIZE
#define CONFIG_UART_TX_BUF_SIZE 4096
@@ -81,7 +81,8 @@
#define CONFIG_FANS 1
#undef CONFIG_FAN_INIT_SPEED
#define CONFIG_FAN_INIT_SPEED 50
-#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_EN_A_RAILS
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_TEMP_SENSOR_POWER
#define CONFIG_THERMISTOR
#define CONFIG_THROTTLE_AP
#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
@@ -108,6 +109,7 @@
#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__
diff --git a/board/sweetberry/board.c b/board/sweetberry/board.c
index 66b21a81b9..bee8f91a22 100644
--- a/board/sweetberry/board.c
+++ b/board/sweetberry/board.c
@@ -59,14 +59,34 @@ struct dwc_usb usb_ctl = {
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"i2c1", I2C_PORT_0, 400,
- GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"i2c2", I2C_PORT_1, 400,
- GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"i2c3", I2C_PORT_2, 400,
- GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"fmpi2c4", FMPI2C_PORT_3, 900,
- GPIO_FMPI2C_SCL, 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);
diff --git a/board/taeko/board.c b/board/taeko/board.c
index c3b496d9ce..6fb96f7d21 100644
--- a/board/taeko/board.c
+++ b/board/taeko/board.c
@@ -5,7 +5,9 @@
#include "battery.h"
#include "button.h"
+#include "charge_manager.h"
#include "charge_ramp.h"
+#include "charge_state_v2.h"
#include "charger.h"
#include "common.h"
#include "compile_time_macros.h"
@@ -109,3 +111,17 @@ 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;
}
+
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ /*
+ * Follow OEM request to limit the input current to
+ * 95% negotiated limit.
+ */
+ charge_ma = charge_ma * 95 / 100;
+
+ 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 66905bb82d..5ba767bdb9 100644
--- a/board/taeko/board.h
+++ b/board/taeko/board.h
@@ -19,6 +19,7 @@
#include "baseboard.h"
#define CONFIG_SYSTEM_UNLOCKED
+#define CONFIG_BYPASS_CBI_EEPROM_WP_CHECK
/*
* This will happen automatically on NPCX9 ES2 and later. Do not remove
@@ -91,6 +92,12 @@
#define CONFIG_USBC_PPC_SYV682X
#define CONFIG_USBC_PPC_NX20P3483
+/* I2C speed console command */
+#define CONFIG_CMD_I2C_SPEED
+
+/* I2C control host command */
+#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 */
@@ -104,6 +111,9 @@
#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
+
/*
* 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
@@ -122,6 +132,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_L
/*
@@ -162,7 +173,7 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
/* Fan */
@@ -171,10 +182,30 @@
/* Charger defines */
#define CONFIG_CHARGER_BQ25720
#define CONFIG_CHARGER_BQ25720_VSYS_TH2_CUSTOM
-#define CONFIG_CHARGER_BQ25720_VSYS_TH2_DV 70
+/* 37h BIT7:2 VSYS_TH2 6.0V */
+#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
+/* 30h BIT13:12 Enable PSYS 00b */
+#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
+/* 31h BIT3 = 1 Enable ACOC */
+#define CONFIG_CHARGER_BQ25710_EN_ACOC
+/* 33h BIT15:11 ILIM2 TH 140% */
+#define CONFIG_CHARGER_BQ257X0_ILIM2_VTH_CUSTOM
+#define CONFIG_CHARGER_BQ257X0_ILIM2_VTH \
+ BQ257X0_PROCHOT_OPTION_0_ILIM2_VTH__1P40
+/* 34h BIT0 CONFIG_CHARGER_BQ25710_PP_ACOK */
+#define CONFIG_CHARGER_BQ25710_PP_ACOK
+/* 34h BIT3 and BIT15:10 IDCHG 9728mA, step is 512mA */
+#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 9728
+/* 36h UVP 5600mV */
+#define CONFIG_CHARGER_BQ25720_VSYS_UVP_CUSTOM
+#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__
diff --git a/board/taeko/ec.tasklist b/board/taeko/ec.tasklist
index 41d86da3d6..6d995d6b44 100644
--- a/board/taeko/ec.tasklist
+++ b/board/taeko/ec.tasklist
@@ -19,6 +19,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
diff --git a/board/taeko/gpio.inc b/board/taeko/gpio.inc
index 7e97007af6..583efc308c 100644
--- a/board/taeko/gpio.inc
+++ b/board/taeko/gpio.inc
@@ -73,7 +73,7 @@ GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
GPIO(USB_C0_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_ODL, PIN(0, 2), GPIO_ODR_LOW)
+GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), GPIO_ODR_HIGH)
GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
/* UART alternate functions */
@@ -120,6 +120,7 @@ UNUSED(PIN(3, 2)) /* GPO32/TRIS_L */
UNUSED(PIN(3, 5)) /* GPO35/CR_SOUT4/TEST_L */
UNUSED(PIN(4, 1)) /* GPIO41/ADC4 */
UNUSED(PIN(6, 6)) /* GPIO66 */
+UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/taeko/i2c.c b/board/taeko/i2c.c
index 0a32a502ab..2c990254fa 100644
--- a/board/taeko/i2c.c
+++ b/board/taeko/i2c.c
@@ -38,9 +38,10 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C4 C1 TCPC */
.name = "tcpc1",
.port = I2C_PORT_USB_C1_TCPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
.sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
},
{
/* I2C5 */
@@ -54,7 +55,7 @@ const struct i2c_port_t i2c_ports[] = {
/* I2C6 */
.name = "ppc1",
.port = I2C_PORT_USB_C1_PPC,
- .kbps = 400,
+ .kbps = 1000,
.scl = GPIO_EC_I2C_USB_C1_MIX_SCL,
.sda = GPIO_EC_I2C_USB_C1_MIX_SDA,
},
diff --git a/board/taeko/sensors.c b/board/taeko/sensors.c
index b5d75460fe..f12e2a9f94 100644
--- a/board/taeko/sensors.c
+++ b/board/taeko/sensors.c
@@ -67,21 +67,24 @@ static struct accelgyro_saved_data_t g_bma422_data;
static struct lsm6dso_data lsm6dso_data;
static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
-/* TODO(b/201504044): calibrate the orientation matrix on later board stage */
-#if 0
-static const mat33_fp_t lid_standard_ref = {
+/* 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},
- { FLOAT_TO_FP(1), 0, 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 base_standard_ref = {
- { FLOAT_TO_FP(1), 0, 0},
- { 0, FLOAT_TO_FP(-1), 0},
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, FLOAT_TO_FP(1), 0},
{ 0, 0, FLOAT_TO_FP(-1)}
};
-#endif
-
struct motion_sensor_t bma422_lid_accel = {
.name = "Lid Accel - BMA",
@@ -94,7 +97,7 @@ struct motion_sensor_t bma422_lid_accel = {
.drv_data = &g_bma422_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY, /* 0x18 */
- .rot_standard_ref = NULL, /* identity matrix */
+ .rot_standard_ref = &lid_standard_ref, /* identity matrix */
.default_range = 2, /* g, enough for laptop. */
.min_frequency = BMA4_ACCEL_MIN_FREQ,
.max_frequency = BMA4_ACCEL_MAX_FREQ,
@@ -122,11 +125,9 @@ struct motion_sensor_t lsm6dsm_base_accel = {
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
@@ -153,12 +154,10 @@ struct motion_sensor_t lsm6dsm_base_gyro = {
.drv = &lsm6dsm_drv,
.mutex = &g_base_accel_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSM_ODR_MIN_VAL,
.max_frequency = LSM6DSM_ODR_MAX_VAL,
};
@@ -173,11 +172,9 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lis2dw12_drv,
.mutex = &g_lid_accel_mutex,
.drv_data = &g_lis2dw12_data,
- .int_signal = GPIO_EC_ACCEL_INT_R_L,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LIS2DW12_ADDR1, /* 0x19 */
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .rot_standard_ref = NULL, /* identity matrix */
+ .rot_standard_ref = &lid_standard_ref, /* identity matrix */
.default_range = 2, /* g */
.min_frequency = LIS2DW12_ODR_MIN_VAL,
.max_frequency = LIS2DW12_ODR_MAX_VAL,
@@ -202,11 +199,9 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lsm6dso_drv,
.mutex = &g_base_accel_mutex,
.drv_data = &lsm6dso_data,
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
.min_frequency = LSM6DSO_ODR_MIN_VAL,
.max_frequency = LSM6DSO_ODR_MAX_VAL,
@@ -231,12 +226,10 @@ struct motion_sensor_t motion_sensors[] = {
.drv = &lsm6dso_drv,
.mutex = &g_base_accel_mutex,
.drv_data = &lsm6dso_data,
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
- .rot_standard_ref = NULL,
+ .rot_standard_ref = &base_standard_ref,
.min_frequency = LSM6DSO_ODR_MIN_VAL,
.max_frequency = LSM6DSO_ODR_MAX_VAL,
},
@@ -287,6 +280,11 @@ static void board_detect_motionsensor(void)
* we don't use INT1. Keep this pin as input w/o enable
* interrupt.
*/
+ if (get_board_id() >= 2) {
+ /* Need to change matrix when board ID >= 2 */
+ bma422_lid_accel.rot_standard_ref =
+ &lid_ref_for_new_DB;
+ }
return;
}
@@ -322,6 +320,12 @@ static void baseboard_sensors_init(void)
motion_sensors[BASE_GYRO] = lsm6dsm_base_gyro;
}
+ 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;
+ }
+
/* Enable gpio interrupt for base accelgyro sensor */
gpio_enable_interrupt(GPIO_EC_IMU_INT_R_L);
} else {
diff --git a/board/taeko/usbc_config.c b/board/taeko/usbc_config.c
index c8e02581be..4cdb29b779 100644
--- a/board/taeko/usbc_config.c
+++ b/board/taeko/usbc_config.c
@@ -6,6 +6,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include "battery.h"
#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
@@ -64,7 +65,8 @@ const struct tcpc_config_t tcpc_config[] = {
},
.drv = &ps8xxx_tcpm_drv,
.flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V,
+ TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
+ TCPC_FLAGS_CONTROL_VCONN,
},
};
BUILD_ASSERT(ARRAY_SIZE(tcpc_config) == USBC_PORT_COUNT);
@@ -168,6 +170,11 @@ static void ps8815_reset(void)
if (i2c_read8(I2C_PORT_USB_C1_TCPC,
PS8751_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,
PS8751_I2C_ADDR1_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
@@ -235,7 +242,15 @@ void board_reset_pd_mcu(void)
*/
gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 0);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+
+ /*
+ * (b/202489681): Nx20p3483 cannot sink power after reset ec
+ * To avoid nx20p3483 cannot sink power after reset ec w/ AC
+ * only in TCPC1 port, EC shouldn't assert GPIO_USB_C1_RT_RST_R_ODL
+ * if no battery.
+ */
+ if (battery_hw_present())
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
/*
* delay for power-on to reset-off and min. assertion time
diff --git a/board/taniks/battery.c b/board/taniks/battery.c
new file mode 100644
index 0000000000..61de7bcf80
--- /dev/null
+++ b/board/taniks/battery.c
@@ -0,0 +1,103 @@
+/* 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.
+ *
+ * Battery pack vendor provided charging profile
+ */
+
+#include "battery.h"
+#include "battery_fuel_gauge.h"
+#include "battery_smart.h"
+#include "common.h"
+#include "util.h"
+/*
+ * Battery info for all Taniks 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[] = {
+ [BATTERY_SMP] = {
+ .fuel_gauge = {
+ .manuf_name = "SMP",
+ .device_name = "L21M4PG4",
+ .ship_mode = {
+ .reg_addr = 0x34,
+ .reg_data = { 0x0000, 0x1000 },
+ },
+ .fet = {
+ .reg_addr = 0x34,
+ .reg_mask = 0x0100,
+ .disconnect_val = 0x0100,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 8900, /* mV */
+ .voltage_normal = 7720, /* mV */
+ .voltage_min = 6000, /* mV */
+ .precharge_current = 330, /* 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_SUNWODA] = {
+ .fuel_gauge = {
+ .manuf_name = "Sunwoda",
+ .device_name = "L21D4PG4",
+ .ship_mode = {
+ .reg_addr = 0x34,
+ .reg_data = { 0x0000, 0x1000 },
+ },
+ .fet = {
+ .reg_addr = 0x34,
+ .reg_mask = 0x0100,
+ .disconnect_val = 0x0100,
+ }
+ },
+ .batt_info = {
+ .voltage_max = 8900, /* mV */
+ .voltage_normal = 7720, /* mV */
+ .voltage_min = 6000, /* mV */
+ .precharge_current = 330, /* 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,
+ },
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
+
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SMP;
+
+__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));
+ return batt_initialization_state;
+}
diff --git a/board/taniks/board.c b/board/taniks/board.c
new file mode 100644
index 0000000000..80be70ca27
--- /dev/null
+++ b/board/taniks/board.c
@@ -0,0 +1,127 @@
+/* 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.
+ */
+
+#include "battery.h"
+#include "button.h"
+#include "charge_manager.h"
+#include "charge_ramp.h"
+#include "charge_state_v2.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/als_tcs3400.h"
+#include "fw_config.h"
+#include "hooks.h"
+#include "lid_switch.h"
+#include "power_button.h"
+#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)
+
+/******************************************************************************/
+/* USB-A charging control */
+
+const int usb_port_enable[USB_PORT_COUNT] = {
+ GPIO_EN_PP5000_USBA_R,
+};
+BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
+
+/******************************************************************************/
+
+__override void board_cbi_init(void)
+{
+ config_usb_db_type();
+}
+
+/* Called on AP S3 -> S0 transition */
+static void board_chipset_resume(void)
+{
+ /* Allow keyboard backlight to be enabled */
+ if (ec_cfg_has_keyboard_backlight() == 1) {
+ /* GPIO_EC_KB_BL_EN_L is low active pin */
+ gpio_set_level(GPIO_EC_KB_BL_EN_L, 0);
+ }
+}
+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. */
+ if (ec_cfg_has_keyboard_backlight() == 1) {
+ /* GPIO_EC_KB_BL_EN_L is low active pin */
+ gpio_set_level(GPIO_EC_KB_BL_EN_L, 1);
+ }
+}
+DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+
+#ifdef CONFIG_CHARGE_RAMP_SW
+
+/*
+ * TODO: tune this threshold
+ */
+
+#define BC12_MIN_VOLTAGE 4400
+
+/**
+ * Return true if VBUS is too low
+ */
+int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
+{
+ int voltage;
+
+ if (charger_get_vbus_voltage(port, &voltage))
+ voltage = 0;
+
+ if (voltage == 0) {
+ CPRINTS("%s: must be disconnected", __func__);
+ return 1;
+ }
+
+ if (voltage < BC12_MIN_VOLTAGE) {
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
+ port, voltage, BC12_MIN_VOLTAGE);
+ return 1;
+ }
+
+ return 0;
+}
+
+#endif /* CONFIG_CHARGE_RAMP_SW */
+
+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;
+}
+
+__override void board_set_charge_limit(int port, int supplier, int charge_ma,
+ int max_ma, int charge_mv)
+{
+ /*
+ * Follow OEM request to limit the input current to
+ * 95% negotiated limit.
+ */
+ charge_ma = charge_ma * 95 / 100;
+
+ charge_set_input_current_limit(MAX(charge_ma,
+ CONFIG_CHARGER_INPUT_CURRENT),
+ charge_mv);
+} \ No newline at end of file
diff --git a/board/taniks/board.h b/board/taniks/board.h
new file mode 100644
index 0000000000..919a156801
--- /dev/null
+++ b/board/taniks/board.h
@@ -0,0 +1,262 @@
+/* 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.
+ */
+
+/* Taniks board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#include "compile_time_macros.h"
+
+/*
+ * Taniks boards are set up for vivaldi
+ */
+#define CONFIG_KEYBOARD_VIVALDI
+
+/* Baseboard features */
+#include "baseboard.h"
+
+#define CONFIG_SYSTEM_UNLOCKED
+
+/*
+ * This will happen automatically on NPCX9 ES2 and later. Do not remove
+ * until we can confirm all earlier chips are out of service.
+ */
+#define CONFIG_HIBERNATE_PSL_VCC1_RST_WAKEUP
+
+/* LED */
+#define CONFIG_LED_ONOFF_STATES
+
+/* Sensors */
+#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_ACCEL_LSM6DSO_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+#define CONFIG_ACCELGYRO_LSM6DSM
+#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+
+/* Enable sensor fifo, must also define the _SIZE and _THRES */
+#define CONFIG_ACCEL_FIFO
+/* FIFO size is in power of 2. */
+#define CONFIG_ACCEL_FIFO_SIZE 256
+/* 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(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_ACCEL_BMA4XX
+#define CONFIG_ACCEL_LIS2DWL
+#define CONFIG_ACCEL_LIS2DW_AS_BASE
+#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
+
+#define CONFIG_ACCEL_INTERRUPTS
+
+/* Sensor console commands */
+#define CONFIG_CMD_ACCELS
+#define CONFIG_CMD_ACCEL_INFO
+
+/* USB Type A Features */
+#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
+
+#define CONFIG_IO_EXPANDER
+#define CONFIG_IO_EXPANDER_NCT38XX
+#define CONFIG_IO_EXPANDER_PORT_COUNT 1
+
+#define CONFIG_USB_PD_TCPM_PS8815
+#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+#define CONFIG_USBC_PPC_SYV682X
+#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 */
+
+/*
+ * 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
+
+/* The lower the input voltage, the higher the power efficiency. */
+#define PD_PREFER_LOW_VOLTAGE
+
+/*
+ * 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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_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_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_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_STEINHART_HART_3V3_30K9_47K_4050B
+
+/* Fan */
+#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_CHARGE_RAMP_SW
+#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 */
+#define CONFIG_CHARGER_BQ25710_EN_ACOC
+/* 33h BIT15:11 ILIM2 TH 140% */
+#define CONFIG_CHARGER_BQ257X0_ILIM2_VTH_CUSTOM
+#define CONFIG_CHARGER_BQ257X0_ILIM2_VTH \
+ BQ257X0_PROCHOT_OPTION_0_ILIM2_VTH__1P40
+/* 34h BIT0 CONFIG_CHARGER_BQ25710_PP_ACOK */
+#define CONFIG_CHARGER_BQ25710_PP_ACOK
+/* 34h BIT3 and BIT15:10 IDCHG 9728mA, step is 512mA */
+#define CONFIG_CHARGER_BQ25710_IDCHG_LIMIT_MA 9728
+/* 36h UVP 5600mV */
+#define CONFIG_CHARGER_BQ25720_VSYS_UVP_CUSTOM
+#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 "registers.h"
+#include "usbc_config.h"
+
+enum adc_channel {
+ ADC_TEMP_SENSOR_1_DDR_SOC,
+ ADC_TEMP_SENSOR_2_FAN,
+ ADC_TEMP_SENSOR_3_CHARGER,
+ ADC_TEMP_SENSOR_4_CPUCHOKE,
+ ADC_CH_COUNT
+};
+
+enum temp_sensor_id {
+ TEMP_SENSOR_1_DDR_SOC,
+ TEMP_SENSOR_2_FAN,
+ TEMP_SENSOR_3_CHARGER,
+ TEMP_SENSOR_4_CPUCHOKE,
+ TEMP_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 battery_type {
+ BATTERY_SMP,
+ BATTERY_LGC,
+ BATTERY_SUNWODA,
+ BATTERY_TYPE_COUNT,
+};
+
+enum pwm_channel {
+ PWM_CH_KBLIGHT = 0, /* PWM3 */
+ PWM_CH_FAN, /* PWM5 */
+ PWM_CH_COUNT
+};
+
+enum fan_channel {
+ FAN_CH_0 = 0,
+ FAN_CH_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/taniks/build.mk b/board/taniks/build.mk
new file mode 100644
index 0000000000..2afcd5a0f8
--- /dev/null
+++ b/board/taniks/build.mk
@@ -0,0 +1,25 @@
+# -*- makefile -*-
+# 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.
+#
+# Taniks board specific files build
+#
+
+CHIP:=npcx
+CHIP_FAMILY:=npcx9
+CHIP_VARIANT:=npcx9m3f
+BASEBOARD:=brya
+
+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
+board-y+=usbc_config.o
diff --git a/board/taniks/charger.c b/board/taniks/charger.c
new file mode 120000
index 0000000000..476ce97df2
--- /dev/null
+++ b/board/taniks/charger.c
@@ -0,0 +1 @@
+../../baseboard/brya/charger_bq25720.c \ No newline at end of file
diff --git a/board/taniks/ec.tasklist b/board/taniks/ec.tasklist
new file mode 100644
index 0000000000..6d995d6b44
--- /dev/null
+++ b/board/taniks/ec.tasklist
@@ -0,0 +1,30 @@
+/* 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.
+ */
+
+/*
+ * 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(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) \
+ TASK_ALWAYS(CHARGER, charger_task, NULL, BASEBOARD_CHARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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_interrupt_handler_task, 0, BASEBOARD_PD_INT_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, BASEBOARD_PD_INT_TASK_STACK_SIZE)
diff --git a/board/taniks/fans.c b/board/taniks/fans.c
new file mode 100644
index 0000000000..d50d3e5506
--- /dev/null
+++ b/board/taniks/fans.c
@@ -0,0 +1,88 @@
+/* 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.
+ */
+
+/* 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_1,
+ .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,
+};
+
+/*
+ * TODO(b/211076077): 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,
+ },
+};
+
+#ifndef CONFIG_FANS
+
+/*
+ * TODO(b/211076077): use static fan speeds until fan and sensors are
+ * tuned. for now, use:
+ *
+ * AP off: 33%
+ * AP on: 100%
+ */
+
+static void fan_slow(void)
+{
+ const int duty_pct = 33;
+
+ ccprints("%s: speed %d%%", __func__, duty_pct);
+
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, duty_pct);
+}
+
+static void fan_max(void)
+{
+ const int duty_pct = 100;
+
+ ccprints("%s: speed %d%%", __func__, duty_pct);
+
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, 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/taniks/fw_config.c b/board/taniks/fw_config.c
new file mode 100644
index 0000000000..578fcdfeb0
--- /dev/null
+++ b/board/taniks/fw_config.c
@@ -0,0 +1,65 @@
+/* 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.
+ */
+
+#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_CHIPSET, format, ## args)
+
+static union taniks_cbi_fw_config fw_config;
+BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
+
+/*
+ * FW_CONFIG defaults for Taniks if the CBI.FW_CONFIG data is not
+ * initialized.
+ */
+static const union taniks_cbi_fw_config fw_config_defaults = {
+ .usb_db = DB_USB3_PS8815,
+ .kb_bl = KEYBOARD_BACKLIGHT_ENABLED,
+};
+
+/****************************************************************************
+ * Taniks 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;
+ }
+
+ if (get_board_id() == 0) {
+ /* TODO(b/211076082): Update CBI fw config structure
+ * Update correct FW_CONFIG.
+ */
+ CPRINTS("CBI: Using board defaults for early board");
+ if (ec_cfg_has_tabletmode()) {
+ fw_config = fw_config_defaults;
+ }
+ }
+}
+
+union taniks_cbi_fw_config get_fw_config(void)
+{
+ return fw_config;
+}
+
+enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void)
+{
+ return fw_config.usb_db;
+}
+
+bool ec_cfg_has_keyboard_backlight(void)
+{
+ return (fw_config.kb_bl == KEYBOARD_BACKLIGHT_ENABLED);
+}
+
+bool ec_cfg_has_tabletmode(void)
+{
+ return (fw_config.tabletmode == TABLETMODE_ENABLED);
+}
diff --git a/board/taniks/fw_config.h b/board/taniks/fw_config.h
new file mode 100644
index 0000000000..35bf7b9cc2
--- /dev/null
+++ b/board/taniks/fw_config.h
@@ -0,0 +1,82 @@
+/* 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.
+ */
+
+#ifndef __BOARD_TANIKS_FW_CONFIG_H_
+#define __BOARD_TANIKS_FW_CONFIG_H_
+
+#include <stdint.h>
+
+/****************************************************************************
+ * CBI FW_CONFIG layout for Taniks board.
+ *
+ * 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_keyboard_backlight_type {
+ KEYBOARD_BACKLIGHT_DISABLED = 0,
+ KEYBOARD_BACKLIGHT_ENABLED = 1
+};
+
+enum ec_cfg_tabletmode_type {
+ TABLETMODE_DISABLED = 0,
+ TABLETMODE_ENABLED = 1
+};
+
+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 : 6;
+ /* b/211079131 - Fw config structure
+ * b/211076082 - Move tablet mode to bit14
+ * bit8-9: kb_layout
+ * bit10-11: wifi_sar_id,
+ * bit12: nvme
+ * bit13: emmc
+ */
+ enum ec_cfg_tabletmode_type tabletmode : 1;
+ uint32_t reserved_2 : 17;
+ };
+ uint32_t raw_value;
+};
+
+/**
+ * Read the cached FW_CONFIG. Guaranteed to have valid values.
+ *
+ * @return the FW_CONFIG for the board.
+ */
+union taniks_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);
+
+/**
+ * Check if the FW_CONFIG has enabled keyboard backlight.
+ *
+ * @return true if board supports keyboard backlight, false if the board
+ * doesn't support it.
+ */
+bool ec_cfg_has_keyboard_backlight(void);
+
+/**
+ * Check if the FW_CONFIG has enabled tablet mode.
+ *
+ * @return true if board supports tablet mode, false if the board
+ * doesn't support it.
+ */
+bool ec_cfg_has_tabletmode(void);
+
+#endif /* __BOARD_TANIKS_FW_CONFIG_H_ */
diff --git a/board/taniks/gpio.inc b/board/taniks/gpio.inc
new file mode 100644
index 0000000000..9984ebc55e
--- /dev/null
+++ b/board/taniks/gpio.inc
@@ -0,0 +1,146 @@
+/* -*- mode:c -*-
+ *
+ * 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.
+ */
+
+#define MODULE_KB MODULE_KEYBOARD_SCAN
+
+/* 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, motion_interrupt)
+GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, lsm6dso_interrupt)
+GPIO_INT(EC_PROCHOT_IN_L, PIN(2, 4), 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_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(2, 2), 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(2, 5), 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_TCPC_INT_ODL, PIN(2, 3), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(USB_C0_PPC_INT_ODL, PIN(6, 2), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C1_BC12_INT_ODL, PIN(5, 0), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C1_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event)
+GPIO_INT(USB_C1_PPC_INT_ODL, PIN(F, 5), GPIO_INT_FALLING, ppc_interrupt)
+
+/* USED GPIOs: */
+GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
+GPIO(CHARGER_VAP_OTG_EN, PIN(7, 3), GPIO_OUT_LOW)
+GPIO(CPU_C10_GATE_L, PIN(6, 7), 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(D, 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_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_PPC_BC_SDA, PIN(9, 1), GPIO_INPUT)
+GPIO(EC_I2C_KBMCU_SCL, PIN(D, 1), GPIO_INPUT)
+GPIO(EC_I2C_KBMCU_SDA, PIN(D, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_TCPC_SCL, PIN(9, 0), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_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)
+GPIO(EC_KB_BL_EN_L, PIN(8, 6), 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(2, 6), 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_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(3, 0), GPIO_INPUT)
+GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
+GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
+GPIO(USB_C0_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_ODL, PIN(0, 2), GPIO_ODR_HIGH)
+GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
+GPIO(KBMCU_INT_ODL, PIN(7, 0), GPIO_INPUT)
+
+/* 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 */
+ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */
+
+/* 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 */
+
+/* ADC alternate functions */
+ALTERNATE(PIN_MASK(3, 0x10), 0, MODULE_ADC, 0) /* GPIO34/PS2_DAT2/ADC6 */
+ALTERNATE(PIN_MASK(4, 0x24), 0, MODULE_ADC, 0) /* GPIO42/ADC3/RI_L, GPIO45/ADC0 */
+ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
+
+/* 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 */
+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, 0x03), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO00/GPIO21/JTAG_TCK_SWCLK, KSO01/GPIO20/JTAG_TMS_SWIO */
+ALTERNATE(PIN_MASK(3, 0x80), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* GPIO37/PS2_CLK2/ADC5 */
+ALTERNATE(PIN_MASK(4, 0x1a), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* GPIO44/ADC1, GPIO43/ADC2, GPIO41/ADC4 */
+ALTERNATE(PIN_MASK(8, 0x04), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO14/GPIO82 */
+ALTERNATE(PIN_MASK(C, 0x80), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* GPIOC7/DTR_L_BOUT/ADC11 */
+ALTERNATE(PIN_MASK(E, 0x01), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* GPIOE0/ADC10 */
+ALTERNATE(PIN_MASK(F, 0x03), 0, MODULE_KB, GPIO_INPUT | GPIO_PULL_UP) /* GPIOF1/ADC8, GPIOF0/ADC9 */
+
+/* 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 */
+
+/* Unused Pins */
+UNUSED(PIN(B, 1)) /* KSO17/GPIOB1/CR_SIN4 */
+UNUSED(PIN(D, 4)) /* GPIOD4/CR_SIN3 */
+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(4, 1)) /* GPIO41/ADC4 */
+UNUSED(PIN(6, 6)) /* GPIO66 */
+UNUSED(PIN(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
+
+/* Pre-configured PSL balls: J8 K6 */
+
+/*
+ * 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)
+
+/* 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)
+
+/* LED */
+GPIO(LED_1_L, PIN(C, 4), GPIO_OUT_HIGH) /* Battery - Red LED */
+GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH) /* Battery - Green LED */
+GPIO(LED_3_L, PIN(C, 2), GPIO_OUT_HIGH) /* Power - White LED */
diff --git a/board/taniks/i2c.c b/board/taniks/i2c.c
new file mode 100644
index 0000000000..afbf101431
--- /dev/null
+++ b/board/taniks/i2c.c
@@ -0,0 +1,79 @@
+/* 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.
+ */
+
+#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",
+ .port = I2C_PORT_USB_C0_TCPC,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_TCPC_SDA,
+ },
+ {
+ /* I2C2 */
+ .name = "ppc0",
+ .port = I2C_PORT_USB_C0_PPC,
+ .kbps = 1000,
+ .scl = GPIO_EC_I2C_USB_C0_PPC_BC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_PPC_BC_SDA,
+ },
+ {
+ /* I2C3 */
+ .name = "kbmcu",
+ .port = I2C_PORT_KBMCU,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_KBMCU_SCL,
+ .sda = GPIO_EC_I2C_KBMCU_SDA,
+ },
+ {
+ /* I2C4 C1 TCPC */
+ /* TODO(b/211080526): Change TCPC1's (PS8815) I2C frequency from 400Khz to 1000Khz */
+ .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 = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BAT_SCL,
+ .sda = GPIO_EC_I2C_BAT_SDA,
+ },
+ {
+ /* I2C6 */
+ .name = "ppc1",
+ .port = I2C_PORT_USB_C1_PPC,
+ .kbps = 400,
+ .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/taniks/keyboard.c b/board/taniks/keyboard.c
new file mode 100644
index 0000000000..38a0799f9c
--- /dev/null
+++ b/board/taniks/keyboard.c
@@ -0,0 +1,48 @@
+/* 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.
+ */
+
+#include "common.h"
+#include "ec_commands.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 */
+ },
+};
+
+static const struct ec_response_keybd_config taniks_kb = {
+ .num_top_row_keys = 10,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_VOL_MUTE, /* T8 */
+ TK_VOL_DOWN, /* T9 */
+ TK_VOL_UP, /* T10 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+__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
new file mode 100644
index 0000000000..1631bce51f
--- /dev/null
+++ b/board/taniks/led.c
@@ -0,0 +1,119 @@
+/* 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.
+ */
+
+/* Taniks 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.
+ */
+
+#include "common.h"
+#include "led_onoff_states.h"
+#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 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} },
+};
+
+__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
+};
+
+const int supported_led_ids_count = ARRAY_SIZE(supported_led_ids);
+
+__override void led_set_color_power(enum ec_led_colors color)
+{
+ if (color == EC_LED_COLOR_WHITE)
+ gpio_set_level(GPIO_LED_3_L, LED_ON_LVL);
+ else
+ /* LED_OFF and unsupported colors */
+ gpio_set_level(GPIO_LED_3_L, LED_OFF_LVL);
+}
+
+__override void led_set_color_battery(enum ec_led_colors color)
+{
+ switch (color) {
+ case EC_LED_COLOR_AMBER:
+ gpio_set_level(GPIO_LED_1_L, LED_ON_LVL);
+ gpio_set_level(GPIO_LED_2_L, LED_ON_LVL);
+ break;
+ case EC_LED_COLOR_RED:
+ gpio_set_level(GPIO_LED_1_L, LED_ON_LVL);
+ gpio_set_level(GPIO_LED_2_L, LED_OFF_LVL);
+ break;
+ case EC_LED_COLOR_GREEN:
+ gpio_set_level(GPIO_LED_1_L, LED_OFF_LVL);
+ gpio_set_level(GPIO_LED_2_L, LED_ON_LVL);
+ break;
+ default: /* LED_OFF and other unsupported colors */
+ gpio_set_level(GPIO_LED_1_L, LED_OFF_LVL);
+ gpio_set_level(GPIO_LED_2_L, LED_OFF_LVL);
+ break;
+ }
+}
+
+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_RED] = 1;
+ brightness_range[EC_LED_COLOR_AMBER] = 1;
+ brightness_range[EC_LED_COLOR_GREEN] = 1;
+ } 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_RED] != 0)
+ led_set_color_battery(EC_LED_COLOR_RED);
+ else if (brightness[EC_LED_COLOR_AMBER] != 0)
+ led_set_color_battery(EC_LED_COLOR_AMBER);
+ else if (brightness[EC_LED_COLOR_GREEN] != 0)
+ led_set_color_battery(EC_LED_COLOR_GREEN);
+ else
+ led_set_color_battery(LED_OFF);
+ } 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
+ led_set_color_power(LED_OFF);
+ }
+
+ return EC_SUCCESS;
+}
diff --git a/board/taniks/pwm.c b/board/taniks/pwm.c
new file mode 100644
index 0000000000..b5fef384f9
--- /dev/null
+++ b/board/taniks/pwm.c
@@ -0,0 +1,39 @@
+/* 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.
+ */
+
+#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_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_FAN] = {
+ .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN,
+ .freq = 25000
+ },
+};
+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);
+}
+DECLARE_HOOK(HOOK_INIT, board_pwm_init, HOOK_PRIO_DEFAULT);
diff --git a/board/taniks/sensors.c b/board/taniks/sensors.c
new file mode 100644
index 0000000000..ca8afa7f8d
--- /dev/null
+++ b/board/taniks/sensors.c
@@ -0,0 +1,436 @@
+/* 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.
+ */
+
+#include "common.h"
+#include "accelgyro.h"
+#include "adc_chip.h"
+#include "driver/accel_bma422.h"
+#include "driver/accel_bma4xx.h"
+#include "driver/accel_lis2dw12.h"
+#include "driver/accelgyro_lsm6dsm.h"
+#include "driver/accelgyro_lsm6dso.h"
+#include "fw_config.h"
+#include "hooks.h"
+#include "i2c.h"
+#include "motion_sense.h"
+#include "temp_sensor.h"
+#include "thermal.h"
+#include "temp_sensor/thermistor.h"
+
+#if 0
+#define CPRINTS(format, args...) ccprints(format, ## args)
+#define CPRINTF(format, args...) ccprintf(format, ## args)
+#else
+#define CPRINTS(format, args...)
+#define CPRINTF(format, args...)
+#endif
+
+/* ADC configuration */
+const 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_FAN] = {
+ .name = "TEMP_FAN",
+ .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_CPUCHOKE] = {
+ .name = "CPU_CHOKE",
+ .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);
+
+K_MUTEX_DEFINE(g_lid_accel_mutex);
+K_MUTEX_DEFINE(g_base_accel_mutex);
+static struct stprivate_data g_lis2dw12_data;
+static struct accelgyro_saved_data_t g_bma422_data;
+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 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",
+ .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_accel_mutex,
+ .drv_data = &g_bma422_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY, /* 0x18 */
+ .rot_standard_ref = &lid_standard_ref, /* identity matrix */
+ .default_range = 2, /* g, enough for laptop. */
+ .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,
+ },
+ },
+};
+
+struct motion_sensor_t lsm6dsm_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_accel_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, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = LSM6DSM_ODR_MIN_VAL,
+ .max_frequency = LSM6DSM_ODR_MAX_VAL,
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 13000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ /* Sensor on for angle detection */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 100 * MSEC,
+ },
+ },
+};
+
+struct motion_sensor_t lsm6dsm_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_accel_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,
+};
+
+struct motion_sensor_t motion_sensors[] = {
+ [LID_ACCEL] = {
+ .name = "Lid Accel - ST",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_LIS2DW12,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &lis2dw12_drv,
+ .mutex = &g_lid_accel_mutex,
+ .drv_data = &g_lis2dw12_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LIS2DW12_ADDR1, /* 0x19 */
+ .rot_standard_ref = &lid_standard_ref, /* identity matrix */
+ .default_range = 2, /* g */
+ .min_frequency = LIS2DW12_ODR_MIN_VAL,
+ .max_frequency = LIS2DW12_ODR_MAX_VAL,
+ .config = {
+ /* EC use accel for angle detection */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 12500 | ROUND_UP_FLAG,
+ },
+ /* Sensor on for lid angle detection */
+ [SENSOR_CONFIG_EC_S3] = {
+ .odr = 10000 | ROUND_UP_FLAG,
+ },
+ },
+ },
+
+ [BASE_ACCEL] = {
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_LSM6DSO,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &lsm6dso_drv,
+ .mutex = &g_base_accel_mutex,
+ .drv_data = &lsm6dso_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
+ .rot_standard_ref = &base_standard_ref,
+ .default_range = 4, /* g */
+ .min_frequency = LSM6DSO_ODR_MIN_VAL,
+ .max_frequency = LSM6DSO_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,
+ },
+ },
+ },
+
+ [BASE_GYRO] = {
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_LSM6DSO,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &lsm6dso_drv,
+ .mutex = &g_base_accel_mutex,
+ .drv_data = &lsm6dso_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
+ .default_range = 1000 | ROUND_UP_FLAG, /* dps */
+ .rot_standard_ref = &base_standard_ref,
+ .min_frequency = LSM6DSO_ODR_MIN_VAL,
+ .max_frequency = LSM6DSO_ODR_MAX_VAL,
+ },
+
+};
+
+#ifdef CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
+unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+#else
+const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+#endif
+
+
+static void board_detect_motionsensor(void)
+{
+ int ret;
+ int val;
+
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF))
+ return;
+
+ /*
+ * b/194765820 - Dynamic motion sensor count
+ * All board supports tablet mode if board id > 0
+ */
+ if (get_board_id() == 0 && !ec_cfg_has_tabletmode())
+ return;
+
+ /* Check lid accel chip */
+ 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 IS2DW12");
+ /* Enable gpio interrupt for lid accel sensor */
+ gpio_enable_interrupt(GPIO_EC_ACCEL_INT_R_L);
+ return;
+ }
+
+ ret = i2c_read8(I2C_PORT_SENSOR, BMA4_I2C_ADDR_PRIMARY,
+ BMA4_CHIP_ID_ADDR, &val);
+ if (ret == 0 && val == BMA422_CHIP_ID) {
+ CPRINTS("LID_ACCEL is BMA422");
+ motion_sensors[LID_ACCEL] = bma422_lid_accel;
+ /*
+ * The driver for BMA422 doesn't have code to support
+ * INT1. So, it doesn't need to enable interrupt.
+ * Vendor recommend to configure EC gpio as high-z if
+ * we don't use INT1. Keep this pin as input w/o enable
+ * interrupt.
+ */
+ return;
+ }
+
+ /* Lid accel is not stuffed, don't allow line to float */
+ gpio_disable_interrupt(GPIO_EC_ACCEL_INT_R_L);
+ gpio_set_flags(GPIO_EC_ACCEL_INT_R_L, GPIO_INPUT | GPIO_PULL_DOWN);
+ CPRINTS("No LID_ACCEL are detected");
+}
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_detect_motionsensor,
+ HOOK_PRIO_DEFAULT);
+
+static void baseboard_sensors_init(void)
+{
+ CPRINTS("baseboard_sensors_init");
+ /* b/194765820
+ * Dynamic motion sensor count
+ * All board supports tablet mode if board id > 0
+ */
+ if (ec_cfg_has_tabletmode()) {
+ /*
+ * GPIO_EC_ACCEL_INT_R_L
+ * The interrupt of lid accel is disabled by default.
+ * We'll enable it later if lid accel is LIS2DW12.
+ */
+
+ /* 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
+ */
+ if (get_board_id() > 0) {
+ motion_sensors[BASE_ACCEL] = lsm6dsm_base_accel;
+ motion_sensors[BASE_GYRO] = lsm6dsm_base_gyro;
+ }
+
+ /* Enable gpio interrupt for base accelgyro sensor */
+ gpio_enable_interrupt(GPIO_EC_IMU_INT_R_L);
+ } else {
+ CPRINTS("Clamshell");
+ motion_sensor_count = 0;
+ /* Gyro is not present, don't allow line to float */
+ 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);
+
+void motion_interrupt(enum gpio_signal signal)
+{
+ if (motion_sensors[LID_ACCEL].chip == MOTIONSENSE_CHIP_LIS2DW12) {
+ lis2dw12_interrupt(signal);
+ CPRINTS("IS2DW12 interrupt");
+ return;
+ }
+
+ /*
+ * From other project, ex. guybrush, it seem BMA422 doesn't have
+ * interrupt handler when EC_ACCEL_INT_R_L is asserted.
+ * However, I don't see BMA422 assert EC_ACCEL_INT_R_L when it has
+ * power. That could be the reason EC code doesn't register any
+ * interrupt handler.
+ */
+ CPRINTS("BMA422 interrupt");
+
+}
+
+/* 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
+ },
+};
+
+
+BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
+
+/*
+ * TODO(b/201021109): 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 (100 C)
+ */
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
+#define THERMAL_CPU \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(100), \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
+ }, \
+ .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/201021109): 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 100c
+ */
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
+#define THERMAL_FAN \
+ { \
+ .temp_host = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(90), \
+ [EC_TEMP_THRESH_HALT] = C_TO_K(100), \
+ }, \
+ .temp_host_release = { \
+ [EC_TEMP_THRESH_HIGH] = C_TO_K(85), \
+ }, \
+ .temp_fan_off = C_TO_K(35), \
+ .temp_fan_max = C_TO_K(60), \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_fan = THERMAL_FAN;
+
+/* 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_FAN,
+ [TEMP_SENSOR_4_CPUCHOKE] = THERMAL_FAN,
+};
+
+BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
diff --git a/board/taniks/usbc_config.c b/board/taniks/usbc_config.c
new file mode 100644
index 0000000000..4cdb29b779
--- /dev/null
+++ b/board/taniks/usbc_config.c
@@ -0,0 +1,392 @@
+/* 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.
+ */
+
+#include <stdint.h>
+#include <stdbool.h>
+
+#include "battery.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/bc12/pi3usb9201_public.h"
+#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/syv682x_public.h"
+#include "driver/retimer/bb_retimer_public.h"
+#include "driver/tcpm/nct38xx.h"
+#include "driver/tcpm/ps8xxx_public.h"
+#include "driver/tcpm/tcpci.h"
+#include "ec_commands.h"
+#include "fw_config.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)
+
+#if 0
+/* Debug only! */
+#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...)
+#endif
+
+/* 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_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
+ },
+ .drv = &nct38xx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+ [USBC_PORT_C1] = {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C1_TCPC,
+ .addr_flags = PS8751_I2C_ADDR1_FLAGS,
+ },
+ .drv = &ps8xxx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
+ TCPC_FLAGS_CONTROL_VCONN,
+ },
+};
+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_PPC,
+ .i2c_addr_flags = SYV682X_ADDR0_FLAGS,
+ .drv = &syv682x_drv,
+ },
+ [USBC_PORT_C1] = {
+ /* Compatible with Silicon Mitus SM536A0 */
+ .i2c_port = I2C_PORT_USB_C1_PPC,
+ .i2c_addr_flags = NX20P3483_ADDR2_FLAGS,
+ .drv = &nx20p348x_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 */
+
+/*
+ * 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,
+};
+
+const struct usb_mux usb_muxes[] = {
+ [USBC_PORT_C0] = {
+ .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,
+ },
+};
+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_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,
+ },
+};
+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_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);
+
+void config_usb_db_type(void)
+{
+ enum ec_cfg_usb_db_type db_type = ec_cfg_usb_db_type();
+
+ /*
+ * TODO(b/194515356): implement multiple DB types
+ */
+ CPRINTS("Configured USB DB type number is %d", db_type);
+}
+
+static void ps8815_reset(void)
+{
+ int val;
+
+ CPRINTS("%s: patching ps8815 registers", __func__);
+
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC,
+ PS8751_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,
+ PS8751_I2C_ADDR1_FLAGS, 0x0f, 0x31) == EC_SUCCESS)
+ CPRINTS("ps8815: reg 0x0f set to 0x31");
+
+ if (i2c_read8(I2C_PORT_USB_C1_TCPC,
+ PS8751_I2C_ADDR1_FLAGS, 0x0f, &val) == EC_SUCCESS)
+ CPRINTS("ps8815: reg 0x0f now %02x", val);
+}
+
+/**
+ * b/197585292
+ * It's used for early board to check if usb_db is plugged or not.
+ * That's used to avoid TCPC1 initialization abnormal if db isn't
+ * plugged into system.
+ */
+enum usb_db_present {
+ DB_USB_NOT_PRESENT = 0,
+ DB_USB_PRESENT = 1,
+};
+static enum usb_db_present db_usb_hw_pres;
+
+/**
+ * Init hw ps8815 detection and keep it in db_usb_hw_press.
+ * Then, we don't need to keep query ps8815 mcu.
+ */
+static void board_init_ps8815_detection(void)
+{
+ int rv, val;
+
+ CPRINTSUSB("%s", __func__);
+
+ rv = i2c_read8(I2C_PORT_USB_C1_TCPC,
+ PS8751_I2C_ADDR1_FLAGS, 0x00, &val);
+
+ 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!");
+}
+
+/**
+ * @return true if ps8815_db is plugged, false if it isn't plugged.
+ */
+static bool board_detect_ps8815_db(void)
+{
+ CPRINTSUSB("%s", __func__);
+
+ /* All dut should plug ps8815 db if board id > 0 */
+ if (get_board_id() > 0)
+ return true;
+
+ if (ec_cfg_usb_db_type() == DB_USB3_PS8815 &&
+ db_usb_hw_pres == DB_USB_PRESENT)
+ return true;
+
+ CPRINTSUSB("No PS8815 DB");
+ return false;
+}
+
+void board_reset_pd_mcu(void)
+{
+ /*
+ * TODO(b/194618663): figure out correct timing
+ */
+
+ gpio_set_level(GPIO_USB_C0_TCPC_RST_ODL, 0);
+
+ /*
+ * (b/202489681): Nx20p3483 cannot sink power after reset ec
+ * To avoid nx20p3483 cannot sink power after reset ec w/ AC
+ * only in TCPC1 port, EC shouldn't assert GPIO_USB_C1_RT_RST_R_ODL
+ * if no battery.
+ */
+ if (battery_hw_present())
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+
+ /*
+ * 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));
+
+ 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);
+ ps8815_reset();
+
+ /*
+ * board_init_ps8815_detection should be called before
+ * board_get_usb_pd_port_count(). usb_mux_hpd_update can check
+ * pd port count.
+ */
+ board_init_ps8815_detection();
+ usb_mux_hpd_update(USBC_PORT_C1, USB_PD_MUX_HPD_LVL_DEASSERTED |
+ USB_PD_MUX_HPD_IRQ_DEASSERTED);
+}
+
+static void board_tcpc_init(void)
+{
+ CPRINTSUSB("%s: board id = %d", __func__, get_board_id());
+
+ /* 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.
+ */
+ ioex_init(0);
+ }
+
+ CPRINTSUSB("Enable GPIO INT");
+
+ /* Enable PPC interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
+ if (board_detect_ps8815_db())
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
+
+ /* Enable TCPC interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_TCPC_INT_ODL);
+ if (board_detect_ps8815_db())
+ gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
+
+ /* Enable BC1.2 interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
+ if (board_detect_ps8815_db())
+ gpio_enable_interrupt(GPIO_USB_C1_BC12_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_TCPC_INT_ODL) == 0)
+ status |= PD_STATUS_TCPC_ALERT_0;
+
+ 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;
+
+ 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_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:
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C1_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P1, 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:
+ nx20p348x_interrupt(USBC_PORT_C1);
+ break;
+ default:
+ break;
+ }
+}
+
+__override bool board_is_dts_port(int port)
+{
+ return port == USBC_PORT_C0;
+}
+
+__override uint8_t board_get_usb_pd_port_count(void)
+{
+ CPRINTSUSB("%s is called by task_id:%d", __func__, task_get_current());
+
+ if (board_detect_ps8815_db())
+ return CONFIG_USB_PD_PORT_MAX_COUNT;
+
+ return CONFIG_USB_PD_PORT_MAX_COUNT - 1;
+}
diff --git a/board/taniks/usbc_config.h b/board/taniks/usbc_config.h
new file mode 100644
index 0000000000..8bcf365e8d
--- /dev/null
+++ b/board/taniks/usbc_config.h
@@ -0,0 +1,21 @@
+/* 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.
+ */
+
+/* Taniks board-specific USB-C configuration */
+
+#ifndef __CROS_EC_USBC_CONFIG_H
+#define __CROS_EC_USBC_CONFIG_H
+
+#define CONFIG_USB_PD_PORT_MAX_COUNT 2
+
+enum usbc_port {
+ USBC_PORT_C0 = 0,
+ USBC_PORT_C1,
+ USBC_PORT_COUNT
+};
+
+void config_usb_db_type(void);
+
+#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/taniks/vif_override.xml b/board/taniks/vif_override.xml
new file mode 100644
index 0000000000..32736caf64
--- /dev/null
+++ b/board/taniks/vif_override.xml
@@ -0,0 +1,3 @@
+<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
+ Definition from the USB-IF.
+-->
diff --git a/board/terrador/ec.tasklist b/board/terrador/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/terrador/ec.tasklist
+++ b/board/terrador/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/tglrvp_ish/board.h b/board/tglrvp_ish/board.h
index 03044a5bb8..12f4b5992a 100644
--- a/board/tglrvp_ish/board.h
+++ b/board/tglrvp_ish/board.h
@@ -35,7 +35,7 @@
#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(BASE_ACCEL)
/* Host command over HECI */
-#define CONFIG_HOSTCMD_HECI
+#define CONFIG_HOST_INTERFACE_HECI
/* I2C ports */
#define I2C_PORT_SENSOR ISH_I2C1
diff --git a/board/tglrvpu_ite/gpio.inc b/board/tglrvpu_ite/gpio.inc
index e0bce1ddd8..b84c92aac6 100644
--- a/board/tglrvpu_ite/gpio.inc
+++ b/board/tglrvpu_ite/gpio.inc
@@ -37,7 +37,7 @@ GPIO_INT(UART1_RX, PIN(B, 0), GPIO_INT_FALLING, uart_deepsleep_interrupt) /* UAR
GPIO_INT(WP_L, PIN(I, 4), GPIO_INT_BOTH, switch_interrupt) /* EC_WP_ODL */
-#ifdef CONFIG_HOSTCMD_ESPI
+#ifdef CONFIG_HOST_INTERFACE_ESPI
/* enable 1.8v input of EC's espi_reset pin, and then this pin takes effect. */
GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INT_FALLING | GPIO_SEL_1P8V, espi_reset_pin_asserted_interrupt) /* eSPI_reset# */
#endif
@@ -75,7 +75,7 @@ GPIO(EC_PCH_DSW_PWROK, PIN(L, 6), GPIO_OUT_LOW)
/* Host communication GPIOs */
GPIO(PCH_WAKE_L, PIN(J, 0), GPIO_ODR_HIGH)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO(PCH_PLTRST_L, PIN(E, 3), GPIO_INPUT | GPIO_PULL_UP)
#endif
@@ -165,7 +165,7 @@ GPIO(NC_USB_C1_RETIMER_ALRT, PIN(G, 0), GPIO_INPUT)
/* Used if Base EC is present */
GPIO(NC_EC_BASE_DET, PIN(I, 3), GPIO_INPUT)
-#ifndef CONFIG_HOSTCMD_ESPI
+#ifndef CONFIG_HOST_INTERFACE_ESPI
GPIO_INT(ESPI_RESET_L, PIN(D, 2), GPIO_INPUT)
#endif
diff --git a/board/tigertail/board.c b/board/tigertail/board.c
index f4d0382b9c..e7679a125d 100644
--- a/board/tigertail/board.c
+++ b/board/tigertail/board.c
@@ -103,8 +103,13 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100,
- GPIO_MASTER_I2C_SCL, 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);
diff --git a/board/treeya/board.c b/board/treeya/board.c
index 4583d89d7c..b0e4f459da 100644
--- a/board/treeya/board.c
+++ b/board/treeya/board.c
@@ -32,11 +32,41 @@ const int hibernate_wake_pins_used = ARRAY_SIZE(hibernate_wake_pins);
/* I2C port map. */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_I2C0_SCL, GPIO_I2C0_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 400, GPIO_I2C2_SCL, GPIO_I2C2_SDA},
- {"thermal", I2C_PORT_THERMAL_AP, 400, GPIO_I2C3_SCL, GPIO_I2C3_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_I2C7_SCL, 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);
@@ -100,8 +130,6 @@ struct motion_sensor_t base_accel_1 = {
.mutex = &g_base_mutex_1,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &lsm6dsm_base_standard_ref,
@@ -132,8 +160,6 @@ struct motion_sensor_t base_gyro_1 = {
.mutex = &g_base_mutex_1,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_ACCEL,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
@@ -144,10 +170,14 @@ struct motion_sensor_t base_gyro_1 = {
static int board_use_st_sensor(void)
{
- /* sku_id 0xa8-0xa9 use ST sensors */
+ /* sku_id 0xa8-0xa9, 0xbe, 0xbf use ST sensors */
uint32_t sku_id = system_get_sku_id();
- return sku_id == 0xa8 || sku_id == 0xa9;
+ if (sku_id == 0xa8 || sku_id == 0xa9 ||
+ sku_id == 0xbe || sku_id == 0xbf)
+ return 1;
+ else
+ return 0;
}
/* treeya board will use two sets of lid/base sensor, we need update
diff --git a/board/trogdor/board.c b/board/trogdor/board.c
index 0261ada9ff..7036e57c4a 100644
--- a/board/trogdor/board.c
+++ b/board/trogdor/board.c
@@ -53,16 +53,41 @@ __override struct keyboard_scan_config keyscan_config = {
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/trogdor/usbc_config.c b/board/trogdor/usbc_config.c
index dddc1d87a6..283001e3ed 100644
--- a/board/trogdor/usbc_config.c
+++ b/board/trogdor/usbc_config.c
@@ -6,6 +6,8 @@
/* Trogdor board-specific USB-C configuration */
#include "bc12/pi3usb9201_public.h"
+#include "charger.h"
+#include "charger/isl923x_public.h"
#include "charge_manager.h"
#include "charge_state.h"
#include "common.h"
@@ -26,6 +28,52 @@
#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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;
+}
+
/* GPIO Interrupt Handlers */
void tcpc_alert_event(enum gpio_signal signal)
{
diff --git a/board/twinkie/board.c b/board/twinkie/board.c
index 6572f27281..f3f8460c8d 100644
--- a/board/twinkie/board.c
+++ b/board/twinkie/board.c
@@ -66,7 +66,13 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"master", I2C_PORT_MASTER, 100, GPIO_I2C_SCL, 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);
diff --git a/board/twinkie/sniffer.c b/board/twinkie/sniffer.c
index a567b5d725..7d2d8d439f 100644
--- a/board/twinkie/sniffer.c
+++ b/board/twinkie/sniffer.c
@@ -316,9 +316,9 @@ void sniffer_task(void)
+ (EP_PACKET_HEADER_SIZE>>1))),
samples[d >> 4]+off,
EP_PAYLOAD_SIZE);
- atomic_clear_bits((uint32_t *)&free_usb, 1 << u);
+ atomic_clear_bits((atomic_t *)&free_usb, 1 << u);
u = !u;
- atomic_clear_bits((uint32_t *)&filled_dma, 1 << d);
+ atomic_clear_bits((atomic_t *)&filled_dma, 1 << d);
}
led_reset_record();
diff --git a/board/vell/battery.c b/board/vell/battery.c
index 1f0239a013..f45cc53c13 100644
--- a/board/vell/battery.c
+++ b/board/vell/battery.c
@@ -33,70 +33,37 @@
* 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 */
+ /* Simplo Coslight Battery Information */
+ [BATTERY_SIMPLO_COS] = {
.fuel_gauge = {
- .manuf_name = "POW-TECH",
- .device_name = "BATGQA05L22",
+ .manuf_name = "333-1C-DA-A",
.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,
- },
- },
- /* LGC L17L3PB0 Battery Information */
- /*
- * Battery info provided by ODM on b/143477210, comment #11
- */
- [BATTERY_LGC011] = {
- .fuel_gauge = {
- .manuf_name = "LGC",
- .ship_mode = {
- .reg_addr = 0x00,
- .reg_data = { 0x0010, 0x0010 },
- },
- .fet = {
.reg_addr = 0x0,
- .reg_mask = 0x6000,
- .disconnect_val = 0x6000,
- }
+ .reg_mask = 0x0006,
+ },
},
.batt_info = {
- .voltage_max = TARGET_WITH_MARGIN(13200, 5),
- .voltage_normal = 11550, /* 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 = 0,
- .discharging_max_c = 75,
+ .voltage_max = 8800, /* mV */
+ .voltage_normal = 7600,
+ .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 = 0,
+ .discharging_max_c = 60,
},
},
};
BUILD_ASSERT(ARRAY_SIZE(board_battery_info) == BATTERY_TYPE_COUNT);
-const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_POWER_TECH;
+const enum battery_type DEFAULT_BATTERY_TYPE = BATTERY_SIMPLO_COS;
enum battery_present battery_hw_present(void)
{
diff --git a/board/vell/board.c b/board/vell/board.c
index cb060442a2..47774afec5 100644
--- a/board/vell/board.c
+++ b/board/vell/board.c
@@ -13,8 +13,6 @@
#include "gpio.h"
#include "gpio_signal.h"
#include "hooks.h"
-#include "driver/accel_lis2dw12.h"
-#include "driver/accelgyro_lsm6dso.h"
#include "driver/als_tcs3400.h"
#include "fw_config.h"
#include "hooks.h"
@@ -23,7 +21,6 @@
#include "power.h"
#include "registers.h"
#include "switch.h"
-#include "tablet_mode.h"
#include "throttle_ap.h"
#include "usbc_config.h"
@@ -33,20 +30,18 @@
#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)
+static void board_chipset_startup(void)
{
/* Allow keyboard backlight to be enabled */
- gpio_set_level(GPIO_EC_KB_BL_EN_L, 0);
+ gpio_set_level(GPIO_EC_KB_BL_EN, 1);
}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, board_chipset_resume, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_chipset_startup, HOOK_PRIO_DEFAULT);
-/* Called on AP S0 -> S3 transition */
-static void board_chipset_suspend(void)
+static void board_chipset_shutdown(void)
{
/* Turn off the keyboard backlight if it's on. */
- gpio_set_level(GPIO_EC_KB_BL_EN_L, 1);
+ gpio_set_level(GPIO_EC_KB_BL_EN, 0);
}
-DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_chipset_shutdown, HOOK_PRIO_DEFAULT);
diff --git a/board/vell/board.h b/board/vell/board.h
index 6b99df2569..30ec2a210f 100644
--- a/board/vell/board.h
+++ b/board/vell/board.h
@@ -10,11 +10,6 @@
#include "compile_time_macros.h"
-/*
- * Early brya boards are not set up for vivaldi
- */
-#undef CONFIG_KEYBOARD_VIVALDI
-
/* Baseboard features */
#include "baseboard.h"
@@ -24,22 +19,13 @@
*/
#define CONFIG_HIBERNATE_PSL_VCC1_RST_WAKEUP
-/* LED */
-#define CONFIG_LED_PWM
-#define CONFIG_LED_PWM_COUNT 2
-#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
+/* Buttons */
+#undef CONFIG_VOLUME_BUTTONS
/* Sensors */
-#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
-#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+#undef CONFIG_TABLET_MODE
+#undef CONFIG_TABLET_MODE_SWITCH
+#undef CONFIG_GMR_TABLET_MODE
/* TCS3400 ALS */
#define CONFIG_ALS
@@ -56,29 +42,10 @@
#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))
-
-/* 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_ACCEL_LIS2DWL
-#define CONFIG_ACCEL_LIS2DW_AS_BASE
-#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
+#define CONFIG_ACCEL_FORCE_MODE_MASK BIT(CLEAR_ALS)
#define CONFIG_ACCEL_INTERRUPTS
-/* Sensor console commands */
-#define CONFIG_CMD_ACCELS
-#define CONFIG_CMD_ACCEL_INFO
-
-/* USB Type A Features */
-#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
@@ -86,31 +53,25 @@
#define CONFIG_IO_EXPANDER_NCT38XX
#define CONFIG_IO_EXPANDER_PORT_COUNT 4
-#define CONFIG_USB_PD_TCPM_PS8815
-#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
#define CONFIG_USBC_RETIMER_INTEL_BB
-/* I2C speed console command */
-#define CONFIG_CMD_I2C_SPEED
-
-/* I2C control host command */
-#define CONFIG_HOSTCMD_I2C_CONTROL
-
#define CONFIG_USBC_PPC_SYV682X
+/* TODO: b/211791444 - Remove it after compile error fixed */
#define CONFIG_USBC_PPC_NX20P3483
+#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 */
-/*
- * Passive USB-C cables only support up to 60W.
- */
+/* USB Type C and USB PD defines */
#define PD_OPERATING_POWER_MW 15000
-#define PD_MAX_POWER_MW 60000
-#define PD_MAX_CURRENT_MA 3000
+#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)
/*
* Macros for GPIO signals used in common code that don't match the
@@ -130,7 +91,7 @@
#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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_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
@@ -142,9 +103,11 @@
#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_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
@@ -153,17 +116,17 @@
#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_C1_TCPC NPCX_I2C_PORT1_0
+#define I2C_PORT_USB_C2_C3_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_C1_PPC NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C2_C3_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_C1_BC12 NPCX_I2C_PORT2_0
+#define I2C_PORT_USB_C2_C3_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_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
@@ -175,7 +138,9 @@
* 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_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
@@ -189,19 +154,19 @@
/* 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_STEINHART_HART_3V3_30K9_47K_4050B
#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_ISL9241
#define CONFIG_CHARGE_RAMP_SW
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
-#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
-#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
+#define CONFIG_CHARGER_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_SENSE_RESISTOR_AC 20
+
+/* Keyboard features */
+#define CONFIG_KEYBOARD_REFRESH_ROW3
/*
* Older boards have a different ADC assignment.
@@ -216,51 +181,45 @@
#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_TEMP_SENSOR_1_SOC,
+ ADC_TEMP_SENSOR_2_CHARGER,
+ ADC_TEMP_SENSOR_3_WWAN,
+ ADC_TEMP_SENSOR_4_DDR,
+ ADC_TEMP_SENSOR_5_REGULATOR,
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_1_SOC,
+ TEMP_SENSOR_2_CHARGER,
+ TEMP_SENSOR_3_WWAN,
+ TEMP_SENSOR_4_DDR,
+ TEMP_SENSOR_5_REGULATOR,
TEMP_SENSOR_COUNT
};
enum sensor_id {
- LID_ACCEL = 0,
- BASE_ACCEL,
- BASE_GYRO,
- CLEAR_ALS,
+ CLEAR_ALS = 0,
RGB_ALS,
SENSOR_COUNT
};
enum ioex_port {
IOEX_C0_NCT38XX = 0,
+ IOEX_C1_NCT38XX,
IOEX_C2_NCT38XX,
- IOEX_ID_1_C0_NCT38XX,
- IOEX_ID_1_C2_NCT38XX,
+ IOEX_C3_NCT38XX,
IOEX_PORT_COUNT
};
enum battery_type {
- BATTERY_POWER_TECH,
- BATTERY_LGC011,
+ BATTERY_SIMPLO_COS,
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_KBLIGHT = 0, /* PWM3 */
PWM_CH_FAN, /* PWM5 */
- PWM_CH_LED4, /* PWM7 (white on DB) */
PWM_CH_COUNT
};
diff --git a/board/vell/charger.c b/board/vell/charger.c
index 04be67147d..06933f04f1 100644
--- a/board/vell/charger.c
+++ b/board/vell/charger.c
@@ -10,7 +10,8 @@
#include "charger.h"
#include "compile_time_macros.h"
#include "console.h"
-#include "driver/charger/bq25710.h"
+#include "driver/charger/isl9241.h"
+#include "hooks.h"
#include "usbc_ppc.h"
#include "usb_pd.h"
#include "util.h"
@@ -23,8 +24,8 @@
const struct charger_config_t chg_chips[] = {
{
.i2c_port = I2C_PORT_CHARGER,
- .i2c_addr_flags = BQ25710_SMBUS_ADDR1_FLAGS,
- .drv = &bq25710_drv,
+ .i2c_addr_flags = ISL9241_ADDR_FLAGS,
+ .drv = &isl9241_drv,
},
};
BUILD_ASSERT(ARRAY_SIZE(chg_chips) == CHARGER_NUM);
@@ -88,3 +89,9 @@ __overridable void board_set_charge_limit(int port, int supplier, int charge_ma,
CONFIG_CHARGER_INPUT_CURRENT),
charge_mv);
}
+
+static void set_ac_prochot(void)
+{
+ isl9241_set_ac_prochot(CHARGER_SOLO, PD_MAX_CURRENT_MA);
+}
+DECLARE_HOOK(HOOK_INIT, set_ac_prochot, HOOK_PRIO_DEFAULT);
diff --git a/board/vell/ec.tasklist b/board/vell/ec.tasklist
index 5efc5a8d23..924d708a6b 100644
--- a/board/vell/ec.tasklist
+++ b/board/vell/ec.tasklist
@@ -12,14 +12,17 @@
#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(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) \
TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \
+ TASK_ALWAYS(USB_CHG_P3, usb_charger_task, 0, TASK_STACK_SIZE) \
TASK_ALWAYS(CHARGER, charger_task, NULL, BASEBOARD_CHARGER_TASK_STACK_SIZE) \
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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) \
@@ -27,5 +30,6 @@
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_C2, pd_task, NULL, BASEBOARD_PD_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), BASEBOARD_PD_INT_TASK_STACK_SIZE) \
- TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, BASEBOARD_PD_INT_TASK_STACK_SIZE)
+ TASK_ALWAYS(PD_C3, 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) \
+ TASK_ALWAYS(PD_INT_C1, pd_shared_alert_task, (BIT(3) | BIT(2)), BASEBOARD_PD_INT_TASK_STACK_SIZE)
diff --git a/board/vell/gpio.inc b/board/vell/gpio.inc
index 27f57f392a..3753ad8eb5 100644
--- a/board/vell/gpio.inc
+++ b/board/vell/gpio.inc
@@ -9,32 +9,31 @@
/* 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_ALS_RGB_INT_R_L, PIN(D, 4), GPIO_INT_FALLING, tcs3400_interrupt)
-GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, lsm6dso_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_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_ALL_SYS_PG, PIN(D, 7), 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(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_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_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_C1_PPC_INT_ODL, PIN(9, 5), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INT_FALLING, retimer_interrupt)
GPIO_INT(USB_C2_BC12_INT_ODL, PIN(8, 3), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C2_C3_TCPC_INT_ODL, PIN(A, 2), GPIO_INT_FALLING, tcpc_alert_event)
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(USB_C2_RT_INT_ODL, PIN(9, 4), GPIO_INT_FALLING, retimer_interrupt)
+GPIO_INT(USB_C3_BC12_INT_ODL, PIN(5, 6), GPIO_INT_FALLING, bc12_interrupt)
+GPIO_INT(USB_C3_PPC_INT_ODL, PIN(8, 1), GPIO_INT_FALLING, ppc_interrupt)
+GPIO_INT(USB_C3_RT_INT_ODL, PIN(9, 3), GPIO_INT_FALLING, retimer_interrupt)
/* USED GPIOs: */
GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
@@ -50,17 +49,17 @@ 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_C2_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
-GPIO(EC_I2C_USB_C0_C2_PPC_BC_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)
-GPIO(EC_KB_BL_EN_L, PIN(8, 6), GPIO_OUT_HIGH)
+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_RT_SCL, PIN(D, 1), GPIO_INPUT)
+GPIO(EC_I2C_USB_RT_SDA, PIN(D, 0), 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_C2_C3_PPC_BC_RT_SCL, PIN(E, 4), GPIO_INPUT)
+GPIO(EC_I2C_USB_C2_C3_PPC_BC_RT_SDA, PIN(E, 3), GPIO_INPUT)
+GPIO(EC_I2C_USB_C2_C3_TCPC_SCL, PIN(F, 3), GPIO_INPUT)
+GPIO(EC_I2C_USB_C2_C3_TCPC_SDA, PIN(F, 2), GPIO_INPUT)
+GPIO(EC_KB_BL_EN, PIN(8, 0), GPIO_OUT_LOW)
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)
@@ -70,18 +69,20 @@ 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_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)
GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
-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_RST_ODL, PIN(9, 6), GPIO_ODR_LOW)
-GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT)
-GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), GPIO_ODR_LOW)
+GPIO(USB_C0_C1_TCPC_RST_ODL, PIN(A, 7), GPIO_ODR_LOW)
+GPIO(USB_C2_C3_TCPC_RST_ODL, PIN(9, 6), GPIO_ODR_LOW)
GPIO(VCCST_PWRGD_OD, PIN(A, 4), GPIO_ODR_LOW)
+/* LED */
+GPIO(LED_1_L, PIN(C, 4), GPIO_OUT_HIGH)
+GPIO(LED_2_L, PIN(C, 3), GPIO_OUT_HIGH)
+GPIO(LED_3_L, PIN(C, 2), GPIO_OUT_HIGH)
+GPIO(LED_4_L, PIN(6, 0), GPIO_OUT_HIGH)
+
/* UART alternate functions */
ALTERNATE(PIN_MASK(6, 0x30), 0, MODULE_UART, 0) /* GPIO64/CR_SIN1, GPO65/CR_SOUT1/FLPRG1_L */
@@ -97,14 +98,11 @@ 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(6, 0x01), 0, MODULE_PWM, 0) /* GPIO60/PWM7 */
-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) /* GPIOC4/PWM2, GPIOC3/PWM0, GPIOC2/PWM1/I2C6_SCL0 */
/* 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(4, 0x36), 0, MODULE_ADC, 0) /* GPIO42/ADC3/RI_L, GPIO45/ADC0, GPIO44/ADC1, GPIO41/ADC4*/
ALTERNATE(PIN_MASK(E, 0x02), 0, MODULE_ADC, 0) /* GPIOE1/ADC7 */
/* KB alternate functions */
@@ -125,6 +123,11 @@ 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(F, 4)) /* GPIOF4/I2C5_SDA1 */
+UNUSED(PIN(F, 5)) /* GPIOF5/I2C5_SCL1 */
+UNUSED(PIN(8, 6)) /* GPO86/TXD/CR_SOUT2 */
+UNUSED(PIN(9, 7)) /* GPIO97 */
/* Pre-configured PSL balls: J8 K6 */
@@ -136,14 +139,26 @@ UNUSED(PIN(6, 6)) /* GPIO66 */
GPIO(EC_KSO_02_INV, PIN(1, 7), GPIO_OUT_LOW)
/* IO expander configuration */
-/* GPIO02_P2 to PU */
-/* GPIO03_P2 to PU */
+/* 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_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_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)
+/* 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_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)
/* GPIO07_P2 to PU */
diff --git a/board/vell/i2c.c b/board/vell/i2c.c
index 3db2e0c17b..def6bff688 100644
--- a/board/vell/i2c.c
+++ b/board/vell/i2c.c
@@ -8,8 +8,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[] = {
{
@@ -22,36 +20,35 @@ const struct i2c_port_t i2c_ports[] = {
},
{
/* 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,
+ .name = "tcpc0,1",
+ .port = I2C_PORT_USB_C0_C1_TCPC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C0_C1_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C1_TCPC_SDA,
},
{
/* I2C2 */
- .name = "ppc0,2",
- .port = I2C_PORT_USB_C0_C2_PPC,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SCL,
- .sda = GPIO_EC_I2C_USB_C0_C2_PPC_BC_SDA,
+ .name = "ppc0,1",
+ .port = I2C_PORT_USB_C0_C1_PPC,
+ .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,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,
+ .name = "retimer0,1,2,3",
+ .port = I2C_PORT_USB_C0_C1_MUX,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_RT_SCL,
+ .sda = GPIO_EC_I2C_USB_RT_SDA,
},
{
- /* I2C4 C1 TCPC */
- .name = "tcpc1",
- .port = I2C_PORT_USB_C1_TCPC,
- .kbps = 1000,
- .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
- .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
- .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
+ /* I2C4 */
+ .name = "tcpc2,3",
+ .port = I2C_PORT_USB_C2_C3_TCPC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C2_C3_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C2_C3_TCPC_SDA,
},
{
/* I2C5 */
@@ -63,12 +60,11 @@ const struct i2c_port_t i2c_ports[] = {
},
{
/* 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,
- .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
+ .name = "ppc2,3",
+ .port = I2C_PORT_USB_C2_C3_PPC,
+ .kbps = 400,
+ .scl = GPIO_EC_I2C_USB_C2_C3_PPC_BC_RT_SCL,
+ .sda = GPIO_EC_I2C_USB_C2_C3_PPC_BC_RT_SDA,
},
{
/* I2C7 */
@@ -80,19 +76,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/vell/keyboard.c b/board/vell/keyboard.c
index a9f033130d..2ab0ef9fc3 100644
--- a/board/vell/keyboard.c
+++ b/board/vell/keyboard.c
@@ -4,7 +4,7 @@
*/
#include "common.h"
-
+#include "ec_commands.h"
#include "keyboard_scan.h"
#include "timer.h"
@@ -23,3 +23,30 @@ __override struct keyboard_scan_config keyscan_config = {
0xa4, 0xff, 0xfe, 0x55, 0xfa, 0xca /* full set */
},
};
+
+static const struct ec_response_keybd_config keybd1 = {
+ .num_top_row_keys = 13,
+ .action_keys = {
+ TK_BACK, /* T1 */
+ TK_REFRESH, /* T2 */
+ TK_FULLSCREEN, /* T3 */
+ TK_OVERVIEW, /* T4 */
+ TK_SNAPSHOT, /* T5 */
+ TK_BRIGHTNESS_DOWN, /* T6 */
+ TK_BRIGHTNESS_UP, /* T7 */
+ TK_KBD_BKLIGHT_TOGGLE, /* T8 */
+ TK_PLAY_PAUSE, /* T9 */
+ TK_MICMUTE, /* T10 */
+ TK_VOL_MUTE, /* T11 */
+ TK_VOL_DOWN, /* T12 */
+ TK_VOL_UP, /* T13 */
+ },
+ .capabilities = KEYBD_CAP_SCRNLOCK_KEY,
+};
+
+__override const struct ec_response_keybd_config *
+board_vivaldi_keybd_config(void)
+{
+ return &keybd1;
+
+}
diff --git a/board/vell/led.c b/board/vell/led.c
index 68945ec79e..48555f8de7 100644
--- a/board/vell/led.c
+++ b/board/vell/led.c
@@ -1,93 +1,206 @@
/* 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.
- */
-
-/* Brya 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.
+ *
+ * Power and battery LED control for Vell
*/
#include <stdint.h>
-#include "common.h"
-#include "compile_time_macros.h"
+#include "battery.h"
+#include "charge_manager.h"
+#include "charge_state.h"
#include "ec_commands.h"
-#include "led_pwm.h"
-#include "pwm.h"
+#include "gpio.h"
+#include "host_command.h"
+#include "led_common.h"
+#include "task.h"
#include "util.h"
+#define BAT_LED_ON 0
+#define BAT_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_RIGHT_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.
- */
-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 },
+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,
- },
- {
- .ch0 = PWM_CH_LED3,
- .ch1 = PWM_CH_LED4,
- .ch2 = PWM_LED_NO_CHANNEL,
- .enable = &pwm_enable,
- .set_duty = &pwm_set_duty,
- },
+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_RIGHT_LED_AMBER_L :
+ GPIO_LEFT_LED_AMBER_L);
+ white_led = (port == RIGHT_PORT ? GPIO_RIGHT_LED_WHITE_L :
+ GPIO_LEFT_LED_WHITE_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_LEFT_LED:
+ brightness_range[EC_LED_COLOR_WHITE] = 1;
+ brightness_range[EC_LED_COLOR_AMBER] = 1;
+ break;
+ case EC_LED_ID_RIGHT_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;
+ if (brightness[EC_LED_COLOR_WHITE] != 0)
+ led_set_color_battery(LEFT_PORT, LED_WHITE);
+ else if (brightness[EC_LED_COLOR_AMBER] != 0)
+ led_set_color_battery(LEFT_PORT, LED_AMBER);
+ else
+ led_set_color_battery(LEFT_PORT, LED_OFF);
break;
case EC_LED_ID_RIGHT_LED:
- pwm_id = PWM_LED1;
+ if (brightness[EC_LED_COLOR_WHITE] != 0)
+ led_set_color_battery(RIGHT_PORT, LED_WHITE);
+ else if (brightness[EC_LED_COLOR_AMBER] != 0)
+ led_set_color_battery(RIGHT_PORT, LED_AMBER);
+ else
+ led_set_color_battery(RIGHT_PORT, 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)
+{
+ int usbc_port = charge_manager_get_active_charge_port();
+ int port = 0;
+
+ if ((usbc_port == USBC_PORT_C0) || (usbc_port == USBC_PORT_C1))
+ port = RIGHT_PORT;
+ else if ((usbc_port == USBC_PORT_C2) || (usbc_port == USBC_PORT_C3))
+ port = LEFT_PORT;
+
+ if (led_auto_control_is_enabled(EC_LED_ID_RIGHT_LED))
+ led_set_color_battery(RIGHT_PORT,
+ (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);
+}
+
+static void led_set_battery(void)
+{
+ static unsigned int battery_ticks;
+ uint32_t chflags = charge_get_flags();
+
+ battery_ticks++;
+
+ 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:
+ 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);
+ else
+ led_set_color_battery(RIGHT_PORT, LED_OFF);
+ }
+
+ if (led_auto_control_is_enabled(EC_LED_ID_LEFT_LED))
+ led_set_color_battery(LEFT_PORT, LED_OFF);
+ break;
+ case PWR_STATE_ERROR:
+ set_active_port_color((battery_ticks & 0x1) ?
+ 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);
+ 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/vell/pwm.c b/board/vell/pwm.c
index 6e662f8e7d..8535de88e1 100644
--- a/board/vell/pwm.c
+++ b/board/vell/pwm.c
@@ -11,21 +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_LED3] = {
- .channel = 1,
- .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,
@@ -42,11 +27,6 @@ const struct pwm_t pwm_channels[] = {
.flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
.freq = 1000
},
- [PWM_CH_LED4] = {
- .channel = 7,
- .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
- .freq = 4800,
- },
};
BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
@@ -54,17 +34,7 @@ static void board_pwm_init(void)
{
/*
* Turn on all the LED at 50%.
- * Turn on the fan at 100%.
*/
- 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_LED3, 1);
- pwm_set_duty(PWM_CH_LED3, 50);
- pwm_enable(PWM_CH_LED4, 1);
- pwm_set_duty(PWM_CH_LED4, 50);
-
pwm_enable(PWM_CH_KBLIGHT, 1);
pwm_set_duty(PWM_CH_KBLIGHT, 50);
}
diff --git a/board/vell/sensors.c b/board/vell/sensors.c
index 0a4b0198bd..46bc33e492 100644
--- a/board/vell/sensors.c
+++ b/board/vell/sensors.c
@@ -6,8 +6,6 @@
#include "common.h"
#include "accelgyro.h"
#include "adc.h"
-#include "driver/accel_lis2dw12.h"
-#include "driver/accelgyro_lsm6dso.h"
#include "driver/als_tcs3400_public.h"
#include "hooks.h"
#include "motion_sense.h"
@@ -17,56 +15,44 @@
/* ADC configuration */
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_CHARGER] = {
+ .name = "TEMP_CHARGER",
.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",
+ [ADC_TEMP_SENSOR_3_WWAN] = {
+ .name = "TEMP_WWAN",
.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",
+ [ADC_TEMP_SENSOR_4_DDR] = {
+ .name = "TEMP_DDR",
.input_ch = NPCX_ADC_CH7,
.factor_mul = ADC_MAX_VOLT,
.factor_div = ADC_READ_MAX + 1,
.shift = 0,
},
+ [ADC_TEMP_SENSOR_5_REGULATOR] = {
+ .name = "TEMP_REGULATOR",
+ .input_ch = NPCX_ADC_CH4,
+ .factor_mul = ADC_MAX_VOLT,
+ .factor_div = ADC_READ_MAX + 1,
+ .shift = 0,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
-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;
-
-/* 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)}
-};
-
-/* 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)}
-};
-
/* TCS3400 private data */
static struct als_drv_data_t g_tcs3400_data = {
.als_cal.scale = 1,
@@ -122,85 +108,6 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = {
};
struct motion_sensor_t motion_sensors[] = {
- [LID_ACCEL] = {
- .name = "Lid Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LIS2DW12,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &lis2dw12_drv,
- .mutex = &g_lid_accel_mutex,
- .drv_data = &g_lis2dw12_data,
- .int_signal = GPIO_EC_ACCEL_INT_R_L,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LIS2DW12_ADDR0,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .rot_standard_ref = &lid_standard_ref, /* identity matrix */
- .default_range = 2, /* g */
- .min_frequency = LIS2DW12_ODR_MIN_VAL,
- .max_frequency = LIS2DW12_ODR_MAX_VAL,
- .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,
- },
- },
- },
-
- [BASE_ACCEL] = {
- .name = "Base Accel",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LSM6DSO,
- .type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &lsm6dso_drv,
- .mutex = &g_base_accel_mutex,
- .drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
- MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = LSM6DSO_ODR_MIN_VAL,
- .max_frequency = LSM6DSO_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,
- },
- },
- },
-
- [BASE_GYRO] = {
- .name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_LSM6DSO,
- .type = MOTIONSENSE_TYPE_GYRO,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &lsm6dso_drv,
- .mutex = &g_base_accel_mutex,
- .drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
- MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_EC_IMU_INT_R_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
- .port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
- .default_range = 1000 | ROUND_UP_FLAG, /* dps */
- .rot_standard_ref = &base_standard_ref,
- .min_frequency = LSM6DSO_ODR_MIN_VAL,
- .max_frequency = LSM6DSO_ODR_MAX_VAL,
- },
-
[CLEAR_ALS] = {
.name = "Clear Light",
.active_mask = SENSOR_ACTIVE_S0_S3,
@@ -249,46 +156,48 @@ BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
static void baseboard_sensors_init(void)
{
- /* Enable gpio interrupt for lid accel sensor */
- gpio_enable_interrupt(GPIO_EC_ACCEL_INT_R_L);
/* Enable interrupt for the TCS3400 color light sensor */
gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_R_L);
- /* Enable gpio interrupt for base accelgyro sensor */
- gpio_enable_interrupt(GPIO_EC_IMU_INT_R_L);
}
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_CHARGER] = {
+ .name = "Charger",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_2_AMBIENT,
+ .idx = ADC_TEMP_SENSOR_2_CHARGER,
},
- [TEMP_SENSOR_3_CHARGER] = {
- .name = "Charger",
+ [TEMP_SENSOR_3_WWAN] = {
+ .name = "WWAN",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_3_CHARGER,
+ .idx = ADC_TEMP_SENSOR_3_WWAN,
},
- [TEMP_SENSOR_4_WWAN] = {
- .name = "WWAN",
+ [TEMP_SENSOR_4_DDR] = {
+ .name = "DDR",
.type = TEMP_SENSOR_TYPE_BOARD,
.read = get_temp_3v3_30k9_47k_4050b,
- .idx = ADC_TEMP_SENSOR_4_WWAN,
+ .idx = ADC_TEMP_SENSOR_4_DDR,
+ },
+ [TEMP_SENSOR_5_REGULATOR] = {
+ .name = "Regulator",
+ .type = TEMP_SENSOR_TYPE_BOARD,
+ .read = get_temp_3v3_30k9_47k_4050b,
+ .idx = ADC_TEMP_SENSOR_5_REGULATOR,
},
};
BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
/*
- * TODO(b/180681346): update for Alder Lake/brya
+ * TODO(b/203839956): update for Alder Lake/vell
*
* 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
@@ -312,17 +221,7 @@ BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT);
__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/203839956): update for Alder Lake/vell
*/
/*
* TODO(b/202062363): Remove when clang is fixed.
@@ -343,15 +242,7 @@ __maybe_unused static const struct ec_thermal_config thermal_ambient =
THERMAL_AMBIENT;
/*
- * 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/203839956): update for Alder Lake/vell
*/
/*
* TODO(b/202062363): Remove when clang is fixed.
@@ -372,7 +263,7 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
THERMAL_CHARGER;
/*
- * TODO(b/180681346): update for brya WWAN module
+ * TODO(b/203839956): update for vell WWAN module
*/
/*
* TODO(b/202062363): Remove when clang is fixed.
@@ -392,27 +283,54 @@ __maybe_unused static const struct ec_thermal_config thermal_charger =
__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);
+/*
+ * TODO(b/203839956): update for Alder Lake/vell
+ */
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
-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;
+#define THERMAL_DDR \
+ { \
+ .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_ddr =
+ THERMAL_DDR;
+
+/*
+ * TODO(b/203839956): update for Alder Lake/vell
+ */
+/*
+ * TODO(b/202062363): Remove when clang is fixed.
+ */
+
+#define THERMAL_REGULATOR \
+ { \
+ .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_regulator =
+ THERMAL_REGULATOR;
-DECLARE_HOOK(HOOK_INIT, board_thermals_init, HOOK_PRIO_INIT_CHIPSET);
+struct ec_thermal_config thermal_params[] = {
+ [TEMP_SENSOR_1_SOC] = thermal_cpu,
+ [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/usbc_config.c b/board/vell/usbc_config.c
index ba50928dd2..eca6782ba4 100644
--- a/board/vell/usbc_config.c
+++ b/board/vell/usbc_config.c
@@ -17,7 +17,6 @@
#include "driver/ppc/syv682x_public.h"
#include "driver/retimer/bb_retimer_public.h"
#include "driver/tcpm/nct38xx.h"
-#include "driver/tcpm/ps8xxx_public.h"
#include "driver/tcpm/tcpci.h"
#include "ec_commands.h"
#include "fw_config.h"
@@ -44,29 +43,35 @@ 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,
+ .port = I2C_PORT_USB_C0_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,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
},
[USBC_PORT_C1] = {
.bus_type = EC_BUS_TYPE_I2C,
.i2c_info = {
- .port = I2C_PORT_USB_C1_TCPC,
- .addr_flags = PS8751_I2C_ADDR1_FLAGS,
+ .port = I2C_PORT_USB_C0_C1_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR2_1_FLAGS,
},
- .drv = &ps8xxx_tcpm_drv,
- .flags = TCPC_FLAGS_TCPCI_REV2_0 |
- TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
- TCPC_FLAGS_CONTROL_VCONN,
+ .drv = &nct38xx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
},
[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,
+ .port = I2C_PORT_USB_C2_C3_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR1_4_FLAGS,
+ },
+ .drv = &nct38xx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0,
+ },
+ [USBC_PORT_C3] = {
+ .bus_type = EC_BUS_TYPE_I2C,
+ .i2c_info = {
+ .port = I2C_PORT_USB_C2_C3_TCPC,
+ .addr_flags = NCT38XX_I2C_ADDR2_4_FLAGS,
},
.drv = &nct38xx_tcpm_drv,
.flags = TCPC_FLAGS_TCPCI_REV2_0,
@@ -75,38 +80,28 @@ 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);
-/******************************************************************************/
-/* USB-A charging control */
-
-const int usb_port_enable[USB_PORT_COUNT] = {
- GPIO_EN_PP5000_USBA_R,
-};
-BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_PORT_COUNT);
-
-/******************************************************************************/
-
/* USBC PPC configuration */
struct ppc_config_t ppc_chips[] = {
[USBC_PORT_C0] = {
- .i2c_port = I2C_PORT_USB_C0_C2_PPC,
+ .i2c_port = I2C_PORT_USB_C0_C1_PPC,
.i2c_addr_flags = SYV682X_ADDR0_FLAGS,
.drv = &syv682x_drv,
},
[USBC_PORT_C1] = {
- /* Compatible with Silicon Mitus SM536A0 */
- .i2c_port = I2C_PORT_USB_C1_PPC,
- .i2c_addr_flags = NX20P3483_ADDR2_FLAGS,
- .drv = &nx20p348x_drv,
+ .i2c_port = I2C_PORT_USB_C0_C1_PPC,
+ .i2c_addr_flags = SYV682X_ADDR1_FLAGS,
+ .drv = &syv682x_drv,
},
[USBC_PORT_C2] = {
- .i2c_port = I2C_PORT_USB_C0_C2_PPC,
- /*
- * b/179987870
- * schematics I2C map says ADDR3
- */
+ .i2c_port = I2C_PORT_USB_C2_C3_PPC,
.i2c_addr_flags = SYV682X_ADDR2_FLAGS,
.drv = &syv682x_drv,
},
+ [USBC_PORT_C3] = {
+ .i2c_port = I2C_PORT_USB_C2_C3_PPC,
+ .i2c_addr_flags = SYV682X_ADDR3_FLAGS,
+ .drv = &syv682x_drv,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(ppc_chips) == USBC_PORT_COUNT);
@@ -118,21 +113,20 @@ static const struct usb_mux usbc0_tcss_usb_mux = {
.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,
};
-
-/*
- * 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 usbc3_tcss_usb_mux = {
+ .usb_port = USBC_PORT_C3,
+ .driver = &virtual_usb_mux_driver,
+ .hpd_update = &virtual_hpd_update,
};
const struct usb_mux usb_muxes[] = {
@@ -140,42 +134,55 @@ const struct usb_mux usb_muxes[] = {
.usb_port = USBC_PORT_C0,
.driver = &bb_usb_retimer,
.hpd_update = bb_retimer_hpd_update,
- .i2c_port = I2C_PORT_USB_C0_C2_MUX,
+ .i2c_port = I2C_PORT_USB_C0_C1_MUX,
.i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
.next_mux = &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,
+ .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,
},
[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_port = I2C_PORT_USB_C2_C3_MUX,
.i2c_addr_flags = USBC_PORT_C2_BB_RETIMER_I2C_ADDR,
.next_mux = &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,
+ },
};
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_port = I2C_PORT_USB_C0_C1_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,
+ .i2c_port = I2C_PORT_USB_C0_C1_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_2_FLAGS,
},
[USBC_PORT_C2] = {
- .i2c_port = I2C_PORT_USB_C0_C2_BC12,
+ .i2c_port = I2C_PORT_USB_C2_C3_BC12,
.i2c_addr_flags = PI3USB9201_I2C_ADDR_1_FLAGS,
},
+ [USBC_PORT_C3] = {
+ .i2c_port = I2C_PORT_USB_C2_C3_BC12,
+ .i2c_addr_flags = PI3USB9201_I2C_ADDR_0_FLAGS,
+ },
};
BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
@@ -190,26 +197,26 @@ BUILD_ASSERT(ARRAY_SIZE(pi3usb9201_bc12_chips) == USBC_PORT_COUNT);
struct ioexpander_config_t ioex_config[] = {
[IOEX_C0_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
+ .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,
},
- [IOEX_C2_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
+ [IOEX_C1_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_ID_1_C0_NCT38XX] = {
- .i2c_host_port = I2C_PORT_USB_C0_C2_TCPC,
- .i2c_addr_flags = NCT38XX_I2C_ADDR1_1_FLAGS,
+ [IOEX_C2_NCT38XX] = {
+ .i2c_host_port = I2C_PORT_USB_C2_C3_TCPC,
+ .i2c_addr_flags = NCT38XX_I2C_ADDR1_4_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,
+ [IOEX_C3_NCT38XX] = {
+ .i2c_host_port = I2C_PORT_USB_C2_C3_TCPC,
+ .i2c_addr_flags = NCT38XX_I2C_ADDR2_4_FLAGS,
.drv = &nct38xx_ioexpander_drv,
.flags = IOEX_FLAGS_DEFAULT_INIT_DISABLED,
},
@@ -256,8 +263,12 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
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 if (me->usb_port == USBC_PORT_C2)
rst_signal = IOEX_USB_C2_RT_RST_ODL;
+ else if (me->usb_port == USBC_PORT_C3)
+ rst_signal = IOEX_USB_C3_RT_RST_ODL;
else
return EC_ERROR_INVAL;
@@ -288,63 +299,58 @@ __override int bb_retimer_power_enable(const struct usb_mux *me, bool enable)
void board_reset_pd_mcu(void)
{
- /*
- * TODO(b/203371200): figure out correct timing
- */
-
- gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 0);
- gpio_set_level(GPIO_USB_C1_RST_ODL, 0);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+ gpio_set_level(GPIO_USB_C0_C1_TCPC_RST_ODL, 0);
+ gpio_set_level(GPIO_USB_C2_C3_TCPC_RST_ODL, 0);
/*
* delay for power-on to reset-off and min. assertion time
*/
+ msleep(NCT38XX_RESET_HOLD_DELAY_MS);
- msleep(20);
+ gpio_set_level(GPIO_USB_C0_C1_TCPC_RST_ODL, 1);
+ gpio_set_level(GPIO_USB_C2_C3_TCPC_RST_ODL, 1);
- gpio_set_level(GPIO_USB_C0_C2_TCPC_RST_ODL, 1);
- gpio_set_level(GPIO_USB_C1_RST_ODL, 1);
- gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
+ nct38xx_reset_notify(USBC_PORT_C0);
+ nct38xx_reset_notify(USBC_PORT_C1);
+ nct38xx_reset_notify(USBC_PORT_C2);
+ nct38xx_reset_notify(USBC_PORT_C3);
/* wait for chips to come up */
-
- msleep(50);
-}
-
-static void enable_ioex(int ioex)
-{
- ioex_init(ioex);
+ if (NCT3808_RESET_POST_DELAY_MS != 0)
+ msleep(NCT3808_RESET_POST_DELAY_MS);
}
static void board_tcpc_init(void)
{
+ int i;
+
/* Don't reset TCPCs after initial reset */
- if (!system_jumped_late()) {
+ 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);
- }
+ /*
+ * These IO expander pins are implemented using the
+ * C0/C1/C2/C3 TCPCs, so they must be set up after the TCPC
+ * has been taken out of reset.
+ */
+ for (i = 0; i < CONFIG_IO_EXPANDER_PORT_COUNT; ++i)
+ ioex_init(i);
/* Enable PPC interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C2_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C3_PPC_INT_ODL);
/* Enable TCPC interrupts. */
- gpio_enable_interrupt(GPIO_USB_C0_C2_TCPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C0_C1_TCPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C2_C3_TCPC_INT_ODL);
/* Enable BC1.2 interrupts. */
gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C2_BC12_INT_ODL);
-
- gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
- gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
gpio_enable_interrupt(GPIO_USB_C1_BC12_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C2_BC12_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C3_BC12_INT_ODL);
}
DECLARE_HOOK(HOOK_INIT, board_tcpc_init, HOOK_PRIO_INIT_CHIPSET);
@@ -352,11 +358,11 @@ 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_C0_C1_TCPC_INT_ODL) == 0)
+ status = PD_STATUS_TCPC_ALERT_0 | PD_STATUS_TCPC_ALERT_1;
- if (gpio_get_level(GPIO_USB_C1_TCPC_INT_ODL) == 0)
- status |= PD_STATUS_TCPC_ALERT_1;
+ if (gpio_get_level(GPIO_USB_C2_C3_TCPC_INT_ODL) == 0)
+ status = PD_STATUS_TCPC_ALERT_2 | PD_STATUS_TCPC_ALERT_3;
return status;
}
@@ -369,17 +375,19 @@ int ppc_get_alert_status(int port)
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;
+ else if (port == USBC_PORT_C3)
+ return gpio_get_level(GPIO_USB_C3_PPC_INT_ODL) == 0;
return 0;
}
void tcpc_alert_event(enum gpio_signal signal)
{
switch (signal) {
- case GPIO_USB_C0_C2_TCPC_INT_ODL:
+ case GPIO_USB_C0_C1_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);
+ case GPIO_USB_C2_C3_TCPC_INT_ODL:
+ schedule_deferred_pd_interrupt(USBC_PORT_C2);
break;
default:
break;
@@ -398,6 +406,9 @@ void bc12_interrupt(enum gpio_signal signal)
case GPIO_USB_C2_BC12_INT_ODL:
task_set_event(TASK_ID_USB_CHG_P2, USB_CHG_EVENT_BC12);
break;
+ case GPIO_USB_C3_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P3, USB_CHG_EVENT_BC12);
+ break;
default:
break;
}
@@ -410,11 +421,14 @@ void ppc_interrupt(enum gpio_signal signal)
syv682x_interrupt(USBC_PORT_C0);
break;
case GPIO_USB_C1_PPC_INT_ODL:
- nx20p348x_interrupt(USBC_PORT_C1);
+ syv682x_interrupt(USBC_PORT_C1);
break;
case GPIO_USB_C2_PPC_INT_ODL:
syv682x_interrupt(USBC_PORT_C2);
break;
+ case GPIO_USB_C3_PPC_INT_ODL:
+ syv682x_interrupt(USBC_PORT_C3);
+ break;
default:
break;
}
@@ -431,19 +445,3 @@ __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_C2)
- 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/vell/usbc_config.h b/board/vell/usbc_config.h
index f21e2c17dc..447c03efb3 100644
--- a/board/vell/usbc_config.h
+++ b/board/vell/usbc_config.h
@@ -8,12 +8,13 @@
#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 4
enum usbc_port {
USBC_PORT_C0 = 0,
USBC_PORT_C1,
USBC_PORT_C2,
+ USBC_PORT_C3,
USBC_PORT_COUNT
};
diff --git a/board/vilboz/board.c b/board/vilboz/board.c
index a39d46cbcd..006ee57645 100644
--- a/board/vilboz/board.c
+++ b/board/vilboz/board.c
@@ -106,8 +106,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs.*/
@@ -138,8 +136,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(g_lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_6AXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/voema/ec.tasklist b/board/voema/ec.tasklist
index 292de51cdb..3e20d8ae39 100644
--- a/board/voema/ec.tasklist
+++ b/board/voema/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/volet/ec.tasklist b/board/volet/ec.tasklist
index e76bd368eb..ca6d9fbf14 100644
--- a/board/volet/ec.tasklist
+++ b/board/volet/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/volmar/battery.c b/board/volmar/battery.c
new file mode 100644
index 0000000000..172365195e
--- /dev/null
+++ b/board/volmar/battery.c
@@ -0,0 +1,112 @@
+/* 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_fuel_gauge.h"
+#include "cbi.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "gpio.h"
+/*
+ * Battery info for all Brya 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,
+ },
+ },
+ /* LGC L17L3PB0 Battery Information */
+ /*
+ * Battery info provided by ODM on b/143477210, comment #11
+ */
+ [BATTERY_LGC011] = {
+ .fuel_gauge = {
+ .manuf_name = "LGC",
+ .ship_mode = {
+ .reg_addr = 0x00,
+ .reg_data = { 0x0010, 0x0010 },
+ },
+ .fet = {
+ .reg_addr = 0x0,
+ .reg_mask = 0x6000,
+ .disconnect_val = 0x6000,
+ }
+ },
+ .batt_info = {
+ .voltage_max = TARGET_WITH_MARGIN(13200, 5),
+ .voltage_normal = 11550, /* 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 = 0,
+ .discharging_max_c = 75,
+ },
+ },
+};
+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;
+
+ if (get_board_id() == 1)
+ batt_pres = GPIO_ID_1_EC_BATT_PRES_ODL;
+ else
+ 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/volmar/board.c b/board/volmar/board.c
new file mode 100644
index 0000000000..4ca53ffa48
--- /dev/null
+++ b/board/volmar/board.c
@@ -0,0 +1,108 @@
+/* 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 "battery.h"
+#include "button.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/als_tcs3400.h"
+#include "fw_config.h"
+#include "hooks.h"
+#include "lid_switch.h"
+#include "power_button.h"
+#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)
+
+__override void board_cbi_init(void)
+{
+ config_usb_db_type();
+}
+
+/* Called on AP S3 -> S0 transition */
+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
+ gpio_set_level(GPIO_EC_KB_BL_EN_L, 0);
+}
+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. */
+
+ if (get_board_id() == 1)
+ gpio_set_level(GPIO_ID_1_EC_KB_BL_EN, 0);
+ else
+ 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/volmar/board.h b/board/volmar/board.h
new file mode 100644
index 0000000000..b9217e32d9
--- /dev/null
+++ b/board/volmar/board.h
@@ -0,0 +1,286 @@
+/* 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.
+ */
+
+/* Brya board configuration */
+
+#ifndef __CROS_EC_BOARD_H
+#define __CROS_EC_BOARD_H
+
+#include "compile_time_macros.h"
+
+/*
+ * Early brya boards are not set up for vivaldi
+ */
+#undef CONFIG_KEYBOARD_VIVALDI
+
+/* Baseboard features */
+#include "baseboard.h"
+
+/*
+ * This will happen automatically on NPCX9 ES2 and later. Do not remove
+ * until we can confirm all earlier chips are out of service.
+ */
+#define CONFIG_HIBERNATE_PSL_VCC1_RST_WAKEUP
+
+#define CONFIG_MP2964
+
+/* LED */
+#define CONFIG_LED_PWM
+#define CONFIG_LED_PWM_COUNT 2
+#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 */
+#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */
+#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
+
+/* TCS3400 ALS */
+#define CONFIG_ALS
+#define ALS_COUNT 1
+#define CONFIG_ALS_TCS3400
+#define CONFIG_ALS_TCS3400_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(CLEAR_ALS)
+
+/* Enable sensor fifo, must also define the _SIZE and _THRES */
+#define CONFIG_ACCEL_FIFO
+/* FIFO size is in power of 2. */
+#define CONFIG_ACCEL_FIFO_SIZE 256
+/* 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(LID_ACCEL) | BIT(CLEAR_ALS))
+
+/* 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_ACCEL_LIS2DWL
+#define CONFIG_ACCEL_LIS2DW_AS_BASE
+#define CONFIG_ACCEL_LIS2DW12_INT_EVENT \
+ TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL)
+
+#define CONFIG_ACCEL_INTERRUPTS
+
+/* Sensor console commands */
+#define CONFIG_CMD_ACCELS
+#define CONFIG_CMD_ACCEL_INFO
+
+/* USB Type A Features */
+#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
+
+#define CONFIG_IO_EXPANDER
+#define CONFIG_IO_EXPANDER_NCT38XX
+#define CONFIG_IO_EXPANDER_PORT_COUNT 4
+
+#define CONFIG_USB_PD_TCPM_PS8815
+#define CONFIG_USB_PD_TCPM_PS8815_FORCE_DID
+#define CONFIG_USBC_RETIMER_INTEL_BB
+
+/* I2C speed console command */
+#define CONFIG_CMD_I2C_SPEED
+
+/* I2C control host command */
+#define CONFIG_HOSTCMD_I2C_CONTROL
+
+#define CONFIG_USBC_PPC_SYV682X
+#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 */
+
+/*
+ * 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 GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE_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_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
+
+/* I2C Bus Configuration */
+
+#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_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_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
+
+/*
+ * see b/174768555#comment22
+ */
+#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
+
+/* Retimer */
+#define CONFIG_USBC_RETIMER_FW_UPDATE
+
+/* Thermal features */
+#define CONFIG_THERMISTOR
+#define CONFIG_TEMP_SENSOR
+#define CONFIG_TEMP_SENSOR_POWER_GPIO GPIO_SEQ_EC_DSW_PWROK
+#define CONFIG_STEINHART_HART_3V3_30K9_47K_4050B
+
+#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_CHARGE_RAMP_SW
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR 10
+#define CONFIG_CHARGER_BQ25710_SENSE_RESISTOR_AC 10
+#define CONFIG_CHARGER_BQ25710_PSYS_SENSING
+
+/*
+ * Older boards have a different ADC assignment.
+ */
+
+#define CONFIG_ADC_CHANNELS_RUNTIME_CONFIG
+
+#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 sensor_id {
+ LID_ACCEL = 0,
+ BASE_ACCEL,
+ BASE_GYRO,
+ CLEAR_ALS,
+ RGB_ALS,
+ 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 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_COUNT
+};
+
+enum fan_channel {
+ FAN_CH_0 = 0,
+ FAN_CH_COUNT
+};
+
+enum mft_channel {
+ MFT_CH_0 = 0,
+ MFT_CH_COUNT
+};
+
+#endif /* !__ASSEMBLER__ */
+
+#endif /* __CROS_EC_BOARD_H */
diff --git a/board/volmar/build.mk b/board/volmar/build.mk
new file mode 100644
index 0000000000..e69587a781
--- /dev/null
+++ b/board/volmar/build.mk
@@ -0,0 +1,26 @@
+# -*- makefile -*-
+# 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.
+#
+# Brya board specific files build
+#
+
+CHIP:=npcx
+CHIP_FAMILY:=npcx9
+CHIP_VARIANT:=npcx9m3f
+BASEBOARD:=brya
+
+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
+board-y+=tune_mp2964.o
+board-y+=usbc_config.o
diff --git a/board/volmar/charger.c b/board/volmar/charger.c
new file mode 100644
index 0000000000..e6a5c446d7
--- /dev/null
+++ b/board/volmar/charger.c
@@ -0,0 +1,90 @@
+/* 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/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)
+
+/* 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);
+
+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/volmar/ec.tasklist b/board/volmar/ec.tasklist
new file mode 100644
index 0000000000..a049ba3bfa
--- /dev/null
+++ b/board/volmar/ec.tasklist
@@ -0,0 +1,32 @@
+/* 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(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) \
+ TASK_ALWAYS(USB_CHG_P2, usb_charger_task, 0, TASK_STACK_SIZE) \
+ TASK_ALWAYS(CHARGER, charger_task, NULL, BASEBOARD_CHARGER_TASK_STACK_SIZE) \
+ TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_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_C2, pd_task, NULL, BASEBOARD_PD_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C0, pd_shared_alert_task, (BIT(2) | BIT(0)), BASEBOARD_PD_INT_TASK_STACK_SIZE) \
+ TASK_ALWAYS(PD_INT_C1, pd_interrupt_handler_task, 1, BASEBOARD_PD_INT_TASK_STACK_SIZE)
diff --git a/board/volmar/fans.c b/board/volmar/fans.c
new file mode 100644
index 0000000000..27f5bca929
--- /dev/null
+++ b/board/volmar/fans.c
@@ -0,0 +1,89 @@
+/* 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"
+
+/* MFT channels. These are logically separate from pwm_channels. */
+const struct mft_t mft_channels[] = {
+ [MFT_CH_0] = {
+ .module = NPCX_MFT_MODULE_1,
+ .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/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,
+};
+
+const struct fan_t fans[FAN_CH_COUNT] = {
+ [FAN_CH_0] = {
+ .conf = &fan_conf_0,
+ .rpm = &fan_rpm_0,
+ },
+};
+
+#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)
+{
+ const int duty_pct = 33;
+
+ ccprints("%s: speed %d%%", __func__, duty_pct);
+
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, duty_pct);
+}
+
+static void fan_max(void)
+{
+ const int duty_pct = 100;
+
+ ccprints("%s: speed %d%%", __func__, duty_pct);
+
+ pwm_enable(PWM_CH_FAN, 1);
+ pwm_set_duty(PWM_CH_FAN, 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/volmar/fw_config.c b/board/volmar/fw_config.c
new file mode 100644
index 0000000000..544f276d25
--- /dev/null
+++ b/board/volmar/fw_config.c
@@ -0,0 +1,61 @@
+/* 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_CHIPSET, format, ## args)
+
+static union brya_cbi_fw_config fw_config;
+BUILD_ASSERT(sizeof(fw_config) == sizeof(uint32_t));
+
+/*
+ * FW_CONFIG defaults for brya if the CBI.FW_CONFIG data is not
+ * initialized.
+ */
+static const union brya_cbi_fw_config fw_config_defaults = {
+ .usb_db = DB_USB3_PS8815,
+ .kb_bl = KEYBOARD_BACKLIGHT_ENABLED,
+};
+
+/****************************************************************************
+ * Brya 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;
+ }
+
+ 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)
+{
+ return fw_config;
+}
+
+enum ec_cfg_usb_db_type ec_cfg_usb_db_type(void)
+{
+ return fw_config.usb_db;
+}
diff --git a/board/volmar/fw_config.h b/board/volmar/fw_config.h
new file mode 100644
index 0000000000..ed4dbce7d9
--- /dev/null
+++ b/board/volmar/fw_config.h
@@ -0,0 +1,54 @@
+/* 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_BRYA_FW_CONFIG_H_
+#define __BOARD_BRYA_FW_CONFIG_H_
+
+#include <stdint.h>
+
+/****************************************************************************
+ * CBI FW_CONFIG layout for Brya board.
+ *
+ * Source of truth is the project/brya/brya/config.star configuration file.
+ */
+
+enum ec_cfg_usb_db_type {
+ DB_USB_ABSENT = 0,
+ DB_USB3_PS8815 = 1,
+ DB_USB_ABSENT2 = 15
+};
+
+enum ec_cfg_keyboard_backlight_type {
+ KEYBOARD_BACKLIGHT_DISABLED = 0,
+ KEYBOARD_BACKLIGHT_ENABLED = 1
+};
+
+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;
+ };
+ uint32_t raw_value;
+};
+
+/**
+ * Read the cached FW_CONFIG. Guaranteed to have valid values.
+ *
+ * @return the FW_CONFIG for the board.
+ */
+union brya_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_BRYA_FW_CONFIG_H_ */
diff --git a/board/volmar/generated-gpio.inc b/board/volmar/generated-gpio.inc
new file mode 100644
index 0000000000..f4772188a5
--- /dev/null
+++ b/board/volmar/generated-gpio.inc
@@ -0,0 +1,125 @@
+/*
+ * 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_ACCEL_INT_R_L, PIN(8, 1), GPIO_SEL_1P8V | GPIO_INT_FALLING, lis2dw12_interrupt)
+GPIO_INT(EC_ALS_RGB_INT_R_L, PIN(D, 4), GPIO_INT_FALLING, tcs3400_interrupt)
+GPIO_INT(EC_IMU_INT_R_L, PIN(5, 6), GPIO_SEL_1P8V | GPIO_INT_FALLING, lsm6dso_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_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(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)
+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)
+
+/* USED GPIOs: */
+GPIO(CCD_MODE_ODL, PIN(E, 5), GPIO_INPUT)
+GPIO(CHARGER_VAP_OTG_EN, PIN(7, 3), GPIO_OUT_LOW)
+GPIO(CPU_C10_GATE_L, PIN(6, 7), 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(D, 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_C2_PPC_BC_SCL, PIN(9, 2), GPIO_INPUT)
+GPIO(EC_I2C_USB_C0_C2_PPC_BC_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)
+GPIO(EC_KB_BL_EN_L, PIN(8, 6), 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_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)
+GPIO(PCH_PWROK, PIN(7, 2), GPIO_OUT_LOW)
+GPIO(SYS_RST_ODL, PIN(C, 5), GPIO_ODR_HIGH)
+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_RST_ODL, PIN(9, 6), GPIO_ODR_LOW)
+GPIO(USB_C1_RT_INT_ODL, PIN(A, 0), GPIO_INPUT)
+GPIO(USB_C1_RT_RST_R_ODL, PIN(0, 2), 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 */
+ALTERNATE(PIN_MASK(F, 0x0c), 0, MODULE_I2C, 0) /* GPIOF3/I2C4_SCL1, GPIOF2/I2C4_SDA1 */
+
+/* PWM alternate functions */
+ALTERNATE(PIN_MASK(4, 0x01), 0, MODULE_PWM, 0) /* GPIO40/TA1 */
+ALTERNATE(PIN_MASK(6, 0x01), 0, MODULE_PWM, 0) /* GPIO60/PWM7 */
+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) /* GPIOC4/PWM2, GPIOC3/PWM0, GPIOC2/PWM1/I2C6_SCL0 */
+
+/* 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, 0xf0), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO10&P80_CLK/GPIO07, KSO11&P80_DAT/GPIO06, KSO12/GPIO05, KSO13/GPIO04 */
+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) /* KSI2/GPIO27/TRACEDATA1, KSI3/GPIO26/TRACEDATA0, 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 */
+ALTERNATE(PIN_MASK(8, 0x04), 0, MODULE_KB, GPIO_ODR_HIGH) /* KSO14/GPIO82 */
+
+/* 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 */
+
+/* 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(5, 7)) /* GPIO57/SER_IRQ/ESPI_ALERT_L */
+
+/* Pre-configured PSL balls: J8 K6 */
diff --git a/board/volmar/gpio.inc b/board/volmar/gpio.inc
new file mode 100644
index 0000000000..c338e6b5ec
--- /dev/null
+++ b/board/volmar/gpio.inc
@@ -0,0 +1,74 @@
+/* -*- 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)
+
+/*
+ * 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 */
+
+/* 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 */
diff --git a/board/volmar/i2c.c b/board/volmar/i2c.c
new file mode 100644
index 0000000000..b63cfa645f
--- /dev/null
+++ b/board/volmar/i2c.c
@@ -0,0 +1,98 @@
+/* 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 "i2c.h"
+
+#define BOARD_ID_FAST_PLUS_CAPABLE 2
+
+/* 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,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_BC_SCL,
+ .sda = GPIO_EC_I2C_USB_C0_C2_PPC_BC_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 = 1000,
+ .scl = GPIO_EC_I2C_USB_C1_TCPC_SCL,
+ .sda = GPIO_EC_I2C_USB_C1_TCPC_SDA,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
+ },
+ {
+ /* I2C5 */
+ .name = "battery",
+ .port = I2C_PORT_BATTERY,
+ .kbps = 100,
+ .scl = GPIO_EC_I2C_BAT_SCL,
+ .sda = GPIO_EC_I2C_BAT_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,
+ .flags = I2C_PORT_FLAG_DYNAMIC_SPEED,
+ },
+ {
+ /* 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);
+
+/*
+ * 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/volmar/keyboard.c b/board/volmar/keyboard.c
new file mode 100644
index 0000000000..133d574dfa
--- /dev/null
+++ b/board/volmar/keyboard.c
@@ -0,0 +1,25 @@
+/* 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/volmar/led.c b/board/volmar/led.c
new file mode 100644
index 0000000000..be2b832237
--- /dev/null
+++ b/board/volmar/led.c
@@ -0,0 +1,93 @@
+/* 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.
+ */
+
+/* Brya 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.
+ */
+
+#include <stdint.h>
+
+#include "common.h"
+#include "compile_time_macros.h"
+#include "ec_commands.h"
+#include "led_pwm.h"
+#include "pwm.h"
+#include "util.h"
+
+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);
+
+/*
+ * 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 },
+};
+
+/* 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,
+ },
+ {
+ .ch0 = PWM_CH_LED3,
+ .ch1 = PWM_CH_LED4,
+ .ch2 = PWM_LED_NO_CHANNEL,
+ .enable = &pwm_enable,
+ .set_duty = &pwm_set_duty,
+ },
+};
+
+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;
+}
+
+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;
+ break;
+ case EC_LED_ID_RIGHT_LED:
+ pwm_id = PWM_LED1;
+ break;
+ default:
+ return EC_ERROR_UNKNOWN;
+ }
+
+ 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;
+}
diff --git a/board/volmar/pwm.c b/board/volmar/pwm.c
new file mode 100644
index 0000000000..de19f15cd5
--- /dev/null
+++ b/board/volmar/pwm.c
@@ -0,0 +1,71 @@
+/* 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_LED2] = {
+ .channel = 0,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 4800,
+ },
+ [PWM_CH_LED3] = {
+ .channel = 1,
+ .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,
+ /*
+ * 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_FAN] = {
+ .channel = 5,
+ .flags = PWM_CONFIG_OPEN_DRAIN | PWM_CONFIG_DSLEEP,
+ .freq = 1000
+ },
+ [PWM_CH_LED4] = {
+ .channel = 7,
+ .flags = PWM_CONFIG_ACTIVE_LOW | PWM_CONFIG_DSLEEP,
+ .freq = 4800,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT);
+
+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_LED3, 1);
+ pwm_set_duty(PWM_CH_LED3, 0);
+ pwm_enable(PWM_CH_LED4, 1);
+ pwm_set_duty(PWM_CH_LED4, 0);
+
+ 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/volmar/sensors.c b/board/volmar/sensors.c
new file mode 100644
index 0000000000..b355c98123
--- /dev/null
+++ b/board/volmar/sensors.c
@@ -0,0 +1,412 @@
+/* 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 "accelgyro.h"
+#include "adc.h"
+#include "driver/accel_lis2dw12.h"
+#include "driver/accelgyro_lsm6dso.h"
+#include "driver/als_tcs3400_public.h"
+#include "hooks.h"
+#include "motion_sense.h"
+#include "temp_sensor.h"
+#include "thermal.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);
+
+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;
+
+/* 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)}
+};
+
+/* 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)}
+};
+
+/* TCS3400 private data */
+static struct als_drv_data_t g_tcs3400_data = {
+ .als_cal.scale = 1,
+ .als_cal.uscale = 0,
+ .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 */
+ },
+};
+
+/*
+ * TODO: b/184702900 need to calibrate ALS/RGB sensor. At default settings,
+ * shining phone flashlight on sensor pegs all readings at 0xFFFF.
+ */
+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),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kr */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ }
+ },
+ .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),
+ .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),
+ .scale = {
+ .k_channel_scale = ALS_CHANNEL_SCALE(1.0), /* kb */
+ .cover_scale = ALS_CHANNEL_SCALE(1.0)
+ }
+ },
+ .calibration.irt = INT_TO_FP(1),
+ .saturation.again = TCS_DEFAULT_AGAIN,
+ .saturation.atime = TCS_DEFAULT_ATIME,
+};
+
+struct motion_sensor_t motion_sensors[] = {
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_LIS2DW12,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &lis2dw12_drv,
+ .mutex = &g_lid_accel_mutex,
+ .drv_data = &g_lis2dw12_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LIS2DW12_ADDR0,
+ .rot_standard_ref = &lid_standard_ref, /* identity matrix */
+ .default_range = 2, /* g */
+ .min_frequency = LIS2DW12_ODR_MIN_VAL,
+ .max_frequency = LIS2DW12_ODR_MAX_VAL,
+ .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,
+ },
+ },
+ },
+
+ [BASE_ACCEL] = {
+ .name = "Base Accel",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_LSM6DSO,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &lsm6dso_drv,
+ .mutex = &g_base_accel_mutex,
+ .drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
+ MOTIONSENSE_TYPE_ACCEL),
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
+ .rot_standard_ref = &base_standard_ref,
+ .default_range = 4, /* g */
+ .min_frequency = LSM6DSO_ODR_MIN_VAL,
+ .max_frequency = LSM6DSO_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,
+ },
+ },
+ },
+
+ [BASE_GYRO] = {
+ .name = "Base Gyro",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_LSM6DSO,
+ .type = MOTIONSENSE_TYPE_GYRO,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &lsm6dso_drv,
+ .mutex = &g_base_accel_mutex,
+ .drv_data = LSM6DSO_ST_DATA(lsm6dso_data,
+ MOTIONSENSE_TYPE_GYRO),
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS,
+ .default_range = 1000 | ROUND_UP_FLAG, /* dps */
+ .rot_standard_ref = &base_standard_ref,
+ .min_frequency = LSM6DSO_ODR_MIN_VAL,
+ .max_frequency = LSM6DSO_ODR_MAX_VAL,
+ },
+
+ [CLEAR_ALS] = {
+ .name = "Clear Light",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_TCS3400,
+ .type = MOTIONSENSE_TYPE_LIGHT,
+ .location = MOTIONSENSE_LOC_CAMERA,
+ .drv = &tcs3400_drv,
+ .drv_data = &g_tcs3400_data,
+ .port = I2C_PORT_SENSOR,
+ .i2c_spi_addr_flags = TCS3400_I2C_ADDR_FLAGS,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1x, uscale = 0 */
+ .min_frequency = TCS3400_LIGHT_MIN_FREQ,
+ .max_frequency = TCS3400_LIGHT_MAX_FREQ,
+ .config = {
+ /* Run ALS sensor in S0 */
+ [SENSOR_CONFIG_EC_S0] = {
+ .odr = 1000,
+ },
+ },
+ },
+
+ [RGB_ALS] = {
+ /*
+ * RGB channels read by CLEAR_ALS and so the i2c port and
+ * address do not need to be defined for RGB_ALS.
+ */
+ .name = "RGB Light",
+ .active_mask = SENSOR_ACTIVE_S0_S3,
+ .chip = MOTIONSENSE_CHIP_TCS3400,
+ .type = MOTIONSENSE_TYPE_LIGHT_RGB,
+ .location = MOTIONSENSE_LOC_CAMERA,
+ .drv = &tcs3400_rgb_drv,
+ .drv_data = &g_tcs3400_rgb_data,
+ .rot_standard_ref = NULL,
+ .default_range = 0x10000, /* scale = 1x, uscale = 0 */
+ },
+};
+const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+/* ALS instances when LPC mapping is needed. Each entry directs to a sensor. */
+const struct motion_sensor_t *motion_als_sensors[] = {
+ &motion_sensors[CLEAR_ALS],
+};
+BUILD_ASSERT(ARRAY_SIZE(motion_als_sensors) == ALS_COUNT);
+
+static void baseboard_sensors_init(void)
+{
+ /* Enable gpio interrupt for lid accel sensor */
+ gpio_enable_interrupt(GPIO_EC_ACCEL_INT_R_L);
+ /* Enable interrupt for the TCS3400 color light sensor */
+ gpio_enable_interrupt(GPIO_EC_ALS_RGB_INT_R_L);
+ /* Enable gpio interrupt for base accelgyro sensor */
+ gpio_enable_interrupt(GPIO_EC_IMU_INT_R_L);
+}
+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_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/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 \
+ { \
+ .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/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), \
+ }
+__maybe_unused static const struct ec_thermal_config thermal_ambient =
+ THERMAL_AMBIENT;
+
+/*
+ * 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/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), \
+ }
+__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);
+
+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/kano/tune_mp2964.c b/board/volmar/tune_mp2964.c
index 198f06d8eb..f67caa587e 100644
--- a/board/kano/tune_mp2964.c
+++ b/board/volmar/tune_mp2964.c
@@ -1,4 +1,4 @@
-/* Copyright 2021 The Chromium OS Authors. All rights reserved.
+/* 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.
*/
diff --git a/board/volmar/usbc_config.c b/board/volmar/usbc_config.c
new file mode 100644
index 0000000000..e1d899f7fc
--- /dev/null
+++ b/board/volmar/usbc_config.c
@@ -0,0 +1,506 @@
+/* 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 "cbi.h"
+#include "charger.h"
+#include "charge_ramp.h"
+#include "common.h"
+#include "compile_time_macros.h"
+#include "console.h"
+#include "driver/bc12/pi3usb9201_public.h"
+#include "driver/ppc/nx20p348x.h"
+#include "driver/ppc/syv682x_public.h"
+#include "driver/retimer/bb_retimer_public.h"
+#include "driver/tcpm/nct38xx.h"
+#include "driver/tcpm/ps8xxx_public.h"
+#include "driver/tcpm/tcpci.h"
+#include "ec_commands.h"
+#include "fw_config.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 = PS8751_I2C_ADDR1_FLAGS,
+ },
+ .drv = &ps8xxx_tcpm_drv,
+ .flags = TCPC_FLAGS_TCPCI_REV2_0 |
+ TCPC_FLAGS_TCPCI_REV2_0_NO_VSAFE0V |
+ TCPC_FLAGS_CONTROL_VCONN,
+ },
+ [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);
+
+/******************************************************************************/
+/* USB-A charging control */
+
+const int usb_port_enable[USB_PORT_COUNT] = {
+ GPIO_EN_PP5000_USBA_R,
+};
+BUILD_ASSERT(ARRAY_SIZE(usb_port_enable) == USB_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] = {
+ /* Compatible with Silicon Mitus SM536A0 */
+ .i2c_port = I2C_PORT_USB_C1_PPC,
+ .i2c_addr_flags = NX20P3483_ADDR2_FLAGS,
+ .drv = &nx20p348x_drv,
+ },
+ [USBC_PORT_C2] = {
+ .i2c_port = I2C_PORT_USB_C0_C2_PPC,
+ /*
+ * b/179987870
+ * schematics I2C map says ADDR3
+ */
+ .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 usbc2_tcss_usb_mux = {
+ .usb_port = USBC_PORT_C2,
+ .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,
+};
+
+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_C2_MUX,
+ .i2c_addr_flags = USBC_PORT_C0_BB_RETIMER_I2C_ADDR,
+ .next_mux = &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,
+ },
+ [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,
+ },
+};
+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,
+ },
+ [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);
+
+#ifdef CONFIG_CHARGE_RAMP_SW
+
+/*
+ * TODO(b/181508008): tune this threshold
+ */
+
+#define BC12_MIN_VOLTAGE 4400
+
+/**
+ * Return true if VBUS is too low
+ */
+int board_is_vbus_too_low(int port, enum chg_ramp_vbus_state ramp_state)
+{
+ int voltage;
+
+ if (charger_get_vbus_voltage(port, &voltage))
+ voltage = 0;
+
+ if (voltage == 0) {
+ CPRINTS("%s: must be disconnected", __func__);
+ return 1;
+ }
+
+ if (voltage < BC12_MIN_VOLTAGE) {
+ CPRINTS("%s: port %d: vbus %d lower than %d", __func__,
+ port, voltage, BC12_MIN_VOLTAGE);
+ return 1;
+ }
+
+ return 0;
+}
+
+#endif /* CONFIG_CHARGE_RAMP_SW */
+
+void config_usb_db_type(void)
+{
+ enum ec_cfg_usb_db_type db_type = ec_cfg_usb_db_type();
+
+ /*
+ * TODO(b/180434685): implement multiple DB types
+ */
+
+ CPRINTS("Configured USB DB type number is %d", db_type);
+}
+
+__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) {
+ if (get_board_id() == 1)
+ rst_signal = IOEX_ID_1_USB_C0_RT_RST_ODL;
+ else
+ rst_signal = IOEX_USB_C0_RT_RST_ODL;
+ } else if (me->usb_port == USBC_PORT_C2) {
+ if (get_board_id() == 1)
+ rst_signal = IOEX_ID_1_USB_C2_RT_RST_ODL;
+ else
+ 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);
+ 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);
+ }
+ return EC_SUCCESS;
+}
+
+void board_reset_pd_mcu(void)
+{
+ enum gpio_signal tcpc_rst;
+
+ 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;
+
+ /*
+ * TODO(b/179648104): figure out correct timing
+ */
+
+ gpio_set_level(tcpc_rst, 0);
+ if (ec_cfg_usb_db_type() != DB_USB_ABSENT) {
+ gpio_set_level(GPIO_USB_C1_RST_ODL, 0);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 0);
+ }
+
+ /*
+ * delay for power-on to reset-off and min. assertion time
+ */
+
+ msleep(20);
+
+ gpio_set_level(tcpc_rst, 1);
+ if (ec_cfg_usb_db_type() != DB_USB_ABSENT) {
+ gpio_set_level(GPIO_USB_C1_RST_ODL, 1);
+ gpio_set_level(GPIO_USB_C1_RT_RST_R_ODL, 1);
+ }
+
+ /* wait for chips to come up */
+
+ msleep(50);
+}
+
+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.
+ */
+ 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);
+ }
+
+ /* 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);
+
+ /* Enable BC1.2 interrupts. */
+ gpio_enable_interrupt(GPIO_USB_C0_BC12_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C2_BC12_INT_ODL);
+
+ if (ec_cfg_usb_db_type() != DB_USB_ABSENT) {
+ gpio_enable_interrupt(GPIO_USB_C1_PPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_TCPC_INT_ODL);
+ gpio_enable_interrupt(GPIO_USB_C1_BC12_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 ((ec_cfg_usb_db_type() != DB_USB_ABSENT) &&
+ 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) &&
+ (ec_cfg_usb_db_type() != DB_USB_ABSENT))
+ 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:
+ if (ec_cfg_usb_db_type() == DB_USB_ABSENT)
+ break;
+ 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:
+ task_set_event(TASK_ID_USB_CHG_P0, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C1_BC12_INT_ODL:
+ if (ec_cfg_usb_db_type() == DB_USB_ABSENT)
+ break;
+ task_set_event(TASK_ID_USB_CHG_P1, USB_CHG_EVENT_BC12);
+ break;
+ case GPIO_USB_C2_BC12_INT_ODL:
+ task_set_event(TASK_ID_USB_CHG_P2, 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:
+ switch (ec_cfg_usb_db_type()) {
+ case DB_USB_ABSENT:
+ case DB_USB_ABSENT2:
+ break;
+ case DB_USB3_PS8815:
+ nx20p348x_interrupt(USBC_PORT_C1);
+ break;
+ }
+ 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)
+{
+ if (port == USBC_PORT_C0 || port == USBC_PORT_C2)
+ 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/volmar/usbc_config.h b/board/volmar/usbc_config.h
new file mode 100644
index 0000000000..3a500af9d3
--- /dev/null
+++ b/board/volmar/usbc_config.h
@@ -0,0 +1,22 @@
+/* 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.
+ */
+
+/* Brya board-specific USB-C configuration */
+
+#ifndef __CROS_EC_USBC_CONFIG_H
+#define __CROS_EC_USBC_CONFIG_H
+
+#define CONFIG_USB_PD_PORT_MAX_COUNT 3
+
+enum usbc_port {
+ USBC_PORT_C0 = 0,
+ USBC_PORT_C1,
+ USBC_PORT_C2,
+ USBC_PORT_COUNT
+};
+
+void config_usb_db_type(void);
+
+#endif /* __CROS_EC_USBC_CONFIG_H */
diff --git a/board/volmar/vif_override.xml b/board/volmar/vif_override.xml
new file mode 100644
index 0000000000..32736caf64
--- /dev/null
+++ b/board/volmar/vif_override.xml
@@ -0,0 +1,3 @@
+<!-- Add VIF field overrides here. See genvif.c and the Vendor Info File
+ Definition from the USB-IF.
+-->
diff --git a/board/volteer/ec.tasklist b/board/volteer/ec.tasklist
index ec9e64e850..d94a4445b9 100644
--- a/board/volteer/ec.tasklist
+++ b/board/volteer/ec.tasklist
@@ -16,6 +16,7 @@
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, 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) \
diff --git a/board/volteer_ish/board.h b/board/volteer_ish/board.h
index 097ee25750..527432285c 100644
--- a/board/volteer_ish/board.h
+++ b/board/volteer_ish/board.h
@@ -35,7 +35,7 @@
#define CONFIG_ACCEL_BMA255
/* Host command over HECI */
-#define CONFIG_HOSTCMD_HECI
+#define CONFIG_HOST_INTERFACE_HECI
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HECI
diff --git a/board/voxel/ec.tasklist b/board/voxel/ec.tasklist
index 292de51cdb..174a47eea3 100644
--- a/board/voxel/ec.tasklist
+++ b/board/voxel/ec.tasklist
@@ -15,7 +15,8 @@
TASK_ALWAYS(CHARGER, charger_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_ALWAYS(MOTIONSENSE, motion_sense_task, NULL, VENTI_TASK_STACK_SIZE) \
TASK_NOTEST(KEYPROTO, keyboard_protocol_task, NULL, TASK_STACK_SIZE) \
- TASK_NOTEST(CHIPSET, chipset_task, NULL, LARGER_TASK_STACK_SIZE) \
+ TASK_NOTEST(CHIPSET, chipset_task, NULL, ULTRA_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) \
diff --git a/board/waddledee/board.c b/board/waddledee/board.c
index 1e4f8a387c..2e439de601 100644
--- a/board/waddledee/board.c
+++ b/board/waddledee/board.c
@@ -503,8 +503,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = NULL,
@@ -532,8 +530,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/wheelie/board.c b/board/wheelie/board.c
index 198dbda284..9740013ddd 100644
--- a/board/wheelie/board.c
+++ b/board/wheelie/board.c
@@ -394,8 +394,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = NULL,
@@ -423,8 +421,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/willow/board.c b/board/willow/board.c
index ba467fddc2..463550ddb2 100644
--- a/board/willow/board.c
+++ b/board/willow/board.c
@@ -64,13 +64,32 @@ BUILD_ASSERT(ARRAY_SIZE(adc_channels) == ADC_CH_COUNT);
/******************************************************************************/
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
- {"typec", 0, 400, GPIO_I2C1_SCL, GPIO_I2C1_SDA},
- {"other", 1, 400, GPIO_I2C2_SCL, 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[] = {
- {"battery", 2, 100, GPIO_I2C3_SCL, 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);
@@ -136,8 +155,12 @@ 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)
+ mux_state_t mux_state,
+ bool *ack_required)
{
+ /* This driver does not use host command ACKs */
+ *ack_required = false;
+
/*
* svdm_dp_attention() did most of the work, we only need to notify
* host here.
diff --git a/board/willow/board.h b/board/willow/board.h
index a6907b9a9e..9ec0b9483b 100644
--- a/board/willow/board.h
+++ b/board/willow/board.h
@@ -81,7 +81,7 @@
#define IT8801_KEYBOARD_PWM_I2C_ADDR_FLAGS IT8801_I2C_ADDR1
/* Enable Accel over SPI */
-#define CONFIG_SPI_ACCEL_PORT 0 /* The first SPI master 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/wormdingler/board.c b/board/wormdingler/board.c
index d8bc04e4fd..e9ad3ab21c 100644
--- a/board/wormdingler/board.c
+++ b/board/wormdingler/board.c
@@ -119,16 +119,41 @@ static void switchcap_interrupt(enum gpio_signal signal)
/* I2C port map */
const struct i2c_port_t i2c_ports[] = {
- {"power", I2C_PORT_POWER, 100, GPIO_EC_I2C_POWER_SCL,
- GPIO_EC_I2C_POWER_SDA},
- {"tcpc0", I2C_PORT_TCPC0, 1000, GPIO_EC_I2C_USB_C0_PD_SCL,
- GPIO_EC_I2C_USB_C0_PD_SDA},
- {"tcpc1", I2C_PORT_TCPC1, 1000, GPIO_EC_I2C_USB_C1_PD_SCL,
- GPIO_EC_I2C_USB_C1_PD_SDA},
- {"eeprom", I2C_PORT_EEPROM, 400, GPIO_EC_I2C_EEPROM_SCL,
- GPIO_EC_I2C_EEPROM_SDA},
- {"sensor", I2C_PORT_SENSOR, 400, GPIO_EC_I2C_SENSOR_SCL,
- 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);
diff --git a/board/wormdingler/board.h b/board/wormdingler/board.h
index 83f0e98365..4423a21aeb 100644
--- a/board/wormdingler/board.h
+++ b/board/wormdingler/board.h
@@ -10,14 +10,6 @@
#include "baseboard.h"
-/* TODO(waihong): Remove the following bringup features */
-#define CONFIG_BRINGUP
-#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands. */
-#define CONFIG_USB_PD_DEBUG_LEVEL 3
-#define CONFIG_CMD_GPIO_EXTENDED
-#define CONFIG_CMD_POWERINDEBUG
-#define CONFIG_I2C_DEBUG
-
#define CONFIG_BUTTON_TRIGGERED_RECOVERY
/* Internal SPI flash on NPCX7 */
diff --git a/board/wormdingler/build.mk b/board/wormdingler/build.mk
index 74b6b95e4d..452abeb591 100644
--- a/board/wormdingler/build.mk
+++ b/board/wormdingler/build.mk
@@ -11,4 +11,4 @@ CHIP_FAMILY:=npcx7
CHIP_VARIANT:=npcx7m6fc
BASEBOARD:=trogdor
-board-y=battery.o board.o led.o base_detect.o
+board-y=battery.o board.o led.o base_detect.o usbc_config.o
diff --git a/board/wormdingler/usbc_config.c b/board/wormdingler/usbc_config.c
new file mode 100644
index 0000000000..8f3fb02c30
--- /dev/null
+++ b/board/wormdingler/usbc_config.c
@@ -0,0 +1,60 @@
+/* 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.
+ */
+
+/* Trogdor family-specific USB-C configuration */
+
+#include "charger.h"
+#include "charger/isl923x_public.h"
+#include "charge_state.h"
+#include "usb_pd.h"
+
+#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[] = {
+ {
+ .i2c_port = I2C_PORT_CHARGER,
+ .i2c_addr_flags = ISL923X_ADDR_FLAGS,
+ .drv = &isl923x_drv,
+ },
+};
+
+int charger_profile_override(struct charge_state_data *curr)
+{
+ int usb_mv;
+ int port;
+
+ if (curr->state != ST_CHARGE)
+ return 0;
+
+ /* Lower the max requested voltage to 5V when battery is full. */
+ if (chipset_in_state(CHIPSET_STATE_ANY_OFF) &&
+ !(curr->batt.flags & BATT_FLAG_BAD_STATUS) &&
+ !(curr->batt.flags & BATT_FLAG_WANT_CHARGE) &&
+ (curr->batt.status & STATUS_FULLY_CHARGED))
+ usb_mv = 5000;
+ else
+ usb_mv = PD_MAX_VOLTAGE_MV;
+
+ if (pd_get_max_voltage() != usb_mv) {
+ CPRINTS("VBUS limited to %dmV", usb_mv);
+ for (port = 0; port < CONFIG_USB_PD_PORT_MAX_COUNT; port++)
+ pd_set_external_voltage_limit(port, usb_mv);
+ }
+
+ 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/yorp/board.c b/board/yorp/board.c
index 625db5d0b7..137100aec3 100644
--- a/board/yorp/board.c
+++ b/board/yorp/board.c
@@ -142,8 +142,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_ACCEL),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -174,8 +172,6 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_base_mutex,
.drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
MOTIONSENSE_TYPE_GYRO),
- .int_signal = GPIO_BASE_SIXAXIS_INT_L,
- .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
.default_range = 1000 | ROUND_UP_FLAG, /* dps */
diff --git a/board/zinger/runtime.c b/board/zinger/runtime.c
index 0b6f1995f5..9d27181032 100644
--- a/board/zinger/runtime.c
+++ b/board/zinger/runtime.c
@@ -4,6 +4,7 @@
*/
/* tiny substitute of the runtime layer */
+#include "atomic.h"
#include "chip/stm32/clock-f.h"
#include "clock.h"
#include "common.h"
@@ -16,7 +17,7 @@
#include "util.h"
volatile uint32_t last_event;
-uint32_t sleep_mask;
+atomic_t sleep_mask;
/* High word of the 64-bit timestamp counter */
static volatile uint32_t clksrc_high;