Initial commit for the sony NWZ-E360 and NWZ-E370

Change-Id: I52d21e136a98eaf481615d641795cf7ecf325465
This commit is contained in:
Amaury Pouly 2013-09-25 14:29:00 +02:00
parent 46248b3df9
commit 9392d036c4
24 changed files with 1519 additions and 3 deletions

View File

@ -289,5 +289,7 @@ keymaps/keymap-sansa-connect.c
keymaps/keymap-ypr0.c
#elif CONFIG_KEYPAD == MA_PAD
keymaps/keymap-ma.c
#elif CONFIG_KEYPAD == SONY_NWZ_PAD
keymaps/keymap-nwz.c
#endif

View File

@ -1184,6 +1184,23 @@ target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c
target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.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
target/arm/imx233/sony-nwz/backlight-nwz.c
target/arm/imx233/sony-nwz/button-nwz.c
target/arm/imx233/sony-nwz/debug-nwz.c
target/arm/imx233/sony-nwz/power-nwz.c
target/arm/imx233/sony-nwz/adc-nwz.c
# if defined(SONY_NWZE360)
target/arm/imx233/sony-nwz/lcd-nwze360.c
target/arm/imx233/sony-nwz/powermgmt-nwze360.c
# elif defined(SONY_NWZE370)
target/arm/imx233/sony-nwz/lcd-nwze370.c
target/arm/imx233/sony-nwz/powermgmt-nwze370.c
# endif
#endif
#ifdef SANSA_CONNECT
drivers/lcd-memframe.c
target/arm/tms320dm320/sdmmc-dm320.c

View File

@ -148,6 +148,7 @@
#define CREATIVE_ZENXFI2_PAD 54
#define CREATIVE_ZENXFI3_PAD 55
#define MA_PAD 56
#define SONY_NWZ_PAD 57
/* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1
@ -250,6 +251,8 @@
#define LCD_CREATIVEZXFI2 48 /* as used by the Creative Zen X-Fi2 */
#define LCD_CREATIVEZXFI3 49 /* as used by the Creative Zen X-Fi3 */
#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 */
/* LCD_PIXELFORMAT */
#define HORIZONTAL_PACKING 1
@ -509,6 +512,10 @@ Lyre prototype 1 */
#include "config/samsungypr0.h"
#elif defined(MA9)
#include "config/hifietma9.h"
#elif defined(SONY_NWZE370)
#include "config/sonynwze370.h"
#elif defined(SONY_NWZE360)
#include "config/sonynwze360.h"
#else
/* no known platform */
#endif

View File

@ -0,0 +1,183 @@
/*
* This config file is for the Sony NWZ-E360 series
*/
#define IMX233_SUBTARGET 3780
#define IMX233_PACKAGE IMX233_BGA169
/* For Rolo and boot loader */
#define MODEL_NUMBER 89
#define MODEL_NAME "Sony NWZ-E360 series"
#define HW_SAMPR_CAPS SAMPR_CAP_ALL
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
#define INPUT_SRC_CAPS SRC_CAP_FMRADIO
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP
/* define this if you have a colour LCD */
#define HAVE_LCD_COLOR
#ifndef BOOTLOADER
#define HAVE_ALBUMART
/* define this to enable bitmap scaling */
#define HAVE_BMP_SCALING
/* define this to enable JPEG decoding */
#define HAVE_JPEG
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY
/* define this if you have access to the quickscreen */
#define HAVE_QUICKSCREEN
/* define this if you have a light associated with the buttons */
/* define this if you would like tagcache to build on this target */
#define HAVE_TAGCACHE
/* define this if you have LCD enable function */
#define HAVE_LCD_ENABLE
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
should be defined as well.
#define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING
*/
/* define this if you can flip your LCD
#define HAVE_LCD_FLIP
*/
/* define this if you can invert the colours on your LCD
#define HAVE_LCD_INVERT
*/
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_IMX233
/* define this if you have a real-time clock with alarm facilities */
#define HAVE_RTC_ALARM
#endif /* !BOOTLOADER */
/* define this if you have an i.MX23 codec */
#define HAVE_IMX233_CODEC
#define CONFIG_TUNER STFM1000
/* There is no hardware tone control */
#define HAVE_SW_TONE_CONTROLS
#define CONFIG_KEYPAD SONY_NWZ_PAD
/* Define this to enable morse code input */
#define HAVE_MORSE_INPUT
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* LCD dimensions */
#define LCD_WIDTH 240
#define LCD_HEIGHT 320
#define LCD_DEPTH 16 /* 65536 colours */
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
/* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x100000
/* The number of bytes reserved for loadable plugins */
#define PLUGIN_BUFFER_SIZE 0x80000
#define AB_REPEAT_ENABLE
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 0
#define MAX_BRIGHTNESS_SETTING 100
#define DEFAULT_BRIGHTNESS_SETTING 50
/* Which backlight fading type? */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
/* define this if the flash memory uses the SecureDigital Memory Card protocol */
#define CONFIG_STORAGE STORAGE_MMC
/* todo */
#define BATTERY_CAPACITY_DEFAULT 550 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 550 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 550 /* max. capacity selectable */
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
/* define this if the unit can be powered or charged via USB */
#define HAVE_USB_POWER
/* Define this if you have an IMX233*/
#define CONFIG_CPU IMX233
/* Define this if you want to use the IMX233 i2c interface */
#define CONFIG_I2C I2C_IMX233
/* define current usage levels (based on battery bench) */
#define CURRENT_NORMAL 35
#define CURRENT_BACKLIGHT 30
#define CURRENT_RECORD CURRENT_NORMAL
/* maximum charging current */
#define CURRENT_MAX_CHG 200
/* Define this to the CPU frequency */
#define CPU_FREQ 454000000
/* Type of LCD */
#define CONFIG_LCD LCD_NWZE360
/* Offset ( in the firmware file's header ) to the file CRC and data. These are
only used when loading the old format rockbox.e200 file */
#define FIRMWARE_OFFSET_FILE_CRC 0x0
#define FIRMWARE_OFFSET_FILE_DATA 0x8
/* USB On-the-go */
#define CONFIG_USBOTG USBOTG_ARC
/* enable these for the experimental usb stack */
#define HAVE_USBSTACK
//#define USB_HANDLED_BY_OF
#define USE_ROCKBOX_USB
#define USB_VENDOR_ID 0x054c
#define USB_PRODUCT_ID 0x059b
#define HAVE_USB_HID_MOUSE
#define HAVE_BOOTLOADER_USB_MODE
/* The fuze+ actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
#define MAX_LOG_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
#define BOOTFILE_EXT "sony"
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
#define INCLUDE_TIMEOUT_API

View File

@ -0,0 +1,182 @@
/*
* This config file is for the Sony NWZ-E370 series
*/
#define IMX233_SUBTARGET 3780
#define IMX233_PACKAGE IMX233_BGA169
/* For Rolo and boot loader */
#define MODEL_NUMBER 88
#define MODEL_NAME "Sony NWZ-E370 series"
#define HW_SAMPR_CAPS SAMPR_CAP_ALL
/* Define bitmask of input sources - recordable bitmask can be defined
explicitly if different */
#define INPUT_SRC_CAPS SRC_CAP_FMRADIO
/* define this if you have a bitmap LCD display */
#define HAVE_LCD_BITMAP
/* define this if you have a colour LCD */
#define HAVE_LCD_COLOR
#ifndef BOOTLOADER
#define HAVE_ALBUMART
/* define this to enable bitmap scaling */
#define HAVE_BMP_SCALING
/* define this to enable JPEG decoding */
#define HAVE_JPEG
/* Define this if a programmable hotkey is mapped */
#define HAVE_HOTKEY
/* define this if you have access to the quickscreen */
#define HAVE_QUICKSCREEN
/* define this if you have a light associated with the buttons */
/* define this if you would like tagcache to build on this target */
#define HAVE_TAGCACHE
/* define this if you have LCD enable function */
#define HAVE_LCD_ENABLE
/* Define this if your LCD can be put to sleep. HAVE_LCD_ENABLE
should be defined as well.
#define HAVE_LCD_SLEEP
#define HAVE_LCD_SLEEP_SETTING
*/
/* define this if you can flip your LCD
#define HAVE_LCD_FLIP
*/
/* define this if you can invert the colours on your LCD
#define HAVE_LCD_INVERT
*/
/* define this if you have a real-time clock */
#define CONFIG_RTC RTC_IMX233
/* define this if you have a real-time clock with alarm facilities */
#define HAVE_RTC_ALARM
#endif /* !BOOTLOADER */
/* define this if you have an i.MX23 codec */
#define HAVE_IMX233_CODEC
#define CONFIG_TUNER STFM1000
/* There is no hardware tone control */
#define HAVE_SW_TONE_CONTROLS
#define CONFIG_KEYPAD SONY_NWZ_PAD
/* Define this to enable morse code input */
#define HAVE_MORSE_INPUT
/* Define this if you do software codec */
#define CONFIG_CODEC SWCODEC
/* LCD dimensions */
#define LCD_WIDTH 128
#define LCD_HEIGHT 160
#define LCD_DEPTH 16 /* 65536 colours */
#define LCD_PIXELFORMAT RGB565 /* rgb565 */
/* Define this if you have a software controlled poweroff */
#define HAVE_SW_POWEROFF
/* The number of bytes reserved for loadable codecs */
#define CODEC_SIZE 0x100000
/* The number of bytes reserved for loadable plugins */
#define PLUGIN_BUFFER_SIZE 0x80000
#define AB_REPEAT_ENABLE
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
#define HAVE_BACKLIGHT_BRIGHTNESS
/* Main LCD backlight brightness range and defaults */
#define MIN_BRIGHTNESS_SETTING 0
#define MAX_BRIGHTNESS_SETTING 100
#define DEFAULT_BRIGHTNESS_SETTING 50
/* Which backlight fading type? */
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
/* define this if you have a flash memory storage */
#define HAVE_FLASH_STORAGE
/* define this if the flash memory uses the SecureDigital Memory Card protocol */
#define CONFIG_STORAGE STORAGE_MMC
/* todo */
#define BATTERY_CAPACITY_DEFAULT 550 /* default battery capacity */
#define BATTERY_CAPACITY_MIN 550 /* min. capacity selectable */
#define BATTERY_CAPACITY_MAX 550 /* max. capacity selectable */
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
#define BATTERY_TYPES_COUNT 1 /* only one type */
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
/* Charging implemented in a target-specific algorithm */
#define CONFIG_CHARGING CHARGING_TARGET
/* define this if the unit can be powered or charged via USB */
#define HAVE_USB_POWER
/* Define this if you have an IMX233*/
#define CONFIG_CPU IMX233
/* Define this if you want to use the IMX233 i2c interface */
#define CONFIG_I2C I2C_IMX233
/* define current usage levels (based on battery bench) */
#define CURRENT_NORMAL 35
#define CURRENT_BACKLIGHT 30
#define CURRENT_RECORD CURRENT_NORMAL
/* maximum charging current */
#define CURRENT_MAX_CHG 200
/* Define this to the CPU frequency */
#define CPU_FREQ 454000000
/* Type of LCD */
#define CONFIG_LCD LCD_NWZE370
/* Offset ( in the firmware file's header ) to the file CRC and data. These are
only used when loading the old format rockbox.e200 file */
#define FIRMWARE_OFFSET_FILE_CRC 0x0
#define FIRMWARE_OFFSET_FILE_DATA 0x8
/* USB On-the-go */
#define CONFIG_USBOTG USBOTG_ARC
/* enable these for the experimental usb stack */
#define HAVE_USBSTACK
//#define USB_HANDLED_BY_OF
#define USE_ROCKBOX_USB
#define USB_VENDOR_ID 0x054c
#define USB_PRODUCT_ID 0x068a
#define HAVE_USB_HID_MOUSE
#define HAVE_BOOTLOADER_USB_MODE
/* The fuze+ actually interesting partition table does not use 512-byte sector
* (usually 2048 logical sector size) */
#define MAX_LOG_SECTOR_SIZE 2048
/* Define this if you have adjustable CPU frequency */
#define HAVE_ADJUSTABLE_CPU_FREQ
#define BOOTFILE_EXT "sony"
#define BOOTFILE "rockbox." BOOTFILE_EXT
#define BOOTDIR "/.rockbox"
#define INCLUDE_TIMEOUT_API

