Added I2C sensors ADT7481 and TMP411 with config
items and build rules.
BRANCH=none
BUG=
TEST=Define CONFIG_TEMP_SENSOR_ADT7481 or _TMP411
and build board.
Change-Id: I4d1eb55ee56ad3f42787538bb839193e683d0a60
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Add Microchip MEC17xx family PWM and fan
source files for review
BRANCH=none
BUG=
TEST=Review only.
Change-Id: I91439ab999a4662d690b58b0fbbb887f643b3673
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Add Microchip MEC17xx family SPI master
controllers and flash files. SPI implements
public interface wrapper for QMSPI and GPSPI.
MEC17xx family uses QMSPI for loading
EC firmware. GPSPI is for general use (sensor).
BRANCH=none
BUG=
TEST=Review only.
Change-Id: I23001e254dd437caa0917949f4dd2eb903f1adb1
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
This CONFIG DISCHARGE_ON_AC enables discharging
battery even when AC is connected.
BUG=b:71364739
BRANCH=glkrvp
TEST=On glkrvp EC console, execute command
"chgstate discharge on" and verify if battery
is discharging with "battery" command.
Change-Id: I709c7b5ccfea9058961d387a1575db9aebe70707
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Issue was found when EC would not wake up from hibernate after
specified time period.
The infinite while loop blocks further hibernate functions
that needs to be executed after the board specific
hibernate method.
Remove this while loop to complete hibernation logic.
Also in hibernate function we should not be cutting down power
to EC (SMC_SHUTDOWN) as this will limit supporting wake sources
feature. Removing it in this patch.
BRANCH=master
BUG=b:70690772
TEST=On glkrvp EC console, check if "hibernate 30" wakes up EC
after 30 sec, with only battery, only AC, with AC+battery.
Change-Id: Iae735cc26eeef8e205771d2f3c6e5260918e093e
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Modify ALS module to use CPRINT macros with
channel support.
BRANCH=none
BUG=
TEST=Build board(s) with ALS support such glados.
Test ALS CPRINT messages go out over EC UART and
can be masked off by channel mask UART command.
Change-Id: I65ffc889d63a778f3fb8995f508773842ba875ef
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Experimental and disabled by default feature for
powering down GPIO pins on those EC's supporting it.
Pins may be powered down by module ID or pin name.
Goal is to make use of common GPIO pin table.
If enabled, developer must implement power down
support in chip level. Developer re-powers module
pin(s) by calling the current gpio module enable
API in the wake path.
BRANCH=none
BUG=
TEST=Feature is disabled by default. Build all
boards with feature disabled.
Change-Id: Ifacd08e51def6424baf5c78c84b24f1d9f4bc4aa
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
BRANCH=none
BUG=
TEST=Review only. Committing small pieces until
all code passes review.
Change-Id: I9d16f95314a7c97b11c4fe61602c6db2621e6024
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
Add Microchip MEC17xx family little-firmware
(LFW) folder and files.
Change-Id: I9142266d41234574730fadccd5a2cc27fe3d8fd7
Signed-off-by: Scott Worley <scott.worley@microchip.corp-partner.google.com>
If AC is present but we're not charging yet, it's very possible this
status is transient (eg. due to cut-off battery, brief spike in current
useage, etc), so don't use very long task timeout.
BUG=b:70554834
BRANCH=None
TEST=Verify soraka doesn't take over a minute to boot when exiting from
ship mode.
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I9dbfd8cb7dfc54cb8017bb0c7d633c5d64a15025
Move all the peripheral blocks base addresses in a common block rather
than spread among the register definitions.
This will help making a cleaner STM32H7 implementation whose base
addresses are all different from other families.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:67081508
TEST=compare all the ec.bin generated by 'make buildall' and verify
they are bit-identical with and without the change.
Change-Id: I52cafd2f3c9145dbcd585166df3fc78e38573bb4
libfpsensor is using it.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:70320279
TEST=run on Eve FP MCU with external library and see its traces are
correctly printed.
Change-Id: Iea1bc04d7ea7931478d14d655a7e986a0839a51a
For compatibility/convenience, implement the '%li' printf format
as a *32-bit* integer format, as it might be expected by non-EC code.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=b:70320279
TEST=run on Eve EVT with unspecified external binary and see its traces
are correctly printed.
Change-Id: Iac20e823c74aac4f659176416eebd804c321d47c
NCP15WB is actually the correct thermistor, let's drop that
copy-pasted comment.
BRANCH=none
BUG=b:35585396
TEST=make buildall -j
Change-Id: I5577bb70e354a6f2ef6338894793b808fe4b0e9a
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Nothing in fizz/nami code uses that thermistor: the 2 places that
would use it (ec_adc.c and bd99992gw.c) are not compiled in on
fizz/nami.
BRANCH=fizz
BUG=none
TEST=make buildall -j
Change-Id: Ib2af8ad066eb05cd9510669600feb26641433eed
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
On dual-battery slave, we use the charging allowed signal from
master to indicate whether external power is present.
In most cases, this actually matches the external power status
of the master (slave battery charging when AC is connected, or
discharging when slave battery still has enough capacity), with
one exception: when we do master to slave battery charging (in
this case the "external" power is the master).
BRANCH=none
BUG=b:65697962
TEST=Deplete wand battery to 5%, see that lux still provides power
to it but the battery does not charge.
Change-Id: I8bd9f52c386a0a9edfae3837ba33725b3101a008
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Scarlet has only one PD port.
Let's always source 1.5A instead of 3A.
BUG=b:70524967
BRANCH=none
TEST=Monitor PD packets, see Scarlet rev2 broadcast
source_cap as 'FixedVol=5.00V, MaxCur=1.50A'
Change-Id: Id9bcd69f3a20ef5eb55eb7b17539fd304abb08e4
Signed-off-by: Philip Chen <philipchen@google.com>
It's a dead board.
BUG=none
BRANCH=none
TEST=make buildall -j
Change-Id: I9f5530afdea07bb5787fa2b674984147f8425fba
Signed-off-by: Philip Chen <philipchen@google.com>
When SLP_SUS_L is deasserted, that means the chipset is in S5.
BUG=None
BRANCH=None
TEST=Flash meowth; boot from AC only, verify that when SoC actually
boots the power state is reported as S0 instead of G3.
Change-Id: Ib9cd76aa9efd6f81df432205b8c1e8c342e32af6
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/837485
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This patch makes EC save the max current and voltage of a barrel jack
adapter before sysjump and restore them after sysjump.
BUG=b:64442692
BRANCH=none
TEST=Boot Fizz and let coreboot set the adapter current and voltage.
Verify EC-RW inherits the current and voltage set by coreboot.
Change-Id: Ib1addf6e5ce059a39cb2d8b355515df1138409eb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/835628
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
With this, the EC-EC communication slave (base) updates the battery
information, to be transmitted to the master (lid).
Note that, in the future, we might want to use a similar mechanism
to pass battery information on all boards (not only the ones that
use EC-EC communication to pass information to the lid), and TODO
are left in the code for this reason.
BRANCH=none
BUG=b:65697962
BUG=b:65697620
TEST=Flash lux and wand, EC-EC communication works.
Change-Id: I042138ee066a65c3664fbeb93aadabf483a6ceea
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/725125
Reviewed-by: Randall Spangler <rspangler@chromium.org>
This adds functions required for the slave in EC-EC communication,
including the task that processes requests from the master.
This also adds required CONFIG_EC_EC_COMM_SLAVE/MASTER/BATTERY
config options.
BRANCH=none
BUG=b:65697962
TEST=Build wand and lux boards, flash it, EC-EC communication works.
Change-Id: I772d9023a830f4fbc37316ca31e4da8240de7324
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/828180
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This patch makes EC check the presence of power from a barrel jack
adapter before activating the BJ port.
BUG=none
BRANCH=none
TEST=Boot Fizz on type-c. Boot Fizz on BJ.
Switch power from type-c to BJ at G3 and S0.
Switch power from BJ to type-c at G3 and S0.
Change-Id: Iec982278e1ceb9b997069f66eb0e14f2e361efd2
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/777824
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This adds 3 commands to obtain static and dynamic battery
information, as well as control base charger state.
These host commands are meant to be used as part of the EC-EC
communication protocol (based on hostcmd v4 protocol), but could
be used in the future to pass information between AP and EC,
especially when more than 1 battery is present, which would be
hard to support with the current MEMMAP-based approach.
BRANCH=none
BUG=b:65697962
BUG=b:65697620
TEST=Build wand and lux boards, flash it, EC-EC communication works.
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Change-Id: I263454794394838918832c9e4623835ab2f3a3da
Reviewed-on: https://chromium-review.googlesource.com/670380
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
The CONFIG_BUTTON_RECOVERY option was a little confusing especially when
we have the CONFIG_DEDICATED_RECOVERY_BUTTON option. This commit
renames CONFIG_BUTTON_RECOVERY to CONFIG_BUTTON_TRIGGERED_RECOVERY to
help make things a little clearer.
Additionally, to avoid copy paste, defining
CONFIG_BUTTON_TRIGGERED_RECOVERY will populate the recovery_buttons
table with either the volume buttons or a dedicated recovery button
depending what the board is configured for.
Lastly, if CONFIG_DEDICATED_RECOVERY_BUTTON is defined,
CONFIG_BUTTON_TRIGGERED_RECOVERY is defined as well since it's implicit.
BUG=chromium:783371
BRANCH=None
TEST=make -j buildall
Change-Id: Idccaa4d049ace0df3b98b35bdd38ac9dbd843200
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/830917
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
The boards need to have 5V masked off from the power good tree.
Additionially, Meowth needs to have the COMP_C fault masked from the
fault mask because its enable is connected and not grounded like on
Zoombini.
BUG=b:69935563
BRANCH=None
TEST=flash zoombini; Verify that we can boot to S0.
Change-Id: Ia51004a131e7c31d0e5ee59d87ab13455b822779
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/807632
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
Nobody is calling the flush function for consumer_ops structure,
so let's remove it to save flash space, until we find a use for it.
CQ-DEPEND=CL:*529221
BRANCH=none
BUG=chromium:795624
TEST=make buildall -j, saves from 40 to 128 bytes on some boards.
Change-Id: Iad18b30f419ccebc54a90914ec46da84b8d19601
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/826905
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
rt946x_closest_reg_via_tbl() is buggy and doesn't
return the right reg value because of misuse of ARRAY_SIZE().
We should fix it.
Meanwhile, since rt946x_closest_reg_via_tbl() is only called in
rt946x_set_boost_current(), let's just delete rt946x_closest_reg_via_tbl()
and move its code to rt946x_set_boost_current().
BUG=b:70524967
BRANCH=none
TEST=Confirm reg 0x0a is set correctly
Change-Id: Ie9c90ebf63596a52f864ff5809488731edc41fff
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/830895
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
GPIO02 (EC_HAVEN_RESET_ODL) is now configured to GPIO_ODR_HIGH,
designed for EC to reset H1. And it's no longer used with just
the HW path reserved (DNS R267 on schematic).
Tests showed that INPUT | PULL_UP has lower EC power consumption
so reconfiguring here.
BUG=b:64503543
BRANCH=none
TEST=manual
(on chroot)
$ make BOARD=soraka -j
$ ./util/flash_ec --board soraka
(on DUT)
$ powerd_dbus_suspend
(on chroot)
$ dut-control -p $PORT pp3300_dsw_ec_ma -t 10 | grep @@
> @@ NAME COUNT AVERAGE STDDEV MAX MIN
> @@ pp3300_dsw_ec_ma 5629 1.25 0.71 16.60 1.12
Without the change, the original setting gives:
> @@ NAME COUNT AVERAGE STDDEV MAX MIN
> @@ pp3300_dsw_ec_ma 4674 2.69 1.98 12.00 2.00
Change-Id: I4e2268612109155f57fdd236088cadaaba54bb3f
Signed-off-by: Ayo Wu <ayowu@google.com>
Reviewed-on: https://chromium-review.googlesource.com/786951
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
Added code to support port 1 and 2 power path controller
since we didn't have the parts on rev 0.
BUG=None
BRANCH=None
TEST=make board=zoombini, make board=meowth
TEST=Make sure Zoombini can charge in on all ports.
TEST=Make sure Zoombini can charge out on all ports.
Change-Id: Idf174125cc5a617ad77378ce65d5c0f6cbb9fce4
Signed-off-by: Rachel Nancollas <rachelsn@google.com>
Reviewed-on: https://chromium-review.googlesource.com/823211
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
PU62 used to be used to turn on power to PS8751 but it's been removed.
PS8751 is powered directly from PP3300_EC. So, EC doesn't need to
enable it.
BUG=b:65212601
BRANCH=none
TEST=On Kench EVT SKU5, verify type-c port is powered.
Change-Id: I2a1ce28efe09212a4ce7e7b57c0560e42e137cec
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/826256
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
We add 2 hashes that each map to a list of allowed commands
(command list is secret, and provided by Elan).
UPDATE_EXTRA_CMD_TOUCHPAD_DEBUG on the USB interface have the
following format for the parameter:
- param[0]: must be 0xff
- param[1]: offset of the I2C command in data
- param[2]: command length
- param[3-4]: read-back length (MSB first) over I2C, can be 0
- param[5-49]: data, is verified using SHA-256 hash.
The I2C command pointed at by param[1-2] is then sent over
I2C, and the data is read back into a shared buffer of size
param[3-4].
The data can be fetched over USB by a single byte USB update
touchpad debug command (indicating an offset in 64-bytes unit),
fetching data from the shared buffer in blocks of 64 bytes.
BRANCH=none
BUG=b:63993891
TEST=Elan can run debugging commands using their proprietary tool.
Change-Id: Idb19bcb940b7f030c3b3aeaf39d6b725fcb9ef34
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/763576
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>
In gpio.inc, fixed EN_PP3300_WLAN so it's always high
since CNVi requires PP3300_WLAN power up at the same
time as PP3300_A.
Also, fixed USB_PD_RST_L to be an OD output.
BUG=b:69139536
BRANCH=none
TEST=make BOARD=meowth and BOARD=zoombini
runs with no errors
Change-Id: I3c2a4e7ca7b1ab5f9122d17324822dc5e61e70a8
Signed-off-by: Rachel Nancollas <rachelsn@google.com>
Reviewed-on: https://chromium-review.googlesource.com/778120
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
We would like to use all 64-bytes of the buffer as parameter to
UPDATE_EXTRA_CMD_TOUCHPAD_DEBUG (12 bytes for update_frame_header,
2 bytes for the extra command type, leaving 50 bytes of payload).
BRANCH=none
BUG=b:63993891
TEST=./usb_updater2 -g 00 -d 18d1:502b
Change-Id: I023aa760f1a4cf9cacf9262a758cba1120d4f380
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/780372
Reviewed-by: Chun-ta Lin <itspeter@chromium.org>