Commit 8129d25e authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Arnd Bergmann

bus: ts-nbus: Convert to atomic pwm API

With this change the PWM hardware is only configured once (instead of
three times).
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
parent f0379bd1
...@@ -273,7 +273,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write); ...@@ -273,7 +273,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write);
static int ts_nbus_probe(struct platform_device *pdev) static int ts_nbus_probe(struct platform_device *pdev)
{ {
struct pwm_device *pwm; struct pwm_device *pwm;
struct pwm_args pargs; struct pwm_state state;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct ts_nbus *ts_nbus; struct ts_nbus *ts_nbus;
int ret; int ret;
...@@ -296,25 +296,22 @@ static int ts_nbus_probe(struct platform_device *pdev) ...@@ -296,25 +296,22 @@ static int ts_nbus_probe(struct platform_device *pdev)
return ret; return ret;
} }
pwm_get_args(pwm, &pargs); pwm_init_state(pwm, &state);
if (!pargs.period) { if (!state.period) {
dev_err(&pdev->dev, "invalid PWM period\n"); dev_err(&pdev->dev, "invalid PWM period\n");
return -EINVAL; return -EINVAL;
} }
/* state.duty_cycle = state.period;
* FIXME: pwm_apply_args() should be removed when switching to state.enabled = true;
* the atomic PWM API.
*/ ret = pwm_apply_state(pwm, &state);
pwm_apply_args(pwm);
ret = pwm_config(pwm, pargs.period, pargs.period);
if (ret < 0) if (ret < 0)
return ret; return ret;
/* /*
* we can now start the FPGA and populate the peripherals. * we can now start the FPGA and populate the peripherals.
*/ */
pwm_enable(pwm);
ts_nbus->pwm = pwm; ts_nbus->pwm = pwm;
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment