Commit Graph

1263 Commits

Author SHA1 Message Date
Randall Spangler
e9dd3ff1ad Clean up charger code
BUG=chrome-os-partner:15579
BRANCH=none
TEST=discharge and charge battery; should still work

Change-Id: I97033e5f5ff4289831f9a4400d18730ece3bd99a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36365
2012-10-24 10:09:20 -07:00
Randall Spangler
44a973ef95 Cleanup: battery_precharge
Just code cleanup; no functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=code compiles

Change-Id: I9610b7df4b6c621d0a1d5ca0513629ee21626ec4
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36364
2012-10-24 10:09:20 -07:00
Randall Spangler
935824d617 Cleanup: battery
Tidy code.  No functional changes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=discharge battery, then plug AC in and make sure it charges

Change-Id: I4cff018940ecb665be96655d6722f74dd6674f6d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36359
2012-10-24 10:09:20 -07:00
Jon Salz
06a7508187 Revert "lm4: Add chip name for lm4fs1gh5bbfig"
This reverts commit db2c527d5c

Change-Id: I033916921993bffc6a3c0d6bbb70a867b73b25a9
Reviewed-on: https://gerrit.chromium.org/gerrit/36414
Commit-Ready: Jon Salz <jsalz@chromium.org>
Reviewed-by: Jon Salz <jsalz@chromium.org>
Tested-by: Jon Salz <jsalz@chromium.org>
2012-10-23 22:40:21 -07:00
Randall Spangler
8625009dc2 Use CONFIG_TASK_VBOOTHASH instead of CONFIG_VBOOT
This fixes build breaks in 'make tests'.

BUG=none
BRANCH=none

TEST=make tests (note that this still fails due to other problems;
will fix those in a followup CL)

Change-Id: I5b5ce52ed6e44ade6051e0a091a6699c0454d61a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36353
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-23 17:32:03 -07:00
Randall Spangler
cc263093d3 Clean up keyboard_scan module
We only have one scan mask and no capability to change scan masks, so
don't reserve space for masks we're not using.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=type on keyboard; should still work

Change-Id: I8ad0c5c894f93c2a79ca646e7666b3279c90a63c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36347
2012-10-23 17:32:02 -07:00
Randall Spangler
090e4f5f8e Clean up i8042 module
Remove unused code paths.  Simplify interfaces.  Clarify comments.
Split the protocol constants into their own header file (since they're
used only by keyboard.c, not i8042.c, which is really keyboard
buffering... and will be renamed so in a followup CL.)

This cleanup reduces binary size by about 200 bytes.

BUG=chrome-os-partner:15579
BRANCH=none
TEST=type on the keyboard; it should still work.

Change-Id: I6acbab5fe5604b4b0c516ba3622e6f41820985d1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36271
2012-10-23 17:32:01 -07:00
Randall Spangler
e72788ef96 Hook functions no longer return values
Previously, all hook functions returned EC_SUCCESS, which was
meaningless because nothing ever looked at the return value.  Changing
the return value to void saves ~100 bytes of code size and an equal
amount of source code size.

BUG=none
BRANCH=none
TEST=code still builds; link still boots

Change-Id: I2a636339894e5a804831244967a9c9d134df7d13
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36372
2012-10-23 16:49:29 -07:00
Sameer Nanda
7cd4d4391d temp_metrics: tmp006 calibration update
Updated S0 calibration settings based on DVT3 systems.

De-activate the PCH sensor in the thermal loop as its accuracy is poor.

BUG=chrome-os-partner:9599
TEST=run "for i in {0..3}; do echo $i: && ectool tmp006cal $i; done" and make sure
the S0 values are the same as those programmed by temp_metrics.conf.
BRANCH=none

Change-Id: I2b4395d3c74ce4610f57ee90f6cd3f0d7467d31b
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36000
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
2012-10-23 10:32:22 -07:00
Vic Yang
db2c527d5c lm4: Add chip name for lm4fs1gh5bbfig
BUG=chrome-os-partner:15519
TEST=none
BRANCH=link

Change-Id: I00c27eab4320a95b17c4f18572835fea1fb8cdf7
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36307
2012-10-22 20:30:38 -07:00
Vic Yang
965ec04fff lm4: Report raw DID value when chip name cannot be determined
We map the raw DID value to chip name in EC. If the raw value is not in
the mapping table, EC just returns empty string and we lose this
information from host side. Let's return raw DID value like
"Unknown-10ea".

BUG=chrome-os-partner:15519
TEST=remove 0x10ea from the mapping and check 'mosys -k ec info' shows
'Unknown-10ea'.
BRANCH=link

Change-Id: I9399f44ab40db02202ee03ba3f988f3ece010d9f
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36305
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-10-22 20:22:39 -07:00
Randall Spangler
99011554fa Fix help message for ectool
Not all of the options for reboot_ec were listed.  This fixes the
text; there are no code changes.

BUG=none
BRANCH=none
TEST=run ectool with no options to print help

Change-Id: I65275a007febbd3583f157cc7f8df5634d6eeeda
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/36257
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-22 14:47:25 -07:00
Randall Spangler
8febf5ba28 Host commands use correct console channel
Previously they reported on the system channel, not the hostcmd channel.

BUG=none
BRANCH=none (affects all platforms, but only affects use of 'chan' ec console command)
TEST=manual

  - chan 0x40
  - x86reset
  - should see HC debug output.

Change-Id: Ie9873db015c94a0198a94ebafad87d51b0f73620
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35953
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-18 14:24:54 -07:00
Randall Spangler
1da8181c58 cleanup: TMP006 constants should be static
BUG=none
BRANCH=none
TEST=code still builds; this is code cleanup with nothing to test

Change-Id: Ibce47a67c8af51c214bb1ef5e31e9afdd8d2dfd3
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35964
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-18 14:24:54 -07:00
Randall Spangler
d598b64277 link: Fix checking runtime keys
This accidentally got disabled when printing keyboard scan state was
turned off by default.

BUG=chrome-os-partner:15466
BRANCH=link

TEST=alt+volup+R should reboot system
  Then from console, ksstate on
  Then press keys; KB state should print on console

Change-Id: I7d410b56210fda0c73c65d9d76ccc7b4e873516c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35971
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-18 13:59:29 -07:00
Randall Spangler
113dd1ba16 link: Increase EC cold reboot time to 150ms
This matches Silego's recommendation as of 10/18.

BUG=chrome-os-partner:14687
BRANCH=link

TEST='reboot cold' repeatedly from EC console (or 'ectool reboot_ec
cold' repeatedly from root shell), then check that Power+Esc still
reboots the system.

Change-Id: Ief2962bf66a947e83dfe934e45e18dc37d6ba326
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35968
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-18 13:37:04 -07:00
Randall Spangler
3a9b255d07 link: host command params must be 32-bit aligned
This fixes a problem where flash writes would fail because the source
buffer was not 32-bit aligned.

BUG=chrome-os-partner:15435
BRANCH=link
TEST=from a root shell,

    localhost ~ # echo 1234567812345678123456781234567 > /tmp/data
    localhost ~ # ls -l /tmp/data
    -rw-r--r-- 1 root root 32 Oct 17 17:28 /tmp/data
    localhost ~ # ectool flasherase 0x3a000 0x4000
    Erasing 16384 bytes at offset 237568...
    done.
    localhost ~ # ectool flashwrite 0x3a000 /tmp/data
    Reading 32 bytes from /tmp/data...
    Writing to offset 237568...
    done.

If that doesn't crash, the fix works (prior to this fix, that would
reboot the system).

Change-Id: I8d197e7ef7a1c74825916bd788f7d450088a55cc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35916
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2012-10-17 17:55:36 -07:00
Randall Spangler
90a18599bb link: Don't print keyboard state changes by default
The keyboard scan module generates a lot of debug output when the user
is typing on the keyboard - enough so that switching to the console,
logging in as root, and typing 'ectool console' flushes the EC's
console output buffer of any useful data.  Default printing this to
off.  Add a new 'ksstate' command which will print the current
keyboard scan state or toggle printing off/on.

