Commit Graph

74 Commits

Author SHA1 Message Date
Daisuke Nojiri
044cc72496 Enable PD communication in RO for external display
This patch makes EC enable PD communication if it's running in
manual recovery mode. This is required to show recovery screen
on a type-c monitor.

This patch also makes EC-EFS ignore power availability. It will
make EC verify & jump to RW even if power is sourced by a barrel
jack adapter. This should allow depthcharge to show screens
(e.g. broken, warning) on a type-c monitor.

BUG=b:72387533
BRANCH=none
TEST=On Fizz with type-c monitor, verify
- Recovery screen is displayed in manual recovery mode.
- Critical update screen is displayed in normal mode.
- Warning screen is displayed in developer mode.
Monitors tested: Dingdong, Dell S2718D

Change-Id: Ib53e02d1e5c0f5b2d96d9a02fd33022f92e52b04
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/898346
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-02-03 02:38:10 -08:00
Daisuke Nojiri
cd5173dfe0 Fizz: Suppress EC_CMD_PD_GET_LOG_ENTR debug log
Host command handler prints every single host command except when
commands are repeated back-to-back. Some commands do not provide
useful info when studying feedback reports or what is worse they
may hide critical info by flooding the EC log.

BUG=chromium:803955
BRANCH=none
TEST=Observe 'HC 0x115' is not printed.

Change-Id: I4901b27bbfedd54dc0d364b16c49d4ed0dea0fc4
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/896694
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2018-02-03 02:38:07 -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
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
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
Daisuke Nojiri
6e3e0f87b1 CBI: Read board info from EEPROM
This patch adds Cros Board Info APIs. It reads board info from EEPROM.
This patch sets CONFIG_CBI for Fizz to make it use CBI.

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

Change-Id: I7eb4323188817d46b0450f1d65ac34d1b7e4e220
Reviewed-on: https://chromium-review.googlesource.com/707741
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-01-18 05:09:29 -08:00
Daisuke Nojiri
67b8bb85da EFS: Add EFS_VERIFY host command
If a bios carries an EC image signed by a wrong key, EFS EC falls back
to the previous slot upon reboot. Vboot currently does not handle this
case and tries to update the EC with an incompatible image again.
When this happens, a user sees 'applying critical update' screen
repeatedly.

This patch adds EFS_VERIFYV host command. Vboot on AP calls it to check
whether the EC likes a newly updated image or not. If the verification
fails, it's considered as update failure and vboot displays 'broken'
screen.

BUG=b:71719323
BRANCH=none
TEST=Flash EC SPI with an image which has a different RO key. Boot DUT
and let it run software sync. EC-RO rejects the updated image and falls
back to the previous one. The update counter is incremented and vboot
shows the 'broken' screen, requesting recovery.

Change-Id: I8a107a376963baa146ff691c50d80018ec3e429c
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/858159
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2018-01-09 21:13:39 -08:00
Devin Lu
0ebb1c2479 Fizz: override DP EQ setting for Deterministic Jitter
Set lower EQ of DP port to 4.5db.

BUG=b:71613170
BRANCH=none
TEST=use ectools to read PS8751 reg offset 0xd3 as 0x98

Change-Id: Iedc0002028ead6f0f6fa7aeef4ad2845b028a76b
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/851756
Reviewed-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2018-01-09 01:04:44 -08:00
Nicolas Boichat
292b4e1bcf fizz/nami: Drop CONFIG_THERMISTOR_NCP15WB
Nothing in fizz/nami code uses that thermistor: the 2 places that
would use it (ec_adc.c and bd99992gw.c) are not compiled in on
fizz/nami.

BRANCH=fizz
BUG=none
TEST=make buildall -j

Change-Id: Ib2af8ad066eb05cd9510669600feb26641433eed
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
2017-12-21 22:50:38 -08:00
Daisuke Nojiri
7c688c0f69 Fizz: Restore BJ current and voltage after sysjump
This patch makes EC save the max current and voltage of a barrel jack
adapter before sysjump and restore them after sysjump.

BUG=b:64442692
BRANCH=none
TEST=Boot Fizz and let coreboot set the adapter current and voltage.
Verify EC-RW inherits the current and voltage set by coreboot.

Change-Id: Ib1addf6e5ce059a39cb2d8b355515df1138409eb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/835628
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-20 10:14:45 -08:00
Daisuke Nojiri
66db5b4e87 Fizz: Set default BJ voltage and current
BUG=b:64442692
BRANCH=none
TEST=make runtests && buildall. Boot Fizz and let coreboot set
the adapter current and voltage.

