Skip to content

Commit

Permalink
ARM: Kirkwood: Replace DNS-320/DNS-325 leds with dt bindings
Browse files Browse the repository at this point in the history
Replace code in board-dnskw with the equivalent devicetree bindings.

Signed-off-by: Jamie Lentin <jm@lentin.co.uk>
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
  • Loading branch information
Jamie Lentin authored and Andrew Lunn committed Jul 27, 2012
1 parent 55650d4 commit 09059e9
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 90 deletions.
25 changes: 25 additions & 0 deletions arch/arm/boot/dts/kirkwood-dns320.dts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@
bootargs = "console=ttyS0,115200n8 earlyprintk";
};

gpio-leds {
compatible = "gpio-leds";
blue-power {
label = "dns320:blue:power";
gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
linux,default-trigger = "default-on";
};
blue-usb {
label = "dns320:blue:usb";
gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
};
orange-l_hdd {
label = "dns320:orange:l_hdd";
gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
};
orange-r_hdd {
label = "dns320:orange:r_hdd";
gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
};
orange-usb {
label = "dns320:orange:usb";
gpios = <&gpio1 3 1>; /* GPIO 35 Active Low */
};
};

ocp@f1000000 {
serial@12000 {
clock-frequency = <166666667>;
Expand Down
25 changes: 25 additions & 0 deletions arch/arm/boot/dts/kirkwood-dns325.dts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,31 @@
bootargs = "console=ttyS0,115200n8 earlyprintk";
};

gpio-leds {
compatible = "gpio-leds";
white-power {
label = "dns325:white:power";
gpios = <&gpio0 26 1>; /* GPIO 26 Active Low */
linux,default-trigger = "default-on";
};
white-usb {
label = "dns325:white:usb";
gpios = <&gpio1 11 1>; /* GPIO 43 Active Low */
};
red-l_hdd {
label = "dns325:red:l_hdd";
gpios = <&gpio0 28 1>; /* GPIO 28 Active Low */
};
red-r_hdd {
label = "dns325:red:r_hdd";
gpios = <&gpio0 27 1>; /* GPIO 27 Active Low */
};
red-usb {
label = "dns325:red:usb";
gpios = <&gpio0 29 1>; /* GPIO 29 Active Low */
};
};

ocp@f1000000 {
i2c@11000 {
status = "okay";
Expand Down
90 changes: 0 additions & 90 deletions arch/arm/mach-kirkwood/board-dnskw.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,90 +68,6 @@ static unsigned int dnskw_mpp_config[] __initdata = {
0
};

static struct gpio_led dns325_led_pins[] = {
{
.name = "dns325:white:power",
.gpio = 26,
.active_low = 1,
.default_trigger = "default-on",
},
{
.name = "dns325:white:usb",
.gpio = 43,
.active_low = 1,
},
{
.name = "dns325:red:l_hdd",
.gpio = 28,
.active_low = 1,
},
{
.name = "dns325:red:r_hdd",
.gpio = 27,
.active_low = 1,
},
{
.name = "dns325:red:usb",
.gpio = 29,
.active_low = 1,
},
};

static struct gpio_led_platform_data dns325_led_data = {
.num_leds = ARRAY_SIZE(dns325_led_pins),
.leds = dns325_led_pins,
};

static struct platform_device dns325_led_device = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &dns325_led_data,
},
};

static struct gpio_led dns320_led_pins[] = {
{
.name = "dns320:blue:power",
.gpio = 26,
.active_low = 1,
.default_trigger = "default-on",
},
{
.name = "dns320:blue:usb",
.gpio = 43,
.active_low = 1,
},
{
.name = "dns320:orange:l_hdd",
.gpio = 28,
.active_low = 1,
},
{
.name = "dns320:orange:r_hdd",
.gpio = 27,
.active_low = 1,
},
{
.name = "dns320:orange:usb",
.gpio = 35,
.active_low = 1,
},
};

static struct gpio_led_platform_data dns320_led_data = {
.num_leds = ARRAY_SIZE(dns320_led_pins),
.leds = dns320_led_pins,
};

static struct platform_device dns320_led_device = {
.name = "leds-gpio",
.id = -1,
.dev = {
.platform_data = &dns320_led_data,
},
};

static struct gpio_keys_button dnskw_button_pins[] = {
{
.code = KEY_POWER,
Expand Down Expand Up @@ -237,12 +153,6 @@ void __init dnskw_init(void)
platform_device_register(&dnskw_button_device);
platform_device_register(&dnskw_fan_device);

if (of_machine_is_compatible("dlink,dns-325"))
platform_device_register(&dns325_led_device);

else if (of_machine_is_compatible("dlink,dns-320"))
platform_device_register(&dns320_led_device);

/* Register power-off GPIO. */
if (gpio_request(36, "dnskw:power:off") == 0
&& gpio_direction_output(36, 0) == 0)
Expand Down

0 comments on commit 09059e9

Please sign in to comment.