This includes:
- Discharging with AC present now recognized as battery assist mode
- Trigger LED update every second instead of from PMU task
- Minor breathing effect optimization
- Control LED power and color from the same task to prevent
simultaneous access to LED driver
BUG=chrome-os-partner:18244
TEST=Manual
BRANCH=spring
Change-Id: I9b34934f46cd4f04aaa7ca30cbe90316aec3e61e
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45632
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Code cleanup; use the same function names to mean the same thing
across boards. No functional changes; just renaming.
BUG=none
BRANCH=none
TEST=build daisy,snow,spring
Change-Id: Icbb4cfda5f5f9ba0cbbc07fee622e9c21af3f8cd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45867
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: David James <davidjames@chromium.org>
Rename tasks
TICK -> HOOKS
The hooks task handles more than just the TICK hook now.
X86POWER -> CHIPSET
GAIAPOWER -> CHIPSET
Kinda kludgy that the name of the task controls which chipset source gets
included. Change this to a CONFIG_CHIPSET_{X86,GAIA} #define to make it
easier to support future chipsets. Also, rename the task function to
chipset_task() so ec.tasklist is chipset-agnostic.
No code changes, just renaming constants and functions.
BUG=none
BRANCH=none
TEST=build bds,link,daisy,snow,spring
Change-Id: I163ce1cd27b2d8d030d42bb1f7eb46b880c244fb
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45805
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
Using code like this, modules which service interrupts and notify
hooks will no longer need to have their own tasks to call
hook_notify() from. They can share the hook task as long as they
don't mind the notification possibly being deferred.
BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away
Change-Id: I1bc32d21b2202c3242d39e0fc533198cd5bb9c66
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45780
Modules that need to find out about charge/power state no longer need
to use the lower-level switch API.
(This will matter more in future CLs which handle conditions like
"external power present, but at low power so we're doing battery
assist" - that can simply be state=discharging,flags=external_power_present.
BUG=chrome-os-partner:18256
BRANCH=none
TEST=add AC power, UI shows charging indicator; remove AC, indicator goes away
Change-Id: I62130a4e089297fa47ab03f6a76082593c936761
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45515
Reviewed-by: Vic Yang <victoryang@chromium.org>
No code changes, just renaming to make the filename more useful.
BUG=chromium-os:18256
BRANCH=none
TEST=build link. Plug in AC. See plug LED come on.
Change-Id: I00d9f222de0b097bb68ef235bc6b0015e4c62f7e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45494
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
The power LED now has its own tick-based handler which knows how to
blink the LED and resend the desired LED state to work around the
flaky 1-wire connection.
Removes a bunch of LED state code from charge_state.c.
No user-visible impact. Does not need to go into link branch.
BUG=chromium-os:18256
BRANCH=none
TEST=manual
1) Discharge battery to <97%
2) Plug in AC. LED=yellow
3) 'ectool chargeforceidle 1' from root shell. LED=blinking green/off.
4) 'ectool chargeforceidle 0' from root shell. LED=yellow.
5) Wait for battery >= 97% (or 'battfake 98' from EC console). LED=green.
6) Unplug battery. LED=red (may take 10 sec).
7) Replug battery. LED=green.
Change-Id: I999ee3e1abe269bb3f737bbc75e0b872316605ce
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/45469
Reviewed-by: Vic Yang <victoryang@chromium.org>
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
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
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Allow to send commands to switch on/off the TPSchrome LDOs by using EC commands
when the TPSchrome chip 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 an updated bootloader, switch on screen FETs from
U-Boot instead of hardcoding them in the EC board code.
Change-Id: Ic6cebf04ba73a7c0ca2c54f532f8cf4c953ac0c1
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41288
Reviewed-by: Vic Yang <victoryang@chromium.org>
To make test and bring-up easier, adds a host command for USB mux
switching.
BUG=chrome-os-partner:17111
TEST=manual
BRANCH=none
Change-Id: I9da43fe934881ce24f326275ef312c4e6a474f11
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40586
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This adds USB port control to charger task. For now, it only senses
attached device type and log it to console.
BUG=chrome-os-partner:14319
TEST=Attach/detach charger and see console output.
BRANCH=none
Change-Id: I1218d520c292d9d398c868122ae3876d3fc889bc
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40078
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This is a prepartory work for integrating USB port control into PMU
task.
Currently TPS65090 charger task is throttled to only waken by event once
per 500 ms. This in a way makes it hard to integrate other functionality
into this task. This CL moves the throttling mechanism to interrupt
handler so as to provide better control of when to throttle the
interrupt event.
BUG=chrome-os-partner:14319
TEST=Build success and boot on spring.
BRANCH=none
Change-Id: I72e63180442b379a379e1a87c10ef62395434872
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40189
Reviewed-by: Rong Chang <rongchang@chromium.org>
This adds functions to control interrupt and get device type from
TSU6721.
Also expose initialization function so that we can initialize TSU6721
before we solve the initialization problem.
BUG=chrome-os-partner:14318
TEST=Build success.
BRANCH=none
Change-Id: Ia50f1c93309360d35902a707090694e94a3f7a74
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40077
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
We have yet another tweak for the lightbar, but we don't want to update the
EC. This CL adds an init script that runs on the AP at every boot and pokes
the EC to modify the lightbar settings. We have to run it at every boot
because the EC will hibernate after the AP has been off (not suspended) for
an hour on battery power and will lose its settings.
There's a corresponding CL for the ec-utils ebuild that installs the
userspace scripts into the rootfs.
BUG=chrome-os-partner:16827
BRANCH=link
TEST=manual
Build the image for Link, install, reboot.
Run "ectool lightbar params". The output should match what's in
/usr/share/ec/lightbar_params.txt
Change-Id: If50ac2ef2432f7d60cdaf4c222b68dbdee80b2ec
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39979
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
for now, just control the USB pins muxing.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=none
BUG=chrome-os-partner:14318
TEST=on Spring, put the EC UART on the micro-B connector and read it
using a modified FTDI cable.
Change-Id: Ib0c87e483fb0bbe1835bd6ea008176b88d6f12f8
Reviewed-on: https://gerrit.chromium.org/gerrit/38361
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
If the entire flash is protected (as it normally is after software
sync), fail all flash write/erase operations.
Add a shadow copy of the all_now flag.
BUG=chrome-os-partner:16727
BRANCH=link
TEST=manual
Verify that flash operations work properly before all_now. Then enable HW WP
and
flashwp enable
flashwp now
and try
flasherase 0x38000 0x1000
flashwrite 0x38000 0x100
Those commands should fail with error 7
From the host side
ectool flasherase 0x38000 0x1000
echo 'Khaaaaaaaaaaan' > /tmp/b16727
ectool flashwrite 0x38000 /tmp/b16727
should also fail.
Change-Id: I99a4d2bb86080bd12c900582a8fbdfc79c99916c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39517
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This works around a problem where disabling +5VALW glitches +3VALW_EC,
which may cause the EC to brown out or hang.
BUG=chrome-os-partner:16600
BRANCH=link
TEST=manual
1. When the system boots, look for this line as the first x86 power state:
[0.004977 x86 power state 0 = G3, in 0x0001]
2. Boot the system. Should boot normally.
3. Shut down the system using the power button.
4. After ~10 seconds, you should see that line of output again.
5. At the EC console: 'gpioget enable_5valw' should output:
1* ENABLE_5VALW
This should ideally be combined with a hardware fix to add 30+ ms of
delay to EC_EN_5V, since when the EC is reset via power+refresh that
tri-states EC_EN_5V, and it takes ~22ms for the EC to boot and start
driving EC_EN_5V again.
Change-Id: Iba4d961d064105faf988a35c2277e9d7406e39e2
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39334
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
1) Properly report I2C errors on TMP006 as error, not device-not-powered.
2) Treat clock timeout and bus-busy I2C status as error (previously ignored).
3) If clock timeout or bus-busy, reset I2C master for that bus to clear the
error.
These should help with systems where the thermal I2C bus gets into a
weird state on suspend/resume.
BUG=chrome-os-partner:16262
BRANCH=link
TEST=boot system; 'battery' and 'temps' should give good info
Then run snanda's suspend_stress_test for a while and repeat.
Change-Id: I534be8236a4d6de82575fe6d33a68502ce0a3a95
Original-Change-Id: Iec5d6bbd357d2e5eb3dc3d361c829f353e996ab6
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38444
Reviewed-on: https://gerrit.chromium.org/gerrit/38659
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Add an interface to allow the CPU to cap the maximum battery charging
current.
The maximum is removed every time the machine goes to S3 or S5.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=link
BUG=chrome-os-partner:16041
TEST=on Link, plug AC to charge the battery,
then run "ectool chargecurrentlimit 1200" and see
the charging current in "power-supply-info" decreasing to 1.2 A.
Change-Id: I10900e1c264d2db67809638ec0dcb836d721fa75
Reviewed-on: https://gerrit.chromium.org/gerrit/37532
Reviewed-by: Sameer Nanda <snanda@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
When the system is in S5, it will go to hibernate mode after 1 hour
instead of 24 hours.
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
BRANCH=link
BUG=none
TEST=on Link DVT3 with servo connected, turn off the machine and
see the EC going to hibernate after 1 hour (according to EC UART traces)
start the machine and see it boot properly.
Change-Id: I1da87b3e09b90817ce5609f3f74b5969235fb90a
Reviewed-on: https://gerrit.chromium.org/gerrit/37526
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Add i8042 output port commands (0xf0-0xff), I8042_ENABLE_A20 and
I8042_DISABLE_A20.
BUG=chrome-os-partner:13119,
BRANCH=None
TEST=Tested on W7 installer. No KB error shown on EC console.
Change-Id: I9ad1fd7baa10683ef18ccf13faf09dc0cefcca0a
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34994
Reviewed-by: Stefan Reinauer <reinauer@chromium.org>
They're not x86-specific, so move to the chipset interface.
BUG=chrome-os-partner:15579
BRANCH=none
TEST=x86reset warm, then x86reset cold. Should reboot OS in each case.
Change-Id: Ib571ab916bab16179198a0d054320e59afbae124
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36785
This reduces memory / code size, and gets rid of ifdefs in temp_sensor.c.
BUG=chrome-os-partner:15714
BRANCH=none
TEST=boot system and run 'ectool temps all' every few seconds
- ectool temps all
The numbers should update over time.
Change-Id: Idaac7e6e4cbc1d6689f5d3b607c623a5cc536a4f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36940
The time out value passed to task_wait_event() is signed 32-bit and
thus waiting for 24 hours will cause overflow. Limit max wait time.
BUG=chrome-os-partner:15797
BRANCH=link
TEST=Disconnect AC, shut down system, and close lid. From ec console,
do 'hibdelay 8000' and then wait 2.5 hours. EC should have
hibernated. (8000 is more than twice the max time for
task_wait_event())
Change-Id: I5fa505554182e8bad6399c12a382ff71bb123d8f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37095
Reviewed-by: Vic Yang <victoryang@chromium.org>
Support the keyscan test functionality on stm32.
Note: This is enabled by default so that it continues to build. But it
is unlikely that we will want this in a shipping image. I suggest we add
the facility for a dev build.
Secondly, the stack has to be larger due to a printf (which admittedly I
could just remove). Should we make the stack size conditional on the
CONFIG? Seems a bit ugly, on the other hand we don't want to waste IRAM.
BUG=chrome-os-partner:12179
BRANCH=none
TEST=manual for now:
On snow:
./ectool keyscan 20000 key_sequence.txt
See that the test passes.
Change-Id: Ic441ca0bde1be9589a924374605e2f146d16f423
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35118
PWM and temp sensor monitoring want to happen every second,
vs. several times a second for watchdog and LPC.
This is still considerably simpler than having tick functions declare
an interval at which they want to be called, which would require a
RAM-based array of pending tick functions and alarm times. If you
need that level of complexity, you still need a task.
BUG=chrome-os-partner:15714
BRANCH=none
TEST=temporarily add HOOK_TICK and HOOK_SECOND hooks and see that on
LM4, HOOK_TICK is called 4x a second and HOOK_SECOND is called every
second.
Change-Id: I5c09842fd356d3254021486949b2799142068b4f
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36938
Commit-Ready: Simon Glass <sjg@chromium.org>