summaryrefslogtreecommitdiff
path: root/common/lightbar.c
Commit message (Collapse)AuthorAgeFilesLines
* Split pwm.c into pwm_fan.c and pwm_kblight.cBill Richardson2013-04-261-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Sadly, the existence of fans may not always imply the existence of keyboard backlights. BUG=chrome-os-partner:18825 BRANCH=slippy TEST=manual Use the Link EC console to make sure that both functions still behave. faninfo fanset 4400 faninfo fanset 9999 faninfo autofan faninfo fanduty 50 faninfo fanduty 100 faninfo autofan kblight 0 kblight 100 kblight 50 kbligth 100 Change-Id: I2e07cd46c21bce2d0d4162275a8ea6ae40135e96 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49355
* Replace generated CONFIG_TASK_ macros with HAS_TASK_Bill Richardson2013-04-241-1/+1
| | | | | | | | | | | | | | | CONFIG_ macros should be set directly. Expanding the task names in the same way made it difficult to tell what was a configuration choice and what was due to changes in ec.tasklist BUG=chrome-os-partner:18343 TEST=build all, run link BRANCH=none Change-Id: Ib82e34f974238ee2dd216f33b701b6f4c6a4f1f1 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/49098 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Increase EC low-battery threshold to 14% to match kernelBill Richardson2013-04-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | There is a 4% difference between the kernel's view of battery level and the actual battery level, to give userspace a chance to shut down cleanly. The EC should turn the lightbar red when the battery drops below 10%, so this change makes that happen when the kernel says it's 10%, instead of the real 10%. Note: We don't have to cherry-pick this to the Link branch. Although it affects the EC, we already patch the EC lightbar parameters at boot and that's done in userspace. BUG=chromium:225500 BRANCH=none TEST=manual Unplug Link, let the battery run down. The lightbar should pulse red when the battery level reported by the UI drops to 9% (there may be a little delay due to rounding). Note that it's only red when on battery. Change-Id: If3d335c54ceb37c86da59e4a66f8ecd46ce15664 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/48904 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add AP userspace scripts to tweak lightbar colorsBill Richardson2012-12-201-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | We have yet another tweak for the lightbar, but we don't want to update the EC. This CL adds an init script that runs on the AP at every boot and pokes the EC to modify the lightbar settings. We have to run it at every boot because the EC will hibernate after the AP has been off (not suspended) for an hour on battery power and will lose its settings. There's a corresponding CL for the ec-utils ebuild that installs the userspace scripts into the rootfs. BUG=chrome-os-partner:16827 BRANCH=link TEST=manual Build the image for Link, install, reboot. Run "ectool lightbar params". The output should match what's in /usr/share/ec/lightbar_params.txt Change-Id: If50ac2ef2432f7d60cdaf4c222b68dbdee80b2ec Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/39979 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
* Switch PWM to use HOOK_SECOND instead of its own taskRandall Spangler2012-10-301-2/+2
| | | | | | | | | | | | | BUG=chrome-os-partner:15714 BRANCH=none TEST=taskinfo no longer shows PWM task, and 'ectool pwmgetfanrpm' updates as fan speed changes. Change-Id: Ia23f52527c40c8117238ddc2ee4c023f59eba05a Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36939 Reviewed-by: Simon Glass <sjg@chromium.org>
* Use SECOND and MSEC constantsRandall Spangler2012-10-291-8/+3
| | | | | | | | | | | | | | | | | | We'd defined them in a number of different files. This moves definitions to timer.h, and uses them everywhere we have large delays (since 10*SECOND is less typo-prone than 10000000). Also add msleep() and sleep() inline functions. No need for mdelay() or delay(), since any delays that long should use sleep funcs instead of spin-waiting. BUG=chrome-os-partner:15579 BRANCH=none TEST=boot system; taskinfo displays similar numbers to before Change-Id: I2a92a9f10f46b6b7b6571759b1f8ab4ecfbf8259 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36726
* Rename POWERSTATE task to CHARGERRandall Spangler2012-10-291-1/+1
| | | | | | | | | | | | | Since POWERSTATE is confusing whether it refers to battery power or system power. BUG=chrome-os-partner:15579 BRANCH=none TEST=taskinfo; see CHARGER task Change-Id: I5a237b1329cace4ce48ae39d8954c08a9912ed4b Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36707
* Hook functions no longer return valuesRandall Spangler2012-10-231-11/+5
| | | | | | | | | | | | | | | Previously, all hook functions returned EC_SUCCESS, which was meaningless because nothing ever looked at the return value. Changing the return value to void saves ~100 bytes of code size and an equal amount of source code size. BUG=none BRANCH=none TEST=code still builds; link still boots Change-Id: I2a636339894e5a804831244967a9c9d134df7d13 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/36372
* Make S3 red-light flash adjustable.Bill Richardson2012-10-171-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes the timing for the S3 low-power indicator adjustable without reflashing. BUG=chrome-os-partner:8039 BRANCH=Link TEST=manual Boot, log in, run this to put the lightbar into demo mode: ectool lightbar demo 1 ectool lightbar seq s3s0 The lightbar should act as though the system is asleep. Then press the left arrow a couple of times and the down-arrow four or five times. You should see the red light pulse every 5 seconds or so. Now run ectool lightbar params > /tmp/w Edit /tmp/w to change the timing lines to this: 100 # .s3_ramp_up 100 # .s3_ramp_down Then run ectool lightbar params /tmp/w After a cycle or two, you should see the lightbar flash instead of pulse. Change-Id: If815ff2fb9a158c0e1f4dbb6a269ad07e122d84c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35839 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Finally final lightbar tweaks. Really. I think...Bill Richardson2012-10-161-17/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is hopefully the finally final tweak to the lightbar behavior. It does this: * When booting or awakening from sleep, Google colors pulse briefly. * When the chromebook is fully on, lightbar is dim blue. Every 3-5 seconds, a pulse of brighter blue sweeps across. * On battery, the lightbar is not quite as bright, and the sweep goes in the other direction and is slightly slower. If the battery charge drops below 10%, the lightbar changes from blue to red (but only on battery, not AC). * When going to sleep (close lid while logged in), lightbar fades to black, then pulses Google colors, then off. * While asleep, lightbar does nothing, UNLESS on battery and battery charge is under 10%. Then it pulses red every 5-8 seconds. * When shutting off, it just goes black with no special effects. Other than the slight dimming on battery power, there is no ambient light or dynamic brightness control. BUG=chrome-os-partner:8039 BRANCH=Link TEST=manual Turn it on, watch the blinky lights. Log in, close the lid, open the lid. Connect/disconnect AC. The lights should change as described above. Ta Da. Change-Id: Id174a452639decc4b5eefb9e21b28cf3643529f5 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35742 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix lightbar bug, add more tweaks.Bill Richardson2012-10-151-10/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I introduced a glitch in the parameterization CL. This fixes it, and makes the choice between the gentle throbbing and occasional pulse something that can be selected as a parameter. Default is the new pulsey style. BUG=chrome-os-partner:8039 BRANCH=Link TEST=manual Using the ectool that's part of this change, run these commands to flip between suspend and active displays: ectool lightbar seq s3s0 ectool lightbar seq s0s3 Change the "new_s0" value (0/1) and reload the params with ectool lightbar params | tee /tmp/w vi /tmp/w ectool lightbar params /tmp/w In each case you'll see some pretty patterns. Pass/Fail is an artistic decision. No QA required. Change-Id: I8de0b1b3cc77f65879befe95e110bbbce18846d9 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35620 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Replace pulsing with sweeping.Bill Richardson2012-10-141-23/+15
| | | | | | | | | | | | | BUG=chrome-os-partner:8039 BRANCH=Link TEST=none More cosmetic changes. Change-Id: If33e39d3cea1e3930d630ad84a156e9afb4c57fd Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35485 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Set minimum brightness to 35%, variable osc settings.Bill Richardson2012-10-141-36/+42
| | | | | | | | | | | | | BUG=chrome-os-partner:8039 BRANCH=Link TEST=none More cosmetic changes. Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I1fd9318131ce55541d845ac8be5faa9334c3953f Reviewed-on: https://gerrit.chromium.org/gerrit/35484 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Parameterize the lightbar behavior as much as possible.Bill Richardson2012-10-111-95/+179
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change replaces most of the hard-coded lightbar constants with values that can be updated at run-time, so that if we change our minds about colors and timing we can tweak some of the values without requiring an EC/BIOS update. It also adds the "ectool lightbar params" command to get and set those values from the host. You can see the values from the EC console ("lightbar params"), but there's no way to set them. BUG=chrome-os-partner:8039 BRANCH=Link TEST=manual From the EC console, run lightbar params It should display the current values that can be changed. Log in to the host and run this to see the same values: ectool lightbar params Or edit and change them with this: ectool lightbar params > /tmp/vals.txt vi /tmp/vals.txt ectool lightbar params /tmp/vals.txt The updated parameters are persistent across EC jumps (RO->RW), but are lost when/if the EC reboots (as it will after the AP is off for 24 hours, for example). Change-Id: Ic2a3fd6f8062673432b48904933e0c7239b8658b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35289 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fix lightbar test patternBill Richardson2012-10-101-11/+11
| | | | | | | | | | | | | | | | | | | An earlier commit made the lightbar test sequence run much too quickly. This puts it back. I'm not sure if the factory still looks at this, but I think they did at one time, so we might as well keep it working. It's helpful for debugging anyway. BUG=chrome-os-partner:8039 BRANCH=link TEST=manual Log in, run "ectool lightbar seq test". You should see the lightbar colors pulse in various colors, then go back to whatever they were doing before. Change-Id: I11c24a448bf40f0c0c82456fcf6e0415a0392c28 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/35190 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Major rewrite of lightbar using FP math.Bill Richardson2012-10-021-377/+388
| | | | | | | | | | | | | | | | | | | Latest tweaks after working with the UI folks. This changes the S3 and S0 sequences and the transitions between them, using Google colors, smooth fades, and persistent state across EC resets. In S3, we only pulse when the battery is low and is discharging. BUG=chrome-os-partner:8039 BRANCH=Link TEST=none Artistic criticism only, please. Change-Id: Id75b8c2c96e2e9dc9ff27af0bfe126cfad5d490e Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/34465 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Use two-color lightbar scheme, with KB backlight for brightnessBill Richardson2012-09-241-17/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Yet another set of tweaks to the lightbar patterns: At Startup or wake from sleep, Google colors cycle in. While running, > 25% power level in the battery: All blue, in a breathing effect (cycle up and down 30%). While running, <= 25% power level in battery: Same as above, but with red Shutting down, or going into sleep: Cycle out the Google colors (Note: the effect is only visible for S0->S3, because shutting down kills power to the lightbar before we can react). While sleeping: Similar to now, but only using Blue and red for battery indication as above. The EC doesn't have access to the ALS, so we use the keyboard backlight to control the lightbar brightness instead: If keyboard backlight is OFF (which it is when ambient is bright), use max brightness for lightbar. If keyboard backlight is ON, use keyboard backlight brightness. BUG=chrome-os-partner:13870 BRANCH=Link TEST=none This is an aesthetic change. Nothing to test, only artisitic criticism. Change-Id: Ib0b98eef18984945a83e988588c225025c4e8e52 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/33824 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor lightbar host command to pass messages the new way.Bill Richardson2012-09-211-37/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | We recently changed the way host messages are passed to the EC to make it work nicer across I2C. When we did, we updated all the internal structs except those used for lightbar commands. This CL updates the lightbar commands too. BUG=chrome-os-partner:11277 BRANCH=all TEST=manual This shouldn't change anything, but you can ensure that by poking at the lightbar manually. On Link, run this from a root shell: ectool lightbar seq stop ectool lightbar 4 ff 00 ff ectool lightbar seq run With the first command, the lightbar pattern should freeze. With the second command, it should turn magenta. With the third command, it should resume pulsing as before. Change-Id: Ic5dc4c827b3b4459288d7d9bd7d06af8a5176b3c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/33798 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Cleanup: move lightbar command enum into ec_commands.hRandall Spangler2012-09-111-1/+1
| | | | | | | | | | | | | | | | | | | | Previously this was in lightbar.h. ec_commands.h should not require other header files. Also make brightness local variable static, so it won't leak outside lightbar module. This is simply code cleanup; values themselves have not changed. BUG=none TEST=if it builds, it's fine BRANCH=none (not required in link branch since it's just cleanup) Change-Id: I5722fb677fcec99e0826e3dfc0b22033781b576f Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/32815 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Yung-Chieh Lo <yjlou@chromium.org>
* Fix return size error in lightbar host commands.Bill Richardson2012-08-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | The response size was wrong. It should be right. BUG=none BRANCH=link TEST=none Build the lbplay tool, copy it to the DUT. cd src/platform/ec make BOARD=link scp build/link/util/lbplay root@LINKIPADDR:/tmp/ Run /tmp/lbplay on DUT. It used to print a warning message. Now it doesn't. The lightbar will glow green, then red (that's what lbplay does). Change-Id: Iee02a026f08b6f761e5f28f20b79bcb9f4704a43 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/31403 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add "lightbar demo" mode for executive bikesheddingBill Richardson2012-08-201-21/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I keep getting asked to build an EC image to manually control the lightbar patterns so that the Powers That Be can look at it. This change just makes it possible to turn that mode on and off for yourself. You'll need a root shell or the EC console to do it, though. BUG=chrome-os-partner:8039 BRANCH=link TEST=manual From the EC console, type lightbar demo 1 OR from the root shell run ectool lightbar demo 1 After that, these keys should change the lightbar appearance (transitions may be slow and subtle - that's intended): UP = battery is more fully charged DOWN = battery is less fully charged RIGHT = battery is charging LEFT = battery is discharging BRIGHT = increase lightbar brightness DIM = decrase lightbar brightness Note that this does not interfere with the normal function of any keys. It only adds some additional EC behavior. Change-Id: Ia1a9855188244d74b670f9dbfdf60e3ac0343460 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/30899
* Change host command params/response pointers to void *Randall Spangler2012-07-261-2/+1
| | | | | | | | | | | | | This removes a bunch of unnecessary typecasts, since you can assign to/from void * without them. This also uncovered a few cases where const was being cast away for the input params; now fixed. BUG=none TEST=mkbp hash from u-boot console, and/or system boots ok Change-Id: Ic314b9d2ca06226ea8a09703ef5c1a912eb7146d Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/28500
* Implement something close to final lightbar code.Bill Richardson2012-07-231-37/+311
| | | | | | | | | | | | BUG=chrome-os-partner:8039 TEST=manual Boot the system, look at the lightbar. It should pulse colors slowly on battery, faster on AC. Change-Id: I0184973d11eda51db87d652aa2c92995f5a25588 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27810
* Security fix: check lightbar_sequence num paramBill Richardson2012-07-131-1/+1
| | | | | | | | | | | | | | | Make sure that a negative 'num' param won't be accepted if passed by a malicious caller. BUG=chrome-os-partner:11048 TEST=manual No visible changes, everything should continue to work. Change-Id: I8128d24adc99e5ff954a6b8065e1bfa8bf20630e Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27386 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Security fix: validate index in controller_write()Bill Richardson2012-07-131-0/+2
| | | | | | | | | | | | | | Make sure it doesn't run off the end of the I2C device list. BUG=chrome-os-partner:11051 TEST=manual No visible changes. Everything should continue to work. Change-Id: I43182361cda6be578e57acef01afb27260cea80a Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27390 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Refactor API for host commands, and handle variable length data betterRandall Spangler2012-07-111-6/+18
| | | | | | | | | | | | | | | | | | | | | | | Added version mask field to DECLARE_HOST_COMMAND() because it's convenient to do so when I'm touching all host command implementations, but all commands simply declare version 0 and nothing checks it yet. Will add version support in a followup CL. This change is internal to the EC; it does not change the data sent over the host interface. BUG=chrome-os-partner:11275 TEST=manual ectool version && ectool echash; should get sane data from both ectool flashread 0x80 0x40 /tmp/foo && od -tx1 /tmp/foo should match data from offset 0x80 of ec.bin (od -j128 -n64 -tx1 ec.bin) Change-Id: I5699f72b8d5e1ac23929353c9a34158d76c44206 Signed-off-by: Randall Spangler <rspangler@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/27172 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Remove proto1 workaroundsRandall Spangler2012-06-251-15/+1
| | | | | | | | | | | | | | | | | | | | | | | At this point, EC code requires EVT. If you still have a proto1, here's what'll break: 1) Keyboard recovery mode checks refresh key, and may read unreliably due to proto1 silego reset circuit. 2) Lightbar may not start in the correct state. 3) EC 'hibernate' command will not work. 4) Board version may read incorrectly. BUG=chrome-os-partner:9661 TEST=manual 1) powerbtn -> system powers on, lightbar displays proper sequence 2) version -> board version 1 (EVT) 3) power+refresh+esc -> system boots into recovery mode 4) power+refresh, then power button -> system reboots, then boots normally Signed-off-by: Randall Spangler <rspangler@chromium.org> Change-Id: I699946e365d15ae38622b69da1a0241e72d05f61 Reviewed-on: https://gerrit.chromium.org/gerrit/26053 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* Better help for console commandsRandall Spangler2012-05-251-3/+6
| | | | | | | | | | | | | | | | | | | | Additional help messages and usage are gated by CONFIG_CONSOLE_CMDHELP, so we can turn it on if there's space (adds about 3KB to image size) and turn it off when there isn't. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=manual 1) help 2) help list 3) help gpioset 4) gpioset -> wrong number of params 5) gpioset fred 0 -> param1 bad 6) gpioset cpu_prochot fred -> param2 bad Change-Id: Ibe99f37212020f763ebe65a068e6aa83a809a370
* Handle multiple pending lightbar events.Bill Richardson2012-05-221-29/+44
| | | | | | | | | | | | | Since the events are requests for new patterns, we only want to do the latest one. This does that. BUG=chrome-os-partner:9349 TEST=none No test: multiple events are rare. I had to fake them to see the problem. Change-Id: I7e7de94655576e16c442a97097a7303e422a551a Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Notify lightbar task when CPU enters/leaves S5Bill Richardson2012-05-221-1/+16
| | | | | | | | BUG=none TEST=none Change-Id: I07e3751c8fece18cf34d9b7c628fb3c6ab63d6b3 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Turn on light bar subtly for factoryBill Richardson2012-05-211-70/+30
| | | | | | | | | | BUG=chrome-os-partner:9850 TEST=manual Open the lid. The lightbar should turn on. Change-Id: I14d1316e6b0cac7a7e2f5b08b7d14b6bbdfa5830 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Even more debug command cleanup to save spaceRandall Spangler2012-05-211-29/+19
| | | | | | | | BUG=none TEST=(run the commands) Change-Id: Ibc414ffd594e06dbdce64c51859b6f247bb10d36 Signed-off-by: Randall Spangler <rspangler@chromium.org>
* de-LPCify the EC host interfaceVincent Palatin2012-05-151-9/+9
| | | | | | | | | | | | | Preparatory work to use common host command code between ARM and x86. Just rename constants, do not change the binary API. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:9614 TEST=make BOARD=link Change-Id: I534d427c9b50103273835a6f32a0ddb622c762b3
* Slightly update the host commands APIVincent Palatin2012-05-141-1/+3
| | | | | | | | | | | | | | | | | | | | Preparatory work to use common host command code between ARM and x86. Every command sends back explicitly the size of the response payload. The size of the response defaults to 0 ond can be updated. Add a protocol version number returned as command 0x00 to help with backward compatibility. move a couple of function from lpc specific header to host commands to be able to implement them for the I2C link. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BUG=chrome-os-partner:9614 TEST=make BOARD=link Change-Id: I6a28edf02996ddf6b7f32a3831d07d5f0271848f
* Use open drain reset signals, and clean up signals to 5VALW-powered devicesRandall Spangler2012-05-101-5/+10
| | | | | | | | | | | | | | | | | | | | | | Open drain cleanup minimizes leakage and signal glitching on shared reset/signal lines, and is tidier than explicitly switching the signals between inputs/outputs. Touchscreen and lightbar are powered by +5VALW so their signals need to be dropped when +5VALW is off to avoid leakage, and so they see a clean reset signal when they're powered up. Moved +5VALW power-on to S5-S3 transition, to minimize power draw in S5. This also ensures that 5VALW-powered devices get reset when the device bounces through S5. (No effect on proto1, where 5VALW is not under EC control.) Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:9172 TEST=boot and shutdown system; still works. Change-Id: Ia4bf0703292a189c324ce283d1e79a33776ee40f
* Add hooks for chipset power transitionsRandall Spangler2012-05-091-0/+16
| | | | | | | | | | | | This is cleaner than having x86_power explicitly know about everything else in the system that cares about power transitions. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=none TEST=boot and shutdown system; still works. Mouse powered to system is off in S5. Change-Id: Ib673ca2d9edd5473334e7604e98b99b02b768419
* Add LPC lightbar command to get the current sequence.Bill Richardson2012-05-081-27/+36
| | | | | | | | | | | | | | Instead of making the STOP command synchronous, we can just have the host-side app tell the EC to stop, then poll until it has. BUG=chrome-os-partner:9349 TEST=manual "make BOARD=link", then copy build/link/util/lbplay to the host and run it. Change-Id: I846924ae7994a498e0089197785cf239898fe2a3 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Make lightbar task stop dropping events.Bill Richardson2012-05-021-1/+1
| | | | | | | | BUG=chrome-os-partner:9350 TEST=none Change-Id: I5a208aeb74f34e82393a3208f4a0cd48cdc7bff4 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Give ectool the same lightbar commands as the console.Bill Richardson2012-04-251-63/+125
| | | | | | | | | | | BUG=chrome-os-partner:7839 TEST=manual Try "lightbar help" on the EC console and "ectool lightbar help" on the host. You should see the same commands and behavior. Change-Id: I6e879e8bb892ef5ada7ef85a97fdf243149f4cb6 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Clean up lightbar msg command parsing, add some help.Bill Richardson2012-04-251-47/+79
| | | | | | | | BUG=none TEST=none Change-Id: I5767bd45bd66793606014b3ce8020d0eb2e17090 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Refactor async console outputRandall Spangler2012-04-241-30/+33
| | | | | | | | | | | | | | | | | | This adds a 'ch' command which prints/sets which channels are active This handles all the async output; the remaining debug commands will be refactored to use ccprintf() / ccputs() in a followup CL. Signed-off-by: Randall Spangler <rspangler@chromium.org> BUG=chrome-os-partner:7464 TEST=manual ch --> all channels active ch 0x100 -> just port80 active powerbtn -> system boots; only port 80 codes shown on console Change-Id: I9efc43acec919b62b78c2c82c61946d32380adfe
* Tweaks to lightbar code, detect konami sequenceBill Richardson2012-04-191-71/+231
| | | | | | | | | | | | | | More cleanup to come... BUG=chrome-os-partner:7839 TEST=manual Lights should blink in various ways, depending on the CPU state. Also try the konami code on the keyboard. Change-Id: I90be9aabb611278ed509493fbab4d5faff74e24c Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* Add preliminary lightbar functionality.Bill Richardson2012-04-121-104/+449
| | | | | | | | | | | | | I need to clean up the console commands and provide the same functionality via ectool, but this is a good starting point. BUG=chrome-os-partner:7839 TEST=manual Power up the CPU. The lights should blink. Change-Id: Ic05a171d2b647551f1cfc7d6b2fd101088cac137 Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* First "ectool lightbar" command.Bill Richardson2012-04-041-43/+69
| | | | | | | | | | | | | | | | | | | | BUG=chrome-os-partner:8728 TEST=manual I don't have a system that has both an EC and a lightsaber, so I can't be certain this works, but I *think* it will. I do have a Link proto 0.5. With that, you can say ectool lightbar test and the EC console says it's poking at the lightbar, but of course there's nothing there. If there was, it *should* flash in pretty colors. I have a lightsaber attached to a BDS, and from the EC console running "lightsaber test" does make it blink. Change-Id: Ib6021ad8e53959de52b12efda376254071e5fb4b Signed-off-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: add reset GPIOBill Richardson2012-04-031-4/+5
| | | | | | | | | | | | | | | | | | De-assert the lightbar reset GPIO to be able to access its registers. According to the HW guys, it will consume less power in standby than in reset due the pull-up on the reset line. Signed-off-by: Bill Richardson <wfrichar@chromium.org> BUG=None TEST=manual On Link proto-1, type "lightbar test" in the EC console and see it blink. On BDS, just build it. Nothing actually changes for BDS. Change-Id: I9ec612c80f48d41ccf779f0962fc047966d4b7ba
* Rename led.c to lightbar.c, improve command interface.Bill Richardson2012-03-201-0/+229
BUG=chrome-os-partner:7839 TEST=none Signed-off-by: Bill Richardson <wfrichar@google.com> Only tested on BDS at the moment, because that's all I have. Change-Id: I30c7202856a272953bf7170c6786999378984329