[PATCH v3] sandbox: cros-ec: Add tests for the Chromium OS EC PWM driver

Simon Glass sjg at chromium.org
Sun Jul 4 22:15:25 CEST 2021


This patch adds a limited pulse-width modulator to sandbox's Chromium OS
Embedded Controller emulation. The emulated PWM device supports multiple
channels but can only set a duty cycle for each, as the actual EC
doesn't expose any functionality or information other than that. Though
the EC supports specifying the PWM channel by its type (e.g. display
backlight, keyboard backlight), this is not implemented in the emulation
as nothing in U-Boot uses this type specification.

This emulated PWM device is then used to test the Chromium OS PWM driver
in sandbox. Adding the required device node to the sandbox test
device-tree unfortunately makes it the first PWM device, so this also
touches some other tests to make sure they still use the sandbox PWM.

Signed-off-by: Alper Nebi Yasak <alpernebiyasak at gmail.com>
Reviewed-by: Simon Glass <sjg at chromium.org>
---
This depends on a small fix [1] for cros-ec-pwm which otherwise fails to
build.

[1] https://patchwork.ozlabs.org/project/uboot/patch/20210514134840.19380-1-alpernebiyasak@gmail.com/

Changes in v3:
- Add tag: "Reviewed-by: Simon Glass <sjg at chromium.org>"
- Replace instances of "Chrome OS" with "Chromium OS" in commit message
- Add missing "EC" in the subject line

v2: https://patchwork.ozlabs.org/project/uboot/patch/20210519153017.12544-1-alpernebiyasak@gmail.com/

Changes in v2:
- Try to clarify commit message

v1: https://patchwork.ozlabs.org/project/uboot/patch/20210516154144.141945-1-alpernebiyasak@gmail.com/

 arch/sandbox/dts/test.dts          |  6 +++
 arch/sandbox/include/asm/test.h    | 10 +++++
 configs/sandbox64_defconfig        |  1 +
 configs/sandbox_defconfig          |  1 +
 configs/sandbox_flattree_defconfig |  1 +
 configs/sandbox_noinst_defconfig   |  1 +
 configs/sandbox_spl_defconfig      |  1 +
 drivers/misc/cros_ec_sandbox.c     | 47 +++++++++++++++++++++++
 test/cmd/pwm.c                     | 32 +++++++++++++++-
 test/dm/Makefile                   |  1 +
 test/dm/cros_ec_pwm.c              | 60 ++++++++++++++++++++++++++++++
 test/dm/panel.c                    |  2 +-
 test/dm/pwm.c                      |  6 ++-
 13 files changed, 164 insertions(+), 5 deletions(-)
 create mode 100644 test/dm/cros_ec_pwm.c

Applied to u-boot-dm/next, thanks!


More information about the U-Boot mailing list