diff options
Diffstat (limited to 'firmware')
17 files changed, 43 insertions, 581 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index fb78e8924c..b96912e880 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES | |||
@@ -1163,10 +1163,14 @@ target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c | |||
1163 | target/arm/tms320dm320/creative-zvm/usb-creativezvm.c | 1163 | target/arm/tms320dm320/creative-zvm/usb-creativezvm.c |
1164 | #endif /* CREATIVE_ZVx */ | 1164 | #endif /* CREATIVE_ZVx */ |
1165 | 1165 | ||
1166 | #if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) | 1166 | #if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC) |
1167 | target/arm/imx233/creative-zen/fmradio-i2c-zen.c | 1167 | target/arm/imx233/creative-zen/fmradio-i2c-zen.c |
1168 | target/arm/imx233/creative-zen/backlight-zen.c | 1168 | target/arm/imx233/creative-zen/backlight-zen.c |
1169 | # if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) | ||
1169 | target/arm/imx233/creative-zen/lcd-zen.c | 1170 | target/arm/imx233/creative-zen/lcd-zen.c |
1171 | # elif defined(CREATIVE_ZENMOZAIC) | ||
1172 | target/arm/imx233/creative-zen/lcd-zenmozaic.c | ||
1173 | #endif | ||
1170 | target/arm/imx233/creative-zen/button-zen.c | 1174 | target/arm/imx233/creative-zen/button-zen.c |
1171 | target/arm/imx233/creative-zen/debug-zen.c | 1175 | target/arm/imx233/creative-zen/debug-zen.c |
1172 | target/arm/imx233/creative-zen/power-zen.c | 1176 | target/arm/imx233/creative-zen/power-zen.c |
@@ -1198,18 +1202,6 @@ target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c | |||
1198 | target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c | 1202 | target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c |
1199 | #endif | 1203 | #endif |
1200 | 1204 | ||
1201 | #ifdef CREATIVE_ZENMOZAIC | ||
1202 | target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c | ||
1203 | target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c | ||
1204 | target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c | ||
1205 | target/arm/imx233/creative-zenmozaic/button-zenmozaic.c | ||
1206 | target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c | ||
1207 | target/arm/imx233/creative-zenmozaic/power-zenmozaic.c | ||
1208 | target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c | ||
1209 | target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c | ||
1210 | target/arm/imx233/button-lradc-imx233.c | ||
1211 | #endif | ||
1212 | |||
1213 | #if defined(SONY_NWZE360) || defined(SONY_NWZE370) | 1205 | #if defined(SONY_NWZE360) || defined(SONY_NWZE370) |
1214 | target/arm/imx233/button-lradc-imx233.c | 1206 | target/arm/imx233/button-lradc-imx233.c |
1215 | target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c | 1207 | target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c |
diff --git a/firmware/target/arm/imx233/creative-zen/button-zen.c b/firmware/target/arm/imx233/creative-zen/button-zen.c index cacc47d448..1997f91357 100644 --- a/firmware/target/arm/imx233/creative-zen/button-zen.c +++ b/firmware/target/arm/imx233/creative-zen/button-zen.c | |||
@@ -57,6 +57,19 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = | |||
57 | {2945, BUTTON_PLAYPAUSE}, | 57 | {2945, BUTTON_PLAYPAUSE}, |
58 | {3400, 0}, | 58 | {3400, 0}, |
59 | {0, IMX233_BUTTON_LRADC_END}, | 59 | {0, IMX233_BUTTON_LRADC_END}, |
60 | #elif defined(CREATIVE_ZENMOZAIC) | ||
61 | {0, IMX233_BUTTON_LRADC_HOLD}, | ||
62 | {200, BUTTON_MENU}, | ||
63 | {445, BUTTON_SHORTCUT}, | ||
64 | {645, BUTTON_UP}, | ||
65 | {860, BUTTON_LEFT}, | ||
66 | {1060, BUTTON_RIGHT}, | ||
67 | {1260, BUTTON_DOWN}, | ||
68 | {1480, BUTTON_SELECT}, | ||
69 | {2700, BUTTON_BACK}, | ||
70 | {2945, BUTTON_PLAYPAUSE}, | ||
71 | {3400, 0}, | ||
72 | {0, IMX233_BUTTON_LRADC_END}, | ||
60 | #else | 73 | #else |
61 | #error wrong target | 74 | #error wrong target |
62 | #endif | 75 | #endif |
@@ -65,6 +78,11 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = | |||
65 | void button_init_device(void) | 78 | void button_init_device(void) |
66 | { | 79 | { |
67 | imx233_button_lradc_init(); | 80 | imx233_button_lradc_init(); |
81 | #if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC) | ||
82 | imx233_pinctrl_acquire(2, 8, "jack_detect"); | ||
83 | imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO); | ||
84 | imx233_pinctrl_enable_gpio(2, 8, false); | ||
85 | #endif | ||
68 | } | 86 | } |
69 | 87 | ||
70 | bool button_hold(void) | 88 | bool button_hold(void) |
@@ -72,7 +90,7 @@ bool button_hold(void) | |||
72 | return imx233_button_lradc_hold(); | 90 | return imx233_button_lradc_hold(); |
73 | } | 91 | } |
74 | 92 | ||
75 | #ifdef CREATIVE_ZENXFI | 93 | #if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC) |
76 | bool headphones_inserted(void) | 94 | bool headphones_inserted(void) |
77 | { | 95 | { |
78 | return !imx233_pinctrl_get_gpio(2, 8); | 96 | return !imx233_pinctrl_get_gpio(2, 8); |
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c index eac36676ae..eac36676ae 100644 --- a/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c +++ b/firmware/target/arm/imx233/creative-zen/lcd-zenmozaic.c | |||
diff --git a/firmware/target/arm/imx233/creative-zen/power-zen.c b/firmware/target/arm/imx233/creative-zen/power-zen.c index 81157da511..2c68325432 100644 --- a/firmware/target/arm/imx233/creative-zen/power-zen.c +++ b/firmware/target/arm/imx233/creative-zen/power-zen.c | |||
@@ -27,11 +27,29 @@ | |||
27 | #include "power-imx233.h" | 27 | #include "power-imx233.h" |
28 | 28 | ||
29 | static bool tuner_enable = false; | 29 | static bool tuner_enable = false; |
30 | static bool initialised = false; | ||
31 | |||
32 | static void init(void) | ||
33 | { | ||
34 | #ifdef CREATIVE_ZENMOZAIC | ||
35 | /* CE is B2P15 (active high) */ | ||
36 | imx233_pinctrl_acquire(2, 15, "tuner power"); | ||
37 | imx233_pinctrl_set_function(2, 15, PINCTRL_FUNCTION_GPIO); | ||
38 | imx233_pinctrl_enable_gpio(2, 15, true); | ||
39 | #endif | ||
40 | initialised = true; | ||
41 | } | ||
30 | 42 | ||
31 | bool tuner_power(bool enable) | 43 | bool tuner_power(bool enable) |
32 | { | 44 | { |
33 | if(enable != tuner_enable) | 45 | if(!initialised) |
46 | init(); | ||
47 | if(tuner_enable != enable) | ||
34 | { | 48 | { |
49 | #ifdef CREATIVE_ZENMOZAIC | ||
50 | imx233_pinctrl_set_gpio(2, 15, enable); | ||
51 | sleep(HZ / 5); | ||
52 | #endif | ||
35 | tuner_enable = enable; | 53 | tuner_enable = enable; |
36 | } | 54 | } |
37 | return tuner_enable; | 55 | return tuner_enable; |
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h b/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h deleted file mode 100644 index 5a525152f6..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/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-zenmozaic/adc-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c deleted file mode 100644 index 92c1063c24..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.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-zenmozaic/audio-target.h b/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h deleted file mode 100644 index 4ee2e2f402..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h +++ /dev/null | |||
@@ -1,25 +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 __audio_target__ | ||
22 | #define __audio_target__ | ||
23 | |||
24 | #endif /* __audio_target__ */ | ||
25 | |||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h b/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h deleted file mode 100644 index 78a0a72d85..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/backlight-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 BACKLIGHT_TARGET_H | ||
22 | #define BACKLIGHT_TARGET_H | ||
23 | |||
24 | bool _backlight_init(void); | ||
25 | void _backlight_on(void); | ||
26 | void _backlight_off(void); | ||
27 | void _backlight_set_brightness(int brightness); | ||
28 | |||
29 | #endif /* BACKLIGHT_TARGET_H */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c deleted file mode 100644 index 0d223b52e9..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c +++ /dev/null | |||
@@ -1,69 +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 | |||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "backlight.h" | ||
25 | #include "lcd.h" | ||
26 | #include "backlight-target.h" | ||
27 | #include "uartdbg-imx233.h" | ||
28 | #include "pinctrl-imx233.h" | ||
29 | |||
30 | void _backlight_set_brightness(int level) | ||
31 | { | ||
32 | unsigned val = (level + 200) * level / 1000; | ||
33 | if(level != 0) | ||
34 | { | ||
35 | for(unsigned mask = 0x10; mask; mask >>= 1) | ||
36 | imx233_uartdbg_send((val & mask) ? 0xff : 0xf8); | ||
37 | imx233_uartdbg_send(0); | ||
38 | imx233_pinctrl_set_gpio(1, 12, true); | ||
39 | } | ||
40 | else | ||
41 | imx233_pinctrl_set_gpio(1, 12, false); | ||
42 | } | ||
43 | |||
44 | bool _backlight_init(void) | ||
45 | { | ||
46 | imx233_pinctrl_acquire(1, 12, "backlight_enable"); | ||
47 | imx233_pinctrl_set_function(1, 12, PINCTRL_FUNCTION_GPIO); | ||
48 | imx233_pinctrl_enable_gpio(1, 12, true); | ||
49 | imx233_uartdbg_init(BAUD_38400); | ||
50 | return true; | ||
51 | } | ||
52 | |||
53 | void _backlight_on(void) | ||
54 | { | ||
55 | #ifdef HAVE_LCD_ENABLE | ||
56 | lcd_enable(true); /* power on lcd + visible display */ | ||
57 | #endif | ||
58 | /* restore the previous backlight level */ | ||
59 | _backlight_set_brightness(backlight_brightness); | ||
60 | } | ||
61 | |||
62 | void _backlight_off(void) | ||
63 | { | ||
64 | /* there is no real on/off but we can set to 0 brightness */ | ||
65 | _backlight_set_brightness(0); | ||
66 | #ifdef HAVE_LCD_ENABLE | ||
67 | lcd_enable(false); /* power off visible display */ | ||
68 | #endif | ||
69 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/button-target.h b/firmware/target/arm/imx233/creative-zenmozaic/button-target.h deleted file mode 100644 index 29319b2c99..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/button-target.h +++ /dev/null | |||
@@ -1,54 +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 _BUTTON_TARGET_H_ | ||
22 | #define _BUTTON_TARGET_H_ | ||
23 | |||
24 | #include <stdbool.h> | ||
25 | |||
26 | bool button_debug_screen(void); | ||
27 | |||
28 | #define HAS_BUTTON_HOLD | ||
29 | |||
30 | #define IMX233_BUTTON_LRADC_CHANNEL 0 | ||
31 | #define IMX233_BUTTON_LRADC_HOLD_DET BLH_ADC | ||
32 | |||
33 | /* Main unit's buttons */ | ||
34 | #define BUTTON_POWER 0x00000001 | ||
35 | #define BUTTON_LEFT 0x00000002 | ||
36 | #define BUTTON_UP 0x00000004 | ||
37 | #define BUTTON_RIGHT 0x00000008 | ||
38 | #define BUTTON_DOWN 0x00000010 | ||
39 | #define BUTTON_SELECT 0x00000020 | ||
40 | #define BUTTON_PLAYPAUSE 0x00000040 | ||
41 | #define BUTTON_BACK 0x00000080 | ||
42 | #define BUTTON_MENU 0x00000100 | ||
43 | #define BUTTON_SHORTCUT 0x00000200 | ||
44 | |||
45 | |||
46 | #define BUTTON_MAIN (BUTTON_POWER|BUTTON_LEFT|BUTTON_UP|BUTTON_RIGHT|\ | ||
47 | BUTTON_DOWN|BUTTON_SELECT|BUTTON_PLAYPAUSE|BUTTON_BACK|\ | ||
48 | BUTTON_MENU|BUTTON_SHORTCUT) | ||
49 | |||
50 | /* Software power-off */ | ||
51 | #define POWEROFF_BUTTON BUTTON_POWER | ||
52 | #define POWEROFF_COUNT 10 | ||
53 | |||
54 | #endif /* _BUTTON_TARGET_H_ */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c deleted file mode 100644 index bf6729a273..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c +++ /dev/null | |||
@@ -1,69 +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 "button-target.h" | ||
22 | #include "system.h" | ||
23 | #include "system-target.h" | ||
24 | #include "pinctrl-imx233.h" | ||
25 | #include "power-imx233.h" | ||
26 | #include "button-lradc-imx233.h" | ||
27 | |||
28 | struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] = | ||
29 | { | ||
30 | {0, IMX233_BUTTON_LRADC_HOLD}, | ||
31 | {200, BUTTON_MENU}, | ||
32 | {445, BUTTON_SHORTCUT}, | ||
33 | {645, BUTTON_UP}, | ||
34 | {860, BUTTON_LEFT}, | ||
35 | {1060, BUTTON_RIGHT}, | ||
36 | {1260, BUTTON_DOWN}, | ||
37 | {1480, BUTTON_SELECT}, | ||
38 | {2700, BUTTON_BACK}, | ||
39 | {2945, BUTTON_PLAYPAUSE}, | ||
40 | {3400, 0}, | ||
41 | {0, IMX233_BUTTON_LRADC_END}, | ||
42 | }; | ||
43 | |||
44 | void button_init_device(void) | ||
45 | { | ||
46 | imx233_button_lradc_init(); | ||
47 | |||
48 | imx233_pinctrl_acquire(2, 8, "jack_detect"); | ||
49 | imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO); | ||
50 | imx233_pinctrl_enable_gpio(2, 8, false); | ||
51 | } | ||
52 | |||
53 | bool headphones_inserted(void) | ||
54 | { | ||
55 | return imx233_pinctrl_get_gpio(2, 8); | ||
56 | } | ||
57 | |||
58 | bool button_hold(void) | ||
59 | { | ||
60 | return imx233_button_lradc_hold(); | ||
61 | } | ||
62 | |||
63 | int button_read_device(void) | ||
64 | { | ||
65 | int btn = 0; | ||
66 | if(BF_RD(POWER_STS, PSWITCH) == 1) | ||
67 | btn |= BUTTON_POWER; | ||
68 | return imx233_button_lradc_read(btn); | ||
69 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c deleted file mode 100644 index a350d0ae62..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c +++ /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 | |||
22 | #include "system.h" | ||
23 | #include "button-target.h" | ||
24 | #include "lcd-target.h" | ||
25 | |||
26 | bool dbg_hw_target_info(void) | ||
27 | { | ||
28 | return false; | ||
29 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c deleted file mode 100644 index a1377ce1f2..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c +++ /dev/null | |||
@@ -1,40 +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 | |||
22 | #include "config.h" | ||
23 | #include "system.h" | ||
24 | #include "fmradio_i2c.h" | ||
25 | #include "pinctrl-imx233.h" | ||
26 | #include "i2c.h" | ||
27 | |||
28 | void fmradio_i2c_init(void) | ||
29 | { | ||
30 | } | ||
31 | |||
32 | int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count) | ||
33 | { | ||
34 | return i2c_write(address, buf, count); | ||
35 | } | ||
36 | |||
37 | int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count) | ||
38 | { | ||
39 | return i2c_read(address, buf, count); | ||
40 | } | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h b/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h deleted file mode 100644 index 5133c75d1b..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h +++ /dev/null | |||
@@ -1,27 +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 LCD_TARGET_H | ||
22 | #define LCD_TARGET_H | ||
23 | |||
24 | bool lcd_debug_screen(void); | ||
25 | void lcd_set_contrast(int val); | ||
26 | |||
27 | #endif /* LCD_TARGET_H */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c deleted file mode 100644 index 1bed2ffcca..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c +++ /dev/null | |||
@@ -1,57 +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 | |||
22 | #include "system.h" | ||
23 | #include "power.h" | ||
24 | #include "tuner.h" | ||
25 | #include "fmradio_i2c.h" | ||
26 | #include "pinctrl-imx233.h" | ||
27 | #include "power-imx233.h" | ||
28 | |||
29 | static bool tuner_enable = false; | ||
30 | static bool initialised = false; | ||
31 | |||
32 | static void init(void) | ||
33 | { | ||
34 | /* CE is B2P15 (active high) */ | ||
35 | imx233_pinctrl_acquire(2, 15, "tuner power"); | ||
36 | imx233_pinctrl_set_function(2, 15, PINCTRL_FUNCTION_GPIO); | ||
37 | imx233_pinctrl_enable_gpio(2, 15, true); | ||
38 | initialised = true; | ||
39 | } | ||
40 | |||
41 | bool tuner_power(bool enable) | ||
42 | { | ||
43 | if(!initialised) | ||
44 | init(); | ||
45 | if(tuner_enable != enable) | ||
46 | { | ||
47 | imx233_pinctrl_set_gpio(2, 15, enable); | ||
48 | sleep(HZ / 5); | ||
49 | tuner_enable = enable; | ||
50 | } | ||
51 | return tuner_enable; | ||
52 | } | ||
53 | |||
54 | bool tuner_powered(void) | ||
55 | { | ||
56 | return tuner_enable; | ||
57 | } \ No newline at end of file | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h deleted file mode 100644 index 57a6b82ec9..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h +++ /dev/null | |||
@@ -1,55 +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 POWERMGMT_TARGET_H | ||
22 | #define POWERMGMT_TARGET_H | ||
23 | |||
24 | #include "config.h" | ||
25 | #include "powermgmt-imx233.h" | ||
26 | |||
27 | /* ZEN Mozaic OF settings: | ||
28 | * - current ramp slope: | ||
29 | * - conditioning threshold voltage: | ||
30 | * - conditioning max voltage: | ||
31 | * - conditioning current: | ||
32 | * - conditioning timeout: | ||
33 | * - charging voltage: | ||
34 | * - charging current: | ||
35 | * - charging threshold current: | ||
36 | * - charging timeout: | ||
37 | * - top off period: | ||
38 | * - high die temperature: | ||
39 | * - low die temperature: | ||
40 | * - safe die temperature current: | ||
41 | * - battery temperature channel: | ||
42 | * - high battery temperature: | ||
43 | * - low battery temperature: | ||
44 | * - safe battery temperature current: | ||
45 | * - low DCDC battery voltage: | ||
46 | */ | ||
47 | |||
48 | #define IMX233_CHARGE_CURRENT 200 | ||
49 | #define IMX233_STOP_CURRENT 30 | ||
50 | #define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ) | ||
51 | #define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ) | ||
52 | #define IMX233_DIE_TEMP_HIGH 71 | ||
53 | #define IMX233_DIE_TEMP_LOW 56 | ||
54 | |||
55 | #endif /* POWERMGMT_TARGET_H */ | ||
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c deleted file mode 100644 index 1e986813f9..0000000000 --- a/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c +++ /dev/null | |||
@@ -1,49 +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 "config.h" | ||
22 | #include "powermgmt-target.h" | ||
23 | #include "power-imx233.h" | ||
24 | |||
25 | #warning FIXME calibrate | ||
26 | |||
27 | const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] = | ||
28 | { | ||
29 | 0 | ||
30 | }; | ||
31 | |||
32 | const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] = | ||
33 | { | ||
34 | 0 | ||
35 | }; | ||
36 | |||
37 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */ | ||
38 | const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] = | ||
39 | { | ||
40 | /* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */ | ||
41 | { 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 }, | ||
42 | }; | ||
43 | |||
44 | /* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */ | ||
45 | const unsigned short percent_to_volt_charge[11] = | ||
46 | { | ||
47 | /* Sansa Fuze+ Li Ion 600mAH figured from charge curve */ | ||
48 | 3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335 | ||
49 | }; \ No newline at end of file | ||