Commit Graph

3892 Commits

Author SHA1 Message Date
Aseda Aboagye
1d114ffa3c nocturne: Fix accel/gyro reference.
The BMI160 driver requires that the macro I2C_PORT_ACCEL is defined.
This commit simply defines that macro and defines a matrix to rotate the
sensor data into the standard frame.

BUG=b:79715267
BRANCH=master
TEST=Flash nocturne, verify that the BMI160 initializes successfully.
Verify that when device is struck from the left edge, positive
acceleration is seen on the X axis.  When device is struck from the
bottom edge, positive acceleration is seen on Y axis.

Change-Id: I6407b21fdfe311fa8ac7d83a8050ebfb27b4e0d8
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1059535
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-05-16 05:08:35 -07:00
Nicolas Boichat
9be407f10e chip/npcx: Increase default stack size for tasks
Usually, we enable CONFIG_FPU on NPCX, which requires larger
stack size. Also, NPCX has very deep call patch in I2C transactions
(in particular, I2C recovery path), so it generally requires larger
stack.

To make the code fit, however, we need to reduce the accelerometer
fifo depth from 1024 to 512, on a few boards.

BRANCH=none
BUG=b:75234824
TEST=make buildall -j, stackanalyzer result on poppy looks a little
     better.

Change-Id: I37b5a2a97a760dc4fd225253c23962d74e25605a
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/967963
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-16 05:08:30 -07:00
Philip Chen
163263c9a3 scarlet: Clamp reported battery SOC when charge terminates
After we set TE (CL:958295), rt946x terminates charging when
the charge current is below IEOC in constant-voltage mode.

When AC is plugged and rt946x terminates, we see cases that
battery SOC falls below BATTERY_LEVEL_NEAR_FULL but rt946x doesn't
re-enable charging yet, which leads to amber LED. The Chrome OS UI
might also show battery is not full in this case.

Let's clamp the reported battery SOC in this scenario to
avoid user confusion.

BUG=b:77870927
BRANCH=scarlet
TEST=When AC is on, charge terminates, and BATTERY_LEVEL_NEAR_FULL
is hit, confirm battery SOC is overwritten.

Change-Id: I4575e562873d149d6f349ddb578334d107e21776
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1055194
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-05-14 23:56:58 -07:00
Nick Sanders
88ffd86551 servo_v4: add more stack for PD
C0 PD would occasionally get stack overflow.
Add venti stack.

BRANCH=servo
BUG=b:79266510
TEST=no more crash

Change-Id: Id1d7174af954b5e5716ba402ae5b993e2971464d
Signed-off-by: Nick Sanders <nsanders@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1056488
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
2018-05-14 18:56:55 -07:00
Wai-Hong Tam
f8e3859a67 cheza: Disable EC hibernate temporarily
EC can't be waked up once it enters hibernate. Need to figure out the
cause. Disable it temporarily in order not to block others.

BRANCH=none
BUG=b:79348203
TEST=Ran "help" on console and not "hibernate" command.

Change-Id: Ifba2b95df26b03e4389616ebb3fc217bb5a24d54
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1050748
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-14 18:56:53 -07:00
Philip Chen
82133f4b1c Revert "scarlet: Limit the maximal acceptable VBUS to 9.5V"
This reverts commit 73686dafb0177e44582586b614234eb2e053b5d4.

BUG=b:78792296
BRANCH=scarlet
TEST=none

Change-Id: If36f7b1a470c8476d80e4c0d0ffad49cfdc36e5b
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1034106
Reviewed-by: Brian Norris <briannorris@chromium.org>
Commit-Queue: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Trybot-Ready: Philip Chen <philipchen@chromium.org>
(cherry picked from commit 10050b1ebbcea44fe11b917eb14e8ec84f297949)
Reviewed-on: https://chromium-review.googlesource.com/1055269
Commit-Ready: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2018-05-14 15:33:06 -07:00
Alexandru M Stan
6c2cbf567e zoombini: Disable motion sense FIFO and vsync
zoombini does not have MKBP enabled, it's nonsensical to have the sensor EC
side FIFO enabled. while it does compile (currently) it makes no sense to have
one without the other.

The next patch in this series will add more cross coupling between them (MKBP
set_gpio time will have to be communicated to the sensor fifo code). And
buildall is failing due to this half inclusion.

