Commit Graph

719 Commits

Author SHA1 Message Date
cloud_lin
ccdce3f83d big: Modify LGC battery setting based on battery spec
1. Modify voltage_max
2. Set CP point

BUG=chrome-os-partner:27859
BRANCH=Big
TEST=Plug in AC and battery, use UART command "charger" to check
v_batt and I_in and the values are correct.

Change-Id: If83a444338e8d520e6c2f4d04ca6016c14cea8bd
Reviewed-on: https://chromium-review.googlesource.com/193584
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Lin Cloud <cloud_lin@compal.com>
Tested-by: Lin Cloud <cloud_lin@compal.com>
2014-04-12 05:54:04 +00:00
Vincent Palatin
a1e8b316db Zinger board configuration
Add the USB Power delivery PHY configuration,
and all the pins and details to use the real Zinger
board.

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

BRANCH=none
BUG=none
TEST=none

Change-Id: Ic2d3616c9fd2bf3ebeccba74a5519697e7c3e899
Reviewed-on: https://chromium-review.googlesource.com/194220
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-12 01:45:51 +00:00
Vincent Palatin
6c6276fd45 FruitPie board configuration
Add all the pins configuration to use the real FruitPie board
and the USB Power Delivery configuration.

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

BRANCH=none
BUG=none
TEST=make BOARD=fruitpie

Change-Id: I8c20118400cb6a2e26b541a9ee2da5b706299fcf
Reviewed-on: https://chromium-review.googlesource.com/189862
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
2014-04-12 01:45:47 +00:00
Bill Richardson
9814e54204 Increase test coverage of charge_state_v2.c
This improves some of the smart battery mocks, and adds some more tests for
the new change state machine.

BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=make coverage

Line coverage of this file jumps from 53% to 93%.

Change-Id: I4a9b8818cefaffd3022cebe08a36d592b0611295
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193690
2014-04-11 15:37:53 +00:00
Alec Berg
529548208c accel: add host command to modify accel params and add ectool command
Created a host command to set/get various motion sensor parameters and
added an ectool command to use that host command.

The host command is created such that the first argument is a
sub-command. Sub-commands created include:
dump: dumps all current motion sensor data
info: returns general information about each motion sensor
ec_rate: set/get the EC sampling rate of sensors
sensor_range: set/get the sensor range (ie +/- 2G,4G,8G)
sensor_odr: set/get the sensor output data rate (ie 50Hz, 100Hz, ...)

For sensor_range and sensor_odr parameters, since the host doesn't know
what are valid values for the parameter, the host can specify to round
up or down to the nearest valid value. For example, the host can specify
to set the output data rate to at least 100Hz, and the EC will return
the closest valid output data rate that is at least 100Hz.

BUG=chrome-os-partner:27321
BRANCH=rambi
TEST=Test on a glimmer using ectool from vt-2 prompt:

> ectool motionsense help
Usage:
  motionsense                            - dump all motion data
  motionsense info NUM                   - print sensor info
  motionsense ec_rate [RATE_MS]          - set/get sample rate
  motionsense odr NUM [ODR [ROUNDUP]]    - set/get sensor ODR
  motionsense range NUM [RANGE [ROUNDUP]]- set/get sensor range
>
> ectool motionsense
Sensor 0: 0, 0, 1024
Sensor 1: 1024, 0, 0
Sensor 2: None
> ectool motionsense info 0
Type:     accel
Location: base
Chip:     kxcj9
> ectool motionsense ec_rate
10
> ectool motionsense ec_rate 1000
1000
> ectool motionsense odr 0
100000
> ectool motionsense odr 0 40000 1
50000
> ectool motionsense range 0 8
8

After running this I verified on the EC console that all the parameters
were set appropriately. I tested the EC sampling rate was 1000ms by
running lidangle on and making sure samples were displayed roughly every
second. I verified the sensor odr and range by defining
CONFIG_CMD_ACCELS and typing:

> accelrange 0
8
> accelrate 0
50000

Change-Id: I444e2f0eafabd607f1c7aa78b5c4e91f6cb06387
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192064
Reviewed-on: https://chromium-review.googlesource.com/193307
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-05 03:25:47 +00:00
Bill Richardson
dfb7ac632b Fix idle task deep sleep on Samus.
Samus' power sequence is not in common/power, so it was overlooked when
enabling deep sleep support. Fix it.

