summaryrefslogtreecommitdiff
path: root/zephyr
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: lazor: enable RTCWai-Hong Tam2021-03-252-0/+5
| | | | | | | | | | | | | | | | | | | | Enable PLATFORM_EC_RTC and PLATFORM_EC_CONSOLE_CMD_RTC. BRANCH=None BUG=b:182398910 TEST=Tested on Lazor. The RTC counted. Can set it. uart:~$ rtc RTC: 0x605ccb65 (1616694117.00 s) uart:~$ rtc RTC: 0x605ccb93 (1616694163.00 s) uart:~$ rtc set 12345 RTC: 0x00003039 (12345.00 s) Change-Id: Iecd67ea279508aaa28c81b6d28b7aa2e118023b2 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2787084 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* Revert "ps8815: delete CONFIG_USB_PD_TCPM_PS8815_FORCE_DID"Zhuohao Lee2021-03-251-0/+1
| | | | | | | | | | | | | | | | | This reverts commit e2761c8be4571adcfc425a9187290872ffa9d02d. In order to support the old TCPC chip which bcd revision is smaller than 0x7, we need to bring back the CONFIG_USB_PD_TCPM_PS8815_FORCE_DID and force the TCPC firmware be updated in the factory line. BUG=b:177251013, b:159289062, b:182018599, b:178978970 BRANCH=firmware-volteer-13672.B TEST=the old TCPC chip can update its firmware. Signed-off-by: Zhuohao Lee <zhuohao@chromium.org> Change-Id: I66d12aee569137cc7823a186e3251ca8b187e767 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2784327 Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: delbin: bringup keyboardJack Rosenthal2021-03-243-2/+36
| | | | | | | | | | | | | | Enable keyboard support. BUG=b:180410072 BRANCH=none TEST=use keyboard in ChromeOS Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I82c6e8a0a289ae10f9aaae532fc5d7359eea3ec0 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2727847 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: remove unused compiler definitionsKeith Short2021-03-241-14/+0
| | | | | | | | | | | | | | | Remove the CHIP_FAMILY_ and CHIP_VARIANT_ preprocessor definitions that are not used. BUG=none BRANCH=none TEST=zmake testall Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: Ied1d49495109ea99029196d4ad65462381c2581b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777124 Commit-Queue: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable link time optimization for board filesKeith Short2021-03-244-23/+22
| | | | | | | | | | | | | | | | | | | Move the baseboard and board files into the zephyr_ec library to take advantage of the LTO compiler option enabled for the zephyr_ec library. On Volteer, this reduces the image size by 832 bytes. Total LTO saving is just over 10,000 bytes. BUG=none BRANCH=none TEST=zmake testall TEST=boot zephry-ec on Volteer, verify AP boots Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I2f3aa7f6c400a5b5cd1b346fcf52160b834e66a3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776218 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Enable link time optimization (LTO)Keith Short2021-03-247-148/+191
| | | | | | | | | | | | | | | | | | | The upstream Zephyr repo does not support LTO. Reconfigure the platform/ec source files into a cmake library so the LTO option can be enabled for all the platorm/ec sources. This reduces the Volteer flash image size by 9176 bytes. BUG=none BRANCH=none TEST=zmake testall TEST=boot zephyr-ec on Volteer, verfiy AP boots Cq-Depend: chromium:2776218 Signed-off-by: Keith Short <keithshort@chromium.org> Change-Id: I8312773c8b21c498ec8116a8558b7571831159ff Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776217 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: Connect up the USB interruptsSimon Glass2021-03-241-1/+6
| | | | | | | | | | | | | | | Now that all the code is accessible to zephyr, connect up the interrupt handlers so that events are dealt with. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie4790ae85efb7e63fb472d3081c4288f16b31c1f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777647 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org>
* zephyr: lazor: Add initial USC-C config into the buildSimon Glass2021-03-243-2/+57
| | | | | | | | | | | | | | | | | | Add this file into the zephyr build along with the required CONFIG options and device tree additions, so we can make a start on bringing up USB-C and charging functionality. Add all the required GPIOs here as well, so that things will work when we move the code over in the following CLs. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I8c4f54664d2d18b44ed8992e61e7b2f694f04f93 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777642 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: volteer: enable BOARD_RESET_AFTER_POWER_ONWealian Liao2021-03-241-0/+1
| | | | | | | | | | | | | | | | | | | This enables BOARD_RESET_AFTER_POWER_ON feature for volteer. BUG=b:178101173 BRANCH=None. TEST=zmake testall TEST=check the following reset cause 1. power-up 2. reset-pin reset Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ie1b0fc4b41227bc23d6a58e62af5e35e6f154ad3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2771130 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Keith Short <keithshort@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: npcx: add reset cause checkWealian Liao2021-03-249-43/+288
| | | | | | | | | | | | | | | | | | | | | | | | | | | The reset cause will influence the initialization flow. We define some of initial flow of the reset cause for the following development. This CL include the following: 1. Add check_reset_cause() which sets the system reset flag. 2. Add chip_bbram_status_check() to clear the error status & show the error message. 3. Add CONFIG_BOARD_RESET_AFTER_POWER_ON feature. 4. Define the initialize flow for reset cause. BRANCH=none BUG=b:178101173 TEST=check the following reset cause by 'sysinfo' 1. power-up 2. reset-pin reset 3. soft by 'reboot' console command 4. watchdog by 'waitms 2000' Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I515868d8cda4544fdbe782210b0108b4dda0d8cc Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2731180 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org>
* zephyr: kconfig: set BOARD_RESET_AFTER_POWER_ON default disableWealian Liao2021-03-241-1/+0
| | | | | | | | | | | | | | | | | | | | CONFIG_BOARD_RESET_AFTER_POWER_ON default disable in config.h. Moreover, the early delay mechanism hasn't been implemented for CONFIG_BOARD_RESET_AFTER_POWER_ON feature delay. Set to default disable to avoid misconfigure it. BUG=b:182875520 BRANCH=None. TEST=zmake testall Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I65100f3a5a1b7ceb1907f17142cd0ace130aeea5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2771129 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Commit-Queue: Keith Short <keithshort@chromium.org> Tested-by: Keith Short <keithshort@chromium.org>
* zephyr: volteer: enable RTCWealian Liao2021-03-242-0/+4
| | | | | | | | | | | | | | | Enable CONFIG_RTC for volteer. BUG=None. BRANCH=None. TEST=zmake testall TEST=check console show RTC value after powerbtn press "RTC: 0x000003ae (942.00 s)" Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I129c20d8a32e87837a7042dd5bb16900d1d9f5ba Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2767059 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: shim: connect RTC with cros_rtc driverWealian Liao2021-03-241-25/+93
| | | | | | | | | | | | | | This connect shim/rtc with cros_rtc driver. BUG=b:178230662 BRANCH=None. TEST=check rtc value by 'ectool rtcset 10' & 'ectool rtcget' check rtc alarm by 'ectool rtcsetalarm 10' & 'ectool rtcgetalarm' Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I4171074ff58ab32e5386dedea3695adbc40f58f6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2767058 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: kconfig: set rtc default disableWealian Liao2021-03-242-6/+0
| | | | | | | | | | | | | | | | | | CONFIG_RTC, CONFIG_CMD_RTC, CONFIG_CMD_RTC_ALARM, and CONFIG_HOSTCMD_RTC are default disable in config.h. Set the PLATFORM_EC_RTC, PLATFORM_EC_CONSOLE_CMD_RTC, PLATFORM_EC_CONSOLE_CMD_RTC_ALARM, and PLATFORM_EC_HOSTCMD_RTC to default disable. Sync with the original behavior. BUG=b:178230662 BRANCH=None. TEST=zmake testall Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: I7c5b9ff1d494adaaef0420d28d93f8aed3ff2cc7 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2767057 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: add cros_rtc_npcx driver for npcx7 seriesMulin Chao2021-03-246-0/+296
| | | | | | | | | | | | | | | | | This implements cros_rtc_npcx driver for Zephyr OS-based EC. For the NPCX7 chip, NPCX Monotonic Counter(MTC) provides a time-keeping function with a resolution of one second. MTC is selected to implement the cros_rtc_npcx driver. BUG=b:178230662 BRANCH=None. TEST=zmake testall Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ibd9e27efe4a8b84cdac6d61539742c4f3eb93fce Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2767056 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: driver: add CROS_RTC apiMulin Chao2021-03-246-0/+244
| | | | | | | | | | | | | | | | | Add Real-Time Clock (RTC) API for Zephyr OS-based ec. Currently, Zephyr doesn't provide setting RTC value functionality in the counter driver api interface. Hence, a cros RTC api provides the low-level driver interface related to it and the others used in cros ec. BUG=b:178230662 BRANCH=None. TEST=zmake testall Signed-off-by: Mulin Chao <mlchao@nuvoton.com> Signed-off-by: Wealian Liao <whliao@nuvoton.corp-partner.google.com> Change-Id: Ia4b10739fbf65fa7213022cac6a17d2a9bc56b10 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777938 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add support for multiple Parade PS8xxx chipsSimon Glass2021-03-242-0/+26
| | | | | | | | | | | | | | Some designs use different chips. The driver supports them all but needs to know which one is on which port. Add support for this feature in Zephyr. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I497da5e865e764d74242c00bf2fb0d309fae7061 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777638
* zephyr: Add two more Parade PS8xxx chips to the buildSimon Glass2021-03-243-0/+32
| | | | | | | | | | | | | Parade PS8751 and PS8805 are needed by lazor so add support for them in the Zephyr build. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic93a0568d1c505cb496dd92c128d0b05ddef93cd Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777637
* zephyr: lazor: Add supported batteriesSimon Glass2021-03-243-0/+36
| | | | | | | | | | | | | | | Lazor supports five different batteries. Add these to the binding and create a new file to hold the battery information, as we do with GPIOs. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie8eac2ed08577e28d63a8119c8ced3bf825e165a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777636 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: volteer: Drop hard-coded battery enumerationSimon Glass2021-03-242-5/+18
| | | | | | | | | | | | | | | | | | | | | | | Now that this enum is available in a header file, include it in the build, so it is available to any file that needs it. With ECOS the enum is assumed to be present since it is declared in the board.h header file. This lets us tidy up the hard-coded enum in config_chip.h so we can enable the battery on other boards. Add the required config to volteer. BUG=b:176121284 BRANCH=none TEST=zmake configure -B /tmp/z/vol zephyr/projects/volteer -t zephyr && zmake -L build /tmp/z/vol Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I636410a38d156061efe67798c99a7d60c9fc6096 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777635 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add a binding for named batteriesSimon Glass2021-03-242-0/+39
| | | | | | | | | | | | | | | | | | | Each board has its own list of supported batteries, taken from a set of possible ones. Create a binding for this so we can generate the enum from the device tree. We can add new battery types as needed. For now, just include the battery for volteer. Add a new header file to generate enum battery_type. BUG=b:176121284 BRANCH=none TEST=build zephry for volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I6452705250075423ed6b5c87fdf32eda3f31c32b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777634
* zephyr: lazor: enable keyboard supportWai-Hong Tam2021-03-243-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define the keyboard scanlines and the inverted KSO2 GPIO. Enable the keyboard-related configs. Some warning of "MKBP not cleared" or "MKBP FIFO being full" will be showed as the SHI driver is not ready. The MKBP FIFO won't be dequeued. BRANCH=None BUG=b:183445211 TEST=Tested on Lazor by pressing keys, including KSO2. uart:~$ ksstate on [26.075200 KB debounced : -- -- -- -- -- -- -- -- -- -- -- -- --] [26.079600 KB debouncing: -- -- -- -- -- -- -- -- -- -- -- -- --] Keyboard scan disable mask: 0x00000000 Keyboard scan state printing on uart:~$ [29.269700 KB state: -- 02 -- -- -- -- -- -- -- -- -- -- --] [29.392000 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [30.244000 KB state: -- -- 01 -- -- -- -- -- -- -- -- -- --] [30.274000 MKBP not cleared within threshold, toggling.] [30.359600 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [31.278800 MKBP not cleared within threshold, toggling.] [31.872900 KB state: -- -- 08 -- -- -- -- -- -- -- -- -- --] [32.005100 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [33.060500 KB state: -- -- 04 -- -- -- -- -- -- -- -- -- --] [33.189500 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [34.065100 MKBP not cleared within threshold, toggling.] [34.454100 KB state: -- -- 02 -- -- -- -- -- -- -- -- -- --] [34.556600 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [35.069300 MKBP not cleared within threshold, toggling.] [37.356900 KB state: -- -- -- -- 08 -- -- -- -- -- -- -- --] [37.452900 KB state: -- -- -- -- -- -- -- -- -- -- -- -- --] [38.361500 MKBP not cleared within threshold, toggling.] [39.365800 MKBP not cleared within threshold, toggling.] Change-Id: I02390e85f9454d5c93cd54d333d2e242e0c54911 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782368 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: enable MKBP protocolWai-Hong Tam2021-03-242-0/+5
| | | | | | | | | | | | | | | | | Enable MKBP protocol. Lazor uses GPIO to interrupt the AP. So far, it just sends an interrupt to AP. Since the SHI driver is not ready, when AP sends the host command to EC, EC won't respond. BRANCH=None BUG=b:183445211 TEST=Built the image correctly. With the following CLs, tested the keyboard working on Lazor. Change-Id: Idc32926d4b187ce6f4a95158a26647ad1cea36e3 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782367 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: don't limit the console commands to 8042 protocolWai-Hong Tam2021-03-242-5/+11
| | | | | | | | | | | | | | | | The CrOS EC CONFIG_CMD_KEYBOARD also enables the commands ksstate and kbpress, which are not limited to 8042 protocol. Rename the Kconfig to drop the 8042 term and update the help. BRANCH=None BUG=b:183445211 TEST=Built the image correctly. With the following CLs, tested the keyboard working on Lazor. Change-Id: Ib53446f8264d6f72157f989a1506e1bac9bd9023 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782366 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: shim the MKBP-protocol keyboard supportWai-Hong Tam2021-03-243-0/+15
| | | | | | | | | | | | | | | | | The MKBP protocol is usually used on ARM-based platforms for keyboard communication. It sends the raw scan code, like (row, col), to the AP and the kernel driver will map the scan code to a key. BRANCH=None BUG=b:183445211 TEST=Built the image correctly. With the following CLs, tested the keyboard working on Lazor. Change-Id: I9453c3e6f6629fc11135e56bdfe909635844932c Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782365 Reviewed-by: Simon Glass <sjg@chromium.org>
* Revert "zephyr: volteer: disable motion sense"Hyungwoo Yang2021-03-241-0/+18
| | | | | | | | | | | | This reverts commit e321487d4385143f64cfd8ed9cfe3aa485f85008. Configuring sensors via DT is ready so enables motion sense. Change-Id: If9720e4b06432d050933ceae589e83d3da8d1e51 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778826 Tested-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Commit-Queue: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: use device tree for sensor configHyungwoo Yang2021-03-245-52/+35
| | | | | | | | | This change switches to use device tree for sensor configuration. Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Ibadd91ce26520973ce4f70580e66abe484c0ca75 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778825 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: volteer: add device treeHyungwoo Yang2021-03-242-3/+268
| | | | | | | | | This change adds device tree for Volteer project. Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I7ab169d0fd21e9d590071746b281c4eada144095 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778824 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: volteer: disable motion senseHyungwoo Yang2021-03-241-18/+0
| | | | | | | | | | | | This change disables motion sense temporarily. To enable DT-based sensor configuration, We need to disable motion sense temporarily. Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Id06de91a7909cb81818ae9df3f183e7d0cbb01e3 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778823 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support TCS3400Hyungwoo Yang2021-03-247-0/+169
| | | | | | | | | | | | | | | | | | This change is to support TCS3400 via DT. The change includes, using DT, - creating TCS3400 driver specific data - creating motion sensor entry for TCS3400 - creating the TCS3400 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I09cb7d69baa95c8450c7f5cc0149038aa23f3bc9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778822 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support BMI260Hyungwoo Yang2021-03-246-0/+112
| | | | | | | | | | | | | | | | | | This change is to support BMI260 via DT. The change includes, using DT, - creating BMI260 driver specific data - creating motion sensor entry for BMI260 - creating the BMI260 irq event to motion sense task BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Id5c64df4d2f14a50709ac15855567a67671b8515 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778821 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support BMA255Hyungwoo Yang2021-03-244-0/+88
| | | | | | | | | | | | | | | | | This change is to support BMA255 via DT. The change includes, using DT, - creating BMA255 driver specific data - creating motion sensor entry for BMA255 BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Change-Id: Ie67dc1fb7a25872d48c805b5ba4385dae399f240 Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778820 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support CONFIG_ACCEL_FORCE_MODE_MASKHyungwoo Yang2021-03-242-0/+32
| | | | | | | | | | | | | | | This change support to create CONFIG_ACCEL_FORCE_MODE_MASK using the information from DT. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Change-Id: Ibd9a3ca2a699b2bd95bdbb3c6ce7b195d460d5d1 Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778819 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support sensor irq enablingHyungwoo Yang2021-03-242-0/+38
| | | | | | | | | | | | | | | This change allows motion sensor interrupt to be enabled at initial stage. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Ib85a1015110ae0a43c62a10c97e0d8f21a86319d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778818 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support creating motion_als_sensorsHyungwoo Yang2021-03-243-0/+68
| | | | | | | | | | | | | | | This change allows to create motion_als_sensors array by using the information from DT. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Ic1c169d8f98de9f6b09f68d99844cb709f57e33d Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778817 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: basic support for motion sensorHyungwoo Yang2021-03-245-0/+386
| | | | | | | | | | | | | | | This change allows sensor drivers to create motion sensor entry using the information from DT. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I1cae9760492966601c1d98050764a2e93b4fc013 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778816 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add BQ25710 and BQ25720 kconfigCaveh Jalali2021-03-243-0/+36
| | | | | | | | | | | | | | | This adds the BQ25710 and BQ25720 charger chips to zephyr's kconfig structure. BRANCH=none BUG=b:173575131 TEST=buildall passes Change-Id: I0fdd08d4104991bf630221efd11c9da932e7db38 Signed-off-by: Caveh Jalali <caveh@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2762527 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: define ADC mul and div factorsWai-Hong Tam2021-03-241-0/+14
| | | | | | | | | | | | | | | | | | | | Copy the mul and div factors from board/lazor/board.c. The ADC_PSYS doesn't need the hack to handle the overflow; just set the mul factor to 124000. BUG=b:182398910 BRANCH=None TEST=Tested on Lazor: uart:~$ adc ADC_VBUS = 5060 mV ADC_AMON_BMON = 611 mV ADC_PSYS = 0 mV Change-Id: I3bd4a30eae04c584efaa2ed302b2b65e4fb4ced7 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2779749 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: lazor: enable PLATFORM_EC_PWM_DISPLIGHTWai-Hong Tam2021-03-241-0/+1
| | | | | | | | | | | | | | | | | | | In Lazor, the display backlight is controlled by the EC chipset. The kernel driver talks to EC over host command. Enable PLATFORM_EC_PWM_DISPLIGHT such that the kernel driver knows the PWM channel for the display backlight. Can't test it yet as the host command interface is not ready. BUG=b:182398910 BRANCH=None TEST=zmake testall Change-Id: I755ccabc7d27ff028a0b5f23df4b345f1bf8ca01 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2779748 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add Kconfig for PWM display backlightWai-Hong Tam2021-03-242-0/+14
| | | | | | | | | | | | | | Add a Kconfig option to enable display backlight controlled by a PWM signal connected directly to the EC chipset. BUG=b:182398910 BRANCH=None TEST=zmake testall Change-Id: I0e544116f3b467505f2ecf742c9708c20e24b275 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2779747 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Tidy up BATTERY_PRESENT_GPIOSimon Glass2021-03-232-8/+21
| | | | | | | | | | | | | | | | | | | | | | This is not a boolean CONFIG in ECOS but it must be with Zephyr. There doesn't seem to be any advantage to allowing an arbitrary name here, since the mapping is controlled in the device tree anyway. So hard-code it to GPIO_BATT_PRES_ODL and document this in the Kconfig. Also drop the unnecessary logic in config_chip.h since Kconfig handles ensuring that only one option is set. This makes the code easier to follow and avoids errors. Fix the error that is there. BUG=b:183296099 BRANCH=none TEST=make BOARD=lazor -j4 Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I55a9083ad01be2f6b1e9314f73fbbff1442e486c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777633 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: flash: change flash_lock to use K_MUTEX_DEFINEJack Rosenthal2021-03-231-9/+1
| | | | | | | | | | | | | | Switch this Zephyr-only code to use K_MUTEX_DEFINE, removing the requirement to initialize this mutex at runtime. BUG=b:177677037 BRANCH=none TEST=zmake testall Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Change-Id: I917f88d4e72d27f23503f58511b6486405631d97 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2782235 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support sensor driver dataHyungwoo Yang2021-03-237-0/+348
| | | | | | | | | | | | | | | This has basic support to create instances of sensor-specific driver data using the information from device tree. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I196d7595e8bd880e2314290660f08274ad99e172 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778815 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: DT: support sensor rotation matrixHyungwoo Yang2021-03-232-0/+81
| | | | | | | | | | | | | | | | This creates instances of rotation matrix(mat33_fp_t) which is used to convert raw value from a sensor to X, Y and Z on the defined coordinate system. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: Ifc80fe7ff33c46904af279b9f52e611c7157c346 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2778814 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add support for USB_PD_5V_EN_CUSTOMSimon Glass2021-03-232-0/+16
| | | | | | | | | | | | | | Allow this option to be enabled since it is used on lazor. BUG=b:183296099 BRANCH=none TEST=build for lazor Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ie4c57b7c42acaca6e151fc5f93a1a3ad012952ed Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2777631 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add support for hardware charge-rampingSimon Glass2021-03-233-3/+38
| | | | | | | | | | | | | | | | | | | | | | | Allow this option to be selected, turning it into a choice between the two options. Make hardware ramping the default since it seems to be preferred. It was apparently not supported on volteer only due to a bug in the charger chip. Also move the software-ramp requirement for ISL9241 to Kconfig. We cannot 'select' a choice item like PLATFORM_EC_CHARGE_RAMP_SW in PLATFORM_EC_CHARGER_ISL9241, so use a 'depends on' instead. Update volteer to use software ramping since the default has changed. BUG=b:183296099 BRANCH=none TEST=build zephyr for lazor build for volteer and check that CONFIG_PLATFORM_EC_CHARGE_RAMP_SW=y Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: Ic3ffd21cd10aa896a4c6dbe1d98d75776c89aefe Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774917 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: Add ADC mul and div factors supportDawid Niedzwiecki2021-03-222-0/+13
| | | | | | | | | | | | | | | | Some boards need to adjust ADC measurements with multiplication and division factors so add support for these also in Zephyr. BUG=b:175881324 BRANCH=none TEST=Add mul and div factors in the dts file and verify measurements with the "adc" console command Signed-off-by: Dawid Niedzwiecki <dn@semihalf.com> Change-Id: I6b716e20af18623249a4a972b6f3db8eec09a376 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2775487 Reviewed-by: Wai-Hong Tam <waihong@google.com> Commit-Queue: Wai-Hong Tam <waihong@google.com>
* zephyr: DT: support sensor driver mutexHyungwoo Yang2021-03-222-0/+67
| | | | | | | | | | | | | | | This change creates mutex instances based on information from device tree. BUG=b:173507858 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I785e58efe1db9c5fad633bbfb87be3909f253162 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2749427 Reviewed-by: Simon Glass <sjg@chromium.org>
* zephyr: Add support for ISL9237/8 chargersSimon Glass2021-03-224-2/+59
| | | | | | | | | | | | | | | | Enable the isl923x driver in the zephyr build. Update the volteer charger since the default has changed. This needs a Narrow VDC setting so add that as well. BUG=b:183296099 BRANCH=none TEST=build zephyr (no changes) Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I1991b78263c2311c3d1f8c4f30f8d3bd823a39ac Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2774915 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* zephyr: lazor: enable PWMWai-Hong Tam2021-03-223-0/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable PWM. Lazor uses PWM 3 and 5 for keyboard backlight and display backlight. The display backlight can't be tested yet. The EN pin of the LED driver IC is connected to an AND gate. One of its input is an AP's GPIO. Since the AP power sequence is not ready yet, the IC is disabled. BUG=b:182398910 BRANCH=None TEST=Tested on Lazor: uart:~$ gpioset EN_PP5000_A 1 uart:~$ pwmduty PWM channels: 0: disabled 1: disabled uart:~$ pwmduty 0 50 # The keyboard backlight is on Setting channel 0 to 50 0: 50% uart:~$ pwmduty 0 30 Setting channel 0 to 30 0: 30% uart:~$ pwmduty 0 100 Setting channel 0 to 100 0: 100% uart:~$ pwmduty 0 -1 0: disabled Change-Id: I73dca658b54fd6d4bd7668e85d60dff915faf671 Signed-off-by: Wai-Hong Tam <waihong@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2776215 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>