1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-12-18 09:54:05 +02:00

[brcm63xx] fix gpio_button device register

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@21252 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
rhk 2010-04-29 12:50:09 +00:00
parent eb30c3b7ce
commit 7b8a4fb8e0
4 changed files with 34 additions and 12 deletions

View File

@ -43,7 +43,7 @@
}; };
static struct board_info __initdata board_FAST2404 = { static struct board_info __initdata board_FAST2404 = {
@@ -771,6 +793,16 @@ static struct platform_device bcm63xx_gp @@ -771,12 +793,23 @@ static struct platform_device bcm63xx_gp
.dev.platform_data = &bcm63xx_led_data, .dev.platform_data = &bcm63xx_led_data,
}; };
@ -60,12 +60,23 @@
/* /*
* third stage init callback, register all board devices. * third stage init callback, register all board devices.
*/ */
@@ -826,6 +858,13 @@ int __init board_register_devices(void) int __init board_register_devices(void)
{
u32 val;
+ int button_count = 0;
if (board.has_pccard)
bcm63xx_pcmcia_register();
@@ -826,6 +859,17 @@ int __init board_register_devices(void)
platform_device_register(&bcm63xx_gpio_leds); platform_device_register(&bcm63xx_gpio_leds);
+ if (board.reset_buttons) { + /* count number of BUTTONs defined by this device */
+ bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons); + while (button_count < ARRAY_SIZE(board.reset_buttons) && board.reset_buttons[button_count].desc)
+ button_count++;
+
+ if (button_count) {
+ bcm63xx_gpio_buttons_data.nbuttons = button_count;
+ bcm63xx_gpio_buttons_data.buttons = board.reset_buttons; + bcm63xx_gpio_buttons_data.buttons = board.reset_buttons;
+ +
+ platform_device_register(&bcm63xx_gpio_buttons_device); + platform_device_register(&bcm63xx_gpio_buttons_device);

View File

@ -53,10 +53,10 @@
{ {
u32 val; u32 val;
+ int led_count = 0; + int led_count = 0;
int button_count = 0;
if (board.has_pccard) if (board.has_pccard)
bcm63xx_pcmcia_register(); @@ -902,7 +918,11 @@ int __init board_register_devices(void)
@@ -901,7 +917,11 @@ int __init board_register_devices(void)
platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);

View File

@ -43,7 +43,7 @@
}; };
static struct board_info __initdata board_FAST2404 = { static struct board_info __initdata board_FAST2404 = {
@@ -770,6 +792,16 @@ static struct platform_device bcm63xx_gp @@ -770,12 +792,23 @@ static struct platform_device bcm63xx_gp
.dev.platform_data = &bcm63xx_led_data, .dev.platform_data = &bcm63xx_led_data,
}; };
@ -60,12 +60,23 @@
/* /*
* third stage init callback, register all board devices. * third stage init callback, register all board devices.
*/ */
@@ -825,6 +857,13 @@ int __init board_register_devices(void) int __init board_register_devices(void)
{
u32 val;
+ int button_count = 0;
if (board.has_pccard)
bcm63xx_pcmcia_register();
@@ -825,6 +858,17 @@ int __init board_register_devices(void)
platform_device_register(&bcm63xx_gpio_leds); platform_device_register(&bcm63xx_gpio_leds);
+ if (board.reset_buttons) { + /* count number of BUTTONs defined by this device */
+ bcm63xx_gpio_buttons_data.nbuttons = ARRAY_SIZE(board.reset_buttons); + while (button_count < ARRAY_SIZE(board.reset_buttons) && board.reset_buttons[button_count].desc)
+ button_count++;
+
+ if (button_count) {
+ bcm63xx_gpio_buttons_data.nbuttons = button_count;
+ bcm63xx_gpio_buttons_data.buttons = board.reset_buttons; + bcm63xx_gpio_buttons_data.buttons = board.reset_buttons;
+ +
+ platform_device_register(&bcm63xx_gpio_buttons_device); + platform_device_register(&bcm63xx_gpio_buttons_device);

View File

@ -53,10 +53,10 @@
{ {
u32 val; u32 val;
+ int led_count = 0; + int led_count = 0;
int button_count = 0;
if (board.has_pccard) if (board.has_pccard)
bcm63xx_pcmcia_register(); @@ -901,7 +917,11 @@ int __init board_register_devices(void)
@@ -900,7 +916,11 @@ int __init board_register_devices(void)
platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1); platform_device_register_simple("GPIODEV", 0, &gpiodev_resource, 1);