summaryrefslogtreecommitdiff
path: root/board/grunt
Commit message (Collapse)AuthorAgeFilesLines
* led_pwm: support different pwm modulesTing Shen2019-12-271-3/+6
| | | | | | | | | | | | | | | | add enable() and set_duty() into struct pwm_led, to support PWMs other than the default one. BUG=b:135086465 TEST=verify led works on grunt BRANCH=none Change-Id: I1fd919d4990a145df272a7ee0b2072612f80cd44 Signed-off-by: Ting Shen <phoenixshen@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1963730 Reviewed-by: Eric Yilun Lin <yllin@chromium.org> Commit-Queue: Ting Shen <phoenixshen@chromium.org> Tested-by: Ting Shen <phoenixshen@chromium.org>
* Grunt/Treeya: Add ANX3447 variant for TCPC 0.Paul Ma2019-08-212-178/+2
| | | | | | | | | | | | | | | | | | | Merge common TCPC code into baseboard, and add choice of ANX3429 or ANX3447 for port 0 TCPC. Treeya uses ANX3447, all others use ANX3429. BUG=b:138744661 BRANCH=none TEST=build -j BOARD=treeya Change-Id: I66f84ae50be0b5fe80479dfdc699717427e4457c Signed-off-by: Paul Ma <magf@bitland.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1751302 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Tested-by: Martin Roth <martinroth@chromium.org> Commit-Queue: Martin Roth <martinroth@chromium.org>
* grunt: Wake from hibernate on EC resetEdward Hill2019-06-141-0/+7
| | | | | | | | | | | | | | | Add GPIO_EC_RST_ODL to hibernate_wake_pins[] for Aleena + Careena + Liara since the HW supports this as a PSL wake input. BUG=b:122833270 BRANCH=grunt TEST='dut-control cold_reset:on cold_reset:off' with ServoV2 Change-Id: I24a878be5e2c822b052a7d65b1964dcb6ed2ce94 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1658524 Reviewed-by: Raul E Rangel <rrangel@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* ec.tasklist: Consolidate duplicate commentsDaisuke Nojiri2019-04-081-14/+1
| | | | | | | | | | | | | | | | | | | | | | | It's simply a bad idea to describe a macro in multiple locations. It'll make it hard to change. It'll be difficult to keep all locations in sync. This patch replaces the comment duplicated in all ec.tasklist with a pointer to the CONFIG_TASK_LIST definition. The macro will be described in a single place (just like all/most other macros). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: Id658b9d68e742e4334c692b804d9c98c8de21313 Reviewed-on: https://chromium-review.googlesource.com/1551579 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* motion: Define macros for custom eventsGwendal Grignou2019-03-201-1/+2
| | | | | | | | | | | | | | Define macros to define custom events used by sensor interrupt handlers. Remove CONFIG_ for activity events. BUG=none BRANCH=none TEST=compile, sensors work on eve. Change-Id: I08ef6ed2a004466ebc5f7650d6952a150b9de713 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1272189 Reviewed-by: Jett Rink <jettrink@chromium.org>
* aleena: Enable GPIO-based MKBP event notificationEdward Hill2019-02-121-0/+2
| | | | | | | | | | | | | | Send MKBP events (for sensor data) over GPIO instead of host event. BUG=b:123750725 BRANCH=grunt TEST=MKBP events still received Change-Id: Ie1b02bbb8df44ade5ec6f1a4ba5dc4c5142e9f39 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1452936 Reviewed-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* USB PD: PPC: Add overcurrent handling.Aseda Aboagye2019-01-171-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Type-C Power Path Controllers provide overcurrent protection. This commit adds support into the USB PD task for overcurrent events while we are in source role. The USB PD 3.0 spec recommends that ports issue a hard reset when an overcurrent condition occurs on a port. Additionally, we'll allow a source port to overcurrent 3 times before latching off VBUS from the port entirely. The source path will be re-enabled after ~1s after each overcurrent event. BUG=b:69935262,b:114680657 BRANCH=None TEST=Boot to ChromeOS in grabbiter. No overcurrent events reported when the sink is drawing <= 3.20 A. Overcurrent events are reported when the sink is drawing > 3.25 A. After 3 reports, the port is latched off and power delivery is stopped. The port is re-enabled only after the sink is disconnected. Also when the sink is drawing current at 3.24 A, there is one report of overcurrent. The port gets disabled in response to that event. But the port is re-enabled after 1 second since overcurrent event is reported only once. After the port is re-enabled, the sink is able to draw the set current. When the overcurrent event is reported, I can see in the kernel logs that the overcurrent condition is detected by the kernel. EC Logs: [3391.984462 C1: PPC detected Vbus overcurrent!] [3391.984953 C1: overcurrent!] [3392.044935 C1: PPC detected Vbus overcurrent!] [3392.045425 C1: overcurrent!] [3392.061404 C1: PPC detected Vbus overcurrent!] [3392.061894 C1: overcurrent!] [3392.062142 C1: OC event limit reached! Source path disabled until physical disconnect.] [3392.077226 C1: PPC detected Vbus overcurrent!] [3392.077532 C1: overcurrent!] [3392.077891 C1: OC event limit reached! Source path disabled until physical disconnect.] [3392.092660 C1: PPC detected Vbus overcurrent!] [3392.092966 C1: overcurrent!] [3392.093213 C1: OC event limit reached! Source path disabled until physical disconnect.] Kernel Logs: [ 3356.560456] usb usb2-port1: over-current condition [ 3356.768434] usb usb2-port2: over-current condition [ 3356.976446] usb usb2-port4: over-current condition [ 3357.184441] usb usb2-port5: over-current condition [ 3357.392445] usb usb2-port6: over-current condition Change-Id: Ib070f261e98264cd88725ebce7d10e0798267e3b Signed-off-by: Aseda Aboagye <aaboagye@google.com> Signed-off-by: Karthikeyan Ramasubramanian <kramasub@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1286300 Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/807633 Commit-Ready: Karthikeyan Ramasubramanian <kramasub@chromium.org> Tested-by: Karthikeyan Ramasubramanian <kramasub@chromium.org> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* grunt: Enable PWM_CONFIG_DSLEEP for keyboard backlightEdward Hill2018-12-061-1/+1
| | | | | | | | | | | | | | | | Enabling CONFIG_LOW_POWER_S0 (CL:1347014) caused the keyboard backlight to flash. Fix this by setting the PWM_CONFIG_DSLEEP flag. BUG=b:120400520,b:120447176 BRANCH=grunt TEST=Liara keyboard backlight no longer flashes Change-Id: I2808c40bc3f833acebd0246992f3763dab76a752 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1363673 Commit-Ready: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* aleena/kasumi: Add support for motion sensorsEdward Hill2018-12-051-2/+1
| | | | | | | | | | | | | | | | | | Adjust Grunt baseboard to allow for per-sku support for motion sensors. Use this to enable motion sensors for SKU 82 (Kasumi360). Only enable the interrupt if the sensor is present. BUG=b:119795894 BRANCH=grunt TEST=Kasumi360 `ectool motionsense lid_angle` shows correct angles. Change-Id: Icb34359d7ac4cd894776e134c2c1fb7032741f03 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1361987 Tested-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-by: Ryan Zhang <ryan.zhang@quanta.corp-partner.google.com> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Diana Z <dzigterman@chromium.org>
* motion_lid: Use CONFIG_TABLET_MODEFurquan Shaikh2018-11-291-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | This change updates motion_lid driver to use CONFIG_TABLET_MODE to decide if device requires reporting of tablet mode. This basically makes the config options CONFIG_LID_ANGLE_INVALID_CHECK and CONFIG_LID_ANGLE_TABLET_MODE obsolete. Now that EC will always report tablet mode aligned with Chrome (at 180 degree), any device that supports tablet mode and uses motion lid driver will require this by default and should not require boards to individually select any special config options. Thus, it also gets rid of unused CONFIG_LID_ANGLE_TABLET_MODE and CONFIG_LID_ANGLE_INVALID_CHECK. BUG=b:120050761 BRANCH=octopus TEST=make -j buildall Change-Id: Ib73af66ca1c17d4033cf54f0b4b86bf41793f3a3 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1350470 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt: Raise some task sizesJonathan Brandmeyer2018-10-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A rough early (and therefore liberal) analysis of grunt task stacks shows that some of them will overrun on some infrequently-executed debugging statements. Raise those task sizes to reduce the risk of an overflow. On Careena: Task: HOOKS, Max size: 320 (96 + 224), Allocated size: 800 Task: USB_CHG_P0, Max size: 548 (324 + 224), Allocated size: 672 Task: USB_CHG_P1, Max size: 548 (324 + 224), Allocated size: 672 Task: CHARGER, Max size: 844 (620 + 224), Allocated size: 928 Task: MOTIONSENSE, Max size: 588 (364 + 224), Allocated size: 928 Task: CHIPSET, Max size: 812 (588 + 224), Allocated size: 928 Task: KEYPROTO, Max size: 516 (292 + 224), Allocated size: 672 Task: PDCMD, Max size: 344 (120 + 224), Allocated size: 800 Task: HOSTCMD, Max size: 524 (300 + 224), Allocated size: 800 Task: CONSOLE, Max size: 484 (260 + 224), Allocated size: 928 Task: POWERBTN, Max size: 812 (588 + 224), Allocated size: 928 Task: KEYSCAN, Max size: 556 (332 + 224), Allocated size: 672 Task: PD_C0, Max size: 820 (596 + 224), Allocated size: 928 Task: PD_C1, Max size: 820 (596 + 224), Allocated size: 928 Task: PD_INT_C0, Max size: 296 (72 + 224), Allocated size: 672 Task: PD_INT_C1, Max size: 296 (72 + 224), Allocated size: 672 Note that '224' is conservative right now with CONFIG_FPU cleared on Grunt. BUG=b:116610278 TEST=buildall and analyzestack BRANCH=grunt Change-Id: Ibf721acc3250aa1d1195546e943031c5c8617b95 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1262101
* grunt: Add minimal analyzestack configurationsJonathan Brandmeyer2018-10-051-0/+1
| | | | | | | | | | | | | | | | | Considerably more work is needed to support the various driver indirections that Grunt is using. This is a 'liberal' analysis, in the sense that it is failing to include some driver paths in its stack consumption analysis. BRANCH=grunt BUG=b:116610278 TEST=make BOARD=grunt analyzestack. Change-Id: I6ff034935a749049b1ce6b544ea627b1772c7a80 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1262100 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* careena, liara, aleena: Remove motion sensing supportJonathan Brandmeyer2018-10-041-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | These members of the grunt family do not include any motion sensors. Remove them entirely, both to save space and to disable some factory tests. build/aleena/RW/space_free_flash grew by 12716 bytes: (62400 to 75116) build/aleena/RW/space_free_ram grew by 9888 bytes: (30272 to 40160) build/careena/RW/space_free_flash grew by 12864 bytes: (61664 to 74528) build/careena/RW/space_free_ram grew by 9856 bytes: (30304 to 40160) build/liara/RW/space_free_flash grew by 12724 bytes: (61364 to 74088) build/liara/RW/space_free_ram grew by 9856 bytes: (30272 to 40128) BRANCH=grunt BUG=b:115649135 TEST=boot Careena. Observe that `ectool motionsense` returns an INVALID COMMAND error, and that the EC console shows no attempt is made to communicate with the sensors. Change-Id: I322978fc80e36b999e77f9e3d54b175c6814fdcf Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1262099 Reviewed-by: Edward Hill <ecgh@chromium.org>
* grunt: Move KSI03 HW bug work around out of baseboardEdward Hill2018-10-041-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | CONFIG_KEYBOARD_REFRESH_ROW3 and CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3 were needed to work around a KSI03 bug on Grunt HW. The HW has been fixed for Careena and later, so move these out of baseboard. Grunt enter recovery (short power): [0.045400 KB init state: -- 02 08 -- -- -- -- -- -- -- -- -- --] Grunt enter recovery (hold power): [0.045387 KB init state: 08 0a 08 08 08 -- 08 -- 08 08 -- 08 08] Careena enter recovery (short power): [0.077781 KB init state: -- 02 -- -- -- -- -- -- -- -- -- -- --] Careena enter recovery (hold power): [0.046569 KB init state: -- 02 -- -- -- -- -- -- -- -- -- -- --] BUG=b:79758966 BRANCH=grunt TEST=Esc+Refresh+Power gives recovery screen on Careena Change-Id: I2660385c2f77ff84ac6fb71b8ae6a3569895ec2b Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1257643 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt: Remove no longer needed GPIO_EN_PP5000Edward Hill2018-10-021-3/+0
| | | | | | | | | | | | | | | The BQ24392 driver was renamed to MAX14637 (CL:1250031) and no longer requires GPIO_EN_PP5000 to be defined (CL:1250032), so this can be removed from grunt-family gpio.inc. BUG=none BRANCH=grunt TEST=make -j buildall Change-Id: I186ece073e544760d487489f874659226c820bd8 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1257644 Reviewed-by: Scott Collyer <scollyer@chromium.org>
* bc12: rename bq24392 driver to max14637Scott Collyer2018-10-021-1/+0
| | | | | | | | | | | | | | | | | | | | The MAX14637 BC 1.2 USB charger detection chip is functionally similar to the bq24392 and can use the same driver. Rather than have 2 copies of the same driver, or a generic named driver than can be used for both chips, rename the existing bq24392 driver to max14637 as that's the BC 1.2 chip that our current designs are using. BUG=b:113267982 BRANCH=none TEST=make -j buildall Change-Id: I03cfb4918513d756c2a41341001a8162652a29b6 Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/1250031 Commit-Ready: Scott Collyer <scollyer@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt family: Clear CONFIG_SYSTEM_UNLOCKEDJonathan Brandmeyer2018-09-271-2/+0
| | | | | | | | | | | | | | | | | | | Some factory tests are evaluating behavior that is sensitive to RO firmware behaving like a locked system image. Caveat: EC engineers will need to manually `sysjump rw` or use flashrom to update the entire system firmware image as described in the grunt care and feeding guide. TEST=buildall; flash and boot a Careena pre-release system. BRANCH=grunt BUG=b:114686468 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: Ida253bd9e0197a4a70abed3f3670b720fa0e33bb Reviewed-on: https://chromium-review.googlesource.com/1246268 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* grunt: Use higher priority TCPC interrupt tasks.Jonathan Brandmeyer2018-09-072-17/+3
| | | | | | | | | | | | | | | | | | See also go/usb-pd-slow-response-time. Lift tcpc_alert_event interrupt handler to baseboard.c to reduce duplication. BUG=b:112848644, b:111909282 BRANCH=none TEST=Observe response time after SrcCap to Sink Request is 15ms on Careena and Grunt hardware after forcing a sysjump. Repeat test on Careena Port 0 with the DB disconnected (containing Port 1), also 15ms. Change-Id: I501bd86d84ba84eea0a705731e59e2431fc9a2ac Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1194669 Commit-Ready: Jett Rink <jettrink@chromium.org> Tested-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt: Remove support for board version 0Edward Hill2018-08-022-42/+12
| | | | | | | | | | | | | | We no longer need to support both version 0 and 2. BUG=b:74538637 BRANCH=none TEST=build Change-Id: I37eb7adfd2e9e1f50cb30f489c593bfd00b220d9 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1159722 Reviewed-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org>
* grunt family: Provide pu/pd for port 1 BC1.2Jonathan Brandmeyer2018-07-311-2/+2
| | | | | | | | | | | | | | | | | | | Port 1 is provided by a daughterboard. In the event that the daughterboard is disconnected, these pins are floating. Pull them in the appropriate direction for their logic when the board is disconnected. BUG=b:111942717 BRANCH=none TEST=make -j buildall; Test startup on Careena hardware both with and without port 1 connected to the mainboard. Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: Ica06ea16c2c76c624c542ba9b803197a4fd852bd Reviewed-on: https://chromium-review.googlesource.com/1155713 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org>
* grunt, careena: Clean up GPIO alternate functions.Jonathan Brandmeyer2018-07-131-13/+13
| | | | | | | | | | | | | | | | The NPCX only supports two modes per pin: Peripheral function or GPIO. The chip and its driver do not support alternate peripheral functions. TEST=buildall -j BRANCH=none BUG=b:79686781 Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: Ib5d7ba81b5224ed9c121887d664dac659962b2c2 Reviewed-on: https://chromium-review.googlesource.com/1136942 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Grunt: Elide obsolete GPIO configuration.Jonathan Brandmeyer2018-07-131-1/+0
| | | | | | | | | | | | | BRANCH=none BUG=none TEST=make -j buildall Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Change-Id: I2beb407e39acd49755982587b8de6602b7e00f4e Reviewed-on: https://chromium-review.googlesource.com/1136712 Commit-Ready: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Tested-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* careena, grunt: Enable pullup for the lid switch.Jonathan Brandmeyer2018-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | In the case that the lid switch becomes loose/disconnected, default to the 'lid open' state by pulling up the GPIO. Grunt is not affected, but we want to demonstrate best practices for the grunt family with its configuration. BUG=b:110836185 BRANCH=none TEST=disconnected lid switch on careena and observed lid state remained open and stable. Reconnected lid switch and observed lid state followed physical lid position. Change-Id: I951594ed7f6d98cf1b5258a894d0b95b6ca98ecc Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1115859 Commit-Ready: Martin Roth <martinroth@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Martin Roth <martinroth@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* careena: Fix power-on with cut-off batteryEdward Hill2018-06-201-10/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove CONFIG_BATTERY_HW_PRESENT_CUSTOM, CONFIG_BATTERY_PRESENT_CUSTOM, and associated code in battery.c, and delay in board_tcpc_init. Add CONFIG_BATTERY_PRESENT_GPIO. This allows CONFIG_BATTERY_REVIVE_DISCONNECT to work correctly to revive a cut-off battery, using battery_get_disconnect_state(). Before this change, the call to battery_get_disconnect_state() in the main loop of charge_state_v2's charger_task would not be reached with cut-off battery, due to the earlier: "if (curr.batt.is_present == BP_NO) goto wait_for_it;" With this change, curr.batt.is_present changes to BP_YES based on the simple test of GPIO_EC_BATT_PRES_L. This allows charger_task to "try to wake battery", then call battery_get_disconnect_state() and "found battery in disconnect state". This succeeds in getting the battery out of the disconnect state. The delay in board_tcpc_init() is removed because TCPC init doesn't disturb the AC power supply. If it did, powering on with AC only (no battery) would fail. BUG=b:109894491 BRANCH=none TEST=these combinations on grunt and careena: grunt, unplug AC, cutoff battery, on AC plug: pass (AP boots) grunt, unplug AC, normal battery, on EC reboot: pass (AP boots) grunt, unplug AC, unplug battery, on AC plug: pass (AP boots) grunt, unplug AC, discharge battery to cutoff, on AC plug: pass (AP boots) careena, unplug AC, cutoff battery, on AC plug: pass (AP boots) careena, unplug AC, normal battery, on EC reboot: pass (AP boots) careena, unplug AC, unplug battery, on AC plug: pass (AP boots) careena, unplug AC, discharge battery to cutoff, on AC plug: pass (AP boots) Change-Id: Ieceaa51535b9fcabc8b42681472689bfa9d0e498 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1105338 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* stoney: Rename GPIO_PCH_RCIN_L to GPIO_SYS_RESET_LJonathan Brandmeyer2018-06-051-1/+1
| | | | | | | | | | | | | | Pin rename only; no functional changes. See also b/72426192 for earlier functional changes. BUG=b:77301519 TEST=make -j buildall BRANCH=none Change-Id: I18e71118e584a5b36ba001bac24951929d2c93ff Signed-off-by: Jonathan Brandmeyer <jbrandmeyer@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1087207 Reviewed-by: Edward Hill <ecgh@chromium.org>
* battery: Move fuel gauge code to commonEdward Hill2018-06-011-1/+1
| | | | | | | | | | | | | | | | | Move fuel gauge code to common to avoid duplication in octopus and grunt baseboards. BUG=b:79704826,b:74018100 BRANCH=none TEST=make -j buildall Change-Id: I58a615c9ed7906cb19b49c2baa36aaa619838cf1 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1072637 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Vijay Hiremath <vijay.p.hiremath@intel.corp-partner.google.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt: Board specific battery infoEdward Hill2018-06-014-1/+72
| | | | | | | | | | | | | | | | | | | Split battery info between baseboard and board, following the Octopus example. This will allow Grunt and Careena to define their own lists of supported battery types. This also adds CONFIG_BATTERY_REVIVE_DISCONNECT support, and checks the charge/discharge FET status. BUG=b:79704826,b:74018100 BRANCH=none TEST=Grunt still boots ok. Change-Id: I6e82ac5e48f9aabf59b63add253108513f0a6b60 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1072039 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
* careena: Change LED colorsEdward Hill2018-05-252-0/+33
| | | | | | | | | | | | | Careena has non-PWM White/Orange LEDs. BUG=b:79704826,b:79894166 BRANCH=none TEST=make -j buildall Change-Id: Ie85de84fbd6e4ac4c6139d8407a7a25b5f6d5e7e Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1072898 Reviewed-by: Jett Rink <jettrink@chromium.org>
* careena: Make GPIOs match hardwareEdward Hill2018-05-251-1/+1
| | | | | | | | | | | | | Update GPIO definitions for Careena to match hardware. BUG=b:79704826 BRANCH=none TEST=make BOARD=careena Change-Id: I755e5fd8123eefdfa8d30ca2314435c28340e488 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1070989 Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt: Move common code to baseboardEdward Hill2018-05-255-1254/+71
| | | | | | | | | | | | | | | | Move code that will be common to Grunt and Careena to baseboard to avoid duplication when creating the Careena board. Add Careena board files. These are currently just a copy of Grunt and will be modified for Careena next. BUG=b:79704826 BRANCH=none TEST=Grunt still boots ok. Change-Id: I6dd0035bdd62e92a7f3664120fc6ac3f23a0af4d Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1070988
* ppc: making driver non-constJett Rink2018-05-241-2/+2
| | | | | | | | | | | | | | | We need to update the driver based on the runtime board id, so we need to remove the const attribute. BRANCH=none BUG=b:78896495,b:78021059 TEST=build all -j Change-Id: I5f751c33cf4ec68a38aeb8644170df4987c87d7b Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1068030 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* lpc: convert LPC only boards to use CONFIG_HOSTCMD_LPCJett Rink2018-05-221-1/+1
| | | | | | | | | | | BRANCH=none BUG=chromium:818804 TEST=Full stack builds and works on yorp (espi) and grunt (lpc) Change-Id: I4a70e10c34d79361ceada1ff40b8912b8a6fdaa7 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1067500 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* keyboard_scan: Add refresh and power button boot key optionsEdward Hill2018-05-161-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Make Esc+Refresh+Power on Grunt enter Recovery Mode. If Power is released fast: [0.045303 KB init state: -- 02 08 -- -- -- -- -- -- -- -- -- --] Add CONFIG_KEYBOARD_IGNORE_REFRESH_BOOT_KEY to handle this case. If Power is held longer: [0.045448 KB init state: 08 0a 08 08 08 -- 08 -- 08 08 -- 08 08] Add CONFIG_KEYBOARD_PWRBTN_ASSERTS_KSI3 to handle this case. BUG=b:79758966 BRANCH=none TEST=Esc+Refresh+Power gives recovery screen on Grunt Change-Id: I43a7d485535ff7b0d9bfce59f28c0049ee989818 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1063032 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
* grunt: Increase CONFIG_EXTPOWER_DEBOUNCE_MS to 200Edward Hill2018-04-271-0/+6
| | | | | | | | | | | | | | | | | | | | | When plugging in USB-C power with no battery (or cutoff battery), the ACOK signal from the ISL9238 charger sometimes has a negative pulse of up to 175 ms after VBUS increases from 5V to 20V. The width of the pulse varies from board to board. Increase CONFIG_EXTPOWER_DEBOUNCE_MS to 200 ms (from default of 30) to ignore this negative pulse. If we think we are running with no battery and no AC then we will set the charger voltage to 2.048V, and therefore lose power. BUG=b:77455171 BRANCH=none TEST=Plug power into Grunt with no battery. Change-Id: I9c0f358985e4c630daef93d61c49b87c2e11a480 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1031563 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* grunt: Drop the unnecessary charge-current limitSimon Glass2018-04-271-8/+0
| | | | | | | | | | | | | | | Our maximum power is 45W so we don't need to keep this limit. Also we can drop the TODO since we have a bug to track that work. BUG=b:69683178 BRANCH=none TEST=emerge-grunt chromeos-ec Change-Id: Ie40847e3e88653225dc228563c1ac89cc0970316 Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1031115 Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Raul E Rangel <rrangel@chromium.org>
* grunt: Send sensor MKBP events using host eventEdward Hill2018-04-191-0/+10
| | | | | | | | | | | | | | Add CONFIG_MKBP_EVENT and CONFIG_MKBP_USE_HOST_EVENT to send sensor events to AP. BUG=b:77342604 BRANCH=none TEST=view sensors in AIDA64 Android app in ARC++ Change-Id: I3687072903d251bccb2cdf7670b0780a906dd22d Signed-off-by: Edward Hill <ecgh@chromium.org> Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1012457
* system: update board version to return an error if encounteredJett Rink2018-04-191-1/+1
| | | | | | | | | | | | | | | | | | | | Now that board version can come from CBI, we can have a real error reading it. We should pass that error to the console or to the AP on the host command and let the AP firmware (or user) decided how to handle that error case Also update the CONFIG_BOARD_VERSION to be derived instead of needed in most cases. BRANCH=none BUG=b:77972120 TEST=Error reported on EC console and AP console when CBI is invalid on yorp Change-Id: Ib8d80f610ea226265a61e68b61965150cdc9bb04 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1015776 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* usbc: add default I2C addressesJett Rink2018-03-281-2/+2
| | | | | | | | | | | | | Add hard coded I2C addresses as defined by datasheet. BRANCH=none BUG=none TEST=none Change-Id: Ia69cc4da7474a9c1f8a994d33db88e0a405f02b7 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/982561 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* stoney: Rename PGOOD GPIOsEdward Hill2018-03-264-9/+9
| | | | | | | | | | | | | | | Rename stoney power signals for clarity: SPOK -> S5_PGOOD VGATE -> S0_PGOOD BUG=none BRANCH=none TEST=power grunt on and off Change-Id: Iee8307138600c10868981a22971beace2de1ca91 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/978952 Reviewed-by: Justin TerAvest <teravest@chromium.org>
* tcpc: rename CONFIG_USB_PD_TCPM_ANX74XX to CONFIG_USB_PD_TCPM_ANX3429Jett Rink2018-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | Since all of the uses of CONFIG_USB_PD_TCPM_ANX74XX are actually for ANX3429, rename the option especially since the ANX7447 driver will not reuse the ANX74XX driver which is being introduced in CL:956790. Also adding the CONFIG_USB_PD_TCPM_ANX740X and CONFIG_USB_PD_TCPM_ANX741X options to advertise which versions of the ANX chip the anx74xx.c driver applies to. BRANCH=none BUG=chromium:824208 TEST=build all Change-Id: Ib47f4661466e54ff2a0c52d517eb318d3bfd25a2 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/973558 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Furquan Shaikh <furquan@chromium.org>
* grunt: Tiny fix to board_get_tempEdward Hill2018-03-191-1/+3
| | | | | | | | | | | | | | | Fix argument to adc_read_channel() to be enum adc_channel. No change in behavior since this ends up being a different name for the same value (0/1). BUG=none BRANCH=none TEST=none Change-Id: I0e8b3066122f3789d043b98aad98d8a32c2607bc Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/967242 Reviewed-by: Simon Glass <sjg@chromium.org>
* grunt: Read SKU ID and report it to APEdward Hill2018-03-183-0/+68
| | | | | | | | | | | | | | | Add 2 ADC channels for SKU ID. Each channel gives a 0-15 level, these are combined to give a 0-255 SKU ID. The AP reads this using EC_CMD_GET_SKU_ID. BUG=b:75285661 BRANCH=none TEST=EC_CMD_GET_SKU_ID (HC 0x0e) now succeeds TEST=dmidecode | grep sku Change-Id: I5b03e478518a1bb0ce7107451d71a82b7e48ec86 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/967223
* grunt: GPIO changes for board version 2Edward Hill2018-03-163-24/+55
| | | | | | | | | | | | | | Define GPIOs for board versions 0 and 2. Read version in board_init() and configure GPIOs correctly. BUG=b:74538637 BRANCH=none TEST=build + boot grunt (version 0) Change-Id: I1ff23d5c114cb12e3a32ef069f5e5dff50640d3f Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/966591 Reviewed-by: Martin Roth <martinroth@chromium.org>
* board: In motion sensor array, remove assignment to 0Gwendal Grignou2018-03-141-48/+0
| | | | | | | | | | | | Assignment to 0 are no necessary. BUG=none TEST=compile, check nami. BRANCH=none Change-Id: I1bc11efcff31cbfe2947580e7b8db0d5ba72d444 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/959502
* grunt: Improve battery presence checksEdward Hill2018-03-123-2/+97
| | | | | | | | | | | | | | | | | | | | | | | | Use CONFIG_BATTERY_HW_PRESENT_CUSTOM and CONFIG_BATTERY_PRESENT_CUSTOM to make Grunt closer to Coral and Eve. This gets auto-power-on-with-no-battery closer to working, because charge_prevent_power_on uses battery_hw_present for its factory override check: "Factory override: Always allow power on if WP is disabled, except when auto-power-on at EC startup and the battery is physically present." BUG=b:72645441 BRANCH=none TEST=cold reset Grunt with battery connected and disconnected Change-Id: I2b158bedcad7dffc340992dc020145a4c6e60802 Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/900048 Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Duncan Laurie <dlaurie@google.com>
* usbc: add config support for multiple (and no) vbus adc channelsJett Rink2018-03-091-1/+1
| | | | | | | | | | | | | | yorp measures each port's vbus separately on a deticated ADC. Also, add config to take care of ADV_VBUS -1 case too. BRANCH=none BUG=b:74127309 TEST=none Change-Id: I6f4df96caffc3b527b69e67358631dd448172cde Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956555 Reviewed-by: Edward Hill <ecgh@chromium.org>
* bc12: add support for active low/high on all gpio signalsJett Rink2018-03-091-0/+15
| | | | | | | | | | | | | | yorp inverts both bc12 signals and the bc12 driver needs to handle the inverted logic BRANCH=none BUG=b:74127309 TEST=none Change-Id: I6848375fc652251aecb553c3f53d62a5f775bec4 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/956321 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* cleanup: remove incorrect commentJett Rink2018-03-081-3/+3
| | | | | | | | | | | | | | The port_address field is used in the driver. Also making array declaration consistent with other parts of the file. BRANCH=none BUG=none TEST=none Change-Id: I43c72182c6afefbdbb7286918326b7ea6f92c7d7 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/955940 Reviewed-by: Edward Hill <ecgh@chromium.org>
* grunt: Enable discharge on ACEdward Hill2018-03-081-0/+1
| | | | | | | | | | | | | | | Add support for setting the battery to discharge even if AC is present. Used for factory testing. BRANCH=none BUG=b:74096137 TEST=ectool chargecontrol discharge, ectool battery Change-Id: I79e6bfabcfc0327e5c12c789decc27591911a6ee Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/954283 Reviewed-by: Cheng-Han Yang <chenghan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* npcx: Conforming CONFIG_UART_HOST define to match intentionJett Rink2018-03-061-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The CONFIG_UART_HOST is supposed to be defined to the index of the UART we want to use. It is not supposed to be defined as a boolean. Updated npcx and all incorrect uses. BRANCH=none BUG=none TEST=Added the following diff to ensure that everything still built: diff --git a/chip/npcx/lpc.c b/chip/npcx/lpc.c index 446baa842..826233744 100644 --- a/chip/npcx/lpc.c +++ b/chip/npcx/lpc.c @@ -897,6 +897,9 @@ static void lpc_init(void) /* Initialize Hardware for UART Host */ #ifdef CONFIG_UART_HOST +#if !CONFIG_UART_HOST +#error "Fix me" +#endif /* Init COMx LPC UART */ /* FMCLK have to using 50MHz */ NPCX_DEVALT(0xB) = 0xFF; Change-Id: Ia46c7cb86c6040a5c75dddf23d5ccd8e33210581 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949308 Reviewed-by: Randall Spangler <rspangler@chromium.org>