Merry Christmas Gogear HDD6330 owners! This is the start of the HDD6330 port. At the moment, it's essentially a copy of the HDD1630 port with a minimal LCD driver. The touchpad doesn't work as expected, but you can still kind of navigate and listen to music/radio.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24112 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Mark Arigo 2009-12-25 04:05:01 +00:00
parent 4a85eb7d9f
commit 6908cc5235
28 changed files with 1215 additions and 33 deletions

View file

@ -59,7 +59,7 @@ unsigned short adc_scan(int channel)
adcdata[channel] = (adc_data_1<<2 | adc_data_2);
#if !defined(PHILIPS_HDD1630)
#if !(defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330))
/* ADC values read low if PLL is enabled */
if(PLL_CONTROL & 0x80000000){
adcdata[channel] += 0x14;
@ -94,7 +94,7 @@ static void adc_tick(void)
/* Figured out from how the OF does things */
void adc_init(void)
{
#if defined(PHILIPS_HDD1630)
#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
ADC_INIT = 0;
#else
ADC_INIT |= 1;
@ -119,7 +119,7 @@ void adc_init(void)
ADC_ADDR = 0;
ADC_ADDR |= 0x40;
#if !defined(PHILIPS_HDD1630)
#if !(defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330))
ADC_ADDR |= 0x20000000;
udelay(100);
@ -155,7 +155,7 @@ void adc_init(void)
ADC_STATUS |= 0x20000000;
#endif
#if defined(PHILIPS_HDD1630)
#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
ADC_INIT |= 0x80000000;
udelay(100);
ADC_INIT = 0;

View file

@ -156,7 +156,7 @@ cpu:
mov r1, #WAKE
str r1, [r0]
#if defined(SANSA_C200) || defined(PHILIPS_HDD1630)
#if defined(SANSA_C200) || defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
/* Magic for loading the c200 OF */
ldr r0, =0xb00d10ad
mov r1, #0x700

View file

@ -269,8 +269,8 @@ void i2c_init(void)
#if CONFIG_I2C == I2C_PP5020
outl(0x0, 0x600060a4);
#if defined(PHILIPS_HDD1630) || defined(SAMSUNG_YH820) || \
defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
#if defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330) || \
defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
outl(inl(0x600060a4) | 0x20, 0x600060a4);
outl(inl(0x7000c020) | 0x3, 0x7000c020);
outl(0x55, 0x7000c02c);

View file

@ -0,0 +1,35 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2006 by Barry Wardell
*
* 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_UNKNOWN_1 1
#define ADC_UNKNOWN_2 2
#define ADC_UNKNOWN_3 3
#define ADC_UNREG_POWER ADC_BATTERY /* For compatibility */
/* Force a scan now */
unsigned short adc_scan(int channel);
#endif

View file

@ -0,0 +1,125 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Mark Arigo
*
* 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.h"
#include "backlight.h"
#include "synaptics-mep.h"
/*#define LOGF_ENABLE*/
#include "logf.h"
static int int_btn = BUTTON_NONE;
/*
* Generate a click sound from the player (not in headphones yet)
* TODO: integrate this with the "key click" option
*/
void button_click(void)
{
GPO32_ENABLE |= 0x2000;
GPO32_VAL |= 0x2000;
udelay(1000);
GPO32_VAL &= ~0x2000;
}
#ifndef BOOTLOADER
void button_init_device(void)
{
/* The touchpad is powered on and initialized in power-hdd1630.c
since it needs to be ready for both buttons and button lights. */
}
/*
* Button interrupt handler
*/
void button_int(void)
{
char data[4];
int val;
int_btn = BUTTON_NONE;
val = touchpad_read_device(data, 4);
if (val == MEP_BUTTON_HEADER)
{
/* Buttons packet */
if (data[1] & 0x1)
int_btn |= BUTTON_LEFT;
if (data[1] & 0x2)
int_btn |= BUTTON_RIGHT;
}
else if (val == MEP_ABSOLUTE_HEADER)
{
/* Absolute packet - the finger is on the vertical strip.
Position ranges from 1-4095, with 1 at the bottom. */
val = ((data[1] >> 4) << 8) | data[2]; /* position */
if ((val > 0) && (val <= 1365))
int_btn |= BUTTON_DOWN;
else if ((val > 1365) && (val <= 2730))
int_btn |= BUTTON_SELECT;
else if ((val > 2730) && (val <= 4095))
int_btn |= BUTTON_UP;
}
}
#else
void button_init_device(void){}
#endif /* bootloader */
bool button_hold(void)
{
return !(GPIOJ_INPUT_VAL & 0x8);
}
/*
* Get button pressed from hardware
*/
int button_read_device(void)
{
static int btn_old = BUTTON_NONE;
int btn = int_btn;
/* Hold */
if(button_hold())
return BUTTON_NONE;
/* Device buttons */
if (!(GPIOA_INPUT_VAL & 0x01)) btn |= BUTTON_MENU;
if (!(GPIOA_INPUT_VAL & 0x02)) btn |= BUTTON_VOL_UP;
if (!(GPIOA_INPUT_VAL & 0x04)) btn |= BUTTON_VOL_DOWN;
if (!(GPIOA_INPUT_VAL & 0x08)) btn |= BUTTON_VIEW;
if (!(GPIOD_INPUT_VAL & 0x20)) btn |= BUTTON_PLAYLIST;
if (!(GPIOD_INPUT_VAL & 0x40)) btn |= BUTTON_POWER;
if ((btn != btn_old) && (btn != BUTTON_NONE))
button_click();
btn_old = btn;
return btn;
}
bool headphones_inserted(void)
{
return (GPIOE_INPUT_VAL & 0x80) ? true : false;
}

View file

@ -0,0 +1,63 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2008 by Mark Arigo
*
* 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"
#define MEP_BUTTON_HEADER 0x19
#define MEP_BUTTON_ID 0x9
#define MEP_ABSOLUTE_HEADER 0x0b
#define HAS_BUTTON_HOLD
bool button_hold(void);
void button_init_device(void);
int button_read_device(void);
#ifndef BOOTLOADER
void button_int(void);
#endif
/* Main unit's buttons */
#define BUTTON_POWER 0x00000001
#define BUTTON_PLAYLIST 0x00000002
#define BUTTON_MENU 0x00000004
#define BUTTON_VIEW 0x00000008
#define BUTTON_VOL_UP 0x00000010
#define BUTTON_VOL_DOWN 0x00000020
#define BUTTON_SELECT 0x00000040
#define BUTTON_LEFT 0x00000080
#define BUTTON_RIGHT 0x00000100
#define BUTTON_UP 0x00000200
#define BUTTON_DOWN 0x00000400
#define BUTTON_MAIN 0x00000fff
/* No Remote control */
#define BUTTON_REMOTE 0
#define POWEROFF_BUTTON BUTTON_POWER
#define POWEROFF_COUNT 10
#endif /* _BUTTON_TARGET_H_ */

View file

@ -0,0 +1,159 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2009 by Mark Arigo
*
* 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 "cpu.h"
#include "lcd.h"
#include "kernel.h"
#include "system.h"
/* Display status */
static unsigned lcd_yuv_options SHAREDBSS_ATTR = 0;
/* wait for LCD */
static inline void lcd_wait_write(void)
{
int i = 0;
while (LCD2_PORT & LCD2_BUSY_MASK)
{
if (i < 2000)
i++;
else
LCD2_PORT &= ~LCD2_BUSY_MASK;
}
}
/* send LCD data */
static void lcd_send_data(unsigned data)
{
lcd_wait_write();
LCD2_PORT = LCD2_DATA_MASK | (data & 0xff);
}
/* send LCD command */
static void lcd_send_cmd(unsigned cmd)
{
lcd_wait_write();
LCD2_PORT = LCD2_CMD_MASK | (cmd & 0xff);
lcd_wait_write();
}
static inline void lcd_send_pixel(unsigned pixel)
{
lcd_send_data(pixel >> 8);
lcd_send_data(pixel);
}
void lcd_init_device(void)
{
/* init handled by the OF bootloader */
}
/*** hardware configuration ***/
int lcd_default_contrast(void)
{
return DEFAULT_CONTRAST_SETTING;
}
void lcd_set_contrast(int val)
{
(void)val;
}
void lcd_set_invert_display(bool yesno)
{
(void)yesno;
}
/* turn the display upside down (call lcd_update() afterwards) */
void lcd_set_flip(bool yesno)
{
(void)yesno;
}
void lcd_yuv_set_options(unsigned options)
{
lcd_yuv_options = options;
}
/* Performance function to blit a YUV bitmap directly to the LCD */
void lcd_blit_yuv(unsigned char * const src[3],
int src_x, int src_y, int stride,
int x, int y, int width, int height)
{
(void)src;
(void)src_x;
(void)src_y;
(void)stride;
(void)x;
(void)y;
(void)width;
(void)height;
}
/* Update the display.
This must be called after all other LCD functions that change the display. */
void lcd_update(void)
{
lcd_update_rect(0, 0, LCD_WIDTH, LCD_HEIGHT);
}
/* Update a fraction of the display. */
void lcd_update_rect(int x, int y, int width, int height)
{
const fb_data *addr;
if (x + width >= LCD_WIDTH)
width = LCD_WIDTH - x;
if (y + height >= LCD_HEIGHT)
height = LCD_HEIGHT - y;
if ((width <= 0) || (height <= 0))
return; /* Nothing left to do. */
addr = &lcd_framebuffer[y][x];
lcd_send_cmd(0x01);
lcd_send_data(0x48);
lcd_send_cmd(0x05);
lcd_send_data(0x0f);
lcd_send_cmd(0x08);
lcd_send_data(y);
lcd_send_cmd(0x09);
lcd_send_data(y + height - 1);
lcd_send_cmd(0x0a);
lcd_send_data(x + 16);
lcd_send_cmd(0x0b);
lcd_send_data(x + width - 1 + 16);
lcd_send_cmd(0x06);
do {
int w = width;
do {
lcd_send_pixel(*addr++);
} while (--w > 0);
addr += LCD_WIDTH - width;
} while (--height > 0);
}

View file

@ -0,0 +1,72 @@
/***************************************************************************
* __________ __ ___.
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
* \/ \/ \/ \/ \/
* $Id$
*
* Copyright (C) 2002 by Heikki Hannikainen, Uwe Freese
* Revisions copyright (C) 2005 by Gerald Van Baren
*
* 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 "adc.h"
#include "powermgmt.h"
#define SMLAL(lo, hi, x, y) \
asm volatile ("smlal %0, %1, %2, %3" \
: "+r" (lo), "+r" (hi) \
: "%r" (x), "r" (y))
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
{
3550
};
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
{
3500
};
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled */
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
{
{ 3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990 },
};
#if CONFIG_CHARGING
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
const unsigned short percent_to_volt_charge[11] =
{
3480, 3550, 3590, 3610, 3630, 3650, 3700, 3760, 3800, 3910, 3990
};
#endif /* CONFIG_CHARGING */
#define BATTERY_SCALE_FACTOR 4200
/* full-scale ADC readout (2^10) in millivolt */
/* Returns battery voltage from ADC [millivolts] */
unsigned int battery_adc_voltage(void)
{
/* return (adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR) >> 10; */
/* This may be overly complicated (pulled from the OF) */
int lo = 0;
int val = adc_read(ADC_UNREG_POWER) * BATTERY_SCALE_FACTOR;
SMLAL(lo, val, 0x8a42f871, val);
val>>= 9;
val -= (val >> 31);
return val;
}

View file

@ -143,7 +143,7 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
usb_insert_int();
}
/* end PHILIPS_SA9200 */
#elif defined(PHILIPS_HDD1630)
#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
else if (CPU_HI_INT_STAT & GPIO0_MASK) {
if (GPIOA_INT_STAT & 0x20)
button_int();
@ -152,7 +152,7 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
if (GPIOE_INT_STAT & 0x04)
usb_insert_int();
}
/* end PHILIPS_HDD1630 */
/* end PHILIPS_HDD1630 || PHILIPS_HDD6330 */
#elif defined(SAMSUNG_YH820) || defined(SAMSUNG_YH920) || defined(SAMSUNG_YH925)
else if (CPU_HI_INT_STAT & GPIO0_MASK) {
if (GPIOD_INT_STAT & 0x10)

View file

@ -70,7 +70,7 @@
#define USB_GPIO_MASK 0x80
#define USB_GPIO_VAL 0x00
#elif defined(PHILIPS_HDD1630)
#elif defined(PHILIPS_HDD1630) || defined(PHILIPS_HDD6330)
/* GPIO E bit 2 is usb detect */
#define USB_GPIO GPIOE
#define USB_GPIO_MASK 0x04