Commit Graph

8415 Commits

Author SHA1 Message Date
Mary Ruthven
a4e1e47630 cr50: add properties to BOARD_ALL_PROPERTIES
Add BOARD_DEEP_SLEEP_DISABLED and BOARD_DETECT_AP_WITH_UART to
BOARD_ALL_PROPERTIES, so they will be updated after cr50 reboots.

BUG=b:35647982
BRANCH=cr50
TEST=test deep sleep on scarlet

Change-Id: I8999ae7c6c1dad6799b5fdb99ebf5d7618a21c2b
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/882343
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-29 16:38:26 -08:00
Gwendal Grignou
051aebf5e0 sensors: Remove debug printf
Remove prints when activity triggers.

BUG=b:72533440
BRANCH=eve
TEST=compile

Change-Id: I047e14990ef734c35161293b9c5fbbece0ddab0c
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/890632
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-01-29 16:38:26 -08:00
Nicolas Boichat
a954cecd3e charge_state_v2: Fetch static battery information when flags change
Instead of fetching static battery information all the time, we
first fetch the dynamic information, and see if the flags changed.
If they did, refetch the static information.

This also covers the cases when the base is disconnected/reconnected.

BRANCH=none
BUG=b:71881017
TEST=ectool battery 1 shows correct static battery information after
     plug/unplug.

Change-Id: I936983fc0fdc4dae0494e8a24f890927e30555dc
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/872813
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-29 05:24:48 -08:00
Nicolas Boichat
31c1fc6d43 whiskers: Update GPIO for next revision
Looks more similar to original hammer.

BRANCH=none
BUG=b:68934906
TEST=make BOARD=whiskers -j

Change-Id: I0f10240f8c3237b20f60a1217e167ad9539e3953
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/853574
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-29 05:24:45 -08:00
YB.Ha
14e6afb4f2 nautilus : fix abnormal led operation
The charge state is set to IDLE when battery temperature
is under 0 or over 50 degrees and led is set to green although
external power does not present.
This CL fix this issue.

b:72423182
BRANCH=none
TEST=build/test in nautilus

Change-Id: I238096d46a426dd3ad579540c06eb306f2d1b490
Reviewed-on: https://chromium-review.googlesource.com/888358
Commit-Ready: YongBeum.Ha <ybha@samsung.corp-partner.google.com>
Tested-by: YongBeum.Ha <ybha@samsung.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-01-29 03:06:35 -08:00
Elmo_Lan
e46d0fcbc8 Nami: Update for ALS and temperture sensor
Implement ALS code and add a new thermal sensor
(Fintek, F75303)

BUG=b:71839392
BRANCH=none
TEST=Verify Nami can read ALS and thermal data via I2C by ec console.

Change-Id: I0f8fd486f62508bbca30a57f435b9f26621cf34b
Signed-off-by: Elmo_Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/863350
Commit-Ready: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
Tested-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
2018-01-28 21:17:06 -08:00
Vincent Palatin
4e39404604 ectool: increase image capture delay to 200ms
the current 50ms delay between the capture and having the image
available was working (to some definition of it) on the current boards,
but we hit issues on the next revision of the board with new sensor
silicon (and somewhat different delay), let's put a larger 200ms delay.
This will be converted to waiting for the proper MKBP event (aka
EC_MKBP_FP_IMAGE_READY) when all the boards using this feature will have
MKBP events support validated.

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

BRANCH=none
BUG=b:71770455
TEST=run 'ectool --name=cros_fp fpcheckpixels' on different boards.