This patch disables FIFO stuff on zoombini as a fix. With that we also need
to disable the vsync sensor, since that depends on FIFO. #ifdefs everywhere!

TEST=FIFO stuff will not get compiled in when there's no MKBP
TEST=Next patch doesn't fail buildall anymore.
BRANCH=master
BUG=None

Change-Id: I6877fd131b84e9d42f32c5628c928a1355a5774c
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1055189
Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
2018-05-14 15:32:46 -07:00
Daisuke Nojiri
94b4c511a6 kblight: Add keyboard backlight control module
This patch promotes board/nami/keyboard_backlight.c to common
directory.
Board customization is done via board_kblight_init callback.
It currently supports two drivers: direct PWM control and lm3509.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:78360907,b:78141647
BRANCH=none
TEST=On Nami (for lm3509) and Sona (pwm), verify the followings:
1. Alt + brightness up/down works
2. After suspend-resume, brightness is restored
3. Lid close/open
4. After screen is off, keyboard backlight is turned off

Change-Id: I584c06e8702fe7b289999698f277311cfd3400bd
Reviewed-on: https://chromium-review.googlesource.com/1051027
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-11 12:10:44 -07:00
Daisuke Nojiri
f21a0681c7 Nami: Read CBI early and cache it
This patch adds a HOOK_INIT handler which reads CBI. This handler runs
as early as I2C controller is ready so that all subsequent code can refer
to cached CBI.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=none
BRANCH=none
TEST=Verify CBI is read reliably on Nami at boot.

Change-Id: I979947d6bd63ce0cdc1400ba561c543d9ed7b40e
Reviewed-on: https://chromium-review.googlesource.com/1054341
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-05-11 12:10:43 -07:00
Stefan Adolfsson
38d90756cb npcx: CEC: Event-handling for incoming messages
When an incoming message is complete, store it in a
internal circular buffer and notify the AP so the
message can be read out.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Write different type of messages from one EC to another EC
using ectool. Also use ectool on the second EC to verify that
they are received correctly.
CQ-DEPEND=CL:1030226

Change-Id: Ie4370b0c954befe81a055cd5dff7d7f13dbefbd0
Reviewed-on: https://chromium-review.googlesource.com/1030227
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-05-11 09:30:34 -07:00
Stefan Adolfsson
802337c26d npcx: CEC: Add stub implementation of CEC
Add CEC stub implementation and enable it for Fizz. All
it does is print a message when the driver is initialized.

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Check that "CEC initialized" is printed on the
console when the EC boots.
CQ-DEPEND=CL:1030219

Change-Id: I1cf674e664e091354e344e0c08a69bd09f415904
Reviewed-on: https://chromium-review.googlesource.com/1030220
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-11 09:30:31 -07:00
Philip Chen
13ea63266c scarlet: Enable AP throttling for battery OCP
BUG=b:74321682
BRANCH=scarlet
TEST=manually test on scarlet together with CL:994188

Change-Id: I831ca9941248835f98a1c5ea69e751f3f7413ed7
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1043454
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-11 02:58:50 -07:00
Philip Chen
43db76c108 Revert "scarlet: Limit the maximal acceptable VBUS to 5.5V"
This reverts commit c4e728e6f991537b5e0f715c4f9e946b029d5bd8.

BUG=b:78792296
BRANCH=scarlet
TEST=none

Change-Id: I4dc73e85cc7883ef4b2ab83da4d671a7709d9fd3
Signed-off-by: Philip Chen <philipchen@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1054121
Commit-Ready: Philip Chen <philipchen@chromium.org>
Tested-by: Philip Chen <philipchen@chromium.org>
Reviewed-by: Philip Chen <philipchen@chromium.org>
2018-05-11 02:58:49 -07:00
Stefan Adolfsson
bdc8b02528 Fizz: Add GPIOs used for CEC
The Fizz hardware has three pins for CEC. One GPIO is used
as a pull-up. It is always an output and always high. The
second GPIO is a data output. The third GPIO is the data
input that can also be configured as a timer input (TA1).

Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org>

BUG=b:76467407
BRANCH=none
TEST=Read and write the newly added GPIOs using ectool

Change-Id: Ia33b36a0cdaa40fd1a4f7aa66a092b5833bf5cf8
Reviewed-on: https://chromium-review.googlesource.com/1030219
Commit-Ready: Stefan Adolfsson <sadolfsson@chromium.org>
Tested-by: Stefan Adolfsson <sadolfsson@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-10 02:27:07 -07:00
Jett Rink
0385f2fefd phaser: initial files commit
BRANCH=none
BUG=b:78770036
TEST=build

Change-Id: I10ce1cc0196bc1e9b7d892834351bb9b3d27e3e1
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1042730
Reviewed-by: Scott Collyer <scollyer@chromium.org>
2018-05-09 14:40:24 -07:00
Daisuke Nojiri
c7559fea4e tablet_mode: Define common interrupt handler for tablet switch
This patch adds an interrupt handler for a tablet switch and an init
hook to enable the interrupt.

The handler does the typical tasks for convertible devices: 1. sets
tablet mode then 2. disables peripherals if tablet mode is on.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:77298177
BRANCH=none
TEST=buildall. Verify on Nami.

Change-Id: If7fb5ea15f388d2b6084d800d2bc05efafd1945e
Reviewed-on: https://chromium-review.googlesource.com/1043057
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-09 14:40:08 -07:00
Daisuke Nojiri
50ba7ef146 Nami: Use lid angle to detect tablet mode for Vayne & Nami
This patch refactors motion_lid so that EC can decide to use lid angles
to set tablet mode at run time.

Then, it implements board_is_lid_angle_tablet_mode to enable the feature
for Nami and Vayne.

Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>

BUG=b:77298177
BRANCH=none
TEST=Verify on Nami.

Change-Id: Ib717911a16fe031aa6c6ede731e6aa722d32d022
Reviewed-on: https://chromium-review.googlesource.com/1024914
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-09 14:40:07 -07:00
Tom Wai-Hong Tam
4461fb7ab7 cheza: Remove BC1.2 switch hack
PD is enabled so don't need it.

BRANCH=none
BUG=b:74395451
TEST=Did "gpioset EN_PP5000_A 1" before the folllowing tests:
 * Verified USB boot
 * Plugged adapter to port-0/port-1/both and saw charging
 * Plugged USB device to port-0/port-1/both and saw sourcing VBUS
 * Plugged adapter to one port and USB device to another port
 * Plugged USB disk to port-0 and booted into kernel
 * When AP off, not sourcing VBUS to USB device
 * Rebooting AP still works

Change-Id: Ib878960fb302d85549735a395f75cc8d045d45f2
Signed-off-by: Tom Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1042621
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-05-09 14:40:02 -07:00
Tom Wai-Hong Tam
aafc4f5d1a cheza: Support PD and charging
Port 0:
  TCPC: ANX3429
  PPC: SN5S330
  BC1.2: PI3USB9281

Port 1:
  TCPC: PS8751
  Power switch (sink): NX5P3290
  Power switch (source): NX20P5090
  BC1.2: PI3USB9281

Charger: ISL9238

BRANCH=none
BUG=b:74395451
TEST=make buildall -j
TEST=Did "gpioset EN_PP5000_A 1" before the folllowing tests:
 * Plugged adapter to port-0/port-1/both and saw charging
 * Plugged USB device to port-0/port-1/both and saw sourcing VBUS
 * Plugged adapter to one port and USB device to another port
 * Plugged USB disk to port-0 and booted into kernel
 * When AP off, not sourcing VBUS to USB device
 * Rebooting AP still works

Change-Id: Icde5e24c2cda3d0f2046486528a210af84befcca
Signed-off-by: Tom Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/969701
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-05-09 14:40:02 -07:00
Tom Wai-Hong Tam
e9916b94ca cheza: Change ACOK_OD pin to EC input
The ACOK_OD is a required signal of the charging state machine. EC
can't always hold it low; however, it breaks the charging state.

Make it back to EC input. There are some side-efforts, mentioned in
the bug.

BRANCH=none
BUG=b:78035750
TEST=Plugged/unplugged AC when AP is on/off.
TEST=Verified the power sequence still works.

