You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(26) |
Sep
(22) |
Oct
(55) |
Nov
(24) |
Dec
(30) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(68) |
Feb
(85) |
Mar
(54) |
Apr
(12) |
May
(52) |
Jun
(75) |
Jul
(116) |
Aug
(71) |
Sep
(54) |
Oct
|
Nov
(2) |
Dec
|
From: <mar...@us...> - 2007-03-20 16:43:22
|
Revision: 930 http://svn.sourceforge.net/hackndev/?rev=930&view=rev Author: marex_z71 Date: 2007-03-20 09:43:17 -0700 (Tue, 20 Mar 2007) Log Message: ----------- PalmLD: removing root device while suspended _IS_ a bad idea Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-20 16:40:22 UTC (rev 929) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-20 16:43:17 UTC (rev 930) @@ -68,14 +68,12 @@ static int palmld_ide_suspend(struct platform_device *dev, pm_message_t state) { printk("palmld_ide_suspend: going zzz\n"); - palmld_ide_remove(dev); return 0; } static int palmld_ide_resume(struct platform_device *dev) { printk("palmld_ide_resume: resuming\n"); - palmld_ide_probe(dev); return 0; } #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hap...@us...> - 2007-03-20 16:40:25
|
Revision: 929 http://svn.sourceforge.net/hackndev/?rev=929&view=rev Author: happy-slapin Date: 2007-03-20 09:40:22 -0700 (Tue, 20 Mar 2007) Log Message: ----------- z72: PM cleanup Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-03-20 16:05:19 UTC (rev 928) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-03-20 16:40:22 UTC (rev 929) @@ -26,17 +26,6 @@ #include <asm/arch/palmz72-gpio.h> #include <asm/arch/pxa27x_keyboard.h> -#define KPASMKP(col) (col/2==0 ? KPASMKP0 : col/2==1 ? KPASMKP1 : col/2==2 ? KPASMKP2 : KPASMKP3) -#define KPASMKPx_MKC(row, col) (1 << (row + 16*(col%2))) - -struct pm_save_data -{ - int brightness; - u32 rcnr; -}; - -static struct pm_save_data pm_save_data; - #ifdef CONFIG_PM static int palmz72_suspend(struct device *dev, pm_message_t state) { @@ -56,9 +45,6 @@ while(!(OSCC & OSCC_OOK)) {} - /* Here are all of special for suspend PalmOne Zire 72 */ - //printk("Palmz72_suspend: suspending..."); - /* Turn off LCD power */ SET_PALMZ72_GPIO(LCD_POWER,0); /* Turn screen off */ @@ -115,98 +101,6 @@ .resume = palmz72_pxa_ll_pm_resume, }; -static int (*pxa_pm_enter_orig)(suspend_state_t state); -#define KBD_ROWS 4 -#define KBD_COLS 3 -#if 0 -static int check_buttons(void) -{ - int data = 0, row, col; - u32 storekpc = KPC; - - data = GET_GPIO(GPIO_NR_PALMZ72_KP_DKIN7) && 1; - - pxa_set_cken(CKEN19_KEYPAD, 1); - - KPC |= KBD_ROWS << 26; - KPC |= KBD_COLS << 23; - - KPC &= ~(KPC_ASACT|KPC_AS|KPC_IMKP|KPC_DE|KPC_DIE|KPC_MIE); - - /* Processing automatic scan once */ - KPC |= KPC_ME | KPC_AS; - - for (row=0; row < KBD_ROWS; row++) { - for (col=0; col < KBD_COLS; col++) { - data |= (KPASMKP(col) & KPASMKPx_MKC(row, col) && 1) << 2; - } - } - - -// pxa_set_cken(CKEN19_KEYPAD, 0); - KPC = storekpc; - return data; -} -#endif -static int zire72_enter_suspend(suspend_state_t state) -{ - /* Here we should implement wakeup conditions - If we have none, just return 1 to continue - sleeping */ - int data = 0; - - /* Do not suspend on active keypress */ -#if 0 - if(check_buttons()) - return 1; -#endif - pxa_pm_enter_orig(state); - -#if 0 - if(!pm_save_data.rcnr) pm_save_data.rcnr = RCNR; - while(RCNR < ( pm_save_data.rcnr + 3)) { - - /* If we release button, sleep back */ - if(!(data = check_buttons())) { - pm_save_data.rcnr = 0; - return 1; - } - } -#endif - printk(KERN_NOTICE "Returning from sleep due to GPIOs 100-102 or 13\n"); - printk(KERN_NOTICE "RCNR = %u pm_save_data.rcnr = %u\n", RCNR, pm_save_data.rcnr); - printk(KERN_NOTICE "Keys pressed: %d\n", data); - pm_save_data.rcnr = 0; - return 0; -} - - -static int zire72_pxa_pm_enter(suspend_state_t state) -{ - pm_save_data.rcnr = 0; - -#if 0 - /* Do not suspend on active keypress */ - if(check_buttons()) - return 0; -#endif - pxa_pm_enter_orig(state); - - while (zire72_enter_suspend(state)) - {} - return 0; -} - - -static struct pm_ops zire72_pm_ops = { - .pm_disk_mode = PM_DISK_FIRMWARE, - .prepare = pxa_pm_prepare, - .enter = zire72_pxa_pm_enter, - .finish = pxa_pm_finish, -}; - -extern struct pm_ops pxa_pm_ops; - static int palmz72_pm_probe(struct device *dev) { printk(KERN_NOTICE "PalmOne Zire72 power management driver registered\n"); @@ -223,14 +117,11 @@ static int __init palmz72_pm_init(void) { - pxa_pm_enter_orig = pxa_pm_ops.enter; - pxa_pm_ops.enter = zire72_pxa_pm_enter; return driver_register(&palmz72_pm_driver); } static void __exit palmz72_pm_exit(void) { - pxa_pm_ops.enter = pxa_pm_enter_orig; driver_unregister(&palmz72_pm_driver); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-03-20 16:12:28
|
Revision: 928 http://svn.sourceforge.net/hackndev/?rev=928&view=rev Author: marex_z71 Date: 2007-03-20 09:05:19 -0700 (Tue, 20 Mar 2007) Log Message: ----------- PalmLD: various cleanups and testing microdrive suspend/resume Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 23:47:26 UTC (rev 927) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-20 16:05:19 UTC (rev 928) @@ -57,13 +57,33 @@ if (hd) { ide_unregister(*hd); } - + kfree(hd); /* conserve battery where we can */ SET_PALMLD_GPIO(IDE_PWEN, 0); return 0; } +#ifdef CONFIG_PM +static int palmld_ide_suspend(struct platform_device *dev, pm_message_t state) +{ + printk("palmld_ide_suspend: going zzz\n"); + palmld_ide_remove(dev); + return 0; +} + +static int palmld_ide_resume(struct platform_device *dev) +{ + printk("palmld_ide_resume: resuming\n"); + palmld_ide_probe(dev); + return 0; +} +#else +#define palmld_suspend NULL +#define palmld_resume NULL +#endif + + static struct platform_driver palmld_ide_driver = { .driver = { .name = "palmld-ide", @@ -71,8 +91,8 @@ }, .probe = palmld_ide_probe, .remove = palmld_ide_remove, - .suspend= NULL, - .resume = NULL, + .suspend= palmld_ide_suspend, + .resume = palmld_ide_resume, }; static int __init palmld_ide_init(void) Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c 2007-03-19 23:47:26 UTC (rev 927) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c 2007-03-20 16:05:19 UTC (rev 928) @@ -31,14 +31,6 @@ #define KPASMKP(col) (col/2==0 ? KPASMKP0 : col/2==1 ? KPASMKP1 : col/2==2 ? KPASMKP2 : KPASMKP3) #define KPASMKPx_MKC(row, col) (1 << (row + 16*(col%2))) -struct pm_save_data -{ - int brightness; - u32 rcnr; -}; - -static struct pm_save_data pm_save_data; - #ifdef CONFIG_PM static int palmld_suspend(struct device *dev, pm_message_t state) { @@ -67,8 +59,14 @@ while(!(OSCC & OSCC_OOK)) {} + /* Here are all of special for suspend PalmOne LifeDrive */ + + /* Turn off LCD power */ + SET_PALMLD_GPIO(LCD_POWER,0); + /* Turn screen off */ + SET_PALMLD_GPIO(SCREEN,0); + /* disable GPIO reset, palm bootloader will hang us */ - //PCFR |= PCFR_GPR_EN | PCFR_OPDE; PCFR &= PCFR_GPR_EN; return 0; @@ -86,9 +84,9 @@ /* Here are all of special to resume PalmOne LifeDrive */ /* Turn on LCD power */ -// SET_PALMZ72_GPIO(LCD_POWER,1); - /* Turn on USB power */ -// SET_PALMZ72_GPIO(USB_POWER,1); + SET_PALMLD_GPIO(LCD_POWER,1); + /* Turn screen on */ + SET_PALMLD_GPIO(SCREEN,1); return 0; } @@ -115,39 +113,6 @@ static int (*pxa_pm_enter_orig)(suspend_state_t state); -static int lifedrive_enter_suspend(suspend_state_t state) -{ - /* Here we should implement wakeup conditions - If we have none, just return 1 to continue - sleeping */ - int data = 0; - - /* Do not suspend on active keypress */ - pxa_pm_enter_orig(state); - - printk(KERN_NOTICE "Returning from sleep due to GPIOs 100-102 or 13\n"); - printk(KERN_NOTICE "RCNR = %u pm_save_data.rcnr = %u\n", RCNR, pm_save_data.rcnr); - printk(KERN_NOTICE "Keys pressed: %d\n", data); - pm_save_data.rcnr = 0; - return 0; -} -static int lifedrive_pxa_pm_enter(suspend_state_t state) -{ - pm_save_data.rcnr = 0; - pxa_pm_enter_orig(state); - while (lifedrive_enter_suspend(state)) - {} - return 0; -} - - -static struct pm_ops lifedrive_pm_ops = { - .pm_disk_mode = PM_DISK_FIRMWARE, - .prepare = pxa_pm_prepare, - .enter = lifedrive_pxa_pm_enter, - .finish = pxa_pm_finish, -}; - extern struct pm_ops pxa_pm_ops; static int palmld_pm_probe(struct device *dev) Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-03-19 23:47:26 UTC (rev 927) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-03-20 16:05:19 UTC (rev 928) @@ -29,6 +29,7 @@ #define GPIO_NR_PALMLD_EARPHONE_DETECT 13 #define GPIO_NR_PALMLD_SD_DETECT_N 14 /* SD card inserted; RE FE; Input */ #define GPIO_NR_PALMLD_LOCK_SWITCH 15 /* keypad lock */ +#define GPIO_NR_PALMLD_SCREEN 19 #define GPIO_NR_PALMLD_WM9712_IRQ 27 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bal...@us...> - 2007-03-19 23:47:38
|
Revision: 927 http://svn.sourceforge.net/hackndev/?rev=927&view=rev Author: balrog-kun Date: 2007-03-19 16:47:26 -0700 (Mon, 19 Mar 2007) Log Message: ----------- LD: palmld_ide: retabify. Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 23:27:48 UTC (rev 926) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 23:47:26 UTC (rev 927) @@ -17,30 +17,31 @@ static int palmld_ide_probe(struct platform_device *dev) { hw_regs_t hw; - int *hd = NULL; - - if(!machine_is_xscale_palmld()) return -ENODEV; + int *hd = NULL; - memset(&hw, 0, sizeof(hw)); + if (!machine_is_xscale_palmld()) + return -ENODEV; - if(!GET_PALMLD_GPIO(IDE_PWEN)) { - printk(KERN_INFO "palmld_ide_probe: enabling HDD power\n"); - SET_PALMLD_GPIO(IDE_PWEN, 1); - msleep(300); // fixme: should wait for a ready condition instead of just delaying - } + if (!GET_PALMLD_GPIO(IDE_PWEN)) { + printk(KERN_INFO "palmld_ide_probe: enabling HDD power\n"); + SET_PALMLD_GPIO(IDE_PWEN, 1); + /* fixme: should wait for a ready condition instead + * of just delaying */ + msleep(300); + } - ide_std_init_ports(&hw, PALMLD_IDE_VIRT + 0x10, PALMLD_IDE_VIRT + 0xe); + ide_std_init_ports(&hw, PALMLD_IDE_VIRT + 0x10, PALMLD_IDE_VIRT + 0xe); hw.dev = &dev->dev; - hw.irq = IRQ_GPIO_PALMLD_IDE_IRQ; - set_irq_type(hw.irq, IRQT_RISING); + hw.irq = IRQ_GPIO_PALMLD_IDE_IRQ; + set_irq_type(hw.irq, IRQT_RISING); hd = kmalloc(sizeof(int), GFP_KERNEL); - *hd = ide_register_hw(&hw, NULL); + *hd = ide_register_hw(&hw, NULL); if(*hd == -1) { - printk(KERN_ERR "palmld_ide_probe: unable to register ide hw\n"); + printk(KERN_ERR "palmld_ide_probe: " + "unable to register ide hw\n"); kfree(hd); - hd = NULL; return -ENODEV; } @@ -53,11 +54,11 @@ { int *hd = platform_get_drvdata(dev); - if(hd) { + if (hd) { ide_unregister(*hd); } - // conserve battery where we can + /* conserve battery where we can */ SET_PALMLD_GPIO(IDE_PWEN, 0); return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bal...@us...> - 2007-03-19 23:33:07
|
Revision: 926 http://svn.sourceforge.net/hackndev/?rev=926&view=rev Author: balrog-kun Date: 2007-03-19 16:27:48 -0700 (Mon, 19 Mar 2007) Log Message: ----------- LD: palmld_ide: initialise hw.dev properly Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 23:14:21 UTC (rev 925) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 23:27:48 UTC (rev 926) @@ -30,6 +30,7 @@ } ide_std_init_ports(&hw, PALMLD_IDE_VIRT + 0x10, PALMLD_IDE_VIRT + 0xe); + hw.dev = &dev->dev; hw.irq = IRQ_GPIO_PALMLD_IDE_IRQ; set_irq_type(hw.irq, IRQT_RISING); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bal...@us...> - 2007-03-19 23:33:07
|
Revision: 925 http://svn.sourceforge.net/hackndev/?rev=925&view=rev Author: balrog-kun Date: 2007-03-19 16:14:21 -0700 (Mon, 19 Mar 2007) Log Message: ----------- LD: convert palmld_ide to platform_device (this is 2007!) Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 20:19:05 UTC (rev 924) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 23:14:21 UTC (rev 925) @@ -14,7 +14,7 @@ #include <asm/arch/pxa-regs.h> #include <asm/arch/palmld-gpio.h> -static int palmld_ide_probe(struct device *dev) +static int palmld_ide_probe(struct platform_device *dev) { hw_regs_t hw; int *hd = NULL; @@ -43,14 +43,14 @@ return -ENODEV; } - dev_set_drvdata(dev, hd); + platform_set_drvdata(dev, hd); return 0; } -static int palmld_ide_remove(struct device *dev) +static int palmld_ide_remove(struct platform_device *dev) { - int *hd = dev_get_drvdata(dev); + int *hd = platform_get_drvdata(dev); if(hd) { ide_unregister(*hd); @@ -62,9 +62,11 @@ return 0; } -static struct device_driver palmld_ide_driver = { - .name = "palmld-ide", - .bus = &platform_bus_type, +static struct platform_driver palmld_ide_driver = { + .driver = { + .name = "palmld-ide", + .owner = THIS_MODULE, + }, .probe = palmld_ide_probe, .remove = palmld_ide_remove, .suspend= NULL, @@ -73,12 +75,12 @@ static int __init palmld_ide_init(void) { - return driver_register(&palmld_ide_driver); + return platform_driver_register(&palmld_ide_driver); } static void __exit palmld_ide_exit(void) { - driver_unregister(&palmld_ide_driver); + platform_driver_unregister(&palmld_ide_driver); } module_init(palmld_ide_init); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-03-19 20:32:34
|
Revision: 924 http://svn.sourceforge.net/hackndev/?rev=924&view=rev Author: marex_z71 Date: 2007-03-19 13:19:05 -0700 (Mon, 19 Mar 2007) Log Message: ----------- PalmLD: Battery driver and TESTING new powermanagement !!! USE AT YOUR 0WN RISK, IT CAN HANG YOUR DEVICE !!! Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h Added Paths: ----------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-init.h Removed Paths: ------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ac97.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Kconfig 2007-03-19 20:19:05 UTC (rev 924) @@ -21,3 +21,20 @@ config PALMLD_IDE tristate "Palm LifeDrive IDE driver" depends on MACH_XSCALE_PALMLD + +config PALMLD_BATTERY + tristate "Palm LifeDrive Battery support" + select TOUCHSCREEN_WM97XX + depends on MACH_XSCALE_PALMLD + default m + help + Enable support for PalmOne LifeDrive battery to APM. + ATM use it only as module, otherwise it hangs. + +config PALMLD_PM + tristate "Palm LifeDrive Power Management support" + depends on MACH_XSCALE_PALMLD + default y if MACH_XSCALE_PALMLD + help + Enable support for suspend/resume the PalmOne LifeDrive PDA. + \ No newline at end of file Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/Makefile 2007-03-19 20:19:05 UTC (rev 924) @@ -6,5 +6,6 @@ obj-$(CONFIG_PALMLD_PCMCIA) += palmld_pcmcia.o obj-$(CONFIG_PALMLD_USB) += palmld_usb.o obj-$(CONFIG_PALMLD_IDE) += palmld_ide.o -obj-$(CONFIG_PM) += palmld_pm.o +obj-$(CONFIG_PALMLD_PM) += palmld_pm.o +obj-$(CONFIG_PALMLD_BATTERY) += palmld_battery.o Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld.c 2007-03-19 20:19:05 UTC (rev 924) @@ -234,6 +234,18 @@ }; +/******************** + * Power Management * + ********************/ + +struct platform_device palmld_pm = { + .name = "palmld-pm", + .id = -1, + .dev = { + .platform_data = NULL, + }, +}; + /********************************************************* * IDE *********************************************************/ @@ -246,7 +258,7 @@ static struct platform_device *devices[] __initdata = { &palmld_kbd, &palmld_ac97, &palmld_ide, &palmld_backlight, - &palmldled_device, + &palmldled_device, &palmld_pm, }; /********************************************************* @@ -325,13 +337,6 @@ static void __init palmld_init(void) { - - -#ifdef CONFIG_PM - extern struct pxa_ll_pm_ops palmld_ll_pm_ops; - pxa_pm_set_ll_ops(&palmld_ll_pm_ops); -#endif - set_pxa_fb_info( &palmld_lcd_screen ); pxa_set_mci_info( &palmld_mci_platform_data ); platform_add_devices( devices, ARRAY_SIZE(devices) ); Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ac97.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ac97.c 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ac97.c 2007-03-19 20:19:05 UTC (rev 924) @@ -1,544 +0,0 @@ -/* - * linux/arch/arm/mach-pxa/palmld/palmld-ts.c - * - * Touchscreen/battery driver for Palm LifeDrive's WM9712 AC97 codec. - * - * Author: Alex Osborne <bob...@gm...> - */ - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/input.h> -#include <linux/device.h> -#include <linux/workqueue.h> -#include <linux/battery.h> - -#include <asm/delay.h> -#include <asm/arch/hardware.h> -#include <asm/arch/pxa-regs.h> -#include <asm/arch/irqs.h> -#include <asm/arch/palmld-gpio.h> -#include <asm/arch/palmld-ac97.h> - -#include <asm/mach-types.h> -#include <asm/mach/arch.h> -#include <asm/mach/map.h> - -#include <sound/driver.h> -#include <sound/core.h> -#include <sound/pcm.h> -#include <sound/initval.h> -#include <sound/ac97_codec.h> - - -#define palmld_ac97_WORK_QUEUE_NAME "palmld_ac97.c" - -#define GET_GPIO(gpio) \ - (GPLR(gpio) & GPIO_bit(gpio)) - -#define X_AXIS_MAX 3630 -#define X_AXIS_MIN 200 -#define Y_AXIS_MAX 3880 -#define Y_AXIS_MIN 160 -#define PRESSURE_MIN 0 -#define PRESSURE_MAX 300 - -#define GPIO_DEBUG - -static spinlock_t palmld_ac97_lock = SPIN_LOCK_UNLOCKED; - -static struct workqueue_struct *palmld_ac97_workqueue; -static struct work_struct palmld_ac97_irq_task; -struct input_dev *palmld_ac97_input; -struct device *palmld_ac97_dev; - -static u64 battery_update_jiffies_64 = 0; -static int battery_voltage; - -DECLARE_MUTEX(battery_update_mutex); - -/* - * ac97 codec - */ - -void wm97xx_gpio_func(ac97_t *ac97, int gpio, int func) -{ - int GEn; - GEn = ac97->bus->ops->read(ac97, 0x56); - if(func) - GEn |= gpio; - else - GEn &= ~gpio; - ac97->bus->ops->write(ac97, 0x56, GEn); -} - -void wm97xx_gpio_mode(ac97_t *ac97, int gpio, int config, int polarity, - int sticky, int wakeup) -{ - int GCn, GPn, GSn, GWn; - GCn = ac97->bus->ops->read(ac97, 0x4c); - GPn = ac97->bus->ops->read(ac97, 0x4e); - GSn = ac97->bus->ops->read(ac97, 0x50); - GWn = ac97->bus->ops->read(ac97, 0x52); - - if(config) - GCn |= gpio; - else - GCn &= ~gpio; - - if(polarity) - GPn |= gpio; - else - GPn &= ~gpio; - - if(sticky) - GSn |= gpio; - else - GSn &= ~gpio; - - if(wakeup) - GWn |= gpio; - else - GWn &= ~gpio; - - ac97->bus->ops->write(ac97, 0x4c, GCn); - ac97->bus->ops->write(ac97, 0x4e, GPn); - ac97->bus->ops->write(ac97, 0x50, GSn); - ac97->bus->ops->write(ac97, 0x52, GWn); -} - -void wm97xx_set_digitiser_power(struct device *dev, int value) -{ - ac97_t *ac97 = dev->platform_data; - u16 d2; - - d2 = ac97->bus->ops->read(ac97, AC97_WM97XX_DIGITISER2); - d2 |= value; - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2); -} - -/* - * This is a hack that waits until the ac97 bus is free. I was unable to find - * a more appropriate way of doing this, but it seems to work. If we don't use - * this, then the driver will eventually conflict with another driver's use - * of AC97 (probably audio) and will lockup. - */ -void wait_for_ac97(void) -{ - int timeout=1000; - - while (CAR & CAR_CAIP) { - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/100); - set_current_state(TASK_RUNNING); - if(!timeout--) { - printk("palmld_ac97_pendown: CAR_CAIP timeout\n"); - return; - } - } - CAR &= ~CAR_CAIP; - -} - -static int palmld_ac97_take_reading(struct device *dev, int adcsel) -{ - ac97_t *ac97 = dev->platform_data; - int timeout=100; - u16 r76, r7a; - - r76 = ac97->bus->ops->read(ac97, 0x76); - r76 &= ~WM97XX_ADCSEL_MASK; /* clear ADCSEL */ - r76 |= adcsel; /* set ADCSEL */ - r76 &= ~(1<<11); /* COO = 0 (single measurement) */ - r76 &= ~(1<<10); /* CTC = 0 (polling mode) */ - r76 |= (1<<15); /* start reading */ - ac97->bus->ops->write(ac97, 0x76, r76); - - do { - if(!(timeout--)) { - printk("palmld_ac97_pendown: timed out waiting for poll to complete.\n"); - return 0; - } - //udelay(1); - r76 = ac97->bus->ops->read(ac97, 0x76); - } while(!(r76 & (1<<15))); - printk("Poll complete loops=%d\n", 100-timeout); - - r7a = ac97->bus->ops->read(ac97, 0x7a); - return r7a; -} - - - -/* - * battery - */ - -void update_data(int force) -{ - u16 reading; - - if(!force && (battery_update_jiffies_64 + HZ > jiffies_64)) { - return; - } - - if(down_trylock(&battery_update_mutex)) { - return; - } - - - spin_lock(&palmld_ac97_lock); - wait_for_ac97(); - - #ifdef GPIO_DEBUG - ac97_t *ac97 = palmld_ac97_dev->platform_data; - - // invert and univert the gpio a few times while watching - // the PXA's gpios to see if we can spot a connection ;) - printk("%x %x %x\n", GPLR0, GPLR1, GPLR2); - - reading = ac97->bus->ops->read(ac97, 0x58); - ac97->bus->ops->write(ac97, 0x58, reading | 1); - udelay(10); - printk("%x %x %x %x\n", GPLR0, GPLR1, GPLR2, GPLR3); - - reading = ac97->bus->ops->read(ac97, 0x58); - ac97->bus->ops->write(ac97, 0x58, reading & (~1)); - udelay(10); - printk("%x %x %x %x\n", GPLR0, GPLR1, GPLR2, GPLR3); - - - #else - wm97xx_set_digitiser_power(palmld_ac97_dev, WM97XX_PRP_DET_DIG); - reading = palmld_ac97_take_reading(palmld_ac97_dev, WM97XX_ADCSEL_BMON); - wm97xx_set_digitiser_power(palmld_ac97_dev, WM97XX_PRP_DET); - - #endif - - spin_unlock(&palmld_ac97_lock); - battery_voltage = reading & 0xfff; - printk("Battery: %d\n", battery_voltage); - - battery_update_jiffies_64 = jiffies_64; - up(&battery_update_mutex); -} - -int get_min_voltage(struct battery *b) -{ - return 0; -} -int get_min_charge(struct battery *b) -{ - return 0; -} -int get_max_voltage(struct battery *b) -{ - return 4750; /* mV */ -} -int get_max_charge(struct battery *b) -{ - return 1; -} -int get_voltage(struct battery *b) -{ - update_data(0); - return battery_voltage; -} -int get_charge(struct battery *b) -{ - return 0; -} -int get_status(struct battery *b) -{ - return 0; //power_status == POWER_NONE? 0: 1; -} - -static struct battery palmld_battery = { - .name = "palmld-ac97", - .id = "battery0", - .get_min_voltage = get_min_voltage, - .get_min_current = NULL, - .get_min_charge = get_min_charge, - .get_max_voltage = get_max_voltage, - .get_max_current = NULL, - .get_max_charge = get_max_charge, - .get_temp = NULL, - .get_voltage = get_voltage, - .get_current = NULL, - .get_charge = get_charge, - .get_status = get_status, -}; - -static void -battery_class_release(struct class_device *dev) -{ -} - -static void -battery_class_class_release(struct class *class) -{ -} - - -/* - * touchscreen - */ - -static void palmld_ac97_pendown(struct device *dev) -{ - ac97_t *ac97 = dev->platform_data; - int xread, yread, pressure; - int pendown=0, valid_coords=0; - - - - /* - * shut off the pen detect interrupt until pen goes up, otherwise the WM9712 - * will keep on interrupting us and we'll never be able to get any work - * done. - */ - spin_lock(&palmld_ac97_lock); - wait_for_ac97(); - wm97xx_gpio_mode(ac97, WM97XX_GPIO_13, WM97XX_GPIO_IN, - WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE); - spin_unlock(&palmld_ac97_lock); - - - /* take readings until the pen goes up */ - do { - spin_lock(&palmld_ac97_lock); - wait_for_ac97(); - - /* power up digitiser */ - wm97xx_set_digitiser_power(dev, WM97XX_PRP_DET_DIG); - - /* take readings */ - xread = palmld_ac97_take_reading(dev, WM97XX_ADCSEL_X); - yread = palmld_ac97_take_reading(dev, WM97XX_ADCSEL_Y); - pressure = palmld_ac97_take_reading(dev, WM97XX_ADCSEL_PRES); - - /* power down digitiser to conserve power */ - wm97xx_set_digitiser_power(dev, WM97XX_PRP_DET); - - printk("(%d,%d) = %d\n", xread&0xfff, yread&0xfff, pressure&0xfff); - - pendown = pressure & (1<<15); - valid_coords = (xread & 0xfff) && (yread & 0xfff) && (pressure & 0xfff); - - /* - * with light pressure reading is exteremely inaccurate so only report - * it when there is heavy pressure - */ - if( (!pendown) || (pressure & 0xfff) < 100 ) { - - /* valid coordinates? */ - if(valid_coords) { - input_report_abs(palmld_ac97_input, ABS_X, xread & 0xfff); - input_report_abs(palmld_ac97_input, ABS_Y, yread & 0xfff); - input_report_abs(palmld_ac97_input, ABS_PRESSURE, pressure & 0xfff); - } - - if(valid_coords || !pendown) { - input_report_key(palmld_ac97_input, BTN_TOUCH, pendown); - } - input_sync(palmld_ac97_input); - } - - spin_unlock(&palmld_ac97_lock); - - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/100); - set_current_state(TASK_RUNNING); - } while(pressure & (1<<15)); - - /* re-enable pen detect interrupt */ - spin_lock(&palmld_ac97_lock); - wait_for_ac97(); - wm97xx_gpio_mode(ac97, WM97XX_GPIO_13, WM97XX_GPIO_IN, - WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE); - spin_unlock(&palmld_ac97_lock); - - printk("exit\n"); -} - -static void palmld_ac97_irq_work(void *data) -{ - int change = 0; - struct device *dev = data; - ac97_t *ac97 = dev->platform_data; - u16 levels; - - - //while(GET_GPIO(27)) { /* while interrupt still there */ - - spin_lock(&palmld_ac97_lock); - wait_for_ac97(); - levels = ac97->bus->ops->read(ac97, 0x54); - spin_unlock(&palmld_ac97_lock); - - printk("int %x\n", levels); - - - if(levels & WM97XX_GPIO_13) { - printk("Pen down detected %x\n", levels); - levels &= ~WM97XX_GPIO_13; - //wm9712_initiate_measurement(ac97); - palmld_ac97_pendown(dev); - change++; - } - - spin_lock(&palmld_ac97_lock); - wait_for_ac97(); - ac97->bus->ops->write(ac97, 0x54, levels); - spin_unlock(&palmld_ac97_lock); - //} - - -} - -static irqreturn_t palmld_ac97_irq_handler(int irq, void *dev_id, struct pt_regs *regs) -{ - /* - * we can't use ac97 from within the interrupt handler, so schedule a task - * to do the actual handling. - */ - queue_work(palmld_ac97_workqueue, &palmld_ac97_irq_task); - - return IRQ_HANDLED; -} - -static int __init palmld_ac97_probe(struct device *dev) -{ - int err; - ac97_t *ac97 = dev->platform_data; - u16 d2; - - if(!machine_is_xscale_palmld()) - return -ENODEV; - printk("palmld_ac97_probe\n"); - - /* for use by bettery level monitor */ - palmld_ac97_dev = dev; - - /* setup work queue */ - palmld_ac97_workqueue = create_workqueue(palmld_ac97_WORK_QUEUE_NAME); - INIT_WORK(&palmld_ac97_irq_task, palmld_ac97_irq_work, dev); - - - set_irq_type(IRQ_GPIO_PALMLD_WM9712_IRQ, IRQT_RISING); - err = request_irq(IRQ_GPIO_PALMLD_WM9712_IRQ, palmld_ac97_irq_handler, - SA_INTERRUPT, "WM9712 IRQ", dev); - - if(err) { - printk(KERN_ERR "palmld_ac97_probe: cannot request pen down IRQ\n"); - return -1; - } - - spin_lock(&palmld_ac97_lock); - - printk("x\n"); - - /* reset levels */ - ac97->bus->ops->write(ac97, 0x54, 0); - printk("y\n"); - - /* disable digitiser to save power, enable pen-down detect */ - d2 = ac97->bus->ops->read(ac97, AC97_WM97XX_DIGITISER2); - d2 |= WM97XX_PRP_DET; - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2); - - - /* enable interrupts on codec's gpio 2 (connected to cpu gpio 27) */ - wm97xx_gpio_mode(ac97, WM97XX_GPIO_2, WM97XX_GPIO_IN, - WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE); - wm97xx_gpio_func(ac97, WM97XX_GPIO_2, 0); - - /* enable pen detect interrupt */ - wm97xx_gpio_mode(ac97, WM97XX_GPIO_13, WM97XX_GPIO_IN, - WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE); - - /* enable ada detect interrupt */ - /* - wm97xx_gpio_mode(ac97, WM97XX_GPIO_12, WM97XX_GPIO_IN, - WM97XX_GPIO_POL_HIGH, WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE); - */ - - /* turn off irq gpio inverting */ - ac97->bus->ops->write(ac97, 0x58, ac97->bus->ops->read(ac97, 0x58)&~1); - - - /* turn on the digitiser and pen down detector */ - d2 = ac97->bus->ops->read(ac97, AC97_WM97XX_DIGITISER2); - d2 |= WM97XX_PRP_DETW; - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2); - printk("probe\n"); - - spin_unlock(&palmld_ac97_lock); - - /* setup the input device */ - palmld_ac97_input = input_allocate_device(); - palmld_ac97_input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - palmld_ac97_input->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); - input_set_abs_params(palmld_ac97_input, ABS_X, X_AXIS_MIN, X_AXIS_MAX, 0, 0); - input_set_abs_params(palmld_ac97_input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, 0, 0); - input_set_abs_params(palmld_ac97_input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, 0, 0); - - palmld_ac97_input->name = "Palm LifeDrive touchscreen"; - palmld_ac97_input->dev = dev; - palmld_ac97_input->id.bustype = BUS_HOST; - input_register_device(palmld_ac97_input); - - /* register battery */ - if(battery_class_register(&palmld_battery)) { - printk(KERN_ERR "palmld_ac97_probe: Could not register battery " - "class\n"); - } else { - palmld_battery.class_dev.class->release = battery_class_release; - palmld_battery.class_dev.class->class_release = battery_class_class_release; - } - - return 0; -} - -static int __exit palmld_ac97_remove (struct device *dev) -{ - ac97_t *ac97 = dev->platform_data; - printk("x: %x\n", ac97->bus->ops->read(ac97, AC97_WM97XX_DIGITISER2)); - input_unregister_device(palmld_ac97_input); - free_irq(IRQ_GPIO_PALMLD_WM9712_IRQ, dev); - return 0; -} - -static struct device_driver palmld_ac97_driver = { - .name = "WM9711,WM9712", - .bus = &ac97_bus_type, - .probe = palmld_ac97_probe, - .remove = palmld_ac97_remove, -#ifdef CONFIG_PM - .suspend = NULL, - .resume = NULL, -#endif -}; - -static int __init palmld_ac97_init(void) -{ - if(!machine_is_xscale_palmld()) - return -ENODEV; - - - return driver_register(&palmld_ac97_driver); -} - -static void __exit palmld_ac97_exit(void) -{ - driver_unregister(&palmld_ac97_driver); -} - -module_init(palmld_ac97_init); -module_exit(palmld_ac97_exit); - -MODULE_AUTHOR ("Alex Osborne <bob...@gm...>"); -MODULE_DESCRIPTION ("WM9712 AC97 codec support for Palm LifeDrive"); -MODULE_LICENSE ("GPL"); Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c (rev 0) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_battery.c 2007-03-19 20:19:05 UTC (rev 924) @@ -0,0 +1,236 @@ +/************************************************************************ + * linux/arch/arm/mach-pxa/palmld/palmld_battery.c * + * * + * Touchscreen/battery driver for WM9712 AC97 codec * + * Authros: Jan Herman <2h...@se...> * + * Sergey Lapin <sl...@ha...> * + * Changes for PalmLD: Marek Vasut <mar...@gm...> * + * * + ************************************************************************/ + + +#include <linux/kernel.h> +#include <linux/module.h> +#include <linux/moduleparam.h> +#include <linux/init.h> +#include <linux/interrupt.h> +#include <linux/input.h> +#include <linux/device.h> +#include <linux/workqueue.h> +#include <linux/battery.h> + +#include <asm/apm.h> +#include <asm/delay.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <asm/arch/hardware.h> +#include <asm/arch/pxa-regs.h> +#include <asm/arch/irqs.h> + +#include <sound/driver.h> +#include <sound/core.h> +#include <sound/pcm.h> +#include <sound/initval.h> +#include <linux/wm97xx.h> +#include <asm/arch/palmld-gpio.h> +#include <asm/arch/palmld-init.h> + + +struct palmld_battery_dev +{ + struct wm97xx * wm; + int battery_registered; + int current_voltage; + int previous_voltage; + u32 last_battery_update; +}; + +struct palmld_battery_dev bat; + +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) +/* original APM hook */ +static void (*apm_get_power_status_orig)(struct apm_power_info *info); +#endif + +int palmld_battery_min_voltage(struct battery *b) +{ + return PALMLD_BAT_MIN_VOLTAGE; +} + + +int palmld_battery_max_voltage(struct battery *b) +{ + return PALMLD_BAT_MAX_VOLTAGE; /* mV */ +} + +/* + This formula is based on battery life of my battery 1100mAh. Original battery in Zire72 is Li-On 920mAh + V_batt = ADCSEL_BMON * 1,889 + 767,8 [mV] +*/ + +int palmld_battery_get_voltage(struct battery *b) +{ + if (bat.battery_registered){ + bat.previous_voltage = bat.current_voltage; + bat.current_voltage = wm97xx_read_aux_adc(bat.wm, WM97XX_AUX_ID3); + bat.last_battery_update = jiffies; + return bat.current_voltage * 1889/1000 + 7678/10; + } + else{ + printk("palmld_battery: cannot get voltage -> battery driver unregistered\n"); + return 0; + } +} + + +int palmld_battery_get_status(struct battery *b) +{ + int ac_connected = GET_PALMLD_GPIO(POWER_DETECT); + int usb_connected = !GET_PALMLD_GPIO(USB_DETECT); + + if (bat.current_voltage <= 0) + return BATTERY_STATUS_UNKNOWN; + + if (ac_connected || usb_connected){ + if ( ( bat.current_voltage > bat.previous_voltage ) || (bat.current_voltage <= PALMLD_BAT_MAX_VOLTAGE) ) + return BATTERY_STATUS_CHARGING; + return BATTERY_STATUS_NOT_CHARGING; + } + else + return BATTERY_STATUS_DISCHARGING; +} + +struct battery palmld_battery = { + .name = "palmld_battery", + .id = "battery0", + .get_min_voltage = palmld_battery_min_voltage, + .get_max_voltage = palmld_battery_max_voltage, + .get_voltage = palmld_battery_get_voltage, + .get_status = palmld_battery_get_status, +}; + +static int palmld_wm97xx_probe(struct device *dev) +{ + struct wm97xx *wm = dev->driver_data; + bat.wm = wm; + return 0; +} + +static int palmld_wm97xx_remove(struct device *dev) +{ + return 0; +} + +static void +palmld_wm97xx_shutdown(struct device *dev) +{ +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) + apm_get_power_status = apm_get_power_status_orig; +#endif +} + +static int +palmld_wm97xx_suspend(struct device *dev, pm_message_t state) +{ + return 0; +} + +static int +palmld_wm97xx_resume(struct device *dev) +{ + return 0; +} + + +static struct device_driver palmld_wm97xx_driver = { + .name = "wm97xx-touchscreen", + .bus = &wm97xx_bus_type, + .owner = THIS_MODULE, + .probe = palmld_wm97xx_probe, + .remove = palmld_wm97xx_remove, + .suspend = palmld_wm97xx_suspend, + .resume = palmld_wm97xx_resume, + .shutdown = palmld_wm97xx_shutdown +}; + +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) + +/* APM status query callback implementation */ +static void palmld_apm_get_power_status(struct apm_power_info *info) +{ + int min, max, curr, percent; + + curr = palmld_battery_get_voltage(&palmld_battery); + min = palmld_battery_min_voltage(&palmld_battery); + max = palmld_battery_max_voltage(&palmld_battery); + + curr = curr - min; + if (curr < 0) curr = 0; + max = max - min; + + percent = curr*100/max; + + info->battery_life = percent; + + info->ac_line_status = (GET_PALMLD_GPIO(POWER_DETECT) + ? APM_AC_ONLINE : APM_AC_OFFLINE); + + if (info->ac_line_status) { + info->battery_status = APM_BATTERY_STATUS_CHARGING; + } else { + if (percent > 50) + info->battery_status = APM_BATTERY_STATUS_HIGH; + else if (percent < 5) + info->battery_status = APM_BATTERY_STATUS_CRITICAL; + else + info->battery_status = APM_BATTERY_STATUS_LOW; + } + + info->time = percent * PALMLD_MAX_LIFE_MINS/100; + info->units = APM_UNITS_MINS; +} +#endif +static int __init palmld_wm97xx_init(void) +{ +#ifndef MODULE + int ret; +#endif + + /* register battery to APM layer */ + bat.battery_registered = 0; + + if(battery_class_register(&palmld_battery)) { + printk(KERN_ERR "palmld_ac97_probe: could not register battery class\n"); + } + else { + bat.battery_registered = 1; + printk("Battery registered\n"); + } +#if defined(CONFIG_APM) || defined(CONFIG_APM_MODULE) + apm_get_power_status_orig = apm_get_power_status; + apm_get_power_status = palmld_apm_get_power_status; +#endif +#ifndef MODULE + /* If we're in kernel, we could accidentally be run before wm97xx + and thus have panic */ + if((ret = bus_register(&wm97xx_bus_type)) < 0) + return ret; +#endif + return driver_register(&palmld_wm97xx_driver); +} + +static void __exit palmld_wm97xx_exit(void) +{ +/* TODO - recover APM callback to original state */ + battery_class_unregister(&palmld_battery); + driver_unregister(&palmld_wm97xx_driver); +} + +module_init(palmld_wm97xx_init); +module_exit(palmld_wm97xx_exit); + +/* Module information */ +MODULE_AUTHOR("Sergey Lapin <sl...@ha...> Jan Herman <2h...@se...>"); +MODULE_DESCRIPTION("wm97xx battery driver"); +MODULE_LICENSE("GPL"); Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_ide.c 2007-03-19 20:19:05 UTC (rev 924) @@ -67,6 +67,8 @@ .bus = &platform_bus_type, .probe = palmld_ide_probe, .remove = palmld_ide_remove, + .suspend= NULL, + .resume = NULL, }; static int __init palmld_ide_init(void) Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmld/palmld_pm.c 2007-03-19 20:19:05 UTC (rev 924) @@ -1,87 +1,185 @@ +/************************************************************************ + * PalmOne LifeDrive suspend/resume support * + * * + * Author: Jan Herman <2h...@se...> * + * Sergey Lapin <sla...@gm...> * + * Modification for Palm LifeDrive: Marek Vasut <mar...@gm...> * + * * + * * + * 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/device.h> #include <linux/pm.h> +#include <linux/fb.h> +#include <linux/platform_device.h> +#include <asm/mach-types.h> +#include <asm/hardware.h> +#include <asm/arch/pm.h> #include <asm/arch/pxa-pm_ll.h> #include <asm/arch/hardware.h> #include <asm/arch/pxa-regs.h> -static u32 *addr_a0200000; -static u32 *addr_a0200004; -static u32 *addr_a0200008; -static u32 save_a0200000; -static u32 save_a0200004; -static u32 save_a0200008; +#include <asm/arch/palmld-gpio.h> +#include <asm/arch/pxa27x_keyboard.h> -static void palmld_pxa_ll_pm_suspend(unsigned long resume_addr) +#define KPASMKP(col) (col/2==0 ? KPASMKP0 : col/2==1 ? KPASMKP1 : col/2==2 ? KPASMKP2 : KPASMKP3) +#define KPASMKPx_MKC(row, col) (1 << (row + 16*(col%2))) + +struct pm_save_data { + int brightness; + u32 rcnr; +}; - /* wake up on */ - PWER |= PWER_GPIO12; - //PFER |= PWER_RTC; - PRER |= PWER_GPIO12; - - /* USB, in theory this can even wake us from deep sleep */ - PWER |= PWER_GPIO3; - PFER |= PWER_GPIO3; - PRER |= PWER_GPIO3; - - /* disable GPIO reset, palm bootloader will hang us */ - //PCFR |= PCFR_GPR_EN | PCFR_OPDE; - PCFR &= PCFR_GPR_EN; - - /* as set by POS */ - /*PGSR0 = 0x00020000; - PGSR1 = 0x00000000; - PGSR2 = 0x01004000; - PGSR3 = 0x00421380; - - PGSR2 |= (1<<30); - PGSR3 |= (1<<7) | (1<<8) | (1<<9); +static struct pm_save_data pm_save_data; - PSLR = 0xff400000; - */ - //PKWR |= GPIO_bit(0) | GPIO_bit(12) | GPIO_bit(3) | (1<<17); - //PKSR = 0xffffffff; // clear +#ifdef CONFIG_PM +static int palmld_suspend(struct device *dev, pm_message_t state) +{ + /* Wake-Up on RTC event, etc. */ + PWER |= PWER_RTC | PWER_WEP1; + /* Wake-Up on powerbutton */ + PWER |= PWER_GPIO12; + PRER |= PWER_GPIO12; - /* - addr_a0200000 = phys_to_virt(0xa0200000); - addr_a0200004 = phys_to_virt(0xa0200004); - addr_a0200008 = phys_to_virt(0xa0200008); + /* USB, in theory this can even wake us from deep sleep */ +// PWER |= PWER_GPIO3; +// PFER |= PWER_GPIO3; +// PRER |= PWER_GPIO3; - save_a0200000 = *addr_a0200000; - save_a0200004 = *addr_a0200004; - save_a0200008 = *addr_a0200008; - */ - /* - c: e3a00121 mov r0, #1073741832 ; 0x40000008 - 10: e280060f add r0, r0, #15728640 ; 0xf00000 - 14: e590f000 ldr pc, [r0] - */ - - /* - *addr_a0200000 = 0xe3a00121; // mov r0, #0x40000008 - *addr_a0200004 = 0xe280060f; // add r0, r0, #0xf00000 - *addr_a0200008 = 0xe590f000; // ldr pc, [r0] - */ + /* Wakeup by keyboard :) */ +// PKWR = 0xe0001; - PSPR = 0; /* should cause Palm bootloader to allow us to reboot */ + /* Enabled Deep-Sleep mode */ + PCFR |= PCFR_DS; + + /* Low power mode */ + PCFR |= PCFR_OPDE; + + + /* 3.6.8.1 */ + while(!(OSCC & OSCC_OOK)) + {} + + /* disable GPIO reset, palm bootloader will hang us */ + //PCFR |= PCFR_GPR_EN | PCFR_OPDE; + PCFR &= PCFR_GPR_EN; + + return 0; +} + +static int palmld_resume(struct device *dev) +{ + /* Disabled Deep-Sleep mode ?? */ + PCFR &= PCFR_DS; + + /* Re-enable GPIO reset */ + PCFR |= PCFR_GPR_EN; /* !! DO NOT REMOVE !! THIS IS NECCESARY FOR ENABLE PALM RESET !! */ + + + /* Here are all of special to resume PalmOne LifeDrive */ + + /* Turn on LCD power */ +// SET_PALMZ72_GPIO(LCD_POWER,1); + /* Turn on USB power */ +// SET_PALMZ72_GPIO(USB_POWER,1); + + return 0; +} +#else +#define palmld_suspend NULL +#define palmld_resume NULL +#endif + +static void palmld_pxa_ll_pm_suspend(unsigned long resume_addr) +{ + /* For future */ return; } static void palmld_pxa_ll_pm_resume(void) { - /* - *addr_a0200000 = save_a0200000; - *addr_a0200004 = save_a0200004; - *addr_a0200008 = save_a0200008; - */ - - /* re-enable GPIO reset */ - PCFR |= PCFR_GPR_EN; + /* For future */ } struct pxa_ll_pm_ops palmld_ll_pm_ops = { - .suspend = palmld_pxa_ll_pm_suspend, - .resume = palmld_pxa_ll_pm_resume, + .suspend = palmld_pxa_ll_pm_suspend, + .resume = palmld_pxa_ll_pm_resume, }; + +static int (*pxa_pm_enter_orig)(suspend_state_t state); + +static int lifedrive_enter_suspend(suspend_state_t state) +{ + /* Here we should implement wakeup conditions + If we have none, just return 1 to continue + sleeping */ + int data = 0; + + /* Do not suspend on active keypress */ + pxa_pm_enter_orig(state); + + printk(KERN_NOTICE "Returning from sleep due to GPIOs 100-102 or 13\n"); + printk(KERN_NOTICE "RCNR = %u pm_save_data.rcnr = %u\n", RCNR, pm_save_data.rcnr); + printk(KERN_NOTICE "Keys pressed: %d\n", data); + pm_save_data.rcnr = 0; + return 0; +} +static int lifedrive_pxa_pm_enter(suspend_state_t state) +{ + pm_save_data.rcnr = 0; + pxa_pm_enter_orig(state); + while (lifedrive_enter_suspend(state)) + {} + return 0; +} + + +static struct pm_ops lifedrive_pm_ops = { + .pm_disk_mode = PM_DISK_FIRMWARE, + .prepare = pxa_pm_prepare, + .enter = lifedrive_pxa_pm_enter, + .finish = pxa_pm_finish, +}; + +extern struct pm_ops pxa_pm_ops; + +static int palmld_pm_probe(struct device *dev) +{ + printk(KERN_NOTICE "PalmOne LifeDrive power management driver registered\n"); + return 0; +} + +struct device_driver palmld_pm_driver = { + .name = "palmld-pm", + .bus = &platform_bus_type, + .probe = palmld_pm_probe, + .suspend = palmld_suspend, + .resume = palmld_resume, +}; + +static int __init palmld_pm_init(void) +{ +pxa_pm_enter_orig=pxa_pm_ops.enter; + pxa_pm_ops.enter = pxa_pm_enter_orig; + return driver_register(&palmld_pm_driver); +} + +static void __exit palmld_pm_exit(void) +{ + pxa_pm_ops.enter = pxa_pm_enter_orig; + driver_unregister(&palmld_pm_driver); +} + +module_init(palmld_pm_init); +module_exit(palmld_pm_exit); + +MODULE_AUTHOR("Jan Herman <2h...@se...>, Sergey Lapin <sla...@gm...>"); +MODULE_DESCRIPTION("PalmOne LifeDrive power management driver"); +MODULE_LICENSE("GPL"); Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-03-18 19:56:23 UTC (rev 923) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-gpio.h 2007-03-19 20:19:05 UTC (rev 924) @@ -41,6 +41,8 @@ #define GPIO_NR_PALMLD_ORANGE_LED 94 #define GPIO_NR_PALMLD_IDE_IRQ 95 +#define GPIO_NR_PALMLD_LCD_POWER 96 + #define GPIO_NR_PALMLD_KP_MKIN3 97 /* rotate-display, center, left */ #define GPIO_NR_PALMLD_IDE_RESET 98 Added: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-init.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-init.h (rev 0) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmld-init.h 2007-03-19 20:19:05 UTC (rev 924) @@ -0,0 +1,34 @@ +/* + * palmld-init.h + * + * Init values for PalmOne LifeDrive Handheld Computer + * + * Author: Marek Vasut <mar...@gm...> + * + * + * 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. + * + * + * + */ + +#ifndef _INCLUDE_PALMLD_INIT_H_ + +#define _INCLUDE_PALMLD_INIT_H_ + + +// BATTERY + +#define PALMLD_BAT_MAX_VOLTAGE 4000 // 4.00V current voltage at max charge as from PalmOS +#define PALMLD_BAT_MIN_VOLTAGE 3600 // 3.60V critical voltage as from Zlauncher +#define PALMLD_BAT_MAX_CURRENT 0 // unknokn +#define PALMLD_BAT_MIN_CURRENT 0 // unknown +#define PALMLD_BAT_MAX_CHARGE 1 // unknown +#define PALMLD_BAT_MIN_CHARGE 1 // unknown +#define PALMLD_BAT_MEASURE_DELAY (HZ * 1) +#define PALMLD_MAX_LIFE_MINS 240 // my LifeDrive on-life in minutes + + +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-19 00:35:46
|
Revision: 923 http://svn.sourceforge.net/hackndev/?rev=923&view=rev Author: z72ka Date: 2007-03-18 12:56:23 -0700 (Sun, 18 Mar 2007) Log Message: ----------- palmz72: Clearing unused header Removed Paths: ------------- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-ac97.h Deleted: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-ac97.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-ac97.h 2007-03-18 19:54:45 UTC (rev 922) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-ac97.h 2007-03-18 19:56:23 UTC (rev 923) @@ -1,108 +0,0 @@ -/* - * Definitions for the Zire 72 WM9712 AC97 codec - * Based upon wm97xx.h by Liam Girdwood, Wolfson Microelectronics - */ - -#ifndef _PALMZ72_AC97_H_ -#define _PALMZ72_AC97_H_ - - -#define AC97_ADD_FUNC 0x58 /* Additional functions */ - -/* - * WM97xx AC97 Touchscreen registers - */ -#define AC97_WM97XX_DIGITISER1 0x76 -#define AC97_WM97XX_DIGITISER2 0x78 -#define AC97_WM97XX_DIGITISER_RD 0x7a -#define AC97_WM9713_DIG1 0x74 -#define AC97_WM9713_DIG2 AC97_WM97XX_DIGITISER1 -#define AC97_WM9713_DIG3 AC97_WM97XX_DIGITISER2 - -/* - * WM97xx GPGIO states - */ -#define WM97XX_GPIO_OUT 0 -#define WM97XX_GPIO_IN 1 -#define WM97XX_GPIO_POL_HIGH 1 -#define WM97XX_GPIO_POL_LOW 0 -#define WM97XX_GPIO_STICKY 1 -#define WM97XX_GPIO_NOTSTICKY 0 -#define WM97XX_GPIO_WAKE 1 -#define WM97XX_GPIO_NOWAKE 0 - -/* - * WM97xx register bits - */ -#define WM97XX_POLL 0x8000 /* initiate a polling measurement */ -#define WM97XX_ADCSEL_X 0x1000 /* x coord measurement */ -#define WM97XX_ADCSEL_Y 0x2000 /* y coord measurement */ -#define WM97XX_ADCSEL_PRES 0x3000 /* pressure measurement */ -#define WM97XX_ADCSEL_COMP1 0x4000 /* aux1 measurement */ -#define WM97XX_ADCSEL_COMP2 0x5000 /* aux2 measurement */ -#define WM97XX_ADCSEL_BMON 0x6000 /* aux3 measurement */ -#define WM97XX_ADCSEL_WIPER 0x7000 /* aux4 measurement */ -#define WM97XX_ADCSEL_MASK 0x7000 -#define WM97XX_COO 0x0800 /* enable coordinate mode */ -#define WM97XX_CTC 0x0400 /* enable continuous mode */ -#define WM97XX_CM_RATE_93 0x0000 /* 93.75Hz continuous rate */ -#define WM97XX_CM_RATE_187 0x0100 /* 187.5Hz continuous rate */ -#define WM97XX_CM_RATE_375 0x0200 /* 375Hz continuous rate */ -#define WM97XX_CM_RATE_750 0x0300 /* 750Hz continuous rate */ -#define WM97XX_CM_RATE_8K 0x00f0 /* 8kHz continuous rate */ -#define WM97XX_CM_RATE_12K 0x01f0 /* 12kHz continuous rate */ -#define WM97XX_CM_RATE_24K 0x02f0 /* 24kHz continuous rate */ -#define WM97XX_CM_RATE_48K 0x03f0 /* 48kHz continuous rate */ -#define WM97XX_CM_RATE_MASK 0x03f0 -#define WM97XX_RATE(i) (((i & 3) << 8) | ((i & 4) ? 0xf0 : 0)) -#define WM97XX_DELAY(i) ((i << 4) & 0x00f0) /* sample delay times */ -#define WM97XX_DELAY_MASK 0x00f0 -#define WM97XX_SLEN 0x0008 /* slot read back enable */ -#define WM97XX_SLT(i) ((i - 5) & 0x7) /* touchpanel slot selection (5-11) */ -#define WM97XX_SLT_MASK 0x0007 -#define WM97XX_PRP_DETW 0x4000 /* pen detect on, digitiser off, wake up */ -#define WM97XX_PRP_DET 0x8000 /* pen detect on, digitiser off, no wake up */ -#define WM97XX_PRP_DET_DIG 0xc000 /* pen detect on, digitiser on */ -#define WM97XX_RPR 0x2000 /* wake up on pen down */ -#define WM97XX_PEN_DOWN 0x8000 /* pen is down */ -#define WM97XX_ADCSRC_MASK 0x7000 /* ADC source mask */ - -#define WM97XX_AUX_ID1 0x8001 -#define WM97XX_AUX_ID2 0x8002 -#define WM97XX_AUX_ID3 0x8003 -#define WM97XX_AUX_ID4 0x8004 - -/* Codec GPIO's */ -#define WM97XX_MAX_GPIO 16 -#define WM97XX_GPIO_1 (1 << 1) -#define WM97XX_GPIO_2 (1 << 2) -#define WM97XX_GPIO_3 (1 << 3) -#define WM97XX_GPIO_4 (1 << 4) -#define WM97XX_GPIO_5 (1 << 5) -#define WM97XX_GPIO_6 (1 << 6) -#define WM97XX_GPIO_7 (1 << 7) -#define WM97XX_GPIO_8 (1 << 8) -#define WM97XX_GPIO_9 (1 << 9) -#define WM97XX_GPIO_10 (1 << 10) -#define WM97XX_GPIO_11 (1 << 11) -#define WM97XX_GPIO_12 (1 << 12) -#define WM97XX_GPIO_13 (1 << 13) -#define WM97XX_GPIO_14 (1 << 14) -#define WM97XX_GPIO_15 (1 << 15) - -/* WM9712 Bits */ -#define WM9712_45W 0x1000 /* set for 5-wire touchscreen */ -#define WM9712_PDEN 0x0800 /* measure only when pen down */ -#define WM9712_WAIT 0x0200 /* wait until adc is read before next sample */ -#define WM9712_PIL 0x0100 /* current used for pressure measurement. set 400uA else 200uA */ -#define WM9712_MASK_HI 0x0040 /* hi on mask pin (47) stops conversions */ -#define WM9712_MASK_EDGE 0x0080 /* rising/falling edge on pin delays sample */ -#define WM9712_MASK_SYNC 0x00c0 /* rising/falling edge on mask initiates sample */ -#define WM9712_RPU(i) (i&0x3f) /* internal pull up on pen detect (64k / rpu) */ -#define WM9712_PD(i) (0x1 << i) /* power management */ -#define WM9712_ADCSEL_COMP1 0x4000 /* COMP1/AUX1 measurement (pin29) */ -#define WM9712_ADCSEL_COMP2 0x5000 /* COMP2/AUX2 measurement (pin30) */ -#define WM9712_ADCSEL_BMON 0x6000 /* BMON/AUX3 measurement (pin31) */ -#define WM9712_ADCSEL_WIPER 0x7000 /* WIPER/AUX4 measurement (pin12) */ - -#endif /* _PALMZ72_AC97_H_ */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-19 00:35:46
|
Revision: 920 http://svn.sourceforge.net/hackndev/?rev=920&view=rev Author: z72ka Date: 2007-03-18 12:35:13 -0700 (Sun, 18 Mar 2007) Log Message: ----------- palmz72: Make irda to work - found IR SD GPIO and rewritten IRDA init to pxafcpi - power management, found GPIO for blank screen, blank screen is used for better and nice resume LCD Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-03-18 19:18:56 UTC (rev 919) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-03-18 19:35:13 UTC (rev 920) @@ -1,5 +1,5 @@ GPIO pin Level Dir Function -GPIO_0 0 I 00 POWER detect +GPIO_0 0 I 00 Low POWER detect? GPIO_1 1 I 00 GPIO_2 1 O 00 SYS_EN GPIO_3 1 O 00 @@ -13,12 +13,12 @@ GPIO_11 0 I 00 GPIO_12 1 I 00 USB_PULLUP GPIO_13 0 I 02 KP_DKIN7 // Voice Memo button -GPIO_14 0 I 00 +GPIO_14 0 I 00 SD card inserted GPIO_15 0 I 00 USB_DETECT GPIO_16 1 O 02 PWM_OUT0 GPIO_17 1 O 00 Bluetooth: 1 when enabled in POS GPIO_18 0 O 00 -GPIO_19 1 O 00 +GPIO_19 1 O 00 Screen goes white when 0 GPIO_20 1 O 00 GPIO_21 0 O 00 GPIO_22 0 O 00 @@ -48,7 +48,7 @@ GPIO_46 1 I 02 STD_RXD GPIO_47 0 O 01 STD_TXD GPIO_48 1 I 01 CIF_DD5 -GPIO_49 0 O 00 +GPIO_49 0 O 00 IR_SD GPIO_50 1 I 01 CIF_DD3 GPIO_51 1 I 01 CIF_DD2 GPIO_52 1 I 01 CIF_DD4 Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-03-18 19:18:56 UTC (rev 919) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-03-18 19:35:13 UTC (rev 920) @@ -21,6 +21,7 @@ #include <linux/platform_device.h> #include <linux/fb.h> #include <linux/irq.h> +#include <linux/delay.h> #include <asm/arch/audio.h> #include <asm/arch/hardware.h> @@ -30,7 +31,6 @@ #include <asm/arch/pxa27x_keyboard.h> #include <asm/arch/pxa-pm_ll.h> #include <asm/arch/pxapwm-bl.h> -#include <asm/arch/irda.h> #include <asm/arch/serial.h> #include <linux/gpio_keys.h> @@ -208,64 +208,40 @@ /******** * IRDA * ********/ -/* -static void -palmz72_irda_configure (struct uart_pxa_port *up, int enable) -{ - // Switch STUART RX/TX pins to SIR - pxa_gpio_mode( GPIO_NR_PALMZ72_STD_RXD_MD ); - pxa_gpio_mode( GPIO_NR_PALMZ72_STD_TXD_MD ); - // make sure FIR ICP is off - ICCR0 = 0; - if (enable) { - // configure STUART to for SIR - STISR = STISR_XMODE | STISR_RCVEIR | STISR_RXPL; - GPSR(91) = GPIO_bit(91); - } else { - STISR = 0; - } -} - -static void -palmz72_irda_set_txrx (struct uart_pxa_port *up, int txrx) +static void palmz72_irda_transceiver_mode(struct device *dev, int mode) { - unsigned old_stisr = STISR; - unsigned new_stisr = old_stisr; + unsigned long flags; + + local_irq_save(flags); - if (txrx & PXA_SERIAL_TX) { - // Ignore RX if TX is set - txrx &= PXA_SERIAL_TX; - new_stisr |= STISR_XMITIR; - } else - new_stisr &= ~STISR_XMITIR; + if (mode & IR_SIRMODE){ + printk (KERN_INFO "IRDA: setting mode to SIR\n"); + } + else if (mode & IR_FIRMODE){ + printk (KERN_INFO "IRDA: setting mode to FIR\n"); + } + if (mode & IR_OFF){ + printk (KERN_INFO "IRDA: turning OFF\n"); + SET_PALMZ72_GPIO(IR_SD, 1); + } + else { + printk (KERN_INFO "IRDA: turning ON\n"); + SET_PALMZ72_GPIO(IR_SD, 0); + SET_PALMZ72_GPIO(ICP_TXD_MD, 1); + mdelay(30); + SET_PALMZ72_GPIO(ICP_TXD_MD, 0); + } - if (txrx & PXA_SERIAL_RX) - new_stisr |= STISR_RCVEIR; - else - new_stisr &= ~STISR_RCVEIR; - - if (new_stisr != old_stisr) { - while (!(STLSR & LSR_TEMT)) - ; - STISR = new_stisr; - } + local_irq_restore(flags); } -static int -palmz72_irda_get_txrx (struct uart_pxa_port *up) -{ - return ((STISR & STISR_XMITIR) ? PXA_SERIAL_TX : 0) | - ((STISR & STISR_RCVEIR) ? PXA_SERIAL_RX : 0); -} - -static struct platform_pxa_serial_funcs palmz72_pxa_irda_funcs = { - .configure = palmz72_irda_configure, - .set_txrx = palmz72_irda_set_txrx, - .get_txrx = palmz72_irda_get_txrx, +static struct pxaficp_platform_data palmz72_ficp_platform_data = { + .transceiver_cap = IR_SIRMODE | IR_FIRMODE | IR_OFF, + .transceiver_mode = palmz72_irda_transceiver_mode, }; -*/ + /************************* * AC97 audio controller * *************************/ @@ -373,7 +349,6 @@ &palmz72_pm, &palmz72_backlight, &palmz72_keypad, - //&palmz72_pxa_irda_funcs #ifdef CONFIG_GPIO_KEYS &palmz72_pxa_keys, #endif @@ -408,8 +383,8 @@ set_pxa_fb_info( &palmz72_lcd_screen ); pxa_set_mci_info( &palmz72_mci_platform_data ); - pxa_set_udc_info(&palmz72_udc_mach_info ); - //stuart_device.dev.platform_data = &palmz72_pxa_irda_funcs; + pxa_set_udc_info( &palmz72_udc_mach_info ); + pxa_set_ficp_info( &palmz72_ficp_platform_data ); platform_add_devices( devices, ARRAY_SIZE(devices) ); } Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-03-18 19:18:56 UTC (rev 919) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-03-18 19:35:13 UTC (rev 920) @@ -46,7 +46,7 @@ /* Wakeup by keyboard :) */ PKWR = 0xe0001; - /* Enabled Deep-Sleep mode ?? */ + /* Enabled Deep-Sleep mode */ PCFR |= PCFR_DS; /* Low power mode */ @@ -61,6 +61,8 @@ /* Turn off LCD power */ SET_PALMZ72_GPIO(LCD_POWER,0); + /* Turn screen off */ + SET_PALMZ72_GPIO(SCREEN,0); /* Turn off USB power */ SET_PALMZ72_GPIO(USB_POWER,0); @@ -85,6 +87,8 @@ /* Turn on LCD power */ SET_PALMZ72_GPIO(LCD_POWER,1); + /* Turn screen on */ + SET_PALMZ72_GPIO(SCREEN,1); /* Turn on USB power */ SET_PALMZ72_GPIO(USB_POWER,1); Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h 2007-03-18 19:18:56 UTC (rev 919) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/palmz72-gpio.h 2007-03-18 19:35:13 UTC (rev 920) @@ -40,14 +40,16 @@ #define GPIO_NR_PALMZ72_LED_MD (GPIO_NR_PALMZ72_LED | GPIO_ALT_FN_1_OUT) -/* Serial */ +/* IRDA */ -#define GPIO_NR_PALMZ72_STD_RXD 46 -#define GPIO_NR_PALMZ72_STD_TXD 47 -#define GPIO_NR_PALMZ72_STD_RXD_MD (GPIO_NR_PALMZ72_STD_RXD | GPIO_ALT_FN_2_IN) -#define GPIO_NR_PALMZ72_STD_TXD_MD (GPIO_NR_PALMZ72_STD_TXD | GPIO_ALT_FN_1_OUT) +#define GPIO_NR_PALMZ72_IR_SD 49 +#define GPIO_NR_PALMZ72_ICP_RXD 46 +#define GPIO_NR_PALMZ72_ICP_TXD 47 +#define GPIO_NR_PALMZ72_ICP_RXD_MD (GPIO_NR_PALMZ72_ICP_RXD | GPIO_ALT_FN_1_IN) +#define GPIO_NR_PALMZ72_ICP_TXD_MD (GPIO_NR_PALMZ72_ICP_TXD | GPIO_ALT_FN_2_OUT) + /* Wolfson WM9712 */ #define GPIO_NR_PALMZ72_WM9712_IRQ 27 @@ -75,6 +77,7 @@ #define GPIO_NR_PALMZ72_GPIO_RESET 1 #define IRQ_GPIO_PALMZ72_GPIO_RESET IRQ_GPIO(GPIO_NR_PALMZ72_GPIO_RESET) +#define GPIO_NR_PALMZ72_SCREEN 19 //screen on when this GPIO is 1 /* Utility macros */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-19 00:02:04
|
Revision: 921 http://svn.sourceforge.net/hackndev/?rev=921&view=rev Author: z72ka Date: 2007-03-18 12:46:37 -0700 (Sun, 18 Mar 2007) Log Message: ----------- palmz72: Modified for IRDA work Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig Modified: linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-03-18 19:35:13 UTC (rev 920) +++ linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-03-18 19:46:37 UTC (rev 921) @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.20-hnd0 -# Fri Mar 16 15:25:02 2007 +# Sun Mar 18 20:44:25 2007 # CONFIG_ARM=y # CONFIG_GENERIC_TIME is not set @@ -368,14 +368,14 @@ # # CONFIG_NET_PKTGEN is not set # CONFIG_HAMRADIO is not set -CONFIG_IRDA=m +CONFIG_IRDA=y # # IrDA protocols # # CONFIG_IRLAN is not set # CONFIG_IRNET is not set -# CONFIG_IRCOMM is not set +CONFIG_IRCOMM=m # CONFIG_IRDA_ULTRA is not set # @@ -392,12 +392,11 @@ # # SIR device drivers # -CONFIG_IRTTY_SIR=m +# CONFIG_IRTTY_SIR is not set # # Dongle support # -# CONFIG_DONGLE is not set # # Old SIR device drivers @@ -411,7 +410,7 @@ # # FIR device drivers # -CONFIG_PXA_FICP=m +CONFIG_PXA_FICP=y CONFIG_BT=m # CONFIG_BT_L2CAP is not set # CONFIG_BT_SCO is not set @@ -606,8 +605,6 @@ # CONFIG_KEYBOARD_STOWAWAY is not set # CONFIG_GPIO_KEYS is not set CONFIG_KEYBOARD_PXA27x=y -# CONFIG_KEYBOARD_PALMIR is not set -CONFIG_KEYBOARD_PALMWK=m # CONFIG_INPUT_MOUSE is not set # CONFIG_INPUT_JOYSTICK is not set CONFIG_INPUT_TOUCHSCREEN=y @@ -1057,6 +1054,7 @@ CONFIG_SQUASHFS_EMBEDDED=y CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3 # CONFIG_SQUASHFS_VMALLOC is not set +# CONFIG_SQUASHFS_LZMA is not set # CONFIG_VXFS_FS is not set # CONFIG_HPFS_FS is not set # CONFIG_QNX4FS_FS is not set This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-18 23:34:39
|
Revision: 922 http://svn.sourceforge.net/hackndev/?rev=922&view=rev Author: z72ka Date: 2007-03-18 12:54:45 -0700 (Sun, 18 Mar 2007) Log Message: ----------- palmz72: Clearing unused files Removed Paths: ------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c 2007-03-18 19:46:37 UTC (rev 921) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c 2007-03-18 19:54:45 UTC (rev 922) @@ -1,175 +0,0 @@ -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/proc_fs.h> - -#include <linux/interrupt.h> -#include <asm/irq.h> -#include <asm/mach/arch.h> -#include <asm/mach/map.h> -#include <asm/mach-types.h> -#include <asm/hardware.h> -#include <linux/sched.h> -#include <linux/workqueue.h> -#include <asm/arch/pxa-regs.h> -#include <asm/arch/irqs.h> -#include <asm/uaccess.h> - -#include <linux/debugfs.h> -#include <linux/seq_file.h> - -#define PROCFS_NAME "gpio" -#define DEBUGFS_NAME "gpio" - -static struct proc_dir_entry *proc_intf; -static struct dentry *debugfs_intf; - -#define PROCFS_MAX_SIZE 20 - -static char procfs_buffer[PROCFS_MAX_SIZE]; -static unsigned long procfs_buffer_size = 0; - -#define GPIO_TEST(reg, gp) (reg(gp) & GPIO_bit(gp)) -static int dfs_show(struct seq_file *s, void *_) -{ - int i,afn; - seq_printf(s, "GPIO lines status:\n"); - - for(i=0;i<121;i++) { - afn = (GAFR(i) & (0x3 << (((i) & 0xf)*2))) >> (((i) & 0xf)*2); - seq_printf(s, "%s%d: %s %s %s %s %lx\n", - i<10?"0":"", - i, - GPIO_TEST(GPLR, i)?"*":" ", - GPIO_TEST(GPDR, i)?"->":"<-", - GPIO_TEST(GRER, i)?"_/":" ", - GPIO_TEST(GFER, i)?"\\_":" ", - afn); - - } - - return 0; -} - -static int dfs_open(struct inode *inode, struct file *file) -{ - return single_open(file, dfs_show, inode->u.generic_ip); -} - -static struct file_operations debug_fops = { - .open = dfs_open, - .read = seq_read, - .llseek = seq_lseek, - .release = single_release, -}; - -static void gpio_set(int id, int on) -{ - do { - if (on) - GPSR(id) = GPIO_bit(id); - else - GPCR(id) = GPIO_bit(id); - } while (0); -} - -void set_afn(int gpio, int fn) -{ - int gafr; - gafr = GAFR(gpio) & ~(0x3 << (((gpio) & 0xf)*2)); - GAFR(gpio) = gafr | (fn << (((gpio) & 0xf)*2)); -} - -void handle_request() -{ - char *p = NULL; - unsigned long id = simple_strtoul(procfs_buffer+2, &p, 10); - switch(procfs_buffer[0]) { - case 'L': - gpio_set(id, 1); - printk(KERN_ERR "GPIOed: GPIO %lu set high\n", id); - break; - case 'l': - gpio_set(id, 0); - printk(KERN_ERR "GPIOed: GPIO %lu set low\n", id); - break; - case 'd': - GPDR(id) &= ~(GPIO_bit(id)); - break; - case 'D': - GPDR(id) |= GPIO_bit(id); - break; - case '0': - set_afn(id, 0); - break; - case '1': - set_afn(id, 1); - break; - case '2': - set_afn(id, 2); - break; - default: - printk(KERN_ERR "GPIOed: Unknown request\n"); - break; - } -} - - -int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data) -{ - procfs_buffer_size = count; - if (procfs_buffer_size > PROCFS_MAX_SIZE ) { - procfs_buffer_size = PROCFS_MAX_SIZE; - } - - /* write data to the buffer */ - if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) { - return -EFAULT; - } - - handle_request(); - - return procfs_buffer_size; -} - - -static int __init gpioed_init(void) -{ - proc_intf = create_proc_entry(PROCFS_NAME, 0644, NULL); - if (proc_intf == NULL) { - remove_proc_entry(PROCFS_NAME, &proc_root); - printk(KERN_ALERT "Error: Could not initialize /proc/%s\n", PROCFS_NAME); - return -ENOMEM; - } - - /*proc_intf->read_proc = procfile_read;*/ - proc_intf->write_proc = procfile_write; - proc_intf->owner = THIS_MODULE; - proc_intf->mode = S_IFREG | S_IRUGO; - proc_intf->uid = 0; - proc_intf->gid = 0; - proc_intf->size = 37; - - debugfs_intf = debugfs_create_file(DEBUGFS_NAME, S_IRUGO, NULL, NULL, &debug_fops); - - printk(KERN_INFO "/proc/%s created\n", PROCFS_NAME); - - return 0; -} - -static void __exit gpioed_exit(void) -{ - debugfs_remove(debugfs_intf); - remove_proc_entry(PROCFS_NAME, &proc_root); - printk(KERN_INFO "/proc/%s removed\n", PROCFS_NAME); -} - - -/*** Some more stuff ***/ -module_init(gpioed_init); -module_exit(gpioed_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Vladimir \"Farcaller\" Pouzanov <far...@gm...>"); -MODULE_DESCRIPTION("GPIO editor for PXA26x, second edition"); - Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c 2007-03-18 19:46:37 UTC (rev 921) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c 2007-03-18 19:54:45 UTC (rev 922) @@ -1,226 +0,0 @@ -/*** Basic includes ***/ -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/init.h> -#include <linux/proc_fs.h> - -#include <linux/interrupt.h> -#include <asm/irq.h> -#include <asm/mach/arch.h> -#include <asm/mach/map.h> -#include <asm/mach-types.h> -#include <asm/hardware.h> -#include <linux/sched.h> -#include <linux/workqueue.h> -#include <asm/arch/pxa-regs.h> -#include <asm/arch/irqs.h> -#include <asm/uaccess.h> - -/*** GPIO macros ***/ -#define GET_PALMT3_GPIO(gpio) \ - (GPLR(GPIO_NR_PALMT3_ ## gpio) & GPIO_bit(GPIO_NR_PALMT3_ ## gpio)) - -#define SET_PALMT3_GPIO(gpio, setp) \ - do { \ - if (setp) \ - GPSR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \ - else \ - GPCR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \ - } while (0) - -#define SET_PALMT3_GPIO_N(gpio, setp) \ - do { \ - if (setp) \ - GPCR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \ - else \ - GPSR(GPIO_NR_PALMT3_ ## gpio) = GPIO_bit(GPIO_NR_PALMT3_ ## gpio); \ - } while (0) - -#define GET_GPIO_REG(reg,gpio) (GP##reg(gpio) & GPIO_bit(gpio)) -#define GET_GPIO(gpio) GET_GPIO_REG(LR, gpio) - -/*** /proc interface ***/ -static struct proc_dir_entry *proc_intf; -#define procfs_name "gpioed" -#define PROCFS_MAX_SIZE 20 - -static char procfs_buffer[PROCFS_MAX_SIZE]; -static unsigned long procfs_buffer_size = 0; - -int procfile_read(char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data) -{ - int ret; - - if (offset > 0) { - /* we have finished to read, return 0 */ - ret = 0; - } else { - /* fill the buffer, return the buffer size */ - ret = sprintf(buffer, "HelloWorld!\n"); - } - return ret; -} - -void handle_request(void); - -int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data) -{ - procfs_buffer_size = count; - if (procfs_buffer_size > PROCFS_MAX_SIZE ) { - procfs_buffer_size = PROCFS_MAX_SIZE; - } - - /* write data to the buffer */ - if ( copy_from_user(procfs_buffer, buffer, procfs_buffer_size) ) { - return -EFAULT; - } - - handle_request(); - - return procfs_buffer_size; -} - -/*** IRQ (GPIO) handling ***/ -static struct workqueue_struct *my_workqueue; -#define MY_WORK_QUEUE_NAME "GPIOed" - -static void handle_gpio(void* irq) -{ - int gpn = (int)irq; - printk(KERN_ERR "*** GPIO *** %d *** is *** %s ***\n", gpn, GET_GPIO(gpn) ? "high" : "low "); -} - -irqreturn_t gpio_irq(int irq, void *dev_id, struct pt_regs *regs) -{ - static int initialised = 0; - static struct work_struct task; - - if (initialised == 0) { - INIT_WORK(&task, handle_gpio, dev_id); - initialised = 1; - } else { - PREPARE_WORK(&task, handle_gpio, dev_id); - } - - queue_work(my_workqueue, &task); - - return IRQ_HANDLED; -} - -/*** GPIO R/W ***/ -static int gpio_get(int id) -{ - return GET_GPIO(id); -} - -static void gpio_set(int id, int on) -{ - do { - if (on) - GPSR(id) = GPIO_bit(id); - else - GPCR(id) = GPIO_bit(id); - } while (0); -} - -static int gpio_watch(int x) -{ - int ret; - ret = request_irq (IRQ_GPIO(x), gpio_irq, SA_SAMPLE_RANDOM, "test_handler", (void*)x); - set_irq_type (IRQ_GPIO(x), IRQT_BOTHEDGE); - if(ret!=0) { - printk(KERN_ERR "GPIOed: failed to register for GPIO %d\n", x); - return 1; - } else { - printk(KERN_ERR "GPIOed: Registered GPIO %d\n", x); - return 0; - } -} - -/*** Request handler ***/ -void handle_request() -{ - char *p = NULL; - unsigned long base = 10; - unsigned long id; - - if((procfs_buffer[0] == 'P') || (procfs_buffer[0] == 'V')) - base = 16; - id = simple_strtoul(procfs_buffer+2, &p, base); - switch(procfs_buffer[0]) { - case 'r': - printk(KERN_ERR "GPIOed: GPIO %lu is %s\n", id, gpio_get(id)?"high":"low "); - break; - case 's': - gpio_watch(id); - break; - case 'h': - gpio_set(id, 1); - printk(KERN_ERR "GPIOed: GPIO %lu set high\n", id); - break; - case 'l': - gpio_set(id, 0); - printk(KERN_ERR "GPIOed: GPIO %lu set low\n", id); - break; - case 'd': - printk(KERN_ERR "GPIOed: GPIO %lu is %s\n", id, GET_GPIO_REG(DR,id)?"output":"input"); - break; - - case 'P': - printk(KERN_ERR "GPIOed: P-V for 0x%x is 0x%x\n", id, (unsigned int)phys_to_virt(id)); - break; - case 'V': - printk(KERN_ERR "GPIOed: V-P for 0x%x is 0x%x\n", id, (unsigned int)virt_to_phys(id)); - break; - case 'D': - base = *((unsigned int*)id); - printk(KERN_ERR "GPIOed: 0x%x = 0x%x\n", id, base); - break; - default: - printk(KERN_ERR "GPIOed: Unknown request\n"); - break; - } -} - -/*** init&exit ***/ -static int __init gpioed_init(void) -{ - my_workqueue = create_workqueue(MY_WORK_QUEUE_NAME); - - proc_intf = create_proc_entry(procfs_name, 0644, NULL); - if (proc_intf == NULL) { - remove_proc_entry(procfs_name, &proc_root); - printk(KERN_ALERT "Error: Could not initialize /proc/%s\n", - procfs_name); - return -ENOMEM; - } - - proc_intf->read_proc = procfile_read; - proc_intf->write_proc = procfile_write; - proc_intf->owner = THIS_MODULE; - proc_intf->mode = S_IFREG | S_IRUGO; - proc_intf->uid = 0; - proc_intf->gid = 0; - proc_intf->size = 37; - - printk(KERN_INFO "/proc/%s created\n", procfs_name); - - return 0; -} - -static void __exit gpioed_exit(void) -{ - destroy_workqueue(my_workqueue); - remove_proc_entry(procfs_name, &proc_root); - printk(KERN_INFO "/proc/%s removed\n", procfs_name); -} - - -/*** Some more stuff ***/ -module_init(gpioed_init); -module_exit(gpioed_exit); - -MODULE_LICENSE("GPL"); -MODULE_AUTHOR("Vladimir \"Farcaller\" Pouzanov <far...@gm...>"); -MODULE_DESCRIPTION("GPIO editor for PXA26x"); - Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c 2007-03-18 19:46:37 UTC (rev 921) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c 2007-03-18 19:54:45 UTC (rev 922) @@ -1,594 +0,0 @@ -/************************************************************************ - * linux/arch/arm/mach-pxa/palmz72/palmz72_ac97.c * - * * - * Touchscreen/battery driver for Palm Zire 72 WM9712 AC97 codec * - * Author: Jan Herman <2h...@se...> * - * Based on palmld_ac97.c code from Alex Osborne * - * * - ************************************************************************/ - - -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/moduleparam.h> -#include <linux/init.h> -#include <linux/interrupt.h> -#include <linux/input.h> -#include <linux/device.h> -#include <linux/workqueue.h> -#include <linux/battery.h> - -#include <asm/apm.h> -#include <asm/delay.h> -#include <asm/mach-types.h> -#include <asm/mach/arch.h> -#include <asm/mach/map.h> -#include <asm/arch/hardware.h> -#include <asm/arch/pxa-regs.h> -#include <asm/arch/irqs.h> - -#include <sound/driver.h> -#include <sound/core.h> -#include <sound/pcm.h> -#include <sound/initval.h> -#include <sound/ac97_codec.h> -#include <asm/arch/palmz72-ac97.h> -#include <asm/arch/palmz72-gpio.h> -#include <asm/arch/palmz72-init.h> - - -#define X_AXIS_MAX 3900 -#define X_AXIS_MIN 350 -#define Y_AXIS_MAX 3750 -#define Y_AXIS_MIN 320 -#define PRESSURE_MIN 0 -#define PRESSURE_MAX 300 - -#define DIG2_INIT 0x0001 /* initial value for digitiser2 reg */ - -#define DEFAULT_PRESSURE_TRESHOLD 47200 /* default pressure treshold for pen up/down */ -#define DEFAULT_X_AXIS_FUZZ 5 /* default x axis noise treshold */ -#define DEFAULT_Y_AXIS_FUZZ 40 /* default y axis noise treshold */ -#define PRESSURE_FUZZ 4 /* default pressure noise treshold */ - -#define palmz72_ac97_WORK_QUEUE_NAME "palmz72_ac97_workqueue" - - -/********************* - * Module parameters * - *********************/ - -static int ptrsh = DEFAULT_PRESSURE_TRESHOLD; -module_param(ptrsh, int, 0); -MODULE_PARM_DESC(ptrsh, "pressure treshold for pen up/down"); - -static int dbglvl = 0; // debug disabled -module_param(dbglvl, int, 0); -MODULE_PARM_DESC(dbglvl, "debug level (0 is disabled)"); - -static int xdjtrsh = DEFAULT_X_AXIS_FUZZ; -module_param(xdjtrsh, int, 0); -MODULE_PARM_DESC(xdjtrsh, "treshold for x axis jitter"); - -static int ydjtrsh = DEFAULT_Y_AXIS_FUZZ; -module_param(ydjtrsh, int, 0); -MODULE_PARM_DESC(ydjtrsh, "treshold for y axis jitter"); - - -static DECLARE_MUTEX_LOCKED(queue_sem); -static DECLARE_MUTEX(digitiser_sem); -static DECLARE_MUTEX(battery_update_mutex); - -static struct workqueue_struct *palmz72_ac97_workqueue; -static struct work_struct palmz72_ac97_irq_task; - -struct input_dev *palmz72_ac97_input; -struct device *palmz72_ac97_dev; - -static ac97_t *ac97; - -static int battery_registered = 0; -static unsigned long last_battery_update = 0; -static int current_voltage; -static int previous_voltage; -static u16 d2base; - -/************** - * ac97 codec * - **************/ - -void wm97xx_gpio_func(int gpio, int func) -{ - int GEn; - GEn = ac97->bus->ops->read(ac97, 0x56); - if(func) - GEn |= gpio; - else - GEn &= ~gpio; - ac97->bus->ops->write(ac97, 0x56, GEn); -} - - -void wm97xx_gpio_mode(int gpio, int config, int polarity, int sticky, int wakeup) -{ - int GCn, GPn, GSn, GWn; - GCn = ac97->bus->ops->read(ac97, 0x4c); - GPn = ac97->bus->ops->read(ac97, 0x4e); - GSn = ac97->bus->ops->read(ac97, 0x50); - GWn = ac97->bus->ops->read(ac97, 0x52); - - if(config) - GCn |= gpio; - else - GCn &= ~gpio; - - if(polarity) - GPn |= gpio; - else - GPn &= ~gpio; - - if(sticky) - GSn |= gpio; - else - GSn &= ~gpio; - - if(wakeup) - GWn |= gpio; - else - GWn &= ~gpio; - - ac97->bus->ops->write(ac97, 0x4c, GCn); - ac97->bus->ops->write(ac97, 0x4e, GPn); - ac97->bus->ops->write(ac97, 0x50, GSn); - ac97->bus->ops->write(ac97, 0x52, GWn); -} - - -static void wm97xx_set_digitiser_power(int value) -{ - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base | value); -} - -static int palmz72_ac97_take_reading(int adcsel) -{ - - int timeout = 15; - u16 r76 = 0; - u16 r7a; - - r76 |= adcsel; // set ADCSEL (ADC source) - r76 |= WM97XX_DELAY(3); // set settling time delay - r76 &= ~(1<<11); // COO = 0 (single measurement) - r76 &= ~(1<<10); // CTC = 0 (polling mode) - r76 |= (1<<15); // initiate measurement (POLL) - - ac97->bus->ops->write(ac97, 0x76, r76); - - // wait settling time - udelay ((3 * AC97_LINK_FRAME) + 167); - - // wait for POLL to go low - while((ac97->bus->ops->read(ac97, 0x76) & 0x8000) && timeout){ - udelay(AC97_LINK_FRAME); - timeout--; - } - - if (timeout == 0){ - printk("palmz72_ac97: discarding reading due to POLL wait timout on 0x76\n"); - return 0; - } - - r7a = ac97->bus->ops->read(ac97, 0x7a); - - if ((r7a & WM97XX_ADCSEL_MASK) != adcsel){ - printk("palmz72_ac97: discarding reading -> wrong ADC source\n"); - return 0; - } - - return (int) r7a; - -} - - -static void palmz72_ac97_pendown(void) -{ - int xread, yread, pressure; - int valid_coords=0, btn_pressed = 0; - - /* take readings until the pen goes up */ - do { - /* take readings */ - xread = palmz72_ac97_take_reading(WM97XX_ADCSEL_X); - yread = palmz72_ac97_take_reading(WM97XX_ADCSEL_Y); - pressure = palmz72_ac97_take_reading(WM97XX_ADCSEL_PRES); - - // printk("Pressure is %d:\n", pressure); - - valid_coords = (xread & 0xfff) && (yread & 0xfff) && (pressure & 0xfff); - - if(valid_coords && (pressure < ptrsh)) { - btn_pressed = 1; - input_report_key(palmz72_ac97_input, BTN_TOUCH, 1); - input_report_abs(palmz72_ac97_input, ABS_X, xread & 0xfff); - input_report_abs(palmz72_ac97_input, ABS_Y, yread & 0xfff); - input_report_abs(palmz72_ac97_input, ABS_PRESSURE, pressure & 0xfff); - input_sync(palmz72_ac97_input); - - set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(HZ/100); - set_current_state(TASK_RUNNING); - } - } while( valid_coords ); - - - if (btn_pressed) { - input_report_key(palmz72_ac97_input, BTN_TOUCH, 0); - input_report_abs(palmz72_ac97_input, ABS_X, 0); - input_report_abs(palmz72_ac97_input, ABS_Y, 0); - input_report_abs(palmz72_ac97_input, ABS_PRESSURE, 0); - input_sync(palmz72_ac97_input); - } - -} - - -static void palmz72_ac97_irq_work(void *data) -{ - u16 levels; - u16 polarity; - - levels = ac97->bus->ops->read(ac97, 0x54); - polarity = ac97->bus->ops->read(ac97, 0x4e); - - if(polarity & levels & WM97XX_GPIO_13) { - /* power up digitiser: */ - down(&digitiser_sem); - wm97xx_set_digitiser_power(WM97XX_PRP_DET_DIG); - - palmz72_ac97_pendown(); - - /* power down digitiser to conserve power */ - wm97xx_set_digitiser_power(WM97XX_PRP_DET); - ac97->bus->ops->write(ac97, 0x4e, polarity & ~WM97XX_GPIO_13); - up(&digitiser_sem); - } - else { - ac97->bus->ops->write(ac97, 0x4e, polarity | WM97XX_GPIO_13); - } - - ac97->bus->ops->write(ac97, 0x54, levels & ~WM97XX_GPIO_13); - - udelay(1); - up(&queue_sem); - enable_irq(IRQ_GPIO_PALMZ72_WM9712_IRQ); -} - - -static irqreturn_t palmz72_ac97_irq_handler(int irq, void *dev_id, struct pt_regs *regs) -{ - if (down_trylock(&queue_sem) == 0){ - disable_irq(IRQ_GPIO_PALMZ72_WM9712_IRQ); - queue_work(palmz72_ac97_workqueue, &palmz72_ac97_irq_task); - } - - return IRQ_HANDLED; -} - -static int suspended = 0; - -static int palmz72_ac97_suspend(struct device *dev, pm_message_t state) -{ - suspended = 1; - return 0; -} - - -static int palmz72_ac97_resume(struct device* dev) -{ - u16 d2 = DIG2_INIT; - - ac97 = to_ac97_t(dev); - - /* reset levels */ - ac97->bus->ops->write(ac97, 0x54, 0); - - /* disable digitiser to save power, enable pen-down detect */ - d2 |= WM97XX_PRP_DET; - d2base = d2; - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base); - - /* enable interrupts on codec's gpio 2 (connected to cpu gpio 27) */ - wm97xx_gpio_mode(WM97XX_GPIO_2, WM97XX_GPIO_OUT, WM97XX_GPIO_POL_HIGH, - WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE); - wm97xx_gpio_func(WM97XX_GPIO_2, 0); - - /* enable pen detect interrupt */ - wm97xx_gpio_mode(WM97XX_GPIO_13, WM97XX_GPIO_OUT, WM97XX_GPIO_POL_HIGH, - WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE); - - /* setup work queue */ - palmz72_ac97_workqueue = create_workqueue(palmz72_ac97_WORK_QUEUE_NAME); - INIT_WORK(&palmz72_ac97_irq_task, palmz72_ac97_irq_work, dev); - - up(&queue_sem); - return 0; -} - - - - -/*********** - * Battery * - ***********/ - - -void palmz72_battery_read_adc(int force) -{ - u16 vread; - - if(!force && ((last_battery_update + 10 *HZ) > jiffies)) - return; - - if(down_trylock(&battery_update_mutex)) - return; - - down(&digitiser_sem); - wm97xx_set_digitiser_power(WM97XX_PRP_DET_DIG); - vread = palmz72_ac97_take_reading(WM97XX_ADCSEL_BMON); - wm97xx_set_digitiser_power(WM97XX_PRP_DET); - up(&digitiser_sem); - - previous_voltage = current_voltage; - current_voltage = vread & 0xfff; - last_battery_update = jiffies; - - up(&battery_update_mutex); -} - - -int palmz72_battery_min_voltage(struct battery *b) -{ - return PALMZ72_BAT_MIN_VOLTAGE; -} - - -int palmz72_battery_max_voltage(struct battery *b) -{ - return PALMZ72_BAT_MAX_VOLTAGE; /* mV */ -} - -/* - This formula is based on battery life of my battery 1100mAh. Original battery in Zire72 is Li-On 920mAh - V_batt = ADCSEL_BMON * 1,889 + 767,8 [mV] -*/ - -int palmz72_battery_get_voltage(struct battery *b) -{ - if (battery_registered){ - palmz72_battery_read_adc(0); - //printk("Battery [mV]: %d\n", current_voltage * 1889/1000 + 7678/10 ); - return current_voltage * 1889/1000 + 7678/10; - } - else{ - printk("palmz72_battery: cannot get voltage -> battery driver unregistered\n"); - return 0; - } -} - - -int palmz72_battery_get_status(struct battery *b) -{ - int ac_connected = GET_GPIO(GPIO_NR_PALMZ72_POWER_DETECT); - int usb_connected = !GET_GPIO(GPIO_NR_PALMZ72_USB_DETECT); - - if (current_voltage <= 0) - return BATTERY_STATUS_UNKNOWN; - - if (ac_connected || usb_connected){ - if ( ( current_voltage > previous_voltage ) || (current_voltage <= PALMZ72_BAT_MAX_VOLTAGE) ) - return BATTERY_STATUS_CHARGING; - return BATTERY_STATUS_NOT_CHARGING; - } - else - return BATTERY_STATUS_DISCHARGING; -} - - -struct battery palmz72_battery = { - .name = "palmz72_battery", - .id = "battery0", - .get_min_voltage = palmz72_battery_min_voltage, - .get_max_voltage = palmz72_battery_max_voltage, - .get_voltage = palmz72_battery_get_voltage, - .get_status = palmz72_battery_get_status, -}; - - -static int __init palmz72_ac97_probe(struct device *dev) -{ - int err; - u16 d2 = DIG2_INIT; - - if(!machine_is_palmz72()) - return -ENODEV; - - ac97 = to_ac97_t(dev); - - set_irq_type(IRQ_GPIO_PALMZ72_WM9712_IRQ, IRQT_RISING); - - err = request_irq(IRQ_GPIO_PALMZ72_WM9712_IRQ, palmz72_ac97_irq_handler, - SA_INTERRUPT, "WM9712 pendown IRQ", dev); - - if(err) { - printk(KERN_ERR "palmz72_ac97_probe: cannot request pen down IRQ\n"); - return -1; - } - - /* reset levels */ - ac97->bus->ops->write(ac97, 0x54, 0); - - /* disable digitiser to save power, enable pen-down detect */ - d2 |= WM97XX_PRP_DET; - d2base = d2; - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base); - - /* enable interrupts on codec's gpio 2 (connected to cpu gpio 27) */ - wm97xx_gpio_mode(WM97XX_GPIO_2, WM97XX_GPIO_OUT, WM97XX_GPIO_POL_HIGH, - WM97XX_GPIO_NOTSTICKY, WM97XX_GPIO_NOWAKE); - wm97xx_gpio_func(WM97XX_GPIO_2, 0); - - /* enable pen detect interrupt */ - wm97xx_gpio_mode(WM97XX_GPIO_13, WM97XX_GPIO_OUT, WM97XX_GPIO_POL_HIGH, - WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE); - - /* turn off irq gpio inverting */ - ac97->bus->ops->write(ac97, 0x58, ac97->bus->ops->read(ac97, 0x58)&~1); - - /* turn on the digitiser and pen down detector */ - ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base | WM97XX_PRP_DETW); - - /* setup the input device */ - palmz72_ac97_input = input_allocate_device(); - if (palmz72_ac97_input == NULL){ - printk ("palmz72_ac97_probe: cannot allocate input device\n"); - return -ENOMEM; - } - - palmz72_ac97_input->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); - - palmz72_ac97_input->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); - input_set_abs_params(palmz72_ac97_input, ABS_X, X_AXIS_MIN, X_AXIS_MAX, xdjtrsh, 0); - input_set_abs_params(palmz72_ac97_input, ABS_Y, Y_AXIS_MIN, Y_AXIS_MAX, ydjtrsh, 0); - input_set_abs_params(palmz72_ac97_input, ABS_PRESSURE, PRESSURE_MIN, PRESSURE_MAX, PRESSURE_FUZZ, 0); - - palmz72_ac97_input->name = "palmz72 touchscreen"; - palmz72_ac97_input->dev = dev; - palmz72_ac97_input->id.bustype = BUS_HOST; - input_register_device(palmz72_ac97_input); - - /* register battery */ - - if(battery_class_register(&palmz72_battery)) { - printk(KERN_ERR "palmz72_ac97_probe: could not register battery class\n"); - } - else{ - battery_registered = 1; - } - - /* setup work queue */ - palmz72_ac97_workqueue = create_workqueue(palmz72_ac97_WORK_QUEUE_NAME); - INIT_WORK(&palmz72_ac97_irq_task, palmz72_ac97_irq_work, dev); - - up(&queue_sem); - return 0; -} - -static int palmz72_ac_is_connected (void){ - /* when charger is plugged in and USB is not connected, then status is ONLINE */ - int ret = (!(GET_GPIO(GPIO_NR_PALMZ72_USB_PULLUP)) && !(GET_GPIO(GPIO_NR_PALMZ72_USB_DETECT)));; - if (ret) - ret = 1; - else - ret = 0; - - return ret; -} - -/******* - * APM * - *******/ - -static void palmz72_apm_get_power_status(struct apm_power_info *info) -{ - int min, max, curr, percent; - - curr = palmz72_battery_get_voltage(NULL); - min = palmz72_battery_min_voltage(NULL); - max = palmz72_battery_max_voltage(NULL); - - curr = curr - min; - if (curr < 0) curr = 0; - max = max - min; - - percent = curr*100/max; - - info->battery_life = percent; - - info->ac_line_status = palmz72_ac_is_connected() ? APM_AC_ONLINE : APM_AC_OFFLINE; - - if (info->ac_line_status) { - info->battery_status = APM_BATTERY_STATUS_CHARGING; - } else { - if (percent > 50) - info->battery_status = APM_BATTERY_STATUS_HIGH; - else if (percent < 5) - info->battery_status = APM_BATTERY_STATUS_CRITICAL; - else - info->battery_status = APM_BATTERY_STATUS_LOW; - } - - info->time = percent * PALMZ72_MAX_LIFE_MINS/100; - info->units = APM_UNITS_MINS; -} - -typedef void (*apm_get_power_status_t)(struct apm_power_info*); - -int set_apm_get_power_status(apm_get_power_status_t t) -{ - apm_get_power_status = t; - - return 0; -} - - -/* end of APM implementing */ - -static int palmz72_ac97_remove (struct device *dev) -{ - battery_class_unregister(&palmz72_battery); - ac97 = NULL; - input_unregister_device(palmz72_ac97_input); - return 0; -} - - -static struct device_driver palmz72_ac97_driver = { - .name = "palmz72_ac97 (WM9712)", - .bus = &ac97_bus_type, - .owner = THIS_MODULE, - .probe = palmz72_ac97_probe, - .remove = palmz72_ac97_remove, - -#ifdef CONFIG_PM - .suspend = palmz72_ac97_suspend, - .resume = palmz72_ac97_resume, -#endif -}; - - -static int __init palmz72_ac97_init(void) -{ - driver_register(&palmz72_ac97_driver); - -/* register battery to APM layer */ - -#ifdef CONFIG_PM - apm_get_power_status = palmz72_apm_get_power_status; - return 0; -#endif - -} - - -static void __exit palmz72_ac97_exit(void) -{ - driver_unregister(&palmz72_ac97_driver); -} - - -module_init(palmz72_ac97_init); -module_exit(palmz72_ac97_exit); - -MODULE_AUTHOR ("Jan Herman <2h...@se...>"); -MODULE_DESCRIPTION ("WM9712 AC97 codec support for PalmOne Zire 72"); -MODULE_LICENSE ("GPL"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mar...@us...> - 2007-03-18 22:03:57
|
Revision: 919 http://svn.sourceforge.net/hackndev/?rev=919&view=rev Author: marex_z71 Date: 2007-03-18 12:18:56 -0700 (Sun, 18 Mar 2007) Log Message: ----------- l4p: add few more ifdefs for squashfs-lzma Modified Paths: -------------- linux4palm/linux/trunk/init/do_mounts_rd.c Modified: linux4palm/linux/trunk/init/do_mounts_rd.c =================================================================== --- linux4palm/linux/trunk/init/do_mounts_rd.c 2007-03-18 12:28:29 UTC (rev 918) +++ linux4palm/linux/trunk/init/do_mounts_rd.c 2007-03-18 19:18:56 UTC (rev 919) @@ -64,7 +64,9 @@ struct romfs_super_block *romfsb; struct cramfs_super *cramfsb; struct squashfs_super_block *squashfsb; +#ifdef CONFIG_SQUASHFS_LZMA struct squashfs_super_block *squashfslzmab; +#endif int nblocks = -1; unsigned char *buf; @@ -78,7 +80,9 @@ romfsb = (struct romfs_super_block *) buf; cramfsb = (struct cramfs_super *) buf; squashfsb = (struct squashfs_super_block *) buf; +#ifdef CONFIG_SQUASHFS_LZMA squashfslzmab = (struct squashfs_super_block *) buf; +#endif memset(buf, 0xe5, size); /* @@ -128,6 +132,7 @@ goto done; } +#ifdef CONFIG_SQUASHFS_LZMA /* squashfslzma is at block zero too */ if (squashfslzmab->s_magic == SQUASHFS_MAGIC_LZMA) { printk(KERN_NOTICE @@ -139,6 +144,7 @@ nblocks = (squashfslzmab->bytes_used+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS; goto done; } +#endif /* * Read block 1 to test for minix and ext2 superblock This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-03-18 13:01:17
|
Revision: 918 http://svn.sourceforge.net/hackndev/?rev=918&view=rev Author: keddar Date: 2007-03-18 05:28:29 -0700 (Sun, 18 Mar 2007) Log Message: ----------- l4p: add support for initrd in SquashFS-LZMA format Modified Paths: -------------- linux4palm/linux/trunk/init/do_mounts_rd.c Modified: linux4palm/linux/trunk/init/do_mounts_rd.c =================================================================== --- linux4palm/linux/trunk/init/do_mounts_rd.c 2007-03-18 12:23:04 UTC (rev 917) +++ linux4palm/linux/trunk/init/do_mounts_rd.c 2007-03-18 12:28:29 UTC (rev 918) @@ -5,7 +5,14 @@ #include <linux/ext2_fs.h> #include <linux/romfs_fs.h> #include <linux/cramfs_fs.h> -#include <linux/squashfs_fs.h> + +#ifdef CONFIG_SQUASHFS_LZMA + #include <linux/squashfslzma_fs.h> + #include <../fs/squashfs_lzma/sqmagic.h> +#else + #include <linux/squashfs_fs.h> +#endif + #include <linux/initrd.h> #include <linux/string.h> @@ -41,6 +48,7 @@ * * We currently check for the following magic numbers: * squashfs + * squashfs-lzma * minix * ext2 * romfs @@ -56,6 +64,8 @@ struct romfs_super_block *romfsb; struct cramfs_super *cramfsb; struct squashfs_super_block *squashfsb; + struct squashfs_super_block *squashfslzmab; + int nblocks = -1; unsigned char *buf; @@ -68,6 +78,7 @@ romfsb = (struct romfs_super_block *) buf; cramfsb = (struct cramfs_super *) buf; squashfsb = (struct squashfs_super_block *) buf; + squashfslzmab = (struct squashfs_super_block *) buf; memset(buf, 0xe5, size); /* @@ -117,6 +128,17 @@ goto done; } + /* squashfslzma is at block zero too */ + if (squashfslzmab->s_magic == SQUASHFS_MAGIC_LZMA) { + printk(KERN_NOTICE + "RAMDISK: SquashFS-LZMA filesystem found at block %d\n", + start_block); + if (squashfslzmab->s_major < 3) + nblocks = (squashfslzmab->bytes_used_2+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS; + else + nblocks = (squashfslzmab->bytes_used+BLOCK_SIZE-1)>>BLOCK_SIZE_BITS; + goto done; + } /* * Read block 1 to test for minix and ext2 superblock This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ke...@us...> - 2007-03-18 13:01:15
|
Revision: 917 http://svn.sourceforge.net/hackndev/?rev=917&view=rev Author: keddar Date: 2007-03-18 05:23:04 -0700 (Sun, 18 Mar 2007) Log Message: ----------- l4p: patched squashfs (3.2-r2) include for squashfs-lzma... Added Paths: ----------- linux4palm/linux/trunk/include/linux/squashfslzma_fs.h linux4palm/linux/trunk/include/linux/squashfslzma_fs_i.h linux4palm/linux/trunk/include/linux/squashfslzma_fs_sb.h Added: linux4palm/linux/trunk/include/linux/squashfslzma_fs.h =================================================================== --- linux4palm/linux/trunk/include/linux/squashfslzma_fs.h (rev 0) +++ linux4palm/linux/trunk/include/linux/squashfslzma_fs.h 2007-03-18 12:23:04 UTC (rev 917) @@ -0,0 +1,934 @@ +#ifndef SQUASHFS_FS +#define SQUASHFS_FS + +/* + * Squashfs + * + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Phillip Lougher <ph...@lo...> + * + * 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, + * or (at your option) any later version. + * + * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * squashfs_fs.h + */ + +#ifndef CONFIG_SQUASHFS_2_0_COMPATIBILITY +#define CONFIG_SQUASHFS_2_0_COMPATIBILITY +#endif + +#ifdef CONFIG_SQUASHFS_VMALLOC +#define SQUASHFS_ALLOC(a) vmalloc(a) +#define SQUASHFS_FREE(a) vfree(a) +#else +#define SQUASHFS_ALLOC(a) kmalloc(a, GFP_KERNEL) +#define SQUASHFS_FREE(a) kfree(a) +#endif +#define SQUASHFS_CACHED_FRAGMENTS CONFIG_SQUASHFS_LZMA_FRAGMENT_CACHE_SIZE +#define SQUASHFS_MAJOR 3 +#define SQUASHFS_MINOR 0 +#define SQUASHFS_MAGIC 0x73717368 +#define SQUASHFS_MAGIC_SWAP 0x68737173 +#define SQUASHFS_START 0 + +/* size of metadata (inode and directory) blocks */ +#define SQUASHFS_METADATA_SIZE 8192 +#define SQUASHFS_METADATA_LOG 13 + +/* default size of data blocks */ +#define SQUASHFS_FILE_SIZE 65536 +#define SQUASHFS_FILE_LOG 16 + +#define SQUASHFS_FILE_MAX_SIZE 65536 + +/* Max number of uids and gids */ +#define SQUASHFS_UIDS 256 +#define SQUASHFS_GUIDS 255 + +/* Max length of filename (not 255) */ +#define SQUASHFS_NAME_LEN 256 + +#define SQUASHFS_INVALID ((long long) 0xffffffffffff) +#define SQUASHFS_INVALID_FRAG ((unsigned int) 0xffffffff) +#define SQUASHFS_INVALID_BLK ((long long) -1) +#define SQUASHFS_USED_BLK ((long long) -2) + +/* Filesystem flags */ +#define SQUASHFS_NOI 0 +#define SQUASHFS_NOD 1 +#define SQUASHFS_CHECK 2 +#define SQUASHFS_NOF 3 +#define SQUASHFS_NO_FRAG 4 +#define SQUASHFS_ALWAYS_FRAG 5 +#define SQUASHFS_DUPLICATE 6 +#define SQUASHFS_EXPORT 7 + +#define SQUASHFS_BIT(flag, bit) ((flag >> bit) & 1) + +#define SQUASHFS_UNCOMPRESSED_INODES(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NOI) + +#define SQUASHFS_UNCOMPRESSED_DATA(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NOD) + +#define SQUASHFS_UNCOMPRESSED_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NOF) + +#define SQUASHFS_NO_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_NO_FRAG) + +#define SQUASHFS_ALWAYS_FRAGMENTS(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_ALWAYS_FRAG) + +#define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_DUPLICATE) + +#define SQUASHFS_EXPORTABLE(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_EXPORT) + +#define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, \ + SQUASHFS_CHECK) + +#define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, \ + duplicate_checking, exortable) (noi | (nod << 1) | (check_data << 2) \ + | (nof << 3) | (no_frag << 4) | (always_frag << 5) | \ + (duplicate_checking << 6) | (exportable << 7)) + +/* Max number of types and file types */ +#define SQUASHFS_DIR_TYPE 1 +#define SQUASHFS_FILE_TYPE 2 +#define SQUASHFS_SYMLINK_TYPE 3 +#define SQUASHFS_BLKDEV_TYPE 4 +#define SQUASHFS_CHRDEV_TYPE 5 +#define SQUASHFS_FIFO_TYPE 6 +#define SQUASHFS_SOCKET_TYPE 7 +#define SQUASHFS_LDIR_TYPE 8 +#define SQUASHFS_LREG_TYPE 9 + +/* 1.0 filesystem type definitions */ +#define SQUASHFS_TYPES 5 +#define SQUASHFS_IPC_TYPE 0 + +/* Flag whether block is compressed or uncompressed, bit is set if block is + * uncompressed */ +#define SQUASHFS_COMPRESSED_BIT (1 << 15) + +#define SQUASHFS_COMPRESSED_SIZE(B) (((B) & ~SQUASHFS_COMPRESSED_BIT) ? \ + (B) & ~SQUASHFS_COMPRESSED_BIT : SQUASHFS_COMPRESSED_BIT) + +#define SQUASHFS_COMPRESSED(B) (!((B) & SQUASHFS_COMPRESSED_BIT)) + +#define SQUASHFS_COMPRESSED_BIT_BLOCK (1 << 24) + +#define SQUASHFS_COMPRESSED_SIZE_BLOCK(B) (((B) & \ + ~SQUASHFS_COMPRESSED_BIT_BLOCK) ? (B) & \ + ~SQUASHFS_COMPRESSED_BIT_BLOCK : SQUASHFS_COMPRESSED_BIT_BLOCK) + +#define SQUASHFS_COMPRESSED_BLOCK(B) (!((B) & SQUASHFS_COMPRESSED_BIT_BLOCK)) + +/* + * Inode number ops. Inodes consist of a compressed block number, and an + * uncompressed offset within that block + */ +#define SQUASHFS_INODE_BLK(a) ((unsigned int) ((a) >> 16)) + +#define SQUASHFS_INODE_OFFSET(a) ((unsigned int) ((a) & 0xffff)) + +#define SQUASHFS_MKINODE(A, B) ((squashfs_inode_t)(((squashfs_inode_t) (A)\ + << 16) + (B))) + +/* Compute 32 bit VFS inode number from squashfs inode number */ +#define SQUASHFS_MK_VFS_INODE(a, b) ((unsigned int) (((a) << 8) + \ + ((b) >> 2) + 1)) +/* XXX */ + +/* Translate between VFS mode and squashfs mode */ +#define SQUASHFS_MODE(a) ((a) & 0xfff) + +/* fragment and fragment table defines */ +#define SQUASHFS_FRAGMENT_BYTES(A) ((A) * sizeof(struct squashfs_fragment_entry)) + +#define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_OFFSET(A) (SQUASHFS_FRAGMENT_BYTES(A) % \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEXES(A) ((SQUASHFS_FRAGMENT_BYTES(A) + \ + SQUASHFS_METADATA_SIZE - 1) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) *\ + sizeof(long long)) + +/* inode lookup table defines */ +#define SQUASHFS_LOOKUP_BYTES(A) ((A) * sizeof(squashfs_inode_t)) + +#define SQUASHFS_LOOKUP_BLOCK(A) (SQUASHFS_LOOKUP_BYTES(A) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_LOOKUP_BLOCK_OFFSET(A) (SQUASHFS_LOOKUP_BYTES(A) % \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_LOOKUP_BLOCKS(A) ((SQUASHFS_LOOKUP_BYTES(A) + \ + SQUASHFS_METADATA_SIZE - 1) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_LOOKUP_BLOCK_BYTES(A) (SQUASHFS_LOOKUP_BLOCKS(A) *\ + sizeof(long long)) + +/* cached data constants for filesystem */ +#define SQUASHFS_CACHED_BLKS 8 + +#define SQUASHFS_MAX_FILE_SIZE_LOG 64 + +#define SQUASHFS_MAX_FILE_SIZE ((long long) 1 << \ + (SQUASHFS_MAX_FILE_SIZE_LOG - 2)) + +#define SQUASHFS_MARKER_BYTE 0xff + +/* meta index cache */ +#define SQUASHFS_META_INDEXES (SQUASHFS_METADATA_SIZE / sizeof(unsigned int)) +#define SQUASHFS_META_ENTRIES 31 +#define SQUASHFS_META_NUMBER 8 +#define SQUASHFS_SLOTS 4 + +struct meta_entry { + long long data_block; + unsigned int index_block; + unsigned short offset; + unsigned short pad; +}; + +struct meta_index { + unsigned int inode_number; + unsigned int offset; + unsigned short entries; + unsigned short skip; + unsigned short locked; + unsigned short pad; + struct meta_entry meta_entry[SQUASHFS_META_ENTRIES]; +}; + + +/* + * definitions for structures on disk + */ + +typedef long long squashfs_block_t; +typedef long long squashfs_inode_t; + +struct squashfs_super_block { + unsigned int s_magic; + unsigned int inodes; + unsigned int bytes_used_2; + unsigned int uid_start_2; + unsigned int guid_start_2; + unsigned int inode_table_start_2; + unsigned int directory_table_start_2; + unsigned int s_major:16; + unsigned int s_minor:16; + unsigned int block_size_1:16; + unsigned int block_log:16; + unsigned int flags:8; + unsigned int no_uids:8; + unsigned int no_guids:8; + unsigned int mkfs_time /* time of filesystem creation */; + squashfs_inode_t root_inode; + unsigned int block_size; + unsigned int fragments; + unsigned int fragment_table_start_2; + long long bytes_used; + long long uid_start; + long long guid_start; + long long inode_table_start; + long long directory_table_start; + long long fragment_table_start; + long long lookup_table_start; +} __attribute__ ((packed)); + +struct squashfs_dir_index { + unsigned int index; + unsigned int start_block; + unsigned char size; + unsigned char name[0]; +} __attribute__ ((packed)); + +#define SQUASHFS_BASE_INODE_HEADER \ + unsigned int inode_type:4; \ + unsigned int mode:12; \ + unsigned int uid:8; \ + unsigned int guid:8; \ + unsigned int mtime; \ + unsigned int inode_number; + +struct squashfs_base_inode_header { + SQUASHFS_BASE_INODE_HEADER; +} __attribute__ ((packed)); + +struct squashfs_ipc_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; +} __attribute__ ((packed)); + +struct squashfs_dev_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + unsigned short rdev; +} __attribute__ ((packed)); + +struct squashfs_symlink_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + unsigned short symlink_size; + char symlink[0]; +} __attribute__ ((packed)); + +struct squashfs_reg_inode_header { + SQUASHFS_BASE_INODE_HEADER; + squashfs_block_t start_block; + unsigned int fragment; + unsigned int offset; + unsigned int file_size; + unsigned short block_list[0]; +} __attribute__ ((packed)); + +struct squashfs_lreg_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + squashfs_block_t start_block; + unsigned int fragment; + unsigned int offset; + long long file_size; + unsigned short block_list[0]; +} __attribute__ ((packed)); + +struct squashfs_dir_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + unsigned int file_size:19; + unsigned int offset:13; + unsigned int start_block; + unsigned int parent_inode; +} __attribute__ ((packed)); + +struct squashfs_ldir_inode_header { + SQUASHFS_BASE_INODE_HEADER; + unsigned int nlink; + unsigned int file_size:27; + unsigned int offset:13; + unsigned int start_block; + unsigned int i_count:16; + unsigned int parent_inode; + struct squashfs_dir_index index[0]; +} __attribute__ ((packed)); + +union squashfs_inode_header { + struct squashfs_base_inode_header base; + struct squashfs_dev_inode_header dev; + struct squashfs_symlink_inode_header symlink; + struct squashfs_reg_inode_header reg; + struct squashfs_lreg_inode_header lreg; + struct squashfs_dir_inode_header dir; + struct squashfs_ldir_inode_header ldir; + struct squashfs_ipc_inode_header ipc; +}; + +struct squashfs_dir_entry { + unsigned int offset:13; + unsigned int type:3; + unsigned int size:8; + int inode_number:16; + char name[0]; +} __attribute__ ((packed)); + +struct squashfs_dir_header { + unsigned int count:8; + unsigned int start_block; + unsigned int inode_number; +} __attribute__ ((packed)); + +struct squashfs_fragment_entry { + long long start_block; + unsigned int size; + unsigned int pending; +} __attribute__ ((packed)); + +extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen); +extern int squashfs_uncompress_init(void); +extern int squashfs_uncompress_exit(void); + +/* + * macros to convert each packed bitfield structure from little endian to big + * endian and vice versa. These are needed when creating or using a filesystem + * on a machine with different byte ordering to the target architecture. + * + */ + +#define SQUASHFS_SWAP_START \ + int bits;\ + int b_pos;\ + unsigned long long val;\ + unsigned char *s;\ + unsigned char *d; + +#define SQUASHFS_SWAP_SUPER_BLOCK(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_super_block));\ + SQUASHFS_SWAP((s)->s_magic, d, 0, 32);\ + SQUASHFS_SWAP((s)->inodes, d, 32, 32);\ + SQUASHFS_SWAP((s)->bytes_used_2, d, 64, 32);\ + SQUASHFS_SWAP((s)->uid_start_2, d, 96, 32);\ + SQUASHFS_SWAP((s)->guid_start_2, d, 128, 32);\ + SQUASHFS_SWAP((s)->inode_table_start_2, d, 160, 32);\ + SQUASHFS_SWAP((s)->directory_table_start_2, d, 192, 32);\ + SQUASHFS_SWAP((s)->s_major, d, 224, 16);\ + SQUASHFS_SWAP((s)->s_minor, d, 240, 16);\ + SQUASHFS_SWAP((s)->block_size_1, d, 256, 16);\ + SQUASHFS_SWAP((s)->block_log, d, 272, 16);\ + SQUASHFS_SWAP((s)->flags, d, 288, 8);\ + SQUASHFS_SWAP((s)->no_uids, d, 296, 8);\ + SQUASHFS_SWAP((s)->no_guids, d, 304, 8);\ + SQUASHFS_SWAP((s)->mkfs_time, d, 312, 32);\ + SQUASHFS_SWAP((s)->root_inode, d, 344, 64);\ + SQUASHFS_SWAP((s)->block_size, d, 408, 32);\ + SQUASHFS_SWAP((s)->fragments, d, 440, 32);\ + SQUASHFS_SWAP((s)->fragment_table_start_2, d, 472, 32);\ + SQUASHFS_SWAP((s)->bytes_used, d, 504, 64);\ + SQUASHFS_SWAP((s)->uid_start, d, 568, 64);\ + SQUASHFS_SWAP((s)->guid_start, d, 632, 64);\ + SQUASHFS_SWAP((s)->inode_table_start, d, 696, 64);\ + SQUASHFS_SWAP((s)->directory_table_start, d, 760, 64);\ + SQUASHFS_SWAP((s)->fragment_table_start, d, 824, 64);\ + SQUASHFS_SWAP((s)->lookup_table_start, d, 888, 64);\ +} + +#define SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ + SQUASHFS_MEMSET(s, d, n);\ + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ + SQUASHFS_SWAP((s)->mode, d, 4, 12);\ + SQUASHFS_SWAP((s)->uid, d, 16, 8);\ + SQUASHFS_SWAP((s)->guid, d, 24, 8);\ + SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ + SQUASHFS_SWAP((s)->inode_number, d, 64, 32); + +#define SQUASHFS_SWAP_BASE_INODE_HEADER(s, d, n) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ +} + +#define SQUASHFS_SWAP_IPC_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_ipc_inode_header))\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ +} + +#define SQUASHFS_SWAP_DEV_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_dev_inode_header)); \ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->rdev, d, 128, 16);\ +} + +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_symlink_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->symlink_size, d, 128, 16);\ +} + +#define SQUASHFS_SWAP_REG_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_reg_inode_header));\ + SQUASHFS_SWAP((s)->start_block, d, 96, 64);\ + SQUASHFS_SWAP((s)->fragment, d, 160, 32);\ + SQUASHFS_SWAP((s)->offset, d, 192, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 224, 32);\ +} + +#define SQUASHFS_SWAP_LREG_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_lreg_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 128, 64);\ + SQUASHFS_SWAP((s)->fragment, d, 192, 32);\ + SQUASHFS_SWAP((s)->offset, d, 224, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 256, 64);\ +} + +#define SQUASHFS_SWAP_DIR_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_dir_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 128, 19);\ + SQUASHFS_SWAP((s)->offset, d, 147, 13);\ + SQUASHFS_SWAP((s)->start_block, d, 160, 32);\ + SQUASHFS_SWAP((s)->parent_inode, d, 192, 32);\ +} + +#define SQUASHFS_SWAP_LDIR_INODE_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE(s, d, \ + sizeof(struct squashfs_ldir_inode_header));\ + SQUASHFS_SWAP((s)->nlink, d, 96, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 128, 27);\ + SQUASHFS_SWAP((s)->offset, d, 155, 13);\ + SQUASHFS_SWAP((s)->start_block, d, 168, 32);\ + SQUASHFS_SWAP((s)->i_count, d, 200, 16);\ + SQUASHFS_SWAP((s)->parent_inode, d, 216, 32);\ +} + +#define SQUASHFS_SWAP_DIR_INDEX(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index));\ + SQUASHFS_SWAP((s)->index, d, 0, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 32, 32);\ + SQUASHFS_SWAP((s)->size, d, 64, 8);\ +} + +#define SQUASHFS_SWAP_DIR_HEADER(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header));\ + SQUASHFS_SWAP((s)->count, d, 0, 8);\ + SQUASHFS_SWAP((s)->start_block, d, 8, 32);\ + SQUASHFS_SWAP((s)->inode_number, d, 40, 32);\ +} + +#define SQUASHFS_SWAP_DIR_ENTRY(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry));\ + SQUASHFS_SWAP((s)->offset, d, 0, 13);\ + SQUASHFS_SWAP((s)->type, d, 13, 3);\ + SQUASHFS_SWAP((s)->size, d, 16, 8);\ + SQUASHFS_SWAP((s)->inode_number, d, 24, 16);\ +} + +#define SQUASHFS_SWAP_FRAGMENT_ENTRY(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry));\ + SQUASHFS_SWAP((s)->start_block, d, 0, 64);\ + SQUASHFS_SWAP((s)->size, d, 64, 32);\ +} + +#define SQUASHFS_SWAP_INODE_T(s, d) SQUASHFS_SWAP_LONG_LONGS(s, d, 1) + +#define SQUASHFS_SWAP_SHORTS(s, d, n) {\ + int entry;\ + int bit_position;\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, n * 2);\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + 16)\ + SQUASHFS_SWAP(s[entry], d, bit_position, 16);\ +} + +#define SQUASHFS_SWAP_INTS(s, d, n) {\ + int entry;\ + int bit_position;\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, n * 4);\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + 32)\ + SQUASHFS_SWAP(s[entry], d, bit_position, 32);\ +} + +#define SQUASHFS_SWAP_LONG_LONGS(s, d, n) {\ + int entry;\ + int bit_position;\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, n * 8);\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + 64)\ + SQUASHFS_SWAP(s[entry], d, bit_position, 64);\ +} + +#define SQUASHFS_SWAP_DATA(s, d, n, bits) {\ + int entry;\ + int bit_position;\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, n * bits / 8);\ + for(entry = 0, bit_position = 0; entry < n; entry++, bit_position += \ + bits)\ + SQUASHFS_SWAP(s[entry], d, bit_position, bits);\ +} + +#define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n) +#define SQUASHFS_SWAP_LOOKUP_BLOCKS(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n) + +#ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY + +struct squashfs_base_inode_header_1 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:4; /* index into uid table */ + unsigned int guid:4; /* index into guid table */ +} __attribute__ ((packed)); + +struct squashfs_ipc_inode_header_1 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:4; /* index into uid table */ + unsigned int guid:4; /* index into guid table */ + unsigned int type:4; + unsigned int offset:4; +} __attribute__ ((packed)); + +struct squashfs_dev_inode_header_1 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:4; /* index into uid table */ + unsigned int guid:4; /* index into guid table */ + unsigned short rdev; +} __attribute__ ((packed)); + +struct squashfs_symlink_inode_header_1 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:4; /* index into uid table */ + unsigned int guid:4; /* index into guid table */ + unsigned short symlink_size; + char symlink[0]; +} __attribute__ ((packed)); + +struct squashfs_reg_inode_header_1 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:4; /* index into uid table */ + unsigned int guid:4; /* index into guid table */ + unsigned int mtime; + unsigned int start_block; + unsigned int file_size:32; + unsigned short block_list[0]; +} __attribute__ ((packed)); + +struct squashfs_dir_inode_header_1 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:4; /* index into uid table */ + unsigned int guid:4; /* index into guid table */ + unsigned int file_size:19; + unsigned int offset:13; + unsigned int mtime; + unsigned int start_block:24; +} __attribute__ ((packed)); + +#define SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n) \ + SQUASHFS_MEMSET(s, d, n);\ + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ + SQUASHFS_SWAP((s)->mode, d, 4, 12);\ + SQUASHFS_SWAP((s)->uid, d, 16, 4);\ + SQUASHFS_SWAP((s)->guid, d, 20, 4); + +#define SQUASHFS_SWAP_BASE_INODE_HEADER_1(s, d, n) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, n)\ +} + +#define SQUASHFS_SWAP_IPC_INODE_HEADER_1(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_ipc_inode_header_1));\ + SQUASHFS_SWAP((s)->type, d, 24, 4);\ + SQUASHFS_SWAP((s)->offset, d, 28, 4);\ +} + +#define SQUASHFS_SWAP_DEV_INODE_HEADER_1(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_dev_inode_header_1));\ + SQUASHFS_SWAP((s)->rdev, d, 24, 16);\ +} + +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_1(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_symlink_inode_header_1));\ + SQUASHFS_SWAP((s)->symlink_size, d, 24, 16);\ +} + +#define SQUASHFS_SWAP_REG_INODE_HEADER_1(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_reg_inode_header_1));\ + SQUASHFS_SWAP((s)->mtime, d, 24, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 56, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 88, 32);\ +} + +#define SQUASHFS_SWAP_DIR_INODE_HEADER_1(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_1(s, d, \ + sizeof(struct squashfs_dir_inode_header_1));\ + SQUASHFS_SWAP((s)->file_size, d, 24, 19);\ + SQUASHFS_SWAP((s)->offset, d, 43, 13);\ + SQUASHFS_SWAP((s)->mtime, d, 56, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 88, 24);\ +} + +#endif + +#ifdef CONFIG_SQUASHFS_2_0_COMPATIBILITY + +struct squashfs_dir_index_2 { + unsigned int index:27; + unsigned int start_block:29; + unsigned char size; + unsigned char name[0]; +} __attribute__ ((packed)); + +struct squashfs_base_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ +} __attribute__ ((packed)); + +struct squashfs_ipc_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ +} __attribute__ ((packed)); + +struct squashfs_dev_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned short rdev; +} __attribute__ ((packed)); + +struct squashfs_symlink_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned short symlink_size; + char symlink[0]; +} __attribute__ ((packed)); + +struct squashfs_reg_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned int mtime; + unsigned int start_block; + unsigned int fragment; + unsigned int offset; + unsigned int file_size:32; + unsigned short block_list[0]; +} __attribute__ ((packed)); + +struct squashfs_dir_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned int file_size:19; + unsigned int offset:13; + unsigned int mtime; + unsigned int start_block:24; +} __attribute__ ((packed)); + +struct squashfs_ldir_inode_header_2 { + unsigned int inode_type:4; + unsigned int mode:12; /* protection */ + unsigned int uid:8; /* index into uid table */ + unsigned int guid:8; /* index into guid table */ + unsigned int file_size:27; + unsigned int offset:13; + unsigned int mtime; + unsigned int start_block:24; + unsigned int i_count:16; + struct squashfs_dir_index_2 index[0]; +} __attribute__ ((packed)); + +union squashfs_inode_header_2 { + struct squashfs_base_inode_header_2 base; + struct squashfs_dev_inode_header_2 dev; + struct squashfs_symlink_inode_header_2 symlink; + struct squashfs_reg_inode_header_2 reg; + struct squashfs_dir_inode_header_2 dir; + struct squashfs_ldir_inode_header_2 ldir; + struct squashfs_ipc_inode_header_2 ipc; +}; + +struct squashfs_dir_header_2 { + unsigned int count:8; + unsigned int start_block:24; +} __attribute__ ((packed)); + +struct squashfs_dir_entry_2 { + unsigned int offset:13; + unsigned int type:3; + unsigned int size:8; + char name[0]; +} __attribute__ ((packed)); + +struct squashfs_fragment_entry_2 { + unsigned int start_block; + unsigned int size; +} __attribute__ ((packed)); + +#define SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\ + SQUASHFS_MEMSET(s, d, n);\ + SQUASHFS_SWAP((s)->inode_type, d, 0, 4);\ + SQUASHFS_SWAP((s)->mode, d, 4, 12);\ + SQUASHFS_SWAP((s)->uid, d, 16, 8);\ + SQUASHFS_SWAP((s)->guid, d, 24, 8);\ + +#define SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, n) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, n)\ +} + +#define SQUASHFS_SWAP_IPC_INODE_HEADER_2(s, d) \ + SQUASHFS_SWAP_BASE_INODE_HEADER_2(s, d, sizeof(struct squashfs_ipc_inode_header_2)) + +#define SQUASHFS_SWAP_DEV_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_dev_inode_header_2)); \ + SQUASHFS_SWAP((s)->rdev, d, 32, 16);\ +} + +#define SQUASHFS_SWAP_SYMLINK_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_symlink_inode_header_2));\ + SQUASHFS_SWAP((s)->symlink_size, d, 32, 16);\ +} + +#define SQUASHFS_SWAP_REG_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_reg_inode_header_2));\ + SQUASHFS_SWAP((s)->mtime, d, 32, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 64, 32);\ + SQUASHFS_SWAP((s)->fragment, d, 96, 32);\ + SQUASHFS_SWAP((s)->offset, d, 128, 32);\ + SQUASHFS_SWAP((s)->file_size, d, 160, 32);\ +} + +#define SQUASHFS_SWAP_DIR_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_dir_inode_header_2));\ + SQUASHFS_SWAP((s)->file_size, d, 32, 19);\ + SQUASHFS_SWAP((s)->offset, d, 51, 13);\ + SQUASHFS_SWAP((s)->mtime, d, 64, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 96, 24);\ +} + +#define SQUASHFS_SWAP_LDIR_INODE_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_SWAP_BASE_INODE_CORE_2(s, d, \ + sizeof(struct squashfs_ldir_inode_header_2));\ + SQUASHFS_SWAP((s)->file_size, d, 32, 27);\ + SQUASHFS_SWAP((s)->offset, d, 59, 13);\ + SQUASHFS_SWAP((s)->mtime, d, 72, 32);\ + SQUASHFS_SWAP((s)->start_block, d, 104, 24);\ + SQUASHFS_SWAP((s)->i_count, d, 128, 16);\ +} + +#define SQUASHFS_SWAP_DIR_INDEX_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_index_2));\ + SQUASHFS_SWAP((s)->index, d, 0, 27);\ + SQUASHFS_SWAP((s)->start_block, d, 27, 29);\ + SQUASHFS_SWAP((s)->size, d, 56, 8);\ +} +#define SQUASHFS_SWAP_DIR_HEADER_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_header_2));\ + SQUASHFS_SWAP((s)->count, d, 0, 8);\ + SQUASHFS_SWAP((s)->start_block, d, 8, 24);\ +} + +#define SQUASHFS_SWAP_DIR_ENTRY_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_dir_entry_2));\ + SQUASHFS_SWAP((s)->offset, d, 0, 13);\ + SQUASHFS_SWAP((s)->type, d, 13, 3);\ + SQUASHFS_SWAP((s)->size, d, 16, 8);\ +} + +#define SQUASHFS_SWAP_FRAGMENT_ENTRY_2(s, d) {\ + SQUASHFS_SWAP_START\ + SQUASHFS_MEMSET(s, d, sizeof(struct squashfs_fragment_entry_2));\ + SQUASHFS_SWAP((s)->start_block, d, 0, 32);\ + SQUASHFS_SWAP((s)->size, d, 32, 32);\ +} + +#define SQUASHFS_SWAP_FRAGMENT_INDEXES_2(s, d, n) SQUASHFS_SWAP_INTS(s, d, n) + +/* fragment and fragment table defines */ +#define SQUASHFS_FRAGMENT_BYTES_2(A) (A * sizeof(struct squashfs_fragment_entry_2)) + +#define SQUASHFS_FRAGMENT_INDEX_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_OFFSET_2(A) (SQUASHFS_FRAGMENT_BYTES_2(A) % \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEXES_2(A) ((SQUASHFS_FRAGMENT_BYTES_2(A) + \ + SQUASHFS_METADATA_SIZE - 1) / \ + SQUASHFS_METADATA_SIZE) + +#define SQUASHFS_FRAGMENT_INDEX_BYTES_2(A) (SQUASHFS_FRAGMENT_INDEXES_2(A) *\ + sizeof(int)) + +#endif + +#ifdef __KERNEL__ + +/* + * macros used to swap each structure entry, taking into account + * bitfields and different bitfield placing conventions on differing + * architectures + */ + +#include <asm/byteorder.h> + +#ifdef __BIG_ENDIAN + /* convert from little endian to big endian */ +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \ + tbits, b_pos) +#else + /* convert from big endian to little endian */ +#define SQUASHFS_SWAP(value, p, pos, tbits) _SQUASHFS_SWAP(value, p, pos, \ + tbits, 64 - tbits - b_pos) +#endif + +#define _SQUASHFS_SWAP(value, p, pos, tbits, SHIFT) {\ + b_pos = pos % 8;\ + val = 0;\ + s = (unsigned char *)p + (pos / 8);\ + d = ((unsigned char *) &val) + 7;\ + for(bits = 0; bits < (tbits + b_pos); bits += 8) \ + *d-- = *s++;\ + value = (val >> (SHIFT))/* & ((1 << tbits) - 1)*/;\ +} + +#define SQUASHFS_MEMSET(s, d, n) memset(s, 0, n); + +#endif +#endif Added: linux4palm/linux/trunk/include/linux/squashfslzma_fs_i.h =================================================================== --- linux4palm/linux/trunk/include/linux/squashfslzma_fs_i.h (rev 0) +++ linux4palm/linux/trunk/include/linux/squashfslzma_fs_i.h 2007-03-18 12:23:04 UTC (rev 917) @@ -0,0 +1,45 @@ +#ifndef SQUASHFS_FS_I +#define SQUASHFS_FS_I +/* + * Squashfs + * + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Phillip Lougher <ph...@lo...> + * + * 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, + * or (at your option) any later version. + * + * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * squashfs_fs_i.h + */ + +struct squashfs_inode_info { + long long start_block; + unsigned int offset; + union { + struct { + long long fragment_start_block; + unsigned int fragment_size; + unsigned int fragment_offset; + long long block_list_start; + } s1; + struct { + long long directory_index_start; + unsigned int directory_index_offset; + unsigned int directory_index_count; + unsigned int parent_inode; + } s2; + } u; + struct inode vfs_inode; +}; +#endif Added: linux4palm/linux/trunk/include/linux/squashfslzma_fs_sb.h =================================================================== --- linux4palm/linux/trunk/include/linux/squashfslzma_fs_sb.h (rev 0) +++ linux4palm/linux/trunk/include/linux/squashfslzma_fs_sb.h 2007-03-18 12:23:04 UTC (rev 917) @@ -0,0 +1,74 @@ +#ifndef SQUASHFS_FS_SB +#define SQUASHFS_FS_SB +/* + * Squashfs + * + * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Phillip Lougher <ph...@lo...> + * + * 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, + * or (at your option) any later version. + * + * 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, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * squashfs_fs_sb.h + */ + +#include <linux/squashfslzma_fs.h> +#include "../fs/squashfs_lzma/sqlzma.h" + +struct squashfs_cache { + long long block; + int length; + long long next_index; + char *data; +}; + +struct squashfs_fragment_cache { + long long block; + int length; + unsigned int locked; + char *data; +}; + +struct squashfs_sb_info { + struct squashfs_super_block sblk; + int devblksize; + int devblksize_log2; + int swap; + struct squashfs_cache *block_cache; + struct squashfs_fragment_cache *fragment; + int next_cache; + int next_fragment; + int next_meta_index; + unsigned int *uid; + unsigned int *guid; + long long *fragment_index; + unsigned int *fragment_index_2; + char *read_page; + //struct mutex read_data_mutex; + struct mutex read_page_mutex; + struct mutex block_cache_mutex; + struct mutex fragment_mutex; + struct mutex meta_index_mutex; + wait_queue_head_t waitq; + wait_queue_head_t fragment_wait_queue; + struct meta_index *meta_index; + long long *inode_lookup_table; + int (*read_inode)(struct inode *i, squashfs_inode_t \ + inode); + long long (*read_blocklist)(struct inode *inode, int \ + index, int readahead_blks, char *block_list, \ + unsigned short **block_p, unsigned int *bsize); + int (*read_fragment_index_table)(struct super_block *s); +}; +#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-16 15:25:52
|
Revision: 915 http://svn.sourceforge.net/hackndev/?rev=915&view=rev Author: z72ka Date: 2007-03-16 08:25:50 -0700 (Fri, 16 Mar 2007) Log Message: ----------- unionfs - added missing headers Added Paths: ----------- linux4palm/linux/trunk/include/linux/union_fs.h Added: linux4palm/linux/trunk/include/linux/union_fs.h =================================================================== --- linux4palm/linux/trunk/include/linux/union_fs.h (rev 0) +++ linux4palm/linux/trunk/include/linux/union_fs.h 2007-03-16 15:25:50 UTC (rev 915) @@ -0,0 +1,18 @@ +#ifndef _LINUX_UNION_FS_H +#define _LINUX_UNION_FS_H + +#define UNIONFS_VERSION "2.0" +/* + * DEFINITIONS FOR USER AND KERNEL CODE: + */ +# define UNIONFS_IOCTL_INCGEN _IOR(0x15, 11, int) +# define UNIONFS_IOCTL_QUERYFILE _IOR(0x15, 15, int) + +/* We don't support normal remount, but unionctl uses it. */ +# define UNIONFS_REMOUNT_MAGIC 0x4a5a4380 + +/* should be at least LAST_USED_UNIONFS_PERMISSION<<1 */ +#define MAY_NFSRO 16 + +#endif /* _LINUX_UNIONFS_H */ + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-16 14:40:44
|
Revision: 914 http://svn.sourceforge.net/hackndev/?rev=914&view=rev Author: z72ka Date: 2007-03-16 07:40:41 -0700 (Fri, 16 Mar 2007) Log Message: ----------- palmz72: defconfig - removed GPIO keys... at this time this driver craches wake-up Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig Modified: linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-03-15 19:57:36 UTC (rev 913) +++ linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-03-16 14:40:41 UTC (rev 914) @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.20-hnd0 -# Thu Mar 15 20:52:40 2007 +# Fri Mar 16 15:25:02 2007 # CONFIG_ARM=y # CONFIG_GENERIC_TIME is not set @@ -604,7 +604,7 @@ # CONFIG_KEYBOARD_XTKBD is not set # CONFIG_KEYBOARD_NEWTON is not set # CONFIG_KEYBOARD_STOWAWAY is not set -CONFIG_GPIO_KEYS=y +# CONFIG_GPIO_KEYS is not set CONFIG_KEYBOARD_PXA27x=y # CONFIG_KEYBOARD_PALMIR is not set CONFIG_KEYBOARD_PALMWK=m This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-15 19:57:38
|
Revision: 913 http://svn.sourceforge.net/hackndev/?rev=913&view=rev Author: z72ka Date: 2007-03-15 12:57:36 -0700 (Thu, 15 Mar 2007) Log Message: ----------- palmz72: defconfig - removed PM debug, GPIO modules as uni driver, added af_packet (for irda dumping etc...) Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig Modified: linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-03-15 19:50:29 UTC (rev 912) +++ linux4palm/linux/trunk/arch/arm/configs/palmz72_defconfig 2007-03-15 19:57:36 UTC (rev 913) @@ -1,7 +1,7 @@ # # Automatically generated make config: don't edit # Linux kernel version: 2.6.20-hnd0 -# Thu Mar 1 09:20:29 2007 +# Thu Mar 15 20:52:40 2007 # CONFIG_ARM=y # CONFIG_GENERIC_TIME is not set @@ -174,14 +174,13 @@ CONFIG_MACH_PALMZ72=y CONFIG_PALMZ72_PM=y CONFIG_PALMZ72_BATTERY=m -# CONFIG_GPIOED is not set -# CONFIG_GPIOEDNG is not set # CONFIG_MACH_OMAP_PALMTC is not set # CONFIG_MACH_ZIRE31 is not set +CONFIG_GPIOED=m +CONFIG_GPIOEDNG=m # CONFIG_PXA_SHARPSL is not set # CONFIG_MACH_TRIZEPS4 is not set CONFIG_PXA27x=y -CONFIG_PXA_RTC_EPOCH=1970 # # Linux As Bootloader @@ -283,9 +282,8 @@ # CONFIG_PM=y CONFIG_PM_LEGACY=y -CONFIG_PM_DEBUG=y +# CONFIG_PM_DEBUG is not set # CONFIG_DPM_DEBUG is not set -# CONFIG_DISABLE_CONSOLE_SUSPEND is not set # CONFIG_PM_SYSFS_DEPRECATED is not set CONFIG_APM=y @@ -298,7 +296,8 @@ # Networking options # # CONFIG_NETDEBUG is not set -# CONFIG_PACKET is not set +CONFIG_PACKET=m +# CONFIG_PACKET_MMAP is not set CONFIG_UNIX=y CONFIG_XFRM=y # CONFIG_XFRM_USER is not set @@ -773,6 +772,7 @@ # CONFIG_LEDS_TRIGGERS=y CONFIG_LEDS_TRIGGER_TIMER=y +# CONFIG_LEDS_TRIGGER_HWTIMER is not set CONFIG_LEDS_TRIGGER_MMC_CARD=y # CONFIG_LEDS_TRIGGER_HEARTBEAT is not set # CONFIG_LEDS_TRIGGER_SHARED is not set @@ -969,6 +969,7 @@ # CONFIG_RTC_LIB=y CONFIG_RTC_CLASS=m +CONFIG_RTC_EPOCH=1970 # # RTC interfaces This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-15 19:50:33
|
Revision: 912 http://svn.sourceforge.net/hackndev/?rev=912&view=rev Author: z72ka Date: 2007-03-15 12:50:29 -0700 (Thu, 15 Mar 2007) Log Message: ----------- squashfs: fixed build problem with gcc-4.1 used in OE build, this is a linux-rp patch for 2.6.20 Modified Paths: -------------- linux4palm/linux/trunk/include/linux/squashfs_fs.h linux4palm/linux/trunk/include/linux/squashfs_fs_i.h linux4palm/linux/trunk/include/linux/squashfs_fs_sb.h Modified: linux4palm/linux/trunk/include/linux/squashfs_fs.h =================================================================== --- linux4palm/linux/trunk/include/linux/squashfs_fs.h 2007-03-15 19:47:10 UTC (rev 911) +++ linux4palm/linux/trunk/include/linux/squashfs_fs.h 2007-03-15 19:50:29 UTC (rev 912) @@ -4,7 +4,7 @@ /* * Squashfs * - * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Copyright (c) 2002, 2003, 2004, 2005, 2006 * Phillip Lougher <ph...@lo...> * * This program is free software; you can redistribute it and/or @@ -72,7 +72,6 @@ #define SQUASHFS_NO_FRAG 4 #define SQUASHFS_ALWAYS_FRAG 5 #define SQUASHFS_DUPLICATE 6 -#define SQUASHFS_EXPORT 7 #define SQUASHFS_BIT(flag, bit) ((flag >> bit) & 1) @@ -94,16 +93,13 @@ #define SQUASHFS_DUPLICATES(flags) SQUASHFS_BIT(flags, \ SQUASHFS_DUPLICATE) -#define SQUASHFS_EXPORTABLE(flags) SQUASHFS_BIT(flags, \ - SQUASHFS_EXPORT) - #define SQUASHFS_CHECK_DATA(flags) SQUASHFS_BIT(flags, \ SQUASHFS_CHECK) #define SQUASHFS_MKFLAGS(noi, nod, check_data, nof, no_frag, always_frag, \ - duplicate_checking, exortable) (noi | (nod << 1) | (check_data << 2) \ + duplicate_checking) (noi | (nod << 1) | (check_data << 2) \ | (nof << 3) | (no_frag << 4) | (always_frag << 5) | \ - (duplicate_checking << 6) | (exportable << 7)) + (duplicate_checking << 6)) /* Max number of types and file types */ #define SQUASHFS_DIR_TYPE 1 @@ -157,7 +153,7 @@ #define SQUASHFS_MODE(a) ((a) & 0xfff) /* fragment and fragment table defines */ -#define SQUASHFS_FRAGMENT_BYTES(A) ((A) * sizeof(struct squashfs_fragment_entry)) +#define SQUASHFS_FRAGMENT_BYTES(A) (A * sizeof(struct squashfs_fragment_entry)) #define SQUASHFS_FRAGMENT_INDEX(A) (SQUASHFS_FRAGMENT_BYTES(A) / \ SQUASHFS_METADATA_SIZE) @@ -172,22 +168,6 @@ #define SQUASHFS_FRAGMENT_INDEX_BYTES(A) (SQUASHFS_FRAGMENT_INDEXES(A) *\ sizeof(long long)) -/* inode lookup table defines */ -#define SQUASHFS_LOOKUP_BYTES(A) ((A) * sizeof(squashfs_inode_t)) - -#define SQUASHFS_LOOKUP_BLOCK(A) (SQUASHFS_LOOKUP_BYTES(A) / \ - SQUASHFS_METADATA_SIZE) - -#define SQUASHFS_LOOKUP_BLOCK_OFFSET(A) (SQUASHFS_LOOKUP_BYTES(A) % \ - SQUASHFS_METADATA_SIZE) - -#define SQUASHFS_LOOKUP_BLOCKS(A) ((SQUASHFS_LOOKUP_BYTES(A) + \ - SQUASHFS_METADATA_SIZE - 1) / \ - SQUASHFS_METADATA_SIZE) - -#define SQUASHFS_LOOKUP_BLOCK_BYTES(A) (SQUASHFS_LOOKUP_BLOCKS(A) *\ - sizeof(long long)) - /* cached data constants for filesystem */ #define SQUASHFS_CACHED_BLKS 8 @@ -255,7 +235,7 @@ long long inode_table_start; long long directory_table_start; long long fragment_table_start; - long long lookup_table_start; + long long unused; } __attribute__ ((packed)); struct squashfs_dir_index { @@ -362,7 +342,7 @@ struct squashfs_fragment_entry { long long start_block; unsigned int size; - unsigned int pending; + unsigned int unused; } __attribute__ ((packed)); extern int squashfs_uncompress_block(void *d, int dstlen, void *s, int srclen); @@ -411,7 +391,7 @@ SQUASHFS_SWAP((s)->inode_table_start, d, 696, 64);\ SQUASHFS_SWAP((s)->directory_table_start, d, 760, 64);\ SQUASHFS_SWAP((s)->fragment_table_start, d, 824, 64);\ - SQUASHFS_SWAP((s)->lookup_table_start, d, 888, 64);\ + SQUASHFS_SWAP((s)->unused, d, 888, 64);\ } #define SQUASHFS_SWAP_BASE_INODE_CORE(s, d, n)\ @@ -527,8 +507,6 @@ SQUASHFS_SWAP((s)->size, d, 64, 32);\ } -#define SQUASHFS_SWAP_INODE_T(s, d) SQUASHFS_SWAP_LONG_LONGS(s, d, 1) - #define SQUASHFS_SWAP_SHORTS(s, d, n) {\ int entry;\ int bit_position;\ @@ -570,7 +548,6 @@ } #define SQUASHFS_SWAP_FRAGMENT_INDEXES(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n) -#define SQUASHFS_SWAP_LOOKUP_BLOCKS(s, d, n) SQUASHFS_SWAP_LONG_LONGS(s, d, n) #ifdef CONFIG_SQUASHFS_1_0_COMPATIBILITY Modified: linux4palm/linux/trunk/include/linux/squashfs_fs_i.h =================================================================== --- linux4palm/linux/trunk/include/linux/squashfs_fs_i.h 2007-03-15 19:47:10 UTC (rev 911) +++ linux4palm/linux/trunk/include/linux/squashfs_fs_i.h 2007-03-15 19:50:29 UTC (rev 912) @@ -3,7 +3,7 @@ /* * Squashfs * - * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Copyright (c) 2002, 2003, 2004, 2005, 2006 * Phillip Lougher <ph...@lo...> * * This program is free software; you can redistribute it and/or Modified: linux4palm/linux/trunk/include/linux/squashfs_fs_sb.h =================================================================== --- linux4palm/linux/trunk/include/linux/squashfs_fs_sb.h 2007-03-15 19:47:10 UTC (rev 911) +++ linux4palm/linux/trunk/include/linux/squashfs_fs_sb.h 2007-03-15 19:50:29 UTC (rev 912) @@ -3,7 +3,7 @@ /* * Squashfs * - * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 + * Copyright (c) 2002, 2003, 2004, 2005, 2006 * Phillip Lougher <ph...@lo...> * * This program is free software; you can redistribute it and/or @@ -53,18 +53,18 @@ unsigned int *guid; long long *fragment_index; unsigned int *fragment_index_2; + unsigned int read_size; + char *read_data; char *read_page; - struct mutex read_data_mutex; - struct mutex read_page_mutex; - struct mutex block_cache_mutex; - struct mutex fragment_mutex; - struct mutex meta_index_mutex; + struct semaphore read_data_mutex; + struct semaphore read_page_mutex; + struct semaphore block_cache_mutex; + struct semaphore fragment_mutex; + struct semaphore meta_index_mutex; wait_queue_head_t waitq; wait_queue_head_t fragment_wait_queue; struct meta_index *meta_index; - z_stream stream; - long long *inode_lookup_table; - int (*read_inode)(struct inode *i, squashfs_inode_t \ + struct inode *(*iget)(struct super_block *s, squashfs_inode_t \ inode); long long (*read_blocklist)(struct inode *inode, int \ index, int readahead_blks, char *block_list, \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-14 19:32:57
|
Revision: 910 http://svn.sourceforge.net/hackndev/?rev=910&view=rev Author: z72ka Date: 2007-03-14 12:32:46 -0700 (Wed, 14 Mar 2007) Log Message: ----------- Palmz72: removed gpio tools from palmz72 Kconfig and Makefile. This tool are now in Misc Devices - thx to Marex Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-03-13 18:09:24 UTC (rev 909) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-03-14 19:32:46 UTC (rev 910) @@ -20,18 +20,3 @@ help Enable support for PalmOne Zire 72 battery to APM. ATM use it only as module, otherwise it hangs. - -config GPIOED - tristate "GPIOED" - depends on MACH_PALMZ72 - default n - help - Gpioed: only for debuging and testing! - -config GPIOEDNG - tristate "GPIOEDNG" - depends on MACH_PALMZ72 - default n - help - Gpioed-ng: only for debuging and testing! - Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-03-13 18:09:24 UTC (rev 909) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-03-14 19:32:46 UTC (rev 910) @@ -5,5 +5,3 @@ obj-$(CONFIG_MACH_PALMZ72) += palmz72.o obj-$(CONFIG_PALMZ72_PM) += palmz72_pm.o obj-$(CONFIG_PALMZ72_BATTERY) += palmz72_battery.o -obj-$(CONFIG_GPIOED) += gpioed.o -obj-$(CONFIG_GPIOEDNG) += gpioed-ng.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-13 18:09:58
|
Revision: 909 http://svn.sourceforge.net/hackndev/?rev=909&view=rev Author: z72ka Date: 2007-03-13 11:09:24 -0700 (Tue, 13 Mar 2007) Log Message: ----------- Palmz72: make buildable with latest HH sync (commented irda... woks now too) fixed gpiokeys - at this time only for experimenting Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-03-12 22:08:05 UTC (rev 908) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-03-13 18:09:24 UTC (rev 909) @@ -32,10 +32,8 @@ #include <asm/arch/pxapwm-bl.h> #include <asm/arch/irda.h> #include <asm/arch/serial.h> -#include <asm/hardware/gpio_keys.h> +#include <linux/gpio_keys.h> - - #include <asm/arch/udc.h> #include <asm/arch/irda.h> #include <asm/arch/mmc.h> @@ -145,7 +143,7 @@ .nr_cols = 3, .keycodes = { { /* row 0 */ - KEY_POWER, /* Power key */ + KEY_F8, /* Power key */ KEY_F11, /* Photos */ KEY_ENTER, /* DPAD Center */ }, @@ -155,15 +153,15 @@ KEY_F12, /* Media */ }, { /* row 2 */ - KEY_UP, /* D-PAD UP */ + KEY_LEFT, /* D-PAD UP */ 0, /* unused */ - KEY_DOWN, /* D-PAD DOWN */ + KEY_RIGHT, /* D-PAD DOWN */ }, { /* row 3 */ - KEY_RIGHT, /* D-PAD RIGHT */ + KEY_UP, /* D-PAD RIGHT */ 0, /* unused */ - KEY_LEFT, /* D-PAD LEFT */ + KEY_DOWN, /* D-PAD LEFT */ }, }, .gpio_modes = { @@ -189,9 +187,9 @@ /******************************** * GPIO Key - Voice Memo Button * ********************************/ - +#ifdef CONFIG_GPIO_KEYS static struct gpio_keys_button palmz72_pxa_buttons[] = { - {KEY_F7, GPIO_NR_PALMZ72_KP_DKIN7, 1, "Voice Memo Button" }, + {KEY_F7, GPIO_NR_PALMZ72_KP_DKIN7, 0, "Voice Memo Button" }, }; static struct gpio_keys_platform_data palmz72_pxa_keys_data = { @@ -205,23 +203,23 @@ .platform_data = &palmz72_pxa_keys_data, }, }; +#endif - /******** * IRDA * ********/ - +/* static void palmz72_irda_configure (struct uart_pxa_port *up, int enable) { - /* Switch STUART RX/TX pins to SIR */ + // Switch STUART RX/TX pins to SIR pxa_gpio_mode( GPIO_NR_PALMZ72_STD_RXD_MD ); pxa_gpio_mode( GPIO_NR_PALMZ72_STD_TXD_MD ); - /* make sure FIR ICP is off */ + // make sure FIR ICP is off ICCR0 = 0; if (enable) { - /* configure STUART to for SIR */ + // configure STUART to for SIR STISR = STISR_XMODE | STISR_RCVEIR | STISR_RXPL; GPSR(91) = GPIO_bit(91); } else { @@ -236,7 +234,7 @@ unsigned new_stisr = old_stisr; if (txrx & PXA_SERIAL_TX) { - /* Ignore RX if TX is set */ + // Ignore RX if TX is set txrx &= PXA_SERIAL_TX; new_stisr |= STISR_XMITIR; } else @@ -267,7 +265,7 @@ .set_txrx = palmz72_irda_set_txrx, .get_txrx = palmz72_irda_get_txrx, }; - +*/ /************************* * AC97 audio controller * *************************/ @@ -343,7 +341,6 @@ .vsync_len = 1, .upper_margin = 7, // This value is optimized for older problematic LCD panels .lower_margin = 8, // This value is optimized for older problematic LCD panels -// .sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT, } }; @@ -376,7 +373,10 @@ &palmz72_pm, &palmz72_backlight, &palmz72_keypad, + //&palmz72_pxa_irda_funcs +#ifdef CONFIG_GPIO_KEYS &palmz72_pxa_keys, +#endif &palmz72_led_device, }; @@ -409,7 +409,7 @@ set_pxa_fb_info( &palmz72_lcd_screen ); pxa_set_mci_info( &palmz72_mci_platform_data ); pxa_set_udc_info(&palmz72_udc_mach_info ); - stuart_device.dev.platform_data = &palmz72_pxa_irda_funcs; + //stuart_device.dev.platform_data = &palmz72_pxa_irda_funcs; platform_add_devices( devices, ARRAY_SIZE(devices) ); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sle...@us...> - 2007-03-12 22:08:12
|
Revision: 908 http://svn.sourceforge.net/hackndev/?rev=908&view=rev Author: sleep_walker Date: 2007-03-12 15:08:05 -0700 (Mon, 12 Mar 2007) Log Message: ----------- l4p: T|T3 TSC2101 dependency fix - can be built in kernel Modified Paths: -------------- linux4palm/linux/trunk/drivers/soc/Kconfig Modified: linux4palm/linux/trunk/drivers/soc/Kconfig =================================================================== --- linux4palm/linux/trunk/drivers/soc/Kconfig 2007-03-12 18:57:34 UTC (rev 907) +++ linux4palm/linux/trunk/drivers/soc/Kconfig 2007-03-12 22:08:05 UTC (rev 908) @@ -91,7 +91,9 @@ config SOC_TSC2101 tristate "Support for TI TSC2101 Touchscreen and Audio Codec" - depends on TOUCHSCREEN_TSC2101 && SND_PXA2xx_I2SOUND + depends on TOUCHSCREEN_TSC2101 + select SND_PXA2xx_I2SOUND + select SND_PXA2XX_AC97 help Support for TI TSC2101 Touchscreen and Audio Codec This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <z7...@us...> - 2007-03-12 18:57:49
|
Revision: 907 http://svn.sourceforge.net/hackndev/?rev=907&view=rev Author: z72ka Date: 2007-03-12 11:57:34 -0700 (Mon, 12 Mar 2007) Log Message: ----------- fixed bad Kconfig Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig 2007-03-12 13:39:32 UTC (rev 906) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig 2007-03-12 18:57:34 UTC (rev 907) @@ -54,7 +54,6 @@ source "arch/arm/mach-pxa/palmz72/Kconfig" source "arch/arm/mach-pxa/palmtc/Kconfig" source "arch/arm/mach-pxa/palmz31/Kconfig" -source "arch/arm/mach-pxa/plat-recon/Kconfig" config PXA_SHARPSL bool "SHARP Zaurus SL-5600, SL-C7xx and SL-Cxx00 Models" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sle...@us...> - 2007-03-10 09:35:35
|
Revision: 905 http://svn.sourceforge.net/hackndev/?rev=905&view=rev Author: sleep_walker Date: 2007-03-10 01:35:33 -0800 (Sat, 10 Mar 2007) Log Message: ----------- l4p: forgotten change related to PalmOS RTC problem fix candidate Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/time.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/time.c =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/time.c 2007-03-10 00:22:34 UTC (rev 904) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/time.c 2007-03-10 09:35:33 UTC (rev 905) @@ -29,7 +29,12 @@ #include <asm/mach/time.h> #include <asm/arch/pxa-regs.h> -#define PL_ODDS (1970-CONFIG_PXA_RTC_EPOCH) +#ifdef CONFIG_RTC_EPOCH +#define PL_ODDS (1970-CONFIG_RTC_EPOCH) +#else +#define PL_ODDS 0 +#endif + #define SECS_PER_DAY 24*60*60 #define SECS_PER_LEAP (SECS_PER_DAY*366) #define SECS_PER_OTHER (SECS_PER_DAY*365) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <bal...@us...> - 2007-03-10 00:22:36
|
Revision: 904 http://svn.sourceforge.net/hackndev/?rev=904&view=rev Author: balrog-kun Date: 2007-03-09 16:22:34 -0800 (Fri, 09 Mar 2007) Log Message: ----------- l4p: ENRINTR is too cool - removing :p Modified Paths: -------------- linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxa-regs.h Modified: linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxa-regs.h =================================================================== --- linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxa-regs.h 2007-03-10 00:20:31 UTC (rev 903) +++ linux4palm/linux/trunk/include/asm-arm/arch-pxa/pxa-regs.h 2007-03-10 00:22:34 UTC (rev 904) @@ -100,7 +100,6 @@ #define DCSR_CLRCMPST (1 << 24) /* Clear Descriptor Compare Status */ #define DCSR_CMPST (1 << 10) /* The Descriptor Compare Status */ #define DCSR_EORINTR (1 << 9) /* The end of Receive */ -#define DCSR_ENRINTR (1 << 9) /* The end of Receive */ #endif #define DCSR_REQPEND (1 << 8) /* Request Pending (read-only) */ #define DCSR_STOPSTATE (1 << 3) /* Stop State (read-only) */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sle...@us...> - 2007-03-10 00:20:35
|
Revision: 903 http://svn.sourceforge.net/hackndev/?rev=903&view=rev Author: sleep_walker Date: 2007-03-09 16:20:31 -0800 (Fri, 09 Mar 2007) Log Message: ----------- l4p: RTC Palm problem fix candidate Modified Paths: -------------- linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig linux4palm/linux/trunk/drivers/rtc/Kconfig linux4palm/linux/trunk/drivers/rtc/rtc-lib.c Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig =================================================================== --- linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig 2007-03-10 00:13:47 UTC (rev 902) +++ linux4palm/linux/trunk/arch/arm/mach-pxa/Kconfig 2007-03-10 00:20:31 UTC (rev 903) @@ -184,13 +184,6 @@ to work around certain bootloaders overwriting them during resume. -config PXA_RTC_EPOCH - int "PXA RTC epoch year" - default "1970" - help - The default Linux epoch Jan 1st 1970, however to - operate alongside PalmOS nicely, change this to 1904. - config PXA_SUSPEND_SAVE_EXTRA_REGS bool help Modified: linux4palm/linux/trunk/drivers/rtc/Kconfig =================================================================== --- linux4palm/linux/trunk/drivers/rtc/Kconfig 2007-03-10 00:13:47 UTC (rev 902) +++ linux4palm/linux/trunk/drivers/rtc/Kconfig 2007-03-10 00:20:31 UTC (rev 903) @@ -37,6 +37,13 @@ The RTC device that will be used as the source for the system time, usually rtc0. +config RTC_EPOCH + int "RTC epoch year" + default "1970" + help + The default Linux epoch Jan 1st 1970, however to + operate alongside PalmOS nicely, change this to 1904. + config RTC_DEBUG bool "RTC debug support" depends on RTC_CLASS = y Modified: linux4palm/linux/trunk/drivers/rtc/rtc-lib.c =================================================================== --- linux4palm/linux/trunk/drivers/rtc/rtc-lib.c 2007-03-10 00:13:47 UTC (rev 902) +++ linux4palm/linux/trunk/drivers/rtc/rtc-lib.c 2007-03-10 00:20:31 UTC (rev 903) @@ -28,6 +28,12 @@ #define LEAPS_THRU_END_OF(y) ((y)/4 - (y)/100 + (y)/400) #define LEAP_YEAR(year) ((!(year % 4) && (year % 100)) || !(year % 400)) +#ifdef CONFIG_RTC_EPOCH +#define EPOCH_YEAR CONFIG_RTC_EPOCH +#else +#define EPOCH_YEAR 1970 +#endif + /* * The number of days in the month. */ @@ -46,8 +52,14 @@ } EXPORT_SYMBOL(rtc_year_days); +#define EPOCH_YEAR_DAYS_DIFFERENCE ((1970 - EPOCH_YEAR) * 365 - LEAPS_THRU_END_OF(EPOCH_YEAR - 1)) + + /* * Convert seconds since 01-01-1970 00:00:00 to Gregorian date. + + * Added support for other years than 1970 + * needed for example for Palm PDAs */ void rtc_time_to_tm(unsigned long time, struct rtc_time *tm) { @@ -57,12 +69,14 @@ time -= days * 86400; /* day of the week, 1970-01-01 was a Thursday */ - tm->tm_wday = (days + 4) % 7; + /* and between 1970-01-01 and EPOCH_YEAR was EPOCH_YEAR_DAYS_DIFFERENCE days */ + tm->tm_wday = (days + EPOCH_YEAR_DAYS_DIFFERENCE + 4) % 7; - year = 1970 + days / 365; - days -= (year - 1970) * 365 - + LEAPS_THRU_END_OF(year - 1) - - LEAPS_THRU_END_OF(1970 - 1); + year = EPOCH_YEAR + days / 365; + days -= (year - EPOCH_YEAR) * 365 + + LEAPS_THRU_END_OF(year - 1) + - LEAPS_THRU_END_OF(EPOCH_YEAR - 1); + if (days < 0) { year -= 1; days += 365 + LEAP_YEAR(year); @@ -93,8 +107,7 @@ */ int rtc_valid_tm(struct rtc_time *tm) { - if (tm->tm_year < 70 - || ((unsigned)tm->tm_mon) >= 12 + if (((unsigned)tm->tm_mon) >= 12 || tm->tm_mday < 1 || tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900) || ((unsigned)tm->tm_hour) >= 24 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |