diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2011-05-28 15:05:02 -0400 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2011-07-07 03:59:57 -0400 |
commit | 5b8d628ca4036e76a2d892f2c1d01b58d232809e (patch) | |
tree | e7e6107cc728527afba516ad87e2e0e7c308910a /arch/arm/mach-mx5 | |
parent | 47e837b54c01083ce153493882fb8d74d108ae4a (diff) |
ARM: mx5: convert to new leds-gpio registration helper
This gets rid of per machine struct platform_device definitions and allows
to move the platform data and led definition to .init.rodata.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/mach-mx5')
-rw-r--r-- | arch/arm/mach-mx5/Kconfig | 4 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-mx51_efikamx.c | 15 | ||||
-rw-r--r-- | arch/arm/mach-mx5/board-mx51_efikasb.c | 16 | ||||
-rw-r--r-- | arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | 18 | ||||
-rw-r--r-- | arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c | 19 |
5 files changed, 19 insertions, 53 deletions
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index 799fbc40e53c..f25e9d7bf0f5 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig | |||
@@ -109,6 +109,7 @@ config MACH_EUKREA_MBIMX51_BASEBOARD | |||
109 | bool | 109 | bool |
110 | select IMX_HAVE_PLATFORM_IMX_KEYPAD | 110 | select IMX_HAVE_PLATFORM_IMX_KEYPAD |
111 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX | 111 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX |
112 | select LEDS_GPIO_REGISTER | ||
112 | help | 113 | help |
113 | This adds board specific devices that can be found on Eukrea's | 114 | This adds board specific devices that can be found on Eukrea's |
114 | MBIMX51 evaluation board. | 115 | MBIMX51 evaluation board. |
@@ -135,6 +136,7 @@ config MACH_EUKREA_MBIMXSD51_BASEBOARD | |||
135 | prompt "Eukrea MBIMXSD development board" | 136 | prompt "Eukrea MBIMXSD development board" |
136 | bool | 137 | bool |
137 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX | 138 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX |
139 | select LEDS_GPIO_REGISTER | ||
138 | help | 140 | help |
139 | This adds board specific devices that can be found on Eukrea's | 141 | This adds board specific devices that can be found on Eukrea's |
140 | MBIMXSD evaluation board. | 142 | MBIMXSD evaluation board. |
@@ -151,6 +153,7 @@ config MX51_EFIKA_COMMON | |||
151 | 153 | ||
152 | config MACH_MX51_EFIKAMX | 154 | config MACH_MX51_EFIKAMX |
153 | bool "Support MX51 Genesi Efika MX nettop" | 155 | bool "Support MX51 Genesi Efika MX nettop" |
156 | select LEDS_GPIO_REGISTER | ||
154 | select MX51_EFIKA_COMMON | 157 | select MX51_EFIKA_COMMON |
155 | help | 158 | help |
156 | Include support for Genesi Efika MX nettop. This includes specific | 159 | Include support for Genesi Efika MX nettop. This includes specific |
@@ -158,6 +161,7 @@ config MACH_MX51_EFIKAMX | |||
158 | 161 | ||
159 | config MACH_MX51_EFIKASB | 162 | config MACH_MX51_EFIKASB |
160 | bool "Support MX51 Genesi Efika Smartbook" | 163 | bool "Support MX51 Genesi Efika Smartbook" |
164 | select LEDS_GPIO_REGISTER | ||
161 | select MX51_EFIKA_COMMON | 165 | select MX51_EFIKA_COMMON |
162 | help | 166 | help |
163 | Include support for Genesi Efika Smartbook. This includes specific | 167 | Include support for Genesi Efika Smartbook. This includes specific |
diff --git a/arch/arm/mach-mx5/board-mx51_efikamx.c b/arch/arm/mach-mx5/board-mx51_efikamx.c index 6e362315291b..2400f6d10099 100644 --- a/arch/arm/mach-mx5/board-mx51_efikamx.c +++ b/arch/arm/mach-mx5/board-mx51_efikamx.c | |||
@@ -139,7 +139,7 @@ static void __init mx51_efikamx_board_id(void) | |||
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | static struct gpio_led mx51_efikamx_leds[] = { | 142 | static struct gpio_led mx51_efikamx_leds[] __initdata = { |
143 | { | 143 | { |
144 | .name = "efikamx:green", | 144 | .name = "efikamx:green", |
145 | .default_trigger = "default-on", | 145 | .default_trigger = "default-on", |
@@ -157,19 +157,12 @@ static struct gpio_led mx51_efikamx_leds[] = { | |||
157 | }, | 157 | }, |
158 | }; | 158 | }; |
159 | 159 | ||
160 | static struct gpio_led_platform_data mx51_efikamx_leds_data = { | 160 | static const struct gpio_led_platform_data |
161 | mx51_efikamx_leds_data __initconst = { | ||
161 | .leds = mx51_efikamx_leds, | 162 | .leds = mx51_efikamx_leds, |
162 | .num_leds = ARRAY_SIZE(mx51_efikamx_leds), | 163 | .num_leds = ARRAY_SIZE(mx51_efikamx_leds), |
163 | }; | 164 | }; |
164 | 165 | ||
165 | static struct platform_device mx51_efikamx_leds_device = { | ||
166 | .name = "leds-gpio", | ||
167 | .id = -1, | ||
168 | .dev = { | ||
169 | .platform_data = &mx51_efikamx_leds_data, | ||
170 | }, | ||
171 | }; | ||
172 | |||
173 | static struct gpio_keys_button mx51_efikamx_powerkey[] = { | 166 | static struct gpio_keys_button mx51_efikamx_powerkey[] = { |
174 | { | 167 | { |
175 | .code = KEY_POWER, | 168 | .code = KEY_POWER, |
@@ -248,7 +241,7 @@ static void __init mx51_efikamx_init(void) | |||
248 | mx51_efikamx_leds[2].default_trigger = "mmc1"; | 241 | mx51_efikamx_leds[2].default_trigger = "mmc1"; |
249 | } | 242 | } |
250 | 243 | ||
251 | platform_device_register(&mx51_efikamx_leds_device); | 244 | gpio_led_register_device(-1, &mx51_efikamx_leds_data); |
252 | imx_add_gpio_keys(&mx51_efikamx_powerkey_data); | 245 | imx_add_gpio_keys(&mx51_efikamx_powerkey_data); |
253 | 246 | ||
254 | if (system_rev == 0x11) { | 247 | if (system_rev == 0x11) { |
diff --git a/arch/arm/mach-mx5/board-mx51_efikasb.c b/arch/arm/mach-mx5/board-mx51_efikasb.c index 474fc6e4c6df..28d68962e7df 100644 --- a/arch/arm/mach-mx5/board-mx51_efikasb.c +++ b/arch/arm/mach-mx5/board-mx51_efikasb.c | |||
@@ -132,7 +132,7 @@ static void __init mx51_efikasb_usb(void) | |||
132 | mxc_register_device(&mxc_usbh2_device, &usbh2_config); | 132 | mxc_register_device(&mxc_usbh2_device, &usbh2_config); |
133 | } | 133 | } |
134 | 134 | ||
135 | static struct gpio_led mx51_efikasb_leds[] = { | 135 | static const struct gpio_led mx51_efikasb_leds[] __initconst = { |
136 | { | 136 | { |
137 | .name = "efikasb:green", | 137 | .name = "efikasb:green", |
138 | .default_trigger = "default-on", | 138 | .default_trigger = "default-on", |
@@ -146,19 +146,12 @@ static struct gpio_led mx51_efikasb_leds[] = { | |||
146 | }, | 146 | }, |
147 | }; | 147 | }; |
148 | 148 | ||
149 | static struct gpio_led_platform_data mx51_efikasb_leds_data = { | 149 | static const struct gpio_led_platform_data |
150 | mx51_efikasb_leds_data __initconst = { | ||
150 | .leds = mx51_efikasb_leds, | 151 | .leds = mx51_efikasb_leds, |
151 | .num_leds = ARRAY_SIZE(mx51_efikasb_leds), | 152 | .num_leds = ARRAY_SIZE(mx51_efikasb_leds), |
152 | }; | 153 | }; |
153 | 154 | ||
154 | static struct platform_device mx51_efikasb_leds_device = { | ||
155 | .name = "leds-gpio", | ||
156 | .id = -1, | ||
157 | .dev = { | ||
158 | .platform_data = &mx51_efikasb_leds_data, | ||
159 | }, | ||
160 | }; | ||
161 | |||
162 | static struct gpio_keys_button mx51_efikasb_keys[] = { | 155 | static struct gpio_keys_button mx51_efikasb_keys[] = { |
163 | { | 156 | { |
164 | .code = KEY_POWER, | 157 | .code = KEY_POWER, |
@@ -256,9 +249,8 @@ static void __init efikasb_board_init(void) | |||
256 | mx51_efikasb_usb(); | 249 | mx51_efikasb_usb(); |
257 | imx51_add_sdhci_esdhc_imx(1, NULL); | 250 | imx51_add_sdhci_esdhc_imx(1, NULL); |
258 | 251 | ||
259 | platform_device_register(&mx51_efikasb_leds_device); | 252 | gpio_led_register_device(-1, &mx51_efikasb_leds_data); |
260 | imx_add_gpio_keys(&mx51_efikasb_keys_data); | 253 | imx_add_gpio_keys(&mx51_efikasb_keys_data); |
261 | |||
262 | } | 254 | } |
263 | 255 | ||
264 | static void __init mx51_efikasb_timer_init(void) | 256 | static void __init mx51_efikasb_timer_init(void) |
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c index 97292d20f1f3..02ce720c887f 100644 --- a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c +++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c | |||
@@ -37,7 +37,7 @@ | |||
37 | #define MBIMX51_LED2 IMX_GPIO_NR(3, 7) | 37 | #define MBIMX51_LED2 IMX_GPIO_NR(3, 7) |
38 | #define MBIMX51_LED3 IMX_GPIO_NR(3, 8) | 38 | #define MBIMX51_LED3 IMX_GPIO_NR(3, 8) |
39 | 39 | ||
40 | static struct gpio_led mbimx51_leds[] = { | 40 | static const struct gpio_led mbimx51_leds[] __initconst = { |
41 | { | 41 | { |
42 | .name = "led0", | 42 | .name = "led0", |
43 | .default_trigger = "heartbeat", | 43 | .default_trigger = "heartbeat", |
@@ -64,23 +64,11 @@ static struct gpio_led mbimx51_leds[] = { | |||
64 | }, | 64 | }, |
65 | }; | 65 | }; |
66 | 66 | ||
67 | static struct gpio_led_platform_data mbimx51_leds_info = { | 67 | static const struct gpio_led_platform_data mbimx51_leds_info __initconst = { |
68 | .leds = mbimx51_leds, | 68 | .leds = mbimx51_leds, |
69 | .num_leds = ARRAY_SIZE(mbimx51_leds), | 69 | .num_leds = ARRAY_SIZE(mbimx51_leds), |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct platform_device mbimx51_leds_gpio = { | ||
73 | .name = "leds-gpio", | ||
74 | .id = -1, | ||
75 | .dev = { | ||
76 | .platform_data = &mbimx51_leds_info, | ||
77 | }, | ||
78 | }; | ||
79 | |||
80 | static struct platform_device *devices[] __initdata = { | ||
81 | &mbimx51_leds_gpio, | ||
82 | }; | ||
83 | |||
84 | static iomux_v3_cfg_t mbimx51_pads[] = { | 72 | static iomux_v3_cfg_t mbimx51_pads[] = { |
85 | /* UART2 */ | 73 | /* UART2 */ |
86 | MX51_PAD_UART2_RXD__UART2_RXD, | 74 | MX51_PAD_UART2_RXD__UART2_RXD, |
@@ -204,7 +192,7 @@ void __init eukrea_mbimx51_baseboard_init(void) | |||
204 | gpio_direction_output(MBIMX51_LED3, 1); | 192 | gpio_direction_output(MBIMX51_LED3, 1); |
205 | gpio_free(MBIMX51_LED3); | 193 | gpio_free(MBIMX51_LED3); |
206 | 194 | ||
207 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 195 | gpio_led_register_device(-1, &mbimx51_leds_info); |
208 | 196 | ||
209 | imx51_add_imx_keypad(&mbimx51_map_data); | 197 | imx51_add_imx_keypad(&mbimx51_map_data); |
210 | 198 | ||
diff --git a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c index 31c871ec46a6..261923997643 100644 --- a/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c +++ b/arch/arm/mach-mx5/eukrea_mbimxsd-baseboard.c | |||
@@ -74,7 +74,7 @@ static iomux_v3_cfg_t eukrea_mbimxsd_pads[] = { | |||
74 | #define GPIO_LED1 IMX_GPIO_NR(3, 30) | 74 | #define GPIO_LED1 IMX_GPIO_NR(3, 30) |
75 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 31) | 75 | #define GPIO_SWITCH1 IMX_GPIO_NR(3, 31) |
76 | 76 | ||
77 | static struct gpio_led eukrea_mbimxsd_leds[] = { | 77 | static const struct gpio_led eukrea_mbimxsd_leds[] __initconst = { |
78 | { | 78 | { |
79 | .name = "led1", | 79 | .name = "led1", |
80 | .default_trigger = "heartbeat", | 80 | .default_trigger = "heartbeat", |
@@ -83,19 +83,12 @@ static struct gpio_led eukrea_mbimxsd_leds[] = { | |||
83 | }, | 83 | }, |
84 | }; | 84 | }; |
85 | 85 | ||
86 | static struct gpio_led_platform_data eukrea_mbimxsd_led_info = { | 86 | static const struct gpio_led_platform_data |
87 | eukrea_mbimxsd_led_info __initconst = { | ||
87 | .leds = eukrea_mbimxsd_leds, | 88 | .leds = eukrea_mbimxsd_leds, |
88 | .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), | 89 | .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds), |
89 | }; | 90 | }; |
90 | 91 | ||
91 | static struct platform_device eukrea_mbimxsd_leds_gpio = { | ||
92 | .name = "leds-gpio", | ||
93 | .id = -1, | ||
94 | .dev = { | ||
95 | .platform_data = &eukrea_mbimxsd_led_info, | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { | 92 | static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = { |
100 | { | 93 | { |
101 | .gpio = GPIO_SWITCH1, | 94 | .gpio = GPIO_SWITCH1, |
@@ -112,10 +105,6 @@ static const struct gpio_keys_platform_data | |||
112 | .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), | 105 | .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons), |
113 | }; | 106 | }; |
114 | 107 | ||
115 | static struct platform_device *platform_devices[] __initdata = { | ||
116 | &eukrea_mbimxsd_leds_gpio, | ||
117 | }; | ||
118 | |||
119 | static const struct imxuart_platform_data uart_pdata __initconst = { | 108 | static const struct imxuart_platform_data uart_pdata __initconst = { |
120 | .flags = IMXUART_HAVE_RTSCTS, | 109 | .flags = IMXUART_HAVE_RTSCTS, |
121 | }; | 110 | }; |
@@ -154,6 +143,6 @@ void __init eukrea_mbimxsd51_baseboard_init(void) | |||
154 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, | 143 | i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices, |
155 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); | 144 | ARRAY_SIZE(eukrea_mbimxsd_i2c_devices)); |
156 | 145 | ||
157 | platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); | 146 | gpio_led_register_device(-1, &eukrea_mbimxsd_led_info); |
158 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); | 147 | imx_add_gpio_keys(&eukrea_mbimxsd_button_data); |
159 | } | 148 | } |