2 * LED interface for Himalaya, the HTC PocketPC.
6 * Author: Luke Kenneth Casson Leighton, Copyright(C) 2004
8 * Copyright(C) 2004, Luke Kenneth Casson Leighton.
12 * 2004-02-19 Luke Kenneth Casson Leighton created.
16 #include <linux/module.h>
17 #include <linux/delay.h>
19 #include <asm/hardware/ipaq-asic3.h>
20 #include <asm/mach-types.h>
21 #include <asm/arch/ipaq.h>
23 //#include "himalaya_leds.h"
25 extern struct platform_device himalaya_asic3
;
26 extern struct ipaq_model_ops ipaq_model_ops
;
28 #define CLOCK_CDEX_LED0 (1 << 6) /* clock for led 0? */
29 #define CLOCK_CDEX_LED1 (1 << 7) /* clock for led 1? */
31 void himalaya_set_led (enum led_color color
, int duty_time
, int cycle_time
)
35 IPAQ_ASIC3_LED_TimeBase(H3900_ASIC3_VIRT
, 0) = 0x6 | LEDTBS_BLINK
;
36 IPAQ_ASIC3_LED_PeriodTime(H3900_ASIC3_VIRT
, 0) = cycle_time
;
37 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 0) = 0;
39 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 0) = duty_time
;
41 IPAQ_ASIC3_LED_TimeBase(H3900_ASIC3_VIRT
, 1) = 0x6 | LEDTBS_BLINK
;
42 IPAQ_ASIC3_LED_PeriodTime(H3900_ASIC3_VIRT
, 1) = cycle_time
;
43 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 1) = 0;
46 if (color
== GREEN_LED
)
48 IPAQ_ASIC3_LED_TimeBase(H3900_ASIC3_VIRT
, 1) = 0x6 | LEDTBS_BLINK
;
49 IPAQ_ASIC3_LED_PeriodTime(H3900_ASIC3_VIRT
, 1) = cycle_time
;
50 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 1) = 0;
52 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 1) = duty_time
;
54 IPAQ_ASIC3_LED_TimeBase(H3900_ASIC3_VIRT
, 0) = 0x6 | LEDTBS_BLINK
;
55 IPAQ_ASIC3_LED_PeriodTime(H3900_ASIC3_VIRT
, 0) = cycle_time
;
56 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 0) = 0;
59 if (color
== YELLOW_LED
)
61 IPAQ_ASIC3_LED_TimeBase(H3900_ASIC3_VIRT
, 1) = 0x6 | LEDTBS_BLINK
;
62 IPAQ_ASIC3_LED_PeriodTime(H3900_ASIC3_VIRT
, 1) = cycle_time
;
63 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 1) = 0;
65 IPAQ_ASIC3_LED_TimeBase(H3900_ASIC3_VIRT
, 0) = 0x6 | LEDTBS_BLINK
;
66 IPAQ_ASIC3_LED_PeriodTime(H3900_ASIC3_VIRT
, 0) = cycle_time
;
67 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 0) = 0;
70 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 1) = duty_time
;
71 IPAQ_ASIC3_LED_DutyTime(H3900_ASIC3_VIRT
, 0) = duty_time
;
74 if (color
== BLUE_LED
)
75 printk("%s: Blue LED not yet enabled.\n", __FUNCTION__
);
77 EXPORT_SYMBOL(himalaya_set_led
);
79 static int himalaya_led_init (void)
83 if (! machine_is_himalaya() )
86 ipaq_model_ops
.set_led
= himalaya_set_led
;
90 static void himalaya_led_exit (void)
92 ipaq_model_ops
.set_led
= NULL
;
95 module_init (himalaya_led_init
);
96 module_exit (himalaya_led_exit
);