Commit Graph

8388 Commits

Author SHA1 Message Date
Benjamin Gordon
04a9dfe645 zoombini: Add support for I2C bus 4
This is used by the keyboard backlight driver.  Add support so we can
start talking to this chip.

BUG=b:69379749
BRANCH=none
TEST=i2cscan shows a device at 0x6c on bus 4 now

Change-Id: I951ecd0fa3030f9f408ed0a4504b54950b7ca174
Signed-off-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879081
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-01-23 11:24:21 -08:00
Philip Chen
5bdc0e2298 nautilus: Remove WLAN_PE_RST
We don't use GPIO12 anymore.

BUG=b:72334658
BRANCH=none
TEST=build Nautilus

Change-Id: I0f407caf708040a7ee132fd0993d20b5a0b7bb7a
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/879783
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 11:24:19 -08:00
Vincent Palatin
b16f759652 ectool: use poll interface
Test polling for MKBP events through the kernel cros_ec/pd/fp/.. driver
node.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:69460856
TEST=run on Eve EVT:
ectool --name=cros_fp fpmode fingerdown && \
ectool --name=cros_fp waitevent 5 10000

Change-Id: Ibdec137a3b646cf017a29afcf24ff5bbfb731198
Reviewed-on: https://chromium-review.googlesource.com/806167
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 05:25:08 -08:00
Vincent Palatin
96a7e9fe81 fpsensor: update interface
Update the FP MCU interface to include a few convenient diagnostics
functions for factory testing.

It's mostly backward compatible, but overall this interface never
shipped in anything, so not a big deal regardless.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:71986991
TEST=ectool --name=cros_fp fpinfo && ectool --name=cros_fp fpcheckpixels
CQ-DEPEND=CL:*546799

Change-Id: Ic641f891ace02d79af9339cf6cb59a2960e506a7
Reviewed-on: https://chromium-review.googlesource.com/873924
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 05:25:08 -08:00
Daisuke Nojiri
a70227296b Fizz: Remove board_has_working_reset_flags
This function is no longer used because proto0 boards have been
deprecated. This function is called before I2C is initialized.
This function tries to read board info and causes watchdog to
trigger because timeout is set to zero.

BUG=none
BRANCH=none
TEST=boot Fizz. reboot by 'reboot ap-off'. Observe no watchdog reset.

Change-Id: I3bdebe4fb34dbef552fc89a170efa87d753078c0
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879355
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-22 22:07:25 -08:00
Philip Chen
632043a544 scarlet: Fix ADC unit conversion
To detect the board version correctly, ADC must output mV.

BUG=b:72233188
BRANCH=none
TEST='version' command shows correct board version.

Change-Id: I68889092719240394f03cb9b21cb0844feb315e5
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/879491
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-22 22:07:19 -08:00
Scott Collyer
f793f81b8b bd9995x: Clear VSYS_PRIORITY when Vbat > Vbat_min
VSYS_PRIORITY in the register VIN_CTRL_SET is set during bd9995x
initialization to ensure VSYS remains up and stable during deeply
discharged battery conditions. However, outside of this case, this bit
should remain cleared.

If set, there the input current limit is disabled between the time
that the boost converter is enabled (USB_SUS = 0) and charging is
enabled (CHG_EN = 1). This can lead to too much current being drawn
which results in the connecting port shutting off VBUS due to its
overcurrent protection. This has been observed when attempting to
charge one DUT from another chromebook port, or with a Type C only
charger.

This CL adds a check in the bd99965x driver implementation of
charger_get_voltage() that compares the current battery voltage to
its minimum voltage. If it's higher, then it's not a deeply discharged
battery and VSYS_PRIORITY can be cleared.

BUG=chromium:69143827,71814128
BRANCH=coral,eve
TEST=Tested with 2 Coral DUTs. Verified that VSYS_PRIORITY gets
cleared when the charger state machine gets the charger
parameters. Also verified that I can repeatedly initated charging from
one Coral device to another. Without this fix, this would fail most of
the of the time. Also tested Eve with deeply discharged battery to
make sure the startup conditon still works.

