summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* samus_pd: add dual-role port flag to power info host commandstabilize-6436.BAlec Berg2014-10-313-0/+11
| | | | | | | | | | | | | | | | | Add flag for whether or not device plugged into a given port is a dual-role PD device. For now, the dual-role flag is always 0, but need to add the flag to the host command now for compatibility in the future. BUG=chrome-os-partner:32650 BRANCH=samus TEST=load onto samus, run ectool --name=cros_pd usbpdpower and verify that for anything plugged in it says "dedicated charger" Change-Id: I2d3c8c149802492f27a87a47aaa68fbf505ee7a9 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226820 Reviewed-by: Sameer Nanda <snanda@chromium.org>
* Add initial support for cr50 SoCBill Richardson2014-10-3117-0/+1036
| | | | | | | | | | | | | | | | | | | | | The serial console works. Nothing else is implemented yet. BUG=none BRANCH=ToT TEST=make buildall -j To build, make BOARD=cr50 hex Testing the result requires a development board. I have one. It works with HW revision m3.dist_20140918_094011 Change-Id: I718d93572d315d13e96ef6f296c3c2796e928e66 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226268 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Samus: Fixed sensor init when sysjump to between RO and RW codeSheng-Liang Song2014-10-311-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | When sysjump between RO and RW code, the motion sensor global data structure get reset to 0. The motion sensor task does not get notification from the power state change event. Added chipset S0 state check logic to re-init sensor active flag to S0. BUG=chrome-os-partner:33370 BRANCH=ToT TEST=sysjump RW; accelread 0 Test Cases: 1 - press power cycle button; checked with powerinfo,accelread 2 - press power cycle button + F3 (refresh) key; checked with powerinfo,accelread 3 - Go to G3, S0, S3; checked with powerinfo, accelread 4 - boot up to S0; sysjump RW; accelread 0|1|2 Change-Id: Ibfe4ba581c8b771be15adb7440374d09fdf03953 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226698 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Sheng-liang Song <ssl@chromium.org> Tested-by: Sheng-liang Song <ssl@chromium.org>
* samus_pd: add more host events and host cmd to get event statusAlec Berg2014-10-314-6/+65
| | | | | | | | | | | | | | | | | | | | | | | | Add support for more host events and add a host command for the host to use to get which host events have fired. The EC only uses one real host command to notify the AP whenever the PD MCU needs attention so the EC_CMD_PD_HOST_EVENT_STATUS host command can be used to differentiate the possible triggers for the host event. Current events include: PD remote device needs update, type-C power info changed, and PD identity response received. Added host event for power info change, which fires whenever a charger or device is plugged into a type-C port. BUG=chrome-os-partner:32650 BRANCH=samus TEST=tested on samus by connected various peripherals to type-C ports and verifying on EC console that a host event is sent. Change-Id: Ibfc2cafe5826a0ab41aee96a68fdb561c0a2b4ab Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225841 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* pd: dingdong/hoho: Include product VDO in discovery identity.Todd Broch2014-10-317-15/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per table 6-24 of USB PD spec an alternate mode adapter (AMA) should include both product & AMA VDOs. BRANCH=samus BUG=chrome-os-partner:31192,chrome-os-partner:31193 TEST=manual, Connect hoho/dingdong to fpie/samus and see product VDO proceed the AMA VDO in DFP_U console output: Product VDO -----------------------------v |------| SVDM/5 [1] ff008041 340018d1 00000000 50100001 1100000b Note, hoho's PID == 0x5010 And dingdong (0x5011) SVDM/5 [1] ff008041 340018d1 00000000 50110001 1100000b Also see bcdDevice field in descriptor match above data. $ lsusb -v -d 18d1: | egrep -i "idproduct|bcddev" idProduct 0x5011 bcdDevice 0.01 Change-Id: I4d898816a45c68c7ff75a54fd348fc11be408ae0 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226125 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: dingdong/hoho: inhibit USB Billboard.Todd Broch2014-10-319-25/+66
| | | | | | | | | | | | | | | | | | | | | | | USB Billboard class can be used to advertise an alternate mode capable device that hasn't entered a mode. Additionally it can remain after mode entry providing its Billboard capabilities descriptor is updated. This CL postpones enumeration which previously occurred after boot until tAMETimeout has passed and alternate mode has NOT been entered. Future CL could choose to also (re)enumerate with mode capabilities although this is not required by the USB PD specification. BRANCH=none BUG=chrome-os-partner:31192,chrome-os-partner:31193 TEST=manual, With DFP_U which does not enter mode see Billboard class enumerate else it does not. Change-Id: I59a0815cd0ea551ba9a878907c0184df4ba9480c Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224663 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: accel: fix initialization bug in tap gestureAlec Berg2014-10-311-12/+8
| | | | | | | | | | | | | | | | | | | | | Fix bug in tap gesture. When turning on tap detection, don't clear the history circular array index. This was causing inconsitent tap for battery recognition because the inner window sum of z-axis data (sum_z_inner) was relying on subtracting out old historical data and adding in the new data, but when the array index changed, it was subtracting out the wrong old data. This really only came in to play if there was significant z motion before the last wakeup. BUG=none BRANCH=samus TEST=keep going to sleep and waking up and test that tap for battery works every time. Change-Id: I55e00c805d504dd6d257a81f2cd25fe384a53257 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226591 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* pd: dingdong/hoho: assert USB billboard only in AMA VDO.Todd Broch2014-10-303-2/+4
| | | | | | | | | | | | | | | | | | BRANCH=samus BUG=chrome-os-partner:31192,chrome-os-partner:31193 TEST=manual Attach hoho/dingdong to samus and see AMA VDO bits <2:0> set to 0x3 during the discover identity response. AMA VDO |------| SVDM/4 [1] ff008041 340018d1 00000000 1100000b Change-Id: I1e2459b87cceca88ab3ae09440b689041ae03c7c Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226101 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: dingdong/hoho: HPD over USB PD.Todd Broch2014-10-3010-13/+244
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | HPD needs to be transported of USB PD as both SBU lines are consumed for differential AUX signalling. This CL does the following: 1. Enables GPIO DP_HPD as interrupt 2. Sends debounced HPD across CC via the SVDM DP status message BRANCH=none BUG=chrome-os-partner:31192,chrome-os-partner:31193 TEST=manual, From servo w/ GPIO attached to HPD drove the following transactions after inserting with HPD low initially: # e1: hpd_high # e2: hpd_low # non-registered glitch # e3: hpd_high followed by hpd_low # e4: hpd high # non-registered glitch # e5: hpd_irq # e6: hpd_irq # e7: hpd_irq # e8: hpd_low followed by hpd_high From fruitpie console (marked up to show result of above) ----> enter-mode, dp status, dp config [6.774108 DONE] SVDM/1 [4] ff018144 [6.777467 DONE] SVDM/2 [16] ff018150 00000002 [6.780637 DONE] SVDM/1 [17] ff018051 ----> attentions start arriving ----> e1 [18.966741 DONE] SVDM/2 [6] ff018106 0000008a ----> e2 [33.724367 DONE] SVDM/2 [6] ff018106 0000000a ----> e3 [64.550398 DONE] SVDM/2 [6] ff018106 0000008a ----> e3 [64.752452 DONE] SVDM/2 [6] ff018106 0000000a ----> e4 [74.247127 DONE] SVDM/2 [6] ff018106 0000008a ----> e5 [88.906254 DONE] SVDM/2 [6] ff018106 0000010a ----> e6 [100.938738 DONE] SVDM/2 [6] ff018106 0000010a ----> e7 [123.693414 DONE] SVDM/2 [6] ff018106 0000010a ----> e8 [130.050074 DONE] SVDM/2 [6] ff018106 0000000a ----> e8 [130.254087 DONE] SVDM/2 [6] ff018106 0000008a Change-Id: I976c268467ece84cedab7ba4943fb59d1e48c113 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223262 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* twinkie: fix CC2 reception in PD injector modeVincent Palatin2014-10-302-2/+9
| | | | | | | | | | | | | | | | | | | | | | | Properly set the comparator output when using CC2. Also add some basic LED color to display the current power contract when we are a sink : - green : 5V - red : 20V - blue : other voltage Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=plug to Zinger in each plug direction and see green then red LED. type "pd 0 dev 12" and see the blue LED. Change-Id: I4eb4339568eda5871c7f3df75bedebd97238e941 Reviewed-on: https://chromium-review.googlesource.com/226385 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* twinkie: fix INA reference in PD injectorVincent Palatin2014-10-301-3/+3
| | | | | | | | | | | | | | | | | Update the INA naming in the optional PD code to use Twinkie as PD source/sink. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: Ib06e274c0d916d6c84107546a8701fc80b4e6ab1 Reviewed-on: https://chromium-review.googlesource.com/226363 Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* samus_pd: add host command to get type-c port power infoAlec Berg2014-10-308-10/+281
| | | | | | | | | | | | | | | | | | | | | | | | Get type-c port power info including power role, charger type, and charging info. Also added host command to get number of type-c ports. Also adds new charging suppliers for pericom identified chargers including DCP, CDP, SDP, proprietary, and other chargers. Priority of these for charging is set in samus board file. BUG=chrome-os-partner:32650 BRANCH=samus TEST=run 'ectool --name=cros_pd usbpdpower' and verify correct status with minimuffin, zinger, and type-C to type-A adapter. Change-Id: I1dabbe7de4185a23df5684a5ea9a2d944f1f6ff5 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/223523 Tested-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ryu: Enable low power idle for P2 boardsVic Yang2014-10-302-2/+7
| | | | | | | | | | | | | | | | | Now that the problem with UART in STOP mode is fixed, let's enable low power idle for Ryu P2 boards. BRANCH=None BUG=chrome-os-partner:33219 TEST=Shut down the AP and unplug AC power. Check the EC goes into deep-sleep by 'idlestat'. TEST=Power up the AP and check the EC stays awake. Change-Id: Ib8ad3763407315ec0f95551fa0fdd258a060e113 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226312 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* discovery-stm32f072: Rename USB console endpointAnton Staaf2014-10-301-1/+1
| | | | | | | | | | | | | | | | | This isn't really an EC as Vincent pointed out, rename this endpoint serial interface to Shell. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: Id4605b782cdb8e1be5293f4b6b88357bd653c770 Reviewed-on: https://chromium-review.googlesource.com/226331 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* gesture: Minor fixesGwendal Grignou2014-10-291-3/+5
| | | | | | | | | | | | | | | Set state or numeric when needed Add debug for the idle state. BUG=None BRANCH=ToT TEST=Check debug appears when enabled. Check tap still works. Change-Id: Ic4660f70a27464dc68c02fdaef60dc36d7c2edad Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225487 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Sheng-liang Song <ssl@chromium.org>
* Samus: Split motion sense and lid angleGwendal Grignou2014-10-2917-353/+437
| | | | | | | | | | | | | | | Split motion_sense.c. Translate the accel data in the Android coordinate right away. BUG=chrome-os-partner:32002 BRANCH=ToT TEST=On samus, check lid angle are still correct. Change-Id: If743e25245dc1ce4cdacb8a4d5af22616c4a79e4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225486 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* core: Add subcommands to MOTION_SENSE_CMDGwendal Grignou2014-10-292-6/+56
| | | | | | | | | | | | | These subcommands allow accessing sensor (accel+gyro) over i2c. BRANCH=ToT BUG=chrome-os-partner:31071 TEST=Compile. Change-Id: Ic6c3e9bf9c23f369de9f540c50daab7f2e4582ee Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225653
* Samus: move gesture to commonGwendal Grignou2014-10-2910-67/+90
| | | | | | | | | | | | | | | | Move gesture to common directory, 1st step to be reused by other board. Cleanup motion_sense shutdown path. BUG=chrome-os-partner:33102 TEST=Double tap still works on Samus BRANCH=ToT Change-Id: I0a3b38c4a7dbe95c27dcdebff04c1176aaf932d1 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225235 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* USB-console: Add Linux USB serial kernel moduleAnton Staaf2014-10-292-0/+56
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a simple kernel module and Makefile for building it out of tree. This module just uses the existing kernel usb serial driver and probes for the Google VID/Class/SubClass/Protocol that identifies a valid simple serial interface. This code should be rolled into the existing kernel driver at: drivers/usb/serial/usb-serial-simple.c While that happens, this module is still useful to developers. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=cd extra/usb_serial; make; sudo insmod raiden.ko Connect the discovery-stm32f072 over USB and see that its console is discovered and works. Change-Id: I83661b816643c43b3e2dc9fdc825bc3a796af2f4 Reviewed-on: https://chromium-review.googlesource.com/225923 Reviewed-by: Olof Johansson <olofj@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* discovery-stm32f072: Enable USB consoleAnton Staaf2014-10-292-10/+15
| | | | | | | | | | | | | | | Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Verify that the console is discovered and works. Change-Id: I7bdf85c4435a6423acc915a61c1d1302052113a0 Reviewed-on: https://chromium-review.googlesource.com/225951 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* USB-console: Add string names for console interfacesAnton Staaf2014-10-297-6/+12
| | | | | | | | | | | | | | | | | | | | | These names can be used to uniquely identify an interface as being a console forwarded from the AP, or the EC's console or some other console. This makes it possible to connect to the correct console from servo without knowing what board is attached. These strings could also be used by udev rules to create appropriate symlinks. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I1abd36f952782a03606b09485917be8e154534ce Reviewed-on: https://chromium-review.googlesource.com/225950 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* USB: Add simple serial subclass supportAnton Staaf2014-10-293-4/+8
| | | | | | | | | | | | | | | | | | | | | | This uses the newly allocated simple serial SubClass and Protocol identifiers to make enumeration of serial consoles over USB easier. The simple usb serial kernel driver can select based on vid/class/subclass/protocol, making it trivial to attach to serial consoles. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable USB console on discovery-stm32f072 and verify that a new ttyUSB? device is discovered. Change-Id: I6d3e414a20753573c2ee90a48fb1d5dce2c3972d Reviewed-on: https://chromium-review.googlesource.com/225869 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* USB-console: Reclaim two bulk endpointsAnton Staaf2014-10-292-69/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the USB console code used two separate bidirectional endpoints. Using the STM32 USB perihperals endpoints in this manner means that there are only 8 total endpoints available. But the STM32 USB peripheral allows for a single endpoint number to be used for both IN and OUT transactions, and while this (re-using an endpoint number for both IN and OUT endpoints) appears to be not compliant with the letter of the law with respect to the USB spec, it is supported by USB stacks, and is used in a number of USB devices. So this change makes the USB console driver share a single endpoint number between the IN and OUT bulk endpoints used to implement the console. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable USB console on discovery board and manually test. Change-Id: I511e56de2162a6c04ddba80d26b37b4f0cd993fd Reviewed-on: https://chromium-review.googlesource.com/225868 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* usb: fix undefined USB endpointsstabilize-6415.Bfoo-testVincent Palatin2014-10-291-4/+8
| | | | | | | | | | | | | | | | | | When calling the ep_undefined function, the linker was not considering it as a Thumb function and not setting the LSB in the address pointer. This was causing an exception at runtime. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=all BUG=none TEST=inspect assembly Change-Id: I8f4d1e351081032e138f593f0b61294031fc09b1 Reviewed-on: https://chromium-review.googlesource.com/226093 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* it8380dev: add pwm control moduleDino Li2014-10-298-22/+294
| | | | | | | | | | | | | | | | Add pwm control module for emulation board. Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=console manual test, pwm channels output correctly. Change-Id: I6eb1a9e4fdcb9279e9d0cbd67f7a92afed21c889 Reviewed-on: https://chromium-review.googlesource.com/223921 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Dino Li <dino.li@ite.com.tw> Tested-by: Dino Li <dino.li@ite.com.tw>
* EC:KBC: Wait until LPC host senses the IRQ and gets the character.Kenji Chen2014-10-281-1/+6
| | | | | | | | | | | | | BRANCH=master BUG=chrome-os-partner:29139 TEST=Buiid an EC FW image and run on Rambi to test if key loss is improved and any side effect somes with this change. Need more test units to confirm this. Signed-off-by: Kenji Chen <kenji.chen@intel.com> Change-Id: I2399e33d2ca3defe8cd9b1f94ab0af1db7f84635 Reviewed-on: https://chromium-review.googlesource.com/225557 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mohammed Habibulla <moch@chromium.org>
* USB-console: Don't wait in interrupt contextsAnton Staaf2014-10-281-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the USB console code would wait for up to 30 ms for the USB packet buffer to become available for transmission, even if it was called from an interrupt context. This doesn't work because, even if we were OK with waiting this long in interrupt contexts, which we are not, we rightly assert that we are not in an interrupt context in task_wait_event, which usleep calls. This solution is a quick fix to only wait when not called from within an interrupt context. The correct solution is likely to decouple the printf code from directly calling the console driver code, instead we should place a queue between the driver and printf logic. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Enable USB console on discovery board and manually test. Change-Id: I5b6f7bbb77f75132c75935f8fda01e652a236ae0 Reviewed-on: https://chromium-review.googlesource.com/225867 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* twinkie: dual channel CCx sniffingstabilize-6412.BVincent Palatin2014-10-283-69/+111
| | | | | | | | | | | | | | | | | | Update the sniffer code to sample both CC lines at the same time. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:28337 TEST=make BOARD=twinkie do an on a sample pattern from the function generator on both channels and verify that the waveform looks good. Change-Id: I30c607591775531e432e757f61209733804b55e5 Reviewed-on: https://chromium-review.googlesource.com/224583 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@google.com> Tested-by: Vincent Palatin <vpalatin@google.com>
* stm32f0: stm32f3: Wake from STOP mode on UART start bitVic Yang2014-10-283-4/+20
| | | | | | | | | | | | | | | | | | | | | | | | By default, UART wakes the chip up on RXNE interrupt. This means when the chip wakes up, RDR is full and only the shift register is empty, and this leaves us only the time of a single character to process the character in RDR. On some system, this is not enough and the first (or even the second) character is overrun, and thus any multi-character keys (e.g. arrow keys) break. To avoid this problem, let's change the wake source to wake on start bit detection. This gives us the time for one more character to wake up and process the console input. BRANCH=None BUG=chrome-os-partner:33219 TEST=Enable low power mode on Ryu P2. In STOP mode, hit up arrow key and see the last command show up. Change-Id: Idce4c0bdfcf3e04ad84152ba525f704a0909f115 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225771 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@google.com>
* samus: use resulting current limit from charge managerAlec Berg2014-10-283-72/+77
| | | | | | | | | | | | | | | | | Send the current limit chosen by charge manager to the EC so that it can set the current limit appropriately. Note, before this change, only the PD negotiated current limit was sent to EC. BUG=none BRANCH=samus TEST=use a non-PD type-C charger and verify current limit gets set appropriately on EC. Change-Id: Ic4bfce052ec8150cad07d35e2cb2fcbfd3d3e6c8 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225667 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* usb_pd_protocol: Don't prematurely set PD charge supplier limitShawn Nematbakhsh2014-10-281-22/+14
| | | | | | | | | | | | | | | Wait until we have a confirmed PD charger before setting the PD charge limit to non-zero. BUG=None TEST=Manual on samus_pd. Insert type C non-PD charger, verify that current limit is correctly set to to 3000 mA. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ib4ec663d926e6ed955427e4a77123caac0e20252 Reviewed-on: https://chromium-review.googlesource.com/225691 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charge_manager: Move supplier list and priority hierarchy to boardShawn Nematbakhsh2014-10-265-25/+41
| | | | | | | | | | | | | | | | Allow the list of charge suppliers and port selection priority to be specified at the board level. BUG=chrome-os-partner:32650 TEST=Manual on samus_pd. Plug + unplug PD and BC1.2 chargers, verify that PD is always preferred and higher power port / supplier is always selected. BRANCH=Samus Change-Id: Ic867a40120c809111bf76bf290ed6f204eab1168 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225292 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: for DP mode, only enter mode if device is DFP_U capableAlec Berg2014-10-254-6/+20
| | | | | | | | | | | | | | | | | | Added return parameter to enter mode functions. For DP mode on samus and fruitpie, only send enter mode if device is a DP sink (DFP_U). BUG=none BRANCH=samus TEST=make buildall. tested a simpler version of this with a third-party DFP_D capable device and verified we don't send enter mode. Change-Id: I5caf008b7b3711232aeb1a1012cde2022584109b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225288 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: make transition out of hard reset shorterAlec Berg2014-10-251-0/+1
| | | | | | | | | | | | | | | | | Shorten the hard reset timeout so that we transition out of hard reset state faster. BUG=none BRANCH=samus TEST=test on third-party product that sends source cap very soon after we send hard reset. without this patch we weren't responding to the first few source caps, with this change we respond right away. Change-Id: I285aaf0296604da22438e31bc962629701694b7b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225247 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add initial support for jerryKatie Roberts-Hoffman2014-10-259-0/+449
| | | | | | | | | | | BUG=chrome-os-partner:33269 TEST=make BOARD=jerry; ./util/flash_ec BOARD=jerry (on a pinky rev2 as a sanity) Change-Id: I2c54e4044a65a0014adb32dd46f74bf5ed11b02d Signed-off-by: Katie Roberts-Hoffman <katierh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225300 Reviewed-by: Alexandru Stan <amstan@chromium.org>
* pd: Add DFP parsing for alternate mode status & attention.Todd Broch2014-10-257-63/+171
| | | | | | | | | | | | | | | | | | | | | Once alternate mode is entered the DFP will make an initial status request to the UFP. Future status changes on the UFP are then sent to the DFP via the attention command. This VDM consists of the VDM header plus another VDO containing mode specific information. CL adds ability of DFP to consume the attention VDMs status message and in the case of DisplayPort SID toggle the necessary HPD gpio accordingly. BRANCH=samus BUG=chrome-os-partner:30645 TEST=manual, for DFP w/ HPD over CC see HPD toggle correctly without manually driving it providing cable connected when AMA is inserted. Change-Id: Ifef60b5d0170cbcc1b518e3b13e84bac99a17e32 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224769 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Wait for UART Tx to complete before entering STOP modeVic Yang2014-10-241-1/+20
| | | | | | | | | | | | | | | | | | | | | | | Before entering STOP mode, we need to ensure UART Tx has completed. Otherwise, we may lose some characters or some bits within a character. For Tx DMA mode, this is already done as we wait until TC (Tx complete) is set before disabling Tx. However, when not using DMA, we enable sleep when TXE is set. At this moment, the last character is still in the shift register and going into sleep causes loss of the whole or part of the last character. To avoid this, let's enable TC interrupt and enable sleep only if we have no more characters to send and TC is set. BRANCH=None BUG=chrome-os-partner:33219 TEST=Enable low power mode on Ryu P2. Type when the EC is in STOP mode and check there is no broken character. Change-Id: Ife42671882b7f1d1d17734d7d20fb4ba7dffb371 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225283 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ryu: Enable watchdog helper for P2 boardsVic Yang2014-10-241-1/+2
| | | | | | | | | | | | | | We have several unused timer. Let's use TIM19 for watchdog helper. BRANCH=None BUG=chrome-os-partner:32660 TEST='waitms 3000' and see debug message. Change-Id: I638a4de7d2729ffb10cb5cf2b3fb9c458dd588a5 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225254 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* stm32: Add watchdog debug message for hwtimer32Vic Yang2014-10-241-0/+77
| | | | | | | | | | | | | | | | This adds the option to use one 16-bit timer for watchdog helper when using 32-bit hwtimer. With this, a debug message is dumped before watchdog fires and we can easily see the task hogging the processor. BRANCH=None BUG=None TEST=On Ryu P2, 'waitms 3000' and see debug message before the EC reboots. Change-Id: I498f63a105a0ba1ab7ec7d274dc8b1f16a44140f Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225253 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: update DP pin configuration declarationVincent Palatin2014-10-242-4/+4
| | | | | | | | | | | | | | | | | | | | | | When we are a UFP with a plug, for the supported DisplayPort pinout, we need to state which DFP pin configuration we support. Update the field used for declaring pin configuration in our display dongles. HoHo is a protocol converter : update the pin assignment to C. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:30645 TEST=none Change-Id: Ie5484f228bd39666c6b01055bd11f68eb9acad88 Reviewed-on: https://chromium-review.googlesource.com/225231 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* pd: update DP mode signaling bitsVincent Palatin2014-10-245-14/+15
| | | | | | | | | | | | | | | | | | | | | A USB type-C to DisplayPort dongle can support either DPv1.3 or USB Gen 2 signaling. Our dongles need to advertise that they support DPv1.3 and only this. Our DFP needs to request DPv1.3 signaling. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:30645 TEST=Plug a type-C to DP dongle from another vendor to Samus and see a display output. Change-Id: Ie0ac16b675e86f635220a954a2c03442777cc527 Reviewed-on: https://chromium-review.googlesource.com/225250 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* ryu: properly enable UART Rx DMA for P2 boardsVic Yang2014-10-241-0/+1
| | | | | | | | | | | | | | We defined the DMA channel for UART Rx DMA to use, but we didn't actually enable it. BRANCH=None BUG=chrome-os-partner:32660 TEST=Check the console is still responsive Change-Id: I0dcbeeccb3a4213305c84ec5238e6e9dbee09b33 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225280 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Fix UART Rx DMA for USART2 and aboveVic Yang2014-10-241-1/+1
| | | | | | | | | | | | | | This modifies the stray hard-coded DMA channel for UART Rx to the correct config flag. BRANCH=None BUG=chrome-os-partner:32660 TEST=On Ryu, enable UART Rx DMA and check console is still responsive Change-Id: Icec2de6ad4d34c6e0f8df2a1d51d9fefd982c9f4 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225239 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* MKBP event signalling implementationVic Yang2014-10-2411-1/+241
| | | | | | | | | | | | | | | | | | | This implements a new API for EC modules to define MKBP event sources and send MKBP event to the AP. Also, a new host command EC_CMD_GET_NEXT_EVENT is added for the AP to query the pending MKBP events. Each event type may have custom event data sent along with the event. BRANCH=None BUG=chrome-os-partner:33194 TEST=Enable MKBP event on Ryu. Set a host event from EC console, run 'ectool nextevent', and see MKBP event 0x01 (HOST_EVENT) and the set host event. Signed-off-by: Vic Yang <victoryang@chromium.org> Change-Id: I28a1b7e826bcc102bbe39016c9bb3e37d125664c Reviewed-on: https://chromium-review.googlesource.com/224905 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* EC: Ensure the udelay function waits at least the time indicated.Kenji Chen2014-10-231-1/+1
| | | | | | | | | | | | | | | | | | | | Udelay function might get delay less than the time indicated by the input parameter. udelay(4) sometimes get the tick like, 6->7->7-> 8->8->9->A and then the udelay return. But, the sampling point of 6 could be at the end of 6(close to 7) and the point of A could be right at the beginning of A(close to A). This function could get delay from (us - 1) to (us + 1). This change is to ensure the delay at least over the parameter, us. BRANCH=master BUG=None TEST=Build an EC FW iamge and run on Rambi to ensure at the time duration indicated by the parameter is elaspsed and satisfied. Signed-off-by: Kenji Chen <kenji.chen@intel.com> Change-Id: I797f80c577d7e29e75a304aec1e02d2c750f8a23 Reviewed-on: https://chromium-review.googlesource.com/224660 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Mohammed Habibulla <moch@chromium.org>
* ryu: Enable pull-up on console UART Tx/Rx pinsVic Yang2014-10-232-13/+13
| | | | | | | | | | | | | | | | There is no external pull-up on UART signals and this could lead to garbage characters received. Let's enable the internal pull-up to avoid this. BRANCH=None BUG=None TEST=On a Ryu board with which UART Rx gets garbage when servo is not connected, check that we don't get garbage characters anymore. Change-Id: I014b399dfecc1b8495cce7c80c481c3668976084 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225095 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* flash_ec: Add support for kittyKen Chang2014-10-231-2/+3
| | | | | | | | | | | | | | Make board kitty to use flash_stm32. BUG=chrome-os-partner:33035 BRANCH=None TEST=Run util/flash_ec on kitty, verify flashing complete successfully. Change-Id: I302cfc85bfe5fa36fdf1a61d59b4dc21b36cc06a Signed-off-by: Ken Chang <kenc@nvidia.com> Reviewed-on: https://chromium-review.googlesource.com/224231 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* plankton: Fix output voltage selectionVic Yang2014-10-231-2/+2
| | | | | | | | | | | | | | We updated the source PDO indices and we also need to update the output voltage selection function. BRANCH=None BUG=chrome-os-partner:33133 TEST=On Plankton, output 5V and measure with INA. Change-Id: I771c04cf929a8e473cf09ae3eb222518f042600a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225154 Reviewed-by: Pin-chih Lin <johnylin@chromium.org>
* stm32f3: Use the correct RTC ALARM IRQVic Yang2014-10-232-2/+3
| | | | | | | | | | | | | | | | | | | | On STM32F0, a single IRQ is used for all RTC events, including RTC_ALARM and RTC_WAKEUP, and this IRQ is named RTC_WAKEUP. We use RTC_WAKEUP IRQ in our code while we actually meant to capture RTC alarm event. On STM32F3, RTC_WAKEUP and RTC_ALARM are separate IRQs and thus we're having problem. Let's make it explicit which RTC IRQ we want to use and fix our code to use RTC_ALARM. BRANCH=None BUG=chrome-os-partner:33219 TEST=Run 'rtc_alarm' on Ryu and verify the EC gets interrupted after a second. Change-Id: Ib1a14a5da49d709a4d071d44fbfa46544cc5929b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/224998 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ryu: Implement battery cut-offVic Yang2014-10-238-46/+80
| | | | | | | | | | | | | | The battery cut-off is achieved by putting BQ27742 in SHUTDOWN mode. BRANCH=None BUG=None TEST=Unplug AC and do 'cutoff' in EC console. The EC console goes unresponsive. Change-Id: I4a1aa359d79333d47aaf53b685a52960e5dfd652 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225007 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>