This is important for debugging LPC communication failures.

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

- Boot system
- Type on keyboard.  At EC console, should not see KB state: output
- Hold down space bar.
- At EC console, type 'ksstate'.  Should print:
  ksstate
  [20.943886 KB debounced : -- -- -- -- -- -- -- -- -- -- -- 20 --]
  [20.945215 KB prev      : -- -- -- -- -- -- -- -- -- -- -- 20 --]
  [20.945568 KB debouncing: -- -- -- -- -- -- -- -- -- -- -- -- --]
  Keyboard scan state printing off
- Release space bar
- At EC console, type 'ksstate on'
- Type on keyboard.  Should see KB state: output
- At EC console, type 'ksstate off'
- Type on keyboard.  At EC console, should not see KB state: output

Change-Id: I4343b7b777fd13057b3222eeba77ed099c5e5a93
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35843
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
2012-10-17 15:23:52 -07:00
Randall Spangler
c0640ee296 link: don't rely on host-write interrupt status
This works around a potential LM4 chip problem where edges on the FRMH
status bit don't always trigger interrupts.  The workaround is to look
at FRMH for each channel in the interrupt handler rather than the
interrupt status, and to trigger the interrupt every 250ms to sweep up
any missed writes.  We already do this for port 80 writes; this just
extends the workaround to all channels.

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

- boot system
- EC console should show a number of HC lines for host command
- EC console should show a number of ACPI queries
- switch to root shell; keyboard should work
- ectool version should work

Change-Id: If02d685519c69ee88c055c8374a6c655a277e637
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35871
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-17 15:23:52 -07:00
Simon Glass
8f73372cef stm32: Swallow special keys instead of passing them to AP
During the debounce refactor we unintentionally adjusted the behavior
of special keys so that they are no longer swallowed (as per commit
9332d76). The LM4's keyboard behaves differently so this code cannot
be brought over as is.

Bring back the required behavior for STM32.

BUG=chrome-os-partner:14496
TEST=hit alt-volume_up-r keys together. See that the AP does not see
this keypress in U-Boot by checking the EC console has no 0x60 messages.
BRANCH=snow

Change-Id: I043fbba4d9be5941e550257b99bdb2137792c133
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35767
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-17 15:23:49 -07:00
Bill Richardson
f574f1c37c Make S3 red-light flash adjustable.
This makes the timing for the S3 low-power indicator adjustable without
reflashing.

BUG=chrome-os-partner:8039
BRANCH=Link
TEST=manual

Boot, log in, run this to put the lightbar into demo mode:

  ectool lightbar demo 1
  ectool lightbar seq s3s0

The lightbar should act as though the system is asleep.

Then press the left arrow a couple of times and the down-arrow four or five
times.  You should see the red light pulse every 5 seconds or so.

Now run

  ectool lightbar params > /tmp/w

Edit /tmp/w to change the timing lines to this:

  100             # .s3_ramp_up
  100             # .s3_ramp_down

Then run

  ectool lightbar params /tmp/w

After a cycle or two, you should see the lightbar flash instead of pulse.

Change-Id: If815ff2fb9a158c0e1f4dbb6a269ad07e122d84c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35839
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-17 12:50:26 -07:00
Vic Yang
a2c0103908 Fix delay loop for battery detecting
The charging voltage and current are not necessary zero. Remove the
conditions.

BUG=chrome-os-partner:14094
TEST=Remove the battery with AC connected. LED turns red after 30
seconds.
Plug in AC with battery disconnected. LED turns red after 30 seconds.
BRANCH=link

