summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2008-12-12 04:56:25 +0000
committerMark Arigo <markarigo@gmail.com>2008-12-12 04:56:25 +0000
commit08585e417b4e545752ff9478d28c4da3e8c09844 (patch)
tree313471fd029dcd6fb3acad417a8fa88dc2644ed8 /firmware/target/arm
parentea5d0bd7ec036eb8a34afe1d339b3233d281db57 (diff)
downloadrockbox-08585e417b4e545752ff9478d28c4da3e8c09844.tar.gz
rockbox-08585e417b4e545752ff9478d28c4da3e8c09844.zip
FS#9591 by Anton Veretenenko for the Philips GoGear HDD1620/1630 (with a few changes by me). Fixes boot problem, pixel format, sound, and a few other things.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19395 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/adc-pp5020.c22
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/backlight-hdd1630.c4
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/button-hdd1630.c33
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/lcd-hdd1630.c1
-rwxr-xr-xfirmware/target/arm/philips/hdd1630/power-hdd1630.c27
-rw-r--r--firmware/target/arm/philips/hdd1630/powermgmt-hdd1630.c8
-rw-r--r--firmware/target/arm/wmcodec-pp.c7
7 files changed, 82 insertions, 20 deletions
diff --git a/firmware/target/arm/adc-pp5020.c b/firmware/target/arm/adc-pp5020.c
index a8fe8c1560..33950014dc 100644
--- a/firmware/target/arm/adc-pp5020.c
+++ b/firmware/target/arm/adc-pp5020.c
@@ -35,28 +35,28 @@ unsigned short adc_scan(int channel)
35 35
36 /* Start conversion */ 36 /* Start conversion */
37 ADC_ADDR |= 0x80000000; 37 ADC_ADDR |= 0x80000000;
38 38
39 /* Wait for conversion to complete */ 39 /* Wait for conversion to complete */
40 while((ADC_STATUS & (0x40<<8*channel))==0); 40 while((ADC_STATUS & (0x40<<8*channel))==0);
41 41
42 /* Stop conversion */ 42 /* Stop conversion */
43 ADC_ADDR &=~ 0x80000000; 43 ADC_ADDR &=~ 0x80000000;
44 44
45 /* ADC_DATA_1 and ADC_DATA_2 are both four bytes, one byte per channel. 45 /* ADC_DATA_1 and ADC_DATA_2 are both four bytes, one byte per channel.
46 For each channel, ADC_DATA_1 stores the 8-bit msb, ADC_DATA_2 stores the 46 For each channel, ADC_DATA_1 stores the 8-bit msb, ADC_DATA_2 stores the
47 2-bit lsb (in bits 0 and 1). Each channel is 10 bits total. */ 47 2-bit lsb (in bits 0 and 1). Each channel is 10 bits total. */
48 adc_data_1 = ((ADC_DATA_1 >> (8*channel)) & 0xff); 48 adc_data_1 = ((ADC_DATA_1 >> (8*channel)) & 0xff);
49 adc_data_2 = ((ADC_DATA_2 >> (8*channel+6)) & 0x3); 49 adc_data_2 = ((ADC_DATA_2 >> (8*channel+6)) & 0x3);
50 50
51 adcdata[channel] = (adc_data_1<<2 | adc_data_2); 51 adcdata[channel] = (adc_data_1<<2 | adc_data_2);
52 52
53 /* ADC values read low if PLL is enabled */ 53 /* ADC values read low if PLL is enabled */
54 if(PLL_CONTROL & 0x80000000){ 54 if(PLL_CONTROL & 0x80000000){
55 adcdata[channel] += 0x14; 55 adcdata[channel] += 0x14;
56 if(adcdata[channel] > 0x400) 56 if(adcdata[channel] > 0x400)
57 adcdata[channel] = 0x400; 57 adcdata[channel] = 0x400;
58 } 58 }
59 59
60 return adcdata[channel]; 60 return adcdata[channel];
61} 61}
62 62
@@ -83,17 +83,18 @@ static void adc_tick(void)
83/* Figured out from how the OF does things */ 83/* Figured out from how the OF does things */
84void adc_init(void) 84void adc_init(void)
85{ 85{
86
86 ADC_INIT |= 1; 87 ADC_INIT |= 1;
87 ADC_INIT |= 0x40000000; 88 ADC_INIT |= 0x40000000;
88 udelay(100); 89 udelay(100);
89 90
90 /* Reset ADC */ 91 /* Reset ADC */
91 DEV_RS2 |= 0x20; 92 DEV_RS2 |= 0x20;
92 udelay(100); 93 udelay(100);
93 94
94 DEV_RS2 &=~ 0x20; 95 DEV_RS2 &=~ 0x20;
95 udelay(100); 96 udelay(100);
96 97
97 /* Enable ADC */ 98 /* Enable ADC */
98 DEV_EN2 |= 0x20; 99 DEV_EN2 |= 0x20;
99 udelay(100); 100 udelay(100);
@@ -121,7 +122,8 @@ void adc_init(void)
121 ADC_ADDR |= 0x2000000; 122 ADC_ADDR |= 0x2000000;
122 ADC_STATUS |= 0x2000; 123 ADC_STATUS |= 0x2000;
123 124
124#if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(MROBE_100) 125#if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || \
126 defined(MROBE_100) || defined(PHILIPS_HDD1630)
125 /* Enable channel 2 (H10:remote) */ 127 /* Enable channel 2 (H10:remote) */
126 DEV_INIT1 &=~0x300; 128 DEV_INIT1 &=~0x300;
127 DEV_INIT1 |= 0x100; 129 DEV_INIT1 |= 0x100;
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
35void _backlight_on(void) 35void _backlight_on(void)
36{ 36{
37 GPO32_VAL &= ~0x1000000;
38 GPO32_ENABLE &= ~0x1000000;
37} 39}
38 40
39void _backlight_off(void) 41void _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 */
27int 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 */
33void button_click(void)
34{
35 GPO32_ENABLE |= 0x2000;
36 GPIOD_OUTPUT_VAL |= 0x8;
37 udelay(1000);
38 GPO32_VAL &= ~0x2000;
39}
40
26void button_init_device(void) 41void 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
64bool headphones_inserted(void) 93bool 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
36void power_init(void) 36void 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
40unsigned int power_input_status(void) 48unsigned 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
45void ide_power_enable(bool on) 64void ide_power_enable(bool on)
@@ -57,4 +76,8 @@ bool ide_powered(void)
57 76
58void power_off(void) 77void 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
27const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = 27const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
28{ 28{
29 3450 29 3450
30}; 30};
31 31
32const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = 32const 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 */
45const unsigned short percent_to_volt_charge[11] = 45const 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] */
61unsigned int battery_adc_voltage(void) 61unsigned 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}
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index 031f5c8d47..bd3d4e6579 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -32,11 +32,12 @@
32#include "i2s.h" 32#include "i2s.h"
33#include "wmcodec.h" 33#include "wmcodec.h"
34 34
35#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(MROBE_100) 35#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || \
36 defined(MROBE_100) || defined(PHILIPS_HDD1630)
36/* The H10's audio codec uses an I2C address of 0x1b */ 37/* The H10's audio codec uses an I2C address of 0x1b */
37#define I2C_AUDIO_ADDRESS 0x1b 38#define I2C_AUDIO_ADDRESS 0x1b
38#else 39#else
39/* The iPod's audio codecs use an I2C address of 0x1a */ 40/* The iPod's audio codecs use an I2C address of 0x1a */
40#define I2C_AUDIO_ADDRESS 0x1a 41#define I2C_AUDIO_ADDRESS 0x1a
41#endif 42#endif
42 43
@@ -100,7 +101,7 @@ void audiohw_init(void)
100 101
101 /* reset the I2S controller into known state */ 102 /* reset the I2S controller into known state */
102 i2s_reset(); 103 i2s_reset();
103 104
104 audiohw_preinit(); 105 audiohw_preinit();
105} 106}
106 107