Commit latest Qisda version and Bookeen's modification

This commit is contained in:
mlt 2010-04-23 11:27:04 +00:00 committed by Godzil
parent 2c907884d1
commit f2fd2aec61
75 changed files with 182708 additions and 51781 deletions

View File

@ -32,6 +32,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
#
# General setup
#
# CONFIG_RESCUEOS_BUILD is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SWAP is not set
@ -1001,8 +1002,11 @@ CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_VGA16 is not set
# CONFIG_LOGO_LINUX_CLUT224 is not set
# CONFIG_LOGO_LINUX_LANDSCAPED_CLUT224 is not set
# CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224 is not set
# CONFIG_LOGO_LINUX_SH060B00_6_INCH_CLUT224 is not set
CONFIG_LOGO_LINUX_CUSTOMER_9_INCH_CLUT224=y
#
# Sound
#

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -974,6 +974,8 @@ CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_VGA16 is not set
# CONFIG_LOGO_LINUX_CLUT224 is not set
# CONFIG_LOGO_LINUX_LANDSCAPED_CLUT224 is not set
# CONFIG_LOGO_LINUX_CUSTOMER_9_INCH_CLUT224 is not set
# CONFIG_LOGO_LINUX_SH060B00_6_INCH_CLUT224 is not set
CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224=y
#

View File

@ -32,6 +32,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
#
# General setup
#
# CONFIG_RESCUEOS_BUILD is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SWAP is not set
@ -276,7 +277,7 @@ CONFIG_ALIGNMENT_TRAP=y
#
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_CMDLINE="root=/dev/mmcblk0p1 rootfstype=ext3 init=/linuxrc console=ttySAC0,115200"
CONFIG_CMDLINE="root=/dev/mmcblk0p1 rootfstype=ext3 ro init=/linuxrc console=ttySAC0,115200"
# CONFIG_XIP_KERNEL is not set
# CONFIG_KEXEC is not set
@ -305,6 +306,9 @@ CONFIG_BINFMT_AOUT=y
CONFIG_PM=y
CONFIG_PM_LEGACY=y
CONFIG_PM_CPU_MODE=y
CONFIG_TOUCH_PM=y
CONFIG_PM_PLATFORM_POWER_SAVING=y
# CONFIG_PM_DEBUG is not set
CONFIG_PM_SYSFS_DEPRECATED=y
CONFIG_APM_EMULATION=y
@ -1004,6 +1008,8 @@ CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_VGA16 is not set
# CONFIG_LOGO_LINUX_CLUT224 is not set
# CONFIG_LOGO_LINUX_LANDSCAPED_CLUT224 is not set
# CONFIG_LOGO_LINUX_CUSTOMER_9_INCH_CLUT224 is not set
# CONFIG_LOGO_LINUX_SH060B00_6_INCH_CLUT224 is not set
CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224=y
#
@ -1225,6 +1231,7 @@ CONFIG_USB_FILE_STORAGE=m
# CONFIG_USB_MIDI_GADGET is not set
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
CONFIG_SD_SW_DEBOUNCE=y
CONFIG_MMC_UNSAFE_RESUME=y
#

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.21.5-cfs-v19
# Mon Nov 23 19:28:57 2009
# Thu Feb 4 10:46:10 2010
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@ -32,6 +32,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
#
# General setup
#
# CONFIG_RESCUEOS_BUILD is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SWAP is not set
@ -304,6 +305,7 @@ CONFIG_BINFMT_AOUT=y
#
CONFIG_PM=y
CONFIG_PM_LEGACY=y
# CONFIG_PM_PLATFORM_POWER_SAVING is not set
CONFIG_PM_CPU_MODE=y
# CONFIG_PM_DEBUG is not set
CONFIG_PM_SYSFS_DEPRECATED=y
@ -411,6 +413,8 @@ CONFIG_WIRELESS_EXT=y
#
# Generic Driver Options
#
# CONFIG_QISDA_BQ060B00 is not set
# CONFIG_QISDA_SH060B00 is not set
# CONFIG_QISDA_QD060B00 is not set
CONFIG_QISDA_QD090B00=y
CONFIG_QISDA_QD090B00_EVT1=y
@ -868,6 +872,7 @@ CONFIG_I2C_S3C2410=y
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_SENSORS_MAX6875 is not set
CONFIG_QISDA_IIC=y
# CONFIG_TOUCH_PM is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -181,6 +181,10 @@ __setup("reboot=", reboot_setup);
void machine_halt(void)
{
if (pm_power_off)
pm_power_off();
while(1);
}

View File

@ -32,10 +32,10 @@ config MACH_SMDK2416
help
Say Y here if you are using an SMDK2416
config MACH_CYBOOK2416
bool "CYBOOK 2416"
select MACH_SMDK2416
config MACH_CYBOOK_ORIZON
bool "Bookeen Cybook Orizon"
select CPU_S3C2416
select MACH_SMDK
help
Say Y here is you are using a Cybook 2416
Say Y here if you are using a Cybook Orizon
endmenu

View File

@ -18,6 +18,6 @@ obj-$(CONFIG_S3C2416_PM) += pm.o
# Machine support
obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o
obj-$(CONFIG_MACH_SMDK2416) += qisda-utils.o
obj-$(CONFIGçMACH_CYBOOK2416) += cybook.o
obj-$(CONFIG_MACH_SMDK2416) += mach-smdk2416.o qisda-utils.o cybook.o
obj-$(CONFIG_MACH_CYBOOK_ORIZON) += mach-cybook_orizon.o cybook.o qisda-utils.o

View File

@ -17,6 +17,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
//#include <linux/miscdevice.h>
//#include <linux/poll.h>
//#include <linux/sched.h>
//#include <linux/wait.h>
//#include <linux/delay.h>
//#include <linux/interrupt.h>
//#include <linux/pm.h>
#include <cybook.h>
struct proc_dir_entry *platform_type_Proc_File;
#define procfs_name "device"
@ -26,6 +40,8 @@ int procfile_read(char *buffer,
{
int ret;
if (offset > 0) {
/* we have finished to read, return 0 */
ret = 0;
@ -40,9 +56,9 @@ int procfile_read(char *buffer,
}
// ---------------------------------------------------------------------------
// ===========================================================================
static int __init cybooInit(void)
static int __init cybookInit(void)
{
printk("CIC [Cybook Initialisation Code]\n");
/* cybook proc file */
platform_type_Proc_File = create_proc_entry(procfs_name, 0644, NULL);

View File

@ -0,0 +1,297 @@
/* linux/arch/arm/mach-s3c2416/mach-cybook_orizon.c
*
* Slightly based on mach-s3c2416.c
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/interrupt.h>
#include <linux/list.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <linux/serial_core.h>
#include <linux/platform_device.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/irq.h>
#include <asm/setup.h>
#include <asm/hardware.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/mach-types.h>
#include <asm/arch/regs-serial.h>
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-gpioj.h>
#include <asm/arch/regs-lcd.h>
#include <asm/arch/regs-mem.h>
#include <asm/arch/idle.h>
#include <asm/arch/fb.h>
#include <asm/plat-s3c24xx/s3c2410.h>
#include <asm/plat-s3c24xx/s3c2440.h>
#include <asm/plat-s3c24xx/clock.h>
#include <asm/plat-s3c24xx/devs.h>
#include <asm/plat-s3c24xx/cpu.h>
#include <asm/plat-s3c24xx/common-smdk.h>
#include <asm/arch/nand.h>
#include <linux/mtd/mtd.h>
#include <linux/mtd/partitions.h>
#include <asm/arch/hsmmc.h>
#include <cybook.h>
unsigned int platform_type = CYBOOK_GEN4;
unsigned long platform_capability = PLAT_CAP_GTILT | PLAT_CAP_SOUNDNO
| PLAT_CAP_VTCON | PLAT_CAP_ORIZONFORM;
static struct map_desc bkorizon_iodesc[] __initdata = {
};
#define UCON S3C2410_UCON_DEFAULT | S3C2440_UCON_FCLK
#define ULCON S3C2410_LCON_CS8 | S3C2410_LCON_PNONE | S3C2410_LCON_STOPB
#define UFCON S3C2410_UFCON_RXTRIG8 | S3C2410_UFCON_FIFOMODE
static struct s3c24xx_uart_clksrc bkorizon_serial_clocks[] = {
[0] = {
.name = "pclk",
.divisor = 1,
.min_baud = 0,
.max_baud = 0,
},
[1] = {
.name = "esysclk",
.divisor = 1,
.min_baud = 0,
.max_baud = 0,
}
};
static struct s3c2410_uartcfg bkorizon_uartcfgs[] __initdata = {
[0] = {
.hwport = 0,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
},
[1] = { /* VRFY: Used by BT? */
.hwport = 1,
.flags = 0,
/* Use PCLK */
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
.clocks = bkorizon_serial_clocks,
.clocks_size = ARRAY_SIZE(bkorizon_serial_clocks),
},
/* IR port */
[2] = {
.hwport = 2,
.flags = 0,
.ucon = 0x3c5,
.ulcon = 0x03,
.ufcon = 0x51,
.clocks = bkorizon_serial_clocks,
.clocks_size = ARRAY_SIZE(bkorizon_serial_clocks),
}
};
/*** TODO: Verify this list and remove anything unneeded */
static struct platform_device *bkorizon_devices[] __initdata = {
&s3c_device_spi0,
&s3c_device_spi1,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_lcd,
&s3c_device_rtc,
&s3c_device_adc,
&s3c_device_iis,
&s3c_device_usbgadget,
&s3c_device_usb,
&s3c_device_hsmmc0,
&s3c_device_hsmmc1,
&s3c_device_ts_iic,
};
static struct s3c24xx_board bkorizon_board __initdata = {
.devices = bkorizon_devices,
.devices_count = ARRAY_SIZE(bkorizon_devices)
};
static void bkorizon_power_off(void)
{
printk(KERN_ERR "Will Shutdown...\n");
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD14, 0);
}
static void __init bkorizon_map_io(void)
{
s3c24xx_init_io(bkorizon_iodesc, ARRAY_SIZE(bkorizon_iodesc));
s3c24xx_init_clocks(12000000);
s3c24xx_init_uarts(bkorizon_uartcfgs, ARRAY_SIZE(bkorizon_uartcfgs));
s3c24xx_set_board(&bkorizon_board);
}
static void __init bkorizon_machine_init(void)
{
smdk_machine_init();
pm_power_off = bkorizon_power_off;
}
static void __init bkorizon_fixup (struct machine_desc *desc, struct tag *tags,
char **cmdline, struct meminfo *mi)
{
/*
* Bank start addresses are not present in the information
* passed in from the boot loader. We could potentially
* detect them, but instead we hard-code them.
*/
mi->bank[0].start = 0x30000000;
mi->bank[0].size = 128*1024*1024;
mi->bank[0].node = 0;
mi->nr_banks = 1;
}
MACHINE_START(CYBOOK_ORIZON, "Cybook Orizon")
/* Maintainer: Manoel Trapier <mtrapier@bookeen.com> */
.phys_io = S3C2410_PA_UART,
.io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
.boot_params = S3C2410_SDRAM_PA + 0x100,
.init_irq = s3c24xx_init_irq,
.map_io = bkorizon_map_io,
.fixup = bkorizon_fixup,
.init_machine = bkorizon_machine_init,
.timer = &s3c24xx_timer,
MACHINE_END
/*
* HS-MMC GPIO Set function for S3C2416 SMDK board
*/
void hsmmc_set_gpio (uint channel, uint width)
{
switch (channel) {
/* can supports 1 and 4 bit bus */
case 0:
/* GPIO E : Command, Clock */
s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2450_GPE5_SD0_CLK);
s3c2410_gpio_cfgpin(S3C2410_GPE6, S3C2450_GPE6_SD0_CMD);
if (width == 1) {
/* GPIO E : MMC DATA0[0] */
s3c2410_gpio_cfgpin(S3C2410_GPE7, S3C2450_GPE7_SD0_DAT0);
}
else if (width == 4) {
/* GPIO E : MMC DATA0[0:3] */
s3c2410_gpio_cfgpin(S3C2410_GPE7, S3C2450_GPE7_SD0_DAT0);
s3c2410_gpio_cfgpin(S3C2410_GPE8, S3C2450_GPE8_SD0_DAT1);
s3c2410_gpio_cfgpin(S3C2410_GPE9, S3C2450_GPE9_SD0_DAT2);
s3c2410_gpio_cfgpin(S3C2410_GPE10, S3C2450_GPE10_SD0_DAT3);
}
break;
/* can supports 1 and 4 bit bus */
case 1:
/* GPIO L : Command, Clock */
s3c2410_gpio_cfgpin(S3C2443_GPL8, S3C2450_GPL8_SD1CMD);
s3c2410_gpio_cfgpin(S3C2443_GPL9, S3C2450_GPL9_SD1CLK);
if (width == 1) {
/* GPIO L : MMC DATA1[0] */
s3c2410_gpio_cfgpin(S3C2443_GPL0, S3C2450_GPL0_SD1DAT0);
}
else if (width == 4) {
/* GPIO L : MMC DATA1[0:3] */
s3c2410_gpio_cfgpin(S3C2443_GPL0, S3C2450_GPL0_SD1DAT0);
s3c2410_gpio_cfgpin(S3C2443_GPL1, S3C2450_GPL1_SD1DAT1);
s3c2410_gpio_cfgpin(S3C2443_GPL2, S3C2450_GPL2_SD1DAT2);
s3c2410_gpio_cfgpin(S3C2443_GPL3, S3C2450_GPL3_SD1DAT3);
}
break;
default:
break;
}
}
EXPORT_SYMBOL_GPL(hsmmc_set_gpio);
#define HOST_CAPS (MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE | \
MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED)
/* Channel 0 : added HS-MMC channel */
struct s3c_hsmmc_cfg s3c_hsmmc0_platform = {
.hwport = 0,
.enabled = 1,
.host_caps = 0xF ,
.bus_width = 4,
.highspeed = 0,
/* ctrl for mmc */
.fd_ctrl[MMC_MODE_MMC] = {
.ctrl2 = 0xC0000100, /* ctrl2 for mmc */
.ctrl3[SPEED_NORMAL] = 0, /* ctrl3 for low speed */
.ctrl3[SPEED_HIGH] = 0, /* ctrl3 for high speed */
.ctrl4 = 0x3,
},
/* ctrl for sd */
.fd_ctrl[MMC_MODE_SD] = {
.ctrl2 = 0xC0000100, /* ctrl2 for sd */
.ctrl3[SPEED_NORMAL] = 0, /* ctrl3 for low speed */
.ctrl3[SPEED_HIGH] = 0, /* ctrl3 for high speed */
.ctrl4 = 0x3,
},
.clk_name[0] = "hsmmc", /* 1st clock source */
.clk_name[1] = "esysclk", /* 2nd clock source hsmmc-epll by Ben Dooks */
.clk_name[2] = "hsmmc-ext", /* 3rd clock source */
};
/* Channel 1 : default HS-MMC channel */
struct s3c_hsmmc_cfg s3c_hsmmc1_platform = {
.hwport = 1,
.enabled = 1,
.host_caps = 0xF ,
.bus_width = 8,
.highspeed = 0,
/* ctrl for mmc */
.fd_ctrl[MMC_MODE_MMC] = {
.ctrl2 = 0xC0000100, /* ctrl2 for mmc */
.ctrl3[SPEED_NORMAL] = 0, /* ctrl3 for low speed */
.ctrl3[SPEED_HIGH] = 0, /* ctrl3 for high speed */
.ctrl4 = 0x3,
},
/* ctrl for sd */
.fd_ctrl[MMC_MODE_SD] = {
.ctrl2 = 0xC0000100, /* ctrl2 for sd */
.ctrl3[SPEED_NORMAL] = 0, /* ctrl3 for low speed */
.ctrl3[SPEED_HIGH] = 0, /* ctrl3 for high speed */
.ctrl4 = 0x3,
},
.clk_name[0] = "hsmmc", /* 1st clock source */
.clk_name[1] = "esysclk", /* 2nd clock source hsmmc-epll by Ben Dooks */
.clk_name[2] = "hsmmc-ext", /* 3rd clock source */
};

View File

@ -96,8 +96,10 @@ static struct s3c2410_uartcfg smdk2416_uartcfgs[] __initdata = {
//.ucon = 0xfc5,
.ulcon = 0x03,
.ufcon = 0x51,
#ifndef CONFIG_QISDA_BK060B00
.clocks = smdk2416_serial_clocks,
.clocks_size = ARRAY_SIZE(smdk2416_serial_clocks),
#endif
},
/* IR port */
[2] = {
@ -195,12 +197,58 @@ static void smdk2416_cs89x0_set(void)
}
/* Qisda Mark Tsai, 2010/01/13 { */
static void smdk2416_power_off(void)
{
printk("[smdk2416_power_off]T-CON Off\n");
if(is_Epaper_Write_Ready())
{
//AUO T-CON Standby
msleep(100);
Epaper_Enter_Standby_Mode(1);
msleep(100);
//AUO T-CON Sleep
Epaper_Enter_Sleep_Mode(1);
msleep(5);
//Shutdown T-CON Power
Epaper_Power(0);
//Shutdown i80 of s3c
EPaper_CloseLcdPort();
//msleep(1000);
//u32PowerState = EN_EPD_DEVICE_POWER_STATE_D3;
}
printk("[smdk2416_power_off]Power Off\n");
writeb(0x0, 0xc8a30029);
msleep(100);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPG14_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG14, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG0, 0);
#endif
}
/* Qisda Mark Tsai, 2010/01/13 } */
static void __init smdk2416_machine_init(void)
{
/* SROM init for NFS */
smdk2416_cs89x0_set();
smdk_machine_init();
/* Qisda Mark Tsai, 2010/01/13 { */
pm_power_off = smdk2416_power_off;
/* Qisda Mark Tsai, 2010/01/13 } */
}
static void __init smdk2416_fixup (struct machine_desc *desc, struct tag *tags,

View File

@ -1,4 +1,4 @@
/* linux/arch/arm/mach-s3c2450/pm.c
/* linux/arch/arm/mach-s3c2416/pm.c
*
* Copyright (c) 2006 Simtec Electronics
* Ben Dooks <ben@simtec.co.uk>
@ -35,22 +35,30 @@
#include <asm/plat-s3c24xx/cpu.h>
#include <asm/plat-s3c24xx/pm.h>
#include <asm/plat-s3c24xx/s3c2450.h>
#include <asm/plat-s3c24xx/s3c2416.h>
#include <asm/gpio.h>
#ifdef CONFIG_PM_CPU_MODE
extern unsigned char pm_cpu_mode;
#endif
static void s3c2450_cpu_suspend(void)
static void s3c2416_cpu_suspend(void)
{
//unsigned long tmp;
unsigned long tmp;
#if 0
/* This is the USB driver work not PM */
/* USB Physical power */
__raw_writel(__raw_readl(S3C2443_PHYPWR) | 0xf, S3C2443_PHYPWR);
/* USB Suspend mode */
__raw_writel(__raw_readl(S3C2410_MISCCR)|(1<<12)|(1<<13), S3C2410_MISCCR);
#endif
#if 0
/* What the heck??? We configure (even badly) MASK & PENDING ints, and we
* set them after to a more bad value ???? */
__raw_writel(0xffffffff, S3C2410_INTMSK);
__raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND);
__raw_writel(__raw_readl(S3C2410_INTPND), S3C2410_INTPND);
@ -59,35 +67,80 @@ static void s3c2450_cpu_suspend(void)
__raw_writel(0xffffffff, S3C2410_EINTMASK);
__raw_writel(0xffffffff, S3C2410_SRCPND);
__raw_writel(0xffffffff, S3C2410_INTPND);
__raw_writel((0xffffffff & ~((1<<0) | (1<<3) | (1<<30))) , S3C2410_INTMSK);
#endif
/* TODO: Need verification */
__raw_writel(0xff80, S3C2443_RSTCON);
__raw_writel(0xffff, S3C2443_OSCSET);
/* ack any outstanding external interrupts before we go to sleep */
__raw_writel((0xffffffff & ~((1<<0) | (1<<3) | (1<<30))) , S3C2410_INTMSK);
__raw_writel(__raw_readl(S3C2410_EINTPEND), S3C2410_EINTPEND);
__raw_writel(__raw_readl(S3C2410_INTPND), S3C2410_INTPND);
__raw_writel(__raw_readl(S3C2410_SRCPND), S3C2410_SRCPND);
/* Allow wakeup even if BATT_FLT is asserted */
__raw_writel( (1<<15), S3C2443_PWRCFG);
#if 0
/* Test */
/* shutdown as many device as possible */
/* Disable USB power */
/* Disable SD Power */
tmp = __raw_readl(S3C2410_GPHCON);
tmp &= ~((3<<28)|(3<<8));
tmp |= (1<<28)|(1<<8);
__raw_writel(tmp, S3C2410_GPHCON);
tmp = __raw_readl(S3C2410_GPHUP);
tmp &= ~((3<<28)|(3<<8));
__raw_writel(tmp, S3C2410_GPHUP);
tmp = __raw_readl(S3C2410_GPHDAT);
tmp &= ~((1<<14)|(1<<4));
__raw_writel(tmp, S3C2410_GPHDAT);
/* Disable TCON power */
tmp = __raw_readl(S3C2410_GPBCON);
tmp &= ~((3<<6));
tmp |= (1<<6);
__raw_writel(tmp, S3C2410_GPBCON);
tmp = __raw_readl(S3C2410_GPBUP);
tmp &= ~((3<<6));
__raw_writel(tmp, S3C2410_GPBUP);
tmp = __raw_readl(S3C2410_GPBDAT);
tmp &= ~(1<<3);
__raw_writel(tmp, S3C2410_GPBDAT);
/* Disable Touch power */
/* Disable wifi/bt power */
tmp = __raw_readl(S3C2410_GPDCON);
tmp &= ~((3<<20)|(3<22));
tmp |= (1<<20)|(1<<22);
__raw_writel(tmp, S3C2410_GPDCON);
tmp = __raw_readl(S3C2410_GPDUP);
tmp &= ~((3<<20)|(3<<22));
__raw_writel(tmp, S3C2410_GPDUP);
tmp = __raw_readl(S3C2410_GPDDAT);
tmp &= ~((1<<11)|(1<<10));
__raw_writel(tmp, S3C2410_GPDDAT);
#endif
#ifdef CONFIG_PM_CPU_MODE
/* set our standby method to sleep */
switch(pm_cpu_mode){
switch(pm_cpu_mode)
{
case PM_CPU_DEVICE_MODE_SUSPEND:
__raw_writel(0x2BED, S3C2443_PWRMODE);
break;
case PM_CPU_MODE_STOP:
__raw_writel(((__raw_readl(S3C2443_PWRMODE) & ~(1<<16))| (1<<16)), S3C2443_PWRMODE);
break;
case PM_CPU_MODE_DEEP_STOP:
__raw_writel(((__raw_readl(S3C2443_PWRCFG) & ~(1<<16))| (1<<16)), S3C2443_PWRCFG);
__raw_writel(((__raw_readl(S3C2443_PWRMODE) & ~(1<<16))| (1<<16)), S3C2443_PWRMODE);
break;
case PM_CPU_MODE_IDLE:
__raw_writel(((__raw_readl(S3C2443_PWRCFG) & ~(1<<17))| (1<<17)), S3C2443_PWRCFG);
asm("mcr p15, 0, r0, c7, c0, 4"); /* wait for interrupt */
asm("mcr p15, 0, r0, c7, c0, 4"); /* wait for interrupt "STANDBYWFI" */
break;
case PM_CPU_MODE_SLEEP:
__raw_writel(0x2BED, S3C2443_PWRMODE);
@ -101,90 +154,52 @@ static void s3c2450_cpu_suspend(void)
#endif
}
static void s3c2450_pm_prepare(void)
static void s3c2416_pm_prepare(void)
{
int ret;
/* set flag to wake up */
__raw_writel(0x2BED, S3C2443_INFORM0);
/* memory auto-detect configuration for u-boot side wake-up */
ret = __raw_readl(S3C2410_BWSCON) & S3C2410_MEMCFG_MASK;
if(ret == S3C2410_MEMCFG_MDDR)
__raw_writel(0xDD, S3C2443_INFORM2); /* mDDR */
else if(ret == S3C2410_MEMCFG_MSDR)
__raw_writel(0xDA, S3C2443_INFORM2); /* mSDRAM */
else if(ret == S3C2410_MEMCFG_DDR2)
panic("DDR2 is not supported at u-boot");
else
panic("memory setup is not correct?");
/* Set Power_Mode to low */
//s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPD12_OUTP); /* <- D12 should already be configured */
/* TODO: have a "charger/battery driver" (maybe inside the USB driver?) */
s3c2410_gpio_setpin(S3C2410_GPD12, 0);
}
static int s3c2450_pm_add(struct sys_device *sysdev)
static int s3c2416_pm_add(struct sys_device *sysdev)
{
pm_cpu_prep = s3c2450_pm_prepare;
pm_cpu_sleep = s3c2450_cpu_suspend;
pm_cpu_prep = s3c2416_pm_prepare;
pm_cpu_sleep = s3c2416_cpu_suspend;
return 0;
}
static struct sleep_save s3c2450_sleep[] = {
// SAVE_ITEM(S3C2450_DSC0),
// SAVE_ITEM(S3C2450_DSC1),
// SAVE_ITEM(S3C2413_GPJDAT),
// SAVE_ITEM(S2C2413_GPJCON),
// SAVE_ITEM(S3C2413_GPJUP),
/* save the PWRCFG to get back to original sleep method */
// SAVE_ITEM(S3C2443_PWRMODE),
/* save the sleep configuration anyway, just in case these
* get damaged during wakeup */
// SAVE_ITEM(S3C2450_GPBSLPCON),
// SAVE_ITEM(S3C2450_GPCSLPCON),
// SAVE_ITEM(S3C2450_GPDSLPCON),
// SAVE_ITEM(S3C2450_GPESLPCON),
// SAVE_ITEM(S3C2450_GPFSLPCON),
// SAVE_ITEM(S3C2450_GPGSLPCON),
// SAVE_ITEM(S3C2450_GPHSLPCON),
// SAVE_ITEM(S3C2413_GPJSLPCON),
};
static int s3c2450_pm_suspend(struct sys_device *dev, pm_message_t state)
static int s3c2416_pm_suspend(struct sys_device *dev, pm_message_t state)
{
s3c2410_pm_do_save(s3c2450_sleep, ARRAY_SIZE(s3c2450_sleep));
return 0;
}
static int s3c2450_pm_resume(struct sys_device *dev)
static int s3c2416_pm_resume(struct sys_device *dev)
{
// unsigned long tmp;
// tmp = __raw_readl(S3C2443_RSTCON);
// tmp |= (1<<16);
// __raw_writel(tmp, S3C2443_RSTCON);
// __raw_writel(0, S3C2443_PWRMODE);
__raw_writel(0x0, S3C2443_INFORM0);
__raw_writel(0x0, S3C2443_INFORM2);
s3c2410_pm_do_restore(s3c2450_sleep, ARRAY_SIZE(s3c2450_sleep));
/* set PowerMode as high */
// s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPD12_OUTP); /* <- D12 should already be configured */
s3c2410_gpio_setpin(S3C2410_GPD12, 1);
return 0;
}
static struct sysdev_driver s3c2450_pm_driver = {
.add = s3c2450_pm_add,
.suspend = s3c2450_pm_suspend,
.resume = s3c2450_pm_resume,
static struct sysdev_driver s3c2416_pm_driver = {
.add = s3c2416_pm_add,
.suspend = s3c2416_pm_suspend,
.resume = s3c2416_pm_resume,
};
static __init int s3c2450_pm_init(void)
static __init int s3c2416_pm_init(void)
{
return sysdev_driver_register(&s3c2416_sysclass, &s3c2450_pm_driver);
return sysdev_driver_register(&s3c2416_sysclass, &s3c2416_pm_driver);
}
arch_initcall(s3c2450_pm_init);
arch_initcall(s3c2416_pm_init);

View File

@ -43,65 +43,56 @@
#include <asm/plat-s3c24xx/devs.h>
#include <asm/plat-s3c24xx/pm.h>
/*Qisda , wenny cheng , 20091224 , board id info {*/
int board_id = 0;
/*Qisda , wenny cheng , 20091224 , board id info }*/
/* LED devices */
static struct s3c24xx_led_platdata smdk_pdata_led4 = {
.gpio = S3C2410_GPF4,
static struct s3c24xx_led_platdata smdk_pdata_led0 = {
.gpio = S3C2410_GPH12,
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.name = "led4",
.def_trigger = "timer",
.name = "led0",
.def_trigger = "power",
};
static struct s3c24xx_led_platdata smdk_pdata_led5 = {
.gpio = S3C2410_GPF5,
/*static struct s3c24xx_led_platdata smdk_pdata_led1 = {
.gpio = S3C_GPK8,
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.name = "led5",
.def_trigger = "nand-disk",
.name = "led1",
.def_trigger = "bluetooth",
};
static struct s3c24xx_led_platdata smdk_pdata_led6 = {
.gpio = S3C2410_GPF6,
static struct s3c24xx_led_platdata smdk_pdata_led2 = {
.gpio = S3C_GPK9,
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.name = "led6",
};
.def_trigger = "wifi",
};*/
static struct s3c24xx_led_platdata smdk_pdata_led7 = {
.gpio = S3C2410_GPF7,
.flags = S3C24XX_LEDF_ACTLOW | S3C24XX_LEDF_TRISTATE,
.name = "led7",
};
static struct platform_device smdk_led4 = {
static struct platform_device smdk_led0 = {
.name = "s3c24xx_led",
.id = 0,
.dev = {
.platform_data = &smdk_pdata_led4,
.platform_data = &smdk_pdata_led0,
},
};
static struct platform_device smdk_led5 = {
/*static struct platform_device smdk_led1 = {
.name = "s3c24xx_led",
.id = 1,
.dev = {
.platform_data = &smdk_pdata_led5,
.platform_data = &smdk_pdata_led1,
},
};
static struct platform_device smdk_led6 = {
static struct platform_device smdk_led2 = {
.name = "s3c24xx_led",
.id = 2,
.dev = {
.platform_data = &smdk_pdata_led6,
.platform_data = &smdk_pdata_led2,
},
};
static struct platform_device smdk_led7 = {
.name = "s3c24xx_led",
.id = 3,
.dev = {
.platform_data = &smdk_pdata_led7,
},
};
};*/
/* NAND parititon from 2.4.18-swl5 */
@ -230,15 +221,51 @@ static struct s3c2410_platform_nand smdk_nand_info = {
static struct platform_device __initdata *smdk_devs[] = {
&s3c_device_nand,
&s3c_device_onenand,
&smdk_led4,
&smdk_led5,
&smdk_led6,
&smdk_led7,
&smdk_led0,
/* &smdk_led1,
&smdk_led2,*/
};
void __init smdk_machine_init(void)
{
/* Configure the LEDs (even if we have no LED support)*/
/*Qisda , wenny cheng , 20091224 , board id info {*/
//writel((readl(S3C2416_GPKCON) & ~(3<<18)), S3C2416_GPKCON);
//writel((readl(S3C2416_GPKUDP) & ~(3<<18)), S3C2416_GPKUDP);
//writel((readl(S3C2416_GPKCON) & ~(3<<16)), S3C2416_GPKCON);
//writel((readl(S3C2416_GPKUDP) & ~(3<<16)), S3C2416_GPKUDP);
//writel((readl(S3C2410_GPHCON) & ~(3<<24)), S3C2410_GPHCON);
//writel((readl(S3C2410_GPHUP) & ~(3<<24)), S3C2410_GPHUP);
#ifdef CONFIG_QISDA_BQ060B00_DVT
if((readl(S3C2416_GPKDAT) & (1<<1))){
board_id = BQ060B00_A02;
}
else{
board_id = BQ060B00_A01_And_Before;
}
#elif defined(CONFIG_QISDA_QD090B00)
if((readl(S3C2416_GPKDAT) & (1<<3))){
board_id = QD090B00_S03;
}
else{
board_id = QD090B00_S02;
}
#else
if((readl(S3C2416_GPKDAT) & (1<<1))){
board_id = QD060B00_A02;
}
else{
board_id = QD060B00_A01_And_Before;
}
#endif
//printk("\nsmdk_machine_init: %d\n", as090b00_board_id);
/*Qisda , wenny cheng , 20091224 , board id info }*/
//Qisda, Leo SJ Yang, 2009/08/14, re{
// remove gpio configuration that doesn't need in EVT2
#ifdef CONFIG_QISDA_E600_EVT0
@ -269,6 +296,9 @@ void __init smdk_machine_init(void)
#ifdef CONFIG_QISDA_E600_EVT0
writel((readl(S3C2416_GPKCON) & ~(1<<5) | (1<<4)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<2)), S3C2416_GPKDAT);
#elif CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);

View File

@ -41,6 +41,13 @@
#include <asm/io.h>
#include <asm/arch/regs-serial.h>
/*Qisda , wenny cheng , 20091224 , board id info {*/
#include <../include/asm-arm/plat-s3c24xx/common-smdk.h>
/*Qisda , wenny cheng , 20091224 , board id info }*/
/*Qisda Qube, suspend mode gpio config 20091117*/
#include <asm/arch/regs-mem.h>
/*Qisda Qube, suspend mode gpio config 20091117*/
#if defined (CONFIG_CPU_S3C6400)
#include <asm/arch/regs-s3c6400-clock.h>
@ -54,6 +61,41 @@
#include <asm/arch/regs-clock.h>
#endif
/*Qisda Qube, suspend mode gpio config 20091117*/
#define S3C2410_GPIO_BANKM (32*16)
#define S3C2410_GPMCON S3C2410_GPIOREG(0x100)
#define S3C2410_GPMDAT S3C2410_GPIOREG(0x104)
#define S3C2410_GPMUP S3C2410_GPIOREG(0x108)
#define S3C2410_GPMSEL S3C2410_GPIOREG(0x10C)
#define S3C2410_GPM0 S3C2410_GPIONO(S3C2410_GPIO_BANKM, 0)
#define S3C2410_GPM0_INP (0x00 << 0)
#define S3C2410_GPM1 S3C2410_GPIONO(S3C2410_GPIO_BANKM, 1)
#define S3C2410_GPM1_INP (0x00 << 2)
#define S3C2410_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR)
#define S3C_CLKREG(x) ((x) + S3C24XX_VA_SYSCON)
#define S3C2410_LOCKTIME S3C2410_CLKREG(0x00)
#define S3C24XX_LOCKTIME0 S3C_CLKREG(0x00)
#define S3C24XX_LOCKTIME1 S3C_CLKREG(0x04)
#define S3C2410_MPLLCON S3C2410_CLKREG(0x04)
#define S3C2410_UPLLCON S3C2410_CLKREG(0x08)
#define S3C2410_CLKCON S3C2410_CLKREG(0x0C)
#define S3C2410_CLKSLOW S3C2410_CLKREG(0x10)
#define S3C2410_CLKDIVN S3C2410_CLKREG(0x14)
void pm_gpio_setting_enhancement (void);
#if 0
void test_message(void);
#endif
/*Qisda Qube, suspend mode gpio config 20091117*/
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-gpioj.h>
#include <asm/arch/regs-dsc.h>
@ -79,6 +121,11 @@ extern unsigned char pm_cpu_mode;
#endif
/* } Qisda, ShiYong Lin, 2009/08/18, Wake up source */
/* 2010/1/21, weichen, for handling events during suspend */
#if defined (CONFIG_PM_PLATFORM_POWER_SAVING)
extern unsigned int g_wakeup_event_occurs;
#endif
/* for external use */
unsigned long s3c_pm_flags;
@ -104,6 +151,19 @@ static struct sleep_save core_save[] = {
SAVE_ITEM(S3C2443_PCLKCON),
SAVE_ITEM(S3C2443_SCLKCON),
/*Qisda Qube, suspend mode kernel panic 20091117*/
//s3c2416 dram config 0,4,8,c,10
SAVE_ITEM(S3C2410_BWSCON),
SAVE_ITEM(S3C2410_BANKCON0),
SAVE_ITEM(S3C2410_BANKCON1),
SAVE_ITEM(S3C2410_BANKCON2),
SAVE_ITEM(S3C2410_BANKCON3),
SAVE_ITEM(S3C2410_BANKCON4),
/*Qisda Qube, suspend mode gpio config 20091117*/
/*Qisda Qube, suspend mode kernel panic 20091117*/
#else
SAVE_ITEM(S3C2410_LOCKTIME),
SAVE_ITEM(S3C2410_CLKCON),
@ -715,7 +775,6 @@ static void s3c2410_pm_show_resume_irqs(int start, unsigned long which,
}
#if !defined (CONFIG_CPU_S3C6400) && !defined (CONFIG_CPU_S3C6410)
#if !defined(CONFIG_CPU_S3C2450) && !defined(CONFIG_CPU_S3C2416)
/* s3c2410_pm_check_resume_pin
*
* check to see if the pin is configured correctly for sleep mode, and
@ -746,581 +805,15 @@ static void s3c2410_pm_check_resume_pin(unsigned int pin, unsigned int irqoffs)
}
}
#endif
/* s3c2410_pm_configure_extint
*
* configure all external interrupt pins
*/
/* Qisda, ShiYong Lin, 2009/09/08, Wake up source {*/
void set_system_off_wkup_srce(void)
{
printk("Set_system_off_wkup_srce\n");
#ifdef CONFIG_QISDA_AS090B00_EVT1
// Power button, GPF0
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
// The insertion of SD card, GPF1
s3c2410_gpio_cfgpin(S3C2410_GPF1, S3C2410_GPF1_INP);
s3c2410_gpio_pullup(S3C2410_GPF1, 2);
// TP_INT, GPF2
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
// SPI_INT, GPF3
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP);
s3c2410_gpio_pullup(S3C2410_GPF3, 2);
// The insertion of earphone, GPF4
s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_INP);
s3c2410_gpio_pullup(S3C2410_GPF4, 2);
// Touch_EN, GPF5
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
// FUNCTION key, GPF6
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_INP);
s3c2410_gpio_pullup(S3C2410_GPF6, 2);
// Pagedown key, GPF7
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_INP);
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
#if 0
// P_KEEP, GPG0, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_EINT8);
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<3)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<0))|(2<<0)), S3C2410_EXTINT1);
#endif
// VBUS_IN_STA, GPG1, need to open when EVT2
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 0);
#if 0
// Audio_resetn pin, GPG3, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_EINT11);
s3c2410_gpio_pullup(S3C2410_GPG3, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<15)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<12))|(2<<12)), S3C2410_EXTINT1);
#endif
#if 0
// WLAN_MAC_wake, GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP);
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
#endif
// Power_Fail, GPG5, need to open when EVT2
// active low
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(2<<20)), S3C2410_EXTINT1);
// Library, GPG6
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_INP);
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
// Page up key, GPG7
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_INP);
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
/* Qisda, ShiYong Lin, 2009/09/25, Power consumption {*/
s3c2410_gpio_cfgpin(S3C2410_GPL13, S3C2410_GPL13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
/* } Qisda, ShiYong Lin, 2009/09/25, Power consumption */
#elif defined (CONFIG_QISDA_AS090B00_EVT1_1) || defined (CONFIG_QISDA_QD090B00_EVT1) || defined(CONFIG_QISDA_QD060N00_DVT1_1)
// Power button, GPF0
printk("Set_system_off_wkup_srce, CONFIG_QISDA_AS090B00_EVT1_1\n");
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
// The insertion of SD card, GPF1
s3c2410_gpio_cfgpin(S3C2410_GPF1, S3C2410_GPF1_INP);
s3c2410_gpio_pullup(S3C2410_GPF1, 2);
// TP_INT, GPF2
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
// SPI_INT, GPF3
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP);
s3c2410_gpio_pullup(S3C2410_GPF3, 2);
// The insertion of earphone, GPF4
s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_INP);
s3c2410_gpio_pullup(S3C2410_GPF4, 2);
// Touch_EN, GPF5
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
// CHG_STA key, GPF6
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_INP);
s3c2410_gpio_pullup(S3C2410_GPF6, 0);
// Pagedown key, GPF7
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_INP);
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
#if 0
// P_KEEP, GPG0, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_EINT8);
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<3)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<0))|(2<<0)), S3C2410_EXTINT1);
#endif
// VBUS_IN_STA, GPG1
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
// SD power, GPG2
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 0);
// 3G ON-OFF, GPG3
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG3, 0);
// WLAN_MAC_wake, GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP);
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
// Power_Fail, GPG5, need to open when EVT2
// active low
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(2<<20)), S3C2410_EXTINT1);
// Function, GPG6
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_INP);
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
// PageUp key, GPG7
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_INP);
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
/* Qisda, ShiYong Lin, 2009/09/25, Power consumption {*/
s3c2410_gpio_cfgpin(S3C2410_GPL13, S3C2410_GPL13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
/* } Qisda, ShiYong Lin, 2009/09/25, Power consumption */
#else
// Power button, GPF0
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
// The insertion of SD card, GPF1
s3c2410_gpio_cfgpin(S3C2410_GPF1, S3C2410_GPF1_INP);
s3c2410_gpio_pullup(S3C2410_GPF1, 2);
// The touch panel, GPF2
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
// Menu key, GPF3
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP);
s3c2410_gpio_pullup(S3C2410_GPF3, 2);
// The insertion of earphone, GPF4
s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_INP);
s3c2410_gpio_pullup(S3C2410_GPF4, 2);
// Touch_EN, GPF5
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
// Search key, GPF6
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_INP);
s3c2410_gpio_pullup(S3C2410_GPF6, 2);
// Pagedown key, GPF7
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_INP);
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
#if 0
// P_KEEP, GPG0, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_EINT8);
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<3)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<0))|(2<<0)), S3C2410_EXTINT1);
#endif
// CHG_STA, GPG1, need to open when EVT2
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
#if 0
// T_SENSOR1, GPG2, need to open when EVT2
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_EINT10);
s3c2410_gpio_pullup(S3C2410_GPG2, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<11)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<8))|(2<<8)), S3C2410_EXTINT1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_EINT10);
s3c2410_gpio_pullup(S3C2410_GPG2, 0);
#endif
#if 0
// PI2C_EN pin, GPG3, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_EINT11);
s3c2410_gpio_pullup(S3C2410_GPG3, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<15)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<12))|(2<<12)), S3C2410_EXTINT1);
#endif
// Return key, GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP);
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
// Power_Fail, GPG5, need to open when EVT2
// active low
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(2<<20)), S3C2410_EXTINT1);
#if 0
// EN2, GPG6
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_EINT14);
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT1) & ~(7<<24))|(2<<24)), S3C2410_EXTINT0);
#endif
// Page up key, GPG7
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_INP);
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
#endif
}
void set_system_sleep_wkup_srce(void)
{
printk("Set_system_sleep_wkup_srce\n");
#ifdef CONFIG_QISDA_AS090B00_EVT1
// Power button, GPF0
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
// The insertion of SD card, GPF1
s3c2410_gpio_cfgpin(S3C2410_GPF1, S3C2410_GPF1_EINT1);
s3c2410_gpio_pullup(S3C2410_GPF1, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<7)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<4))|(6<<4)), S3C2410_EXTINT0);
// TP_INT, GPF2
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<11)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<8))|(2<<8)), S3C2410_EXTINT0);
#if 0
// SPI_INT, GPF3
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
s3c2410_gpio_pullup(S3C2410_GPF3, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<15)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<12))|(2<<12)), S3C2410_EXTINT0);
#endif
// The insertion of earphone, GPF4
s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_EINT4);
s3c2410_gpio_pullup(S3C2410_GPF4, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<19)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<16))|(6<<16)), S3C2410_EXTINT0);
// Touch_EN, GPF5
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
// Function key, GPF6
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_EINT6);
s3c2410_gpio_pullup(S3C2410_GPF6, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<24))|(6<<24)), S3C2410_EXTINT0);
// Pagedown key, GPF7
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_EINT7);
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<31)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<28))|(6<<28)), S3C2410_EXTINT0);
#if 0
// P_KEEP, GPG0, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_EINT8);
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<3)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<0))|(2<<0)), S3C2410_EXTINT1);
#endif
// VBUS_IN_STA, GPG1
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
// PWREN_SD, GPG2
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 0);
#if 0
// Audio_resetn pin, GPG3, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_EINT11);
s3c2410_gpio_pullup(S3C2410_GPG3, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<15)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<12))|(2<<12)), S3C2410_EXTINT1);
#endif
#if 0
// WLAN_MAC_Wake key, GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_EINT12);
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<19)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<16))|(2<<16)), S3C2410_EXTINT1);
#endif
// Power_Fail, GPG5
// active low
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(2<<20)), S3C2410_EXTINT1);
// Library, GPG6
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_EINT14);
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT1) & ~(7<<24))|(6<<24)), S3C2410_EXTINT0);
// Page up key, GPG7
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_EINT15);
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<31)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<28))|(6<<28)), S3C2410_EXTINT1);
/* Qisda, ShiYong Lin, 2009/09/25, Power consumption {*/
s3c2410_gpio_cfgpin(S3C2410_GPL13, S3C2410_GPL13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
/* } Qisda, ShiYong Lin, 2009/09/25, Power consumption */
#elif defined (CONFIG_QISDA_AS090B00_EVT1_1) || defined (CONFIG_QISDA_QD090B00_EVT1) || defined(CONFIG_QISDA_QD060N00_DVT1_1)
// Power button, GPF0
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
// The insertion of SD card, GPF1
s3c2410_gpio_cfgpin(S3C2410_GPF1, S3C2410_GPF1_INP);
s3c2410_gpio_pullup(S3C2410_GPF1, 2);
// TP_INT, GPF2
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<11)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<8))|(2<<8)), S3C2410_EXTINT0);
// SPI_INT, GPF3
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP);
s3c2410_gpio_pullup(S3C2410_GPF3, 2);
// The insertion of earphone, GPF4
s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_INP);
s3c2410_gpio_pullup(S3C2410_GPF4, 2);
// Touch_EN, GPF5
// s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
// s3c2410_gpio_setpin(S3C2410_GPF5, 0);
// CHG_STA key, GPF6
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_INP);
s3c2410_gpio_pullup(S3C2410_GPF6, 0);
// Pagedown key, GPF7
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_EINT7);
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<31)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<28))|(6<<28)), S3C2410_EXTINT0);
#if 0
// P_KEEP, GPG0, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_EINT8);
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<3)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<0))|(2<<0)), S3C2410_EXTINT1);
#endif
// VBUS_IN_STA, GPG1
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 0);
// 3G_ON_OFF pin, GPG3
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG3, 0);
#if 0
// WLAN_MAC_Wake key, GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_EINT12);
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<19)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<16))|(2<<16)), S3C2410_EXTINT1);
#endif
// Power_Fail, GPG5
// active low
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(2<<20)), S3C2410_EXTINT1);
// Function, GPG6
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_EINT14);
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT1) & ~(7<<24))|(6<<24)), S3C2410_EXTINT0);
// Pageup key, GPG7
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_EINT15);
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<31)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<28))|(6<<28)), S3C2410_EXTINT1);
/* Qisda, ShiYong Lin, 2009/09/25, Power consumption {*/
s3c2410_gpio_cfgpin(S3C2410_GPL13, S3C2410_GPL13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
/* } Qisda, ShiYong Lin, 2009/09/25, Power consumption */
#else
//other project
// Power button, GPF0
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
// The insertion of SD card, GPF1
s3c2410_gpio_cfgpin(S3C2410_GPF1, S3C2410_GPF1_INP);
s3c2410_gpio_pullup(S3C2410_GPF1, 0);
// The touch panel, GPF2
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 0);
// Menu key, GPF3
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
s3c2410_gpio_pullup(S3C2410_GPF3, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<15)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<12))|(6<<12)), S3C2410_EXTINT0);
// The insertion of earphone, GPF4
s3c2410_gpio_cfgpin(S3C2410_GPF4, S3C2410_GPF4_EINT4);
s3c2410_gpio_pullup(S3C2410_GPF4, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<19)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<16))|(6<<16)), S3C2410_EXTINT0);
// Touch_EN, GPF5
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
// Search key, GPF6
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_EINT6);
s3c2410_gpio_pullup(S3C2410_GPF6, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<24))|(6<<24)), S3C2410_EXTINT0);
// Pagedown key, GPF7
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_EINT7);
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
writel((readl(S3C2410_EXTINT0) & ~(1<<31)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<28))|(6<<28)), S3C2410_EXTINT0);
#if 0
// P_KEEP, GPG0, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_EINT8);
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<3)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<0))|(2<<0)), S3C2410_EXTINT1);
#endif
// CHG_STA, GPG1
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_INP);
s3c2410_gpio_pullup(S3C2410_GPG2, 0);
#if 0
// PI2C_EN pin, GPG3, needn't open
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_EINT11);
s3c2410_gpio_pullup(S3C2410_GPG3, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<15)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<12))|(2<<12)), S3C2410_EXTINT1);
#endif
// Return key, GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_EINT12);
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<19)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<16))|(6<<16)), S3C2410_EXTINT1);
// Power_Fail, GPG5
// active low
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(2<<20)), S3C2410_EXTINT1);
#if 0
// EN2, GPG6
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_EINT14);
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT1) & ~(7<<24))|(2<<24)), S3C2410_EXTINT0);
#endif
// Page up key, GPG7
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_EINT15);
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<31)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<28))|(6<<28)), S3C2410_EXTINT1);
#endif
}
/* } Qisda, ShiYong Lin, 2009/09/08, Wake up source */
static void s3c2410_pm_configure_extint(void)
{
#if !defined(CONFIG_CPU_S3C2450) && !defined(CONFIG_CPU_S3C2416)
int pin;
/* for each of the external interrupts (EINT0..EINT15) we
@ -1335,57 +828,8 @@ static void s3c2410_pm_configure_extint(void)
for (pin = S3C2410_GPG0; pin <= S3C2410_GPG7; pin++) {
s3c2410_pm_check_resume_pin(pin, (pin - S3C2410_GPG0)+8);
}
#else
/* Qisda, ShiYong Lin, 2009/08/18, Wake up source {*/
#if 0
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0);
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
s3c2410_gpio_pullup(S3C2410_GPF0, 0);
s3c2410_gpio_pullup(S3C2410_GPF3, 0);
/* EINT0 filter enable */
writel((readl(S3C2410_EXTINT0) & ~(1<<3)), S3C2410_EXTINT0);
/* EINT3 filter enable */
writel((readl(S3C2410_EXTINT0) & ~(1<<15)), S3C2410_EXTINT0);
/* EINT0 falling edge triggered */
writel(((readl(S3C2410_EXTINT0) & ~(7<<0))|(2<<0)), S3C2410_EXTINT0);
/* EINT3 falling edge triggered */
writel(((readl(S3C2410_EXTINT0) & ~(7<<12))|(2<<12)), S3C2410_EXTINT0);
#else
if( wkup_srce == SYSTEM_OFF_STATE)
{
// System power off ( fake to power off)
// Wake up source
// 1. The long press of the power button
// 2. The insertion of the charger and USB (CHG_STA)
// 3. Power fail
set_system_off_wkup_srce();
}
else if (wkup_srce == SYSTEM_SLEEP_STATE)
{
// System sleep
// Wake up source
// 1. The short or long press of the power button
// 2. The insertion of the charger and USB (CHG_STA)
// 3. Menu, Search, Page_down,Page up, and return
// 4. Touch
// 5. The insertion of the Earphone
set_system_sleep_wkup_srce();
}
else
{
set_system_off_wkup_srce();
}
#endif
/* } Qisda, ShiYong Lin, 2009/08/18, Wake up source */
#endif
}
#else
#else /* !defined (CONFIG_CPU_S3C6400) && !defined (CONFIG_CPU_S3C6410) */
#if 0
extern int s3c_irqext_type(unsigned int irq, unsigned int type);
extern void s3c_irqext_unmaskack(unsigned int irqno);
@ -1444,7 +888,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
unsigned long regs_save[16];
/* ensure the debug is initialised (if enabled) */
s3c2410_pm_debug_init();
DBG("s3c2410_pm_enter(%d)\n", state);
@ -1461,7 +904,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
}
#endif
#if !defined(CONFIG_CPU_S3C2450) && !defined(CONFIG_CPU_S3C2416)
/* check if we have anything to wake-up with... bad things seem
* to happen if you suspend with no wakeup (system will often
* require a full power-cycle)
@ -1473,7 +915,7 @@ static int s3c2410_pm_enter(suspend_state_t state)
printk(KERN_ERR PFX "Aborting sleep\n");
return -EINVAL;
}
#endif
/* prepare check area if configured */
s3c2410_pm_check_prepare();
@ -1489,6 +931,7 @@ static int s3c2410_pm_enter(suspend_state_t state)
s3c2410_pm_do_save(gpio_save, ARRAY_SIZE(gpio_save));
s3c2410_pm_do_save(core_save, ARRAY_SIZE(core_save));
s3c2410_pm_do_save(uart_save, ARRAY_SIZE(uart_save));
#if defined(CONFIG_CPU_S3C2450) || defined(CONFIG_CPU_S3C2416)
s3c2410_pm_do_save(irq_save, ARRAY_SIZE(irq_save));
s3c2410_pm_do_save(smc_save, ARRAY_SIZE(smc_save));
@ -1500,27 +943,6 @@ static int s3c2410_pm_enter(suspend_state_t state)
/* set the irq configuration for wake */
s3c2410_pm_configure_extint();
/* Qisda, ShiYong Lin, 2009/11/02, Set En1 and En2 based on charging source {*/
if(charging_source!=1){
//usb or nothing
//EN2
s3c2410_gpio_cfgpin(S3C2410_GPB0, S3C2410_GPB0_OUTP);
s3c2410_gpio_setpin(S3C2410_GPB0, 0);
//EN1
s3c2410_gpio_cfgpin(S3C2410_GPB4, S3C2410_GPB4_OUTP);
s3c2410_gpio_setpin(S3C2410_GPB4, 1);
}
else{
//charger
//EN2
s3c2410_gpio_cfgpin(S3C2410_GPB0, S3C2410_GPB0_OUTP);
s3c2410_gpio_setpin(S3C2410_GPB0, 1);
//EN1
s3c2410_gpio_cfgpin(S3C2410_GPB4, S3C2410_GPB4_OUTP);
s3c2410_gpio_setpin(S3C2410_GPB4, 0);
}
/* } Qisda, ShiYong Lin, 2009/11/02, Set En1 and En2 based on charging source */
DBG("sleep: irq wakeup masks: %08lx,%08lx\n",
s3c_irqwake_intmask, s3c_irqwake_eintmask);
@ -1551,20 +973,13 @@ static int s3c2410_pm_enter(suspend_state_t state)
/* s3c2410_cpu_save will also act as our return point from when
* we resume as it saves its own register state, so use the return
* code to differentiate return from save and return from sleep */
/* Qisda, ShiYong Lin, 2009/10/27, set P_mode as high {*/
s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPD12_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD12, 0);
/* } Qisda, ShiYong Lin, 2009/10/27, Set P_mode as high */
if(s3c2410_cpu_save(regs_save) == 0) {
flush_cache_all();
pm_cpu_sleep();
}
/* Qisda, ShiYong Lin, 2009/10/27, set P_mode as high {*/
s3c2410_gpio_cfgpin(S3C2410_GPD12, S3C2410_GPD12_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD12, 1);
/* } Qisda, ShiYong Lin, 2009/10/27, Set P_mode as high */
/************************ CPU is now sleeping ... *****************************/
/* restore the cpu state */
cpu_init();
@ -1579,7 +994,7 @@ static int s3c2410_pm_enter(suspend_state_t state)
s3c2410_pm_do_restore(irq_save, ARRAY_SIZE(irq_save));
s3c2410_pm_do_restore(smc_save, ARRAY_SIZE(smc_save));
__raw_writel(0xD, S3C2443_PWRMODE);
__raw_writel(0x0, S3C2443_PWRMODE);
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.21.5-cfs-v19
# Tue Dec 22 17:57:18 2009
# Wed Apr 21 19:03:09 2010
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
@ -32,6 +32,7 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
#
# General setup
#
# CONFIG_RESCUEOS_BUILD is not set
CONFIG_LOCALVERSION=""
CONFIG_LOCALVERSION_AUTO=y
# CONFIG_SWAP is not set
@ -96,11 +97,11 @@ CONFIG_IOSCHED_NOOP=y
CONFIG_IOSCHED_AS=y
CONFIG_IOSCHED_DEADLINE=y
CONFIG_IOSCHED_CFQ=y
CONFIG_DEFAULT_AS=y
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_AS is not set
CONFIG_DEFAULT_DEADLINE=y
# CONFIG_DEFAULT_CFQ is not set
# CONFIG_DEFAULT_NOOP is not set
CONFIG_DEFAULT_IOSCHED="anticipatory"
CONFIG_DEFAULT_IOSCHED="deadline"
#
# System Type
@ -138,8 +139,6 @@ CONFIG_ARCH_S3C2410=y
CONFIG_PLAT_S3C=y
CONFIG_PLAT_S3C24XX=y
# CONFIG_PLAT_S3C64XX is not set
CONFIG_SPLIT_ROOT_FILESYSTEM=y
# CONFIG_S3C2410_BOOT_WATCHDOG is not set
# CONFIG_S3C2410_BOOT_ERROR_RESET is not set
# CONFIG_S3C2410_PM_DEBUG is not set
# CONFIG_S3C2410_PM_CHECK is not set
@ -203,8 +202,8 @@ CONFIG_S3C2416_PM=y
#
# S3C2416 Machines
#
CONFIG_MACH_SMDK2416=y
CONFIG_MACH_CYBOOK2416=y
# CONFIG_MACH_SMDK2416 is not set
CONFIG_MACH_CYBOOK_ORIZON=y
#
# S3C6400 Machines
@ -305,9 +304,10 @@ CONFIG_BINFMT_AOUT=y
#
CONFIG_PM=y
CONFIG_PM_LEGACY=y
CONFIG_PM_PLATFORM_POWER_SAVING=y
CONFIG_PM_CPU_MODE=y
# CONFIG_PM_DEBUG is not set
CONFIG_PM_SYSFS_DEPRECATED=y
# CONFIG_PM_SYSFS_DEPRECATED is not set
CONFIG_APM_EMULATION=y
#
@ -401,8 +401,27 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_IEEE80211 is not set
CONFIG_BT=m
# CONFIG_BT_L2CAP is not set
# CONFIG_BT_SCO is not set
#
# Bluetooth device drivers
#
# CONFIG_BT_HCIUSB is not set
CONFIG_BT_HCIUART=m
CONFIG_BT_HCIUART_H4=y
# CONFIG_BT_HCIUART_BCSP is not set
# CONFIG_BT_HCIBCM203X is not set
# CONFIG_BT_HCIBPA10X is not set
# CONFIG_BT_HCIBFUSB is not set
# CONFIG_BT_HCIVHCI is not set
CONFIG_IEEE80211=y
# CONFIG_IEEE80211_DEBUG is not set
# CONFIG_IEEE80211_CRYPT_WEP is not set
# CONFIG_IEEE80211_CRYPT_CCMP is not set
# CONFIG_IEEE80211_CRYPT_TKIP is not set
# CONFIG_IEEE80211_SOFTMAC is not set
CONFIG_WIRELESS_EXT=y
#
@ -412,12 +431,17 @@ CONFIG_WIRELESS_EXT=y
#
# Generic Driver Options
#
# CONFIG_QISDA_QD060B00 is not set
# CONFIG_QISDA_BQ060B00 is not set
CONFIG_QISDA_BK060B00=y
# CONFIG_QISDA_SH060B00 is not set
CONFIG_QISDA_QD060B00=y
CONFIG_QISDA_QD060N00_DVT1_1=y
# CONFIG_QISDA_E600_DVT1 is not set
# CONFIG_QISDA_E600_EVT2 is not set
# CONFIG_QISDA_E600_EVT0 is not set
# CONFIG_QISDA_QD090B00 is not set
CONFIG_QISDA_AS090B00=y
# CONFIG_QISDA_AS090B00_EVT1 is not set
CONFIG_QISDA_AS090B00_EVT1_1=y
CONFIG_QISDA_BADBLOCK_CHECK=y
# CONFIG_QISDA_AS090B00 is not set
# CONFIG_QISDA_BADBLOCK_CHECK is not set
# CONFIG_STANDALONE is not set
CONFIG_PREVENT_FIRMWARE_BUILD=y
# CONFIG_FW_LOADER is not set
@ -433,103 +457,7 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
#
# Memory Technology Devices (MTD)
#
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_CONCAT is not set
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_REDBOOT_PARTS is not set
# CONFIG_MTD_CMDLINE_PARTS is not set
# CONFIG_MTD_AFS_PARTS is not set
#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
#
# RAM/ROM/Flash chip drivers
#
CONFIG_MTD_CFI=y
CONFIG_MTD_JEDECPROBE=y
CONFIG_MTD_GEN_PROBE=y
# CONFIG_MTD_CFI_ADV_OPTIONS is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_CFI_INTELEXT is not set
# CONFIG_MTD_CFI_AMDSTD is not set
# CONFIG_MTD_CFI_STAA is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set
# CONFIG_MTD_OBSOLETE_CHIPS is not set
#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_PHYSMAP is not set
# CONFIG_MTD_ARM_INTEGRATOR is not set
# CONFIG_MTD_IMPA7 is not set
# CONFIG_MTD_PLATRAM is not set
#
# Self-contained MTD device drivers
#
# CONFIG_MTD_DATAFLASH is not set
# CONFIG_MTD_M25P80 is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLOCK2MTD is not set
#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOC2001PLUS is not set
#
# NAND Flash Device Drivers
#
CONFIG_MTD_NAND=y
# CONFIG_MTD_NAND_VERIFY_WRITE is not set
# CONFIG_MTD_NAND_ECC_SMC is not set
CONFIG_MTD_NAND_IDS=y
# CONFIG_MTD_NAND_S3C2410 is not set
CONFIG_MTD_NAND_S3C=y
# CONFIG_MTD_NAND_S3C_DEBUG is not set
CONFIG_MTD_NO_ECC_WARNING=y
CONFIG_MTD_NAND_S3C_HWECC=y
# CONFIG_MTD_NAND_S3C_FLASH_BBT is not set
# CONFIG_MTD_NAND_S3C_CACHEDPROG is not set
# CONFIG_MTD_NAND_DISKONCHIP is not set
# CONFIG_MTD_NAND_NANDSIM is not set
#
# OneNAND Flash Device Drivers
#
# CONFIG_MTD_ONENAND is not set
#
# UBI - Unsorted block images
#
# CONFIG_MTD_UBI is not set
# CONFIG_MTD is not set
#
# Parallel port support
@ -719,8 +647,8 @@ CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_GPIO is not set
# CONFIG_KEYPAD_S3C_QISDA is not set
CONFIG_CYBOOK_CYIO=y
# CONFIG_KEYPAD_S3C_QISDA is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
CONFIG_INPUT_TOUCHSCREEN=y
@ -735,7 +663,9 @@ CONFIG_INPUT_TOUCHSCREEN=y
# CONFIG_TOUCHSCREEN_TOUCHWIN is not set
# CONFIG_TOUCHSCREEN_UCB1400 is not set
CONFIG_TOUCHSCREEN_IIC_QISDA=y
# CONFIG_INPUT_MISC is not set
CONFIG_INPUT_MISC=y
# CONFIG_INPUT_UINPUT is not set
CONFIG_CYBOOK_ORIZON_TILT=y
#
# Hardware I/O ports
@ -812,7 +742,7 @@ CONFIG_WATCHDOG=y
# Watchdog Device Drivers
#
# CONFIG_SOFT_WATCHDOG is not set
CONFIG_S3C2410_WATCHDOG=y
# CONFIG_S3C2410_WATCHDOG is not set
#
# ISA-based Watchdog Cards
@ -871,6 +801,7 @@ CONFIG_I2C_S3C2410=y
# CONFIG_SENSORS_PCF8591 is not set
# CONFIG_SENSORS_MAX6875 is not set
CONFIG_QISDA_IIC=y
CONFIG_TOUCH_PM=y
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
@ -888,10 +819,6 @@ CONFIG_SPI_MASTER=y
#
# CONFIG_SPI_BITBANG is not set
# CONFIG_SPI_S3C24XX is not set
CONFIG_HS_SPI_S3C2416=m
CONFIG_SPICLK_PCLK=y
# CONFIG_SPICLK_EPLL is not set
# CONFIG_SPICLK_USBCLK is not set
#
# SPI Protocol Masters
@ -990,21 +917,12 @@ CONFIG_FB_AUOEPAPER_6=y
# CONFIG_VGA_CONSOLE is not set
# CONFIG_MDA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_FRAMEBUFFER_CONSOLE=y
# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
# CONFIG_FONTS is not set
CONFIG_FONT_8x8=y
CONFIG_FONT_8x16=y
# CONFIG_FRAMEBUFFER_CONSOLE is not set
#
# Logo configuration
#
CONFIG_LOGO=y
# CONFIG_LOGO_LINUX_MONO is not set
# CONFIG_LOGO_LINUX_VGA16 is not set
# CONFIG_LOGO_LINUX_CLUT224 is not set
# CONFIG_LOGO_LINUX_LANDSCAPED_CLUT224 is not set
CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224=y
# CONFIG_LOGO is not set
#
# Sound
@ -1017,16 +935,12 @@ CONFIG_SOUND=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_SEQUENCER=y
# CONFIG_SND_SEQ_DUMMY is not set
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_SEQUENCER_OSS=y
# CONFIG_SND_SEQUENCER is not set
# CONFIG_SND_MIXER_OSS is not set
# CONFIG_SND_PCM_OSS is not set
# CONFIG_SND_DYNAMIC_MINORS is not set
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_SUPPORT_OLD_API is not set
# CONFIG_SND_VERBOSE_PROCFS is not set
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
@ -1034,7 +948,6 @@ CONFIG_SND_VERBOSE_PROCFS=y
# Generic devices
#
# CONFIG_SND_DUMMY is not set
# CONFIG_SND_VIRMIDI is not set
# CONFIG_SND_MTPAV is not set
# CONFIG_SND_SERIAL_U16550 is not set
# CONFIG_SND_MPU401 is not set
@ -1064,15 +977,7 @@ CONFIG_SND_SOC=y
#
# SoC Audio for the Samsung S3C
#
CONFIG_SND_S3C_SOC=y
# CONFIG_SND_S3C24XX_SOC_SMDK2450_WM9713 is not set
CONFIG_SND_S3C2416_SOC_I2S=y
CONFIG_SND_SOC_I2S_V32=y
# CONFIG_SND_S3C24XX_SOC_SMDK2450_WM8580 is not set
# CONFIG_SND_S3C24XX_SOC_SMDK2416_WM8753 is not set
# CONFIG_SND_S3C24XX_SOC_SMDK2416_RT5627 is not set
CONFIG_SND_S3C24XX_SOC_SMDK2416_RT5624=y
CONFIG_SND_SOC_RT5624=y
# CONFIG_SND_S3C_SOC is not set
#
# Open Sound System
@ -1082,7 +987,8 @@ CONFIG_SND_SOC_RT5624=y
#
# HID Devices
#
# CONFIG_HID is not set
CONFIG_HID=y
# CONFIG_HID_DEBUG is not set
#
# USB support
@ -1105,10 +1011,7 @@ CONFIG_USB=y
# USB Host Controller Drivers
#
# CONFIG_USB_ISP116X_HCD is not set
CONFIG_USB_OHCI_HCD=y
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_OHCI_HCD is not set
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_OTG_HOST is not set
@ -1130,13 +1033,10 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
#
# USB Input Devices
#
# CONFIG_USB_HID is not set
#
# USB HID Boot Protocol drivers
#
# CONFIG_USB_KBD is not set
# CONFIG_USB_MOUSE is not set
CONFIG_USB_HID=y
# CONFIG_USB_HIDINPUT_POWERBOOK is not set
# CONFIG_HID_FF is not set
# CONFIG_USB_HIDDEV is not set
# CONFIG_USB_AIPTEK is not set
# CONFIG_USB_WACOM is not set
# CONFIG_USB_ACECAD is not set
@ -1174,45 +1074,7 @@ CONFIG_USB_OHCI_LITTLE_ENDIAN=y
#
# USB Serial Converter support
#
CONFIG_USB_SERIAL=y
# CONFIG_USB_SERIAL_CONSOLE is not set
# CONFIG_USB_SERIAL_GENERIC is not set
# CONFIG_USB_SERIAL_AIRCABLE is not set
# CONFIG_USB_SERIAL_AIRPRIME is not set
# CONFIG_USB_SERIAL_ARK3116 is not set
# CONFIG_USB_SERIAL_BELKIN is not set
# CONFIG_USB_SERIAL_WHITEHEAT is not set
# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
# CONFIG_USB_SERIAL_CP2101 is not set
# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
# CONFIG_USB_SERIAL_EMPEG is not set
# CONFIG_USB_SERIAL_FTDI_SIO is not set
# CONFIG_USB_SERIAL_FUNSOFT is not set
# CONFIG_USB_SERIAL_VISOR is not set
# CONFIG_USB_SERIAL_IPAQ is not set
# CONFIG_USB_SERIAL_IR is not set
# CONFIG_USB_SERIAL_EDGEPORT is not set
# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
# CONFIG_USB_SERIAL_GARMIN is not set
# CONFIG_USB_SERIAL_IPW is not set
# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
# CONFIG_USB_SERIAL_KEYSPAN is not set
# CONFIG_USB_SERIAL_KLSI is not set
# CONFIG_USB_SERIAL_KOBIL_SCT is not set
# CONFIG_USB_SERIAL_MCT_U232 is not set
# CONFIG_USB_SERIAL_MOS7720 is not set
# CONFIG_USB_SERIAL_MOS7840 is not set
# CONFIG_USB_SERIAL_NAVMAN is not set
# CONFIG_USB_SERIAL_PL2303 is not set
# CONFIG_USB_SERIAL_HP4X is not set
# CONFIG_USB_SERIAL_SAFE is not set
# CONFIG_USB_SERIAL_SIERRAWIRELESS is not set
# CONFIG_USB_SERIAL_TI is not set
# CONFIG_USB_SERIAL_CYBERJACK is not set
# CONFIG_USB_SERIAL_XIRCOM is not set
CONFIG_USB_SERIAL_OPTION=y
# CONFIG_USB_SERIAL_OMNINET is not set
# CONFIG_USB_SERIAL_DEBUG is not set
# CONFIG_USB_SERIAL is not set
#
# USB Miscellaneous drivers
@ -1244,7 +1106,7 @@ CONFIG_USB_SERIAL_OPTION=y
# USB Gadget Support
#
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG_FILES is not set
CONFIG_USB_GADGET_DEBUG_FILES=y
CONFIG_USB_GADGET_SELECTED=y
# CONFIG_USB_GADGET_NET2280 is not set
# CONFIG_USB_GADGET_PXA2XX is not set
@ -1258,14 +1120,16 @@ CONFIG_USB_GADGET_S3C_HS=y
# CONFIG_USB_GADGET_DUMMY_HCD is not set
CONFIG_USB_GADGET_DUALSPEED=y
# CONFIG_USB_ZERO is not set
# CONFIG_USB_ETH is not set
CONFIG_USB_ETH=m
CONFIG_USB_ETH_RNDIS=y
CONFIG_USB_GADGETFS=m
CONFIG_USB_FILE_STORAGE=m
# CONFIG_USB_FILE_STORAGE_TEST is not set
# CONFIG_USB_G_SERIAL is not set
CONFIG_USB_G_SERIAL=m
# CONFIG_USB_MIDI_GADGET is not set
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
CONFIG_SD_SW_DEBOUNCE=y
CONFIG_MMC_UNSAFE_RESUME=y
#
@ -1294,7 +1158,7 @@ CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set
CONFIG_RTC_DEBUG=y
#
# RTC interfaces
@ -1396,17 +1260,6 @@ CONFIG_RAMFS=y
# CONFIG_BEFS_FS is not set
# CONFIG_BFS_FS is not set
# CONFIG_EFS_FS is not set
CONFIG_YAFFS_FS=y
CONFIG_YAFFS_YAFFS1=y
# CONFIG_YAFFS_DOES_ECC is not set
CONFIG_YAFFS_YAFFS2=y
CONFIG_YAFFS_AUTO_YAFFS2=y
# CONFIG_YAFFS_DISABLE_LAZY_LOAD is not set
CONFIG_YAFFS_CHECKPOINT_RESERVED_BLOCKS=10
# CONFIG_YAFFS_DISABLE_WIDE_TNODES is not set
# CONFIG_YAFFS_ALWAYS_CHECK_CHUNK_ERASED is not set
CONFIG_YAFFS_SHORT_NAMES_IN_RAM=y
# CONFIG_JFFS2_FS is not set
CONFIG_CRAMFS=y
# CONFIG_VXFS_FS is not set
# CONFIG_HPFS_FS is not set
@ -1491,22 +1344,22 @@ CONFIG_NLS_UTF8=y
#
# CONFIG_PRINTK_TIME is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_MAGIC_SYSRQ=y
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
# CONFIG_HEADERS_CHECK is not set
CONFIG_DEBUG_KERNEL=y
# CONFIG_DEBUG_SHIRQ is not set
CONFIG_LOG_BUF_SHIFT=16
CONFIG_DETECT_SOFTLOCKUP=y
CONFIG_SCHED_DEBUG=y
# CONFIG_DETECT_SOFTLOCKUP is not set
# CONFIG_SCHED_DEBUG is not set
# CONFIG_SCHEDSTATS is not set
# CONFIG_TIMER_STATS is not set
# CONFIG_DEBUG_SLAB is not set
# CONFIG_DEBUG_RT_MUTEXES is not set
# CONFIG_RT_MUTEX_TESTER is not set
# CONFIG_DEBUG_SPINLOCK is not set
CONFIG_DEBUG_MUTEXES=y
# CONFIG_DEBUG_MUTEXES is not set
# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
# CONFIG_DEBUG_KOBJECT is not set
@ -1515,7 +1368,7 @@ CONFIG_DEBUG_INFO=y
# CONFIG_DEBUG_VM is not set
# CONFIG_DEBUG_LIST is not set
CONFIG_FRAME_POINTER=y
CONFIG_FORCED_INLINING=y
# CONFIG_FORCED_INLINING is not set
# CONFIG_RCU_TORTURE_TEST is not set
# CONFIG_FAULT_INJECTION is not set
CONFIG_DEBUG_USER=y

View File

@ -1,5 +1,64 @@
menu "Generic Driver Options"
# Qisda, Joey Lin {
config QISDA_BQ060B00
bool "QISDA BQ060B00"
default n
help
Say Y here, and a list of supported model AS090B00 will be displayed.
This option doesn't affect the kernel.
choice
depends on QISDA_BQ060B00
prompt "qisda bq060b00"
default QISDA_BQ060B00_DVT
config QISDA_BQ060B00_DVT
bool "DVT"
---help---
QISDA_BQ060B00_DVT
#config QISDA_BQ060B00_DVT2
# bool "DVT2"
# ---help---
# QISDA_BQ060B00_DVT2
endchoice
# Qisda, Joey Lin }
# Qisda, Ralph Chang {
config QISDA_BK060B00
bool "QISDA BK060B00"
default n
help
Say Y here, and a list of supported model BK060B00 will be displayed.
This option doesn't affect the kernel.
# Qisda, Ralph Chang }
# Qisda, Howard Hsu, 2010/01/07, fix SH060B00 config missing {
config QISDA_SH060B00
bool "QISDA SH060B00"
default n
help
Say Y here, and a list of supported model SH060B00 will be displayed.
This option doesn't affect the kernel.
choice
depends on QISDA_SH060B00
prompt "qisda sh060b00"
default QISDA_SH060B00_DVT
config QISDA_SH060B00_DVT
bool "DVT"
---help---
QISDA_SH060B00_DVT
endchoice
# } Qisda, Howard Hsu, 2010/01/07, fix SH060B00 config missing
# Qisda, Asaku Chen {
config QISDA_QD060B00
bool "QISDA QD060B00"

View File

@ -62,15 +62,22 @@
#include <asm/arch/regs-gpio.h>
//#define USE_12BITS_ADC
//#define USE_10BITS_ADC
#define LEVEL0_MIN 2980
#define LEVEL0_MAX 3384
#define LEVEL1_MIN 3385
#define LEVEL1_MAX 3484
#define LEVEL2_MIN 3485
#define LEVEL2_MAX 3684
#define LEVEL3_MIN 3685
#define LEVEL3_MAX 4080
#define BATTERY_FULL 4081
#define LEVEL0_MIN 2980 /*0%~25%*/
#define LEVEL0_MAX 3581
#define LEVEL1_MIN 3582 /*25%~50%*/ /*3.67V*/ /*3582*/
#define LEVEL1_MAX 3666
#define LEVEL2_MIN 3667 /*50%~75%*/ /*3.78V*/ /*3692*/ /*-25*/
#define LEVEL2_MAX 3778
#define LEVEL3_MIN 3779 /*75%~99%*/ /*3.92V*/ /*3829*/ /*-50*/
#define LEVEL3_MAX 4004
#define BATTERY_FULL 4005 /*100%*/ /*4.1V*/ /*4005*/
#define ADC_sample_count 100 //25 /*joey modify ADC read method to catch top 5 low value 2009/12/21*/
#define ADC_jig_voltage 3700 /*joey for ENV ADC to voltage 2010/01/15*/
#define ADC_READ_LEVEL_VAULE _IOR('S', 0x01, unsigned long)
#define ADC_READ_INPUT_SOURCE_STATUS _IOR('S', 0x02, unsigned long)
#define ADC_SET_PM_WKUP_SOURCE _IOW('S', 0x03, unsigned long)
@ -84,6 +91,19 @@
#endif
#define ADC_READ_WAKEUP_SOURCE _IOR('S', 0x0A, unsigned long)
#define ADC_READ_POWER_FAIL_STATUS _IOR('S', 0x0B, unsigned long)
#define ADC_READ_LEVEL_VAULE_TOOL _IOR('S', 0x10, unsigned long) /*qisda joey add for tool read 20091207*/
#define ADC_READ_RAW_VAULE_TOOL _IOR('S', 0x11, unsigned long) /*qisda joey add for tool read 20091207*/
#define HIGH_LOW_PULSE _IOR('S', 0x12, unsigned long)
#define ADC_READ_ENV _IOR('S', 0x13, unsigned long) /*joey for ENV ADC read/write 2010/01/13*/
#define ADC_GET_ENV _IOR('S', 0x14, unsigned long) /*joey for ENV ADC read/write 2010/01/13*/
#define ADC_READ_VOLTAGE _IOR('S', 0x15, unsigned long) /*joey for ENV ADC to voltage 2010/01/15*/
/* 2010/1/21, weichen, for handling events during suspend */
#if defined (CONFIG_PM_PLATFORM_POWER_SAVING)
#define ADC_CLEAR_WAKEUP_EVENT _IOW('S', 0x20, unsigned long)
#endif
//#define ADC_INPUT_PIN _IOW('S', 0x0c, unsigned long)
/*Qisda Qube 20091103 for Smart card power control*/
#define ADC_SMARTCARD_PWR _IOR('S', 0x8F, unsigned long)
@ -96,6 +116,12 @@ unsigned int wkup_srce = NON_ZERO_VALUE;
#ifdef CONFIG_PM_CPU_MODE
unsigned char pm_cpu_mode = 0;
#endif
/* 2010/1/21, weichen, for handling events during suspend */
#if defined (CONFIG_PM_PLATFORM_POWER_SAVING)
unsigned int g_wakeup_event_occurs = 0;
#endif
#define ADC_PM_DEBUG_PORT (0x00000003)
#define ADC_PM_WIFI (0x0000000C)
#define ADC_PM_AUDIO (0x00000030)
@ -111,11 +137,12 @@ extern int IsWallCharger(void);
extern int charging_source;
/* } Qisda, ShiYong Lin, 2009/10/27, Modify for exception in IsWallCharger function */
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event {
//extern int sleeping_cha_event;
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event }
#define ADC_MINOR 131
#if defined(CONFIG_CPU_S3C2443)
#define ADC_ENV(x) (S3C2410_ADCCON_PRSCVL(49))
#else
@ -142,6 +169,8 @@ struct s3c_adc_mach_info s3c_adc_cfg __initdata = {
//#endif
};
int average_adc_value_keep1 = 9999; /*joey add to keep ADC will always return lower one 2009/12/28*/
int average_adc_value_keep2 = 9999; /*joey add to keep ADC will always return lower one 2009/12/28*/
static struct clk *adc_clock;
static void __iomem *base_addr;
@ -153,6 +182,7 @@ static unsigned long data_for_ADCCON;
static unsigned long data_for_ADCTSC;
static int adc_port = 0;
static unsigned long env_adc_value; /*joey for ENV ADC to voltage 2010/01/15*/
static void s3c_adc_save_SFR_on_ADC(void) {
@ -270,16 +300,43 @@ s3c_adc_read(void)
#endif
/* Qisda, ShiYong Lin, 2009/07/18, ADC and Battery Status }*/
void bubblesort(int *data, int n) /*joey modify ADC read method to catch top 5 low value 2009/12/21*/
{
int i, j, temp;
for (i = n - 1; i > 0; i--)
{
for (j = 0; j <= i - 1; j++)
{
if (data[j] > data[j + 1])
{
temp = data[j];
data[j] = data[j + 1];
data[j + 1] = temp;
}
}
}
}
static int s3c_adc_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
int i = 0;
int average_adc_value = 0;
int env_adc_voltage; /*joey for ENV ADC to voltage 2010/01/15*/
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
unsigned long data_mask = 0; /* BenQ, weichen, 2009/12/22, check the wakeup source of 2416 for MMI */
#else
int data_mask = 0;
#endif
unsigned int ret = -ENOIOCTLCMD;
unsigned long level = NON_ZERO_VALUE;
unsigned long input_source = NON_ZERO_VALUE;
int ADC_raw_data[ADC_sample_count]; /*joey modify ADC read method to catch top 5 low value 2009/12/21*/
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
/* BenQ, weichen, 2009/12/22, check the wakeup source of 2416 for MMI */
void __user *uarg = (void __user *) arg;
#endif
switch (cmd) {
/*Qisda Qube 20091103 for Smart card power control*/
case ADC_SMARTCARD_PWR:
@ -324,32 +381,114 @@ static int s3c_adc_ioctl(struct inode *inode, struct file *file,
wkup_srce = (unsigned long) arg;
printk("Wakeup parameter = %d\n", wkup_srce);
/* Qisda, ShiYong Lin, 2009/09/28, Add the sleep event message when sleep {*/
#ifdef QISDA
s3c_keypad_pm_sleep_message_to_ap(1);
#endif
//s3c_keypad_pm_sleep_message_to_ap(1);
/* } Qisda, ShiYong Lin, 2009/09/28, Add the sleep event message when sleep */
ret = 0;
break;
case ADC_READ_LEVEL_VAULE:
for(i=0; i<20 ;i++)
for(i=0; i<ADC_sample_count ;i++)
{
udelay(1000);
average_adc_value += s3c_adc_read();
//udelay(1000);
msleep(1); /*joey modify for asus request 2009/12/18*/
average_adc_value += s3c_adc_read(); /*old*/
////ADC_raw_data[i] = s3c_adc_read(); /*joey modify ADC read method to catch top 5 low value 2009/12/21*/ /*new*/
}
average_adc_value = average_adc_value/20;
average_adc_value = average_adc_value/ADC_sample_count; /*old*/
//for(i=0; i<ADC_sample_count ;i++)
// printk("Before ADC data = %d\n", (int)ADC_raw_data[i]);
////bubblesort(ADC_raw_data, ADC_sample_count); /*new*/
//for(i=0; i<ADC_sample_count ;i++)
// printk("After ADC data = %d\n", (int)ADC_raw_data[i]);
////average_adc_value = (ADC_raw_data[1]+ADC_raw_data[2]+ADC_raw_data[3]+ADC_raw_data[4]+ADC_raw_data[5])/5; /*new*/
// if((readl(S3C2410_GPGDAT)&(1<<1)) == 0) /*no usb charger */
// {
// if(average_adc_value > average_adc_value_keep1) /*joey add to keep ADC will always return lower one 2009/12/28*/
// average_adc_value = average_adc_value_keep1;
// }
if (average_adc_value <= LEVEL0_MAX)
{
level = 0;
}
else if (average_adc_value < LEVEL1_MAX && average_adc_value >= LEVEL1_MIN)
else if (average_adc_value <= LEVEL1_MAX && average_adc_value >= LEVEL1_MIN)
{
level = 1;
}
else if (average_adc_value < LEVEL2_MAX && average_adc_value >= LEVEL2_MIN)
else if (average_adc_value <= LEVEL2_MAX && average_adc_value >= LEVEL2_MIN)
{
level = 2;
}
else if(average_adc_value < LEVEL3_MAX && average_adc_value >= LEVEL3_MIN)
else if(average_adc_value <= LEVEL3_MAX && average_adc_value >= LEVEL3_MIN)
{
level = 3;
}
else if(average_adc_value >= BATTERY_FULL)
{
level = 4;
}
// printk("level = %d, ADC data = %d\n", (int)level, (int)average_adc_value);
put_user(level, (unsigned long __user *)arg);
// if((readl(S3C2410_GPGDAT)&(1<<1)) == 0) /*no usb charger */
// average_adc_value_keep1 = average_adc_value; /*joey add to keep ADC will always return lower one 2009/12/28*/
ret = 0;
break;
case ADC_READ_RAW_VAULE:
for(i=0; i<ADC_sample_count ;i++)
{
//udelay(1000);
msleep(1); /*joey modify for asus request 2009/12/18*/
average_adc_value += s3c_adc_read();/*old*/
////ADC_raw_data[i] = s3c_adc_read(); /*joey modify ADC read method to catch top 5 low value 2009/12/21*/ /*new*/
}
average_adc_value = average_adc_value / ADC_sample_count; /*old*/
//for(i=0; i<ADC_sample_count ;i++)
// printk("Before ADC data = %d\n", (int)ADC_raw_data[i]);
////bubblesort(ADC_raw_data, ADC_sample_count); /*new*/
//for(i=0; i<ADC_sample_count ;i++)
// printk("After ADC data = %d\n", (int)ADC_raw_data[i]);
////average_adc_value = (ADC_raw_data[1]+ADC_raw_data[2]+ADC_raw_data[3]+ADC_raw_data[4]+ADC_raw_data[5])/5; /*new*/
// if((readl(S3C2410_GPGDAT)&(1<<1)) == 0) /*no usb charger */
// {
// if(average_adc_value > average_adc_value_keep2) /*joey add to keep ADC will always return lower one 2009/12/28*/
// average_adc_value = average_adc_value_keep2;
// }
printk("ADC data = %d\n", (int)average_adc_value);
put_user(average_adc_value, (unsigned long __user *)arg);
// if((readl(S3C2410_GPGDAT)&(1<<1)) == 0) /*no usb charger */
// average_adc_value_keep2 = average_adc_value; /*joey add to keep ADC will always return lower one 2009/12/28*/
ret = 0;
break;
case ADC_READ_LEVEL_VAULE_TOOL: /*qisda joey add for tool read 20091207*/
for(i=0; i<1000 ;i++) /*qisda joey modify from 20 to 1000 20091202*/
{
udelay(1000);
average_adc_value += s3c_adc_read();
}
average_adc_value = average_adc_value/1000; /*qisda joey modify from 20 to 1000 20091202*/
if (average_adc_value <= LEVEL0_MAX)
{
level = 0;
}
else if (average_adc_value <= LEVEL1_MAX && average_adc_value >= LEVEL1_MIN)
{
level = 1;
}
else if (average_adc_value <= LEVEL2_MAX && average_adc_value >= LEVEL2_MIN)
{
level = 2;
}
else if(average_adc_value <= LEVEL3_MAX && average_adc_value >= LEVEL3_MIN)
{
level = 3;
}
@ -361,21 +500,31 @@ static int s3c_adc_ioctl(struct inode *inode, struct file *file,
put_user(level, (unsigned long __user *)arg);
ret = 0;
break;
case ADC_READ_RAW_VAULE:
for(i=0; i<20 ;i++)
case ADC_READ_RAW_VAULE_TOOL: /*qisda joey add for tool read 20091207*/
for(i=0; i<1000 ;i++) /*qisda joey modify from 20 to 1000 20091202*/
{
udelay(1000);
average_adc_value += s3c_adc_read();
}
average_adc_value = average_adc_value / 20;
average_adc_value = average_adc_value / 1000; /*qisda joey modify from 20 to 1000 20091202*/
printk("ADC data = %d\n", (int)average_adc_value);
put_user(average_adc_value, (unsigned long __user *)arg);
ret = 0;
break;
case ADC_POWER_OFF:
printk("power off");
printk("power off\n");
//writeb(0x0, 0xc8a30029); /*joey shut down SD bus power before p_keep pull low 2010/01/06*/
s3c_moviNAND_power_off();
msleep(100);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD14, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG0, 0);
#endif
ret = 0;
break;
#ifdef CONFIG_QISDA_AS090B00_EVT1
@ -386,14 +535,16 @@ static int s3c_adc_ioctl(struct inode *inode, struct file *file,
ret = put_user(data_mask, (unsigned long __user *)arg);
break;
#endif
#if defined(CONFIG_QISDA_AS090B00_EVT1_1) || defined (CONFIG_QISDA_QD090B00_EVT1) || defined(CONFIG_QISDA_QD060N00_DVT1_1)
case ADC_READ_CHARGING_STATUS:
data_mask = readl(S3C2410_GPFDAT);
data_mask &= 0x1<<6;
if(data_mask) /*shiyong joey for asus 2009/12/15*/
data_mask = 1;
else
data_mask = 0;
printk("GPF6 = %d\n", data_mask);
ret = put_user(data_mask, (unsigned long __user *)arg);
break;
#endif
case ADC_SET_PM_FUNCTION_POWER:
printk("ADC_SET_PM_FUNCTION_POWER\n");
#if defined(CONFIG_QISDA_AS090B00_EVT1_1) || defined(CONFIG_QISDA_AS090B00_EVT1) || defined(CONFIG_QISDA_QD060N00_DVT1_1) || defined(CONFIG_QISDA_QD090B00_EVT1)
@ -673,8 +824,15 @@ static int s3c_adc_ioctl(struct inode *inode, struct file *file,
// s3c2410_gpio_setpin(S3C2410_GPB3, 0);
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF2, 0);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
#endif
}
else if(((arg & ADC_PM_TOUCH) >> 12)==1){
//power on
@ -682,29 +840,58 @@ static int s3c_adc_ioctl(struct inode *inode, struct file *file,
// s3c2410_gpio_cfgpin(S3C2410_GPB3, S3C2410_GPB3_OUTP);
// s3c2410_gpio_setpin(S3C2410_GPB3, 1);
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
}
else if(((arg & ADC_PM_TOUCH) >> 12)==2){
//power on () + touch active mode (touch ioctl)
printk("ADC_PM_TOUCH, 2 Touch GPIO on and Enter Active\n");
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
}
else if(((arg & ADC_PM_TOUCH) >> 12)==3){
//power on + touch sleep mode (via touch ioctl)
printk("ADC_PM_TOUCH, 3 Touch GPIO on and Enter Sleep\n");
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
}
else if(((arg & ADC_PM_TOUCH) >> 12)==4){
//power on + touch deep sleep mode (via touch ioctl)
printk("ADC_PM_TOUCH, 4 Touch GPIO on and Enter Deep sleep\n");
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
}
else{
printk("ADC_PM_TOUCH, 5~15 do nothing\n");
@ -799,16 +986,94 @@ static int s3c_adc_ioctl(struct inode *inode, struct file *file,
ret = 0;
break;
#endif
/* BenQ, weichen, 2009/12/22, check the wakeup source of 2416 for MMI */
case ADC_READ_WAKEUP_SOURCE:
data_mask = readl(S3C2443_WKUPSTAT);
printk("Wakeup source =0x%08lx\n", data_mask);
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
if (copy_to_user(uarg, &data_mask, sizeof(data_mask)))
return -EFAULT;
/* BenQ, weichen, 2010/1/28, clear the wakeup source of 2416 for MMI */
#if defined (CONFIG_PM_PLATFORM_POWER_SAVING)
writel(0x33, S3C2443_WKUPSTAT);
data_mask = readl(S3C2443_WKUPSTAT);
printk("Wakeup source2 =0x%08lx\n", data_mask);
#endif
#endif
ret = 0;
break;
/* BenQ, weichen, 2009/12/22, check the wakeup source of 2416 for MMI */
case ADC_READ_POWER_FAIL_STATUS:
data_mask = readl(S3C2410_GPGDAT) & (1<<5);
printk("ADC_READ_POWER_FAIL_STATUS GPG5 = %d\n", data_mask);
ret = put_user(data_mask, (unsigned long __user *)arg);
break;
case HIGH_LOW_PULSE: /*joey add for high/low pulse 2010/01/08*/
{
unsigned long percent[3]={0, 0, 0}; /*1:high sec 2:low msec 3:times*/
int i;
copy_from_user(percent, (unsigned long) arg, sizeof(unsigned long)*3);
printk("1st=%d, 2nd=%d, 3rd=%d\n", percent[0], percent[1], percent[2]);
s3c2410_gpio_cfgpin(S3C2410_GPH11, S3C2410_GPH11_OUTP);
s3c2410_gpio_pullup(S3C2410_GPH11, 2);
for(i=0; i<percent[2]; i++)
{
s3c2410_gpio_setpin(S3C2410_GPH11, 0);
printk("GPH11 pull low\n");
msleep(percent[1]);
s3c2410_gpio_setpin(S3C2410_GPH11, 1);
printk("GPH11 pull high\n");
msleep(percent[0]);
}
//ret = put_user(data_mask, (unsigned long __user *)arg);
break;
}
case ADC_GET_ENV: /*joey for ENV ADC read/write 2010/01/13*/
copy_from_user(&env_adc_value, (unsigned long) arg, sizeof(unsigned long));
printk("env_adc_value=%d\n", env_adc_value);
//ret = put_user(data_mask, (unsigned long __user *)arg);
break;
case ADC_READ_ENV: /*joey for ENV ADC read/write 2010/01/13*/
ret = put_user(env_adc_value, (unsigned long __user *)arg);
printk("env_adc_value=%d\n", env_adc_value);
break;
case ADC_READ_VOLTAGE: /*joey for ENV ADC to voltage 2010/01/15*/
if(env_adc_value > 3711 || env_adc_value < 3511)
env_adc_value = 3611;
printk("env_adc_value=%d\n", env_adc_value);
for(i=0; i<ADC_sample_count ;i++)
{
msleep(1); /*joey modify for asus request 2009/12/18*/
average_adc_value += s3c_adc_read();
}
average_adc_value = average_adc_value / ADC_sample_count;
printk("average_adc_value=%d\n", average_adc_value);
if(average_adc_value >= env_adc_value)
env_adc_voltage = ADC_jig_voltage + (average_adc_value-env_adc_value)*100/97;
else
env_adc_voltage = ADC_jig_voltage - (env_adc_value-average_adc_value)*100/97;
ret = put_user(env_adc_voltage, (unsigned long __user *)arg);
printk("env_adc_voltage=%d\n", env_adc_voltage);
break;
#if defined (CONFIG_PM_PLATFORM_POWER_SAVING)
case ADC_CLEAR_WAKEUP_EVENT:
g_wakeup_event_occurs = 0;
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event {
//sleeping_cha_event = 0;
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event }
printk("ADC_CLEAR_WAKEUP_EVENT: g_wakeup_event_occurs=%d\n", g_wakeup_event_occurs);
ret = 0;
break;
#endif
default:
ret = -ENOIOCTLCMD;
break;

View File

@ -917,6 +917,11 @@ static int s3c24xx_i2c_resume(struct platform_device *dev)
//AUDIO [i2c] SDA setting
s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_IICSDA);
/*kit.add 2010/01/11*/
//s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_IICSDA);
//s3c2410_gpio_cfgpin(S3C2410_GPE14, S3C2410_GPE14_IICSCL);
/*kit.end*/
printk("[HIKO DEBUG]s3c24xx_i2c_resume");
//HIKO: for RT5624 audio power management process {
//#endif //0
@ -941,6 +946,14 @@ static int s3c24xx_i2c_suspend(struct platform_device *dev)
//AUDIO [i2c] SDA setting
s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_INP);
/*kit.add 2010/01/11*/
//s3c2410_gpio_cfgpin(S3C2410_GPE14, S3C2410_GPE14_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPE14, 0);
//s3c2410_gpio_cfgpin(S3C2410_GPE15, S3C2410_GPE15_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPE15, 0);
/*kit.end*/
printk("[HIKO DEBUG]s3c24xx_i2c_suspend");

View File

@ -131,4 +131,12 @@ config QISDA_IIC
help
tony.yc.huang@qisda.com
#Qisda Tony 090406, add Auo touch i2c driver ]
#BENQ Aaron 091210, add power-saving of AUO touch i2c driver for plato
config TOUCH_PM
tristate "Power Saving Setting of Touch for Plato use"
default n
help
aaron.lan@benq.com
endmenu

View File

@ -52,6 +52,48 @@
#define QISDA_IIC_ID 0xB8
#define DELAY_TIME_IIC_READ 8//1//8
//Aaron, add for the feature of buffered touch data
#define USE_BUFFERED_TOUCH_DATA
#ifdef USE_BUFFERED_TOUCH_DATA
//Aaron, prevent from read wrong data in touch panel of old firmware version
static int IsBufferedDataFwVersion;
#endif
#ifdef CONFIG_TOUCH_PM
//Aaron
#define AXIS_DATA(axis) \
printk(KERN_INFO"AA: show_%s():", #axis); \
if (axis < 0) \
return snprintf(buf, PAGE_SIZE, "%s\n", "read data error"); \
else { \
axis = axis; \
return snprintf(buf, PAGE_SIZE, "0x%x(%d)\n", axis, axis); \
}
#define COORD_DATA_BLOCK_NUM 8
#define X1_LSB 0x00
#define X1_MSB 0x01
#define Y1_LSB 0x02
#define Y1_MSB 0x03
#define X2_LSB 0x04
#define X2_MSB 0x05
#define Y2_LSB 0x06
#define Y2_MSB 0x07
#define X_SENSITIVITY 0x6F
#define Y_SENSITIVITY 0x70
#define INT_SETTING 0x71
#define INT_WIDTH 0x72
#define POWERMODE 0x73
#define CALIBRATION 0x78
#endif
static struct i2c_driver qisda_iic_driver;
static unsigned short normal_i2c[] = { QISDA_IIC_ID>>1 , I2C_CLIENT_END };
I2C_CLIENT_INSMOD_1(qisda_iic);
@ -105,6 +147,308 @@ static struct i2c_driver qisda_iic_driver = {
#define NEW_TCOM_BOARD
//Tony 090615 end
#ifdef CONFIG_TOUCH_PM
//Aaron
static ssize_t show_x1(struct device *device, struct device_attribute *attr,
char *buf)
{
#if 1
int x1;
// int x1_lsb, x1_msb;
struct qisda_iic_data *data = dev_get_drvdata(device);
x1 = i2c_smbus_read_word_data(&data->client, X1_LSB);
AXIS_DATA(x1); /* Macro */
// x1_lsb = i2c_smbus_read_byte_data(&data->client, X1_LSB);
// x1_msb = i2c_smbus_read_byte_data(&data->client, X1_MSB);
// printk(KERN_INFO"AA: show_x1():");
// if (x1_lsb < 0 || x1_msb < 0)
// return snprintf(buf, PAGE_SIZE, "%s\n", "read data error");
// else {
// x1 = (x1_lsb & 0xff) | (x1_msb << 8);
// return snprintf(buf, PAGE_SIZE, "0x%x(%d)\n", x1, x1);
// }
#else
struct qisda_iic_data *data = dev_get_drvdata(device);
u8 coordinate[COORD_DATA_BLOCK_NUM] = {0};
int ret = 0;
int x1, y1, x2, y2;
ret = i2c_smbus_read_i2c_block_data(&data->client, X1_LSB, COORD_DATA_BLOCK_NUM, coordinate);
if (ret != COORD_DATA_BLOCK_NUM)
return snprintf(buf, PAGE_SIZE, "%s\n", "read data error(number not match)");
x1 = *(coordinate ) | (*(coordinate + 1) << 8);
y1 = *(coordinate + 2) | (*(coordinate + 3) << 8);
x2 = *(coordinate + 4) | (*(coordinate + 5) << 8);
y2 = *(coordinate + 6) | (*(coordinate + 7) << 8);
return snprintf(buf, PAGE_SIZE, "(%d,%d)(%d,%d)\n", x1, y1, x2, y2);
#endif
}
static DEVICE_ATTR(x1, S_IRUGO, show_x1, NULL);
static ssize_t show_y1(struct device *device, struct device_attribute *attr,
char *buf)
{
int y1;
struct qisda_iic_data *data = dev_get_drvdata(device);
y1 = i2c_smbus_read_word_data(&data->client, Y1_LSB);
AXIS_DATA(y1); /* Macro */
/* printk(KERN_ERR"AA: show_y1(): y1_lsb=0x%x, y1_msb=0x%x \n", y1_lsb, y1_msb);
if (y1_lsb < 0 || y1_msb < 0)
return snprintf(buf, PAGE_SIZE, "%s\n", "read x1 error");
else {
y1 = (y1_lsb & 0xff) | ((y1_msb & 0x3) << 8);
return snprintf(buf, PAGE_SIZE, "0x%x(%d)\n", x1, x1);
}
*/
//return snprintf(buf, PAGE_SIZE, "0x%x\n", );
}
static DEVICE_ATTR(y1, S_IRUGO, show_y1, NULL);
static ssize_t show_x2(struct device *device, struct device_attribute *attr,
char *buf)
{
int x2;
struct qisda_iic_data *data = dev_get_drvdata(device);
#if 0
x2 = i2c_smbus_read_word_data(&data->client, X2_LSB);
#else
x2 = i2c_smbus_read_word_data(&data->client, 0xC0);
#endif
AXIS_DATA(x2); /* Macro */
}
static DEVICE_ATTR(x2, S_IRUGO, show_x2, NULL);
static ssize_t show_y2(struct device *device, struct device_attribute *attr,
char *buf)
{
int y2;
struct qisda_iic_data *data = dev_get_drvdata(device);
#if 0
y2 = i2c_smbus_read_word_data(&data->client, Y2_LSB);
#else
y2 = i2c_smbus_read_byte_data(&data->client, 0x77);
#endif
AXIS_DATA(y2); /* Macro */
}
static DEVICE_ATTR(y2, S_IRUGO, show_y2, NULL);
static ssize_t show_x_sensitivity(struct device *device, struct device_attribute *attr,
char *buf)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value;
value = i2c_smbus_read_byte_data(&data->client, X_SENSITIVITY);
if (value < 0 || value > 255)
return snprintf(buf, PAGE_SIZE, "0x%x(error data)\n", value);
else
return snprintf(buf, PAGE_SIZE, "0x%x\n", value);
}
static ssize_t store_x_sensitivity(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value = 0;
sscanf(buf, "%x", &value);
/* check whether data is correct */
if (value < 0 || value > 255)
return -EINVAL;
if (i2c_smbus_write_byte_data(&data->client, X_SENSITIVITY, value) < 0)
return -EIO;
return count;
}
static DEVICE_ATTR(x_sensitivity, S_IWUSR | S_IRUGO, show_x_sensitivity, store_x_sensitivity);
static ssize_t show_y_sensitivity(struct device *device, struct device_attribute *attr,
char *buf)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value;
value = i2c_smbus_read_byte_data(&data->client, Y_SENSITIVITY);
if (value < 0 || value > 255)
return snprintf(buf, PAGE_SIZE, "0x%x(error)\n", value);
else
return snprintf(buf, PAGE_SIZE, "0x%x\n", value);
}
static ssize_t store_y_sensitivity(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value = 0;
sscanf(buf, "%x", &value);
/* check whether data is correct */
if (value < 0 || value > 255)
return -EINVAL;
if (i2c_smbus_write_byte_data(&data->client, Y_SENSITIVITY, value) < 0)
return -EIO;
return count;
}
static DEVICE_ATTR(y_sensitivity, S_IWUSR | S_IRUGO, show_y_sensitivity, store_y_sensitivity);
static ssize_t show_int_setting(struct device *device, struct device_attribute *attr,
char *buf)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
return snprintf(buf, PAGE_SIZE, "0x%x\n", i2c_smbus_read_byte_data(&data->client, INT_SETTING));
}
static ssize_t store_int_setting(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int setting_data = 0;
sscanf(buf, "%x", &setting_data);
/* check whether data is correct */
if (setting_data < 0 || setting_data > 0xf)
return -EINVAL;
if (i2c_smbus_write_byte_data(&data->client, INT_SETTING, setting_data) < 0)
return -EIO;
return count;
}
static DEVICE_ATTR(int_setting, S_IWUSR | S_IRUGO, show_int_setting, store_int_setting);
static ssize_t show_int_width(struct device *device, struct device_attribute *attr,
char *buf)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value;
value = i2c_smbus_read_byte_data(&data->client, INT_WIDTH);
if (value < 0 || value > 255)
return snprintf(buf, PAGE_SIZE, "0x%x(error)\n", value);
else
return snprintf(buf, PAGE_SIZE, "0x%x\n", value);
}
static ssize_t store_int_width(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value = 0;
sscanf(buf, "%x", &value);
/* check whether data is correct */
if (value < 0 || value > 255)
return -EINVAL;
if (i2c_smbus_write_byte_data(&data->client, INT_WIDTH, value) < 0)
return -EIO;
return count;
}
static DEVICE_ATTR(int_width, S_IWUSR | S_IRUGO, show_int_width, store_int_width);
static ssize_t show_powermode(struct device *device, struct device_attribute *attr,
char *buf)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value;
value = i2c_smbus_read_byte_data(&data->client, POWERMODE);
if (value < 0 || value & 0x08)
return snprintf(buf, PAGE_SIZE, "0x%x(error)\n", value);
else
return snprintf(buf, PAGE_SIZE, "0x%x\n", value);
}
static ssize_t store_powermode(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value = 0;
sscanf(buf, "%x", &value);
/* check whether data is correct */
if ((value < 0) || (value > (0xff -0x08)) || (value & 0x08))
return -EINVAL;
if (i2c_smbus_write_byte_data(&data->client, POWERMODE, value) < 0)
return -EIO;
return count;
}
static DEVICE_ATTR(powermode, S_IWUSR | S_IRUGO, show_powermode, store_powermode);
//TODO: add for calibration register.
static ssize_t show_calibration(struct device *device, struct device_attribute *attr,
char *buf)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value;
value = i2c_smbus_read_byte_data(&data->client, CALIBRATION);
if (value < 0)
return snprintf(buf, PAGE_SIZE, "0x%x(error)\n", value);
else
return snprintf(buf, PAGE_SIZE, "0x%x\n", value);
}
static ssize_t store_calibration(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct qisda_iic_data *data = dev_get_drvdata(device);
int value = 0;
//int value2 = -1;
sscanf(buf, "%x", &value);
/* check whether data is correct */
if ((value < 0) || (value & (0xff - 0x03)))
return -EINVAL;
if (i2c_smbus_write_byte_data(&data->client, CALIBRATION, value) < 0)
return -EIO;
return count;
}
static DEVICE_ATTR(calibration, S_IWUSR | S_IRUGO, show_calibration, store_calibration);
static struct attribute *multitouch_attributes[] = {
&dev_attr_x1.attr,
&dev_attr_y1.attr,
&dev_attr_x2.attr,
&dev_attr_y2.attr,
&dev_attr_x_sensitivity.attr,
&dev_attr_y_sensitivity.attr,
&dev_attr_int_setting.attr,
&dev_attr_int_width.attr,
&dev_attr_powermode.attr,
&dev_attr_calibration.attr,
NULL
};
static const struct attribute_group multitouch_group = {
.attrs = multitouch_attributes,
};
#endif
unsigned char qisda_iic_read(struct i2c_client *client, unsigned char subaddr)
{
int ret;
@ -140,6 +484,35 @@ writel(readl(g_pGPIOReg_GPFCON+0x04) & (0x0<<0), g_pGPIOReg_GPFCON+0x04);
return buf[0];
}
/*kit.add 2009/12/02*/
unsigned char i2c_buf1[1];
unsigned char i2c_buf2[4];
int qisda_iic_read_pos(struct i2c_client *client, unsigned char subaddr)
{
int ret;
int i;
struct i2c_msg msg[] =
{
{client->addr, 0, 1, i2c_buf1},
{client->addr, I2C_M_RD, 4, i2c_buf2},
};
for(i=0; i<4; i++)
i2c_buf2[i] = 0;
i2c_buf1[0] = subaddr;
i2c_buf2[0] = subaddr;
ret = i2c_transfer(client->adapter, msg, 2) == 1 ? 0 : -EIO;
/*if (ret == -EIO) {
printk(" I2C read Error, subaddr: 0x%x \n", subaddr);
return 0;
}*/
return 0;
}
/*kit.end*/
static int qisda_iic_write(struct i2c_client *client, unsigned char subaddr, unsigned char val)
{
unsigned char buf[2];
@ -190,6 +563,17 @@ static int qisda_iic_detect(struct i2c_adapter *adapter, int address, int kind)
//Then it will callback to the command
if ((err = s3c_ts_iic_port_init(new_client))) goto exit_kfree;;
#ifdef CONFIG_TOUCH_PM
/* Aaron: create sysfs group */
if (sysfs_create_group(&new_client->dev.kobj, &multitouch_group) < 0) {
printk(KERN_ERR "qisda_iic_detect: Unable to create sysfs group\n");
//goto err_sysfs_create_group_failed;
}
//Aaron: powermode with allow_sleep
if(qisda_iic_write(new_client, 0x73, 0x54) < 0)
printk(KERN_ERR "qisda_iic_detect: fail to set powermode with allow_sleep\n");
#endif
return err;
exit_kfree:
@ -240,33 +624,55 @@ writel(readl(g_pGPIOReg_GPFCON+0x08) | (0x2<<0), g_pGPIOReg_GPFCON+0x08);
if(qisda_iic_write(client, 0x71, 0xA) < 0) return -EIO;
udelay(DELAY_TIME_IIC_READ);
u8return= qisda_iic_read(client, 0x71);
printk(KERN_INFO "qisda_iic_command INIT =0x%x\n",u8return);
//printk(KERN_INFO "qisda_iic_command INIT =0x%x\n",u8return);
qisda_iic_write(client, 0x6F, 0x22);
qisda_iic_write(client, 0x70, 0x22);
#ifdef USE_BUFFERED_TOUCH_DATA
//Aaron: add for buffered data
/* enable buffered data, because default is disabled (0x0) */
if(qisda_iic_write(client, 0xBE, 0x01) < 0) return -EIO;
udelay(DELAY_TIME_IIC_READ);
u8return= qisda_iic_read(client, 0xBE);
//printk(KERN_INFO "qisda_iic_command: points interval =0x%x\n",u8return);
u8return= qisda_iic_read(client, 0x77); //read firmware version of touch panel
//printk(KERN_INFO "qisda_iic_command: firmware version =0x%x\n",u8return);
if (u8return < 0x13)
IsBufferedDataFwVersion = 0;
else
IsBufferedDataFwVersion = 1;
#endif
#else // old
printk(KERN_INFO "qisda_iic_command INIT 1111\n");
//printk(KERN_INFO "qisda_iic_command INIT 1111\n");
mdelay(6000);
qisda_iic_write(client, 0x78, 0x3);
printk(KERN_INFO "qisda_iic_command INIT 2222\n");
//printk(KERN_INFO "qisda_iic_command INIT 2222\n");
qisda_iic_write(client, 0x71,INT_MODE_ENABLE | INT_MODE_TOUCH_INDICATE);
udelay(DELAY_TIME_IIC_READ);
u8return= qisda_iic_read(client, 0x71);
printk(KERN_INFO "qisda_iic_command INIT =0x%x\n",u8return);
//printk(KERN_INFO "qisda_iic_command INIT =0x%x\n",u8return);
#endif
break;
case QISDA_IIC_READ_POSITION:
pos = arg;
#ifdef NEW_TCOM_BOARD
u8x0= qisda_iic_read(client, 0x00);
/*kit.mod 2009/12/02*/
/*u8x0= qisda_iic_read(client, 0x00);
udelay(DELAY_TIME_IIC_READ);
u8x1= qisda_iic_read(client, 0x01);
udelay(DELAY_TIME_IIC_READ);
u8y0= qisda_iic_read(client, 0x02);
udelay(DELAY_TIME_IIC_READ);
u8y1= qisda_iic_read(client, 0x03);
udelay(DELAY_TIME_IIC_READ);
udelay(DELAY_TIME_IIC_READ);*/
qisda_iic_read_pos(client, 0x00);
u8x0 = i2c_buf2[0];
u8x1 = i2c_buf2[1];
u8y0 = i2c_buf2[2];
u8y1 = i2c_buf2[3];
/*kit.end*/
#else
u8x0= qisda_iic_read(client, 0x54);
udelay(DELAY_TIME_IIC_READ);
@ -304,7 +710,62 @@ writel(readl(g_pGPIOReg_GPFCON+0x08) | (0x2<<0), g_pGPIOReg_GPFCON+0x08);
#endif
//printk("X: %d, Y: %d\n", pos[0], pos[1]);
break;
#ifdef USE_BUFFERED_TOUCH_DATA
/* Aaron,20091224, add for buffered data read */
case QISDA_IIC_READ_BUFFERED_POSITION:
{
int coordinate[2] = {0}; /*[0]=x, [1]=y*/
int *data = (int *)arg;
int index, len, i, j, offset, *point_data;
/* prevent from using the panel of old firmware version */
if (!IsBufferedDataFwVersion) {
printk("qisda_iic_command():buffered data(Not supported firmware version)\n");
break;
}
index = data[0];
len = data[1];
point_data = data + (2 + index * len * 2); /* each point is made of two coordinate data*/
offset = len * index * 4;
/* read buffered data for each check length */
for (i = 0; i < len; i++) {
/* read coordinates for x & y (two words), as one point data */
for (j = 0; j < 2; j++) {
coordinate[j] = i2c_smbus_read_word_data(client, (0xC0 + offset + j*2));
if (coordinate[j] < 0) {
printk("qisda_iic_command():read word data error(%d),i=%d,j=%d\n", coordinate[j], i, j);
break;
}
}
offset += 4; /* there are 4 bytes in each point data*/
//Aaron: //TODO: maybe should change from "<" to "<="
/* if either of x/y is zero, we think they are both zero. */
//TODO: need to feedback the status of no more read?????????
if (coordinate[0] <= 0 || coordinate[1] <= 0)
break;
#ifdef ROTATE_NAGATIVE_90
#if defined(AUO_EPAPER_6_INCH)
point_data[i*2] = 600 - coordinate[1];
#elif defined(AUO_EPAPER_9_INCH)
point_data[i*2] = 768 - coordinate[1];
#else
/* error: shall not go into this configuration */
point_data[i*2] = coordinate[1];
#endif
point_data[i*2 + 1] = coordinate[0];
#else
point_data[i*2] = coordinate[0];
point_data[i*2 + 1] = coordinate[1];
#endif
//printk("qisda_iic_command():buffered data(%d,%d)\n", point_data[i*2],point_data[i*2 + 1]);
}
}
break;
#endif //#ifdef USE_BUFFERED_TOUCH_DATA
case QISDA_IIC_CALIBRATION:
if(qisda_iic_write(client, 0x78, 0x3) < 0){
printk("CALIBRATION ERROR!");
@ -312,25 +773,43 @@ writel(readl(g_pGPIOReg_GPFCON+0x08) | (0x2<<0), g_pGPIOReg_GPFCON+0x08);
}
msleep(300);
break;
#ifdef CONFIG_TOUCH_PM
case QISDA_IIC_ACTIVE_MODE:
printk("ACTIVE MODE\n");
//printk("ACTIVE MODE\n");
qisda_iic_write(client, 0x73, 0x54);
msleep(5);
break;
case QISDA_IIC_SLEEP_MODE:
//printk("SLEEP MODE\n");
qisda_iic_write(client, 0x73, 0x55);
msleep(5);
break;
case QISDA_IIC_DEEPSLEEP_MODE:
//printk("ALSO SLEEP MODE\n");
qisda_iic_write(client, 0x73, 0x55);
msleep(5);
break;
#else
case QISDA_IIC_ACTIVE_MODE:
//printk("ACTIVE MODE\n");
qisda_iic_write(client, 0x73, 0x50);
msleep(5);
break;
case QISDA_IIC_SLEEP_MODE:
printk("SLEEP MODE\n");
//printk("SLEEP MODE\n");
qisda_iic_write(client, 0x73, 0x51);
msleep(5);
break;
case QISDA_IIC_DEEPSLEEP_MODE:
printk("DEEP SLEEP MODE\n");
//printk("DEEP SLEEP MODE\n");
qisda_iic_write(client, 0x73, 0x52);
msleep(5);
break;
#endif
default:
break;

View File

@ -29,6 +29,16 @@ MODULE_LICENSE("GPL");
#define INPUT_DEVICES 256
/* Aaron, 20090122, add for CPU sleep prevention */
/* prevent cpu from sleep when any event happens */
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
#define CPU_SLEEP_PREVENT
#endif
#ifdef CPU_SLEEP_PREVENT
extern unsigned int g_wakeup_event_occurs;
#endif
static LIST_HEAD(input_dev_list);
static LIST_HEAD(input_handler_list);
@ -51,6 +61,10 @@ void input_event(struct input_dev *dev, unsigned int type, unsigned int code, in
if (type > EV_MAX || !test_bit(type, dev->evbit))
return;
#ifdef CPU_SLEEP_PREVENT
g_wakeup_event_occurs = 1;
#endif
add_input_randomness(type, code, value);
switch (type) {

View File

@ -229,6 +229,13 @@ config KEYBOARD_GPIO
To compile this driver as a module, choose M here: the
module will be called gpio-keys.
config CYBOOK_CYIO
tristate "Cybook CyIO"
# depends on MACH_CYBOOK_ORIZON
default y
help
Say Y.
config KEYPAD_S3C
tristate "S3C keypad support"
depends on (CPU_S3C6400 || CPU_S3C6410)
@ -248,10 +255,4 @@ config KEYPAD_S3C_QISDA
tony.yc.huang@qisda.com
#Qisda Tony 090324, add keypad ]
config CYBOOK_CYIO
tristate "CYBOOK buttons"
default y
help
To compile this driver as a module, choose M here.
endif

View File

@ -23,4 +23,4 @@ obj-$(CONFIG_KEYPAD_S3C) += s3c-keypad.o
#Qisda Tony 090324, add keypad [
obj-$(CONFIG_KEYPAD_S3C_QISDA) += s3c-keypad-qisda.o
#Qisda Tony 090324, add keypad ]
obj-$(CONFIG_CYIO) += cyio.o
obj-$(CONFIG_CYBOOK_CYIO) += cyio.o

View File

@ -12,18 +12,21 @@
#include <linux/delay.h>
#include <linux/interrupt.h>
#include <linux/pm.h>
#include <linux/proc_fs.h>
#include <cybook.h>
#include "cyio.h"
#include <linux/cyio.h>
//#define CYIO_TIMER
#define CYIO_REPEAT
#define CYIO_TIMER
//#define CYIO_REPEAT
//#define CYIO_POLLING
#define CYIO_ALTERNATE_KEY
//#define CYIO_ALTERNATE_KEY
#define DEBUG_MESSAGES
#define DBG_IRQ
//#define DEBUG_MESSAGES
//#define DBG_IRQ
#include <asm/hardware.h>
#include <asm/delay.h>
@ -43,17 +46,38 @@ spinlock_t io_lock = SPIN_LOCK_UNLOCKED;
static unsigned long io_status = 0;
struct task_struct *ptsk = 0;
unsigned int platform_type = CYBOOK_GEN4;
#ifdef CYIO_POLLING
#define GPROCFS_ROOTFOLDER "cybook"
#define GPROCFS_MODULEFOLDER "gsensor"
#define GPROCFS_CALIBFILE "calibration"
#define GPROCFS_IOFILE "io"
#define GPROCFS_STATUSFILE "status"
#define GPROCFS_AXISFILE "axis"
#define GPROCFS_THDXFILE "thdx"
#define GPROCFS_THDYFILE "thdy"
#define GPROCFS_DIRECTIONFILE "direction"
#define GPROCFS_DEBUGFILE "debug"
unsigned long tiltRotation;
static struct proc_dir_entry *rootDir, *ioProcEntry;
#endif
#ifdef CYIO_TIMER
#define IO_TIMER_DELAY_1 ((HZ * 1) / 2) /* 500 ms */
#define IO_TIMER_DELAY_2 ((HZ * 2) / 1) /* 2 s */
#define IO_TIMER_DELAY_3 ((HZ * 1) / 1) /* 1 s */
static struct timer_list io_timer;
#ifdef CYIO_POLLING
static struct timer_list io_btn_timer;
#endif
static int timer_inited = 0;
static int timer_run = 0;
#endif
static volatile int CyIO_Running = 0;
#define TRUE (1==1)
#define FALSE (0==1)
@ -72,14 +96,26 @@ typedef struct _cyIrq_
char* sName;
} cyIrq;
#ifdef CYIO_POLLING
typedef struct _cyPoll_
{
u32 nGpio;
u8 oldState;
u8 nCodeActive;
u8 nCodeInactive;
char *sName;
} cyPoll;
#endif
typedef struct _cyEvent_
{
u8 nCode;
u8 nKeyEvent;
u8 bValid;
void* pNext;
} cyEvent;
static cyEvent s_nEvents[10];
static cyEvent s_nEvents[20];
static int s_nEventMax = sizeof(s_nEvents)/sizeof(s_nEvents[0]);
static int s_nEventCnt = 0;
static int s_nKeyLogMax = 1;
@ -119,31 +155,48 @@ static u8 s_altKeyPresent = FALSE; /* By default we don't have a Alt Key */
#define GPIO_G8 S3C2410_GPG8
#define GPIO_G9 S3C2410_GPG9
#define GPIO_D10 S3C2410_GPD10
#define GPIO_D11 S3C2410_GPD11
#define GPIO_D14 S3C2410_GPD14
#define GPIO_H4 S3C2410_GPH4
#define GPIO_H5 S3C2410_GPH5
static cyIrq *s_nIrq ;
static int nCnt;
#ifdef CYIO_POLLING
static int nPCnt;
static cyPoll *s_nPio;
#endif
static cyIrq s_nIrq_GEN4[] =
{ /* Event structure for the Cybook Gen3 (2440) */
/* IRQ GPIO A B C Depress Event Release Event Alt Event Name Number */
{ IRQ_EINT0, GPIO_F0, 0, 1, 0, CYEVENT_KEY_OFF, 0, 0, "PowerBtn" } //0
//, { IRQ_EINT1, GPIO_F1, 0, 0, 0, CYEVENT_SD_IN, CYEVENT_SD_OUT, 0, "SD Card" } //1
//, { IRQ_EINT2, GPIO_F2, 0, 0, 0, CYEVENT_TP_PRESS, CYEVENT_TP_REL, 0, "Touch Panel" } //2
//
/* EINT3 is not Wifi EINT */
/* EINT4 is Headphone plug status */
/* EINT5 is Touchpanel Enable */
/* EINT6 is charger status */
, { IRQ_EINT7, GPIO_F7, 0, 1, 0, CYEVENT_KEY_LEFT, 0, 0, "Left" } //3
/* INT8 is Power Keey???? */
//, { IRQ_EINT9, GPIO_G1, 0, 0, 0, CYEVENT_USB_IN, CYEVENT_USB_OUT, 0, "USB" } //4
/* EINT10 is SD power enable */
, { IRQ_EINT15, GPIO_G7, 0, 1, 0, CYEVENT_KEY_RIGHT, 0, 0, "Right" } //5
, { IRQ_EINT7, GPIO_F7, 0, 1, 0, CYEVENT_KEY_DOWN, 0, 0, "Down" } //1
, { IRQ_EINT15, GPIO_G7, 0, 1, 0, CYEVENT_KEY_UP, 0, 0, "Up" } //2
, { IRQ_EINT8, GPIO_G0, 0, 1, 0, CYEVENT_KEY_LEFT, 0, 0, "Left" } //3
, { IRQ_EINT10, GPIO_G2, 0, 1, 0, CYEVENT_KEY_RIGHT, 0, 0, "Right" } //4
, { IRQ_EINT14, GPIO_G6, 0, 1, 0, CYEVENT_KEY_ENTER, 0, 0, "Center" } //5
, { IRQ_EINT9, GPIO_G1, 0, 0, 0, CYEVENT_USB_OUT, CYEVENT_USB_IN, 0, "USB" } //6
/* IRQ GPIO A B C Depress Event Release Event Alt Event Name Number */
/* A:Reserved (must be 0) - B: Is Keypress Event? (or Allow Repeat?) (1: Yes, 0: No) - C: Is Alt Key? (1: Yes 0: No) */
};
#ifdef CYIO_POLLING
static cyPoll s_nPoll_GEN4[] =
{
/* GPIO, Must 0 Depress Event, Release Event Name */
// { GPIO_H4, 0, CYEVENT_KEY_LEFT, 0, "Left" }
//, { GPIO_H5, 0, CYEVENT_KEY_RIGHT, 0, "Right" }
//, { GPIO_D14, 0, CYEVENT_KEY_ENTER, 0, "Enter" }
/* GPIO, Must 0 Depress Event, Release Event, Name */
};
#endif
static u8* s_pbUsbPowered = NULL;
static u8* s_pbAcPowered = NULL;
static u8* s_pbPowerOff = NULL;
static u8* s_pbVolMinus = NULL;
@ -151,6 +204,16 @@ static irqreturn_t io_interrupt(int irq, void *dev_id);
#ifdef CYIO_TIMER
static void io_timer_handler(unsigned long nData);
#ifdef CYIO_POLLING
static void io_btn_timer_handler(unsigned long nData);
#endif
#endif
#ifdef CYIO_POLLING
static int procReadIo (char *page, char **start, off_t off, int count,
int *eof, void *data);
static int procWriteIo (struct file *file, const char *buffer,
unsigned long count, void *data);
#endif
#undef MSG
@ -186,35 +249,50 @@ static void io_timer_handler(unsigned long nData);
#endif
/* Allow other modules/driver to push cyio event */
void Cyio_PushEvent(char eventId, char unique)
int Cyio_PushEvent(char eventId, char unique)
{
cyEvent *pEventC;
int ret = 0;
spinLock(&io_lock);
/* CyIO is not running, ie no one take it, so don't accept events */
if (CyIO_Running == 0)
{
spinUnlock(&io_lock);
return -1;
}
if (unique != 0)
{
pEventC = s_pEventR;
do
{
if (pEventC->nCode == eventId)
{
ret = -EEXIST;
goto exit;
}
pEventC = pEventC->pNext;
} while ((pEventC != s_pEventW) && (s_pEventR != s_pEventW));
}
DBG("New Pushed event '%c'\n", eventId);
DBG("New Pushed event '%c'\n", eventId>8);
if (s_pEventW)
{
++s_nEventCnt;
s_pEventW->nCode = eventId;
s_pEventW->nKeyEvent = 0;
s_pEventW->bValid = 1;
s_pEventW = s_pEventW->pNext;
}
spinUnlock(&io_lock);
ret = 0;
exit:
if (ptsk)
wake_up_process(ptsk);
return ret;
}
EXPORT_SYMBOL(Cyio_PushEvent);
@ -260,6 +338,7 @@ void io_initEventList(void)
cyEvent* pEvent = &s_nEvents[i];
pEvent->nCode = 0;
pEvent->nKeyEvent = 0;
pEvent->bValid = 0;
if (s_pEventR)
s_pEventR->pNext = pEvent;
s_pEventR = pEvent;
@ -289,8 +368,28 @@ void io_initIrq(void)
int i;
cyIrq *pIrq, *pIrq0;
int ret;
#ifdef CYIO_POLLING
cyPoll *pPoll, *pPoll0;
pPoll0 = &s_nPio[0];
#endif
pIrq0 = &s_nIrq[0];
DBG(">>%s()\n", __func__);
#ifdef CYIO_POLLING
tiltRotation = 90;
for (i=0, pPoll=pPoll0; i<nPCnt; ++i, ++pPoll)
{
s3c2410_gpio_cfgpin(pPoll->nGpio, 0);
s3c2410_gpio_pullup(pPoll->nGpio, 0);
}
s3c2410_gpio_cfgpin(GPIO_D10, 0);
s3c2410_gpio_pullup(GPIO_D10, 0);
s3c2410_gpio_cfgpin(GPIO_D11, 0);
s3c2410_gpio_pullup(GPIO_D11, 0);
#endif
// Read state as fast as possible (important when resuming)
for (i=0, pIrq=pIrq0; i<nCnt; ++i, ++pIrq)
{
@ -311,8 +410,8 @@ void io_initIrq(void)
switch (pIrq->nCodeActive)
{
case CYEVENT_USB_IN:
case CYEVENT_USB_OUT:
s_pbUsbPowered = &pIrq->bActive;
s_pbAcPowered = &pIrq->bActive;
break;
case CYEVENT_AC_IN:
break;
@ -342,6 +441,7 @@ void io_initIrq(void)
++s_nKeyLogCnt;
s_pEventW->nCode = CYEVENT_FACTORY_OFF;
s_pEventW->nKeyEvent = 1;
s_pEventW->bValid = 0;
s_pEventW = s_pEventW->pNext;
}
spinUnlock(&io_lock);
@ -369,6 +469,7 @@ void io_initIrq(void)
++s_nKeyLogCnt;
s_pEventW->nCode = pIrq->bActive ? pIrq->nCodeActive : pIrq->nCodeInactive;
s_pEventW->nKeyEvent = pIrq->bKeyIrq;
s_pEventW->bValid = 0;
s_pEventW = s_pEventW->pNext;
}
}
@ -380,8 +481,12 @@ void io_initIrq(void)
int nIrq = pIrq->nIrq;
set_irq_type(nIrq, IRQT_BOTHEDGE);
/* Set no Pullup and no Pulldown */
s3c2410_gpio_pullup(pIrq->nGpio, 0);
DBG(".. io_initIrq [%s][%c] bActive[%d]", pIrq->sName, pIrq->bActive || !pIrq->nCodeInactive ? (char)pIrq->nCodeActive : (char)pIrq->nCodeInactive, pIrq->bActive);
ret = request_irq(nIrq, io_interrupt, SA_INTERRUPT|SA_SHIRQ, "cyio", pIrq);
ret = request_irq(nIrq, io_interrupt, SA_INTERRUPT|SA_SHIRQ, pIrq->sName, pIrq);
enable_irq_wake(nIrq);
if (ret != 0)
{
printk(KERN_ERR PFX "Error registering IRQ %d [%s]!\n", nIrq, pIrq->sName);
@ -393,7 +498,16 @@ void io_initIrq(void)
timer_inited = 1;
io_timer.function = io_timer_handler;
io_timer.data = CYEVENT_SUSPEND_SCREEN;
#ifdef CYIO_POLLING
init_timer(&io_btn_timer);
io_btn_timer.function = io_btn_timer_handler;
io_btn_timer.expires = jiffies + HZ/8;
add_timer(&io_btn_timer);
#endif
#endif
spinLock(&io_lock);
CyIO_Running = 1;
spinUnlock(&io_lock);
}
// ---------------------------------------------------------------------------
void io_deinitIrq(void)
@ -401,18 +515,27 @@ void io_deinitIrq(void)
int i;
cyIrq *pIrq, *pIrq0;
spinLock(&io_lock);
CyIO_Running = 0;
spinUnlock(&io_lock);
#ifdef CYIO_TIMER
del_timer(&io_timer);
timer_run = 0;
# ifdef CYIO_POLLING
del_timer(&io_btn_timer);
# endif
#endif
//nCnt = sizeof(s_nIrq)/sizeof(s_nIrq[0]);
pIrq0 = &s_nIrq[0];
for (i=0, pIrq=pIrq0; i<nCnt; ++i, ++pIrq)
{
disable_irq_wake(pIrq->nIrq);
free_irq(pIrq->nIrq, pIrq);
}
}
// ---------------------------------------------------------------------------
//#define DBG_IRQ
static irqreturn_t io_interrupt(int irq, void *dev_id)
{
cyIrq* pIrq = (cyIrq*)dev_id;
@ -445,16 +568,22 @@ static irqreturn_t io_interrupt(int irq, void *dev_id)
return IRQ_HANDLED;
#ifdef DBG_IRQ
#ifdef CYIO_ALTERNATE_KEY
DBG(".. io_irq #%d [%s][%c] alt[%d:%d] bActive[%d]", s_nIrq_dbg, pIrq->sName, bActive || !pIrq->nCodeInactive ? (char)pIrq->nCodeActive : (char)pIrq->nCodeInactive, (s_altKeyPress && pIrq->bKeyIrq) ? pIrq->nCodeAlternate : (bActive ? pIrq->nCodeActive : pIrq->nCodeInactive), s_altKeyPress, bActive);
#else
DBG(".. io_irq #%d [%s][%c] bActive[%d]", s_nIrq_dbg, pIrq->sName, bActive || !pIrq->nCodeInactive ? (char)pIrq->nCodeActive : (char)pIrq->nCodeInactive, (bActive ? pIrq->nCodeActive : pIrq->nCodeInactive), bActive);
#endif
#endif
blCodeActive = (s_altKeyPress && pIrq->bKeyIrq) ? pIrq->nCodeAlternate : (bActive ? pIrq->nCodeActive : pIrq->nCodeInactive);
#ifdef CYIO_ALTERNATE_KEY
blCodeActive = (s_altKeyPress && pIrq->bKeyIrq) ? pIrq->nCodeAlternate : (bActive ? pIrq->nCodeActive : pIrq->nCodeInactive);
if (s_altKeyPresent)
{
s_altKeyPress = !gpio_get_value(s_altKeyGpio);
DBG("alt status: %d", s_altKeyPress);
}
#else
blCodeActive = bActive ? pIrq->nCodeActive : pIrq->nCodeInactive;
#endif
spinLock(&io_lock);
@ -482,6 +611,7 @@ static irqreturn_t io_interrupt(int irq, void *dev_id)
++s_nEventCnt;
s_pEventW->nCode = CYEVENT_KEY_REPEAT_END;
s_pEventW->nKeyEvent = 0;
s_pEventW->bValid = 0;
s_pEventW = s_pEventW->pNext;
}
if (ptsk)
@ -520,6 +650,7 @@ static irqreturn_t io_interrupt(int irq, void *dev_id)
++s_nKeyLogCnt;
s_pEventW->nCode = CYEVENT_FACTORY_OFF;
s_pEventW->nKeyEvent = 1;
s_pEventW->bValid = 0;
s_pEventW = s_pEventW->pNext;
}
spinUnlock(&io_lock);
@ -578,6 +709,7 @@ static irqreturn_t io_interrupt(int irq, void *dev_id)
#endif
s_pEventW->nKeyEvent = pIrq->bKeyIrq;
s_pEventW->bValid = 0;
s_pEventW = s_pEventW->pNext;
}
@ -593,17 +725,82 @@ static irqreturn_t io_interrupt(int irq, void *dev_id)
// ---------------------------------------------------------------------------
#ifdef CYIO_TIMER
#ifdef CYIO_POLLING
static void io_btn_timer_handler(unsigned long nData)
{
/* read buttons */
cyPoll *pPoll, *pPoll0;
int i;
int curState;
int currentTilt, tE1, tE2;
pPoll0 = &s_nPio[0];
DBG(">>%s()\n", __func__);
for (i=0, pPoll=pPoll0; i<nPCnt; ++i, ++pPoll)
{
curState = !gpio_get_value(pPoll->nGpio);
DBG("|| Btn '%s' [current: %d, old: %d, gpio: %d]\n", pPoll->sName, curState, pPoll->oldState, pPoll->nGpio);
/* If button found pressed, then push event 'bout them */
if (pPoll->oldState != curState)
{
if (curState != 0)
Cyio_PushEvent(pPoll->nCodeActive, 1);
/*else
Cyio_PushEvent(CYEVENT_KEY_REPEAT_END, 1);*/
}
else if (pPoll->oldState != 0)
{
/* Push event with repeat flag */
//Cyio_PushEvent(pPoll->nCodeActive | CYEVENT_KEY_REPEAT_FLAG, 1);
}
pPoll->oldState = curState;
}
/* special case, look at the tilt sensor */
tE1 = !gpio_get_value(GPIO_D11);
tE2 = !gpio_get_value(GPIO_D10);
currentTilt = 0;
if (!tE2)
currentTilt |= 1 << 1;
if (!tE1)
currentTilt |= 1 << 0;
switch(currentTilt)
{
case 0x00: /* 90 */
currentTilt = 90;
break;
case 0x01: /* 0 */
currentTilt = 0;
break;
case 0x02: /* 180 */
currentTilt = 180;
break;
case 0x03: /* 270 */
currentTilt = 270;
break;
}
if (currentTilt != tiltRotation)
{ /* We move */
tiltRotation = currentTilt;
printk("New tilt: %d\n", tiltRotation);
Cyio_PushEvent(CYEVENT_ORIENTATIONCHANGED, 1);
}
/* Update the timer */
io_btn_timer.expires = jiffies + HZ/8;
mod_timer(&io_btn_timer, io_btn_timer.expires);
DBG("<<%s()\n", __func__);
}
#endif
static void io_timer_handler(unsigned long nData)
{
/* YEP inside */
#if 0
//#ifdef G_SENSOR
if (hold_wakeup==1) {
del_timer(&io_timer);
goto end_timer;
}
#endif
/* end YEP inside */
DBG("Timer [%ld] tick...\n", nData);
spin_lock_irq(&io_lock);
@ -617,6 +814,7 @@ static void io_timer_handler(unsigned long nData)
++s_nEventCnt;
s_pEventW->nCode = (u8)nData;
s_pEventW->nKeyEvent = 0;
s_pEventW->bValid = 0;
s_pEventW = s_pEventW->pNext;
}
}
@ -682,7 +880,7 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
int nBytes = sizeof(unsigned long);
unsigned long nData;
ssize_t nRes = 0;
u8 bDataValid = 0;
if (count < sizeof(unsigned long))
return -EINVAL;
@ -694,6 +892,7 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if (s_nEventCnt)
{
nData = s_pEventR->nCode;
bDataValid = s_pEventR->bValid;
s_pEventR->nCode = 0;
--s_nEventCnt;
if (s_pEventR->nKeyEvent)
@ -702,7 +901,6 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
#ifdef CYIO_REPEAT
if (nData != CYEVENT_KEY_OFF)
{
DBG("(line %d)Set s_nPrevKey", __LINE__);
s_nPrevKey = nData;
s_bRepMode = 0;
}
@ -717,7 +915,6 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
cyIrq *pIrq, *pIrq0;
pIrq0 = &s_nIrq[0];
MSG("Will test key...");
for (i=0, pIrq=pIrq0; i<nCnt; ++i, ++pIrq)
{
#ifdef CYIO_ALTERNATE_KEY
@ -726,21 +923,17 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
if (pIrq->nCodeActive != s_nPrevKey)
#endif
{
MSG("!CodeActive and Alt+!AltCode");
continue;
}
MSG("May clear prevkey");
if (!pIrq->bActive || gpio_get_value(pIrq->nGpio))
{
DBG("(line %d)Set s_nPrevKey", __LINE__);
s_nPrevKey = 0;
}
break;
}
if (s_nPrevKey)
{
MSG("Will Set Repeat flag...");
nData = s_nPrevKey | CYEVENT_KEY_REPEAT_FLAG;
s_bRepMode = 1;
}
@ -748,7 +941,7 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
#endif
spinUnlock(&io_lock);
if (nData != 0)
if ((nData != 0) | (bDataValid == 1))
{
#ifdef CYIO_TIMER
del_timer(&io_timer);
@ -759,7 +952,7 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
}
#ifdef CYIO_TIMER
if (s_pbUsbPowered && s_pbAcPowered && !(*s_pbUsbPowered) && !(*s_pbAcPowered))
if (s_pbUsbPowered && (*s_pbUsbPowered))
{
del_timer(&io_timer);
timer_run = 0;
@ -792,7 +985,7 @@ ssize_t io_read(struct file *file, char *buf, size_t count, loff_t *ppos)
}
}
if (nData)
if ((nData != 0) | (bDataValid == 1))
{
nRes = copy_to_user(buf,&nData,nBytes);
if (!nRes)
@ -835,7 +1028,7 @@ static int io_remove(struct platform_device *dev)
misc_deregister(&s_io_dev);
return 0;
}
// ---------------------------------------------------------------------------
// --------------------------------------------------------------------------
static int io_resume(struct platform_device *dev)
{
//cyIrq *pIrq;
@ -904,12 +1097,22 @@ static int __init cyIo_init(void)
}
#endif
s_nIrq = s_nIrq_GEN4;
#ifdef CYIO_POLLING
s_nPio = s_nPoll_GEN4;
nPCnt = sizeof(s_nPoll_GEN4)/sizeof(s_nPoll_GEN4[0]);
#endif
nCnt = sizeof(s_nIrq_GEN4)/sizeof(s_nIrq_GEN4[0]);
DBG("s_nEventMax:%d, s_nEventCnt:%d, s_nKeyLogMax:%d, s_nKeyLogCnt:%d",s_nEventMax,s_nEventCnt,s_nKeyLogMax,s_nKeyLogCnt);
/* end YEP inside */
#ifdef CYIO_POLLING
rootDir = proc_mkdir(GPROCFS_MODULEFOLDER, proc_root_driver);
ioProcEntry = create_proc_entry(GPROCFS_IOFILE, 0644, rootDir);
ioProcEntry->read_proc = procReadIo;
ioProcEntry->write_proc = procWriteIo;
ioProcEntry->owner = THIS_MODULE;
#endif
io_initEventList();
@ -929,6 +1132,57 @@ static void __exit cyIo_exit(void)
//MSG("<< cyIo_exit");
}
#ifdef CYIO_POLLING
static int procReadIo (char *page, char **start, off_t off, int count,
int *eof, void *data)
{
int len;
char tmp = 0;
//printk("Read IO Tilt [%d]", tiltRotation);
switch (tiltRotation)
{
case 270:
tmp++;
case 180:
tmp++;
case 90:
tmp++;
default:
break;
}
len = sprintf (page, "%02X", tmp);
DBG("io readed value: %02X", tmp);
return len;
}
static int procWriteIo (struct file *file, const char *buffer,
unsigned long count, void *data)
{
char cmd;
/* in case of... */
if ( count < 1 )
return 0;
cmd = buffer[0];
switch(cmd)
{
case G_SENSOR_CAL:
case G_SENSOR_ON:
case G_SENSOR_OFF:
case 254:
break;
default:
printk(KERN_ERR "ProcIO: Unknown command '%c'\n",cmd);
break;
}
return count;
}
#endif
// ---------------------------------------------------------------------------
module_init(cyIo_init);
module_exit(cyIo_exit);

View File

@ -1,65 +0,0 @@
// ===========================================================================
// cyio.h
// Copyright (C) 2008-2009 Bookeen - All rights reserved
// ===========================================================================
// Key events
#define CYEVENT_KEY_ENTER 'e'
#define CYEVENT_KEY_RIGHT 'r'
#define CYEVENT_KEY_DOWN 'd'
#define CYEVENT_KEY_LEFT 'l'
#define CYEVENT_KEY_UP 'u'
#define CYEVENT_KEY_F1 '1'
#define CYEVENT_KEY_F2 '2'
#define CYEVENT_KEY_F3 '3'
#define CYEVENT_KEY_F4 '4'
#define CYEVENT_KEY_OFF 'o'
#define CYEVENT_KEY_VOLP '+'
#define CYEVENT_KEY_VOLN '-'
#define CYEVENT_KEY_REPEAT_FLAG 0x80
#define CYEVENT_KEY_REPEAT_END '0'
// Physical events
#define CYEVENT_USB_IN 'p'
#define CYEVENT_USB_OUT 'q'
#define CYEVENT_AC_IN 'a'
#define CYEVENT_AC_OUT 'b'
#define CYEVENT_ACN_IN 'j'
#define CYEVENT_ACN_OUT 'k'
#define CYEVENT_SD_IN 's'
#define CYEVENT_SD_OUT 't'
#define CYEVENT_SDN_IN 'u'
#define CYEVENT_SDN_OUT 'v'
// G-Sensor events
#define CYEVENT_ORIENTATIONCHANGED 'O'
#define CYEVENT_G_ROT000 'A'
#define CYEVENT_G_ROT090 'B'
#define CYEVENT_G_ROT180 'C'
#define CYEVENT_G_ROT270 'D'
#define CYEVENT_TOGGLE_GSENSOR 'G'
// Logical events
// CYEVENT_KEY_OFF + CYEVENT_KEY_VOLN
#define CYEVENT_FACTORY_OFF 'x'
#define CYEVENT_SUSPEND_SCREEN 'y'
#define CYEVENT_SUSPEND_DEVICE 'z'
// ===========================================================================
/* YEP inside */
#define CYIO_KERNEL_2_6 1
#define G_SENSOR_ON '1'
#define G_SENSOR_OFF '0'
#define G_SENSOR_CAL 'C'
/* end YEP inside */
enum
{
CYGSENSOR_STATUS_ENABLED = 0,
CYGSENSOR_STATUS_DISABLED = 1,
CYGSENSOR_STATUS_NOTCALIB = 2, /* Not calibrated, or invalid calibration data */
CYGSENSOR_STATUS_CALIBRATED = 3, /* This status should never been read, but it could help to debug */
CYGSENSOR_STATUS_UNKNOWN = 4, /* This status should not been read too, but it could help to debug */
};
/* Exported function of CyIO */
void Cyio_ResetTimer(void);
void Cyio_PushEvent(char eventId, char unique);

View File

@ -22,6 +22,10 @@
#include <asm/irq.h>
#include <asm/arch/regs-gpio.h>
/*Qisda , wenny cheng , 20091224 , board id info {*/
#include <../include/asm-arm/plat-s3c24xx/common-smdk.h>
/*Qisda , wenny cheng , 20091224 , board id info }*/
/* Qisda, ShiYong Lin, 2009/08/18, Detect insertion source {*/
#include <asm/arch/regs-udc-hs.h>
#include <asm/arch/regs-s3c2416-clock.h>
@ -45,8 +49,24 @@
#define QISDA_TILT_180 3
#define QISDA_TILT_270 2
/*Qisda , wenny cheng , 20091224 , board id info {*/
//static int hw_version_for_keypad = 0;
extern int board_id;
/*Qisda , wenny cheng , 20091224 , board id info }*/
extern int average_adc_value_keep1; /*joey add to keep ADC will always return lower one 2009/12/28*/
extern int average_adc_value_keep2; /*joey add to keep ADC will always return lower one 2009/12/28*/
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event {
int sleeping_cha_event = 0;
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event }
/*Qisda , howard hsu, 20100116 , op_mode-delay key event {*/
#define OP_MODE_DELAY_REQUEST KEY_F9
/*} Qisda , howard hsu, 20100116 , op_mode-delay key event*/
#if defined(CONFIG_QISDA_AS090B00_EVT1) || defined(CONFIG_QISDA_AS090B00_EVT1_1)
#define MAX_KEYPAD_QISDA 22
#define MAX_KEYPAD_QISDA 23 /*shiyong joey for asus 2009/12/15*/
static int keypad_keycode_qisda[] = {
KEY_PAGEDOWN, KEY_PAGEUP, KEY_VOLUMEDOWN, KEY_VOLUMEUP,
KEY_F1, KEY_F2, KEY_F3, KEY_INSERT, KEY_ESC,
@ -54,9 +74,8 @@ static int keypad_keycode_qisda[] = {
KEY_CHA_STA_WALL_CHARGER, KEY_CHA_STA_UNPLUG,
KEY_CHA_STA_USB, KEY_BATTERY_FAIL,
KEY_SLEEP, KEY_TIMER_TICK,
/* } Qisda, ShiYong Lin, 2009/09/08, Implement for message for AP */
KEY_F4, KEY_F5, KEY_F6, KEY_F7, KEY_F8, KEY_SOUND,
KEY_SD_INSERT
KEY_SD_INSERT, KEY_BATTERY /*shiyong joey for asus 2009/12/15*/
};
#endif
@ -65,9 +84,10 @@ static int keypad_keycode_qisda[] = {
#define QISDA_E600
//#define QISDA_L600
//#define QISDA_BQ060B00_DVT
#define MAX_KEYPAD_QISDA 27
#define MAX_KEYPAD_QISDA 29
static int keypad_keycode_qisda[] = {
KEY_MENU, KEY_SEARCH, KEY_PAGEDOWN, KEY_PAGEUP,
KEY_BACK, KEY_VOLUMEDOWN, KEY_VOLUMEUP, KEY_WAKEUP,
@ -78,14 +98,17 @@ static int keypad_keycode_qisda[] = {
/* Qisda, ShiYong Lin, 2009/09/08, Implement for message for AP {*/
KEY_CLOSE, KEY_CHA_STA_WALL_CHARGER, KEY_CHA_STA_UNPLUG,
KEY_CHA_STA_USB, KEY_BATTERY_FAIL,
KEY_SLEEP, KEY_TIMER_TICK
KEY_SLEEP, KEY_TIMER_TICK, KEY_BATTERY,
/* } Qisda, ShiYong Lin, 2009/09/08, Implement for message for AP */
/*Qisda , howard hsu, 20100116 , op_mode-delay key event {*/
KEY_F9
/*} Qisda , howard hsu, 20100116 , op_mode-delay key event*/
};
#endif
#ifdef CONFIG_QISDA_QD090B00
#define MAX_KEYPAD_QISDA 25
#define MAX_KEYPAD_QISDA 27
static int keypad_keycode_qisda[] = {
KEY_MENU, KEY_SEARCH, KEY_PAGEDOWN, KEY_PAGEUP,
KEY_BACK, KEY_VOLUMEDOWN, KEY_VOLUMEUP, KEY_WAKEUP,
@ -95,8 +118,11 @@ static int keypad_keycode_qisda[] = {
/* Qisda, ShiYong Lin, 2009/09/08, Implement for message for AP {*/
KEY_CLOSE, KEY_CHA_STA_WALL_CHARGER, KEY_CHA_STA_UNPLUG,
KEY_CHA_STA_USB, KEY_BATTERY_FAIL,
KEY_SLEEP, KEY_TIMER_TICK
KEY_SLEEP, KEY_TIMER_TICK, KEY_BATTERY,
/* } Qisda, ShiYong Lin, 2009/09/08, Implement for message for AP */
/*Qisda , howard hsu, 20100116 , op_mode-delay key event {*/
KEY_F9
/*} Qisda , howard hsu, 20100116 , op_mode-delay key event*/
};
#endif
@ -114,6 +140,9 @@ static int keypad_set_irq = FALSE;
/* Qisda, ShiYong Lin, 2009/11/11, Fix the trembling voice issue when plugging usb {*/
static struct timer_list charger_source_timer;
/* } Qisda, ShiYong Lin, 2009/11/11, Fix the trembling voice issue when plugging usb */
/*joey add timer to avoid bouncing with usb in/out 20100127*/
static struct timer_list battery_status_timer;
/* Qisda, ShiYong Lin, 2009/11/11, Modify for pwr fail event occurring wrongly when heavy loading {*/
static struct timer_list power_fail_timer;
@ -157,15 +186,37 @@ static void keypad_port_initialize(void)
#ifdef CONFIG_QISDA_QD090B00
//Set gpio as input and pull-up enable
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_INP); //T_SENSOR2
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_INP); //T_SENSOR1
/*Qisda , wenny cheng , 20091224 , board id info {*/
// hw_version_for_keypad = readl(S3C2416_GPKDAT) & (0x3<<3);
printk("\nhw_version_for_keypad: %d\n", board_id);
//if(hw_version_for_keypad){
if(board_id != QD090B00_S02){
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); // Tilt_EN
s3c2410_gpio_setpin(S3C2410_GPC3, 1);
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_EINT10); // Search
s3c2410_gpio_pullup(S3C2410_GPG2, 2);
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_EINT11); // Return
s3c2410_gpio_pullup(S3C2410_GPG3, 2);
}
else{
//old
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_INP); // Search
s3c2410_gpio_pullup(S3C2410_GPD14, 2);
s3c2410_gpio_cfgpin(S3C2410_GPD15, S3C2410_GPD15_INP); // Return
s3c2410_gpio_pullup(S3C2410_GPD15, 2);
}
/*Qisda , wenny cheng , 20091224 , board id info }*/
//Set gpio as input and pull-up enable
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_INP); //T_SENSOR2
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_INP); //T_SENSOR1
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0); // power
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
@ -191,31 +242,62 @@ static void keypad_port_initialize(void)
#ifdef CONFIG_QISDA_QD060B00
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); // Tilt_EN
s3c2410_gpio_setpin(S3C2410_GPC3, 1);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_INP); //T_SENSOR2
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP); //T_SENSOR1
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_INP); // Menu / Plato: Menu
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_INP); // VOL-/LEFT
s3c2410_gpio_pullup(S3C2410_GPG0, 2);
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_INP); // VOL+/RIGHT
s3c2410_gpio_pullup(S3C2410_GPG2, 2);
s3c2410_gpio_cfgpin(S3C2410_GPH5, S3C2410_GPH5_OUTP); // USB_SEL: DEVICE ONLY
s3c2410_gpio_setpin(S3C2410_GPH5, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_INP); //T_SENSOR2
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_INP); //T_SENSOR1
//Set gpio as input and pull-up enable
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_INP); // Menu
// Qisda Jonas disable for keypad rework 20100104
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_INP); // Menu / Plato: Menu
s3c2410_gpio_pullup(S3C2410_GPD14, 2);
s3c2410_gpio_cfgpin(S3C2410_GPD15, S3C2410_GPD15_INP); // Page down / Back
s3c2410_gpio_pullup(S3C2410_GPD15, 2);
// Qisda Jonas disable for keypad rework
s3c2410_gpio_cfgpin(S3C2410_GPF0, S3C2410_GPF0_EINT0); // power
s3c2410_gpio_pullup(S3C2410_GPF0, 2);
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_INP); // Back / Right
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
s3c2410_gpio_cfgpin(S3C2410_GPH5, S3C2410_GPH5_INP); // Search / UP / Plato: Vol up
s3c2410_gpio_pullup(S3C2410_GPH5, 2);
#ifdef QISDA_E600
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_INP); // Page up
// Qisda Jonas modify for keypad rework 20100104
s3c2410_gpio_cfgpin(S3C2410_GPG3, S3C2410_GPG3_EINT11); // Menu key
s3c2410_gpio_pullup(S3C2410_GPG3, 2);
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_EINT12); // Page up, Plato: Back
s3c2410_gpio_pullup(S3C2410_GPG4, 2);
// Qisda Jonas modify for keypad rework
#endif
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_INP); // VOL / Down
s3c2410_gpio_cfgpin(S3C2410_GPD15, S3C2410_GPD15_INP); // Page down / Back / Plato: Back
s3c2410_gpio_pullup(S3C2410_GPD15, 2);
s3c2410_gpio_cfgpin(S3C2410_GPF7, S3C2410_GPF7_EINT7); // Back / Right / Plato: Page down
s3c2410_gpio_pullup(S3C2410_GPF7, 2);
s3c2410_gpio_cfgpin(S3C2410_GPG6, S3C2410_GPG6_EINT14); // VOL / Down / Plato: Search
s3c2410_gpio_pullup(S3C2410_GPG6, 2);
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_INP); // Refresh / Left
s3c2410_gpio_cfgpin(S3C2410_GPG7, S3C2410_GPG7_EINT15); // Refresh / Left / Plato: Page up
s3c2410_gpio_pullup(S3C2410_GPG7, 2);
#ifdef QISDA_L600
@ -223,24 +305,30 @@ static void keypad_port_initialize(void)
s3c2410_gpio_pullup(S3C2410_GPH4, 2);
#endif
s3c2410_gpio_cfgpin(S3C2410_GPH5, S3C2410_GPH5_INP); // Search / UP
s3c2410_gpio_pullup(S3C2410_GPH5, 2);
#ifdef CONFIG_QISDA_BQ060B00_DVT
s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_INP); // Plato: Vol down
s3c2410_gpio_pullup(S3C2410_GPH4, 2);
#endif
/* Qisda, ShiYong Lin, 2009/08/27, Implement for message for AP {*/
// Power_Fail, GPG5, need to open when EVT2
// Both edge triggered
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1); /* EINT13 filter enable */
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(6<<20)), S3C2410_EXTINT1);
#endif
// CHG_STA, GPG1, need to open when EVT2,
// Both edge triggered
// CHG_STA, GPF6, Both edge triggered /*shiyong joey for asus 2009/12/15*/
s3c2410_gpio_cfgpin(S3C2410_GPF6, S3C2410_GPF6_EINT6);
s3c2410_gpio_pullup(S3C2410_GPF6, 0); /*joey modify 2->0 20100127*/
writel((readl(S3C2410_EXTINT0) & ~(1<<27)), S3C2410_EXTINT0);
writel(((readl(S3C2410_EXTINT0) & ~(7<<24))|(4<<24)), S3C2410_EXTINT0); /*joey modify (6<<24) to (4<<24)) 20100127*/ /*1:high 4:rise 6:both*/
// VBUS_IN_STA, GPG1, Both edge triggered /*shiyong joey for asus 2009/12/15*/
s3c2410_gpio_cfgpin(S3C2410_GPG1, S3C2410_GPG1_EINT9);
s3c2410_gpio_pullup(S3C2410_GPG1, 0);
writel((readl(S3C2410_EXTINT1) & ~(1<<7)), S3C2410_EXTINT1); /* EINT9 filter enable */
writel(((readl(S3C2410_EXTINT1) & ~(7<<4))|(6<<4)), S3C2410_EXTINT1);
// Power_Fail, GPG5, Both edge triggered /*shiyong joey for asus 2009/12/15*/
s3c2410_gpio_cfgpin(S3C2410_GPG5, S3C2410_GPG5_EINT13);
s3c2410_gpio_pullup(S3C2410_GPG5, 2);
writel((readl(S3C2410_EXTINT1) & ~(1<<23)), S3C2410_EXTINT1);
writel(((readl(S3C2410_EXTINT1) & ~(7<<20))|(6<<20)), S3C2410_EXTINT1);
}
struct s3c_keypad_qisda *pdata;
@ -271,8 +359,8 @@ int IsWallCharger(void)
if((readl(S3C2410_GPGDAT)&0x2)==0x2){
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 1); /* usb power enbale */
s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPD13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD13,1); /* usb power enbale */
// s3c2410_gpio_cfgpin(S3C2410_GPD13, S3C2410_GPD13_OUTP);
// s3c2410_gpio_setpin(S3C2410_GPD13,1); /* usb power enbale */
/* if reset by sleep wakeup, control the retention I/O cell */
if (__raw_readl(S3C_RSTSTAT) & 0x8)
@ -285,17 +373,21 @@ int IsWallCharger(void)
udelay(1000);
__raw_writel((1<<2)|(0<<0), S3C_URSTCON);
__raw_writel((0<<2)|(0<<0), S3C_URSTCON);
__raw_writel((0<<3)|(0<<2)|(0<<1)|(0<<0), S3C_PHYCTRL);
__raw_writel((0<<3)|(0<<2)|(1<<1)|(0<<0), S3C_PHYCTRL);
__raw_writel((1<<31)|(0<<4)|(0<<3)|(0<<2)|(0<<1)|(0<<0), S3C_PHYPWR);
__raw_writel((0<<31)|(1<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
__raw_writel((1<<31)|(1<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
__raw_writel((1<<31)|(1<<4)|(1<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
}
for(i=0;i<10;i++) {
read_pin = __raw_readl(S3C_UDC_SYS_STATUS_REG)&0x60;
if(read_pin !=0x60){
udelay(1000);
}
//Benq,Andy modify for wall charger recognize bugfix
//if( (read_pin != 0x60) ){
if( (read_pin != 0x60) && (read_pin != 0x0)){ //Benq, Andy add (read_pin != 0x0)
// printk("usb\n");
printk("usb\n");
#if defined(CONFIG_QISDA_E600_EVT2)|| defined(CONFIG_QISDA_QD060N00_DVT1_1)
if((readl(S3C2410_GPGDAT) &(1<<1))==0)
{
@ -321,11 +413,20 @@ int IsWallCharger(void)
__raw_writel((0<<31)|(0<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
}
#endif
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
//{Benq,Andy add for USB power disable
printk("\nUSB_UDC_DEVICE_POWER_DOWN\n");
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 0); /* usb all power disable (USB_EN20)*/
//}Benq,Andy add for USB power disable
#endif
return 0;
}
else
{
// printk("wall charger\n");
printk("wall charger\n");
#if defined(CONFIG_QISDA_E600_EVT2)||defined(CONFIG_QISDA_QD060N00_DVT1_1)
if((readl(S3C2410_GPGDAT) &(1<<1))==0)
{
@ -349,6 +450,15 @@ int IsWallCharger(void)
__raw_writel((0<<31)|(0<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
}
#endif
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
//{Benq,Andy add for USB power disable
printk("\nUSB_UDC_DEVICE_POWER_DOWN\n");
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 0); /* usb all power disable (USB_EN20)*/
//}Benq,Andy add for USB power disable
#endif
return 1;
}
}
@ -390,21 +500,87 @@ static irqreturn_t s3c_pwrbtn_close_irq(int irq, void *id)
#else
s3c_keypad_deal(dev, read_pin, 7);
#endif
//close system by letting P_KEEP low
#ifdef POWER_KEY_FOR_SYS_SHUTDOWN
//close system by letting P_KEEP low
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD14, 0);
#else
s3c2410_gpio_setpin(S3C2410_GPG0, 0);
s3c2410_gpio_cfgpin(S3C2410_GPG0, S3C2410_GPG0_OUTP);
#endif
#endif
/* } Qisda, ShiYong Lin, 2009/08/27, Implementing power btn behavior */
return IRQ_HANDLED;
}
static void battery_status_handler(unsigned long data)
{
//struct input_dev *dev = id;
u32 read_pin;
u32 i, j;
printk("battery_status_handler\n");
read_pin = readl(S3C2410_GPGDAT) & (1<<1); /*joey add condition with usb/charger 20100128*/
if(read_pin!=0)
{
read_pin = readl(S3C2410_GPFDAT) & (0x01<<6);
#ifdef CONFIG_QISDA_QD090B00
if(read_pin)
{
//s3c_keypad_deal(dev, 0 , 25);
input_report_key(Message_dev,KEY_BATTERY,1);
input_sync(Message_dev);
printk("s3c_battery_status_irq, keypad_message_to_ap\n");
}
else
{
//s3c_keypad_deal(dev, 1 , 25);
input_report_key(Message_dev,KEY_BATTERY,0);
input_sync(Message_dev);
}
#else
if(read_pin)
{
//s3c_keypad_deal(dev, 0 , 27);
input_report_key(Message_dev,KEY_BATTERY,1);
input_sync(Message_dev);
printk("s3c_battery_status_irq, keypad_message_to_ap\n");
}
else
{
//s3c_keypad_deal(dev, 1 , 27);
input_report_key(Message_dev,KEY_BATTERY,0);
input_sync(Message_dev);
}
#endif
}
enable_irq(IRQ_EINT6); /*joey add timer to avoid bouncing with usb in/out 20100127*/
}
static irqreturn_t s3c_battery_status_irq(int irq, void *id) /*joey add timer to avoid bouncing with usb in/out 20100127*/
{
printk("s3c_battery_status_irq, detecting\n");
disable_irq(IRQ_EINT6);
battery_status_timer.expires = jiffies + (HZ);
add_timer(&battery_status_timer);
return IRQ_HANDLED;
}
/* Qisda, ShiYong Lin, 2009/11/11, Fix the trembling voice issue when plugging usb {*/
static irqreturn_t s3c_cha_sta_irq(int irq, void *id)
{
/* Qisda , howard hsu, 2010/01/16 , op_mode-delay key event {*/
op_mode_delay_message_to_ap(0);//0:usb,1:sd
/* } Qisda , howard hsu, 2010/01/16 , op_mode-delay key event */
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event {
sleeping_cha_event = 1;
// Qisda, 2010/02/18, TN Wei, sleep mode wakes up for usb event }
printk("s3c_cha_sta_irq\n");
disable_irq(IRQ_EINT9);
charger_source_timer.expires = jiffies + (HZ);
@ -453,17 +629,57 @@ void USB_SaftRemove_keypad_message_to_ap(uint uiSleep)
{
input_report_key(Message_dev,KEY_F6,1);
input_sync(Message_dev);
printk("Key-USB_PlugIn\n");
}
else
{
input_report_key(Message_dev,KEY_F6,0);
input_sync(Message_dev);
printk("USB_SaftRemove_keypad_message_to_ap, USB_SaftRemove_keypad_message_to_ap press\n");
printk("Key-USB_PlugOut\n");
//printk("USB_SaftRemove_keypad_message_to_ap, USB_SaftRemove_keypad_message_to_ap press\n");
}
}
/*} Qisda, Leo SJ Yang, 2009/10/26*/
/*Qisda , howard hsu, 20100116 , op_mode-delay key event {*/
/* OP_MODE_DELAY_REQUEST is KEY_F9 */
/* Qisda , howard hsu, 20100208 , add type, 0 for usb, 1 for sd */
void op_mode_delay_message_to_ap(uint type)
{
static uint last_type=0;
if (type == last_type)
{
if(pdata!=NULL)
{
change_bit(OP_MODE_DELAY_REQUEST,pdata->dev->key);
}
}
last_type = type;
input_report_key(Message_dev,OP_MODE_DELAY_REQUEST,type);
input_sync(Message_dev);
}
/*} Qisda , howard hsu, 20100116 , op_mode-delay key event*/
/* Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card { */
// disable it first, wait integration test
#ifdef CONFIG_SD_SW_DEBOUNCE
void SD_Detect_keypad_message_to_ap(uint sd_on)
{
static uint last_sd_on=0;
if (last_sd_on == sd_on)
{
printk("\nCC--Repeat SDKey(%d)\n",sd_on);
if(pdata!=NULL)
{
change_bit(KEY_F5,pdata->dev->key);
}
}
last_sd_on = sd_on;
input_report_key(Message_dev,KEY_F5,sd_on);
input_sync(Message_dev);
printk("\nCC--SendSD Key(%d)\n",sd_on);
}
#endif /* CONFIG_SD_SW_DEBOUNCE */
/* } Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card */
/* Qisda, ShiYong Lin, 2009/09/08, Implement sleep message to AP {*/
void s3c_keypad_pm_sleep_message_to_ap (uint uiSleep)
@ -485,6 +701,10 @@ static void s3c_keypad_set_irq(struct input_dev *dev)
request_irq(IRQ_EINT0, s3c_pwrbtn_close_irq,
SA_INTERRUPT, DEVICE_NAME, dev);
set_irq_type(IRQ_EINT6, 0x3); /*shiyong joey for asus 2009/12/15*/
request_irq(IRQ_EINT6, s3c_battery_status_irq,
SA_INTERRUPT, "s3c2410-battery status", dev);
set_irq_type(IRQ_EINT9, 0x3);
request_irq(IRQ_EINT9, s3c_cha_sta_irq,
SA_INTERRUPT, "s3c2410-charging status", dev);
@ -509,6 +729,9 @@ static void charger_source_handler(unsigned long data)
read_pin = readl(S3C2410_GPGDAT) & (1<<1);
printk("GPG1 = %d\n", read_pin);
if(read_pin != 0){
//s3c2410_gpio_pullup(S3C2410_GPF6, 0); /*joey add to put floating GPF6 with usb 20100201*/
average_adc_value_keep1=9999; /*joey add to keep ADC will always return lower one 2009/12/28*/
average_adc_value_keep2=9999; /*joey add to keep ADC will always return lower one 2009/12/28*/
input_report_key(Message_dev, KEY_CHA_STA_UNPLUG, 0);
input_sync(Message_dev);
printk("usb or wallchager\n");
@ -539,6 +762,7 @@ static void charger_source_handler(unsigned long data)
}
}
else{
//s3c2410_gpio_pullup(S3C2410_GPF6, 1); /*joey add to pull low GPF6 without usb 20100201*/
printk("nothing\n");
input_report_key(Message_dev, KEY_CHA_STA_UNPLUG, 1);
input_sync(Message_dev);
@ -558,6 +782,14 @@ static void charger_source_handler(unsigned long data)
//EN1
s3c2410_gpio_cfgpin(S3C2410_GPB4, S3C2410_GPB4_OUTP);
s3c2410_gpio_setpin(S3C2410_GPB4, 1);
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
//{Benq,Andy add for disable USB power
printk("\nUSB_UDC_DEVICE_POWER_DOWN\n");
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 0); /* usb all power disable (USB33 & USB12)*/
//}Benq,Andy add for disable USB power
#endif
}
enable_irq(IRQ_EINT9);
}
@ -627,6 +859,8 @@ static void keypad_timer_handler_qisda(unsigned long data)
u32 read_tilt;
static u32 tilt_status_previous;
static int tilt_counter=3;
static u32 mmc_status_previous = 0xF;
static int mmc_counter=16;
//struct s3c_keypad_qisda *pdata = (struct s3c_keypad_qisda *)data;
pdata = (struct s3c_keypad_qisda *)data;
@ -721,7 +955,24 @@ static void keypad_timer_handler_qisda(unsigned long data)
#ifdef CONFIG_QISDA_QD090B00
read_pin = readl(S3C2410_GPFDAT);
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 2); // Page down
/* Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card { */
#ifndef CONFIG_SD_SW_DEBOUNCE
if(mmc_status_previous != (read_pin & (0x1<<1))){
if(mmc_counter != 0){
mmc_counter--;
}
else{
s3c_keypad_deal(dev, (read_pin & (0x1<<1)), 16); // SD card
mmc_status_previous = (read_pin & (0x1<<1));
mmc_counter=16;
}
}
else{
mmc_counter=16;
}
#endif /* CONFIG_SD_SW_DEBOUNCE */
/* } Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card */
if(headphonr_insert != (read_pin & (1<<4))){ // Headphone
if(headphonr_insert_counter != 0){
@ -752,13 +1003,31 @@ static void keypad_timer_handler_qisda(unsigned long data)
s3c_keypad_deal(dev, (read_pin & (0x1<<6)), 0); // Menu
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 3); // Page up
/*Qisda , wenny cheng , 20091224 , board id info {*/
//if(hw_version_for_keypad){
if(board_id !=QD090B00_S02)
{
//new
s3c_keypad_deal(dev, read_pin & 1<<2, 1); // Search
s3c_keypad_deal(dev, read_pin & 1<<3, 4); // Return
}
/*Qisda , wenny cheng , 20091224 , board id info }*/
read_pin = readl(S3C2410_GPHDAT);
s3c_keypad_deal(dev, read_pin & 1<<5, 5); // Volume down
s3c_keypad_deal(dev, read_pin & 1<<4, 6); // Volume up
read_pin = readl(S3C2410_GPDDAT);
/*Qisda , wenny cheng , 20091224 , board id info {*/
//if(!hw_version_for_keypad){
if(board_id ==QD090B00_S02)
{
//old
s3c_keypad_deal(dev, read_pin & 1<<14, 1); // Search
s3c_keypad_deal(dev, read_pin & 1<<15, 4); // Return
}
/*Qisda , wenny cheng , 20091224 , board id info }*/
read_tilt = (read_pin & (0x3<<10)) >> 10;
if(tilt_status_previous != read_tilt){
@ -807,13 +1076,34 @@ static void keypad_timer_handler_qisda(unsigned long data)
#ifdef CONFIG_QISDA_QD060B00
read_pin = readl(S3C2410_GPFDAT);
#ifdef QISDA_E600
#ifdef CONFIG_QISDA_BQ060B00_DVT
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 2); // Page down
#else
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 4); // Back
#endif
#endif
#ifdef QISDA_L600
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 13); // Right
#endif
s3c_keypad_deal(dev, (read_pin & (0x1<<1)), 18); // SD card
/* Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card { */
#ifndef CONFIG_SD_SW_DEBOUNCE
if(mmc_status_previous != (read_pin & (0x1<<1))){
if(mmc_counter != 0){
mmc_counter--;
}
else{
s3c_keypad_deal(dev, (read_pin & (0x1<<1)), 18); // SD card
mmc_status_previous = (read_pin & (0x1<<1));
printk("Key-SD_CHANGE(%d)\n",mmc_status_previous);
mmc_counter=16;
}
}
else{
mmc_counter=16;
}
#endif /* CONFIG_SD_SW_DEBOUNCE */
/* } Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card */
if(headphonr_insert != (read_pin & (1<<4))){ // Headphone
if(headphonr_insert_counter != 0){
@ -841,19 +1131,53 @@ static void keypad_timer_handler_qisda(unsigned long data)
read_pin = readl(S3C2410_GPGDAT);
#ifdef QISDA_E600
#ifdef CONFIG_QISDA_BQ060B00_DVT
//s3c_keypad_deal(dev, (read_pin & (0x1<<4)), 8); // Refresh
s3c_keypad_deal(dev, (read_pin & (0x1<<6)), 1); // Search
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 3); // Page up
if(board_id ==BQ060B00_A02)
{
s3c_keypad_deal(dev, (read_pin & (0x1<<3)), 0); // Menu
s3c_keypad_deal(dev, (read_pin & (0x1<<4)), 4); // Back
}
#else
s3c_keypad_deal(dev, (read_pin & (0x1<<4)), 3); // Page up
if(board_id ==QD060B00_A02) {
s3c_keypad_deal(dev, (read_pin & (0x1<<3)), 0); // Menu
s3c_keypad_deal(dev, (read_pin & (0x1<<6)), 2); // Page down
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 1); // Search
} else if(board_id == QD060B00_A01_And_Before){
s3c_keypad_deal(dev, (read_pin & (0x1<<6)), 6); // Volume
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 8); // Refresh
}
#endif
#endif
#ifdef QISDA_L600
s3c_keypad_deal(dev, (read_pin & (0x1<<6)), 11); // Down
s3c_keypad_deal(dev, (read_pin & (0x1<<7)), 12); // Left
#endif
#ifdef CONFIG_QISDA_BK060B00
s3c_keypad_deal(dev, (read_pin & (0x1<<0)), 12); // LEFT
s3c_keypad_deal(dev, (read_pin & (0x1<<2)), 13); // RIGHT
#endif
read_pin = readl(S3C2410_GPHDAT);
#ifdef QISDA_E600
#ifdef CONFIG_QISDA_BQ060B00_DVT
s3c_keypad_deal(dev, read_pin & 1<<4, 5); // Volume down
s3c_keypad_deal(dev, read_pin & 1<<5, 6); // Volume up
#else
// Qisda Jonas modify for keypad rework 20100104
if(board_id ==QD060B00_A02) {
s3c_keypad_deal(dev, read_pin & 1<<5, 8); // Refresh
} else if (board_id == QD060B00_A01_And_Before){
s3c_keypad_deal(dev, read_pin & 1<<5, 1); // Search
}
// Qisda Jonas modify for keypad rework
#endif
#endif
#ifdef QISDA_L600
s3c_keypad_deal(dev, read_pin & 1<<4, 9); // OK
@ -862,16 +1186,40 @@ static void keypad_timer_handler_qisda(unsigned long data)
read_pin = readl(S3C2410_GPDDAT);
s3c_keypad_deal(dev, read_pin & 1<<14, 0); // Menu
#ifdef QISDA_E600
#ifdef CONFIG_QISDA_BQ060B00_DVT
// Qisda Jonas modify for keypad rework 20100103
if(board_id ==BQ060B00_A01_And_Before)
{
s3c_keypad_deal(dev, read_pin & 1<<14, 0); // Menu
s3c_keypad_deal(dev, read_pin & 1<<15, 4); // Back
}
#else
// Qisda Jonas modify for keypad rework
if(board_id == QD060B00_A02) {
s3c_keypad_deal(dev, read_pin & 1<<15, 6); // Volumn
} else if(board_id == QD060B00_A01_And_Before){
s3c_keypad_deal(dev, read_pin & 1<<14, 0); // Menu
s3c_keypad_deal(dev, read_pin & 1<<15, 2); // Page down
}
#endif
#endif
#ifdef QISDA_L600
s3c_keypad_deal(dev, read_pin & 1<<15, 4); // Back
#endif
//Benq,Aaron: no tilt sensor in Plato
#ifndef CONFIG_QISDA_BQ060B00_DVT
#ifdef CONFIG_QISDA_BK060B00
read_pin = readl(S3C2410_GPGDAT);
read_tilt = (read_pin & (0x3<<3)) >> 3;
#else
read_tilt = (read_pin & (0x3<<10)) >> 10;
#endif
if(tilt_status_previous != read_tilt){
if(tilt_counter != 0){
tilt_counter--;
@ -912,6 +1260,7 @@ static void keypad_timer_handler_qisda(unsigned long data)
s3c_keypad_deal(dev, 1, 16);
s3c_keypad_deal(dev, 1, 17);
}
#endif // #ifndef CONFIG_QISDA_BQ060B00_DVT
#endif
if (is_timer_on_qisda == FALSE) {
@ -994,6 +1343,9 @@ static int __init s3c_keypad_qisda_probe(struct platform_device *pdev)
init_timer(&charger_source_timer);
charger_source_timer.function = charger_source_handler;
/* } Qisda, ShiYong Lin, 2009/11/11, Fix the trembling voice issue when plugging usb */
/*joey add timer to avoid bouncing with usb in/out 20100127*/
init_timer(&battery_status_timer);
battery_status_timer.function = battery_status_handler;
/* Qisda, ShiYong Lin, 2009/11/11, Modify for pwr fail event occurring wrongly when heavy loading {*/
init_timer(&power_fail_timer);
@ -1004,6 +1356,15 @@ static int __init s3c_keypad_qisda_probe(struct platform_device *pdev)
//initial work queue
//INIT_WORK(&wqReadData,s3c_keypad_qisda_workqueue);
//{Benq,Andy add for USB cable unplug bugfix
//If boot up with USB cable, s3c_adc_init will set charging_source to 0, without sending input_report_key,
//so recheck is needed when initializing keypad, setting KEY_CHA_STA_USB to 1
if( charging_source == 0 ){
if ( ((readl(S3C2410_GPGDAT) & (1<<1)) != 0) && (IsWallCharger() == 0) )
input_report_key(s3c_keypad_qisda->dev, KEY_CHA_STA_USB, 1);
}
//}Benq,Andy add for USB cable unplug bugfix
DPRINTK("s3c_keypad_qisda_probe finished\n");
/* Qisda, ShiYong Lin, 2009/08/27, Implement for message for AP {*/

View File

@ -89,4 +89,11 @@ config HP_SDC_RTC
Say Y here if you want to support the built-in real time clock
of the HP SDC controller.
config CYBOOK_ORIZON_TILT
tristate "Cybook Orizon Tilt Sensor"
depends on MACH_CYBOOK_ORIZON && CYBOOK_CYIO
default y
help
Say Y here ig you want to support the Cybook Orizon Tilt Sensor
endif

View File

@ -12,3 +12,4 @@ obj-$(CONFIG_INPUT_WISTRON_BTNS) += wistron_btns.o
obj-$(CONFIG_INPUT_ATLAS_BTNS) += atlas_btns.o
obj-$(CONFIG_HP_SDC_RTC) += hp_sdc_rtc.o
obj-$(CONFIG_INPUT_IXP4XX_BEEPER) += ixp4xx-beeper.o
obj-$(CONFIG_CYBOOK_ORIZON_TILT) += orizon_tilt.o

View File

@ -1,5 +1,4 @@
/* Qisda Tony 090406, add Auo touch i2c driver [
*
/*
* 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
@ -38,6 +37,30 @@
#include <linux/kthread.h>
#include <linux/sched.h>
/* Qisda, howard hsu, 2010/01/27, TOUCH firmware update { */
#include <asm/uaccess.h> //for copy_from_user
/* } Qisda, howard hsu, 2010/01/27, TOUCH firmware update */
//Aaron, add for the feature of buffered touch data
#define USE_BUFFERED_TOUCH_DATA
/* Aaron, 20090122, add for CPU sleep prevention */
/* prevent cpu from sleep when any event happens */
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
#define CPU_SLEEP_PREVENT
#endif //#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
int Cyio_PushEvent(char eventId, char unique);
#ifdef USE_BUFFERED_TOUCH_DATA
static int go_in_suspend = 0;
#endif
#ifdef CPU_SLEEP_PREVENT
extern unsigned int g_wakeup_event_occurs;
#endif
//Tony test
//#define IN_2416_EMU_BOARD
//#define QISDA_TEST_GPIO_PROBE
@ -49,6 +72,9 @@
#define TRUE 1
#define FALSE 0
#define printk(x...)
//#ifdef IN_2416_EMU_BOARD
//#define GPIO_NUM (0x3)
//#else
@ -109,16 +135,26 @@ static void touhc_iic_timer_handler_qisda(unsigned long data) { schedule_work(&w
#define TOUCH_DEVICE_POWEROFF_STATE 3 //Power State D3
/*kit.end*/
/*kit.add 2009/11/04*/
static short isTouchPowerOff = 0;
static short touchPowerState = TOUCH_DEVICE_ACTIVE_STATE;
extern unsigned int wkup_srce;
/* Qisda, howard hsu, 2010/01/27, TOUCH firmware update { */
#define TOUCH_IIC_FW_UPDATE 4
#define TOUCH_IIC_GET_FW_INFO 6 /* get fw version */
/* } Qisda, howard hsu, 2010/01/27, TOUCH firmware update */
/*kit.add 2010/01/30*/
#define TOUCH_IIC_T_SENSOR_ENABLE 5
/*kit.end*/
/*kit.add 2009/11/16*/
#define TOUCH_ACTIVE_POLLING_TIME 20 //default value
#define TOUCH_SLEEP_POLLING_TIME 10
#define TOUCH_DEEPSLEEP_POLLING_TIME 1
#define TOUCH_SLEEP_POLLING_TIME 20 //10
#define TOUCH_DEEPSLEEP_POLLING_TIME 20 //1
/*kit.end*/
/*kit.add 2009/11/04*/
static short isTouchPowerOff = 0;
static short touchPowerState = TOUCH_DEVICE_ACTIVE_STATE;
static short touchPollingTime = TOUCH_ACTIVE_POLLING_TIME;
extern unsigned int wkup_srce;
/*kit.end*/
/*
@ -165,6 +201,78 @@ static void touch_iic_init(void)
}
*/
#ifdef USE_BUFFERED_TOUCH_DATA
#define BUFFERED_DATA_LEN 16
/* Aaron: two coordinates on each point */
/* two bytes for each coordinate */
/* block read for max byte num=32, ((32/2)/2)=8 */
/* <=CHECK_LEN_EACH_TIME shall NOT be larger than 8, sync with qisda_iic.c */
#define CHECK_LEN_EACH_TIME 8
static int IsPanelPressed = 0;
static void bufferd_touch_point_handler(int WithRelease)
{
/* [0] is the index of check count */
/* [1] is the check length */
/* buffered data start from [2],x1_y1_x2_y2_x3_y3 */
int buffered_data[BUFFERED_DATA_LEN*2+(2+1)] = {0};
int i, IndexOffset;
//printk("bufferd_touch_point_handler: start\n");
buffered_data[1] = CHECK_LEN_EACH_TIME;
for (i = 0; i < (BUFFERED_DATA_LEN/CHECK_LEN_EACH_TIME); i++) {
buffered_data[0] = i;
ts_iic->client->driver->command(ts_iic->client,QISDA_IIC_READ_BUFFERED_POSITION,buffered_data);
}
//Aaron: send input event.
if ((buffered_data[2] == 0) && (buffered_data[3] == 0)) {
/* If buffered data is empty, do nothing before return*/
return;
}
for (i = 1; i < (BUFFERED_DATA_LEN+1); i++) {
IndexOffset = 2 * i;
/* check if next point data is zero, which means no more data. */
if ((i == BUFFERED_DATA_LEN) ||
(!buffered_data[IndexOffset + 2] && !buffered_data[IndexOffset + 2 + 1])) {
//TODO: send release event.
input_report_abs(ts_iic->dev, ABS_X, buffered_data[IndexOffset]);
input_report_abs(ts_iic->dev, ABS_Y, buffered_data[IndexOffset + 1]);
// //for debug
// //printk("\n bufferd_touch_point_handler: panel is touching(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i);
if (WithRelease) {
if (!IsPanelPressed) {
/* in case that only one buffered data with release */
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
input_report_abs(ts_iic->dev, ABS_PRESSURE,1);
//printk("bufferd_touch_point_handler: panel is Pressed(only one buffered data)\n");
//maybe not necessary//IsPanelPressed = 1;
}
input_report_key(ts_iic->dev, BTN_TOUCH, 0);
input_report_abs(ts_iic->dev, ABS_PRESSURE,0);
IsPanelPressed = 0;
//printk("bufferd_touch_point_handler: panel is Released(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i);
}
input_sync(ts_iic->dev);
break;
}
//TODO: send press event
input_report_abs(ts_iic->dev, ABS_X, buffered_data[IndexOffset]);
input_report_abs(ts_iic->dev, ABS_Y, buffered_data[IndexOffset + 1]);
if (!IsPanelPressed) {
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
input_report_abs(ts_iic->dev, ABS_PRESSURE,1);
IsPanelPressed = 1;
printk("bufferd_touch_point_handler: panel is Pressed(%d,%d)\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1]);
// } else {
// //for debug
// printk("\n bufferd_touch_point_handler: panel is touching(%d,%d)[%d]\n",buffered_data[IndexOffset],buffered_data[IndexOffset + 1],i);
}
input_sync(ts_iic->dev);
}
}
#endif
static void ts_iic_workqueue(struct work_struct *work)
{
static int startpoint[2];
@ -242,8 +350,18 @@ release:
startpoint[0]-=keybuffer[i].x;
startpoint[1]-=keybuffer[i].y;
//Put your gesture function here!!!!
if(( startpoint[1]<-50) || (startpoint[1]>50))
printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");
/*if(( startpoint[1]<-50) || (startpoint[1]>50))
printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/
// Key input
if (Cyio_PushEvent('R', 1) >= 0)
{
Cyio_PushEvent( (keybuffer[0].x >> 8) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].x >> 0) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].y >> 8) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].y >> 0) & 0xFF, 0 );
}
memset(keybuffer,0x0,sizeof(keybuffer));
memset(startpoint,0x0,sizeof(startpoint));
IdxBottom = 0;
@ -319,8 +437,19 @@ release:
startpoint[0]-=keybuffer[i].x;
startpoint[1]-=keybuffer[i].y;
//Put your gesture function here!!!!
if(( startpoint[1]<-50) || (startpoint[1]>50))
printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");
/*if(( startpoint[1]<-50) || (startpoint[1]>50))
printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/
// Key input
if (Cyio_PushEvent('R', 1) >= 0)
{
Cyio_PushEvent( (keybuffer[0].x >> 8) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].x >> 0) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].y >> 8) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].y >> 0) & 0xFF, 0 );
}
memset(keybuffer,0x0,sizeof(keybuffer));
memset(startpoint,0x0,sizeof(startpoint));
IdxBottom = 0;
@ -359,6 +488,10 @@ finished:
//printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer);
if(emptyKeyBuffer==TRUE){
emptyKeyBuffer = FALSE;
#ifdef USE_BUFFERED_TOUCH_DATA
bufferd_touch_point_handler(1); /* with release */
go_in_suspend = 0;
#endif
goto finished;
}
else{
@ -366,14 +499,33 @@ finished:
goto release;
}
}
#ifdef USE_BUFFERED_TOUCH_DATA
if (go_in_suspend) {
bufferd_touch_point_handler(0); /* without release */
go_in_suspend = 0;
}
#endif
//key input
ts_iic->xp = keybuffer[IdxBottom].x = curpoint[0];
ts_iic->yp =keybuffer[IdxBottom].y = curpoint[1];
input_report_abs(ts_iic->dev, ABS_X, ts_iic->xp);
input_report_abs(ts_iic->dev, ABS_Y, ts_iic->yp);
#ifdef USE_BUFFERED_TOUCH_DATA
if (!IsPanelPressed) {
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
input_report_abs(ts_iic->dev, ABS_PRESSURE,1);
IsPanelPressed = 1;
}
#else
input_report_key(ts_iic->dev, BTN_TOUCH, 1);
input_report_abs(ts_iic->dev, ABS_PRESSURE,1);
#endif
input_sync(ts_iic->dev);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPH12, S3C2410_GPH12_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH12, 1);
#endif
//printk("\n[%d] --%d,%d,%d\n", __LINE__, curpoint[0], curpoint[1], emptyKeyBuffer);
if((startpoint[0]==0) || (startpoint[1]==0))
{
@ -395,8 +547,17 @@ release:
startpoint[0]-=keybuffer[i].x;
startpoint[1]-=keybuffer[i].y;
//Put your gesture function here!!!!
if(( startpoint[1]<-50) || (startpoint[1]>50))
printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");
/*if(( startpoint[1]<-50) || (startpoint[1]>50))
printk(KERN_ERR "ts_iic_workqueue okokokokokokokokok\n");*/
// Key input
if (Cyio_PushEvent('R', 1) >= 0)
{
Cyio_PushEvent( (keybuffer[0].x >> 8) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].x >> 0) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].y >> 8) & 0xFF, 0 );
Cyio_PushEvent( (keybuffer[0].y >> 0) & 0xFF, 0 );
}
memset(keybuffer,0x0,sizeof(keybuffer));
memset(startpoint,0x0,sizeof(startpoint));
@ -404,9 +565,17 @@ release:
emptyKeyBuffer = TRUE;
//Key input
ts_iic->xp =ts_iic->yp = 0;
#ifdef USE_BUFFERED_TOUCH_DATA
IsPanelPressed = 0;
#endif
input_report_key(ts_iic->dev, BTN_TOUCH, 0);
input_report_abs(ts_iic->dev, ABS_PRESSURE,0);
input_sync(ts_iic->dev);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPH12, S3C2410_GPH12_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH12, 0);
#endif
#ifdef NEW_TCOM_BOARD
prevpoint[0]=0;
prevpoint[1]=0;
@ -437,6 +606,10 @@ finished:
//static int count=0;
printk(KERN_ERR "\ntouch_iic_isr\n");
disable_irq(IRQ_EINT2);
#ifdef CPU_SLEEP_PREVENT
g_wakeup_event_occurs = 1;
//printk("touch_iic_isr: set g_wakeup_event_occurs\n");
#endif
//touch_iic_disable_interrupt();
//touch_iic_clear_interrupt_pending();
touch_iic_timer_qisda.expires = jiffies + (HZ/ts_iic->polling_time);
@ -454,11 +627,380 @@ static int s3c_ts_iic_open(struct inode *inode, struct file *file)
{
return 0;
}
/* Qisda, howard hsu, 2010/01/27, touch firmware update { */
#define NORMAL_SLAVE_ADDR 0x5C
#define BOOTLOADER_SLAVE_ADDR 0x5D
/*************************/
/*** GPF2 => TP_INT ***/
/*** GPF5 => TOUCH_EN ***/
/*************************/
#define OPCODE_INIT 0
#define OPCODE_USER 1
#define OPCODE_AES 2
#define OPCODE_EEPROM 3
#define OPCODE_QUERY 8
typedef struct BLModeInfo {
char Status;
char FlashLock;
char Version;
char Key;
} __attribute__((packed)) BLModeInfo;
int normalmode_read_eeprom(unsigned int eepr_addr, unsigned char *buff)
{
unsigned char tmp[4];
struct i2c_msg msg;
unsigned long nmsgs;
int ret=0;
tmp[0]=120;
tmp[1]=0x01;//read
tmp[2]=(eepr_addr&0xFF);
tmp[3]=eepr_addr>>8;
nmsgs=1;
msg.len=4; //mem address
msg.addr=NORMAL_SLAVE_ADDR;
msg.flags=0;
msg.buf=tmp;
ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs);
nmsgs=1;
msg.len=1; //mem address
msg.addr=NORMAL_SLAVE_ADDR;
msg.flags=I2C_M_RD;
msg.buf=buff;
ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs);
if(ret<0)
printk("normalmode_read_eeprom error code:%d\n",ret);
return ret;
}
int normalmode_read_op(unsigned int mem_addr,unsigned char *buff)
{
unsigned char tmp[2];
struct i2c_msg msg[2];
unsigned long nmsgs;
int ret=0;
tmp[0]=mem_addr;
//tmp[0]=mem_addr;
//tmp[1]=val;
nmsgs=2;
msg[0].len=1; //mem address
msg[0].addr=NORMAL_SLAVE_ADDR;
msg[0].flags=0;
msg[0].buf=tmp;
msg[1].len=1;
msg[1].addr=NORMAL_SLAVE_ADDR;
msg[1].flags=I2C_M_RD;
msg[1].buf=buff;
ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs);
if(ret<0)
printk("[normalmode_read_op] error:%d\n",ret);
else
printk("[normalmode_read_op] ok addr:%d value:%d\n",mem_addr,buff[0]);
return ret;
}
int normalmode_write_op(unsigned char mem_addr,unsigned char val)
{
unsigned char tmp[2];
struct i2c_msg msg;
unsigned long nmsgs;
int ret=0;
tmp[0]=mem_addr;
tmp[1]=val;
nmsgs=1;
msg.len=2; //mem address
msg.addr=NORMAL_SLAVE_ADDR;
msg.flags=0;
msg.buf=tmp;
ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs);
if(ret<0)
printk("[normalmode_write_op] error:%d\n",ret);
else
printk("[normalmode_write_op] ok addr:%d value:%d\n",mem_addr,val);
return ret;
}
int blmode_read_op(int opcode)
{
struct i2c_msg msg;
unsigned long nmsgs;
int ret=0;
BLModeInfo *bl_info = vmalloc(sizeof(BLModeInfo));
nmsgs = 1;
msg.addr = BOOTLOADER_SLAVE_ADDR;
msg.flags= I2C_M_RD; //0 for write
msg.len = 4;
msg.buf = bl_info;
ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs);
if(ret<0)
{
printk("[blmode_read_op] error:%d\n",ret);
}
else
{
printk("[blmode_read_op] ok:[%x][%x][%x][%x]\n",bl_info->Status,bl_info->FlashLock,bl_info->Version,bl_info->Key);
if ( (bl_info->Status&0x80) != 0) {
ret = -8;
}
else {
if (opcode==OPCODE_AES)
{
if(bl_info->FlashLock==0x00)
printk("=Flash is locked\n");
else if (bl_info->FlashLock==0x05)
printk("=Flash verified failed\n");
else if (bl_info->FlashLock==0xFF)
printk("=Flash is erased\n");
else if (bl_info->FlashLock==0xA5)
printk("=Flash is unlocked\n");
else
printk("=Flash status Unknown(%x)\n",bl_info->FlashLock);
}
}
}
return ret;
}
int blmode_write_op(char *data_ptr)
{
struct i2c_msg msg;
unsigned long nmsgs;
int ret=0;
nmsgs = 1;
msg.addr = BOOTLOADER_SLAVE_ADDR;
msg.flags= 0;
msg.len = 143;
msg.buf = data_ptr;
ret = i2c_transfer(ts_iic->client->adapter, &msg, nmsgs);
if(ret<0)
{
printk("blmode_write_op error:%d\n",ret);
}
else
{
ret = data_ptr[0];
printk("opcode[%d] OK\n",data_ptr[0]);
}
return ret;
}
int blmode_wait_ready()
{
unsigned int pin_state;
int count = 0;
int ret =0;
do {
pin_state = (__raw_readl(S3C2410_GPFDAT)&(1<<2));
count++;
msleep(20);
} while((pin_state!=0)&&(count<100)); //wait for 2 seconds
//printk("[blmode_wait_ready]count=%d pin=%d\n",count,pin_state);
ret = (pin_state==0)? 0:1;
return ret;
}
int get_touch_firmware_info(char *buff)
{
/* read version */
normalmode_read_op(119,buff);
}
int enter_blmode (int method)
{
disable_irq(IRQ_EINT2);
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 0);
if( method==0 )
{
printk("TP:HW_blmode entry\n");
//turn-off
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
#endif
msleep(2000);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
//s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
//s3c2410_gpio_pullup(S3C2410_GPF2, 0);
blmode_read_op(OPCODE_QUERY);
blmode_wait_ready();
blmode_read_op(OPCODE_QUERY);
}
else
{
printk("TP:SW_blmode entry\n");
msleep(100);
normalmode_write_op(120,5);
blmode_read_op(OPCODE_QUERY);
blmode_wait_ready();
blmode_read_op(OPCODE_QUERY);
}
}
int reset_touch()
{
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
#endif
//s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP); //?smart card
//s3c2410_gpio_setpin(S3C2410_GPC3, 0);
msleep(2000);
//on
//s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
//s3c2410_gpio_pullup(S3C2410_GPF2, 2);
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
msleep(400);
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL);
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
enable_irq(IRQ_EINT2);
msleep(100);
}
int update_touch_firmware(unsigned long size, char* frame_data)
{
unsigned int pin_state;
int count, count_max;
int opcode, result;
int i;
unsigned long offset = 0;
/*
disable_irq(IRQ_EINT2);
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 0);
msleep(100);
normalmode_write_op(120,5);
blmode_wait_ready();
blmode_read_op(OPCODE_QUERY);
*/
enter_blmode(0);
char *cmd_buff = vmalloc(143, GFP_KERNEL);
char *data_ptr = frame_data;
unsigned long limit = frame_data + size;
char *p_head;
char *p_tail;
count = 0;
do {
p_head = strchr(data_ptr,'$');
if ( (p_head != NULL)&& (p_tail<limit) )
{
p_tail = strchr(p_head+1,0xd);
if( (p_tail!=NULL) && (p_tail<limit))
{
printk("p_head=%lu p_tail=%lu \n",p_head, p_tail);
unsigned long length = p_tail - p_head;
p_head++;
if(length!=287)
goto FAIL;
char tmpToken[3];
memset( tmpToken, 0, sizeof(tmpToken) );
for(i=0;i<143;i++)
{
strncpy( tmpToken, p_head+i*2, 2 );
sprintf( cmd_buff+i, "%c", simple_strtol( tmpToken,NULL,16) );
}
count++;
printk("OpCode[%2x] CRC[%2x][%2x]\n",cmd_buff[0],cmd_buff[141],cmd_buff[142]);
opcode = blmode_write_op(cmd_buff);
printk("[blmode_write_op][%d]=%d\n",count,opcode);
if ( opcode < 0) {
goto FAIL;
}
if ( opcode!= OPCODE_USER)
{
if( blmode_wait_ready() != 0)
goto FAIL_BUSY;
result = blmode_read_op(opcode);
printk("[blmode_read_op]=%d\n",result);
if (result<0)
goto FAIL;
}
data_ptr = p_tail+1;
if( data_ptr > (limit-280) )
{
printk("end of file,stop\n");
printk("curr:%lu limit:%lu\n",data_ptr,limit);
p_head=0;
}
}
else
{
p_head=0;
}
}
printk("==p_head=%lu\n",p_head);
} while(p_head!=0);
vfree(cmd_buff);
/* printk("restore EINT\n");
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
enable_irq(IRQ_EINT2);
msleep(100); */
reset_touch();
return 0;
FAIL_BUSY:
printk("[FAIL]Dev is Busy\n");
FAIL:
return -1;
}
/* } Qisda, howard hsu, 2010/01/27, touch firmware update */
/*******************************/
/****** GPF2 => TP_INT ******/
/****** GPF5 => TOUCH_EN ******/
/*** GPC3 => T-Sensor Power ***/
/*******************************/
static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
switch(cmd){
@ -480,6 +1022,7 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
}
else{
ts_iic->polling_time = arg;
touchPollingTime = arg;
}
break;
/*kit.mod 2009/11/04*/
@ -490,16 +1033,28 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
if(isTouchPowerOff)
{
isTouchPowerOff = 0;
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
msleep(200);
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL);
/*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
/*kit.end*/
enable_irq(IRQ_EINT2);
}
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_ACTIVE_MODE, NULL);
/*kit.add 2009/11/16*/
ts_iic->polling_time = TOUCH_ACTIVE_POLLING_TIME;
ts_iic->polling_time = touchPollingTime;
touchPowerState = TOUCH_DEVICE_ACTIVE_STATE;
/*kit.end*/
@ -510,10 +1065,22 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
if(isTouchPowerOff)
{
isTouchPowerOff = 0;
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
msleep(200);
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL);
/*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
/*kit.end*/
enable_irq(IRQ_EINT2);
}
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_SLEEP_MODE, NULL);
@ -530,10 +1097,22 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
if(isTouchPowerOff)
{
isTouchPowerOff = 0;
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
msleep(200);
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL);
/*kit.add 2010/01/20, for turn on TP_INT(GPF2) power*/
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
/*kit.end*/
enable_irq(IRQ_EINT2);
}
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_DEEPSLEEP_MODE, NULL);
@ -553,8 +1132,26 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
{
isTouchPowerOff = 1;
disable_irq(IRQ_EINT2);
/*kit.add 2010/01/20, turn off TP_INT(GPF2) power*/
/*test1: TP_INT(GPF2) => Input, Disable*/
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_pullup(S3C2410_GPF2, 0);
/*test2: TP_INT(GPF2) => Input, Pull Low*/
//s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
//s3c2410_gpio_setpin(S3C2410_GPF2, 1);
/*kit.end*/
/*Turn off touch power(TOUCH_EN)*/
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
#endif
printk("Touch Device => Power Off State\n");
}
@ -568,6 +1165,59 @@ static int s3c_ts_iic_ioctl(struct inode *inode, struct file *file, unsigned int
}
break;
/*kit.end*/
/* Qisda, howard hsu, 2010/01/27, TOUCH firmware update { */
case TOUCH_IIC_FW_UPDATE:
{
printk("Call TOUCH_IIC_FW_UPDATE\n");
unsigned long fw_size = 0;
int result = 0;
if(copy_from_user(&fw_size, (unsigned long*) arg, sizeof(unsigned long)))
return -EFAULT;
unsigned char *fw_data = vmalloc(fw_size, GFP_KERNEL);
if(copy_from_user(fw_data, (char*) ((char *)arg+sizeof(unsigned long)), fw_size))
return -EFAULT;
printk("FW_Size=%d\n",fw_size);
result = update_touch_firmware(fw_size,fw_data);
printk("TOUCH_IIC_FW_UPDATE Complete(result=%d)!!!\n",result);
vfree(fw_data);
return result;
}
break;
case TOUCH_IIC_GET_FW_INFO:
{
char info = 0;
get_touch_firmware_info(&info);
if(copy_to_user((void *)arg, (const void *) &info, sizeof(char)))
return -EFAULT;
}
break;
/* } Qisda, howard hsu, 2010/01/27, TOUCH firmware update */
/*kit.add 2010/01/30*/
case TOUCH_IIC_T_SENSOR_ENABLE:
{
switch(arg)
{
case 0:
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPC3, 0);
printk("T-Sensor power off\n");
break;
case 1:
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPC3, 1);
printk("T-Sensor power on\n");
break;
default:
printk("T-Sensor no such command\n");
break;
}
}
break;
/*kit.end*/
default:
printk("No such command\n");
@ -649,15 +1299,24 @@ int s3c_ts_iic_port_init(struct i2c_client *c)
}
printk("s3c_ts_iic_port_init is initialized!!\n");
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_pullup(S3C2410_GPD10, 2);
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10,1);
#else
s3c2410_gpio_pullup(S3C2410_GPF5, 2);
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5,1);
#endif
/*Qisda Qube for open smartcard pwr*/
#if defined (CONFIG_QISDA_AS090B00_EVT1) || defined (CONFIG_QISDA_AS090B00_EVT1_1)
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPC3,1);
/*kit.mod 2009/12/25*/
s3c2410_gpio_setpin(S3C2410_GPC3, 0);
/*kit.end*/
#endif
/*Qisda Qube for open smartcard pwr*/
@ -741,11 +1400,14 @@ static int s3c_ts_iic_remove(struct platform_device *dev)
#ifdef CONFIG_PM
static int s3c_ts_iic_suspend(struct platform_device *dev, pm_message_t state)
{
//disable_irq(IRQ_EINT2);
/*kit.add 2010/01/06, turn off Tilt-Sensor power*/
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPC3, 0);
/*kit.end*/
/*kit.add 2009/09/24*/
//s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPF5, 0);
/*kit.test 2010/01/30, turn off SPI_INT power*/
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP);
s3c2410_gpio_pullup(S3C2410_GPF3, 0); /* pull-up/down disable */
/*kit.end*/
/*kit.add 2009/11/04*/
@ -753,36 +1415,55 @@ static int s3c_ts_iic_suspend(struct platform_device *dev, pm_message_t state)
{
printk("\nTouch Suspend: Add touch to wakeup source, do not turn off touch power...\n");
}
else if(wkup_srce == 0)
//else if(wkup_srce == 0)
else
{
if(!isTouchPowerOff)
{
printk("\nTouch Suspend: Do not add touch to wakeup source, turn off touch power...\n");
disable_irq(IRQ_EINT2);
/*kit.add 2010/01/20, turn off TP_INT(GPF2) power*/
/*test1: TP_INT(GPF2) => Input, Disable*/
//s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
//s3c2410_gpio_pullup(S3C2410_GPF2, 0);
/*test2: TP_INT(GPF2) => Input, Pull Low*/
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_INP);
s3c2410_gpio_setpin(S3C2410_GPF2, 1);
/*kit.end*/
/*turn off TOUCH_EN power*/
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 0);
#endif
}
}
/*kit.end*/
#ifdef USE_BUFFERED_TOUCH_DATA
go_in_suspend = 1;
#endif
return 0;
}
static int s3c_ts_iic_resume(struct platform_device *pdev)
{
/*need to check*/
/*Qisda Qube for open smartcard pwr*/
#if defined (CONFIG_QISDA_AS090B00_EVT1) || defined (CONFIG_QISDA_AS090B00_EVT1_1)
/*s3c2410_gpio_pullup(S3C2410_GPF5, 2);
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5,1);
msleep(200);*/
/*kit.add 2010/01/06, for Tilt-Sensor power*/
s3c2410_gpio_cfgpin(S3C2410_GPC3, S3C2410_GPC3_OUTP);
s3c2410_gpio_setpin(S3C2410_GPC3, 1);
msleep(200);
#endif
/*Qisda Qube for open smartcard pwr*/
/*kit.end*/
/*kit.test 2010/01/30, for SPI_INT power*/
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
s3c2410_gpio_pullup(S3C2410_GPF3, 2); /* pull-up enable */
/*kit.end*/
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT, NULL);
@ -791,23 +1472,37 @@ static int s3c_ts_iic_resume(struct platform_device *pdev)
{
printk("\nTouch Resume: Touch is wakeup source\n");
}
else if(wkup_srce == 0)
//else if(wkup_srce == 0)
else
{
printk("\nTouch Resume: Touch is not wakeup source, turn on touch power and enable IRQ...\n");
if(!isTouchPowerOff)
{
/*turn on TOUCH_EN power*/
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPD10, S3C2410_GPD10_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD10, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPF5, S3C2410_GPF5_OUTP);
s3c2410_gpio_setpin(S3C2410_GPF5, 1);
#endif
msleep(200);
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_INIT,NULL);
/*kit.add 2010/01/20, config TP_INT(GPF2) to interrupt*/
s3c2410_gpio_cfgpin(S3C2410_GPF2, S3C2410_GPF2_EINT2);
s3c2410_gpio_pullup(S3C2410_GPF2, 2);
/*kit.end*/
enable_irq(IRQ_EINT2);
switch(touchPowerState)
{
case TOUCH_DEVICE_ACTIVE_STATE:
ts_iic->client->driver->command(ts_iic->client, QISDA_IIC_ACTIVE_MODE, NULL);
ts_iic->polling_time = TOUCH_ACTIVE_POLLING_TIME;
ts_iic->polling_time = touchPollingTime;
touchPowerState = TOUCH_DEVICE_ACTIVE_STATE;
break;
@ -827,7 +1522,7 @@ static int s3c_ts_iic_resume(struct platform_device *pdev)
touchPowerState = TOUCH_DEVICE_DEEPSLEEP_STATE;
break;
defaule:
default:
break;
}
}

View File

@ -404,7 +404,7 @@ extern void s3c_camif_set_polarity(camif_cfg_t *cfg);
#define QISDA_IIC_ACTIVE_MODE (1<<3)
#define QISDA_IIC_SLEEP_MODE (1<<4)
#define QISDA_IIC_DEEPSLEEP_MODE (1<<5)
#define QISDA_IIC_READ_BUFFERED_POSITION (1<<6)
extern int s3c_ts_iic_port_init(struct i2c_client *c);

View File

@ -18,6 +18,13 @@ config MMC_DEBUG
This is an option for use by developers; most people should
say N here. This enables MMC core and driver debugging.
config SD_SW_DEBOUNCE
bool "Use SD_SW_DEBOUNC detect method"
default n
help
This is an option for enable the added sd-card detection
method with "software debounce time" feature
if MMC
source "drivers/mmc/core/Kconfig"

View File

@ -430,7 +430,10 @@ static struct mmc_blk_data *mmc_blk_alloc(struct mmc_card *card)
struct mmc_blk_data *md;
int devidx, ret;
devidx = find_first_zero_bit(dev_use, MMC_NUM_MINORS);
/* Qisda, howard hsu, 2010/01/21, fix start slot for SD card { */
//devidx = find_first_zero_bit(dev_use, MMC_NUM_MINORS);
devidx = find_next_zero_bit(dev_use, MMC_NUM_MINORS, card->host->first_devidx);
/* } Qisda, howard hsu, 2010/01/21, fix start slot for SD card */
if (devidx >= MMC_NUM_MINORS)
return ERR_PTR(-ENOSPC);
__set_bit(devidx, dev_use);

View File

@ -120,8 +120,8 @@ config MMC_TIFM_SD
config MMC_SPI
tristate "MMC/SD over SPI (EXPERIMENTAL)"
depends on MMC && SPI_MASTER && !HIGHMEM && EXPERIMENTAL
select CRC7
select CRC_ITU_T
#select CRC7
#select CRC_ITU_T
help
Some systems accss MMC/SD cards using a SPI controller instead of
using a "native" MMC/SD controller. This has a disadvantage of

View File

@ -55,6 +55,10 @@
#include <asm/arch/hsmmc.h>
/*Qisda , wenny cheng , 20091224 , board id info {*/
#include <../include/asm-arm/plat-s3c24xx/common-smdk.h>
/*Qisda , wenny cheng , 20091224 , board id info }*/
/*Trevor add for debug*/
/*#define CONFIG_S3CMMC_DEBUG*/
@ -79,6 +83,11 @@ struct s3c_hsmmc_host *global_host[3];
#endif
static void s3c_hsmmc_tasklet_finish (unsigned long param);
/*Qisda , wenny cheng , 20091224 , board id info {*/
extern int board_id;
/*Qisda , wenny cheng , 20091224 , board id info }*/
static int inResume = 0; //howard, 2009/12/22, fix resume card-detect
/*Qisda,2009/7/28,Leo SJ Yang {*/
/*Fix: Must plug-in twice ,SD is reconginzed by system*/
/* GEORGE 20090608 update for module on board.*/
@ -86,6 +95,106 @@ static int card_detect = 0;
static int card_detect2 = 2;
/* GEORGE 20090608 update for module on board.*/
/*}Qisda,2009/7/28,Leo SJ Yang*/
/* Qisda , howard hsu, 2010/01/16 , op_mode-delay key event {*/
//extern void op_mode_delay_message_to_ap();
/* } Qisda , howard hsu, 2010/01/16 , op_mode-delay key event */
/* Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card { */
// disable it first, wait integration test
#ifdef CONFIG_SD_SW_DEBOUNCE
static int SDCardStatus = 16;
#define SD_INSERTED 0
#define SD_REMOVED 2
#define CHECK_MSEC 50
#define INSERT_MSEC 800
#define REMOVE_MSEC 800
static struct timer_list sd_detect_timer;
static void sdcard_debounce_timer(unsigned long data);
static int ReadSDCardStatus()
{
int SDStatus= 0;
#if defined(CONFIG_CPU_S3C2450) || defined(CONFIG_CPU_S3C2416)
SDStatus = readl(S3C2410_GPFDAT);
SDStatus &= SD_REMOVED; /* GPF1 */
#elif defined(CONFIG_CPU_S3C6410)
SDStatus = readl(S3C_GPNDAT);
SDStatus &= 0x2000; /* GPN13 */
#endif
return SDStatus;
}
static void sdcard_debounce_timer(unsigned long data)
{
static unsigned int StayCount = 0;
static unsigned int MaxCount = 2*INSERT_MSEC/CHECK_MSEC;
static unsigned int MidCount = INSERT_MSEC/CHECK_MSEC;
static unsigned int MinCount = INSERT_MSEC/CHECK_MSEC/2;
static int LastSDCardStatus = 0xF;
int RawStatus = ReadSDCardStatus();
/* stay count in case of resume in progress */
if (inResume == 1)
{
mod_timer(&sd_detect_timer ,jiffies+msecs_to_jiffies(CHECK_MSEC));
return;
}
if ( SDCardStatus == RawStatus )
{
StayCount++;
if (StayCount >= MaxCount)
{
StayCount = 0;
LastSDCardStatus = SDCardStatus;
del_timer(&sd_detect_timer);
}
else if (StayCount == MidCount)
{
struct s3c_hsmmc_host *s3c_host = global_host[0];
struct mmc_host *host = s3c_host->mmc;
if (SDCardStatus == LastSDCardStatus )
{
//StayCount = 0;
//LastSDCardStatus = 0xF;
}
mmc_detect_change(host, 1);
mod_timer(&sd_detect_timer, jiffies+msecs_to_jiffies(CHECK_MSEC));
}
else if ( StayCount==MinCount )
{
/* call detect twice for SD_INSERTED case */
//if (SDCardStatus == LastSDCardStatus )
if (SDCardStatus == SD_INSERTED )
{
struct s3c_hsmmc_host *s3c_host = global_host[0];
struct mmc_host *host = s3c_host->mmc;
mmc_detect_change(host, 1);
}
mod_timer(&sd_detect_timer, jiffies+msecs_to_jiffies(CHECK_MSEC));
}
else
{
mod_timer(&sd_detect_timer, jiffies+msecs_to_jiffies(CHECK_MSEC));
}
}
else
{
SDCardStatus = RawStatus;
if (SDCardStatus==SD_INSERTED) {
MaxCount = 2*INSERT_MSEC/CHECK_MSEC;
MidCount = INSERT_MSEC/CHECK_MSEC;
}
else {
MaxCount = 2*REMOVE_MSEC/CHECK_MSEC;
MidCount = REMOVE_MSEC/CHECK_MSEC;
}
StayCount = 0;
mod_timer(&sd_detect_timer ,jiffies+msecs_to_jiffies(CHECK_MSEC));
}
}
#endif /* CONFIG_SD_SW_DEBOUNCE */
/* } Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card */
/*****************************************************************************\
* *
* Low level functions *
@ -123,8 +232,34 @@ static int s3c_hsmmc_power_switch(int channel, int arg)
if(arg){
if(channel == 0){
//Power on
#ifdef CONFIG_QISDA_QD090B00
/*Qisda , wenny cheng , 20091224 , board id info {*/
//if((readl(S3C2416_GPKDAT) & (0x3<<3))){
if(board_id!=QD090B00_S02){
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD14, 1);
}
else{
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 1);
}
/*Qisda , wenny cheng , 20091224 , board id info }*/
#endif
#ifdef CONFIG_QISDA_QD060B00
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH4, 1);
#else
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 1);
#endif
#endif
//Signal
s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2450_GPE5_SD0_CLK);
s3c2410_gpio_cfgpin(S3C2410_GPE6, S3C2450_GPE6_SD0_CMD);
@ -145,8 +280,32 @@ static int s3c_hsmmc_power_switch(int channel, int arg)
else{
if(channel == 0){
//Power off
#ifdef CONFIG_QISDA_QD090B00
/*Qisda , wenny cheng , 20091224 , board id info {*/
//if((readl(S3C2416_GPKDAT) & (0x3<<3))){
if(board_id!=QD090B00_S02){
s3c2410_gpio_cfgpin(S3C2410_GPD14, S3C2410_GPD14_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD14, 0);
}
else{
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 0);
}
/*Qisda , wenny cheng , 20091224 , board id info }*/
#endif
#ifdef CONFIG_QISDA_QD060B00
#ifdef CONFIG_QISDA_BK060B00
s3c2410_gpio_cfgpin(S3C2410_GPH4, S3C2410_GPH4_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH4, 0);
#else
s3c2410_gpio_cfgpin(S3C2410_GPG2, S3C2410_GPG2_OUTP);
s3c2410_gpio_setpin(S3C2410_GPG2, 0);
#endif
#endif
//Signal
s3c2410_gpio_cfgpin(S3C2410_GPE5, S3C2410_GPE5_INP);
s3c2410_gpio_pullup(S3C2410_GPE5, 1);
@ -274,7 +433,18 @@ static void s3c_hsmmc_tasklet_card (ulong param)
spin_unlock_irqrestore(&host->lock, iflags);
/* Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card { */
#ifdef CONFIG_SD_SW_DEBOUNCE
int exist = timer_pending(&sd_detect_timer);
if (exist == 0)
{
sd_detect_timer.expires = jiffies+msecs_to_jiffies(CHECK_MSEC);
add_timer(&sd_detect_timer);
}
#else
mmc_detect_change(host->mmc, msecs_to_jiffies(500));
#endif /* CONFIG_SD_SW_DEBOUNCE */
/* } Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card */
}
static void s3c_hsmmc_activate_led(struct s3c_hsmmc_host *host)
@ -933,6 +1103,10 @@ out:
return result;
}
#include <linux/cyio.h>
int Cyio_PushEvent(char eventId, char unique);
static irqreturn_t s3c_hsmmc_irq_cd (int irq, void *dev_id)
{
struct s3c_hsmmc_host *host = dev_id;
@ -948,23 +1122,41 @@ static irqreturn_t s3c_hsmmc_irq_cd (int irq, void *dev_id)
//printk("\ns3c_hsmmc_irq_cd, ext_CD_int: %d, card_detect: %d, card_detect2: %d\n", ext_CD_int, card_detect, card_detect2);
if(ext_CD_int && card_detect) {
printk("s3c-hsmmc channel-0(EXT): card removed.\n");
set_irq_type(host->irq_cd, IRQT_FALLING);
/*Qisda Qube for sd card detect20091124*/
//set_irq_type(host->irq_cd, IRQT_FALLING);
set_irq_type(host->irq_cd, IRQT_LOW);
/*Qisda Qube for sd card detect20091124*/
card_detect = 0;
//Qisda, Asaku Chen, 2009/11/03, SD power off
s3c_hsmmc_power_switch(0, 0);
card_detect2 = 2;
/* Send CyIO event */
Cyio_PushEvent(CYEVENT_SD_OUT, 1);
}
else if(!ext_CD_int && !card_detect) {
printk("s3c-hsmmc channel-0(EXT): card inserted.\n");
set_irq_type(host->irq_cd, IRQT_RISING);
card_detect = 1;
/*Qisda Qube for sd card detect20091124*/
//set_irq_type(host->irq_cd, IRQT_RISING);
set_irq_type(host->irq_cd, IRQT_HIGH);
/*Qisda Qube for sd card detect20091124*/
//Qisda, Asaku Chen, 2009/11/03, SD power on
if (inResume!=1)//howard, 2009/12/22, fix resume card-detect
{
card_detect = 1;
s3c_hsmmc_power_switch(0, 1);
}
if(card_detect2 == 3){
printk("resume host first\n");
s3c_hsmmc_ios_init(host);
mmc_resume_host(host->mmc);
card_detect2 = 2;
}
/* Send CyIO event */
Cyio_PushEvent(CYEVENT_SD_IN, 1);
}
//Qisda, Asaku Chen, 2009/11/03 {
@ -1244,9 +1436,105 @@ static int s3c_wifi_open(struct inode *inode, struct file *file)
#define S3C_READ_GPIO_VALUE 4
#define S3C_SET_GPIO_ADDR 5
#define S3C_WRITE_GPIO_VALUE 6
#define S3C_READ_HW_VERSION 7
#define S3C_TCON_ERASE 10
#define S3C_TCON_ID 11
#define S3C_TCON_READ 12
#define S3C_TCON_BYTE_COUNT 13
#define S3C_TCON_WRITE 14
#define MMC_DEVICE_POWER_STATE 20
#define S3C_BT_POWER_ON 1
#define S3C_BT_POWER_OFF 2
static unsigned char s3c_tcon_read_byte(void)
{
/*
Unsigned char Get data () //Receive a byte from Serial flash
{
unsigned char k, temdata =0, i;
for ( k = 0; k++; k< 8)
{
if ( SO == 1 )
{
i = (0x80 >> k);
temdata = (temdata || i);
}
SCLK = 1;
SCLK = 0;
}
return (temdata);
}
*/
unsigned char k, temdata =0, i=0;
u32 read_pin;
for(k=0; k<8; k++){
read_pin = (readl(S3C2410_GPEDAT) & (1<<11));
//printk(" [%d]: 0x%X 0x%X\n", k, read_pin, readl(S3C2410_GPEDAT));
if(read_pin){
i = (0x80 >> k);
temdata = (temdata | i);
}
s3c2410_gpio_setpin(S3C2410_GPE13, 1);
udelay(2);
s3c2410_gpio_setpin(S3C2410_GPE13, 0);
udelay(2);
}
//printk("s3c_tcon_read_byte: 0x%2X\n", temdata);
return (temdata);
}
static void s3c_tcon_write_byte(char w_data)
{
/*
Send data (unsigned char indata) // Send 1 byte data to Serial flash
{
unsigned char k;
for ( k = 0; k++; k< 8)
{
if( (indata & 0x80) == 0x80)
SI = 1;
else
SI = 0;
SCLK = 1;
SCLK = 0;
indata = (indata << 1);
}
}
*/
unsigned char k;
//printk("s3c_tcon_write_byte: 0x%2X\n", w_data);
for(k=0; k<8; k++){
if((w_data & 0x80))
s3c2410_gpio_setpin(S3C2410_GPE12, 1);
else
s3c2410_gpio_setpin(S3C2410_GPE12, 0);
s3c2410_gpio_setpin(S3C2410_GPE13, 1);
udelay(2);
s3c2410_gpio_setpin(S3C2410_GPE13, 0);
udelay(2);
w_data = (w_data << 1);
}
}
@ -1255,10 +1543,128 @@ static int s3c_wifi_ioctl(struct inode *inode, struct file *file, unsigned int c
{
static char s3c_power_off = 0;
static unsigned int gpio_addr = 0;
static unsigned int tcon_byte_count;
static unsigned int tcon_address;
unsigned char tcon_buffer[128];
unsigned char r_data;
int ret, i;
u32 read_pin;
switch(cmd){
#ifdef CONFIG_QISDA_BK060B00
case S3C_WIFI_POWER_ON:
printk("BCM4329-WIFI_BT_POWER_ON\n");
//TCON Flash disable, and select WiFi
s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH6, 0);
//bcm4329 module power on control
//GPK7, WIFI PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<15)) | (1<<14)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<7)), S3C2416_GPKDAT);
//GPK6, PA 1.8V
writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<6)), S3C2416_GPKDAT);
//GPK5, PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<5)), S3C2416_GPKDAT);
//GPK9 (green light), pull high
writel(((readl(S3C2416_GPKCON) & ~(1<<19)) | (1<<18)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<9)), S3C2416_GPKDAT);
//WIFI_BT_EN (GPD11) pull high
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD11, 0);
//writel(((readl(S3C2416_GPGCON) & ~(1<<9)) | (1<<8)), S3C2416_GPGCON);
//writel((readl(S3C2416_GPGDAT) & ~(1<<4)), S3C2416_GPGDAT);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPD11, 1);
//writel((readl(S3C2416_GPGDAT) | (1<<4)), S3C2416_GPGDAT);
mdelay(20);
//EXT_N_WIFI_RST (GPD8) pull high
s3c2410_gpio_cfgpin(S3C2410_GPD8, S3C2410_GPD8_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD8, 0);
//writel(((readl(S3C2416_GPDCON) & ~(1<<17)) | (1<<16)), S3C2416_GPDCON);
//writel((readl(S3C2416_GPDDAT) & ~(1<<8)), S3C2416_GPDDAT);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPD8, 1);
//writel((readl(S3C2416_GPDDAT) | (1<<8)), S3C2416_GPDDAT);
mdelay(20);
//EXT_N_BT_RST (GPA2) pull high
s3c2410_gpio_cfgpin(S3C2410_GPA2, S3C2410_GPA2_OUT);
s3c2410_gpio_setpin(S3C2410_GPA2, 0);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPA2, 1);
mdelay(20);
//UART1 CTS1 (GPH10) set
s3c2410_gpio_cfgpin(S3C2410_GPH10, S3C2410_GPH10_CLKOUT1);
//writel(((readl(S3C2416_GPHCON) | (1<<21)) & ~ (1<<20)), S3C2416_GPHCON);
//writel(((readl(S3C2416_GPHUDP) & ~ (1<<21)) & ~ (1<<20)), S3C2416_GPHUDP);
//writel((readl(S3C2416_GPHDAT) & ~(1<<10)), S3C2416_GPHDAT);
mdelay(1);
//UART1 RTS1 (GPH11) set
s3c2410_gpio_cfgpin(S3C2410_GPH11, S3C2410_GPH11_nRTS);
//writel(((readl(S3C2416_GPHCON) | (1<<23)) & ~(1<<22)), S3C2416_GPHCON);
//writel((readl(S3C2416_GPHDAT) & ~(1<<11)), S3C2416_GPHDAT);
//writel(((readl(S3C2416_GPHUDP) & ~ (1<<23)) & ~ (1<<22)), S3C2416_GPHUDP);
mdelay(1);
break;
case S3C_WIFI_POWER_OFF:
printk("BCM4329-WIFI_POWER_OFF\n");
//TCON Flash disable, and select WiFi
s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH6, 0);
//bcm4329 module power off control
//EXT_N_WIFI_RST (GPD8) pull down
s3c2410_gpio_cfgpin(S3C2410_GPD8, S3C2410_GPD8_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD8, 0);
//WIFI_BT_EN (GPD11) pull down
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD11, 0);
//EXT_N_BT_RST (GPA2) pull down
s3c2410_gpio_cfgpin(S3C2410_GPA2, S3C2410_GPA2_OUT);
s3c2410_gpio_setpin(S3C2410_GPA2, 0);
mdelay(20);
//GPK9 (green light), pull down
writel(((readl(S3C2416_GPKCON) & ~(1<<19)) | (1<<18)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<9)), S3C2416_GPKDAT);
//GPK7, WIFI PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<15)) | (1<<14)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<7)), S3C2416_GPKDAT);
//GPK6, PA 1.8V
writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<6)), S3C2416_GPKDAT);
//GPK5, PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<5)), S3C2416_GPKDAT);
break;
#else
case S3C_WIFI_POWER_ON:
printk("WIFI_POWER_ON\n");
//TCON Flash disable, and select WiFi
s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH6, 0);
//GPL13, SPI_CS
s3c2410_gpio_cfgpin(S3C2410_GPL13, S3C2410_GPL13_SS0);
//SPI DI
@ -1288,6 +1694,11 @@ static int s3c_wifi_ioctl(struct inode *inode, struct file *file, unsigned int c
case S3C_WIFI_POWER_OFF:
printk("WIFI_POWER_OFF\n");
//TCON Flash disable, and select WiFi
s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH6, 0);
//GPK5, PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<5)), S3C2416_GPKDAT);
@ -1315,7 +1726,7 @@ static int s3c_wifi_ioctl(struct inode *inode, struct file *file, unsigned int c
break;
#endif
case S3C_READ_TILT_STATUS:
if( ((readl(S3C2410_GPDDAT) & (0x3<<10)) >> 10) == 2){
return 270;
@ -1366,6 +1777,191 @@ static int s3c_wifi_ioctl(struct inode *inode, struct file *file, unsigned int c
break;
case S3C_READ_HW_VERSION:
//printk("S3C_READ_HW_VERSION\n");
read_pin = readl(S3C2416_GPKDAT) & 0x1E;
//printk(" read_pin: 0x%x\n", read_pin);
ret = 0;
if((read_pin & (1<<4)))
ret = ret + 0x1000;
if((read_pin & (1<<3)))
ret = ret + 0x0100;
if((read_pin & (1<<2)))
ret = ret + 0x0010;
if((read_pin & (1<<1)))
ret = ret + 0x0001;
printk("Board ID: 0x%04x\n", ret);
return ret;
break;
case S3C_TCON_ERASE:
printk("S3C_TCON_ERASE\n");
//WiFi off
//GPK5, PA 3.3V off
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<5)), S3C2416_GPKDAT);
//GPK6, PA 1.8V
writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<6)), S3C2416_GPKDAT);
//GPD8, RESET
s3c2410_gpio_cfgpin(S3C2410_GPD8, S3C2410_GPD8_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD8, 0);
//GPH6, TCON_FLASH enable, and select TCON flash
s3c2410_gpio_cfgpin(S3C2410_GPH6, S3C2410_GPH6_OUTP);
s3c2410_gpio_setpin(S3C2410_GPH6, 1);
mdelay(200);
//Set GPIO for TCON update
//Chip Select
s3c2410_gpio_cfgpin(S3C2410_GPL13, S3C2410_GPL13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
//GPE11 SPIMISO0
s3c2410_gpio_cfgpin(S3C2410_GPE11, S3C2410_GPE11_INP);
s3c2410_gpio_pullup(S3C2410_GPE11, 0);
//GPE12 SPIMOSI0
s3c2410_gpio_cfgpin(S3C2410_GPE12, S3C2410_GPE12_OUTP);
s3c2410_gpio_setpin(S3C2410_GPE12, 1);
//GPE13 SPI CLK
s3c2410_gpio_cfgpin(S3C2410_GPE13, S3C2410_GPE13_OUTP);
s3c2410_gpio_setpin(S3C2410_GPE13, 0);
msleep(50);
//Erase TCON Flash
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x06); //Setting Write Enable Latch bit
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
udelay(50);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x60); //Write Chip Erase command
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
msleep(500);
do{
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x05); //Write Read Status command
r_data = s3c_tcon_read_byte();
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
//printk("r_data: 0x%02x\n", r_data);
msleep(500);
}while(r_data & 0x01);
tcon_byte_count = 0;
tcon_address = 0;
break;
case S3C_TCON_ID:
printk("S3C_TCON_ID: ");
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x9F);
r_data = s3c_tcon_read_byte();
printk("0x%02X ", r_data);
r_data = s3c_tcon_read_byte();
printk("0x%02X ", r_data);
r_data = s3c_tcon_read_byte();
printk("0x%02X\n", r_data);
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
break;
case S3C_TCON_READ:
printk("S3C_TCON_READ\n");
printk("\n\ns3c_tcon_read_content 1\n");
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x03);
s3c_tcon_write_byte(0x00);
s3c_tcon_write_byte(0x00);
s3c_tcon_write_byte(0x00);
for(i=0; i<300; i++){
printk("0x%02x\n", s3c_tcon_read_byte());
}
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
msleep(50);
printk("\n\ns3c_tcon_read_content 2\n");
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x03);
s3c_tcon_write_byte(0x02);
s3c_tcon_write_byte(0x0F);
s3c_tcon_write_byte(0xA0);
for(i=0; i<40; i++){
printk("0x%02x\n", s3c_tcon_read_byte());
}
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
break;
case S3C_TCON_BYTE_COUNT:
tcon_byte_count = arg;
//printk("S3C_TCON_BYTE_COUNT: %d\n", tcon_byte_count);
break;
case S3C_TCON_WRITE:
//printk("+ S3C_TCON_WRITE: %d\n ", tcon_address);
copy_from_user(tcon_buffer, arg, tcon_byte_count);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(20);
s3c_tcon_write_byte(0x06); //Setting Write Enable Latch bit
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
udelay(20);
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(20);
//printk("0x%x 0x%x 0x%x\n", (tcon_address & 0xFF0000) >> 16, (tcon_address & 0xFF00) >> 8, (tcon_address & 0xFF));
s3c_tcon_write_byte(0x02); //Write Page Program command
s3c_tcon_write_byte( (tcon_address & 0xFF0000) >> 16 );
s3c_tcon_write_byte( (tcon_address & 0xFF00) >> 8 );
s3c_tcon_write_byte( (tcon_address & 0xFF) );
for(i=0; i<tcon_byte_count; i++){
//printk("0x%02X ", tcon_buffer[i]);
s3c_tcon_write_byte(tcon_buffer[i]);
}
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
udelay(400);
do{
s3c2410_gpio_setpin(S3C2410_GPL13, 0);
udelay(50);
s3c_tcon_write_byte(0x05); //Write Read Status command
r_data = s3c_tcon_read_byte();
s3c2410_gpio_setpin(S3C2410_GPL13, 1);
//printk("r_data: 0x%02x\n", r_data);
udelay(100);
}while(r_data & 0x01);
tcon_address = tcon_address + tcon_byte_count;
//printk("\n- S3C_TCON_WRITE: %d\n\n", tcon_address);
break;
default:
printk("no this command\n");
@ -1373,12 +1969,140 @@ static int s3c_wifi_ioctl(struct inode *inode, struct file *file, unsigned int c
return 0;
}
#ifdef CONFIG_QISDA_BK060B00
static int s3c_bt_open(struct inode *inode, struct file *file);
static int s3c_bt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg);
/* File operations struct for character device */
static const struct file_operations s3c_bt_fops = {
.owner = THIS_MODULE,
.ioctl = s3c_bt_ioctl,
.open = s3c_bt_open,
.release = NULL
};
//Qisda, Ralph Chang, 2010/02/09, for bt power }
//Qisda, Ralph Chang, 2010/02/09, for bt power {
static int s3c_bt_open(struct inode *inode, struct file *file)
{
return 0;
}
static int s3c_bt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
switch(cmd){
case S3C_BT_POWER_ON:
printk("BCM4329-BT_POWER_ON\n");
//bcm4329 module power on control
//GPK7, WIFI PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<15)) | (1<<14)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<7)), S3C2416_GPKDAT);
//GPK6, PA 1.8V
writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<6)), S3C2416_GPKDAT);
//GPK5, PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<5)), S3C2416_GPKDAT);
mdelay(1);
//GPL8 (blue light), pull high
//printk ("\n GPL8 (blue light), pull high\n");
//writel(((readl(S3C2416_GPLCON) & ~(1<<17)) | (1<<16)), S3C2416_GPLCON);
//writel((readl(S3C2416_GPLDAT) | (1<<8)), S3C2416_GPLDAT);
//writel(((readl(S3C2416_GPLUDP) | (1<<17)) & ~(1<<16)), S3C2416_GPLUDP); //pull up enable
//s3c2410_gpio_cfgpin(S3C2410_GPL8, S3C2410_GPL8_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPL8, 1);
//s3c2410_gpio_pullup(S3C2410_GPL8, 1);
//WIFI_BT_EN (GPD11) pull high
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD11, 0);
//writel(((readl(S3C2416_GPGCON) & ~(1<<9)) | (1<<8)), S3C2416_GPGCON);
//writel((readl(S3C2416_GPGDAT) & ~(1<<4)), S3C2416_GPGDAT);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPD11, 1);
//writel((readl(S3C2416_GPGDAT) | (1<<4)), S3C2416_GPGDAT);
mdelay(20);
/*
printk("EXT_N_WIFI_RST (GPD8) set high\n");
//s3c2410_gpio_cfgpin(S3C2410_GPD8, S3C2410_GPD8_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPD8, 0);
writel(((readl(S3C2416_GPDCON) & ~(1<<17)) | (1<<16)), S3C2416_GPDCON);
writel((readl(S3C2416_GPDDAT) & ~(1<<8)), S3C2416_GPDDAT);
mdelay(1);
//s3c2410_gpio_setpin(S3C2410_GPD8, 1);
writel((readl(S3C2416_GPDDAT) | (1<<8)), S3C2416_GPDDAT);
mdelay(20);
*/
//EXT_N_BT_RST (GPA2) pull high
s3c2410_gpio_cfgpin(S3C2410_GPA2, S3C2410_GPA2_OUT);
s3c2410_gpio_setpin(S3C2410_GPA2, 0);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPA2, 1);
mdelay(20);
//UART1 CTS1 (GPH10) set
s3c2410_gpio_cfgpin(S3C2410_GPH10, S3C2410_GPH10_CLKOUT1);
//writel(((readl(S3C2416_GPHCON) | (1<<21)) & ~ (1<<20)), S3C2416_GPHCON);
//writel(((readl(S3C2416_GPHUDP) & ~ (1<<21)) & ~ (1<<20)), S3C2416_GPHUDP);
//writel((readl(S3C2416_GPHDAT) & ~(1<<10)), S3C2416_GPHDAT);
mdelay(1);
//"UART1 RTS1 (GPH11) set
s3c2410_gpio_cfgpin(S3C2410_GPH11, S3C2410_GPH11_nRTS);
//writel(((readl(S3C2416_GPHCON) | (1<<23)) & ~(1<<22)), S3C2416_GPHCON);
//writel((readl(S3C2416_GPHDAT) & ~(1<<11)), S3C2416_GPHDAT);
//writel(((readl(S3C2416_GPHUDP) & ~ (1<<23)) & ~ (1<<22)), S3C2416_GPHUDP);
mdelay(1);
break;
case S3C_BT_POWER_OFF:
printk("BCM4329-BT_POWER_OFF\n");
//bcm4329 module power off control
//EXT_N_BT_RST (GPA2) pull down
s3c2410_gpio_cfgpin(S3C2410_GPA2, S3C2410_GPA2_OUT);
s3c2410_gpio_setpin(S3C2410_GPA2, 0);
mdelay(20);
//WIFI_BT_EN (GPD11) pull down
s3c2410_gpio_cfgpin(S3C2410_GPD11, S3C2410_GPD11_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD11, 0);
//GPL8 (blue light), pull down
//writel(((readl(S3C2416_GPLCON) & ~(1<<17)) | (1<<16)), S3C2416_GPLCON);
//writel((readl(S3C2416_GPLDAT) & ~(1<<8)), S3C2416_GPLDAT);
//s3c2410_gpio_cfgpin(S3C2410_GPL8, S3C2410_GPL8_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPL8, 0);
//GPK7, WIFI PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<15)) | (1<<14)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<7)), S3C2416_GPKDAT);
//GPK6, PA 1.8V
writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<6)), S3C2416_GPKDAT);
//GPK5, PA 3.3V
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) & ~(1<<5)), S3C2416_GPKDAT);
break;
default:
printk("no this command\n");
}
return 0;
}
#endif
/* File operations struct for character device */
static const struct file_operations s3c_wifi_fops = {
@ -1426,6 +2150,17 @@ static int s3c_hsmmc_probe (struct platform_device *pdev)
}
//Qisda, Asaku Chen, 2009/08/20, for wifi power }
#ifdef CONFIG_QISDA_BK060B00
//Qisda, Ralph Chang, 2010/02/09, for bt power {
if(plat_data->hwport==1){
if (register_chrdev (S3C_BT_MAJOR, "s3c_bt_cmd", &s3c_bt_fops)) {
printk("unable to get major S3C_BT_MAJOR\n");
}
}
//Qisda, Asaku Chen, 2009/08/20, for wifi power }
#endif
host = mmc_priv(mmc);
host->mmc = mmc;
@ -1465,7 +2200,25 @@ static int s3c_hsmmc_probe (struct platform_device *pdev)
DBG("s3c_hsmmc_cfg(plat_data): enabled(%d) hwport(%d)\n", plat_data->enabled, plat_data->hwport);
/* To detect a card inserted on channel 0, an external interrupt is used. */
/* Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card { */
#ifdef CONFIG_SD_SW_DEBOUNCE
if( plat_data->hwport == 0)
{
init_timer(&sd_detect_timer);
sd_detect_timer.function=sdcard_debounce_timer;
}
#endif /* CONFIG_SD_SW_DEBOUNCE */
/* } Qisda, howard hsu, 2010/01/21, SW_DEBOUNCE for sd card */
/* Qisda, howard hsu, 2010/01/21, fix start slot for SD card { */
if( plat_data->hwport == 0)
{
mmc->first_devidx = 1;
}
else
{
mmc->first_devidx = 0;
}
/* } Qisda, howard hsu, 2010/01/21, fix start slot for SD card */
if ((plat_data->enabled == 1) && (plat_data->hwport == 0)) {
host->irq_cd = platform_get_irq(pdev, 1);
if (host->irq_cd == 0) {
@ -1514,7 +2267,8 @@ static int s3c_hsmmc_probe (struct platform_device *pdev)
/* you must make sure that our hsmmc block can support
* up to 52MHz. by scsuh
*/
mmc->f_max = 100 * MHZ;
//mmc->f_max = 100 * MHZ;
mmc->f_max = 25 * MHZ;
mmc->caps = plat_data->host_caps;
DBG("mmc->caps: %08lx\n", mmc->caps);
printk(KERN_INFO "mmc->caps: %08lx\n", mmc->caps);
@ -1708,7 +2462,13 @@ static int s3c_hsmmc_suspend(struct platform_device *pdev, pm_message_t state)
//mmc suspend GPIO config
s3c_hsmmc_power_switch(s3c_host->plat_data->hwport, 0);
/* Qisda, Howard, 2009/12/22, fix resume card-detect { */
if(s3c_host->plat_data->hwport==0)
{
inResume = 1;
card_detect2 = 2;
}
/* } Qisda, Howard, 2009/12/22, fix resume card-detect */
return 0;
}
@ -1733,19 +2493,41 @@ static int s3c_hsmmc_resume(struct platform_device *pdev)
//PWREN_SD
if(s3c_host->plat_data->hwport==0){
read_pin = readl(S3C2410_GPFDAT) & (1<<1);
if(read_pin){
//printk("\nno card\n");
if(read_pin && !card_detect){
printk("\nNO CARD\n");
s3c_hsmmc_power_switch(0, 0);
set_irq_type(s3c_host->irq_cd, IRQT_FALLING);
/* Qisda, Howard Hsu, 2009/12/17, card detect by level-trigger { */
//set_irq_type(s3c_host->irq_cd, IRQT_FALLING);
set_irq_type(s3c_host->irq_cd, IRQT_LOW);
/* } Qisda, Howard Hsu, 2009/12/17, card detect by level-trigger */
card_detect2 = 3;
}
else{
//printk("\ncard in\n");
if(read_pin){
printk("no card\n");
/* Qisda, Howard Hsu, 2009/12/17, card detect by level-trigger { */
//set_irq_type(s3c_host->irq_cd, IRQT_FALLING);
set_irq_type(s3c_host->irq_cd, IRQT_LOW);
/* } Qisda, Howard Hsu, 2009/12/17, card detect by level-trigger */
card_detect = 0;
//s3c_hsmmc_power_switch(0, 0);
}
else{
printk("card in\n");
/* Qisda, Howard Hsu, 2009/12/17, card detect by level-trigger { */
//set_irq_type(s3c_host->irq_cd, IRQT_RISING);
set_irq_type(s3c_host->irq_cd, IRQT_HIGH);
/* } Qisda, Howard Hsu, 2009/12/17, card detect by level-trigger */
card_detect = 1;
//s3c_hsmmc_power_switch(0, 1);
}
card_detect2 = 2;
s3c_hsmmc_power_switch(0, 1);
set_irq_type(s3c_host->irq_cd, IRQT_RISING);
s3c_hsmmc_ios_init(s3c_host);
mmc_resume_host(host);
}
card_detect2 = 2; //Qisda, Asaku Chen, 2009/11/03 {
inResume = 0; //howard, 2009/12/22, fix resume card-detect
}
else if(s3c_host->plat_data->hwport==1){
s3c_hsmmc_power_switch(1, 1);
@ -1813,6 +2595,12 @@ static void __exit s3c_hsmmc_drv_exit(void)
platform_driver_unregister(&s3c_hsmmc_driver);
}
void s3c_moviNAND_power_off(void)
{
struct s3c_hsmmc_host *host = global_host[1];
printk("s3c_moviNAND_power_off");
s3c_hsmmc_writeb(S3C_HSMMC_POWER_OFF, S3C_HSMMC_PWRCON);
}
module_init(s3c_hsmmc_drv_init);
module_exit(s3c_hsmmc_drv_exit);

View File

@ -48,9 +48,7 @@ static unsigned int tick_count;
/* Qisda, ShiYong Lin, 2009/07/22, Implement function for RTC tick service {*/
static unsigned long uiResolution = 0;
#ifdef QISDA
extern void rtc_tick_keypad_message_to_ap (void);
#endif
//extern void rtc_tick_keypad_message_to_ap (void);
/* Qisda, ShiYong Lin, 2009/07/22, Implement function for RTC tick service }*/
static irqreturn_t s3c_rtc_alarmirq(int irq, void *id)
@ -69,9 +67,9 @@ static irqreturn_t s3c_rtc_tickirq(int irq, void *id)
{
struct rtc_device *rdev = id;
#ifdef QISDA
rtc_tick_keypad_message_to_ap();
#endif
//rtc_tick_keypad_message_to_ap();
rtc_update_irq(&rdev->class_dev, tick_count++, RTC_PF | RTC_IRQF);
#if defined(CONFIG_CPU_S3C6400) || defined(CONFIG_CPU_S3C6410)

View File

@ -667,14 +667,16 @@ static unsigned int s3c24xx_serial_getclk(struct uart_port *port,
struct baud_calc *resptr, *best, *sptr;
int i;
/*Qisda Qube for smart card*/
if(port->irq==73&&port->uartclk==1)
{
//force uart 1 clock= pclk
/* Ralph added compile flag to disable it for BK060B00 */
#ifndef CONFIG_QISDA_BK060B00
/*Qisda Qube for smart card*/
if(port->irq==73&&port->uartclk==1)
{
//force uart 1 clock= pclk
cfg->clocks_size=1;
}
/*Qisda Qube for smart card*/
}
/*Qisda Qube for smart card*/
#endif
//printk("\n\n\s3c24xx_serial_getclk\n\n\n");
//printk("\n\n\n\n hwport= %ld \n\n\n\\n",cfg->hwport);
@ -782,15 +784,17 @@ static void s3c24xx_serial_set_termios(struct uart_port *port,
baud = uart_get_baud_rate(port, termios, old, 0, 115200*8);
/*Qisda Qube for smart card*/
/* Ralph added compile flag to disable it for BK060B00 */
#ifndef CONFIG_QISDA_BK060B00
/*Qisda Qube for smart card*/
if(port->irq==73&&port->uartclk==1)
{
//force uart1 to 38400
if(port->irq==73&&port->uartclk==1)
{
//force uart1 to 38400
baud=38400;
}
/*Qisda Qube for smart card*/
}
/*Qisda Qube for smart card*/
#endif
if (baud == 38400 && (port->flags & UPF_SPD_MASK) == UPF_SPD_CUST)
quot = port->custom_divisor;

View File

@ -52,6 +52,7 @@
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-clock.h>
#include <asm/arch/regs-spi.h>
#include <asm/arch/regs-irq.h>
#include <asm/dma.h>
#include "spi-dev.h"
@ -86,7 +87,132 @@ static void s3c_spi_wifi_if_on(void);
static void s3c_spi_wifi_if_off(void);
//#undef debug
//blacksu add
#define S3C2416_GPKCON S3C2410_GPIOREG(0xe0)
#define S3C2416_GPKDAT S3C2410_GPIOREG(0xe4)
#define S3C2416_GPKUDP S3C2410_GPIOREG(0xe8)
irqreturn_t Wlan_irq (int i4Irq, void *pvDevID)
{
printk("Wlan_irq()++\n");
disable_irq(IRQ_EINT3);
enable_irq(IRQ_EINT3);
printk("Wlan_irq()--\n");
return IRQ_HANDLED;
}
static void
myhexdump(char *pfx, unsigned char *msg, int msglen)
{
int i, col;
char buf[1024];
col = 0;
for (i = 0; i < msglen; i++, col++) {
if (col % 16 == 0)
strcpy(buf, pfx);
sprintf(buf + strlen(buf), "%02x", msg[i]);
if ((col + 1) % 16 == 0)
printk("%s\n", buf);
else
sprintf(buf + strlen(buf), " ");
}
if (col % 16 != 0)
printk("%s\n", buf);
}
void ClearSourcePenging(void)
{
writel( (1<<3), S3C2410_SRCPND);
}
void ClearIntrPenging(void)
{
writel( (1<<3), S3C2410_INTPND);
}
void S3cEnableIntr(void)
{
// writel(readl(S3C2410_INTMSK)& ~(1<<3), S3C2410_INTMSK);
writel(readl(S3C2410_INTMSK)& 0xfffffff7, S3C2410_INTMSK);
}
void S3cDisableIntr(void)
{
writel(readl(S3C2410_INTMSK)|(1<<3), S3C2410_INTMSK);
}
void spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen)
{
struct spi_dev *prSpiDev;
int ret;
unsigned char Write;
// int i;
//myhexdump("OUT:", msg_out,msglen);
/*
if( (sd->wordlen!=2) || (sd->resp_delay_all) )
{
printk("********************************\n");
printk("******* BlackSu *****************\n");
printk("********Watch Here***************\n");
printk("wordlen=%d, resp_delay_all=%d\n",sd->wordlen,sd->resp_delay_all);
printk("********************************\n");
}
*/
Write=msg_out[2] & 0x80;//bit 7: read:0, write :1
prSpiDev = spi_dev_get_by_minor(0);
if(Write)
{
ret = spi_master_send(prSpiDev, (char *)&msg_out[0], msglen-4);//send CMD
ret = spi_master_recv(prSpiDev, (char *)&msg_in[msglen-4], 4);
}
else
{
ret = spi_master_send(prSpiDev, (char *)&msg_out[0], 4);//send CMD
ret = spi_master_recv(prSpiDev, (char *)&msg_in[4], msglen-4);
}
//myhexdump("I N:", msg_in,msglen);
return ;
}
EXPORT_SYMBOL(ClearSourcePenging);
EXPORT_SYMBOL(ClearIntrPenging);
EXPORT_SYMBOL(S3cEnableIntr);
EXPORT_SYMBOL(S3cDisableIntr);
EXPORT_SYMBOL(spi_sendrecv);
#undef debug
//#define debug
#ifdef debug
#define DBG(x...) printk(x)
@ -112,7 +238,7 @@ void print_reg(struct s3c_spi *spi) { }
static void s3c_spi_free(struct s3c_spi *spi)
{
//DEBUG;
DEBUG;
if (spi->clk != NULL && !IS_ERR(spi->clk)) {
clk_disable(spi->clk);
@ -139,7 +265,7 @@ static void s3c_spi_free(struct s3c_spi *spi)
static void s3c_spi_wifi_if_on()
{
printk("\n[HIKO HSPI] s3c_spi_wifi_if_on()\n");
printk("s3c_spi_wifi_if_on()++\n");
/* program defaults into the registers */
writel(readl(S3C2443_SCLKCON)|(1<<14), S3C2443_SCLKCON);
@ -168,30 +294,82 @@ static void s3c_spi_wifi_if_on()
/* GeorgeKuo: */
//s3c2410_gpio_pullup(S3C2410_GPL13, 2); /* pull-up enable */
//GPK5, PA 3.3V
//writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
//writel((readl(S3C2416_GPKDAT) | (1<<5)), S3C2416_GPKDAT);
//writel(((readl(S3C2416_GPKUDP) & (1<<11)) | ~(1<<10)), S3C2416_GPKUDP);
//GPK6, PA 1.8V
//writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
//writel((readl(S3C2416_GPKDAT) | (1<<6)), S3C2416_GPKDAT);
//writel(((readl(S3C2416_GPKUDP) & (1<<13)) | ~(1<<12)), S3C2416_GPKUDP);
/*
printk("GPK_CON = 0x%08x\n",readl(S3C2416_GPKCON));
writel(((readl(S3C2416_GPKCON) & ~(1<<13)) | (1<<12)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<6)), S3C2416_GPKDAT);
writel(((readl(S3C2416_GPKUDP) & (1<<13)) | ~(1<<12)), S3C2416_GPKUDP);
*/
//GPK5, WIFI 3.3V
printk("GPK_CON = 0x%08x\n",readl(S3C2416_GPKCON));
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<5)), S3C2416_GPKDAT);
writel(((readl(S3C2416_GPKUDP) & (1<<11)) | ~(1<<10)), S3C2416_GPKUDP);
//GPK7, PA 3.3V
printk("GPK_CON = 0x%08x\n",readl(S3C2416_GPKCON));
writel(((readl(S3C2416_GPKCON) & ~(1<<15)) | (1<<14)), S3C2416_GPKCON);
writel((readl(S3C2416_GPKDAT) | (1<<7)), S3C2416_GPKDAT);
writel(((readl(S3C2416_GPKUDP) & (1<<15)) | ~(1<<14)), S3C2416_GPKUDP);
#if 0
//WIFI_BT_EN
//GPG4
s3c2410_gpio_cfgpin(S3C2410_GPG4, S3C2410_GPG4_OUTP);
// s3c2410_gpio_setpin(S3C2410_GPG4, 0);
// mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPG4, 1);
mdelay(20);
#endif
/* GeorgeKuo: */
//EXT Reset
//s3c2410_gpio_cfgpin(S3C2410_GPD8, S3C2410_GPD8_OUTP);
//s3c2410_gpio_setpin(S3C2410_GPD8, 0);
//mdelay(1);
//s3c2410_gpio_setpin(S3C2410_GPD8, 1);
//mdelay(20);
//EXT_N_WIFI_RST
//GPD8
s3c2410_gpio_cfgpin(S3C2410_GPD8, S3C2410_GPD8_OUTP);
s3c2410_gpio_setpin(S3C2410_GPD8, 0);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPD8, 1);
mdelay(20);
printk("s3c_spi_wifi_if_on()--\n");
}
EXPORT_SYMBOL_GPL(s3c_spi_wifi_if_on);
static void s3c_spi_wifi_if_off()
{
printk("\n[HIKO HSPI] s3c_spi_wifi_if_off()\n");
//GPK7, PA 3.3V
printk("+GPK_DAT = 0x%08x\n",readl(S3C2416_GPKDAT));
writel(((readl(S3C2416_GPKCON) & ~(1<<15)) | (1<<14)), S3C2416_GPKCON);
writel(((readl(S3C2416_GPKUDP) & ~(1<<15)) | (1<<14)), S3C2416_GPKUDP);
writel((readl(S3C2416_GPKDAT) & ~(1<<7)), S3C2416_GPKDAT);
// writel(((readl(S3C2416_GPKUDP) & (1<<15)) | ~(1<<14)), S3C2416_GPKUDP);
printk("-GPK_DAT = 0x%08x\n",readl(S3C2416_GPKDAT));
//GPK5, WIFI 3.3V
printk("+GPK_DAT = 0x%08x\n",readl(S3C2416_GPKDAT));
writel(((readl(S3C2416_GPKCON) & ~(1<<11)) | (1<<10)), S3C2416_GPKCON);
writel(((readl(S3C2416_GPKUDP) & ~(1<<11)) | (1<<10)), S3C2416_GPKUDP);
writel((readl(S3C2416_GPKDAT) & ~(1<<5)), S3C2416_GPKDAT);
// writel(((readl(S3C2416_GPKUDP) & (1<<11)) | ~(1<<10)), S3C2416_GPKUDP);
printk("-GPK_DAT = 0x%08x\n",readl(S3C2416_GPKDAT));
printk("s3c_spi_wifi_if_off()\n");
}
EXPORT_SYMBOL_GPL(s3c_spi_wifi_if_off);
@ -236,12 +414,14 @@ static int s3c_spi_hw_init(struct s3c_spi *spi)
#ifdef CONFIG_SPICLK_PCLK
/*Enable PCLK into the HS SPI*/
printk("Enable PCLK into the HS SPI\n");
writel(readl(S3C2443_PCLKCON)|(1<<6), S3C2443_PCLKCON);
clk_enable(spi->clk);
#elif defined CONFIG_SPICLK_EPLL
/* implemetation when use EPLL clock */
printk("implemetation when use EPLL clock\n");
writel(0x800, S3C2443_LOCKCON1);
writel( (readl( S3C2443_CLKSRC ) | (1 << 6) ), S3C2443_CLKSRC); // EPLL Output
@ -277,7 +457,7 @@ static int s3c_spi_hw_init(struct s3c_spi *spi)
static int s3c_spi_dma_init(struct s3c_spi *spi, int mode)
{
// DEBUG;
DEBUG;
// TX
if (mode == 0) {
@ -304,7 +484,7 @@ static int s3c_spi_dma_init(struct s3c_spi *spi, int mode)
static inline void s3c_spi_write_fifo(struct s3c_spi *spi)
{
u32 wdata = 0;
DEBUG;
if (spi->msg->wbuf) {
wdata = spi->msg->wbuf[spi->msg_ptr++];
} else {
@ -323,7 +503,7 @@ static inline void s3c_spi_write_fifo(struct s3c_spi *spi)
*/
static inline void s3c_spi_master_complete(struct s3c_spi *spi, int ret)
{
// DEBUG;
DEBUG;
spi->msg_ptr = 0;
spi->msg_rd_ptr = 0;
@ -358,7 +538,7 @@ static inline void s3c_spi_stop(struct s3c_spi *spi, int ret)
{
u32 spi_slavecfg;
u32 spi_chcfg;
DEBUG;
#if CONFIG_AUTO_nSS
#else
/* GeorgeKuo: set nSS high to stop bus operation */
@ -396,7 +576,7 @@ void s3c_spi_dma_cb(struct s3c2410_dma_chan *dma_ch, void *buf_id,
{
struct s3c_spi *spi = (struct s3c_spi *)buf_id;
unsigned long status = 0;
// DEBUG;
DEBUG;
status = readl(spi->regs + S3C_SPI_STATUS);
@ -427,7 +607,7 @@ static void s3c_spi_message_start(struct s3c_spi *spi)
//u32 spi_clkcfg = 0;
// DEBUG;
DEBUG;
#if CONFIG_DO_SWRST /* GeorgeKuo: do software reset */
writel(readl(spi->regs + S3C_CH_CFG) | SPI_CH_SW_RST, spi->regs + S3C_CH_CFG);
@ -615,11 +795,13 @@ static void s3c_spi_message_start(struct s3c_spi *spi)
static inline int tx_msgend(struct s3c_spi *spi)
{
DEBUG;
return spi->msg_ptr >= spi->msg->len;
}
static inline int rx_msgend(struct s3c_spi *spi)
{
DEBUG;
return spi->msg_rd_ptr >= spi->msg->len;
}
@ -733,7 +915,8 @@ static irqreturn_t s3c_spi_irq(int irqno, void *dev_id)
{
struct s3c_spi *spi = dev_id;
unsigned long spi_sts;
//printk("[S3C2416]s3c_spi_irq()++\n");
DEBUG;
spi_sts = readl(spi->regs + S3C_SPI_STATUS);
if (spi_sts & SPI_STUS_RX_OVERRUN_ERR) {
@ -762,7 +945,7 @@ static irqreturn_t s3c_spi_irq(int irqno, void *dev_id)
static int s3c_spi_doxfer(struct s3c_spi *spi, struct spi_msg msgs[], int num)
{
int ret;
DEBUG;
/* GeorgeKuo: spi_dev->bus_lock is acquired by caller, do we have to do
* protection again?
*/
@ -783,22 +966,24 @@ static int s3c_spi_doxfer(struct s3c_spi *spi, struct spi_msg msgs[], int num)
}*/
if (spi->msg->wbuf) {
// DEBUG;
DEBUG;
spi->state = STATE_XFER_TX;
/* vivek, 2009-04-15 17:40 Notes: write dmabufw to dmabuf_addr */
if (spi->msg->flags & SPI_M_DMA_MODE) {
spi->dmabuf_addr = spi->spidev.dmabufw;
pr_debug("spi->dmabuf_addr = 0x%x\n",spi->dmabuf_addr);
printk("[W]spi->dmabuf_addr = 0x%x\n",spi->dmabuf_addr);
}
} else if (spi->msg->rbuf) {
// DEBUG;
DEBUG;
spi->state = STATE_XFER_RX;
/* vivek, 2009-04-15 17:41 Notes: write dmabufr to dmabuf_addr */
if (spi->msg->flags & SPI_M_DMA_MODE) {
spi->dmabuf_addr = spi->spidev.dmabufr;
pr_debug("spi->dmabuf_addr = 0x%x\n",spi->dmabuf_addr);
printk("[R]spi->dmabuf_addr = 0x%x\n",spi->dmabuf_addr);
}
} else {
dev_err(spi->dev,"Unknown functionality \n");
@ -844,7 +1029,7 @@ static int s3c_spi_xfer(struct spi_dev *spi_dev,
struct s3c_spi *spi = (struct s3c_spi *)spi_dev->algo_data;
int retry;
int ret;
DEBUG;
for (retry = 0; retry < spi_dev->retries; retry++) {
ret = s3c_spi_doxfer(spi, msgs, num);
@ -865,7 +1050,7 @@ static int s3c_spi_close(struct spi_dev *spi_dev)
{
struct s3c_spi *spi = (struct s3c_spi *)spi_dev->algo_data;
u32 spi_clkcfg;
//DEBUG;
DEBUG;
spi_clkcfg = readl( spi->regs + S3C_CLK_CFG);
/* GeorgeKuo: */
@ -959,8 +1144,10 @@ static int s3c_spi_probe(struct platform_device *pdev)
struct s3c_spi *spi = &s3c_spi[pdev->id];
struct resource *res;
int ret;
DEBUG;
/* find the clock and enable it */
printk("s3c_spi_probe(name=%s , id=%d, # resources=%d)++\n", pdev->name, pdev->id,pdev->num_resources);
sema_init(&spi->sem, 0);
spi->nr = pdev->id;
spi->dev = &pdev->dev;
@ -990,7 +1177,7 @@ static int s3c_spi_probe(struct platform_device *pdev)
goto out;
}
printk(KERN_ALERT "resource start : %x\n",res->start);
printk("resource start : %x\n",res->start);
spi->regs = ioremap(res->start, (res->end - res->start) + 1);
@ -1000,7 +1187,7 @@ static int s3c_spi_probe(struct platform_device *pdev)
goto out;
}
printk(KERN_ALERT "hspi registers %p (%p, %p)\n", spi->regs, spi->ioarea, res);
printk("hspi registers %p (%p, %p)\n", spi->regs, spi->ioarea, res);
/* setup info block for the spi core */
@ -1028,6 +1215,8 @@ static int s3c_spi_probe(struct platform_device *pdev)
/* GeorgeKuo: */
//ret = request_irq(res->start, s3c_spi_irq, SA_INTERRUPT, pdev->name, spi);
printk("[s3c2416]request_irq=%d\n",spi->irq->start);
ret = request_irq(spi->irq->start, s3c_spi_irq, SA_INTERRUPT, pdev->name,
spi);
@ -1039,7 +1228,15 @@ static int s3c_spi_probe(struct platform_device *pdev)
/* GeorgeKuo: Do initialization here instead of each read/write operation */
do {
/* MT5921 uses CPOL=1, CPHA=1 */
u32 spi_chcfg = SPI_CH_MASTER | SPI_CH_FALLING | SPI_CH_FORMAT_B;
// u32 spi_chcfg = SPI_CH_MASTER | SPI_CH_FALLING | SPI_CH_FORMAT_B;
//blacksu mod
u32 spi_chcfg = SPI_CH_MASTER | SPI_CH_RISING | SPI_CH_FORMAT_A;
// spi_chcfg = SPI_CH_MASTER | SPI_CH_RISING | SPI_CH_FORMAT_B;
// spi_chcfg = SPI_CH_MASTER | SPI_CH_FALLING | SPI_CH_FORMAT_A;
//u32 spi_clkcfg = SPI_ENCLK_ENABLE | 1; /* prescaler = 1 */
u32 spi_clkcfg = SPI_ENCLK_ENABLE | CONFIG_SPI_PRESCALER; /* prescaler = 1 */
//0:44.435 Mhz, 1:22.2175 Mhz, 2:14.81 Mhz, 3:11.10875 Mhz, 4:8.887Mhz
@ -1106,6 +1303,95 @@ static int s3c_spi_probe(struct platform_device *pdev)
s3c_spi_dma_init(spi, 1);
printk("spi read channel is %d\n",spi->dmar);
/*
printk("GPFCON=%08X\n",readl(S3C2410_GPFCON));
printk("GPFDAT=%08X\n",readl(S3C2410_GPFDAT));
printk("GPFUP=%08X\n",readl(S3C2410_GPFUP));
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_OUTP);
//s3c2410_gpio_pullup(S3C2410_GPF3, 0); // pull-up/down disable
s3c2410_gpio_pullup(S3C2410_GPF3, 1); // pull-down enable
writel( (readl( S3C2410_GPFDAT ) | (1 << 3) ), S3C2410_GPFDAT); // EPLL Output
*/
#if 0
printk("GPFCON=%08X\n",readl(S3C2410_GPFCON));
printk("GPFDAT=%08X\n",readl(S3C2410_GPFDAT));
printk("GPFUP=%08X\n",readl(S3C2410_GPFUP));
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_INP);
//s3c2410_gpio_pullup(S3C2410_GPF3, 0); /* pull-up/down disable */
s3c2410_gpio_pullup(S3C2410_GPF3, 1); /* pull-down enable */
// s3c2410_gpio_pullup(S3C2410_GPF3, 2); /* pull-up enable */
//set_irq_type(WLAN_STA_IRQ, IRQ_TYPE_LEVEL_LOW);
set_irq_type(IRQ_EINT3, IRQ_TYPE_LEVEL_HIGH);
printk("GPFCON=%08X\n",readl(S3C2410_GPFCON));
printk("GPFDAT=%08X\n",readl(S3C2410_GPFDAT));
printk("GPFUP=%08X\n",readl(S3C2410_GPFUP));
#endif
#if 1
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
//s3c2410_gpio_pullup(S3C2410_GPF3, 0); // pull-up/down disable
s3c2410_gpio_pullup(S3C2410_GPF3, 1); // pull-down enable
// s3c2410_gpio_pullup(S3C2410_GPF3, 2); // pull-up enable
// set_irq_type(IRQ_EINT3, IRQ_TYPE_LEVEL_LOW);
set_irq_type(IRQ_EINT3, IRQ_TYPE_LEVEL_HIGH);
/*
s3c2410_gpio_cfgpin(S3C2410_GPF3, S3C2410_GPF3_EINT3);
//s3c2410_gpio_pullup(S3C2410_GPF3, 0); // pull-up/down disable
s3c2410_gpio_pullup(S3C2410_GPF3, 2); // pull-up enable
//set_irq_type(WLAN_STA_IRQ, IRQ_TYPE_LEVEL_LOW);
// set_irq_type(IRQ_EINT3, IRQ_TYPE_EDGE_FALLING);
set_irq_type(IRQ_EINT3, IRQ_TYPE_EDGE_FALLING);
mdelay(100);
// ret = request_irq(IRQ_EINT3, Wlan_irq, IRQ_TYPE_EDGE_FALLING | IRQ_DISABLED, "EINT3-test", NULL);
*/
printk("GPFCON=%08X\n",readl(S3C2410_GPFCON));
printk("GPFDAT=%08X\n",readl(S3C2410_GPFDAT));
printk("GPFUP=%08X\n",readl(S3C2410_GPFUP));
#endif
out:
if (ret < 0)
s3c_spi_free(spi);
@ -1166,6 +1452,91 @@ out:
} while (0);
#endif
#if 1 /* BCM4329 read test*/
do {
struct spi_dev *prSpiDev;
int ret;
// int i;
sdioh_info_t sd;
unsigned C[4];
unsigned char buf[128]={0x0,};
unsigned char msg_out[128]={0xa0,0x04,0x00,0x00,};
unsigned char msg_in[128]={0,};
int msglen=16;
#define CMD_READ 0
#define CMD_WRITE 1
#define ACCESS_FIXED 0
#define ACCESS_INCREMENTAL 1
#define FUN_0 0
#define FUN_1 1
#define FUN_2 2
#define FUN_3 3
unsigned int SPI_Cmd=CMD_READ;
unsigned int SPI_Acc=ACCESS_INCREMENTAL;
unsigned int SPI_Fun=FUN_0;
unsigned int SPI_Add=0x14;
unsigned int SPI_Len=0x4;
unsigned int CMD=0x0;
CMD= (SPI_Cmd <<31) | (SPI_Acc<<30) | (SPI_Fun<<28) | (SPI_Add<<11) | (SPI_Len<<0);
C[3]=(CMD & 0xff000000) >> 24;
C[2]=(CMD & 0x00ff0000) >> 16;
C[1]=(CMD & 0x0000ff00) >> 8;
C[0]=(CMD & 0x000000ff) >>0;
buf[0]=C[1];
buf[1]=C[0];
buf[2]=C[3];
buf[3]=C[2];
/*
// GeorgeKuo:
s3c2410_gpio_setpin(S3C2410_GPD8, 0);
mdelay(1);
s3c2410_gpio_setpin(S3C2410_GPD8, 1);
mdelay(20);
*/
prSpiDev = spi_dev_get_by_minor(0);
#if 1
// for (i = 0; i < 10; i++) {
ret = spi_master_send(prSpiDev, (char *)&buf[0], 4);
ret = spi_master_recv(prSpiDev, (char *)&buf[4], 8);
printk("****BCM4329 read test****\n");
if( (buf[4]==0xBE) &&
(buf[5]==0xAD) &&
(buf[6]==0xFE) &&
(buf[7]==0xED) )
printk("$$$$$$$ Success to read Reg. 0x14 buf1=%02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X\n",buf[0],buf[1],buf[2],buf[3],buf[4],buf[5],buf[6],buf[7],buf[8],buf[9],buf[10],buf[11]);
else
printk("!!!!!! Failed to read Reg. 0x14\n");
// }
#endif
sd.wordlen=2;
sd.resp_delay_all=0;
spi_sendrecv(&sd,msg_out, msg_in, msglen);
myhexdump("OUT:", msg_out,msglen);
myhexdump("I N:", msg_in,msglen);
//ret = spi_master_recv(prSpiDev, (char *)&u4RVal, sizeof(u32));
//printk(KERN_INFO "read 0x%x\n", u4RVal);
} while (0);
#endif
#if 0 /* MT5921 Initial */
do {
u32 u4InitCmd = 0x00040000UL;
@ -1223,7 +1594,7 @@ out:
}
} while (0);
#endif
printk("s3c_spi_probe()--\n");
return ret;
}
@ -1258,6 +1629,7 @@ static int s3c_spi_remove(struct platform_device *pdev)
static int s3c_spi_suspend(struct platform_device *pdev, pm_message_t msg)
{
struct s3c_spi *hw = platform_get_drvdata(pdev);
DEBUG;
clk_disable(hw->clk);
return 0;
}
@ -1265,6 +1637,7 @@ static int s3c_spi_suspend(struct platform_device *pdev, pm_message_t msg)
static int s3c_spi_resume(struct platform_device *pdev)
{
struct s3c_spi *hw = platform_get_drvdata(pdev);
DEBUG;
clk_enable(hw->clk);
s3c_spi_wifi_if_on();
@ -1293,16 +1666,20 @@ static struct platform_driver s3c_spi_driver = {
static int __init s3c_spi_driver_init(void)
{
printk(KERN_INFO "S3C2443 HSPI Driver \n");
// printk("s3c_spi_driver_init()\n");
DEBUG;
s3c_spi_wifi_if_on();
printk("platform_bus_type=%s\n",platform_bus_type.name);
return platform_driver_register(&s3c_spi_driver);
}
static void __exit s3c_spi_driver_exit(void)
{
printk("s3c_spi_driver_exit()++\n");
s3c_spi_wifi_if_off();
platform_driver_unregister(&s3c_spi_driver);
printk("s3c_spi_driver_exit()--\n");
}
module_init(s3c_spi_driver_init);

View File

@ -110,4 +110,154 @@ struct s3c_spi {
};
typedef unsigned char int8;
typedef signed short int16;
typedef signed int int32;
typedef unsigned char uchar;
//typedef unsigned short ushort;
//typedef unsigned int uint;
//typedef unsigned long ulong;
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
#define BCM_MEM_FILENAME_LEN 24
typedef void (*pktfree_cb_fn_t)(void *ctx, void *pkt, unsigned int status);
typedef struct {
bool pkttag;
uint pktalloced;
bool mmbus;
pktfree_cb_fn_t tx_fn;
void *tx_ctx;
} osl_pubinfo_t;
typedef struct bcm_mem_link {
struct bcm_mem_link *prev;
struct bcm_mem_link *next;
uint size;
int line;
char file[BCM_MEM_FILENAME_LEN];
} bcm_mem_link_t;
struct osl_info {
osl_pubinfo_t pub;
uint magic;
void *pdev;
uint malloced;
uint failed;
uint bustype;
bcm_mem_link_t *dbgmem_list;
};
/* Maximum number of I/O funcs */
#define SPI_MAX_IOFUNCS 4
#define NUM_PREV_TRANSACTIONS 16
/* Error statistics for gSPI */
struct spierrstats_t {
uint32 dna; /* The requested data is not available. */
uint32 rdunderflow; /* FIFO underflow happened due to current (F2, F3) rd command */
uint32 wroverflow; /* FIFO underflow happened due to current (F1, F2, F3) wr command */
uint32 f2interrupt; /* OR of all F2 related intr status bits. */
uint32 f3interrupt; /* OR of all F3 related intr status bits. */
uint32 f2rxnotready; /* F2 FIFO is not ready to receive data (FIFO empty) */
uint32 f3rxnotready; /* F3 FIFO is not ready to receive data (FIFO empty) */
uint32 hostcmddataerr; /* Error in command or host data, detected by CRC/checksum
* (optional)
*/
uint32 f2pktavailable; /* Packet is available in F2 TX FIFO */
uint32 f3pktavailable; /* Packet is available in F2 TX FIFO */
uint32 dstatus[NUM_PREV_TRANSACTIONS]; /* dstatus bits of last 16 gSPI transactions */
uint32 spicmd[NUM_PREV_TRANSACTIONS];
};
typedef struct osl_info osl_t;
typedef void (*sdioh_cb_fn_t)(void *);
struct sdioh_info {
uint cfg_bar; /* pci cfg address for bar */
uint32 caps; /* cached value of capabilities reg */
void *bar0; /* BAR0 for PCI Device */
osl_t *osh; /* osh handler */
void *controller; /* Pointer to SPI Controller's private data struct */
uint lockcount; /* nest count of spi_lock() calls */
bool client_intr_enabled; /* interrupt connnected flag */
bool intr_handler_valid; /* client driver interrupt handler valid */
sdioh_cb_fn_t intr_handler; /* registered interrupt handler */
void *intr_handler_arg; /* argument to call interrupt handler */
bool initialized; /* card initialized */
uint32 target_dev; /* Target device ID */
uint32 intmask; /* Current active interrupts */
void *sdos_info; /* Pointer to per-OS private data */
uint32 controller_type; /* Host controller type */
uint8 version; /* Host Controller Spec Compliance Version */
uint irq; /* Client irq */
uint32 intrcount; /* Client interrupts */
uint32 local_intrcount; /* Controller interrupts */
bool host_init_done; /* Controller initted */
bool card_init_done; /* Client SDIO interface initted */
bool polled_mode; /* polling for command completion */
bool sd_use_dma; /* DMA on CMD53 */
bool sd_blockmode; /* sd_blockmode == FALSE => 64 Byte Cmd 53s. */
/* Must be on for sd_multiblock to be effective */
bool use_client_ints; /* If this is false, make sure to restore */
/* polling hack in wl_linux.c:wl_timer() */
int adapter_slot; /* Maybe dealing with multiple slots/controllers */
int sd_mode; /* SD1/SD4/SPI */
int client_block_size[SPI_MAX_IOFUNCS]; /* Blocksize */
uint32 data_xfer_count; /* Current transfer */
uint16 card_rca; /* Current Address */
uint8 num_funcs; /* Supported funcs on client */
uint32 card_dstatus; /* 32bit device status */
uint32 com_cis_ptr;
uint32 func_cis_ptr[SPI_MAX_IOFUNCS];
void *dma_buf;
ulong dma_phys;
int r_cnt; /* rx count */
int t_cnt; /* tx_count */
uint32 wordlen; /* host processor 16/32bits */
uint32 prev_fun;
uint32 chip;
uint32 chiprev;
bool resp_delay_all;
bool dwordmode;
struct spierrstats_t spierrstats;
};
typedef struct sdioh_info sdioh_info_t;
void spi_sendrecv(sdioh_info_t *sd, uint8 *msg_out, uint8 *msg_in, int msglen);
void ClearSourcePenging(void);
void ClearIntrPenging(void);
void S3cEnableIntr(void);
void S3cDisableIntr(void);
#endif /* _S3C6400_SPI_H */

View File

@ -222,6 +222,8 @@ static ssize_t spidev_write (struct file *file, const char __user *buf, size_t c
count = BUFFER_SIZE;
if(spi_dev->flags & SPI_M_DMA_MODE){
printk("********USE DMA MODE*********\n");
tmp = dma_alloc_coherent(NULL, BUFFER_SIZE,
&spi_dev->dmabuf, GFP_KERNEL | GFP_DMA);
}

View File

@ -101,6 +101,8 @@ struct spi_algorithm {
extern int spi_attach_spidev(struct spi_dev *);
extern int spi_detach_spidev(struct spi_dev *);
extern struct spi_dev *spi_dev_get_by_minor(unsigned index);
/*
* SPI Message - used for pure spi transaction, also from /dev interface
*/

View File

@ -2058,10 +2058,12 @@ static int do_verify(struct fsg_dev *fsg)
static int do_inquiry(struct fsg_dev *fsg, struct fsg_buffhd *bh)
{
u8 *buf = (u8 *) bh->buf;
static char vendor_id[] = "Linux ";
static char product_id[] = "File-Stor Gadget";
/* Qisda, howard.hsu, 2010/01/26, change usb device name { */
//static char vendor_id[] = "Linux ";
//static char product_id[] = "File-Stor Gadget";
static char vendor_id[] = "e-Book ";
static char product_id[] = "Reader";
/* } Qisda, howard.hsu, 2010/01/26, change usb device name */
if (!fsg->curlun) { // Unsupported LUNs are okay
fsg->bad_lun_okay = 1;
memset(buf, 0, 36);

View File

@ -128,9 +128,7 @@ static void reconfig_usbd(void);
/*send key code F6 1 when USB plugin*/
/*send key code F6 0 when USB unplugin*/
/*send key code F6 0 when USB safety remove USB{*/
#ifdef QISDA
void USB_SaftRemove_keypad_message_to_ap(uint uiSleep)
#endif
//void USB_SaftRemove_keypad_message_to_ap(uint uiSleep);
/*}Qisda,Leo SJ Yang,2009/10/26*/
static __inline__ u32 usb_read(u32 port, u8 ind)
{
@ -299,8 +297,10 @@ static void udc_disable(struct s3c_udc *dev)
__raw_writel((0<<31)|(0<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
//#elif CONFIG_QISDA_AS090B00_EVT1
#else
if((readl(S3C2410_GPHDAT) &&(1<<11))==0)
/* Qisda, 2009/12/29, Howard Hsu, fix condition error */
if((readl(S3C2410_GPHDAT)&(1<<11))==0)
{
printk("turn-off USB_GPH14 power\n");
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 0);
/* usb clock disable */
@ -425,7 +425,7 @@ static int udc_enable(struct s3c_udc *dev)
/*Qisda,Leo SJ Yang,2009/09/09{*/
/*Fixed 3G module can not work after running Mass storage*/
// __raw_writel((0<<3)|(1<<2)|(1<<1)|(0<<0), S3C_PHYCTRL);
__raw_writel((0<<3)|(0<<2)|(0<<1)|(0<<0), S3C_PHYCTRL);
__raw_writel((0<<3)|(0<<2)|(1<<1)|(0<<0), S3C_PHYCTRL);
/*}Qisda,Leo SJ Yang,2009/09/09*/
/*Fixed 3G module can not work after running Mass storage*/
/* 48Mhz clock on ,PHY2.0 analog block power on
@ -455,8 +455,12 @@ static int udc_enable(struct s3c_udc *dev)
*/
/*Qisda,Leo SJ Yang,2009/09/09{*/
/*Fixed 3G module can not work after running Mass storage*/
/*Qisda Leo SJ Yang 2009/12/10*/
/*Fix the issue, the 3G can not work after playing audio{*/
//__raw_writel((1<<31)|(1<<2)|(0<<1)|(1<<0), S3C_UCLKCON);
__raw_writel((1<<31)|(1<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
__raw_writel((1<<31)|(1<<4)|(1<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
/*}Qisda Leo SJ Yang 2009/12/10*/
/*Fix the issue, the 3G can not work after playing audio*/
/*}Qisda,Leo SJ Yang,2009/09/09*/
/*Fixed 3G module can not work after running Mass storage*/
@ -1127,10 +1131,8 @@ static irqreturn_t s3c_udc_irq(int irq, void *_dev)
/*send key code F6 0 when USB safety remove USB{*/
/*Qisda,Leo SJ Yang,2009/11/13*/
/*prevent from sending saftremove event to MMI when the event to be occured is not the action of saftremove{*/
#ifdef QISDA
if((intr_status&S3C_UDC_INT_VBUSON)==0)
USB_SaftRemove_keypad_message_to_ap(0);
#endif
//if((intr_status&S3C_UDC_INT_VBUSON)==0)
//USB_SaftRemove_keypad_message_to_ap(0);
/*}Qisda,Leo SJ Yang,2009/11/13*/
#endif
/*}Qisda,Leo SJ Yang,2009/08/26 set g_EMUSBTestIsOK=0 when uplug USB*/
@ -1797,9 +1799,8 @@ static void s3c_ep0_setup(struct s3c_udc *dev, u32 csr)
/*Qisda,Leo SJ Yang,2009/07/28 add /proc/driver/udc for EM mode{*/
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
g_EMUSBTestIsOK=1;
#ifdef QISDA
USB_SaftRemove_keypad_message_to_ap(1);
#endif
//USB_SaftRemove_keypad_message_to_ap(1);
#endif
/*}Qisda,Leo SJ Yang,2009/07/28 add /proc/driver/udc for EM mode*/
@ -2192,6 +2193,16 @@ static int s3c_udc_ioctl(struct inode *inode, struct file *file, unsigned int cm
}
}
#ifdef CONFIG_PM_PLATFORM_POWER_SAVING
//{Benq,Andy add for USB power disable, even when VBUS_IN_STA is on
else if(arg == 5)
{
printk("\nUSB_UDC_DEVICE_POWER_DOWN\n");
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 0); /* usb all power disable (USB_EN20)*/
}
//}Benq,Andy add for USB power disable, even when VBUS_IN_STA is on
#endif
}
break;

View File

@ -25,6 +25,7 @@
#include <asm/hardware.h>
#include <asm/arch/usb-control.h>
#include <asm/arch/regs-gpio.h>
#include <asm/arch/regs-udc-hs.h>
#include <linux/major.h> //Qisda, Leo SJ Yang, 2009/08/31, for 3G power
#if defined(CONFIG_CPU_S3C6400)
@ -32,6 +33,7 @@
#elif defined(CONFIG_CPU_S3C6410)
#include <asm/arch/regs-s3c6410-clock.h>
#endif
#include <asm/arch/regs-s3c2416-clock.h>
#define USB_HOST_PORT2_EN 0
/*Qisda,Leo SJ Yang,2009/09/09{*/
@ -46,6 +48,10 @@ extern char g_EMUSBTestIsOK;
#include <asm/arch/regs-usb-otg-hs.h>
#endif
/*Qisda , wenny cheng , 20091224 , board id info {*/
#include <../include/asm-arm/plat-s3c24xx/common-smdk.h>
extern int board_id;
/*Qisda , wenny cheng , 20091224 , board id info }*/
#define valid_port(idx) ((idx) == 1 || (idx) == 2)
@ -408,6 +414,106 @@ static int s3c_3G_open(struct inode *inode, struct file *file)
{
return 0;
}
/*Qisda Leo SJ Yang,2009/12/10*/
/*Fix the issue, the 3G can not work after playing audio{*/
static int usb20_phy_init(void)
{
long reg=0;
#if 0
s3c2410_gpio_pullup(S3C2443_GPH14, 2); /* usb power pull-up enable */
s3c2410_gpio_pullup(S3C2410_GPF2, 0); /* vbus detect pull-up/down disable */
s3c2410_gpio_cfgpin(S3C2443_GPH14, S3C2443_GPH14_OUTP);
s3c2410_gpio_setpin(S3C2443_GPH14, 1); /* usb power enbale */
#endif
writel(((readl(S3C2410_GPHCON) & ~(1<<29)) | 1<<28), S3C2410_GPHCON);
writel(readl(S3C2410_GPHDAT) |(1<<14), S3C2410_GPHDAT);
writel(((readl(S3C2410_GPHCON) & ~(1<<17)) | 1<<16), S3C2410_GPHCON);
writel(readl(S3C2410_GPHDAT) &~(1<<8), S3C2410_GPHDAT);
writel(((readl(S3C2410_GPHCON) & ~(1<<23)) | 1<<22), S3C2410_GPHCON);
writel(readl(S3C2410_GPHDAT) &~(1<<11), S3C2410_GPHDAT);
writel(((readl(S3C2410_GPGCON) & ~(1<<7)) | 1<<6), S3C2410_GPGCON);
/*Qisda , wenny cheng , 20091224 , board id info {*/
if(board_id==QD090B00_S02)
writel(readl(S3C2410_GPGDAT) |(1<<3), S3C2410_GPGDAT);
/*Qisda , wenny cheng , 20091224 , board id info }*/
//s3c2410_gpio_pullup(S3C2410_GPG3, 2); /* usb power enbale */
//mdelay(100);
/*2009/10/21 ,Qisda,Leo SJ Yang*/
/*3G will voltage over 3.6V if charging capcity for 100 msec*/
/*change the time of charging from 100 msec to 65 msec{*/
mdelay(65);
/*}2009/10/21 ,Qisda,Leo SJ Yang*/
writel(readl(S3C2410_GPHDAT) |(1<<11), S3C2410_GPHDAT);
s3c2410_gpio_pullup(S3C2410_GPH11, 2); /* usb power enbale */
mdelay(1);
/*Qisda , wenny cheng , 20091224 , board id info {*/
if(board_id==QD090B00_S02)
writel(readl(S3C2410_GPGDAT) &~(1<<3), S3C2410_GPGDAT);
/*Qisda , wenny cheng , 20091224 , board id info }*/
//s3c2410_gpio_pullup(S3C2410_GPG3, 1); /* usb power enbale */
mdelay(1);
writel(((readl(S3C2410_GPHCON) & ~(1<<17)) | 1<<16), S3C2410_GPHCON);
writel(readl(S3C2410_GPHDAT) |(1<<8), S3C2410_GPHDAT);
s3c2410_gpio_pullup(S3C2410_GPH8, 2); /* usb power enbale */
s3c2410_gpio_pullup(S3C2410_GPH9, 2); /* usb power enbale */
#if 0
/* if reset by sleep wakeup, control the retention I/O cell */
if (readl(S3C_RSTSTAT) & 0x8)
writel(readl(S3C_RSTCON)|(1<<16), S3C_RSTCON);
/* USB Port is Normal mode */
writel(readl(S3C2410_MISCCR)&~(1<<12), S3C2410_MISCCR);
/* PHY power enable */
writel(readl(S3C_PWRCFG)|(1<<4), S3C_PWRCFG);
/* USB device 2.0 must reset like bellow,
* 1st phy reset and after at least 10us, func_reset & host reset
* phy reset can reset bellow registers.
*/
/* PHY 2.0 S/W reset */
writel((1<<1)|(0<<0), S3C_URSTCON);
mdelay(1); /* phy reset must be asserted for at 10us */
/*Function 2.0, Host 1.1 S/W reset*/
writel((0<<1)|(1<<0), S3C_URSTCON);
writel((0<<1)|(0<<0), S3C_URSTCON);
/* 48Mhz,Oscillator,External X-tal,device */
writel((0<<3)|(1<<2)|(1<<1)|(0<<0), S3C_PHYCTRL);
/* 48Mhz clock on ,PHY2.0 analog block power on
* XO block power on,XO block power in suspend mode,
* PHY 2.0 Pll power on ,suspend signal for save mode disable
*/
writel((1<<31)|(0<<4)|(0<<3)|(0<<2)|(0<<1)|(0<<0), S3C_PHYPWR);
/* D+ pull up disable(VBUS detect), USB2.0 Function clock Disable,
* USB1.1 HOST Enable, USB2.0 PHY test enable
*/
//__raw_writel((0<<31)|(0<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
//__raw_writel((1<<31)|(1<<4)|(0<<2)|(1<<1)|(1<<0), S3C_UCLKCON);
#endif
//writel((0<<3)|(1<<2)|(1<<1)|(0<<0), S3C_PHYCTRL);
reg=readl(S3C_PHYCTRL);
reg|=(1<<1);
writel(reg, S3C_PHYCTRL);
reg=readl(S3C_UCLKCON);
reg|=(1<<4);
writel(reg, S3C_UCLKCON);
return 0;
}
/*}Qisda Leo SJ Yang 2009/12/10 2009/12/10*/
/*Fix the issue, the 3G can not work after playing audio*/
static int s3c_3G_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
{
int retval;
@ -426,7 +532,9 @@ static int s3c_3G_ioctl(struct inode *inode, struct file *file, unsigned int cmd
USB_3G_POWER_SAVING = 0;
return 0;
}
/*Qisda Leo SJ Yang, 2009/12/10*/
/*Fix the issue, the 3G can not work after playing audio{*/
#if 0
#ifdef CONFIG_QISDA_E600_EVT2
writel(((readl(S3C2410_GPHCON) & ~(1<<29)) | 1<<28), S3C2410_GPHCON);
writel(readl(S3C2410_GPHDAT) |(1<<14), S3C2410_GPHDAT);
@ -469,7 +577,10 @@ static int s3c_3G_ioctl(struct inode *inode, struct file *file, unsigned int cmd
writel(readl(S3C2410_GPHDAT) &~(1<<11), S3C2410_GPHDAT);
writel(((readl(S3C2410_GPGCON) & ~(1<<7)) | 1<<6), S3C2410_GPGCON);
/*Qisda , wenny cheng , 20091224 , board id info {*/
if(board_id==QD090B00_S02)
writel(readl(S3C2410_GPGDAT) |(1<<3), S3C2410_GPGDAT);
/*Qisda , wenny cheng , 20091224 , board id info }*/
//s3c2410_gpio_pullup(S3C2410_GPG3, 2); /* usb power enbale */
//mdelay(100);
@ -483,16 +594,23 @@ static int s3c_3G_ioctl(struct inode *inode, struct file *file, unsigned int cmd
mdelay(1);
/*Qisda , wenny cheng , 20091224 , board id info {*/
if(board_id==QD090B00_S02)
writel(readl(S3C2410_GPGDAT) &~(1<<3), S3C2410_GPGDAT);
/*Qisda , wenny cheng , 20091224 , board id info }*/
//s3c2410_gpio_pullup(S3C2410_GPG3, 1); /* usb power enbale */
mdelay(1);
writel(((readl(S3C2410_GPHCON) & ~(1<<17)) | 1<<16), S3C2410_GPHCON);
writel(readl(S3C2410_GPHDAT) |(1<<8), S3C2410_GPHDAT);
s3c2410_gpio_pullup(S3C2410_GPH8, 2); /* usb power enbale */
s3c2410_gpio_pullup(S3C2410_GPH9, 2); /* usb power enbale */
#endif //CONFIG_QISDA_AS090B00_EVT1_1
#endif
usb20_phy_init();
/*}Qisda Leo SJ Yang 2009/12/10*/
/*Fix the issue,the 3G can not work after playing audio*/
s3c_3Gpower_off = 0;
if(g_phcd==NULL)
{
@ -594,7 +712,12 @@ static int s3c_3G_ioctl(struct inode *inode, struct file *file, unsigned int cmd
#if defined(CONFIG_QISDA_AS090B00_EVT1_1)|| defined(CONFIG_QISDA_QD090B00_EVT1)
writel((readl(S3C2410_GPHDAT)&~(1<<11)),S3C2410_GPHDAT);
writel(readl(S3C2410_GPHDAT)&~(1<<8), S3C2410_GPHDAT);
/*Qisda , wenny cheng , 20091224 , board id info {*/
if(board_id==QD090B00_S02)
writel((readl(S3C2410_GPGDAT)&~(1<<3)),S3C2410_GPGDAT);
/*Qisda , wenny cheng , 20091224 , board id info }*/
s3c2410_gpio_pullup(S3C2410_GPH11, 1); /* usb power enbale */
s3c2410_gpio_pullup(S3C2410_GPH8, 1); /* usb power enbale */
#endif
@ -745,7 +868,11 @@ static int usb_hcd_s3c2410_probe (const struct hc_driver *driver,
writel((readl(S3C2410_GPHDAT)&~(1<<11)),S3C2410_GPHDAT); //on/off
writel(readl(S3C2410_GPHDAT)&~(1<<8), S3C2410_GPHDAT);//disable
/*Qisda , wenny cheng , 20091224 , board id info {*/
if(board_id==QD090B00_S02)
writel(readl(S3C2410_GPGDAT)&~(1<<3), S3C2410_GPGDAT);//audio reset
/*Qisda , wenny cheng , 20091224 , board id info }*/
#endif
if (register_chrdev (S3C_3G_MAJOR, "s3c_3G_cmd", &s3c_3G_fops)) {

File diff suppressed because it is too large Load Diff

View File

@ -78,7 +78,9 @@
#define AUOFB_IOCTL_SHOW_PROGRESS_BAR 0xFFE0
#define AUOFB_IOCTL_CLEAN_EPD 0xFFE1
/* Qisda, Howard Hsu, 2010/01/11, Add show image ioctrl { */
#define AUOFB_IOCTL_SHOW_IMAGE 0xFFE2
/* } Qisda, Howard Hsu, 2010/01/11, Add show image ioctrl */
#define EPD_DEVICE_POWER_STATE AUOFB_IOCTL_TCON_POWER_STATE
enum {
@ -411,5 +413,6 @@ extern int auo_fb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
extern void auofb_activate_var(struct auo_fb_info *fbi, struct fb_var_screeninfo *var);
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -44,6 +44,8 @@ typedef enum
#define AUO_EPAPER_CMD_RESET 0x1005
#define AUO_EPAPER_CMD_ROTATION 0x1006
#define AUO_EPAPER_CMD_LUT_STOP 0x1009
#define AUO_EPAPER_CMD_PRE_DISPLAY_START 0x100D
#define AUO_EPAPER_CMD_PRE_DISPLAY_STOP 0x100F
#define AUO_EPAPER_CMD_FLASH_W 0x2000
#define AUO_EPAPER_CMD_FLASH_E 0x2001
@ -89,10 +91,9 @@ typedef struct T_DISPLAY_FRAME_TAG
unsigned short* pFrameData;
} T_DISPLAY_FRAME, *T_DISPLAY_FRAME_P;
//functions
void Epaper_SetLcdPort(void);
DispErrorCode_t Epaper_Disp(T_DISPLAY_FRAME tFrame);
int Epaper_Disp(T_DISPLAY_FRAME tFrame);
int is_Epaper_Write_Ready(void);
int is_Epaper_Write_Ready_No_Wait(void);
int is_Epaper_Write_Ready_Wait(unsigned long waitTime); //ms
@ -102,15 +103,17 @@ void Epaper_Set_Resolution(int h_res, int v_res);
void Epaper_Enter_Standby_Mode(int isEnter);
void Epaper_Enter_Sleep_Mode(int isEnter);
void Epaper_Power(int isEnable);
int Epaper_Init(int h_Res, int v_Res, int rotation, int data_inverse, int inputdata_arrangement, int outputdata_arrangement,int UD, int SHL);
int Epaper_Init(int h_Res, int v_Res, int temp_ave, int data_filter, int rotation, int data_inverse, int inputdata_arrangement, int outputdata_arrangement,int UD, int SHL);
void EPaper_CloseLcdPort(void);
void Epaper_Read_R_TEMP(unsigned short* val0, unsigned short* val1, unsigned short* val2, unsigned short* val3);
void Epaper_Display_Refresh(void);
int Epaper_Update_LUT(unsigned short* u16LUT, unsigned long u32LUTLength);
void Epaper_Read_LUT(unsigned short* u16LUT, unsigned long u32LUTLength);
int Epaper_Read_LUT(unsigned short* u16LUT, unsigned long u32LUTLength);
void Epaper_Reset(void);
void Epaper_Clean_Panel(void);
void Epaper_Show_Progress(int percent);
int Epaper_Pre_DMA_Disp_Start(T_DISPLAY_FRAME tFrame);
int Epaper_Pre_DMA_Disp_Stop(T_DISPLAY_FRAME tFrame);
#ifdef EPAPER_BOOT_CODE
#else //KERNEL

View File

@ -30,15 +30,20 @@ config LOGO_LINUX_LANDSCAPED_CLUT224
depends on LOGO
default y
config LOGO_LINUX_SH060B00_6_INCH_CLUT224
bool "SH060B00 224-color Linux logo, 6 inch"
depends on LOGO && FB_AUOEPAPER_6
default n
config LOGO_LINUX_CUSTOMER_6_INCH_CLUT224
bool "Customer 224-color Linux logo, 6 inch"
depends on LOGO && FB_AUOEPAPER_6
default y
default n
config LOGO_LINUX_CUSTOMER_9_INCH_CLUT224
bool "Customer 224-color Linux logo, 9 inch"
depends on LOGO && FB_AUOEPAPER_9
default y
default n
config LOGO_DEC_CLUT224
bool "224-color Digital Equipment Corporation Linux logo"

View File

@ -5,8 +5,9 @@ obj-$(CONFIG_LOGO_LINUX_MONO) += logo_linux_mono.o
obj-$(CONFIG_LOGO_LINUX_VGA16) += logo_linux_vga16.o
obj-$(CONFIG_LOGO_LINUX_CLUT224) += logo_linux_clut224.o
obj-$(CONFIG_LOGO_LINUX_LANDSCAPED_CLUT224) += logo_linux_landscaped_clut224.o
obj-$(CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224) += logo_linux_customer_6_inch_clut224.o
#obj-$(CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224) += logo_linux_customer_6_inch_clut224.o
obj-$(CONFIG_LOGO_LINUX_CUSTOMER_9_INCH_CLUT224) += logo_linux_customer_9_inch_clut224.o
obj-$(CONFIG_LOGO_LINUX_SH060B00_6_INCH_CLUT224) += logo_linux_sh060b00_6_inch_clut224.o
obj-$(CONFIG_LOGO_DEC_CLUT224) += logo_dec_clut224.o
obj-$(CONFIG_LOGO_MAC_CLUT224) += logo_mac_clut224.o
obj-$(CONFIG_LOGO_PARISC_CLUT224) += logo_parisc_clut224.o
@ -16,6 +17,17 @@ obj-$(CONFIG_LOGO_SUPERH_MONO) += logo_superh_mono.o
obj-$(CONFIG_LOGO_SUPERH_VGA16) += logo_superh_vga16.o
obj-$(CONFIG_LOGO_SUPERH_CLUT224) += logo_superh_clut224.o
obj-$(CONFIG_LOGO_M32R_CLUT224) += logo_m32r_clut224.o
# Qisda, Howard Hsu, 2010/01/04, custom logo for BQ060B00 {
ifdef CONFIG_QISDA_BQ060B00
ifndef CONFIG_RESCUEOS_BUILD
obj-$(CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224) += logo_bq060b00_startup_6_inch_clut224.o
else
obj-$(CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224) += logo_bq060b00_rescueos_6_inch_clut224.o
endif
else
obj-$(CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224) += logo_linux_customer_6_inch_clut224.o
endif
# } Qisda, Howard Hsu, 2010/01/04, custom logo for BQ060B00
# How to generate logo's

View File

@ -36,9 +36,24 @@ extern const struct linux_logo logo_superh_clut224;
extern const struct linux_logo logo_m32r_clut224;
//20090819 Ivan
extern const struct linux_logo logo_linux_customer_6_inch_clut224;
//extern const struct linux_logo logo_linux_customer_6_inch_clut224;
extern const struct linux_logo logo_linux_customer_9_inch_clut224;
extern const struct linux_logo logo_linux_sh060b00_6_inch_clut224;
//20090819 Ivan
#ifdef CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224
/* Qisda, Howard Hsu, 2010/01/04, custom logo for BQ060B00 { */
#ifdef CONFIG_QISDA_BQ060B00
#ifdef CONFIG_RESCUEOS_BUILD
extern const struct linux_logo logo_bq060b00_rescueos_6_inch_clut224;
#else
extern const struct linux_logo logo_bq060b00_startup_6_inch_clut224;
#endif /* CONFIG_RESCUEOS_BUILD */
#else
extern const struct linux_logo logo_linux_customer_6_inch_clut224;
#endif /* CONFIG_QISDA_BQ060B00 */
#endif /* CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224 */
/* } Qisda, Howard Hsu, 2010/01/04, custom logo for BQ060B00 */
const struct linux_logo *fb_find_logo(int depth)
{
@ -112,12 +127,25 @@ const struct linux_logo *fb_find_logo(int depth)
#endif
//20090819 Ivan
/* Qisda, Howard Hsu, 2010/01/04, custom logo for BQ060B00 { */
#ifdef CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224
#ifdef CONFIG_QISDA_BQ060B00
#ifdef CONFIG_RESCUEOS_BUILD
logo = &logo_bq060b00_rescueos_6_inch_clut224;
#else
logo = &logo_bq060b00_startup_6_inch_clut224;
#endif
#else
logo = &logo_linux_customer_6_inch_clut224;
#endif
#endif /* CONFIG_QISDA_BQ060B00 */
#endif /*CONFIG_LOGO_LINUX_CUSTOMER_6_INCH_CLUT224 */
/* } Qisda, Howard Hsu, 2010/01/04, custom logo for BQ060B00 */
#ifdef CONFIG_LOGO_LINUX_CUSTOMER_9_INCH_CLUT224
logo = &logo_linux_customer_9_inch_clut224;
#endif
#ifdef CONFIG_LOGO_LINUX_SH060B00_6_INCH_CLUT224
logo = &logo_linux_sh060b00_6_inch_clut224;
#endif
//20090819 Ivan
}
return logo;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -625,6 +625,10 @@ shortname:
(*nr_slots)++;
memcpy(de->name, msdos_name, MSDOS_NAME);
de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
/* Qisda Mark Tsai, 2010/01/13 { */
if (name[0] == '.')
de->attr |= ATTR_HIDDEN;
/* Qisda Mark Tsai, 2010/01/13 } */
de->lcase = lcase;
fat_date_unix2dos(ts->tv_sec, &time, &date);
de->time = de->ctime = time;

View File

@ -1105,6 +1105,10 @@
/*2009/7/17,Qisda Leo SJ Yang Set GPK3 for enabling SD_POWER{*/
#define S3C2416_GPLCON S3C2410_GPIOREG(0xF0)
#define S3C2416_GPLDAT S3C2410_GPIOREG(0xF4)
#define S3C2416_GPLUDP S3C2410_GPIOREG(0xF8)
#define S3C2416_GPKCON S3C2410_GPIOREG(0xE0)
#define S3C2416_GPKDAT S3C2410_GPIOREG(0xE4)
#define S3C2416_GPKUDP S3C2410_GPIOREG(0xE8)

View File

@ -12,4 +12,13 @@
* published by the Free Software Foundation.
*/
/*Qisda , wenny cheng , 20091224 , board id info {*/
#define QD090B00_S02 0
#define QD090B00_S03 4
#define BQ060B00_A01_And_Before 0
#define BQ060B00_A02 1
#define QD060B00_A01_And_Before 0
#define QD060B00_A02 1
/*Qisda , wenny cheng , 20091224 , board id info }*/
extern void smdk_machine_init(void);

View File

@ -2,7 +2,7 @@
* Disclaimer (blabla)
*
* Author: Manoël Trapier <manoelt@bookeen.com>
* Copyright (c) 2009 Bookeen
* Copyright (c) 2009-2010 Bookeen
*
*/
#ifndef CYBOOK_H
@ -12,8 +12,45 @@ enum {
CYBOOK_GEN3 = 0,
CYBOOK_OPUS,
CYBOOK_GEN3GOLD,
CYBOOK_OPUS2,
CYBOOK_GEN4,
};
extern unsigned int platform_type;
/* 3322 2222 2222 1111 1111 1100 0000 0000
* 1098 7654 3210 9876 5432 1098 7654 3210
* ---------------------------------------
* FFGG VVSS
*
* FF = Form Factor
* GG = GSensor mode
* VV = Video Driver
* SS = Sound Driver
*/
extern unsigned long platform_capability;
#define PLAT_CAP_GSENSOR (3 << 4)
#define PLAT_CAP_GNONE (0 << 4)
#define PLAT_CAP_GMMA7455 (1 << 4)
#define PLAT_CAP_GMMA7660 (2 << 4)
#define PLAT_CAP_GTILT (3 << 4)
#define PLAT_CAP_SOUND (3 << 0)
#define PLAT_CAP_SOUNDNO (0 << 0)
#define PLAT_CAP_SOUNDL3 (1 << 0)
#define PLAT_CAP_VIDEO (3 << 2)
#define PLAT_CAP_VAPOLLO (0 << 2)
#define PLAT_CAP_VEPSON (1 << 2)
#define PLAT_CAP_VTCON (2 << 2)
#define PLAT_CAP_FORMFACTOR (3 << 6)
#define PLAT_CAP_GEN3FORM (0 << 6)
#define PLAT_CAP_OPUSFORM (1 << 6)
#define PLAT_CAP_ORIZONFORM (2 << 6)
#define GET_CAPABILITY(CAPAB) (platform_capability & (CAPAB))
//#define PLAT_CAP_
#endif /* CYBOOK_H */

107
include/linux/auofb_ioctl.h Normal file
View File

@ -0,0 +1,107 @@
/*
* auofb_ioctl.h
*
* Copyright 2009 Bookeen <devs@bookeen.com>
*
* 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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#ifndef AUOFB_IOCTL_H
#define AUOFB_IOCTL_H
#pragma pack(1)
typedef struct sAUOCommand_t
{
unsigned long cmd;
unsigned short params[5];
unsigned long datalen;
unsigned short *data;
} sAUOCommand;
#pragma pack()
/* [MTR]: Epson_S1D13521 Like command interface for AUO TCON K1900 */
#define IOCTL_AUO_PREFIX ('A' << 8)
#define IOCTL_AUO_SENDCOMMAND (IOCTL_AUO_PREFIX | 0x01)
/* Command definition *
* 3322 2222 2222 1111 1111 1100 0000 0000 *
* 1098 7654 3210 9876 5432 1098 7654 3210 *
* --------------------------------------- *
* WD pppp CCCC CCCC CCCC CCCC *
*
* W = 'need_wait'
* D = 'have_data'
* p = 'nb_param'
* C = "command"
*/
#define SET_AUO_COMMAND(command, nb_param, have_data, need_wait) \
( ((need_wait & 0x01) << 29) |\
((have_data & 0x01) << 28) |\
((nb_param & 0x0F) << 20) |\
(command & 0xFFFF) )
#define AUOCMD_INIT_SET SET_AUO_COMMAND(0x0000, 1, 0, 1)
#define AUOCMD_STANDBY SET_AUO_COMMAND(0x0001, 0, 0, 1)
#define AUOCMD_WAKEUP SET_AUO_COMMAND(0x0002, 0, 0, 0)
#define AUOCMD_DISPLAY_START SET_AUO_COMMAND(0x1001, 4, 1, 1)
#define AUOCMD_DISPLAY_STOP SET_AUO_COMMAND(0x1002, 0, 0, 1)
#define AUOCMD_DISPLAY_REFRESH SET_AUO_COMMAND(0x1004, 0, 0, 1)
#define AUOCMD_DISPLAY_RESET SET_AUO_COMMAND(0x1005, 0, 0, 1)
//#define AUOCMD_LUMINANCE_BALANCE SET_AUO_COMMAND(0x5001, 1, 0, 1)
//#define AUOCMD_AGING_MODE SET_AUO_COMMAND(0x6000, 0, 0, 1)
//#define AUOCMD_AGING_MODE_EXIT SET_AUO_COMMAND(0x6001, 0, 0, 1)
//#define AUOCMD_POWER_CONTROL SET_AUO_COMMAND(0x7000, 2, 0, 1)
#define AUO_DSPPARAM_FLASH (1 << 15)
#define AUO_DSPPARAM_MODE_GRAYwFLASH (0x00 << 12) /* Mode 0: Gray 4bit With Flash */
#define AUO_DSPPARAM_MODE_GRAYnFLASH (0x01 << 12) /* Mode 1: Gray 4bit Without flash */
#define AUO_DSPPARAM_MODE_TEXT (0x02 << 12) /* Mode 2: Text mode 2bit */
#define AUO_DSPPARAM_MODE_HIGHSPEED (0x03 << 12) /* Mode 3: Highspeed mode 1bit */
#define AUO_DSPPARAM_MODE_HANDWRITE (0x04 << 12) /* Mode 4: Handwriting mode 1bit */
#define AUO_DSPPARAM_MODE_AUTOSELECT (0x05 << 12) /* Mode 5: Autoselect mode */
/* INIT_SET command parameters */
#define AUO_INITPARAM_OUT_DATA_ARR (0x01 << 5) /* Set to 0 (default) for normal, 1 for inverse byte order */
#define AUO_INITPARAM_RESOL_800x600 (0x00 << 2) /* Set to 800x600 (default) */
#define AUO_INITPARAM_RESOL_1024x768 (0x01 << 2) /* Set to 1024x768 */
#define AUO_INITPARAM_RESOL_600x800 (0x04 << 2) /* Set to 600x800 */
#define AUO_INITPARAM_RESOL_768x1024 (0x05 << 2) /* Set to 768x1024 */
#define AUO_INITPARAM_UD_FUNC (0x01 << 1) /* Set to 0 (default) to scan down, 1 to scan up */
#define AUO_INITPARAM_SHL_FUNC (0x01 << 0) /* Set to 0 to shift left, 1 (default) to scan right */
#define AUO_INITPARAM_IN_DATA_ARR (0x01 << 6) /* Set to 0 (default) for normal, 1 for inverse byte order */
#define AUO_INITPARAM_INV_DISPLAY (0x01 << 9) /* Set to 0 (default) for normal colors, 1 for inversed colors */
#define AUO_INITPARAM_ROTATION_000 (0x00 << 10) /* Set the rotation to 0° (0) */
#define AUO_INITPARAM_ROTATION_090 (0x01 << 10) /* Set the rotation to 90° (PI/2) */
#define AUO_INITPARAM_ROTATION_180 (0x02 << 10) /* Set the rotation to 180° (PI) */
#define AUO_INITPARAM_ROTATION_270 (0x03 << 10) /* Set the rotation to 270° (1.5*PI) */
#define AUO_INITPARAM_DATA_FILTER (0x01 << 12) /* Data filter (1: active, 0: inactive) */
#define AUO_INITPARAM_TEMP_AVERAGE (0x01 << 13) /* Temperature average (1: active, 0: inactive) */
int Epaper_sendCommand(sAUOCommand *cmd);
/* Please, do not use these #define s */
#define GET_COMMAND_PARAM_NUM(command) ((command >> 20) & 0x0F)
#define GET_COMMAND_HAVE_DATA(command) ((command >> 28) & 0x01)
#define GET_COMMAND_NEED_WAIT(command) ((command >> 29) & 0x01)
#endif /* AUOFB_IOCTL_H */

71
include/linux/cyio.h Normal file
View File

@ -0,0 +1,71 @@
// ===========================================================================
// cyio.h
// Copyright (C) 2008-2010 Bookeen - All rights reserved
// ===========================================================================
// Key events
#define CYEVENT_KEY_ENTER 'e'
#define CYEVENT_KEY_RIGHT 'r'
#define CYEVENT_KEY_DOWN 'd'
#define CYEVENT_KEY_LEFT 'l'
#define CYEVENT_KEY_UP 'u'
#define CYEVENT_KEY_F1 '1'
#define CYEVENT_KEY_F2 '2'
#define CYEVENT_KEY_F3 '3'
#define CYEVENT_KEY_F4 '4'
#define CYEVENT_KEY_OFF 'o'
#define CYEVENT_KEY_DSLP 'S'
#define CYEVENT_KEY_VOLP '+'
#define CYEVENT_KEY_VOLN '-'
#define CYEVENT_KEY_REPEAT_FLAG 0x80
#define CYEVENT_KEY_REPEAT_END '0'
// Physical events
#define CYEVENT_USB_IN 'p'
#define CYEVENT_USB_OUT 'q'
#define CYEVENT_AC_IN 'a'
#define CYEVENT_AC_OUT 'b'
#define CYEVENT_ACN_IN 'j'
#define CYEVENT_ACN_OUT 'k'
#define CYEVENT_SD_IN 's'
#define CYEVENT_SD_OUT 't'
#define CYEVENT_SDN_IN 'u'
#define CYEVENT_SDN_OUT 'v'
// G-Sensor events
#define CYEVENT_ORIENTATIONCHANGED 'O'
#define CYEVENT_G_ROT000 'A'
#define CYEVENT_G_ROT090 'B'
#define CYEVENT_G_ROT180 'C'
#define CYEVENT_G_ROT270 'D'
#define CYEVENT_TOGGLE_GSENSOR 'G'
// Logical events
// CYEVENT_KEY_OFF + CYEVENT_KEY_VOLN
#define CYEVENT_FACTORY_OFF 'x'
#define CYEVENT_SUSPEND_SCREEN 'y'
#define CYEVENT_SUSPEND_DEVICE 'z'
/* Normaly no more used... */
//#define CYIO_KERNEL_2_6 1
// ===========================================================================
/* Non directly CyIO related values, but used for the Accelerometer */
#define G_SENSOR_ON '1'
#define G_SENSOR_OFF '0'
#define G_SENSOR_CAL 'C'
enum
{
CYGSENSOR_STATUS_ENABLED = 0, /** The accelerometer is enabled */
CYGSENSOR_STATUS_DISABLED = 1, /** The accelerometer is disabled */
CYGSENSOR_STATUS_NOTCALIB = 2, /** Not calibrated, or invalid calibration data */
CYGSENSOR_STATUS_CALIBRATED = 3, /** This status should never been read, but it could help to debug */
CYGSENSOR_STATUS_UNKNOWN = 4, /** This status should never been read, but it could help to debug */
CYGSENSOR_STATUS_CHIPDETECTED = 5, /** This status should never been read, used to say if we correctly detected the I²C accelerometer Chip */
CYGSENSOR_STATUS_CRITICALERROR = 6, /** If we are in this status, the G-Sensor is non working: possible cause, defective chip */
CYGSENSOR_STATUS_SUSPENDED = 7, /** The GSENSOR was on, the device go to deepsleep, so we go in this state. */
};
// ===========================================================================
/* Exported function of CyIO */
void Cyio_ResetTimer(void);
int Cyio_PushEvent(char eventId, char unique);
// ===========================================================================

View File

@ -178,6 +178,7 @@ otherwise SD card can not be mounted*/
#define S3C_WIFI_MAJOR 222 //Qisda, Asaku Chen, 2009/08/20 for wifi power
#define S3C_3G_MAJOR 223 //Qisda, Leo SJ Yang, 2009/08/27 for 3G Module power
#define S3C_UDC_MAJOR 224 //Qisda, Leo SJ Yang, 2009/11/04 for UDC power state
#define S3C_BT_MAJOR 225 //Qisda, Ralph Chang, 2010/02/09 for bt power state

View File

@ -103,6 +103,9 @@ struct mmc_host {
unsigned int max_req_size; /* maximum number of bytes in one req */
unsigned int max_blk_size; /* maximum size of one mmc block */
unsigned int max_blk_count; /* maximum number of blocks in one req */
/* Qisda, howard hsu, 2010/01/21, fix start slot for SD card { */
unsigned int first_devidx; /* preferred starting mmc block device index */
/* } Qisda, howard hsu, 2010/01/21, fix start slot for SD card */
/* private data */
spinlock_t lock; /* lock for claim and bus ops */

View File

@ -65,6 +65,14 @@ endmenu
menu "General setup"
# Qisda, Howard Hsu, 2010/01/04, config for RescueOS {
config RESCUEOS_BUILD
bool "Build for RescueOS kernel"
default n
help
Config to distinguish the build is for RescueOS from the normal kernel
# } Qisda, Howard Hsu, 2010/01/04, config for RescueOS
config LOCALVERSION
string "Local version - append to kernel release"
help

View File

@ -29,6 +29,13 @@ config PM_LEGACY
If unsure, say N.
config PM_PLATFORM_POWER_SAVING
bool "The platform power saving in OP mode"
depends on PM
default y
---help---
Support the devices (CPU/Touch/USB...) power saving modes under OP Mode
config PM_CPU_MODE
bool "PM_CPU_MODE"
depends on PM

View File

@ -254,9 +254,7 @@ static int enter_pm_cpu_mode(suspend_state_t state)
Unlock:
mutex_unlock(&pm_mutex);
/* Qisda, ShiYong Lin, 2009/09/28, Add the sleep event message when sleep {*/
#ifdef QISDA
s3c_keypad_pm_sleep_message_to_ap(0);
#endif
//s3c_keypad_pm_sleep_message_to_ap(0);
// printk(KERN_ERR "Sleep end enter_pm_cpu_mode, %d\n", state);
/* } Qisda, ShiYong Lin, 2009/09/28, Add the sleep event message when sleep */
return error;
@ -301,9 +299,7 @@ static int enter_state(suspend_state_t state)
Unlock:
mutex_unlock(&pm_mutex);
/* Qisda, ShiYong Lin, 2009/09/28, Add the sleep event message when sleep {*/
#ifdef QISDA
s3c_keypad_pm_sleep_message_to_ap(0);
#endif
//s3c_keypad_pm_sleep_message_to_ap(0);
/* } Qisda, ShiYong Lin, 2009/09/28, Add the sleep event message when sleep */
return error;
}

View File

@ -1,5 +1,11 @@
#!/bin/bash
# Qisda, Howard Hsu,2009/12/16
# Move the actual make kernel steps to RescueFS/src/dlfw/mkzImage
# 1) Only do below two steps here:
# 3.Cat kernel with pre-made rescue file system.
# 4.Pad the zeros to 4-byte boundar
# 2) change first command line parameter to "project name"
#
# Qisda,Howard Hsu,2009/11/18
# The script is used to create rescue.bin under ./arch/arm/boot/
# Steps:
@ -16,52 +22,63 @@
# input
# this file should be executable
rescueKernel=./arch/arm/boot/zImageRescue
rescueFs=../RescueFS/img/urootfs.img
# output
# output: rescue.bin
rescueBin=./arch/arm/boot/rescue.bin
# intermediate
rescureKernelBackupDir=../RescueFS/img/uzImage
rescueKernelTemp=./arch/arm/boot/zImage
arg1="none"
if [ -n $1 ]; then
arg1=$1
fi
if [ $arg1 == "skip" ]; then
echo "skip make rescue kernel"
cp $rescureKernelBackupDir $rescueKernelTemp
# input: two files
# 1-FS
rescueFs=../RescueFS/img/urootfs.img
let projectbuild=0
# 2-Kernel, decide
supportProjs=( qd060b00_movi bq060b00 sh060b00 qd090b00 as090b00 st060b00 )
if [ $# ne 1 ]; then
echo "usage: $0 (600 | 900 | project_name)"
exit 1;
else
echo "step1: make rescue kernel..."
make rescueOS_defconfig
make
if [ -f .config.old ]; then
mv .config.old .config
currProj=$1
for name in ${supportProjs[@]}
do
echo "check for $name proj"
if [ $currProj == $name ]; then
echo "$currProj is supported"
if [ -f "../RescueFS/img/uzImage_$currProj" ]; then
rescueKernel="../RescueFS/img/uzImage_$currProj"
else
if [[ $currProj =~ 060 ]]; then
rescueKernel=../RescueFS/img/uzImage600
else
rescueKernel=../RescueFS/img/uzImage900
fi
fi
projectbuild=1
break
fi
done
if [ "$currProj" == "skip" ]; then
echo "temp workaround for skip option"
rescueKernel=../RescueFS/img/uzImage600
projectbuild=1
fi
fi
rescueKsize=$(stat -c%s "$rescueKernelTemp")
echo " $rescueKernelTemp size is $rescueKsize"
if [ "$projectbuild" -ne "1" ]; then
echo "Invalid proj name: $currProj"
echo "supported projs: ${supportProjs[@]}"
fi
expectrescueKsize=1586688
let padzero=$expectrescueKsize-$rescueKsize
echo "step2: append $padzero zeros"
dd if=/dev/zero of=./zero.bin bs=$padzero count=1
cat $rescueKernelTemp ./zero.bin > $rescueKernel
rm ./zero.bin
#rm $rescueKernelTemp
cp $rescueKernelTemp $rescureKernelBackupDir
if [ -f $rescueFs ]; then
echo "step3: cat kernel and Fs into rescue.bin"
cat $rescueKernel $rescueFs > $rescueBin
else
# intermediate
if [ ! -f "$rescueFs" ]; then
echo "$rescueFs does not exist!!!"
exit 1;
fi
if [ ! -f "$rescueKernel" ]; then
echo "$rescueKernel does not exist!!!"
exit 1;
fi
echo "cat kernel($rescueKernel) and Fs into rescue.bin"
cat $rescueKernel $rescueFs > $rescueBin
size=$(stat -c%s "$rescueBin")
let padzero=4-size%4
if [ padzero != 0 ]; then

File diff suppressed because it is too large Load Diff

View File

@ -305,11 +305,18 @@ static int smdk6400_hifi_hw_params(struct snd_pcm_substream *substream,
return ret;
#else
//HIKO DEBUG for PCLK clock
// writel((readl(S3C2443_PCLKCON)|(S3C2443_PCLKCON_IIS)), S3C2443_PCLKCON);
/* Select Clock source EPLL */
// regs = ioremap(S3C2410_PA_CLKPWR,0x20);
regs = readl(S3C2443_CLKSRC);
regs &= ~(3<<12);
regs &= ~(3<<14);
regs |= S3C2450_CLKSRC_I2S1_EPLL;
//HIKO DEBUG
@ -330,6 +337,9 @@ static int smdk6400_hifi_hw_params(struct snd_pcm_substream *substream,
#if 1
//HIKO DEBUG: 3G with Audio concurrency issue So we let the EPLL source always be 96MHz {
#if 0
switch (params_rate(params)) {
case 8000:
case 16000:
@ -352,6 +362,9 @@ static int smdk6400_hifi_hw_params(struct snd_pcm_substream *substream,
break;
}
#endif //0
//HIKO DEBUG: 3G with Audio concurrency issue So we let the EPLL source always be 96MHz }
//HIKO REVISION
#else
switch (params_rate(params)) {
@ -579,7 +592,14 @@ static int smdk6400_hifi_hw_params(struct snd_pcm_substream *substream,
// ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, ((prescaler - 1) << 0x8));
// ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, ((prescaler/2 - 1) << 0x8));
ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, ((prescaler/2) << 0x8));
// ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, ((prescaler/2) << 0x8));
// ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, ((prescaler/2) << 0x8));
//HIKO DEBUG: 3G with Audio concurrency issue So we let the EPLL source always be 96MHz {
ret = cpu_dai->dai_ops.set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER, (prescaler-1 << 0x8));
//HIKO DEBUG: 3G with Audio concurrency issue So we let the EPLL source always be 96MHz }
if (ret < 0)
return ret;
@ -822,18 +842,35 @@ void rt5624_i2s_init()
//////////////////////////////////////////////////
//HIKO DEBUG: init process for REALTEK 5624
//////////////////////////////////////////////////
//Original setting for CPU Master mode
#if 1
//AUDIO [i2s] LRCK setting
s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2410_GPE0_I2SLRCK);
//AUDIO [i2s] BCLK setting
s3c2410_gpio_cfgpin(S3C2410_GPE1, S3C2410_GPE1_I2SSCLK);
//[HIKO] Realtek Charles suggestion for CPU Slave mode
#else
//AUDIO [i2s] LRCK setting
s3c2410_gpio_setpin(S3C2410_GPE0, 0);
s3c2410_gpio_cfgpin(S3C2410_GPE0, S3C2410_GPE0_INP);
s3c2410_gpio_pullup(S3C2410_GPE0, 0);
//AUDIO [i2s] BCLK setting
s3c2410_gpio_setpin(S3C2410_GPE1, 0);
s3c2410_gpio_cfgpin(S3C2410_GPE1, S3C2410_GPE1_INP);
s3c2410_gpio_pullup(S3C2410_GPE1, 0);
#endif
//AUDIO [i2s] DACDAT setting
s3c2410_gpio_cfgpin(S3C2410_GPE4, S3C2410_GPE4_I2SSDO);
#if defined(CONFIG_QISDA_AS090B00_EVT1)||defined(CONFIG_QISDA_AS090B00_EVT1_1) || defined(CONFIG_QISDA_QD060N00_DVT1_1) || defined(CONFIG_QISDA_QD090B00_EVT1)
#if defined(CONFIG_QISDA_AS090B00_EVT1)||defined(CONFIG_QISDA_AS090B00_EVT1_1) || defined(CONFIG_QISDA_QD060N00_DVT1_1) || defined(CONFIG_QISDA_QD090B00_EVT1) || defined(CONFIG_QISDA_E600_DVT1)
printk("[HIKO rt5624] AS090B00 i2s Input MIC Setting\n");
//AUDIO [i2s] Input Mic setting
s3c2410_gpio_cfgpin(S3C2410_GPE3, S3C2410_GPE3_I2SSDI);
@ -843,6 +880,10 @@ void rt5624_i2s_init()
//AUDIO [i2s] MCLK setting
s3c2410_gpio_cfgpin(S3C2410_GPE2, S3C2410_GPE2_CDCLK);
//MCLK 11MHz
// s3c_i2s_set_iispcr_clkdiv_rt5624(5);