Change-Id: I5230560fa98e5bf16921eb4f2c70802eb962e7f3
Signed-off-by: Scott Collyer <scollyer@google.com>
Reviewed-on: https://chromium-review.googlesource.com/875178
Commit-Ready: Scott Collyer <scollyer@chromium.org>
Tested-by: Scott Collyer <scollyer@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-22 22:07:17 -08:00
Daisuke Nojiri
c06d7fea8f host_command: Suppress individual host command debug log
Host command handler prints every single host command except when
commands are repeated back-to-back. This patch allows each board
decide which commands should be ignored. When debug printf is
suppressed, a global counter is incremented. Developers know there
were commands processed but not reported to the console.

BUG=chromium:803955
BRANCH=none
TEST=Observe 0x97 and 0x98 were not printed. Global suppress
counter is incremented.

Change-Id: I05e8cde9039f602e8fc06c20e89b328e797bd733
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/876952
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-22 18:50:11 -08:00
Nicolas Boichat
d9f4ce13f2 touchpad_elan: Add retry logic if the touchpad does not respond
After 3 tries, the touchpad is reset by power-cycling it.

BRANCH=none
BUG=b:71688150
TEST=Short SDA/SCL lines, press on touchpad, see that touchpad tasks
     retries transaction, and then resets the touchpad power.
TEST=Do ESD discharge, and see that touchpad always recovers.

Change-Id: If0b5eb936d4d2feb3d34a7ec8748869a1b915c34
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/872131
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-21 22:20:48 -08:00
Nicolas Boichat
667a35bb9c poppy/nautilus: Enable ACCELGYRO3_INT_L BMI160 interrupts
BRANCH=none
BUG=b:69656838
TEST=Flash soraka, AIDA64 works fine

Change-Id: I98443f3aee8605fbc9b5080cda83ac2b42ba8cd8
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/869550
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-01-21 22:20:48 -08:00
Edward Hill
8b51215355 grunt: Enable TCPC/PPC interrupts in board_tcpc_init
Move enable of TCPC and PPC interrupts from board_init to
board_tcpc_init so they are enabled after the PD tasks have
been initialized.

BUG=b:69378796
BRANCH=none
TEST=PD still works on both ports

Change-Id: Ia6c91e78d95f126b9049994f8f0568ac2e4cec4f
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/876642
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-19 20:35:47 -08:00
Edward Hill
dfda7899b7 grunt: Add USB-C DP Hotplug Detect GPIOs
Grunt HW has these driven from EC to SOC, unlike coral which had
the TCPCs drive the HPD signals to SOC.

BUG=b:71810897
BRANCH=none
TEST=external display works if GPIOs set high on EC console

Change-Id: I40d794cccfdbb46f42642ea1410d75e2281028a1
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/867235
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-01-19 20:35:46 -08:00
Philip Chen
741a814690 scarlet: Update the charging current for Simplo battery
Simplo updated the datesheet and limited the charging current to 3A.

BUG=b:70820167
BRANCH=none
TEST=none

Change-Id: I88b9e0ac3ebba401530e2bb6ae08438c56d8506e
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/875145
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-19 17:18:09 -08:00
Simon Glass
c7040bf38a grunt: Add PWMs for battery / charger LEDs
Connect these up so that we can test the hardware.

BUG=b:71902053
BRANCH=none
TEST=manually on EC:
> pwm
PWM channels:
  0: 0%
  1: 100%
  2: 100%
> pwm 1 50
Setting channel 1 to 50
  1: 50%
> pwm 2 50
Setting channel 2 to 50
  2: 50%
> pwm 1 10
Setting channel 1 to 10
  1: 10%

See that the colours changes orange/blue

Change-Id: I9bc3f4c0eb033f58d7bfe524ba99f8dd2e177eef
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865101
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-18 20:18:16 -08:00
Daisuke Nojiri
ead2428e91 CBI: Allow get command to reload data from EEPROM
This patch adds CBI_GET_RELOAD flag to EC_CMD_GET_CROS_BOARD_INFO
command. When the flag is set, the command will be forced to read
data from EEPROM even, ignoring the data cached by the previous
read.

This allows ectool to verify a write was successful without reboot.

BUG=b:70294260
BRANCH=none
TEST=ectool cbi set 0 0x1234 && ectool cbi get 0 1

Change-Id: I3e7ced5be56a74c605870a4c0622c0a2f47963bb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/874155
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 20:18:11 -08:00
Daisuke Nojiri
4941dd5542 CBI: Retry read and cache the result
This patch makes read_board_info retry to read CBI on error. The
successive calls will be immediately returned with the cached result.
This will avoid attempting reads doomed to fail.

BUG=b:70294260
BRANCH=none
TEST=ectool cbi get 0

Change-Id: Iacd9cc38bab814af9188c4557c2ee751c421e3a3
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/872259
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 20:18:11 -08:00
Jett Rink
f02c8c4c87 grunt: Enabling backlight lid control module
Enabling backlight control module with active low mode enabled.

BUG=b:72007261
BRANCH=none
TEST=Booted grunt board and verified lid sensor toggles backlight

Change-Id: I14a6eec01c4cda6fcb4b821b9a4b6f266b8fe78b
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/872234
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-18 17:40:53 -08:00
Philip Chen
bffb196a07 scarlet: Use TCPC to detect if AC is present
After VBUS is up, there is a delay of ~500ms for rt946x to determine
'VBUS is ready'.
But we need charger_task to detect AC presence and then set a proper
sleep time immediately.
When using fusb302 to detect VBUS, I almost don't see any delay.

BUG=b:71520398
BRANCH=none
TEST=Confirm BATTERY LED turns on immediately when AC is
plugged in a Scarlet in G3.

Change-Id: If1d6d40081b5822eeb9e012115f8deef172def37
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/869420
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-18 17:40:46 -08:00
Nicolas Boichat
9e71ed4b4d charge_state_v2: Wake charger task when we start/stop providing power
BRANCH=none
BUG=b:65697962
TEST=On wand, battery information is quickly updated after
     (un)pluging AC on lid (otherwise we might have to wait up to
     60 seconds).

Change-Id: I2bd457ba4d38aa4c99638a2576a4132406416de2
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/859401
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-18 17:40:28 -08:00
Vincent Palatin
f8825cef15 fpsensor: fix test build
Disable the private fp driver calls for test binaries.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:70320279
TEST=make BOARD=meowth_fp tests

Change-Id: I16f241a33ead3ea29e7aa955512e05e679a0c551
Reviewed-on: https://chromium-review.googlesource.com/873923
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-18 17:40:02 -08:00
Simon Glass
60bbe1ca75 grunt: Add support for I2C bus 5
This is used by the keyboard backlight driver. Add support for it so we
can use this chip.

BUG=b:69379749
BRANCH=none
TEST=manual:
boot AP
gpioset KB_BL_EN 1
i2cscan
See that bus 5 shows 0x6c now

Change-Id: I37dd497688f7d280119bf2a226e23bee35063e0c
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/871135
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-18 19:05:37 +00:00
CHLin
97c819c628 util: flash_ec: Add support to flash npcx7_evb with npcx7m7x chip
This CL modified the flash_ec and openocd script to support flashing
npcx7m7x chip on npcx7_evb.

BRANCH=none
BUG=none
TEST=Change CHIP_VARIANT to npcx7m7w in board/npcx7_evb/build.mk;
"BOARD=npcx7_evb make"; Move npcx7_evb from array BOARDS_NPCX_7M6X_JTAG
to BOARDS_NPCX_7M7X_JTAG in util/flash_ec; Connect servo JTAG to npcx7
EVB; "./util/flash_ec --board=npcx7_evb"; Make sure the programing
succeed and EVB bootup.

Change-Id: I9d448f55321330cbe9a7103d2b617617963ea307
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/858989
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 10:11:50 -08:00
Nicolas Boichat
9ef3e91bdd stm32/usb: Add logic to detect stuck controller in usb_wake
When we tried to go back to sleep immediately after receiving a
spurious USB resume event, the controller would get stuck in an
unrecoverable state. Hopefully we fixed the resume logic, but
this code would catch other cases, and recover the base.

