2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
16 * Copyright (C) 2006 infineon
17 * Copyright (C) 2007 John Crispin <blogic@openwrt.org>
21 #include <linux/kernel.h>
22 #include <linux/module.h>
23 #include <linux/version.h>
24 #include <linux/types.h>
26 #include <linux/miscdevice.h>
27 #include <linux/init.h>
28 #include <asm/uaccess.h>
29 #include <asm/unistd.h>
30 #include <linux/errno.h>
31 #include <asm/danube/danube.h>
32 #include <asm/danube/port.h>
33 #include <asm/danube/danube_led.h>
34 #include <asm/danube/danube_gptu.h>
36 #define DATA_CLOCKING_EDGE FALLING_EDGE
38 #define FALLING_EDGE 1
40 #define port_reserve_pin danube_port_reserve_pin
41 #define port_free_pin danube_port_free_pin
42 #define port_set_altsel0 danube_port_set_altsel0
43 #define port_clear_altsel0 danube_port_clear_altsel0
44 #define port_set_altsel1 danube_port_set_altsel1
45 #define port_clear_altsel1 danube_port_clear_altsel1
46 #define port_set_dir_out danube_port_set_dir_out
47 #define port_clear_dir_out danube_port_clear_dir_out
48 #define port_set_open_drain danube_port_set_open_drain
49 #define port_clear_open_drain danube_port_clear_open_drain
54 #define LED_SH_ALTSEL0 1
55 #define LED_SH_ALTSEL1 0
56 #define LED_SH_OPENDRAIN 1
60 #define LED_D_ALTSEL0 1
61 #define LED_D_ALTSEL1 0
62 #define LED_D_OPENDRAIN 1
66 #define LED_ST_ALTSEL0 1
67 #define LED_ST_ALTSEL1 0
68 #define LED_ST_OPENDRAIN 1
70 #define LED_ADSL0_PORT 0
71 #define LED_ADSL0_PIN 4
72 #define LED_ADSL0_DIR 1
73 #define LED_ADSL0_ALTSEL0 0
74 #define LED_ADSL0_ALTSEL1 1
75 #define LED_ADSL0_OPENDRAIN 1
76 #define LED_ADSL1_PORT 0
77 #define LED_ADSL1_PIN 5
78 #define LED_ADSL1_DIR 1
79 #define LED_ADSL1_ALTSEL0 1
80 #define LED_ADSL1_ALTSEL1 1
81 #define LED_ADSL1_OPENDRAIN 1
83 #if (LED_SH_PORT == LED_ADSL0_PORT && LED_SH_PIN == LED_ADSL0_PIN) \
84 || (LED_D_PORT == LED_ADSL0_PORT && LED_D_PIN == LED_ADSL0_PIN) \
85 || (LED_ST_PORT == LED_ADSL0_PORT && LED_ST_PIN == LED_ADSL0_PIN) \
86 || (LED_SH_PORT == LED_ADSL1_PORT && LED_SH_PIN == LED_ADSL1_PIN) \
87 || (LED_D_PORT == LED_ADSL1_PORT && LED_D_PIN == LED_ADSL1_PIN) \
88 || (LED_ST_PORT == LED_ADSL1_PORT && LED_ST_PIN == LED_ADSL1_PIN)
89 #define ADSL_LED_IS_EXCLUSIVE 1
91 #define ADSL_LED_IS_EXCLUSIVE 0
95 #define LED_SH_DIR_SETUP port_set_dir_out
97 #define LED_SH_DIR_SETUP port_clear_dir_out
100 #define LED_SH_ALTSEL0_SETUP port_set_altsel0
102 #define LED_SH_ALTSEL0_SETUP port_clear_altsel0
105 #define LED_SH_ALTSEL1_SETUP port_set_altsel1
107 #define LED_SH_ALTSEL1_SETUP port_clear_altsel1
110 #define LED_SH_OPENDRAIN_SETUP port_set_open_drain
112 #define LED_SH_OPENDRAIN_SETUP port_clear_open_drain
116 #define LED_D_DIR_SETUP port_set_dir_out
118 #define LED_D_DIR_SETUP port_clear_dir_out
121 #define LED_D_ALTSEL0_SETUP port_set_altsel0
123 #define LED_D_ALTSEL0_SETUP port_clear_altsel0
126 #define LED_D_ALTSEL1_SETUP port_set_altsel1
128 #define LED_D_ALTSEL1_SETUP port_clear_altsel1
131 #define LED_D_OPENDRAIN_SETUP port_set_open_drain
133 #define LED_D_OPENDRAIN_SETUP port_clear_open_drain
137 #define LED_ST_DIR_SETUP port_set_dir_out
139 #define LED_ST_DIR_SETUP port_clear_dir_out
142 #define LED_ST_ALTSEL0_SETUP port_set_altsel0
144 #define LED_ST_ALTSEL0_SETUP port_clear_altsel0
147 #define LED_ST_ALTSEL1_SETUP port_set_altsel1
149 #define LED_ST_ALTSEL1_SETUP port_clear_altsel1
152 #define LED_ST_OPENDRAIN_SETUP port_set_open_drain
154 #define LED_ST_OPENDRAIN_SETUP port_clear_open_drain
158 #define LED_ADSL0_DIR_SETUP port_set_dir_out
160 #define LED_ADSL0_DIR_SETUP port_clear_dir_out
162 #if LED_ADSL0_ALTSEL0
163 #define LED_ADSL0_ALTSEL0_SETUP port_set_altsel0
165 #define LED_ADSL0_ALTSEL0_SETUP port_clear_altsel0
167 #if LED_ADSL0_ALTSEL1
168 #define LED_ADSL0_ALTSEL1_SETUP port_set_altsel1
170 #define LED_ADSL0_ALTSEL1_SETUP port_clear_altsel1
172 #if LED_ADSL0_OPENDRAIN
173 #define LED_ADSL0_OPENDRAIN_SETUP port_set_open_drain
175 #define LED_ADSL0_OPENDRAIN_SETUP port_clear_open_drain
179 #define LED_ADSL1_DIR_SETUP port_set_dir_out
181 #define LED_ADSL1_DIR_SETUP port_clear_dir_out
183 #if LED_ADSL1_ALTSEL0
184 #define LED_ADSL1_ALTSEL0_SETUP port_set_altsel0
186 #define LED_ADSL1_ALTSEL0_SETUP port_clear_altsel0
188 #if LED_ADSL1_ALTSEL1
189 #define LED_ADSL1_ALTSEL1_SETUP port_set_altsel1
191 #define LED_ADSL1_ALTSEL1_SETUP port_clear_altsel1
193 #if LED_ADSL1_OPENDRAIN
194 #define LED_ADSL1_OPENDRAIN_SETUP port_set_open_drain
196 #define LED_ADSL1_OPENDRAIN_SETUP port_clear_open_drain
199 #define SET_BITS(x, msb, lsb, value) (((x) & ~(((1 << ((msb) + 1)) - 1) ^ ((1 << (lsb)) - 1))) | (((value) & ((1 << (1 + (msb) - (lsb))) - 1)) << (lsb)))
201 static inline int update_led(void);
203 static inline unsigned int set_update_source(unsigned int, unsigned long, unsigned long);
204 static inline unsigned int set_blink_in_batch(unsigned int, unsigned long, unsigned long);
205 static inline unsigned int set_data_clock_edge(unsigned int, unsigned long);
206 static inline unsigned int set_update_clock(unsigned int, unsigned long, unsigned long);
207 static inline unsigned int set_store_mode(unsigned int, unsigned long);
208 static inline unsigned int set_shift_clock(unsigned int, unsigned long);
209 static inline unsigned int set_data_offset(unsigned int, unsigned long);
210 static inline unsigned int set_number_of_enabled_led(unsigned int, unsigned long);
211 static inline unsigned int set_data_in_batch(unsigned int, unsigned long, unsigned long);
212 static inline unsigned int set_access_right(unsigned int, unsigned long, unsigned long);
214 static inline void enable_led(void);
215 static inline void disable_led(void);
217 static inline int setup_gpio_port(unsigned long);
218 static inline void release_gpio_port(unsigned long);
220 static inline int setup_gpt(int, unsigned long);
221 static inline void release_gpt(int);
223 static inline int turn_on_led(unsigned long);
224 static inline void turn_off_led(unsigned long);
227 static struct semaphore led_sem
;
229 static unsigned long gpt_on
= 0;
230 static unsigned long gpt_freq
= 0;
232 static unsigned long adsl_on
= 0;
233 static unsigned long f_led_on
= 0;
235 static int module_id
;
244 * GPT2 or FPID is the clock to update LEDs automatically.
246 if (readl(DANUBE_LED_CON1
) >> 30)
250 * Check the status to prevent conflict of two consecutive update
252 for ( i
= 100000; i
!= 0; i
-= j
/ 16 )
255 if (!(readl(DANUBE_LED_CON0
) & LED_CON0_SWU
))
257 *DANUBE_LED_CON0
|= 1 << 31;
263 for ( j
= 0; j
< 1000 * 16; j
++ );
269 static inline unsigned int
270 set_update_source (unsigned int reg
, unsigned long led
, unsigned long source
)
272 return (reg
& ~((led
& 0x03) << 24)) | ((source
& 0x03) << 24);
275 static inline unsigned int
276 set_blink_in_batch (unsigned int reg
, unsigned long mask
, unsigned long blink
)
278 return (reg
& (~(mask
& 0x00FFFFFF) & 0x87FFFFFF)) | (blink
& 0x00FFFFFF);
281 static inline unsigned int
282 set_data_clock_edge (unsigned int reg
, unsigned long f_on_rising_edge
)
284 return f_on_rising_edge
? (reg
& ~(1 << 26)) : (reg
| (1 << 26));
287 static inline unsigned int
288 set_update_clock (unsigned int reg
, unsigned long clock
, unsigned long fpid
)
292 case 0: reg
&= ~0xC0000000; break;
293 case 1: reg
= (reg
& ~0xC0000000) | 0x40000000; break;
294 case 2: reg
= (reg
& ~0xCF800000) | 0x80000000 | ((fpid
& 0x1F) << 23); break;
299 static inline unsigned int
300 set_store_mode (unsigned int reg
, unsigned long mode
)
302 return mode
? (reg
| (1 << 28)) : (reg
& ~(1 << 28));
306 unsigned int set_shift_clock (unsigned int reg
, unsigned long fpis
)
308 return SET_BITS(reg
, 21, 20, fpis
);
312 unsigned int set_data_offset (unsigned int reg
, unsigned long offset
)
314 return SET_BITS(reg
, 19, 18, offset
);
318 unsigned int set_number_of_enabled_led (unsigned int reg
, unsigned long number
)
320 unsigned int bit_mask
;
322 bit_mask
= number
> 16 ? 0x07 : (number
> 8 ? 0x03 : (number
? 0x01 : 0x00));
323 return (reg
& ~0x07) | bit_mask
;
326 static inline unsigned int
327 set_data_in_batch (unsigned int reg
, unsigned long mask
, unsigned long data
)
329 return (reg
& ~(mask
& 0x00FFFFFF)) | (data
& 0x00FFFFFF);
332 static inline unsigned int
333 set_access_right (unsigned int reg
, unsigned long mask
, unsigned long ar
)
335 return (reg
& ~(mask
& 0x00FFFFFF)) | (~ar
& mask
);
341 /* Activate LED module in PMU. */
344 *(unsigned long *)0xBF10201C &= ~(1 << 11);
345 while ( --i
&& (*(unsigned long *)0xBF102020 & (1 << 11)) );
347 panic("Activating LED in PMU failed!");
353 *(unsigned long *)0xBF10201C |= 1 << 11;
357 setup_gpio_port (unsigned long adsl
)
362 * Reserve all pins before config them.
366 ret
|= port_reserve_pin(LED_ADSL0_PORT
, LED_ADSL0_PIN
, module_id
);
367 ret
|= port_reserve_pin(LED_ADSL1_PORT
, LED_ADSL1_PIN
, module_id
);
371 ret
|= port_reserve_pin(LED_ST_PORT
, LED_ST_PIN
, module_id
);
372 ret
|= port_reserve_pin(LED_D_PORT
, LED_D_PIN
, module_id
);
373 ret
|= port_reserve_pin(LED_SH_PORT
, LED_SH_PIN
, module_id
);
377 release_gpio_port(adsl
);
378 return ret
; // Should be -EBUSY
383 LED_ADSL0_ALTSEL0_SETUP(LED_ADSL0_PORT
, LED_ADSL0_PIN
, module_id
);
384 LED_ADSL0_ALTSEL1_SETUP(LED_ADSL0_PORT
, LED_ADSL0_PIN
, module_id
);
385 LED_ADSL0_DIR_SETUP(LED_ADSL0_PORT
, LED_ADSL0_PIN
, module_id
);
386 LED_ADSL0_OPENDRAIN_SETUP(LED_ADSL0_PORT
, LED_ADSL0_PIN
, module_id
);
388 LED_ADSL1_ALTSEL0_SETUP(LED_ADSL1_PORT
, LED_ADSL1_PIN
, module_id
);
389 LED_ADSL1_ALTSEL1_SETUP(LED_ADSL1_PORT
, LED_ADSL1_PIN
, module_id
);
390 LED_ADSL1_DIR_SETUP(LED_ADSL1_PORT
, LED_ADSL1_PIN
, module_id
);
391 LED_ADSL1_OPENDRAIN_SETUP(LED_ADSL1_PORT
, LED_ADSL1_PIN
, module_id
);
397 * I don't check the return value, because I'm sure the value is valid
398 * and the pins are reserved already.
400 LED_ST_ALTSEL0_SETUP(LED_ST_PORT
, LED_ST_PIN
, module_id
);
401 LED_ST_ALTSEL1_SETUP(LED_ST_PORT
, LED_ST_PIN
, module_id
);
402 LED_ST_DIR_SETUP(LED_ST_PORT
, LED_ST_PIN
, module_id
);
403 LED_ST_OPENDRAIN_SETUP(LED_ST_PORT
, LED_ST_PIN
, module_id
);
408 LED_D_ALTSEL0_SETUP(LED_D_PORT
, LED_D_PIN
, module_id
);
409 LED_D_ALTSEL1_SETUP(LED_D_PORT
, LED_D_PIN
, module_id
);
410 LED_D_DIR_SETUP(LED_D_PORT
, LED_D_PIN
, module_id
);
411 LED_D_OPENDRAIN_SETUP(LED_D_PORT
, LED_D_PIN
, module_id
);
416 LED_SH_ALTSEL0_SETUP(LED_SH_PORT
, LED_SH_PIN
, module_id
);
417 LED_SH_ALTSEL1_SETUP(LED_SH_PORT
, LED_SH_PIN
, module_id
);
418 LED_SH_DIR_SETUP(LED_SH_PORT
, LED_SH_PIN
, module_id
);
419 LED_SH_OPENDRAIN_SETUP(LED_SH_PORT
, LED_SH_PIN
, module_id
);
426 release_gpio_port (unsigned long adsl
)
430 port_free_pin(LED_ADSL0_PORT
, LED_ADSL0_PIN
, module_id
);
431 port_free_pin(LED_ADSL1_PORT
, LED_ADSL1_PIN
, module_id
);
435 port_free_pin(LED_ST_PORT
, LED_ST_PIN
, module_id
);
436 port_free_pin(LED_D_PORT
, LED_D_PIN
, module_id
);
437 port_free_pin(LED_SH_PORT
, LED_SH_PIN
, module_id
);
442 setup_gpt (int timer
, unsigned long freq
)
446 timer
= TIMER(timer
, 1);
448 ret
= request_timer(timer
,
452 | TIMER_FLAG_CYCLIC
| TIMER_FLAG_COUNTER
| TIMER_FLAG_DOWN
453 | TIMER_FLAG_ANY_EDGE
454 | TIMER_FLAG_NO_HANDLE
,
461 ret
= start_timer(timer
, 0);
470 release_gpt (int timer
)
472 timer
= TIMER(timer
, 1);
478 turn_on_led (unsigned long adsl
)
482 ret
= setup_gpio_port(adsl
);
492 turn_off_led (unsigned long adsl
)
494 release_gpio_port(adsl
);
500 danube_led_set_blink (unsigned int led
, unsigned int blink
)
502 unsigned int bit_mask
;
510 *DANUBE_LED_CON0
|= bit_mask
;
512 *DANUBE_LED_CON0
&= ~bit_mask
;
515 return (led
== 0 && (readl(DANUBE_LED_CON0
) & LED_CON0_AD0
)) || (led
== 1 && (readl(DANUBE_LED_CON0
) & LED_CON0_AD1
)) ? -EINVAL
: 0;
519 danube_led_set_data (unsigned int led
, unsigned int data
)
521 unsigned long f_update
;
522 unsigned int bit_mask
;
530 *DANUBE_LED_CPU0
|= bit_mask
;
532 *DANUBE_LED_CPU0
&= ~bit_mask
;
533 f_update
= !(*DANUBE_LED_AR
& bit_mask
);
536 return f_update
? update_led() : 0;
540 danube_led_config (struct led_config_param
* param
)
543 unsigned int reg_con0
, reg_con1
, reg_cpu0
, reg_ar
;
544 unsigned int clean_reg_con0
, clean_reg_con1
, clean_reg_cpu0
, clean_reg_ar
;
545 unsigned int f_setup_gpt2
;
546 unsigned int f_software_update
;
547 unsigned int new_led_on
, new_adsl_on
;
554 reg_con0
= *DANUBE_LED_CON0
;
555 reg_con1
= *DANUBE_LED_CON1
;
556 reg_cpu0
= *DANUBE_LED_CPU0
;
557 reg_ar
= *DANUBE_LED_AR
;
566 f_software_update
= (readl(DANUBE_LED_CON0
) & LED_CON0_SWU
) ? 0 : 1;
568 new_led_on
= f_led_on
;
569 new_adsl_on
= adsl_on
;
572 if ( (param
->operation_mask
& CONFIG_OPERATION_UPDATE_SOURCE
) )
574 if ( param
->led
> 0x03 || param
->source
> 0x03 )
577 reg_con0
= set_update_source(reg_con0
, param
->led
, param
->source
);
578 #if 0 // ADSL0,1 is source for bit 0, 1 in shift register
579 new_adsl_on
= param
->source
;
584 if ( (param
->operation_mask
& CONFIG_OPERATION_BLINK
) )
586 if ( (param
->blink_mask
& 0xFF000000) || (param
->blink
& 0xFF000000) )
589 reg_con0
= set_blink_in_batch(reg_con0
, param
->blink_mask
, param
->blink
);
593 if ( (param
->operation_mask
& CONFIG_DATA_CLOCK_EDGE
) )
596 reg_con0
= set_data_clock_edge(reg_con0
, param
->f_data_clock_on_rising
);
600 if ( (param
->operation_mask
& CONFIG_OPERATION_UPDATE_CLOCK
) )
602 if ( param
->update_clock
> 0x02 || (param
->update_clock
== 0x02 && param
->fpid
> 0x3) )
605 f_software_update
= param
->update_clock
== 0 ? 1 : 0;
606 if ( param
->update_clock
== 0x01 )
608 reg_con1
= set_update_clock(reg_con1
, param
->update_clock
, param
->fpid
);
612 if ( (param
->operation_mask
& CONFIG_OPERATION_STORE_MODE
) )
615 reg_con1
= set_store_mode(reg_con1
, param
->store_mode
);
619 if ( (param
->operation_mask
& CONFIG_OPERATION_SHIFT_CLOCK
) )
621 if ( param
->fpis
> 0x03 )
624 reg_con1
= set_shift_clock(reg_con1
, param
->fpis
);
628 if ( (param
->operation_mask
& CONFIG_OPERATION_DATA_OFFSET
) )
630 if ( param
->data_offset
> 0x03 )
633 reg_con1
= set_data_offset(reg_con1
, param
->data_offset
);
637 if ( (param
->operation_mask
& CONFIG_OPERATION_NUMBER_OF_LED
) )
639 if ( param
->number_of_enabled_led
> 0x24 )
643 * If there is at lease one LED enabled, the GPIO pin must be setup.
645 new_led_on
= param
->number_of_enabled_led
? 1 : 0;
648 reg_con1
= set_number_of_enabled_led(reg_con1
, param
->number_of_enabled_led
);
652 if ( (param
->operation_mask
& CONFIG_OPERATION_DATA
) )
654 if ( (param
->data_mask
& 0xFF000000) || (param
->data
& 0xFF000000) )
657 reg_cpu0
= set_data_in_batch(reg_cpu0
, param
->data_mask
, param
->data
);
658 if ( f_software_update
)
661 reg_con0
|= 0x80000000;
666 if ( (param
->operation_mask
& CONFIG_OPERATION_MIPS0_ACCESS
) )
668 if ( (param
->mips0_access_mask
& 0xFF000000) || (param
->mips0_access
& 0xFF000000) )
671 reg_ar
= set_access_right(reg_ar
, param
->mips0_access_mask
, param
->mips0_access
);
675 if ( f_setup_gpt2
&& !new_adsl_on
) // If ADSL led is on, GPT is disabled.
681 if ( gpt_freq
!= param
->fpid
)
685 ret
= setup_gpt(2, param
->fpid
);
689 ret
= setup_gpt(2, param
->fpid
);
694 printk("Setup GPT error!\n");
696 goto SETUP_GPT_ERROR
;
701 printk("Setup GPT successfully!\n");
716 if ( !new_led_on
|| adsl_on
!= new_adsl_on
)
718 turn_off_led(adsl_on
);
722 if ( !f_led_on
&& new_led_on
)
724 ret
= turn_on_led(new_adsl_on
);
727 printk("Setup GPIO error!\n");
728 goto SETUP_GPIO_ERROR
;
730 adsl_on
= new_adsl_on
;
738 *DANUBE_LED_AR
= reg_ar
;
739 if ( !clean_reg_cpu0
)
740 *DANUBE_LED_CPU0
= reg_cpu0
;
741 if ( !clean_reg_con1
)
742 *DANUBE_LED_CON1
= reg_con1
;
743 if ( !clean_reg_con0
)
744 *DANUBE_LED_CON0
= reg_con0
;
764 led_ioctl (struct inode
*inode
, struct file
*file
, unsigned int cmd
, unsigned long arg
)
767 struct led_config_param param
;
772 copy_from_user(¶m
, (char*)arg
, sizeof(param
));
773 ret
= danube_led_config(¶m
);
781 led_open (struct inode
*inode
, struct file
*file
)
787 led_release (struct inode
*inode
, struct file
*file
)
792 static struct file_operations led_fops
= {
799 static struct miscdevice led_miscdev
= {
809 danube_led_init (void)
812 struct led_config_param param
= {0};
817 * Set default value to registers to turn off all LED light.
819 *DANUBE_LED_AR
= 0x0;
820 *DANUBE_LED_CPU0
= 0x0;
821 *DANUBE_LED_CPU1
= 0x0;
822 *DANUBE_LED_CON1
= 0x0;
823 *DANUBE_LED_CON0
= (0x80000000 | (DATA_CLOCKING_EDGE
<< 26));
827 sema_init(&led_sem
, 0);
829 ret
= misc_register(&led_miscdev
);
832 led_miscdev
.minor
= MISC_DYNAMIC_MINOR
;
833 ret
= misc_register(&led_miscdev
);
837 printk(KERN_ERR
"led: can't misc_register\n");
841 printk(KERN_INFO
"led: misc_register on minor = %d\n", led_miscdev
.minor
);
843 module_id
= THIS_MODULE
? (int)THIS_MODULE
: ((MISC_MAJOR
<< 8) | led_miscdev
.minor
);
847 /* Add to enable hardware relay */
848 /* Map for LED on reference board
849 WLAN_READ LED11 OUT1 15
850 WARNING LED12 OUT2 14
851 FXS1_LINK LED13 OUT3 13
852 FXS2_LINK LED14 OUT4 12
853 FXO_ACT LED15 OUT5 11
854 USB_LINK LED16 OUT6 10
855 ADSL2_LINK LED19 OUT7 9
858 ADSL2_TRAFFIC LED31 OUT16 0
859 Map for hardware relay on reference board
863 param
.operation_mask
= CONFIG_OPERATION_NUMBER_OF_LED
;
864 param
.number_of_enabled_led
= 16;
865 danube_led_config(¶m
);
866 param
.operation_mask
= CONFIG_OPERATION_DATA
;
867 param
.data_mask
= 1 << 4;
869 danube_led_config(¶m
);
871 // by default, update by FSC clock (FPID)
872 param
.operation_mask
= CONFIG_OPERATION_UPDATE_CLOCK
;
873 param
.update_clock
= 2; // FPID
874 param
.fpid
= 3; // 10Hz
875 danube_led_config(¶m
);
877 // source of LED 0, 1 is ADSL
878 param
.operation_mask
= CONFIG_OPERATION_UPDATE_SOURCE
;
879 param
.led
= 3; // LED 0, 1
880 param
.source
= 3; // ADSL
881 danube_led_config(¶m
);
884 param
.operation_mask
= CONFIG_OPERATION_DATA
;
885 param
.data_mask
= 1 << 5;
887 danube_led_config(¶m
);
893 danube_led_exit (void)
897 ret
= misc_deregister(&led_miscdev
);
899 printk(KERN_ERR
"led: can't misc_deregister, get error number %d\n", -ret
);
901 printk(KERN_INFO
"led: misc_deregister successfully\n");
904 EXPORT_SYMBOL(danube_led_set_blink
);
905 EXPORT_SYMBOL(danube_led_set_data
);
906 EXPORT_SYMBOL(danube_led_config
);
908 module_init(danube_led_init
);
909 module_exit(danube_led_exit
);