Change-Id: I039af9cdb86cfb509f2580e6f57d82309825dac1
Signed-off-by: Tom Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1042620
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-08 21:15:32 -07:00
Tom Wai-Hong Tam
499e404d98 cheza: Lower the I2C bus speed of smart battery
The I2C speed of the smart battery is 100KHz. Lower the bus speed.

BRANCH=none
BUG=b:74395451
TEST=Used console command "i2cscan" to check the smart battery.

Change-Id: I3f5f1e7ac1707ba416036214afa2ff46dad7f174
Signed-off-by: Tom Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1040874
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-08 21:15:32 -07:00
Tom Wai-Hong Tam
de6825d3ff cheza: Remove internal pull-up for the BATT_PRES_ODL pin
There is an external pull-up for the BATT_PRES_ODL signal.

BRANCH=none
BUG=b:74395451
TEST=Verified the BATT_PRES_ODL value when battery plugged or not.

Change-Id: Ief10820290c204cd0a965081165df9f64ce1bb34
Signed-off-by: Tom Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1035450
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-08 21:15:31 -07:00
Jett Rink
4148738134 yorp: renegotiate Vbus down before hibernating
When we support the lowest power mode for Nuvoton in the next spin, we
will shed the TCPC/PPC power rail during hibernate. Before we drop the
power for the PPCs we need to ensure that Vbus is lower than the
hard-coded 6.8V dead-battery mode over-voltage threshold, otherwise we
will lock ourselves out of power.

BRANCH=none
BUG=b:79218851
TEST=verified that yorp renegotiates Vbus to 5V when entering hibernate
via ec `hibernate` cmd.

Change-Id: I4a98573eefb5757eea02dc48c64d5f9358b5e0b7
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1047954
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-08 13:17:16 -07:00
Tom Wai-Hong Tam
548e4d9708 cheza: Support confirmation of power lost
Keep the timestamp of the latest power lost. Add a handler to wake
the chipset task to check if power lost stays low for a while (the
time between now and the latest power lost is longer than a period).

BRANCH=none
BUG=b:78455067
TEST=Toggle EC GPIO SYS_RST_L for a low pulse to execute PMIC reset
sequence and verified AP reset but not a transition S0 -> S5.
TEST=Toggle EC GPIO PMIC_KPD_PWR_ODL and SYS_RST_L for a low pulse
(see power_off function) to execute PMIC shutdown sequence and verified
a power-lost transition S0 -> S5.

Change-Id: I8ed789d701e834195865bfdf2d302388d42618d2
Signed-off-by: Tom Wai-Hong Tam <waihong@google.com>
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1028831
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-08 13:17:14 -07:00
Wai-Hong Tam
71e966af61 cheza: Enable AP_RST_REQ as a request from AP to reset itself
This makes the EC listen to the AP_RST_REQ GPIO from AP. The rising
edge interrupts to trigger a hook to call chipset_reset().

As the hook task will be preempted by the chipset task, it adds a
flag bypass_power_lost_trigger to avoid triggering to S5 as the
chipset state machines sees power lost during the reset.

So far the chipset_reset() implementation is to do a cold reset;
will be revised to a warm reset after the PMIC registers are
reprogrammed.

BRANCH=none
BUG=b:74395451
TEST=make buildall -j
TEST=Ran 'reboot' on AP console which toggles the GPIO.

Change-Id: I946cb029541ce018a8ed1ce25681d38998a7f4b6
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1023986
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-08 13:17:13 -07:00
Vincent Palatin
139b84f5b0 meowth_fp: make FP_RST_ODL push-pull
On newer boards, FP_RST_ODL is no longer Open-Drain and has a 100k
pull-down. Drive it as push-pull.

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

BRANCH=poppy
BUG=b:79277207
TEST=On ZerbleBarn, verify that the sensor comes up, has the right HWID
and can capture images.
TEST=On new boards, do the same.

Change-Id: I45e1ba41a7649e0682e3ea11dd0159f666286bba
Reviewed-on: https://chromium-review.googlesource.com/1049545
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-05-08 08:50:53 -07:00
Caveh Jalali
72343b097e atlas: config PROCHOT GPIO as input
we need to configure EC_PROCHOT_ODL as an input because the EC isn't
driving it correctly.  we changed the polarity of EC_PROCHOT for atlas
and similar boards, but the EC codebase has this hard-coded as
active-high.