BUG=chrome-os-partner:27705
BRANCH=ToT
TEST=manual

Verify that the EC is not going into deep sleep while the AP is on by
looking at the EC console:

With the AP on:

> idlestat
Num idle calls that sleep:           1518647
Num idle calls that deep-sleep:      414
Time spent in deep-sleep:            0.000000s
Total time on:                       316.642174s
Deep-sleep closest to wake deadline: 698us
> sleepmask
sleep mask: 00020001
>

With the AP off (or in S3):

> idlestat
Num idle calls that sleep:           1846586
Num idle calls that deep-sleep:      831
Time spent in deep-sleep:            11.089183s
Total time on:                       388.695558s
Deep-sleep closest to wake deadline: 698us
> sleepmask
sleep mask: 00020000
>

Change-Id: Iba708b6d53f96ef6d49d42bcf6d21db4732399b0
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/193223
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-04-04 22:18:25 +00:00
Bill Richardson
2cd8a20204 Samus: LIGHTBAR_RESET_L should be open-drain.
This GPIO was configured as TTL. It should be open drain instead.

BUG=chrome-os-partner:27280
BRANCH=ToT
TEST=manual

Hard reboot, lightbar still works.
Try turning it off and on from the EC console:

> gpioset LIGHTBAR_RESET_L 0

lightbar goes dark.

> gpioset LIGHTBAR_RESET_L 1
> lightbar init
> lightbar on

lightbar comes on again.

Change-Id: If4d4beade8c95f3f231eeed435e35350ce866cea
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192871
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-02 21:43:11 +00:00
Randall Spangler
a13edcc038 Add OWNERS files
These are not currently checked by gerrit, but will be at some point
in the not-too-distant future.

The board/ directory gets additional owners to make it easier for
partner eng to make changes in ToT.

BUG=chrome-os-partner:27404
BRANCH=none
TEST=none (since gerrit doesn't check owners yet)

Change-Id: Ie21b9530fcc6d708ab987d9de80676f91faa72b9
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191947
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
2014-04-02 19:58:53 +00:00
Bill Richardson
9f40d3f90e Add charge_state_v2 algorithm for use by Samus
This is a complete rewrite of the charge_state task used by x86 platforms.
Rather than having a bunch of state-specific functions, each with their own
error handling and special cases, this is organized like so:

  Forever:
  1. Read everything we can from the battery and charger.
  2. Figure out what we'd like to do (including error handling).
  3. Allow for customization to override that.
  4. Do it.

Things I need to file bugs for are marked with "TODO(wfrichar)". I'll file
the bugs after this CL goes in, so that they'll have something relevant to
refer to.

BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=manual

  make buildall -j

Try it on Samus, watch it charge from nearly empty to full, both with and
without fastcharge enabled.

Also undefine CONFIG_BATTERY_PRESENT_CUSTOM, plug and unplug the battery to
be sure the trickle charging logic is correct when it can't tell if the
battery is present.

Change-Id: I3935cd3b87f322eb52178f8a675a886c16b75d58
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191767
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-01 21:37:32 +00:00
Louis Yung-Chieh Lo
be17ca9d91 big: fixed a LED corner case while almost full
Vic points out a corner case that the battery LED could be off by
the followng steps:

1. charge the battery to very full
2. disconnact the AC so that the LED is off for discharge.
3. plug AC again, then charger enters INIT state -->
   IDLE0 --> IDLE where those states don't toggle LED.

BUG=none
BRANCH=big
TEST=Reproduced this bug on big. Verified this has been fixed by this CL.

Change-Id: I7125acd6b11953675ac6d4085e31e0560b384015
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189757
2014-04-01 02:46:34 +00:00
ChromeOS Developer
daeddb75e9 Rambi, Squawks: Clean up old comment on keyboard IRQ
The comment about cleaning up _NEW signals related
to the keyboard IRQ was taken care of by
https://chromium-review.googlesource.com/#/c/181718/4

BUG=None
BRANCH=ToT
TEST=make buildall -j 32

Change-Id: I635ec910b0c2f7fe686c9a7480095a65085e8a91
Original-Change-Id: I97e6f66340d9f8683ed69548cdbbe7c243c3b764
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185020
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192199
2014-04-01 00:47:28 +00:00
ChromeOS Developer
bc8ed17c5f Squawks: Fix manual control of the power LED
BUG=chrome-os-partner:25531
BRANCH=None
TEST=Run the following:
  ectool led power off
  ectool led power green
  ectool led power green=20
  ectool led power auto

Change-Id: I0f6808290a495666dc5c048c9a2198fc6dd337d5
Original-Change-Id: I6d2ad424da12b7db5b6a33acd281eecfe56f61e0
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189603
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192198
2014-04-01 00:47:23 +00:00
ChromeOS Developer
8763e86df0 Squawks: Set adapter input current to 1575mA
Requested by ODM.

BUG=chrome-os-partner:24933
BRANCH=ToT
TEST=Verify input current with 'adc' console command
while system charging the battery and under heavy load.

Change-Id: I66a98852678758b4e73a7231d318b073ea5416c5
Original-Change-Id: I797a06cf4a3325c3895c6567d3e64465121efc70
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189387
Reviewed-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192197
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-01 00:44:21 +00:00
ChromeOS Developer
b52b3d3282 Squawks: Add smart battery temp sensor to temp sensors list
BUG=None
BRANCH=ToT
TEST=Run "ectool temps all". Verify battery temp reported.
Remove battery, verify an error is reported.

Change-Id: Ib20a0fda29f7cb88f0415efa5ae0b58ecf912a72
Original-Change-Id: Id8e5c26dde3e1332208a1ea2744f14a56808caea
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186414
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192196
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-04-01 00:44:17 +00:00
ChromeOS Developer
9dbf2d1143 Squawks: Enable low-power idle
BUG=chrome-os-partner:25377
BRANCH=None
TEST=Manual. Shutdown system. Verify "Disabling console
in deep sleep" message is displayed on EC console after
a few seconds. Boot and suspend system and perform the
same check.

Signed-off-by: Dave Parker <dparker@chromium.org>

Change-Id: I697395283a3deda323c02e2e025adb05ae4a4fc2
Original-Change-Id: I8d15ab1cab9ffb6b4ff5c01176b8015276f67326
Reviewed-on: https://chromium-review.googlesource.com/184966
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Alec Berg <alecaberg@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192195
2014-04-01 00:42:11 +00:00
henryhsu
c5d408438a Fix EC_PWROK pin for Squawks evt board
BUG=chrome-os-partner:25298
BRANCH=rambi
TEST=manaully test on Squawks EVT board
Signed-off-by: Heng-ruey Hsu <henryhsu@chromium.org>

Change-Id: Ifc63dd22607c23719dedb6af8e570da4076ad8ee
Original-Change-Id: I932545e0bf0234eb9c3bdc399f5b29c9e4913951
Reviewed-on: https://chromium-review.googlesource.com/183904
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Heng-ruey Hsu <henryhsu@chromium.org>
Tested-by: Heng-ruey Hsu <henryhsu@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192194
Tested-by: Dave Parker <dparker@chromium.org>
Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>
Commit-Queue: Dave Parker <dparker@chromium.org>
2014-04-01 00:42:07 +00:00
ChromeOS Developer
c82d35cdcf Squawks: Enable USB power in S3 if USB ports enabled at suspend
BUG=chrome-os-partner:24876
BRANCH=None
TEST=Suspend with a USB keyboard attached. On
the EC console, 'gpioget pp5000_en' should be 1.

Change-Id: Ic4ec175e2a5b51c433143e61e417d2171f1f99f2
Original-Change-Id: Ie7850617befa32dd2c2146ef23d18252ef6ea4a4
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186673
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192193
2014-04-01 00:39:04 +00:00
ChromeOS Developer
1036c890cb Squawks: Default enable WLAN antenna and power in suspend
BUG=chrome-os-partner:25655
BRANCH=None
TEST=Verify WLAN_OFF_L = 1 and GPIO_PP3300_WLAN_EN = 1 in suspend.

Change-Id: I06df0a7c629e554fad110a9c3611d84035100af3
Original-Change-Id: I6d60fe78d51a1b6ef16b3e1df242025e927aa7d1
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187994
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bernie Thompson <bhthompson@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/192192
2014-04-01 00:39:02 +00:00
Bill Richardson
9151377708 Add charger_get_params() function to query charger state.
This returns all the parameters of the charger that must be monitored
frequently. While some of the fields are charger-specific, all of the
parameters are present in all supported chargers.

Nothing uses this yet.

BUG=chrome-os-partner:20881
BRANCH=ToT
TEST=make buildall -j

All targets build; all tests pass.

Change-Id: Id3e00532469b193aeab3acf93e94afe3ffb8c6b6
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191985
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-28 15:23:04 +00:00
Bill Richardson
f47b6e84e5 Make battery_is_present() tristate: YES, NO, NOT_SURE
In most cases we can't actually know whether a battery is present until
we've been able to talk to it. This adds that NOT_SURE case.

BUG=none
BRANCH=ToT
TEST=none

Nothing uses this case yet, and the only time that battery_is_present() is
called is when we have hardware to detect the battery (which always returns
YES or NO). This is just preparation for charge_state_v2, which will need
the NOT_SURE case for trickle charging.

Change-Id: Ic5793de080529d50c98860450a021a1abae168db
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191782
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-27 18:45:06 +00:00
Vincent Palatin
130a2d6a9a Add a charger board
Using minimal runtime to fit the charger flash and RAM size.

It is currently more an experiment than the final layout written in the
stone.

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

BRANCH=none
BUG=none
TEST=run on STM32F051 Discovery with
limited RAM and Flash to mimic STM32F031.

Change-Id: I10ee1decfd1f1448edbc909f0e997367921c4b53
Reviewed-on: https://chromium-review.googlesource.com/189405
Reviewed-by: Vic Yang <victoryang@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-03-23 23:35:23 +00:00
ChromeOS Developer
8a4c5e78dc Blaze: Configure board to use CHARGER_V1
Looks like this board just missed a change to temporarily fork the
charger code while it is being refactored.

BUG=None
BRANCH=nyan,blaze
TEST=make -j BOARD=blaze

Change-Id: I4ca630cc5210486928fbeda9af3e9c11ddbc8daa
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/191214
2014-03-22 22:50:23 +00:00
Neil Chen
53d46c5ca1 Add initial blaze support
once firmware branch exists, this commit need go into it and
doesn't need to be carried in master forever

BRANCH=blaze
BUG=chrome-os-partner:27120
TEST=USE="nyan_blaze" emerge-nyan_blaze chromeos-ec;flash nyan
board, verify ec is alive and version is reported as blaze

Change-Id: I115890a7122440a25c3d1f5e4b94248099a1de99
Signed-off-by: Neil Chen <neilc@nvidia.com>
Reviewed-on: https://chromium-review.googlesource.com/190610
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-03-22 18:49:09 +00:00
Alec Berg
727b4e4e0d samus: enable config option for low power idle
Enable low power idle for Samus.

BUG=none
BRANCH=none
TEST=tested on samus. made sure EC comes up with no obvious
problems and that the EC goes into deep sleep a minute after
no console activity.

Change-Id: I00e196560759dfd62915e645319de606f2f29df3
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190791
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-by: Sameer Nanda <snanda@chromium.org>
2014-03-21 09:23:55 +00:00
Bill Richardson
a025f18673 Rename charge_state.[ch] to charge_state_v1.[ch]
Making room for a new charge_state implementation.

BRANCH=ToT
BUG=chrome-os-partner:23776
TEST=make buildall -j

No new functionality, just renaming some files.

Change-Id: I80ce861f09129a518e180cac20d32e867a93cd46
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/190852
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-20 23:51:00 +00:00
cloud_lin
24417669a6 Big: Add ectool discharge command.
BRANCH=big
BUG=None
TEST=Run ectool chargecontrol command with each option (normal,
 idle, discharge) on Big. Verifiy battery is discharging
 in discharge mode via EC console 'battery' command.
Signed-off-by: Cloud Lin <Cloud_Lin@compal.com>

Change-Id: Iab150c36df64016d06831a6a6c620742738ae2af
Reviewed-on: https://chromium-review.googlesource.com/189450
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Lin Cloud <cloud_lin@compal.com>
Commit-Queue: Lin Cloud <cloud_lin@compal.com>
2014-03-18 11:24:20 +00:00
Louis Yung-Chieh Lo
c00675b909 cleanup: remove the conflict I2C2/GPIO config in nyan/big.
After Alex's CL 8a9817a, the i2c driver no longer hardcodes the
I2C port pin (Ya!). Remove the conflict pin setting in board files.

BRANCH=nyan,big
BUG=chrome-os-partner:26620
TEST=build and run on nyan board. Everything looks good.

Change-Id: Iee2c5f10f642da7ad00f503b6e615cb6aa472459
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/189245
Reviewed-by: Alec Berg <alecaberg@chromium.org>
2014-03-13 23:22:29 +00:00
git-cloud_lin.compal.com
344c2fb865 Big: implement the power and battery LED behavior
Remove power_led_task and add the big-specific LED logic

BRANCH=big
BUG=None
TEST=manually
>> ectool led power blue:   PWR LED blue
>> ectool led power yellow: PWR LED orange
>> ectool led power off:    PWR LED off
>> ectool led power auto:   PWR LED auto control
>> ectool led battery blue:   BAT LED blue
>> ectool led battery yellow: BAT LED orange
>> ectool led battery off:    BAT LED off
>> ectool led battery auto:   BAT LED auto control
Signed-off-by: Cloud Lin <cloud_lin@compal.com>

Change-Id: I5ded361a46c627e4e4e6fcb6bddea9b487a46768
Reviewed-on: https://chromium-review.googlesource.com/188631
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Lin Cloud <cloud_lin@compal.com>
Tested-by: Lin Cloud <cloud_lin@compal.com>
2014-03-11 05:54:08 +00:00
Vincent Palatin
e926fd6311 add support for FruitPie board
Until we have real hardware, use the STM32F072B Discovery board as a
test vehicle and do a configuration compatible with both boards.

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

BRANCH=none
BUG=none
TEST=run EC console on STM32F072B Discovery board,
and pass all available unit-tests on target.

Change-Id: Ica691f9fc915d2873761025e7c019f8a6484b9b1
Reviewed-on: https://chromium-review.googlesource.com/188984
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
2014-03-11 05:53:46 +00:00
cloud_lin
cb462f29c6 Big: add LGC 3s battery info
BRANCH=big
BUG=chrome-os-partner:26533
TEST=build ec and flash to big board; verify battery works

Signed-off-by: Cloud Lin <cloud_lin@compal.com>
Signed-off-by: Katie Roberts-Hoffman <katierh@chromium.org>

Change-Id: Ia005a549b8318b4f8df81e7b1341d50da28f4282
Reviewed-on: https://chromium-review.googlesource.com/188632
Reviewed-by: Katie Roberts-Hoffman <katierh@chromium.org>
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
2014-03-07 03:41:36 +00:00
MilesDY_Chen
fcdb93668a Big: add 4s battery LGC AC14B8K support
Big can't be powered on by using 4s LGC AC14B8K battery.
Thus, add 4s battery definition to ec.

BRANCH=big
BUG=chrome-os-partner:26533
TEST=flash ec to big device and confirm battery works

Change-Id: I32d2eb2fabc70f3fc075a49a67c1fd4d30975981
Signed-off-by: MilesDY_Chen <MilesDY_Chen@compal.com>
Signed-off-by: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/188651
2014-03-07 00:41:44 +00:00
Katie Roberts-Hoffman
f4f934c103 Add initial big support
BRANCH=big
BUG=chrome-os-partner:26533
TEST=emerge-nyan_big chromeos-ec; flash big board, verify
ec is alive and version is reported as big

Change-Id: Idbf84d029b5c7b7c198f8c4a2bd2a90d79524441
Reviewed-on: https://chromium-review.googlesource.com/188926
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-by: Yung-chieh Lo <yjlou@chromium.org>
Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-06 20:16:49 +00:00
Bill Richardson
bfb16961c7 Samus: Enable manual control of TOUCHSCREEN_RESET_L
The charger task was holding this either on or off in S3, no matter what we
wanted. We really only need to set it at S3->S0 or S3->S5, or when the
lid opens or closes. The rest of the time we should be able to turn it off
and on with gpioset, for testing purposes.

BUG=chrome-os-partner:26502
BRANCH=ToT
TEST=manual

Check the state with

  gpioget TOUCHSCREEN_RESET_L

Open and close the lid, suspend the AP with powerd_dbus_suspend, etc. The
touchscreen should be on when the lid is open and the AP is in either S3 or
S0, off when the lid is closed or the AP is off.

Then

  gpioset TOUCHSCREEN_RESET_L 1
  gpioget TOUCHSCREEN_RESET_L
  gpioset TOUCHSCREEN_RESET_L 0
  gpioget TOUCHSCREEN_RESET_L

The change should persist as long as nothing else changes.

Change-Id: If7b6f809b1b28ae2699d0fbc6c9b2305fc57cbff
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/188869
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-06 17:51:38 +00:00
Alec Berg
8a9817a5c7 cleanup: Combined i2c unwedge code into one common function
Refactored the i2c unwedge code to place it in the common directory
so that any EC chip can use it.

Added to the STM32F and LM4 boards, code to automatically detect and
unwedge the i2c bus at the start of an i2c transaction. Note that STM32L
already had this ability.

To enable unwedging of the i2c port though, the gpio pins for SDA and
SCL must be defined in the i2c_ports[] array in the board.c file. This
allows the i2c module to bit bang the unwedging for the given port. If
SDA and SCL are not defined for the port, then the unwedge code will
not run.

BUG=chrome-os-partner:26315, chrome-os-partner:23802
BRANCH=none
TEST=Manual testing on machines with different EC chips.

Testing made extensive use of https://chromium-review.googlesource.com/66389
in order to force wedging of the i2c bus so that we can attempt to unwedge
it. Note that you can easily test if the bus is wedged by running i2cscan.

On pit and spring:
On pit, after each of the following, I verified that the bus was automatically
unwedged.
On spring, the unwedge only runs at reboot, so, for the non-reboot wedge
commands, I manually ran console command unwedge, and verified that the bus
became unwedged.
(1) Bit bang a transaction but only read part of the response.
    Command to wedge: i2cwedge 0x90 0 2 2
(2) Bit bang a transaction to do a "write" and stop while the other side is
    acking. Command to wedge: i2cwedge 0x90 0 1
(3) Same as (1) but do a reboot instead of returning and see
    that the unwedge works at init time w/ no cancelled transactions.
    Command to wedge: i2cwedge 0x90 0 6 2
(4) Same as (2) but do a reboot instead of returning and see
    that the unwedge works at init time w/ no cancelled transactions.
    Command to wedge: i2cwedge 0x90 0 5

On glimmer:
Added code to call i2c_unwedge in accel_init(). Then tested unwedging the
accelerometer with the following. One extra difficulty testing this with
the accelerometer is that sometimes the bit you stop on is high, which
means it won't be wedged at all, the next start transaction will reset
the bus. So, sometimes running i2cwedge won't wedge the bus and sometimes
it will depending on the acceleration data.
(1) Big bang transaction to do a "read" of accelerometer and stop partway:
    i2cwedge 0x1c 0x0f 2 2
    i2cscan to make sure bus is actually wedged
    i2cunwedge
    i2cscan to make sure bus is now unwedged.
(2) Bit bang transaction to do a "read" and stop partway, then reboot:
    i2cwedge 0x1c 0x0f 6 2.
    i2cscan to verify that the bus is working after the reboot.

Change-Id: Ie3328e843ffb40f5001c96626fea131c0f9ad9b1
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/188422
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-03-06 02:42:49 +00:00
Randall Spangler
b805917e43 rambi: Remove ignored PCH signals
The EC had inputs with internal pullups on SUS_STAT#, SUSPWRDNACK, and
SLP_SX#.  But we never used those signals for anything.  The pullups
cost 1.5 mW power in S3.  So, remove those signals and their pullups.
They can be turned back on via CONFIG_CHIPSET_DEBUG.

BUG=chrome-os-partner:25568
BRANCH=rambi
TEST=build with and without CONFIG_CHIPSET_DEBUG.  Verify gpioget and
     powerindebug show the signals only when it's defined.

Change-Id: I0851243615c91a3aa8aa1b28df70809b578d2e74
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/188389
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-03-01 21:57:41 +00:00
Alec Berg
2356c3e213 rambi: Rotate accelerometer data into standard reference frame
Added rotation of accelerometer data into a standard reference frame
so that the host does not have to know about the orientation of the
sensors.

Also added a calibration routine to calibrate the rotation matrix to
get to the standard reference frame. Cleanup up calibration in the
process to make it more user friendly.

Changed the default accelerometer sampling rate to 100Hz.

BUG=chrome-os-partner:25599
BRANCH=rambi
TEST=Tested the full calibration routine on a glimmer at my desk.
Used 'taskinfo' and verified that the higher sampling rate does not
bog down the EC. I found that the motion sense task is running for
about 200ms every 10 seconds, so about 2% CPU load.

Change-Id: I9ca1a4252f62a54016009c7d5e43b4cb1adf7e1d
Original-Change-Id: Id554511f7cc9549dfc9ed2d6337216bfa639359d
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187172
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/188385
2014-03-01 02:35:59 +00:00
Bill Richardson
19bcc7f481 samus: fix an output to be open-drain
This was always supposed to be open drain.

BUG=chrome-os-partner:22870
BRANCH=ToT,samus
TEST=manual

Try turning it off and back on again. ;-)

