Modify

Opened 12 years ago

Closed 11 years ago

#349 closed enhancement (fixed)

diag_led.c: support for asus wl-500g pwr_led

Reported by: wtzm Owned by: florian
Priority: normal Milestone: 0.9/rc6
Component: kernel Version:
Keywords: Cc:

Description

This patch adds support for controlling the Power-Led on ASUS WL-500g (including the "Deluxe" version) routers.
State is stored in the second bit of the diag variable, which is set to "on" by default as the led is already lit when the module gets loaded.
Output of svn diff is attached.

Index: diag_led.c
===================================================================
--- diag_led.c  (revision 3255)
+++ diag_led.c  (working copy)
@@ -61,6 +61,13 @@
        set_gpio(DMZ_GPIO,state);
 }
 
+// asus wl-500g (+deluxe)
+#define ASUS_PWR_GPIO (1<<0)
+
+static void asus_set_pwr(u8 state) {
+       set_gpio(ASUS_PWR_GPIO,state);
+}
+
 // v1.x - - - - -
 #define LED_DIAG   0x13
 #define LED_DMZ    0x12
@@ -85,22 +92,27 @@
 
 // - - - - -
 #define BIT_DMZ         0x01
+#define BIT_PWR         0x02
 #define BIT_DIAG        0x04
 
 void (*set_diag)(u8 state);
 void (*set_dmz)(u8 state);
+void (*set_pwr)(u8 state);
 
-static unsigned int diag = 0;
+static unsigned int diag = 0x02; // default: diag off, pwr on, dmz off
 
 static void diag_change()
 {
        set_diag(0xFF); // off
        set_dmz(0xFF); // off
+       set_pwr(0xFF); // off
 
        if(diag & BIT_DIAG)
                set_diag(0x00); // on
        if(diag & BIT_DMZ)
                set_dmz(0x00); // on
+       if(diag & BIT_PWR)
+               set_pwr(0x00); // on
 }
 
 static int proc_diag(ctl_table *table, int write, struct file *filp,
@@ -171,6 +183,7 @@
 
        set_diag=ignore;
        set_dmz=ignore;
+       set_pwr=ignore;
 
        buf=nvram_get("pmon_ver") ?: "";
        if (((board_type & 0xf00) == 0x400) && (strncmp(buf, "CFE", 3) != 0)) {
@@ -185,6 +198,7 @@
                        }
                        if (!strcmp(buf,"asusX")) {
                                //asus wl-500g
+                               set_pwr=asus_set_pwr;
                                reset_gpio=(1<<6);
                        }
                        if (!strcmp(buf,"2")) {
@@ -223,6 +237,7 @@
                }
                if (!strcmp(buf,"45")) {
                        //wl-500g deluxe
+                       set_pwr=asus_set_pwr;
                        reset_gpio=(1<<6);
                }
        }


Attachments (0)

Change History (4)

comment:1 Changed 12 years ago by kaloz

  • Milestone set to 1.0-rc6

comment:2 Changed 12 years ago by futaris

Apparently this works on WL-HDD too.

comment:3 Changed 11 years ago by florian

  • Owner changed from developers to florian
  • Status changed from new to assigned

comment:4 Changed 11 years ago by florian

  • Resolution set to fixed
  • Status changed from assigned to closed

Added in [4594] for both whiterussian and buildroot-ng

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.