Change-Id: Id1f2402ef85c903744054b00eeab0086221b4d7b
Reviewed-on: https://chromium-review.googlesource.com/888738
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Benson Leung <bleung@chromium.org>
2018-01-26 16:12:08 -08:00
Vincent Palatin
1701465551 Make CONFIG_MALLOC partition-specific
Allow to have CONFIG_MALLOC defined for one partition and not the other.
The typical use-case is asymetric firmware whose small RO is typically
just an updater/verifier (and RW signature verification currently
doesn't like malloc as the memory initialization is done too late).

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

BRANCH=none
BUG=b:72360575
TEST=make buildall

Change-Id: I67cc04cd11385d4c05556ea41ef674cb7a232e65
Reviewed-on: https://chromium-review.googlesource.com/885820
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-26 13:25:49 -08:00
Martin Roth
9b7b5460d2 grunt: Disable CONFIG_BRINGUP option
Bringup went well so this this option is no longer needed.

BUG=None
TEST=Build & boot
BRANCH=None

Change-Id: I415161ab77d2a6b1ce59d6773d3cf78176cd1e96
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/882182
Commit-Ready: Martin Roth <martinroth@chromium.org>
Tested-by: Martin Roth <martinroth@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-01-26 13:25:47 -08:00
Nicolas Boichat
e5c6f97d1a charge_state_v2: Basic dual-battery charging algorithm
First version of the algorithm, some TODOs are left in the code
but this, generally, works reasonably well.

When charging, we allocate input current in this general order:
 - Base system (fixed, low, number)
 - Lid system (based on PSYS)
 - Lid battery (estimating how much current the battery actually
   requires)
 - Base battery (similar estimation)
 - Provide everything else to lid

When discharging, we generally:
 - First discharge the base battery
 - Then discharge the lid battery

BRANCH=none
BUG=b:71881017
TEST=Flash lux and wand, EC-EC communication works, adapter power
     is split in a sensible way, and discharging works fine.

Change-Id: I8a4f87963962fc5466b2fedf1347eb4dadd35740
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/659460
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-26 13:25:38 -08:00
Nicolas Boichat
ecfa696638 lux: Base detection code
Lux base detection is a little trickier than previous bases,
as the detection levels switch around when GPIO_EC_COMM_PD gets
enabled:
 - When disconnected, low levels (~550mV) mean base got connected,
   and high levels (~3300mV) mean base is still disconnected.
 - When connected, low levels (~43mV) mean base got disconnected,
   and high levels (~2346mV) mean base is still connected.

On reset, when base_status is unknown, we enable GPIO_EC_COMM_PD,
to be able to differentiate between connected and disconnected.

BRANCH=none
BUG=b:67029560
TEST=Connect lux/wand, check that base gets detected correctly.
TEST=Type reboot in EC console, base gets detected as well.

Change-Id: I742def8e378a93c08e2dcc155b06cbca814e7fd8
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/845543
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-01-26 13:25:38 -08:00
Jett Rink
a5c21c4ffe usb pd: Increasing delay for Rp time on CC lines
Some chargers don't respect the SRC.Open state within the 20ms allotted by
the usb spec. The LiteOn Charger seems to notice after ~120ms bumping to
200ms so we cutoff Vbus for even ill-behaved chargers. We expect to brown
out in the sleep.

BRANCH=none
TEST=LiteOn charge will disconnect now
BUG=b:72510370

Change-Id: Ief0e999ed52f39420eed5f07432273e741a14c7e
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/886833
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-26 10:58:55 -08:00
paris_yeh
9c06f2f1c2 coral: Fix default LED table for battery error state
The default behavior for this state is the amber color for 1 second
and then off for 1 seconds. The existing table entry for this state
was incorrect.

BUG=b:70914820
BRANCH=none
TEST=make buildall -j
Signed-off-by: paris_yeh <pyeh@google.com>

Change-Id: I6291121a37905d5f7cdcfe57b3f91d98af370605
Reviewed-on: https://chromium-review.googlesource.com/848757
Commit-Queue: David Huang <David.Huang@quantatw.com>
Tested-by: David Huang <David.Huang@quantatw.com>
Reviewed-by: Scott Collyer <scollyer@chromium.org>
(cherry picked from commit 9377284119d1279c3843f16e9ea8d91d5dc8528f)
Reviewed-on: https://chromium-review.googlesource.com/842345
Commit-Ready: Paris Yeh <pyeh@chromium.org>
Tested-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-by: Paris Yeh <pyeh@chromium.org>
2018-01-25 22:38:21 -08:00
Jett Rink
f4602ec472 usbc: Moving PPC init after setting TCPC resistors.
We don't want the PPC to connect the CC lines from the
TCPC to the USB connector until the TCPC resistors are
set in a valid state (SINK initially).

If we connect the CC lines (happens in the ppc_init) before
setting the resistor values, some TCPC will be toggling the
CC line between Rp/Rd since it doesn't detect a cable yet.

In the dead battery charging case, connecting the toggling
CC lines to the charger can rail the CC lines to 3.3 V signaling
to the charger to disconnect Vbus, thus browning out the board.

BRANCH=none
BUG=b:71865251
TEST=Grunt powers on via usbc p0 with and without USB hub.

Change-Id: I8e78aa2af42075398fab89a2dccef5e7df27b260
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/882305
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-25 19:23:47 -08:00
Benjamin Gordon
f71edad1e7 grunt: Enable LM3630A driver for keyboard backlight
BUG=b:69379749
BRANCH=None
TEST=kblight 100; kblight 50; kblight 0

Change-Id: I003ae1071de0430fe38a48b2e9bccb08207bc019
Signed-off-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879083
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-25 19:23:38 -08:00
Benjamin Gordon
73162e60af zoombini: Enable LM3630A driver for keyboard backlight
BUG=b:69379749
BRANCH=None
TEST=kblight 100; kblight 50; kblight 0

Change-Id: I096ed43859e11a7984d9672bfab406f0cb91015f
Signed-off-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/881945
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-01-25 19:23:37 -08:00
Benjamin Gordon
d258f8a788 driver/led: Add LM3630A driver
This chip controls the keyboard backlight.  The backlight level is set
through PWM, but the chip needs to be enabled and configured before PWM
settings are recognized.  This will be initially used for grunt and
zoombini.

BUG=b:69379749
BRANCH=none
TEST=In EC console for grunt: kblight 100; kblight 0

Change-Id: I5576d709687d8f61b5757485baa239ffd6b41a74
Signed-off-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879082
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-25 19:23:37 -08:00
Philip Chen
b46496c2d5 nautilus: Fix battery_check_disconnect()
The way Nautilus battery checks the conditions of CHG/DSG FETs
are slightly different from the other smart batteries we use.
So the current implementation of battery_check_disconnect() doesn't work.

BUG=b:69016914
BRANCH=none
TEST=recovery from software-based battery cutoff 10/10

Change-Id: I88de64d8da55f0b57fbdde21d4529435841bdf76
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/882941
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-01-25 02:43:22 -08:00
Wei-Han Chen
9a7e82bac8 stm32: make half-duplex SPI works on STM32F0
According to RM0091, steps for using DMA for SPI peripheral should be:

1. enable DMA RX / TX
2. enable SPI
3. wait for DMA to complete
4. disable DMA RX / TX
5. disable SPI

BUG=b:70482333
TEST=tested on reworked staff (half-duplex)
TEST=tested elm (full-duplex)

Change-Id: I095409195cd1e0379995f0bfa6605c2e1a0dfd3c
Reviewed-on: https://chromium-review.googlesource.com/853715
Commit-Ready: Wei-Han Chen <stimim@chromium.org>
Tested-by: Wei-Han Chen <stimim@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-01-25 00:15:48 -08:00
Elmo_Lan
e68469b524 Nami: trigger type of LCD backlight
Modify for low active design.

BUG=b:71839295
BRANCH=none
TEST=Verify Nami LCD backlight turn on.

Change-Id: I26f1e744921da5fa62f5f561fd6d16a76f2c5f4e
Signed-off-by: Elmo_Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/861583
Commit-Ready: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
Tested-by: Elmo Lan <elmo_lan@compal.corp-partner.google.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-24 20:24:39 -08:00
Daniel Kurtz
8944d0824a grunt: Add CONFIG_VSTORE
Add a slot of secure temporary storage to support suspend/resume.

Signed-off-by: Daniel Kurtz <djkurtz@chromium.org>

BUG=b:72188897
TEST=On grunt w/ S3-enabled coreboot:
  powerd_dbus_suspend --wakeup_timeout=10
 => Device resumes throught coreboot to kernel
BRANCH=none

Change-Id: I37410a3e66fc6eee32e559069a33e904880cddc9
Reviewed-on: https://chromium-review.googlesource.com/875418
Commit-Ready: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Daniel Kurtz <djkurtz@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-01-24 20:24:38 -08:00
CHLin
65cc83f780 npcx7_evb: Define BOARD_VERSION for different npcx7 EVBs
There are two versions of npcx7 EVB. This CL adds the definition
BOARD_VERSION (default is 2) in board.h. So we can include different
features or set CONFIG_* flags based on the value of BOARD_VERSION to
meet the default HW configuration of npcx7 EVBs.

BRANCH=none
BUG=none
TEST=No build errors for make buildall.
TEST=Change BOARD_VERSION to 1/2; "BOARD=npcx7_evb make";
Flash the image on EVB 1/2; make sure the EVBs bootup.

Change-Id: Id4556f702af8c26778a649addde7cf490b5301fc
Signed-off-by: CHLin <CHLIN56@nuvoton.com>
Reviewed-on: https://chromium-review.googlesource.com/873510
Commit-Ready: CH Lin <chlin56@nuvoton.com>
Tested-by: CH Lin <chlin56@nuvoton.com>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-24 04:36:36 -08:00
Jongpil Jung
b58ceaca34 nautilus: set default level for USB_POWERON
To eanble USB power, USB_POWERON_L should be low.
Default is high. So, turn off USB.
Power On(Low) : chipset startup
Power Off(High) : chipset shutdown

BUG=b:72202322
BRANCH=master
TEST=emerge-nautilus chromeos-ec
     flash ec and check if PIN stay low after power on.

Change-Id: I9ab617b72f10645fb2dce7005ddeeb023c67605d
Signed-off-by: Jongpil Jung <jongpil19.jung@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/872810
Commit-Ready: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com>
Tested-by: Jongpil Jung <jongpil19.jung@samsung.corp-partner.google.com>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 20:18:29 -08:00
Philip Chen
163ba57cc2 scarlet: Assert SYS_RST_L in S5
To support CR50 deep sleep mode:
In up-sequence, SYS_RST_L needs to remain asserted on the transition
to S5 and then deasserted on the transition to S0;
In down-sequence, SYS_RST_L needs to be asserted on the transition to S5.

This only affects Scarlet.

BUG=b:35647982
BRANCH=none
TEST=minitor SYS_RST_L pin to confirm it is toggled right

Change-Id: Ic73d39c531f9d28b2087a23d58613e98ec80dbd2
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/866115
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: David Schneider <dnschneid@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 20:18:28 -08:00
Daisuke Nojiri
451fba34b8 Nami: Add Nami to flash_ec script
This patch adds Nami to flash_ec script.

BUG=none
BRANCH=none
TEST=Flash ec.bin to nami proto0.

Change-Id: I7b036c429fb028e916335efd330a4b8d80977263
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879585
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-23 17:41:53 -08:00
Edward Hill
bd9d0d054b grunt: Move TCPC init to init hook
All init hooks complete before tasks are started (since
crrev.com/c/456628), so board_tcpc_init will finish before
the PD tasks start.

Using the init hook instead of CONFIG_USB_PD_TCPC_BOARD_INIT
avoids the problem of board_tcpc_init being called by every
PD task.

BUG=b:72229154
BRANCH=none
TEST=PD still works on grunt,
     board_tcpc_init is only called once,
     PD task init happens after board_tcpc_init finishes

Change-Id: Ie1263dffce06e9ea2433cc2d08d1537e4a891d40
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/879358
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 17:41:45 -08:00
Vincent Palatin
adeb276aa6 eve_fp: remove board
fp is dead, long life to fp.

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

BRANCH=none
BUG=b:72360575
TEST=make buildall

Change-Id: Idccb953044018e24d14b6ef1dbf69766fb9b58ab
Reviewed-on: https://chromium-review.googlesource.com/880954
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2018-01-23 17:41:42 -08:00
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