Commit Graph

40 Commits

Author SHA1 Message Date
Edward Hill
5bfeef6bb3 grunt: Set USB-C DP HPD GPIOs correctly.
Change the EC to drive the Hotplug Detect (HPD) 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 using USB-C to DP adapter on both ports

Change-Id: I22ec9eecc5bdf9c6463dd3ce208d051faf15c57a
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/892099
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 21:29:38 -08:00
Martin Roth
69b592426c Grunt: Set AP reset pin to open drain
By setting this GPIO to open drain, we don't need to make any board
changes as it won't conflict with the warm reset pin from the servo
header.

TEST=Warm reset works
BUG=B:72751599
BRANCH=None

Change-Id: I29d976851fc011fcb130a1747e4a39c8bf80a4ed
Signed-off-by: Martin Roth <martinroth@google.com>
Reviewed-on: https://chromium-review.googlesource.com/898075
Commit-Ready: Aaron Durbin <adurbin@chromium.org>
Tested-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 18:08:42 -08:00
Simon Glass
c23e632984 grunt: Rename orange LED to amber
'Amber' seems to be more common in the code base. Rename it for grunt.

BUG=b:71902053
BRANCH=none
TEST=make BOARD=grunt -j10

Change-Id: I73a6bff4f113f5c49e70fde6d1f4667b8324a6d8
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896401
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-02-01 18:08:40 -08:00
Jett Rink
1b87ee65ac cleanup: Removing unnecessary CONFIG_USB_PD_DISCHARGE define
CONFIG_USB_PD_DISCHARGE is now defined automatically if you specify one of
the specified options such as CONFIG_USB_PD_DISCHARGE_TCPC

BRANCH=none
BUG=none
TEST=grunt still discharges using PPC

Change-Id: I94086cfc58bebce9c62ad6aa52b7740b25276d89
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/894676
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
2018-02-01 14:55:19 -08:00
Jett Rink
aa2a4695ae grunt: enabling PPC vbus discharge path
Grunt uses a PPC, so we want it to discharge VBUS instead of the TPCP

BRANCH=none
BUG=b:72179253
TEST=Verified grunt board fall time is within spec now

Change-Id: I556cd2945ee191e3f423ee0a93c35eb2ccff9016
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/886564
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-31 22:39:01 -08:00
Edward Hill
11bda19561 sn5s330: Enable VBUS interrupts
If the sn5s330 PPC is being used to detect VBUS presence
(CONFIG_USB_PD_VBUS_DETECT_PPC), then enable interrupts and call
usb_charger_vbus_change when VBUS_GOOD changes.

BUG=b:72007153,b:72007492
BRANCH=none
TEST=Connect 3A and 1A USB-A chargers to each of Grunt's USB-C ports,
check that BC1.2 detection is working:
	With 1A:
	> chgsup
	port=0/1, type=7, cur=500mA, vtg=5000mV, lsm=1
	With 3A:
	> chgsup
	port=0/1, type=7, cur=2400mA, vtg=5000mV, lsm=1
TEST=Boot Grunt to OS, then connect USB2 mouse or USB3 flash drive to each
of Grunt's USB-C ports. Devices do not work due to b:71772180, but gpioget
shows EC is setting USB_C0/1_BC12_VBUS_ON_L correctly.

Change-Id: Iffc352105a321997adb364b9fbb8bafef248c224
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/887938
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-01-31 22:38:56 -08:00
Shawn Nematbakhsh
9afcd8d602 cleanup: Remove CONFIG_USB_PD_TCPC_BOARD_INIT
It's no longer necessary to call board_tcpc_init() from PD tasks, since
HOOK_INIT completion is guaranteed before the task starts. Also, calling
board_tcpc_init() for each PD task without a port arg is a bad idea.

BUG=b:72229154
BRANCH=none
TEST=`make buildall -j`

Change-Id: I6fba07771693b8343568041960a263e02775a8fc
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/881538
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-30 14:54:23 -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
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
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
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
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
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
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
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
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
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
Simon Glass
2bd336f1d2 grunt: Add I2C support for the BMI160
We need to enable I2C_PORT_ACCEL so that the driver supports I2C
transfers.

BUG=b:71877225
BRANCH=none
TEST=On EC console:
> accelinit 1
> accelread 1
With this CL we avoid an error

Change-Id: I9b7018ef9615992d91fbf8685832ff73c3cc1172
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/863206
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-12 14:31:21 -08:00
Simon Glass
9802a28f19 grunt: Enable the CPU temperature sensor
Set this up so we can measure the CPU temperature.

BUG=b:71868256
BRANCH=none
TEST=on EC:
> temps
  Charger             : 312 K = 39 C
  SOC                 : 321 K = 48 C
  CPU                 : 331 K = 58 C

CPU shows 58 C (which seems a lot cooler than it actually is)

