iPod 2nd gen: * Fake battery voltage of 4.00V so rockbox doesn't shutdown (ADC is not yet implemented). * Fix button hold polarity for main rockbox. * Implement backlight inversion (the 1st/2nd gen backlight works in a way that makes the LCD look inverted when active). * Fix default contrast and clean up target tree.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14022 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2007-07-27 12:05:54 +00:00
parent b701322fea
commit 021c0868dd
7 changed files with 86 additions and 18 deletions

View file

@ -625,7 +625,7 @@ target/arm/wmcodec-pp.c
target/arm/i2s-pp.c
target/arm/ipod/adc-ipod.c
target/arm/ipod/3g/backlight-3g.c
target/arm/ipod/3g/button-3g.c
target/arm/ipod/button-1g-3g.c
target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c
target/arm/usb-pp.c
@ -638,8 +638,8 @@ target/arm/ata-pp5002.c
target/arm/wmcodec-pp.c
target/arm/i2s-pp.c
target/arm/ipod/adc-ipod.c
target/arm/ipod/3g/backlight-3g.c /* FIXME */
target/arm/ipod/3g/button-3g.c /* FIXME */
target/arm/ipod/1g2g/backlight-1g2g.c
target/arm/ipod/button-1g-3g.c
target/arm/ipod/lcd-gray.c
target/arm/ipod/power-ipod.c
#endif /* SIMULATOR */

View file

@ -38,7 +38,7 @@
/* LCD contrast */
#define MIN_CONTRAST_SETTING 5
#define MAX_CONTRAST_SETTING 63
#define DEFAULT_CONTRAST_SETTING 40 /* Match boot contrast */
#define DEFAULT_CONTRAST_SETTING 28 /* Match boot contrast */
#define CONFIG_KEYPAD IPOD_1G2G_PAD
@ -63,6 +63,9 @@
/* Define this for LCD backlight available */
#define HAVE_BACKLIGHT
/* Define this if the backlight unverts LCD appearance */
#define HAVE_BACKLIGHT_INVERSION
#define BATTERY_CAPACITY_DEFAULT 630 /* default battery capacity */
#ifndef SIMULATOR

View file

@ -0,0 +1,34 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Linus Nielsen Feltzing
*
* All files in this archive are subject to the GNU General Public License.
* See the file COPYING in the source tree root for full license agreement.
*
* 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"
void __backlight_on(void)
{
outl(inl(0xc0001000) | 0x02, 0xc0001000);
lcd_set_backlight_inversion(true);
}
void __backlight_off(void)
{
outl(inl(0xc0001000) & ~0x02, 0xc0001000);
lcd_set_backlight_inversion(false);
}

View file

@ -17,18 +17,7 @@
*
****************************************************************************/
#include "config.h"
#include <stdlib.h>
#include "cpu.h"
#include "kernel.h"
#include "thread.h"
#include "i2c.h"
#include "debug.h"
#include "rtc.h"
#include "usb.h"
#include "power.h"
#include "system.h"
#include "button.h"
#include "timer.h"
#include "backlight.h"
inline void __backlight_on(void)

View file

@ -55,7 +55,7 @@ static unsigned short _adc_read(struct adc_struct *adc)
}
adc->data = value;
return value;
} else
} else
#endif
{
return adc->data;
@ -66,11 +66,19 @@ static unsigned short _adc_read(struct adc_struct *adc)
unsigned short adc_scan(int channel) {
struct adc_struct *adc = &adcdata[channel];
adc->timeout = 0;
#ifdef IPOD_1G2G
if (channel == ADC_UNREG_POWER)
return 681; /* FIXME fake 4.00V */
#endif
return _adc_read(adc);
}
/* Retrieve the ADC value, only does a scan periodically */
unsigned short adc_read(int channel) {
#ifdef IPOD_1G2G
if (channel == ADC_UNREG_POWER)
return 681; /* FIXME fake 4.00V */
#endif
return _adc_read(&adcdata[channel]);
}

View file

@ -194,7 +194,11 @@ int button_read_device(void)
bool button_hold(void)
{
return (GPIOA_INPUT_VAL & 0x20)?false:true;
#ifdef IPOD_1G2G
return (GPIOA_INPUT_VAL & 0x20);
#else
return !(GPIOA_INPUT_VAL & 0x20);
#endif
}
bool headphones_inserted(void)

View file

@ -68,6 +68,12 @@ static inline bool timer_check(int clock_start, int usecs)
#define R_RAM_ADDR_SET 0x11
#define R_RAM_DATA 0x12
#ifdef HAVE_BACKLIGHT_INVERSION
/* The backlight makes the LCD appear negative on the 1st/2nd gen */
static bool lcd_inverted = false;
static bool lcd_backlit = false;
#endif
/* needed for flip */
static int addr_offset;
#if defined(IPOD_MINI) || defined(IPOD_MINI2G)
@ -146,7 +152,9 @@ void lcd_init_device(void)
int lcd_default_contrast(void)
{
#if defined(IPOD_MINI) || defined(IPOD_MINI2G) || defined(IPOD_3G)
#ifdef IPOD_1G2G
return 28;
#elif defined(IPOD_MINI) || defined(IPOD_MINI2G) || defined(IPOD_3G)
return 42;
#else
return 35;
@ -162,6 +170,27 @@ void lcd_set_contrast(int val)
lcd_cmd_and_data(R_CONTRAST_CONTROL, 0x400 | (val + 64));
}
#ifdef HAVE_BACKLIGHT_INVERSION
static void invert_display(void)
{
if (lcd_inverted ^ lcd_backlit)
lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0023);
else
lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0009);
}
void lcd_set_invert_display(bool yesno)
{
lcd_inverted = yesno;
invert_display();
}
void lcd_set_backlight_inversion(bool yesno)
{
lcd_backlit = yesno;
invert_display();
}
#else
void lcd_set_invert_display(bool yesno)
{
if (yesno)
@ -169,6 +198,7 @@ void lcd_set_invert_display(bool yesno)
else
lcd_cmd_and_data(R_DISPLAY_CONTROL, 0x0009);
}
#endif
/* turn the display upside down (call lcd_update() afterwards) */
void lcd_set_flip(bool yesno)