diff options
author | Amaury Pouly <amaury.pouly@gmail.com> | 2013-11-19 19:04:03 +0000 |
---|---|---|
committer | Amaury Pouly <amaury.pouly@gmail.com> | 2013-11-19 19:04:03 +0000 |
commit | c2c2274e0adacc1a0c5bdb57fa1367badb7b047f (patch) | |
tree | de5477d9b65a50bf5b5e693b1254ac653564c925 /firmware/target | |
parent | 287be81c16ef52484403c9f08bbf80465da6263b (diff) | |
download | rockbox-c2c2274e0adacc1a0c5bdb57fa1367badb7b047f.tar.gz rockbox-c2c2274e0adacc1a0c5bdb57fa1367badb7b047f.zip |
imx233: factor adc accross targets
The old code allowed each target to specify its adc targets but this proved
useless since the target rely directly on imx233/lradc for input method and
generic adc is mostly used for battery and debug. Remove all target specific
files and provide a generic implemenation. The targets can still specify a
battery temperature channel in powermgmt-target.h
Change-Id: I68cf2e3e46379d174ac6d774ffb237bb15a19ae3
Diffstat (limited to 'firmware/target')
-rw-r--r-- | firmware/target/arm/imx233/adc-imx233.c | 48 | ||||
-rw-r--r-- | firmware/target/arm/imx233/adc-target.h (renamed from firmware/target/arm/imx233/adc-imx233.h) | 21 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zen/adc-target.h | 29 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zen/adc-zen.c | 34 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zen/lcd-zen.c | 10 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi2/adc-target.h | 32 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c | 40 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi3/adc-target.h | 32 | ||||
-rw-r--r-- | firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c | 40 | ||||
-rw-r--r-- | firmware/target/arm/imx233/debug-imx233.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c | 42 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sansa-fuzeplus/adc-target.h | 33 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sony-nwz/adc-nwz.c | 38 | ||||
-rw-r--r-- | firmware/target/arm/imx233/sony-nwz/adc-target.h | 31 |
14 files changed, 62 insertions, 372 deletions
diff --git a/firmware/target/arm/imx233/adc-imx233.c b/firmware/target/arm/imx233/adc-imx233.c index a6025cfde9..a0bda9ab02 100644 --- a/firmware/target/arm/imx233/adc-imx233.c +++ b/firmware/target/arm/imx233/adc-imx233.c | |||
@@ -19,9 +19,46 @@ | |||
19 | * | 19 | * |
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | 21 | ||
22 | #include "adc-imx233.h" | 22 | #include "adc-target.h" |
23 | #include "power-imx233.h" | 23 | #include "power-imx233.h" |
24 | 24 | ||
25 | /* Virtual channels */ | ||
26 | #define IMX233_ADC_BATTERY -1 /* Battery voltage (mV) */ | ||
27 | #define IMX233_ADC_DIE_TEMP -2 /* Die temperature (°C) */ | ||
28 | #define IMX233_ADC_VDDIO -3 /* VddIO voltage (mV) */ | ||
29 | #if IMX233_SUBTARGET >= 3700 | ||
30 | #define IMX233_ADC_VDD5V -4 /* Vdd5V voltage (mV) */ | ||
31 | #endif | ||
32 | #ifdef IMX233_BATT_TEMP_SENSOR | ||
33 | #define IMX233_ADC_BATT_TEMP -5 /* Battery temperature (°C) */ | ||
34 | #endif | ||
35 | |||
36 | static const char *imx233_adc_channel_name[NUM_ADC_CHANNELS] = | ||
37 | { | ||
38 | [ADC_BATTERY] = "Battery(raw)", | ||
39 | [ADC_DIE_TEMP] = "Die temperature(°C)", | ||
40 | [ADC_VDDIO] = "VddIO(mV)", | ||
41 | #if IMX233_SUBTARGET >= 3700 | ||
42 | [ADC_VDD5V] = "Vdd5V(mV)", | ||
43 | #endif | ||
44 | #ifdef IMX233_BATT_TEMP_SENSOR | ||
45 | [ADC_BATT_TEMP] = "Battery temperature(raw)", | ||
46 | #endif | ||
47 | }; | ||
48 | |||
49 | static int imx233_adc_mapping[NUM_ADC_CHANNELS] = | ||
50 | { | ||
51 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
52 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
53 | [ADC_VDDIO] = IMX233_ADC_VDDIO, | ||
54 | #if IMX233_SUBTARGET >= 3700 | ||
55 | [ADC_VDD5V] = IMX233_ADC_VDD5V, | ||
56 | #endif | ||
57 | #ifdef IMX233_BATT_TEMP_SENSOR | ||
58 | [ADC_BATT_TEMP] = IMX233_ADC_BATT_TEMP, | ||
59 | #endif | ||
60 | }; | ||
61 | |||
25 | void adc_init(void) | 62 | void adc_init(void) |
26 | { | 63 | { |
27 | } | 64 | } |
@@ -52,11 +89,11 @@ static short adc_read_virtual(int c) | |||
52 | return imx233_lradc_read_battery_voltage(); | 89 | return imx233_lradc_read_battery_voltage(); |
53 | case IMX233_ADC_VDDIO: | 90 | case IMX233_ADC_VDDIO: |
54 | /* VddIO pin has a builtin 2:1 divide */ | 91 | /* VddIO pin has a builtin 2:1 divide */ |
55 | return adc_read_physical(LRADC_SRC_VDDIO, false); | 92 | return adc_read_physical(LRADC_SRC_VDDIO, true) * 2; |
56 | #if IMX233_SUBTARGET >= 3700 | 93 | #if IMX233_SUBTARGET >= 3700 |
57 | case IMX233_ADC_VDD5V: | 94 | case IMX233_ADC_VDD5V: |
58 | /* Vdd5V pin has a builtin 4:1 divide */ | 95 | /* Vdd5V pin has a builtin 4:1 divide */ |
59 | return adc_read_physical(LRADC_SRC_5V, false) * 2; | 96 | return adc_read_physical(LRADC_SRC_5V, true) * 4; |
60 | #endif | 97 | #endif |
61 | case IMX233_ADC_DIE_TEMP: | 98 | case IMX233_ADC_DIE_TEMP: |
62 | { | 99 | { |
@@ -102,3 +139,8 @@ unsigned short adc_read(int channel) | |||
102 | else | 139 | else |
103 | return adc_read_physical(c, true); | 140 | return adc_read_physical(c, true); |
104 | } | 141 | } |
142 | |||
143 | const char *adc_name(int channel) | ||
144 | { | ||
145 | return imx233_adc_channel_name[channel]; | ||
146 | } | ||
diff --git a/firmware/target/arm/imx233/adc-imx233.h b/firmware/target/arm/imx233/adc-target.h index f833e17be0..ed6e3eca77 100644 --- a/firmware/target/arm/imx233/adc-imx233.h +++ b/firmware/target/arm/imx233/adc-target.h | |||
@@ -27,20 +27,21 @@ | |||
27 | #include "powermgmt-target.h" | 27 | #include "powermgmt-target.h" |
28 | #include "lradc-imx233.h" | 28 | #include "lradc-imx233.h" |
29 | 29 | ||
30 | /* Virtual channels */ | 30 | enum imx233_adc_channel_t |
31 | #define IMX233_ADC_BATTERY -1 /* Battery voltage (mV) */ | 31 | { |
32 | #define IMX233_ADC_DIE_TEMP -2 /* Die temperature (°C) */ | 32 | ADC_BATTERY, /* Battery voltage (mV) */ |
33 | #define IMX233_ADC_VDDIO -3 /* VddIO voltage (mV) */ | 33 | ADC_DIE_TEMP, /* Die temperature (°C) */ |
34 | ADC_VDDIO, /* VDDIO (mV) */ | ||
34 | #if IMX233_SUBTARGET >= 3700 | 35 | #if IMX233_SUBTARGET >= 3700 |
35 | #define IMX233_ADC_VDD5V -4 /* Vdd5V voltage (mV) */ | 36 | ADC_VDD5V, /* VDD5V (mV) */ |
36 | #endif | 37 | #endif |
37 | #ifdef IMX233_BATT_TEMP_SENSOR | 38 | #ifdef IMX233_BATT_TEMP_SENSOR |
38 | #define IMX233_ADC_BATT_TEMP -5 /* Battery temperature (°C) */ | 39 | ADC_BATT_TEMP, /* Battery temperature (°C) */ |
39 | #endif | 40 | #endif |
41 | NUM_ADC_CHANNELS, | ||
42 | }; | ||
40 | 43 | ||
41 | /* Channel mapping */ | 44 | /* Return channel name */ |
42 | extern int imx233_adc_mapping[]; | 45 | const char *adc_name(int channel); |
43 | /* Channel names */ | ||
44 | extern const char *imx233_adc_channel_name[]; | ||
45 | 46 | ||
46 | #endif | 47 | #endif |
diff --git a/firmware/target/arm/imx233/creative-zen/adc-target.h b/firmware/target/arm/imx233/creative-zen/adc-target.h deleted file mode 100644 index 5a525152f6..0000000000 --- a/firmware/target/arm/imx233/creative-zen/adc-target.h +++ /dev/null | |||
@@ -1,29 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #define NUM_ADC_CHANNELS 2 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_DIE_TEMP 1 | ||
28 | |||
29 | #endif | ||
diff --git a/firmware/target/arm/imx233/creative-zen/adc-zen.c b/firmware/target/arm/imx233/creative-zen/adc-zen.c deleted file mode 100644 index 92c1063c24..0000000000 --- a/firmware/target/arm/imx233/creative-zen/adc-zen.c +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "adc-target.h" | ||
22 | #include "adc-imx233.h" | ||
23 | |||
24 | int imx233_adc_mapping[] = | ||
25 | { | ||
26 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
27 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
28 | }; | ||
29 | |||
30 | const char *imx233_adc_channel_name[] = | ||
31 | { | ||
32 | "Die temperature(°C)", | ||
33 | "Battery(raw)", | ||
34 | }; | ||
diff --git a/firmware/target/arm/imx233/creative-zen/lcd-zen.c b/firmware/target/arm/imx233/creative-zen/lcd-zen.c index 22d643c778..3b58159df4 100644 --- a/firmware/target/arm/imx233/creative-zen/lcd-zen.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zen.c | |||
@@ -278,15 +278,15 @@ void lcd_init_device(void) | |||
278 | imx233_pinctrl_acquire(1, 8, "lcd_power"); | 278 | imx233_pinctrl_acquire(1, 8, "lcd_power"); |
279 | imx233_pinctrl_set_function(1, 8, PINCTRL_FUNCTION_GPIO); | 279 | imx233_pinctrl_set_function(1, 8, PINCTRL_FUNCTION_GPIO); |
280 | imx233_pinctrl_enable_gpio(1, 8, true); | 280 | imx233_pinctrl_enable_gpio(1, 8, true); |
281 | // power up | ||
282 | lcd_power(true); | ||
283 | // reset lcd | 281 | // reset lcd |
284 | imx233_lcdif_reset_lcd(true); | 282 | imx233_lcdif_reset_lcd(true); |
285 | mdelay(1); | 283 | mdelay(10); |
286 | imx233_lcdif_reset_lcd(false); | 284 | imx233_lcdif_reset_lcd(false); |
287 | mdelay(1); | 285 | mdelay(10); |
288 | imx233_lcdif_reset_lcd(true); | 286 | imx233_lcdif_reset_lcd(true); |
289 | mdelay(1); | 287 | mdelay(10); |
288 | // power up | ||
289 | lcd_power(true); | ||
290 | // setup registers | 290 | // setup registers |
291 | imx233_lcdif_enable_sync_signals(true); // we need frame signals during init | 291 | imx233_lcdif_enable_sync_signals(true); // we need frame signals during init |
292 | lcd_power_seq(); | 292 | lcd_power_seq(); |
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/adc-target.h b/firmware/target/arm/imx233/creative-zenxfi2/adc-target.h deleted file mode 100644 index 79b281b892..0000000000 --- a/firmware/target/arm/imx233/creative-zenxfi2/adc-target.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2011 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #define NUM_ADC_CHANNELS 5 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_DIE_TEMP 1 | ||
28 | #define ADC_VDDIO 2 | ||
29 | #define ADC_5V 3 | ||
30 | #define ADC_BATT_TEMP 4 | ||
31 | |||
32 | #endif | ||
diff --git a/firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c b/firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c deleted file mode 100644 index 9ec641be88..0000000000 --- a/firmware/target/arm/imx233/creative-zenxfi2/adc-zenxfi2.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2011 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "adc-target.h" | ||
22 | #include "adc-imx233.h" | ||
23 | |||
24 | int imx233_adc_mapping[] = | ||
25 | { | ||
26 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
27 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
28 | [ADC_VDDIO] = IMX233_ADC_VDDIO, | ||
29 | [ADC_5V] = IMX233_ADC_VDD5V, | ||
30 | [ADC_BATT_TEMP] = IMX233_ADC_BATT_TEMP, | ||
31 | }; | ||
32 | |||
33 | const char *imx233_adc_channel_name[] = | ||
34 | { | ||
35 | "Battery(raw)", | ||
36 | "Die temperature(°C)", | ||
37 | "VddIO", | ||
38 | "Vdd5V", | ||
39 | "Battery temperature(raw)", | ||
40 | }; | ||
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/adc-target.h b/firmware/target/arm/imx233/creative-zenxfi3/adc-target.h deleted file mode 100644 index d946989c1c..0000000000 --- a/firmware/target/arm/imx233/creative-zenxfi3/adc-target.h +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2012 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #define NUM_ADC_CHANNELS 5 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_DIE_TEMP 1 | ||
28 | #define ADC_VDDIO 2 | ||
29 | #define ADC_5V 3 | ||
30 | #define ADC_BATT_TEMP 4 | ||
31 | |||
32 | #endif | ||
diff --git a/firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c b/firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c deleted file mode 100644 index 919e55200b..0000000000 --- a/firmware/target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2012 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "adc-target.h" | ||
22 | #include "adc-imx233.h" | ||
23 | |||
24 | int imx233_adc_mapping[] = | ||
25 | { | ||
26 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
27 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
28 | [ADC_VDDIO] = IMX233_ADC_VDDIO, | ||
29 | [ADC_5V] = IMX233_ADC_VDD5V, | ||
30 | [ADC_BATT_TEMP] = IMX233_ADC_BATT_TEMP, | ||
31 | }; | ||
32 | |||
33 | const char *imx233_adc_channel_name[] = | ||
34 | { | ||
35 | "Battery(raw)", | ||
36 | "Die temperature(°C)", | ||
37 | "VddIO", | ||
38 | "Vdd5V", | ||
39 | "Battery temperature(raw)", | ||
40 | }; | ||
diff --git a/firmware/target/arm/imx233/debug-imx233.c b/firmware/target/arm/imx233/debug-imx233.c index 8abe8e1c40..63172c8c1e 100644 --- a/firmware/target/arm/imx233/debug-imx233.c +++ b/firmware/target/arm/imx233/debug-imx233.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "font.h" | 25 | #include "font.h" |
26 | #include "adc.h" | 26 | #include "adc.h" |
27 | #include "adc-imx233.h" | ||
28 | #include "power-imx233.h" | 27 | #include "power-imx233.h" |
29 | #include "clkctrl-imx233.h" | 28 | #include "clkctrl-imx233.h" |
30 | #include "powermgmt-imx233.h" | 29 | #include "powermgmt-imx233.h" |
@@ -269,8 +268,7 @@ bool dbg_hw_info_lradc(void) | |||
269 | lcd_putsf(0, 0, "Battery(mV) %d", _battery_voltage()); | 268 | lcd_putsf(0, 0, "Battery(mV) %d", _battery_voltage()); |
270 | for(unsigned i = 0; i < NUM_ADC_CHANNELS; i++) | 269 | for(unsigned i = 0; i < NUM_ADC_CHANNELS; i++) |
271 | { | 270 | { |
272 | lcd_putsf(0, i + 1, "%s %d", imx233_adc_channel_name[i], | 271 | lcd_putsf(0, i + 1, "%s %d", adc_name(i), adc_read(i)); |
273 | adc_read(i)); | ||
274 | } | 272 | } |
275 | 273 | ||
276 | lcd_update(); | 274 | lcd_update(); |
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c deleted file mode 100644 index 5d04f6f6b0..0000000000 --- a/firmware/target/arm/imx233/sansa-fuzeplus/adc-fuzeplus.c +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2011 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "adc-target.h" | ||
22 | #include "adc-imx233.h" | ||
23 | |||
24 | int imx233_adc_mapping[] = | ||
25 | { | ||
26 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
27 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
28 | [ADC_VDDIO] = IMX233_ADC_VDDIO, | ||
29 | [ADC_5V] = IMX233_ADC_VDD5V, | ||
30 | [ADC_BATT_TEMP] = IMX233_ADC_BATT_TEMP, | ||
31 | [ADC_CH2] = LRADC_SRC(2), | ||
32 | }; | ||
33 | |||
34 | const char *imx233_adc_channel_name[] = | ||
35 | { | ||
36 | "Battery(raw)", | ||
37 | "Die temperature(°C)", | ||
38 | "VddIO(mV)", | ||
39 | "Vdd5V(mV)", | ||
40 | "Battery temperature(raw)", | ||
41 | "Channel 2", | ||
42 | }; | ||
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/adc-target.h b/firmware/target/arm/imx233/sansa-fuzeplus/adc-target.h deleted file mode 100644 index 9fccfa9da4..0000000000 --- a/firmware/target/arm/imx233/sansa-fuzeplus/adc-target.h +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2011 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #define NUM_ADC_CHANNELS 6 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_DIE_TEMP 1 | ||
28 | #define ADC_VDDIO 2 | ||
29 | #define ADC_5V 3 | ||
30 | #define ADC_BATT_TEMP 4 | ||
31 | #define ADC_CH2 5 | ||
32 | |||
33 | #endif | ||
diff --git a/firmware/target/arm/imx233/sony-nwz/adc-nwz.c b/firmware/target/arm/imx233/sony-nwz/adc-nwz.c deleted file mode 100644 index e53005c082..0000000000 --- a/firmware/target/arm/imx233/sony-nwz/adc-nwz.c +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #include "adc-target.h" | ||
22 | #include "adc-imx233.h" | ||
23 | |||
24 | int imx233_adc_mapping[] = | ||
25 | { | ||
26 | [ADC_BATTERY] = IMX233_ADC_BATTERY, | ||
27 | [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP, | ||
28 | [ADC_VDDIO] = IMX233_ADC_VDDIO, | ||
29 | [ADC_5V] = IMX233_ADC_VDD5V, | ||
30 | }; | ||
31 | |||
32 | const char *imx233_adc_channel_name[] = | ||
33 | { | ||
34 | "Battery(raw)", | ||
35 | "Die temperature(°C)", | ||
36 | "VddIO", | ||
37 | "Vdd5V", | ||
38 | }; | ||
diff --git a/firmware/target/arm/imx233/sony-nwz/adc-target.h b/firmware/target/arm/imx233/sony-nwz/adc-target.h deleted file mode 100644 index e9c1939941..0000000000 --- a/firmware/target/arm/imx233/sony-nwz/adc-target.h +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2013 by Amaury Pouly | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or | ||
13 | * modify it under the terms of the GNU General Public License | ||
14 | * as published by the Free Software Foundation; either version 2 | ||
15 | * of the License, or (at your option) any later version. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef _ADC_TARGET_H_ | ||
22 | #define _ADC_TARGET_H_ | ||
23 | |||
24 | #define NUM_ADC_CHANNELS 4 | ||
25 | |||
26 | #define ADC_BATTERY 0 | ||
27 | #define ADC_DIE_TEMP 1 | ||
28 | #define ADC_VDDIO 2 | ||
29 | #define ADC_5V 3 | ||
30 | |||
31 | #endif | ||