View File

@ -124,6 +124,15 @@ struct sdmmc_config_t sdmmc_config[] =
.ssp = 1,
.mode = SD_MODE,
},
#elif defined(SONY_NWZE370) || defined(SONY_NWZE360)
/* The Sony NWZ-E370 uses #B1P29 for power */
{
.name = "internal/SD",
.flags = POWER_PIN | POWER_INVERTED | WINDOW,
.power_pin = PIN(1, 29),
.ssp = 2,
.mode = MMC_MODE
},
#else
#error You need to write the sd/mmc config!
#endif

View File

@ -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",
};

View File

@ -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

View File

@ -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__ */

View File

@ -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
}

View File

@ -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 */

View File

@ -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);
}

View File

@ -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_ */

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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 */

View File

@ -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;
}

View File

@ -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
};

View File

@ -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
};

View File

@ -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 */

45
tools/configure vendored
View File

@ -1330,8 +1330,9 @@ cat <<EOF
203) Nokia N900 190) HM-60x
204) Pandora ==HiFi E.T.== 191) HM-801
205) Samsung YP-R0 210) MA9
206) Android MIPS
207) Android x86
206) Android MIPS ==Sony==
207) Android x86 220) NWZ-E370 series
221) NWZ-E360 series
EOF
buildfor=`input`;
@ -3434,6 +3435,46 @@ fi
t_model="ma"
;;
220|sonynwze370)
target_id=88
modelname="sonynwze370"
target="SONY_NWZE370"
memory=32
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
tool="$rootdir/tools/scramble -add=e370"
output="rockbox.sony"
bootoutput="bootloader-nwze370.sony"
appextra="gui:recorder:radio"
plugins=""
swcodec="yes"
toolset=$scramblebitmaptools
t_cpu="arm"
t_manufacturer="imx233"
t_model="sony-nwz"
arm926ejscc
;;
221|sonynwze360)
target_id=89
modelname="sonynwze360"
target="SONY_NWZE360"
memory=32
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
bmp2rb_native="$rootdir/tools/bmp2rb -f 4"
tool="$rootdir/tools/scramble -add=e360"
output="rockbox.sony"
bootoutput="bootloader-nwze360.sony"
appextra="gui:recorder:radio"
plugins=""
swcodec="yes"
toolset=$scramblebitmaptools
t_cpu="arm"
t_manufacturer="imx233"
t_model="sony-nwz"
arm926ejscc
;;
*)
echo "Please select a supported target platform!"
exit 7

View File

@ -128,7 +128,7 @@ void usage(void)
"\t 9200, 1630, 6330, ldax, m200, c100, clip, e2v2,\n"
"\t m2v4, fuze, c2v2, clv2, y820, y920, y925, x747,\n"
"\t 747p, x777, nn2g, m244, cli+, fuz2, hd20, hd30,\n"
"\t ip6g, rk27, clzp, zxf2, zxf3, fuz+)\n");
"\t ip6g, rk27, clzp, zxf2, zxf3, fuz+, e370, e360)\n");
printf("\nNo option results in Archos standard player/recorder format.\n");
exit(1);
@ -365,6 +365,10 @@ int main (int argc, char** argv)
modelnum = 82;
else if (!strcmp(&argv[1][5], "zxf3")) /* Creative Zen X-Fi3 */
modelnum = 83;
else if (!strcmp(&argv[1][5], "e370")) /* Sony NWZ-E370 series */
modelnum = 88;
else if (!strcmp(&argv[1][5], "e360")) /* Sony NWZ-E360 series */
modelnum = 89;
else {
fprintf(stderr, "unsupported model: %s\n", &argv[1][5]);
return 2;