Change-Id: I754383b05af6de0ceeb706612f1cb534254e47e3
Signed-off-by: Vic Yang <victoryang@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35807
Reviewed-by: Rong Chang <rongchang@chromium.org>
Tested-by: Rong Chang <rongchang@chromium.org>
2012-10-17 00:54:30 -07:00
Bill Richardson
a6ec0e16d8 Finally final lightbar tweaks. Really. I think...
This is hopefully the finally final tweak to the lightbar behavior. It does
this:

* When booting or awakening from sleep, Google colors pulse briefly.
* When the chromebook is fully on, lightbar is dim blue. Every 3-5 seconds,
  a pulse of brighter blue sweeps across.
* On battery, the lightbar is not quite as bright, and the sweep goes in the
  other direction and is slightly slower. If the battery charge drops below
  10%, the lightbar changes from blue to red (but only on battery, not AC).
* When going to sleep (close lid while logged in), lightbar fades to black,
  then pulses Google colors, then off.
* While asleep, lightbar does nothing, UNLESS on battery and battery charge
  is under 10%. Then it pulses red every 5-8 seconds.
* When shutting off, it just goes black with no special effects.

Other than the slight dimming on battery power, there is no ambient light or
dynamic brightness control.

BUG=chrome-os-partner:8039
BRANCH=Link
TEST=manual

Turn it on, watch the blinky lights. Log in, close the lid, open the lid.
Connect/disconnect AC. The lights should change as described above. Ta Da.

Change-Id: Id174a452639decc4b5eefb9e21b28cf3643529f5
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35742
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-16 18:32:06 -07:00
Randall Spangler
fdaa78e3c2 link: increase time in hibernate for EC cold reset
This works around a problem where the Silego chip doesn't cleanly
reset for short hibernate durations.

BUG=chrome-os-partner:14687
BRANCH=link
TEST=ectool reboot_ec cold (~100 times), then check if power+refresh still
     reboots the system

Change-Id: I14098940da9331856dd061a56a60a47c9a1cf1f8
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/34832
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-16 16:48:20 -07:00
Simon Glass
943c241545 Add EC keyscan test interface
Add EC commands for managing a list of keyscan events which the EC
should replay instead of its normal key scanning operation.

There are two commands: one adds to the list of events. The other
allows the list to be cleared, the sequence to be started, and the
resulting information to be collected.

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

See that the test passes.

Signed-off-by: Simon Glass <sjg@chromium.org>

Change-Id: Ie4c3e4d0f5c1dbf642185fec99b9201d47532ae1
Reviewed-on: https://gerrit.chromium.org/gerrit/35117
Commit-Ready: Simon Glass <sjg@chromium.org>
Tested-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
2012-10-16 10:46:50 -07:00
Bill Richardson
aadfab96c0 Fix lightbar bug, add more tweaks.
I introduced a glitch in the parameterization CL. This fixes it, and makes
the choice between the gentle throbbing and occasional pulse something that
can be selected as a parameter. Default is the new pulsey style.

BUG=chrome-os-partner:8039
BRANCH=Link
TEST=manual

Using the ectool that's part of this change, run these commands to flip
between suspend and active displays:

  ectool lightbar seq s3s0
  ectool lightbar seq s0s3

Change the "new_s0" value (0/1) and reload the params with

  ectool lightbar params | tee /tmp/w
  vi /tmp/w
  ectool lightbar params /tmp/w

In each case you'll see some pretty patterns. Pass/Fail is an artistic
decision. No QA required.

Change-Id: I8de0b1b3cc77f65879befe95e110bbbce18846d9
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35620
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-15 17:47:01 -07:00
Sameer Nanda
4dd3940d19 temp_metrics: disable ACPI thermal zone 1
ACPI thermal zone 0 is used for critical thermal events while thermal zone 1
is used for asserting (internal) prochot and duty cycling. Since the
equivalent of thermal zone 1 functionality exists in temp_metrics,
disable ACPI's thermal zone 1 in order to prevent conflicts between ACPI
and temp_metrics.

BUG=chrome-os-partner:9193
TEST='cat /sys/class/thermal/thermal_zone1/mode' and check that it is
disabled.
BRANCH=none

Change-Id: I689e8e5c1747c5f259f4a72a9f86396f4aa5c0b2
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35593
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-10-15 17:46:57 -07:00
Sameer Nanda
dd300b5baf temp_metrics: tmp006 calibration and fan loop updates
With the recent changes that have gone into the EC, the TMP006
calibration data is no longer present in the EC by default. Push it down
to the EC via the newly added ectool tmp006cal command.

Also added couple of changes to the fan loop:
- hand back fan control loop to the EC if none of the TMP006 sensors
  report valid temperatures.
- handle S0->S3->S0 transition where the EC sets the fan to 0 RPM.

BUG=chrome-os-partner:9193
TEST=run "ectool tmp006cal" command for sensors 0, 1, 2 and 3 and ensure
that they return non-zero calibration values.
BRANCH=none

Change-Id: Iaf91216a4d3353f15489b39aba9acb34055551cf
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35469
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2012-10-15 17:46:57 -07:00
Randall Spangler
e764bdbb03 link:re-enable fan RPM controller when needed
Previously, any command which set the fan duty manually would leave
the PWM RPM controller disabled.  Setting the fan back to auto mode
via 'ectool autofanctrl' or 'autofan' or 'ectool pwmsetfanrpm'
wouldn't turn the controller back on.  Now it does.

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

  - Reboot in recovery mode and wait for INSERT screen

  - From EC console
    fanduty 100 -> fan turns on all the way
    faninfo -> mode is duty
    fanset 6000 -> fan turns down to a lower level
    faninfo -> mode is rpm
    fanduty 0 -> fan turns off all the way
    faninfo -> mode is duty
    (wait a min or so for the system to heat up)
    autofan -> fan turns on
    faninfo -> mode is rpm

  - Reboot normally

  - From root shell
    ectool fanduty 100 -> fan turns on all the way
    ectool pwmsetfanrpm 6000 -> fan turns down to a lower level

Change-Id: I3b07e8b49500f5f8a42f20909d2869cf63987d6d
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35335
Reviewed-by: Sameer Nanda <snanda@chromium.org>
2012-10-15 13:41:28 -07:00
Vincent Palatin
9a0e69cbbf spring: force power on LCD and backlight
For board bring-up.

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

BRANCH=none
BUG=chrome-os-partner:10912 chrome-os-partner:14324
TEST=on Spring, boot the AP, issue "pmu" command on the EC console
and FET1 and FET6 (registers 0xf and 0x14) contains 0x13.

Change-Id: Ic8fd681c2e2f3e2168de2cb7f83920d4feefd485
Reviewed-on: https://gerrit.chromium.org/gerrit/33703
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
2012-10-15 12:14:27 -07:00
Randall Spangler
b3fa69f17f link: thermal controls ignore case temp by default
The remote temperature sensors for case temps are now not used until
they're calibrated by the host.  But the EC still tries to control the
fan based on case temps.  At best this has no effect because the
sensors haven't been enabled by host calibration.  At worst, the host
calibrates them, but doesn't set up the temerature thresholds to
match, so the EC spins up the fan briefly during boot before the host
takes over (annoying), or potentially asserts prochot, shuts the
system down, or triggers a bunch of SMIs (really annoying).  It's
safer just to leave these thresholds disabled by default; if the host
wants the EC to use them, it can easily set them at the same time it
sets the remote sensor calibration data.

Also, adjust overheated thresholds up based on snanda's recommendations.

BUG=chrome-os-partner:9193
BRANCH=link
TEST=thermalconf 2 --> should print 0 K for all levels

Change-Id: I5bd1ea65eaefc4d39238b22363176d32663434a0
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35449
Reviewed-by: Sameer Nanda <snanda@chromium.org>
2012-10-15 10:37:26 -07:00
Bill Richardson
814d0d227f Replace pulsing with sweeping.
BUG=chrome-os-partner:8039
BRANCH=Link
TEST=none

More cosmetic changes.

