summaryrefslogtreecommitdiff
path: root/drivers/pwm
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@free-electrons.com>2016-04-14 21:17:40 +0200
committerThierry Reding <thierry.reding@gmail.com>2016-05-17 14:48:03 +0200
commit15fa8a43c147213a9563903c87b29671035eb6e8 (patch)
treeececf11f09885f32d8b27334d180c8a080882000 /drivers/pwm
parent09a7e4a3d9fcb95ade2cb02167e85fbeb8315ce0 (diff)
pwm: Add hardware readout infrastructure
Add a ->get_state() function to the pwm_ops struct to let PWM drivers initialize the PWM state attached to a PWM device. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Diffstat (limited to 'drivers/pwm')
-rw-r--r--drivers/pwm/core.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index c240b5437145..a909c64ee863 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -270,6 +270,9 @@ int pwmchip_add_with_polarity(struct pwm_chip *chip,
pwm->hwpwm = i;
pwm->state.polarity = polarity;
+ if (chip->ops->get_state)
+ chip->ops->get_state(chip, pwm, &pwm->state);
+
radix_tree_insert(&pwm_tree, pwm->pwm, pwm);
}