summaryrefslogtreecommitdiff
path: root/include/pwm.h
diff options
context:
space:
mode:
authorAlper Nebi Yasak <alpernebiyasak@gmail.com>2020-10-22 23:49:26 +0300
committerAnatolij Gustschin <agust@denx.de>2021-04-10 17:07:12 +0300
commitfefa713b1843cf13d3132bfe0cf27710938c5d92 (patch)
tree4ae09212a60da99436d30eb24b3f9d041553cdbe /include/pwm.h
parent9749d2ea29e1a535c9ea8f850db8b6abe6df7b15 (diff)
downloadu-boot-fefa713b1843cf13d3132bfe0cf27710938c5d92.tar.xz
video: backlight: Support PWMs without a known period_ns
The PWM device provided by Chrome OS EC doesn't really support anything other than setting a relative duty cycle. To support it as a backlight, this patch makes the PWM period optional in the device tree and pretends the valid brightness range is its period_ns. Also adds a sandbox test for a PWM channel that has a fixed period, checking that the resulting duty_cycle matches on a set_config() even if the requested period_ns can't be set. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/pwm.h')
-rw-r--r--include/pwm.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/pwm.h b/include/pwm.h
index f9959706ce..668551e4b8 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -17,6 +17,10 @@ struct pwm_ops {
/**
* set_config() - Set the PWM configuration
*
+ * Change both the PWM device's period and it's duty period if
+ * possible. Otherwise, set an appropriate duty period that best
+ * matches the given period_ns / duty_ns ratio for the device.
+ *
* @dev: PWM device to update
* @channel: PWM channel to update
* @period_ns: PWM period in nanoseconds
@@ -51,6 +55,10 @@ struct pwm_ops {
/**
* pwm_set_config() - Set the PWM configuration
*
+ * Change both the PWM device's period and it's duty period if
+ * possible. Otherwise, set an appropriate duty period that best
+ * matches the given period_ns / duty_ns ratio for the device.
+ *
* @dev: PWM device to update
* @channel: PWM channel to update
* @period_ns: PWM period in nanoseconds