summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfactory-auron-6459.BBrian Norris2021-09-102-10/+1
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155039 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* ectool: Add led battery color for gandofdavid2015-06-112-1/+2
| | | | | | | | | | | | | | | Add led battery color orange for gandof. BRANCH=gandof BUG=chrome-os-partner:40035 TEST=Use "ectool led battery orange" "ectool led power white" to check Change-Id: I6b0442827086b3deeb1ed8fd1d3b143d2e6f651a Reviewed-on: https://chromium-review.googlesource.com/276831 Reviewed-by: Mohammed Habibulla <moch@google.com> Commit-Queue: Ryan Siao <Ryan.Siao@quantatw.com> Tested-by: Ryan Siao <Ryan.Siao@quantatw.com>
* plankton: Update GPIO names and attributes for Plankton v3Vic (Chun-Ju) Yang2014-11-092-12/+16
| | | | | | | | | | | | | | | | | | | | | | Update GPIOs to reflect changes in Plankton v3. The default values are set so that case closed debugging is disabled. Also, rename CABLE_FLIP to MUX_FLIP to match the schematic. (Plus that MUX_FLIP is a more suitable name for what it does.) This change be functionally compatible with Plankton v2, except that the change on PA7 causes a 0.33mA leakage current on Plankton v2, which should not be a problem. BRANCH=None BUG=None TEST=Compile only Change-Id: I50c56a1c583015d3624ec9f5901ed477d07233f4 Signed-off-by: Vic (Chun-Ju) Yang <victoryang@google.com> Reviewed-on: https://chromium-review.googlesource.com/227980 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vic Yang <victoryang@chromium.org> Tested-by: Vic Yang <victoryang@chromium.org>
* math: use CONFIG_FPU when using float.Gwendal Grignou2014-11-094-1/+17
| | | | | | | | | | | | | ifdef code than needs CONFIG_FPU (acos and friends) BRANCH=ToT BUG=chrome-os-partner:32050 TEST=define CONFIG_FPU on host board and use it. Change-Id: I1c4ed16c23450bb4059d26044f4c1fe45b33674e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226414 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Sheng-liang Song <ssl@chromium.org>
* pd: remove redundant 5V source PDOsAlec Berg2014-11-069-12/+3
| | | | | | | | | | | | | | | | Remove redundant 5V source PDOs in source cap packet. We only need one 5V advertisement with the maximum current that we can provide. BUG=none BRANCH=samus TEST=make buildall Change-Id: I94a01813787eb92fafbf600dcbbc8a2f0aa69e2b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227392 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* pd: for non dual-role device, always send reject to PR_SWAPAlec Berg2014-11-061-1/+3
| | | | | | | | | | | | | | For non dual-role devices, always send reject to power swap request, PR_SWAP. BUG=none BRANCH=samus TEST=make buildall Change-Id: I54ce4810cf08a02a1d841308507a0f8de284d987 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227391 Reviewed-by: Todd Broch <tbroch@chromium.org>
* pd: samus: add support for power swap commandAlec Berg2014-11-0614-59/+335
| | | | | | | | | | | | | | | | Add support for PR_SWAP command as per PD specification. BUG=chrome-os-partner:28343 BRANCH=samus TEST=test by connecting two samus' and running 'pd 1 swap power' from console. verified that both sides switch power roles by observing console output. also tested against third party devices. Change-Id: I0e8738b544de9f9a4348250630e67d0fefb4486d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/225559 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: update source/sink cap PDOs and use to get dual role capableAlec Berg2014-11-0611-54/+91
| | | | | | | | | | | | | | | | | | | | | Update source and sink capacity tables for all PD boards. As per spec, the first entry in both tables must be a fixed power supply PDO. Added dual-role capable bit to fixed PDOs and added new state variable to keep track of that information for each port. This will be used to make decisions in charge manager and to pass up via host commands. BUG=chrome-os-partner:28869 BRANCH=samus TEST=make buildall. use "pd 1 status" to check if part partner is dual-role capable and check zinger is not, C to A receptable adapter is not, and another samus is. Change-Id: I49f034a372bc145cd524577c17ca210eec4c1013 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227170 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* Strago: Initial Version of Strago Board added.Divya Jyothi2014-11-0612-22/+607
| | | | | | | | | | | | | | | | | | | Modules that are enabled are listed below: - Power Sequencing - Keyboard Scan and Protocol - LPC to support Keyboard - Power Button Task ec.spi.bin has to be generated manualy using pack_ec.py BUG=None BRANCH=None TEST=Tested on Stargo-Proto board Change-Id: Ic5d504c3d6e9c7c5f3482fb7e9e37800b6274824 Signed-off-by: Divya Jyothi <divya.jyothi@intel.com> Reviewed-on: https://chromium-review.googlesource.com/226303 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Samus: Handle fan startup in the EC, not the fan controllerBill Richardson2014-11-0614-8/+167
| | | | | | | | | | | | | | | | | | | | | | | | | | | The fans on samus have a recommended minimum duty cycle of 20% while running, but 30% in order to start. We've been using the EC's built-in fan controller for the start requirement, but it has a minimum fast-start duty cycle of 50%. It turns out that that speed is noticeably noisy. This change handles the startup with logic in the EC instead, so that the fan only tries to spin at 30% initially (or if it drops too much below the minimum turning speed). BUG=chrome-os-partner:33429 BRANCH=ToT,samus TEST=make buildall -j Boot the system, let it idle with the browser windows closed, the browse a bit, then idle. Listen for changes to the fans. Before, I could hear the fans kick in and out as the AP load changed. Now it's much quieter. Change-Id: Id35215520c064eb6843686ec8bb5f3618dac6cf6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227658 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Re-Calibrated lightbar values for Samus & RyuBill Richardson2014-11-062-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | New values from lab testing with slightly higher intensity. BUG=chrome-os-partner:33017 BRANCH=ToT,samus,ryu TEST=manual ectool lightbar brightness ff ectool lightbar seq s3s0 ectool lightbar Resulting current levels: 15 00 2d 16 2a 0a 17 26 13 18 10 0b 19 10 26 1a 1b 0d Change-Id: I118bf2fda3dee67b27c5d6a5825b7a9a96dc66dd Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227515 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Do not try to wake the battery after battery cut-offVic Yang2014-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | When the battery cut-off command is issued with external power present, the battery can end up in one of the following two states: 1. The battery stays responsive but is waiting for the external power to go away. 2. The battery decides to cut itself off right away. In case 1, we are already avoiding charging the battery again, so we're good. However, in case 2, the charge state machine mistakenly thinks the battery is dead and tries to revive it. Fix this by checking if the battery is cut off before starting to revive it. BRANCH=None BUG=chrome-os-partner:33372 TEST=Cut off the battery with external power connected. Wait for a while and then disconnect external power. Check the battery is sure cut off. Repeat for several times. Change-Id: Icf343b168a556a490bc1786802a8a6e230863a28 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227521 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* ectool: compile LPC and i2C support by default.Gwendal Grignou2014-11-051-3/+2
| | | | | | | | | | | | | | | | Currently, LPC or I2C are compiled based on the board.h. This is not really necessary, code can handle both at the same time. Note that LPC and I2C access mode are backup modes, the main mode is dev (accessing ECs through /dev/cros_XX). BRANCH=None BUG=chromium:408713 TEST=Compile, tested on Ryu and Samus. Change-Id: I8b4730f0f5708c543dc034165e9b53de0e543860 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/227432 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* USB: Remove special case for iVersion string descriptorAnton Staaf2014-11-0411-22/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the version string was special cased in the USB stack because the build system prevented the inclusion of ec_version.h in any file other than common/version.c. This lead to common/version.c being the only place that the USB version string could be computed and thus the special case of filling in the version string descriptor at run time. This made the USB stack more complex, and lead to the common/version.c file including usb.h, which is actually STM32 specific. Now, the portion of ec_version.h that is deterministic is only updated when something in the tree actually changes (by way of a conditional in the makefile), and ec_version.h no longer has to depend on all object files (other than the special version.o). This allows anyone to include ec_version.h as needed. In particular, each board that wants to define a USB version string can directly include ec_version.h and do so. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j touch files and verify rebuilds happen correctly Change-Id: Ic84d0b9da90f82ebb4630fb550ec841071e25a49 Reviewed-on: https://chromium-review.googlesource.com/227211 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* USB: stm32f3: use correct values for USB RAM size and usb_uintAnton Staaf2014-11-042-2/+2
| | | | | | | | | | | | | | | | | | | | The RAM size was copied from the STM32F0 definition which was not correct, and the usb_uint computation was only checking for the STM32F0 family, assuming that all others were the old uint32_t access size. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I28951351601254ea6ebabaec2687d6bfe716b699 Reviewed-on: https://chromium-review.googlesource.com/227210 Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* 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>