BRANCH=none
BUG=b:35775088
BUG=b:67766202
BUG=b:71688150
TEST=With badly implemented resume logic (e.g. call
     usb_resume_deferred directly from usb_resume), with USB
     autosuspend enabled on soraka, short D+/D- lines.
     Next wake event from staff shows "USB stuck", and then
     USB interface recovers.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Change-Id: I7463a37682723be195bd6a72ea5d76c21bb6cb9a
Reviewed-on: https://chromium-review.googlesource.com/868094
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-18 10:11:49 -08:00
Nicolas Boichat
0270e9db62 stm32/usb: Handle spurious wakes in usb_resume
Sometimes, usb_resume gets called, but the D+/D- lines do not
indicate an actual resume event (e.g. during ESD discharge).

Reference manual tells we should go back to sleep if state is 10 or
11. However, setting FSUSP and LP_MODE in this interrupt routine
seems to lock the USB controller (see b/35775088 and b/71688150).
Instead, we do it in a deferred routine. The host must assert the
reset condition for 20ms, so reading D+/D- after ~3ms should be safe
(there is no chance we end up sampling during a bus transaction).

BRANCH=none
BUG=b:35775088
BUG=b:67766202
BUG=b:71688150
TEST=On staff, with USB autosuspend enabled on soraka, short
     D+/D- lines, which causes a spurious wake event. After that
     remote wake-up still works.
TEST=Repeat test with ESD discharge.
TEST=Repeat test with plugging/unplugging of USB-C monitor.

Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Change-Id: I0f2697d1fa5b68356fd8a4fc16eaab5eadad9086
Reviewed-on: https://chromium-review.googlesource.com/868093
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-18 10:11:48 -08:00
Vincent Palatin
07230f772e Add more debugging to run_host_test
If a host test fails, record the execution state of the EC host process.

This is an attempt to provide a hint whether the test was blocked on
I/O, if so it might be in 'D' state (but it might have recovered too
late too).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chromium:715011
TEST=run 'make runtests -j', then run it again with TIMEOUT reduced to 1
see it fail on 'kb_scan' and 'interrupt' tests with the trace containing
'*** test [...] in state Ssl+ ***'

Change-Id: I4590a4b84a2aba8d385d3ef911d5d0186e8ce2e3
Reviewed-on: https://chromium-review.googlesource.com/859771
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 05:09:42 -08:00
Jett Rink
d52ba1a4d4 backlight: Adding support for active low GPIO signal
BUG=b:72007261
BRANCH=none
TEST=Verified with grunt board (with is active low)

Change-Id: I9a58148b8d92065bec982071ed1d97a466197e9a
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/872233
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-18 05:09:37 -08:00
Aseda Aboagye
289347ad6a flash_ec: Support NPCX_INT_SPI using CCD.
A few things needed to be moved around in order for flashing the npcx7
to work over CCD.  This commit makes those changes and fixes a small bug
with the serial number parameter for raiden devices. (It just needed a
space).  It also fixes using just a SuzyQable to flash.

BUG=b:71548795
BRANCH=None
TEST=`./util/flash_ec --board meowth` with a servo_v4 and verify that
flashing is successful.
TEST=Repeat above test with a servo_v2.
TEST=Repeat above test with a servo_micro.
TEST=Repeat above test with a SuzyQable.

Change-Id: I8ff22fb1d2a5fe7af2ad30a14bf896dbae65c024
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/851354
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-18 05:09:35 -08:00
Daisuke Nojiri
bc4b786156 CBI: Add host command to set board info
This patch adds host command to write board information in EERPOM.

BUG=b:70294260
BRANCH=none
TEST=Run ectool cbi set <type> <value> to write BOARD_VERSION, OEM_ID,
and SKU_ID. Enable WP and verify cbi set command fails.

Change-Id: I39536d146313408ace666f350a107d89b331bf7a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865570
2018-01-18 05:09:31 -08:00
Daisuke Nojiri
5232cdd16b CBI: Add host command to get board info
This patch adds host command to get board info from EEPROM.

BUG=b:70294260
BRANCH=none
TEST=Run ectool cbi get <type> to get board version, OEM, SKU

