summaryrefslogtreecommitdiff
path: root/include/extpower.h
Commit message (Collapse)AuthorAgeFilesLines
* dedede: Rework `extpower_is_present()`Aseda Aboagye2021-05-191-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | The dedede boards erroneously assumed that if VBUS was present, then "extpower" was present. "extpower" is generally connected to the ACOK signal for the battery charger IC. It indicates that the voltage present at the switching node is valid for bucking or boosting. For our Type-C systems, this needs to be at least 4V. However, just because VBUS is present doesn't mean that the voltage is present at the switching node. The FETs on the selected charge port needs to be enabled first. This commit simply changes the logic to check the battery charger ICs' ACOK status to reflect whether extpower is present. BUG=b:187965740 BRANCH=dedede TEST=Build and flash drawcia and madoo, verify that "AC on" prints are emitted when the charge port is selected and not just when VBUS appears on the port. Signed-off-by: Aseda Aboagye <aaboagye@google.com> Change-Id: If5a4a10d502f2f08ccf1d3228e42f48fa6d45909 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2901254 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* extpower: replace header with forward declCaveh Jalali2020-11-191-1/+1
| | | | | | | | | | | | | this replaces the inclusion of "common.h" in favor of a forward declaration for enum gpio_signal. BRANCH=none BUG=none TEST=buildall Change-Id: I3ca832c1bec3bea6d38b1955e101fcab841d1b6a Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2546801
* extpower: Add helper function extpower_handle_updateFurquan Shaikh2020-06-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a helper function extpower_handle_update() that performs all the necessary actions that need to be done on external power state change: 1. Call hook_notify with AC_CHANGE 2. Update memmap_batt_flags to update EC_BATT_FLAG_AC_PRESENT 3. Set host event for EC_HOST_EVENT_AC_CONNECTED or EC_HOST_EVENT_AC_DISCONNECTED. Step#2 above is important because it ensures that the memory map flag is correctly updated when host reads it. Before this change, it was observed that EC_BATT_FLAG_AC_PRESENT is updated only when static/dynamic battery information gets updated. This could result in host reading the wrong AC state if battery information did not update before host acts on the host event bit getting set for AC connect/disconnect. BUG=b:157752693 BRANCH=None TEST=Verified on trembyle that EC ASL routines read the correct state of AC present flag on receiving host event. Signed-off-by: Furquan Shaikh <furquan@google.com> Change-Id: I077de1135320654f571e5cf87ced6f08cbf23876 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242353 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Auto-Submit: Furquan Shaikh <furquan@chromium.org>
* LICENSE: remove unnecessary (c) after CopyrightTom Hughes2019-06-191-1/+1
| | | | | | | | | | | | | | | | Ran the following command: git grep -l 'Copyright (c)' | \ xargs sed -i 's/Copyright (c)/Copyright/g' BRANCH=none BUG=none TEST=make buildall -j Change-Id: I6cc4a0f7e8b30d5b5f97d53c031c299f3e164ca7 Signed-off-by: Tom Hughes <tomhughes@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1663262 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Remove obsolete board-specific codeRandall Spangler2015-06-101-10/+0
| | | | | | | | | | | | | | | | | Now that we've removed boards from ToT, also delete board-specific code used only by the removed boards. There are still more things to remove (unused charging chips, LED drivers, COMx support). More CLs coming. BUG=chromium:493866 BRANCH=none TEST=make buildall -j Change-Id: Ie6bdeaf96e61cadd77e3f6336c73b9b54ff4eabb Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/276524 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Rename extpower_usb to extpower_springVic Yang2013-08-281-3/+3
| | | | | | | | | | | | | | | | | | | The ID detection and charging circuits on Spring are very different from that on Kirby. PWM current limit is no longer used. The ID detection sequence is also different. Also, there is no boost circuit on Kirby. Given those hardware issues that we had to work around on Spring, it's unlikely that we will have another board that shares the same/similar ID detection design with Spring. Let's rename extpower_usb to extpower_spring to better reflect this. BUG=None TEST=Build and boot Spring. BRANCH=None Change-Id: I7c212a121eed55665593cb7e1b2b672891819940 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/67031
* Add turbo mode charger support, and tests for it.Bill Richardson2013-07-251-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some chargers can run in a "turbo" mode, which lets it draw from the battery to provide extra power to the AP in short bursts. In order for this to work properly, the EC has to watch the current closely to make sure specific limits are observed. It also has to recognize specific adapters, since those limits vary depending on the rated power that the adapter can provide. This adds the basic functionality, plus a test for it. BUG=chrome-os-partner:20739 BRANCH=falco,peppy TEST=manual make BOARD=${BOARD} runtests On Falco, you can also use the "adapter" EC command to see what's going on. Try replacing the adapters and running that command to be sure they're correctly identified, too: > adapter Adapter 65W (590mv), turbo 1, AP_throttled 0 > We currently support 45W, 65W, and 90W adapters. Unknown adapters are treated as 65W, but don't enable turbo mode. Change-Id: I7e5407db825ce7e596cb495fb8cb4d1dd1ff639c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/63372 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clean up USB external power moduleRandall Spangler2013-04-101-0/+5
| | | | | | | | | | | | | | | | | | | | Make internal APIs static, and remove board_ prefix for clarity. Move TSU6721 calls from charger task to extpower_usb functions for better encapsulation. No functional changes, just moving code. Yes, this will make cherry-picking back from spring to TOT less convenient, but now the code is more readable and it will make maintaining the PMU code easier as we add boards. BUG=chrome-os-partner:18343 BRANCH=none TEST=build spring Change-Id: I52b37e57fc8519859996a110b0503277c6f0bbc8 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/47657
* Move external power detect for link to its own fileChromeOS Developer2013-03-191-0/+25
Now that it doesn't need to leverage SWITCH_TASK to send the AC_CHANGE notification, pure GPIO-based external power detection can move from switch.c to its own file. BUG=chrome-os-partner:18256 BRANCH=none TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away Change-Id: Id495f34185b7d971c241ac6d0a8311a6bf544507 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/45789