Initial commit for the Creative ZEN V

Change-Id: I3408cfdf742ea5995d5c87bf76653f436e1ec2b0
This commit is contained in:
Amaury Pouly 2013-11-18 20:07:02 +00:00
parent a8b816ae9c
commit 977a6c3ce7
18 changed files with 300 additions and 10 deletions

View file

@ -29,6 +29,9 @@
void _backlight_set_brightness(int level)
{
#ifdef CREATIVE_ZENV
lcd_set_contrast(level);
#else
unsigned val = (level + 200) * level / 1000;
if(level != 0)
{
@ -39,14 +42,17 @@ void _backlight_set_brightness(int level)
}
else
imx233_pinctrl_set_gpio(1, 12, false);
#endif
}
bool _backlight_init(void)
{
#ifndef CREATIVE_ZENV
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);
#endif
return true;
}

View file

@ -47,8 +47,12 @@ bool button_debug_screen(void);
#define BUTTON_TOPLEFT 0x00001000
#define BUTTON_TOPRIGHT 0x00002000
#endif
#ifdef CREATIVE_ZENV
#define BUTTON_VOL_UP 0x00004000
#define BUTTON_VOL_DOWN 0x00008000
#endif
#define BUTTON_MAIN 0x00003fff
#define BUTTON_MAIN 0x0000ffff
/* Software power-off */
#define POWEROFF_BUTTON BUTTON_POWER

View file

@ -57,6 +57,20 @@ struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
{2945, BUTTON_PLAYPAUSE},
{3400, 0},
{0, IMX233_BUTTON_LRADC_END},
#elif defined(CREATIVE_ZENV)
{190, IMX233_BUTTON_LRADC_HOLD},
{250, BUTTON_PLAYPAUSE},
{530, BUTTON_BACK},
{785, BUTTON_VOL_UP},
{1040, BUTTON_VOL_DOWN},
{1295, BUTTON_MENU},
{1540, BUTTON_UP},
{1800, BUTTON_SELECT},
{2070, BUTTON_LEFT},
{2315, BUTTON_RIGHT},
{2550, BUTTON_DOWN},
{3450, 0},
{0, IMX233_BUTTON_LRADC_END},
#elif defined(CREATIVE_ZENMOZAIC)
{0, IMX233_BUTTON_LRADC_HOLD},
{200, BUTTON_MENU},
@ -100,7 +114,7 @@ bool headphones_inserted(void)
int button_read_device(void)
{
int btn = 0;
if(BF_RD(POWER_STS, PSWITCH) == 1)
if(imx233_power_read_pswitch() == 1)
btn |= BUTTON_POWER;
return imx233_button_lradc_read(btn);
}

View file

@ -58,4 +58,14 @@ bool tuner_power(bool enable)
bool tuner_powered(void)
{
return tuner_enable;
}
}
void ide_power_enable(bool on)
{
(void) on;
}
bool ide_powered(void)
{
return true;
}

View file

@ -196,11 +196,13 @@ struct imx233_emi_info_t imx233_emi_get_info(void)
{
struct imx233_emi_info_t info;
memset(&info, 0, sizeof(info));
#if IMX233_SUBTARGET >= 3700
info.rows = 13 - BF_RD(DRAM_CTL10, ADDR_PINS);
info.columns = 12 - BF_RD(DRAM_CTL11, COLUMN_SIZE);
info.cas = BF_RD(DRAM_CTL13, CASLAT_LIN);
info.banks = 4;
info.chips = __builtin_popcount(BF_RD(DRAM_CTL14, CS_MAP));
info.size = 2 * (1 << (info.rows + info.columns)) * info.chips * info.banks;
#endif
return info;
}

View file

@ -124,7 +124,9 @@ void INT_VDD5V(void)
void imx233_power_init(void)
{
#if IMX233_SUBTARGET >= 3700
BF_CLR(POWER_MINPWR, HALF_FETS);
#endif
/* setup vbusvalid parameters: set threshold to 4v and power up comparators */
BF_CLR(POWER_5VCTRL, VBUSVALID_TRSH);
BF_SETV(POWER_5VCTRL, VBUSVALID_TRSH, 1);
@ -155,7 +157,9 @@ void imx233_power_init(void)
BF_SET(POWER_CTRL, POLARITY_VDD5V_GT_VDDIO);
BF_SET(POWER_CTRL, ENIRQ_VDD5V_GT_VDDIO);
/* make the vbusvalid detection way is not enabled */
#if IMX233_SUBTARGET >= 3700
BF_CLR(POWER_CTRL, ENIRQ_VBUS_VALID);
#endif
#endif
/* the VDD5V IRQ is shared by several sources, disable them */
#if IMX233_SUBTARGET >= 3700

View file

@ -119,6 +119,15 @@ static inline void imx233_power_set_dcdc_freq(bool pll, unsigned freq)
}
#endif
static inline unsigned imx233_power_read_pswitch(void)
{
#if IMX233_SUBTARGET >= 3700
return BF_RD(POWER_STS, PSWITCH);
#else
return BF_RD(DIGCTL_STATUS, PSWITCH);
#endif
}
#if IMX233_SUBTARGET < 3700
/* return -1 on error */
int imx233_power_sense_die_temperature(int *min, int *max);

View file

@ -48,9 +48,9 @@ void imx233_powermgmt_init(void)
{
imx233_power_set_charge_current(IMX233_CHARGE_CURRENT);
imx233_power_set_stop_current(IMX233_STOP_CURRENT);
#if IMX233_SUBTARGET >= 3700
/* assume that adc_init was called and battery monitoring via LRADC setup */
BF_WR(POWER_BATTMONITOR, EN_BATADJ, 1);
#if IMX233_SUBTARGET >= 3700
/* setup linear regulator offsets to 25 mV below to prevent contention between
* linear regulators and DCDC */
BF_WR(POWER_VDDDCTRL, LINREG_OFFSET, 2);