summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* move stringify macro to common includestabilize-5899.BVincent Palatin2014-05-271-0/+9
| | | | | | | | | | | | | | | | | | We need to stringify macros arguments in various places in the code, avoid duplicating this definition. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=make buildall Change-Id: I03530c06139fad4c60711d041239b396d9ed321e Reviewed-on: https://chromium-review.googlesource.com/201576 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* zinger: activate the watchdog.Vincent Palatin2014-05-272-0/+5
| | | | | | | | | | | | | | | | | | | | | Ensure we are never stuck somewhere without doing the safety checks by enabling the watchdog and reloading it in the safaty checks function. I have kept the default timing constants, so on STM32F0xx the watchdog period should be between 1.2s (LSI at 30kHz) and 2.0s (LSI at 50kHz). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=add a 2s loop in the serial port interrupt handler and see the power supply rebooting. Change-Id: I000f2a36a31e1166adf63a36c2b7f52999adc928 Reviewed-on: https://chromium-review.googlesource.com/201575 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* flash_ec: enclose variable $IMG in quotes to handle whitespace in filenameDominic Chen2014-05-231-1/+1
| | | | | | | | | | | BRANCH=none BUG=chromium:346807 TEST=flash firmware image with whitespace in filename Change-Id: I8aa2ea9439a8f861e617256a63803c278708596e Signed-off-by: Dominic Chen <ddchen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200995 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: implement fast scan modeVic Yang2014-05-232-14/+97
| | | | | | | | | | | | | | With fast scan mode, the scan rate can usually go up to 90-100 Hz. In worst case, the rate still maintains at around 50 Hz. BUG=None TEST=Manual test. Check heat map. BRANCH=None Change-Id: I2dc25028ffa5b3175b856d3437004c21b84e7df7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200829 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: when PD sink request is rejected go back to discovery stateAlec Berg2014-05-231-2/+3
| | | | | | | | | | | | | | | | When sink receives a power request rejected packet, go back to discovery state in order to retry transmitting request. BUG=none BRANCH=none TEST=tested with zinger. when zinger has an over current fault, it rejects requests for power. made sure that when device gets rejected it goes back to discovery state. Change-Id: Id532b69f52bd533e5d7ac1171d8833bc993a0e9f Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/201157 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: detect source disconnectionAlec Berg2014-05-231-0/+10
| | | | | | | | | | | | | | | For non-PD aware source, ensure that we detect their disconnection when the CC goes back below Vnc. BUG=none BRANCH=none TEST=when zinger gets into state where it is not talking PD, remove charger and make sure we transition to disconnected state. Change-Id: I675ff6d3300eda680acdd7814f0163f222eeb516 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/201156 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus_pd: add interrupt to detect VBUS transitions quicklyAlec Berg2014-05-232-1/+6
| | | | | | | | | | | | | | | | | | Add interrupt to VBUS signal to detect VBUS transitions quickly to make sure we transition out of SNK_READY when VBUS goes away. BUG=chrome-os-partner:28611 BRANCH=none TEST=Test on samus 1.9 board. Ran for hours with charger plugged in, made sure when charger cuts out after missing ping responses, that it successfully goes to disconnected state and renogiates power. Change-Id: I93b2e49891e6a38c98095b7311a9435606cc61ab Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/201155 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: limit input current to 2.5A to prevent over currenting zingerAlec Berg2014-05-231-1/+1
| | | | | | | | | | | | | | | | | Set maximum input current limit to ~2.5A to prevent over current faults on zinger. Note, we still get over current faults sometimes but it always clears in < 10seconds. BUG=chrome-os-partner:28611 BRANCH=none TEST=Test with a samus 1.9 and a zinger. Plug and unplug charger many times and make sure that we are eventually able to successfully negotiate for power and start charging. Change-Id: I5a7adf9fc7f5ed7a0c7dfdb620e0c1474f72a878 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/201154 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Samus: The Silego on proto1b inverts the COL2 outputBill Richardson2014-05-221-0/+1
| | | | | | | | | | | | | | | Without this change, COL2 is dead. BUG=chrome-os-partner:28721 BRANCH=ToT TEST=manual Tried all keys, now they work. Change-Id: Ie6f6ba342c7dae035d9a1dc6b2d4837146840d95 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200852 Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
* zinger: ensure we re-enable the output once a fault is clearedVincent Palatin2014-05-211-0/+5
| | | | | | | | | | | | | | | | | | When a fault is cleared, reset the PD state and communicate, so that we re-enable the output and negociate a new voltage. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=on Zinger connected to Firefly, trigger an OCP (using an electronic load) and see that the output is re-enabled once the OCP is cleared after 1 second. Change-Id: I3199d2c8675ab43958321378fd7f65ac383468cc Reviewed-on: https://chromium-review.googlesource.com/200338 Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* samus_pd: when sinking power detect loss of VBUS and disconnectAlec Berg2014-05-214-0/+23
| | | | | | | | | | | | | | | | | | Detect loss of VBUS when acting as PD sink and go to the disconnected state. This allows us to renegotiate power when power supply drops and switches to 5V. BUG=none BRANCH=none TEST=On a samus, tested by running for a couple of hours, and verifying that occasionally when zinger drops from 20V to 5V, we detect it and go to the disconnected state. Note, this only happens a couple times every hour. Change-Id: I237d267824ff564662c9c02e525ce2613ed229e6 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200365 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add cprints() and ccprints()Vic Yang2014-05-2178-417/+451
| | | | | | | | | | | | | | | | | | | | | Our code base contains a lot of debug messages in this pattern: CPRINTF("[%T xxx]\n") or ccprintf("[%T xxx]\n") The strings are taking up spaces in the EC binaries, so let's refactor this by adding cprints() and ccprints(). cprints() is just like cprintf(), except that it adds the brackets and the timestamp. ccprints() is equivalent to cprints(CC_CONSOLE, ...) This saves us hundreds of bytes in EC binaries. BUG=chromium:374575 TEST=Build and check flash size BRANCH=None Change-Id: Ifafe8dc1b80e698b28ed42b70518c7917b49ee51 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200490 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: change battery charging current sense resistor valueAlec Berg2014-05-211-1/+1
| | | | | | | | | | | | | | Correct battery current sense resistor is 5m-ohms. BUG=none BRANCH=none TEST=Still having charging problems, but this should be a little better. Change-Id: I54f664a3efa3b3afdc46c2329467cb97ad02a301 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200751 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
* stm32: Enable USART TCIE after clearing TCstabilize-5875.BDavid Hendricks2014-05-211-0/+3
| | | | | | | | | | | | | | | | | | | After clearing the TC flag, we should re-enable TCIE so that when the DMA transfer is done we re-interrupt and allow uart_process_output() to continue printing whatever is in the circular buffer (in the case of wrap-around) or finish gracefully if there is nothing left in the buffer. BUG=chrome-os-partner:28837 BRANCH=nyan TEST=Commands now reliably print full output whereas before they might appear truncated until another interrupt was triggered to finish printing the buffer. Change-Id: I0a4236139f57812f384e2b99af45195537201a04 Signed-off-by: Randall Spangler <rspangler@chromium.org> Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200499
* Show success message after 'make buildall'Vic Yang2014-05-211-0/+1
| | | | | | | | | | | | | | | | | | 'make buildall' spews out a long long long message, and when an error occurs, it's sometimes hard to spot the error message. By adding a explicit success message after a successful run, one can just look for that success message to determine if it failed. BUG=None TEST=Build and see success message. TEST=Introduce an error, build, and check there is no success message. BRANCH=None Change-Id: Ia5468342ad2eb5378c3e10774ed81c5c91f002a2 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200618 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* pd: revert slow traces in PD codeVincent Palatin2014-05-211-18/+16
| | | | | | | | | | | | | | | | | | | | | | The commit 4ba7a15 has modified the traces resulting in a far larger overhead (mainly due to %T doing dozen? of 64-bit divisions which is an expensive operation on a Cortex-M0) as a result the code is now missing communication deadlines. for lack of a better solution, revert the modification is this file. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=run PD communication between Zinger and Firefly, and between Fruitpie and Samus and see communication error rate is going down from 30% failure to less than a few percents. Change-Id: I902b951450bc200baad722ae5d65053ceda5357b Reviewed-on: https://chromium-review.googlesource.com/200326 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: fix a bug in task_wait_event()Vic Yang2014-05-211-4/+3
| | | | | | | | | | | | | The match interrupt is disabled before we actually intend to. Fix it. BUG=None TEST=Build and boot BRANCH=None Change-Id: I8fb171e849809d1e4f35f00bbf6d15c9a8caad74 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200680 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: do not trim response before sending back to masterVic Yang2014-05-211-9/+3
| | | | | | | | | | | | | | | ADC sampling is slower than SPI communication. If we spend more CPU cycle trimming the response, we are just wasting time and letting SPI bus sit idle. BUG=None TEST=Build and boot. Check scanning rate. BRANCH=None Change-Id: I9a4ece28a29ffd3205931ea71958cbc73642be6b Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200673 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: make a copy of response before transmittingVic Yang2014-05-211-5/+7
| | | | | | | | | | | | | | | | | Before transmitting the response back to the master, the slave should make a copy of it. Otherwise, if the buffer is reused, we run the risk of overwriting the last response before it's sent out. We got away with this before because we didn't overwrite it fast enough. Let's fix this to be safe. BUG=None TEST=Build and boot BRANCH=None Change-Id: If3c50692d554119de9ff0f0ae0de450b923b11af Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200672 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: fix ADC timing and increase sampling rateVic Yang2014-05-212-10/+9
| | | | | | | | | | | | | | This fixes a bug that PMSE_MRCR is changed too early. Also, with this bug fixed, we can increase the sampling rate to 13.5 cycles/sample. BUG=None TEST=Check heat map BRANCH=None Change-Id: Id7dc34fd7975ca7153b96443b8d4d28f1557eec4 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200651 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: Switch to HSEVic Yang2014-05-212-10/+10
| | | | | | | | | | | | | We have a 16MHz oscillator input, so let's use it to save HSI power. BUG=None TEST=Build and boot BRANCH=None Change-Id: Ia2d97cfc8b97b7f8661112ebbd84952e41b955f2 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200650 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Keyborg: fix bug in slave data processingVic Yang2014-05-211-2/+9
| | | | | | | | | | | | | | | This fixes two bugs: - The row order on the slave is reversed - The last value is missed when transferring data to the master BUG=None TEST=Build and check the heatmap BRANCH=None Change-Id: Ic51ad1132d948ec6ec68dc673288ec6f29c6ebe7 Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200621 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* nyan: don't compile in shorthelp of console commandsLouis Yung-Chieh Lo2014-05-201-0/+1
| | | | | | | | | | | | | | | | | | | | Since stm32l has smaller flash size, undef CONFIG_CONSOLE_CMDHELP to remove short descripton to save 2560 byes. If you need to read the description, grep that in the code. BUG=chromium:374575 BRANCH=tot,nyan TEST=buildall and % grep hey build/big/ec.RO.map 0x000000000000ef48 After shrink --> 0x000000000000e548 Change-Id: I856e89def6456607ade610134bf318d8522f5e4d Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200472 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* reduced the charge v2 debug message sizeLouis Yung-Chieh Lo2014-05-201-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove redudant struct names. Replace 2 spaces with a tab char. This reduces 128 bytes in flash size. BUG=chromium:374575 BRANCH=tot,nyan TEST=Built and verified on big % grep hey build/big/ec.RO.map 0x000000000000ef48 After shrink: 0x000000000000eec8 The output still is easy to read. > chg state = charge ac = 1 chg.*: voltage = 13040mV current = 256mA input_current = 2048mA status = 0x10 option = 0xf912 flags = 0x0 batt.*: temperature = 20C state_of_charge = 0% voltage = 8253mV current = 274mA desired_voltage = 13050mV desired_current = 256mA flags = 0x3 remaining_capacity = 0mAh full_capacity = 4026mAh is_present = YES requested_voltage = 13040mV requested_current = 256mA force_idle = 0 manual_mode = 0 user_current_limit = -1mA battery_seems_to_be_dead = 0 debug output = off Change-Id: I82a3a5cda3fa96e247355dc90431691015eece6c Signed-off-by: Louis Yung-Chieh Lo <yjlou@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200470 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Tested-by: Bill Richardson <wfrichar@chromium.org>
* Enable flashing of usbpd mcu for samus.Todd Broch2014-05-191-27/+34
| | | | | | | | | | | | | | | | | | | | | | | | | CL manages various dut-control dependencies for readying the STM32 part for programming. Additionally deprecated the short-lived --uart_prefix argument as user's defining this could be problematic without knowledge of necessary modifications to h/w & s/w. Signed-off-by: Todd Broch <tbroch@chromium.org> CQ-DEPEND=CL:200146 BRANCH=none BUG=chrome-os-partner:28826 TEST=manual, util/flash_ec --board=samus_pd succeeds. util/flash_ec --board=spring succeeds. Change-Id: I7627c77293da187700aeddf7382dbb12e163a2ef Reviewed-on: https://chromium-review.googlesource.com/200148 Tested-by: Todd Broch <tbroch@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* Implicitly decide uart_prefix based on board.Todd Broch2014-05-191-9/+19
| | | | | | | | | | | | | | | | | | Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=chrome-os-partner:28826 TEST=manual util/flash_ec --board=samus_pd - See uart_prefix is 'usbpd' util/flash_ec --board=rambi - See uart_prefix is 'ec' Change-Id: Iba14fd0635d72413e48d45992c852393301b3f6b Reviewed-on: https://chromium-review.googlesource.com/199939 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* Add uart_prefix flag to control which uart is used to flash.Todd Broch2014-05-191-6/+8
| | | | | | | | | | | | | | | | | | | | There are CrOS devices that have multiple embedded controllers and therefore multiple uarts that can be used for programming. This CL allows user to set the uart_prefix to access the alternate uarts via the --uart_prefix argument. Default is still 'ec'. Signed-off-by: Todd Broch <tbroch@chromium.org> BRANCH=none BUG=chrome-os-partner:28826 TEST=util/flash_ec --board=samus_pd --uart_prefix=usbpd Change-Id: I9fbe8d13067b7f514447645b2587dda706445661 Reviewed-on: https://chromium-review.googlesource.com/199900 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Tested-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Todd Broch <tbroch@chromium.org>
* Keyborg: encode the scanned heat map to fit into RAMVic Yang2014-05-184-22/+143
| | | | | | | | | | | | | | A single frame of the scanned heat map is too big to fit into RAM. Let's encode it so that we can get the whole frame. BUG=None TEST=Touch on various places on the panel and see corresponding results. BRANCH=None Change-Id: I8c7c72d5d4a83ebc2018c0abd57075697c931bef Signed-off-by: Vic Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199940 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus_pd: PD configuration bug fixesAlec Berg2014-05-183-22/+36
| | | | | | | | | | | | | | | Fix bug to get PD transmit working. Fix config bug for reading the CC ADCs. BUG=chrome-os-partner:28350 BRANCH=none TEST=connect fruitpie and samus via USB-C and run pd dev on samus and pd charger on fruitpie. Change-Id: Ic981a1f1e621ef4b69dedc61a02751346274aa4e Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200159 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus_pd: remove battery configAlec Berg2014-05-181-1/+0
| | | | | | | | | | | | | Remove battery config since PD chip doesn't talk to battery. BUG=chrome-os-partner:28350 BRANCH=none TEST=load on samus and make sure console running normally. Change-Id: I97174aa3796eaa10b3a5a2bf0aa79a39ba8640ac Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200142 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* zinger: fast over-current protectionVincent Palatin2014-05-172-2/+67
| | | | | | | | | | | | | | | | | | When the supply output is enabled, ensure that we detect quickly any over-current situation by setting an analog watchdog in continuous conversion mode. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:28331 TEST=plug an electronic load to Zinger and see the OCP triggered quickly when we go above the current threshold. Change-Id: I7da50ef242addbd2f4f48f624494daa321ac22b2 Reviewed-on: https://chromium-review.googlesource.com/199924 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
* zinger: add support to flash RW firmwareVincent Palatin2014-05-177-10/+337
| | | | | | | | | | | | | | | | | | | | | | | Allow flashing the RW firmware by sending Vendor-Defined Messages over the USB-PD link. This is not the secure update whose design is still under discussion, it's a simple update with integrity check. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:28330 TEST=using the following CLs, ./util/flash_pd.py ./build/zinger/ec.RW.flat and see Zinger booting on RW, repeat the operations with different builds of the RW firmware. Change-Id: Icd90eb92f7321ccd66341a50b9dabd73c59c68c1 Reviewed-on: https://chromium-review.googlesource.com/197948 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* Add SHA-1 hashVincent Palatin2014-05-174-0/+209
| | | | | | | | | | | | | | | | | | | | Imported code from VBoot firmware cryptolib and slightly reformat it for the EC code base. We already have SHA-256, but for updates over PD, the maximum payload size is 192 bits, so SHA-1 seems a better trade-off. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:28336 TEST=none Change-Id: I6da7b71a9af03c6689accfa3c59cfcf7776fcfc6 Reviewed-on: https://chromium-review.googlesource.com/199553 Reviewed-by: Alec Berg <alecaberg@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* firefly: update VBUS voltage sensingVincent Palatin2014-05-171-2/+2
| | | | | | | | | | | | | | | | | The voltage divider resistor values have changes to 10K/100K, update the code to take this into account. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: I2a1469e3441c4bea2bfe3f3a3b7f8ac2225cca51 Reviewed-on: https://chromium-review.googlesource.com/200343 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* firefly: voltage button debouncingVincent Palatin2014-05-171-3/+23
| | | | | | | | | | | | | | | | | Add a debouncing period on the mechanical switches event detection to avoid issues in the noisy factory environment. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=none TEST=none Change-Id: I40316c8e32948f92cb92f8743003d5be8cbe8e11 Reviewed-on: https://chromium-review.googlesource.com/200342 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* samus_pd: fix DMA init bugAlec Berg2014-05-161-0/+2
| | | | | | | | | | | | | | Enable clock to syscfg in order to write DMA remapping registers in pre_init(). BUG=chrome-os-partner:28350 BRANCH=none TEST=test on a samus board. Change-Id: I71b7f9b2bdc45f138f404997ccde65f54a1125d0 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/200039 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* Add "debug" option to charge_state_v2.cBill Richardson2014-05-155-10/+40
| | | | | | | | | | | | | | | | | | | | | | | | | This is useful for testing battery charge profiles. When enabled, a dump of all battery, charger, and charge state information will be printed whenever the battery charge percentage changes. BUG=none BRANCH=ToT TEST=make buildall -j On the EC console: chg debug on then watch the console while either charging or discharging the battery. Disable with chg debug off Change-Id: I6725c461461f90fcd812873f97490e980ab47bc6 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199816 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Replace magic numbers with #defines for charger bq24773.cBill Richardson2014-05-152-9/+25
| | | | | | | | | | | BUG=none BRANCH=none TEST=buildall -j Change-Id: I125fbe7716f6c8b78011c3a39745ec4992074795 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199796 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Add standalone lightbar simulation toolBill Richardson2014-05-1510-3/+781
| | | | | | | | | | | | | | | | | | | | | | | | | This adds an "extra/" directory to hold various experiments and optional programs. With this change, we add a tool that can simulate the lightbar behavior on the build machine. That can be used to experment with variations in the lightbar pattern code without needing to reflash a Pixel with a new EC to see the effect. There is no functional change to the EC code, just a couple of #ifdefs to allow common/lightbar.c to be compiled separately from the EC. BUG=none BRANCH=ToT TEST=make buildall -j cd extra make ./lightbar You may need to install the libxcb1-dev package on your build machine. Change-Id: I847ce7ea97cae792b1de1b91f488819e873b6555 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199883
* Put the lightbar IC controls and pattern logic into separate filesBill Richardson2014-05-154-284/+316
| | | | | | | | | | | | | | | | | | This puts the code that talks to the lightbar hardware in one file, and the code that implements the pretty patterns and behavior into another. This will let us make improvements or changes to the patterns without requiring detailed knowledge of the controller chips. BUG=chrome-os-partner:28596 BRANCH=ToT TEST=make buildall -j Refactoring only. There is no new functionality. Change-Id: I4e5fe8943385ddeab26bbd7e66c20e2dccd3dc43 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199882 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Add GET_RGB, GET_BRIGHTNESS, and GET_DEMO subcommands to lightbarBill Richardson2014-05-153-91/+197
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds three new lightbar subcommands to the EC_CMD_LIGHTBAR_CMD host command, allowing the AP to read the current brightness level, the current lightbar LED values, and the state of demo mode. Because this is new, also update LIGHTBAR_IMPLEMENTATION_VERSION. All the previous commands are unchanged, though. BUG=chrome-os-partner:28596 BRANCH=ToT TEST=manual From the AP, run these commands to see the changes: ectool version ectool lightbar brightness ectool lightbar 0 ectool lightbar 1 ectool lightbar 2 ectool lightbar 3 ectool lightbar demo The version output is different, the other commands used to just emit errors. Change-Id: If32a5d2388217edc3ae7b9b091d66e9d2cf753be Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199881 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Rearrange lightbar.c to separate IC control from pattern logicBill Richardson2014-05-151-185/+186
| | | | | | | | | | | | | Just refactoring the code to make it neater. No functional changes. BUG=chrome-os-partner:28596 BRANCH=ToT TEST=make buildall -j Change-Id: Ib436369c2242de3b0fdacf65404eaba4a309e73b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199880 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* samus: add PD MCU interrupt signal to gpio listAlec Berg2014-05-142-0/+10
| | | | | | | | | | | | | | | | Add PD MCU interrupt signal to gpio list, currently with a dummy interrupt function which prints a message to let us know it is occuring. BUG=chrome-os-partner:28721 BRANCH=none TEST=none Change-Id: I1fab016b84b1abaced905e0ea0bd35dbd67b30bb Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199792 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: add PD MCU boardAlec Berg2014-05-1411-5/+768
| | | | | | | | | | | | | | Initial patch for samus PD board. This configures GPIOs to match samus 1.9. BUG=chrome-os-partner:28350 BRANCH=none TEST=none, no boards yet. Change-Id: Ibc9d67325a1d9699b4e76e2998ab830ddbd0fb98 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199660 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* fruitpie: disable battery charging chip ILIM pinAlec Berg2014-05-144-0/+29
| | | | | | | | | | | | | | | | Typically bq24xxx charging chip limits input current to minimum of register value and ILIM pin. For fruitpie, the current limit will be decided solely in software, and the hardware pin will be ignored. BUG=chrome-os-partner:28611,chrome-os-partner:28311 BRANCH=none TEST=Tested on fruitpie. Verified that current limit can be set above the ILIM pin value of 500mA. Change-Id: Ia687446f95f9d18fde9d2b4ebb0e1c093aebf885 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/198940 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* samus: disable battery charging chip ILIM pinAlec Berg2014-05-141-0/+1
| | | | | | | | | | | | | | | | | Ignore ILIM pin for charging which allows EC to set the input current limit to anything it desires. This is necessary for 1.9 build because the hardware sets the ILIM to something like 0.5A. BUG=chrome-os-partner:28611 BRANCH=none TEST=none CQ-DEPEND=CL:198940 Change-Id: I43c57d0040e341e091ee36c97ec601d6bd174606 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199661 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* zinger: increase OCP thresholdVincent Palatin2014-05-141-2/+2
| | | | | | | | | | | | | | | | | | As per hardware team request, use a higher over-current limit to avoid false positives due to measurement precision margin. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=chrome-os-partner:28331 TEST=use a Zinger connected to an electronic load and trigger the protection. Change-Id: If031f6f58b9b7119c6fa3fa3273c08f16cbbbebb Reviewed-on: https://chromium-review.googlesource.com/199552 Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
* Samus: Punt on BQ_IBAT measurements for nowBill Richardson2014-05-121-6/+10
| | | | | | | | | | | | | | Nothing looks at this except for an EC console command, so leave it at unity gain until we've confirmed that it's working correctly. BUG=chrome-os-partner:28721 BRANCH=ToT TEST=make buildall Change-Id: I81085743535f4664ac8bf1d016bb7562046ab49b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199243 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Samus: Update configuration for proto1.9Bill Richardson2014-05-123-18/+26
| | | | | | | | | | | | | Start of changes to Samus' board.h and board.c to support proto1.9 BUG=chrome-os-partner:28721 BRANCH=ToT TEST=make buildall Change-Id: I70590c1f9845430801a6c2939ac92be289750ca3 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199242 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* Samus: Move single-use constant into the file that uses it.Bill Richardson2014-05-122-3/+2
| | | | | | | | | | | | | | | There's a constant defined in board/samus/board.h that's only used in board/samus/panel.c. Let's just put it in that file, so it doesn't clutter up the config. BUG=chrome-os-partner:28721 BRANCH=ToT TEST=make buildall Change-Id: I23d61aff16726a11a0408957cd109b49c3bf954c Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/199241 Reviewed-by: Alec Berg <alecaberg@chromium.org>