mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
creativezenmozaic: factor out code with the zen/zenxfi
Most of the code is similar, only the lcd driver is significantly different. Change-Id: I9eab1faf08d2356f2d820d6930ef3b0653349aa1
This commit is contained in:
parent
b770f63934
commit
a8b816ae9c
18 changed files with 44 additions and 582 deletions
|
@ -1163,10 +1163,14 @@ target/arm/tms320dm320/creative-zvm/powermgmt-creativezvm.c
|
||||||
target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
|
target/arm/tms320dm320/creative-zvm/usb-creativezvm.c
|
||||||
#endif /* CREATIVE_ZVx */
|
#endif /* CREATIVE_ZVx */
|
||||||
|
|
||||||
#if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI)
|
#if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC)
|
||||||
target/arm/imx233/creative-zen/fmradio-i2c-zen.c
|
target/arm/imx233/creative-zen/fmradio-i2c-zen.c
|
||||||
target/arm/imx233/creative-zen/backlight-zen.c
|
target/arm/imx233/creative-zen/backlight-zen.c
|
||||||
|
# if defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI)
|
||||||
target/arm/imx233/creative-zen/lcd-zen.c
|
target/arm/imx233/creative-zen/lcd-zen.c
|
||||||
|
# elif defined(CREATIVE_ZENMOZAIC)
|
||||||
|
target/arm/imx233/creative-zen/lcd-zenmozaic.c
|
||||||
|
#endif
|
||||||
target/arm/imx233/creative-zen/button-zen.c
|
target/arm/imx233/creative-zen/button-zen.c
|
||||||
target/arm/imx233/creative-zen/debug-zen.c
|
target/arm/imx233/creative-zen/debug-zen.c
|
||||||
target/arm/imx233/creative-zen/power-zen.c
|
target/arm/imx233/creative-zen/power-zen.c
|
||||||
|
@ -1198,18 +1202,6 @@ target/arm/imx233/creative-zenxfi3/adc-zenxfi3.c
|
||||||
target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
|
target/arm/imx233/creative-zenxfi3/powermgmt-zenxfi3.c
|
||||||
#endif
|
#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)
|
#if defined(SONY_NWZE360) || defined(SONY_NWZE370)
|
||||||
target/arm/imx233/button-lradc-imx233.c
|
target/arm/imx233/button-lradc-imx233.c
|
||||||
target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c
|
target/arm/imx233/sony-nwz/fmradio-i2c-nwz.c
|
||||||
|
|
|
@ -57,6 +57,19 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
|
||||||
{2945, BUTTON_PLAYPAUSE},
|
{2945, BUTTON_PLAYPAUSE},
|
||||||
{3400, 0},
|
{3400, 0},
|
||||||
{0, IMX233_BUTTON_LRADC_END},
|
{0, IMX233_BUTTON_LRADC_END},
|
||||||
|
#elif defined(CREATIVE_ZENMOZAIC)
|
||||||
|
{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},
|
||||||
#else
|
#else
|
||||||
#error wrong target
|
#error wrong target
|
||||||
#endif
|
#endif
|
||||||
|
@ -65,6 +78,11 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
|
||||||
void button_init_device(void)
|
void button_init_device(void)
|
||||||
{
|
{
|
||||||
imx233_button_lradc_init();
|
imx233_button_lradc_init();
|
||||||
|
#if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC)
|
||||||
|
imx233_pinctrl_acquire(2, 8, "jack_detect");
|
||||||
|
imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO);
|
||||||
|
imx233_pinctrl_enable_gpio(2, 8, false);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool button_hold(void)
|
bool button_hold(void)
|
||||||
|
@ -72,7 +90,7 @@ bool button_hold(void)
|
||||||
return imx233_button_lradc_hold();
|
return imx233_button_lradc_hold();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CREATIVE_ZENXFI
|
#if defined(CREATIVE_ZENXFI) || defined(CREATIVE_ZENMOZAIC)
|
||||||
bool headphones_inserted(void)
|
bool headphones_inserted(void)
|
||||||
{
|
{
|
||||||
return !imx233_pinctrl_get_gpio(2, 8);
|
return !imx233_pinctrl_get_gpio(2, 8);
|
||||||
|
|
|
@ -27,11 +27,29 @@
|
||||||
#include "power-imx233.h"
|
#include "power-imx233.h"
|
||||||
|
|
||||||
static bool tuner_enable = false;
|
static bool tuner_enable = false;
|
||||||
|
static bool initialised = false;
|
||||||
|
|
||||||
|
static void init(void)
|
||||||
|
{
|
||||||
|
#ifdef CREATIVE_ZENMOZAIC
|
||||||
|
/* 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);
|
||||||
|
#endif
|
||||||
|
initialised = true;
|
||||||
|
}
|
||||||
|
|
||||||
bool tuner_power(bool enable)
|
bool tuner_power(bool enable)
|
||||||
{
|
{
|
||||||
if(enable != tuner_enable)
|
if(!initialised)
|
||||||
|
init();
|
||||||
|
if(tuner_enable != enable)
|
||||||
{
|
{
|
||||||
|
#ifdef CREATIVE_ZENMOZAIC
|
||||||
|
imx233_pinctrl_set_gpio(2, 15, enable);
|
||||||
|
sleep(HZ / 5);
|
||||||
|
#endif
|
||||||
tuner_enable = enable;
|
tuner_enable = enable;
|
||||||
}
|
}
|
||||||
return tuner_enable;
|
return tuner_enable;
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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
|
|
|
@ -1,34 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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)",
|
|
||||||
};
|
|
|
@ -1,25 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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__ */
|
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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 */
|
|
|
@ -1,69 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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
|
|
||||||
}
|
|
|
@ -1,54 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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 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_ */
|
|
|
@ -1,69 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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);
|
|
||||||
}
|
|
|
@ -1,29 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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;
|
|
||||||
}
|
|
|
@ -1,40 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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);
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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 */
|
|
|
@ -1,57 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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;
|
|
||||||
}
|
|
|
@ -1,55 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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 */
|
|
|
@ -1,49 +0,0 @@
|
||||||
/***************************************************************************
|
|
||||||
* __________ __ ___.
|
|
||||||
* 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
|
|
||||||
};
|
|
2
tools/configure
vendored
2
tools/configure
vendored
|
@ -2318,7 +2318,7 @@ fi
|
||||||
toolset=$scramblebitmaptools
|
toolset=$scramblebitmaptools
|
||||||
t_cpu="arm"
|
t_cpu="arm"
|
||||||
t_manufacturer="imx233"
|
t_manufacturer="imx233"
|
||||||
t_model="creative-zenmozaic"
|
t_model="creative-zen"
|
||||||
arm926ejscc
|
arm926ejscc
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue