summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Squawks: Fix manual control of the power LEDChromeOS Developer2014-03-111-1/+1
| | | | | | | | | | | | | | | 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: I6d2ad424da12b7db5b6a33acd281eecfe56f61e0 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189603 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Squawks: Set adapter input current to 1575mAChromeOS Developer2014-03-111-1/+1
| | | | | | | | | | | | | | 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: I797a06cf4a3325c3895c6567d3e64465121efc70 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189387 Reviewed-by: Todd Broch <tbroch@chromium.org>
* Glimmer: Add second source fan tableHenry Hsu2014-03-111-14/+19
| | | | | | | | | | | | | | | | | | | | | Glimmer use BOARD_VERSION3 to identify two fan module. Each of them have its own thermal table (different rpm) due to keep the same noise. on off RPM(FAN_ID low) RPM(FAN_ID high) 42 35 4000 3950 48 39 4350 4550 63 53 5150 5600 BUG=chrome-os-partner:25076 BRANCH=glimmer TEST=For different fan module, the fan can work with different fan speed as above. Change-Id: If1ee2e8d2931e2193233d933ca01de68d499d8bf Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/189032 Reviewed-by: Dave Parker <dparker@chromium.org>
* Clapper: Modify battery LED behaviorgit-CarryBK_Chen.compal.com2014-03-111-2/+2
| | | | | | | | | | | | | | | | | | Set battery LED to WHITE when the battery is charged, the system is on AC power, and the system is off or in suspend. BRANCH=clapper BUG=none TEST=manually Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I408766d48ff37a4a0e372072dcc221467d1359cc Reviewed-on: https://chromium-review.googlesource.com/188953 Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-by: Antonie Cheng <Antonie_Cheng@compal.com> Commit-Queue: Antonie Cheng <Antonie_Cheng@compal.com> Tested-by: Antonie Cheng <Antonie_Cheng@compal.com>
* rambi: Add 7 ms delay before turning off PP3300_DX at shutdownRandall Spangler2014-03-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This works around an issue where LCDVCC falls too slowly. The impact is to slow shutdown by 7 ms, which isn't noticeable to the user. BUG=chrome-os-partner:26561 BRANCH=rambi TEST=shut down rambi; still shuts down, and ~7 ms more time is spent in S0->S3 state. before: [429.933010 power state 3 = S0, in 0x043f] [429.933240 power state 7 = S0->S3, in 0x043f] [429.933614 power state 2 = S3, in 0x042b] [429.934013 power state 8 = S3->S5, in 0x0428] after: [20.355975 power state 3 = S0, in 0x003f] [20.356194 power state 7 = S0->S3, in 0x003f] [20.363957 power state 2 = S3, in 0x002c] [20.364179 power state 8 = S3->S5, in 0x002c] [20.364877 power state 1 = S5, in 0x0008] Change-Id: I657ce33d9769744ba5e9c751013678911dee51d3 Original-Change-Id: Ie843bdcf740f3dbc1b866a0356cea2a8b42d4194 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189092 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189200 Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* rambi: fix potential bug in accelerometer initAlec Berg2014-03-071-2/+2
| | | | | | | | | | | | | | | | | | Fixed a potential bug in accelerometer initialization that could result in failing to write the desired accelereometer settings. Before writing the desired settings, we first send a command to perform a software reset. While waiting for software reset to complete, if we have an I2C error, then we could interpret this as software reset complete and go on to write the accelerometer settings before the reset has actually completed. BUG=none BRANCH=rambi TEST=Code inspection. I haven't actually seen this bug, I just saw the potential for it. Change-Id: I78757106291ffbaeff27f94aa6f74c9cea81e0b9 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189064
* glimmer: clapper: add I2C unwedge ability to accel portsAlec Berg2014-03-074-2/+12
| | | | | | | | | | | | | | | | | | | | | This adds the ability for clapper and glimmer to automatically detect and unwedge the I2C bus on the accelerometer port. BUG=chrome-os-partner:26136 BRANCH=rambi TEST=manual test on glimmer: Used servo board to perform a cold boot until I noticed that on boot I got an I2C unwedge message on the prompt. Then ran i2cscan to make sure accelerometer bus was working. This shows that on boot we detected a hang and fixed the porblem. I've also tested this on the trunk using the i2c_wedge command which is not yet in this branch. Change-Id: If23ffbd8b41d1c559894a8ba1b15eb1525a91a13 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/189056
* i2c: add wedge commandHung-ying Tyan2014-03-072-0/+344
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This command wedges the I2C bus by writing part of a byte to or reading part of the response from the slave device. To enabled the wedge command you must define CONFIG_CMD_I2CWEDGE and you must define I2C_PORT_HOST, the i2c port to use the wedge command. BUG=chrome-os-partner:19286 TEST=Manual test on peach pit, spring, and glimmer. Define config in board.h to enable the command: On the EC console, execute the following "i2cwedge" command i2cwedge 0x90 0 1 (wedge write) or i2cwedge 0x90 0 2 (wedge read) and then "battery". Observe that the command reports an error. Similarly, execute i2cwedge 0x90 0 5 (wedge write + reboot) or i2cwedge 0x90 0 6 (wedge read + reboot) on the EC console and observe a reboot. Then execute "battery" and observe that the command works properly. BRANCH=none Change-Id: I10ccb21b047df907a4dfdbd84c0f582cfa2d939a Signed-off-by: Hung-ying Tyan <tyanh@chromium.org> Signed-off-by: Doug Anderson <dianders@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/66389 Tested-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Alec Berg <alecaberg@chromium.org> (cherry picked from commit 6bdc69940188cd4f17ecde547afbbc3ad8335367) Reviewed-on: https://chromium-review.googlesource.com/189214
* Clapper: Add ship modegit-CarryBK_Chen.compal.com2014-03-061-1/+67
| | | | | | | | | | | | | | BRANCH=clapper BUG=chrome-os-partner:24375 TEST=manually Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I2af97146d6ddc1ee7470b7157b0a91ebfc894c9c Reviewed-on: https://chromium-review.googlesource.com/188633 Reviewed-by: Dave Parker <dparker@chromium.org> Reviewed-by: Antonie Cheng <Antonie_Cheng@compal.com> Tested-by: Antonie Cheng <Antonie_Cheng@compal.com> Commit-Queue: Antonie Cheng <Antonie_Cheng@compal.com>
* cleanup: Combined i2c unwedge code into one common functionAlec Berg2014-03-0610-268/+489
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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/188924 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rambi: Remove ignored PCH signalsRandall Spangler2014-03-0411-3/+46
| | | | | | | | | | | | | | | | | | | | | | | | 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. Orig-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> (cherry picked from commit b805917e43ec2912404892aede64a1265201a4a4) Change-Id: I6459bd7f544755915ac7c5f0b986a8faab1f3555 Reviewed-on: https://chromium-review.googlesource.com/188538 Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Dave Parker <dparker@chromium.org>
* Add arbitrary-length read support to i2cxferRandall Spangler2014-03-031-68/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, it could only read 8 or 16 bit values BUG=chrome-os-partner:26191 BRANCH=rambi TEST=manual Counted string for battery manufacturer name: > i2cxfer rlen 0 0x16 0x20 16 Data: 0653696d706c6fe1e1e1e1e1e1e1e1e1 Read lifetime data block 1 (also tests 16-bit writes) > i2cxfer w16 0 0x16 0 0x60 > i2cxfer rlen 0 0x16 0x23 32 Data: 20d2d2d2d2948700000d0a0a060a000000020000000000000000000000000000 Read lifetime data block 2 > i2cxfer w16 0 0x16 0 0x61 > i2cxfer rlen 0 0x16 0x23 27 Data: 1b0000000000010200010c02000201000100000300002008082009 8 and 16 bit reads still work > i2cxfer r 0 0x16 0x23 0x1b [27] > i2cxfer r16 0 0x16 0x23 0x001b [27] Change-Id: Ibba5aced60c0b2de04c3f86cf5fd2ab3db1b6308 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/188379 Reviewed-by: Alec Berg <alecaberg@chromium.org> (cherry picked from commit a35bfd69e9a749fbaa152937dd91a6ed407a9005) Reviewed-on: https://chromium-review.googlesource.com/188519
* Glimmer: Fan table implement.Henry Hsu2014-03-032-2/+51
| | | | | | | | | | | | | | | | | | | | | | | Glimmer define the thermal table for fan. The table is below: on off RPM 42 35 4000 48 39 4350 63 53 5150 SW Throttling: 65, HW Throttling: 67, EC Shutdown: 69. Where the temperature scale is celsius degree. BUG=chrome-os-partner:25076 BRANCH=glimmer TEST=Use external heater to change the temperature, the fan follows the fan table. Change-Id: I0ed69cdd538e66869c445de0e194fbd1e6eecc22 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/187774 Reviewed-by: Dave Parker <dparker@chromium.org>
* rambi: fix two bugs with accelerometer driverAlec Berg2014-02-281-2/+29
| | | | | | | | | | | | | | | | | | | Two bugs are: - Need to grab the I2C port mutex before performing i2cxfer. - Added sending software reset command to accelerometers on init. This is necessary because the accelerometers can be powered through an EC reboot, and it's important we restore them to a known state. BUG=none BRANCH=rambi TEST=Manually set accelerometer setting, rebooted, manually read that setting and verified it was restored to default. Change-Id: I0ea571f3a8dc46052128def24cbb5c1c29638469 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/188349 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* 8042: Add typematic support for non-matrixed buttonsChromeOS Developer2014-02-261-15/+51
| | | | | | | | | | | | | | BUG=chrome-os-partner:24956 BRANCH=ToT TEST=Using evtest, verify off-keyboard volume buttons now send repeat codes while held down. Verify power button does not send repeat codes. Verify keyboard keys still send repeat codes as before. Change-Id: I873548181cdfa40d8e8929a6538c0ecd5ed8e92c Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187938 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* BayTrail: Default enable WLAN antenna and power in suspendChromeOS Developer2014-02-264-3/+8
| | | | | | | | | | | | BUG=chrome-os-partner:25655 BRANCH=None TEST=Verify WLAN_OFF_L = 1 and GPIO_PP3300_WLAN_EN = 1 in suspend. 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>
* rambi: Changed accel i2c speed to 400kHz and added accels present bitAlec Berg2014-02-264-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Changed speed of accelerometer i2c bus to 400kHz. Added an accelerometers present bit to the status byte for host shared memory so that the host knows whether this system has accelerometers or not. BUG=chrome-os-partner:25599 BRANCH=rambi TEST=manual test with a glimmer. To test speed, just ran for a while at 400kHz and made sure there were no i2c errors and the data looked accurate using the lidangle on command. To test the accelerometers present bit, I used the kernel patch for the cros_ec_accel driver. First, I verified that without this patch, the kernel driver throws an error when loading the module. Second, I verified that with this patch the module was loaded successfully. Change-Id: If931b37bf057df96659852ef9699b3e6029275c7 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187732 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* rambi: Rotate accelerometer data into standard reference frameAlec Berg2014-02-267-61/+220
| | | | | | | | | | | | | | | | | | | | | | | | 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: Id554511f7cc9549dfc9ed2d6337216bfa639359d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187172 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Allow AP to set wireless power state in suspendRandall Spangler2014-02-2611-54/+252
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 (cherry picked from commit 930b41e6a9782e7c8e37f3a283de2e8a3164b155) Reviewed-on: https://chromium-review.googlesource.com/187867
* Clapper: Add smart battery temp sensor to temp sensors listChromeOS Developer2014-02-252-0/+6
| | | | | | | | | | | | | | | BUG=None BRANCH=None TEST=Run "ectool temps all". Verify Battery temp reported. Remove battery, verify an error is reported. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Ie2b1b12ec47da41d74a7702e1c2e4016d7cd70a1 Reviewed-on: https://chromium-review.googlesource.com/187633 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Glimmer: Remove board-level IDPM enableChromeOS Developer2014-02-241-2/+1
| | | | | | | | | | | | | | IDPM is now enabled by default in the bq24715 driver. BUG=None BRANCH=None TEST=Verify input current measured matches input current limit set in board.h. Change-Id: I5edffe28f2f569cb0f0f60b16fef7ff2c92101aa Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187518 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Enable IDPM for bq24715 charge controllerChromeOS Developer2014-02-242-3/+6
| | | | | | | | | | | | | | | | | Dynamic Power Management enables proper regulation of the input adapter current set in board.h. BUG=chrome-os-partner:24933 BRANCH=ToT TEST=Power a DUT with a bench supply. Verify the input current doesn't exceed the input current limit set in board.h while the system is under load and charging the battery. Change-Id: Ida6b05f1d89b21d7cf1553f5e9936360679f8149 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187517 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Clapper: Add LED functiongit-CarryBK_Chen.compal.com2014-02-234-9/+229
| | | | | | | | | | | | | | | | | | 1. Power LED 2. Battery LED 3. Test LED BRANCH=clapper BUG=chrome-os-partner:24371 TEST=manually Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I6e371964180077791b19a8839c418e0f57013c10 Reviewed-on: https://chromium-review.googlesource.com/187190 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Antonie Cheng <Antonie_Cheng@compal.com> Tested-by: Antonie Cheng <Antonie_Cheng@compal.com> Commit-Queue: Dave Parker <dparker@chromium.org>
* Clapper: Leave WLAN powered in S3ChromeOS Developer2014-02-211-0/+1
| | | | | | | | | | | BUG=None BRANCH=None TEST=Verify PP3300_WLAN_EN remains enabled in S3. Change-Id: I4f64e34ab672afa648b0bbea32da865f668b0363 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/187425 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Clapper: Modify input currentgit-CarryBK_Chen.compal.com2014-02-211-2/+1
| | | | | | | | | | | | | | | Change to 2.048A BRANCH=clapper BUG=chrome-os-partner:24373 TEST=manually Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I26b4026ba12355670f376148456c512a9bd12c0f Reviewed-on: https://chromium-review.googlesource.com/187232 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Clapper: Modify sensor's namegit-CarryBK_Chen.compal.com2014-02-211-2/+1
| | | | | | | | | | | | | BRANCH=clapper BUG=chrome-os-partner:24962 TEST=manually Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I10a41e0dd5b7e2f4fc3e5c998984f9702b7ef31c Reviewed-on: https://chromium-review.googlesource.com/187192 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Glimmer: Add config option to enable WiFi in suspendHenry Hsu2014-02-211-0/+1
| | | | | | | | | | | | | | | | Some WiFi devices do not tolerate losing power in suspend and will not function properly after resume if they have lost power. BUG=chrome-os-partner:25023 BRANCH=glimmer TEST=use powerd_dbus_suspend maually on Rambi about 20 times, the suspend function is more stable than before. Change-Id: I0692275a258d329ef5bb52eb139fcb6b954e7680 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/187222 Tested-by: Keith Tzeng <keith.tzeng@quantatw.com> Reviewed-by: Dave Parker <dparker@chromium.org>
* rambi: Add acceleration data to LPC shared memoryAlec Berg2014-02-202-8/+51
| | | | | | | | | | | | | | | After each read of the accelerometers, add accelerometer data to LPC shared memory. BUG=chrome-os-partner:25599 BRANCH=rambi TEST=Manual test by reading the LPC shared memory through cros_ec in the kernel. Change-Id: If66df3fcb32b5423f4fa7dd471c219a1c4df7095 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186456 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Glimmer: Implement the breathing led when suspendHenry Hsu2014-02-202-2/+43
| | | | | | | | | | | | | | The breathing led is gradual on in 1 second, gradual off in 1 second, and off for 3 seconds when system suspend. BUG=chrome-os-partner:24647 BRANCH=glimmer TEST=use command powerd_dbus_suspend, the led breathes normally. Change-Id: I2c5d018ca2765eab4f86ddf7d1617edd4f955b5b Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/186850 Reviewed-by: Dave Parker <dparker@chromium.org>
* Add pwm support while in low-power idleHenry Hsu2014-02-202-1/+12
| | | | | | | | | | | | BUG=None BRANCH=None TEST=Enable this with pwm led board, the pwm led works even EC low-power idle. Change-Id: Ic808104d8e38b1f9074682ced41412c6af050efe Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/186951 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Clapper: Add battery parametersgit-CarryBK_Chen.compal.com2014-02-193-2/+34
| | | | | | | | | | | | | | | | | | | | | 1. Max voltage : 12.6V 2. Nominal voltage : 11.1V 3. Min voltage : 9V 4. Pre-charge current : 157 mA 5. Initial charge : 0~45°C 6. Continuous Charge: 0~60°C 7. Discharge point : <0°C or >73°C BRANCH=clapper BUG=none TEST=manually Signed-off-by: Carry Chen <CarryBK_Chen@compal.com> Change-Id: I7905f8591c92b81755f6a31b79f0c2b11266a44d Reviewed-on: https://chromium-review.googlesource.com/186942 Reviewed-by: Dave Parker <dparker@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* BayTrail: Fix ADC adapter current calculationChromeOS Developer2014-02-195-20/+20
| | | | | | | | | | | | | | BUG=chrome-os-partner:25977 BRANCH=ToT 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: 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>
* Enable USB power in S3 if USB ports enabled at suspendChromeOS Developer2014-02-173-0/+3
| | | | | | | | | | | | 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: Ie7850617befa32dd2c2146ef23d18252ef6ea4a4 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186673 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Added unit tests for lid angle calculation and acosAlec Berg2014-02-178-1/+242
| | | | | | | | | | | | | | Added unit test for motion_sense lid angle calculations. Added unit test for math_util arc_cos() function. BUG=chrome-os-partner:25640 BRANCH=rambi TEST=make buildall 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>
* Add comment about matching temp sensor index and name with corebootChromeOS Developer2014-02-132-2/+10
| | | | | | | | | | | | | | BUG=None BRANCH=None TEST=None Change-Id: If72cadaf127de9f850f99a2b628a6070723be68f Original-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> Reviewed-on: https://chromium-review.googlesource.com/186445 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Squawks: Add smart battery temp sensor to temp sensors listChromeOS Developer2014-02-132-0/+6
| | | | | | | | | | | | BUG=None BRANCH=ToT TEST=Run "ectool temps all". Verify battery temp reported. Remove battery, verify an error is reported. 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>
* baytrail: Battery cutoff return codes were backwardsRandall Spangler2014-02-132-2/+2
| | | | | | | | | | | | | | | | | | | cutoff() returns 0 on success, not non-zero. BUG=chrome-os-partner:25646 BRANCH=None TEST=ectool batterycutoff succeeds Change-Id: I603931333c9955a81197d831c4cd3efa5b852ce3 Original-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> Reviewed-on: https://chromium-review.googlesource.com/186444 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Clapper: Update accelerometer translation matricesChromeOS Developer2014-02-131-10/+10
| | | | | | | | | | | | | BUG=None BRANCH=None TEST=Run 'lidangle on' EC console command. Verify lid angle reported is correct for closed, open 90 degrees, fully open as the device is rotated in space. Change-Id: I6fdfe73643d49074df5d10599d1f2589b1385fe3 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/186170 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Glimmer: Add smart battery temp sensor to temp sensors listChromeOS Developer2014-02-132-0/+6
| | | | | | | | | | | | BUG=None BRANCH=None TEST=Run "ectool temps all". Verify Battery temp reported. Remove battery, verify an error is reported. Change-Id: Ic1a3b5d2d25adeb45012279df01d9e221643e725 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185715 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Glimmer: Fix return code of host battery cutoff command.ChromeOS Developer2014-02-111-1/+1
| | | | | | | | | | | | | BUG=None BRANCH=None TEST=Run "ectool batterycutoff" with AC power connected. Verify reponse from ectool is "Success" with return code 0. Also run "battcutoff" command from EC serial console. Change-Id: I0a357c3bca40dd4bee7d76fdd458ec2dc468ab6e Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185911 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add winky board configurationChromeOS Developer2014-02-117-2/+522
| | | | | | | | | | | | | | | Cloned from rambi config. Disabled LED control for now. Added TODOs to verify battery charging, led control, and temp sensor placement. BUG=chrome-os-partner:25421 BRANCH=None TEST=make buildall -j 32 and make BOARD=winky tests Change-Id: Ibc16d4e1194bae5d9f5a83e67541a61e7a9b3c66 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185666 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Glimmer: Add input current limit and charger settingHenry Hsu2014-02-112-2/+24
| | | | | | | | | | | | | | | Set current limit to 1920mA. Besides Disable LDO mode & Enable IDPM by power suggest. BUG=chrome-os-partner:24646 BRANCH=glimmer TEST=After plug in AC, the current limit become 1920 and option become 0xe54a by the power's suggestion. Change-Id: Id0b1d103d7603f00e089d2f7b160162e3ee285fc Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/185322 Reviewed-by: Dave Parker <dparker@chromium.org>
* Glimmer: Add PWM led support and some led behaviorHenry Hsu2014-02-114-7/+108
| | | | | | | | | | | | | | | | | | | Enable FAN0PWM0 for led and remove other PWM setting, And the led behavior are, 1. Blink 3 times when AC in (this CL) 2. Off led when system off (this CL) 3. On led when system on (this CL) 4. Breath led in suspend (not yet implement) 5. Blinking when entering suspend (not yet implement) BUG=chrome-os-partner:25349 BRANCH=glimmer TEST=Any time plug in AC, the led blink 3 times. Change-Id: Ic84f363f914cb81c9effb5d06fd4d4cb5139b71e Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/185331 Reviewed-by: Dave Parker <dparker@chromium.org>
* rambi: Add motion sense task to track motionAlec Berg2014-02-1114-0/+899
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added motion sense task to Clapper and Glimmer. This task samples the accelerometers and calculate a lid angle. Note that as the machine is rotated towards the hinge angle aligning with gravity, the lid calculation becomes less trustworthy. Added a math_util file to hold various mathematical functions useful for calculating lid angle that may be helpful in other places. For each board with accelerometers we need to define some orientation specific data in board.c. There is a calibration procedure through the EC console that can be enabled by defining CONFIG_ACCEL_CALIBRATE. The calibration procedure can help determine the orientation data required. For debugging purposes there is a console command to regularly print to the EC console the accelerometer data and derived lid angle. The console command can be enabled by defining CONFIG_CMD_LID_ANGLE. BUG=chrome-os-partner:24703 BRANCH=rambi TEST=Ran the calibration procedure on a Glimmer unit, and then rotated the machine in space. Verified that the lid angle calculated roughly matched actual lid angle. Change-Id: I63a5e384b7f6b628b4ea01de49843355fb8d6ebe Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/184783 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Include battery fuel gauge temp sensor in temperature sensorsRandall Spangler2014-02-105-0/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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'. Orig-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> (cherry picked from commit 3192264679d56a6fe2ddf7ca7292025bdb3b6dfb) Change-Id: I0d6511271e2fbd4b17612de774d4a83d9ce8e848 Reviewed-on: https://chromium-review.googlesource.com/185671 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Glimmer, Clapper: Add comment about matching DPTF temp sensor index and name ↵ChromeOS Developer2014-02-102-2/+10
| | | | | | | | | | | | | | | | with coreboot BUG=None BRANCH=None TEST=None Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Iacf5b91ad05a377b19551a0c7440c71d697331b3 Reviewed-on: https://chromium-review.googlesource.com/185395 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Glimmer: Use CONFIG_BATTERY_PRESENT_GPIO for battery checkChromeOS Developer2014-02-103-11/+3
| | | | | | | | | | | | | | No change in functionality. BUG=None BRANCH=None TEST=Run "make buildall -j32". Manual: Verify that there is no 30 second delay booting Glimmer with the battery removed. Change-Id: I75dc3041949a8eb28a2abe84f204535ec31b590b Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185184 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Support DPTF charger current limitingRandall Spangler2014-02-084-6/+82
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This enables the AP to limit charging current via ACPI. BUG=chrome-os-partner:23971 BRANCH=rambi TEST=manual drain battery down to <90%, then plug into AC (charger commands at EC console, iotools at root shell) iotools io_write8 0x66 0x81 iotools io_write8 0x62 0x08 iotools io_write8 0x62 3 charger -> dptf limit 192, I_batt=192 charger dptf 320 charger -> dptf limit 320, I_batt=320 iotools io_write8 0x66 0x80 iotools io_write8 0x62 0x08 iotools io_read8 0x62 -> 0x05 iotools io_write8 0x66 0x81 iotools io_write8 0x62 0x08 iotools io_write8 0x62 0xff charger -> dptf disabled, I_batt=(something > 192) iotools io_write8 0x66 0x80 iotools io_write8 0x62 0x08 iotools io_read8 0x62 -> 0xff Orig-Change-Id: Iace2ebbbc018143c0154310d7acd02d16a6b7339 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185411 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 5c808ee56c44be4c665de6a85f5feb5cd5753f9d) Change-Id: I67d5449b2135aedba68f2c189dbef67720124004 Reviewed-on: https://chromium-review.googlesource.com/185492 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>
* Fix set2 scancode for volume up media keyChromeOS Developer2014-02-071-2/+1
| | | | | | | | | | | | | | Also removes a useless BUILD_ASSERT. BUG=None BRANCH=ToT TEST=Boot kernel with cmdline arg i8042.direct=1 to force set2 mode. Push volume up/down & power key. Change-Id: Ifc735d66b2f707e68b5c59959c47a0e295a7688c Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185392 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lm4: Remove 500k clock delay in clock_init()Randall Spangler2014-02-071-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | We copied that delay because it seemed to be necessary on early LM4 chips to avoid glitching the UART. But on current boards (e.g. rambi) this does not seem to be necessary, and delays boot by 31ms. So, remove the delay. BUG=chrome-os-partner:23794 BRANCH=rambi TEST=boot system; see little to no glitching on EC uart, and system boots ok hibernate 1; see little to no glitching on EC uart, and system boots ok Orig-Change-Id: I9d4b5927da4282e47e1b09be838104c64f25268c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/185232 Reviewed-by: Bill Richardson <wfrichar@chromium.org> (cherry picked from commit 36d4ecb153518623945f0a8e89e4413938d38869) Change-Id: Ica9447e527da9d2098c17890ee63deacb362c166 Reviewed-on: https://chromium-review.googlesource.com/185346 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Randall Spangler <rspangler@chromium.org> Tested-by: Randall Spangler <rspangler@chromium.org>