Change-Id: I1afc37b7d7b8a5d88becdae2ec6644a86022dfba
Reviewed-on: https://chromium-review.googlesource.com/831398
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-20 10:14:45 -08:00
Daisuke Nojiri
363853006e Fizz: Avoid activating BJ port if unplugged
This patch makes EC check the presence of power from a barrel jack
adapter before activating the BJ port.

BUG=none
BRANCH=none
TEST=Boot Fizz on type-c. Boot Fizz on BJ.
Switch power from type-c to BJ at G3 and S0.
Switch power from BJ to type-c at G3 and S0.

Change-Id: Iec982278e1ceb9b997069f66eb0e14f2e361efd2
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/777824
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-12-19 22:28:46 -08:00
Aseda Aboagye
a6509d28ab config: Add CONFIG_BUTTON_TRIGGERED_RECOVERY.
The CONFIG_BUTTON_RECOVERY option was a little confusing especially when
we have the CONFIG_DEDICATED_RECOVERY_BUTTON option.  This commit
renames CONFIG_BUTTON_RECOVERY to CONFIG_BUTTON_TRIGGERED_RECOVERY to
help make things a little clearer.

Additionally, to avoid copy paste, defining
CONFIG_BUTTON_TRIGGERED_RECOVERY will populate the recovery_buttons
table with either the volume buttons or a dedicated recovery button
depending what the board is configured for.

Lastly, if CONFIG_DEDICATED_RECOVERY_BUTTON is defined,
CONFIG_BUTTON_TRIGGERED_RECOVERY is defined as well since it's implicit.

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

Change-Id: Idccaa4d049ace0df3b98b35bdd38ac9dbd843200
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/830917
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-12-18 22:55:02 -08:00
Daisuke Nojiri
b4e6b8eef9 Fizz: Remove power control of V3P3_USBPD
PU62 used to be used to turn on power to PS8751 but it's been removed.
PS8751 is powered directly from PP3300_EC. So, EC doesn't need to
enable it.

BUG=b:65212601
BRANCH=none
TEST=On Kench EVT SKU5, verify type-c port is powered.

Change-Id: I2a1ce28efe09212a4ce7e7b57c0560e42e137cec
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/826256
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-12-14 18:11:52 -08:00
Daisuke Nojiri
d663420d62 Fizz: Set PD operating power to 50W
This patch sets the PD operating power to 50W, which is the same as what
the AP requires to boot. Since Fizz doesn't have a battery to charge,
we're not interested in lower power.

BUG=none
BRANCH=none
TEST=Boot Fizz on Type-c adapter (87W, 60W). Verify it fails to boot on
on 45W charger.

Change-Id: Ia9191ecf71329c693bee7d5893e53bd2fec70eeb
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/811524
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-08 09:07:04 -08:00
Daisuke Nojiri
d990be3fb2 Fizz: Set PD max power to 100W
This patch sets the max PD power to 100W. It means if all devices
(chager, cable, Fizz) agree, the system can draw upto 100W from
a type-c charger.

BUG=b:70239357
BRANCH=none
TEST=Boot Fizz with Apple 87W charger and verify chgsup comamnd
prints 86W (20V, 4.3A). Boot Fizz with Zinger and verify chgsup
command prints 60W (20V, 3.0A).

Change-Id: I74885c5655f570a91eea49660d537d4f9338356c
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/810004
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-06 14:28:57 -08:00
Daisuke Nojiri
7bc2486f8d Fizz: Remove AMON_BMON
Fizz EC doesn't have IADP_ACMON_BMON. So, this ADC channel can't
be used.

BUG=none
BRANCH=none
TEST=none

Change-Id: I13a4fd4cbb638af731d5bbe3404bfa6a97a2950d
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/803895
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-12-04 14:32:02 -08:00
Daisuke Nojiri
26b4617c43 charge_manager: Add EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT
Usually, the max current and supply voltage of dedicated chargers
are not known to the EC.

This patch adds EC_CMD_OVERRIDE_DEDICATED_CHARGER_LIMIT, which
allows the host to change the max current and supply voltage of the
dedicated charge port.

BUG=b:64442692
BRANCH=none
TEST=make runtests && buildall. Boot Fizz and let coreboot set
the adapter current and voltage.