Change-Id: Ia625e36b95a566aa436eff751c2ebf5863d984ad
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/862885
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-01-12 14:31:13 -08:00
Edward Hill
cb8c632801 grunt: rename volume GPIOs
BUG=b:64935726
BRANCH=none
TEST=press volume buttons, see console messages

Change-Id: I327a166e05bd815acc66d2f6e30fe8ae9d6d1cce
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/864825
Reviewed-by: Simon Glass <sjg@chromium.org>
2018-01-12 14:31:09 -08:00
Jett Rink
bdddd6fc18 grunt: Lowering I2C bus speed to 400kHz for TCPC chips
The ANX3429QN-AA-R I2C bus cannot operate above 400kHz without
first setting register 0x3 to 0x48. We can just lower the bus
to 400kHz without having to set any registers and everything
works as expected.

BUG=b:71810830
BRANCH=none
TEST=Booted grunt with new firmware and p0 TCPC communicates
with EC successfully

Change-Id: I98e3c1a4844e1a79d23f8478fdf97ada72ad1c7d
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/862543
Reviewed-by: Edward Hill <ecgh@chromium.org>
2018-01-11 19:37:40 -08:00
Justin TerAvest
084af6386f grunt: Add accel, gyro, and motion_sense task.
This adds support for the KX022 and BMI160 sensors.

It also enables the motion_sense task so that the keyboard can be
disabled in tablet mode.

BUG=b:69379570,b:69379621
BRANCH=None
TEST=Build

Change-Id: I72cc8f86ddd8d466b4208ff583e93fd51da63c49
Signed-off-by: Justin TerAvest <teravest@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/794525
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-01-08 19:56:43 -08:00
Edward Hill
69173f990a grunt: Use PPC for USB PD
Use the new PPC functions to fill in more of the USB PD board
code:
	board_set_active_charge_port
	board_vbus_source_enabled
	pd_snk_is_vbus_provided
	pd_set_power_supply_ready
	pd_power_supply_reset

BUG=b:69378796
BRANCH=none
TEST=make BOARD=grunt

Change-Id: Ie6c7da8575edbb11d5a4d28da3b228abd811a5a7
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/818504
Reviewed-by: Simon Glass <sjg@chromium.org>
2017-12-13 12:33:40 -08:00
Edward Hill
359b98c312 grunt: Update battery info
Adjust values to match the datasheet.

BUG=b:69683279
BRANCH=none
TEST=make BOARD=grunt

Change-Id: Ic95e9f2ccf2316f342d014f6042fb7b0f7108357
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/817876
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-11 22:44:27 -08:00
Benjamin Gordon
b23fdca572 grunt: Add keyboard backlight
This gets the pins set up.  Not yet sure if we may need additional
support for the LM3630A or if it will use the generic PWM support.

BUG=b:69379749
TEST=make -j buildall
BRANCH=None

Change-Id: I80a1a10818483666461bf47500e3956880dcc1fc
Signed-off-by: Benjamin Gordon <bmgordon@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/812064
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-11 12:47:47 -08:00
Edward Hill
7c96395355 grunt: Remove I2C pull ups
Don't need internal I2C pull ups since we have external.

BUG=b:64935726
BRANCH=none
TEST=make BOARD=grunt

Change-Id: I2f7e57d968622f87427534b2eb296009d68bf757
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/816065
Reviewed-by: Justin TerAvest <teravest@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-08 17:34:40 -08:00
Justin TerAvest
0a20b1fc84 grunt: Add charger and SOC thermal sensors
This change adds support for collecting voltage readings from the two
thermistors on the board.

The temperature/resistance values for the thermistors came from:
https://www.murata.com/en-eu/products/productdata/8796837609502/NTHCG142.txt?1437969863000

TEST=Build
BRANCH=None
BUG=b:69379715

Change-Id: Ibcb995c2cc17f72bfcd60a355f99607628f61dad
Signed-off-by: Justin TerAvest <teravest@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/801213
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-11-30 20:30:18 -08:00
Edward Hill
d22f5518f0 grunt: Initial USB PD board code.
Add USB PD tasks and start of board code.
Update GPIOs to match V1.2 schematics.

Grunt V1.2 USB HW:
	C0: TCPC ANX3429, Switch SN5S330, BC1.2 BQ24392
	C1: TCPC PS8751,  Switch SN5S330, BC1.2 BQ24392
	A0: SN1702001
	A1: SN1702001
	Charger: ISL9238

BUG=b:69378796
BRANCH=none
TEST=make BOARD=grunt

Change-Id: I66918abe3e9452c8d60e51245e730d1bcc168fd3
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/777407
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-30 14:18:40 -08:00
Justin TerAvest
43b864e69c grunt: Enable CONFIG_BRINGUP.
We may as well enable this for the early builds of grunt. It changes the
initial power button state to IDLE instead of INIT_ON, adds power signal
logging, and allows port80 printing in interrupt context.

It doesn't look like we use eSPI Virtual-Wire for communication, so this
should be fine.

