summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES12
-rw-r--r--firmware/export/config.h4
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/adc-target.h29
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c34
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/audio-target.h25
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h29
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c69
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/button-target.h55
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c69
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c29
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c40
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h27
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c152
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c57
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h55
-rw-r--r--firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c49
-rw-r--r--firmware/target/arm/imx233/sdmmc-imx233.c7
17 files changed, 742 insertions, 0 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index 884e110..f6df418 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -1184,6 +1184,18 @@ target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c
target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
#endif
+#ifdef CREATIVE_ZENMOZAIC
+target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/button-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/power-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c
+target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c
+target/arm/imx233/button-lradc-imx233.c
+#endif
+
#if defined(SONY_NWZE360) || defined(SONY_NWZE370)
target/arm/imx233/button-lradc-imx233.c
target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c
diff --git a/firmware/export/config.h b/firmware/export/config.h
index 3ee2330..37146b6 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -149,6 +149,7 @@
#define CREATIVE_ZENXFI3_PAD 55
#define MA_PAD 56
#define SONY_NWZ_PAD 57
+#define CREATIVE_ZEN_PAD 58
/* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1
@@ -253,6 +254,7 @@
#define LCD_ILI9342 50 /* as used by HiFi E.T MA9/MA8 */
#define LCD_NWZE370 51 /* as used by Sony NWZ-E370 series */
#define LCD_NWZE360 52 /* as used by Sony NWZ-E360 series */
+#define LCD_CREATIVEZENMOZAIC 56 /* as used by the Creative ZEN Mozaic (FGD0801) */
/* LCD_PIXELFORMAT */
#define HORIZONTAL_PACKING 1
@@ -521,6 +523,8 @@ Lyre prototype 1 */
#include "config/pandora.h"
#elif defined(SAMSUNG_YPR0)
#include "config/samsungypr0.h"
+#elif defined(CREATIVE_ZENMOZAIC)
+#include "config/creativezenmozaic.h"
#elif defined(MA9)
#include "config/hifietma9.h"
#elif defined(SONY_NWZE370)
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h b/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h
new file mode 100644
index 0000000..5a52515
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/adc-target.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef _ADC_TARGET_H_
+#define _ADC_TARGET_H_
+
+#define NUM_ADC_CHANNELS 2
+
+#define ADC_BATTERY 0
+#define ADC_DIE_TEMP 1
+
+#endif
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c
new file mode 100644
index 0000000..92c1063
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/adc-zenmozaic.c
@@ -0,0 +1,34 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "adc-target.h"
+#include "adc-imx233.h"
+
+int imx233_adc_mapping[] =
+{
+ [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP,
+ [ADC_BATTERY] = IMX233_ADC_BATTERY,
+};
+
+const char *imx233_adc_channel_name[] =
+{
+ "Die temperature(°C)",
+ "Battery(raw)",
+};
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h b/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h
new file mode 100644
index 0000000..4ee2e2f
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/audio-target.h
@@ -0,0 +1,25 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef __audio_target__
+#define __audio_target__
+
+#endif /* __audio_target__ */
+
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h b/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h
new file mode 100644
index 0000000..78a0a72
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/backlight-target.h
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef BACKLIGHT_TARGET_H
+#define BACKLIGHT_TARGET_H
+
+bool _backlight_init(void);
+void _backlight_on(void);
+void _backlight_off(void);
+void _backlight_set_brightness(int brightness);
+
+#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
new file mode 100644
index 0000000..0d223b5
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/backlight-zenmozaic.c
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "system.h"
+#include "backlight.h"
+#include "lcd.h"
+#include "backlight-target.h"
+#include "uartdbg-imx233.h"
+#include "pinctrl-imx233.h"
+
+void _backlight_set_brightness(int level)
+{
+ unsigned val = (level + 200) * level / 1000;
+ if(level != 0)
+ {
+ for(unsigned mask = 0x10; mask; mask >>= 1)
+ imx233_uartdbg_send((val & mask) ? 0xff : 0xf8);
+ imx233_uartdbg_send(0);
+ imx233_pinctrl_set_gpio(1, 12, true);
+ }
+ else
+ imx233_pinctrl_set_gpio(1, 12, false);
+}
+
+bool _backlight_init(void)
+{
+ imx233_pinctrl_acquire(1, 12, "backlight_enable");
+ imx233_pinctrl_set_function(1, 12, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(1, 12, true);
+ imx233_uartdbg_init(BAUD_38400);
+ return true;
+}
+
+void _backlight_on(void)
+{
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(true); /* power on lcd + visible display */
+#endif
+ /* restore the previous backlight level */
+ _backlight_set_brightness(backlight_brightness);
+}
+
+void _backlight_off(void)
+{
+ /* there is no real on/off but we can set to 0 brightness */
+ _backlight_set_brightness(0);
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(false); /* power off visible display */
+#endif
+}
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/button-target.h b/firmware/target/arm/imx233/creative-zenmozaic/button-target.h
new file mode 100644
index 0000000..714e998
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/button-target.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef _BUTTON_TARGET_H_
+#define _BUTTON_TARGET_H_
+
+#include <stdbool.h>
+
+bool button_debug_screen(void);
+
+#define HAS_BUTTON_HOLD
+#define HAVE_HEADPHONE_DETECTION
+
+#define IMX233_BUTTON_LRADC_CHANNEL 0
+#define IMX233_BUTTON_LRADC_HOLD_DET BLH_ADC
+
+/* Main unit's buttons */
+#define BUTTON_POWER 0x00000001
+#define BUTTON_LEFT 0x00000002
+#define BUTTON_UP 0x00000004
+#define BUTTON_RIGHT 0x00000008
+#define BUTTON_DOWN 0x00000010
+#define BUTTON_SELECT 0x00000020
+#define BUTTON_PLAYPAUSE 0x00000040
+#define BUTTON_BACK 0x00000080
+#define BUTTON_MENU 0x00000100
+#define BUTTON_SHORTCUT 0x00000200
+
+
+#define BUTTON_MAIN (BUTTON_POWER|BUTTON_LEFT|BUTTON_UP|BUTTON_RIGHT|\
+ BUTTON_DOWN|BUTTON_SELECT|BUTTON_PLAYPAUSE|BUTTON_BACK|\
+ BUTTON_MENU|BUTTON_SHORTCUT)
+
+/* Software power-off */
+#define POWEROFF_BUTTON BUTTON_POWER
+#define POWEROFF_COUNT 10
+
+#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
new file mode 100644
index 0000000..bf6729a
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/button-zenmozaic.c
@@ -0,0 +1,69 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "button-target.h"
+#include "system.h"
+#include "system-target.h"
+#include "pinctrl-imx233.h"
+#include "power-imx233.h"
+#include "button-lradc-imx233.h"
+
+struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
+{
+ {0, IMX233_BUTTON_LRADC_HOLD},
+ {200, BUTTON_MENU},
+ {445, BUTTON_SHORTCUT},
+ {645, BUTTON_UP},
+ {860, BUTTON_LEFT},
+ {1060, BUTTON_RIGHT},
+ {1260, BUTTON_DOWN},
+ {1480, BUTTON_SELECT},
+ {2700, BUTTON_BACK},
+ {2945, BUTTON_PLAYPAUSE},
+ {3400, 0},
+ {0, IMX233_BUTTON_LRADC_END},
+};
+
+void button_init_device(void)
+{
+ imx233_button_lradc_init();
+
+ imx233_pinctrl_acquire(2, 8, "jack_detect");
+ imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(2, 8, false);
+}
+
+bool headphones_inserted(void)
+{
+ return imx233_pinctrl_get_gpio(2, 8);
+}
+
+bool button_hold(void)
+{
+ return imx233_button_lradc_hold();
+}
+
+int button_read_device(void)
+{
+ int btn = 0;
+ if(BF_RD(POWER_STS, PSWITCH) == 1)
+ btn |= BUTTON_POWER;
+ return imx233_button_lradc_read(btn);
+}
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c
new file mode 100644
index 0000000..a350d0a
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/debug-zenmozaic.c
@@ -0,0 +1,29 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "system.h"
+#include "button-target.h"
+#include "lcd-target.h"
+
+bool dbg_hw_target_info(void)
+{
+ return false;
+}
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c
new file mode 100644
index 0000000..a1377ce
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/fmradio-i2c-zenmozaic.c
@@ -0,0 +1,40 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "config.h"
+#include "system.h"
+#include "fmradio_i2c.h"
+#include "pinctrl-imx233.h"
+#include "i2c.h"
+
+void fmradio_i2c_init(void)
+{
+}
+
+int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
+{
+ return i2c_write(address, buf, count);
+}
+
+int fmradio_i2c_read(unsigned char address, unsigned char* buf, int count)
+{
+ return i2c_read(address, buf, count);
+}
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h b/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h
new file mode 100644
index 0000000..5133c75
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h
@@ -0,0 +1,27 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (c) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef LCD_TARGET_H
+#define LCD_TARGET_H
+
+bool lcd_debug_screen(void);
+void lcd_set_contrast(int val);
+
+#endif /* LCD_TARGET_H */
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c
new file mode 100644
index 0000000..eac3667
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c
@@ -0,0 +1,152 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (c) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include <sys/types.h> /* off_t */
+#include <string.h>
+#include "cpu.h"
+#include "system.h"
+#include "backlight-target.h"
+#include "lcd.h"
+#include "lcdif-imx233.h"
+#include "clkctrl-imx233.h"
+#include "pinctrl-imx233.h"
+#include "dcp-imx233.h"
+#include "logf.h"
+#ifndef BOOTLOADER
+#include "button.h"
+#include "font.h"
+#include "action.h"
+#endif
+
+#ifdef HAVE_LCD_ENABLE
+static bool lcd_on;
+#endif
+
+static void lcd_write_reg(uint16_t reg, uint16_t value)
+{
+ imx233_lcdif_set_data_swizzle(3);
+ imx233_lcdif_pio_send(false, 2, &reg);
+ if(reg != 0x22)
+ imx233_lcdif_pio_send(true, 2, &value);
+}
+
+void lcd_init_device(void)
+{
+ /* clock at 24MHZ */
+ imx233_clkctrl_enable(CLK_PIX, false);
+ imx233_clkctrl_set_div(CLK_PIX, 3);
+ imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */
+ imx233_clkctrl_enable(CLK_PIX, true);
+ imx233_lcdif_init();
+ imx233_lcdif_setup_system_pins(8);
+ imx233_lcdif_set_timings(2, 2, 2, 2);
+ imx233_lcdif_set_word_length(8);
+
+ lcd_write_reg(0, 1);
+ lcd_write_reg(3, 0);
+
+ lcd_write_reg(3, 0x510);
+ lcd_write_reg(9, 8);
+ lcd_write_reg(0xc, 0);
+ lcd_write_reg(0xd, 0);
+ lcd_write_reg(0xe, 0);
+ lcd_write_reg(0x5b, 4);
+ lcd_write_reg(0xd, 0x10);
+ lcd_write_reg(9, 0);
+ lcd_write_reg(3, 0x10);
+ lcd_write_reg(0xd, 0x14);
+ lcd_write_reg(0xe, 0x2b12);
+ lcd_write_reg(1, 0x21f);
+ lcd_write_reg(2, 0x700);
+ lcd_write_reg(5, 0x30);
+ lcd_write_reg(6, 0);
+ lcd_write_reg(8, 0x202);
+ lcd_write_reg(0xa, 0x3); // OF uses 0xc0003 with 3 transfers/pixels
+ lcd_write_reg(0xb, 0);
+ lcd_write_reg(0xf, 0);
+ lcd_write_reg(0x10, 0);
+ lcd_write_reg(0x11, 0);
+ lcd_write_reg(0x14, 0x9f00);
+ lcd_write_reg(0x15, 0x9f00);
+ lcd_write_reg(0x16, 0x7f00);
+ lcd_write_reg(0x17, 0x9f00);
+ lcd_write_reg(0x20, 0);
+ lcd_write_reg(0x21, 0);
+ lcd_write_reg(0x23, 0);
+ lcd_write_reg(0x24, 0);
+ lcd_write_reg(0x25, 0);
+ lcd_write_reg(0x26, 0);
+ lcd_write_reg(0x30, 0x707);
+ lcd_write_reg(0x31, 0x504);
+ lcd_write_reg(0x32, 7);
+ lcd_write_reg(0x33, 0x307);
+ lcd_write_reg(0x34, 7);
+ lcd_write_reg(0x35, 0x400);
+ lcd_write_reg(0x36, 0x607);
+ lcd_write_reg(0x37, 0x703);
+ lcd_write_reg(0x3a, 0x1a0d);
+ lcd_write_reg(0x3b, 0x1309);
+
+ lcd_write_reg(9, 4);
+ lcd_write_reg(7, 5);
+ lcd_write_reg(7, 0x25);
+ lcd_write_reg(7, 0x27);
+ lcd_write_reg(0x5b, 0);
+ lcd_write_reg(7, 0x37);
+#ifdef HAVE_LCD_ENABLE
+ lcd_on = true;
+#endif
+}
+
+#ifdef HAVE_LCD_ENABLE
+bool lcd_active(void)
+{
+ return lcd_on;
+}
+
+void lcd_enable(bool enable)
+{
+ if(lcd_on == enable)
+ return;
+
+ lcd_on = enable;
+}
+#endif
+
+void lcd_update(void)
+{
+ lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
+}
+
+void lcd_update_rect(int x, int y, int w, int h)
+{
+ #ifdef HAVE_LCD_ENABLE
+ if(!lcd_on)
+ return;
+ #endif
+
+ imx233_lcdif_wait_ready();
+ lcd_write_reg(0x16, x | (x + w - 1) << 8);
+ lcd_write_reg(0x17, y | (y + h - 1) << 8);
+ lcd_write_reg(0x21, y * LCD_WIDTH + x);
+ lcd_write_reg(0x22, 0);
+ for(int yy = y; yy < y + h; yy++)
+ imx233_lcdif_pio_send(true, 2 * w, FBADDR(x, yy));
+}
diff --git a/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c b/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c
new file mode 100644
index 0000000..1bed2ff
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/power-zenmozaic.c
@@ -0,0 +1,57 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+
+#include "system.h"
+#include "power.h"
+#include "tuner.h"
+#include "fmradio_i2c.h"
+#include "pinctrl-imx233.h"
+#include "power-imx233.h"
+
+static bool tuner_enable = false;
+static bool initialised = false;
+
+static void init(void)
+{
+ /* CE is B2P15 (active high) */
+ imx233_pinctrl_acquire(2, 15, "tuner power");
+ imx233_pinctrl_set_function(2, 15, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(2, 15, true);
+ initialised = true;
+}
+
+bool tuner_power(bool enable)
+{
+ if(!initialised)
+ init();
+ if(tuner_enable != enable)
+ {
+ imx233_pinctrl_set_gpio(2, 15, enable);
+ sleep(HZ / 5);
+ tuner_enable = enable;
+ }
+ return tuner_enable;
+}
+
+bool tuner_powered(void)
+{
+ return tuner_enable;
+} \ 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
new file mode 100644
index 0000000..57a6b82
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-target.h
@@ -0,0 +1,55 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#ifndef POWERMGMT_TARGET_H
+#define POWERMGMT_TARGET_H
+
+#include "config.h"
+#include "powermgmt-imx233.h"
+
+/* ZEN Mozaic OF settings:
+ * - current ramp slope:
+ * - conditioning threshold voltage:
+ * - conditioning max voltage:
+ * - conditioning current:
+ * - conditioning timeout:
+ * - charging voltage:
+ * - charging current:
+ * - charging threshold current:
+ * - charging timeout:
+ * - top off period:
+ * - high die temperature:
+ * - low die temperature:
+ * - safe die temperature current:
+ * - battery temperature channel:
+ * - high battery temperature:
+ * - low battery temperature:
+ * - safe battery temperature current:
+ * - low DCDC battery voltage:
+ */
+
+#define IMX233_CHARGE_CURRENT 200
+#define IMX233_STOP_CURRENT 30
+#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ)
+#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ)
+#define IMX233_DIE_TEMP_HIGH 71
+#define IMX233_DIE_TEMP_LOW 56
+
+#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
new file mode 100644
index 0000000..1e98681
--- /dev/null
+++ b/firmware/target/arm/imx233/creative-zenmozaic/powermgmt-zenmozaic.c
@@ -0,0 +1,49 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (C) 2013 by Amaury Pouly
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
+ * KIND, either express or implied.
+ *
+ ****************************************************************************/
+#include "config.h"
+#include "powermgmt-target.h"
+#include "power-imx233.h"
+
+#warning FIXME calibrate
+
+const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
+{
+ 0
+};
+
+const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
+{
+ 0
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
+const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
+{
+ /* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */
+ { 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 },
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
+const unsigned short percent_to_volt_charge[11] =
+{
+ /* Sansa Fuze+ Li Ion 600mAH figured from charge curve */
+ 3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335
+}; \ No newline at end of file
diff --git a/firmware/target/arm/imx233/sdmmc-imx233.c b/firmware/target/arm/imx233/sdmmc-imx233.c
index 7caff7b..15eeed1 100644
--- a/firmware/target/arm/imx233/sdmmc-imx233.c
+++ b/firmware/target/arm/imx233/sdmmc-imx233.c
@@ -127,6 +127,13 @@ struct sdmmc_config_t sdmmc_config[] =
.ssp = 1,
.mode = SD_MODE,
},
+#elif defined(CREATIVE_ZENMOZAIC)
+ {
+ .name = "internal/SD",
+ .flags = WINDOW,
+ .ssp = 2,
+ .mode = SD_MODE,
+ }
#elif defined(SONY_NWZE370) || defined(SONY_NWZE360)
/* The Sony NWZ-E370 uses #B1P29 for power */
{