Change-Id: If33e39d3cea1e3930d630ad84a156e9afb4c57fd
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35485
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-14 18:58:01 -07:00
Bill Richardson
eb59ac66bd Set minimum brightness to 35%, variable osc settings.
BUG=chrome-os-partner:8039
BRANCH=Link
TEST=none

More cosmetic changes.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I1fd9318131ce55541d845ac8be5faa9334c3953f
Reviewed-on: https://gerrit.chromium.org/gerrit/35484
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-14 18:57:58 -07:00
Randall Spangler
8c742b2fc3 link: Ignore keyboard when lid is closed
The lid is flexible enough that it's possible to press keys by
squeezing the laptop.  To keep this from waking the device from
suspend or powering it on, don't scan the keyboard or power button
when the lid is closed.

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

- boot system
- use a magnet near the search key to trigger the lid-closed switch
- press space, then power.  neither one should trigger resume
- remove magnet.  system resumes
- space and power should work as expected again
- log out
- use magnet to trigger lid-closed switch (looking at EC console output is
  handy here).  system should shut down
- pressing power should not boot the system
- remove magnet; system will boot
- pressing power should work as expected again

Change-Id: I92080237b0a2f21774301df3d8e866878697b793
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35425
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-12 14:24:39 -07:00
Vincent Palatin
94063c0f35 stm32: support DMA on I2C1
Each I2C controller needs to use a fixed pair of DMA channels.
The former code was hardcoded for I2C2. We now use the board
configuration to decide between I2C1 and I2C2 DMA channels.

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

BRANCH=none
BUG=chrome-os-partner:15185
TEST=make BOARD=snow && make BOARD=spring && make BOARD=daisy
run on Spring and Snow and see we can communicate both with the PMU
(using "pmu" EC console command) and the AP (answering U-Boot host command)

Change-Id: Ifd6806205b443c623e3db09fb1a2d5804bb94214
Reviewed-on: https://gerrit.chromium.org/gerrit/35355
Reviewed-by: Charlie Mooney <charliemooney@chromium.org>
Reviewed-by: Simon Glass <sjg@chromium.org>
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2012-10-11 23:32:26 -07:00
Vincent Palatin
1edad9de11 spring: de-activate power LED code
the power LED code is doing useless operations and messing up with
the former LED pin.

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

BUG=chrome-os-partner:14313
TEST=make BOARD=spring

Change-Id: Idf44bdb7b7a779706bd6579fb66ba3e6932de89f
Reviewed-on: https://gerrit.chromium.org/gerrit/35273
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-10-11 23:32:25 -07:00
Vincent Palatin
fbc4c150d2 stm32: make power led optional
The spring board doesn't have one and we doesn't want to mess up with
that pin.
When the POWERLED task is not present, let's de-activate cleanly that
code.

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

BUG=chrome-os-partner:14324
TEST=make BOARD=spring (no power_led.o compiled)
make BOARD=snow (power_led.o compiled)
make BOARD=link && make BOARD=bds
run on Snow and see the power LED working

Change-Id: Ib44f5df54ec4fdee1863814e6c7052fd6620fee8
Reviewed-on: https://gerrit.chromium.org/gerrit/35272
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-10-11 23:32:24 -07:00
Vincent Palatin
07aa700e92 spring: enable USB boost charger by default
Needed for easy power on until we have the full USB charge state
machine.

note: the GPIO name ILIM_1500 is somewhat misleading,
it is connected to the enable pin of the TPS43060

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

BUG=chrome-os-partner:14319
TEST=manual :
plug the board and press servo power button,
see the AP rails coming up.

Change-Id: I93421d1581065bcc1e7be07086e74d11d1e1ec56
Reviewed-on: https://gerrit.chromium.org/gerrit/35271
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2012-10-11 23:32:23 -07:00
Bill Richardson
d6f05e0d61 Parameterize the lightbar behavior as much as possible.
This change replaces most of the hard-coded lightbar constants with values
that can be updated at run-time, so that if we change our minds about colors
and timing we can tweak some of the values without requiring an EC/BIOS
update.

