diff options
Diffstat (limited to 'firmware/target/arm/philips/hdd1630')
4 files changed, 85 insertions, 47 deletions
diff --git a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c index eb2c2731ac..eafce13759 100755 --- a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c | |||
@@ -21,35 +21,84 @@ | |||
21 | #include "config.h" | 21 | #include "config.h" |
22 | #include "backlight-target.h" | 22 | #include "backlight-target.h" |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | ||
25 | #include "backlight.h" | 24 | #include "backlight.h" |
25 | #include "synaptics-mep.h" | ||
26 | 26 | ||
27 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 27 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
28 | static unsigned short backlight_brightness = DEFAULT_BRIGHTNESS_SETTING; | 28 | static const int brightness_vals[16] = |
29 | {255,237,219,201,183,165,147,130,112,94,76,58,40,22,5,0}; | ||
29 | 30 | ||
30 | void _backlight_set_brightness(int brightness) | 31 | void _backlight_set_brightness(int brightness) |
31 | { | 32 | { |
33 | outl(0x80000000 | (brightness_vals[brightness-1] << 16), 0x7000a000); | ||
32 | } | 34 | } |
33 | #endif | 35 | #endif |
34 | 36 | ||
35 | void _backlight_on(void) | 37 | void _backlight_on(void) |
36 | { | 38 | { |
37 | GPO32_VAL &= ~0x1000000; | 39 | GPO32_VAL &= ~0x1000000; |
38 | GPO32_ENABLE &= ~0x1000000; | 40 | GPO32_ENABLE &= ~0x1000000; |
39 | } | 41 | } |
40 | 42 | ||
41 | void _backlight_off(void) | 43 | void _backlight_off(void) |
42 | { | 44 | { |
43 | GPO32_VAL |= 0x1000000; | 45 | GPO32_VAL |= 0x1000000; |
44 | GPO32_ENABLE |= 0x1000000; | 46 | GPO32_ENABLE |= 0x1000000; |
45 | } | 47 | } |
46 | 48 | ||
47 | #ifdef HAVE_BUTTON_LIGHT | 49 | #ifdef HAVE_BUTTON_LIGHT |
48 | void _buttonlight_on(void) | 50 | |
51 | #define BUTTONLIGHT_MASK 0x7f | ||
52 | |||
53 | static unsigned short buttonight_brightness = DEFAULT_BRIGHTNESS_SETTING - 1; | ||
54 | static unsigned short buttonlight_status = 0; | ||
55 | |||
56 | static void set_buttonlight(int brightness) | ||
49 | { | 57 | { |
58 | int data[6]; | ||
59 | |||
60 | if (syn_get_status()) | ||
61 | { | ||
62 | syn_int_enable(false); | ||
63 | |||
64 | /* turn on all touchpad leds */ | ||
65 | data[0] = 0x05; | ||
66 | data[1] = 0x31; | ||
67 | data[2] = (brightness & 0xff) << 4; | ||
68 | data[3] = 0x00; | ||
69 | data[4] = 0x00; | ||
70 | data[5] = BUTTONLIGHT_MASK; | ||
71 | syn_send(data, 6); | ||
72 | |||
73 | /* device responds with a single-byte ACK packet */ | ||
74 | syn_read(data, 2); | ||
75 | |||
76 | syn_int_enable(true); | ||
77 | } | ||
50 | } | 78 | } |
51 | 79 | ||
80 | void _buttonlight_on(void) | ||
81 | { | ||
82 | if (!buttonlight_status) | ||
83 | { | ||
84 | set_buttonlight(buttonight_brightness); | ||
85 | buttonlight_status = 1; | ||
86 | } | ||
87 | } | ||
88 | |||
52 | void _buttonlight_off(void) | 89 | void _buttonlight_off(void) |
53 | { | 90 | { |
91 | if (buttonlight_status) | ||
92 | { | ||
93 | set_buttonlight(0); | ||
94 | buttonlight_status = 0; | ||
95 | } | ||
96 | } | ||
97 | |||
98 | void _buttonlight_set_brightness(int brightness) | ||
99 | { | ||
100 | buttonight_brightness = brightness - 1; | ||
101 | set_buttonlight(buttonight_brightness); | ||
102 | buttonlight_status = 1; | ||
54 | } | 103 | } |
55 | #endif | 104 | #endif |
diff --git a/firmware/target/arm/philips/hdd1630/backlight-target.h b/firmware/target/arm/philips/hdd1630/backlight-target.h index 8fb5fa1a56..c7aca54a23 100755 --- a/firmware/target/arm/philips/hdd1630/backlight-target.h +++ b/firmware/target/arm/philips/hdd1630/backlight-target.h | |||
@@ -24,7 +24,6 @@ | |||
24 | #define _backlight_init() true | 24 | #define _backlight_init() true |
25 | void _backlight_on(void); | 25 | void _backlight_on(void); |
26 | void _backlight_off(void); | 26 | void _backlight_off(void); |
27 | int __backlight_is_on(void); | ||
28 | 27 | ||
29 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS | 28 | #ifdef HAVE_BACKLIGHT_BRIGHTNESS |
30 | void _backlight_set_brightness(int brightness); | 29 | void _backlight_set_brightness(int brightness); |
@@ -33,6 +32,7 @@ void _backlight_set_brightness(int brightness); | |||
33 | #ifdef HAVE_BUTTON_LIGHT | 32 | #ifdef HAVE_BUTTON_LIGHT |
34 | void _buttonlight_on(void); | 33 | void _buttonlight_on(void); |
35 | void _buttonlight_off(void); | 34 | void _buttonlight_off(void); |
35 | void _buttonlight_set_brightness(int brightness); | ||
36 | #endif | 36 | #endif |
37 | 37 | ||
38 | #endif | 38 | #endif |
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c index c0ac8d7c10..e8214edf91 100755 --- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c | |||
@@ -46,41 +46,11 @@ void button_click(void) | |||
46 | } | 46 | } |
47 | 47 | ||
48 | #ifndef BOOTLOADER | 48 | #ifndef BOOTLOADER |
49 | static int syn_status = 0; | ||
50 | |||
51 | void button_init_device(void) | 49 | void button_init_device(void) |
52 | { | 50 | { |
53 | /* enable touchpad */ | 51 | if (!syn_get_status()) |
54 | GPO32_ENABLE |= 0x80; | ||
55 | GPO32_VAL &= ~0x80; | ||
56 | udelay(1000); | ||
57 | |||
58 | /* enable ACK, CLK, DATA lines */ | ||
59 | GPIOD_ENABLE |= 0x80; | ||
60 | GPIOA_ENABLE |= (0x10 | 0x20); | ||
61 | |||
62 | GPIOD_OUTPUT_EN |= 0x80; /* ACK */ | ||
63 | GPIOD_OUTPUT_VAL |= 0x80; /* high */ | ||
64 | |||
65 | GPIOA_OUTPUT_EN &= ~0x20; /* CLK */ | ||
66 | |||
67 | GPIOA_OUTPUT_EN |= 0x10; /* DATA */ | ||
68 | GPIOA_OUTPUT_VAL |= 0x10; /* high */ | ||
69 | |||
70 | if (syn_init()) | ||
71 | { | 52 | { |
72 | #ifdef ROCKBOX_HAS_LOGF | 53 | logf("button_init_dev: touchpad not ready"); |
73 | syn_info(); | ||
74 | #endif | ||
75 | syn_status = 1; | ||
76 | |||
77 | /* enable interrupts */ | ||
78 | GPIOA_INT_LEV &= ~0x20; | ||
79 | GPIOA_INT_CLR |= 0x20; | ||
80 | GPIOA_INT_EN |= 0x20; | ||
81 | |||
82 | CPU_INT_EN |= HI_MASK; | ||
83 | CPU_HI_INT_EN |= GPIO0_MASK; | ||
84 | } | 54 | } |
85 | } | 55 | } |
86 | 56 | ||
@@ -94,19 +64,18 @@ void button_int(void) | |||
94 | 64 | ||
95 | int_btn = BUTTON_NONE; | 65 | int_btn = BUTTON_NONE; |
96 | 66 | ||
97 | if (syn_status) | 67 | if (syn_get_status()) |
98 | { | 68 | { |
99 | /* disable interrupt while we read the touchpad */ | 69 | /* disable interrupt while we read the touchpad */ |
100 | GPIOA_INT_EN &= ~0x20; | 70 | syn_int_enable(false); |
101 | GPIOA_INT_CLR |= 0x20; | ||
102 | 71 | ||
103 | val = syn_read_device(data, 4); | 72 | val = syn_read(data, 4); |
104 | if (val > 0) | 73 | if (val > 0) |
105 | { | 74 | { |
106 | val = data[0] & 0xff; /* packet header */ | 75 | val = data[0] & 0xff; /* packet header */ |
107 | id = (data[1] >> 4) & 0xf; /* packet id */ | 76 | id = (data[1] >> 4) & 0xf; /* packet id */ |
108 | 77 | ||
109 | logf("button_read_device..."); | 78 | logf("syn_read:"); |
110 | logf(" data[0] = 0x%08x", data[0]); | 79 | logf(" data[0] = 0x%08x", data[0]); |
111 | logf(" data[1] = 0x%08x", data[1]); | 80 | logf(" data[1] = 0x%08x", data[1]); |
112 | logf(" data[2] = 0x%08x", data[2]); | 81 | logf(" data[2] = 0x%08x", data[2]); |
@@ -121,7 +90,7 @@ void button_int(void) | |||
121 | int_btn |= BUTTON_RIGHT; | 90 | int_btn |= BUTTON_RIGHT; |
122 | 91 | ||
123 | /* An Absolute packet should follow which we ignore */ | 92 | /* An Absolute packet should follow which we ignore */ |
124 | val = syn_read_device(data, 4); | 93 | val = syn_read(data, 4); |
125 | logf(" int_btn = 0x%04x", int_btn); | 94 | logf(" int_btn = 0x%04x", int_btn); |
126 | } | 95 | } |
127 | else if (val == MEP_ABSOLUTE_HEADER) | 96 | else if (val == MEP_ABSOLUTE_HEADER) |
@@ -149,8 +118,7 @@ void button_int(void) | |||
149 | } | 118 | } |
150 | 119 | ||
151 | /* re-enable interrupts */ | 120 | /* re-enable interrupts */ |
152 | GPIOA_INT_LEV &= ~0x20; | 121 | syn_int_enable(true); |
153 | GPIOA_INT_EN |= 0x20; | ||
154 | } | 122 | } |
155 | } | 123 | } |
156 | #else | 124 | #else |
diff --git a/firmware/target/arm/philips/hdd1630/power-hdd1630.c b/firmware/target/arm/philips/hdd1630/power-hdd1630.c index 22e11c803a..02279fd560 100755 --- a/firmware/target/arm/philips/hdd1630/power-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/power-hdd1630.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include "power.h" | 28 | #include "power.h" |
29 | #include "logf.h" | 29 | #include "logf.h" |
30 | #include "usb.h" | 30 | #include "usb.h" |
31 | #include "synaptics-mep.h" | ||
31 | 32 | ||
32 | void power_init(void) | 33 | void power_init(void) |
33 | { | 34 | { |
@@ -46,6 +47,27 @@ void power_init(void) | |||
46 | GPIOE_OUTPUT_EN |= 0x40; | 47 | GPIOE_OUTPUT_EN |= 0x40; |
47 | GPIOE_OUTPUT_VAL &= ~0x40; /* off */ | 48 | GPIOE_OUTPUT_VAL &= ~0x40; /* off */ |
48 | #endif | 49 | #endif |
50 | |||
51 | #ifndef BOOTLOADER | ||
52 | /* enable touchpad here because we need it for | ||
53 | both buttons and button lights */ | ||
54 | GPO32_ENABLE |= 0x80; | ||
55 | GPO32_VAL &= ~0x80; | ||
56 | udelay(1000); | ||
57 | |||
58 | GPIOD_ENABLE |= 0x80; /* enable ACK */ | ||
59 | GPIOA_ENABLE |= (0x10 | 0x20); /* enable DATA, CLK */ | ||
60 | |||
61 | GPIOD_OUTPUT_EN |= 0x80; /* set ACK */ | ||
62 | GPIOD_OUTPUT_VAL |= 0x80; /* high */ | ||
63 | |||
64 | GPIOA_OUTPUT_EN &= ~0x20; /* CLK */ | ||
65 | |||
66 | GPIOA_OUTPUT_EN |= 0x10; /* set DATA */ | ||
67 | GPIOA_OUTPUT_VAL |= 0x10; /* high */ | ||
68 | |||
69 | syn_init(); | ||
70 | #endif | ||
49 | } | 71 | } |
50 | 72 | ||
51 | unsigned int power_input_status(void) | 73 | unsigned int power_input_status(void) |
@@ -70,7 +92,6 @@ void ide_power_enable(bool on) | |||
70 | /* We do nothing */ | 92 | /* We do nothing */ |
71 | } | 93 | } |
72 | 94 | ||
73 | |||
74 | bool ide_powered(void) | 95 | bool ide_powered(void) |
75 | { | 96 | { |
76 | /* pretend we are always powered - we don't turn it off */ | 97 | /* pretend we are always powered - we don't turn it off */ |