summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* bd9995x: more delay time between chg_en and vsys_setstabilize-kevin-8785.94.BWonjoon Lee2017-01-061-12/+24
| | | | | | | | | | | | | | | | | | | | | The nvdc voltage has a kind of deep, so that rarely observed NVDC down at this point because of back-boosting. Our sequence to enable charger bit and setting vsysreg is correct but rohm introduce charger may need some more time to be stable when between chg_en and vsys_set to start charge BUG=chrome-os-partner:60380 BRANCH=gru TEST=Manual on kevin, trigger battery disconnect, re-attach AC, verify system boots cleanly. and see voltage probing on c54@60380 Change-Id: Ic05091379322ffaac16fe827a47345c76c85f3e5 Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/424214 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit a62a6254f5578a06893efc28b4c0d2b549129338) Reviewed-on: https://chromium-review.googlesource.com/424985 Commit-Queue: Shawn N <shawnn@chromium.org>
* charger: Prevent power-on while battery is disconnectedShawn Nematbakhsh2017-01-061-4/+9
| | | | | | | | | | | | | | | | | | Wait for revival of disconnected battery before allowing AP power-on. BUG=chrome-os-partner:61462 BRANCH=gru TEST=Manual on kevin, put battery into ship mode, verify that bd9995* CHG_EN is set prior to AP power-on. Change-Id: I77254535ad5d627376cb0bec2289b96e6b4fc670 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424069 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Wonjoon Lee <woojoo.lee@samsung.com> Tested-by: Wonjoon Lee <woojoo.lee@samsung.com> (cherry picked from commit 03ec07d618895654f72ed66f0edda70c5b7493f2) Reviewed-on: https://chromium-review.googlesource.com/424986
* npcx: shi: Optimize OBUF copy / fillShawn Nematbakhsh2017-01-061-22/+53
| | | | | | | | | | | | | | | | | | | | We have hard timing requirements once we begin to output our host command response, and most of the time is spent copying our response to OBUF. Optimize our copy loops to remove needless increments and to avoid needless struct dereference. BUG=chrome-os-partner:61304 BRANCH=gru TEST=Manual on kevin, verify the following performance metrics: Time spent in shi_fill_out_status(): Was 40us, now 28us Time spent in shi_write_half_obuf(): Was 60us, now 31us Time spent in shi_write_first_pkg_outbuf: Was 90us, now 37us (bad case) Was 26us, now 16us (better case / less data copied) Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I04075c92744eeefe8f2be009e6598718c45143c4 Reviewed-on: https://chromium-review.googlesource.com/425331
* npcx: hwtimer: Fix deadlock close to hwtimer wrapShawn Nematbakhsh2017-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | __hw_clock_event_set() is not reentrant and may be called from both our event timer ISR and our hwtimer ISR when hwtimer is close to wrapping. Modify the interrupt priority of our hwtimer int to match our event timer int so that one cannot preempt the other. Originally the priority was changed to allow the hwtimer ISR to run first in case both are pending, but this condition can be handled cleanly and isn't a big concern. BUG=chrome-os-partner:60470 BRANCH=gru TEST=Pass 500 S/R cycles on kevin with hwtimer wrap rate sped up 300x (roughly equivalent to 150,000 real S/R cycles). Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ied466f14661f04c8662b5db709c0e3770a5bb200 Reviewed-on: https://chromium-review.googlesource.com/417060 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit ac28ec53b63a02c4d25e8a222d13595bc857fef0) Reviewed-on: https://chromium-review.googlesource.com/417112 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit a0bfd989d1045dd328543f2792df44209a090d33) Reviewed-on: https://chromium-review.googlesource.com/425332
* kevin: gru: Don't disable trackpad in tablet mode.Aseda Aboagye2016-12-181-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | Apparently, one does not simply remove power from the trackpad and restore it at will; the kernel needs to be involved and decide if the device needs to be fully reinitialized, or if it was supposed to keep some state. Therefore, let's not touch it except from startup and shutdown and let the higher parts of the stack make the necessary decisions. BUG=chrome-os-partner:60478 BRANCH=gru TEST=Boot in tablet mode and verify trackpad still works. TEST=Go from clamshell to tablet mode and verify trackpad still works in both modes. Change-Id: I7674c5516ce4d237b0d2a15fb94b47e6fbe3ba39 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/417066 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit dc135f4b3b25ccb9f074327554ae3a12d688533b) Reviewed-on: https://chromium-review.googlesource.com/421373 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Jongpil Jung <jongpil19.jung@samsung.com>
* kevin: Treat batteries in disconnect as not presentShawn Nematbakhsh2016-12-162-2/+11
| | | | | | | | | | | | | | | | | | For the purpose of determining whether we have enough energy to power-on the system, batteries in disconnect should be considered not present, because they do not provide VBAT until woken. BUG=chrome-os-partner:60380 BRANCH=gru TEST=Manual on kevin w/ BD99956A. Trigger battery disconnect, attach OEM charger, verify device is revived without brownout. Repeat 10x. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Iae3db9527c2f6a5b6483118e7bebba4b2005735d Reviewed-on: https://chromium-review.googlesource.com/420976 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 1722c48788c6fb871a5b79c7b487b4612dda1353) Reviewed-on: https://chromium-review.googlesource.com/421225
* pd: Limit input current to 500mA on PD voltage transitionShawn Nematbakhsh2016-12-024-3/+47
| | | | | | | | | | | | | | | Upon requesting a PD power contract at a new voltage, keep the input current limit at 500mA until PD_RDY is received. BUG=b:30744563,chrome-os-partner:59311,chrome-os-partner:44340 BRANCH=ryu, gru, glados TEST=Manual on kevin, set ilim to 5V through `chglim` console command, attach zinger. Set ilim to 20V through `chglim`, verify that ilim goes from 3A to 500mA to 3A. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I452f183cfb958780e336a9f99dc6398356de17a0 Reviewed-on: https://chromium-review.googlesource.com/416289
* npcx: flash: Set SRP0 when enabling RO write protectionShawn Nematbakhsh2016-12-011-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | HW protection can be overridden unless SRP0 is set with WP asserted. BUG=chrome-os-partner:60029 BRANCH=gru TEST=Manual on kevin, deassert WP: > flashrom -p ec --wp-enable > flashrom -p ec --wp-disable SUCCESS assert WP: > flashrom -p ec --wp-enable > flashrom -p ec --wp-disable FAILED: RO_AT_BOOT is not clear. Change-Id: I67c1ec086704cd5be4518b6dc3dc87146cbd2d99 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/415465 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 3025b40df5c7744dde44336cc11f520667a92268) Reviewed-on: https://chromium-review.googlesource.com/415546 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* kevin: Don't override charge profile if battery is in ship modeShawn Nematbakhsh2016-11-301-7/+8
| | | | | | | | | | | | | | | | | | | | | We must apply voltage / current to the battery to pull it out of disconnect / ship mode, so don't force discharge if the battery happens to be fully charged and in ship mode. BUG=chrome-os-partner:60380 BRANCH=gru TEST=Manual on kevin, trigger battery disconnect, re-attach AC, verify system boots cleanly. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I68b4ca21a91cce6b2640578dbd7a94412c418f12 Reviewed-on: https://chromium-review.googlesource.com/414610 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit cc5563cf8622f185c6a26699651654a804555ffd) Reviewed-on: https://chromium-review.googlesource.com/415386 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org>
* npcx: flash: Use common code for SPI flash protect reg translationShawn Nematbakhsh2016-11-2210-156/+18
| | | | | | | | | | | | | | | | | | Common code is more flexible and supports more parts, so delete the npcx-only register translation code. BUG=chrome-os-partner:60029 BRANCH=gru TEST=Manual on gru, run 'flashrom -p ec --wp-enable' and check that 0x28 gets written to SR1, which matches our desired 'protect botton 128KB', according to the datasheet. Also run 'flashrom -p ec --erase' then read back EC SPI contents, verify ROM is erased except for first 128KB region. Change-Id: I526401997ff7ec77f2a6047a4a9af74a671ed69a Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/413228 Reviewed-by: David Hendricks <dhendrix@chromium.org>
* spi_flash: Add GD25LQ40 write-protect supportDavid Hendricks2016-11-222-4/+8
| | | | | | | | | | | | | | | | | | This adds support for the GD25LQ40 NOR flash chip which is identical to W25Q40 for the purposes of write-protection support for the ranges that we care about. BUG=chrome-os-partner:57015 BRANCH=none TEST=Verify protect regs set appropriately with subsequent commit. Change-Id: I09ad02e04fab4c539b9558180d73bf6c31da6aed Signed-off-by: David Hendricks <dhendrix@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/413227 Tested-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* npcx: flash: Fix SR reg reads during UMA lockShawn Nematbakhsh2016-11-221-33/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If UMA is locked, read and write access to SR* regs will fail, and we'll be unable to determine or change our write protect state. Save our SR regs before enabling UMA lock, and bring down UMA lock for a brief period when writing SR regs. BUG=chrome-os-partner:60029 BRANCH=gru TEST=Manual on kevin with SW sync enabled. flashrom -p ec --wp-enable -> verify success, check flags: Flags: wp_gpio_asserted ro_at_boot ro_now Reboot host, check flags: Flags: wp_gpio_asserted ro_at_boot ro_now all_now Verify flashrom -p ec --wp-status shows protected, and flashrom -p ec --wp-disable fails. Also verify same state after EC reset. Boot into recovery mode, check flags: Flags: wp_gpio_asserted ro_at_boot ro_now Remove WP screw, reboot EC, check flags: Flags: ro_at_boot ro_now Verify flashrom WP status shows protected, and flashrom WP disable succeeds and clears all flags. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I17e32f7305600183e7fcb87f69a3feb88978f94e Reviewed-on: https://chromium-review.googlesource.com/412977
* kevin: Disable MPU lockingShawn Nematbakhsh2016-11-221-0/+2
| | | | | | | | | | | | | | Our RAM / code regions aren't a power of 2, so we cannot program MPU to precisely protect the regions we desire. BUG=chrome-os-partner:57789 BRANCH=gru TEST=`make buildall -j`, then burn + boot to OS. Change-Id: I363575426ec42cbb9a0e23107baf5839f4ac684a Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/413584 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* npcx: hwtimer: Add consecutive reading for ITCNT32Mulin Chao2016-11-221-5/+15
| | | | | | | | | | | | | | | | | | | | | The mux for selecting source clock of ITIM will introduce a delay and have a chance to make ITIM's source clock and core clock are asynchronous. We need consecutive reading for ITCNT32 no matter source clock is APB2 or 32k. Modified sources: 1. hwtimer.c: Add consecutive reading for ITCNT32 BRANCH=none BUG=chrome-os-partner:34346,chrome-os-partner:59240 TEST=No time stamp symptoms occur on wheatley for 30 hours. Change-Id: I8b54e93b320e3ea74fc3d6ea13f0d178f9c449cd Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-on: https://chromium-review.googlesource.com/413098 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
* clock: Fix clock_wait_cycles() asmShawn Nematbakhsh2016-11-183-6/+6
| | | | | | | | | | | | | | | | | | The 'cycles' register will be clobbered by our macro, so it must be specified as an output operand that may also be used as input. BUG=chrome-os-partner:60000 BRANCH=gru,strago,glados TEST=Build + burn wheatley, verify alignment exception is not encountered on boot. Also verify produced assembly is still correct: 100a89a6: 2303 movs r3, #3 100a89a8: 3b01 subs r3, #1 100a89aa: d1fd bne.n 100a89a8 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I1be03a006967aed6970dbac5d98a19a31e0b7d49 Reviewed-on: https://chromium-review.googlesource.com/412349
* kevin: discharge when battery is near fullWonjoon Lee2016-11-184-12/+27
| | | | | | | | | | | | | | | | | For device that are using ceramic caps, when battery is full, discharge to 97% and then charge again until the battery is full. This should also help us meet CEC energy spec. BUG=chrome-os-partner:56255 BRANCH=gru TEST=Manual on kevin, insert charger with battery at 97%, verify battery does charge until 100%, and then discharge down to 96% and verify battery charges. Charge to 100% again. Change-Id: I5099cbbb1228823cc611c456e7e3d8311f1c94d6 Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/408735 Reviewed-by: Shawn N <shawnn@chromium.org>
* tcpm: fusb302: Mask BC_LVL interrupt when PD is enabledShawn Nematbakhsh2016-11-171-0/+17
| | | | | | | | | | | | | | | | | | Avoid needless alerts due to CC lines toggling during PD communication. BUG=chrome-os-partner:58298 BRANCH=gru TEST=Manual on kevin. Verify PD communication with Apple USB-C dongle is functional. Verify Source caps are sent with 100ms-200ms delay. Verify Rp change on Donette is still detected. Signed-off-by; Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: I83fcd1b3235969c8462d23c5159564db2c6a8392 Reviewed-on: https://chromium-review.googlesource.com/409693 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
* kionix: Add reading whoami to be sure device has booted.Gwendal Grignou2016-11-172-1/+28
| | | | | | | | | | | | | | | | | | From the specs, "KX022-1020 Specifications Rev4.0", the power up time can be as long as 10ms. Add a loop to be sure the device is responsive before initalizing it. BRANCH=reef,glados,oak,veyron,cyan BUG=none TEST=After putting a KX022 accel as first in the list, it would not initialize properly. After adding the loop, it initializes properly. Reviewed-on: https://chromium-review.googlesource.com/394750 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 09f90a3b8f0f48d11b3653ad2af1d61c29691a48) Change-Id: I3194a5d1deb0c2eb2a04a459aab3b4269e479af3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/411955
* CHERRY-PICK:Makefile.rules: Add targets to see file size differencesMartin Roth2016-11-172-0/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since the ec binaries are so tight on space, it would be nice to be able to see just how much changes are affecting the size. This allows users to easily do before/after comparisons. Sample output: build/sweetberry/RW/ec.RW.flat shrank by 44 bytes: (43828 to 43784) build/twinkie/RO/ec.RO.flat shrank by 64 bytes: (46312 to 46248) build/twinkie/RW/ec.RW.flat shrank by 40 bytes: (45900 to 45860) build/wheatley/RW/ec.RW.flat shrank by 40 bytes: (102692 to 102652) Compared 156 of 156 files. 81 files changed. Total size change: -3100 bytes. Average size change: -38 bytes. BRANCH=none BUG=none TEST=make clobber buildall -j; make savesizes [change some code that changes file sizes] make clobber buildall -j ; make newsizes [Shows size differences] ORIG-Change-Id: I48b440063eb6eb6c00900af3d0dfa075be6f9ec7 Signed-off-by: Martin Roth <martinroth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/410860 Reviewed-by: Patrick Georgi <pgeorgi@chromium.org> Change-Id: Ic37fe6dec3a43185da9dd93a9b77a608c4b69842 Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/411583 Reviewed-by: Shawn N <shawnn@chromium.org>
* Bob: Fix GPIOB6 settigjames_chao2016-11-151-1/+0
| | | | | | | | | | | | | | | | | | | The GPB6 on Bob is used as POWER_LED (gpio, high active) but the previous commit set GPB6 twice Line 115: GPIO(POWER_LED, PIN(B, 6), GPIO_OUT_LOW) Line 124: GPIO(GPIOB6_NC, PIN(B, 6), GPIO_INPUT | GPIO_PULL_UP) The second setting is incorrect, so delete it. BUG=none BRANCH=firmware-gru-8785.B TEST=make buildall Change-Id: I15cb774b15f5394353b17f58b7160fec564428a2 Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/411580 Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* kevin: keep the pull-up on the USB load switch enableVincent Palatin2016-11-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | Keep the pull-up enabled all the time on the GPIO connected to the load switch enable pin. This is not ideal but the pull-up bit is no-op in output mode on npcx and this avoids glitching the enable when transition from the 3A mode (output strong one) to the 1.5A mode (input with a weak pull-up). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=gru BUG=chrome-os-partner:59679 TEST=on Kevin, plug a USB key on port 0, then plug another USB device on port 1 and see that the key on port 0 is no longer disconnecting/re-enumerating. Change-Id: I075dacb1549239f1b60763659dac006f5b838e2c Reviewed-on: https://chromium-review.googlesource.com/411220 Reviewed-by: Shawn N <shawnn@chromium.org> Tested-by: David Schneider <dnschneid@chromium.org> Commit-Queue: Vincent Palatin <vpalatin@chromium.org>
* motion_lid: Make tablet mode great (again).Aseda Aboagye2016-11-141-7/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chrome seems to pay attention to the tablet mode switch reported by the EC. However, for some devices that don't actually have a switch and use the lid angle as a "virtual" switch, it's possible for invalid tablet mode change events to be reported. This is because a single reading could flip the switch. This commit adds some debouncing to the tablet mode event changes. Instead of having a single event be able to change the tablet mode switch, we will now perform TABLET_MODE_DEBOUNCE_COUNT number of calculations of the new tablet mode value. If those calculations all agree, then we'll flip the switch. This should help mitigate false tablet mode change events caused by spurious forces. BUG=chrome-os-partner:59203 BUG=chrome-os-partner:59480 BRANCH=gru TEST=flash kevin; open lid to pi/2 rad; rotate device counter-clockwise pi/2 rad; shake device and verify that tablet mode doesn't change easily. TEST=verify that tablet mode still works. Change-Id: Id020f7db28e93e53b276b3f0d28a40251f035f0b Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/410226 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
* gru: fix the power led colorphilipchen2016-11-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | In the current implementation, it's hard to tell when led turns from amber to green. BUG=chrome-os-partner:57079 BRANCH=None TEST=Verify LED is green when charging w/ nearly full battery. Also verify LED control host commands work as expected: ectool led battery green=1 // green ectool led battery amber=1 // amber ectool led battery red=1 // red ectool led battery red=0 // off Change-Id: Ie18162fd1608a0548e25472faeca026f1995fc8d Reviewed-on: https://chromium-review.googlesource.com/406471 Commit-Ready: Philip Chen <philipchen@chromium.org> Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit 6b1f11d6b9876bebcfc53f5b33794c9e6cb89939) Reviewed-on: https://chromium-review.googlesource.com/410941 Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org>
* charge_manager: send EC_HOST_EVENT_PD_MCU at the end of refreshJeffy Chen2016-11-101-2/+6
| | | | | | | | | | | | | | | | | When kernel get EC_HOST_EVENT_PD_MCU event and query power state, we may not done refresh here. Delay EC_HOST_EVENT_PD_MCU event to avoid this race. BUG=chrome-os-partner:59499 BRANCH=gru TEST=Manual on kevin, check power state correct after unplug charger Change-Id: Ib88acf5a39c2780c6e40144ccebfba17cf84f77c Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/409713 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Douglas Anderson <dianders@chromium.org> Tested-by: Douglas Anderson <dianders@chromium.org>
* Bob: Config board Bobjames_chao2016-11-107-281/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1.battery info: use gru 2.PWM: use gru PWM_CH_DISPLIGHT 3.board version: replace kevin string to bob 4.sensors: 1) use gru matrix 2) Bob don't have BMA255 5.usb: Bob's usb don't support charger, remove GPIO84/GPIOC3 6.pd: Bob is 33w system, 15v/2.2a 7.led: set LED_STD_POLICY 8.GPIOs 1) GPIO36: LID_360_L->BOARD_DET (identify bob or other project use same ec firmware) 2) GPIOB6: PWR_LED (high active) 3) GPIO44: BAT_LED_GREEN (low active & open drain) 4) GPIO80: BAT_LED_RED (low active & open drain) 5) GPIO84: NC 6) GPIOC3: NC BUG=chrome-os-partner:59454 BRANCH=firmware-gru-8785.B TEST=make buildall Change-Id: Icec2fb88bee64962242843a4b9441e49d2854c6b Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/407744 Reviewed-by: Shawn N <shawnn@chromium.org>
* Bob: Create initial boardjames_chao2016-11-109-0/+1872
| | | | | | | | | | | | | | Create initial bob EC code, by copy from gru. Just replace all 'gru' to 'bob' BUG=chrome-os-partner:59454 BRANCH=firmware-gru-8785.B TEST=make buildall Change-Id: I71672ebc93cda94a8899a05f8baed46084622e3b Signed-off-by: james_chao <james_chao@asus.com> Reviewed-on: https://chromium-review.googlesource.com/408003 Reviewed-by: Shawn N <shawnn@chromium.org>
* npcx: hwtimer: Fix 'slow' timer count just before overflowShawn Nematbakhsh2016-11-093-5/+12
| | | | | | | | | | | | | | | | | | If our 32-bit usec timer is close to overflow, we may deep sleep several times in succession without making any adjustment to our count, causing deadlines on the other side (eg. HOOK_TICK expiration) to be reached much slower than expected. Avoid this by not entering deep sleep if our timer is about to overflow. This will result in a <= HOOK_TICK_INTERVAL (200ms interval) period of not entering deep sleep, every ~4300 seconds. BUG=chrome-os-partner:59240 BRANCH=gru TEST=Verify 3x kevin units survive 16 hours in S3 without EC watchdog. Change-Id: I2126458be8820f78212e19c2bb79242ff1194f6f Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409550 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* mkbp: Always keep memmap host event mask up-to-dateShawn Nematbakhsh2016-11-051-0/+1
| | | | | | | | | | | | | | Keep the memmap copy of the host event mask up-to-date, in case it ever gets used. BUG=chrome-os-partner:59241 BRANCH=gru TEST=None Change-Id: I482a3344242ff0e744292ffd2ad8eff3a4628c74 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/407124 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* npcx: Fix hwtimersShawn Nematbakhsh2016-11-052-6/+21
| | | | | | | | | | | | | | | | | | | | | - Wait for ITEN bit to be set / cleared, since writing this bit just sets a 'request'. - Ensure ITIM_EVENT_NO reg is set with minimum value 1, per the datasheet. - Don't dsleep if our wake event is in the past (eg. wake event will occur any time now) BUG=chrome-os-partner:59240 BRANCH=gru TEST=Manual on kevin, verify that dsleep period never exceeds expected wait period. Also verify that EC watchdog doesn't occur after 5 hours in S3. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Iedb2723c3f12b74dea66082b1d8b8ce1b6e7d945 Reviewed-on: https://chromium-review.googlesource.com/408219 Reviewed-by: Mulin Chao <mlchao@nuvoton.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* elm / kevin / oak: Don't wake from S3 on lid closeShawn Nematbakhsh2016-11-053-6/+3
| | | | | | | | | | BUG=chrome-os-partner:59256 BRANCH=gru TEST=None Change-Id: I8e41dc131343e7639850364db27a3ff926164fba Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/407337
* kevin: Add Sensor in S3, disable keyboard wakeup in tablet mode.Gwendal Grignou2016-11-043-19/+30
| | | | | | | | | | | | | | | | | | | | | | | Let sensor be powered on in S3. It is useful for Android and if we want to disable keyboard wakeup based on lid angle. Allow EC to disable touchpad and not send keyboard events when lid angle is greater than 180. BUG=chrome-os-partner:57510,chromium:620633 BRANCH=gru TEST=In S3, check the sensors are readable. Check that when in S3 and lid angle is < 180 EC sends keyboard events. Check that when in S3 and lid angle is > 180 EC does not send keyboard events. Change-Id: I4e7959ed37bc5dfdf9c105ecae94c314b253d77f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/406739 Commit-Ready: Gwendal Grignou <gwendal@google.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit cbae8f9b321f33734a34cb85c82636bbfa7663ee) Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/407779
* mkbp_event: Properly queue events during host sleepShawn Nematbakhsh2016-11-043-20/+19
| | | | | | | | | | | | | | | | | | | | Don't queue non-wake events, and ensure wake events (and all subsequent events) always get queued. BUG=chrome-os-partner:59248, chrome-os-partner:59336 BRANCH=gru TEST=Manual on kevin, go to suspend, press volume keys dozens of times, press 'shift', verify device wakes. Place cursor on URL bar, go to suspend, type "google" quickly, verify device wakes and "google" appears on URL bar. Go to suspend, press 'VolUp' key 5 times, press keyboard, verify device wakes and no volume meter is seen on display. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ibe761187fbcefd686776a512786550970a6fc067 Reviewed-on: https://chromium-review.googlesource.com/405717 Commit-Queue: Douglas Anderson <dianders@chromium.org> Tested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
* kevin: Set BMI160 interruptGwendal Grignou2016-11-041-0/+3
| | | | | | | | | | | | | | | Interrupt from BMI160 was not set up. BRANCH=gru BUG=none TEST=compile Change-Id: I7d4bdb0b83ffb5de25c40e2c11b6e53b55863dcd Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404914 Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit c457822a811684f6892010011922d67aadc4933b) Reviewed-on: https://chromium-review.googlesource.com/407074
* mkbp_event: Don't use memmap'd host event maskShawn Nematbakhsh2016-11-041-3/+1
| | | | | | | | | | | | | | | | | | | Previously the memmap'd host event mask copy wasn't always updated. Be consistent with other mkbp code and call host_get_event() to get our current mask. BUG=chrome-os-partner:59241 BRANCH=gru TEST=Manual on kevin, close lid to suspend, press volume keys, verify device doesn't wake. Open lid, verify device wakes. Run 'powerd_dbus_suspend', press volume keys, verify device doesn't wake. Press keyboard key, verify device wakes. Change-Id: I3de49efa1ebc53a9c56bed57007c48356c7e97bb Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/406547 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: bmi160: Autocalibrate Accelerometer properly.Gwendal Grignou2016-11-021-1/+6
| | | | | | | | | | | | | | | | | Take into account the rotation matrix to do calibration. In particular the Z axis: if board is upside down, we need to use MINUS_1G instead of PLUS_1G when setting online calibration. BRANCH=kevin BUG=none TEST=Before, calibration would not work on the Z axis. Change-Id: Ifaec331aac40a4be0e34fcab5dd3752d2d59b91f Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/405854 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit cd30d638ab60e5d1821e0fff22051f482cf7a5a7) Reviewed-on: https://chromium-review.googlesource.com/406574
* kevin: set accurate current limit on USB load switchVincent Palatin2016-10-318-13/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When sourcing current on the type-C port, set the OCP limit on the VBUS load switch according to current dynamic capability. (3.0A when only one port is a power source, 1.5A else) Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=gru BUG=chrome-os-partner:56110 TEST=manual: connect Caroline to Kevin with Twinkie in between, ask Caroline to sink current through the UI. without anything else connected on Kevin, see 3A flowing when measuring with Twinkie ('tw vbus'), plug a dangling C-to-A receptacle dongle on the other Kevin port and see 1.5A flowing through Twinkie. Force the input current limit on Caroline to 3.0A and see Kevin cutting VBUS. Reviewed-on: https://chromium-review.googlesource.com/403869 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> (cherry picked from commit cf7ff32b92275f9d4cce4bc3bcaa7d8890b0cb2e) Change-Id: Ib879b1ed720b20aa702c5f3643948ba0575d1193 Reviewed-on: https://chromium-review.googlesource.com/405407 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
* kevin: Remove PD related TODOs.Aseda Aboagye2016-10-282-2/+0
| | | | | | | | | | | | | | | | | | | It was confirmed that these values were correct. BUG=chrome-os-partner:59074 BUG=chrome-os-partner:59075 BRANCH=gru TEST=make -j buildall Change-Id: I8c63d563515c1fdcbd9f83203c193ba09f8f3447 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/404709 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Shawn N <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404909 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
* kevin / gru: Remove accel-related console commands for RAM savingsShawn Nematbakhsh2016-10-281-2/+0
| | | | | | | | | | | BUG=None TEST=`make buildall -j` BRANCH=gru Change-Id: I1de2cb8d34ffdfb1b9192b3a9bd3ef24d8b8877e Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404328 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* kevin / gru: Add custom charge profileShawn Nematbakhsh2016-10-272-11/+21
| | | | | | | | | | | | | | | | | | | | - Stop charging when thermal limits are violated. - Don't start charging if battery percent is above 95% (but continue to charge if we're already charging). - Don't allow battery voltage to get too close (10mA) to BD9995X VBAT setting. If battery voltage exceeds VBAT then back boosting may occur. BUG=chrome-os-partner:56255 BRANCH=gru TEST=Manual on kevin, insert charger with battery at 97%, verify battery doesn't charge and reported current is 0. Discharge down to 95% and insert charger, verify battery charges. Charge to 100%, verify battery stops requesting current. Change-Id: Icc5641e88bfad7d9d8ad4b6840338541fe7ba9a8 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403483 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* i2c: Lock out i2c passthru except for desired portsShawn Nematbakhsh2016-10-265-6/+29
| | | | | | | | | | | | | | | | | Lock out all non-essential i2c passthru ports when system is protected. BUG=chrome-os-partner:58859 BRANCH=gru TEST='ectool i2cxfer 0 0 0 0' on locked system, verify that "ACCESS DENIED" is returned. Change-Id: If4119bbb319aa491d0e79a9ed80c94daa7950c2f Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403543 Tested-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Philip Chen <philipchen@chromium.org>
* power: rk3399: Decrease max. latency for aborted suspendShawn Nematbakhsh2016-10-261-20/+20
| | | | | | | | | | | | | Make several calls to msleep() rather than one single call. BUG=chrome-os-partner:58474 BRANCH=gru TEST=S/R stress test on kevin. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Icdc8f221c51519e0f2b95d273aa0523ea3a4eeee Reviewed-on: https://chromium-review.googlesource.com/401930 Reviewed-by: Douglas Anderson <dianders@chromium.org>
* power: rk3399: Adjust power-down sequencing delaysShawn Nematbakhsh2016-10-261-12/+10
| | | | | | | | | | | BUG=chrome-os-partner:58474 BRANCH=gru TEST=suspend_stress_test on kevin for 50 cycles. Change-Id: Ice721e04c6d4389520f40c4ca72f5bec0e1bdb5b Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/399992 Reviewed-by: Douglas Anderson <dianders@chromium.org>
* power: rk3399: turn off the center logic in s3Caesar Wang2016-10-261-5/+6
| | | | | | | | | | | | | | CQ-DEPEND=CL:386537, CL:401930 BUG=chrome-os-partner:54291 TEST=turn off the center-logic BRANCH=None Change-Id: I73577e15cc0a8474d8eb2ed1a48f5aba59e54c6a Signed-off-by: Caesar Wang <wxt@rock-chips.com> Reviewed-on: https://chromium-review.googlesource.com/397399 Reviewed-by: Douglas Anderson <dianders@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
* pd: Whitelist port after receiving IDENT responseShawn Nematbakhsh2016-10-261-0/+6
| | | | | | | | | | | | | | | | Making dual-role determination after receiving source caps is not sufficient, since we may not yet have identified the partner port. BUG=chrome-os-partner:56966 BRANCH=gru TEST=Attach 'old' Apple USB-C accessory to kevin, attach OEM charger to accessory, run 'pd X hard', verify device charges from port. Change-Id: I7333dd2c723e7245d30cf8a6cb1344e60073c063 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403118 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* npcx: flash: Remove tristate-related console commands for RAM savingsShawn Nematbakhsh2016-10-261-53/+0
| | | | | | | | | | | | | | These commands aren't useful for our project. BUG=None TEST=`make buildall -j` BRANCH=gru Change-Id: Id8f12d6aed0760fd5b80f1b621bc0461ab1ac671 Reviewed-on: https://chromium-review.googlesource.com/403117 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
* kevin / gru: Enable Try.SRCShawn Nematbakhsh2016-10-261-2/+1
| | | | | | | | | | | | | BUG=None TEST=Manual on kevin, attach Ryu and verify kevin always goes to source role initially. BRANCH=gru Change-Id: Ic8b138a4f6e7c651cd0834151354631885fb116d Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/403116 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* pd: fix contract negotiation with dynamic PDOsVincent Palatin2016-10-254-9/+19
| | | | | | | | | | | | | | | | | | | | | When the board is using dynamic source PDOs, we need to ensure that we are checking the incoming sink power request against the right set of PDOs else we might reject a valid request (e.g. with high-power source, we need to check against the 3.0A limit if we only have one port connected). Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=gru BUG=chrome-os-partner:56110 TEST=Connect Kevin to Caroline, ask Caroline to charge from the other side and see it negotiating successfully a 5V/3A contract. Change-Id: Ie1aa5746776be5946422bf07c08ae0f22faddd8c Reviewed-on: https://chromium-review.googlesource.com/402731 Reviewed-by: Shawn N <shawnn@chromium.org> Commit-Queue: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org>
* tcpm: fusb302: Fix BIST modeShawn Nematbakhsh2016-10-211-1/+14
| | | | | | | | | | | | | | Upon request, enter BIST mode 2 (alternating 1/0 output pattern) for 50ms. BUG=chrome-os-partner:58282 BRANCH=gru TEST=Verify compliance test runs on kevin. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ie284066eb2fb54d1c567b516670d8bd966dc9a30 Reviewed-on: https://chromium-review.googlesource.com/401700 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
* task: Don't propagate TASK_EVENT_TIMER between between waitsShawn Nematbakhsh2016-10-214-4/+16
| | | | | | | | | | | | | | | | In __wait_evt(), if a timer expiration occurs after we read event status, before the timer is canceled, then TASK_EVENT_TIMER will be propagated to the next task wait, likely leading to premature timeout. Prevent this by clearing TASK_EVENT_TIMER after canceling our timer. BUG=chrome-os-partner:58658 BRANCH=gru TEST=Manual on gru, run 'pd # hard' for 12 hours with charger attached, verify no TCPC I2C read errors occur. Change-Id: Iac2f05a768b4ef29f82e7c3eb899f4c7dd5c3744 Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/401503
* charger: maintain VBAT voltage as battery maximumWonjoon Lee2016-10-171-1/+10
| | | | | | | | | | | | | | | | | | Some charger IC need to keep charging voltage higher than NVDC. Whatever case charge_request(0, 0) means we need to set the voltage max on this charger. Assume charger driver will inhibit charging when its current is 0. BUG=chrome-os-partner:54248 BRANCH=gru TEST=Manual on kevin, high temperature chamber(60C), battery will require 0 voltage because of high temp, then check 'chgstate' vbat maintained at 8688 mV. Change-Id: I3b5835701c42a0cd861400ba921b3d3797152bbd Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/399878 Reviewed-by: Shawn N <shawnn@chromium.org>