gpioset TOUCHSCREEN_RESET_L 0
gpioset TOUCHSCREEN_RESET_L 1
gpioset TOUCHSCREEN_RESET_L 0

Change-Id: I5e2a49c979294f68b86e2c91d2ccee5f6128ef5a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/188045
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-26 21:37:54 +00:00
ChromeOS Developer
1cdd0d9b31 BayTrail: Fix ADC adapter current calculation
BUG=chrome-os-partner:25977
BRANCH=None
TEST=Run 'adc' console command on a heavily loaded system while
charging the battery. The current reported should be around the
CONFIG_CHARGER_INPUT_CURRENT limit.

Change-Id: I1b4089d00182ce7d286b387361a63edade626f38
Original-Change-Id: I18e5bbb0a45312afbcb7d989517a86b97646c2da
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187018
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187887
2014-02-26 01:52:50 +00:00
Randall Spangler
930b41e6a9 Allow AP to set wireless power state in suspend
Previously, the AP could only set the current wireless power state.
It couldn't determine what the EC would do in S3, nor could it get the
current wireless power state.  Extend the wireless command to do so,
and add an EC console command to aid in debugging.

BUG=chrome-os-partner:25655
BRANCH=rambi
TEST=manual; expected numbers are from EC 'wireless' command
  AP off -> 0x0, 0x9
  AP on -> 0xd 0x9
  AP suspended -> 0x9 0x9
  AP on -> 0xd 0x9
  ectool wireless 0x1 -> 0x1 0x9
  ectool wireless 0xd -> 0xd 0x9
  ectool wireless 0 0 0 0 -> 0xd 0x9 (and prints 0xd 0x9 to root shell)
  ectool wireless 5 -1 -1 0 -> 0x5 0x9
  AP suspended -> 0x1 0x9 (doesn't turn on 0x8, just turns off 0x4)
  AP on -> 0xd 0x9
  ectool wireless 0 0 0 -1 -> 0xd 0x0
  AP suspended -> 0x0 0x0
  AP on -> 0xd 0x9

Change-Id: I8ead2d4a4423b51ec4f638bf94c62de98726b25c
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187273
2014-02-22 00:50:37 +00:00
Alec Berg
89cae30e57 Added unit tests for lid angle calculation and acos
Added unit test for motion_sense lid angle calculations.
Added unit test for math_util arc_cos() function.

BUG=none
Original-BUG=chrome-os-partner:25640
BRANCH=rambi
TEST=make buildall

Original-Change-Id: I35debf6fc0e2d9996debc2ede175acaa060df627
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186720
Reviewed-by: Vic Yang <victoryang@chromium.org>
(cherry picked from commit 55c3e8ee14693d6d667b5d21f0dcbb14d185ccbe)

Change-Id: I017315128f318424cd3000affae785c69afd29d6
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/187434
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-22 00:49:56 +00:00
Louis Yung-Chieh Lo
e43074ebcf cleanup: nyan: remove unnecessary dependence to pmu_tpschrome.h
Nyan uses common/charge_state instead. So, fix the dependence.
Since snow/spring/pit are using common/pmu_tps65090_charger, keep them.

BUG=None
BRANCH=Nyan
TEST=build and works fine on Nyan 3.2

Change-Id: I985f7980578ac22602b1fbffa51edf039078bc05
Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/186337
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-14 17:46:34 +00:00
Jaehoon Kim
7aa3258ae7 Pit: Change the temperature range in discharging state.
Samsung change the temperature range in battery discharing state from (0
<=temp < 100) to (-20 <= temp < 70) from this year. That's why we have to
change the battery_temperature_range structure value as soon as possible
so that our reliability team check the battery.

BUG=chrome-os-partner:25731
TEST=Boot on the pit / pi and then check the battery is working or
not in the oven.
BRANCH=pit

Change-Id: I3289d22176af043e80a881f1626da386e823d857
Signed-off-by: Jaehoon Kim <jh228.kim@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/186040
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-13 08:44:45 +00:00
ChromeOS Developer
a78c59e4ac Add comment about matching temp sensor index and name with coreboot
BUG=None
BRANCH=rambi
TEST=None

Change-Id: I702173af23e6207129149bdb83ec7116fec8af66
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185394
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
2014-02-12 00:40:33 +00:00
Randall Spangler
dad376eada baytrail: Battery cutoff return codes were backwards
cutoff() returns 0 on success, not non-zero.

BUG=chrome-os-partner:25646
BRANCH=rambi
TEST=ectool batterycutoff succeeds

Change-Id: Icca0c53aba82381b73dd679de5df3a97153d0662
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185737
Reviewed-by: Benson Leung <bleung@chromium.org>
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-11 05:30:27 +00:00
Randall Spangler
3192264679 Include battery fuel gauge temp sensor in temperature sensors
This gives the AP a way to see that temperature for DPTF.  Alarm
thresholds were defined on a per-sensor basis, so they come along for
free.

BUG=chrome-os-partner:25585
BRANCH=rambi
TEST=temps command shows same temp for battery as battery command (other
     than rounding error; battery command shows with 0.1C accuracy).
     'ectool temps all' shows the battery temp as the last temperature.

     Unplug battery and temps command shows error for the battery temp,
     as does 'ectool temps all'.

Change-Id: I1bce72f164d9fb1be631e7241a4ea24ddf409d7a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185444
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-08 04:21:26 +00:00
Bill Richardson
683beb8737 Samus: Support capsense input as keyboard events.
This is experimental for now; the capsense chip simply reports its buttons
as the number keys on the keyboard (1-8).

BUG=chrome-os-partner:23382
BRANCH=samus,ToT
TEST=manual

To test, you'll need a reworked and correctly programmed capsense module.
Boot the system, and switch to VT2. Touch the capsense bar and you'll see
the input appear on the console as though you were typing numbers.

Note that the capsense hardware is still buggy. Refer to the bug for
workarounds.

Change-Id: I4c3a8b70b8197ffd538c38c59c9336383365afa7
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185434
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-08 04:15:39 +00:00
Randall Spangler
6ff7a74006 rambi: Update LED charging algorithm
Green when charged and ext. power plugged in.
Orange when charging.
Blinking orange if there is a charging/battery related error.
Blinking green if in "charge force idle mode" in the factory.
Off otherwise.

BUG=chrome-os-partner:23634
BRANCH=rambi
TEST=test each of the states above
     To fake battery error, unplug battery and wait 30 secs
     To force idle, 'ectool chargecontrol idle'

Change-Id: I85fff72d1df85bbbaa1da66572f44f58a960244e
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/185240
Reviewed-by: Dave Parker <dparker@chromium.org>
2014-02-07 04:14:43 +00:00
ChromeOS Developer
86eea83cee Add support for extra buttons not on the keyboard
BUG=chrome-os-partner:24370
BRANCH=tot
TEST=Run button unit test.

Orig-Change-Id: I61b4a6624d62831ce0bfdf7a0f36a45349b37f96
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/184544
Reviewed-by: Randall Spangler <rspangler@chromium.org>
(cherry picked from commit f6426cc21c20a4f876cff28b9ce7e3115f0b054a)

Change-Id: I4face9bf0797a91ec8bef390093aab8e3d8f97ab
Reviewed-on: https://chromium-review.googlesource.com/185243
Tested-by: Randall Spangler <rspangler@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Commit-Queue: Randall Spangler <rspangler@chromium.org>
2014-02-07 04:13:18 +00:00
Jaehoon Kim
f1b622231b Pit: Add Green LED function in tps65090 charger driver
From DV2 board of pit, we'll use 3 color-LED instead of power LED on keyboard.
So, we have to add the function to control 3 color-LED in pmu driver.

BUG=chrome-os-partner:24855
TEST=Tested on the pi and pit board about all power status.
BRANCH=pit

Change-Id: I7b1df39de8fa56eab73779abfa52cf8f72427b44
Signed-off-by: Jaehoon Kim <jh228.kim@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/181588
Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Commit-Queue: Wonjoon Lee <woojoo.lee@samsung.com>
2014-02-06 15:18:14 +00:00
ChromeOS Developer
c35251d662 Add configs for battery detect via gpio or custom function
BUG=chrome-os-partner:24649
BRANCH=baytrail
TEST=Boot target device w/o battery. There should be no 30 second
delay prior to boot.

Change-Id: If7a60919701d1c241670d0b32e04f3e188a643f1
Signed-off-by: Dave Parker <dparker@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/182921
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-02-06 01:22:17 +00:00