Change-Id: I29b3f5762f8b316ca363c23e230530cdf4ca207a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/769152
2017-11-28 10:22:27 -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
Daisuke Nojiri
20d7149b19 Fizz: Switch power source to BJ at G3/S5
This patch allows Fizz to switch the power source from a type-c
charger to a barrel jack adapter if the system is in S5.

BUG=b:38321259
BRANCH=none
TEST=Verify the following with 45W and 60W type-c chargers:
1. Boot Fizz with a type-c charger
2. Go to S5 if not already.
3. Plug in a BJ adapter. Fizz boots to S0 using BJ power.

Also verified other boot modes are not affected:
1. Auto boot on BJ insert
2. Auto boot on Type-C insert
3. Recovery boot on BJ
4. Recovery boot on Type-C
5. Stay off if it's previously S5

Change-Id: I86aa0fe6e403bcbacfe396997d897111ffcf8e74
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/706251
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-13 10:57:37 -08:00
Daisuke Nojiri
66546f8d34 Fizz: Blink LED faster when requesting more power
Fizz blinks the power LED to alert a user when power supply isn't
enough. This patch makes the blinking speed twice as fast (on:1sec,
off:1sec).

BUG=b:37646390
BRANCH=none
TEST=Verify the LED blinks as intended.

Change-Id: I017eaf36b91d987f4b03308b1e9ac8781e5f217d
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/757557
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-11-08 11:47:57 -08:00
Shawn Nematbakhsh
bdb3f44ef2 fizz: Enable charge_manager safe mode and never leave it
Fizz has no battery, so any port / ILIM selection logic that could lead
to de-powering the device should be relaxed.

BUG=b:68953563
BRANCH=None
TEST=Boot fizz with both zinger and barrel charger, verify no panic /
brownout occurs.

Change-Id: I3bf353f5a26fe6210c67f8ee3f785012d4c063f0
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/756924
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-11-07 15:25:21 -08:00
Ryan Zhang
f48cf0e8b2 Fizz: Modify thermal table
Modify thermal table for Fizz
reference patches: 627542, 288256, 329359

       on  off  RPM
step0              0
step1  16   2   2800
step2  27  18   3200
step3  35  29   3400
step4  43  37   4200
step5  54  45   4800
step6  64  56   5200
step7  97  83   5600

Prochot degree:
	active when t >= 88C
	release when t <= 85C
Shutdown degree: when t >= 90C

BUG=b:67487721, b:64439568
BRANCH=master
TEST=fan target speed follows table, make -j buildall pass

Change-Id: I3378668a560b8ddc568fe9cbf2703613fad8e4b6
Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/729606
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-11-06 13:48:38 -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
de63c62822 driver: Rename pmic_tps650830 -> pmic_tps650x30.
The registers seem to be the same for the TPS650930, therefore, this
commit just renames the register map to have a more generic name.

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

Change-Id: Ib1c604b29e7f0e47cc036e042fe597f644d7ad36
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/736311
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-26 20:20:59 -07:00
Daisuke Nojiri
5fd1540e62 Fizz: Inform host of BJ plug/unplug event
This patch makes EC notify the host of BJ plug or unplug event
by triggering EC_HOST_EVENT_PD_MCU. The host can then use
EC_CMD_PD_HOST_EVENT_STATUS to get event details.

BUG=b:67060237
BRANCH=none
TEST=Boot Fizz on Type-C. Plug/unplug BJ adapter. Verify host event
is set by hostevent. Verify available_charge is set by hacking
chgsup command.

Change-Id: I1831bec9715e0191cb9610e05d08bbc08347b513
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/692848
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-10-24 12:57:47 -07:00
Shawn Nematbakhsh
251212fb9d pd: Remove ACCESSORY states
According to the USB-C spec, when a debug accessory is identified, we may
optionally establish USB PD communication over CC. Some DTS partners
(eg. servo_v4) expect us to speak PD, so let's make it so. There is no
need for special ACCESSORY states, these do not exist in the PD spec.

BRANCH=servo
BUG=chromium:737755,b:65837068
TEST=On scarlet, attach servo_v4 and verify scarlet charges. Also verify
EC and cr50 consoles are available through servo_v4.

Change-Id: I59d1ca50b4766509eccf38562cdf926578138585
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/693294
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-19 12:56:42 -07:00
Gaggery Tsai
f9bd2c5546 Fizz: enable fan
This patch is to enable fan through PWM4 output and TACH feedback
from TA2 GPIOA6, and move EC_PLATFORM_RST to GPIO45.

