summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfirmware-spring-3833.BBrian Norris2021-09-101-0/+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/+/3155255 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* stm32: Move KB_INPUTS to board.hDavid Hendricks2013-03-114-5/+6
| | | | | | | | | | | | | | | | This moves KB_INPUTS from keyboard_scan.c to board.h where KB_OUTPUTS is #defined. Although we use the same 13x8 keyboard matrix on all platforms, KB_OUTPUTS is defined on a per-board basis due to its usage in keyboard_test. BUG=none BRANCH=none TEST=locally compiled Change-Id: I0d66705d2959c7824b96cc8aae55368eca39a21a Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44970 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: finish cleaning up row/column/input/output namingDavid Hendricks2013-03-111-35/+33
| | | | | | | | | | | | | | | | | | | This is a purely cosmetic change that removes any remaining references of rows/columns in favor of inputs/outputs since the former is inconsistent across platforms. Higher-level code (such as MKBP) may still refer to logical rows and columns, but low-level GPIO handling code will refer to GPIOs by their input/output function. BUG=none BRANCH=none TEST=Tested on Snow (ran finger across all numbers and letters) Change-Id: Idb8b76e8d013568505d826c3a54a1ed8ce143d12 Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44982 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Dynamically generate keyboard IRQ maskDavid Hendricks2013-03-081-6/+17
| | | | | | | | | | | | | | | | | | | This replaces the hard-coded IRQ mask which has so far worked on Chrome platforms with a variable that gets set in the initialization part of keyboard_scan_task(). A simple loop is used to OR the GPIO mask for each keyboard input provided by the board's gpio_list array. This will make it easier to adapt the code to future targets with different pin mappings. BUG=none BRANCH=none TEST=Tested on Snow Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I848ab3c7e8d276dbb807a97c6b26c5b3c05af166 Reviewed-on: https://gerrit.chromium.org/gerrit/44952 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Fix ID_MUX polarityVic Yang2013-03-081-3/+3
| | | | | | | | | | | | | This reflects the change of the ID_MUX polarity. BUG=chrome-os-partner:18165 TEST=none BRANCH=none Change-Id: Iea126149f8785a0f028221463d197c63b39a3bd7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44945 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32f10x: Initial importDavid Hendricks2013-03-089-39/+123
| | | | | | | | | | | | | | | | | | | | | This adds initial support for the other chips in the stm32f10x series: stm32f101, stm32f102x, stm32f103x, stm32f105x, stm32f107x. The main difference is in the register definitions. Clock, flash, GPIO, and JTAG modules are similar enough that for now we can symlink the existing source for stm32f100. BRANCH=none BUG=none TEST=Tested on McCroskey (follow-up CL) Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I67363d02578e21be51d842b6bd8b5e4848720993 Reviewed-on: https://gerrit.chromium.org/gerrit/43412 Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: David Hendricks <dhendrix@chromium.org>
* spring: support new ID detection circuitVic Yang2013-03-082-11/+78
| | | | | | | | | | | | | This enables the EC to switch the signals to ANX7808 properly. BUG=chrome-os-partner:18165 TEST=Manual on reworked Spring board BRANCH=none Change-Id: Ib3ff57e17afab9ba8fc78fdb037e65aae844f38b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44897 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Rename CODEC_INT to ID_MUX.Jeremy Thorpe2013-03-072-9/+2
| | | | | | | | | | | | | | | | Rename CODEC_INT to ID_MUX and let it be settable on the EC command line. This GPIO line controls the ID line MUX in Spring. BRANCH=spring BUG=chrome-os-partner:16196 TEST=manual Change-Id: Ib29f31cf5dd28f5166236b5f98560543298b083b Signed-off-by: Jeremy Thorpe <jeremyt@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44531 Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: avoid AC bad when load suddenly increaseVic Yang2013-03-052-7/+28
| | | | | | | | | | | | | | | To avoid AC bad condition when system load suddenly increase, we should: - Keep VBUS voltage at reasonable level on battery assist - Allow PWM to bring VBUS voltage up before asserting AC bad BUG=chrome-os-partner:14319 TEST=Manual BRANCH=none Change-Id: I8058ffba9f91550f22408ea25911a1dded835584 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44612 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: switch default current limit mode to aggressive modeVic Yang2013-03-051-1/+1
| | | | | | | | | | | | | | Measurement result for aggressive mode looks good. Let's switch to it by default. BUG=chrome-os-partner:14319 TEST=Boot and check current limit mode. BRANCH=none Change-Id: I117170aaea8c3a3304dc27815ffb429fff2f22c7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44607 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Give the AP 30 sec warning before shutting down due to low batteryRandall Spangler2013-03-052-18/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows the AP to shut down cleanly. If it doesn't shut down in that time period, the EC will forcibly shut it down. BUG=chrome-os-partner:17124 BRANCH=link TEST=manual 1. With system off, - battfake 2 -> EC hibernates immediately 2. With system on, - battfake 2 -> battery shutdown event posted to AP - power off system manually within 30 sec -> EC hibernates 3. With system on, - battfake 2 -> battery shutdown event posted to AP - do not power off AP - after 30 sec, EC shuts down AP then hibernates 4. With system on, - battfake 2 -> battery shutdown event posted to AP - after 15 sec, apply AC power - system does NOT shut down - remove AC power -> battery shutdown event posted to AP (because battfake 2 is still faking 2% battery left) - after 30 sec, EC shuts down AP then hibernates (check to make sure the full 30 sec elapses; the timer should have been restarted when AC power was removed; if the EC shuts down the AP immediately this is a failure indicating the timer is still running from the first shutdown event) Change-Id: I1a13765f501d705d3a580b2acbbb173d47e020ff Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44413
* After shutting down AP, hibernate EC if battery is lowRandall Spangler2013-03-052-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This preserves more battery for the real-time clock. It also gets rid of one battery level/state, since the EC will now shut down at the same level (2%) as the AP. Having the EC hibernate at the same level as the AP shuts down also prevents the following weird scenario: - EC powers on at 2% battery. - EC won't power on the AP to do software sync because battery is low. - But the charge state machine won't actually hibernate the EC until 1%. - Between 2% and 1%, AC is inserted and system starts charging. - But EC-RO is what's doing the charging; we should go through software sync before charging. BUG=chrome-os-partner:17124 BRANCH=link TEST=manual On battery power, 1) With system on, battfake 2 -> system shuts down and EC hibernates 2) With system off, battfake 2 -> EC hibernates Change-Id: I87d17f70d60673f3e3f1c6eb88f3f00a8c9ed4e7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44314
* Wait to power on system until battery state is knownRandall Spangler2013-03-052-14/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This prevents the system from waking from hibernate at very low battery, then powering on the AP to do software sync only to find that the charge state machine shuts down the AP before software sync can complete. BUG=chrome-os-partner:17124 BRANCH=link TEST=manual On both AC and mostly-charged battery: - With lid open, reboot EC -> on - With lid open, reboot EC with power held down -> on - With lid closed, reboot EC -> system boots and does EC software sync - With system on -> battfake 2 shuts system down (and at that point, opening lid or pressing power does nothing) With a hacked charge_state.c so fake_state_of_charge starts at 2: - With lid open or closed, reboot EC -> off - Opening lid does not turn on system - Pressing power button does not turn on system - Plug power back in and press power -> system turns on Change-Id: Ie1f2933060fac87b1afe68718f374d51cb8994de Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44313
* spring: battery LED breath yellow on battery assistVic Yang2013-03-043-9/+133
| | | | | | | | | | | | | | When in battery assit mode, show breathing yellow on battery LED slowly to indicate battery is actually discharging. BUG=chrome-os-partner:17561 TEST=Manual BRANCH=none Change-Id: I688470d8870b181bf2dd20b5ebcbd6e2d861c5b0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44514 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: set maximum allowed duty cycleVic Yang2013-03-041-0/+3
| | | | | | | | | | | | | | We should allow a minimum amount of current input in case the battery is dead. BUG=chrome-os-partner:14319 TEST=Boot with a dead battery BRANCH=none Change-Id: I3c172d43c8190ed2dc5d421dcf2b5aaf0e88ecd9 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44510 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add reinit state to charge_state module to distinguish it from at-ec-boot initRandall Spangler2013-02-283-32/+43
| | | | | | | | | | | | | | | | | | | | | This is a precursor to changing the switch state machine to delay powering on the AP until the charge_state module knows if there's enough power to do so (which it will know when it leaves the INIT state). BUG=chrome-os-partner:17124 BRANCH=link TEST=manual 1. Reboot EC on battery power. See charge state init->discharging 2. Plug in AC. See charge state discharging->reinit (charge state will then transition to some other charging or idle state based on battery level) Change-Id: Ia02cc8b37e9b5e8d6dd8c2fbfdf14e385694b1bf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44291 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* temp_metrics: use iotools wrmsr instead of wrmsrSameer Nanda2013-02-261-3/+3
| | | | | | | | | | | | | | | | | Use the "iotools wrmsr" command instead of the wrmsr alias since iotools ebuild no longer installs the symlinks by default. BUG=chromium-os:39180 TEST=On a Pixel issue "sudo start temp_metrics" and check /var/log/messages to ensure that no new messages such as "init: temp_metrics main process ended, respawning" show up. BRANCH=none Change-Id: I46cd8770c7e6c1af1affe8e2100033a29b9a90bb Signed-off-by: Sameer Nanda <snanda@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/44073 Reviewed-by: Luigi Semenzato <semenzato@chromium.org> Reviewed-by: Mike Frysinger <vapier@chromium.org>
* keep ADC reference voltage on between successive readsVincent Palatin2013-02-254-14/+27
| | | | | | | | | | | | | | | | | | | | | To decrease the amount of time needed for PMU ADC reads, add the option to keep the ADC reference voltage enable as its stabilization time is the longest pole. Also set the stabilization time to 10ms as the max defined in the datasheet. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:17997 TEST=on Spring, measure EC_CMD_POWER_INFO latency and see it going from 49ms to 18ms. Change-Id: I7ed20bcddab165250108eb9f768539b19fa251de Reviewed-on: https://gerrit.chromium.org/gerrit/44008 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Allow TSU6721 auto mode under any conditionVic Yang2013-02-251-1/+1
| | | | | | | | | | | | | | Although TSU6721 cannot go manual mode under certain conditions, it is able to go auto mode no matter what. BUG=chrome-os-partner:14318 TEST=Manual on Spring. BRANCH=none Change-Id: Iba8b9bf815a4c0e5a3462e72c4afe85571845d33 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43864 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: a more aggressive current control approachVic Yang2013-02-251-3/+89
| | | | | | | | | | | | | | | | Currently we stop raising current input when a predefined limit is reached. To take advantage of high power charger, we now push the limit and detect over current shut off if any. This allows us to detect the actual current limit of the charger. BUG=chrome-os-partner:14319 TEST=Manual on Spring BRANCH=none Change-Id: I5aefd8c0ac02bd0ca9920e861a4fa62fc6e588e5 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43863 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: minimize the window that loses TSU6721 interruptVic Yang2013-02-253-2/+20
| | | | | | | | | | | | | | | Since TSU6721 processing is integrated into PMU task, an interrupt closely following previous one may be dropped. We should check interrupt status before yeilding control. BUG=chrome-os-partner:14319, chrome-os-partner:14318 TEST=Boot on Spring. Check TSU6721 functionality. BRANCH=none Change-Id: I7ce1c70a214bb4afc9456eb206203cc6c3fe2f33 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43862 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Change the I8042_CMD_ENABLE (0xf4) for keystroke (not for KBC).Louis Yung-Chieh Lo2013-02-231-5/+16
| | | | | | | | | | | | | | | | | | | | | | Old code treat following commands as the same: 1. I8042_CMD_ENABLE in include/i8042_protocol.h 2. I8042_ENA_KB (0xae) in include/i8042_protocol.h 3. bit 4 of command byte, see I8042_KBD_DIS in include/i8042_protocol.h New code changes 1 in keystroke_enabled variable. Signed-off-by: Yung-Chieh Lo <yjlou@chromium.org> BUG=chrome-os-partner:17005,chrome-os-partner:17810 BRANCH=link TEST=Tested vincent's script with following scenario: 1. not-workarounded kernel: PASS more than 2767, 2946, and 7300 loops. 2. workarounded kernel: PASS more than 5000 loops. Change-Id: I879a1b1f0186594e4b9dd7fc4320232ebab4a1e1 Reviewed-on: https://gerrit.chromium.org/gerrit/43006 Commit-Queue: Yung-Chieh Lo <yjlou@chromium.org> Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org> Tested-by: Yung-Chieh Lo <yjlou@chromium.org>
* spring: Avoid picking up USB power from APVic Yang2013-02-221-6/+21
| | | | | | | | | | | | | | | When powered device is removed, VBUS is still powered by the AP. We should turn off power from AP and let it settle before we sense external VBUS input. BUG=chrome-os-partner:14319 TEST=Manual on Spring BRANCH=none Change-Id: Ie868a3df27e395c948ba8c6342e84764d182ce82 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43779 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Tweak current limit and voltage thresholdVic Yang2013-02-211-6/+6
| | | | | | | | | | | | | | Fine tune current limit and voltage threshold so that we don't hit current limit so easily. BUG=chrome-os-partner:14319 TEST=Manual on Spring BRANCH=None Change-Id: Ia9ccd13b9e7eac7cdee83d0f488a1a83c27318c0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43716 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Handle AP VBUS powerVic Yang2013-02-212-2/+4
| | | | | | | | | | | | | | The VBUS power from AP is now incorrectly recognized as AC source. Let's gate this with device type and BOOST_EN. BUG=chrome-os-partner:14319 TEST=Manual BRANCH=None Change-Id: Id8127ab6f85fb25adfadb1c2bef4c753a58cdc4f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43709 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Handle dead battery and booting with low power chargerVic Yang2013-02-203-1/+26
| | | | | | | | | | | | | | | | This tweaks initial PWM configuration so that: - When battery is dead, more current is allowed to sustain the system. - When EC boots with a low power charger, input current is throttled so as not to kill the charger. BUG=chrome-os-partner:14319 TEST=Manual BRANCH=none Change-Id: Ib52894b07fecdd533aecab312f40afa0b6df5676 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43600 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Add current limit loopVic Yang2013-02-202-4/+70
| | | | | | | | | | | | | | This monitors input voltage and adjust current limit accordingly to keep voltage in acceptable range. BUG=chrome-os-partner:17881 TEST=Manual on spring BRANCH=none Change-Id: Ie4b44844983f622ef7f648cf022c3c093597246c Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43511 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Add host command to read power infoVic Yang2013-02-197-4/+149
| | | | | | | | | | | | | | Getting voltage and current can be handy when verifying hardware design. Let's add host command to do this. BUG=chrome-os-partner:17880 TEST=Manual on Spring BRANCH=none Change-Id: I4d4f6a42a9d0f917292d092e132ccd9ce3367fd6 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43508 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* assert ENTERING_RW only if it existsDavid Hendricks2013-02-191-0/+2
| | | | | | | | | | | | | | | | | This adds an #ifdef to fix compilation for boards which do not have ENTERING_RW (such as McCroskey). BUG=none BRANCH=none TEST=Tested on McCroskey Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: Ic5577753edafd7fc249b8c23ab84e8c355a348e7 Reviewed-on: https://gerrit.chromium.org/gerrit/43413 Commit-Queue: David Hendricks <dhendrix@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org> Tested-by: David Hendricks <dhendrix@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Unify dut-control command.Todd Broch2013-02-131-3/+5
| | | | | | | | | | | | | | | | | | | | Previous CL included --port but I neglected one invocation. Better to just unify how dut-control is called with a global. BRANCH=none BUG=none TEST=manual, ./util/flash_ec --board spring - device connected to servod @ port 9999 is successfully flashed ./util/flash_ec --board spring --port 9902 - device connected to servod @ port 9902 is successfully flashed Change-Id: I9cf57d0ddd94cf825d3015f9768effffca94eaf2 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43222 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Allow flashing of EC binary from host with multiple servod invocations.Todd Broch2013-02-131-4/+7
| | | | | | | | | | | | | | | | | | | | Adds argument --port to provide ability to flash from host that has multiple servos running. BRANCH=none BUG=none TEST=manual, ./util/flash_ec --board spring - device connected to servod @ port 9999 is successfully flashed ./util/flash_ec --board spring --port 9902 - device connected to servod @ port 9902 is successfully flashed Signed-off-by: Todd Broch <tbroch@chromium.org> Change-Id: Iecc4b8df51236a1f21be5feca8bb87f5a1d03e97 Reviewed-on: https://gerrit.chromium.org/gerrit/43182 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: always enable the PP3300_WWAN railVincent Palatin2013-02-132-4/+5
| | | | | | | | | | | | | | | | | | | | The kernel driver to control the 3G modem LDO is not submitted yet. Let's hardcode it for now to enable RF testing and revert this patch later. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:17790 TEST=on Spring, boot and dump the TPS65090 configuration from the EC command line by using "pmu" command. See 0x1f in the register 0x11 for FET3. Change-Id: I29aa7d1d7fb819ff1881a756e9592e272e87ad0b Reviewed-on: https://gerrit.chromium.org/gerrit/43181 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* tps65090: update LDOs configurationVincent Palatin2013-02-131-1/+3
| | | | | | | | | | | | | | | | | | | | | | Match the configuration on Snow : - set overcurrent timeout to 3200us (max) (to avoid triggering the protection on initial inrush current) - properly enable the auto-discharge feature (we need it when the LDOs are turned OFF) Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:17790 chrome-os-partner:17804 TEST=on Spring, boot and dump the TPS65090 configuration from the EC command line by using "pmu" command. See 0x1f in registers 0x0f and 0x14 for LCD and Backlight LDOs. Change-Id: I20b0cb11d7abb890e921816e75e8ed816ca4f2d4 Reviewed-on: https://gerrit.chromium.org/gerrit/43180 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Add console command to fake battery state of chargetoolchain-3701.42.Bstabilize-3701.81.Bstabilize-3701.46.Bstabilize-3701.30.0bstabilize-3701.30.0release-R26-3701.BRandall Spangler2013-02-122-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new 'battfake' command is really handy for testing low-battery shutdown logic. BUG=chrome-os-partner:17124 BRANCH=link TEST=from EC console: reboot battfake -> using real battery level power on system -> lightbar should be blue battfake 5 lightbar turns red after a few seconds UI shows battery is very low (shows <5% due to different kernel math) 'ectool battery' from root shell shows present capacity ~5% of design capacity remove AC power battfake 4 UI shows low-battery screen and shuts down (may take a minute) battfake 50 power on system UI shows battery at 45-55% battfake 2 -> system shuts down immediately battfake -1 power on system UI shows actual battery level Change-Id: I3180e321241c0f586f3baad2150fb6a2b2d2e242 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43151 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Rename and document battery constantsRandall Spangler2013-02-123-32/+28
| | | | | | | | | | | | | | | | | | | | | In preparation for cleaning up low-battery logic. Make clear what comparison operator is used for each constant (<=, <, >=, >). Also remove hard-coded and unused display of design warning/low battery levels from ectool. Verified via code search that these are not used anywhere. Even if we later care about these levels, they should be battery-specific and not hard-coded as a platform-independent percentage of full capacity when ectool is compiled. BUG=chrome-os-partner:17124 BRANCH=link TEST=compile link; 'ectool battery' from root shell prints valid info Change-Id: I3650e27a08f4cc77067beb0685ee1488cc56d02f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43119 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* link: If a required power rail drops, shut downRandall Spangler2013-02-121-4/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | This protects the system from ending up in a weird state if one of the rails fails to come up, or shuts down after coming up. BUG=chrome-os-partner:17774 BRANCH=link TEST=manual - Boot system - From EC console: gpioset enable_1_5v_ddr 0 - System shuts down; EC console prints "x86 power lost input" - Press power button; system turns back on - From EC console: gpioset enable_vs 0 - System shuts down; EC console prints "x86 power lost input" - Press power button; system turns back on - Suspend system - From EC console: gpioset enable_1_5v_ddr 0 - System shuts down; EC console prints "x86 power lost input" - Press power button; system turns back on Change-Id: I8ae1630deb4001716b8dfd89d7dec7300cddb5ae Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/43097 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* spring: Distinguish Apple Chargersstabilize-bluetooth-smartVic Yang2013-02-073-18/+61
| | | | | | | | | | | | | This uses D+/D- voltage to distinguish different Apple chargers. BUG=chrome-os-partner:14319 TEST=Manual on Spring BRANCH=none Change-Id: I50075d466f6e6b1adf613748cf433d7f43c04bfe Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42850 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Lengthen ADC sample timeVic Yang2013-02-061-4/+4
| | | | | | | | | | | | | | Current sample time 1.75us seems too short and some nets with weaker driver don't convert correctly. Let's lengthen it to 8.75us. BUG=chrome-os-partner:14319 TEST=See correct voltage level. BRANCH=none Change-Id: Ib65a07474787504e5f72522167bafad8bb5730bc Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42845 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32mon: add back flashing progressionVincent Palatin2013-02-061-8/+9
| | | | | | | | | | | | | | | | | | | As we no longer have the low-tech dots to show the progression of the on-going flashing, display a completion percentage to give the user a hint of the ETA. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=./util/flash_ec --board=spring and see accurate progression percentage reported. Change-Id: I75ccbe3433acd6c94d03a08bf462ea4516e4ce02 Reviewed-on: https://gerrit.chromium.org/gerrit/42733 Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
* spring: Tweak battery LED policyVic Yang2013-02-051-2/+4
| | | | | | | | | | | | | | | | When battery is nearly full, we sometimes see: - Battery asks for no current, but slowly discharge (5-7 mA) - Battery asks for current, but not charging. For these cases, we consider the battery full and show green LED. BUG=chrome-os-partner:17561 TEST=Manual BRANCH=none Change-Id: I2808d4c1a89d37000244fb308197cdef473ec5be Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42688 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Limit USB port currentVic Yang2013-02-051-2/+24
| | | | | | | | | | BUG=chrome-os-partner:14319 TEST=Attach different chargers and see corresponding PWM duty cycle set. BRANCH=none Change-Id: I10c6e28ddf5a959849a6f14d9ca3894be4f16e30 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42691
* Mask 'tags' in .gitignoreVic Yang2013-02-051-0/+1
| | | | | | | | | | | | | | If ctags is used, git complains about uncommitted 'tags'. Let's add it to .gitignore. BUG=None TEST='git status' and doesn't see git complain about 'tags'. BRANCH=none Change-Id: I6026e83b1537eb61439f22a0b09dccb07283c820 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42689 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: implement SMBUS-style read block/stringVincent Palatin2013-02-051-3/+19
| | | | | | | | | | | | | | | | | | | | | Add support in the I2C driver for SMBUS-style read block operations. As defined by the SMBUS standard, a "read block" returns at most 32 bytes of data plus the size of response as the first byte. It's used to read smart battery strings such as manufacturer or model. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14314 TEST=On Spring, read the battery manufacturer and model from a kernel patched for the smart-battery passthrough. Change-Id: I069ce7f64414817e94516e913643d3847a29d176 Reviewed-on: https://gerrit.chromium.org/gerrit/42647 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Control battery LEDVic Yang2013-02-055-17/+90
| | | | | | | | | | | | | | | | | This implements a basic battery LED policy: - Charged: green - Charging: yellow - Error: red - No charger: off BUG=chrome-os-partner:17561 TEST=Manual BRANCH=none Change-Id: I7fa8242efa4d0382d8ef0cafe80f01d44c390397 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42607 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Modify stm32mon to better suite autotest useVadim Bendebury2013-02-051-17/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces the following modifications: When used outside chroot on Goobuntu the serial interface fails to initialize if parity enable bit is set (for a reason not clearly understood). On top of that the tcsetattr() return value of zero is not a guarantee of success. To be sure that the settings came through one is supposed to read back the driver config and compare it with the desired config. To add insult to injury, gPrecise driver rejects attempts to enable parity. Parity setting is not essential in many cases, this is why we check the actual config and if the only missing setting is parity we print a warning message and continue. In case an operation fails, the exit value should reflect that (so that the autotest suite using the utility could report failure). Often when the programming attempt is undertaken soon after reset, this utility gets overwhelmed with the console output generated by the EC on resets. Consume the output before proceeding. Instead of printing a long set of dots (one per written/read block), print a spinning wheel instead. BRANCH=None BUG=chrome-os-partner:15610 TEST=manual . used the utility to program Snow EC both inside and outside chroot, it succeeded. Observed the failing attempt to set parity when running outside chroot. Observed spinning characters instead of stream of dots. Change-Id: Id25595d35a2a3ca578639cebd508f599e618787c Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42310 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Change PWM frequencyVic Yang2013-02-051-1/+1
| | | | | | | | | | | | | | Current frequency is too low. Change it to 10kHz. BUG=chrome-os-partner:17585 TEST=none BRANCH=none Change-Id: I0ba21bcb6fe52b62f53a621acd220a646dbb9974 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42620 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Tweak lp5562 driver interfaceVic Yang2013-02-052-7/+14
| | | | | | | | | | | | | | This makes it possible to define color constants so as to reduce code size when called. BUG=chrome-os-partner:17561 TEST=Build success. BRANCH=none Change-Id: I800b8d4b84749907b071febfea58d27fef7cc2b7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/42617 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32mon: add ID for stm32f102r8stabilize-3658.0.0David Hendricks2013-01-301-0/+1
| | | | | | | | | | | | | | | | | | This adds a table entry for stm32f102r8. BRANCH=none BUG=none TEST=ran flash_ec successfully on an stm32f102r8 (see notes below) ChipID 0x410 : STM32F102R8 Bootloader v2.2, commands : 00 01 02 11 21 31 43 63 73 82 92 Flash erased. Writing 65536 bytes at 0x08000000 ... (many more dots) ...Done. Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I1f4af0413a4df2c09a1043bdc78a429b79c28533 Reviewed-on: https://gerrit.chromium.org/gerrit/42270 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Add LP5562 driverVic Yang2013-01-214-0/+128
| | | | | | | | | | | BUG=chrome-os-partner:17341 TEST=Set LED color on Spring board BRANCH=none Change-Id: Ibae11a0cf8a724a38e96c5c49952799101bb5764 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/41693 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add a pass-through for the smart batteryVincent Palatin2013-01-192-0/+112
| | | | | | | | | | | | | | | | | | | Allow to send commands to the smart battery using EC commands when the battery is connected to an I2C bus behind the EC. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:14314 TEST=on Spring, with a kernel including patch to use the pass-through for the sbs-battery driver, run "power-supply-info" and see the correct information. Change-Id: Ie10f1c95afe4a33cf0b55d5a0de7640d5971ebb3 Reviewed-on: https://gerrit.chromium.org/gerrit/41289 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>