diff options
Diffstat (limited to 'firmware/target/arm/philips')
5 files changed, 66 insertions, 7 deletions
diff --git a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c index 0c49e65563..eb2c2731ac 100755 --- a/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/backlight-hdd1630.c | |||
@@ -34,10 +34,14 @@ void _backlight_set_brightness(int brightness) | |||
34 | 34 | ||
35 | void _backlight_on(void) | 35 | void _backlight_on(void) |
36 | { | 36 | { |
37 | GPO32_VAL &= ~0x1000000; | ||
38 | GPO32_ENABLE &= ~0x1000000; | ||
37 | } | 39 | } |
38 | 40 | ||
39 | void _backlight_off(void) | 41 | void _backlight_off(void) |
40 | { | 42 | { |
43 | GPO32_VAL |= 0x1000000; | ||
44 | GPO32_ENABLE |= 0x1000000; | ||
41 | } | 45 | } |
42 | 46 | ||
43 | #ifdef HAVE_BUTTON_LIGHT | 47 | #ifdef HAVE_BUTTON_LIGHT |
diff --git a/firmware/target/arm/philips/hdd1630/button-hdd1630.c b/firmware/target/arm/philips/hdd1630/button-hdd1630.c index 3a8f7c5408..84cb8f0c06 100755 --- a/firmware/target/arm/philips/hdd1630/button-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/button-hdd1630.c | |||
@@ -23,6 +23,21 @@ | |||
23 | #include "button.h" | 23 | #include "button.h" |
24 | #include "backlight.h" | 24 | #include "backlight.h" |
25 | 25 | ||
26 | /* Remember last buttons, to make single buzz sound */ | ||
27 | int btn_old; | ||
28 | |||
29 | /* | ||
30 | * Generate a click sound from the player (not in headphones yet) | ||
31 | * TODO: integrate this with the "key click" option | ||
32 | */ | ||
33 | void button_click(void) | ||
34 | { | ||
35 | GPO32_ENABLE |= 0x2000; | ||
36 | GPIOD_OUTPUT_VAL |= 0x8; | ||
37 | udelay(1000); | ||
38 | GPO32_VAL &= ~0x2000; | ||
39 | } | ||
40 | |||
26 | void button_init_device(void) | 41 | void button_init_device(void) |
27 | { | 42 | { |
28 | /* TODO...for now, hardware initialisation is done by the bootloader */ | 43 | /* TODO...for now, hardware initialisation is done by the bootloader */ |
@@ -49,19 +64,33 @@ int button_read_device(void) | |||
49 | /* device buttons */ | 64 | /* device buttons */ |
50 | if (!hold_button) | 65 | if (!hold_button) |
51 | { | 66 | { |
67 | /* These are the correct button definitions | ||
52 | if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU; | 68 | if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU; |
53 | if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP; | 69 | if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP; |
54 | if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; | 70 | if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN; |
55 | if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW; | 71 | if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW; |
56 | |||
57 | if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; | 72 | if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST; |
58 | if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; | 73 | if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; |
74 | */ | ||
75 | |||
76 | /* This is a hack until the touchpad works */ | ||
77 | if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_LEFT; /* BUTTON_MENU */ | ||
78 | if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_UP; /* BUTTON_VOL_UP */ | ||
79 | if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_DOWN; /* BUTTON_VOL_DOWN */ | ||
80 | if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_RIGHT; /* BUTTON_VIEW */ | ||
81 | if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_SELECT; /* BUTTON_PLAYLIST */ | ||
82 | if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER; | ||
59 | } | 83 | } |
60 | 84 | ||
85 | if ((btn != btn_old) && (btn != BUTTON_NONE)) | ||
86 | button_click(); | ||
87 | |||
88 | btn_old = btn; | ||
89 | |||
61 | return btn; | 90 | return btn; |
62 | } | 91 | } |
63 | 92 | ||
64 | bool headphones_inserted(void) | 93 | bool headphones_inserted(void) |
65 | { | 94 | { |
66 | return true; | 95 | return (GPIOE_INPUT_VAL & 0x80) ? true : false; |
67 | } | 96 | } |
diff --git a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c index d7dee2036d..827e3ef8c4 100755 --- a/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/lcd-hdd1630.c | |||
@@ -84,6 +84,7 @@ void lcd_init_device(void) | |||
84 | LCD2_BLOCK_CTRL = 0x10008080; | 84 | LCD2_BLOCK_CTRL = 0x10008080; |
85 | LCD2_BLOCK_CONFIG = 0xF00000; | 85 | LCD2_BLOCK_CONFIG = 0xF00000; |
86 | 86 | ||
87 | /* lcd power */ | ||
87 | GPIOJ_ENABLE |= 0x4; | 88 | GPIOJ_ENABLE |= 0x4; |
88 | GPIOJ_OUTPUT_VAL |= 0x4; | 89 | GPIOJ_OUTPUT_VAL |= 0x4; |
89 | GPIOJ_OUTPUT_EN |= 0x4; | 90 | GPIOJ_OUTPUT_EN |= 0x4; |
diff --git a/firmware/target/arm/philips/hdd1630/power-hdd1630.c b/firmware/target/arm/philips/hdd1630/power-hdd1630.c index ade2536154..03a5794791 100755 --- a/firmware/target/arm/philips/hdd1630/power-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/power-hdd1630.c | |||
@@ -35,11 +35,30 @@ bool charger_enabled; | |||
35 | 35 | ||
36 | void power_init(void) | 36 | void power_init(void) |
37 | { | 37 | { |
38 | /* power off bit */ | ||
39 | GPIOB_ENABLE |= 0x80; | ||
40 | GPIOB_OUTPUT_VAL |= 0x80; | ||
41 | GPIOB_OUTPUT_EN |= 0x80; | ||
42 | |||
43 | /* charger inserted bit */ | ||
44 | GPIOE_ENABLE |= 0x20; | ||
45 | GPIOE_INPUT_VAL |= 0x20; | ||
38 | } | 46 | } |
39 | 47 | ||
40 | unsigned int power_input_status(void) | 48 | unsigned int power_input_status(void) |
41 | { | 49 | { |
42 | return POWER_INPUT_NONE; | 50 | unsigned int status = POWER_INPUT_NONE; |
51 | |||
52 | /* AC charger */ | ||
53 | if (GPIOE_INPUT_VAL & 0x20) | ||
54 | status |= POWER_INPUT_MAIN_CHARGER; | ||
55 | |||
56 | /* Do nothing with USB for now | ||
57 | if (GPIOE_INPUT_VAL & 0x4) | ||
58 | status |= POWER_INPUT_USB_CHARGER; | ||
59 | */ | ||
60 | |||
61 | return status; | ||
43 | } | 62 | } |
44 | 63 | ||
45 | void ide_power_enable(bool on) | 64 | void ide_power_enable(bool on) |
@@ -57,4 +76,8 @@ bool ide_powered(void) | |||
57 | 76 | ||
58 | void power_off(void) | 77 | void power_off(void) |
59 | { | 78 | { |
79 | /* power off bit */ | ||
80 | GPIOB_ENABLE |= 0x80; | ||
81 | GPIOB_OUTPUT_VAL &= ~0x80; | ||
82 | GPIOB_OUTPUT_EN |= 0x80; | ||
60 | } | 83 | } |
diff --git a/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c b/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c index c8d5584305..0bb9458fe7 100644 --- a/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c +++ b/firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c | |||
@@ -26,7 +26,7 @@ | |||
26 | 26 | ||
27 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | 27 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = |
28 | { | 28 | { |
29 | 3450 | 29 | 3450 |
30 | }; | 30 | }; |
31 | 31 | ||
32 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | 32 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = |
@@ -44,7 +44,7 @@ const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | |||
44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | 44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ |
45 | const unsigned short percent_to_volt_charge[11] = | 45 | const unsigned short percent_to_volt_charge[11] = |
46 | { | 46 | { |
47 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 | 47 | 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 |
48 | }; | 48 | }; |
49 | #endif /* CONFIG_CHARGING */ | 49 | #endif /* CONFIG_CHARGING */ |
50 | 50 | ||
@@ -60,5 +60,7 @@ const unsigned short percent_to_volt_charge[11] = | |||
60 | /* Returns battery voltage from ADC [millivolts] */ | 60 | /* Returns battery voltage from ADC [millivolts] */ |
61 | unsigned int battery_adc_voltage(void) | 61 | unsigned int battery_adc_voltage(void) |
62 | { | 62 | { |
63 | return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; | 63 | /* For now, assume as battery full (we need to calibrate) */ |
64 | /* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */ | ||
65 | return 3990; | ||
64 | } | 66 | } |