It also adds the "ectool lightbar params" command to get and set those
values from the host. You can see the values from the EC console ("lightbar
params"), but there's no way to set them.

BUG=chrome-os-partner:8039
BRANCH=Link
TEST=manual

From the EC console, run

  lightbar params

It should display the current values that can be changed.

Log in to the host and run this to see the same values:

  ectool lightbar params

Or edit and change them with this:

  ectool lightbar params > /tmp/vals.txt
  vi /tmp/vals.txt
  ectool lightbar params /tmp/vals.txt

The updated parameters are persistent across EC jumps (RO->RW), but are lost
when/if the EC reboots (as it will after the AP is off for 24 hours, for
example).

Change-Id: Ic2a3fd6f8062673432b48904933e0c7239b8658b
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35289
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2012-10-11 14:24:43 -07:00
Randall Spangler
b00a446ec5 link: EC reclaims fan control on AP shutdown
Previously, if the AP took fan control, the EC would never take it
back.  This meant the EC would leave the fan off even if the system
was sitting at the INSERT screen or booted an alternate OS.

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

- boot system
- from EC console, fanset 0
- faninfo shows fan at 0rpm
- from root shell, crossystem recovery_request=123 && reboot
- wait a few mins
- faninfo should show fan spinning again

Change-Id: I534c9978194085467f1df6eae971c55d4e8083be
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35309
2012-10-11 14:24:43 -07:00
Randall Spangler
ceb696a208 link: Reset fan target RPM when suspending
This prevents the fan from coming on loudly during resume.

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

- power on system
- wait for it to heat up; type faninfo periodically from ec console
- when faninfo reports non-zero, type 'powerd_suspend' at root shell
- faninfo should now report Target: 0 rpm Enable: no

Change-Id: Ia5ee93c0f5c6626afd54a22d2996ab65cf8e3b18
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35303
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 14:24:42 -07:00
Randall Spangler
25c6574da6 link: TMP006 S0 param is uncalibrated by default
S0 values are incorrect and may even need to be calibrated on a
per-system basis.  Set them to 0 by default so that the EC doesn't
return inaccurate remote temperature readings before calibration data
is sent.

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

- temps -> remote temps are all not calibrated
- t6cal 1 s0 9301
- temps -> PCH D-Object temp now returns a temperature

Change-Id: I43facc60cf947ebd9441a8a629a76f7ffc8f3959
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35302
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 14:24:41 -07:00
Randall Spangler
23fe5ed867 link: Added sensor-not-calibrated error for TMP006
BUG=chrome-os-partner:15174
BRANCH=link
TEST=manual, from root shell
 - ectool temps all -> prints all temps
 - ectool tmp006cal 1 0 0 0 0
 - ectool temps all -> sensor 3 not calibrated

Change-Id: I16ee818c948fe90ac7c18b230c5d9f9a0ec83ded
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35288
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 14:24:40 -07:00
Randall Spangler
22e03a1de6 link: Temp sensors can return not-powered error code
This removes the need for a separate method to check sensor power, and
gets rid of temp_sensor.c knowledge of what powers each sensor.

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

- reboot
- within a second, type 'temps'; I2C sensors should return error 1
- type 'temps' again; all sensors should return data
- power off system
- type 'temps' again; I2C sensors and PECI should return error 8
- 'gpioset enable_vs 1'
- type 'temps' again; I2C sensors should return valid data; PECI should still
  return error 8.

Change-Id: I17c353b3c483bc320769307c7715008ec729089b
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35287
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 14:24:36 -07:00
Randall Spangler
8f2e99da75 link: Temp sensor read can return an error code
This will be used in a follow-up CL to return specific error codes
(not powered, not calibrated, etc.)

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

Power on system.
'temps' should return all good temps.
Power off system (into S5)
Only ECInternal temp should work; others should return Error 1
'gpioset enable_vs 1' and wait a second
Now all the I2C temps should display good data, but PECI will still be error 1.

Change-Id: I925434e71653ad53ad76bad992a7a8fdeadb088c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35286
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-11 13:47:17 -07:00
Randall Spangler
d1bebbbe66 Add host command to get/set TMP006 calibration data
Needed for host-based thermal control and tweaking.

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

From a root shell,
  ectool tmp006cal 0 3.5e-14 -2.8e-5 -5.5e-7 4.5e-9
  ectool tmp006cal 2 3.6e-14 -2.9e-5 -5.6e-7 4.6e-9
  ectool tmp006cal 0
    S0: 3.500000e-14
    b0: -2.800000e-05
    b1: -5.500000e-07
    b2: 4.500000e-09
  ectool tmp006cal 2
    S0: 3.600000e-14
    b0: -2.900000e-05
    b1: -5.600000e-07
    b2: 4.600000e-09

At the ec console, "t6cal" should show the settings took effect as well.

Change-Id: If43b11e1e827483f0a20db1a2e5644f3475fd95e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35215
2012-10-11 13:47:17 -07:00
Randall Spangler
bea56570f3 Add t6cal console command to set/print TMP006 calibration
Note that radix must be specified as an integer, because we don't have
floating-point parsing.  So to set the first sensor's S0 to 3.600e-14,
do:
   t6cal 0 S0 3600

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

From EC console,
  t6cal 0 s0 3500
  t6cal 1 b0 -3000
  t6cal 1 b1 -5600
  t6cal 2 b2 4700
  t6cal
The final t6cal should show the changes from the previous commands

Change-Id: I2f8f71890e8e64a427cc29c3ef86ca991ce6b039
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35204
2012-10-11 10:06:56 -07:00
Randall Spangler
0b6b6b7754 Refactor TMP006 module
1) Use floating-point more freely, since it's on all the time now, and
the old fixed-point code no longer compiled.