this is a short-term fix until we implement a more general PROCHOT
"polarity" feature.

BUG=b:78911901,b:79266467
BRANCH=none
TEST=checked voltage drop across in-line resistor on EC_PROCHOT and
AP can now run above 400MHz

Change-Id: I8c3224c62ea7af4f386062d39c248d418e73fa53
Signed-off-by: Caveh Jalali <caveh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1045556
Commit-Ready: Caveh Jalali <caveh@google.com>
Tested-by: Caveh Jalali <caveh@google.com>
Tested-by: caveh jalali <caveh@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Caveh Jalali <caveh@google.com>
2018-05-08 01:22:00 -07:00
Mary Ruthven
c24d480d90 cr50: disable s3_terms during init
When cr50 resumes from deep sleep term_enabled is reset to 0, but not
all of the s3 termination settings are reset. Some of them are, because
some of the gpios are defined in gpio.inc and cr50 will handle setting
those up during init, but others like the sps pulldowns aren't. At this
point, the term_enabled setting does not actually match the state of
enabled terminations.

After deep sleep reset if the AP is on, ccd update state will try to
disable the s3 terminations, but term_enabled is 0, so s3_term thinks
they're already disabled and wont do anything even though some of the
terminations are actually enabled.

This change initializes all of the s3_term stuff to disable during hook
init. This way things are reset so they won't interfere with sps_init.
This will also make sure to align the system state with term_enabled,
before the ccd hook starts getting called. It is safer to start with
disabling the terminations, because it wont interfere with tpm
communication if the AP is on. If the AP is off, ccd_update_state will
re-enable the terminations around a second after init.

BUG=b:62200096,b:79214702
BRANCH=cr50
TEST=firwmare_Cr50DeepSleepStress.reboot on bob

Change-Id: I9a90c7f7703b1406b4c494db448a8ac84d040d1c
Signed-off-by: Mary Ruthven <mruthven@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1043152
Commit-Ready: Mary Ruthven <mruthven@chromium.org>
Tested-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2018-05-07 20:45:51 -07:00
Tino Liu
8ba6446d97 Nami: Disable ALS for Akali
Use OEM ID to update motion_sensor_count to disable ALS for Akali.

BUG=b:78537332
BRANCH=master
TEST=make buildall successfully

Change-Id: I29774c1be4e43218f6aaeb14b3e16637482e1ec4
Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1029397
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-05-07 20:45:43 -07:00
Furquan Shaikh
7fa708389a yorp: Configure GPIO_HIB_WAKE_HIGH for AC_PRESENT
AC_PRESENT is active high and hence GPIO_HIB_WAKE_HIGH needs to be set
in order to wake the EC up from hibernate.

BUG=b:79220888
BRANCH=None
TEST=make -j BOARD=yorp

Change-Id: I91e1c2f0b615b8272d3d1916a284d34a56959f82
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1043343
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-07 17:23:52 -07:00
Furquan Shaikh
ac929b674d yorp: Enable SINK_CTRL on PPC before hibernating
It was observed on yorp that connecting AC when EC is in hibernation
does not always reliably wake the EC up. The reason for this seems to
be that USB_C0_CHARGE_ON from ANX7447 is not asserting SINK_CTRL and
PPC does not pass through ACIN and thus ACOK_OD remains low.

This change ensures that SINK_CTRL is enabled on all the ports before
EC goes into hibernate state.

BUG=b:79173959
BRANCH=None
TEST=Verified that EC wakes up from hibernate reliably with AC
insert.

Change-Id: I14ff2c89511993fec53462ac606b92e5d9438739
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1043076
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-07 17:23:52 -07:00
Furquan Shaikh
74d08a581d yorp: Shutdown AP when doing hibernate
When hibernate is run from EC console or using key combo, AP might not
actually be in shutdown state. Thus, add a call to force chipset
shutdown in board_hibernate and let AP drop down to S5.

BUG=b:79171681
BRANCH=None
TEST=Verified that hibernate with AP in S0 does not result in EC
waking back up.

Change-Id: I4103c51afb42944e05ec3965b421730fac3f867a
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1041278
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-05-04 03:02:43 -07:00
Duncan Laurie
756141d6b9 eve: Limit data role swap to port 0
Only USB port 0 is capable of device mode, so ignore data role
swaps to other ports.

