diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2019-07-28 12:40:15 -0400 |
---|---|---|
committer | Jacek Anaszewski <jacek.anaszewski@gmail.com> | 2019-07-29 15:04:53 -0400 |
commit | 156189a6d7a797d6fa0b13dd6b4f32b11d234a99 (patch) | |
tree | 6aa86d8c19d2489bd2dcb447a87d9f7fc328a075 | |
parent | 246eab59eefc26706e59520cf20d2315377efa08 (diff) |
leds: netxbig: remove legacy board-file support
Since commit ebc278f15759 ("ARM: mvebu: remove static LED setup for
netxbig boards"), no one in upstream passes in the platform data to
this driver.
Squash leds-kirkwood-netxbig.h into the driver, and remove the legacy
board-file support.
Link: https://lkml.org/lkml/2019/7/20/83
Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
-rw-r--r-- | drivers/leds/Kconfig | 1 | ||||
-rw-r--r-- | drivers/leds/leds-netxbig.c | 70 | ||||
-rw-r--r-- | include/linux/platform_data/leds-kirkwood-netxbig.h | 54 |
3 files changed, 51 insertions, 74 deletions
diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index f7a3dd7ecf3d..1988de1d64c0 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig | |||
@@ -590,6 +590,7 @@ config LEDS_NETXBIG | |||
590 | tristate "LED support for Big Network series LEDs" | 590 | tristate "LED support for Big Network series LEDs" |
591 | depends on LEDS_CLASS | 591 | depends on LEDS_CLASS |
592 | depends on MACH_KIRKWOOD | 592 | depends on MACH_KIRKWOOD |
593 | depends on OF_GPIO | ||
593 | default y | 594 | default y |
594 | help | 595 | help |
595 | This option enables support for LEDs found on the LaCie 2Big | 596 | This option enables support for LEDs found on the LaCie 2Big |
diff --git a/drivers/leds/leds-netxbig.c b/drivers/leds/leds-netxbig.c index 10497a466775..0944cb111c34 100644 --- a/drivers/leds/leds-netxbig.c +++ b/drivers/leds/leds-netxbig.c | |||
@@ -15,7 +15,48 @@ | |||
15 | #include <linux/gpio.h> | 15 | #include <linux/gpio.h> |
16 | #include <linux/of_gpio.h> | 16 | #include <linux/of_gpio.h> |
17 | #include <linux/leds.h> | 17 | #include <linux/leds.h> |
18 | #include <linux/platform_data/leds-kirkwood-netxbig.h> | 18 | |
19 | struct netxbig_gpio_ext { | ||
20 | unsigned int *addr; | ||
21 | int num_addr; | ||
22 | unsigned int *data; | ||
23 | int num_data; | ||
24 | unsigned int enable; | ||
25 | }; | ||
26 | |||
27 | enum netxbig_led_mode { | ||
28 | NETXBIG_LED_OFF, | ||
29 | NETXBIG_LED_ON, | ||
30 | NETXBIG_LED_SATA, | ||
31 | NETXBIG_LED_TIMER1, | ||
32 | NETXBIG_LED_TIMER2, | ||
33 | NETXBIG_LED_MODE_NUM, | ||
34 | }; | ||
35 | |||
36 | #define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM | ||
37 | |||
38 | struct netxbig_led_timer { | ||
39 | unsigned long delay_on; | ||
40 | unsigned long delay_off; | ||
41 | enum netxbig_led_mode mode; | ||
42 | }; | ||
43 | |||
44 | struct netxbig_led { | ||
45 | const char *name; | ||
46 | const char *default_trigger; | ||
47 | int mode_addr; | ||
48 | int *mode_val; | ||
49 | int bright_addr; | ||
50 | int bright_max; | ||
51 | }; | ||
52 | |||
53 | struct netxbig_led_platform_data { | ||
54 | struct netxbig_gpio_ext *gpio_ext; | ||
55 | struct netxbig_led_timer *timer; | ||
56 | int num_timer; | ||
57 | struct netxbig_led *leds; | ||
58 | int num_leds; | ||
59 | }; | ||
19 | 60 | ||
20 | /* | 61 | /* |
21 | * GPIO extension bus. | 62 | * GPIO extension bus. |
@@ -306,7 +347,6 @@ static int create_netxbig_led(struct platform_device *pdev, | |||
306 | return devm_led_classdev_register(&pdev->dev, &led_dat->cdev); | 347 | return devm_led_classdev_register(&pdev->dev, &led_dat->cdev); |
307 | } | 348 | } |
308 | 349 | ||
309 | #ifdef CONFIG_OF_GPIO | ||
310 | static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np, | 350 | static int gpio_ext_get_of_pdata(struct device *dev, struct device_node *np, |
311 | struct netxbig_gpio_ext *gpio_ext) | 351 | struct netxbig_gpio_ext *gpio_ext) |
312 | { | 352 | { |
@@ -522,30 +562,20 @@ static const struct of_device_id of_netxbig_leds_match[] = { | |||
522 | {}, | 562 | {}, |
523 | }; | 563 | }; |
524 | MODULE_DEVICE_TABLE(of, of_netxbig_leds_match); | 564 | MODULE_DEVICE_TABLE(of, of_netxbig_leds_match); |
525 | #else | ||
526 | static inline int | ||
527 | netxbig_leds_get_of_pdata(struct device *dev, | ||
528 | struct netxbig_led_platform_data *pdata) | ||
529 | { | ||
530 | return -ENODEV; | ||
531 | } | ||
532 | #endif /* CONFIG_OF_GPIO */ | ||
533 | 565 | ||
534 | static int netxbig_led_probe(struct platform_device *pdev) | 566 | static int netxbig_led_probe(struct platform_device *pdev) |
535 | { | 567 | { |
536 | struct netxbig_led_platform_data *pdata = dev_get_platdata(&pdev->dev); | 568 | struct netxbig_led_platform_data *pdata; |
537 | struct netxbig_led_data *leds_data; | 569 | struct netxbig_led_data *leds_data; |
538 | int i; | 570 | int i; |
539 | int ret; | 571 | int ret; |
540 | 572 | ||
541 | if (!pdata) { | 573 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); |
542 | pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); | 574 | if (!pdata) |
543 | if (!pdata) | 575 | return -ENOMEM; |
544 | return -ENOMEM; | 576 | ret = netxbig_leds_get_of_pdata(&pdev->dev, pdata); |
545 | ret = netxbig_leds_get_of_pdata(&pdev->dev, pdata); | 577 | if (ret) |
546 | if (ret) | 578 | return ret; |
547 | return ret; | ||
548 | } | ||
549 | 579 | ||
550 | leds_data = devm_kcalloc(&pdev->dev, | 580 | leds_data = devm_kcalloc(&pdev->dev, |
551 | pdata->num_leds, sizeof(*leds_data), | 581 | pdata->num_leds, sizeof(*leds_data), |
@@ -571,7 +601,7 @@ static struct platform_driver netxbig_led_driver = { | |||
571 | .probe = netxbig_led_probe, | 601 | .probe = netxbig_led_probe, |
572 | .driver = { | 602 | .driver = { |
573 | .name = "leds-netxbig", | 603 | .name = "leds-netxbig", |
574 | .of_match_table = of_match_ptr(of_netxbig_leds_match), | 604 | .of_match_table = of_netxbig_leds_match, |
575 | }, | 605 | }, |
576 | }; | 606 | }; |
577 | 607 | ||
diff --git a/include/linux/platform_data/leds-kirkwood-netxbig.h b/include/linux/platform_data/leds-kirkwood-netxbig.h deleted file mode 100644 index 3c85a735c380..000000000000 --- a/include/linux/platform_data/leds-kirkwood-netxbig.h +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | /* | ||
2 | * Platform data structure for netxbig LED driver | ||
3 | * | ||
4 | * This file is licensed under the terms of the GNU General Public | ||
5 | * License version 2. This program is licensed "as is" without any | ||
6 | * warranty of any kind, whether express or implied. | ||
7 | */ | ||
8 | |||
9 | #ifndef __LEDS_KIRKWOOD_NETXBIG_H | ||
10 | #define __LEDS_KIRKWOOD_NETXBIG_H | ||
11 | |||
12 | struct netxbig_gpio_ext { | ||
13 | unsigned *addr; | ||
14 | int num_addr; | ||
15 | unsigned *data; | ||
16 | int num_data; | ||
17 | unsigned enable; | ||
18 | }; | ||
19 | |||
20 | enum netxbig_led_mode { | ||
21 | NETXBIG_LED_OFF, | ||
22 | NETXBIG_LED_ON, | ||
23 | NETXBIG_LED_SATA, | ||
24 | NETXBIG_LED_TIMER1, | ||
25 | NETXBIG_LED_TIMER2, | ||
26 | NETXBIG_LED_MODE_NUM, | ||
27 | }; | ||
28 | |||
29 | #define NETXBIG_LED_INVALID_MODE NETXBIG_LED_MODE_NUM | ||
30 | |||
31 | struct netxbig_led_timer { | ||
32 | unsigned long delay_on; | ||
33 | unsigned long delay_off; | ||
34 | enum netxbig_led_mode mode; | ||
35 | }; | ||
36 | |||
37 | struct netxbig_led { | ||
38 | const char *name; | ||
39 | const char *default_trigger; | ||
40 | int mode_addr; | ||
41 | int *mode_val; | ||
42 | int bright_addr; | ||
43 | int bright_max; | ||
44 | }; | ||
45 | |||
46 | struct netxbig_led_platform_data { | ||
47 | struct netxbig_gpio_ext *gpio_ext; | ||
48 | struct netxbig_led_timer *timer; | ||
49 | int num_timer; | ||
50 | struct netxbig_led *leds; | ||
51 | int num_leds; | ||
52 | }; | ||
53 | |||
54 | #endif /* __LEDS_KIRKWOOD_NETXBIG_H */ | ||