summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfirmware-coral-10068.BBrian Norris2021-09-102-10/+1
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155146 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* stm32: Fix manual interrupt clearing functionCraig Hesling2020-03-161-1/+3
| | | | | | | | | | | | | | | | | | | | | This fixes a bug in gpio_clear_pending_interrupt, where all pending interrupts are unintentionally cleared. This is not in the code path for normal gpio interrupt handlers, since the normal interrupt clearing occurs in gpio_interrupt (right below this function). BRANCH=none BUG=chromium:1059520 TEST=none Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I4d6fe7947f4d76cf3b57dfbf3bb926e41851c80c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2101208 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> (cherry picked from commit c2c2c083fef813e3e3c70f8c13a1418717ba682d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2106621
* board: Set min/max frequency attributesGwendal Grignou2019-12-092-46/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On some boards, min_/max_frequency attributes were not set, esp. for kx022 acceleometers. BUG=b:145799480 BRANCH=octopus,coral TEST=compile Conflicts: board/ampton/board.c board/bloog/board.c board/bobba/board.c board/coral/board.c board/dood/board.c board/garg/board.c board/meep/board.c board/yorp/board.c : boards not present in branch. board/nucleo-f411re/board.c : i2c address change not present. Change-Id: I6d32926541505f02f183539ca3ad9f70c1ae7a6b Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1957374 Reviewed-by: Justin TerAvest <teravest@chromium.org> Tested-by: Justin TerAvest <teravest@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1955094 Commit-Queue: Justin TerAvest <teravest@chromium.org>
* Coral: Add new LGC batteryDavid Huang2019-08-231-0/+30
| | | | | | | | | | | | | | | Add new battery: LGC KT0030G023 for Lava. BUG=b:136691308 BRANCH=coral TEST=Make sure battery can cutoff by console "cutoff" or "ectool cutoff" and resume by plug in adapter. Change-Id: I860c2e05b02f0c2d1fffdf7675e8a283df177f20 Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1763890 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: David Huang <david.huang@quanta.corp-partner.google.com>
* blacktip: add simplo BYD 916Q2294H batteryDevin Lu2019-07-251-0/+31
| | | | | | | | | | | | | Clone from CL:1710208, this battery applied to blacktip as well. BUG=b:135988119 BRANCH=coral TEST=Test on charging/discharging/battery cut off pass. Change-Id: I0d4b8e1bb4283a99c6e82a3e549f188d6f502067 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1714439 Reviewed-by: Marco Chen <marcochen@chromium.org>
* Coral: Add new LGC batteryDavid Huang2019-07-191-0/+29
| | | | | | | | | | | | | | | | Add new battery: LGC AP19A8K for Lava. BUG=b:136691308 BRANCH=coral TEST=Make sure battery can cutoff by console "cutoff" or "ectool cutoff" and resume by plug in adapter. Change-Id: Ic962bb5723d569bd9c03a78a6451280d62de3c36 Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1686924 Tested-by: David Huang <david.huang@quanta.corp-partner.google.com> Reviewed-by: Marco Chen <marcochen@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org>
* npcx: disable the selection of JTAG0 signals due to strapCHLin2019-05-3010-193/+271
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was observed that pressing recovery key combination + the other keys, some keys on the keyboard become invalid after system reboots. (see b:129908668 for more detail.) It is because the hardware strap pin for JTAG0 signals is unintentionally triggered. This CL reverts the selection of JTAG signals and set them back to keyboard scan function at system initialization. The revert applies to all real platforms except npcx_evbs. BRANCH=none BUG=b:129908668 TEST=pass "make buildall" TEST=Press the specific key combination, after the system reboots, the keyboard function works normally. On npcx EVBs, the JTAG0 is still functional. Change-Id: I7ede1ea4609466fea50a97b1f60308e4cdfd4544 Signed-off-by: CHLin <CHLIN56@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/1575887 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: CH Lin <chlin56@nuvoton.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit 7a87d4b5c984cc24937944b4cbcd8cd7f3b4fd0b) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1585482 Reviewed-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Xingyu Wu <wuxy@bitland.corp-partner.google.com> Tested-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
* coral:enable battery cutoff when shutdown_on_critical_batterylu.zhang2019-02-136-1/+60
| | | | | | | | | | | | | | | | | | | | The machine can't power on when the soc of battery is 0% with AC adapter plugging in and this behavior is not consistent as usual. The power consumption is very low when battery is cutoff, so let battery cutoff instead of EC hibernate to try to avoid battery soc dropping to 0%. However, it would take more than 1 hour to consume 1% battery power in G3 state. we also need prevent from hibernating in chipset_task if battery soc <= BATTERY_LEVEL_SHUTDOWN to get chance to cutoff the battery. BRANCH=coral BUG=b:120407297 TEST=Discharge the battery to verify if the battery is cutoff. Change-Id: Ia8ce02e9e6e9b1a0eafe872664fd246667a18b00 Signed-off-by: lu.zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1408749 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* robo360: reduce sensor FIFO size to 256Enrico Granata2019-02-121-1/+1
| | | | | | | | | | | | | | | | | | | A smaller FIFO size is required to pass CTS batching test cases BRANCH=coral BUG=b:123038909 TEST=run CTS tests: testAccelerometer_fastest_batching testGyroscope_fastest_batching testAccelerometer_50hz_batching testGyroscope_50hz_batching Change-Id: I924125ea5c4ce773a91c0633546e0816718ce0c6 Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1467544 Reviewed-by: Gwendal Grignou <gwendal@google.com> Commit-Queue: Gwendal Grignou <gwendal@google.com> Tested-by: Gwendal Grignou <gwendal@google.com>
* coral: setting input current limit after detecting ac_oklu.zhang2019-02-111-0/+19
| | | | | | | | | | | | | | | | | | Sometimes EC would execute PD hard reset afterall and it causes the system brownout on some boards with low voltage battery. According to Rohm's recommendation, IBUS_LIM_SET and ICC_LIM_SET need be rewritten within 100ms once VCC&VBUS reset if doesn't enable charger's bit BD9995X_CMD_VM_CTRL_SET_EXTIADPEN. Obviously EC has not met the timing. BUG=b:121105415 BRANCH=coral TEST=The failed DUT can boot up normally Change-Id: Id9c636da18be534103db0ab006d344f993d5879b Reviewed-on: https://chromium-review.googlesource.com/c/1402384 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Tested-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com>
* coral: Reduce FIFO size to 512Enrico Granata2019-01-291-1/+1
| | | | | | | | | | | | | | | | A FIFO size of 1024 causes failures in CTS batching tests. Reducing the FIFO size is the known method to avoid these issues. This has precedent on several boards (Nautilus, Nocturne, Soraka, ...) and is also required for Coral/Robo360. TEST=run CTS batch tests BUG=b:123038909 BRANCH=coral Change-Id: Ie5c67a0c85f6d0e627d9344c61efd5a6a9053cfa Signed-off-by: Enrico Granata <egranata@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1435098 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* coral: Enable CONFIG_CHARGER_LIMIT_POWER_THRESH_BAT_PCT and ↵lu.zhang2018-12-061-0/+2
| | | | | | | | | | | | | | | | | | | CONFIG_CHARGER_LIMIT_POWER_THRESH_CHG_MW set the minimum charger power required for powering on to 18W. BUG=b:119653907 BRANCH=coral TEST=Let battery to fully discharge until no voltage output anyway to make sure the battery is absolutely 0%. The OS can power up after plugging adapter, then check SOC is 0% both on EC console with battery command and VT2 with power_supply_info command. Change-Id: I5c5e5a0955c2ce61412cc8a90bbfaf59698a5b8d Reviewed-on: https://chromium-review.googlesource.com/c/1351921 Commit-Queue: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Tested-by: Lu Zhang <lu.zhang@bitland.corp-partner.google.com> Reviewed-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Babymako: add battery configuration for EVTJames_Chao2018-10-171-1/+31
| | | | | | | | | | | BUG=none BRANCH=coral TEST=check the DUT can find the battery Change-Id: I759a0fe16992650be35511c46ec4034a70bb9e5b Signed-off-by: James_Chao <james_chao@asus.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1282547 Reviewed-by: Marco Chen <marcochen@chromium.org>
* usb-pd: Exit DP mode before shutdownDaisuke Nojiri2018-08-282-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | On start-up, the tcpm tries to discover identity and enter amodes. When system reboots, this makes already entered modes re-entered. This causes some devices to malfunction. This patch makes the tcpm exit DP mode if it's already entered. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:799535,b:79185392 BRANCH=none TEST=Verify picture is displayed on external monitor after suspend/resume, shutdown/power-on via D6000, Hoho, Aplle HDMI adapter, StarTech DP adapter, Dingdong with Vayne. Change-Id: I1fd577e12eaa5a81a0ae0242d38863dc211ac8bc Reviewed-on: https://chromium-review.googlesource.com/1185495 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit a1fa5af5da8f5209ce64428481d6916ca226a340) Reviewed-on: https://chromium-review.googlesource.com/1189783 Reviewed-by: Casper Chang <casper_chang@wistron.corp-partner.google.com> Tested-by: Casper Chang <casper_chang@wistron.corp-partner.google.com> Commit-Queue: Casper Chang <casper_chang@wistron.corp-partner.google.com>
* Coral: add battery support for babymakojames_chao2018-08-141-0/+30
| | | | | | | | | | | BUG=none BRANCH=coral TEST=check the battery is working normally Change-Id: I5025542c2b0ef6fabfa37fc7c57e5b31d0b332b2 Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/1174136 Reviewed-by: Marco Chen <marcochen@chromium.org>
* bd9995x: Don't reset input current limit to default value when sysjump to RW.Marco Chen2018-08-101-3/+12
| | | | | | | | | | | | | | | | | | When system is unlocked and boots up with AC only, EC RO is allowed to do PD negotiation in order to get enough power to power on other system. But if we reset input current limit in the initialization codes after sysjumping to RW then system might get power failure since the power it needs might be exceed this default value. BUG=b:80092378 TEST=Manually verify input current limit doesn't be reset in the RW stage. And verify babymega can boot up with AC only. Change-Id: If7e7f8c93d26e7a32f2147c426d09d2329d9f423 Reviewed-on: https://chromium-review.googlesource.com/1163414 Tested-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org>
* Coral: add battery configurationjames_chao2018-05-151-0/+31
| | | | | | | | | | | | | For Babymega second source battery (Coslight Cell) BUG=None BRANCH=Coral TEST=Check the dut can recognize the battery. Change-Id: I03f9ef154bbb7b575a4d663ce06d60ee1946ff54 Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/1059235 Reviewed-by: Marco Chen <marcochen@chromium.org>
* Coral: add battery configurationjames_chao2018-05-112-2/+94
| | | | | | | | | | | | | | | | | | | | | | | | | For rabbid after proto Manufacture name: AS1GTFE3KA Device name: C423-50 For babytiger proto Manufacture name: AS19XXE3KA Device name:C523-50 For rabbid proto Manufacture name: AS19XXE3KA Device name:C423-50 The rabbid has touch and non-touch sku, both use 2s battery, the sku id for non-touch sku is 31, for touch sku is 32. BUG=None BRANCH=coral TEST=Check the dut can recognize the battery. Change-Id: Ic7d90be65d5f263480ae5527401453e6042c381e Reviewed-on: https://chromium-review.googlesource.com/1051428 Reviewed-by: Marco Chen <marcochen@chromium.org> Commit-Queue: BoChao Jhan <james_chao@asus.com> Tested-by: BoChao Jhan <james_chao@asus.com>
* Coral: Add new battery configurationTino Liu2018-05-091-0/+32
| | | | | | | | | | | | | | | | Epaulette new battery: AP13J7K BUG=b:76443730, b:70698469 BRANCH=coral TEST=recognize new battery AP13J7K okay, ship mode test okay, DSG FET status test okay Change-Id: I1ab0aab9577aea2244dd63df5bf2364024fb74b4 Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1049346 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
* Coral: add 2s battery support for babytiger with touchjames_chao2018-05-081-1/+1
| | | | | | | | | | | | | | The sku id of babytiger with touch is 33 BUG=none BRANCH=coral TEST=voltage of PPVAR_SYS is measured on proto board with and without this CL. Change-Id: I679b590bf7d5e717343de044bf6c15096fdbb2d2 Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/1039120 Reviewed-by: Marco Chen <marcochen@chromium.org>
* bd9995x: Add chop mode control based on AP power state and CHG_ENScott Collyer2018-05-072-5/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This CL adds chopper mode control which is gated on both the AP power state and CHG_EN setting of the bd9995x. In chopper mode the bd9995x switching converter consumes less energy, but can only be safely used under light load conditions. If AP power != S0 and CHG_EN is 0, then chopper mode will be enabled. Because we disable the switching converter when the battery reaches FULL, that effectively means that chopper mode will only be active when the AP power state != S0 and when the battery is removed/cutoff. This CL also removes a check in charger_set_current that would force the current command to be >= 512 mA. This would prevent CHG_EN from ever being 0 even when battery is removed. This check is not required because the following section of code will always make sure that charging is disabled if current command is 0 prior to setting the command value to the ICHG register. BUG=b:72979303 BRANCH=coral TEST=On a coral device, forced AP power state to off with ec console command 'aps' the issued 'cutoff'. Verifed that chopper mode was enabled. [409.054257 Battery cut off] > [409.263562 charge problem: batt params, 0x0 -> 0x7fc after 409.263545s] [409.265881 charge_request(0mV, 0mA)] [409.380555 bd9995x: Chop Mode change, new val = 1] Change-Id: I61bd52a0865502b2919a8a9b1274b1eb26c2e878 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1010909 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Casper Chang <casper_chang@wistron.corp-partner.google.com> Commit-Queue: Scott Collyer <scollyer@chromium.org> Trybot-Ready: Scott Collyer <scollyer@chromium.org>
* Coral: add new battery [BATTERY_SMP523_2S1P]james_chao2018-04-271-0/+30
| | | | | | | | | | | | | | This battery is for babytiger. BUG=none BRANCH=coral TEST=make. Verify on the babytiger proto board. Change-Id: I909b5675e4521213dc59e981129e8ea124a93a1b Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/1009506 Reviewed-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* BD9995X: Do not set VIN_CTRL_SET_VSYS_PRIORITY.Ryan Zhang2018-04-031-15/+0
| | | | | | | | | | | | | | Do not set VIN_CTRL_SET_VSYS_PRIORITY in VIN_CTRL_SET. BRANCH=coral BUG=b:77185915 TEST=Use console command "bd9995x_dump" to check REG VIN_CTRL_SET(0x0A) status. Change-Id: I0e40544f261045db08e0ee92b8d2f99b47af2088 Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/983614 Reviewed-by: Marco Chen <marcochen@chromium.org>
* Revert "bd9995x: Clear VSYS_PRIORITY when Vbat > Vbat_min"David Huang2018-03-291-43/+2
| | | | | | | | | | This reverts commit 67a02040c9ff465619d897e9aac453727eb8ea2c. Change-Id: I13b01eb5330e1fbcc02aca9f3aaddf2f9164684f Reviewed-on: https://chromium-review.googlesource.com/985672 Commit-Queue: David Huang <David.Huang@quantatw.com> Tested-by: David Huang <David.Huang@quantatw.com> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* Coral: Add sku for support keyboard backlight.Ryan Zhang2018-03-291-1/+1
| | | | | | | | | | | | | Add Blue sku ID: 12. BUG=b:76445195 BRANCH=coral TEST=Blue sku 12 keyboard backlight have function. Change-Id: I4ada82ec8ecf825e218cbfbe2d9fc36d14dae869 Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/983203 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* Coral: add SKU IDs of babytiger and babymega into support list of 2S bat.Marco Chen2018-03-211-2/+2
| | | | | | | | | | | | | | BUG=b:74051538 TEST=voltage of PPVAR_SYS is measured on proto board with and without this CL. Signed-off-by: Marco Chen <marcochen@chromium.org> BRANCH=coral Change-Id: I911f08a4d8295429f38c3018c6f0be2c4107640a Reviewed-on: https://chromium-review.googlesource.com/968682 Commit-Queue: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Blacktip: support motion sensorRyan Zhang2018-03-141-1/+1
| | | | | | | | | | | | | Update MACRO for sku id BUG=b:74420116 BRANCH=coral TEST=Blacktip can use motion sensor Change-Id: Ifbad0212b052d9c491a4d71b2cd3bf6b7ba07f51 Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/961172 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* Coral: Assign new SKU IDsTino Liu2018-03-141-1/+1
| | | | | | | | | | | | | | | | Epaulette new SKU IDs are 13, 14, 15 and 16. SKU ID 13 and 14 have keyboard backlight. BUG=b:73729682 BRANCH=master TEST=keyboard backlight works when SKU ID is [13|14] Change-Id: Ie7f14deee9685f4b6f82449692c265557104ed99 Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/958663 Reviewed-by: Scott Collyer <scollyer@chromium.org> Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
* Blacktip: support motion sensorRyan Zhang2018-03-121-1/+1
| | | | | | | | | | | | | | | Blacktip sku ID: 37 & 38. BUG=b:74420116 BRANCH=master TEST=Blacktip can use motion sensor Change-Id: Ic03ee7f7670f157c8813a85b75c931f56ad04c4c Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/956166 Commit-Queue: David Huang <David.Huang@quantatw.com> Tested-by: David Huang <David.Huang@quantatw.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* coral: add 2S batteries and support default battery from 2S or 3S one.Marco Chen2018-03-073-31/+209
| | | | | | | | | | | | | | | | | | | In order to support 2S and 3S batteries in the same time, we need a way to figure out whether default battery type should be came from the group of 2S or 3S batteries. This is in order to set PPVAR_SYS correctly from charger driver when battery is not connected. BUG=b:70701623 Signed-off-by: Marco Chen <marcochen@chromium.org> BRANCH=coral TEST=manually test in the device with 3S battery. For 2S battery, needs to wait for the proto board of babymako. Change-Id: I9c576507b7d7cd83110f68c38c3c342144d78ed8 Reviewed-on: https://chromium-review.googlesource.com/948222 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Marco Chen <marcochen@chromium.org> Tested-by: Marco Chen <marcochen@chromium.org>
* bd9995x: Use battery spec for precharge current limitScott Collyer2018-02-202-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the funciton charger_set_current would always set the precharge current to the min of the maximum allowed setting and what was requested by the charge_v2 state machine. This means that the precharge current command will regularly exceed what is specified by the battery manufacturer for this state. Normally, this isn't an issue because in cases where precharge state is active, the requested value is the value specified for the battery. However, the selection of trickle vs pre vs fast charge is not controlled by the charge v2 state machine, but rather is controlled by the bd9995x based on current battery and vsys values. For additional safety, this CL limits the precharge current command to be the minimum of the requested value and the battery's specified value plus one 64 mA step. BRANCH=coral BUG=b:73144529 TEST=Manual Using EC console command bd9995x_dump, verified that the value in register 0x15 (IPRECH_SET) was set to 64 + the precharge current setitng specified in battery.c Change-Id: I0c6af19123cf9e2e7455a47ab38ec132418f71d7 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/922385 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* Coral: add new battery [SMP-SDI3320]Ryan Zhang2018-02-091-0/+30
| | | | | | | | | | | | | + SMP battery, see crosbug for detail info. BUG=b:72922811 BRANCH=coral TEST=enter shipping mode good, release shipping good. Change-Id: I09caa9f90547512ed1bc624be7150108209aba0a Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/807967 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* coral: Move LED code to its own task for consistent timingScott Collyer2018-02-012-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coral LED code was triggered on the hook tick which is supposed to be a 200 msec tick. However, during suspend state with the config option CONFIG_LOW_POWER_IDLE enabled, the time between every 5th tick (1 second) would consistently exceed 200 msec, to values as high as 370 msec. The result was that the OFF phase during suspend state instead of being 3 seconds was as long as 4.2 seconds. In order to guarantee consistent timing, this CL adds a new LED task modeled on what was done for Eve. With a dedicated task, the LED tick timing remains consistent under all conditions. In addition, the LED tick was changed to 500 msec from 200 msec as that's the minimum increment needed for all Coral LED operation specs. Previously, the power button off time was 600 msec, but the requested time was 500 msec. BUG=b:69568618 BRANCH=coral TEST=Added debug code that logs the time between LED phase changes. With this code in place, the EC log shows consistent timing and no longer has the extra delays. LED: phase = 0, delta = 3002 mSec, ticks = 6 led: 500 500 500 500 500 500 led total = 3000 msec LED: phase = 1, delta = 1000 mSec, ticks = 2 led: 500 500 led total = 1000 msec LED: phase = 0, delta = 3002 mSec, ticks = 6 led: 500 500 500 500 500 500 led total = 3000 msec LED: phase = 1, delta = 1000 mSec, ticks = 2 led: 500 500 led total = 1000 msec Change-Id: I0255ae95766f0f7fbdf8c32de12cf5d903f2b43a Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/897988 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Trybot-Ready: Scott Collyer <scollyer@chromium.org>
* bd9995x: Clear VSYS_PRIORITY when Vbat > Vbat_minScott Collyer2018-01-231-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | VSYS_PRIORITY in the register VIN_CTRL_SET is set during bd9995x initialization to ensure VSYS remains up and stable during deeply discharged battery conditions. However, outside of this case, this bit should remain cleared. If set, there the input current limit is disabled between the time that the boost converter is enabled (USB_SUS = 0) and charging is enabled (CHG_EN = 1). This can lead to too much current being drawn which results in the connecting port shutting off VBUS due to its overcurrent protection. This has been observed when attempting to charge one DUT from another chromebook port, or with a Type C only charger. This CL adds a check in the bd99965x driver implementation of charger_get_voltage() that compares the current battery voltage to its minimum voltage. If it's higher, then it's not a deeply discharged battery and VSYS_PRIORITY can be cleared. BUG=chromium:69143827,71814128 BRANCH=coral,eve TEST=Tested with 2 Coral DUTs. Verified that VSYS_PRIORITY gets cleared when the charger state machine gets the charger parameters. Also verified that I can repeatedly initated charging from one Coral device to another. Without this fix, this would fail most of the of the time. Also tested Eve with deeply discharged battery to make sure the startup conditon still works. Change-Id: I5230560fa98e5bf16921eb4f2c70802eb962e7f3 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/875178 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit f793f81b8b9bd82f14a18adf3f179df78a813261) Reviewed-on: https://chromium-review.googlesource.com/881587 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* Coral: Modify KBLIGHT PWM frequency from 100Hz to 50kHzdavid.huang2018-01-111-1/+1
| | | | | | | | | | | | | | Modify KBLIGHT PWM frequency from 100Hz to 50kHz for follow backlight control IC requirement. BRANCH=coral BUG=b:71729104 TEST=Use console "kblight 50" and check ec oupput frequency is 50k. Change-Id: I014a0391677ec2e06ef13014495a2b51458e35ab Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/860970 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* USB/PD: Request discover identity on bootDaisuke Nojiri2018-01-081-12/+19
| | | | | | | | | | | | | | | | | | | | | This patch makes the TCPM request discover identity on boot instead of resume. BUG=chromium:644663,b:70165261 BRANCH=none TEST=Verified display works in the following cases: 1. On Fizz, plug in Dell type-c HDMI adapter in S0, shutdown, boot. 2. On Fizz, plug in Dell type-c HDMI adapter in S5, boot. 3. On Fizz, plug in type-c monitor in S0, suspend, resume. 4. On Fizz, plug in type-c monitor in S5, boot. 5. On elm, S5. Plug adapter with power+HDMI, boot. Change-Id: Ib068c60bc51ebddc461378028a48c64662bc5b81 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/853672 Commit-Queue: Sean FS Chiang <sean_fs_chiang@wistron.corp-partner.google.com> Tested-by: Sean FS Chiang <sean_fs_chiang@wistron.corp-partner.google.com> Reviewed-by: Shawn N <shawnn@chromium.org>
* charger: Modify manual mode to save desired current/voltageScott Collyer2018-01-052-19/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously manual_mode used the current values of voltage/current to set the desired values for each charge_request() call. Since manual mode is entered/exited in the host command task, this can easily lead to a race condition where the charger gets disabled in the host command task, the reenabled by the charger task. This in turn makes the ectool chargecontrol idle command unreliable. This CL replaces manual mode with two variables, manual_voltage and manual_current. The default values are -1 which means that they are inactive. When the ectool command 'chargecontrol idle' is executed, it sets both variables to 0. This then removes the race condition possibility as each iteration of the charger loop will use manual_voltage and/or manual_current if not -1. BRANCH=coral BUG=b:68364154 TEST=Manual Executed 'ectool chargecontrol idle' and 'ectool chargecontrol normal' numerous times and verified that the charging was disabled/resumed each time as expected. Without this fix the problem could be reproduced always in less than 10 attempts, typcially less than 5. With this CL charging is disabled reliably each time and I'm not able to reproduce the problem. Change-Id: I1ed9cdb42249cdf72ab34dd95b8f42c09d9a490c Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/851419 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* Coral: Disable set margin to voltage max for coral.david.huang2018-01-051-7/+7
| | | | | | | | | | | | | | | | Disable set 0.05% margin to voltage max for some battery. BRANCH=coral BUG=b:65526971 TEST=Use console command "chgstate" to check charge volatge and battery request voltage. Change-Id: Iaa3f90f8946175f6a3bfb1c546f5027f6f01367c Signed-off-by: David Huang <David.Huang@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/839161 Reviewed-by: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* coral: Fix default LED table for battery error stateparis_yeh2018-01-031-1/+1
| | | | | | | | | | | | | | | | | The default behavior for this state is the amber color for 1 second and then off for 1 seconds. The existing table entry for this state was incorrect. BUG=b:70914820 BRANCH=none TEST=make buildall -j Signed-off-by: paris_yeh <pyeh@google.com> Change-Id: I6291121a37905d5f7cdcfe57b3f91d98af370605 Reviewed-on: https://chromium-review.googlesource.com/848757 Commit-Queue: David Huang <David.Huang@quantatw.com> Tested-by: David Huang <David.Huang@quantatw.com> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* whitetip:Fix ectool can't control battery led for skuid 82wesily.li2017-12-201-1/+1
| | | | | | | | | | | | | | | | Add whitetip battery led control for skuid 82 BUG=b:70819057 BRANCH=none TEST=Manual ectool led battery red|amber|green|off.Verified all colors work as expected. Change-Id: I9e8e261e27eb2948153a30b37ad585c3995f6f87 Reviewed-on: https://chromium-review.googlesource.com/832599 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Wesily Li <wesily.li@bitland.corp-partner.google.com> Tested-by: Wesily Li <wesily.li@bitland.corp-partner.google.com>
* pd: Only save active port when VBUS > 5VScott Collyer2017-12-141-8/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | The active port is saved in BBRAM to ensure that following a reset or sysjump, we don't end up with VBUS still being provided at greater than 5V. However, during factory steps when operating without a battery, this will result in losing system power when attempting to flash a new EC image from the AP. This CL makes it so the flag(s) SYSTEM_BBRAM_IDX_PD0|1 are only set when PS_READY message is received and VBUS was negotiated to more than 5V which is case where a port reset needs to be forced following a sysjump. BUG=b:69324395 BRANCH=coral TEST=Verfied that the active port is saved during PD negotiation when VBUs is not limited to 5V. In addition, after limiting VBUS to 5V with 'pd 1 dev 5', verified that can successfully flash a new EC image via flashrom on the AP. Change-Id: I976980f93e62f14db051d62b2934afb5c78e252b Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/802248 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Vineeth Starly <vineeths@google.com>
* adc: Ensure HOOK_PRIO_INIT_ADC is before HOOK_PRIO_DEFAULTScott Collyer2017-12-142-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For coral, SKU ID is required to set the global variable motion_sensor_count. SKU ID can't be read until the adc initialization is complete and so its HOOK_PRIO is set to HOOK_PRIO_INIT_ADC + 1. Folloiwng the jump to RW, motion sensor start is tied to HOOK_PRIO_DEFAULT. In order to have the correct value of motion_sensor_count when jumping to RW, HOOK_PRIO_INIT_ADC must be at least 2 slots eariler than HOOK_PRIO_DEFAULT. This CL moves HOOK_PRIO_INIT_ADC to the enum list in /include/hook.s so that it's guaranteed to happen early enough so that SKU ID well be read correctly. BUG=b:38271876 BRANCH=coral TEST=Tested on clamshell devices and verified that mostion_sensor_count is set prior motion sensor initalization and I no longer see the following outputs in the EC console log: [27.759747 Lid Accel: 0: init failed: 4] [27.760800 Base Accel: 1: init failed: 1] [27.761831 Base Gyro: 2: init failed: 1] Change-Id: I5347c5fc002cc4cc8ab0ddf81e29d89bca0332c1 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/824903 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org>
* coral: Add request nil override for Nasher BYD and LG batteriesScott Collyer2017-12-131-0/+27
| | | | | | | | | | | | | | | | | | | | | | To avoid inadvertenly shutting off the charger, for these 2 batteries if the battery SOC is 0% and the battery requests 0 for voltage and current, then override this request with precharge current and max voltage to ensure that the battery wakes up. BUG=b:67018220 BRANCH=coral TEST=Connected external passive load and drained BYD battery to point where the D-FET gets disabled (~8.6v). Then connect external charger and verify that battery does requrest 0V/0A and that the override is active and the battery wakes up correctly. This CL was also verified in by Nasher ODM testing. Change-Id: Iff9ceffa010ac3e14107220f2a0c6eb475c1e46d Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/817878 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* intel_x86: Auto power-on after battery SOC is above minimum requiredFurquan Shaikh2017-12-081-5/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If power-up is inhibited by charger because of battery SOC, then check for the conditions again on BATTERY_SOC_CHANGE. This allows the EC to boot the AP up on connecting AC power and SOC going above the minimum required. BUG=b:65864825 BRANCH=None TEST=Verified following on coral and soraka: 1. Discharge battery to ~0% 2. Connect AC power ==> Power-up is inhibited 3. When battery SOC reaches 1%. AP is not taken out of reset: "[12.974428 Battery 1% / 8h:4 to full] [12.980439 power-up still inhibited]" 4. When battery SOC reaches 2%, AP is taken out of reset: "[9.230148 Battery 2% / 4h:5 to full] [9.236122 Battery SOC ok to boot AP!]" Change-Id: Ifa89f8929987d86c9e02530b663d563dbe25ed85 Signed-off-by: Furquan Shaikh <furquan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/753294 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit c147530f1046743d15647faae404073855d77f18) Reviewed-on: https://chromium-review.googlesource.com/816554 Tested-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* coral: Fix ectool led on/off controlsScott Collyer2017-12-051-15/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | Robo systems include a power LED and this was not being covered for the ectool led host command. This CL adds support for POWER_LED so that ectool led can control both the power button led and the battery led. In addition, for Robo amber is generated by turning on both the red and green LEDs simultaneously, where as on Santa/Nasher, this is a single GPIO control. BUG=b:69718133 BRANCH=coral TEST=Manual Robo -> ectool led battery red|amber|green|off. Verified all colors work as expected. ectool led power white|off -> verified correct behavior Nasher -> ectool led battery white|amber|off all work correctly Santa -> ectool led battery blue|amber|off all work correctly Change-Id: Ic125acf24d7af4d4c12025b093456eb14c5d5072 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/804295 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>
* whitetip:Add GF/POWTECH battery profilewesily.li2017-12-011-0/+60
| | | | | | | | | | | | | | | Update battery.c according to GF battery datasheet. BUG=b:69530072 BRANCH=none TEST=boot coral with GF battery, and confirm battery state is OK in chromeOS. Change-Id: I1628ffabc1484a7a81f9ece510ac5805c79c3c2c Reviewed-on: https://chromium-review.googlesource.com/792316 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Wesily Li <wesily.li@bitland.corp-partner.google.com> Tested-by: Wesily Li <wesily.li@bitland.corp-partner.google.com>
* coral: disable tablet mode interrupt for clamshell models.Harry Pan2017-12-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coral family has couple SKUs configured in clamshell form factor, in order to avoid external magnetic field unexpectedly switches clamshell device into tablet mode, this patch disables tablet mode interrupt for SKUs in clamshell form factor. BUG=b:67917181 TEST=emerge-coral chromeos-ec, image to clameshell device, apply external magnetic field and examine no unexpected switching to tablet mode through watching powerd logs; alternately, watch the command 'ectool gpioget TABLET_MODE_L' changes from 1 to 0 without interrupt, this requires some hacking dump in board_set_tablet_mode() as reverse proof. i.e. tablet_mode_interrupt() ... (deferred hook) enable_input_devices() board_set_tablet_mode() Change-Id: Iccf14cd5e2ea71ab3204aa386f476a9a0e1550c4 Signed-off-by: Harry Pan <harry.pan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/754148 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 9ef9db911c6b86e1c07a5ac57cb1a23173774d83) Reviewed-on: https://chromium-review.googlesource.com/802875 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
* coral: never enter tablet mode for clamshell SKUs.Harry Pan2017-12-011-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | Coral family has couple SKUs configured in clamshell form factor, in order to avoid external magnetic field unexpectedly deasserts TABLET_MODE_L and switches device into tablet mode, this patch ignores the TABLET_MODE_L pin status for those SKUs. In other words, always set tablet_mode as 0 for clamshell SKUs. BUG=b:67917181 TEST=emerge-coral chromeos-ec, image it to clamshell device, apply external magnetic field and examine there is no unexpected switching to tablet mode through watching powerd logs. Change-Id: Ibbe08a00bb14144cad87fdd5a4a39cb3bfe2968e Signed-off-by: Harry Pan <harry.pan@intel.com> Reviewed-on: https://chromium-review.googlesource.com/748944 Reviewed-by: Aaron Durbin <adurbin@chromium.org> (cherry picked from commit 647fd77b92547749616f0b84318fcc6c58ac8a1e) Reviewed-on: https://chromium-review.googlesource.com/802874 Reviewed-by: Scott Collyer <scollyer@chromium.org> Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com>
* Coral: add Bruce features.Ryan Zhang2017-11-292-2/+3
| | | | | | | | | | | | | | | | | Bruce SKU # is 8 and 11. Bruce is convertible. Bruce has keyboard backlight. BUG=b:69134506 BRANCH=master TEST=`ectool motionsense` Signed-off-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Change-Id: I6368919c3ae9f94b38e1bdae94334c05147dab37 Reviewed-on: https://chromium-review.googlesource.com/795331 Commit-Queue: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-by: Scott Collyer <scollyer@chromium.org>
* chipset: Introduce CHIPSET_STATE_ANY_SUSPENDFurquan Shaikh2017-11-2812-18/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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/794029 Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Commit-Queue: Scott Collyer <scollyer@chromium.org>