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
This commit is contained in:
Mark Arigo 2009-01-27 03:36:30 +00:00
parent 04992ef050
commit 9d10f11299
2 changed files with 21 additions and 3 deletions

View file

@ -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);

View file

@ -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