2) Sensitivity and Bn values are now in a RAM-based struct in
preparation for setting them at runtime.  No changes from current
values.

3) If a sensor fails to read good data, is initialized, or loses
power, its die temperature history will be set to the next good
temperature, rather than persisting an arbitrary start value or old
state.  This fixes reading wildly inaccurate object temperatures for
the first few seconds following boot/resume.

4) If a sensor loses power, wait for the sensor to report data-ready
before reading temperature/voltage.  Otherwise, those read as 0, which
again throws off the first few seconds of data.

BUG=chrome-os-partner:14955
BRANCH=link

TEST=Boot system and set at login screen for a minute to reach thermal
equilibrium.  Then reboot system, type 'temps' repeatedly.  Data from
TMP006's should initially be Error; after a second or so it should be
good, and shouldn't change more than a few degrees.

Change-Id: Id0b42b9b18e94978ba7d3a1ee33194e44b1904bc
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35188
2012-10-11 10:06:54 -07:00
Randall Spangler
678e649240 Add console channel for thermal output
Needed for debugging upcoming TMP006 calibration changes

BUG=none
TEST=boot; EC console output should appear as before
BRANCH=link

Change-Id: I93a18949888533ecefd226fdc64e1fab7d52a8f1
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35187
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2012-10-10 16:28:40 -07:00
Sameer Nanda
3af7bc4335 temp_metrics: remove prochot and TCC modifications
External prochot input was disabled due to board issues. Re-enable it
since those board issues are now fixed.

Remove modification of TCC offset. Changes to TCC offset from this
script are ineffective since they need to happen before the BIOS sets
the BIOS_RESET_CPL bit way early in the initialization sequence.

BUG=chrome-os-partner:9193
TEST=from shell run "rdmsr 0 0x1fc" and check that bit 0 is set to 1.
BRANCH=link

Change-Id: Ida2a090539d7e074794e13a90f251babb6c4ade9
Signed-off-by: Sameer Nanda <snanda@chromium.org>
Reviewed-on: https://gerrit.chromium.org/gerrit/35067
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Todd Broch <tbroch@chromium.org>
2012-10-10 15:59:04 -07:00