diff options
author | Thierry Reding <thierry.reding@gmail.com> | 2016-05-17 15:57:58 +0300 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2016-05-17 15:57:58 +0300 |
commit | 18c588786c08458f5d965d8735ab48f9e51e0b4b (patch) | |
tree | 925893d58c00432f93830d1b83405c9d44d79bb8 /drivers/clk | |
parent | d2a3f206846b4b140aa1fe5be29499e9191fb1fe (diff) | |
parent | 23e3523f5d3a980edf7f189743cf4bb9490400a9 (diff) | |
download | linux-18c588786c08458f5d965d8735ab48f9e51e0b4b.tar.xz |
Merge branch 'for-4.7/pwm-atomic' into for-next
Diffstat (limited to 'drivers/clk')
-rw-r--r-- | drivers/clk/clk-pwm.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/drivers/clk/clk-pwm.c b/drivers/clk/clk-pwm.c index 883045814dac..1630a1f085f7 100644 --- a/drivers/clk/clk-pwm.c +++ b/drivers/clk/clk-pwm.c @@ -59,6 +59,7 @@ static int clk_pwm_probe(struct platform_device *pdev) struct clk_init_data init; struct clk_pwm *clk_pwm; struct pwm_device *pwm; + struct pwm_args pargs; const char *clk_name; struct clk *clk; int ret; @@ -71,22 +72,28 @@ static int clk_pwm_probe(struct platform_device *pdev) if (IS_ERR(pwm)) return PTR_ERR(pwm); - if (!pwm->period) { + pwm_get_args(pwm, &pargs); + if (!pargs.period) { dev_err(&pdev->dev, "invalid PWM period\n"); return -EINVAL; } if (of_property_read_u32(node, "clock-frequency", &clk_pwm->fixed_rate)) - clk_pwm->fixed_rate = NSEC_PER_SEC / pwm->period; + clk_pwm->fixed_rate = NSEC_PER_SEC / pargs.period; - if (pwm->period != NSEC_PER_SEC / clk_pwm->fixed_rate && - pwm->period != DIV_ROUND_UP(NSEC_PER_SEC, clk_pwm->fixed_rate)) { + if (pargs.period != NSEC_PER_SEC / clk_pwm->fixed_rate && + pargs.period != DIV_ROUND_UP(NSEC_PER_SEC, clk_pwm->fixed_rate)) { dev_err(&pdev->dev, "clock-frequency does not match PWM period\n"); return -EINVAL; } - ret = pwm_config(pwm, (pwm->period + 1) >> 1, pwm->period); + /* + * FIXME: pwm_apply_args() should be removed when switching to the + * atomic PWM API. + */ + pwm_apply_args(pwm); + ret = pwm_config(pwm, (pargs.period + 1) >> 1, pargs.period); if (ret < 0) return ret; |