Commit Graph

1349 Commits

Author SHA1 Message Date
Vic Yang
f4a9ffdee3 spring: Control battery LED
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>
2013-02-05 20:16:17 -08:00
Vadim Bendebury
c817977583 Modify stm32mon to better suite autotest use
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>
2013-02-05 11:00:07 -08:00
Vic Yang
a3ac2583a4 spring: Change PWM frequency
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>
2013-02-05 10:08:05 -08:00
Vic Yang
c06e987c1b Tweak lp5562 driver interface
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>
2013-02-05 09:45:44 -08:00
David Hendricks
6e29f8091d stm32mon: add ID for stm32f102r8
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>
2013-01-30 12:29:26 -08:00
Vic Yang
17dae824d2 spring: Add LP5562 driver
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>
2013-01-21 20:25:47 -08:00
Vincent Palatin
c8a61c39ef Add a pass-through for the smart battery
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>
2013-01-19 10:59:20 -08:00
Vincent Palatin
f0cd8251cc spring: remove hardcoded TPSchrome FET settings
Activate the pass-through for TPSchrome LDOs settings
and remove hard-coded values used for bring-up.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:14314
TEST=on Spring, with an updated bootloader, see the screen is still
coming up.

Change-Id: I7fe67640e66939b1a19074b54d81d64459a34f4a
Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41296
Reviewed-by: Vic Yang <victoryang@chromium.org>
2013-01-18 10:56:27 -08:00
Sameer Nanda
40ebfd40fc temp_metrics: set GPU min frequency to 450
Removed the check for modem device and now unconditionally
setting the GPU min frequency to 450.

BUG=chrome-os-partner:16439
TEST="cat /sys/kernel/debug/dri/0/i915_min_freq" and verify that it
returns 450 for systems with and without modem device.
BRANCH=none

Change-Id: I34d176e65420834a85a02755bad11124432ac33f
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41564
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Stéphane Marchesin <marcheu@chromium.org>
2013-01-17 14:45:22 -08:00
Dave Parker
3182778dbb Add 'unprotect' flag for flashing link ec.
BRANCH=link
BUG=chromium-os:37967
TEST=Remove write protect, reflash without 'unprotect', flag
     and verify the write protect flag is stil enabled with
     flashrom -p internal:bus=lpc --wp-status. Power down,
     then reflash with the --unprotect flag. Now verify the
     write protect status flag is disabled.

Change-Id: Ie05b5dc85dd31d29ab43a392fe948a52d547fff3
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/41477
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2013-01-17 13:44:24 -08:00
Vincent Palatin
b24b745f81 Add a pass-through for TPSchrome LDOs
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>
2013-01-16 08:35:03 -08:00
Vic Yang
fd29230988 spring: Add a host command for USB mux switching
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>
2013-01-08 09:30:00 -08:00
Vic Yang
92bf81948d spring: Control BOOST_EN according to device type
BOOST_EN should be turned off when attached device needs power.

BUG=chrome-os-partner:14319
TEST=Manual
BRANCH=none

Change-Id: Ic8d75bdad98eb33ab99792345ddfd90609a1ddbd
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40200
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-08 08:58:38 -08:00
Vic Yang
5019591f68 spring: Configure ADC pins
ADC pins should be configured as analog input pins. Also sets conversion
factor to obtain voltage values in mV.

BUG=chrome-os-partner:14319
TEST=Manual
BRANCH=none

Change-Id: I7e084052062c2b669f10da4309e99bf9e2954ded
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40199
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2013-01-08 08:58:37 -08:00
Vic Yang
40c79398a6 spring: Sense attached device type
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>
2013-01-08 08:58:36 -08:00
Vic Yang
6eb8a6e999 tps65090: Throttle PMU interrupt instead of charger task
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>
2012-12-28 07:48:24 -08:00
Vic Yang
d4fc07c1c2 spring: Setting for USB voltage sense ADC
This changes ID pin sensing to VBUS sensing.

BUG=chrome-os-partner:14319
TEST=Build success.
BRANCH=none

