UPSTREAM: pwm: Add ChromeOS EC PWM driver
authorBrian Norris <briannorris@chromium.org>
Fri, 15 Jul 2016 23:28:44 +0000 (16:28 -0700)
committerHuang, Tao <huangtao@rock-chips.com>
Mon, 6 Mar 2017 10:28:40 +0000 (18:28 +0800)
commit155c86c803c69b4d412ad96cc8f2e59e14696369
tree59e0e3a4df8d65339263d58f89a7f178ab21370d
parent3aa4b5061c6e147a802f5e51242bafc4f430d94d
UPSTREAM: pwm: Add ChromeOS EC PWM driver

Use the new ChromeOS EC EC_CMD_PWM_{GET,SET}_DUTY commands to control
one or more PWMs attached to the Embedded Controller. Because the EC
allows us to modify the duty cycle (as a percentage, where U16_MAX is
100%) but not the period, we assign the period a fixed value of
EC_PWM_MAX_DUTY and reject all attempts to change it.

This driver supports only device tree at the moment, because that
provides a very flexible way of describing the relationship between PWMs
and their consumer devices (e.g., backlight). On a non-DT system, we'll
probably want to use the non-GENERIC addressing (i.e., we'll need to
make special device instances that will use EC_PWM_TYPE_KB_LIGHT or
EC_PWM_TYPE_DISPLAY_LIGHT), as well as the relatively inflexible
pwm_lookup infrastructure for matching devices. Defer that work for now.

Signed-off-by: Brian Norris <briannorris@chromium.org>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
(cherry picked from commit 1f0d3bb02785f698dc273b9006a473194c32f874)

Change-Id: I47dbb20b10ae1b941e50e9a783cb708dff8f7efd
Signed-off-by: David Wu <david.wu@rock-chips.com>
drivers/pwm/Kconfig
drivers/pwm/Makefile
drivers/pwm/pwm-cros-ec.c [new file with mode: 0644]