summaryrefslogtreecommitdiff
path: root/board/trogdor/board.c
Commit message (Collapse)AuthorAgeFilesLines
* Swap system_jumped_to_this_image with system_jumped_latestabilize-quickfix-13310.91.B-masterstabilize-quickfix-13310.76.B-masterstabilize-quickfix-13310.73.B-masterstabilize-13310.99.B-masterstabilize-13310.94.B-masterstabilize-13310.83.B-masterstabilize-13310.74.B-masterstabilize-13310.72.B-masterrelease-R85-13310.B-masterDaisuke Nojiri2020-06-261-1/+1
| | | | | | | | | | | | | | | | | | | | EFS2 boards need to call system_jumped_late in HOOK_INIT to avoid running init code twice per boot. system_jumped_to_this_image and system_jumped_late are functionally equivalent for non EFS2 boards. This patch will prevent system_jumped_to_this_image from being used for EFS2 boards when code is copied from a past project. BUG=chromium:1072743 BRANCH=none TEST=buildall Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Change-Id: I73fb5cedc5325d1c80825f9346954013046ee1df Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2267685 Reviewed-by: Keith Short <keithshort@chromium.org>
* Trogdor: Fix the sensor locationsWai-Hong Tam2020-06-121-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The sensor locations were configured wrong. Fix them. BRANCH=None BUG=b:158611991 TEST=Checked the sensor locations. localhost ~ #␛grep -Fow cros-ec-accel /sys/bus/iio/devices/iio\:dev /sys/bus/iio/devices/iio:device0/name:cros-ec-accel /sys/bus/iio/devices/iio:device2/name:cros-ec-accel localhost ~ # cat /sys/bus/iio/devices/iio\:device0/location lid localhost ~ # cat /sys/bus/iio/devices/iio\:device2/location base localhost ~ # grep -Fow cros-ec-gyro /sys/bus/iio/devices/iio\:devi /sys/bus/iio/devices/iio:device4/name:cros-ec-gyro localhost ~ # cat /sys/bus/iio/devices/iio\:device4/location base Change-Id: I120b39e492364f338d5a899cb1d2398884c7d19d Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2242528 Reviewed-by: Philip Chen <philipchen@chromium.org>
* Trogdor: Fix the base g-sensor's matrix configurationWai-Hong Tam2020-04-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The g-sensor placement is like: +------------------+ | | | | | | | | | | +------------------+ / +----+ / / / / / / / O/ / O is the pin 1 marker, which faces down. / +----+ / +------------------+ The sensor's coordinate system is: +-----> x /| / | v v y z The standard reference frame is: z y ^ ^ | / |/ +-----> x So the matrix contributing to the standard reference frame should be: { { 1, 0, 0}, { 0, -1, 0}, { 0, 0, -1} } Lazor and Trogdor use the same sensor placement. BRANCH=None BUG=b:154782446 TEST=Used 'accelinfo on' command to check the g-sensor's values. Change-Id: I2039db3ad98af314c8d27a738153520c0b542906 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2166486 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org> Commit-Queue: Alexandru M Stan <amstan@chromium.org>
* driver: Replace BMI160 to BMI in board configChing-Kang Yen2020-04-231-6/+6
| | | | | | | | | | | | | | | | | Replace some macro of BMI160 to BMI version for common function of BMI series. Make board config include the accelgyro_bmi_common.h instead of accel_gyro_bmi160.h. BRANCH=None BUG=b:146144827 TEST=make buildall -j Change-Id: I043ff8a92f15295ead3fa5c1e292319e2b4fa21a Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2156525 Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* Trogdor: Create Trogdor baseboardWai-Hong Tam2020-03-301-76/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move the common stuff to from board to baseboard to reduce the effort of forking and maintaining derivatives. This CL is intended to simply moving things around, not to address other needs, like supporting a different EC. Leave the following stuff in board: * Features for debugging * GPIO and interrupt handlers (likely will be changed) * BC 1.2 (already changed from Trogdor rev-0 and rev-1) * TCPC/MUX/PPC (will be changed) * Sensors (clamshell vs convertible) * ADC (detachable vs convertible) * LED/PWM * Battery Others are moved to baseboard. BRANCH=None BUG=b:146237680 TEST=Build Trogdor and it boots. Should be good as there is no logic change. Change-Id: I2e4cd76d18f8739b5b7d5b1dae67c13e038b4480 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2099390
* Trogdor: Switch BC1.2 driver to PI3USB9201 on rev-1Wai-Hong Tam2020-03-101-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | This is for hardware rev-1, which changes the BC1.2 part from PI3USB9281 to PI3USB9201. This is an incompatible change from hardware rev-0. Use EXTRA_CLFAGS option of make to define the hardware rev. People can build the rev-0 image like: $ make BOARD=trogdor clean $ make BOARD=trogdor EXTRA_CFLAGS=-DBOARD_REV=0 -j Or build the rev-1 image like: $ make BOARD=trogdor clean $ make BOARD=trogdor EXTRA_CFLAGS=-DBOARD_REV=1 -j BRANCH=None BUG=b:150682632 TEST=Build the rev-0 image, worked on rev-0 hardware. TEST=The previous patchset was verified on rev-1 hardware. Change-Id: Id43219b154b1dff6bfa1ad46c5a47136f034ffee Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2086392 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Use TCPC to detect VBUSWai-Hong Tam2020-03-101-16/+0
| | | | | | | | | | | | | | | | In hardware rev-1, the BC1.2 part is changed and doesn't has the VBUS detection capability. Should use the TCPC to detect VBUS. This change also works on hardware rev-0. BRANCH=None BUG=b:150682632 TEST=Tested on hardware rev-0. Checked sinking power from 20V properly. Change-Id: I15779c50e8e5cd9e67a45b4d90cb227c1b59c1f9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2086092 Reviewed-by: Philip Chen <philipchen@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Revert "Ampton: Set the PS8751 to source mode before enter low power mode"Matthew Blecker2020-03-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 4ca73139635261ee1273fbe1767dcf06886d2208. Reason for revert: Breaks CCD with AP off https://issuetracker.google.com/150822168 Will work on a solution to address the original CL need, i.e. applying Rp in LPM. Follow the above bug. Some merge conflict happens. Resolved. Also change the usb_mux driver of Trogdor, as ps8xxx_usb_mux_driver is removed. Original change's description: > Ampton: Set the PS8751 to source mode before enter low power mode > > BUG=b:113830171 > BRANCH=octopus > TEST=check the power consumption is lower > > Change-Id: I527cdc5d1e4dd5de137ab0927e66c171696758ce > Signed-off-by: James_Chao <james_chao@asus.corp-partner.google.com> > Reviewed-on: https://chromium-review.googlesource.com/1426306 > Commit-Ready: James Chao <james_chao@asus.corp-partner.google.com> > Tested-by: James Chao <james_chao@asus.corp-partner.google.com> > Reviewed-by: Jett Rink <jettrink@chromium.org> BRANCH=None BUG=b:113830171,150822168 TEST=Build Trogdor, verified CCD with AP off working. Change-Id: I58c26e8466b70e035a1c396cfcba6a46da4bccc9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2091519 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Matthew Blecker <matthewb@chromium.org>
* usb_mux: retimer: mux as chained mux and retimerDenis Brockus2020-02-281-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes retimers appear as generic muxes. By allowing a chain of muxes they can be stacked up to the new configurations that zork requires and will continue to work as they did before on configurations that only have a single mux. The code used to have two different arrays, 1) muxes and 2) retimers. On one of the zork configurations the processor MUX stopped being the primary mux and the retimer took its place. In a different configuration of that same platform it left the primary and secondary alone but the mux_set FLIP operation had to be ignored. Since the same interfaces needed to be available for both it stopped making sense to have two different structures and two different methods of handling them. This consolodates the two into one. The platforms that do not have retimers, this change will not make any difference. For platforms like zork, it will remove the retimers and make them chained muxes. So testing on trembyle makes sense to verify, BUG=b:147593660 BRANCH=none TEST=verify USB still works on trembyle Change-Id: I286cf1e302f9bd3dd7e81098ec08514a2a009fe3 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2066794 Commit-Queue: Jett Rink <jettrink@chromium.org> Reviewed-by: Edward Hill <ecgh@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Revert "Trogdor: Measure the rail PP868_S1C_S2C_S3C"Wai-Hong Tam2020-02-201-8/+0
| | | | | | | | | | | | | | | This reverts commit a7caa808133041759366f45b90d4fa8d252a5a62. The ADC logic is removed on the next rev. BRANCH=None BUG=b:146470311 TEST=Built and booted successfully. Change-Id: Ia32d41e17a40d715b15af8f18493a55b19d7c9d4 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2062763 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Charger: Convert boards to use new driver structureDiana Z2020-02-041-0/+12
| | | | | | | | | | | | | | | This commit removes the temporary common charger chip configuration and instead puts the configuration in each board. BRANCH=none BUG=b:147672225 TEST=builds, runs on waddledoo and octopus Change-Id: If81aef31e48c65999a87e202494f286716114bbb Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2031855 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Trogdor: Print when someone's trying to use AP_RST_REQAlexandru M Stan2020-02-011-0/+4
| | | | | | | | | | | | | | | | | | AP_RST_REQ is deprecated, but it would be nice to know if the AP is trying to misuse this signal. Add it back in as a power signal interrupt. BRANCH=None BUG=b/148238496 TEST=With kernel sandbox 200123-wip-tree: * run "halt" on the AP console * this will assert the AP_RST_REQ signal * you can see EC talk about it: DEPRECATED_AP_RST_REQ => 1 * but cold reboot still doesn't happen Change-Id: I8be10367afa7742642b793dc50e90964eb0b12c1 Signed-off-by: Alexandru M Stan <amstan@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2029203 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* Trogdor: Rename AP_SUSPEND and add its power signal interruptWai-Hong Tam2020-02-011-0/+4
| | | | | | | | | | | | | | | | | Rename the GPIO from AP_SUSPEND_L to AP_SUSPEND as it is active high. Add its power signal interrupt for easily checking the change. Enable the config of the debug command powerindebug. BRANCH=None BUG=b:146470739, b:148149387 TEST=Checked the AP_SUSPEND power signal status on EC coonsole. Change-Id: I4fb5684abb6a3367f5ebc54624f286d8c564d91c Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2023279 Commit-Queue: Alexandru M Stan <amstan@chromium.org> Tested-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* Trogdor: Implement board_set_tcpc_power_modeWai-Hong Tam2020-01-231-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | The board_set_tcpc_power_mode() function hasn't been defined. When doing TCPC software sync, AP to ask EC to suspend the TCPC chip, and then resume it when done. Missing the board_set_tcpc_power_mode() function made the TCPC chip can't resume back. BRANCH=None BUG=b:146652805 TEST=Executed the TCPC software sync, verified the TCPC is back, i.e. 2019-12-20 15:33:27 > C0 st1 SUSPENDED 2019-12-20 15:33:30 [286.977749 TCPC p0 suspended!] 2019-12-20 15:34:14 C0 st2 SNK_DISCONNECTED 2019-12-20 15:34:14 [330.333053 Resetting TCPCs...] 2019-12-20 15:34:14 [330.382545 C0 FAULT 0x00 detected] 2019-12-20 15:34:14 [330.383235 C0 FAULT 0x00 handled] 2019-12-20 15:34:14 [330.387583 TCPC p0 resumed!] Without this CL, an error was reported and the TCPC chip still in suspend. 2019-12-20 14:57:52 C0 st2 SNK_DISCONNECTED 2019-12-20 14:57:52 [546.264649 TCPC p0 restart failed!] Change-Id: I6cee0b7a6d24b9b6ab40f5259a659ca234319990 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1979611 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* PS8805: Add the delay between releasing reset and the first I2C readWai-Hong Tam2020-01-231-1/+4
| | | | | | | | | | | | | | | The PS8805 needs time for firmware init. Before the firmware initiated, I2C read may return wrong values. Parade suggests adding a 10ms delay. BRANCH=None BUG=b:147767696 TEST=Built Trogdor and Nocturne without error. Verified Trogdor TCPC reset correctly, with some other CLs too. Change-Id: I9f67612792f72d6075cbf93a516494c1af592259 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2015640 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Add interrupt on CCD_MODE_ODL to enable SBU muxWai-Hong Tam2020-01-161-0/+23
| | | | | | | | | | | | | | | | | | | The common svdm_enter_dp_mode() disconnects the PPC SBU lines. In Trogdor, the H1 SBU line for CCD are behind PPC chip. The PPC internal FETs for SBU may be disconnected after DP alt mode is off. Should enable the CCD_MODE_ODL interrupt to make sure the SBU FETs are connected. BRANCH=None BUG=b:143616352,chromium:1021724 TEST=Tested the DP alt-mode: plug a dongle without monitor connected -> plug a monitor to it -> unplug the dongle -> plug a CCD connection. Verified the muxes work as expected. Change-Id: Ie4bc4380720138b18fc2699432b81b03c4890aee Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2003530 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Abandon virtual HPD approach and configure TCPC for HPD statusWai-Hong Tam2020-01-161-45/+7
| | | | | | | | | | | | | | | | | | | The TCPC is required to know the HPD status; otherwise, some mux misbehaves. Even thought the HPD status is through a GPIO to notify AP, still configure the TCPC. As the GPIO approach works well, abandon the virtual HPD approach. BRANCH=None BUG=b:147358149 TEST=Plugged a Type-C to DP dongle to the board, checked that the IN_HPD bit not set. Plugged a monitor to the dongle, checked that the IN_HPD bit set. Change-Id: Id8b8eae462c80c36156a1e9443c8af87cd784fd0 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2003531 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* board: Set Accelerometer range to 4gGwendal Grignou2019-12-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Required by Android CDD - Section 7.3.1 - Paragraph C.1.4 Modified mechanically with: for i in $(grep -lr "\.default_range" board); do sed -i '/.default_range =/s#\(.*\.default_range = \).* /\ \* g.*#\14, /* g, to meet CDD 7.3.1/C-1-4 reqs */#' $i done Manually reworked to only change the accelerometer that matters to android: The lid accelerometer or the base accelerometer if the base also hosts the gyroscope. This is only for future EC, no need to land the change on branches: mems_setup will take care to set accelerometer ranges at 4g on startup. BUG=b:144004449 BRANCH=none TEST=compile Change-Id: If8c14b2e928c9c70c0ce51451adcfcd674a9e73b Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1957375 Reviewed-by: Justin TerAvest <teravest@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* Trogdor: Prevent getting into a boot loop assertion failureWai-Hong Tam2019-12-101-8/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In any case failing to talk to the PPC chip, e.g. a hardware bug or a daughter-board not attached, returning a failure return code will result a boot loop assertion failure. Should prevent this case. This is the same behavior as other boards, like octopus, grunt, etc. BRANCH=None BUG=b:145648750 TEST=Don't attach the daughter-board, unplug and plug the charger. No assertion boot loop. > [26.148463 USB MUX 1] C0 st2 SNK_DISCONNECTED [26.150189 Disabling all charging port] [26.151815 ppc p1: Failed to set FUNC_SET3!] [26.152277 Disabling p1 sink path failed.] [26.157214 CL: p-1 s-1 i0 v0] [26.180500 AC off] [27.198359 Battery 99% (Display 0.0 %) / 44h:22 to empty, not accepting current] C0 st3 SNK_DISCONNECTED_DEBOUNCE [30.896588 VBUS p0 1] C0 st14 SRC_DISCONNECTED [30.934551 VBUS p0 0] C0 st3 SNK_DISCONNECTED_DEBOUNCE [31.170306 VBUS p0 1] [31.189848 USB MUX 0] C0 st5 SNK_DISCOVERY C0 RECV 51a1/5 [0]0801912c [1]0002d12c [2]0003c12c [3]0004b12c [4]000640e1 C0 Req [1] 5000mV 3000mA [31.283610 New charge port: p0] [31.284181 ppc p1: Failed to set FUNC_SET3!] [31.284585 p1: sink path disable failed.] ... Change-Id: Ifa81eea0a7d2fc2f90b1a64dacce2a6802165b0a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1954915 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
* Trogdor: Measure the rail PP868_S1C_S2C_S3CWai-Hong Tam2019-12-101-0/+8
| | | | | | | | | | | | | Add ADC5 which measure the rail PP868_S1C_S2C_S3C. BRANCH=None BUG=b:143616352 TEST=Checked the ADC values when AP on and off. Change-Id: I8b33e199a9c7214d748c5435d9a77d0bf1fd7c15 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1954981 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Initial board commitWai-Hong Tam2019-11-221-0/+547
This is an initial commit for Trogdor. Use Cheza as a baseline. Make the change according to the schematic, e.g. * Reflect the GPIO change * Reflect the TCPC/PPC part change * Update the USB topology, e.g. no device mode support * Remove the detachable related code * Add keyboard support * Support keyboard backlight * Update the battery characteristic * Add initial support of muxing DP path * Support a single USB-A port * Change sensors from lid to base * Minor code style improvement BRANCH=None BUG=b:143616352 TEST=BOARD=trogdor make Change-Id: Ia9bb0adfcb8d347e6335fd3ae1e565b0f9d1a025 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1847204 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>