summaryrefslogtreecommitdiff
path: root/board/trogdor/board.c
Commit message (Collapse)AuthorAgeFilesLines
* lid_angle: Create a common callback for lid angle changesWai-Hong Tam2021-08-051-20/+0
| | | | | | | | | | | | | | | | | | | | | | Each board defines its own callback lid_angle_peripheral_enable(). The implementation is very similar. Create a common implementation and reduce the duplicated code. This CL removes the board callbacks which are identifical to the common callback. If it is slightly different, keep it and add the __override tag. The check of TEST_BUILD is unnecessary as the board callback is not linked in the test build. BRANCH=None BUG=b:194922043 TEST=Build all the images. Change-Id: I73d381730f35b80eff69399cdfc5fb54f839aee0 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3069175 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* keyboard: Use __override for keyboard_scan_configDaisuke Nojiri2021-07-231-1/+1
| | | | | | | | | | | | | | | | | Currently keyboard_scan_config is defined by each board using CONFIG_KEYBOARD_BOARD_CONFIG. This patch makes it defined as __override hence removes CONFIG_KEYBOARD_BOARD_CONFIG. BUG=None BRANCH=None TEST=buildall Change-Id: I53a356741ba4d00e829ca59b74ee6dc704188728 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3044403 Tested-by: Gwendal Grignou <gwendal@chromium.org> Commit-Queue: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org>
* trogdor: Separate the board_hibernate() to a separate fileWai-Hong Tam2021-06-231-12/+0
| | | | | | | | | | | | | | | Move the board_hiberante() from board.c to a separate file hibernate.c. This makes Zephyr easier to include the code. BRANCH=None BUG=b:191803008 TEST=Built the trogdor image successfully. Change-Id: Ie3749b9db72fc5b0535cfb6f9ef92499b3b46b82 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980447 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* trogdor: Move USB-C related functions and configs to usbc_config.cWai-Hong Tam2021-06-231-293/+0
| | | | | | | | | | | | | | | Move the functions and configs from board.c into the shared file, usbc_config.c. So this code can be used by Zephyr. BRANCH=None BUG=b:191803008 TEST=Built the trogdor image and checked PD negotiation. Change-Id: I500baf13705d18517332992fd83258fe69735a3a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980446 Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* trogdor: Move GPIO functions to a header fileWai-Hong Tam2021-06-231-12/+6
| | | | | | | | | | | | | | | | | At present these functions are declared static in board.c which means they cannot be implemented in a different file. With zephyr we need to split the files up a bit. Move the declarations to a header file instead. BRANCH=None BUG=b:191803008 TEST=Built the trogdor image successfully. Change-Id: Ic9ad9ec210b61c2a92e36119bb635524136988ab Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980445 Reviewed-by: Keith Short <keithshort@chromium.org>
* trogdor: Move the switchcap code outWai-Hong Tam2021-06-231-16/+0
| | | | | | | | | | | | | | Move the switchcap implementation to another file so it can be more readily used by the Zephyr OS build. BRANCH=None BUG=b:191803008 TEST=Built the trogdor image successfully. Change-Id: I7b42f29b79e53d97c0cd86abf61f3a9f7db96de9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980444 Reviewed-by: Keith Short <keithshort@chromium.org>
* Revert "Trogdor: Add interrupt on CCD_MODE_ODL to enable SBU mux"Wai-Hong Tam2021-06-231-23/+0
| | | | | | | | | | | | | | | | | This reverts commit 2966f2f98ac039e80be84aa6b450474652336175. The latest hardware places H1 SBU lines in front of the PPC chip. So the PPC internal mux state doesn't affect H1 anymore. We don't need the workaround, which fixed PPC blocking H1 SBU lines. So revert it. BRANCH=None BUG=b:184071830 TEST=Tested plugging a monitor and then plugging CCD. CCD worked fine. Change-Id: Ifa62e15dc39701ba2c0ddbd7ad0ab6274b254d11 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2980443 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* trogdor: Drop the workaround of hibernateWai-Hong Tam2021-06-211-10/+0
| | | | | | | | | | | | | | | We added the hibernate workaround for the boards without the pull-up rework. The latest Trogdor revision has the external pull-up. So it doesn't need the workaround for the bug b/170324206. BRANCH=None BUG=b:184071830, b:170324206 TEST=Built the Trogdor image. Change-Id: I62cb3126b4ed4b2c38f04f0b3c937130c1b6fe9a Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2971866 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* trogdor: Drop the support of legacy board revisionsWai-Hong Tam2021-06-211-17/+0
| | | | | | | | | | | | | | The older board revisions use a different EC part. No way to support it using the same EC image. Totally drop the support. BRANCH=None BUG=b:184071830 TEST=Built the Trogdor image. Change-Id: Ib495d69eeb1b4894c87b45ad86a29fd43a0befd9 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2971865 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Update the GPIO names for rev-2Wai-Hong Tam2021-06-041-4/+4
| | | | | | | | | | | | | | Update the GPIO names according to the rev-2 schematic Define the unused pins. BRANCH=None BUG=b:184071830 TEST=Build the Trogdor image and test it on the rev-2 board. Change-Id: Ida8bdbf0dc63984d1f31b4db8b7b6f39f8b33e41 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2911506 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Enable Trogdor as a convertibleWai-Hong Tam2021-05-171-0/+60
| | | | | | | | | | | | | | | | | | | | | | | | Trogdor rev-0 and rev-1 are clamshell designs. Trogdor rev-2 is a convertible design. We don't support rev-0 and rev-1. Make it straight to a convertible: * Add the lid acceleration sensor * Just assign a random rotation metrix, as no chassis * Add the GPIO TABLET_MODE_L interrupt * Enable lid angle detection that disables keyboard * Enable sensors in S3 for the above angle detection BRANCH=None BUG=b:187343625 TEST=Build the Trogdor image and enable "accelinfo on" which shows the lid accel reading and the lid angle. As the lid accel sensor is not mounted to the lid surface. The lid accel reading and the lid angle are not accurate. Change-Id: I16af2c63181eb6037fbf6742c07427e20064c335 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2895920 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* qcom: Generalize the filenames for Qualcomm chipsetsWai-Hong Tam2021-05-171-1/+1
| | | | | | | | | | | | | | | The existing SC7180 power sequence can be reused on its next generation. Generalize the filenames, sc7180.c/sc7180.h to qcom.c/qcom.h. BRANCH=None BUG=b:187980397 TEST=Built all the Chromium EC images and Zephyr EC images. Change-Id: Ie04218ef0a12a4e8aa2db353040c5c39c533ae6f Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2893484 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* sc7180: move switchcap declarations to common headerJack Rosenthal2021-03-191-0/+1
| | | | | | | | | | | | | | | | | | | | | sc7180 depends on board specific functions: - board_set_switchcap_power - board_is_switchcap_enabled - board_is_switchcap_power_good The declaration for these functions were copied between many board.h files. Move the declaration to the new sc7180.h file so it can be commonly sourced. BUG=b:183054226 BRANCH=none TEST=make buildall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: Icecb6220bfecdbee665dacb0834ab5752b06815b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774363 Reviewed-by: Wai-Hong Tam <waihong@google.com>
* task_set_event: remove the wait argumentDawid Niedzwiecki2020-12-141-2/+2
| | | | | | | | | | | | | | | | | | | | There is an option in the task_set_event function which force the calling task to wait for an event. However, the option is never used thus remove it. This also will help in the Zephyr migration process. BUG=b:172360521 BRANCH=none TEST=make buildall Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: Ic152fd3d6862d487bcc0024c48d136556c0b81bc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2521599 Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Tom Hughes <tomhughes@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* Trogdor: Add the interrupt for USB-A overcurrentWai-Hong Tam2020-11-181-0/+18
| | | | | | | | | | | | | | | | | | | | | The USB-A VBUS is through a load switch. The FAULT_L pin of the load switch requires an external pull-up. Apply the pull-up on EC side. Add the interrupt of the FAULT_L pin. Route to the function board_overcurrent_event(), which currently prints an error message. BRANCH=Trogdor BUG=b:173154219 TEST=Plugged a USB load >1.5A to the USB-A port and checked the error message was printed: [73.738372 p2: overcurrent!] Change-Id: I5f5f82de942eaf26a33051ad17f14b90d8024b89 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2547190 Reviewed-by: Alexandru M Stan <amstan@chromium.org>
* Trogdor: Apply PD to sensors' interrupts before entering hibernateWai-Hong Tam2020-11-021-0/+9
| | | | | | | | | | | | | | | | Sensors are unpowered in hibernate. Apply PD to the interrupt lines such that they don't float. Don't need to remove the PD as they will be restored to the gpio.inc configs before the interrupts are enabled. BRANCH=None BUG=b:169595541 TEST=Triggered EC hibernate, woke up, and verified sensors working. Change-Id: I18819700d454fbbc16b28f65dad9533d97aa7d4c Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2511805 Reviewed-by: Alexandru M Stan <amstan@chromium.org> Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Do not activate g-sensors in S5Wai-Hong Tam2020-10-231-2/+2
| | | | | | | | | | | | | | | | | The g-sensors are not necessary to be active in S5; no gesture recognition in Trogdor designs. Do not activate it in S5. Though without this change, EC doesn't read the g-sensors as there is no config (zero odr) for S5. BRANCH=None BUG=b:170288119 TEST=Still read the g-sensors on S0 and S3. Change-Id: I54e8012e2674e13273e5fe9b96e9e9e6086e6490 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2492529 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Enable PPC power sink path before hibernate on old boardsWai-Hong Tam2020-10-081-0/+13
| | | | | | | | | | | | | | | | | | | | | | The old boards don't have the hardware fix b/169797080. They need the workaround to make ACOK functional to wake EC up from hibernate. EC enables the PPC power sink path before EC enters hibernate, such that the ACOK won't be blocked by PPC. Otherwise, the PPC keeps the sink path disconnected; ACOK won't go High and can't wake EC up. Do it in board_hibernate() instead of board_hibernate_late(), which has I2C disabled. BRANCH=None BUG=b:170324206 TEST=Tested on Lazor, without the hardware rework. Triggered EC into hibernate; plugging AC can wake EC up. Change-Id: I3a97f59a344aff88b12fb19e2ea3ae126d1a8715 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2461939 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Mask proper Search key location on the board levelWai-Hong Tam2020-09-261-0/+21
| | | | | | | | | | | | | | | | | | | | Don't use the default key mask, which enables both the old location (KSO_01/KSI_00) and the new location (KSO_00/KSI_03) for the Search key. It makes EC over-doing ghost detection. Define the key mask on the board level: * Trogdor/Lazor uses the old location * Pompom uses the new location * Coachz has no keyboard BRANCH=None BUG=b:169361784 TEST=Tested on Lazor, enabled "ksstate on" in EC console, pressed Grave + Tab + Left-Ctrl and saw these keys detected. Change-Id: I0cf37921901a4f997edbef3ac6a89e4351e742d7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2432449 Reviewed-by: Douglas Anderson <dianders@chromium.org>
* Trogdor: Move the I2C config to the board levelWai-Hong Tam2020-09-171-0/+16
| | | | | | | | | | | | | | | | | Move the I2C config to the board level such that they can have different configs. Also add the extra I2C bus for WLC on Coachz. The device on this I2C bus supports fast-mode plus, 1Mbit/s. BRANCH=None BUG=b:167884598 TEST=Built all Trogdor variants. Change-Id: Ibcb0e110e1b2c67f8ba843c2dc08efabeb5fe9ba Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2412821 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* Trogdor: Remove the references to BC1.2 VBUS detection GPIOWai-Hong Tam2020-09-161-4/+0
| | | | | | | | | | | | | | | We switched to use the TCPC to detect the VBUS, instead of the BC1.2, from CL:2086092. But the BC1.2 VBUS detection GPIOs are still used. Remove these references. BRANCH=None BUG=b:150682632, b:167884598 TEST=Built the affected Trogdor boards. Change-Id: I66d59b16cd93b1dbf460a56a9bc97268d571f6d1 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2410851 Reviewed-by: Stephen Boyd <swboyd@chromium.org>
* sc7180: Decouple the switchcap control from the power sequenceWai-Hong Tam2020-09-021-0/+15
| | | | | | | | | | | | | | | | | Currently, SC7180 power sequence is tightly coupled with a single switchcap part, i.e. DA9313. Should decouple the switchcap control from the power sequence, such that more different switchcap parts can be supported. BRANCH=None BUG=b:163867792 TEST=Built the affect images and booted into kernel. Change-Id: I7f63cd22bbc308672c40a734be4f6dfc80e07158 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2386480 Reviewed-by: Stephen Boyd <swboyd@chromium.org> Reviewed-by: Philip Chen <philipchen@chromium.org>
* Trogdor: Initialize the backlight PWMs to be disabledWai-Hong Tam2020-07-101-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are 2 PWMs for the backlight: display and keyboard. The keyboard background is controlled by the keyboard_backlight.c. The board file doesn't need to define its behavior. So move it from the board.c. The display backlight should be initialized to 0% duty cycle and set to disabled at the beginning. AP will override the value later. When resume from suspend, keep it disabled if the duty cycle is 0%. BRANCH=None BUG=b:157489286 TEST=When EC reboot, the display backlight (channel:1) is disabled. > pwm PWM channels: 0: disabled 1: disabled When booting into the userspace, the display backlight is set to 34%. > pwm PWM channels: 0: disabled 1: 34% Manually set the brightness to 0%. > pwm PWM channels: 0: disabled 1: disabled Change-Id: I07207969b1541326e77167eadc04899554d858dd Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2290830 Reviewed-by: Douglas Anderson <dianders@chromium.org>
* 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>