diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/SOURCES | 3 | ||||
-rw-r--r-- | firmware/drivers/synaptics-mep.c | 20 | ||||
-rwxr-xr-x | firmware/export/config-sa9200.h | 8 | ||||
-rw-r--r-- | firmware/export/usb.h | 6 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/backlight-sa9200.c | 23 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/backlight-target.h | 3 | ||||
-rwxr-xr-x | firmware/target/arm/philips/sa9200/button-sa9200.c | 79 | ||||
-rwxr-xr-x | firmware/target/arm/philips/sa9200/button-target.h | 10 | ||||
-rw-r--r-- | firmware/target/arm/philips/sa9200/power-sa9200.c | 40 |
9 files changed, 159 insertions, 33 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index 78f13a9444..bba9ef1dc5 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -547,6 +547,9 @@ target/arm/sandisk/audio-c200_e200.c | |||
547 | 547 | ||
548 | #ifdef PHILIPS_SA9200 | 548 | #ifdef PHILIPS_SA9200 |
549 | #ifndef SIMULATOR | 549 | #ifndef SIMULATOR |
550 | #ifndef BOOTLOADER | ||
551 | drivers/synaptics-mep.c | ||
552 | #endif /* BOOTLOADER */ | ||
550 | target/arm/adc-as3514.c | 553 | target/arm/adc-as3514.c |
551 | target/arm/ascodec-pp.c | 554 | target/arm/ascodec-pp.c |
552 | target/arm/ata-sd-pp.c | 555 | target/arm/ata-sd-pp.c |
diff --git a/firmware/drivers/synaptics-mep.c b/firmware/drivers/synaptics-mep.c index 64b63397f7..f4b5a99aa7 100644 --- a/firmware/drivers/synaptics-mep.c +++ b/firmware/drivers/synaptics-mep.c | |||
@@ -73,6 +73,26 @@ | |||
73 | #define DATA_LO GPIO_SET_BITWISE(GPIOA_OUTPUT_EN, 0x10);\ | 73 | #define DATA_LO GPIO_SET_BITWISE(GPIOA_OUTPUT_EN, 0x10);\ |
74 | GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_VAL, 0x10) | 74 | GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_VAL, 0x10) |
75 | #define DATA_CL GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x10) | 75 | #define DATA_CL GPIO_CLEAR_BITWISE(GPIOA_OUTPUT_EN, 0x10) |
76 | |||
77 | #elif defined(PHILIPS_SA9200) | ||
78 | #define INT_ENABLE GPIO_CLEAR_BITWISE(GPIOD_INT_LEV, 0x2);\ | ||
79 | GPIO_SET_BITWISE(GPIOD_INT_EN, 0x2) | ||
80 | #define INT_DISABLE GPIO_CLEAR_BITWISE(GPIOD_INT_EN, 0x2);\ | ||
81 | GPIO_SET_BITWISE(GPIOD_INT_CLR, 0x2) | ||
82 | |||
83 | #define ACK (GPIOD_INPUT_VAL & 0x8) | ||
84 | #define ACK_HI GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x8) | ||
85 | #define ACK_LO GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x8) | ||
86 | |||
87 | #define CLK ((GPIOD_INPUT_VAL & 0x2) >> 1) | ||
88 | #define CLK_HI GPIO_SET_BITWISE(GPIOD_OUTPUT_VAL, 0x2) | ||
89 | #define CLK_LO GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x2) | ||
90 | |||
91 | #define DATA ((GPIOD_INPUT_VAL & 0x10) >> 4) | ||
92 | #define DATA_HI GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_EN, 0x10) | ||
93 | #define DATA_LO GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_VAL, 0x10);\ | ||
94 | GPIO_SET_BITWISE(GPIOD_OUTPUT_EN, 0x10) | ||
95 | #define DATA_CL GPIO_CLEAR_BITWISE(GPIOD_OUTPUT_EN, 0x10) | ||
76 | #endif | 96 | #endif |
77 | 97 | ||
78 | #define LO 0 | 98 | #define LO 0 |
diff --git a/firmware/export/config-sa9200.h b/firmware/export/config-sa9200.h index e35c27e15e..37c0b50035 100755 --- a/firmware/export/config-sa9200.h +++ b/firmware/export/config-sa9200.h | |||
@@ -59,6 +59,9 @@ | |||
59 | 59 | ||
60 | #define CONFIG_KEYPAD PHILIPS_SA9200_PAD | 60 | #define CONFIG_KEYPAD PHILIPS_SA9200_PAD |
61 | 61 | ||
62 | /* define this if the target has volume keys which can be used in the lists */ | ||
63 | #define HAVE_VOLUME_IN_LIST | ||
64 | |||
62 | /* Define this if you do software codec */ | 65 | /* Define this if you do software codec */ |
63 | #define CONFIG_CODEC SWCODEC | 66 | #define CONFIG_CODEC SWCODEC |
64 | 67 | ||
@@ -99,6 +102,11 @@ | |||
99 | /* Which backlight fading type? */ | 102 | /* Which backlight fading type? */ |
100 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING | 103 | #define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING |
101 | 104 | ||
105 | /* define this if you have a light associated with the buttons */ | ||
106 | #define HAVE_BUTTON_LIGHT | ||
107 | /* Can't control the brightness on all the buttons */ | ||
108 | /* #define HAVE_BUTTONLIGHT_BRIGHTNESS */ | ||
109 | |||
102 | /* define this if you have a flash memory storage */ | 110 | /* define this if you have a flash memory storage */ |
103 | #define HAVE_FLASH_STORAGE | 111 | #define HAVE_FLASH_STORAGE |
104 | 112 | ||
diff --git a/firmware/export/usb.h b/firmware/export/usb.h index 557639c622..2707541bff 100644 --- a/firmware/export/usb.h +++ b/firmware/export/usb.h | |||
@@ -77,10 +77,12 @@ enum { | |||
77 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ | 77 | #elif (CONFIG_KEYPAD == SANSA_E200_PAD) || \ |
78 | (CONFIG_KEYPAD == SANSA_C200_PAD) || \ | 78 | (CONFIG_KEYPAD == SANSA_C200_PAD) || \ |
79 | (CONFIG_KEYPAD == SANSA_CLIP_PAD) || \ | 79 | (CONFIG_KEYPAD == SANSA_CLIP_PAD) || \ |
80 | (CONFIG_KEYPAD == SANSA_FUZE_PAD) || \ | 80 | (CONFIG_KEYPAD == SANSA_FUZE_PAD) |
81 | (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) | ||
82 | #define USBPOWER_BUTTON BUTTON_SELECT | 81 | #define USBPOWER_BUTTON BUTTON_SELECT |
83 | #define USBPOWER_BTN_IGNORE BUTTON_POWER | 82 | #define USBPOWER_BTN_IGNORE BUTTON_POWER |
83 | #elif (CONFIG_KEYPAD == PHILIPS_SA9200_PAD) | ||
84 | #define USBPOWER_BUTTON BUTTON_PLAY | ||
85 | #define USBPOWER_BTN_IGNORE BUTTON_POWER | ||
84 | #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD | 86 | #elif CONFIG_KEYPAD == PHILIPS_HDD1630_PAD |
85 | #define USBPOWER_BUTTON BUTTON_PLAYLIST | 87 | #define USBPOWER_BUTTON BUTTON_PLAYLIST |
86 | #define USBPOWER_BTN_IGNORE BUTTON_POWER | 88 | #define USBPOWER_BTN_IGNORE BUTTON_POWER |
diff --git a/firmware/target/arm/philips/sa9200/backlight-sa9200.c b/firmware/target/arm/philips/sa9200/backlight-sa9200.c index a0acaa0abd..22aae1ae6b 100644 --- a/firmware/target/arm/philips/sa9200/backlight-sa9200.c +++ b/firmware/target/arm/philips/sa9200/backlight-sa9200.c | |||
@@ -21,10 +21,10 @@ | |||
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" |
26 | #include "ascodec.h" | 25 | #include "ascodec.h" |
27 | #include "as3514.h" | 26 | #include "as3514.h" |
27 | #include "synaptics-mep.h" | ||
28 | 28 | ||
29 | void _backlight_set_brightness(int brightness) | 29 | void _backlight_set_brightness(int brightness) |
30 | { | 30 | { |
@@ -51,12 +51,29 @@ void _backlight_off(void) | |||
51 | #endif | 51 | #endif |
52 | } | 52 | } |
53 | 53 | ||
54 | #ifdef HAVE_BUTTON_LIGHT | ||
55 | |||
56 | #define BUTTONLIGHT_MASK 0x7f | ||
57 | #define BUTTONLIGHT_MAX 0x0f | ||
58 | static unsigned short buttonlight_status = 0; | ||
59 | |||
54 | void _buttonlight_on(void) | 60 | void _buttonlight_on(void) |
55 | { | 61 | { |
56 | /* TODO */ | 62 | if (!buttonlight_status) |
63 | { | ||
64 | touchpad_set_buttonlights(BUTTONLIGHT_MASK, BUTTONLIGHT_MAX); | ||
65 | GPIOD_OUTPUT_VAL &= ~(0x40 | 0x20 | 0x04); /* REW/FFWD/MENU */ | ||
66 | buttonlight_status = 1; | ||
67 | } | ||
57 | } | 68 | } |
58 | 69 | ||
59 | void _buttonlight_off(void) | 70 | void _buttonlight_off(void) |
60 | { | 71 | { |
61 | /* TODO */ | 72 | if (buttonlight_status) |
73 | { | ||
74 | touchpad_set_buttonlights(BUTTONLIGHT_MASK, 0); | ||
75 | GPIOD_OUTPUT_VAL |= (0x40 | 0x20 | 0x04); /* REW/FFWD/MENU */ | ||
76 | buttonlight_status = 0; | ||
77 | } | ||
62 | } | 78 | } |
79 | #endif | ||
diff --git a/firmware/target/arm/philips/sa9200/backlight-target.h b/firmware/target/arm/philips/sa9200/backlight-target.h index 21fad6d22e..9d695e5a22 100644 --- a/firmware/target/arm/philips/sa9200/backlight-target.h +++ b/firmware/target/arm/philips/sa9200/backlight-target.h | |||
@@ -27,6 +27,9 @@ void _backlight_off(void); | |||
27 | void _backlight_set_brightness(int brightness); | 27 | void _backlight_set_brightness(int brightness); |
28 | int __backlight_is_on(void); | 28 | int __backlight_is_on(void); |
29 | 29 | ||
30 | #ifdef HAVE_BUTTON_LIGHT | ||
30 | void _buttonlight_on(void); | 31 | void _buttonlight_on(void); |
31 | void _buttonlight_off(void); | 32 | void _buttonlight_off(void); |
32 | #endif | 33 | #endif |
34 | |||
35 | #endif | ||
diff --git a/firmware/target/arm/philips/sa9200/button-sa9200.c b/firmware/target/arm/philips/sa9200/button-sa9200.c index d965966075..be37111ecb 100755 --- a/firmware/target/arm/philips/sa9200/button-sa9200.c +++ b/firmware/target/arm/philips/sa9200/button-sa9200.c | |||
@@ -22,11 +22,58 @@ | |||
22 | #include "system.h" | 22 | #include "system.h" |
23 | #include "button.h" | 23 | #include "button.h" |
24 | #include "backlight.h" | 24 | #include "backlight.h" |
25 | #include "synaptics-mep.h" | ||
25 | 26 | ||
27 | #define LOGF_ENABLE | ||
28 | #include "logf.h" | ||
29 | |||
30 | static int int_btn = BUTTON_NONE; | ||
31 | |||
32 | #ifndef BOOTLOADER | ||
26 | void button_init_device(void) | 33 | void button_init_device(void) |
27 | { | 34 | { |
28 | /* TODO...for now, hardware initialisation is done by the c200 bootloader */ | 35 | /* The touchpad is powered on and initialized in power-sa9200.c |
36 | since it needs to be ready for both buttons and button lights. */ | ||
37 | } | ||
38 | |||
39 | /* | ||
40 | * Button interrupt handler | ||
41 | */ | ||
42 | void button_int(void) | ||
43 | { | ||
44 | char data[4]; | ||
45 | int val; | ||
46 | |||
47 | int_btn = BUTTON_NONE; | ||
48 | |||
49 | val = touchpad_read_device(data, 4); | ||
50 | |||
51 | if (val == MEP_BUTTON_HEADER) | ||
52 | { | ||
53 | /* Buttons packet */ | ||
54 | if (data[1] & 0x1) int_btn |= BUTTON_FFWD; | ||
55 | if (data[1] & 0x2) int_btn |= BUTTON_RIGHT; | ||
56 | if (data[1] & 0x4) int_btn |= BUTTON_LEFT; | ||
57 | if (data[1] & 0x8) int_btn |= BUTTON_REW; | ||
58 | if (data[2] & 0x1) int_btn |= BUTTON_MENU; | ||
59 | } | ||
60 | else if (val == MEP_ABSOLUTE_HEADER) | ||
61 | { | ||
62 | /* Absolute packet - the finger is on the vertical strip. | ||
63 | Position ranges from 1-4095, with 1 at the bottom. */ | ||
64 | val = ((data[1] >> 4) << 8) | data[2]; /* position */ | ||
65 | |||
66 | if ((val > 0) && (val <= 1365)) | ||
67 | int_btn |= BUTTON_DOWN; | ||
68 | else if ((val > 1365) && (val <= 2730)) | ||
69 | int_btn |= BUTTON_PLAY; | ||
70 | else if ((val > 2730) && (val <= 4095)) | ||
71 | int_btn |= BUTTON_UP; | ||
72 | } | ||
29 | } | 73 | } |
74 | #else | ||
75 | void button_init_device(void){} | ||
76 | #endif /* bootloader */ | ||
30 | 77 | ||
31 | bool button_hold(void) | 78 | bool button_hold(void) |
32 | { | 79 | { |
@@ -38,32 +85,14 @@ bool button_hold(void) | |||
38 | */ | 85 | */ |
39 | int button_read_device(void) | 86 | int button_read_device(void) |
40 | { | 87 | { |
41 | int btn = BUTTON_NONE; | 88 | int btn = int_btn; |
42 | static bool hold_button = false; | ||
43 | bool hold_button_old; | ||
44 | |||
45 | /* Hold */ | ||
46 | hold_button_old = hold_button; | ||
47 | hold_button = button_hold(); | ||
48 | 89 | ||
49 | #ifndef BOOTLOADER | 90 | if (button_hold()) |
50 | if (hold_button != hold_button_old) | 91 | return BUTTON_NONE; |
51 | backlight_hold_changed(hold_button); | ||
52 | #endif | ||
53 | 92 | ||
54 | /* device buttons */ | 93 | if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; |
55 | if (!hold_button) | 94 | if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; |
56 | { | 95 | if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; |
57 | #if 0 | ||
58 | if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_POWER; | ||
59 | if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_VOL_UP; | ||
60 | if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; | ||
61 | #endif | ||
62 | /* A hack until the touchpad works */ | ||
63 | if (!(GPIOB_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT; | ||
64 | if (!(GPIOF_INPUT_VAL & 0x10)) btn |= BUTTON_UP; | ||
65 | if (!(GPIOF_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN; | ||
66 | } | ||
67 | 96 | ||
68 | return btn; | 97 | return btn; |
69 | } | 98 | } |
diff --git a/firmware/target/arm/philips/sa9200/button-target.h b/firmware/target/arm/philips/sa9200/button-target.h index 0d691506d2..6259aa0737 100755 --- a/firmware/target/arm/philips/sa9200/button-target.h +++ b/firmware/target/arm/philips/sa9200/button-target.h | |||
@@ -25,15 +25,23 @@ | |||
25 | #include <stdbool.h> | 25 | #include <stdbool.h> |
26 | #include "config.h" | 26 | #include "config.h" |
27 | 27 | ||
28 | #define MEP_BUTTON_HEADER 0x1a | ||
29 | #define MEP_BUTTON_ID 0x09 | ||
30 | #define MEP_ABSOLUTE_HEADER 0x0b | ||
31 | |||
28 | #define HAS_BUTTON_HOLD | 32 | #define HAS_BUTTON_HOLD |
29 | 33 | ||
30 | bool button_hold(void); | 34 | bool button_hold(void); |
31 | void button_init_device(void); | 35 | void button_init_device(void); |
32 | int button_read_device(void); | 36 | int button_read_device(void); |
33 | 37 | ||
38 | #ifndef BOOTLOADER | ||
39 | void button_int(void); | ||
40 | #endif | ||
41 | |||
34 | /* Main unit's buttons */ | 42 | /* Main unit's buttons */ |
35 | #define BUTTON_POWER 0x00000001 | 43 | #define BUTTON_POWER 0x00000001 |
36 | #define BUTTON_SELECT 0x00000002 | 44 | #define BUTTON_PLAY 0x00000002 |
37 | #define BUTTON_MENU 0x00000004 | 45 | #define BUTTON_MENU 0x00000004 |
38 | #define BUTTON_LEFT 0x00000008 | 46 | #define BUTTON_LEFT 0x00000008 |
39 | #define BUTTON_RIGHT 0x00000010 | 47 | #define BUTTON_RIGHT 0x00000010 |
diff --git a/firmware/target/arm/philips/sa9200/power-sa9200.c b/firmware/target/arm/philips/sa9200/power-sa9200.c index cf9468cb1d..5da1fc5fc4 100644 --- a/firmware/target/arm/philips/sa9200/power-sa9200.c +++ b/firmware/target/arm/philips/sa9200/power-sa9200.c | |||
@@ -22,14 +22,50 @@ | |||
22 | #include <stdbool.h> | 22 | #include <stdbool.h> |
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "cpu.h" | 24 | #include "cpu.h" |
25 | #include "i2c-pp.h" | ||
26 | #include "tuner.h" | ||
27 | #include "ascodec.h" | 25 | #include "ascodec.h" |
28 | #include "as3514.h" | 26 | #include "as3514.h" |
29 | #include "power.h" | 27 | #include "power.h" |
28 | #include "synaptics-mep.h" | ||
29 | #include "logf.h" | ||
30 | 30 | ||
31 | void power_init(void) | 31 | void power_init(void) |
32 | { | 32 | { |
33 | #ifndef BOOTLOADER | ||
34 | /* Power on and initialize the touchpad here because we need it for | ||
35 | both buttons and button lights */ | ||
36 | DEV_INIT2 &= ~0x800; | ||
37 | |||
38 | char byte = ascodec_read(AS3514_CVDD_DCDC3); | ||
39 | byte = (byte & ~0x18) | 0x08; | ||
40 | ascodec_write(AS3514_CVDD_DCDC3, byte); | ||
41 | |||
42 | /* LEDs for REW, FFWD, MENU */ | ||
43 | GPIOD_ENABLE |= (0x40 | 0x20 | 0x04); | ||
44 | GPIOD_OUTPUT_VAL |= (0x40 | 0x20 | 0x04); | ||
45 | GPIOD_OUTPUT_EN |= (0x40 | 0x20 | 0x04); | ||
46 | udelay(20000); | ||
47 | |||
48 | GPIOL_ENABLE |= 0x10; | ||
49 | GPIOL_OUTPUT_VAL &= ~0x10; | ||
50 | GPIOL_OUTPUT_EN |= 0x10; | ||
51 | udelay(100000); | ||
52 | |||
53 | /* enable DATA, ACK, CLK lines */ | ||
54 | GPIOD_ENABLE |= (0x10 | 0x08 | 0x02); | ||
55 | |||
56 | GPIOD_OUTPUT_EN |= 0x08; /* ACK */ | ||
57 | GPIOD_OUTPUT_VAL |= 0x08; /* high */ | ||
58 | |||
59 | GPIOD_OUTPUT_EN &= ~0x02; /* CLK */ | ||
60 | |||
61 | GPIOD_OUTPUT_EN |= 0x10; /* DATA */ | ||
62 | GPIOD_OUTPUT_VAL |= 0x10; /* high */ | ||
63 | |||
64 | if (!touchpad_init()) | ||
65 | { | ||
66 | logf("touchpad not ready"); | ||
67 | } | ||
68 | #endif | ||
33 | } | 69 | } |
34 | 70 | ||
35 | void power_off(void) | 71 | void power_off(void) |