Skip to content

Commit 8129d25

Browse files
Uwe Kleine-Königarndb
authored andcommitted
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: Uwe Kleine-König <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
1 parent f0379bd commit 8129d25

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

drivers/bus/ts-nbus.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ EXPORT_SYMBOL_GPL(ts_nbus_write);
273273
static int ts_nbus_probe(struct platform_device *pdev)
274274
{
275275
struct pwm_device *pwm;
276-
struct pwm_args pargs;
276+
struct pwm_state state;
277277
struct device *dev = &pdev->dev;
278278
struct ts_nbus *ts_nbus;
279279
int ret;
@@ -296,25 +296,22 @@ static int ts_nbus_probe(struct platform_device *pdev)
296296
return ret;
297297
}
298298

299-
pwm_get_args(pwm, &pargs);
300-
if (!pargs.period) {
299+
pwm_init_state(pwm, &state);
300+
if (!state.period) {
301301
dev_err(&pdev->dev, "invalid PWM period\n");
302302
return -EINVAL;
303303
}
304304

305-
/*
306-
* FIXME: pwm_apply_args() should be removed when switching to
307-
* the atomic PWM API.
308-
*/
309-
pwm_apply_args(pwm);
310-
ret = pwm_config(pwm, pargs.period, pargs.period);
305+
state.duty_cycle = state.period;
306+
state.enabled = true;
307+
308+
ret = pwm_apply_state(pwm, &state);
311309
if (ret < 0)
312310
return ret;
313311

314312
/*
315313
* we can now start the FPGA and populate the peripherals.
316314
*/
317-
pwm_enable(pwm);
318315
ts_nbus->pwm = pwm;
319316

320317
/*

0 commit comments

Comments
 (0)