BUG=b:64915426
BRANCH=None
TEST=emerge-fizz chromeos-ec and use fanduty and faninfo from EC
     console to control and check fan status. Probed oscilloscope
     on PWM output and checked the duty as expected. Made sure the
     fan was stopped when DUT entered S3 and was running when DUT
     resumed from S3.

Change-Id: I09f3ac43d2e4170b2aff3830f832bc5fd46a15c0
Signed-off-by: Gaggery Tsai <gaggery.tsai@intel.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/627542
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
2017-10-17 13:02:53 -07:00
Daisuke Nojiri
465de629d3 Fizz: Set proper PD source voltage and current
Fizz allocates 15W to the type-c port. This patch allows the port
to use it.

BUG=b:67682343
BRANCH=none
TEST=Verify 5V 3A PDO is offered.

Change-Id: I1560c0c7cb04379f5e4c9893753afe4a7f0cefe4
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/713583
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-11 16:11:08 -07:00
Shawn Nematbakhsh
286b800f14 pd: Move *_set_input_current() to common code
Boards that use charge_manager have identical implementations of
typec_set_input_current_limit() and pd_set_input_current_limit(), so
move these functions to charge_manager.

BUG=b:67413505
TEST=`make buildall -j`, also verify that fizz continues to power-on and
boot AP, in both protected and unprotected mode, with barrel jack power
and with zinger.
BRANCH=None

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I99a5314d02c4696db944c0f8ac689405f4f1f707
Reviewed-on: https://chromium-review.googlesource.com/701412
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-10-05 21:24:46 -07:00
Daisuke Nojiri
a5cc6b4819 Fizz: Lock system
This patch undefines CONFIG_SYSTEM_UNLOCKED, which forces the system
to be unlocked, and defines CONFIG_USB_PD_COMM_LOCKED, which enables
PD only if EC is in RW. With this change, if SW write-protect is
enabled, the system will stay in G3 until 50W or more power is
supplied.

BUG=b:38462249
BRANCH=none
TEST=Lock Fizz and boot it on type-c adapter. Verify RW image is
successfully verified and executed.

Change-Id: Id8255c5c8e6af93bda3fd4de079008561f46e14c
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/558377
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-10-04 21:44:32 -07:00
Furquan Shaikh
a27f1049b6 power: Add flags parameter to power_signal_info
Replace structure member "level" in power_signal_info with "flags".
"level" has been used on all boards to indicate active-high or
active-low levels. Addition of "flags" allows easy extension of
power_signal_info structure to define various flags that might be
applicable to power signals (e.g. "level"). Going forward, additional
flag will be added in follow-up CLs.

Also, provide a helper function power_signal_is_asserted that checks
the actual level of a signal and compares it to the flags level to
identify if a power signal is asserted.

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

Change-Id: Iacaabd1185b347c17b5159f05520731505b824b8
Signed-off-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/679979
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
2017-10-03 14:26:09 -07:00
Daisuke Nojiri
32549559c0 Fizz: Initialize PMIC after AP power is ready
On proto3, PMIC isn't powered on POR, thus board_pmic_init fails.
With this change, EC waits until AP power is ready before it
notifies HOOK_CHIPSET_PRE_INIT where PMIC will be initialized.
When AP power is ready, PMIC should be ready as well.

BUG=b:65839247,b:64944394
BRANCH=none
TEST=Run reboot [/cold/ap-off] command on BJ and Type-C.

Change-Id: I7e7e07b5acf92167584966ded0a5f14fb6b04f0b
Reviewed-on: https://chromium-review.googlesource.com/672152
Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-29 17:42:53 -07:00
Daisuke Nojiri
48e38cc370 Fizz: Show critical error on LED for recovery request
Fizz EC verifies RW by itself and jumps to RW before AP boots.
If this fails, the system needs recovery. Since EC isn't
capable of showing any info on a display, we use the power
LED to inform the user.

BUG=b:66914368
BRANCH=none
TEST=Make Fizz fail RW verification. Observe LED illuminates
in red.

Change-Id: Ia07de60a316b40e74b1917903996d78750b4ae43
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/683218
2017-09-29 11:24:37 -07:00
Daisuke Nojiri
95c0393a67 Fizz: Blink LED to request more power
This patch makes the LED blink to alert the user when there is
not enough power to boot the system.

This patch also changes minimum boot power to 50W. It's common
for all SKUs.

BUG=b:37646390
BRANCH=none
TEST=Power Fizz with 15W, 45W, 60W chargers. Verify LED blinks as
expected.

Change-Id: If269897f5022f6cba80f37ce03e2315cfb2cf504
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/682876
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-29 11:24:37 -07:00
Shawn Nematbakhsh
c781609bfd charge_manager: Support no-BC1.2 configuration
If BC1.2 isn't supported, don't waste space + time checking for inputs
that don't exist.

BUG=chromium:759880
BRANCH=None
TEST=`make buildall -j`

Change-Id: I47e81451abd79a67a666d1859faf2610ee5c941a
Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/663838
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-09-28 11:18:54 -07:00
Daisuke Nojiri
06f068a29c Fizz: Set proper max power
This patch raises the max power for a type-c adapter to 60W (20V @3A).
We can't go above the regular cable capacity (3A) until we add e-marked
cable detection.

BUG=none
BRANCH=none
TEST=Boot Proto3 on Zinger. Observe 60W (20V @3A) is selected.

Change-Id: I9670d710e363c7db1136a7ce7a7f8401b0ad8240
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/679210
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-26 22:35:21 -07:00
Daisuke Nojiri
13fb9ac539 Fizz: Limit input current
Fizz has an over current control system. There are two FETs
connected to two registers: PR257 & PR258. They control
the max input current as follows:

                               PR257, PR258
  For 4.62A (90W BJ adapter),     on,   off
  For 3.33A (65W BJ adapter),    off,    on
  For 3.00A (Type-C adapter),    off,   off

BJ adapters are distinguished by reading GPIO71.

This patch also removes ISL9238 driver and ramping code. The
charger chip has been removed from the board since proto2.

BUG=b:65013352
BRANCH=none
TEST=Boot Fizz Proto3 on BJ and Type-C.

Change-Id: I32c2467f4ab23adf3f9313a03914d74d64a722df
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/668119
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-09-25 18:35:26 -07:00
Daisuke Nojiri
cbfb59f118 Fizz: Pulse LED using deferred call
This patch makes LED pulse using deferred call to save RAM and
CPU cycles.

This patch also adds led_alert API. It blinks LED as a warning.

BUG=b:37646390
BRANCH=none
TEST=Verify LED on in S0, pulse in S3, and off in S5.
Run 'led alert' command.

Change-Id: I8c61f91f095eed562d2ee9582868879241df626f
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/675749
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-22 13:22:54 -07:00
Ryan Zhang
207b3b4e5f Fizz: add CONFIG_LED_COMMON
This is used for factory test with following command

1. ectool command
	ectool led power query
	ectool led power green=100
	ectool led power red=100
	ectool led power amber=100
	ectool led power off
	ectool led power auto

2. console command
	led debug	>> enter debug mode
	led green
	led red
	led amber
	led off
	led debug	>> exit debug mode

BUG=b:65651340
BRANCH=master
TEST=`ectool ...` works good

Change-Id: Icb87e479075d90f509d60121a3e1df0afe66d41f
Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/666418
2017-09-19 21:46:25 -07:00
Daisuke Nojiri
d8612351ea Fizz: Pulse LED
This change makes the power LEDs pulse using PWM.
S0: solid green.
S3: pulsing amber (= mix of green and red)
S5: off

BUG=b:64975836
BRANCH=none
TEST=Verify LED behavior described above on Proto3

Change-Id: I696cf8279dd762236b7b7f000a316820d58916bf
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/669773
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-09-19 21:46:24 -07:00
Daisuke Nojiri
2f951e9a86 Fizz: Blink power LED in suspend state
BUG=b:37646390
BRANCH=none
TEST=Verify green LED blink in S3 on Fizz proto3.

Change-Id: I055a271e2bb8fd8454d9940c90d5f71cc9025e50
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/669772
2017-09-19 13:26:51 -07:00
Daisuke Nojiri
4566523837 Fizz: Detect BJ as a power source
Proto2 board has the line ADP_IN, which is raised to 2.5 V when a BJ
adapter is plugged. This patch makes EC running on proto2 and above
use this line to detect the power source at boot (as opposed to proto1
guessing a BJ adapter is plugged if PPVAR_BOOSTIN_SENSE is 19v).

BUG=b:37573548
BRANCH=none
TEST=Boot proto3 Fizz on BJ and Type-C.

