mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-08 20:55:17 -05:00
Initial commit for the Creative ZEN Mozaic
Change-Id: Ib65aad9f5de37e514047955cad7ca40dc0af4f74
This commit is contained in:
parent
9ed9807854
commit
d3bc64833c
21 changed files with 1214 additions and 0 deletions
29
firmware/target/arm/imx233/creative-zenmozaic/adc-target.h
Normal file
29
firmware/target/arm/imx233/creative-zenmozaic/adc-target.h
Normal 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 _ADC_TARGET_H_
|
||||
#define _ADC_TARGET_H_
|
||||
|
||||
#define NUM_ADC_CHANNELS 2
|
||||
|
||||
#define ADC_BATTERY 0
|
||||
#define ADC_DIE_TEMP 1
|
||||
|
||||
#endif
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "adc-target.h"
|
||||
#include "adc-imx233.h"
|
||||
|
||||
int imx233_adc_mapping[] =
|
||||
{
|
||||
[ADC_DIE_TEMP] = IMX233_ADC_DIE_TEMP,
|
||||
[ADC_BATTERY] = IMX233_ADC_BATTERY,
|
||||
};
|
||||
|
||||
const char *imx233_adc_channel_name[] =
|
||||
{
|
||||
"Die temperature(°C)",
|
||||
"Battery(raw)",
|
||||
};
|
||||
25
firmware/target/arm/imx233/creative-zenmozaic/audio-target.h
Normal file
25
firmware/target/arm/imx233/creative-zenmozaic/audio-target.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef __audio_target__
|
||||
#define __audio_target__
|
||||
|
||||
#endif /* __audio_target__ */
|
||||
|
||||
|
|
@ -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 */
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "backlight.h"
|
||||
#include "lcd.h"
|
||||
#include "backlight-target.h"
|
||||
#include "uartdbg-imx233.h"
|
||||
#include "pinctrl-imx233.h"
|
||||
|
||||
void _backlight_set_brightness(int level)
|
||||
{
|
||||
unsigned val = (level + 200) * level / 1000;
|
||||
if(level != 0)
|
||||
{
|
||||
for(unsigned mask = 0x10; mask; mask >>= 1)
|
||||
imx233_uartdbg_send((val & mask) ? 0xff : 0xf8);
|
||||
imx233_uartdbg_send(0);
|
||||
imx233_pinctrl_set_gpio(1, 12, true);
|
||||
}
|
||||
else
|
||||
imx233_pinctrl_set_gpio(1, 12, false);
|
||||
}
|
||||
|
||||
bool _backlight_init(void)
|
||||
{
|
||||
imx233_pinctrl_acquire(1, 12, "backlight_enable");
|
||||
imx233_pinctrl_set_function(1, 12, PINCTRL_FUNCTION_GPIO);
|
||||
imx233_pinctrl_enable_gpio(1, 12, true);
|
||||
imx233_uartdbg_init(BAUD_38400);
|
||||
return true;
|
||||
}
|
||||
|
||||
void _backlight_on(void)
|
||||
{
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_enable(true); /* power on lcd + visible display */
|
||||
#endif
|
||||
/* restore the previous backlight level */
|
||||
_backlight_set_brightness(backlight_brightness);
|
||||
}
|
||||
|
||||
void _backlight_off(void)
|
||||
{
|
||||
/* there is no real on/off but we can set to 0 brightness */
|
||||
_backlight_set_brightness(0);
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_enable(false); /* power off visible display */
|
||||
#endif
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef _BUTTON_TARGET_H_
|
||||
#define _BUTTON_TARGET_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
bool button_debug_screen(void);
|
||||
|
||||
#define HAS_BUTTON_HOLD
|
||||
#define HAVE_HEADPHONE_DETECTION
|
||||
|
||||
#define IMX233_BUTTON_LRADC_CHANNEL 0
|
||||
#define IMX233_BUTTON_LRADC_HOLD_DET BLH_ADC
|
||||
|
||||
/* Main unit's buttons */
|
||||
#define BUTTON_POWER 0x00000001
|
||||
#define BUTTON_LEFT 0x00000002
|
||||
#define BUTTON_UP 0x00000004
|
||||
#define BUTTON_RIGHT 0x00000008
|
||||
#define BUTTON_DOWN 0x00000010
|
||||
#define BUTTON_SELECT 0x00000020
|
||||
#define BUTTON_PLAYPAUSE 0x00000040
|
||||
#define BUTTON_BACK 0x00000080
|
||||
#define BUTTON_MENU 0x00000100
|
||||
#define BUTTON_SHORTCUT 0x00000200
|
||||
|
||||
|
||||
#define BUTTON_MAIN (BUTTON_POWER|BUTTON_LEFT|BUTTON_UP|BUTTON_RIGHT|\
|
||||
BUTTON_DOWN|BUTTON_SELECT|BUTTON_PLAYPAUSE|BUTTON_BACK|\
|
||||
BUTTON_MENU|BUTTON_SHORTCUT)
|
||||
|
||||
/* Software power-off */
|
||||
#define POWEROFF_BUTTON BUTTON_POWER
|
||||
#define POWEROFF_COUNT 10
|
||||
|
||||
#endif /* _BUTTON_TARGET_H_ */
|
||||
|
|
@ -0,0 +1,69 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "button-target.h"
|
||||
#include "system.h"
|
||||
#include "system-target.h"
|
||||
#include "pinctrl-imx233.h"
|
||||
#include "power-imx233.h"
|
||||
#include "button-lradc-imx233.h"
|
||||
|
||||
struct imx233_button_lradc_mapping_t imx233_button_lradc_mapping[] =
|
||||
{
|
||||
{0, IMX233_BUTTON_LRADC_HOLD},
|
||||
{200, BUTTON_MENU},
|
||||
{445, BUTTON_SHORTCUT},
|
||||
{645, BUTTON_UP},
|
||||
{860, BUTTON_LEFT},
|
||||
{1060, BUTTON_RIGHT},
|
||||
{1260, BUTTON_DOWN},
|
||||
{1480, BUTTON_SELECT},
|
||||
{2700, BUTTON_BACK},
|
||||
{2945, BUTTON_PLAYPAUSE},
|
||||
{3400, 0},
|
||||
{0, IMX233_BUTTON_LRADC_END},
|
||||
};
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
imx233_button_lradc_init();
|
||||
|
||||
imx233_pinctrl_acquire(2, 8, "jack_detect");
|
||||
imx233_pinctrl_set_function(2, 8, PINCTRL_FUNCTION_GPIO);
|
||||
imx233_pinctrl_enable_gpio(2, 8, false);
|
||||
}
|
||||
|
||||
bool headphones_inserted(void)
|
||||
{
|
||||
return imx233_pinctrl_get_gpio(2, 8);
|
||||
}
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
return imx233_button_lradc_hold();
|
||||
}
|
||||
|
||||
int button_read_device(void)
|
||||
{
|
||||
int btn = 0;
|
||||
if(BF_RD(POWER_STS, PSWITCH) == 1)
|
||||
btn |= BUTTON_POWER;
|
||||
return imx233_button_lradc_read(btn);
|
||||
}
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
#include "button-target.h"
|
||||
#include "lcd-target.h"
|
||||
|
||||
bool dbg_hw_target_info(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
27
firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h
Normal file
27
firmware/target/arm/imx233/creative-zenmozaic/lcd-target.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef LCD_TARGET_H
|
||||
#define LCD_TARGET_H
|
||||
|
||||
bool lcd_debug_screen(void);
|
||||
void lcd_set_contrast(int val);
|
||||
|
||||
#endif /* LCD_TARGET_H */
|
||||
152
firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c
Normal file
152
firmware/target/arm/imx233/creative-zenmozaic/lcd-zenmozaic.c
Normal file
|
|
@ -0,0 +1,152 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (c) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include <sys/types.h> /* off_t */
|
||||
#include <string.h>
|
||||
#include "cpu.h"
|
||||
#include "system.h"
|
||||
#include "backlight-target.h"
|
||||
#include "lcd.h"
|
||||
#include "lcdif-imx233.h"
|
||||
#include "clkctrl-imx233.h"
|
||||
#include "pinctrl-imx233.h"
|
||||
#include "dcp-imx233.h"
|
||||
#include "logf.h"
|
||||
#ifndef BOOTLOADER
|
||||
#include "button.h"
|
||||
#include "font.h"
|
||||
#include "action.h"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
static bool lcd_on;
|
||||
#endif
|
||||
|
||||
static void lcd_write_reg(uint16_t reg, uint16_t value)
|
||||
{
|
||||
imx233_lcdif_set_data_swizzle(3);
|
||||
imx233_lcdif_pio_send(false, 2, ®);
|
||||
if(reg != 0x22)
|
||||
imx233_lcdif_pio_send(true, 2, &value);
|
||||
}
|
||||
|
||||
void lcd_init_device(void)
|
||||
{
|
||||
/* clock at 24MHZ */
|
||||
imx233_clkctrl_enable(CLK_PIX, false);
|
||||
imx233_clkctrl_set_div(CLK_PIX, 3);
|
||||
imx233_clkctrl_set_bypass(CLK_PIX, true); /* use XTAL */
|
||||
imx233_clkctrl_enable(CLK_PIX, true);
|
||||
imx233_lcdif_init();
|
||||
imx233_lcdif_setup_system_pins(8);
|
||||
imx233_lcdif_set_timings(2, 2, 2, 2);
|
||||
imx233_lcdif_set_word_length(8);
|
||||
|
||||
lcd_write_reg(0, 1);
|
||||
lcd_write_reg(3, 0);
|
||||
|
||||
lcd_write_reg(3, 0x510);
|
||||
lcd_write_reg(9, 8);
|
||||
lcd_write_reg(0xc, 0);
|
||||
lcd_write_reg(0xd, 0);
|
||||
lcd_write_reg(0xe, 0);
|
||||
lcd_write_reg(0x5b, 4);
|
||||
lcd_write_reg(0xd, 0x10);
|
||||
lcd_write_reg(9, 0);
|
||||
lcd_write_reg(3, 0x10);
|
||||
lcd_write_reg(0xd, 0x14);
|
||||
lcd_write_reg(0xe, 0x2b12);
|
||||
lcd_write_reg(1, 0x21f);
|
||||
lcd_write_reg(2, 0x700);
|
||||
lcd_write_reg(5, 0x30);
|
||||
lcd_write_reg(6, 0);
|
||||
lcd_write_reg(8, 0x202);
|
||||
lcd_write_reg(0xa, 0x3); // OF uses 0xc0003 with 3 transfers/pixels
|
||||
lcd_write_reg(0xb, 0);
|
||||
lcd_write_reg(0xf, 0);
|
||||
lcd_write_reg(0x10, 0);
|
||||
lcd_write_reg(0x11, 0);
|
||||
lcd_write_reg(0x14, 0x9f00);
|
||||
lcd_write_reg(0x15, 0x9f00);
|
||||
lcd_write_reg(0x16, 0x7f00);
|
||||
lcd_write_reg(0x17, 0x9f00);
|
||||
lcd_write_reg(0x20, 0);
|
||||
lcd_write_reg(0x21, 0);
|
||||
lcd_write_reg(0x23, 0);
|
||||
lcd_write_reg(0x24, 0);
|
||||
lcd_write_reg(0x25, 0);
|
||||
lcd_write_reg(0x26, 0);
|
||||
lcd_write_reg(0x30, 0x707);
|
||||
lcd_write_reg(0x31, 0x504);
|
||||
lcd_write_reg(0x32, 7);
|
||||
lcd_write_reg(0x33, 0x307);
|
||||
lcd_write_reg(0x34, 7);
|
||||
lcd_write_reg(0x35, 0x400);
|
||||
lcd_write_reg(0x36, 0x607);
|
||||
lcd_write_reg(0x37, 0x703);
|
||||
lcd_write_reg(0x3a, 0x1a0d);
|
||||
lcd_write_reg(0x3b, 0x1309);
|
||||
|
||||
lcd_write_reg(9, 4);
|
||||
lcd_write_reg(7, 5);
|
||||
lcd_write_reg(7, 0x25);
|
||||
lcd_write_reg(7, 0x27);
|
||||
lcd_write_reg(0x5b, 0);
|
||||
lcd_write_reg(7, 0x37);
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
lcd_on = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
bool lcd_active(void)
|
||||
{
|
||||
return lcd_on;
|
||||
}
|
||||
|
||||
void lcd_enable(bool enable)
|
||||
{
|
||||
if(lcd_on == enable)
|
||||
return;
|
||||
|
||||
lcd_on = enable;
|
||||
}
|
||||
#endif
|
||||
|
||||
void lcd_update(void)
|
||||
{
|
||||
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
|
||||
}
|
||||
|
||||
void lcd_update_rect(int x, int y, int w, int h)
|
||||
{
|
||||
#ifdef HAVE_LCD_ENABLE
|
||||
if(!lcd_on)
|
||||
return;
|
||||
#endif
|
||||
|
||||
imx233_lcdif_wait_ready();
|
||||
lcd_write_reg(0x16, x | (x + w - 1) << 8);
|
||||
lcd_write_reg(0x17, y | (y + h - 1) << 8);
|
||||
lcd_write_reg(0x21, y * LCD_WIDTH + x);
|
||||
lcd_write_reg(0x22, 0);
|
||||
for(int yy = y; yy < y + h; yy++)
|
||||
imx233_lcdif_pio_send(true, 2 * w, FBADDR(x, yy));
|
||||
}
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "system.h"
|
||||
#include "power.h"
|
||||
#include "tuner.h"
|
||||
#include "fmradio_i2c.h"
|
||||
#include "pinctrl-imx233.h"
|
||||
#include "power-imx233.h"
|
||||
|
||||
static bool tuner_enable = false;
|
||||
static bool initialised = false;
|
||||
|
||||
static void init(void)
|
||||
{
|
||||
/* CE is B2P15 (active high) */
|
||||
imx233_pinctrl_acquire(2, 15, "tuner power");
|
||||
imx233_pinctrl_set_function(2, 15, PINCTRL_FUNCTION_GPIO);
|
||||
imx233_pinctrl_enable_gpio(2, 15, true);
|
||||
initialised = true;
|
||||
}
|
||||
|
||||
bool tuner_power(bool enable)
|
||||
{
|
||||
if(!initialised)
|
||||
init();
|
||||
if(tuner_enable != enable)
|
||||
{
|
||||
imx233_pinctrl_set_gpio(2, 15, enable);
|
||||
sleep(HZ / 5);
|
||||
tuner_enable = enable;
|
||||
}
|
||||
return tuner_enable;
|
||||
}
|
||||
|
||||
bool tuner_powered(void)
|
||||
{
|
||||
return tuner_enable;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#ifndef POWERMGMT_TARGET_H
|
||||
#define POWERMGMT_TARGET_H
|
||||
|
||||
#include "config.h"
|
||||
#include "powermgmt-imx233.h"
|
||||
|
||||
/* ZEN Mozaic OF settings:
|
||||
* - current ramp slope:
|
||||
* - conditioning threshold voltage:
|
||||
* - conditioning max voltage:
|
||||
* - conditioning current:
|
||||
* - conditioning timeout:
|
||||
* - charging voltage:
|
||||
* - charging current:
|
||||
* - charging threshold current:
|
||||
* - charging timeout:
|
||||
* - top off period:
|
||||
* - high die temperature:
|
||||
* - low die temperature:
|
||||
* - safe die temperature current:
|
||||
* - battery temperature channel:
|
||||
* - high battery temperature:
|
||||
* - low battery temperature:
|
||||
* - safe battery temperature current:
|
||||
* - low DCDC battery voltage:
|
||||
*/
|
||||
|
||||
#define IMX233_CHARGE_CURRENT 200
|
||||
#define IMX233_STOP_CURRENT 30
|
||||
#define IMX233_TOPOFF_TIMEOUT (30 * 60 * HZ)
|
||||
#define IMX233_CHARGING_TIMEOUT (4 * 3600 * HZ)
|
||||
#define IMX233_DIE_TEMP_HIGH 71
|
||||
#define IMX233_DIE_TEMP_LOW 56
|
||||
|
||||
#endif /* POWERMGMT_TARGET_H */
|
||||
|
|
@ -0,0 +1,49 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2013 by Amaury Pouly
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
#include "config.h"
|
||||
#include "powermgmt-target.h"
|
||||
#include "power-imx233.h"
|
||||
|
||||
#warning FIXME calibrate
|
||||
|
||||
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||
{
|
||||
0
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
|
||||
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||
{
|
||||
/* Sansa Fuze+ Li Ion 600mAH figured from discharge curve */
|
||||
{ 3100, 3650, 3720, 3750, 3780, 3820, 3880, 4000, 4040, 4125, 4230 },
|
||||
};
|
||||
|
||||
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||
const unsigned short percent_to_volt_charge[11] =
|
||||
{
|
||||
/* Sansa Fuze+ Li Ion 600mAH figured from charge curve */
|
||||
3480, 3790, 3845, 3880, 3900, 3935, 4005, 4070, 4150, 4250, 4335
|
||||
};
|
||||
|
|
@ -127,6 +127,13 @@ struct sdmmc_config_t sdmmc_config[] =
|
|||
.ssp = 1,
|
||||
.mode = SD_MODE,
|
||||
},
|
||||
#elif defined(CREATIVE_ZENMOZAIC)
|
||||
{
|
||||
.name = "internal/SD",
|
||||
.flags = WINDOW,
|
||||
.ssp = 2,
|
||||
.mode = SD_MODE,
|
||||
}
|
||||
#elif defined(SONY_NWZE370) || defined(SONY_NWZE360)
|
||||
/* The Sony NWZ-E370 uses #B1P29 for power */
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue