diff options
author | Kamel Bouhara <kamel.bouhara@bootlin.com> | 2019-09-18 10:57:16 -0400 |
---|---|---|
committer | Thierry Reding <thierry.reding@gmail.com> | 2019-09-20 21:25:10 -0400 |
commit | 3d4d85741ad3d880cb432d9121f5563e6a57ff2e (patch) | |
tree | 36464ab5a892dfd19dce4d911ca42b197e7d069d | |
parent | c91e3234c6035baf5a79763cb4fcd5d23ce75c2b (diff) |
pwm: atmel: Remove platform_device_id and use only dt bindings
Since commit 26202873bb51 ("avr32: remove support for AVR32
architecture") there is no more user of platform_device_id and we
should only use dt bindings
Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Claudiu Beznea <claudiu.beznea@microchip.com>
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
-rw-r--r-- | drivers/pwm/Kconfig | 2 | ||||
-rw-r--r-- | drivers/pwm/pwm-atmel.c | 35 |
2 files changed, 4 insertions, 33 deletions
diff --git a/drivers/pwm/Kconfig b/drivers/pwm/Kconfig index 31dfc88ef362..08f35e2b167e 100644 --- a/drivers/pwm/Kconfig +++ b/drivers/pwm/Kconfig | |||
@@ -44,7 +44,7 @@ config PWM_AB8500 | |||
44 | 44 | ||
45 | config PWM_ATMEL | 45 | config PWM_ATMEL |
46 | tristate "Atmel PWM support" | 46 | tristate "Atmel PWM support" |
47 | depends on ARCH_AT91 | 47 | depends on ARCH_AT91 && OF |
48 | help | 48 | help |
49 | Generic PWM framework driver for Atmel SoC. | 49 | Generic PWM framework driver for Atmel SoC. |
50 | 50 | ||
diff --git a/drivers/pwm/pwm-atmel.c b/drivers/pwm/pwm-atmel.c index 53bc7b9b3581..5b861da3e325 100644 --- a/drivers/pwm/pwm-atmel.c +++ b/drivers/pwm/pwm-atmel.c | |||
@@ -318,19 +318,6 @@ static const struct atmel_pwm_data mchp_sam9x60_pwm_data = { | |||
318 | }, | 318 | }, |
319 | }; | 319 | }; |
320 | 320 | ||
321 | static const struct platform_device_id atmel_pwm_devtypes[] = { | ||
322 | { | ||
323 | .name = "at91sam9rl-pwm", | ||
324 | .driver_data = (kernel_ulong_t)&atmel_sam9rl_pwm_data, | ||
325 | }, { | ||
326 | .name = "sama5d3-pwm", | ||
327 | .driver_data = (kernel_ulong_t)&atmel_sama5_pwm_data, | ||
328 | }, { | ||
329 | /* sentinel */ | ||
330 | }, | ||
331 | }; | ||
332 | MODULE_DEVICE_TABLE(platform, atmel_pwm_devtypes); | ||
333 | |||
334 | static const struct of_device_id atmel_pwm_dt_ids[] = { | 321 | static const struct of_device_id atmel_pwm_dt_ids[] = { |
335 | { | 322 | { |
336 | .compatible = "atmel,at91sam9rl-pwm", | 323 | .compatible = "atmel,at91sam9rl-pwm", |
@@ -350,19 +337,6 @@ static const struct of_device_id atmel_pwm_dt_ids[] = { | |||
350 | }; | 337 | }; |
351 | MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids); | 338 | MODULE_DEVICE_TABLE(of, atmel_pwm_dt_ids); |
352 | 339 | ||
353 | static inline const struct atmel_pwm_data * | ||
354 | atmel_pwm_get_driver_data(struct platform_device *pdev) | ||
355 | { | ||
356 | const struct platform_device_id *id; | ||
357 | |||
358 | if (pdev->dev.of_node) | ||
359 | return of_device_get_match_data(&pdev->dev); | ||
360 | |||
361 | id = platform_get_device_id(pdev); | ||
362 | |||
363 | return (struct atmel_pwm_data *)id->driver_data; | ||
364 | } | ||
365 | |||
366 | static int atmel_pwm_probe(struct platform_device *pdev) | 340 | static int atmel_pwm_probe(struct platform_device *pdev) |
367 | { | 341 | { |
368 | const struct atmel_pwm_data *data; | 342 | const struct atmel_pwm_data *data; |
@@ -370,7 +344,7 @@ static int atmel_pwm_probe(struct platform_device *pdev) | |||
370 | struct resource *res; | 344 | struct resource *res; |
371 | int ret; | 345 | int ret; |
372 | 346 | ||
373 | data = atmel_pwm_get_driver_data(pdev); | 347 | data = of_device_get_match_data(&pdev->dev); |
374 | if (!data) | 348 | if (!data) |
375 | return -ENODEV; | 349 | return -ENODEV; |
376 | 350 | ||
@@ -396,10 +370,8 @@ static int atmel_pwm_probe(struct platform_device *pdev) | |||
396 | atmel_pwm->chip.dev = &pdev->dev; | 370 | atmel_pwm->chip.dev = &pdev->dev; |
397 | atmel_pwm->chip.ops = &atmel_pwm_ops; | 371 | atmel_pwm->chip.ops = &atmel_pwm_ops; |
398 | 372 | ||
399 | if (pdev->dev.of_node) { | 373 | atmel_pwm->chip.of_xlate = of_pwm_xlate_with_flags; |
400 | atmel_pwm->chip.of_xlate = of_pwm_xlate_with_flags; | 374 | atmel_pwm->chip.of_pwm_n_cells = 3; |
401 | atmel_pwm->chip.of_pwm_n_cells = 3; | ||
402 | } | ||
403 | 375 | ||
404 | atmel_pwm->chip.base = -1; | 376 | atmel_pwm->chip.base = -1; |
405 | atmel_pwm->chip.npwm = 4; | 377 | atmel_pwm->chip.npwm = 4; |
@@ -437,7 +409,6 @@ static struct platform_driver atmel_pwm_driver = { | |||
437 | .name = "atmel-pwm", | 409 | .name = "atmel-pwm", |
438 | .of_match_table = of_match_ptr(atmel_pwm_dt_ids), | 410 | .of_match_table = of_match_ptr(atmel_pwm_dt_ids), |
439 | }, | 411 | }, |
440 | .id_table = atmel_pwm_devtypes, | ||
441 | .probe = atmel_pwm_probe, | 412 | .probe = atmel_pwm_probe, |
442 | .remove = atmel_pwm_remove, | 413 | .remove = atmel_pwm_remove, |
443 | }; | 414 | }; |