Change-Id: I179f7ab891f83d5c50ec7766372ba8826b3cd231
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/40154
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-12-22 01:54:35 -08:00
Vic Yang
4d7820f4ad spring: Add interrupt and device type support for TSU6721
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>
2012-12-21 08:23:24 -08:00
Bill Richardson
3eb6f58d3e Add AP userspace scripts to tweak lightbar colors
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>
2012-12-20 10:01:18 -08:00
Vincent Palatin
20e3ac6c9a link: remove VR settings on the fly
The code to re-program the IR3570A core regulator on the fly is no
longer needed as the parts should be pre-programmed correctly and it is
slow.

This will break the EVT and older boards which have bad pre-programmed
settings.

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=link
BUG=chrome-os-partner:15596
TEST=on Link, run the power_Resume test and observe the firmware resume
time has decreased.

Original-Change-Id: Id4f56a68d874879bf2f50047c21fbfabea16c850
Reviewed-on: https://gerrit.chromium.org/gerrit/36417
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
(cherry picked from commit 5c59877ee1878b8de380b662601592c817a8b0a8)

Change-Id: I40937c0379a1b94c24679ee5e3110c242849986a
Reviewed-on: https://gerrit.chromium.org/gerrit/39912
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Randall Spangler <rspangler@chromium.org>
2012-12-19 09:29:09 -08:00
Vic Yang
41204a1cd9 spring: Add function to switch ILIM pin between GPIO and PWM
To save power, we need the ability to switch ILIM pin back to GPIO when
we are not using PWM.

BUG=chrome-os-partner:14319
TEST=In console, test 'ilim on', 'ilim off', and 'ilim 50'.
BRANCH=none

Change-Id: Ib3e0400266ef94df25fca1c6e5f118eba37b3848
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39835
2012-12-18 19:59:16 -08:00
Vic Yang
e22087126a spring: Implement PWM control on ILIM_500
This adds init code to configure PWM and a console command to adjust
duty cycle.
Also rename ILIM_1500 to BOOST_EN.

BUG=chrome-os-partner:14319
TEST=Adjust PWM duty cycle and measure voltage.
BRANCH=none

Change-Id: I23856416da19ed523d46af39e6cbc3129ac25525
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39587
2012-12-18 19:59:15 -08:00
Randall Spangler
7326b7475a Tidy ACPI debug output
The host does a lot of ACPI keyboard backlight writes, which were
scrolling the debug console output.  Change to using CR instead of LF,
so it's not so distracting.

(No code changes other than debug output)

BUG=none
BRANCH=none

TEST=Move laptop through different ambient light settings and look at
console output as keyboard backlight ramps up and down.  The 'ACPI
kblight' messages shouldn't cause piles of scrolling.

Change-Id: Iafde57ffe6090830fa54d4920c48b198c36d8d85
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39914
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-18 18:18:19 -08:00
Randall Spangler
eb6e08570a link: Workaround for errata 3.2
Reads of HIBRTCC and HIBRTCCSS are not properly synchronized and may
return incorrect data.  We were re-checking HIBRTC, but not HIBRTCSS.

BUG=chrome-os-partner:16864
BRANCH=link
TEST=from ec console, do 'rtc' command repeatedly;
printed values should be strictly increasing.

Change-Id: I3e59dc840316ad36bb4851f03b66a3ae3df5cccd
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39795
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-17 14:24:50 -08:00
Randall Spangler
55645f87cb Reformat init.S to use tabs not spaces
And tidy a few comments.  No code changes, only comments and whitespace.

BUG=none
BRANCH=none
TEST=compile code (nothing to test)

Change-Id: I10faadc4f11147984cb911c4e630d05ac594cc56
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39796
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-17 14:24:39 -08:00
Vincent Palatin
e927d1506a spring: add basic TSU6721 driver
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>
2012-12-13 09:01:09 -08:00
Vic Yang
243e935ad4 stm32: Add option to select timer for hardware clock
Hardware clock uses two timers, currently TIM3 and TIM4. This CL adds an
option to select between TIM2, TIM3, and TIM4, so that we can use any
one the three timer as a PWM source.

BUG=chrome-os-partner:14319, chrome-os-partner:7463
TEST=Build and run on snow/spring. Build success on daisy.
BRANCH=none

Change-Id: I1a00b3d491ee3e131708b573f6ea70e6b56c96dd
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39584
2012-12-12 19:52:13 -08:00
Vic Yang
73a0bb2ecf lm4: Postfix chip name when debug mode is enabled
This adds a '-debug' postfix to chip name when debug mode is enabled,
allowing us to probe debug mode from host.

BUG=chrome-os-partner:16700
TEST='mosys -k ec info' and see chip name postfixed with '-tm'
     Test same thing on DVT and chip name is not postfixed.
BRANCH=link

Change-Id: Iade26f2009dd3bdb8ddbe92da0da8da5404c6e99
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39455
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-12-10 23:06:39 -08:00
Randall Spangler
ab727c4941 Add more paranoia for flash write protect
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>
2012-12-10 15:42:21 -08:00
Randall Spangler
7a2e3372ee link: Increase cold reset hibernate time to 1 second
This gives VDDC more time to bleed out before the system reboots.

This will require FAFT changes to compensate for the longer cold reset time.

BUG=chrome-os-partner:16600
BRANCH=link
TEST=from ec console, 'reboot cold' should take a second.

Change-Id: I7e0e901958593262868151642560296f0c5496a7
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39515
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-10 15:42:10 -08:00
Randall Spangler
ad2adc4022 Invalidate hash if flash operation changes the hashed region
This prevents the EC from returning a stale hash.

BUG=chrome-os-partner:16668
BRANCH=link,snow
TEST=manual, with WP disabled

From EC console
- Boot system and wait a second
- hash --> prints valid hash
- flasherase 0x20000 0x1000
- hash --> invalid
- hash rw
- hash --> prints valid hash
- flashwrite 0x20000 0x1000
- hash --> invalid
- hash rw
- flasherase 0x38000 0x1000
- flashwrite 0x38000 0x1000
- hash --> still valid (since 0x38000 is outside the rw section)

From root shell
- ectool hash --> prints valid hash
- ectool flasherase 0x20000 0x1000
- ectool hash --> invalid
- ectool hash recalc RW
- ectool hash --> prints valid hash
- echo 'Making a hash of this' > /tmp/hashofthis
- ectool flashwrite 0x20000 /tmp/hashofthis
- ectool hash --> invalid
- ectool hash recalc RW
- ectool flasherase 0x38000 0x1000
- ectool flashwrite 0x38000 /tmp/hashofthis
- ectool hash --> still valid (since 0x38000 is outside the rw section)

Change-Id: Id915a504a7bc70b8b8c339b5ce55dc5bad5838fe
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39484
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-10 15:14:38 -08:00
Randall Spangler
c26a242e94 Increase cold reset hibernate time to 200ms
The hardware fix for issue 16600 adds RC delays to ENABLE_5VALW, so
that +5VALW stays on during a warm reset of the EC.  In the worst
case, +5VALW will drop around 150ms, which could then move the +3VALW
glitch right into the time frame where the EC is booting following
hibernate.

Increase the cold reset hibernate time from 150ms to 200ms.  This
ensures that +5VALW has dropped before the EC comes out of hibernate.

BUG=chrome-os-partner:16600
BRANCH=link
TEST=manual

From the EC console, 'reboot cold' a bunch of times.  The system
shouldn't hang.  (Alternately, you can 'ectool reboot_ec cold' a bunch
of times)

Change-Id: I4bebdb552b8e917c6345badd6efb68b10d7d1f86
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/39340
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-12-06 17:58:32 -08:00
Randall Spangler
3d0d2adb63 link: Enable +5VALW at boot and leave it enabled
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>
2012-12-06 17:58:31 -08:00
Randall Spangler
52440ef893 link: Disable interrupts while reading/writing bits via onewire
When reading, the line must be sampled in a narrow timing window after
the output pulse.  Interrupts or context switches during this time
corrupt the data.

