summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* samus: add hot keys alt+voldown+0|1|2 to set charging portstabilize-6662.BAlec Berg2015-01-072-0/+57
| | | | | | | | | | | | | | | | | | | | Add hot key detection for alt + volume down + 0|1|2 to set the charging port by sending the charge override command to PD MCU. This should be removed once hot-keys (or some other UI) is added to higher layers. BUG=chrome-os-partner:34850 BRANCH=samus TEST=load onto samus and connect to another samus. use hot keys and see that charge override command gets set appropriately on PD MCU. Change-Id: I7e72d597a02b7aca3326911796d20003f6697077 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238226 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: pd: on PD connection, if sink, ask for power swapAlec Berg2015-01-0713-62/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For samus, on PD connection or on resume to S0, if we are a sink, and the other side supports PR_SWAP, then attempt a power swap. This adds callback functions into board policy file to check and issue power or data swaps if required by the product. BUG=chrome-os-partner:31195 BRANCH=samus TEST=connect samus to zinger and make sure zinger always ends up as SRC-UFP. connect samus to samus with both in S0 and see that they swap power roles once and not data roles. connect one samus in S0 to one samus in S5 and see that the one in S5 is sink. then when you boot the one in S5 it switches to a source. connect samus to samus with both in S0. do chgoverride 1 on one side to start charging from the other samus. then on the same side, turn off the machine (S5) and resume (S0), and see that it is still charging from the other samus (ie has not switched roles to source). Change-Id: Ifab2465fccef77448ac4771a3c2de1c867cbbec4 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238302 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: fix timeouts during power swap and send soft reset on no CRCAlec Berg2015-01-061-19/+60
| | | | | | | | | | | | | | | | | | Change behavior on timeouts during a power swap. If a power swap fails in the final stages, go to disconnected state instead of simply sending a hard reset. When we fail to receive goodCRC to power swap or data swap commands, send a soft reset instead of a hard reset. BUG=chrome-os-partner:34989, chrome-os-partner:34980 BRANCH=samus TEST=make -j buildall Change-Id: I3fa9f1475e42c2754fb7eb15a75bc0b67ed1e2c0 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238301 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: Add NoResponseTimer to disconnect after no responseAlec Berg2015-01-062-17/+49
| | | | | | | | | | | | | | | | | | | | | | Add NoResponseTimer to go to disconnected state after some number of hard resets with the port partner non-responsive. This only takes affect when the port partner is known to be PD capable, i.e. has sent us PD communications in the past. This is useful as a last resort to attempt to restore PD communications with a port partner. BUG=chrome-os-partner:34976 BRANCH=samus TEST=load onto two samus', connect with C to C cable, and let them form a PD contract, then on one side disable PD comms with "pd enable 0" and from the other side initiate some PD traffic, such as "pd 1 soft". See that the side with PD communications enabled sends two hard resets and then goes to disconnected state, then goes to discovery state and acts as if a non-PD capable device is attached. Change-Id: Id40ce7eb05b8b7ae6a4f70b9d08ce6cad0d471fe Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238300 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: Add CONFIG_CMD_TYPEC to optionally remove 'typec' console command.Todd Broch2015-01-062-0/+3
| | | | | | | | | | | | | | | | | | | Create optional config to remove 'typec' command for flash savings. While its a useful command to many developers its not used in any factory flows and costs ~500bytes of flash space. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:34489 TEST=manual, compiles and command still there. If #undef saves ~500bytes. Change-Id: I02c0ec1dd503b02f86d8ac3d5e99ed6ad493c95c Reviewed-on: https://chromium-review.googlesource.com/238462 Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* Add CONFIG_CMD_HASH to optionally remove 'hash' console command.Todd Broch2015-01-065-2/+6
| | | | | | | | | | | | | | | | | | | | | Create optional config to remove 'hash' console command and undef it for a few space-constrained boards (ryu*, samus_pd). Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:34489 TEST=manual, - compile for ryu, samus_pd and save ~400bytes - 'hash' command no longer appears as a console command Change-Id: I054fd4473911dd362c2c1d171ee7aaad859d893a Reviewed-on: https://chromium-review.googlesource.com/238433 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* Support command versioning of new host command rangeVic Yang2015-01-063-4/+18
| | | | | | | | | | | | | | | | | We've extended host command range from 8-bit to 16-bit. Extend EC_CMD_GET_CMD_VERSIONS so that the host may query supported command versions of the new host commands. BRANCH=All BUG=chrome-os-partner:26577 TEST=Extend 'usbpd' to version 1. Test that we can check its version. TEST=Run 'ectool gpioget' with new ectool and old EC. TEST=Run 'ectool gpioget' with old ectool and new EC. Change-Id: I1651aaf21ac2604aea101244b5e53713ead8c1af Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237622 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* lightbar: Pulse lightbar in S5 if power-up is inhibitedShawn Nematbakhsh2015-01-062-4/+79
| | | | | | | | | | | | | | | | Add a lightbar indicator if a charger is attached and we refuse to power-up the AP due to battery level. BUG=chrome-os-partner:31127 TEST=Manual on Samus. Attach charger with depleted battery, verify that lightbar pulses red. Remove charger and verify that lightbar stops pulsing. Also verify the same with missing battery. BRANCH=Samus Change-Id: Icddd543dc34e36ac04957ea07bde0e2d5709f74b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236023 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* lm4: decrease time to wake up from deep sleep to save powerAlec Berg2015-01-061-0/+8
| | | | | | | | | | | | | | | | | | Decrease the time to wake up from deep sleep when not using LFIOSC (when using PIOSC in deep sleep). This helps keep us in deep sleep longer and therefore save power. BUG=none BRANCH=samus TEST=Load onto samus and run for a couple of hours, varying from S0 to S5, with and without EC. Use idlestats to check that closest we get to missing deadline is 86us away. Change-Id: I3eee908e9f42a1c5b549e93d63588a3cb6e29a5d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238412 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* pd: remove PD remote flashing console command by default.Todd Broch2015-01-052-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | Add config option, CONFIG_CMD_PD_FLASH, and undef by default. This subcmd in the 'pd' command is large (500 bytes) and can be performed from host via ectool. Additionally the python script, util/flash_pd.py, is likely outdated or needs adjustments for various timing related nuances. Note, as flash command contained subcmd 'version' have added that under 'pd <port> vdm vers' to keep that functionality by default. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:34489 TEST=manual, run 'pd 1 flash signature' get 'parameter 1 invalid' run 'pd 1 vdm vers' w/ zinger in port 1 see version string returned. Change-Id: If282933c1d29febb43b5cf476a121be6b5a1071b Reviewed-on: https://chromium-review.googlesource.com/238291 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* pd: change receive timeout to 1.8msAlec Berg2015-01-052-2/+2
| | | | | | | | | | | | | | | | | Change PD receive timeout to 1.8ms. The max packet ever received should be ~1.59ms, so this should be safe. BUG=chrome-os-partner:33693 BRANCH=samus TEST=load onto zinger and samus and connect a bunch of times. also tested with PD communication disabled on samus and verified that zinger sends source cap 50 times (each with 4 retries) and then stops. Change-Id: If82b2905d6f9118956229682d7f259fb94da0258 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238305 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Ryu: Add dynamic USB pullup supportAnton Staaf2015-01-051-6/+2
| | | | | | | | | | | | | | | | | | | Ryu Proto 3 has a FET to control the D+ USB pullup. This change enables control of that FET using the board specific USB connect and disconnect functions. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I60cd4d36c19f235800980edc53003490589627c7 Reviewed-on: https://chromium-review.googlesource.com/234395 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vic Yang <victoryang@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
* zinger: enable RO partition write-protectionVincent Palatin2015-01-055-1/+87
| | | | | | | | | | | | | | | | | | | | | Check the flash protection at startup, if the RDP is still at level 0 (no read protection) or if the RO partition is not write protected : - set the write protection on the first 16KB of flash (4 LSB of WRP0) - push the RDP to level 1, so SWD/serial monitor needs to fully erase the part before re-writing the code or the write-protection. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:34935 TEST=dump the content of the option bytes. Change-Id: I11af64365a6fbc34327b2e463eb8e2d369ffacd2 Reviewed-on: https://chromium-review.googlesource.com/238262 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* usb: fix undefined USB endpoints (bis)Vincent Palatin2015-01-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | Repeat the fix done by the CL https://chromium-review.googlesource.com/226093 as the new function iface_undefined introduced by https://chromium-review.googlesource.com/232368 removed it for the ep_undefined function. 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 build/load the firmware on Twinkie and see we are no longer panicing at startup on the unused endpoint 2. Change-Id: Id97ce43dd699436da7eb32bbe27501a74f0ab932 Reviewed-on: https://chromium-review.googlesource.com/237220 Tested-by: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* samus: Change Tj_max to 105CDuncan Laurie2015-01-051-1/+1
| | | | | | | | | | | | | Broadwell Tj_max is 105C vs Haswell at 100C. BUG=chrome-os-partner:28234 BRANCH=samus TEST=build and boot on samus Change-Id: I3dbbf5ed6c48c996371a243e31445e7a1fadd491 Signed-off-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238304 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* zinger: maintain a 64-bit time counterVincent Palatin2015-01-032-10/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | Keep track of the high 32-bit of the microsecond time counter to avoid rollback issues. Just activate the timer "update" interrupt (aka UIE) and increment the high word on every update interrupt. Also disable STOP mode when we are going to roll-over during sleep to avoid missing the event. Given that's only happening every hour, we should not waste too much power. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=samus BUG=chrome-os-partner:34159 TEST=patch the code to set the initial TIM2 value to 0xFC000000, wait for 67s, see the counter rolling and the high word incrementing, then verify that Zinger is still functional. Change-Id: I3a2f8fc09104d8ac75c581b2abcbcef99344def7 Reviewed-on: https://chromium-review.googlesource.com/238220 Trybot-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* pd: On invalid request, send reject and go to SRC_READYAlec Berg2015-01-031-0/+3
| | | | | | | | | | | | | | | | | When a source gets an invalid request, send reject, but still go to SRC_READY state and keep the old power contract in place. BUG=chrome-os-partner:34987 BRANCH=samus TEST=load onto zinger. on samus add custom code to always send an invalid request. note that zinger still transitions to SRC_READY, samus still transitions to SNK_READY, data swap is still performed, discover identity is still performed, and samus still draws 5V/3A. Change-Id: I1213688f2b205636b3657afb1a4d8f7929bfe7ee Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238250 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: add new state to wait for getSinkCap responseAlec Berg2015-01-032-1/+13
| | | | | | | | | | | | | | | | | | | | Add new state to wait for getSinkCap response. We use the READY states in the PD state machine to indicate that we are not waiting on a response. This assumption is necessary for VDMs to know whether or not it is ok to send. This CL fixes a bug in that assumption. BUG=chrome-os-partner:33861 BRANCH=samus TEST=load onto zinger. without this change, under the right circumstances it was possible for a collision between a VDM (response to discover identity) and an incoming response to the getSinkCap. This would cause the discovery identity response to get dropped. with this change, when discover identity response is queued it is delayed until after the getSinkCap response. Change-Id: I16f4d5272e68bf699d0aecba12bdf6d6b8ff7fc7 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238239 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: reject getSourceCap/getSinkCap if doesn't applyAlec Berg2015-01-031-2/+13
| | | | | | | | | | | | | | Send a reject to getSourceCap if device is only a Sink. Send a reject to getSinkCap if device is only a Source. BUG=chrome-os-partner:34979 BRANCH=samus TEST=make -j buildall Change-Id: I53711fd88235c1c98d40fa2c59d48306e9ee7ba2 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238231 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: when battery is full, and not in S0, stop chargingAlec Berg2015-01-036-44/+201
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When battery is full and system is not in S0, then stop charging and allow battery to power the system. Once battery is no longer full and requests current, allow charging again. This is to work around power consumption issues in our AC input path. The charge override port is stored upon entering S3 and restored going back to S0 so that the charge override port is not affected by this. This also fixes lightbar so lightbar checks if battery is full instead of checking raw percentage. The lightbar is also changed to use the last tap direction if no charger is plugged in. And the lightbar tap for battery threshold for turning green is lowered to 95%. This also moves some samus_pd board code out of interrupt handlers and in to deferred functions to minimize time in interrupts. BUG=chrome-os-partner:34640, chrome-os-partner:34847 BRANCH=samus TEST=load onto samus. use battfake command from pd console to set battery percentage. when system is in G3, see that batt = 100% stops charging, and when batt < 100% it starts charging again. tested that we receive host command from EC with battery information every time battery changes SOC. Change-Id: Ia8e0721508e34ee3630f5e5b0c2f431a00329caf Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236411 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* nyan: make large batt struct array const to save RAM spaceAlec Berg2015-01-031-1/+1
| | | | | | | | | | | | | | Make large battery struct array constant to save RAM space BUG=none BRANCH=samus TEST=make -j buildall. check ec.RO.map and see 96 bytes RAM saved. Change-Id: I181138eb79138f6e7bb25738c669232cfa0d31b7 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238211 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: change hard reset power supply off delayAlec Berg2015-01-032-1/+2
| | | | | | | | | | | | | | | Change delay between sending hard reset and cutting VBUS from PD_T_SINK_TRANSITION (35ms) to the new timeout PD_T_PS_HARD_RESET (15ms). BUG=chrome-os-partner:34985 BRANCH=samus TEST=make -j buildall Change-Id: I1dfcdc790ae748aa56350814d8c40d376eba68fc Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238230 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: change retry counter to 3Alec Berg2015-01-031-1/+1
| | | | | | | | | | | | | | | Increment retry counter to 3 (4 total attempts) BUG=chrome-os-partner:35054 BRANCH=samus TEST=load onto zinger. on samus run "pd enable 0" to disable pd communication. plug in zinger and note 4 total source cap packets sent every 100ms. Change-Id: Ifc02db5f47d2ee72dad08e3973a0fb84d3ca46f9 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238079 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: Don't power-on AP if battery level < 1%Shawn Nematbakhsh2015-01-022-0/+9
| | | | | | | | | | | | | | | | | This will also inhibit power-on if no battery is attached. BUG=chrome-os-partner:31127 TEST=Manual on Samus. Verify that AP continues to boot normally when charge level exceeds CONFIG_CHARGER_MIN_BAT_PCT_FOR_POWER_ON. Verify that power button presses are ignored when the charge level is below the threshold, and we return to G3. Also, verify that Samus can boot successfully to the OS with 1% battery and a 5V @ 500mA charger attached. BRANCH=Samus Change-Id: I47cd3903c8cc13282fd5038f9d5fd1e310283ea7 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/236022 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* zinger: fix task_wait_event() bug causing missed wake eventsAlec Berg2015-01-011-2/+2
| | | | | | | | | | | | | | | | | | | Fix task_wait_event() in zinger runtime so that checking for events fired is done with interrupts disabled to avoid getting an interrupt that sets an event right after checking for that event. BUG=none BRANCH=samus TEST=load on zinger and plug/unplug ~10 times and see successful negotiations without any communication errors. note that without this CL, under certain circumstances, zinger fails to respond with goodCRC at the right time because the RX interrupt sets the event after task_wait_event() has already checked it. Change-Id: I2b43b8e389c6655d2a7a62b791014d1d5d678158 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/238092 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* nrf51: Add nRF51-specific code to keyboard_raw.cMyles Watson2014-12-312-81/+28
| | | | | | | | | | | | | | | | | | | Use the PORT event for keyboard inputs. Make a column mask for driving all outputs at once. BUG=chrome-os-partner:34477 BRANCH=none TEST=Used hadoken and the Ryu base keyboard to check that the keys are all functional, that the keyboard polls while keys are held, and that it waits for interrupts when the keys are released. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: Ie1dd1ca17b21ed76b2d412bf25fe87e45c5ba757 Reviewed-on: https://chromium-review.googlesource.com/234394 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* nrf51: Copy the keyboard_raw.c implementation from stm32.Myles Watson2014-12-311-0/+143
| | | | | | | | | | | | | | BUG=chrome-os-partner:34477 BRANCH=none TEST=make buildall -j Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I2ad095a499e960e4b2929792708a563e5b1e1922 Reviewed-on: https://chromium-review.googlesource.com/234393 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* nrf51: Add support for the interrupts in GPIOTE to gpio.cMyles Watson2014-12-311-2/+139
| | | | | | | | | | | | | | | | | | | Add structures to keep track of which interrupts are associated with which pin. There are IN[] events, and one PORT event. The IN[] events have an array. The PORT event can be used for multiple pins at once. BUG=chrome-os-partner:34477 BRANCH=none TEST=Configured pins as IN[] events and PORT events, and saw console output. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I129a6586dca4d5eb141c86fd92fbfbb70080bc2a Reviewed-on: https://chromium-review.googlesource.com/234392 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* nrf51: Add definitions for GPIOTE, the GPIO Tasks and Events.Myles Watson2014-12-311-0/+33
| | | | | | | | | | | | | | | | | | | Updated to use parameters for GPIOTE_OUT, GPIOTE_IN, and GPIOTE_CONFIG Updated with NRF51_GPIOTE_IN_COUNT to remove the magic number. BUG=chrome-os-partner:34477 BRANCH=none TEST=Configured IN[] events and PORT events and checked that they triggered events and wrote to the console. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I2021ecbee67c39571f277c97082378dce4de024f Reviewed-on: https://chromium-review.googlesource.com/234289 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* hadoken: Add the BQ27621 configuration parameters.Myles Watson2014-12-311-0/+15
| | | | | | | | | | | | | | | BUG=chrome-os-partner:34477 BRANCH=none TEST=Used custom console commands to test the charging levels, temperature, etc. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I4d357c610244a6057c9f25d2bf0893642fc41719 Reviewed-on: https://chromium-review.googlesource.com/234288 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* hadoken: Enable I2C.Myles Watson2014-12-312-0/+23
| | | | | | | | | | | | | | | BUG=chrome-os-partner:34477 BRANCH=none TEST=Used console commands to test access to the fuel gauge. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: Iefcbbfe073dcffa3bfe6224ea8210f39fee563e1 Reviewed-on: https://chromium-review.googlesource.com/234287 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* hadoken: Update I/O configuration.Myles Watson2014-12-314-49/+303
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add support for alternate functions for nrf51. Add more register definitions for the nrf51. Use assertions for conditions that should never happen. Use BUILD_ASSERT to keep the sources in sync. Add three more GPIOs to hadoken. BQ27621_GPOUT - Configurable output from the fuel gauge. LID_PRESENT_L - The input for the hall sensor. IND_CHRG_DISABLE - The output to control inductive charging. BUG=chrome-os-partner:34477 BRANCH=none TEST=Used gpioget and magnets for LID_PRESENT_L Used fuel gauge console commands to trigger BQ27621_GPOUT Tested the assertions with gdb Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I508f79ae45127104fa14f9f75fbf545f226387e4 Reviewed-on: https://chromium-review.googlesource.com/234286 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* battery: Add support for TI's BQ27621_g1 fuel gauge.Myles Watson2014-12-314-0/+775
| | | | | | | | | | | | | | | | | | | | | define CONFIG_CMD_BATDEBUG to enable console commands. If the battery is larger than 6Ah or smaller than 150mAh, scale the parameters transparently to the user using macros. BUG=chrome-os-partner:34477 BRANCH=none TEST=Custom console commands for the fuel gauge I also used a Logic16 from Saleae and the fuel gauge on hadoken. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: I959d51c3188336e4ad0983528ad7e53a2955a764 Reviewed-on: https://chromium-review.googlesource.com/234285 Reviewed-by: Randall Spangler <rspangler@chromium.org> Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* nrf51: Add support for i2c.Myles Watson2014-12-313-0/+296
| | | | | | | | | | | | | | | | BUG=chrome-os-partner:34477 BRANCH=none TEST=Custom console commands, I2C console commands I also used a Logic16 from Saleae and the fuel gauge on hadoken. Signed-off-by: Myles Watson <mylesgw@chromium.org> Change-Id: Ice01aa2ec82621107fa2fd246ce62ddf14d5b9cc Reviewed-on: https://chromium-review.googlesource.com/234284 Tested-by: Myles Watson <mylesgw@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Myles Watson <mylesgw@chromium.org>
* gesture: add absolute threshold for start of tap for batteryAlec Berg2014-12-301-1/+2
| | | | | | | | | | | | | | | | | | | | Add absolute threshold on delta_z_inner for tap for battery to guarantee that we have at least some minimum absolute change in z that has started the tap for battery. This change makes it such that if the accel readings are really steady for a while, then a sudden noisy signal doesn't trigger tap for battery. BUG=chrome-os-partner:34592 BRANCH=samus TEST=use tapinfo on to observe tap values and do a double tap of varying intensities. note that it should be just a little less sensitive to weak taps. Change-Id: I95367bc7f99b888e15e9ac3a2bc8c9cca32d30d6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237666 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* gesture: double tap for battery accelereomter ODRAlec Berg2014-12-301-1/+5
| | | | | | | | | | | | | | | | | | | | Double the output data rate setting for accels for tap for battery because with the lsm6ds0 sensor, the current ODR does not guarantee that we get fresh data every time we do a read. BUG=chrome-os-partner:34592 BRANCH=samus TEST=load onto samus, go to G3, use tapinfo on to see ODR set to 476000Hz. add printf to lsm6ds0 to print when data is not ready, and see that without this change, the printf is hit once a minute or so, and with this change, the printf is never hit, meaning new data is always ready. Change-Id: Ib09cba0d70642f59df8a35b5b6bb4fd7b9a4fa3d Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237665 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* accel: fix accel bug where if no new data, it uses wrong dataAlec Berg2014-12-301-3/+3
| | | | | | | | | | | | | | | | Fix accelerometer bug in which, if there is no new data from the lsm6ds0 accel, it will use the old ajusted xyz instead of the old raw xyz. BUG=chrome-os-partner:34952 BRANCH=samus TEST=add printf to case where it uses old data and sample faster then ODR to read wrong data. Change-Id: If0a6bbdec71d84567eae107aca6f1d0ab754919a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237664 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* samus: Debounce BC1.2 charger detection due to asynchronous pin contactShawn Nematbakhsh2014-12-294-57/+94
| | | | | | | | | | | | | | | | | | | | | With the type-c connector, it's common for VBUS to make contact before D+/D-, which can lead to charger misdetection. To work around this, add a 200ms delay and trigger re-detection when a charger is inserted. This should fix most misdetects due to unintentional slow plug (though it's still possible to misdetect if insertion is deliberately very slow). BUG=chrome-os-partner:34584 TEST=Manual on Samus. Plug in Apple charger 20 times, verify that it is always detected correctly. Deliberately plug in slowly, verify it is detected as 500mA SDP port. Repeat tests with various other CDP / SDP ports to verify detection never over-currents and always indicates a charger is plugged (or not plugged) correctly. BRANCH=Samus Change-Id: I8a776f516d8e7f0cedcb9d8579239eba641cab09 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237241 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* mec1322: Added support to use crystal vs oscillator based on board's clock ↵Kevin K Wong2014-12-293-1/+20
| | | | | | | | | | | | | circuitry. BUG=None TEST=make -j buildall BRANCH=None Change-Id: I88fa219cd9e573c1544400d24d00c4fdec93840f Signed-off-by: Kevin K Wong <kevin.k.wong@intel.com> Reviewed-on: https://chromium-review.googlesource.com/237272 Reviewed-by: Vic Yang <victoryang@chromium.org>
* Veyron: cancel the long press timer when lost power_goodChris Zhong2014-12-291-5/+9
| | | | | | | | | | | | | | | | if power good is lost and the power button still press, we need cancel the long press timer, otherwise EC will crash. BUG=chrome-os-partner:34816 TEST=press power button during coreboot, and it can shutdown normally BRANCH=None Change-Id: Ia27c83137451abacce9d544741bbbe5787983215 Signed-off-by: Chris Zhong <zyw@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/237294 Reviewed-by: Jiazi Yang <Tomato_Yang@asus.com> Reviewed-by: Alexandru Stan <amstan@chromium.org> Commit-Queue: Eddie Cai <eddie.cai8848@gmail.com>
* Plankton: add console command to simulate cable unplugVic Yang2014-12-293-28/+139
| | | | | | | | | | | | | | | | | For factory testing, we need a way to simulate unplugging type-C cable. To do so, we disable VBUS output and pull-up/pull-down on CC lines on Plankton, so that the CC lines become floating. BRANCH=None BUG=chrome-os-partner:32163 TEST=Connect Plankton to Ryu. Try 'fake_disconnect' as SRC/SNK. Change-Id: I73a7355e078b6aed4b7d281d480e0aedbc8c2db0 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/229662 Reviewed-by: Pin-chih Lin <johnylin@chromium.org> Tested-by: Pin-chih Lin <johnylin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* charge_manager: Request power swap when switching from dual-role override portShawn Nematbakhsh2014-12-242-6/+73
| | | | | | | | | | | | | | | | Ports should have source roles by default, and should go back to being sources once we stop charging from them. BUG=chrome-os-partner:31195 TEST=Manual on Samus. Connect Samus to dual-role port. Set override port, verify that Samus charges. Attach dedicated charger, verify that the dual-role port becomes a charge source again. Also pass unit tests. BRANCH=Samus Change-Id: Icf153117229cbf0f71d4bdeb888f73299acd5eeb Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237452 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* pd: hoho: mcdp28x0 serial driver.Todd Broch2014-12-235-2/+231
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add initial serial driver for mdcp2850 dp->hdmi converter. Driver implements 'get information' (cmd:0x40) to provide rudimentary method to test mcdp for functionality and assert GPIO if successful. Future CLs may expose more serial functionality if necessary. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:34122 TEST=manual, when compiles with #define MCDP_DEBUG see successful serial communication and result from get info. buf:[00]0x04 [01]0x40 [02]0x00 [03]0xbc ... buf:[00]0x0f [01]0x40 [02]0x00 [03]0x0e [04]0x00 [05]0x01 [06]0x01 [07]0x00 [08]0x00 [09]0x00 [10]0x00 [11]0x00 [12]0x00 [13]0x00 family:000e chipid:0001 irom:1.0.0 fw:0.0.0 Change-Id: I35f9d9b0437633d1bd6a6c9fa14413bedb12f5c2 Reviewed-on: https://chromium-review.googlesource.com/235930 Trybot-Ready: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* charge_manager: Fix port selection debug printShawn Nematbakhsh2014-12-231-1/+1
| | | | | | | | | | | | | | Port + supplier parameters were swapped. BUG=None TEST=Manual on Samus. Insert charger into first port, verify "p0" is printed. BRANCH=Samus Change-Id: Ibb86f07bdd321a91c199310c67054025fa609c43 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237301 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus: set BQ voltage to battery voltage when AC disconnectedAlec Berg2014-12-232-8/+22
| | | | | | | | | | | | | | | | | | | | Set charge state machine voltage to just above the battery voltage when AC is disconnected. Also send new current before sending new voltage to charger when there is a change. These changes reduce input current spikes caused by current inrush into the battery and thereby decrease chance of overcurrenting power supply on connect. BUG=chrome-os-partner:33862 BRANCH=samus TEST=load onto samus instrumented with input current probe. when AC is attached note that initial current spike is much lower with this change. Change-Id: I7760cd2b709c6b3536cf2a9449bb1f46800ce10a Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237245 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* samus_pd: add internal pull-up to EC_IN_RWAlec Berg2014-12-231-1/+1
| | | | | | | | | | | | | | | | | Add internal pull-up to EC_IN_RW to match changes made in DVT. Doesn't affect earlier boards because a hardware bug prevented us from reading the correct state anyway. BUG=none BRANCH=samus TEST=make -j buildall Test on re-worked samus board with DVT changes. Tested PD MCU can read the correct state of the gpio. Change-Id: I27952022cfff2d1f7adcb93d4df47d63f1fd5470 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/237305 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* it8380dev: add ec2i control moduleDino Li2014-12-237-2/+340
| | | | | | | | | | | | | | | | | | | Add EC2I control module for emulation board. The EC2I bridge enables the EC to access the host controlled module registers (e.g., host configuration module(PNPCFG) and SWUC) Signed-off-by: Dino Li <dino.li@ite.com.tw> BRANCH=none BUG=none TEST=EC2I read: Read a logical device page, the results are correctly. EC2I write: Initialize PNPCFG success. Change-Id: I900450d4a8c49182c438b69b5e738c12dc437fe4 Reviewed-on: https://chromium-review.googlesource.com/230410 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>
* pd: vdm: remove replicated VDM code.Todd Broch2014-12-2211-61/+34
| | | | | | | | | | | | | | | | Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:30645 TEST=manual, Still see alternate mode entry and can use flash VDMS Change-Id: Id7371960a20e7d26a15b3a40ca40aa03b6595956 Reviewed-on: https://chromium-review.googlesource.com/235681 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* pd: Remove pe dump command by default.Todd Broch2014-12-222-0/+3
| | | | | | | | | | | | | | | | | | | Marginally useful command being replaced by host command in later patch (ectool --name cros_pd pdgetmode). Hide behind config option CONFIG_CMD_USB_PD_PE. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=samus BUG=chrome-os-partner:34489 TEST=compiles, command is gone and gain >700 bytes of flash. Change-Id: I09deeb997744757a836438eb3217f9b432bdd11c Reviewed-on: https://chromium-review.googlesource.com/236957 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org>
* system: Add function to convert passed system_image_copy_t to stringShawn Nematbakhsh2014-12-223-7/+18
| | | | | | | | | | | | | | | | | | This conversion is needed in files outside of system.c, so add a new function. BUG=chrome-os-partner:34599 TEST=Manual on samus_pd. Run "pd 0 info" and verify "Image RW" is printed. BRANCH=Samus Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ia905ba9cf985f3714fa75c81670b8a39e9608f3d Reviewed-on: https://chromium-review.googlesource.com/236980 Tested-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Shawn Nematbakhsh <shawnn@chromium.org>