BUG=b:64935726
BRANCH=none
TEST=make BOARD=grunt && make buildall -j

Change-Id: Id0049dc6733a3ff8727ea9fc616ac8ce24364ae1
Signed-off-by: Justin TerAvest <teravest@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/794290
Reviewed-by: Edward Hill <ecgh@chromium.org>
Reviewed-by: Chris Ching <chingcodes@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-29 10:31:41 -08:00
Furquan Shaikh
126a303c69 chipset: Introduce CHIPSET_STATE_ANY_SUSPEND
There are two different types of suspend states that are supported on
x86 platforms -- S3 and S0ix. When AP enters S3, the chipset state is
identified as CHIPSET_STATE_SUSPEND. On the other hand, when AP enters
S0ix, the chipset state is identified as CHIPSET_STATE_STANDBY. There
are several components within the EC e.g. charger state machine, usb
pd task, motion sense task that take actions based on the chipset
suspend state (and checked only for CHIPSET_STATE_SUSPEND until
now). In order to ensure that different EC components do not have to
worry about checking for all the different types of suspend states
that are supported, introduce a new combination
CHIPSET_STATE_ANY_SUSPEND which is a combination of
CHIPSET_STATE_SUSPEND(S3) and CHIPSET_STATE_STANDBY(S0ix).

BUG=b:69690699
BRANCH=None
TEST=make -j buildall. Ruben verified that with this change, EC power
consumption in S0ix drops from 7.85mW to 6.59mW on Soraka.

Change-Id: I599a0ea2fe2f39132764a6068fa77c3aea02affa
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/786919
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-11-28 15:44:19 -08:00
Aseda Aboagye
34a97f50d5 buttons: Make buttons[] common.
Nearly every board had a buttons array defined in which its contents had
the standard volume buttons.  This commit creates a single common
buttons array that can contain the standard volume buttons and recovery
buttons.  If a board has volume up and down buttons, they can simply
define CONFIG_VOLUME_BUTTONS and it will populate the buttons array with
the standard definition.  The buttons are active low and have a 30 ms
debounce period.  Similiarly, if a board has a dedicated recovery
button, defining CONFIG_DEDICATED_RECOVERY_BUTTON will also populate the
buttons array with a recovery button.

BUG=chromium:783371
BRANCH=None
TEST=make -j buildall.
TEST=Flash a device with CONFIG_VOLUME_BUTTONS, verify pressing volume
buttons still work.

Change-Id: Ie5d63670ca4c6b146ec8ffb64d40ea9ce437b913
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/773794
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-11-17 20:18:38 -08:00
Edward Hill
6d4674fd05 grunt: Initial GPIO setup for grunt
Configure GPIOs to match grunt proto v1.1 schematic.
Change EC chip to npcx7m6f.
Minimal board.c/h, just enough to build.

BUG=b:64935726
BRANCH=none
TEST=make BOARD=grunt

Change-Id: I1a1f581c7ee7b80808c0dde179bc3ee0d69f960e
Signed-off-by: Edward Hill <ecgh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/754302
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-14 13:31:48 -08:00
Shawn Nematbakhsh
2f127f3081 charge_manager: Enter safe mode at boot
Charge port / current selection often needs to be significantly altered
when a battery cannot provide sufficient charge, so have charge_manager
initially enter safe mode. After a battery with sufficient capacity has
been identified, charge manager will leave safe mode, and port / current
selection will return to standard rules.

BUG=chromium:777596
BRANCH=None
TEST=Pass charge_manager unit tests. On kevin, remove battery, attach
Apple PD charger, verify safe mode is not exited and device does not
brown out. Hot-plug battery and verify safe mode is exited. Next,
remove battery, attach to Samus, verify safe mode is not exited and
device doesn't brown out. Hot-plug battery, verify that safe mode is
exited and no active charge port, due to dual-role exclusion.

Change-Id: I7784865750087a037aad8dbbac058b22c77ba6d4
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/733954
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-02 23:21:52 -07:00
Aseda Aboagye
7bf1696711 chg_ramp: Add charge_is_consuming_full_input_current().
Most boards had an identical implementation for this function,
previously known as board_is_consuming_full_charge().  To reduce copy
paste, let's just move it to common code.  Boards that charge ramp
without a battery will have to define their own implementation, but
there probably won't be any boards like that in the near future.

BUG=None
BRANCH=None
TEST=make -j buildall

Change-Id: Ic99a378ac26dfd35d7d718bf9376eacfa8609166
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/748919
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-11-01 16:47:21 -07:00
YH Lin
c478733f19 grunt: initial setup for ec
Initial files for grunt, to be revised later.

BUG=b:67187149
TEST=None
BRANCH=None

Change-Id: I392bb4982fea0c9374ba8d262f8f4288522207d5
Signed-off-by: YH Lin <yueherngl@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/699554
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-11 20:45:08 -07:00