Similarly, when writing, the difference between a 0-bit and a 1-bit is
the length of the output pulse.  So a context switch or interrupt
there can turn a 1-bit into a 0-bit.

BUG=chrome-os-partner:15507
BRANCH=link
TEST=manual

0. plug in AC power
1. hold down shift key for the duration of this test
2. powerled yellow
3. powerled red
4. repeat steps 2-3 several times
5. release shift key

Power adapter LED should toggle color each time.  (It may also toggle
to the normally expected color during this experiment, if the charging
task updates it.)  Power adapter LED should NOT turn off during this test.

Change-Id: Ief11e6e9a5b07aa3a25c60c50e4e7744a4705713
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38925
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-11-29 12:02:51 -08:00
Randall Spangler
108754005d Fix potential deadlock in udelay()
If interrupts are disabled and the deadline is across a 32-bit timer
boundary from the current time, udelay() can lock up.  The fix is to
do 32-bit math directly in udelay().

BUG=chrome-os-partner:16472
BRANCH=link
TEST=manual

waitms 1 -> prompt returns almost instantly
waitms 500 -> prompt returns after 0.5 sec
waitms 1000 -> watchdog error printed, then prompt returns
waitms 2000 -> watchdog reboot

Change-Id: Ib8ca06cee414d48900c0142e629daa68aa0993c9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38924
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-11-29 12:02:28 -08:00
Sameer Nanda
8722b5b142 temp_metrics: Set GPU min freq
On systems with modems, a harmonic of the lowest GPU frequency
of 350Mhz interferes with the cellular signal.  Set the minimum
GPU frequency for such systems to 450Mhz.

BUG=chrome-os-partner:16439
TEST="cat /sys/kernel/debug/dri/0/i915_min_freq". On systems without
this modem, it should read back 350.  On systems with the modem, it
should read back 450.
BRANCH=none

Change-Id: I103a55af11955aed2f3e8c945904444475c63865
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38826
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2012-11-28 13:06:59 -08:00
Randall Spangler
d619cdd58f Handle arbitration lost on I2C ports
This seems to happen when the I2C signals come up so that the EC sees
a start condition from the remote end.  In this case, the EC refuses
to talk on the I2C port until the EC's I2C state machine is reset.

Also, don't fail on bus-busy, since that's true during a multi-part
transaction such as an I2C string read.

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.

Or a better test is to open 2 crosh shells, sudo bash in each, and
  1) while true; do ectool temps all; sleep 0.5; done
  2) suspend_stress_test

Then watch the EC console for "I2C5 bad status" errors.  These happen
rarely, only on some systems.  With this fix, they'll be reported when
they occur, but should not cause errors to be reported by 'ectool
temps all', since the I2C module will clear the arbitration-lost
status before retrying.

Change-Id: Idfaf9cd7e8ef2abcc0130332890329dd5d2ca052
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/38686
Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
2012-11-28 09:50:23 -08:00
Vincent Palatin
e6bf4533c2 Prevent GCC4.7 from generating unaligned memory accesses
The behavior of GCC seems to have changed between 4.6 and 4.7,
now it might generate unaligned memory accesses, so we need to
explicitly set "-mno-unaligned-access".

Signed-off-by: Vincent Palatin <vpalatin@chromium.org>

BRANCH=none
BUG=chrome-os-partner:16391
TEST=make BOARD=link dis, then check the generated assembly for
keyboard_scan_init

Change-Id: I326479a77d6319f1d74e17efe483f5cde56ff325
Reviewed-on: https://gerrit.chromium.org/gerrit/38758
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-11-27 15:55:15 -08:00
Randall Spangler
e2f8466997 Handle bus errors on thermal I2C bus
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>
2012-11-26 14:49:49 -08:00
Vincent Palatin
3c575ccb02 link: allow to decrease maximum battery charging current
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>
2012-11-07 23:48:04 -08:00
Vincent Palatin
7551e8f57f x86: set hibernation delay to 1 hour
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>
2012-11-07 23:48:03 -08:00
Vadim Bendebury
4efe1ed157 Fix the ec flash programming script to properly handle errors
When a nonexisting file is specified as the EC image, the ec flash
programming script reports the error, but continues running and
returns zero status (success) after completion.

