summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* samus: support sensor at different power state.Sheng-Liang Song2014-10-086-56/+115
| | | | | | | | | | | | | | | | | | | | | Design Goals: 1. Every time the AP boots, the same default sensor settings are configured. 2. If the AP goes to suspend (S3) and wakes back up (S0), then the AP sensor settings will be restored. 3. In S3 and in S5, only sample specific sensors that are needed. BUG=chrome-os-partner:32368 BRANCH=ToT TEST=Verified on Samus. Verified suspend and resume logic with EC console messages. - Test Case0: close lid & open lid - Test Case1: powerd_dbus_suspend Change-Id: I553c53e63ecfcb39d5e649a7189aa6ea02589471 Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220371 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Renaming board veyron -> pinkyAlexandru M Stan2014-10-089-6/+6
| | | | | | | | | | | | | | | Seems that all previous boards used the subvariant specific name, and had an alias from emerge-variant_subvariant to the ec subvariant folder. BUG=chrome-os-partner:32331 BRANCH=None TEST=cd board/pinky; make clean && make -j && ../../util/flash_ec --board=pinky Change-Id: Ie6e0c977b6659687357a1b5aa2915cf0e40a5da7 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221904 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: David Hendricks <dhendrix@chromium.org>
* ectool: Fix help string for pwmsetfanrpmMohammed Habibulla2014-10-081-2/+2
| | | | | | | | | | BUG=none TEST='ectool pwmsetfanrpm' prints correct help command BRANCH=none Change-Id: I6b1ecc7a581bb916563177f878f6361841e3ed90 Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221957
* samus: Fixed a bug in host_sensor_id_to_motion_sensorSheng-Liang Song2014-10-081-4/+3
| | | | | | | | | | | | | | BUG=chrome-os-partner:32368 BRANCH=ToT TEST=Verified on Samus. cd /sys/bus/iio/devices/iio:device0 cat *peak_scale Change-Id: I2b0606e55bfa5e498255c6c42240ee3f9236e4f1 Signed-off-by: Sheng-Liang Song <ssl@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220991 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Remove PULSE and TEST sequences from lightbar moduleVic Yang2014-10-086-161/+50
| | | | | | | | | | | | | | | PULSE and TEST sequences are not used anywhere. Remove them to save flash space. Also, fix msleep(MSEC) calls in the unit test; it's essentially usleep(SECOND) written in an incorrect way. BUG=chrome-os-partner:32203 TEST=make buildall BRANCH=None Change-Id: I61ba897df632538eb89364a4c913d5fee87f3864 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220711 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* stm32-USB: USB GPIO control driverAnton Staaf2014-10-084-0/+205
| | | | | | | | | | | | | | | | Simple control of GPIOs over USB. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: Ic5deccd1a70080742d5ac745b537ebecd56d7443 Reviewed-on: https://chromium-review.googlesource.com/217528 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org>
* Add support for STM32F373Vic Yang2014-10-0719-60/+326
| | | | | | | | | | | | | | | | | | | This mostly reuses chip drivers for STM32F and STM32F0. Since this chip doesn't fit either STM32F or STM32F0, let's use symlink to specify which drivers to use for STM32F3. This is just the preparatory work and it's not verified on a chip yet. BUG=chrome-os-partner:32660 TEST=make buildall to make sure this doesn't break anything BRANCH=None Change-Id: I709ed49265e8f84552251a97d03b9b98496de99e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221412 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* hoho: Make HDMI SPI CS input by default.Todd Broch2014-10-072-2/+2
| | | | | | | | | | | | | Also corrected typo in GPIO name. BRANCH=none BUG=chrome-os-partner:31192 TEST=manual, compiles & runs on hoho. Change-Id: Ib41803c48795d5fc4cdbd15e9a977f78bb029405 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221572 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* ectool: hostcmd support to set fans auto control individuallyMohammed Habibulla2014-10-073-20/+66
| | | | | | | | | | | | | ectool autofanctrl 1 - set auto fan control for fan 1 BUG=chrome-os-partner:23803 TEST=Tested the above EC command on Auron BRANCH=none Change-Id: Idcd3690ad98d7965420f26f7cc445207fe73704d Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221816 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* stm32: pwm: Fix duty cycle / frequency calculationShawn Nematbakhsh2014-10-071-3/+3
| | | | | | | | | | | | | | | Correct frequency + duty cycle register calculations according to datasheet. BUG=chrome-os-partner:32089 TEST=Manual on Samus. Set 50% duty cycle and probe on scope, verify that duty cycle is actually 50% and frequency is exactly 100 Hz. BRANCH=samus. Change-Id: I1e2c0bb7e53110367c38987b369fbef44af90a7d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221790 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* zinger: samus_pd: increment zinger hardware id minor revisionAlec Berg2014-10-077-23/+30
| | | | | | | | | | | | | | | | | | Add a minor revision to the PD device hardware ID field in the info custom VDM and set increment this minor ID from 0 to 1 for zinger. This differentiates zingers for the auto-update payload, so we can update only those with a specific major and minor ID version. BUG=none BRANCH=samus TEST=load onto samus and zinger. when connect zinger, see on PD console: Dev:0x0401 SW:2289 RW:0, which shows the appropriate device ID. Change-Id: I482ee2d850332b608cdd81537f68d4dc509bfc1a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221320 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus_pd: send host event when we recv info VDM from PD deviceAlec Berg2014-10-071-2/+11
| | | | | | | | | | | | | | | Send host event to AP when we receive info VDM from a PD device. This allows the AP to potentially send an update to the device. BUG=none BRANCH=samus TEST=load onto samus. when zinger is attached, verify that EC sends host event to AP. Change-Id: I10961ab60fb752e2e40a21d9351bd1ba98cc11da Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221162 Reviewed-by: Todd Broch <tbroch@chromium.org>
* pd: zinger: move sending info VDM from UFP to DFPAlec Berg2014-10-079-18/+47
| | | | | | | | | | | | | | | | | | | | | Changed sending of info VDM from the UFP side in SNK_DISCONNECTED to the DFP side in SRC_READY to match the PD spec. Only the DFP is supposed to send VDMs, and by default the power source is the DFP. This affects simple DFPs such as power adapters, they must initiate the info VDM once a power contract has been negotiated. BUG=none BRANCH=samus TEST=load onto samus_pd and zinger and make sure that when you attached zinger to samus, samus receives info VDM and prints out something like: VDM/7 [11] 18d1000b Dev:1 SW:2280 RW:0 Change-Id: I16ceac31939fdc1c74be7323e628dd8706e1283b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221174 Reviewed-by: Todd Broch <tbroch@chromium.org>
* Update Zinger flashing processVincent Palatin2014-10-076-103/+50
| | | | | | | | | | | | | | | | | | | | Convert the Zinger flash update commands to the new RSA signature mechanism. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:28336 TEST=from the workstation: ./util/flash_pd.py -m 1 build/zinger/ec.RW.bin from Samus command-line : ectool --name=cros_pd flashpd 0 1 ec.RW.bin Change-Id: Ie8cd7f644ec94e461c5775a4dbbcd408782c72e1 Reviewed-on: https://chromium-review.googlesource.com/221560 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* zinger: add config option for hibernate and disable by defaultAlec Berg2014-10-072-0/+5
| | | | | | | | | | | | | | | Disable hibernate by default on zinger because some EVT zingers do not wake up on connect due to hardware problem. BUG=chrome-os-partner:28335 BRANCH=samus TEST=load onto zinger, leave disconnected for 60s, make sure it doesn't go into hibernate Change-Id: I9f5f9fb1ce349ea862652cd38aa5d1e521234b30 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221478 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ectool: Add hostcmd support to set fan duty cycle for each fan separatelyMohammed Habibulla2014-10-073-16/+86
| | | | | | | | | | | | | | ectool fanduty <percent> - set all fans to <percent> duty cycle ectool fanduty <fan> <percent> - set <fan> to <percent> duty cycle BUG=chrome-os-partner:23803 TEST=Tested the above EC commands on Auron BRANCH=none Change-Id: I06ca1552bd8f3412f6e90245da302c9f86ab6103 Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221505 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cortex-m0: disallow rescheduling if task_start() has not yet runAlec Berg2014-10-071-1/+2
| | | | | | | | | | | | | | | | | | | | | Do not allow rescheduling tasks if task_start() has not been called. This fixes a bug in which if console input occurs between uart_init() and task_start(), the MCU crashes because uart_init() enables uart interrupts which attempts to wake up the console task when RX data is received, which then tries to task switch before we initialized task scheduling. BUG=chrome-os-partner:32561 BRANCH=samus TEST=add while(1) loop to adc_init() to simulate stalled ADC initialization. When stalled, send console character and observe that without this CL MCU crashes, and with this CL the MCU does not crash. Change-Id: I34418e88ebe0063acf1cc55ab5a57b5fddcd9d23 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221599 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add back unit test for usb_pd"Vic Yang2014-10-0413-28/+788
| | | | | | | | | | | | | | | | | | This is mostly the same as previous commits, but with increased delay. Previously, we have short delays (e.g. 3ms) which is too short and may cause instability. Now that we have slowed down the time when running unit tests and increased the delay, this shouldn't cause problems anymore. BUG=chrome-os-partner:31200 TEST=Repeatedly run multiple unit tests in parallel. BRANCH=Samus Change-Id: Ib55e3adc5fd27a8e233996b4799dab3cefd62318 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220734 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* lightbar: refactoring RAMP_ONCE and CYCLE_ONCEEric Caruso2014-10-041-40/+31
| | | | | | | | | | | | | | | | These opcodes basically do the same thing, but with minor changes. We can factor this out to avoid code duplication. Saves 90 bytes. BUG=None BRANCH=ToT TEST=Inspected programs that use RAMP_ONCE and CYCLE_ONCE with both nonzero and zero ramp delay. Change-Id: I0105dbd4fc0af86beea993dbef85a0e0f01a0a90 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220604 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Slow down time when running unit testsVic Yang2014-10-043-4/+15
| | | | | | | | | | | | | | | | | | | | | | When a timing sensitive test run on a heavily loaded system, sometimes a task runs for longer than it usually does and causes the test to fail. All the timing requirements in the unit tests are trying to verify the various delays in our codebase, and mostly we don't care about the time taken by active running code (as they are very quick.) To improve the stability of tests, let's slow down the time. To a test, it's as if the code runs faster. If a test uses udelay() and exceeds the 10-second time limit, we can make that single test faster by setting the time scale. BUG=None TEST=Repeatedly run 'make runtests' BRANCH=None Change-Id: I9bc5c77e0d34d04c8630d495387a751ef29c7bd5 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220717 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: Add host command support to set fan RPM for each fan separatelyMohammed Habibulla2014-10-033-21/+96
| | | | | | | | | | | | | | | | | First case is for legacy support ectool pwmsetfanrpm <targetrpm> - set all fans to <targetrpm> ectool pwmsetfanrpm <fan> <targetrpm> - set <fan> to <targetrpm> BUG=chrome-os-partner:23803 TEST=Tested the above EC commands on Auron BRANCH=none CQ-DEPEND=CL:220960 Change-Id: I8f447f53289abaa9c5cc1285f9f0921328fbf32c Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221291 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* hoho: updates for rev2.0Todd Broch2014-10-031-2/+1
| | | | | | | | | | | | | | | | BRANCH=none BUG=chrome-os-partner:31192 TEST=manual, - compiles & installs & runs on hoho rev2.0 - see RFUx -> SBU gpio change > gpioget PD_SBU_ENABLE 1 PD_SBU_ENABLE Change-Id: Ice6963e05463670653470b24d451d41a35e249f3 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220181 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* ectool: add new host command to get number of fansMohammed Habibulla2014-10-031-8/+33
| | | | | | | | | | | BUG=chrome-os-partner:23803 TEST="ectool pwmgetnumfans" returns correct number of fans on Auron BRANCH=none Change-Id: I2a1930a8f0965b08558bfb3c6424c571a6149bbb Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220960 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* ectool: Fix fanduty helpMohammed Habibulla2014-10-031-1/+1
| | | | | | | | | | | BUG=none BRANCH=none TEST=none Change-Id: Iff09a24064d4245d2660dd307084cd701d03676b Signed-off-by: Mohammed Habibulla <moch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/221202 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* zinger: add hibernate if disconnected for 60sAlec Berg2014-10-035-4/+55
| | | | | | | | | | | | | | | | | Automatically go into hibernate (standby mode) if not powering anything for 60 seconds. Will wake up when it is plugged into something (senses pull-down on CC line). BUG=chrome-os-partner:28335 BRANCH=samus TEST=load onto zinger. if disconnected for 60s, see hibernate print on zinger console. when connected to a device, verified it boots again. Change-Id: I2564c6192395bb5e4f6d7586c2725f13a4581049 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220837 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* zinger: check RW firmware signatureVincent Palatin2014-10-0214-31/+402
| | | | | | | | | | | | | | | | | | | | | | | The Zinger RW is now signed with 2048-bit RSA key (using SHA-256 as digest). This CL implements the verification mechanism. note: the RSA key used for signing must be provided as a .pem file. The path to .pem file must be provided in the PEM environment variable. By default, it's using the dev key stored in zinger_dev_key.pem. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:28336 TEST=on Zinger, run with properly signed RW firmware and corrupted firmware and check the serial traces. Change-Id: Ia58482458904a3ed72d6b0e95996cae86a0ead83 Reviewed-on: https://chromium-review.googlesource.com/220178 Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* zinger: minimuffin: add board support for minimuffinAlec Berg2014-10-027-11/+32
| | | | | | | | | | | | | | | | | | | | | | | Minimuffin is identical to zinger, same MCU, same gpio, same circuitry aroundt the MCU with two differences: - Rated current is 2.25A instead of 3A - USB PD hardware device ID needs to be different so that host can differentiate between the two. Due to the similarity between the two, minimuffin is defined as a symlink to the zinger board. BUG=none BRANCH=samus TEST=make BOARD=minimuffin load onto a zinger and verify that samus reads device ID correctly and limits input current limit to 2.25mA. Change-Id: Ie39ec43262c7d14663eb68abff073bfeec451a24 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220689 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: invert keyboard col2 optionChris Zhong2014-10-023-2/+10
| | | | | | | | | | | | | Silego variant in pinky rev2 require the signal to be inverted. BUG=None TEST=on pinky-rev2: all keys from col2 work correctly BRANCH=None Change-Id: I83a029b4e9c6b4770e83f30b170595d45ea40cca Signed-off-by: Chris Zhong <zyw@rock-chips.com> Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220314
* Veyron: power on 5v drv for pinky-rev2Chris Zhong2014-10-022-0/+14
| | | | | | | | | | | | | | | EC need to enable 5v_drv when power on AP, disable it when power off AP. BUG=None TEST=USB host works well BRANCH=None Change-Id: Ie18679a5a2d3c676daf0af4da599fa010d98161d Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/220162 Reviewed-by: Alexandru Stan <amstan@chromium.org> Tested-by: Alexandru Stan <amstan@chromium.org> Commit-Queue: Alexandru Stan <amstan@chromium.org>
* Remove 'param' option in lightbar console commandVic Yang2014-10-021-69/+0
| | | | | | | | | | | | | | We can use ectool to set/get lightbar parameters and don't need a huge console command option for this. Let's get rid of it to save flash space. BUG=chrome-os-partner:32203 TEST=make buildall BRANCH=None Change-Id: Ifbc122c887a36accaf3f8dce43f091d7d1333550 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220710
* stm32mon: add option to read firmware image from stdinVincent Palatin2014-10-022-4/+8
| | | | | | | | | | | | | | | | | | | | | Add a command-line option to ask stm32mon to read the EC firmware image to flash from the standard input when the filename is replaced by a "-". Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chromium:398165 chromium:396233 TEST=use the following flashing commands: cat build/fruitpie/ec.bin | ./util/flash_ec --board=fruitpie --image=- ./util/flash_ec --board=fruitpie ./util/flash_ec --board=fruitpie --image=build/fruitpie/ec.RO.flat and check the content of the flash. Change-Id: I8039ecb6910f912161a7f59c5f5e2fc80447ce7b Reviewed-on: https://chromium-review.googlesource.com/220842 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* lightbar: hide program command over consoleEric Caruso2014-10-011-5/+4
| | | | | | | | | | | | | | | | This doesn't make any sense to expose to the console, so we can save some logic and string literals by only compiling it for the simulator. BUG=chrome-os-partner:32203 BRANCH=ToT TEST=Checked console does not support command. ectool still works and the lightbar simulator still has the command. Change-Id: Ib216c7c11fd3d0d2d444ef7fc0dda4e451103219 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220834 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* stm32f0: deep sleep in S0Alexandru M Stan2014-10-014-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | Enabled deep sleeping during S0. This was previously inhibited by SLEEP_MASK_AP_RUN but the new config option (CONFIG_LOW_POWER_S0) will ignore it. SPI needed a sleep mask, it essentially gets enabled and disabled whenever the CS changes. Warning: waking up when the CS falls takes a little time, if the AP sends fast data before the 48MHz clock is enabled characters will get corrupted; leave about 30uS time for the clock to start. CQ-DEPEND=CL:219997 CQ-DEPEND=CL:220243 CQ-DEPEND=CL:220461 BUG=chrome-os-partner:32223 BRANCH=none TEST=load onto pinky, boot the AP(S0), use idlestats command to verify that we are going into deep sleep (STOP mode). Verify that everything works normally during S0(SPI, keyboard, anything that requires the EC to wakeup). Change-Id: I81c4fa472332f1ad8ad93301089a99dcdb108948 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219555 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: Translate host command parameters with lookup tablesVic Yang2014-10-011-41/+26
| | | | | | | | | | | | | | | We have giant switch-case just for translating USB PD host command parameters. Let's change this to lookup tables so that it's clearer and also reduces code size. BUG=chrome-os-partner:32203 TEST=make buildall BRANCH=None Change-Id: Ieef0e989bd0faa95e261748a73250c53f0942dad Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220511 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* lightbar: Removing unused space in ramp tableEric Caruso2014-10-011-1/+1
| | | | | | | | | | | | | | | We don't need the upper two bytes of any elements in the ramp table, since none of them are big enough to flow into them. This saves us another 60-70 bytes. BUG=None BRANCH=ToT TEST=Manual, visual inspection Change-Id: Id9d03b8f63e61172c5cc6b36b010582957c7bb22 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220595 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: simplify JUMP, SET_DELAY_TIME opcode executionEric Caruso2014-10-011-12/+2
| | | | | | | | | | | | | | | | We do some unnecessary work here. All we are trying to do is decode, and decode already does all the error checking we want. Saves 20 bytes. BUG=None BRANCH=ToT TEST=Run programs with JUMP and SET_DELAY_TIME opcodes in simulator and on hardware. Change-Id: Ia55f9010da50fe748bda565e069359162cc92b4f Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220630 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* ryu: Use brief assertion failure messageVic Yang2014-10-015-0/+31
| | | | | | | | | | | | | | | | | | | | | Currently, when an assertion fails, the error message is like: ASSERTION FAILURE '1 + 1 == 3' in command_apreset() at common/chipset.c:24 To save flash space, let's add an option to remove the failed expression and function name. The error message becomes: ASSERTION FAILURE at common/chipset.c:24 BUG=chrome-os-partner:32203 TEST=make buildall TEST=Add an assertion and triggers it. Check error message. BRANCH=None Change-Id: Ie323d5b43cbff2cd8f6cd5bb46c1f34ecd16bd5e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219670 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lightbar: treat HALT like a normal opcodeEric Caruso2014-10-013-9/+13
| | | | | | | | | | | | | | | | This removes the special casing around HALT. It saves us a string literal and some logic. In total, we gain about 50 bytes and a little cleanup for this. BUG=None BRANCH=ToT TEST=Tried a program that uses HALT (i.e. red-green-blink) in simulator and on hardware. Change-Id: Iffee1b559983fd1ecd385cc6b8967f72a6b968a0 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220589 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: remove erroneous multiplications by FP_SCALEEric Caruso2014-09-301-2/+2
| | | | | | | | | | | | | | Not sure why these were around. They were making RAMP_ONCE and CYCLE_ONCE do obviously incorrect things. BUG=None BRANCH=ToT TEST=Manual, visual inspection Change-Id: I618078e8bef8824f5449d5b5453924beb36d50e1 Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220463 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* lightbar: shrink size of sine table for rampingEric Caruso2014-09-301-28/+19
| | | | | | | | | | | | | | | cycle_010 now uses a table one-fourth the size and does a small bit of linear interpolation in order to save space. This change saves around 350 bytes. BUG=None BRANCH=ToT TEST=manual; inspection that ramping still looks smooth Change-Id: Ib5900630ba4a471a6284660377134724070babdc Signed-off-by: Eric Caruso <ejcaruso@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220430 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* samus: add auto unwedge to all i2c bussesAlec Berg2014-09-302-2/+6
| | | | | | | | | | | | | | | Allow automatic wedge detection and unwedge to all i2c busses on Samus. BUG=chrome-os-partner:32471 BRANCH=samus TEST=make -j buildall Change-Id: I4a9f91532c479da527bdf40531732108aa2c2c89 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220467 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* i2c: allow for mulitple i2c busses to utilize automatic unwedgingAlec Berg2014-09-301-4/+16
| | | | | | | | | | | | | | | | | Previously we had a restriction that only one i2c bus could use the automatic wedge detect and unwedge functionality. This removes that restriction, although it uses a mutex to make sure only one bus is being unwedged at any given time. BUG=chrome-os-partner:26485 BRANCH=samus TEST=make -j buildall Change-Id: I8ff238fb8a9e9d2f5bc57a2b0a05e2b231024772 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220466 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Commit-Queue: Duncan Laurie <dlaurie@chromium.org>
* add RSA signature verification codeVincent Palatin2014-09-304-0/+244
| | | | | | | | | | | | | | | | | | | | | 2048-bit RSA public key cryptography signature verification code which uses a pre-processed key for computation. it is based on the code from vboot : platform/vboot_reference/firmware/2lib/2rsa.c Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:28336 TEST=using following CL, on Zinger, verify RW firmware signature. Change-Id: I681a29144eb805cd5758aa6efe697ce2f656a298 Reviewed-on: https://chromium-review.googlesource.com/220186 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* samus: Increase ALS task sizeDuncan Laurie2014-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | Sometimes I2C1 is wedging and this can cause the ALS task to overflow its stack. As a temporary measure to stop the random reboots increase the ALS task size. BUG=chrome-os-partner:32471 BRANCH=samus TEST=build and boot on samus with stuck I2C1 taskinfo before (after fresh reboot): 2 ALS 00000000 0.001012 364/384 taskinfo after (notice it is >384 after some time): 2 ALS 00000000 0.031586 400/512 Change-Id: I04e9b93d3cc60afd3303eb4610c81952f365b992 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220442 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Add compiler/decompiler for lightbar bytecode programs.Bill Richardson2014-09-306-29/+640
| | | | | | | | | | | | | | | | | BUG=none BRANCH=ToT TEST=manual make BOARD=samus for i in extra/lightbar/programs/[g-z]*.bin; do ./build/samus/util/lbcc -d $i /tmp/x.lbs ./build/samus/util/lbcc /tmp/x.lbs /tmp/x.bin cmp $i /tmp/x.bin done Change-Id: I86c014c425e917ecafadd1c6845fcf2e5b4edbb7 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220244
* samus_pd: Add BST_DISABLE GPIO for EVT2 boardDuncan Laurie2014-09-301-1/+1
| | | | | | | | | | | | | | This pin is already set to out+low so it should be fine to rename it on EVT1 boards. BUG=chrome-os-partner:32031,chrome-os-partner:32359 BRANCH=samus TEST=make buildall Change-Id: I0d904b0301b793bbfa1d829b4fce60e0b1154b00 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220259 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus: Add define for EVT2 boardDuncan Laurie2014-09-301-0/+1
| | | | | | | | | | | | | EVT2 will be board id 0b100. BUG=chrome-os-partner:32359 BRANCH=samus TEST=make buildall Change-Id: Id82c319e84fac6db1a5223692e575bfe11790190 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220258 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charge_state_v2: Send host event if charge state changesDuncan Laurie2014-09-302-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If there is any delay between AC status and the battery charge status it is possible for the power_manager to read the battery state when the AC status event is sent and still see that the battery is not yet charging. This can cause lag in the UI battery icon because the AP is not notified when the battery charge state changes. In order for the host to be able to differentiate the dynamic battery state changing (re-read ACPI _BST by sending Notify 0x80) from the static battery info (re-read ACPI _BIX/_BIF by sending Notify 0x81) it needs a separate host event. BUG=chrome-os-partner:32196 BRANCH=samus TEST=Test AC instertion and removal while watching state on the host to ensure that an event is sent to the host which triggers power manager to re-read the battery status and notice that the charge state has changed if there is any delay after the AC status event: watch -n 0.1 "cat /sys/class/power_supply/AC/online; cat /sys/class/power_supply/BAT0/status; tail -10 /var/log/power_manager/powerd.LATEST" Change-Id: I18ce70719dc231c43c474cefad2068f949675a2b Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220257 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* zinger: add low power stop modeAlec Berg2014-09-295-49/+129
| | | | | | | | | | | | | | | | Add low power mode for zinger. This uses stop mode in task_wait_event(), the non-runtime equivalent of the idle task. BUG=chrome-os-partner:28335 BRANCH=samus TEST=load onto zinger and plug and unplug into samus a bunch of times to make sure it negotiates to 20V every time. also send custom vdm's from samus_pd and make sure those always succeed. Change-Id: I626365e7d22e030792d28dbf7eafaeb8f54f8a74 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/219933 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Fix floating point usage in lightbar moduleVic Yang2014-09-271-4/+4
| | | | | | | | | | | | | | | | | This patch fixes stary floating point usage in lightbar module. They should be scaled by FP_SCALE and of type 'int'. BUG=None TEST=Compile and make sure the compiler is not using floating point related instructions. BRANCH=None Change-Id: I8d598af1014160b83bc44ef3e88e2cc4bf304e5e Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/220121 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Eric Caruso <ejcaruso@chromium.org>