summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Add ectool chargecontrol discharge command for Slippystabilize-4443.BDave Parker2013-07-222-0/+16
| | | | | | | | | | | | BUG=chrome-os-partner:21180 BRANCH=slippy TEST=Run ectool chargecontrol command with each option (normal, idle, discharge) on Slippy. Verifiy battery is discharging in discharge mode via EC console 'battery' command. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I0461b20fc15c99380327b9a282efff7f1ed93baf Reviewed-on: https://gerrit.chromium.org/gerrit/62851
* Add system_common unit testVic Yang2013-07-226-7/+181
| | | | | | | | | | | | | | This tests reboot-on-ap-shutdown. BUG=chrome-os-partner:19236 TEST=Pass the test BRANCH=None Change-Id: Ic1a07670f82646e85d014d52a2aba0835319c212 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62855 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Slippy: Detect physical presence of battery before waking itDave Parker2013-07-223-0/+12
| | | | | | | | | | | | | | | | BUG=chrome-os-partner:21180 BRANCH=slippy TEST=Power device without battery. It should boot with no 30 second delay. The battery LED blinks orange indicating a battery error. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: Icabc450cd44748aed694e4ed8cb81eee152cf456 Reviewed-on: https://gerrit.chromium.org/gerrit/62850 Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org>
* Set Slippy write protect to active lowDave Parker2013-07-222-3/+2
| | | | | | | | | | | BUG=chrome-os-partner:21180 BRANCH=slippy TEST=Verify correct WP value using crossystem wp_cur. Change-Id: I1eb30584a744df7c695a06544d46b729cd4a689f Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62849 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Basic G781 temp sensor support for SlippyDave Parker2013-07-222-13/+28
| | | | | | | | | | | | | | This lets us read the internal and external values on the G781 temp sensor. BUG=chrome-os-partner:21180 BRANCH=slippy TEST=run ec 'temps' command on Slippy. Change-Id: Ib3a2a89efd4cfbc4a49696c79daa37bc1880a3ef Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62847 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Battery LED control for SlippyDave Parker2013-07-224-2/+96
| | | | | | | | | | | | | | | BUG=chrome-os-partner:21180 BRANCH=slippy TEST=Manual. Verify LED is amber while charging, blue when charged, and off when external power disconnected. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: If80bb9b0c70951d257621a2fe3ef20cd8749a033 Reviewed-on: https://gerrit.chromium.org/gerrit/62848 Tested-by: Dave Parker <dparker@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org>
* Move .lcov_lock to /tmp/ec-lcov-lockVic Yang2013-07-221-1/+1
| | | | | | | | | | | | | | | flock leaves the lock file and git complains about it. Let's move the lock file to /tmp/ec-lcov-lock. BUG=chrome-os-partner:19235 TEST=make coverage and check .lcov_lock is in /tmp BRANCH=None Change-Id: Id6d68af327b53aa1c0c7ae9186149126d8a5cc37 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62858 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Falco: Swap battery LED colors to follow HW changeDave Parker2013-07-191-4/+4
| | | | | | | | | | | | | BUG=chrome-os-partner:20984 BRANCH=falco TEST=Manual. Verify battery LED is amber when charging and white when charged. Change-Id: I98ba6e1839d5e07ad0c0422addc9708aadcce00f Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62678 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Truncate version string to 32 charactersRandall Spangler2013-07-193-12/+19
| | | | | | | | | | | | | | | | | | | | | | | The version struct and EC_CMD_GET_VERSION assume 32-character version strings. But if the git tree is dirty and the board name is long, the version string overflows that limit. This change truncates what's stored in the version string to fit. The build info still contains the full version string, as it did before. BUG=chrome-os-partner:21156 BRANCH=none TEST=build BOARD=mccroskey with a dirty tree; it should build. Then cat build/mccroskey/ec_version.h to see CROS_EC_VERSION32 has truncated the version string. Then build a platform of your choice and type 'version' to see that the version string and build info is still reported correctly. Change-Id: Ie71b8efd99a83315f8b4d5ad10c51e48781b12f4 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62649 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Add an enum for the number of flash regionsSimon Glass2013-07-191-1/+3
| | | | | | | | | | | | | | | | | | Add an enum for the number of flash regions so we can keep track of all the possible regions. (This is used in U-Boot which wants to declare an array of all possible regions.) BUG=chromium:244019 BRANCH=none TEST=manual Build EC for pit. Change-Id: I494d857f1388dcc5c64b1cd580cf0084bdef0212 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62701 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Constrain charging voltage to values chargers can provide.Dave Parker2013-07-193-3/+28
| | | | | | | | | | | | | | | BUG=chrome-os-partner:20863 BRANCH=falco,peppy,slippy,wolf TEST=Manual. On Peppy, there should no longer be "Charging Voltage" messages every second on the EC console. On other platforms verify that V_Batt reported by the 'charger' command is divisible by 16. Change-Id: Idd775a1d8033ff3405d10919e1e15ddddebc6c23 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62699 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Peppy: Detect physical presence of battery before waking itDave Parker2013-07-196-10/+47
| | | | | | | | | | | | | | BUG=chrome-os-partner:20889 BRANCH=peppy TEST=Power device without battery. It should boot with no 30 second delay. The battery LED blinks orange indicating a battery error. Change-Id: Iea4f5644ae223b60dc8058dc52e06405e275c001 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61820 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Marc Jones <marc.jones@se-eng.com>
* Add ectool discharge command to Falco and Peppy.Dave Parker2013-07-199-42/+119
| | | | | | | | | | | | | | | | | | Expands and renames ectool 'chargeforceidle' command to 'chargecontrol'. Board-specific calls are needed to enable and disable the discharge while on AC power state. BUG=chrome-os-partner:20506 BRANCH=falco,peppy TEST=Run ectool chargecontrol command with each option (normal, idle, discharge) on Falco and Peppy. Verifiy battery is discharging in discharge mode via EC console 'battery' command. Change-Id: I7ac2b18b4f143bf6abc1e0bb878ad21a99f52100 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60689 Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add EC_CMD_GET_FLASH_INFO version 1Randall Spangler2013-07-188-7/+113
| | | | | | | | | | | | | | | | | | | | | This adds two new fields: the ideal write size for best EC flashing performance (e.g., page mode instead of word mode), and a flags field with a flag to indicate whether the EC erases its bits to 0 or 1. The EC still supports the old version 0 command, since u-boot and flashrom expect that to work. BUG=chrome-os-partner:20973 BRANCH=(all haswell); this will speed up flashing and software sync TEST=ectool flashinfo 1. old EC, new ectool -> only reports version 0 info 2. new EC, old ectool -> only reports version 0 info 3. new EC, new ectool -> reports new fields Change-Id: I484327fe22a58d2b69d7f6ac767b2d3e81b3e0b7 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62378 Reviewed-by: David Hendricks <dhendrix@chromium.org>
* stm32l: Disable interrupts while running from flashSimon Glass2013-07-171-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The curent code ends up creating a veneer for interrupt_enable/disable() which isn't really needed (see below). By calling the interrupt code while still running from flash we can avoid this. I cannot see any problem with the current implementation, but it seems that with this patch I also avoid an exception. BUG=chrome-os-partner:20976 BRANCH=none TEST=manual Build EC and see code generated like this: 200029ec <iram_flash_write>: 200029ec: b538 push {r3, r4, r5, lr} 200029ee: 460d mov r5, r1 200029f0: 4604 mov r4, r0 200029f2: f000 f83d bl 20002a70 <__interrupt_disable_veneer> ... 20002a4a: f000 b809 b.w 20002a60 <__interrupt_enable_veneer> 20002a4e: bf00 nop 20002a60 <__interrupt_enable_veneer>: 20002a60: b401 push {r0} 20002a62: 4802 ldr r0, [pc, #8] ; (20002a6c <__interrupt_enable_veneer+0xc>) 20002a64: 4684 mov ip, r0 20002a66: bc01 pop {r0} 20002a68: 4760 bx ip 20002a6a: bf00 nop 20002a6c: 080007f5 .word 0x080007f5 20002a70 <__interrupt_disable_veneer>: 20002a70: b401 push {r0} 20002a72: 4802 ldr r0, [pc, #8] ; (20002a7c <__interrupt_disable_veneer+0xc>) 20002a74: 4684 mov ip, r0 20002a76: bc01 pop {r0} 20002a78: 4760 bx ip 20002a7a: bf00 nop 20002a7c: 080007f1 .word 0x080007f1 With this patch the veneers go away. Change-Id: Idfe173b4c8d45a142914b2388bcff8ba708c657c Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62243 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Move switch module from chip/lm4 to commonRandall Spangler2013-07-173-7/+7
| | | | | | | | | | | | | | | There's nothing LM4-specific about the switch module; it's just checking GPIOs and updating a memory-mapped register. No code changes; just moving a file. BUG=chrome-os-partner:18343 BRANCH=none TEST=verify switch.c is compiled for link and falco, but not pit or spring Change-Id: I186f3aac1405c7ba8d94b47bb2586c2ad191daba Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61930
* Split x86 power button logic out of switch.cRandall Spangler2013-07-1718-426/+456
| | | | | | | | | | | | | | | | | | | | | | Power button logic is common across all platforms and is not LM4-specific, so move it to its own module. Switch.c will eventually be moving to common/ and will common across all platforms (not just x86), and splitting out the x86 power button logic is needed before that too. BUG=chrome-os-partner:18343 BRANCH=none TEST=manual 1) power on system with both lid and power button. 2) power+refresh -> reboots 3) power+refresh+esc -> recovery mode 4) power+refresh+downarrow -> reboots, AP stays off 5) toggling recovery GPIO via servo should generate SW debug output showing bit 0x10 toggling Change-Id: I07714e2c035dceece66f90407983397d2697e7d5 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61780
* Fix extracting CONFIG tokens from config.hRandall Spangler2013-07-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We need to use cpp -dM instead of -dN, because -dN doesn't process #undef statements. That is, if you have " #define CONFIG_FOO" " #undef CONFIG_FOO" then -dN will happily print both lines, which results in CONFIG_FOO being defined when processing the makefile. -dM processes the defines and undefs so that the resulting list of macros only includes those that are defined. We didn't notice this before, because we temporarily commented out config statements instead of #undef'ing them - or the configs which were undef'd only resulted in conditional non-compilation of pieces of code inside a file instead of the whole file not being compiled. This change also tidily alphabetizes the resulting configs. It also better filters CONFIGs to ensure that " #define __CROS_EC_CONFIG_CHIP_H" does not show up as a CONFIG_CHIP_H token, as it did previously. BUG=chrome-os-partner:20985 BRANCH=none (though may be needed if any future cherry-picked change requires undefining a CONFIG) TEST=Add #undef CONFIG_ADC to the end of config.h and see that the ADC module is not compiled. Also helps to add $(info $(_flag_cfg)) to the Makefile to see the list of tokens, and verify that CONFIG_ADC is not among them. Change-Id: I18db60099e87857473ba54c3c9fff1116d4f1a93 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62230 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* bq24715: compilation fixAaron Durbin2013-07-161-6/+6
| | | | | | | | | | | | | | | | | I accidentally cut and pasted expressions for REG_TO_CURRENT usage in the initializers for the charger_info struct. This obviously causes things to blow up during compilation. BUG=chrome-os-partner:20372 BRANCH=None TEST=Have been using this on bolt. Change-Id: Ie5e2ca10f7a3dce0ccb17b889a173a65451b8c92 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Change-Id: I8ba5da663a1271cba04f57e407eaff96bc052735 Reviewed-on: https://gerrit.chromium.org/gerrit/62208 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lm4: make configure_kblight_gpios() board dependentAaron Durbin2013-07-163-10/+15
| | | | | | | | | | | | | | The configure_kblight_gpios() funciton was specific to the link board. Therefore, move the function to be defined within the board-specific file. BUG=chrome-os-partner:20372 BRANCH=None TEST=Built. Tested similar change on bolt. Change-Id: Ib5847130450024c50d6526d2c1a64d67ab501637 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62209
* Make a top-level config.h file to include sub-configsRandall Spangler2013-07-168-22/+174
| | | | | | | | | | | | | | | | | This file will soon contain the exhaustive list of all CONFIG defines and their descriptions. Chip-level configs are renamed to config_chip.h to avoid naming conflicts. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I9e94146f5b4c016894bd3ae3d371c4b9f3f69afe Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62122 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Remove unneeded direct includes of board.h and config.hRandall Spangler2013-07-1621-22/+2
| | | | | | | | | | | | | | | | | | | | | Both of these are included via common.h, which is in turn included by most other header files. Directly including board.h or config.h is redundant and discouraged. No code changes, just removing #includes. This is in preparation for making a top-level config.h file, but that change will be easier to review if it doesn't touch as many files. BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms Change-Id: I204bcebe5607c6e6808821eb071cfc31d2a93a7c Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/62121 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Remove unused board_version enumsRandall Spangler2013-07-166-32/+2
| | | | | | | | | | | | | | | | | These were briefly used on link, and are not used by any other platform. The values for those platforms are almost certainly wrong, and incorrect information is worse than no information. This does not remove reading the stuffing resistors - it just removes the assumption that they map to PROTO1 and EVT. BUG=chrome-os-partner:18343 BRANCH=none TEST=compile all platforms Change-Id: I2ba19fd52660559bfd1d8e3b8a9949e9b8abbddf Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61929
* Add 'version' option to ectool test command.Bill Richardson2013-07-161-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is just handy to be sure we're correclty passing the command version to the EC. BUG=chromium:242706 BRANCH=falco, peppy TEST=manual Run "hcdebug params" the EC console (using ToT EC) Compare the output on the EC console when you run these two commands on the host: ectool test 0 13 ectool test 0 13 1 You should see these two lines (among other things): [5728.756652 HC 0x0a.0:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] [5730.809596 HC 0x0a.1:000000000d00000030313233343536373839616263646566303132333 43536373839414243444546] The "0x0a.0" and "0x0a.1" indicate that the version is being passed correctly. Change-Id: I23b97ac6622274a157717f9375945d0866691a37 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61920 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* spring: lower LED brightness to save powerVic Yang2013-07-152-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | Lower LED brightness: - Green: 0x80 -> 0x10 - Yellow: 0x80 -> 0x40 (looks equivalently bright to green @ 0x10) - Red: Not changed since it's an error condition BUG=chrome-os-partner:20768 TEST=Build success BRANCH=Spring Original-Change-Id: Ib80b4f5c746163d98a09e21246ea97a6aeb2c054 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61672 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 1f6e5f8a1e074bd91acd3fc0b3de268495199c10) Change-Id: I8f37cfa79d9fd30f503318e0913f4c12c1737219 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61852 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Remove fancy trickle charging logicRandall Spangler2013-07-154-278/+15
| | | | | | | | | | | | | | | | | | | | | | We implemented a fancy state machine for link to try and feed almost-dead batteries smaller amounts of current than the charger could normally supply, by dithering down the voltage to less than was requested. It's a lot simpler just to give the battery the smallest non-zero amount of current we can give it at the voltage it asks for. Remove the precharge code, since we won't use it on any future platform and link has already branched. BUG=chrome-os-partner:20881 BRANCH=none TEST=find a really dead batery and try to charge it, or do what I did and just hack the battery module to lie about the requested values, and see that it always gets the minimum current step at the requested voltage. Change-Id: I30bcb62bbe215abafb3a98c52e2afed3b74ead1a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61789
* Debug host command responses for error results too.Bill Richardson2013-07-151-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just because the EC doesn't like a host command doesn't mean it doesn't send a response. When we have HC debugging on, we want to see that too. BUG=chrome-os-partner:20647 BRANCH=falco, peppy TEST=manual Run "hcdebug params" on the EC console. Run "ectool test 3 13" on the host. Before this CL, you'd see [4369.366344 HC 0x0a.0:030000000d00000030313233343536373839616263646566303132333 43536373839414243444546] [4369.367315 HC err 3] After this CL, you see: [46.979220 HC 0x0a.0:030000000d0000003031323334353637383961626364656630313233343 536373839414243444546] [46.980067 HC err 3] [46.980344 HC resp:30313233343536373839616263] Change-Id: I9416a5e4a9c643dba0ce29b589832c62634e916b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61791 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* puppy: change XPSHOLD interrupt on both edgesYen Lin2013-07-121-1/+1
| | | | | | | | | | | | | | Change XPSHOLD interrupt from rising edge to rising and falling edges. Without this change, lid has to be opened twice to power on the system. BUG=nvbug 1323023 TEST=tested on Venice Change-Id: I49e953546140bc8de954ac22b59641efb299ba72 Signed-off-by: Yen Lin <yelin@nvidia.com> Reviewed-on: https://gerrit.chromium.org/gerrit/61697 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* x86: Enable all wireless switches when going into S0Dave Parker2013-07-123-6/+7
| | | | | | | | | | | | BUG=None BRANCH=slippy,peppy,falco,wolf TEST=Boot device and verify WLAN and WWAN enable GPIOs are active. Change-Id: I1b488bc26ddbe50c570aefd8fcd3cdcb4d5b38d4 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61653 Commit-Queue: Randall Spangler <rspangler@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add console editing unit testVic Yang2013-07-113-1/+243
| | | | | | | | | | | | | This tests console editing and history functionality. BUG=chrome-os-partner:19236 TEST=Pass the test BRANCH=None Change-Id: Ia3edf2dd627d081fbcae7f775992d7570e5e1dd0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61555 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add extpower-gpio unit testVic Yang2013-07-115-6/+101
| | | | | | | | | | | | | This tests host event and hook are triggered when AC status changes. BUG=chrome-os-partner:19236 TEST=Pass the test. BRANCH=None Change-Id: I9e4263f3f6e273bfb0b24671a4e5c56b20a04e1a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61554 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add I8042 keyboard unit testVic Yang2013-07-119-4/+284
| | | | | | | | | | | | | This tests I8042 scancode and typematic. BUG=chrome-os-partner:19236 TEST=Pass all tests many times. BRANCH=None Change-Id: I8457b7b807b694b0bae32abf1647961f946dc5e1 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61553 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Basic G781 temp sensor support for Falco and Peppy.Dave Parker2013-07-117-19/+132
| | | | | | | | | | | | | | | | | | | This lets us read the internal and external temp values. More functionality to come once we figure out what is needed. BUG=chrome-os-partner:20432 BRANCH=falco,peppy TEST=run ec 'temps' command on Falco and Peppy. Signed-off-by: Dave Parker <dparker@chromium.org> Change-Id: I4f452f438e0a158dc8b34901e3faad3ce36d28b2 Reviewed-on: https://gerrit.chromium.org/gerrit/60145 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Dave Parker <dparker@chromium.org> Tested-by: Dave Parker <dparker@chromium.org>
* Split wireless power/radio control out of switch.cRandall Spangler2013-07-1119-106/+117
| | | | | | | | | | | | | | | | | | | | | | | | | Chipset control of wireless power uses the new API instead of overriding the wireless power itself. Refactor board-specific support for it to just a few config #defines instead of board-specific functions. This makes some assumptions about the polarity of the enable signals. Not making those assumptions would require defining an array of structs or some other heavier-weight board-specific info. Since the assumptions hold for all current boards, let's make them now because this is a step in the right direction, and reserve doing something more general until we actually have a use case for it (so we build in just the flexibility we need). BUG=chrome-os-partner:18343 BRANCH=none TEST=build all platforms; see that link wifi turns on at boot and off at shutdown (verify via 'gpioget' from EC console) Change-Id: Ic036e76158198d2d5e3dd244c3c7b9b1e8d62982 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61608 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Move x86 backlight-enable passthru code to its own moduleRandall Spangler2013-07-1114-52/+92
| | | | | | | | | | | | | | | | | This code is not LM4-specific, it's x86-specific. So it doesn't belong in chip/lm4. Put it in its own module rather than leaving it in switch.c, since some x86 systems may need the power button state machine but not the backlight-enable passthru. BUG=chrome-os-partner:18343 BRANCH=none TEST=Quickly run a magnet over the lid switch; the backlight goes off and then back on. Change-Id: I72f7139b73f91539dcfbe6b5cb6d56587ab66fde Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61595 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Falco: AC adapter identification commandBill Richardson2013-07-113-0/+51
| | | | | | | | | | | | | | | | | | This adds a function to identify the AC adapter. We'll need this to set various battery charging limits, based on the capability. This only applies to Falco, AFAIK. BUG=chrome-os-partner:19594 BRANCH=none TEST=manual Plug in various approved adapters. From the EC console, run "adapter". It should tell you the rated power for each one. Change-Id: Id6d142fa81f20ec9233b0faa2fcb1d53cf7b7ef5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61515 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add thermal host and console command testVic Yang2013-07-112-6/+197
| | | | | | | | | | | | | | This checks the functionality of thermal engine related host and console commands. BUG=chrome-os-partner:19236 TEST=Pass all tests. BRANCH=None Change-Id: I604ed3bfed3549b2573fac65da83450acd3f2797 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60964 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add flash host read command testVic Yang2013-07-112-1/+39
| | | | | | | | | | | | | This checks the correctness of data returned by flash read host command. BUG=chrome-os-partner:19236 TEST=Pass all tests. BRANCH=None Change-Id: I3b97addb9b14922e9f33a71b865000ae9a8d40a8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60963 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add function to inject console input from testVic Yang2013-07-112-2/+23
| | | | | | | | | | | | | This can be used to test console command. BUG=chrome-os-partner:19236 TEST=Build success BRANCH=None Change-Id: I7ce002f9e66fd7786492bacb453f126b9766d741 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60978 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor x86 chipset codeRandall Spangler2013-07-1020-1297/+1136
| | | | | | | | | | | | | | | This moves most of the code into a common module, leaving only the board-specific GPIOs (now listed in a struct in board.c) and the chipset-specific state machine with multiple copies. BUG=chrome-os-partner:18343 BRANCH=none TEST=boot link; verify suspend and resume work; shut back down and see it go to G3 after 10 sec. Change-Id: Iafa8ba55a4870bb0119ff4161a1a9054fcc7955f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60949
* Improve over current detectionVic Yang2013-07-101-3/+25
| | | | | | | | | | | | | | | | | | | | | | | This includes: - Capturing over-current event on transition from known device type to unknown device type. - Limiting current draw when device type is not determined yet. - Shortening CABLE_DET delay to 0.6 seconds so that over-current event for USB host has a 0.6-second window for the charger to recover. BUG=chrome-os-partner:20648 TEST=Charge with Arrow BRANCH=Spring Original-Change-Id: Ie66ccd2d69adf8436a67e504f82da6eca3d0b14f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60730 (cherry picked from commit 03493a72db6ea5e12eda2a9488253d7fae6eec0b) Change-Id: I5d3cf7054960f5d4f924bce76f87257af57ebdb8 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61400 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Remove fast PWM tweak modeVic Yang2013-07-101-10/+4
| | | | | | | | | | | | | | | | | | | | | | Fast mode was originally introduced to prevent the user seeing battery assist mode. Now that we don't report battery assist mode to the user, let's remove this mode to improve stability. BUG=None TEST=Charge with various chargers. See stable PWM duty cycles. BRANCH=Spring Original-Change-Id: I4a2a66e03d50dea7a28fc826369dcf2b3452007a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60754 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 46a2073437f9a150656d37e8bd9219b01b1b3ac1) Change-Id: I8c5b24946385576ada9f08e342beb1a70c55c974 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61399 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Fix a bug of PWM duty cycle upper boundVic Yang2013-07-101-5/+10
| | | | | | | | | | | | | | | | | | | | | The return value from battery_current() is non-zero if there's an error. Also rewrite the condition to make it more readable. BUG=None TEST=Check PWM duty cycle can be set to 100% BRANCH=Spring Original-Change-Id: If13a295d87a1abd2e67f1bb216dc58d3f3d29ba4 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60735 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 29a157e5276a4f0ed004aaab365ad9e32b68c250) Change-Id: I7383bfd49931c8555f92a74e5960bd7e40102fa6 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61398 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Update battery LED less frequently when chargingVic Yang2013-07-101-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | When the user uses about the same amount of power the charger provides and the battery level is around 94%, the user might see the LED hop between green and yellow. We should update LED color less frequently in this case. BUG=chrome-os-partner:20677 TEST=Hack a console command to fake battery charge level. Change battery level between 93 and 94, and see LED color only change every 15 seconds. BRANCH=Spring Original-Change-Id: I55cda9aee5f79465e9094355a1f66666d018cddd Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60851 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Vic Yang <victoryang@chromium.org> (cherry picked from commit d03e35c42835e4b52779499d0a4b8ebdcb1074f2) Change-Id: I51090418cdbb7a6fea0163e04d9a962b46268f34 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61397 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* spring: Drop support for VFET2 video poewr outputVic Yang2013-07-103-5/+9
| | | | | | | | | | | | | | | | | | | | | | VFET2 is only used by early stage boards. Let's drop it now. Also, disable power output when power good for VFET is not set. This essentially adds retry for video power output. BUG=chrome-os-partner:18186 TEST=Boot and test video output. BRANCH=Spring Original-Change-Id: I1937522a6a523a4f5dbeb9882518ca6e37655bea Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60852 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit e82589e073c5a863797fa87ecaa1dfafb1a9228d) Change-Id: Ib043f952e699eb99b373da205379f56230887f6a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61396 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Uprev panic data struct versionVic Yang2013-07-103-9/+34
| | | | | | | | | | | | | | | | The struct was changed in commit 74c34bbad, but the struct version was left as 1. We need to uprev this so the data returned by host command is useful. BUG=chrome-os-partner:16901 chrome-os-partner:20548 TEST='ectool panicinfo' with new and old struct. Compare output with output from console command 'panicinfo'. BRANCH=None Change-Id: I4df3142497dc5ee21d100c4cb8118fb7a0ce7a7e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/60314 Reviewed-by: Daisuke Nojiri <dnojiri@google.com>
* Use sample averaging on ADC to increase accuracyBill Richardson2013-07-091-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AC adapter detection isn't measuring the expected values, most likely because we're not providing enough current for the ADC circuitry to sample. This tells the ADC to take 64 samples for every reading and average them together. That seems to fix it. BUG=chrome-os-partner:19594 BRANCH=none TEST=manual To test, use a scope to probe the voltage pin 6 of the AC adapter connector. Compare that with the measured result from the ADC, by using the EC console's "adc" command. Before this change: Adapter Probed(mV) ADC(mV) error 45W 469 415 11.5% 65W 600 530 11.6% 90W 794 701 11.7% After this change: Adapter Probed(mV) ADC(mV) error 45W 469 452 3.6% 65W 600 590 1.6% 90W 794 773 2.6% Close enough. Change-Id: I5ab5526934a5a2711969a90a26631d54c7863da7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61346 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix EC_ENTERING_RW not being assertedRandall Spangler2013-07-095-2/+4
| | | | | | | | | | | | | GPIO_ENTERING_RW is an enum, not a macro, so the #ifdef evaluated to false. BUG=chrome-os-partner:20761 BRANCH=spring TEST=compile on all platforms; mccroskey doesn't break Change-Id: Ib50989c7d2e47ab573ebc242259709b1712297ea Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61295 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Initial board commit for Wolf based on Slippy.Dave Parker2013-07-098-4/+441
| | | | | | | | | | | | | Additional fix-ups will come in subsequent CLs. BUG=chrome-os-partner:20760 BRANCH=wolf TEST=Verify "make BOARD=wolf" complete succesfully. Change-Id: I24a37f3bebb1feb37c83c2c1b4f8f8db7bbcb2d8 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61318 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* Falco: Implement battery cut off comamnd for factoryDave Parker2013-07-091-0/+18
| | | | | | | | | | | | | | | BUG=chrome-os-partner:20723 BRANCH=falco TEST=Manual. On a DUT with a battery run "ectool batterycutoff" and power down if still connected to AC. Unplug AC. The EC should be unpowered. Verify the only way to boot the system is to plug AC back in. Change-Id: I7a4cef1f69efe673370a450385f6fa91722d2b50 Signed-off-by: Dave Parker <dparker@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/61294 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>