BUG=b:78308749
BRANCH=eve
TEST=manual: ensure OTG pins are not asserted with data role swap
on port 1.

Change-Id: I07a331af11c3ce599a75517a5ba0ff2716987545
Signed-off-by: Duncan Laurie <dlaurie@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1035424
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-04 03:02:32 -07:00
Alexandru M Stan
05e33b28e7 cheza: Make sure switchcap is configured right
Configure switchcap every time we're about to change the signal,
just in case it forgot.
Feel free to revert this after b/77957956 is fixed.

BRANCH=none
BUG=b:77957956
TEST="i2cxfer r 0 0xd0 0x2" never shows 0x70, even after a bad brownout
(like "gpioset EN_PP5000_A 1" on an unreworked board)

Change-Id: I8994cd402ce96d8bf4e436dadfc0e572e7f77a85
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1024501
Commit-Ready: Wai-Hong Tam <waihong@google.com>
Tested-by: Wai-Hong Tam <waihong@google.com>
Reviewed-by: Wai-Hong Tam <waihong@google.com>
2018-05-04 03:02:17 -07:00
Wai-Hong Tam
f7aec0ceb5 cheza: Add SDM845 power sequence for rev-0 board
This is the power sequence for rev-0 board. Confirmed the behavior of
reprogramming the PMIC registers to enable the instant reset and
shutdown.

BRANCH=none
BUG=b:74395451
TEST=make buildall -j
TEST=Tried the following cases:
* Cold reset:
  $ dut-control cold_reset:on sleep:0.2 cold_reset:off
  Result: G3 -> S0
* Long power press to shutdown:
  $ dut-control pwr_button:press sleep:8.2 pwr_button:release
  Result: S0 -> S5 -> G3
* Long power press to power-on but then shutdown:
  $ dut-control pwr_button:press sleep:8.2 pwr_button:release
  Result: G3 -> S0 -> S5 -> G3
* Short power press to power-on:
  $ dut-control pwr_button:press sleep:0.2 pwr_button:release
  Result: G3 -> S0
* Console command: apreset
  Result: S0 -> S5 -> S0
* Console command: power off
  Result: S0 -> S5 -> G3
* Console command: power on
  Result: G3 -> S0
* Console command: apshutdown
  Result: S0 -> S5 -> G3
* Lid open to power-on:
  $ dut-control lid_open:no sleep:0.2 lid_open:yes
  Result: G3 -> S0

Change-Id: Ia9d44b1dccac66b5b580c08c6c1697ef5989b923
Signed-off-by: Wai-Hong Tam <waihong@google.com>
Signed-off-by: Alexandru M Stan <amstan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/969702
2018-05-04 03:02:16 -07:00
Jett Rink
52848179d2 octopus: move more implementation to baseboard
Move driver configuration to baseboard in preparation for phaser board

BRANCH=none
BUG=none
TEST=yorp still works

Change-Id: Ifeb434d2d4103160acd6eb9f784533d1ae0ae35a
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1042729
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-04 03:01:58 -07:00
Jett Rink
a6e3942760 octopus: remove pwm code for LEDs
We are using LED as straight GPIO signals so remove pwm for now

BRANCH=none
BUG=none
TEST=none

Change-Id: I48b316b6df023217a7cc1bed7a741f72d1388026
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1042728
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-04 03:01:57 -07:00
Divya Sasidharan
0f54e5dd5a yorp: Add support for SONY battery
BUG=b:78906183
BRANCH=None
TEST=make buildall -j; connect SONY battery
   and test if recognized on battery UI icon in OS.

Change-Id: I15c7a9611c10de425f3ca34f7f8f737c65e47275
Signed-off-by: Divya Sasidharan <divya.s.sasidharan@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1041159
Commit-Ready: Divya S Sasidharan <divya.s.sasidharan@intel.com>
Tested-by: Wenkai Du <wenkai.du@intel.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-04 00:13:42 -07:00
Aseda Aboagye
be54bb9a9c nocturne: Only power base when AP is on.
BUG=None
BRANCH=None
TEST=make -j BOARD=nocturne

Change-Id: I4492498b710e4e0f4a1682e4353f993013131c7f
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1043346
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-03 21:27:59 -07:00
Furquan Shaikh
24c077476d yorp: Control backlight based on chipset transitions
This change enables/disables backlight based on the chipset state
transition.

