Commit Graph

258 Commits

Author SHA1 Message Date
Vic Yang
747b1f7520 Thermal Engine: LPC commands.
Implement LPC commands and ectool commands to
  1. Set/get threshold temperature values.
  2. Toggle on/off automatic fan speed control.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8251
TEST=Manual test

Change-Id: Ia4282a6fa47a838aed26540f33c1eb7acc92ef0e
2012-02-29 14:42:45 -08:00
Vic Yang
13b5c41951 Thermal Engine
The thermal engine monitors the temperature readings from all sensors.
For each sensor, five threshold temperatures can be set:
    1. Low fan speed.
    2. High fan speed.
    3. SMI warning.
    4. Shutdown CPU.
    5. Shutdown everything we can.
Each of these thresholds can be set to either a fixed value or disabled.
Currently the real implementation of SMI warning and shutting down is
left as TODO, as indicated in the comment.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8250
TEST=Manually change threshold value to test all actions can be triggered.

Change-Id: If168dcff78ef2d7a3203cb227e1739a08eca961e
2012-02-28 16:51:54 -08:00
Randall Spangler
b2b5455f32 Fix version command crashing if no image B
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8253
TEST=manual

Change-Id: Ie14465283c09029c3d2fa9a32296f32ce7304760
2012-02-28 14:29:52 -08:00
Randall Spangler
4c89ccd89e Register host commands the same clever way we do console commands
BUG=none
TEST=run assorted ectool commands

Change-Id: I830d3cbf2d1557b3ab455ec8736d3de5e5d3e697
2012-02-28 13:58:34 -08:00
Gerrit
e632029ed0 Merge "Add persistent host storage in EC EEPROM" 2012-02-28 13:34:37 -08:00
Randall Spangler
e84fc7b110 Add persistent host storage in EC EEPROM
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8247
TEST=manual

from root shell on host:
  ectool pstoreinfo   --> should print PstoreSize 1024 AccessSize 4
  echo testing 1 2 3 4 > /tmp/infile
  ectool pstorewrite 8 /tmp/infile
  ectool pstoreread 8 /tmp/outfile
  diff /tmp/infile /tmp/outfile

Change-Id: I565e580307584f7def36c5e53d360c1a897d67d2
2012-02-28 13:02:17 -08:00
Gerrit
7e40bacb1b Merge "Remove unused temperature command" 2012-02-28 11:48:18 -08:00
Vic Yang
c55b1527ae Remove unused temperature command
'tempremote' is a debug command used to assess temperature calculation of
TMP006 sensor. Remove it since we have finished TMP006 module.

Also add back the fixed-point algorithm that is lost in rebasing earlier.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7801
TEST=none

Change-Id: Ic3555c1a04d2c0483075262e3ab53842f7bd43d8
2012-02-28 10:52:32 -08:00
Gerrit
2a469c61cf Merge "Make all warnings into errors." 2012-02-28 10:08:56 -08:00
Gerrit
b4edad6922 Merge "Add APIs for thermal module to tell x86_power about overheating" 2012-02-27 18:42:52 -08:00
Gerrit
12676f45fc Merge "Have TMP006 sensor report -1 on sensor failure." 2012-02-27 18:42:51 -08:00
Randall Spangler
a395a7272d Add APIs for thermal module to tell x86_power about overheating
(implementation of APIs still todo)

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8242
TEST=none

Change-Id: Idbd38c4e873e95382ae815e1d5b827d95396be8f
2012-02-27 16:58:43 -08:00
Bill Richardson
ae8dd20d77 Make all warnings into errors.
Also fix a couple places where that makes it fail.

BUG=none
TEST=none

Change-Id: I3b434b4bfa547a579193aac67c1a9d440a2c4e51
2012-02-27 15:54:00 -08:00
Gerrit
2d94379984 Merge "EC_LPC_COMMAND_PWM_GET_FAN_RPM return target RPM" 2012-02-27 15:50:44 -08:00
Gerrit
02c8aa7898 Merge "Remove EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS" 2012-02-27 15:28:11 -08:00
Vic Yang
44140b3c57 EC_LPC_COMMAND_PWM_GET_FAN_RPM return target RPM
Actual RPM is now read from LPC mapped space. Modify this command to
return target RPM so we can verify EC receives target RPM.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8238
TEST=Get the same value after setting target RPM.

Change-Id: I9bcc9edd327cec1311b51fd0fcbc4a43b353daff
2012-02-27 15:11:42 -08:00
Vic Yang
1570eafad0 Have TMP006 sensor report -1 on sensor failure.
Temperature reading should be -1 on sensor failure.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8241
TEST="gpioset enable_vs 0" and "temps" gives "Error"
"gpioset enable_vs 1" and "temps" gives correct reading.

Change-Id: Ide82bd3433d3de12a749b0ee85f1ae1c6b12c5e5
2012-02-27 15:09:11 -08:00
Vic Yang
b9999a2c6c Remove EC_LPC_COMMAND_TEMP_SENSOR_GET_READINGS
We now read temp sensor readings using the EC mapped space.
So we don't need this command.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8239
TEST="ectool temps 0" works.

Change-Id: I47f425e45cea992b19734f39ac6d9f6db6433d39
2012-02-27 14:18:25 -08:00
Vic Yang
f40df60a9a Write current fan speed to LPC mapped value space.
Add a task to update fan speed in LPC mapped memory once per second.
Also added read_mapped_mem16 and read_mapped_mem32.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8183
TEST="ectool pwmgetfanrpm" shows same result as "faninfo" from ec
console.

Change-Id: Ibc536acd39f836ffcad0bfa7c9c14e730220bd49
2012-02-27 13:18:32 -08:00
Gerrit
944d76558b Merge "Disable fan PWM when +5VS is disabled" 2012-02-27 13:07:04 -08:00
Gerrit
2cb41491e7 Merge "Only deassert RCINn in S0" 2012-02-27 13:07:04 -08:00
Gerrit
59368ee2df Merge "x86power module is not present on bds board" 2012-02-27 13:07:03 -08:00
Randall Spangler
28b89fdf94 Disable fan PWM when +5VS is disabled
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8097
TEST=manual

faninfo
  should report fan is disabled
powerbtn
  system turns on, fan turns on
faninfo
  should report fan is enabled
powerbtn
  system turns off, fan turns off
faninfo
  should report fan is disabled again

Change-Id: I1be67004edb23ccd18ad434c9340bfbecc22e7c4
2012-02-27 12:32:20 -08:00
Randall Spangler
0592fe594a Only deassert RCINn in S0
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8231
TEST=manual:

gpioget PCH_RCINn --> should return 0
powerbtn --> should turn system on
gpioget PCH_RCINn --> should return 1

Change-Id: I6801bc2e5801ecac53a50b99cf802c00295faf0b
2012-02-27 12:29:05 -08:00
Randall Spangler
1f786bc348 x86power module is not present on bds board
On bds, always send the keyboard scan code for the power button.

Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=none
TEST=none

Change-Id: I56ad8c9dd67edfd54190d64f16742896a86b9ac1
2012-02-27 12:24:44 -08:00
Vincent Palatin
dbe80e987e Use arm-none-eabi toolchain as default for local build
Now, the arm-none-eabi toolchain is available is all chroot,
so ensure that the developers doing a local build using directly the
Makefile pick by default the same toolchain as the one used by the
automated build.

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

BUG=None
TEST=make BOARD=bds && make BOARD=link && make BOARD=adv

Change-Id: Ib9568cabed3ca77cfa5ebc60479025cbb330b024
2012-02-27 20:07:06 +00:00
Dave Tu
c5b323f995 Merge "Revert "Only deassert RCINn in S0"" 2012-02-27 11:41:32 -08:00
Dave Tu
80c2f0ff66 Revert "Disable fan PWM when +5VS is disabled"
This is causing a merge conflict on https://gerrit.chromium.org/gerrit/#change,16827.

This reverts commit 3a460ea765
2012-02-27 11:41:04 -08:00
Dave Tu
8e6d7f5fef Revert "Only deassert RCINn in S0"
This change broke the tree.

This reverts commit 1d1a38a6cc
2012-02-27 11:32:18 -08:00
Randall Spangler
3a460ea765 Disable fan PWM when +5VS is disabled
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8097
TEST=manual

faninfo
  should report fan is disabled
powerbtn
  system turns on, fan turns on
faninfo
  should report fan is enabled
powerbtn
  system turns off, fan turns off
faninfo
  should report fan is disabled again

Change-Id: I8e94c142bf18d07f83bac05287bcd503a098cee7
2012-02-27 11:09:32 -08:00
Randall Spangler
4f3f3fdf3d Merge "Only deassert RCINn in S0" 2012-02-27 11:06:42 -08:00
Gerrit
3f58f4aa66 Merge "stm32l: update GAIA power sequencing timings" 2012-02-26 20:40:40 -08:00
Gerrit
fc6fb08b56 Merge "stm32l: fix ACOK signal" 2012-02-26 20:40:40 -08:00
Randall Spangler
1d1a38a6cc Only deassert RCINn in S0
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8231
TEST=manual:

gpioget PCH_RCINn --> should return 0
powerbtn --> should turn system on
gpioget PCH_RCINn --> should return 1

Change-Id: I8e58e2b6a48c811d5e57549bdcaea27bca964c08
2012-02-24 18:02:20 -08:00
Vic Yang
675cddb258 Write temperature values to LPC mapped value space.
Add a task to update temperature values in LPC mapped value space every
second. Also modify ectool to read directly from LPC mapped space.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:8065
TEST="ectool temps" gives same result as "temps" from ec console.

Change-Id: Idcdef8d822724f9bd22d7e819c717cba5af5eb77
2012-02-24 13:09:44 -08:00
Vincent Palatin
5a2649acf9 stm32l: update GAIA power sequencing timings
Update the timeouts during the power on sequence as recommended by
Frank.

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

BUG=None
TEST=run EC firmware on ADV board and let Frank control he likes the
signals.

Change-Id: I7391a1cdd5ad74e0c22e15eb996955c5b7719154
2012-02-24 11:07:02 -08:00
Vincent Palatin
64e6afdefa stm32l: fix ACOK signal
The PMIC_ACOK signal is active-low.
Let's drive it correctly.

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

BUG=None
TEST=On ADV board, check that a short key press on the power button is
now able to start the board

Change-Id: Iea71939aeb532618019a9e7774721703c632976f
2012-02-23 13:28:46 -08:00
Vic Yang
c977d241b3 Use mutex to arbitrate I2C buses.
We now have a task contantly polling temperature sensors, so we need to
use mutex to arbitrate I2C buses.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7491
TEST=temps, i2cscan, and i2cread all work fine.

Change-Id: I1360afb22d98b47da3da0820c95df45c15056f82
2012-02-22 11:17:39 -08:00
Gerrit
3cd360ad38 Merge "stm32l: add keyboard configuration for ADV and Daisy boards" 2012-02-22 08:17:13 -08:00
Gerrit
028df3ba51 Merge "stm32l: add a simple shutdown sequence for GAIA SoC." 2012-02-22 08:17:13 -08:00
Randall Spangler
12b12e5334 Add EC host commands for keyboard backlight
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8128
TEST='ectool setkblight X && ectool getkblight' for X=1, 20, 99, 100, 0

Change-Id: I540fd2d05f4caa110cd1dc45e9b5184fc8777a06
2012-02-21 12:59:44 -08:00
Gerrit
63c9ebaac9 Merge "Set VDD3ON flag when hibernating" 2012-02-21 11:46:12 -08:00
Randall Spangler
1d50137e31 Set VDD3ON flag when hibernating
Signed-off-by: Randall Spangler <rspangler@chromium.org>

BUG=chrome-os-partner:8125
TEST='hibernate 1000' should hibernate and wake back up

Change-Id: I3bf36171ea86a90415593bdc884c004bfff62c4c
2012-02-21 11:03:26 -08:00
Vincent Palatin
c651715a2c stm32l: add keyboard configuration for ADV and Daisy boards
Set the keyboard GPIO interrupts and task for the Daisy and ADV boards.

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

BUG=None
TEST=make BOARD=adv && make BOARD=daisy
run EC firmware on ADV board.

Change-Id: I01c7f0112b7ab3382e04ad032a86fb0f3878b02b
2012-02-21 18:18:15 +00:00
Vincent Palatin
bd331737b4 stm32l: add a simple shutdown sequence for GAIA SoC.
Either a 8-second press on the power button or the XPSHOLD signal going
down (triggered the AP/PMIC shutdown sequence) will trigger a shutdown
of the system and switch off all power rails.

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

BUG=None
TEST=on Discovery, test manually various power key press duration and
see power on/power off traces.

Change-Id: Ic37e4a51fe6b131034e24c55f05dae8119ce9992
2012-02-21 17:54:08 +00:00
Vincent Palatin
66db728f60 use RTCK on Servo v2 JTAG
The FT4232 chip used on Servo v2 has adaptative clocking feature.
Let's try to use it to avoid signal integrity issue we observe on
Proto-0.5 JTAG.

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

BUG=None
TEST=connect to Link proto-0 and read/write all the SRAM without errors.

Change-Id: Ic2b91acc29c6d510fb6f3364dd253d3deb650949
2012-02-20 09:24:27 -08:00
Gerrit
ed9a5a5573 Merge "Add keyboard_scan for STM32" 2012-02-18 09:26:44 -08:00
Vic Yang
0fefd25c0c Temperature polling and temporal correction
A temperature polling task is added to achieve temporal correction and
also reduce the latency of reading temperature.

Factor out sensor specific part to keep code clean.

Signed-off-by: Vic Yang <victoryang@chromium.org>

BUG=chrome-os-partner:7801
TEST=On link, 'temps' shows all temperature readings.
Cover each sensor with hand and see object temperature rise.
Compilation succeeded on bds/adv/daisy/discovery.

Change-Id: I3c44c8b2e3ab2aa9ce640d3fc25e7fba56534b86
2012-02-18 13:37:53 +08:00
David Hendricks
a3d621f1b2 Add keyboard_scan for STM32
This loosely ports the LM4 keyboard_scan code to STM32

Notable differences:
- Keyboard GPIO layout is spread across multiple ports and is not
  contiguous in many places. Because of this, bitmasks are mostly
  generated on-the-fly instead of hard coded (IO is kept to a minimum)

- Longer timeout when scanning columns (100us versus 20us)

Also, some functions are stubbed out currently since they rely on
other bits being implemented:
- keyboard_state_changed()
- keyboard_has_char()
- keyboard_put_char()

BUG=none
TEST=Tested on STM32L-Discovery (monitoring keystrokes via UART)

Change-Id: I84985879589e70688b2b29b288ab17037f7668b2
2012-02-17 20:30:07 -08:00
Bill Richardson
737fbbd032 Delay enabling UART1 until after LPC bus is enabled.
BUG=none
TEST=manual

Try it on a bds with no LPC bus. It gets a BusFault without this patch.

Change-Id: If3f38df5f7bebaf4c7045a9f48fbe3ac66e8bdbf
2012-02-17 15:55:32 -08:00