summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm/imx233/sony-nwz
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2013-09-25 14:29:00 +0200
committerAmaury Pouly <amaury.pouly@gmail.com>2013-09-25 14:31:39 +0200
commit9392d036c4ee29c251dd1e89cf8ced653972b6fd (patch)
treeeca45a48b5c5277554bc0ba1b095bcca0db2e1c6 /firmware/target/arm/imx233/sony-nwz
parent46248b3df9133d00cf934372ca1da8314b389a60 (diff)
downloadrockbox-9392d036c4ee29c251dd1e89cf8ced653972b6fd.tar.gz
rockbox-9392d036c4ee29c251dd1e89cf8ced653972b6fd.tar.bz2
rockbox-9392d036c4ee29c251dd1e89cf8ced653972b6fd.zip
Initial commit for the sony NWZ-E360 and NWZ-E370
Change-Id: I52d21e136a98eaf481615d641795cf7ecf325465
Diffstat (limited to 'firmware/target/arm/imx233/sony-nwz')
-rw-r--r--firmware/target/arm/imx233/sony-nwz/adc-nwz.c38
-rw-r--r--firmware/target/arm/imx233/sony-nwz/adc-target.h31
-rw-r--r--firmware/target/arm/imx233/sony-nwz/audio-target.h24
-rw-r--r--firmware/target/arm/imx233/sony-nwz/backlight-nwz.c61
-rw-r--r--firmware/target/arm/imx233/sony-nwz/backlight-target.h29
-rw-r--r--firmware/target/arm/imx233/sony-nwz/button-nwz.c64
-rw-r--r--firmware/target/arm/imx233/sony-nwz/button-target.h62
-rw-r--r--firmware/target/arm/imx233/sony-nwz/debug-nwz.c28
-rw-r--r--firmware/target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c40
-rw-r--r--firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c259
-rw-r--r--firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c219
-rw-r--r--firmware/target/arm/imx233/sony-nwz/lcd-target.h24
-rw-r--r--firmware/target/arm/imx233/sony-nwz/power-nwz.c42
-rw-r--r--firmware/target/arm/imx233/sony-nwz/powermgmt-nwze360.c46
-rw-r--r--firmware/target/arm/imx233/sony-nwz/powermgmt-nwze370.c46
-rw-r--r--firmware/target/arm/imx233/sony-nwz/powermgmt-target.h58
16 files changed, 1071 insertions, 0 deletions
diff --git a/firmware/target/arm/imx233/sony-nwz/adc-nwz.c b/firmware/target/arm/imx233/sony-nwz/adc-nwz.c
new file mode 100644
index 0000000000..e53005c082
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/adc-nwz.c
@@ -0,0 +1,38 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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_BATTERY] = IMX233_ADC_BATTERY,
+ [ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP,
+ [ADC_VDDIO] = IMX233_ADC_VDDIO,
+ [ADC_5V] = IMX233_ADC_VDD5V,
+};
+
+const char *imx233_adc_channel_name[] =
+{
+ "Battery(raw)",
+ "Die temperature(°C)",
+ "VddIO",
+ "Vdd5V",
+};
diff --git a/firmware/target/arm/imx233/sony-nwz/adc-target.h b/firmware/target/arm/imx233/sony-nwz/adc-target.h
new file mode 100644
index 0000000000..e9c1939941
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/adc-target.h
@@ -0,0 +1,31 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 4
+
+#define ADC_BATTERY 0
+#define ADC_DIE_TEMP 1
+#define ADC_VDDIO 2
+#define ADC_5V 3
+
+#endif
diff --git a/firmware/target/arm/imx233/sony-nwz/audio-target.h b/firmware/target/arm/imx233/sony-nwz/audio-target.h
new file mode 100644
index 0000000000..afa3d9649b
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/audio-target.h
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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/sony-nwz/backlight-nwz.c b/firmware/target/arm/imx233/sony-nwz/backlight-nwz.c
new file mode 100644
index 0000000000..ad3ef484db
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/backlight-nwz.c
@@ -0,0 +1,61 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "lcd.h"
+#include "backlight.h"
+#include "backlight-target.h"
+#include "pwm-imx233.h"
+#include "pinctrl-imx233.h"
+
+void _backlight_set_brightness(int brightness)
+{
+ imx233_pwm_setup_simple(2, 24000, 100 - brightness);
+ imx233_pwm_enable(2, true);
+}
+
+bool _backlight_init(void)
+{
+ imx233_pinctrl_acquire(0, 10, "backlight_enable");
+ imx233_pinctrl_set_function(0, 10, PINCTRL_FUNCTION_GPIO);
+ imx233_pinctrl_enable_gpio(0, 10, true);
+ imx233_pinctrl_set_gpio(0, 10, true);
+ _backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
+ return true;
+}
+
+void _backlight_on(void)
+{
+#ifdef HAVE_LCD_ENABLE
+ lcd_enable(true); /* power on lcd + visible display */
+#endif
+ /* don't do anything special, the core will set the 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/sony-nwz/backlight-target.h b/firmware/target/arm/imx233/sony-nwz/backlight-target.h
new file mode 100644
index 0000000000..78a0a72d85
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/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/sony-nwz/button-nwz.c b/firmware/target/arm/imx233/sony-nwz/button-nwz.c
new file mode 100644
index 0000000000..93520133e8
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/button-nwz.c
@@ -0,0 +1,64 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "string.h"
+#include "usb.h"
+#include "button-lradc-imx233.h"
+
+struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
+{
+#ifdef SONY_NWZE360
+ {195, BUTTON_VOL_DOWN},
+ {810, BUTTON_VOL_UP},
+#endif
+ {1095, BUTTON_BACK},
+ {1470, BUTTON_PLAY},
+ {1845, BUTTON_RIGHT},
+ {2185, BUTTON_LEFT},
+ {2525, BUTTON_UP},
+ {2870, BUTTON_DOWN},
+ {3400, 0},
+ {0, IMX233_BUTTON_LRADC_END},
+};
+
+void button_init_device(void)
+{
+ imx233_button_lradc_init();
+}
+
+#ifdef HAS_BUTTON_HOLD
+bool button_hold(void)
+{
+ return imx233_button_lradc_hold();
+}
+#endif
+
+int button_read_device(void)
+{
+ int res = 0;
+ if(BF_RD(POWER_STS, PSWITCH) == 3)
+ res |= BUTTON_POWER;
+ return imx233_button_lradc_read(res);
+}
diff --git a/firmware/target/arm/imx233/sony-nwz/button-target.h b/firmware/target/arm/imx233/sony-nwz/button-target.h
new file mode 100644
index 0000000000..94d480f575
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/button-target.h
@@ -0,0 +1,62 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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>
+#include "config.h"
+
+void button_init_device(void);
+int button_read_device(void);
+bool button_debug_screen(void);
+
+#ifdef SONY_NWZE360
+// Sony NWZ-E360 has hold detect on B0P09, inverted using pullup
+#define HAS_BUTTON_HOLD
+#define IMX233_BUTTON_LRADC_HOLD_DET BLH_GPIO
+#define BLH_GPIO_BANK 0
+#define BLH_GPIO_PIN 9
+#define BLH_GPIO_INVERTED
+#define BLH_GPIO_PULLUP
+#endif
+
+#define IMX233_BUTTON_LRADC_CHANNEL 0
+
+/* Main unit's buttons */
+#define BUTTON_POWER 0x00000001
+#define BUTTON_BACK 0x00000002
+#define BUTTON_PLAY 0x00000004
+#define BUTTON_LEFT 0x00000008
+#define BUTTON_UP 0x00000010
+#define BUTTON_DOWN 0x00000020
+#define BUTTON_RIGHT 0x00000040
+#ifdef SONY_NWZE360
+#define BUTTON_VOL_DOWN 0x00000080
+#define BUTTON_VOL_UP 0x00000100
+#endif
+
+#define BUTTON_MAIN 0x3ff
+
+/* Software power-off */
+#define POWEROFF_BUTTON BUTTON_POWER
+#define POWEROFF_COUNT 10
+
+#endif /* _BUTTON_TARGET_H_ */
diff --git a/firmware/target/arm/imx233/sony-nwz/debug-nwz.c b/firmware/target/arm/imx233/sony-nwz/debug-nwz.c
new file mode 100644
index 0000000000..acb1cfca37
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/debug-nwz.c
@@ -0,0 +1,28 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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"
+
+bool dbg_hw_target_info(void)
+{
+ return false;
+}
diff --git a/firmware/target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c b/firmware/target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c
new file mode 100644
index 0000000000..a1377ce1f2
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/fmradio-i2c-nwz.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/sony-nwz/lcd-nwze360.c b/firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c
new file mode 100644
index 0000000000..2a913103c2
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/lcd-nwze360.c
@@ -0,0 +1,259 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "logf.h"
+
+#ifdef HAVE_LCD_ENABLE
+static bool lcd_on;
+#endif
+
+static void lcd_write_reg(uint8_t reg, uint8_t data)
+{
+ imx233_lcdif_wait_ready();
+ imx233_lcdif_set_data_swizzle(0);
+ imx233_lcdif_set_word_length(8);
+ imx233_lcdif_pio_send(false, 1, &reg);
+ if(reg != 0x22)
+ imx233_lcdif_pio_send(true, 1, &data);
+}
+
+static void lcd_init_seq(void)
+{
+ lcd_write_reg(0xea, 0);
+ lcd_write_reg(0xeb, 0x20);
+ lcd_write_reg(0xec, 0xc);
+ lcd_write_reg(0xed, 0xc4);
+ lcd_write_reg(0xe8, 0x38);
+ lcd_write_reg(0xe9, 0xe);
+ lcd_write_reg(0xf1, 1);
+ lcd_write_reg(0xf2, 8);
+ lcd_write_reg(0x2e, 0x86);
+ lcd_write_reg(0x29, 0xff);
+ lcd_write_reg(0xe4, 1);
+ lcd_write_reg(0xe5, 0x20);
+ lcd_write_reg(0xe7, 1);
+ lcd_write_reg(0x40, 0);
+ lcd_write_reg(0x41, 0);
+ lcd_write_reg(0x42, 0);
+ lcd_write_reg(0x43, 0x14);
+ lcd_write_reg(0x44, 0x14);
+ lcd_write_reg(0x45, 0x28);
+ lcd_write_reg(0x46, 0x11);
+ lcd_write_reg(0x47, 0x57);
+ lcd_write_reg(0x48, 5);
+ lcd_write_reg(0x49, 0x16);
+ lcd_write_reg(0x4a, 0x19);
+ lcd_write_reg(0x4b, 0x1a);
+ lcd_write_reg(0x4c, 0x1a);
+ lcd_write_reg(0x50, 0x17);
+ lcd_write_reg(0x51, 0x2b);
+ lcd_write_reg(0x52, 0x2b);
+ lcd_write_reg(0x53, 0x3f);
+ lcd_write_reg(0x54, 0x3f);
+ lcd_write_reg(0x55, 0x3f);
+ lcd_write_reg(0x56, 0x28);
+ lcd_write_reg(0x57, 0x6e);
+ lcd_write_reg(0x58, 5);
+ lcd_write_reg(0x59, 5);
+ lcd_write_reg(0x5a, 6);
+ lcd_write_reg(0x5b, 9);
+ lcd_write_reg(0x5c, 0x1a);
+ lcd_write_reg(0x5d, 0xcc);
+ lcd_write_reg(0x1b, 0x1b);
+ lcd_write_reg(0x1A, 1);
+ lcd_write_reg(0x24, 0x2f); // something special here
+ lcd_write_reg(0x25, 0x57); // something special here
+ lcd_write_reg(0x23, 0x8a);
+ lcd_write_reg(0x2f, 1);
+ lcd_write_reg(0x60, 0);
+ lcd_write_reg(0x16, 8);
+ lcd_write_reg(0x18, 0x36); // something special here
+ lcd_write_reg(0x19, 1);
+ udelay(5000);
+ lcd_write_reg(1, 0);
+ lcd_write_reg(0x1f, 0x88);
+ udelay(5000);
+ lcd_write_reg(0x1f, 0x80);
+ udelay(5000);
+ lcd_write_reg(0x1f, 0x90);
+ udelay(5000);
+ lcd_write_reg(0x1f, 0xD0);
+ udelay(5000);
+ lcd_write_reg(0x17, 6);
+ lcd_write_reg(0x37, 0);
+ lcd_write_reg(0x28, 0x38);
+ udelay(40000);
+ lcd_write_reg(0x28, 0x3c);
+}
+
+void lcd_init_device(void)
+{
+ /* the LCD seems to work at 24Mhz, so use the xtal clock with no divider */
+ imx233_clkctrl_enable(CLK_PIX, false);
+ imx233_clkctrl_set_div(CLK_PIX, 1);
+ imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */
+ imx233_clkctrl_enable(CLK_PIX, true);
+ imx233_lcdif_init();
+ imx233_lcdif_set_lcd_databus_width(8);
+ imx233_lcdif_set_timings(1, 1, 1, 1);
+ imx233_lcdif_enable_underflow_recover(true);
+ imx233_lcdif_setup_system_pins(8);
+ imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */
+
+ // reset device
+ imx233_lcdif_reset_lcd(true);
+ mdelay(10);
+ imx233_lcdif_reset_lcd(false);
+ mdelay(10);
+ imx233_lcdif_reset_lcd(true);
+ mdelay(150);
+
+ lcd_init_seq();
+#ifdef HAVE_LCD_ENABLE
+ lcd_on = true;
+#endif
+}
+
+#ifdef HAVE_LCD_ENABLE
+bool lcd_active(void)
+{
+ return lcd_on;
+}
+
+static void lcd_enable_seq(bool enable)
+{
+ if(!enable)
+ {
+ lcd_write_reg(0x1f, 0xd1);
+ lcd_write_reg(1, 0x40);
+ lcd_write_reg(1, 0xc0);
+ lcd_write_reg(0x19, 1);
+ }
+ else
+ {
+ lcd_write_reg(0x19, 0x81);
+ udelay(5000);
+ lcd_write_reg(1, 0x40);
+ udelay(20000);
+ lcd_write_reg(1, 0);
+ lcd_write_reg(0x1f, 0xd0);
+ }
+}
+
+void lcd_enable(bool enable)
+{
+ if(lcd_on == enable)
+ return;
+
+ lcd_on = enable;
+
+ if(enable)
+ imx233_lcdif_enable(true);
+ lcd_enable_seq(enable);
+ if(!enable)
+ imx233_lcdif_enable(false);
+ else
+ send_event(LCD_EVENT_ACTIVATION, NULL);
+}
+#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
+ /* make sure the rectangle is included in the screen */
+ x = MIN(x, LCD_WIDTH);
+ y = MIN(y, LCD_HEIGHT);
+ w = MIN(w, LCD_WIDTH - x);
+ h = MIN(h, LCD_HEIGHT - y);
+
+ imx233_lcdif_wait_ready();
+ lcd_write_reg(2, x >> 8);
+ lcd_write_reg(3, x & 0xff);
+ lcd_write_reg(4, (x + w - 1) >> 8);
+ lcd_write_reg(5, (x + w - 1) & 0xff);
+ lcd_write_reg(6, y >> 8);
+ lcd_write_reg(7, y & 0xff);
+ lcd_write_reg(8, (y + h - 1) >> 8);
+ lcd_write_reg(9, (y + h - 1) & 0xff);
+ lcd_write_reg(0x22, 0);
+
+ imx233_lcdif_wait_ready();
+ imx233_lcdif_set_word_length(16);
+ /* there are two cases here:
+ * - either width = LCD_WIDTH and we can directly memcopy a part of lcd_framebuffer to FRAME
+ * and send it
+ * - either width != LCD_WIDTH and we have to build a contiguous copy of the rectangular area
+ * into FRAME before sending it (which is slower and doesn't use the hardware)
+ * In all cases, FRAME just acts as a temporary buffer.
+ * NOTE It's more interesting to do a copy to FRAME in all cases since in system mode
+ * the clock runs at 24MHz which provides barely 10MB/s bandwidth compared to >100MB/s
+ * for memcopy operations
+ */
+ if(w == LCD_WIDTH)
+ {
+ memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
+ }
+ else
+ {
+ for(int i = 0; i < h; i++)
+ memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
+ }
+ /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
+ * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
+ * field must be a multiple of 2. Furthermore, it seems the lcd controller doesn't
+ * really like when both w and h are even, probably because the writes to the GRAM
+ * are done on several words and the controller requires dummy writes.
+ * The workaround is to always make sure that we send a number of pixels which is
+ * a multiple of 4 so that both the lcdif and the controller are happy. If any
+ * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
+ * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
+ */
+ if(w % 2 == 1 || h % 2 == 1)
+ {
+ /* copy three pixel after the last one */
+ for(int i = 0; i < 3; i++)
+ *((fb_data *)FRAME + w * h + i) = *((fb_data *)FRAME + i);
+ /* WARNING we need to update w and h to reflect the pixel count BUT it
+ * has no relation to w * h (it can even be 2 * prime). Hopefully, w <= 240 and
+ * h <= 320 so w * h <= 76800 and (w * h + 3) / 4 <= 38400 which fits into
+ * a 16-bit integer (horizontal count). */
+ h = (w * h + 3) / 4;
+ w = 4;
+ }
+ imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w, h);
+}
+
diff --git a/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c b/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c
new file mode 100644
index 0000000000..999f4ee525
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/lcd-nwze370.c
@@ -0,0 +1,219 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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 "logf.h"
+
+#ifdef HAVE_LCD_ENABLE
+static bool lcd_on;
+#endif
+
+static void lcd_write_reg(uint8_t reg, void *data, int data_len)
+{
+ imx233_lcdif_set_data_swizzle(0);
+ imx233_lcdif_set_word_length(8);
+ imx233_lcdif_pio_send(false, 1, &reg);
+ imx233_lcdif_pio_send(true, data_len, data);
+}
+
+static void lcd_init_seq(void)
+{
+ // seems compatible with ILI9163
+ lcd_write_reg(1, NULL, 0); // software reset
+ lcd_write_reg(0x11, NULL, 0); // sleep out
+ mdelay(150);
+ /* format: (<cmd> <data size> <data0> <dataN>)+ */
+ static uint8_t init_seq[] =
+ {
+ /* cmd sz data... */
+ 0x26, 1, 4, /* Gamma Set */
+ 0xb1, 2, 9, 0xd, /* Frame Rate */
+ 0xc0, 2, 8, 0, /* Power Control 1 */
+ 0xc1, 1, 5, /* Power Control 2 */
+ 0xc5, 2, 0x31, 0x40, /* VCOM Control 1 */
+ 0xc7, 1, 0xc8, /* VCOM Offset Control */
+ 0xec, 1, 0xc, /* Unknown */
+ 0x3a, 1, 5, /* Interface Pixel Format */
+ 0x2a, 4, 0, 0, 0, 0x7f, /* Column Address */
+ 0x2b, 4, 0, 0, 0, 0x9f, /* Page Address Set */
+ 0x35, 1, 0, /* Tear Effect Line On */
+ 0x36, 1, 0xc8, /* Memory access Control */
+ 0xb4, 1, 0, /* Display Inversion */
+ 0xb7, 1, 0, /* Source Driver Direction Control */
+ 0xb8, 1, 0, /* Gate Driver Direction Control */
+ 0xf2, 1, 1, /* Gamma Adjustment */
+ 0xe0, 15, 0x3f, 0x20, 0x1d, 0x2d, 0x26, 0x0c, 0x4b, 0xb7,
+ 0x39, 0x17, 0x1d, 0x16, 0x16, 0x10, 0x00, /* Positive Gamma */
+ 0xe1, 15, 0x00, 0x1f, 0x21, 0x12, 0x18, 0x13, 0x34, 0x48,
+ 0x46, 0x08, 0x21, 0x29, 0x28, 0x2f, 0x3f, /* Negative Gamma */
+ 0x29, 0, /* Display On */
+ };
+
+ for(unsigned i = 0; i < sizeof(init_seq); )
+ {
+ lcd_write_reg(init_seq[i], &init_seq[i + 2], init_seq[i + 1]);
+ i += 2 + init_seq[i + 1];
+ }
+}
+
+void lcd_init_device(void)
+{
+ /* the LCD seems to work at 24Mhz, so use the xtal clock with no divider */
+ imx233_clkctrl_enable(CLK_PIX, false);
+ imx233_clkctrl_set_div(CLK_PIX, 1);
+ imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */
+ imx233_clkctrl_enable(CLK_PIX, true);
+ imx233_lcdif_init();
+ imx233_lcdif_set_lcd_databus_width(8);
+ imx233_lcdif_set_timings(2, 2, 2, 2);
+ imx233_lcdif_enable_underflow_recover(true);
+ imx233_lcdif_setup_system_pins(8);
+ imx233_lcdif_set_byte_packing_format(0xf); /* two pixels per 32-bit word */
+
+ // reset device
+ imx233_lcdif_reset_lcd(true);
+ mdelay(10);
+ imx233_lcdif_reset_lcd(false);
+ mdelay(10);
+ imx233_lcdif_reset_lcd(true);
+ mdelay(150);
+
+ lcd_init_seq();
+#ifdef HAVE_LCD_ENABLE
+ lcd_on = true;
+#endif
+}
+
+#ifdef HAVE_LCD_ENABLE
+bool lcd_active(void)
+{
+ return lcd_on;
+}
+
+static void lcd_enable_seq(bool enable)
+{
+ if(enable)
+ {
+ lcd_write_reg(0x11, NULL, 0);
+ lcd_write_reg(0x29, NULL, 0);
+ }
+ else
+ {
+ lcd_write_reg(0x28, NULL, 0);
+ lcd_write_reg(0x10, NULL, 0);
+ }
+}
+
+void lcd_enable(bool enable)
+{
+ if(lcd_on == enable)
+ return;
+
+ lcd_on = enable;
+
+ if(enable)
+ imx233_lcdif_enable(true);
+ lcd_enable_seq(enable);
+ if(!enable)
+ imx233_lcdif_enable(false);
+ else
+ send_event(LCD_EVENT_ACTIVATION, NULL);
+}
+#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
+ /* make sure the rectangle is included in the screen */
+ x = MIN(x, LCD_WIDTH);
+ y = MIN(y, LCD_HEIGHT);
+ w = MIN(w, LCD_WIDTH - x);
+ h = MIN(h, LCD_HEIGHT - y);
+
+ imx233_lcdif_wait_ready();
+ uint32_t window = x << 8 | (x + w - 1) << 24;
+ lcd_write_reg(0x2a, &window, sizeof(window));
+ window = y << 8 | (y + h - 1) << 24;
+ lcd_write_reg(0x2b, &window, sizeof(window));
+ lcd_write_reg(0x2c, NULL, 0);
+
+ imx233_lcdif_wait_ready();
+ imx233_lcdif_set_data_swizzle(3);
+ imx233_lcdif_set_word_length(8);
+ /* there are two cases here:
+ * - either width = LCD_WIDTH and we can directly memcopy a part of lcd_framebuffer to FRAME
+ * and send it
+ * - either width != LCD_WIDTH and we have to build a contiguous copy of the rectangular area
+ * into FRAME before sending it (which is slower and doesn't use the hardware)
+ * In all cases, FRAME just acts as a temporary buffer.
+ * NOTE It's more interesting to do a copy to FRAME in all cases since in system mode
+ * the clock runs at 24MHz which provides barely 10MB/s bandwidth compared to >100MB/s
+ * for memcopy operations
+ */
+ if(w == LCD_WIDTH)
+ {
+ memcpy((void *)FRAME, FBADDR(x,y), w * h * sizeof(fb_data));
+ }
+ else
+ {
+ for(int i = 0; i < h; i++)
+ memcpy((fb_data *)FRAME + i * w, FBADDR(x,y + i), w * sizeof(fb_data));
+ }
+ /* WARNING The LCDIF has a limitation on the vertical count ! In 16-bit packed mode
+ * (which we used, ie 16-bit per pixel, 2 pixels per 32-bit words), the v_count
+ * field must be a multiple of 2. Furthermore, it seems the lcd controller doesn't
+ * really like when both w and h are even, probably because the writes to the GRAM
+ * are done on several words and the controller requires dummy writes.
+ * The workaround is to always make sure that we send a number of pixels which is
+ * a multiple of 4 so that both the lcdif and the controller are happy. If any
+ * of w or h is odd, we will send a copy of the first pixels as dummy writes. We will
+ * send at most 3 bytes. We then send (w * h + 3) / 4 x 4 bytes.
+ */
+ if(w % 2 == 1 || h % 2 == 1)
+ {
+ /* copy three pixel after the last one */
+ for(int i = 0; i < 3; i++)
+ *((fb_data *)FRAME + w * h + i) = *((fb_data *)FRAME + i);
+ /* WARNING we need to update w and h to reflect the pixel count BUT it
+ * has no relation to w * h (it can even be 2 * prime). Hopefully, w <= 240 and
+ * h <= 320 so w * h <= 76800 and (w * h + 3) / 4 <= 38400 which fits into
+ * a 16-bit integer (horizontal count). */
+ h = (w * h + 3) / 4;
+ w = 4;
+ }
+ imx233_lcdif_dma_send((void *)FRAME_PHYS_ADDR, w * 2, h);
+}
+
diff --git a/firmware/target/arm/imx233/sony-nwz/lcd-target.h b/firmware/target/arm/imx233/sony-nwz/lcd-target.h
new file mode 100644
index 0000000000..931fcb32a0
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/lcd-target.h
@@ -0,0 +1,24 @@
+/***************************************************************************
+ * __________ __ ___.
+ * Open \______ \ ____ ____ | | _\_ |__ _______ ___
+ * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
+ * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
+ * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
+ * \/ \/ \/ \/ \/
+ * $Id$
+ *
+ * Copyright (c) 2012 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
+
+#endif /* LCD_TARGET_H */
diff --git a/firmware/target/arm/imx233/sony-nwz/power-nwz.c b/firmware/target/arm/imx233/sony-nwz/power-nwz.c
new file mode 100644
index 0000000000..88644919ad
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/power-nwz.c
@@ -0,0 +1,42 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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"
+
+static bool tuner_enable = false;
+
+bool tuner_power(bool enable)
+{
+ if(enable != tuner_enable)
+ {
+ tuner_enable = enable;
+ }
+ return tuner_enable;
+}
+
+bool tuner_powered(void)
+{
+ return tuner_enable;
+}
diff --git a/firmware/target/arm/imx233/sony-nwz/powermgmt-nwze360.c b/firmware/target/arm/imx233/sony-nwz/powermgmt-nwze360.c
new file mode 100644
index 0000000000..fd395e30ca
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/powermgmt-nwze360.c
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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"
+
+const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
+{
+ 3659
+};
+
+const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
+{
+ 3630
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
+const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
+{
+ /* Toshiba Gigabeat S Li Ion 700mAH figured from discharge curve */
+ { 3659, 3719, 3745, 3761, 3785, 3813, 3856, 3926, 3984, 4040, 4121 },
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
+const unsigned short percent_to_volt_charge[11] =
+{
+ /* Toshiba Gigabeat S Li Ion 700mAH figured from charge curve */
+ 4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208
+};
diff --git a/firmware/target/arm/imx233/sony-nwz/powermgmt-nwze370.c b/firmware/target/arm/imx233/sony-nwz/powermgmt-nwze370.c
new file mode 100644
index 0000000000..fd395e30ca
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/powermgmt-nwze370.c
@@ -0,0 +1,46 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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"
+
+const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
+{
+ 3659
+};
+
+const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
+{
+ 3630
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
+const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
+{
+ /* Toshiba Gigabeat S Li Ion 700mAH figured from discharge curve */
+ { 3659, 3719, 3745, 3761, 3785, 3813, 3856, 3926, 3984, 4040, 4121 },
+};
+
+/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
+const unsigned short percent_to_volt_charge[11] =
+{
+ /* Toshiba Gigabeat S Li Ion 700mAH figured from charge curve */
+ 4028, 4063, 4087, 4111, 4135, 4156, 4173, 4185, 4194, 4202, 4208
+};
diff --git a/firmware/target/arm/imx233/sony-nwz/powermgmt-target.h b/firmware/target/arm/imx233/sony-nwz/powermgmt-target.h
new file mode 100644
index 0000000000..268423b433
--- /dev/null
+++ b/firmware/target/arm/imx233/sony-nwz/powermgmt-target.h
@@ -0,0 +1,58 @@
+/***************************************************************************
+ * __________ __ ___.
+ * 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"
+
+/* Sony NWZ-E360/NWZ-E370 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 260
+#define IMX233_STOP_CURRENT 20
+#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ)
+#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ)
+#define IMX233_DIE_TEMP_HIGH 91
+#define IMX233_DIE_TEMP_LOW 56
+#define IMX233_BATT_TEMP_SENSOR 0
+#define IMX233_BATT_TEMP_HIGH 2400
+#define IMX233_BATT_TEMP_LOW 2300
+
+#endif /* POWERMGMT_TARGET_H */