summaryrefslogtreecommitdiff
path: root/board/homestar
Commit message (Collapse)AuthorAgeFilesLines
* battery: Deprecate CONFIG_BATTERY_LEVEL_NEAR_FULLwen zhang2023-05-111-1/+1
| | | | | | | | | | | | | | | | | | Atlas, coral, corori, eve, morphius, primus, and rammus are setting CONFIG_BATTERY_LEVEL_NEAR_FULL to custom values. This causes their LEDs show 'full' while the display battery percentages are still < 100%. We'll make these boards define CONFIG_BATT_HOST_FULL_FACTOR, instead. And fix LED dts for some zephyr projects. BUG=b:280818345 TEST=build pass Change-Id: I98f97798ea99cc812671d5b31d64e92d55a1e05a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4523043 Commit-Queue: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Tested-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* charger: Rename charge_get_state() to led_pwr_get_state()Simon Glass2023-05-111-1/+1
| | | | | | | | | | | | | | | | | | We have a new 'charge state' in struct charge_state_data as part of the charge_state_v2.h file. This is confusing. Rename this function to match the enum it is referencing. This makes no functional change. BUG=b:218332694 TEST=make buildall Change-Id: I7f08dd4fb11e2939e0ef779018c1e3206ebc8d20 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516188 Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Aaron Massey <aaronmassey@google.com>
* Default charger current derating to 5%Peter Marheine2023-01-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Not derating seems like a common pitfall that can cause problems with some chargers, so set a reasonably conservative default. 5% is chosen as the most common derating factor used among boards today (counting occurrences in source code, so this may undercount 5% occurrences because several projects set 5% at the project rather than board-level): 1. 38 x 5% 2. 23 x 4% 3. 6 x 10% 3. 2 x 3% 4. 1 x 2% Boards that currently configure this setting are modified only to continue building without warnings regardless of whether they use the new default value in order to signal that they were explicitly configured. BUG=b:260774380 TEST=make buildall / zmake build -a BRANCH=none Change-Id: I017849d38572fbc48090ae1fa2c539b808e426f9 Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4109651 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* board: Sort header filesJeremy Bettis2022-12-013-5/+6
| | | | | | | | | | | | | | | | | | | | Sort all includes in board with the clang-format rules used by the zephyr project. BRANCH=None BUG=b:247100970 TEST=zmake build -a TEST=./twister --clobber -v -i TEST=make -j72 buildall_only runtests TEST=zmake compare-builds -a Signed-off-by: Jeremy Bettis <jbettis@google.com> Change-Id: I6ad72b167cbb768a64c338fa633eb4bf5a401897 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4060360 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Jeremy Bettis <jbettis@chromium.org>
* Add default implementation of board_set_charge_limitPeter Marheine2022-11-241-2/+2
| | | | | | | | | | | | | | | | | | | The majority of boards simply call charge_set_input_current_limit() from board_set_charge_limit() now that the minimum current limit and derating are available as config options. Make this the default behavior of the charge manager, overridable by boards as needed. Boards that have existing custom behavior retain it, with their versions of board_set_charge_limit() marked as __override as necessary. BUG=b:163093572 TEST=make buildall; zmake build -a BRANCH=none Signed-off-by: Peter Marheine <pmarheine@chromium.org> Change-Id: I72475ca0e8381596cafbcda4b042c7f884ae0432 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4022857 Reviewed-by: Keith Short <keithshort@chromium.org>
* Add CONFIG_CHARGER_MIN_INPUT_CURRENT_LIMITPeter Marheine2022-11-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This splits the dual use of CONFIG_CHARGER_INPUT_CURRENT into two different symbols, changing the uses of that which are used to set a minimum current limit to be CONFIG_CHARGER_MAX_INPUT_CURRENT_LIMIT. Most boards implement this in the same way within either the board or baseboard, so handling of the new option is moved into charge_set_input_current_limit (which is called by every user of the option) and every board which repeated this pattern has the new symbol set to the same value as the old one, with the duplicated code deleted. One functional change to the charge manager is made: when charging stops, the input current limit is set to the default value (CONFIG_CHARGER_INPUT_CURRENT) rather than 0. This captures the intent that the default current is appropriate at any time, which was previously configured by individual boards' implementation of board_set_charge_limit() while still allowing the limit to be set lower as needed. To verify that all changes are appropriate, the following has been manually checked: * All boards with a change to a .c file also have a .h change * All boards without a changed .h file have a changed baseboard.h * For Zephyr projects, those with a changed .c file have config added for the minimum limit and others (only corsola) are unchanged to leave it off. This is intended to verify that each board that duplicated the MAX() logic has its configuration updated to use the shared copy, and that boards with that code in the baseboard also update their configuration. BUG=b:163093572 TEST=make buildall; zmake build -a BRANCH=none LOW_COVERAGE_REASON=added lines will soon be deleted Change-Id: Ia460a16293c1fb82aac3784fd9be57ba0985f2fe Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4019703 Reviewed-by: Keith Short <keithshort@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com>
* Add CONFIG_CHARGER_INPUT_CURRENT_DERATE_PCTPeter Marheine2022-11-172-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Many boards derate their charge current limits by some fixed ratio, which results in duplicate code appearing in many different boards. Since nearly all of these are in implementations of board_set_charge_limit() and themselves call charge_set_input_current_limit(), make that derating a config option and move it into charge_set_input_current_limit(). This makes most boards' implementations uniform and ripe for further simplification in later changes. For those boards that do more complex adjustments, those can be retained by keeping the existing logic in board_set_charge_limit(). Several boards also uselessly defined multiple versions of board_set_charge_limit(): the redundant ones are removed. BUG=b:163093572 TEST=make buildall; zmake build -a BRANCH=none LOW_COVERAGE_REASON=follow-up CLs delete uncovered code Change-Id: I0a7162e72538a91ad06ba85b91a10b93eb6af96b Signed-off-by: Peter Marheine <pmarheine@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4015966 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* Trogdor: Enable C1 PPC interruptWai-Hong Tam2022-11-101-0/+1
| | | | | | | | | | | | | | | | The C1 PPC interrupt is defined but not enabled on init. Should enable it. BUG=b:258532320 BRANCH=Trogdor TEST=Build all the affected boards Change-Id: I793a511783c7266897f3dc5f0988eb6ca16decc9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4019344 Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Commit-Queue: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* strongbad: usb_mux: Split struct usb_mux in strongbad boardsTomasz Michalec2022-09-131-7/+13
| | | | | | | | | | | | | | | | Update strongbad boards to use new struct usb_mux_chain. BUG=b:236274003 TEST=make buildall BRANCH=None Cq-Depend: chromium:3748785 Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I6527f41f081bca7a179f52afb87a6f534d2f09f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3779622 Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com>
* Update license boilerplate text in source code filesMike Frysinger2022-09-129-9/+9
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* homestar: Disable CMD help to free some flash sizeTomasz Michalec2022-08-231-0/+3
| | | | | | | | | | | | | | | Undefine CONFIG_CONSOLE_CMDHELP to save some flash size BUG=None BRANCH=None TEST=make BOARD=homestar Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I122b5a98351030ff2784c616a780f2b7bb622569 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3831540 Tested-by: Tomasz Michalec <tmichalec@google.com> Commit-Queue: Tomasz Michalec <tmichalec@google.com> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* charge_state: Add PWR_STATE_FORCED_IDLE stateParth Malkan2022-08-181-10/+9
| | | | | | | | | | | | | | | | | | Add PWR_STATE_FORCED_IDLE state which indicates PWR_STATE_IDLE state is forced when charge control is not normal. Also update led.c files for boards to replace chflag use with new PWR_STATE_FORCED_IDLE. BUG=b:241167493 TEST=make buildall, zmake build --all, make runhosttests -j BRANCH=None Signed-off-by: Parth Malkan <parthmalkan@google.com> Cq-Depend: chromium:3807136 Change-Id: Ib00ed3df977482a4430b0c3d16a2a0e305bbd47f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3807134 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* board/homestar/board.h: Format with clang-formatJack Rosenthal2022-07-011-6/+3
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I78cddeb03104a72c9a21ed9c2430a6a4863bc88c Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728469 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/homestar/board.c: Format with clang-formatJack Rosenthal2022-07-011-100/+57
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I2d756b026667c81f8eaba3198f4cb32e760a48ab Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728468 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/homestar/usbc_config.c: Format with clang-formatJack Rosenthal2022-06-291-2/+2
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I2df28345a3d3934cf3233d14ccfc24c7c65ada24 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728325 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/homestar/base_detect.c: Format with clang-formatJack Rosenthal2022-06-291-7/+6
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I99b661817c5e040f9581939383564482d8957fb4 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728467 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/homestar/led.c: Format with clang-formatJack Rosenthal2022-06-281-7/+7
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: I94ad3760708757f4c123619fbbb926c3bf304509 Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3728470 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* usbc: wrap task_set_event to have an explicit port argumentFabio Baltieri2022-05-271-2/+2
| | | | | | | | | | | | | | | | | Define an explicit function to set events for the usb charger tasks, so that the caller is not coupled to the internal task implementation, and we can use a single task on a later patch. BRANCH=none BUG=b:226411332 TEST=make buildall TEST=zmake testall TEST=cq dry run Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com> Change-Id: I7a1223642b800568bf4f9864f75b2b647c84d29f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3663746 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* board/baseboard: Remove ACCEL_INTERRUPTSGwendal Grignou2022-05-231-1/+0
| | | | | | | | | | | | | | Use a finer grain set of define, to allow some sensors to use interrupt when wired properly and some use force mode when not using interrupt. BUG=b:230401133 BRANCH=asurada,dedede,brya TEST=Build all. Check Zephyr with herobrine. Check on bugzzy. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I9c7d50b88a0eaec017f4e5e2ccfdb80761d71fb3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609121 Reviewed-by: Yuval Peress <peress@google.com>
* gpio: cleanup header usage for i2cKeith Short2022-02-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | i2c.h only requires the enum gpio_signal, so use gpio_signal.h instead of gpio.h. The builld doesn't compare due to an ASSERT() calls in i2c-stm32f4.c because the line numbers changed. Before this change: 80068b2: f240 2332 movw r3, #562 80068b6: 48a4 ldr r0, [pc, #656] 80068b8: f7fc fb1a bl 8002ef0 <panic_assert_fail> After this change: 80068b2: f44f 730d mov.w r3, #564 80068b6: 48a4 ldr r0, [pc, #656] 80068b8: f7fc fb1a bl 8002ef0 <panic_assert_fail> BUG=b:218856245 BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I0f9f428d5c575c444b9df69f71a0ed6c4b3e378c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3489094 Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
* homestar/mrbland/wormdingler: Add support PS8755Siyu Qin2022-02-161-2/+1
| | | | | | | | | | | | | | | | Import PS8755 as the 2rd source for TCPC chip. BUG=b:218786366 BRANCH=trogdor TEST=make BOARD=homestar/mrbland/wormdingler -j Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Change-Id: I01185737e55bff93cea65fe0667344841231d30b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3463103 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* TCPM: Change the PS8xxx I2C flags name to match the driverSam Hurst2022-02-101-2/+2
| | | | | | | | | | | | | | | | Change the PS8xxx I2C flags name from PS8751_I2C_ADDR to PS8XXX_I2C_ADDR. BRANCH=main BUG=b:194432779 TEST=make -j buildall Signed-off-by: Sam Hurst <shurst@google.org> Change-Id: Ie8ac1c922c46bb425b7e7b1a39173872d48f6353 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3449669 Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Sam Hurst <shurst@google.com>
* baseboard/trogdor: move usbc_config.c to board levelSue Chen2021-12-112-1/+61
| | | | | | | | | | | | | | | | | | | move baseboard/trogdor/usbc_config.c to board file to let board modify charger_profile_override. BUG=none BRANCH=trogdor TEST="make BOARD" build pass for trogdor family (pompom, pazquel, coachz, lazor, marzipan, homestar, wormdingler, trogdor, mrbland, quackingstick, kingoftown) "zmake -D testall" without ERROR message. Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I6dc71f64a1275fa1a71692f43611d3888f780cb6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3255090 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Bob Moragues <moragues@chromium.org>
* i2c: Use declared initializers for i2c_ports: trogdor boardsKeith Short2021-11-301-10/+35
| | | | | | | | | | | | | | Convert all instances of i2c_ports[] to use declared initializers. This allows the fields to be reordered without breaking code. BUG=none BRANCH=none TEST=compare_build.sh Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ibecd375996b92119eca35721d084c35b6e4e6f1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3300186 Reviewed-by: Denis Brockus <dbrockus@chromium.org>
* Homestar/Mrbland/Wormdingler: ps8805 A3 chip Device IDSiyu Qin2021-11-051-0/+1
| | | | | | | | | | | | | | | | | | Adding CONFIG_USB_PD_TCPM_PS8805_FORCE_DID to include ps8805_make_device_id function in for depthcharge to recognize ps8805 A3 chip. BUG=b:205166223 BRANCH=trogdor TEST=make sure "ectool pdchipinfo 0", "ectool pdchipinfo 1" can get device_id 0x2 for ps8805 A3 chip. Change-Id: Idf2f1c883f1e76bdc457a6a2a337cd294120f645 Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3263853 Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Bob Moragues <moragues@chromium.org>
* Homestar: Modify the BatteryParam registertongjian2021-11-021-2/+2
| | | | | | | | | | | | | | | | | The factory needs to read the battery CT number overstation, but fails to read it through Ectool BatteryParam, so the battery register needs to be modified. BRANCH=Trogdor BUG=b:201618156 TEST=make -j BOARD=homestar Verify build on SIT board Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: Ib53377d3127be9ce0bb9a93acbb6de8160f3bdae Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3195685 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* battery: Move battery get/set vendor param to common/battery.cTommy Chung2021-10-282-22/+6
| | | | | | | | | | | | | | | Since the functions are copied by many boards, move them to common. The specific param regs are defined in each specific boards. BUG=b:203031618 BRANCH=none TEST=make BOARD=burnet/coachz/eve/homestar/kappa/mrbland/quackingstick/ wormdingler. Signed-off-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Change-Id: I77c070663ad3e800ec484bd21865c5d911a2c48b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3220718 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* USB MUX: Update mux HPD update interface to use mux_state_tDiana Z2021-09-161-2/+2
| | | | | | | | | | | | | | | | | Since the drivers are now taking a mux_state_t set of flags to update, go ahead and unify the usb_mux API this way as well. It makes the parameters more apparent than the 1/0 inputs, and aligns the stack to use the same parameters. BRANCH=None BUG=b:172222942 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: Ie943dbdf03818d8497c0e328adf2b9794585d96e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3095438 Commit-Queue: Abe Levkoy <alevkoy@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* adc: Remove adc_chip.h where adc.h is usedCaveh Jalali2021-08-271-1/+0
| | | | | | | | | | | | | | This removes the use of adc_chip.h where adc.h is also used. In this case, adc_chip.h is redundant. BRANCH=none BUG=b:181271666 TEST=buildall passes Change-Id: Id7baf9aef949447a4d47934242f9bae97c971262 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3120317 Reviewed-by: Keith Short <keithshort@chromium.org>
* Homestar: Distinguish PS8755 with hidden registerxuxinxiong2021-08-251-0/+4
| | | | | | | | | | | | | | | | | | When TCPC PS8755 is upgraded to PS8805 firmware, the product id cannot distinguish whether the chip is PS8755 or PS8805. Only the hidden register value of PS8755 is 0x80, so use this hidden register to distinguish whether it is PS8755. BRANCH=trogdor BUG=b:196889096 TEST=emerge-strongbad chromeos-ec Change-Id: I99b50dfb2f5ae47c3d4dbb3334dcdae20c281478 Signed-off-by: xuxinxiong <xuxinxiong@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3113261 Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* Homestar: set TCPC product id as PS8805xuxinxiong2021-07-281-5/+1
| | | | | | | | | | | | | | | | | | Homestar will only support TCPC PS8805, set the product id to PS8805 directly. BRANCH=trogdor BUG=b:194737342 TEST=emerge-strongbad chromeos-ec Change-Id: Iea9f12ddaa4dffb73d9f40f23b66af826225642e Signed-off-by: xuxinxiong <xuxinxiong@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3054221 Reviewed-by: Mike Lee <mike5@huaqin.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Bob Moragues <moragues@chromium.org>
* tablet_mode: Fix the race condition of setting the tablet modeWai-Hong Tam2021-07-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There are 2 tablet mode triggers: * Lid: when the lid angle close to 360 degree, either detected by a GMR sensor or by the angle computed by 2 motion sensors. * Base: when the detachable base is detached. These 2 triggers set the tablet mode status, which as a boolean, resulting a race condition. This CL fixes the race condition. Each trigger updates its own bit. The final tablet mode status is the OR of all bits. BRANCH=Trogdor BUG=b:193873098 TEST=Attached the base, checked tablet_mode enabled; detached the base, checked tablet_mode disabled; flip base to 360 degree, checked tablet_mode disabled; move the base out of the lid, checked tablet_mode disabled. Change-Id: Ia9d9d2d66c194796c1039cc8b746c8d1f28a4496 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044414 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Homestar:BACKLIGHT:Remove CONFIG_BACKLIGHT_LIDtongjian2021-07-231-0/+8
| | | | | | | | | | | | | | | Because of the oled panel poweron timing, BL_DISABLE does not need to be controlled by ec. BUG=b:194197448 TEST=make -j BOARD=homestar Verify build on SIT board BRANCH=Trogdo Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I1723f7def2c9358b137cfe813094b54a1a3974e6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3045418 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Homestar:LED:Modify the behavior of the LED to always be off in dischargingtongjian2021-07-221-15/+2
| | | | | | | | | | | | | BUG=b:187539586 TEST=make -j BOARD=homestar Verify build on DVT board BRANCH=Trogdor Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I3063ca561726c9a33a1ecd1b5f69d96d94576f52 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3043762 Reviewed-by: Wenchao Han <hanwenchao@huaqin.corp-partner.google.com> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Homestar: add the support for ICM42607Siyu Qin2021-07-213-2/+101
| | | | | | | | | | | | | | | | BMI160 is going to EOL, so we intend to import ICM42607 to make 2 sources compatible for Homestar. BUG=b:189057043 BRANCH=trogdor TEST=1.make BOARD=homestar 2.ectool motionsense can get the sensor data Change-Id: I87faabf813b9ec1a5c21092b6796542dfbe2d06f Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3029801 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Homestar: Remove on-body detection and gesture host detectionSiyu Qin2021-07-201-8/+0
| | | | | | | | | | | | | | | | | When import the second source sensor ICM42607, the on-body detection and gesture host detection functions will course proccess going to null pointer. Homestar does not require these features according to OEM, so just remove the related macro. BUG=b:194023320 BRANCH=trogdor TEST=make BOARD=homestar Change-Id: I7672fcc090d52e5a030a32ce86c19ff1cf6a0d54 Signed-off-by: Siyu Qin <qinsiyu@huaqin.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3034508 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* Homestar: Remove CONFIG_DEVICE_EVENT DEFINEtongjian2021-07-141-1/+0
| | | | | | | | | | | | | | | Homestar doesn't have WLC and doesn't need it BRANCH=Trogdor BUG=None TEST=make -j BOARD=homestar Verify build on DVT board Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: Ic49a2c8e387928bab9cad2eac261455fa69717a1 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3020677 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* Homestar: generate locked imagetongjian2021-07-131-8/+0
| | | | | | | | | | | | | | Remove bringup configs to generate locked image for production. BRANCH=trogdor BUG=b:192765315 TEST=build Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I175931ffff8d739d71b23029df38f21d6add62ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3015965 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* Homestar: Remove GMR_TABLET_MODE DEFINEtongjian2021-07-131-3/+0
| | | | | | | | | | | | | | | Homestar has no GMR sensor for 360 tablet mode when keyboard attached BRANCH=Trogdor BUG=b:193475186 TEST=make -j BOARD=homestar Verify build on EVT board Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I47a718493c610f85a2e574750adfbd99ec772ed3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3020675 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* chgstv2: Unify power-on and shutdown battery thresholdsDaisuke Nojiri2021-06-231-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, power-on battery SoC and shutdown battery SoC are independently configured by each board. This patch will unify the setting as follows: CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 2 (don't boot if soc < 2%) CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2 (shutdown if soc <= 2%) BATTERY_LEVEL_SHUTDOWN = 3 (shutdown if soc < 3%) CONFIG_BATTERY_EXPORT_DISPLAY_SOC = Y (removed) CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON_WITH_AC = 1 This allows us to show the low battery alert whenever we can because EC doesn't inhibit power-on even if it knows the host would immediately shut down. With CONFIG_BATTERY_EXPORT_DISPLAY_SOC, boards will start using the CONFIG_BATT_HOST_SHUTDOWN_PERCENTAGE = 2% as the low battery threshold (and the SoC will be agreed between the EC and Powerd). Boards with CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON = 1 will keep the same threshold. This is for avoiding degrading the UX by increasing the power-on threshold (even though a question that 1% may not be enough for soft sync to finish consistently remains to be answered). Boards with CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON > 2 will have a lower threshold but we think 2% is enough to finish the software sync. A lower threshold also improves the UX by showing the low battery alert in the situation where otherwise the system would leave the user uninformed by not responding to a power button press. BUG=b:191837893 BRANCH=None TEST=buildall Change-Id: If6ff733bc181f929561a3fffb8a84e760668ce37 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2981468 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Homestar:LED:Use display SoC to control charge LEDtongjian2021-06-232-1/+4
| | | | | | | | | | | | | | | | | | | | | Currently, Homestar uses the state of charge provided from the battery. This isn't the same as the SoC shown on the screen because Powerd compensates it based on the full factor and the low battery shutdown threshold. This change makes Homestar use the display SoC for the charge LED module so that the charge LED and the display SoC synchronously work. BUG=b:187539586 TEST=make -j BOARD=homestar Verify build on EVT board BRANCH=Trogdo Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I953aca48d18b32655d82fbd9a8c315534a8326bf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2965815 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Homestar:TCPM:Enable PD3.0 functongjian2021-06-161-0/+3
| | | | | | | | | | | | BUG=b:185415863 TEST=make -j BOARD=homestar Verify build on EVT board BRANCH=Trogdo Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I1d2a71e10c0a63fd1e9756a7b46f82eb6e1cf764 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2962202 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Homestar: When the base state changes, update the virtual switchWai-Hong Tam2021-06-112-1/+3
| | | | | | | | | | | | | | | | | | Do the similar thing like crrev.com/c/2884609. When the base state changes, update the virtual switch. It sends a mode change event to notify AP and then AP will query the latest virtual switch of the base state. BRANCH=Trogdor BUG=b:190736240 TEST=Built the image without error. The change has been tested on another device. Should be safe. Change-Id: Ibae150091d65367d92abe1ae665e71b5caf8429a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953873 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Homestar: Enable the basestate console commandWai-Hong Tam2021-06-111-0/+2
| | | | | | | | | | | | | | | The basestate console command is used by tests to emulate the base detach or attach state. Enable it to pass the tests. BRANCH=Trogdor BUG=b:190736240 TEST=Built the image without error. The change has been tested on another device. Should be safe. Change-Id: Ica32802a9c2a2e62b280f83d0275f0c8d873ac81 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2953872 Reviewed-by: Ting Shen <phoenixshen@chromium.org>
* Homestar:LED:Add LED behaviortongjian2021-06-101-60/+53
| | | | | | | | | | | | | | | | | | | | | | | | | The led behavior define as following: Power Led behaiver: 1.S0, Green (soild on) 2.S3, Orange (1s on 3s off) 3.S5, off Battery Led behaiver: 1.Red on S0/S3/S5, battery capa < 5% 2.Orange on S0/S3/S5, 5% < battery capa < 97% 3.Green on S0/S3/S5, battery capa > 97% 4.Battery error: Red on 1sec off 1sec 5.Factory test: Red on 2sec, Green on 2sec BUG=b:187539586 TEST=make -j BOARD=homestar Verify build on EVT board Make sure ectool led battery red/green/amber/off/auto work correctly. BRANCH=Trogdo Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I0ace830d9b728cbd43ed53592d5091a579197b0b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2949629 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* trogdor: Change GPIO HIBERNATE_L to open drainWai-Hong Tam2021-06-091-2/+2
| | | | | | | | | | | | | | | | We stuffed an external pull-up resistor on the GPIO HIBERNATE_L for fixing the CCD bugs, like b/173828265, b/177611071. The GPIO can be used as open drain. BRANCH=Trogdor BUG=b:189184814 TEST=Tested on Lazor; CCD connection still worked under EC hibernate. Change-Id: I50d832f1619f976a4cb682fa1b666add96563222 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2950925 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Revert "Homestar:LED:LED function realization"Aseda Aboagye2021-06-081-57/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 8aacd88a332b9903334e0bb3bf586560fdc5883a. Reason for revert: Orange is the same as amber, so the ectool and ec_commands.h portions were not needed. Original change's description: > Homestar:LED:LED function realization > > BUG=b:187539586 > TEST=make -j BOARD=homestar > Verify build on EVT board > BRANCH=Trogdo > > Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> > Change-Id: I9c77b60e11135df5e289ef32adfe34fef3134760 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2915162 > Reviewed-by: Wai-Hong Tam <waihong@google.com> Bug: b:187539586 Change-Id: Ic096dec630bcdcde17a3611f8414d88808d09469 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2947488 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Auto-Submit: Aseda Aboagye <aaboagye@chromium.org>
* Homestar:POGO: Set POGO VBUS setup later then PP3300_HUBtongjian2021-06-041-1/+5
| | | | | | | | | | | | | | | | | The HUB Spec requires the HUB to power up before it is plugged into the device. BUG=b:189191440 TEST=make -j BOARD=homestar 1.Verify build on EVT board 2.Use oscilloscope to observe the timing of POGO VBUS and PP3300_HUB 3.POGO VBUS setup is later then PP3300_HUB BRANCH=Trogdo Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I7ca46298b58e5f38a88ccbaa99a38b1d2555e05f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2935642 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Homestar:LED:Power LED and Battery LED status amendtongjian2021-06-011-4/+5
| | | | | | | | | | | | | | BUG=b:187539586 TEST=make -j BOARD=homestar Verify build on EVT board BRANCH=Trogdo Signed-off-by: tongjian <tongjian@huaqin.corp-partner.google.com> Change-Id: I90fe26c6911d4b5dd04ae6aa131aeb4e8f7a3e7d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2924484 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com> Tested-by: Wai-Hong Tam <waihong@google.com>
* base_state: implement basestate host commandTing Shen2021-05-271-3/+3
| | | | | | | | | | | | | | | | | | | | | This CL introduces an unified method to force base attach/detach, to deprecate the hard-coded gpio pin name table in hammerd/hammertests/common.py. Also modifies base_force_state to use the same parameter type as host command. BUG=b:188625010 TEST=manually, run `ectool basestate attach|detach|reset` on coachz BRANCH=trogdor,kukui Signed-off-by: Ting Shen <phoenixshen@google.com> Change-Id: I5235661727cbbd15015c49d588ec70605e4a33e8 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2910472 Reviewed-by: Wai-Hong Tam <waihong@google.com> Tested-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org>