summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Clear OWNERS for factory/firmware branchfactory-whirlwind-6509.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/+/3155124 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* Stop mutex_lock() from eating pending eventsBill Richardson2014-11-224-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When another task is holding the lock, mutex_lock() should call task_wait_event_mask() to wait only for TASK_EVENT_MUTEX events. If it calls task_wait_event(), any pending events are silently discarded while its waiting for the the lock. BUG=chromium:435611 BRANCH=ToT,samus TEST=make buildall -j, and: Before this change, I watched the EC console while shutting down and rebooting Samus. I saw the request event arrive: [37.576295 LB lightbar_resume() requests 5 S3S0] [46.055725 LB_version] But the lightbar task never saw it. Adding a bunch of debug messages showed that it was being lost in mutex_lock(). After this change, the event is delivered: [30.167670 LB lightbar_resume() requests 5 S3S0] [30.171009 LB cur_seq 2 S3 returned pending msg 5 S3S0] [30.173816 LB running cur_seq 5 S3S0. prev_seq 2 S3] [32.410073 LB cur_seq 5 S3S0 returned value 0] [32.410865 LB running cur_seq 3 S0. prev_seq 2 S3] [39.938388 LB_version] Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I011838538960cc57171f0a3c4cdee113d156e9ff Reviewed-on: https://chromium-review.googlesource.com/231370 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: add active charge port to EC<->PD status exchangeAlec Berg2014-11-222-1/+3
| | | | | | | | | | | | | | | | Add active charge port for the PD status exchange so that EC knows which port we are currently charging from. BUG=chromo-os-partner:32227 BRANCH=samus TEST=load onto samus. use "pdcmd 0x100 0 0" from EC console to read the active charge port and verify that it matches which port we are charging from. Change-Id: I419befef8f0a14ca2da237be1a4944fd08733b83 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231349 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* pd: restore CC resistor if fail power swapAlec Berg2014-11-221-3/+20
| | | | | | | | | | | | | | | | | | | Fix bug where if a power swap fails in the final stages, it will have switched its CC resistor, but will not have actually switched roles, which causes all sorts of weirdness. BUG=none BRANCH=samus TEST=make buildall. tested power swap between two samus'. modified one samus to never send PS_RDY when in PD_STATE_SNK_SWAP_COMPLETE, and verified that when source asks for power swap and fails, that it properly resets CC to pull-up. Change-Id: If0fc8d3d51ede3be1160ae3b106061edabeaa948 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231193 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* pd: change timeout for exiting sink hard reset recoveryAlec Berg2014-11-221-1/+3
| | | | | | | | | | | | | | | | In sink hard reset recovery, when VBUS finally goes high, go to SNK_DISCOVERY quickly so that we can set our SINK_WAIT_CAP timer. BUG=none BRANCH=samus TEST=tested with zinger. when samus sends hard reset, it goes to SNK_DISCOVERY quickly after VBUS goes high. Change-Id: Ie5b3ed95ea9e0c405861be71bd694b057de289d0 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231397 Reviewed-by: Vincent Palatin <vpalatin@google.com>
* samus_pd: remove host event commands module to save flash spaceAlec Berg2014-11-224-3/+14
| | | | | | | | | | | | | | | | Remove host_event_commands.c from build to save flash space. The PD MCU does not use host event infrastructure and instead has a simple gpio line it uses to notify EC that it has info to share. BUG=none BRANCH=samus TEST=make buildall. view the .map file and see we save about 700 bytes of flash. Change-Id: I71b8a4e32b9ecb57eb1a57f6d28652476ee6afe6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231444 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* zinger: change product type to undefinedAlec Berg2014-11-222-13/+2
| | | | | | | | | | | | | | | | | | | | | Change zinger/minimuffin product type from AMA to undefined. BUG=none BRANCH=samus TEST=make buildall. load onto zinger, plug in samus, see: SVDM/4 [1] ff008041 040018d1 00000000 50120001 [19.163111 DONE] Verify ID header, 2nd word, bits 27-29 are product type, where 0 is undefined. Also verify that product VDO is present, 4th word. Change-Id: I34a70d9356b5a8ee7ad64a4e8f072d7748aa916e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231172 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* plankton: remove dualrole power capable flagAlec Berg2014-11-221-2/+1
| | | | | | | | | | | | | | | Remove dualrole power capable flag from source/sink cap packets so that samus/ryu default to drawing power from plankton. BUG=none BRANCH=samus TEST=load on plankton. select 20V to DUT, attach samus or ryu and see that it charges Change-Id: I3d31b14f65ee8dfa4d817d47598c505b0f6d7479 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/231342 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org>
* ryu: Remove workaround for PI3USB9281Vic Yang2014-11-212-9/+1
| | | | | | | | | | | | | | For P3, we'll use PI3USB9281A, which fixes the I2C clock problem. Let's remove the workaround and leave the clock enabled all the time. BRANCH=Ryu BUG=chrome-os-partner:31526 TEST=Boot on Ryu Signed-off-by: Vic Yang <victoryang@chromium.org> Change-Id: I05a3ebbff82282b69e3c5573608e500a34d370c0 Reviewed-on: https://chromium-review.googlesource.com/231180 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Improve EC console messages for lightbar stuffBill Richardson2014-11-212-13/+16
| | | | | | | | | | | | | | I need more information to find the source of some problems. This just adds a little more context to the lightbar console messages. BUG=chrome-os-partner:33401 BRANCH=ToT,samus TEST=make buildall -j Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I97a210754833c9384eae517f9df2e97d3a9ea6b4 Reviewed-on: https://chromium-review.googlesource.com/231136 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* pd: on hard reset go to a hard reset recovery stateAlec Berg2014-11-212-46/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Added new hard reset recovery states for sink and source state machines and transition there on hard reset. This is necessary because on a hard reset we are not supposed to turn off vconn, nor disconnect USB, nor switch the data role. In other words hard reset is not the same as a disconnect. This also changes timing around when to send source cap after a hard reset and when to expect source cap after hard reset. This also adds a delay between sending hard reset and executing it to give time for sink to recognize the hard reset as differentiated from a disconnect when VBUS goes down. For sink, when a hard reset is issued or received, sink waits for VBUS to go away, then for VBUS to come back, and then starts the sink wait cap timer. BUG=none BRANCH=samus TEST=make buildall Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: Icb6ceaf242cebfcf8d08d7317976f83286a256ff Reviewed-on: https://chromium-review.googlesource.com/228111 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: dynamically adjust current limit based on CC pull-upAlec Berg2014-11-211-6/+30
| | | | | | | | | | | | | | | | | Without a PD contract, regularly monitor CC line voltage to determine if CC pull-up has changed its current advertisement. BUG=chrome-os-partner:33682 BRANCH=samus TEST=test with donette prototype: plug in one donette port to a samus, see it set current limit to 3A, then plug in another port to a different samus and see the first samus lower the current limit to 1.5A. Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: I965ab5fde7a67025f3f7ea34eb86fa35187080a6 Reviewed-on: https://chromium-review.googlesource.com/230594 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org>
* pd: if our request is rejected, go to SNK_READYAlec Berg2014-11-213-74/+78
| | | | | | | | | | | | | | | | | | | | | | | | | If our request is rejected, go to SNK_READY, but don't set explicit contract flag. This also changes charge manager slightly to avoid new power request loops. A new power request is only requested if the charge port changes, or if the active charge port changes its voltage/current offering. A new power request does not occur if the current ceiling changes, since the existing contract still suffices. BUG=chrome-os-partner:33692, chrome-os-partner:28332 BRANCH=samus TEST=make buildall. use samus and make sure we negotiate for 20V as normal. modify zinger to send a REJECT and make sure we go from PD_STATE_SNK_REQUESTED to PD_STATE_SNK_READY and explicit contract bit is 0. Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: Iec02663364dcdc4aa66c681ec08911db7424abbc Reviewed-on: https://chromium-review.googlesource.com/230522 Reviewed-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: implement SenderResponseTimer on request messagesAlec Berg2014-11-211-4/+13
| | | | | | | | | | | | | | | | | Add tSenderResponse timeout to waiting for response from a request message. If timeout triggers, send hard reset. BUG=chrome-os-partner:33687 BRANCH=samus TEST=test with zinger that we can negotiate normally. then modify zinger code to not send any response when it receives a request and see that samus sends hard reset from PD_STATE_SNK_REQUESTED. Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: If147d809cfe185ec714e292a4814fbbfb50af04b Reviewed-on: https://chromium-review.googlesource.com/230521 Reviewed-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: add explicit contract flagAlec Berg2014-11-211-12/+32
| | | | | | | | | | | | | | | | | | Add flag for whether or not a type-C port is in an explicit contract. This flag will be used in the future to determine if VDMs can be sent. BUG=chrome-os-partner:33861 BRANCH=samus TEST=load onto samus. plug in to zinger, use pd 1 state to verify explicit contract bit is set. plug in to another samus, issue a power swap, see contract bit go away and come back when contract is established. Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: I9404e7cc920ebe0b37d9efae758436cc6aa7be85 Reviewed-on: https://chromium-review.googlesource.com/230520 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* stm32f0: fix setting GPIO in push-pull modeVincent Palatin2014-11-211-0/+2
| | | | | | | | | | | | | | | | | | | | | When using gpio_set_flags_by_mask() to modify a GPIO pin setting, the former code was not able to revert an open-drain GPIO into push-pull mode (the other way round was working). Fix it to be able to transition in each direction. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=all BUG=none TEST=on Twinkie, run "tw res none RP3A0" then "adc" and see the RP3A0 GPIO set to 1 and pulling the CC to 3.3V. Change-Id: Ic2d8ed95ea21b21d261a12ba298931d8bd5e6919 Reviewed-on: https://chromium-review.googlesource.com/231150 Reviewed-by: Vic Yang <victoryang@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* pd: wait tSnkTransition after ACCEPT to change voltageVincent Palatin2014-11-2113-36/+101
| | | | | | | | | | | | | | | | | | | Ensure that the PD source changes the output voltage after tSnkTransition delay after having sent the ACCEPT message (rather than before). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:33684 TEST=connect Zinger to a PD power sink and monitor VBUS and CC while doing a 20V to 5V transition. Change-Id: If86f59eec67630491f4e8dc13a52015ac2de918a Reviewed-on: https://chromium-review.googlesource.com/230805 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Fix errors discovered by new compiler.Bill Richardson2014-11-213-24/+1
| | | | | | | | | | | | | | The latest gcc picked up a couple out-of-bounds issues, so "make buildall" was failing. This fixes them. BUG=none BRANCH=ToT TEST=make buildall -j Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: Idcd6a3358ecbb0e0d2a610e1cd28c2f138ce520b Reviewed-on: https://chromium-review.googlesource.com/231156 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* cr50: update for 11/20 hardware releaseVincent Palatin2014-11-213-645/+673
| | | | | | | | | | | | | | | | | | The clock frequency has been update from 26 to 30 Mhz. Update the register definitions. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make BOARD=cr50 load the software and see the console working. Change-Id: I7ccb15491f582173d17739c93ea8c94b05925a6d Reviewed-on: https://chromium-review.googlesource.com/231129 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* cr50: always generate the .hex fileVincent Palatin2014-11-211-0/+3
| | | | | | | | | | | | | | | | | Extends the default rule to generate the .hex file as we need it on this platform. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST="make BOARD=cr50" and see the .hex file is generated. Change-Id: I9dea886f0d54d840767bae2c344114c3a4c143a5 Reviewed-on: https://chromium-review.googlesource.com/231128 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* stm32: Do not wait for USB host if USB is disabledVic Yang2014-11-213-0/+11
| | | | | | | | | | | | | | | | | | For USB console, we wait for USB host to grab the data before writing the next chunk of characters. However, if the USB peripheral is disabled, the current implementation is confused as to whether the host has grabbed the previous chunk of data. Fix this by explicitly checking for USB peripheral enabled. BRANCH=ryu BUG=None TEST=Boot on Ryu and check console isn't slow. Signed-off-by: Vic Yang <victoryang@chromium.org> Change-Id: I438c95835e56707b7ca1796734f2e47062799f44 Reviewed-on: https://chromium-review.googlesource.com/231115 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* usb: extend console buffer to 64 bytesVincent Palatin2014-11-211-1/+1
| | | | | | | | | | | | | | | | | Set the console receive buffer size to 64 bytes into to be able to send a full command line at once (e.g. cut'n paste). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=cut'n paste a large command on the EC USB console. Change-Id: Ifd4ae95082d1f05cb1d53efb9f599a783f074000 Reviewed-on: https://chromium-review.googlesource.com/229980 Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Strago: Spi support added on Private SPI linesDivya Jyothi2014-11-204-11/+35
| | | | | | | | | | | | | BUG=None TEST=Tested on Braswell Reference Design BRANCH=None Change-Id: Idc064e1af837e5e6a1bf4174885bd10624f463d2 Signed-off-by: Divya Jyothi <divya.jyothi@intel.com> Reviewed-on: https://chromium-review.googlesource.com/226297 Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Divya Jyothi <zdivyajyothi@gmail.com> Tested-by: Divya Jyothi <zdivyajyothi@gmail.com>
* plankton: reset USB hub on cable plugVic Yang2014-11-203-0/+22
| | | | | | | | | | | | | | | If USB hub is connected to the type-C port, we need to reset the hub whenever a cable plugs in. Otherwise, USB3.0 may fail to enumerate. BRANCH=None BUG=None TEST=Plug/unplug cable and measure hub reset signal. Change-Id: I60f67c83653d532971ee156914fe6ae0ecdb8d3a Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229490 Reviewed-by: Pin-chih Lin <johnylin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* ec: Add lds dependencies to the dependency list.Gwendal Grignou2014-11-201-0/+1
| | | | | | | | | | | | | | | | With this change, when we modify some config file related to space, the lds is recompiled properly. TEST=Check that when chip/stm32/configXX.h is modified, ec.RO.lds is recompiled. BRANCH=ToT BUG=None Change-Id: I0a49065e59f00dd37d945d9593126ab9fd1598b5 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230908 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add initial mighty supportKatie Roberts-Hoffman2014-11-209-0/+465
| | | | | | | | | | | | | Essentially a copy of jerry for now. BUG=chrome-os-partner:33269 TEST=make BOARD=jerry Change-Id: I696919455f4752ebe43b616bdace6ac0820f8fe5 Reviewed-on: https://chromium-review.googlesource.com/230917 Reviewed-by: Alexandru Stan <amstan@chromium.org> Commit-Queue: Katie Roberts-Hoffman <katierh@chromium.org> Tested-by: Katie Roberts-Hoffman <katierh@chromium.org>
* charge_manager: Add PD_CHARGE_PORT_OVERRIDE host commandShawn Nematbakhsh2014-11-205-9/+89
| | | | | | | | | | | | | | | | | | | Add host command to set charge port override. BUG=chrome-os-partner:32003 BRANCH=Samus TEST=Manual on Samus. Insert PD charger in port1 and BC1.2 charger in port0. ./ectool --name=cros_pd chargeoverride 0 --> Charges from port 0 ./ectool --name=cros_pd chargeoverride off --> Charges from port 1 ./ectool --name=cros_pd chargeoverride dontcharge --> No charge port ./ectool --name=cros_pd chargeoverride 1 --> Charges from port 1 ./ectool --name=cros_pd chargeoverride 2 --> Correctly returns error Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ib35f797a4a24e96fd2e3c008ace3fd6291b89d25 Reviewed-on: https://chromium-review.googlesource.com/230910 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: fix negative timeout for waiting taskBernard Shyu2014-11-191-6/+8
| | | | | | | | | | | | | | | | | | pd[port].timeout will be 0 immediate after set_state(), thus will cause a negative value result for timeout calculation in the pd_task's ending loop. This will cause task_wait_event to receive a negative timeout value. Obviously it causes no harm to the current implementation, but should be fixed by being paranoid. BUG=none BRANCH=none TEST=make buildall Change-Id: Ib2817e1d95ca6c6eedcaff16a9e7e95033953901 Reviewed-on: https://chromium-review.googlesource.com/229760 Commit-Queue: Bernard Shyu <bernard_shyu@bizlinktech.com> Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Bernard Shyu <bernard_shyu@bizlinktech.com>
* usb_pd: SVDM DP protocol definition errorsBernard Shyu2014-11-193-5/+21
| | | | | | | | | | | | | | | | | | | | The role of hoho & dingdong is UFP, and the corresponding protocol fields in VDO (vdo_idh) should reflect it. Fix error in IDH_PTYPE definitions of SVDM Identity Header, it's reversed Adds more legible names to protocol field constants BUG=none BRANCH=none TEST=make buildall Change-Id: Idac9327bf3e8e9597221654bce80bb311b3304af Reviewed-on: https://chromium-review.googlesource.com/230657 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Bernard Shyu <bernard_shyu@bizlinktech.com> Tested-by: Bernard Shyu <bernard_shyu@bizlinktech.com>
* samus: add backboost detect GPIOAlec Berg2014-11-191-0/+1
| | | | | | | | | | | | | Add backboost detect GPIO. Don't do anything with it for now. BUG=none BRANCH=samus TEST=make buildall Change-Id: If688b5e719071650fa295f288b97915a81af2d87 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230247 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* Cr50: Update/refactor for new HW releaseBill Richardson2014-11-187-380/+18131
| | | | | | | | | | | | | | | | | | | | | | | This is fairly large change set to accomodate a new hardware release. There are enough differences to require refactoring the registers.h file. Autogenerated constants are now in gc_regdefs.h and all constant names begin with GC_, while register names are defined in registers.h and begin with GR_. Yes, I know the new header files are wider than 80 chars, but we agreed that was okay in some cases if it makes them more readable (see commit 3500c28). BUG=chrome-os-partner:33423 BRANCH=none TEST=make buildall -j Build and run on the development board. Change-Id: I21bd88c490f4f359ad17b5af9d17d8caca8dc9e4 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/230513 Reviewed-by: Sheng-liang Song <ssl@chromium.org>
* Twinkie: add packet injection capabilityVincent Palatin2014-11-1811-14/+683
| | | | | | | | | | | | | | | | | | | | | | | Add commands to send PD packets and to tweak individual parameters (TX clock frequency, RX detection threshold, resistors on CCx). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:28337 TEST=verify that the PD sniffing is still working by dumping traffic between Zinger and Samus. Connect Twinkie to Zinger, set Rd by using "tw res NONE RD" and see VBUS going to 5V (reading it using "ina 0"). Send a BIST mode 2 request using the following command : tw send 2 0x1043 50000000 and see the other end starting sending BIST. Change-Id: I3c8ddf858435ac1c17a43f59351bbaa69603a209 Reviewed-on: https://chromium-review.googlesource.com/227778 Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* zinger: optimize idle currentVincent Palatin2014-11-181-0/+16
| | | | | | | | | | | | | | | | | | | | | | Force enabling STOP mode when we have a power contract etablished but the sink is consuming a low current (<500mA). As a side effect, when the STOP mode is on, the fast OCP is no longer reacting fast because the analog watchdog ADC conversion will only happen on the next wake-up (dozens of milliseconds). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=none TEST=run on Zinger with the UART RX used as debug GPIO to record STOP mode entry/exit. Change-Id: If78b2651862782cee45cfcdb22425b94f1eee678 Reviewed-on: https://chromium-review.googlesource.com/230341 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>
* Zinger: honor disable_sleep()Vincent Palatin2014-11-183-2/+6
| | | | | | | | | | | | | | | | | | | Extend the Zinger runtime to take into account the disable_sleep() issued by the USB protocol stack and avoid going into deep-sleep while connected. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=none TEST=connect Zinger to a PD power sink (Twinkie) and monitor the stop mode entry/exit on a GPIO. Change-Id: I04e35fdd65f3be3da7a4304dc1a92e6268930888 Reviewed-on: https://chromium-review.googlesource.com/230340 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* samus: enable bq learn mode to avoid backboostingAlec Berg2014-11-181-1/+18
| | | | | | | | | | | | | | | For samus, use learn mode on BQ24773 to avoid the soft start that causes backboosting on some boards. BUG=chrome-os-partner:33644 BRANCH=samus TEST=tested in EE lab on a board that was backboosting reliable. this fixes backboosting at 5V, and also on 20V to 5V transitions. Change-Id: I97c52a55ba07662d444e67bfbc9ca488b530f423 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229282 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* zinger: fix task_wait_event() to only exit on event receivedAlec Berg2014-11-181-27/+45
| | | | | | | | | | | | | | | Fix task_wait_event() so that it only wakes when an event is received or on timeout. Currently it wakes up on any interrupt, which can cause subtle timing issues with PD communication. BUG=none BRANCH=samus TEST=load onto samus, see it negotiate for 20V a few times Change-Id: Ia1268a1ac902433433949269d779ef11403eeae3 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226811 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* ryu: Add LSM6DS0 support.Gwendal Grignou2014-11-183-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add Code to setup LSM6DS0 gyro/accell in sensor hub. BUG=chrome-os-partner:31071 BRANCH=ToT TEST=See the compass and gyro. Message at boot: [0.007142 hash start 0x00010000 0x000096dd] [0.007293 Inits done] [0.007506 power state 2 = S3, in 0x0000] [0.007765 power state 3 = S0, in 0x0000] [0.007908 event set 0x00002000] [0.008021 hostcmd init 0x2000] [0.111195 Accel: MS Done Init type:0x1 range:2 odr:119000] [0.116751 Gyro: MS Done Init type:0x2 range:2000 odr:119000] [0.146870 hash done f87d7824b439db923d270df016af5aabec51b73505b7c4faa6e40c16b12dd392] Check '/usr/sbin/ectool --name=cros_sh motionsense' works. Change-Id: I7ca87faf92803486d8d2d51c7ffe4c6d8c9efef2 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226882 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* ryu: add a dummy power module for controlling sensors.Gwendal Grignou2014-11-189-1/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | With this change we can use power event to configure sensors and trigger motion detection in suspend. BUG=chrome-os-partner:31071 BRANCH=ToT TEST=Check power states. Check power up messages and commands are present at the console. Message at boot: [0.007142 hash start 0x00010000 0x000096dd] [0.007293 Inits done] [0.007506 power state 2 = S3, in 0x0000] [0.007765 power state 3 = S0, in 0x0000] [0.007908 event set 0x00002000] [0.008021 hostcmd init 0x2000] [0.146870 hash done f87d7824b439db923d270df016af5aabec51b73505b7c4faa6e40c16b12dd392] Change-Id: I9c56fe5203506462f0820bbc8a5fe4528f6805ac Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226881 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* motion: Add decoding for MOTION_CMD_DUMP v1 commandGwendal Grignou2014-11-189-296/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MOTIONSENSE_CMD_DUMP is deprecated, replaced with MOTIONSENSE_CMD_GET_DATA Also use vector_3_t instead of x,y,z ectool motionsense commands only work with newer firmware, to handle a dynamic number of sensors. - The host sends the number of sensor it has allocated space for. - If 0, the EC just sends the number of sensors available - Otherwise returns sensor information up to the limit imposed by the host. Remove MOTIONSENSE_GET_STATUS: not needed. It is only useful for LPC, to guarantee atomicity of the data. Remove MOTIONSENSE_GET_DATA: not needed since we increase the version number of MOTIONSENSE command. BUG=chrome-os-partner:31071,chromium:430792 BRANCH=ToT TEST=Compile. On a firmware that support the new command: /usr/sbin/ectool --name=cros_sh motionsense Motion sensing active Sensor 0: 92 15 1030 Sensor 1: -94 -63 718 /usr/sbin/ectool --name=cros_sh motionsense active 0 On a machine with older firmware (samus), check these functions are not working anymore. Change-Id: I64b62afff96670fb93457760d43d4e64e26e029f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226880 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* lid_switch: Support forced lid openHenry Hsu2014-11-183-1/+56
| | | | | | | | | | | | | | | | | | | Factory test process need lid switch no function or keep lid opened BUG=chrome-os-partner:33304 BRANCH=paine,yuna TEST=Run command "ectool forcelidopen 1" and "reboot". Then lid close quickly, the system boot as lid opened. Deault value or run command "ectool forcelidopen 0" make the device normal. Change-Id: I94527b7ef7f9efe779c6b86f3eab651f99af6000 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/230180 Reviewed-by: Mohammed Habibulla <moch@chromium.org> Reviewed-by: Bowgo Tsai <bowgotsai@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org> Tested-by: Shawn Nematbakhsh <shawnn@chromium.org>
* pd: fix alignment issue for print rwhashtable.Todd Broch2014-11-173-13/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | struct ec_params_usb_pd_rw_hash_entry is packed so addressing rw_hash array caused alignment faults. CL removes union in favor of just shipping bytes across the host command. BRANCH=samus BUG=none TEST=manual from DUT ectool --name cros_pd infopddev 0 Port:0 Device:1025 Hash: 0xa90a5d48 0xcc2af4ea 0xc7796d08 0x4a8f9e8e 0x0ba7578b ectool --name cros_pd rwhashpd 1025 0xa90a5d48 0xcc2af4ea 0xc7796d08 0x4a8f9e8e 0x0ba7578b from PD MCU console, pd rwhashtable # no exception due to memory read alignment and ... Device:0x0401 Hash: 0xa90a5d48 0xcc2af4ea 0xc7796d08 0x4a8f9e8e 0x0ba7578b Device:0x0000 Hash: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 Device:0x0000 Hash: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 Device:0x0000 Hash: 0x00000000 0x00000000 0x00000000 0x00000000 0x00000000 Change-Id: I134a5402eac3e5159441ce6c483633ca0d575a03 Signed-off-by: Todd Broch <tbroch@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/226890 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charge_manager: Don't charge from dual-role capable portsShawn Nematbakhsh2014-11-172-2/+121
| | | | | | | | | | | | | | | Don't charge from dual-role capable ports, unless an override is set to force charge. Also, if an override is set to charge from a dual-role capable port and a dedicated charger is attached, remove the override. BUG=chrome-os-partner:32003 TEST=Pass unit tests BRANCH=Samus Change-Id: I4e81e39a9f6ba325fa8a5e8f0d77fd5bfc7a672c Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229465 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* util: Fix return value of ec_commandGwendal Grignou2014-11-173-6/+6
| | | | | | | | | | | | | | | | | | | | When ec_command fails because of transport issue, it should returns an error between -1 and -EECRESULT. If the command fails because of the EC, the error should be less than -EECRESULT. Unify all transports to return the error in the same manner. BRANCH=ToT BUG=None TEST=Samus: Check that unsupported command fails with the correct error number over dev transport. Qwarks: Check the same command with a 3.10 kernel (no dev transport, just LPC) fails with the same error code. Change-Id: I2e43d0cb003d75318b0edd3745e534c700d7d7d8 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/228295 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Jerry: modify the power led polarityChris Zhong2014-11-171-1/+1
| | | | | | | | | | | | | | | | the power led polarity is wrong, so reverse it BRANCH=None BUG=chrome-os-partner:33269 chrome-os-partner:32782 TEST=power led is works correctly Change-Id: I4e91ea185ee5cb1f5b5202832a967244313062b4 Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/230170 Reviewed-by: Lin Huang <hl@rock-chips.com> Tested-by: Lin Huang <hl@rock-chips.com> Reviewed-by: Wei-Ning Huang <wnhuang@chromium.org> Commit-Queue: Lin Huang <hl@rock-chips.com>
* zinger: change minor revision back to 1Alec Berg2014-11-171-1/+1
| | | | | | | | | | | | | | The minor revision was accidentally set back to 0 in CL:229622. Restoring back to 1. BUG=none BRANCH=samus TEST=load onto zinger, make sure minor revision is set to 1 Signed-off-by: Alec Berg <alecaberg@chromium.org> Change-Id: Ia934e4a6f1674f666defe9e4337dee45cd7ab7bd Reviewed-on: https://chromium-review.googlesource.com/229985 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: zinger: add firmware update alternate mode to zingerstabilize-6480.BAlec Berg2014-11-158-56/+226
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a Google Firmware Update alternate mode to zinger. This mode must be entered in order to allow the unstructured VDMs that we use for sending a new firmware. BUG=chrome-os-partner:33754 BRANCH=samus TEST=load on samus and zinger. see that "GFU" is printed on zinger console to represent that it entered GFU mode. use twinkie to see that samus sent discover identity, discover svids, discover modes, enter mode, and then read info. See on samus pd console that we received result of read info. from samus pd console with zinger attached: > pe 1 dump IDENT: [ID Header] 2c0018d1 :: AMA, VID:18d1 [Cert Stat] 00000000 [2] 50100001 [3] 00000003 [4] 52136b91 [5] 0401137d SVID[0]: 18d1 MODES: [1] 00000000 MODE[1]: svid:18d1 caps:00000000 Also, use a samus with cros_pd_update running in kernel, and see that zinger auto-updates when plugged in. Performed 10 updates with no failures. Change-Id: I8d4d38e4a9f649fe0889f688f262630ef55106ee Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229622 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: lower the minimum input current limitAlec Berg2014-11-151-1/+1
| | | | | | | | | | | | | | | | Lower the minimum input current limit on samus by 64mA to 448mA to have the ability to limit input current to something below 500mA. BUG=none BRANCH=samus TEST=load onto samus, and use charger console command to verify input current limit is 448mA. Change-Id: I05bcacce707faddd3addee50356d85281466e146 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229281 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* rsa: add support for 4096 and 8192 bit keysVincent Palatin2014-11-159-21/+102
| | | | | | | | | | | | | | | | | | | | | Allow to use larger RSA keys by setting CONFIG_RSA_KEY_SIZE to 4096 or 8192 rather than using the default 2048-bit size. It's mainly for benchmarking purpose right now as we don't have the RAM to store the 3x key size buffer and the flash space for the public key structure. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=none TEST=build Zinger with CONFIG_RSA_KEY_SIZE equals to 4096 and run it. Change-Id: I9839121bf158d0a30dde1e48d875f345191bfec2 Reviewed-on: https://chromium-review.googlesource.com/228925 Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* pd: allow policy layer to ask for PR/DR_swap on new contractAlec Berg2014-11-1514-84/+244
| | | | | | | | | | | | | | | | | Allow policy layer to request a PR or DR swap upon formation of a power contract. Zinger always asks for a data swap so it can be a UFP, and Samus asks for a data swap only if it is a UFP to become a DFP. BUG=chrome-os-partner:33754, chrome-os-partner:31195 BRANCH=samus TEST=load onto samus and zinger and make sure they swap roles upon connect with no collisions Change-Id: I275c9669549c26f25c58f80845daad8edab11313 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229327 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: changes to actions to take on PD disconnectAlec Berg2014-11-151-17/+20
| | | | | | | | | | | | | | | | | | | Changed actions to take on PD disconnect to do all the same actions for source and sink disconnect. With power and data swap commands, there are potential bugs with state variables not getting cleared properly when separated source and sink disconnects are seperated out. Also changed code to only take those actions on PD disconnect whereas before it was also happening on dual role toggle. BUG=none BRANCH=samus TEST=load onto samus, make sure it takes disconnect actions on when zinger is unplugged. Change-Id: I455f4970517477d4ffd38059110521b228282763 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229621 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>