diff options
Diffstat (limited to 'firmware/target/coldfire/iriver/h300/adc-h300.c')
-rw-r--r-- | firmware/target/coldfire/iriver/h300/adc-h300.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/firmware/target/coldfire/iriver/h300/adc-h300.c b/firmware/target/coldfire/iriver/h300/adc-h300.c index 77d7b4689f..b13d0c73cc 100644 --- a/firmware/target/coldfire/iriver/h300/adc-h300.c +++ b/firmware/target/coldfire/iriver/h300/adc-h300.c | |||
@@ -26,20 +26,23 @@ | |||
26 | 26 | ||
27 | static int adcc2_parms[] = | 27 | static int adcc2_parms[] = |
28 | { | 28 | { |
29 | [ADC_BUTTONS] = 0x80 | (5 << 1) | 1, /* ADCIN2 */ | 29 | [ADC_BUTTONS] = 0x80 | (5 << 1) | 1, /* 8b, ADCIN2 */ |
30 | [ADC_REMOTE] = 0x80 | (6 << 1) | 1, /* ADCIN3 */ | 30 | [ADC_REMOTE] = 0x80 | (6 << 1) | 1, /* 8b, ADCIN3 */ |
31 | [ADC_BATTERY] = 0x80 | (0 << 1) | 1, /* BATVOLT, resistive divider */ | 31 | [ADC_BATTERY] = 0x00 | (0 << 1) | 1, /* 10b, BATVOLT, resistive divider */ |
32 | [ADC_REMOTEDETECT] = 0x80 | (2 << 1) | 1, /* ADCIN1, resistive divider */ | 32 | [ADC_REMOTEDETECT] = 0x80 | (2 << 1) | 1, /* 8b, ADCIN1, resistive divider */ |
33 | }; | 33 | }; |
34 | 34 | ||
35 | unsigned short adc_scan(int channel) | 35 | unsigned short adc_scan(int channel) |
36 | { | 36 | { |
37 | int level = set_irq_level(HIGHEST_IRQ_LEVEL); | 37 | int level = set_irq_level(HIGHEST_IRQ_LEVEL); |
38 | unsigned char data; | 38 | unsigned data; |
39 | 39 | ||
40 | pcf50606_write(0x2f, adcc2_parms[channel]); | 40 | pcf50606_write(0x2f, adcc2_parms[channel]); |
41 | data = pcf50606_read(0x30); | 41 | data = pcf50606_read(0x30); |
42 | 42 | ||
43 | if (channel == ADC_BATTERY) | ||
44 | data = (data << 2) | (pcf50606_read(0x31) & 0x03); | ||
45 | |||
43 | set_irq_level(level); | 46 | set_irq_level(level); |
44 | return data; | 47 | return data; |
45 | } | 48 | } |