Change-Id: I41a84d3eea6da9d88fa8122db36dcd1df515842d
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865161
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 05:09:31 -08:00
Daisuke Nojiri
c62060d9d9 CBI: Add cbi-util
cbi-util is a build command line tool, which creates a blob containing
board information. When invoked with '--show' option, it prints the
information stored in a blob and validates the data.

BUG=b:70294260
BRANCH=none
TEST=Run the command as follows:
$ cbi-util --create /path/to/cbi.bin \
  --board_version 0xabcd --oem_id 2 --sku_id 3 --size 256
$ cbi-util --show /path/to/cbi.bin
CBI blob: /path/to/cbi.bin
  BOARD_VERSION: 0.1 (0xab.cd)
  OEM_ID: 2 (0x02)
  SKU_ID: 3 (0x03)
Data validated successfully
$ cbi-util --create /path/to/cbi.bin \
  --board_version 0xabcd --oem_id 2 --sku_id 3
Missing required arguments
$ cbi-util --create /path/to/cbi.bin --board_version 0xabcde
Invalid --board_version

Change-Id: I7e7b439c50943523039c3cafda3bdf7d08962c61
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/860961
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-18 05:09:30 -08:00
Daisuke Nojiri
6e3e0f87b1 CBI: Read board info from EEPROM
This patch adds Cros Board Info APIs. It reads board info from EEPROM.
This patch sets CONFIG_CBI for Fizz to make it use CBI.

BUG=b:70294260
BRANCH=none
TEST=Read data from EEPROM.

Change-Id: I7eb4323188817d46b0450f1d65ac34d1b7e4e220
Reviewed-on: https://chromium-review.googlesource.com/707741
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-01-18 05:09:29 -08:00
CHLin
a0f25e398e npcx7: Add definition/configuration for npcx7m6xb/npcx7m7w
In this CL, we add the following changes to support the CHIP_VARIANT
npcx7m6xb and npcx7m7w:
1. Define the code RAM, data RAM, BBRAM base address/size.
2. Initialize the wov.c file for WoV driver development. (It will be
compiled only when CHIP_VARIANT=npcx7m7w in the build.mk and
CONFIG_WAKE_ON_VOICE is defined in board.h)
3. Fix the the incorrect offset of PWDWN_CTRL7 register.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST=Change CHIP_VARIANT to npcx7m7w/npcx7m6xb in
board/npcx7_evb/build.mk; "BOARD=npcx7_evb make"; Check ec image can be
built. Flash the image on EVB; make sure EVB bootup.

Change-Id: I87bccb9097f8f0a6c67f96a8d90adf201ae9e773
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/858637
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-17 23:37:27 -08:00
Nicolas Boichat
6432c52a72 stm32/usb: usb_wake: Update STM32_USB_CNTR with interrupts off
STM32_USB_CNTR may be written from both interrupt context, and
usb_wake (not necessarily in interrupt context). Let's disable
interrupts to make sure the operation is atomic.

BRANCH=none
BUG=b:35775088
BUG=b:67766202
BUG=b:71688150
TEST=Flash hammer, hammer can wake from USB autosuspend

Change-Id: I9c2a3259902ecb759a6d0d89c7746c7aa72ae73d
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/744282
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-17 23:37:26 -08:00
Mary Ruthven
7b5b83055c cr50:ap_state: reenable detect ap on interrupt
ap_state doesn't disable/enable the detect ap interrupt correctly. This
means cr50 is mostly just polling the AP state. Cr50 may not realize the
AP is up until almost a second after it first turned on. This change
reenables the detect ap on interrupt while debouncing the AP state or if
Cr50 thinks the AP is off, so cr50 can more quickly detect the
transition from off to on.

This issue doesn't affect devices that detect the AP with TPM_RST_L,
because we never disable the TPM_RST_L interrupt and that handler calls
ap_on_deferred directly.

BUG=b:71866206
BRANCH=cr50
TEST=run power_state:rec on Dru and make sure there are no tpm irq
timeouts.

Change-Id: I67388f9dce94fb22efe5755a0de563e5af42f8f5
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/869410
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-17 06:20:39 -08:00
Nicolas Boichat
e71899a573 ectool: battery: Allow negative present current
Battery interface over host command is different, as it allows
negative current values to indicate discharge, let's not fail in
that case.