Change-Id: I4052a73729d62694ce154bfb33255974dc110841
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/626879
2017-09-14 20:14:17 -07:00
Daisuke Nojiri
117e59cf7b Fizz: Give highest priority to dedicated chargers
This patch gives the highest priority to dedicated chargers. It
means if a dedicated power supply is being connected, other power
supplies such as USB-C adapters will not be recognized as a new
charger.

BUG=b:65059574
BRANCH=none
TEST=Boot Fizz on BJ adapter. Verify plugging in Type-C adapter
doesn't shut down the system.

Change-Id: Ie49b128ae64f917a227f9081148565a3f5356212
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/655638
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-09-12 18:16:27 -07:00
Daisuke Nojiri
ac97fea2d7 Fizz: Refuse PR swap when powered by USB-C port
This patch makes EC refuse PR swap when the system is powered
through the USB-C port because switching from SNK to SRC will
cause the system to shut down.

BUG=b:65481832
BRANCH=none
TEST=Boot Fizz on USB-C and BJ.

Change-Id: I52c5813adc1ea9b4e69e65599c1794ae43192a1e
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/655643
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-12 18:16:27 -07:00
Shawn Nematbakhsh
dde1a514de pd: Remove support for debug accessories that provide VBUS + Rd
Reworked suzy-q and suzy-qable all provide Rp, so there is no need for
special detection handling in S5. Also, CONFIG_USB_PD_QUIRK_SLOW_CC_STATUS
is no longer relevant, since we no longer take special action when VBUS
is seen without Rp.

BUG=chromium:737755
BRANCH=None
TEST=On kevin, verify reworked suzy-q and suzy-qable are detected in S5.
Also, verify zinger works in S5 on reef.

Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org>
Change-Id: I50967bd6415d964a038b2e7d134374132eda11ec
Reviewed-on: https://chromium-review.googlesource.com/656067
Commit-Ready: Shawn N <shawnn@chromium.org>
Tested-by: Shawn N <shawnn@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2017-09-11 11:14:23 -07:00
Daisuke Nojiri
5da63f4ea2 Treat SYSTEM_IMAGE_RW_B also as RW copy
SYSTEM_IMAGE_RW_B hasn't been globally treated as a RW copy.
This change makes EC treat it also as a RW copy.

BUG=none
BRANCH=none
TEST=make buildall

Change-Id: Iae5a9090cdf30f980014daca44cdf8f2a65ea1f2
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/656337
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-09-09 02:26:16 -07:00
Daisuke Nojiri
3dc0eae365 EFS: Rename CONFIG_VBOOT_EC to _EFS
This patch renames CONFIG_VBOOT_ET to CONFIG_VBOOT_EFS. It also
adds the macro to config.h.

BUG=none
BRANCH=none
TEST=make buidlall

Change-Id: I7cb9f4c73da635b36119db74bac6fe26e77a07d2
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/639955
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2017-08-29 19:37:05 -07:00
Caveh Jalali
ee3fb6c6aa ps8xxx: use custom tcpm_drv
the ps8xxx family of TCPCs (ps8751, ps8805) have historically used the
generic tcpci_tcpm_drv functions, but we need to override some of
these entry points because the parade parts need to be woken up before
accessing registers.

in most cases, this doesn't matter because we access the chip in quick
succession where we can "safely" assume the chip is awake -- and the
code is structured to implicitly keep the chip awake.  the new case we
need to address here is where we need to suspend the pd_task and TCPC
at an arbitrary point in time.  the driver's .release method is called
to shut down the chip, and that involves first waking up the chip to
be able to access its regs to mask off interrupts, etc.

BUG=b:35586896
BRANCH=none
TEST=tested from depthcharge - we no longer get errors in the EC
	console logs about TCPC "release" failed.

Change-Id: Ic2a90b71050b3f68c697b1cef48d736ed88b3f41
Signed-off-by: Caveh Jalali <caveh@google.com>
Reviewed-on: https://chromium-review.googlesource.com/616460
Reviewed-by: Shawn N <shawnn@chromium.org>
2017-08-16 20:46:36 -07:00
Daisuke Nojiri
bc23ce1305 Fizz: Disable PECI
This patch disables PECI so that GPIO81 can be used for PROCHOT.

BUG=b:62092359
BRANCH=NONE
TEST=Boot i7 and Celeron Fizz.

Change-Id: I57f7ece6aa23f1f84a05d2570d71a44e43e7e1ef
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/526035
Reviewed-by: Aaron Durbin <adurbin@chromium.org>
2017-08-07 13:50:48 -07:00