summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Arigo <markarigo@gmail.com>2009-01-27 03:36:30 +0000
committerMark Arigo <markarigo@gmail.com>2009-01-27 03:36:30 +0000
commit9d10f112994ddd3470e219175b92ab201769ba87 (patch)
treee1f1de922c002a2e105ec79aafde89ca8ab07902
parent04992ef050a2bef8387f84efc6988211c34e19b7 (diff)
downloadrockbox-9d10f112994ddd3470e219175b92ab201769ba87.tar.gz
rockbox-9d10f112994ddd3470e219175b92ab201769ba87.tar.bz2
rockbox-9d10f112994ddd3470e219175b92ab201769ba87.zip
Make the Philips HDD1630 ADC work: it needs a slightly different init sequence. Also, it only needs 2 channels enabled.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19865 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/adc-pp5020.c22
-rw-r--r--firmware/target/arm/philips/hdd1630/adc-target.h2
2 files changed, 21 insertions, 3 deletions
diff --git a/firmware/target/arm/adc-pp5020.c b/firmware/target/arm/adc-pp5020.c
index e270a41235..851e907246 100644
--- a/firmware/target/arm/adc-pp5020.c
+++ b/firmware/target/arm/adc-pp5020.c
@@ -39,6 +39,9 @@ unsigned short adc_scan(int channel)
unsigned int adc_data_1;
unsigned int adc_data_2;
+ if (channel >= NUM_ADC_CHANNELS)
+ return 0;
+
/* Start conversion */
ADC_ADDR |= 0x80000000;
@@ -56,12 +59,14 @@ unsigned short adc_scan(int channel)
adcdata[channel] = (adc_data_1<<2 | adc_data_2);
+#if !defined(PHILIPS_HDD1630)
/* ADC values read low if PLL is enabled */
if(PLL_CONTROL & 0x80000000){
adcdata[channel] += 0x14;
if(adcdata[channel] > 0x400)
adcdata[channel] = 0x400;
}
+#endif
return adcdata[channel];
}
@@ -89,9 +94,12 @@ static void adc_tick(void)
/* Figured out from how the OF does things */
void adc_init(void)
{
-
+#if defined(PHILIPS_HDD1630)
+ ADC_INIT = 0;
+#else
ADC_INIT |= 1;
ADC_INIT |= 0x40000000;
+#endif
udelay(100);
/* Reset ADC */
@@ -108,13 +116,17 @@ void adc_init(void)
ADC_CLOCK_SRC |= 0x3;
udelay(100);
+ ADC_ADDR = 0;
ADC_ADDR |= 0x40;
+
+#if !defined(PHILIPS_HDD1630)
ADC_ADDR |= 0x20000000;
udelay(100);
ADC_INIT;
ADC_INIT = 0;
udelay(100);
+#endif
ADC_STATUS = 0;
@@ -129,7 +141,7 @@ void adc_init(void)
ADC_STATUS |= 0x2000;
#if defined (IRIVER_H10) || defined(IRIVER_H10_5GB) || \
- defined(MROBE_100) || defined(PHILIPS_HDD1630)
+ defined(MROBE_100)
/* Enable channel 2 (H10:remote) */
DEV_INIT1 &=~0x300;
DEV_INIT1 |= 0x100;
@@ -143,6 +155,12 @@ void adc_init(void)
ADC_STATUS |= 0x20000000;
#endif
+#if defined(PHILIPS_HDD1630)
+ ADC_INIT |= 0x80000000;
+ udelay(100);
+ ADC_INIT = 0;
+#endif
+
/* Force a scan of all channels to get initial values */
adc_scan(0);
adc_scan(1);
diff --git a/firmware/target/arm/philips/hdd1630/adc-target.h b/firmware/target/arm/philips/hdd1630/adc-target.h
index ee9e294c6b..bf97081e35 100644
--- a/firmware/target/arm/philips/hdd1630/adc-target.h
+++ b/firmware/target/arm/philips/hdd1630/adc-target.h
@@ -21,7 +21,7 @@
#ifndef _ADC_TARGET_H_
#define _ADC_TARGET_H_
-#define NUM_ADC_CHANNELS 4
+#define NUM_ADC_CHANNELS 2
#define ADC_BATTERY 0
#define ADC_UNKNOWN_1 1