With this change the exit status on some errors gets communicated to
the caller.

The openocd script is edited to drop the unused parameter of the
flash_lm4() function and the flash_ec script is edited not to require
EC images to be executable.

BRANCH=none
BUG=chrome-os-partner:15610
TEST=manual
   . run flash_ec with nonexisting or nonreadable file as a parameter,
     observe it to report proper return status. Run it with a proper
     image file name and observe it succeed.
   . run the command again, while the device is being programmed enter
     'ctl-c', observe programming stepped but the 'Restoring servo
     settings..." message still showing up.

Change-Id: Iac0b233fe579b0d5a84cf5a9acf85ed8bf10422e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37363
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-11-07 09:48:29 -08:00
Louis Yung-Chieh Lo
25bbb6b5de More supports for A20 enable/disable
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>
2012-11-04 20:27:57 -08:00
Simon Glass
4f410f5468 Add initial keyscan test and key matrix
Add a few very basic tests and the required key matrix information.

The key matrix is for snow, and the tests are just enough to exercise
the feature.

BUG=chrome-os-partner:12179
BRANCH=none
TEST=manual for now:
On snow:
./ectool keyscan 10000 key_sequence.txt

See that the test passes.

Change-Id: Ibe5a6fe5333102ba7f37be4b526185a48b3c1ae8
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35120
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-11-01 17:20:45 -07:00
Simon Glass
4769627290 ectool: Add keyscan test features
Add a way of easily setting up keyscan tests using a simple text file
format. The steps to run a test are as follows:

- read the test file
- read the key matrix information
- translate the ascii characters from tests into keyscan codes
- send the keyscan codes to the EC
- tell the EC to start the test
- wait for the required time, then collect what input we have received
- check that the input matches the expected input

BUG=chrome-os-partner:12179
BRANCH=none
TEST=manual for now:
On snow:
./ectool keyscan 10000 key_sequence.txt

See that the test passes.

Change-Id: I7de646205803a99443503a1b4bbf32f5fe89c534
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35119
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-11-01 14:09:34 -07:00
Randall Spangler
e9e02762dd Move reset/overheat/shutdown funcs to chipset interface
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
2012-11-01 12:45:28 -07:00
Randall Spangler
d83f42bdc8 Switch temp sensor polling to use hooks instead of task
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
2012-11-01 12:45:22 -07:00
Rong Chang
742ec5a1ff snow: fail battery command on unsupported system
GEC exports battery information to host via mapped memory. This change
fails ectool battery command on unsupported system.

Signed-off-by: Rong Chang <rongchang@chromium.org>
BUG=chrome-os-partner:15272
BRANCH=none
TEST=manual, type ectool battery under VT2

Change-Id: I260921eaa679cd3f20fc390472a7e7d64d181a7f
Reviewed-on: https://gerrit.chromium.org/gerrit/37011
Commit-Ready: Rong Chang <rongchang@chromium.org>
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-11-01 10:09:05 -07:00
Randall Spangler
e3c5f77924 link: Fix overflow in hibernate time calculation
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>
2012-11-01 10:08:54 -07:00
Randall Spangler
9a1548984d link: Cold reboot should ignore WAKE# pin
This fixes the EC not being able to do a cold reset while the power
button is held down, because the power button asserts WAKE#.

BUG=chrome-os-partner:15705
BRANCH=link
TEST=manual

- scope HIB#
- hold down power button
- from console, 'reboot cold'

HIB# should stay asserted for 150ms.  Before this fix, it asserted only briefly.

Change-Id: I07c6bb5ee3f846544c75e7e0d4584f8434a9cd56
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/37090
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
2012-10-31 18:06:10 -07:00