summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2011-11-14 21:42:43 +0000
committerAmaury Pouly <pamaury@rockbox.org>2011-11-14 21:42:43 +0000
commitea8570b48c13b7d86704652cac00934f8831b474 (patch)
tree5fde2873172a22fb303a57a1e49ebe5eaf3929bc
parentf791a81e87fc6a4a680158e0c92dcd562de8fbbb (diff)
imx233: remove virtual 5V channel (value doesn't make sense), fix battery conversion (need to trigger delay)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30986 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/target/arm/imx233/adc-imx233.c6
-rw-r--r--firmware/target/arm/imx233/adc-imx233.h1
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c4
3 files changed, 4 insertions, 7 deletions
diff --git a/firmware/target/arm/imx233/adc-imx233.c b/firmware/target/arm/imx233/adc-imx233.c
index 5e9717b922..21447bbda7 100644
--- a/firmware/target/arm/imx233/adc-imx233.c
+++ b/firmware/target/arm/imx233/adc-imx233.c
@@ -59,6 +59,7 @@ void adc_init(void)
* conversions per seconds */
imx233_lradc_setup_delay(battery_delay_chan, 1 << battery_chan,
1 << battery_delay_chan, 0, 200);
+ imx233_lradc_kick_delay(battery_delay_chan);
/* enable automatic conversion, use Li-Ion type battery */
imx233_lradc_setup_battery_conversion(true, HW_LRADC_CONVERSION__SCALE_FACTOR__LI_ION);
}
@@ -86,12 +87,9 @@ unsigned short adc_read_virtual(int c)
switch(c)
{
case IMX233_ADC_BATTERY:
- return /*imx233_lradc_read_battery_voltage()*/adc_read_physical_ex(battery_chan);
+ return adc_read_physical_ex(battery_chan);
case IMX233_ADC_VDDIO:
return adc_read_physical_ex(vddio_chan);
- case IMX233_ADC_5V:
- /* channel 15 5V has a 4:1 built it divider */
- return adc_read_physical(HW_LRADC_CHANNEL_5V) * 4;
case IMX233_ADC_DIE_TEMP:
// do kelvin to celsius conversion
return imx233_lradc_sense_die_temperature(nmos_chan, pmos_chan) - 273;
diff --git a/firmware/target/arm/imx233/adc-imx233.h b/firmware/target/arm/imx233/adc-imx233.h
index 7468fbe3c3..6025fdcdf8 100644
--- a/firmware/target/arm/imx233/adc-imx233.h
+++ b/firmware/target/arm/imx233/adc-imx233.h
@@ -29,7 +29,6 @@
#define IMX233_ADC_BATTERY -1 /* Battery voltage (mV) */
#define IMX233_ADC_DIE_TEMP -2 /* Die temperature (°C) */
#define IMX233_ADC_VDDIO -3 /* VddIO voltage (mV) */
-#define IMX233_ADC_5V -4 /* Vdd5V voltage (mV) */
/* Channel mapping */
extern int imx233_adc_mapping[];
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c
index 2da440b170..78b88c9e85 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c
@@ -26,12 +26,12 @@ int imx233_adc_mapping[] =
[ADC_BATTERY] = IMX233_ADC_BATTERY,
[ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP,
[ADC_VDDIO] = IMX233_ADC_VDDIO,
- [ADC_5V] = IMX233_ADC_5V,
+ [ADC_5V] = HW_LRADC_CHANNEL_5V,
};
const char *imx233_adc_channel_name[] =
{
- "Battery(mV)",
+ "Battery(raw)",
"Die temperature(°C)",
"VddIO",
"Vdd5V",