summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* fizz: Increase fan to reduce throttling.firmware-fizz-10139.BRichard Yeh2023-01-301-86/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Chromebox for Meetings (CfM) devices are videoconferencing appliances. Discovering that a significant fraction of our fleet was throttling the CPU due to temperature, resulting in bad video quality, we have decided that these devices should never throttle. The present change reduces the temperature thresholds at which we increase fan speeds. For most of the time, when the CfM is idle, we expect no or little change in fan speeds. During calls, the CfM CPU can exceed 60 C, and the sensors controlling the fan are typically 10-20 degrees C cooler than the CPU, so we set the maximum-fan temperature to 50-55 C in an attempt to arrest any temperature increase before the CPU reaches throttling temperatures. We add fan tables to enable hysteresis in the fan speed setting. Fan RPMs are chosen to span the min-to-max range, while avoiding 50 Hz and 60 Hz line frequencies. fizz and kalista boards are shared with non-CfM versions, while the other boards are CfM-only. Since those boards are several years old, we plan to build these firmware changes only into CfM-branch releases, not all fizz and kalista devices. Additional details at go/cfm-overheating . Temperature traces with load testing on both top-of-tree and firmware with this change are shown at go/cfm-overheating#heading=h.ykpzxotgnu2j BRANCH=update-fan-tables BUG=b:252966838,b:191187610,chromium:1383859 TEST=Confirmed validity of settings with `ectool thermalset`. Built firmware, flashed to endeavour and excelsior (fizz), verified that fan turns on earlier. This does not completely prevent throttling from 47.25 W to 15.00 W on Kaby Lake boards (endeavour, fizz, kalista), but it does prevent dropping below 15.00 W. Comet Lake boards (ambassador, genesis, moonbuggy, scout) start at 15.00 W and rarely throttle anyway. Change-Id: I4eb532977677fbfd939fc46f851948cd4adf9788 Signed-off-by: Richard Yeh <rcy@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4004441 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> (cherry picked from commit decce1a6dd4204c8c13bc591f6d2f3ce6b49ffb3) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4201308 Reviewed-by: Kyle Williams <kdgwill@chromium.org>
* fan: Rewrite and test the most common custom fan_percent_to_rpm.Richard Yeh2023-01-303-13/+237
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | temp_ratio_to_rpm_hysteresis uses a sorted fan_table containing a mapping of temp_ratio (percent, 0-100) to fan rpm. This clarifies the relationship of temperature to fan speed, while reducing the number of static variables. The existing temp_ratio expressing the percentage of cooling needed (temperature from temp_fan_off to temp_fan_max) suggests the possibility that a proportional-integral-derivative (PID) feedback controller might have been considered; but the default implementation is purely linear (mapping to fan speed from min to max) and this stepwise one just enables hysteresis --- different speeds when the board is warming up than when cooling down. The hysteresis attempts to avoid oscillations in temperature and fan speed. This refactoring is in preparation for reusing this implementation for {ambassador, genesis, moonbuggy, scout}. {kalista, berknip, chronicler, dewatt, endeavour, ezkinil, fizz} define CONFIG_FAN_RPM_CUSTOM and use this or nearly this implementation of a fan_percent_to_rpm with hysteresis. {chronicler} also performs boxcar smoothing of the input. {osiris}, which has two fans, and {jinlon, redrix, and other boards with multiple sensors}, use a similar but not exactly the same implementation, and would need additional abstraction. See: https://source.chromium.org/search?q=f:ec%2Fb%20fan_step%20-f:board.c BRANCH=refactor-fan-percent-to-rpm BUG=b:252966838,b:191187610,chromium:1383859 TEST=make -j run-fan && make -j buildall && make -j runhosttests Signed-off-by: Richard Yeh <rcy@google.com> Change-Id: I50ad4d78ac1145f92573a417646c1f57b8945463 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4021951 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Code-Coverage: Zoss <zoss-cl-coverage@prod.google.com> Reviewed-by: Abe Levkoy <alevkoy@chromium.org> (cherry picked from commit 62c3a651befeb8d9b3ad03994b23b579d92c20d8) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4201307 Reviewed-by: Kyle Williams <kdgwill@chromium.org>
* Clear OWNERS for factory/firmware branchBrian Norris2021-09-112-10/+1
| | | | | | | | | | | | BUG=none TEST=none Change-Id: I0f03f432ada1064ffba9595be78ca7ab4d25ecd1 Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3155171 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Owners-Override: Jora Jacobi <jora@google.com> Tested-by: Jack Rosenthal <jrosenth@chromium.org>
* Revert "Fizz: Apply VR1 fix for all variants"Daisuke Nojiri2020-12-091-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 9496abb082a4ec60ab740e093fe09f56ceec7cd2. Reason for revert: https://bugs.chromium.org/p/chromium/issues/detail?id=1073330. We're going to release QFB. Original change's description: > Fizz: Apply VR1 fix for all variants > > CL:1529983 was applied to only Teemo. This patch applies the same fix > to the rest. > > Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> > > BUG=b/128960577 > BRANCH=firmware-fizz-10139.B > TEST=make buildall -j > > Change-Id: I675327aa5682ab94ce6d41d82d006f3cdf749e54 > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1535173 > Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> > Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> > Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Bug: b/128960577, chromium:1073330, chromium:1157133 Change-Id: I7c9e2e864378e6aa027c43266a13357840565d9f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2581890 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* stm32: Fix manual interrupt clearing functionCraig Hesling2020-03-161-1/+3
| | | | | | | | | | | | | | | | | | | | | This fixes a bug in gpio_clear_pending_interrupt, where all pending interrupts are unintentionally cleared. This is not in the code path for normal gpio interrupt handlers, since the normal interrupt clearing occurs in gpio_interrupt (right below this function). BRANCH=none BUG=chromium:1059520 TEST=none Signed-off-by: Craig Hesling <hesling@chromium.org> Change-Id: I4d6fe7947f4d76cf3b57dfbf3bb926e41851c80c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2101208 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> (cherry picked from commit c2c2c083fef813e3e3c70f8c13a1418717ba682d) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2106632
* Fizz: add fan table for excelsiorJeff Chase2020-02-142-0/+17
| | | | | | | | | | | | | | | | BUG=b:149103675 BRANCH=none TEST=build, install, set OEM to 10, check fan speed, set min fan speed Change-Id: I032c48c5d7696a482b0cf4083b88dcd4f341f434 Signed-off-by: Jeff Chase <jnchase@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2047931 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Ren Kuo <ren.kuo@quanta.corp-partner.google.com> Reviewed-by: David Huang <David.Huang@quantatw.com> (cherry picked from commit 50b268bc67c1c73d81eafaa46dc7cab75c335e41) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2051326 Tested-by: Peter Ou <peter.ou@quanta.corp-partner.google.com>
* Ensure CEC bus pin is not driven lowFelix Ekblom2019-11-271-0/+3
| | | | | | | | | | | | | | | | | | | | We have seen cases where after a cold EC reboot the pin is low until the first CEC message is sent by AP (after which the bus is left in a well defined state again) This is a follow up to https://crrev.com/c/1346990 which initializes the pull up in case not done by the RO FW. BRANCH=none BUG=b:144548408 TEST=CEC pin only goes low for ~40ms instead of 30s. Signed-off-by: Felix Ekblom <felixe@chromium.org> Change-Id: I3c98f8858f407279ad1bd086210969d69df2230b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1928993 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit e73c807595eba1bc1a1b575fb12f252522cffca3) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1930553
* Fizz: Apply VR1 fix for all variantsDaisuke Nojiri2019-03-221-10/+8
| | | | | | | | | | | | | | | | | CL:1529983 was applied to only Teemo. This patch applies the same fix to the rest. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/128960577 BRANCH=firmware-fizz-10139.B TEST=make buildall -j Change-Id: I675327aa5682ab94ce6d41d82d006f3cdf749e54 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1535173 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Teemo PMIC TPS650830 VR1 setting for hang up issueSue Chen2019-03-222-0/+12
| | | | | | | | | | | | | | | | | | Set PMIC register V100ACNT (0x37) to 0x1B [1:0] : 11b Forced PWM Operation. [5:4] : 01b Output Voltage Selet Vnom (1V) To improve +V1P00A ripple around 18mV. BUG=b:128960577 BRANCH=firmware-fizz-10139.B TEST=make buildall -j Signed-off-by: Sue Chen <sue.chen@quanta.corp-partner.google.com> Change-Id: I1e620a6c2eebcf2dec8c66989f1469072621ba92 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1529983 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* npcx/fan: Assign different value to TACHO_FAN_DUTYDaisuke Nojiri2019-01-221-1/+1
| | | | | | | | | | | | | | | | | | | | Currently, zero is assigned to the duty mode (TACHO_FAN_RPM) and the rpm mode (TACHO_FAN_DUTY). This makes 'ectool fanduty' command ineffective because a duty is immediately overwritten by HOOK_TICK. This patch assigns a different value to TACHO_FAN_DUTY to fix it. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b/123245612 BRANCH=fizz TEST=Run 'ectool fanduty 100' and verify fan speed is kept on Fizz. Change-Id: Iac709bb4342df432f9ed417f5e942c564a2dfe27 Reviewed-on: https://chromium-review.googlesource.com/c/1427388 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* CEC: Set pull-up highDaisuke Nojiri2018-11-261-0/+3
| | | | | | | | | | | | | | | | | | | GPIO pins don't get set high or low after sysjump. This cause CEC not to work if RO image doesn't set CEC_GPIO_PULL_UP. This patch sets CEC_GPIO_PULL_UP to high in cec_init. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:119901859 BRANCH=none TEST=Verify CEC_PULL_UP=1 on Teemo in normal mode and recovery mode. Change-Id: I0c88a789a8731054c2e4b0bb1066529933473b70 Reviewed-on: https://chromium-review.googlesource.com/c/1346990 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org>
* Fizz: Set initial fan speed to 50%Daisuke Nojiri2018-11-201-0/+2
| | | | | | | | | | | | | | | | | | | | This patch sets initial fan speed to 50% to reduce fan noise at start-up and resume. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:118701592 BRANCH=none TEST=Verify fan starts spinning on Fizz at 50% speed. Change-Id: I230eb2b6c33499f96d0583b5d75f2674960a35ff Reviewed-on: https://chromium-review.googlesource.com/1309036 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1344576 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Add Jax supportDaisuke Nojiri2018-11-202-19/+26
| | | | | | | | | | | | | | | | | | | | | | If OEM_ID is equal to 8 (Jax), the EC works as follows: - Set barrel jack adapter spec to (19V, 3.42A). - Set fan_count to zero Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:116588924 BRANCH=none TEST=Boot Fizz with OEM=8. Change-Id: Id6489b65a0bb71cd56d4fcf5e2fdbacb630aa99a Reviewed-on: https://chromium-review.googlesource.com/1308258 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1344575 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Fan: Allow fan count to be set dynamicallyDaisuke Nojiri2018-11-207-33/+77
| | | | | | | | | | | | | | | | | | | | | Currently, the fan count is statically set. This patch allows it to be set dynamically so that a single binary can support devices with a different number of fans (including fan-less). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:116588924 BRANCH=none TEST=Boot Fizz with OEM=8. Verify fan spins with OEM=1. Change-Id: I77fc4e07ce2a1be2e288df145857a79c0003542f Reviewed-on: https://chromium-review.googlesource.com/1308257 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1344574 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Fan: Fix memory access error in pwm_fan_initDaisuke Nojiri2018-11-201-2/+3
| | | | | | | | | | | | | | | | | | | | This patch fixes memory access error introduced by CL:1169910. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:112293333 BRANCH=none TEST=Verified EC boots on Sona. Change-Id: I81ab6b9235f51f5e101e286d266d28e41bea4b11 Reviewed-on: https://chromium-review.googlesource.com/1285290 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/1344573 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Fan: Restore thermal control after sysjumpDaisuke Nojiri2018-11-202-18/+30
| | | | | | | | | | | | | | | | | | | | | Currently, the fan thermal control is always disabled after sysjump. This patch makes the EC save the previous thermal control state before sysjump and restore it after sysjump. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:112293333 BRANCH=none TEST=Verify fan spins before sysjump, after sysjump, in OS on Akali. Change-Id: I2ffc2444e5995def0f0a9206a6863a4b55ba8bc1 Reviewed-on: https://chromium-review.googlesource.com/1169910 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1344572 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* fan: Enable fan control on AP startup not on shutdown/suspendDaisuke Nojiri2018-11-202-12/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is no need to cool CPU in S3 or S5. We currently don't have fans for a charging system (i.e. a battery or a charger chip). Battery management systems control charge current based on its own temperature readings. Thus, we do not need to keep fans running in S3/S5. Even with a fan for a charging system, it's questionable to run a fan in S3/S5. Under a heated condition, spinning a fan would create more heat as a fan draws current from a battery and the ambient air is hot. With this patch, EC disables fan control when entering S3/S5 (though fan control would be already disabled if DPTF is used). It also makes EC enables fan control when AP starts (for BIOS and OS if DPTF isn't used). Signee-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify fan spins in S0 and stops in S3/S5. Fan is controled by EC in BIOS and by DPTF in OS after warm and cold reboot. Run make run-fan. Change-Id: Idb4610303e65f7fd4d6b24a0dfe511cd629bf6a7 Reviewed-on: https://chromium-review.googlesource.com/1138822 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-on: https://chromium-review.googlesource.com/c/1344571 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* fan: Don't enable or disable thermal control on resumeDaisuke Nojiri2018-11-201-5/+4
| | | | | | | | | | | | | | | | | | | | | | We don't need to enable or disable thermal control on the resume path. It should be already enabled by pwm_fan_init on cold boot or by pwm_fan_S3_S5 on warm reboot. If it needs to be disabled, DPTF and host command will do so Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify fan spins as expected on Nami and Fizz. Change-Id: If6e4ecdf328b24cc5ba86dbc3bc2824610fcd340 Reviewed-on: https://chromium-review.googlesource.com/1110485 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1344570 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Nami: Set fan speed to CONFIG_FAN_INIT_SPEED on resumeDaisuke Nojiri2018-11-201-1/+3
| | | | | | | | | | | | | | | | | | | | | This patch sets the target RPM to CONFIG_FAN_INIT_SPEED on chipset resume. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:80152440 BRANCH=none TEST=Verify target RPM is set to the value derived from CONFIG_FAN_INIT_SPEED in recovery mode on Akali. Change-Id: Ide0d6b8a0c895479af8afff0ba40a7b502bbbbbf Reviewed-on: https://chromium-review.googlesource.com/1110349 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/1344569 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* chgmgr: Allow charge_manager_update_charge to accept NULLDaisuke Nojiri2018-09-208-49/+33
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, charge_manager_update_charge does not handle NULL pointer for struct charge_port_info any differently. It's not sanity-checked either (thus memory access violation can occur). This patch will make charge_manager_update_charge accept NULL pointer and set available current and voltage to zero. This also helps callers' intentions be clear because callers can explicitly specify NULL (instead of passing a pointer to chg = {0}, which is initialized somewhere else). Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=buildall Change-Id: I518662ab6a3a07f93da5d34cf62a6f856884f67d Reviewed-on: https://chromium-review.googlesource.com/1236851 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* Make USB_PD_POWER_INFO detect inactive supplierDaisuke Nojiri2018-09-201-15/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, CMD_USB_PD_POWER_INFO does not report a supplier if the available current is 0. This causes a dedicated charger (a barrel jack adapter) to be ignored by the command if it's not the active supplier. This change allows a supplier which has 0 current to be reported by the command as long as there is no other supplier with positive current on the same port. With this change, the host can detect a BJ adapter's physical presence regardless of its charging status. In other words, a supplier with positive current always supersedes whatever supplier with zero current. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:841944,b:111667665,b:111777351 BRANCH=none TEST=Verify ectool usbpdpower 1 return 'Port 1: Disconnected' and 'Port 1: SNK (not charging)' without and with a BJ adapter connected respectively on Fizz. Change-Id: I22ba5f147209177c0c9cac87a123d4c3d0f2ec68 Reviewed-on: https://chromium-review.googlesource.com/1236850 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* chgmgr: Set available voltage to 0 on disconnectDaisuke Nojiri2018-09-205-19/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, available current is consistently set to zero when a supplier is disconnected across BC 1.2 drivers, PD task, usb charger task but voltage is set to zero only in some places. This patch will set available voltage consistently to 0 on disconnected ports. This change should have no impact externally or internally because currently ports are treated as a disconnected port as long as available current is zero. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:841944 BRANCH=none TEST=Verify ectool usbpdpower 1 return 'Port 1: Disconnected' and 'Port 1: SNK (not charging)' without and with a BJ adapter connected respectively on Fizz. Verify ectool usbpdpower prints 'Disconnected' and 'SNK Charger PD' on Vayne without and with USB-C charger, respectively. Verify ectool usbpdpower prints 'Disconnected' and 'SNK Charger Type-C' on Vayne without and with a phone USB-C charger, respectively. Change-Id: I9aca575a4a4240ec1f669c55437decaedf758a77 Reviewed-on: https://chromium-review.googlesource.com/1236849 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* charge_manager: Use enum for CHARGE_SUPPLIER_NONEDaisuke Nojiri2018-09-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Currently, CHARGE_SUPPLIER_NONE is defined as a macro. This causes the compiler to allocate uint8_t to enum charge_supplier. When -1 passed to or returned from a function, it's cast to 0xff. This patch defines CHARGE_SUPPLIER_NONE in enum charge_supplier. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=none BRANCH=none TEST=Verify ectool usbpdpower 1 return 'Port 1: Disconnected' and 'Port 1: SNK (not charging)' without and with a BJ adapter connected respectively on Fizz. Change-Id: I31bfa33efa91f60c6667f3b0de9cbdf9c6b3e8bf Reviewed-on: https://chromium-review.googlesource.com/1217605 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1236848 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* usb_charger: initialize VBUS supplier at startupJett Rink2018-09-204-29/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | When using VBUS_DETECT_TCPC the charger code relied on the TCPC alert to initialize the VBUS supply, but that happens too late in board startup sequence to allow an initally plugged in USB-C power supply to be chosen as the active charging port. We can and should initialize the the supplier sooner as to prevent the charge_manager_is_seeded() check from failing thus preventing the board from choosing a charging port. BRANCH=none BUG=b:77458917 TEST=PS8751 on yorp will negotiate 20V over USB-C (which was prevent by the charge_manager not being seeded) Change-Id: I6f612c508932a90ece0036ce8310a20de02d8467 Signed-off-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/994707 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Divya S Sasidharan <divya.s.sasidharan@intel.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1236847 Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
* usb_charger: Always update VBUS charge supplierEdward Hill2018-09-201-11/+8
| | | | | | | | | | | | | | | | | | | | | | | | | usb_charger_init() did not call charge_manager_update_charge() if we are sourcing VBUS. This means we can get stuck with charge_manager_is_seeded() never returning true, and so charging never starts, and power-on is prevented. Change update_vbus_supplier() so it always calls charge_manager_update_charge(), but with current = 0 when we are sourcing VBUS. BUG=b:80203727 BRANCH=none TEST=Reboot Grunt EC while one USB-C port is VBUS source. Change-Id: I24c29dc6b9ad9c50254181614a6440d2d055cd5a Signed-off-by: Edward Hill <ecgh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1086113 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1236846 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
* Fizz: Remove remote temp sensor 2Daisuke Nojiri2018-09-192-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | Fizz has been shipped with TMP431, which has only one remote sensor. This patch removes the one which doesn't exist on the boards. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=chromium:880705 BRANCH=none TEST=Verify local and remote sensor report expected temperatures. Verify the fan spins as expected. > temps TMP431_Internal : 304 K = 31 C 37% TMP431_Sensor_1 : 301 K = 28 C $ ectool temps all 0: 304 K 1: 301 K Change-Id: I2346444f1331faaf32b407a18ba96302b7a166e6 Reviewed-on: https://chromium-review.googlesource.com/1234735 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
* Fizz: Configure USB_C0_PD_RST_ODL as GPIO_ODR_HIGHDaisuke Nojiri2018-08-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | USB_C0_PD_RST_ODL is connected to PS8751 reset pin and currently configured as GPIO_OUT_LOW. This causes the EC to generate an unintentional reset pulse when Cr50 resets the EC on power-on reset. When PS8751 is in reset, the CC line is pulled low. This unintentional reset lasts longer than tPDDebounce ("CC Timing" in the USB Type-C spec), thus causes Z32 to bring down VBUS and the system to brown out. This patch configures the pin as GPIO_ODR_HIGH. This will remove the unintended reset pulse. This pin will continue to be used to generate a reset pulse as it has been doing without exceeding tPDDebounce. BUG=b:74354232 BRANCH=none TEST=Verify Fizz boots on HP Z32 by: 1. Cold reboot (by servo) and 2. Plug-in USB-C cable (connected to Z32) Change-Id: Ieae7c25e8261cf3b708e76c8340b07af5a61720f Reviewed-on: https://chromium-review.googlesource.com/1031736 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* vboot: Don't invalidate cached hash for EXEC_IN_RAM boardsDaisuke Nojiri2018-07-121-22/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, a cached hash is invalidated on flash erase or write. This causes the hash to be (unintentionally) equal to the one expected by the AP after flashrom updates EC-RW directly on EXEC_IN_RAM devices. This patch makes EC skip invalidation of the cached hash if the board supports EXEC_IN_RAM. At the next AP reboot, AP will catch the hash mismatch and triggers software sync to resolve the mismatch. Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> BUG=b:78285812,b:80143039 BRANCH=none TEST=Verify EC-RO/RW versions are updated on a dogfood Akali as follows: 1. emerge-nami chromeos-firmware-nami to build chromeos-firmwareupdate 2. Replace bios.bin and ec.bin in chromeos-firmwareupdate with new images 4. Run 'chromeos-firmwareupdate -m autoupdate' on DUT 5. Run reboot command on AP Change-Id: Ie5f80e4784814569c14d4cf2a03ddb9d1257cfd5 Reviewed-on: https://chromium-review.googlesource.com/1130552 Commit-Ready: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> (cherry picked from commit 65d6c6abbc2093067486e3e080adb4f24fc19acb) Reviewed-on: https://chromium-review.googlesource.com/1135228 Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
* npcx: CEC: Change input back to GPIO when disabling CECStefan Adolfsson2018-06-191-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | The factory tests relies on being able to read CEC_IN through the GPIO API. When it is configured as TA1, it can't be read as a GPIO. With this change, the pin will be a reconfigured as a GPIO at boot or when CEC is runtime disabled using "ectool cec set enable 0" Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:79842676 BRANCH=none TEST=Test that "ectool cec read" still works with CEC on, and that "ectool gpioget CEC_IN" reflects the incoming voltage when CEC is off. Reviewed-on: https://chromium-review.googlesource.com/1064110 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Change-Id: I3b17d6551612a156897d95ea2473e4fbcbd70e39 Reviewed-on: https://chromium-review.googlesource.com/1070068 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Fix issues with pushing to incoming bufferStefan Adolfsson2018-06-191-7/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When pushing to the circular buffer, the read-offset mutex is no longer taken, so don't unlock the mutex. Don't allow writing to the last byte of the buffer. In that case, the read and write pointers will become equal and the buffer will be treated as empty. Add handling for pushing messages of invalid size. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Turn on/off TV: ectool cec write 0x40 0x36 ectool cec write 0x04 0x40 Verify that incoming messages still works when turning off TV: ectool cec read -- -1 Reviewed-on: https://chromium-review.googlesource.com/1068945 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Id207c442fac573430aac0c744ec07fa203074228 Reviewed-on: https://chromium-review.googlesource.com/1070067 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Allow unregistration of logical addressStefan Adolfsson2018-06-191-1/+5
| | | | | | | | | | | | | | | | | | | | | | | The kernel CEC API unregisters logical address by setting it to 255. From that point, we don't receive any direct messages since a CEC address is only 4 bits on the bus. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Verify that "cec-ctl --unregistered" sets logical address to 255. Reviewed-on: https://chromium-review.googlesource.com/1059674 Reviewed-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Neil Armstrong <narmstrong@baylibre.com> Change-Id: I365151d11a0462e50e9274ace8ee35184e1433b8 Reviewed-on: https://chromium-review.googlesource.com/1064051 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Send CEC message in mkbp eventStefan Adolfsson2018-06-194-57/+73
| | | | | | | | | | | | | | | | | | | | | | Instead of fetching incoming CEC messages using a specific read command, extend the standard mkbp event so the CEC message can be delivered directly inside the event. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST="ectool cec read" still working with a kernel that has support for the increased mkbp size. CQ-DEPEND=CL:1046186,CL:1051085 Reviewed-on: https://chromium-review.googlesource.com/1051105 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Id9d944be86ba85084b979d1df9057f7f3e7a1fd0 Reviewed-on: https://chromium-review.googlesource.com/1055833 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add unit suffixesStefan Adolfsson2018-06-191-78/+86
| | | | | | | | | | | | | | | | | | | | Add unit suffixes to all timing constants and variables so it is clear that it is ticks, not usec we are dealing with. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=emerge chromeos-ec CQ-DEPEND=CL:1030371 Reviewed-on: https://chromium-review.googlesource.com/1046186 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I02883108b6f844a7a2d8f0fcd75edaecbbb8e403 Reviewed-on: https://chromium-review.googlesource.com/1055832 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Group ectool subcommands under "ectool cec"Stefan Adolfsson2018-06-191-33/+67
| | | | | | | | | | | | | | | | | Instead of e.g. "ectool cecwrite", use "ectool cec write" to not clutter the command list. BUG=b:76467407 BRANCH=none TEST=Run "cec read/write/get/set" and make sure they still work. CQ-DEPEND=CL:1030218 Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1046185 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: Id515782f5a5ff0861fb95ab63c45dc8ab153f0bb Reviewed-on: https://chromium-review.googlesource.com/1055831
* npcx: CEC: Respect the present initiator free-timeStefan Adolfsson2018-06-191-3/+17
| | | | | | | | | | | | | | | | | | | | | When sending multiple frames, the free-time is a bit higher to make it easier for other senders to get a chance to send. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030370 Reviewed-on: https://chromium-review.googlesource.com/1030371 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I19e510ec0b6e987e0d8477fa5549e0b29ef594ee Reviewed-on: https://chromium-review.googlesource.com/1055830 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Get/set logical addressStefan Adolfsson2018-06-191-2/+17
| | | | | | | | | | | | | | | | | | | | | Logical address selection is best done from the AP since it depends on what kind of CEC device type we want to be. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Set address to different values and verify that it only receives messages on that address (or broadcast) CQ-DEPEND=CL:1030229 Reviewed-on: https://chromium-review.googlesource.com/1030370 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ia5ef182b22f2345831caaa7f29cc9f009f932c99 Reviewed-on: https://chromium-review.googlesource.com/1055829 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add software debouncingStefan Adolfsson2018-06-191-0/+29
| | | | | | | | | | | | | | | | | | | | | If pulses shorter than the CEC specification allows are detected, ignore the bus for a while. This avoids CPU stress if there is a misbehaving device sending short pulses on the CEC bus. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030228 Reviewed-on: https://chromium-review.googlesource.com/1030229 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I55819f9437a00799718e235c30f256508465bf4c Reviewed-on: https://chromium-review.googlesource.com/1055828 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Improve pulse-width measurementsStefan Adolfsson2018-06-191-2/+15
| | | | | | | | | | | | | | | | | | | | Take into account the time from the interrupt is triggered until the timer is set when recharging the timer. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using temprorary debug-prints. CQ-DEPEND=CL:1030227 Reviewed-on: https://chromium-review.googlesource.com/1030228 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ia36bd73ff5efcff719db7b7915212f30a8e555f3 Reviewed-on: https://chromium-review.googlesource.com/1055827 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Event-handling for incoming messagesStefan Adolfsson2018-06-192-5/+164
| | | | | | | | | | | | | | | | | | | | | | | When an incoming message is complete, store it in a internal circular buffer and notify the AP so the message can be read out. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Write different type of messages from one EC to another EC using ectool. Also use ectool on the second EC to verify that they are received correctly. CQ-DEPEND=CL:1030226 Reviewed-on: https://chromium-review.googlesource.com/1030227 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ie4370b0c954befe81a055cd5dff7d7f13dbefbd0 Reviewed-on: https://chromium-review.googlesource.com/1055526 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Handle incoming CEC messagesStefan Adolfsson2018-06-191-5/+323
| | | | | | | | | | | | | | | | | | | | | | | | | Adds handling of incoming messages: * Start-bit detection * ACK incoming messages * Broadcast handling * Pulse-width validation * EOM detection Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Tested in later CL when messages are plumbed all the way back to the AP. CQ-DEPEND=CL:1030225 Reviewed-on: https://chromium-review.googlesource.com/1030226 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I541072b8afa3d911b310628f09f0b665f11a0a15 Reviewed-on: https://chromium-review.googlesource.com/1055525 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add cecset/cecget to ectoolStefan Adolfsson2018-06-191-0/+74
| | | | | | | | | | | | | | | | | | | | Set and get CEC parameters. Currently supported parameters are "enable" and "address" Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support, set values and read them back. CQ-DEPEND=CL:1030217 Reviewed-on: https://chromium-review.googlesource.com/1030218 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I429710f5d8897b23c5b5e54bd10cbf38d1830811 Reviewed-on: https://chromium-review.googlesource.com/1055517 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add cecread command to ectoolStefan Adolfsson2018-06-191-17/+69
| | | | | | | | | | | | | | | | | | | | | Wait for a CEC event and read out the new message. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support: ectool cecread -- -1 Turn on TV, cecread says the same as logical analyzer CQ-DEPEND=CL:1030216 Reviewed-on: https://chromium-review.googlesource.com/1030217 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Iadd2fcfad0dc647aaaa9bd8a04c5c0f582259af5 Reviewed-on: https://chromium-review.googlesource.com/1055516 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Wait for send-event after cec writes in ectoolStefan Adolfsson2018-06-191-2/+27
| | | | | | | | | | | | | | | | | | | | | For factory testing purposes, make the cecwrite return-value depend on whether it got an ACK from the sink. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support, ectool cecwrite with and without sink CQ-DEPEND=CL:1030215 Reviewed-on: https://chromium-review.googlesource.com/1030216 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I681243f74e4745796ac8d50e60dc0f7f9c087335 Reviewed-on: https://chromium-review.googlesource.com/1055515 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* CEC: Add cecwrite command to ectoolStefan Adolfsson2018-06-191-0/+33
| | | | | | | | | | | | | | | | | | | | | cecwrite can be used to write a sequence of bytes on the CEC bus. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Using EC firmware with CEC support, turn on/off TV: ectool cecwrite 0x40 0x04 ectool cecwrite 0x40 0x36 CQ-DEPEND=CL:1030214 Reviewed-on: https://chromium-review.googlesource.com/1030215 Reviewed-by: Randall Spangler <rspangler@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I5bc1efcaaf6ea4c7f92d3654d6e0fcc8717ab757 Reviewed-on: https://chromium-review.googlesource.com/1055689 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add bus-contention handlingStefan Adolfsson2018-06-191-8/+95
| | | | | | | | | | | | | | | | | | | | | If low-impedance is detected during the time from free-time until the end of the initiator address, the current send is postponed until the bus is free again. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=none CQ-DEPEND=CL:1030224 Reviewed-on: https://chromium-review.googlesource.com/1030225 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: If4b9ed43306cf2e38770085603f7fa83a1f76ddc Reviewed-on: https://chromium-review.googlesource.com/1055524 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Handle enable/disable commandStefan Adolfsson2018-06-191-8/+87
| | | | | | | | | | | | | | | | | | | | | | The Linux kernel has enable/disable hooks in the CEC driver API. Make it possible to use those calls on the EC CEC implementation. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Verify with logical analyzer that nothing happens on the bus in disable mode and it still works in enable mode. CQ-DEPEND=CL:1030223 Reviewed-on: https://chromium-review.googlesource.com/1030224 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ib5255d76427f288862740cd2e3299ba47f39d998 Reviewed-on: https://chromium-review.googlesource.com/1055523 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Notify AP of CEC send resultStefan Adolfsson2018-06-191-0/+22
| | | | | | | | | | | | | | | | | | Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=ectool cecwrite with and without sink. Reports success if there is a sink, else it fails. CQ-DEPEND=CL:1030222 Reviewed-on: https://chromium-review.googlesource.com/1030223 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: I28f12fd8e226e1e261efaeeefe60f257c0afadf9 Reviewed-on: https://chromium-review.googlesource.com/1055522 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add resend-logic to CEC driverStefan Adolfsson2018-06-191-4/+24
| | | | | | | | | | | | | | | | | | | | | | According to the CEC specification, a resend must be attempted at least once and up to five times after NAK. This fix does it five times. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Write CEC message without sink. Verify with logical analyzer that it resends 5 times. CQ-DEPEND=CL:1030221 Reviewed-on: https://chromium-review.googlesource.com/1030222 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Id296e12b6657b9e7ca0453a2deb06e8aaf17f839 Reviewed-on: https://chromium-review.googlesource.com/1055521 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Write messages on the CEC busStefan Adolfsson2018-06-193-11/+399
| | | | | | | | | | | | | | | | | | | | | | | | | Add hooks that ectool or AP will use to send CEC messages. Messages are sent by setting a timer and flipping a GPIO in the timer interrupt. The timer is then recharged in inside that interrupt depending on where it is in the CEC state-machine. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Switched on and off a TV: ectool cecwrite 0x40 0x04 ectool cecwrite 0x40 0x36 CQ-DEPEND=CL:1030220 Reviewed-on: https://chromium-review.googlesource.com/1030221 Reviewed-by: Randall Spangler <rspangler@chromium.org> Change-Id: Ia640d0d035bcee9be88863046e88402c7a63c19f Reviewed-on: https://chromium-review.googlesource.com/1055520 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>
* npcx: CEC: Add stub implementation of CECStefan Adolfsson2018-06-194-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | Add CEC stub implementation and enable it for Fizz. All it does is print a message when the driver is initialized. Signed-off-by: Stefan Adolfsson <sadolfsson@chromium.org> BUG=b:76467407 BRANCH=none TEST=Check that "CEC initialized" is printed on the console when the EC boots. CQ-DEPEND=CL:1030219 Reviewed-on: https://chromium-review.googlesource.com/1030220 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Conflicts: chip/npcx/registers.h Change-Id: I1cf674e664e091354e344e0c08a69bd09f415904 Reviewed-on: https://chromium-review.googlesource.com/1055519 Tested-by: Stefan Adolfsson <sadolfsson@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Commit-Queue: Stefan Adolfsson <sadolfsson@chromium.org>