BUG=b:78897667
BRANCH=None
TEST=None

Change-Id: I4da331cb94f7a304a76fce93b73c38016f5b0f4d
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1036798
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-05-02 22:20:50 -07:00
Jett Rink
f24dc485fe octopus: move common function to baseboard
Move common variables and functions to baseboard from yorp and bip

BRANCH=none
BUG=none
TEST=builds

Change-Id: Ic74bec45f4ff6c833e4ef0620380f21b2ed6a041
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1040107
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
2018-05-02 22:20:31 -07:00
Jett Rink
e47daed322 octopus: move common CONFIG defines into baseboard
The `make BOARD=yorp print-configs` and bip version
show no diff before and after this change.

BRANCH=none
BUG=none
TEST=verify the print-configs output does not change.

Change-Id: If2cdc39b685f529ece707b9831052daf58e91dfa
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1038898
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
2018-05-02 22:20:31 -07:00
Jett Rink
59b4257fbb bip: adding missing common defines
Add common defines in bip before we pull them into baseboard
to ensure that the diff of the move is clean.

BRANCH=none
BUG=none
TEST=bip builds.

Change-Id: I06333f2b1ad5d2d7bd057e5e8cd459199393ce1d
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1038897
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
2018-05-02 22:20:30 -07:00
Jett Rink
2efff2146c bip: add keyboard functionality
BRANCH=none
BUG=none
TEST=builds

Change-Id: Iaea766ab55a4d55cb3df5254b55ee460a820f55d
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1039872
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
Reviewed-by: Justin TerAvest <teravest@chromium.org>
2018-05-02 22:20:29 -07:00
Jett Rink
696536faab yorp: enable low power mode on EC
BRANCH=none
BUG=b:78497503
TEST=builds. Still needs more verification for low power mode

Change-Id: Idab7a1577e4d99edc29d55ad4f99a662d9419c12
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1038896
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com>
2018-05-02 22:20:29 -07:00
Furquan Shaikh
ec74ffb91f nautilus: Move PMIC init to a deferred function
Instead of doing I2C traffic in an init hook, move it to a
deferred function to be called outside of INIT_HOOK processing.

(identical to CL:1001474 on eve branch, moved to nautilus board
file)

BUG=b:77336348
BRANCH=poppy
TEST=None

Change-Id: Id9eec4333c6f04141e475b61e5aea7b838dcedf7
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1033614
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2018-05-01 05:35:47 -07:00
Furquan Shaikh
a26cdd0812 nautilus: Enable usb device mode
BUG=b:78649985
BRANCH=poppy
TEST=Verified following:
1. ectool usbpd 0 dr_swap
2. ectool usbpd 0
--> Role: SNK UFP

Change-Id: I10addb4936eab169655c1d11f115740da139a14e
Signed-off-by: Furquan Shaikh <furquan@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1031109
Commit-Ready: Furquan Shaikh <furquan@chromium.org>
Tested-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Duncan Laurie <dlaurie@google.com>
2018-05-01 02:13:32 -07:00
Jett Rink
a5695793ba anx7447: convert automatic OCM erase into command
We do not want to erase the OCM flash automatically so we
can ensure that we fix our supply chain issues. Add a command
that will erase the OCM if needed.

BRANCH=none
BUG=b:77658388
TEST=verified command works on yorp

Change-Id: Iaf6ada3b1e223d15ae0d9624bdcc54b90cb33b64
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1035428
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2018-05-01 02:13:29 -07:00
Jett Rink
bbb5edb220 bip: add correct charger driver
BRANCH=none
BUG=b:76429930
TEST=buildall

Change-Id: I6d318ad80911e564dda67ba542899ecc42068276
Signed-off-by: Jett Rink <jettrink@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1019607
2018-05-01 02:13:27 -07:00
Aseda Aboagye
10385292c1 board: Add initial nocturne support.
BUG=b:78539498
BRANCH=None
TEST=make -j BOARD=nocturne

Change-Id: I830ff6739fb648625536ba248eeb383797c850e2
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1032094
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Jett Rink <jettrink@chromium.org>
2018-05-01 02:13:24 -07:00