summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* crystaldrift: modify battery configurationfirmware-fpmcu-helipilot-releaseTang Qijun2023-05-101-5/+5
| | | | | | | | | | | | | | Under Battery mode Press power and refresh key, system reboot failure for battery_get_disconnect_state is BATTERY_DISCONNECTED BUG=b:274211459 TEST=Under Battery mode Press power and refresh key, reboot succeed Change-Id: I9020a15d20ceb22bffa2b9189ffc7d6b96759ae2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4515502 Commit-Queue: Chao Gui <chaogui@google.com> Tested-by: Tang Qijun <qijun.tang@ecs.corp-partner.google.com> Reviewed-by: Chao Gui <chaogui@google.com>
* omnigul: Add condition use Accel and Gyro by FWCONFIG.Logan_Liao2023-05-103-4/+22
| | | | | | | | | | | | | | | | | | | This patch add FW config to deceide enable Accel and Gyro or not. BUG=b:280001153 TEST=ectool motionsense show sensor 0: 0 0 0 sensor 1: 0 0 0 sensor 2: 0 0 0 Change-Id: Id040713b20e415f52f2feb1f9320a3affa94711b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4487062 Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Kyle Lin <kylelinck@google.com> Code-Coverage: Kyle Lin <kylelinck@google.com> Reviewed-by: Kyle Lin <kylelinck@google.com> Reviewed-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com>
* myst: move all CBI fields to board-level filesBoris Mittelberg2023-05-103-36/+23
| | | | | | | | | | | | | moving the PPC interrupt handler to be under program/myst/myst BUG=b:281645793 BRANCH=none TEST=zmake build myst Change-Id: Ia4a5daab6d280f2f8116486378925b4432a58731 Signed-off-by: Boris Mittelberg <bmbm@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516860 Reviewed-by: Diana Z <dzigterman@chromium.org>
* myst: add daughter board configsBoris Mittelberg2023-05-1010-49/+155
| | | | | | | | | | | | | | | | | Adding devicetree for SKU A and SKU B BUG=b:275610001 BRANCH=none TEST=zmake build myst LOW_COVERAGE_REASON=this is still part of the initial image Change-Id: I5997ca139b26664e6215782c61b9bbe57262ac74 Signed-off-by: Boris Mittelberg <bmbm@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4492007 Reviewed-by: caveh jalali <caveh@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Robert Zieba <robertzieba@google.com> Reviewed-by: Keith Short <keithshort@chromium.org>
* yaviks: Limit C1 current with low power chargerDevin Lu2023-05-102-0/+22
| | | | | | | | | | | | | | | | | | | Yaviks C1 port is OCPC (One Charger IC Per Type-C) architecture, The charging current is controlled by increasing Vsys. However, the charger SM5803 is not limit current while Vsys increasing, we can see the voltage drops to ~3.48V to cause C1 port brownout with low power charger (5V). To avoid C1 port brownout at low power charger connected. Limit charge current to 2A. BUG=b:261102000 TEST=Left battery ~50% with sink device. Toggle 10 times power role swap. Yaviks c2c charging is not brownout on C1 port. Change-Id: I361eda581d3611e176c75804131b3a17343d85c3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4379827 Tested-by: Devin Lu <devin.lu@quantatw.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org> Commit-Queue: Devin Lu <devin.lu@quantatw.com>
* markarth: Modify VBUS monitor from TCPC.Logan_Liao2023-05-101-0/+4
| | | | | | | | | | | | | | | | | | Due to ISL9241 have 200~300mv tolerance, cause 5V test item fail(read 4.4V, measure 4.6V). This patch modify to TCPC monitor Vbus. BUG=b:278988137 BRANCH=skyrim TEST=test monitor VBUS from TCPC success. Change-Id: I53d1fe92595ff65b5a00434c0dc20e638d0ae85c Signed-off-by: Logan_Liao <Logan_Liao@compal.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4486661 Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com>
* taranza: Implement LED behaviorYu-An Chen2023-05-104-98/+46
| | | | | | | | | | | | | | | | | | | Power led behavior: S0 - white S3 - off S5 - off BUG=b:278167979 TEST=make BOARD=taranza Change-Id: Idf3e81e162dfb043ded54b003a72948f44929a93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516817 Tested-by: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Reviewed-by: Bob Moragues <moragues@chromium.org> Reviewed-by: Zhuohao Lee <zhuohao@chromium.org> Auto-Submit: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com> Commit-Queue: Yu-An Chen <yu-an.chen@quanta.corp-partner.google.com>
* config: Add more condition for VBUS measure from charger.Logan_Liao2023-05-101-3/+8
| | | | | | | | | | | | | | | | | | | | | Because of build gradation, build Board layer first, build config.h later, cause that although define monitor TCPC VBUS, code still define CONFIG_PD_VBUS_MEASURE_CHARGER when using ISL9241 which support VBUS measure. BUG=b:278988137 TEST=test VBUS meanure from TCPC success. Zephyr compare builds successful: HEAD: 28be906e09bc69e1b6ea93b5b6aac7e51f91d0d1 HEAD~: 6378b2bd5a61cde2433e92a2ee17f0f7564596da Change-Id: I471e616d6b7ebcf49e3c69b1f037ca4ee5b37c4c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4486660 Reviewed-by: Josh Tsai <josh_tsai@compal.corp-partner.google.com> Reviewed-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Tested-by: Logan Liao <logan_liao@compal.corp-partner.google.com> Commit-Queue: Logan Liao <logan_liao@compal.corp-partner.google.com>
* ec: Add #line in include/usb_pd.hJeremy Bettis2023-05-101-0/+6
| | | | | | | | | | | | | | | Work around coreboot GCC preprocessor bug. BUG=b:272518464 FILE=gcc -E Change-Id: Ib5bf494bf8f7ab1346867014ce0a0bfca5ee6538 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4519642 Commit-Queue: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Auto-Submit: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* charger: Move conditional into process_preferred_voltage()Simon Glass2023-05-091-6/+13
| | | | | | | | | | | | | | | Try to work around the code-coverage loss by moving the condition into the function. BUG=b:281109948 TEST=check if coverage goes back up Change-Id: I3374692c7010f3712e87a2e144212488fb58bb91 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4519108 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* driver/tcpm/nct38xx: Remove write to RO registerRobert Zieba2023-05-091-5/+0
| | | | | | | | | | | | | | | | | `TCPC_REG_DEV_CAP_2` is a RO register according to the TCPC spec and the NCT38xx datasheet. Writes to this register have no effect on real hardware. The vendor has also confirmed that they are not aware of any workarounds that would explain this write. Remove it. BUG=b:280351196 TEST=Ran on skyrim, verified that FRS sequences don't change Change-Id: I9364f66c3499a7a49b41c9edad6cd6ef970e6a89 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4507893 Tested-by: Robert Zieba <robertzieba@google.com> Auto-Submit: Robert Zieba <robertzieba@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* charger: Move setup of input_voltage to charger_base.cSimon Glass2023-05-093-9/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a way to set the base input-voltage in the charger_base.c file. Use this for the two accesses required in charger_base.c, thus removing the final two base-related #ifdefs in that file. With this we can drop the inclusion of the ec_ec_comm_client/server headers. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69460 bytes in flash and 1120 bytes in RAM lux RW **** Check size on brya: *** 33464 bytes in flash and 23136 bytes in RAM brya RO **** *** 33428 bytes in flash and 23136 bytes in RAM brya RW **** Change-Id: I8b747b8d7dbe890ce071027aaeed23b879ae8070 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510250 Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* charger: Deal with dumping the input voltageSimon Glass2023-05-093-3/+12
| | | | | | | | | | | | | | | | | | | | This field is only accessible when CONFIG_EC_EC_COMM_BATTERY_CLIENT is enabled, but we want to dump it in the main charger file. Add a function to access the value. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69460 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: Iebf22c19cd3e2c649715eb3e6010709fda075929 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510249 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* charger: Drop a few more #ifdefsSimon Glass2023-05-092-8/+11
| | | | | | | | | | | | | | | | | | | Change the #ifdef in charge_set_input_current_limit() to use if() and move a line of setup code into charger_base_setup(). This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69460 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: Ie657a69165b4e2cda56c9966e5831152d6b745d4 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510248 Tested-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* charger: Make charge_base staticSimon Glass2023-05-093-10/+25
| | | | | | | | | | | | | | | | | | | | Move use of this variable wholly within charger_base.c by adding a function to show the current charge level and another to check if the base is nearly full. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69460 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: I558c3c122f52a8d4e034bd375b20e7ca154fd3a7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510247 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Make prev_charge_base staticSimon Glass2023-05-093-9/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move use of this variable wholly within charger_base.c by adding two functions to deal with what charger_state_v2.c needs: - seeing if charge_base has changed since last time - committing that change I did toy with the idea of making these two functions static inlines, but that does tend to obfuscate the fact that they only exist when the base is present. So for now at least I have left two IS_ENABLED() calls in the code. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69448 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: Ib9bdbce62cefb99b12aeb235450eac5d29861d3b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510246 Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Move base_responsive to charger_base.cSimon Glass2023-05-093-3/+11
| | | | | | | | | | | | | | | | | | | | This variable is not used in the main charger file. Move it over to the base file by creating a setup function for the base, calling it from the charger_setup() function. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69448 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: Idbdb7639cb51e65de2c77303545221cca25c8865 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510245 Reviewed-by: Al Semjonovs <asemjonovs@google.com> Tested-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* charger: Split base code out to its own fileSimon Glass2023-05-095-667/+711
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | With the essential refactoring complete, move the base code into a new charger_base.c file, with a corresponding charger_base.h header file. The base name 'charger' was chosen since it matches the charger.h header file, even though charge_state_v2.c uses the 'charge' base name. Three variables must be exported for use by the charge_state_v2.c code: charge_base, prev_charge_base and base_responsive. For now these are made global. Future work will tidy that up. The base_connected() function is defined in the new C file, with a stub in the header for when CONFIG_EC_EC_COMM_BATTERY_CLIENT is not enabled. The hook for board_base_reset() is placed at the bottom of the new charger_base.c file. With this change we have 8 #ifdefs for CONFIG_EC_EC_COMM_BATTERY_CLIENT in charge_state_v2.c - future work will tidy those up. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69448 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: I2d8d03e8b07ed1b281b8729cffdb8140239b5b2b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510244 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Tristan Honscheid <honscheid@google.com> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Avoid accessing curr.ac in base_check_extpower()Simon Glass2023-05-091-8/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to move this function into its own file where it will not have access to the 'curr' state. Pass in the ac value and use the return value to indicate whether it should be zeroed. Pass in prev_ac as well, for the same reason. This changes the ordering of curr.ac being set to 0, so it happens after board_base_reset() has been called. From what I can tell, this does not matter, although there is a lot of code what could be affected by the base_detect_deferred hook or the call to base_detect_change(). So this makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69448 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: Ie2171016b692d233fda4f7bd527e74cbb965702e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510243 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Tomasz Michalec <tmichalec@google.com> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Pass debugging variable to base functionSimon Glass2023-05-091-4/+6
| | | | | | | | | | | | | | | | | Pass this variable in as an argument, so we can eventually move the base code out into its own file. BUG=b:218332694 TEST=zmake build dev-posix Check size on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69452 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: I14fb41b07a1baa8bc38efe493de9c4242dda3456 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4510242 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* charger: Pass state to base_charge_allocate_input_current_limit()Simon Glass2023-05-091-17/+18
| | | | | | | | | | | | | | | | | | | | | In preparation for moving this function into its own file, pass in the charge state that we want it to work with. Use a local variable for the battery information to simplify the code. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check code on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69440 bytes in flash and 1120 bytes in RAM lux RW **** Change-Id: If6271fcac99eb3af554bda52f86ed63267daea76 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4509873 Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Al Semjonovs <asemjonovs@google.com> Commit-Queue: Simon Glass <sjg@chromium.org>
* charger: Simplify the arguments to charge_request()Simon Glass2023-05-091-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | This function is called in two modes, one where it deals with the currently requested voltage/current and one where it does not. The function has access to the necessary state so there is no need to pass it in. It is better to tell the function which approach to take explicitly, using a boolean, rather than using zero values for the first two arguments to indicate this. Replace the first two arguments with a boolean. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check code on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69416 bytes in flash and 1152 bytes in RAM lux RW **** Change-Id: I8389e35b0f61b2c4f03a7e7aac746eeab20ef0de Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4509872 Reviewed-by: Aaron Massey <aaronmassey@google.com> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Make base_connected() a functionSimon Glass2023-05-091-12/+16
| | | | | | | | | | | | | | | | | | | | | | | | The double declaration of this variable is ugly. The only user seems to be lux, where board_is_base_connected() is implemented simply by reading from another variable. So there is really advantage to caching the value in the charger code. Change base_connected() to a function, where it returns false if there is no base, otherwise calls the base code to find out. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Check code on lux: *** 69552 bytes in flash and 1152 bytes in RAM lux RO **** *** 69424 bytes in flash and 1152 bytes in RAM lux RW **** Change-Id: I14a05a7705fa52c92fa15b0ee233f79ef01d1b53 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4508350 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Make is_full mostly a local variableSimon Glass2023-05-091-26/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a property of the charger task and various functions access it. Within each iteration of the charger loop, it is only changed at most once. It seems better to use a local variable for that. Unfortunately the exported function charge_get_percent() needs access to this variable. But it seems better to group exported information together, updating it as needed. Then this information it could potentially be accessed as a cohesive whole, rather than a collection of unrelated pieces. Make a start on this by creating a new local struct to hold what will be the 'published' information. Update it once around the charger loop. Update charge_get_percent() to use that version of the information. Code size on lux, which seems to be the only user of the base code, increases a bit. This hits it fairly hard since it adds a 5th function argument to set_base_lid_current(). We could improve that by using flags instead of three booleans. But it seems best to do that once we have all the reported state in one place. Note that we get much of the code space back with the next CL. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Lux adds 136 bytes to RO, less to RW; RAM improves a little Free space before: *** 69624 bytes in flash and 1152 bytes in RAM lux RO **** *** 69444 bytes in flash and 1120 bytes in RAM lux RW **** after: *** 69488 bytes in flash and 1152 bytes in RAM lux RO **** *** 69476 bytes in flash and 1152 bytes in RAM lux RW **** Change-Id: Ide34a613e0bab7868d268b6fa1a9db258d3c5945 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4508349 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org>
* charger: Make prev_full a local varSimon Glass2023-05-091-3/+4
| | | | | | | | | | | | | | | | This does not need to be global to the whole file. Move it into the charging loop. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Change-Id: Ia9e5b4e202535e6b3f9277a66cbdbc87c984d95e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4508348 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* damu: Disable CONFIG_CHARGE_STATE_DEBUGSimon Glass2023-05-091-0/+3
| | | | | | | | | | | | | | | | | Disable this to free up some flash space so I can continue refactoring. Space with clang increases to 204 bytes, more than enough for an SMS message. BUG=b:218332694 TEST= CC=clang make BOARD=damu -j50 See that it has more space *** 204 bytes in flash and 10908 bytes in RAM still available on damu RO **** Change-Id: I46b2a3fc85cf0f29d5fc4c986816fae760b9fd43 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4518025 Commit-Queue: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* charger: Add a way to disable debugging at build timeSimon Glass2023-05-094-10/+57
| | | | | | | | | | | | | | | | | | | | | | Add a way to disable some debugging related to the chgstate command. It is a small, but enough to reclaim 70 bytes for damu. Use functions to avoid needing #ifdefs in the main body of the code. Convert the value to a bool while we are here. BUG=b:218332694 TEST=build on brya and see that the feature is still enabled $ grep CONFIG_CHARGE_DEBUG build/brya/.config CONFIG_CHARGE_DEBUG=y Check damu is the same as before: *** 12 bytes in flash and 10908 bytes in RAM still available on damu RO **** Change-Id: I07d2453aa74ab53a29275bba76cd2e8003c5dc14 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4518028 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* zephyr: mtlrvp: Enable VBUS_MEASURE_CHARGER optionKeith Short2023-05-091-0/+1
| | | | | | | | | | | | | | | | | The legacy config.h silently enables using the charger to measure VBUS when a compatible charger is enabled. Explicitly enable CONFIG_PLATFORM_EC_USB_PD_VBUS_MEASURE_CHARGER to remove the hidden dependency on config.h BUG=none TEST=zmake compare-builds mtlrvpp_mchp mtlrvpp_npcx Change-Id: I34d49c09506eefa506304fee404bb699f7c655e2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4518121 Auto-Submit: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org>
* zephyr: make PPC/TCPC support optionalKeith Short2023-05-092-6/+18
| | | | | | | | | | | | | | | | | | | | | | The "ppc" and "tcpc" properties are tagged as optional by the devicetree. Update the PPC and TCPC shim drivers to support an empty entry in the ppc_chips[] and tcpc_config[] arrays. This is useful for boards that need to setup different USB-C chips at runtime and ensures there is a valid entry to update. BUG=none TEST=zmake build -a TEST=locally, comment out the "ppc" and "tcpc" property on skyrim and validate the corresponding arrays are correct. Change-Id: Ief1c3670d5ef9d8e07a599286e77fbb9e229335e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4516398 Commit-Queue: Keith Short <keithshort@chromium.org> Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com> Tested-by: Keith Short <keithshort@chromium.org> Auto-Submit: Keith Short <keithshort@chromium.org>
* rex: Enable system boot time loggingRajesh Kumar2023-05-091-0/+3
| | | | | | | | | | | | | | | | | | This CL enables system boot time logging support for rex platform. BUG=b:249163956 BRANCH=none TEST='ectool boottime' AP console command is used to fetch data 'reboot' on AP console to trigger warm reboot 'apshutdown' on EC console to trigger cold reboot Change-Id: Ice9e5122f69c6427a36532b6a00e3015dd06b312 Signed-off-by: Rajesh Kumar <rajesh3.kumar@intel.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4263104 Reviewed-by: Vijay P Hiremath <vijay.p.hiremath@intel.com> Reviewed-by: Brandon Breitenstein <brandon.breitenstein@intel.com> Reviewed-by: Tristan Honscheid <honscheid@google.com> Reviewed-by: Wonkyu Kim <wonkyu.kim@intel.com>
* zephyr: implement icm42607 testTing Shen2023-05-098-0/+569
| | | | | | | | | | | | | | | | | | | Add unittest for ICM42607 accel+gyro sensor. Note that we've already hit the hard limit of motion sensor count in zephyr/test/drivers/default/, so this one is implemented as a standalone test. Also fixed an endian bug in driver/accelgyro_icm42607.c. BUG=b:272665228 TEST=twister Change-Id: Ia52a81e671a981fc0f003d07c7f59ca3d0c24233 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4497324 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* zephyr/test: add icm42607 emulatorTing Shen2023-05-095-0/+267
| | | | | | | | | | | | | | | | Implement a simple emulator for icm42607 sensor. This is based on the generic i2c emulator with special handler to process icm42607's mreg bank access and fifo access. BUG=b:272665228 TEST=twister Change-Id: I0f737bf013a62d256522224320d6cca50c3ab219 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4506513 Tested-by: Ting Shen <phoenixshen@chromium.org> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ting Shen <phoenixshen@chromium.org>
* zephyr: Make EC fan options depend on PLATFORM_EC_FANKornel Dulęba2023-05-091-1/+2
| | | | | | | | | | | | | | | | Both PLATFORM_EC_CUSTOM_FAN_CONTROL and PLATFORM_EC_CUSTOM_FAN_DUTY_CONTROL make sense only if PLATFORM_EC_FAN config is enabled. Move them under "if PLATFORM_EC_FAN" block. BUG=none TEST=make try_build_boards TEST=emerge-skyrim chromeos-zephyr Change-Id: I93e7b4bd5909415e15d64009569c77971cc57e85 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4488131 Tested-by: Kornel Dulęba <korneld@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Kornel Dulęba <korneld@google.com>
* whiterun: Implement unit test for custom fan duty controlKornel Dulęba2023-05-093-1/+173
| | | | | | | | | | | | | | | | | Whiterun uses a custom fan duty control logic. Implement a unit test for it. Two global structures that describe fan and its state were mocked. The test makes a really simple fan pseudo-emulation, i.e. after fan duty is change the RPM is adjusted taking inertia into account. BUG=b:279493434 TEST=./twister -i -T zephyr/test/skyrim/ Change-Id: Id32dd8c8ee76420a83de25b23837b8df35ecabbb Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4479372 Tested-by: Kornel Dulęba <korneld@google.com> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Kornel Dulęba <korneld@google.com>
* winterhold: Move fan duty logic to a separate fileKornel Dulęba2023-05-093-81/+93
| | | | | | | | | | | | | | | | | | This is needed for an upcoming fan test written using zephyr test suite. The test framework expects the board specific fan logic to be present in the fan.c file, move it there to make it happy. BUG=b:279493434 TEST=emerge-skyrim chromeos-zephyr TEST=./twister -i -T zephyr/test/skyrim/ Change-Id: I9d776dcf012f6c047eceebb45e4f76c40b17715f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4479371 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Reviewed-by: Robert Zieba <robertzieba@google.com> Commit-Queue: Kornel Dulęba <korneld@google.com> Tested-by: Kornel Dulęba <korneld@google.com>
* yavilla: Update led behaviorTommy Chung2023-05-093-8/+90
| | | | | | | | | | | | | | | | | | | | | Yavilla has convertible sku with power led, and the behavior of power led is described as following: Power state in S0: White on. Power state in suspend: Blink white (1 sec. on, 1 sec. off). Power state in G3/S5: Off. Also, C0/C1 port is on right/left port on Yavilla respectively. Set ports to correct ports. BUG=b:273791621 TEST=make sure power led works correctly. Change-Id: I433def8dcfddafbd5e5b3601105621d3aa041e07 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4474088 Tested-by: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Reviewed-by: Devin Lu <devin.lu@quantatw.com> Commit-Queue: Tommy Chung <tommy.chung@quanta.corp-partner.google.com> Reviewed-by: Peter Marheine <pmarheine@chromium.org>
* starmie: add battery supportedwangganxiang2023-05-093-2/+62
| | | | | | | | | | | | | | | add new battery celxpert b300049 BUG=b:274723043 TEST=zmake build starmie The battery information is normal. Change-Id: I047e594b1143f8558bb0ddd3f0ad6afb96018421 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4509009 Tested-by: Ganxiang Wang <wangganxiang@huaqin.corp-partner.google.com> Reviewed-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> Commit-Queue: Ganxiang Wang <wangganxiang@huaqin.corp-partner.google.com> Reviewed-by: Sung-Chi Li <lschyi@chromium.org>
* jewel: enable GMR sensorwangganxiang2023-05-091-1/+1
| | | | | | | | | | | | | | | | Jewel has a GMR sensor for tablet mode detection BUG=b:278138283 TEST=make BOARD=jewel The GMR sensor is function normal. Change-Id: Ic2cb43dda62d882db0c3519f38b28292fba08538 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4505201 Reviewed-by: Sung-Chi Li <lschyi@chromium.org> Tested-by: Ganxiang Wang <wangganxiang@huaqin.corp-partner.google.com> Reviewed-by: Ruihai Zhou <zhouruihai@huaqin.corp-partner.google.com> Reviewed-by: Eric Yilun Lin <yllin@google.com> Commit-Queue: Ganxiang Wang <wangganxiang@huaqin.corp-partner.google.com>
* docs: Remove deprecated flasrhom EC WP commandsNikolai Artemiev2023-05-091-73/+0
| | | | | | | | | | | | | Remove flasrhom EC commands because ectool should be used instead. BUG=b:280361439 TEST=N/A Change-Id: Ia8362ca325ed7164adbdbea39f1223b61da45c6e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4514139 Commit-Queue: Edward O'Callaghan <quasisec@chromium.org> Reviewed-by: Edward O'Callaghan <quasisec@chromium.org> Tested-by: Nikolai Artemiev <nartemiev@google.com>
* board/hyperdebug: Properly enter alternate modeJes B. Klinke2023-05-091-2/+57
| | | | | | | | | | | | | | | | | | | | | | | | | HyperDebug allows host software to change the mode of most pins. Some of them have pre-defined alternate modes, such as UART, SPI or I2C. The I2C pins in particular must operate as open-drain, when in their "alternate" mode. The EC codebase usually does this as part of gpio_config_module() when all pins used by a particular module are put into alternate mode, based on the flags field in ALTERNATE() declarations in gpio.inc. HyperDebug however, operates on a single pin at a time using gpio_set_flags() which does not look at ALTERNATE() declarations. This CL introduces a helper method to find out which additional flags need to be applied, when switching a particular pin into alternate mode. BUG=none TEST=HyperDebug can continue I2C communication after `transport init` Change-Id: I8e7c9ed081635c6166e9487cff02f0b0e3d059cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4513887 Tested-by: Jes Klinke <jbk@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jes Klinke <jbk@chromium.org>
* dts/it82202ax-512: no padding after the contents of the entryDino Li2023-05-091-0/+1
| | | | | | | | | | | | | | | By default, there is 256KB padding after the entry content. On chip with 512KB flash, the padding is unnecessary. BUG=none TEST=Size of roach image is 512KB Jump fw images to each other. Change-Id: I3bc3025224131a5563d4d12349a268bb34476bdf Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4506540 Tested-by: Dino Li <Dino.Li@ite.com.tw> Reviewed-by: Ting Shen <phoenixshen@chromium.org> Commit-Queue: Dino Li <Dino.Li@ite.com.tw>
* charger: Move charge-state handling into a functionSimon Glass2023-05-081-31/+39
| | | | | | | | | | | | | | | | Move this related code into a separate function, to reduce the side of the charger_task() function. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Change-Id: I20632ed822df5cc2799959b251c29cb160eabcf7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4508347 Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
* charger: Move handling of external power to a functionSimon Glass2023-05-081-5/+12
| | | | | | | | | | | | | | | Put this code in a separate function, since it is logically related. This makes no functional change. BUG=b:218332694 TEST=zmake build dev-posix Change-Id: I1ebab33e72d5927bbc3fcd1e0562b66102c5c689 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4508346 Reviewed-by: Tristan Honscheid <honscheid@google.com> Commit-Queue: Simon Glass <sjg@chromium.org> Tested-by: Simon Glass <sjg@chromium.org>
* uartupdatetool: Add device ID for NPCX997Caveh Jalali2023-05-081-0/+6
| | | | | | | | | | | | | | | | | | | | Add entry for the NPCX 997 EC to the UART update tool. This is used by flash_ec to communicate with the EC, but the missing entry only broke being able to read the EC flash. flash_ec would fail with "Unknown NPCX device ID:0x22 chip ID:0x09". rebuilt uartupdatetool with "sudo emerge ec-devutils -j". BRANCH=none BUG=b:280058857 TEST="util/flash_ec --read /tmp/e.bin" now works Change-Id: I081f81ee28206b0e8cdeb83e9da65b885e2e0ed1 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4400342 Reviewed-by: Boris Mittelberg <bmbm@google.com> Commit-Queue: Boris Mittelberg <bmbm@google.com> Reviewed-by: CH Lin <chlin56@nuvoton.com>
* Skyrim: Keep retimer enabled in suspendDiana Z2023-05-083-7/+27
| | | | | | | | | | | | | | | | The A1 retimer needs to remain enabled in suspend in order to prevent issues with USB detection on resume. Enable and disable on the transition into/out of S5 instead. BUG=b:273849234,b:280957965 TEST=on frostflow, ensure USB file transfer is able to resume after suspend Change-Id: I0186d54a76c14f3d0141fbeec75ed5b13aa599d7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4455299 Tested-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Robert Zieba <robertzieba@google.com>
* Frostflow: Always initialize retimer when enabledDiana Z2023-05-081-3/+22
| | | | | | | | | | | | | | | | | | The A1 retimer will be enabled anytime the board boots. Ensure that the tuning parameters are applied every time the retimer is enabled again since they clear when the retimer is disabled. BUG=b:273849234,b:280957965 TEST=on frostflow, run suspend stress test and verify retimer initialization always reports success talking to the chip, spot check tuning register contents Change-Id: I147e6e7ad09f3279a77fe3f0757cf6ed140b058c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4450966 Reviewed-by: Chao Gui <chaogui@google.com> Tested-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Diana Z <dzigterman@chromium.org> Reviewed-by: Robert Zieba <robertzieba@google.com>
* flash_ec: Fix shellcheck warning SC2295Bobby Casey2023-05-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The failure was: [FAILED] chromiumos/platform/ec: cros lint Hook script "cros lint ${PRESUBMIT_FILES}" failed with code 1: In util/flash_ec line 798: save=( "${CTRL_RESULT#${DUT_CTRL_PREFIX}}" "${save[@]}" ) ^----------------^ SC2295 (info): Expansions inside ${..} need to be quoted separately, otherwise they match as patterns. Did you mean: save=( "${CTRL_RESULT#"${DUT_CTRL_PREFIX}"}" "${save[@]}" ) BRANCH=none BUG=b:242127759 TEST=util/flash_ec --board=dartmonkey --image build/dartmonkey/ec.bin Change-Id: I92bb0aa609be5e377e7ad04f64b81533b3ca9363 Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4455231 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* flash_ec: flash_ec: Fix shellcheck warning SC2140Bobby Casey2023-05-081-2/+2
| | | | | | | | | | | | | | | | | | | The error was: In util/flash_ec line 151: "UART baud rate to use when bit bang programming, "\ ^ SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"? BRANCH=none BUG=b:242127759 TEST=util/flash_ec --board=dartmonkey --image build/dartmonkey/ec.bin Change-Id: Id98ba2d2d44d53c21c9390c51f17195fe889cacb Signed-off-by: Bobby Casey <bobbycasey@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4455230 Reviewed-by: Tom Hughes <tomhughes@chromium.org>
* config: Don't enable LIBCRYPTOC in config.hPatryk Duda2023-05-083-8/+2
| | | | | | | | | | | | | | | | | | | | | In config.h we define CONFIG_LIBCRYPTOC when CONFIG_ROLLBACK_SECRET_SIZE is defined. This way we are sure that rollback have an access to always_memset() function, used to securely clear buffers. However, if BoringSSL library is enabled we use OPENSSL_cleanse() function to clear buffers, so there is no need to enable libcryptoc. BUG=b:277029648 TEST=make BOARD=hammer TEST=make BOARD=prism TEST=make BOARD=bloonchipper TEST=make BOARD=dartmonkey Change-Id: Ibc1e276e221a015285f3b1946df23510a578577d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4513395 Tested-by: Patryk Duda <patrykd@google.com> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Commit-Queue: Patryk Duda <patrykd@google.com>
* rollback: Use OPENSSL_cleanse() when BoringSSL is enabledPatryk Duda2023-05-081-5/+14
| | | | | | | | | | | | | | | | | | Since we are switching from cryptoc to BoringSSL on some boards, we should support OPENSSL_cleanse() function provided by BoringSSL to avoid compiling and linking both libcryptoc and BoringSSL. BUG=b:277029648 TEST=make BOARD=prism TEST=make BOARD=hammer TEST=make BOARD=bloonchipper TEST=make BOARD=dartmonkey Change-Id: Ief5dc28adecaf33120094ba42e418144cdafe9e5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4383046 Reviewed-by: Tom Hughes <tomhughes@chromium.org> Tested-by: Patryk Duda <patrykd@google.com> Commit-Queue: Patryk Duda <patrykd@google.com>