BRANCH=none
BUG=b:65697620
TEST=ectool battery 1 does not fail when battery is discharging.

Change-Id: I89ca750e24706f55a0589201aeaf9fea50f3132f
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/869552
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-17 06:20:38 -08:00
Vincent Palatin
c10a631026 meowth_fp: add flashing script
Simple shell to flash the FP MCU firmware from the AP through the STM32
DFU mode (over the SPI interface).

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:71986991, b:36125319
TEST=run flash_fp_mcu on Meowth and see a new FP MCU is flashed

Change-Id: I99af754b3ed4916ee04a800859f1b28feb640de1
Reviewed-on: https://chromium-review.googlesource.com/866840
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-17 06:20:38 -08:00
Vincent Palatin
9d38e46641 ectool: add servo v2 spi support
Add a new transport for ectool to send host command V3 over the Servo v2
SPI interface using libftdi.

Build this new communication mechanism only for the 'build' architecture
as it has a dependency on libftdi, the new ectool binary is called
ectool_servo.
Fix the 'build' tools build if they don't have a source file matching
their binary name.

The serial number of the servo board can be passed in the 'name'
parameter, e.g. :
sudo ectool_servo --name=905537-00474 version

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=b:70320279
TEST=with ZerbleBarn connected to a servo V2, run:
sudo ectool_servo version

Change-Id: Ia7067d465a42f76695fed5932f32fac9a6d0988e
Reviewed-on: https://chromium-review.googlesource.com/864164
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-17 06:20:37 -08:00
Philip Chen
1e1b5d4463 power/rk3399: Change power-off sequence for KD panel
We should turn off PP3300_S0 and then PP1800_S0 to meet
KD panel spec. PP3300_S0 has to be on in S3_WoUSB, so PP1800_S0
also has to be on - let's move PP1800_S0_EN to s0s3_usb_wake_power_seq.

BUG=b:71057948
BRANCH=none
TEST='suspend_stress_test' for 10+ cycles without seeing things go wrong

Change-Id: Ic44411062b4c9e857b9f8ca6565550ba8bd2f950
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/862254
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2018-01-16 21:26:28 -08:00
Shamile Khan
0348eb1059 glkrvp: Enable eSPI instead of LPC including eSPI VW based SCI/SMI
BUG=None
BRANCH=None
TEST=GLKRVP can boot to OS when a coreboot image with eSPI
     enabled is flashed.

Change-Id: Ia534bdbbe517c53ba2e0beafc41b421872f1e33d
Signed-off-by: Shamile Khan <shamile.khan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/818196
Commit-Ready: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-16 21:26:27 -08:00
Ruben Rodriguez Buchillon
51e9e69f38 power: introducing pwr_avg console command
pwr_avg provides an average voltage, current, and power over the last
1 minute. It's up to the battery drivers to implement this
functionality.
This change allows us to have better power tracking while minimizing
the power impact on the EC, because
- the pwr_avg command only needs to be called once every minute, and is
short, thus less expensive to parse on ECs without a UART buffer
- the work done to keep the avg is partially done by the batteries
already and it's just a question of retrieving it.

undefined on wheatley since no power debugging planned on that board.

usage:
> pwr_avg
mv = 7153
ma = -605
mw = -4327

BUG=chromium:752320
BRANCH=None
TEST=make buildall -j

Change-Id: Id1a3479d277aedf90dfa965afb4ee9136654b1cf
Signed-off-by: Ruben Rodriguez Buchillon <coconutruben@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/823884
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-16 04:08:26 -08:00
Edward Hill
be1f97a255 grunt: Enable TCPC + PPC interrupts and overcurrent GPIOs
BUG=b:69378796
BRANCH=none
TEST=PD still works on both ports

Change-Id: I6c9d378483d141db821da2a717cf1256099b01ec
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/867234
Reviewed-by: Aaron Durbin <adurbin@google.com>
2018-01-16 01:26:15 -08:00
Edward Hill
7f1bb54c10 grunt: Set source current limit to enable 3A output
Call ppc_set_vbus_source_current_limit to enable 3A output.

BUG=b:69378796
BRANCH=none
TEST=connect PD sink and see 5V 3A on both ports

Change-Id: Ia38ebcb3b1b3d1148a00b3050fcda2bd2cf73af5
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/866158
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-01-16 01:26:15 -08:00
Edward Hill
76bd681c8f grunt: Don't return error when disabling all charge ports
charge_manager_refresh() asserts that
board_set_active_charge_port(CHARGE_PORT_NONE) returns EC_SUCCESS,
so if port 1 on Grunt's daughter board is disconnected, the EC
gets stuck in an assert crash loop. Just printing the error and
continuing seems like a better way to handle the missing port.

BUG=b:71955904
BRANCH=none
TEST=grunt with no daughter board doesn't assert

Change-Id: I8a0f79e45c7b564794498cfc41bcc4acd8fd231f
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/866214
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-01-16 01:26:15 -08:00
YB.Ha
67ae6eb9b0 nautilus: support BC1.2 on USB Type-A port
support BC1.2 on USB Type-A port

BUG=b:71775046
BRANCH=none
TEST=build/flash nautilus

Change-Id: Iff9e95d06c0498d8f093d508bc50a0754e973c37
Reviewed-on: https://chromium-review.googlesource.com/858979
Commit-Ready: YongBeum Ha <ybha@samsung.com>
Tested-by: YongBeum Ha <ybha@samsung.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-15 20:31:57 -08:00
Nicolas Boichat
eaaf890188 wand: Enable CONFIG_CHARGE_RAMP_HW
Enable ramping by default. Follow-up CL will have EC-EC master tell
the slave if it's necessary to ramp.

BRANCH=none
BUG=b:71840796
TEST=lux fully charged, in S0ix, wand connected. Connect old
     BC1.2 charger, see that the charger is not browning out anymore.

Change-Id: I5f1052257db4c581bcb700c7f0306f14f792ea03
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/863349
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-14 18:38:31 -08:00
Nicolas Boichat
4c56c17a1a battery: Add support for reading base battery through host command
This adds support for EC_CMD_BATTERY_GET_STATIC and
EC_CMD_BATTERY_GET_DYNAMIC host commands, that can currently only
fetch the base battery information using index = 1.

In the future, all battery information can be passed to AP using
these host commands (i.e. lid could provide its own battery
information on index = 0).

BRANCH=none
BUG=b:65697620
TEST=ectool battery shows lid battery information (no change)
TEST=ectool battery 1 shows base battery information

Change-Id: Ib819e4917b3acc337348764f6cc2aa7380bed700
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/863863
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-14 18:38:29 -08:00
Edward Hill
66bc9c1082 grunt: Fix ENABLE_BACKLIGHT to be active low
BUG=b:71806495
BRANCH=none
TEST=backlight turns on in S0

Change-Id: Ib9271d6cbe9befdf4ed492a9c2b676452e5f4d9b
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/865155
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-14 18:38:27 -08:00
Edward Hill
ad59381ca3 grunt: Enable BMI160 gyro interrupts
Setup bmi160_interrupt and enable in board_init.

BUG=b:69379621
BRANCH=none
TEST=none

Change-Id: I80d08146367af0b91d8d9ac1495c85fe8edd0203
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/864827
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-14 18:38:27 -08:00
Edward Hill
dd404f34d5 grunt: Add CONFIG_VBOOT_HASH
The vboot hash calculation needs to be enabled for EC software sync.

BUG=b:64935726
BRANCH=none
TEST=see hash on console

Change-Id: I2d26ef997fc9ed803e80cc716a518a2834632269
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/864826
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@google.com>
2018-01-14 06:23:22 -08:00
Ege Mihmanli
0765c05d33 rainier: final fix for accel orientation.
Rainier has landscape orientation and last patch was 90 degrees off in
its base rotation value.

BUG=b:71753415
TEST=Flash ec on rainier and tilt device.
BRANCH=None

Signed-off-by: Ege Mihmanli <egemih@google.com>
Change-Id: I1d0837b2391ec4d0051c6c9af984d801264fe64c
Reviewed-on: https://chromium-review.googlesource.com/865803
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-12 22:37:52 -08:00