|
From: <z7...@us...> - 2007-01-18 08:40:53
|
Revision: 764
http://svn.sourceforge.net/hackndev/?rev=764&view=rev
Author: z72ka
Date: 2007-01-18 00:40:52 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
Palmz72: - Added suspend/resume support
- fixing bug with some SD/MMC
- modifiing AC status
- modifiing udc detecting
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_ac97.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-01-18 08:27:14 UTC (rev 763)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-01-18 08:40:52 UTC (rev 764)
@@ -95,7 +95,7 @@
GPIO_93 1 I 02 CIF_DD6
GPIO_94 0 I 00
GPIO_95 0 O 00 USB_POWER
-GPIO_96 1 O 00
+GPIO_96 1 O 00 LCD_POWER (LCD OFF when 0)
GPIO_97 0 I 03 KP_MKIN3
GPIO_98 1 O 00
GPIO_99 1 I 00
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-01-18 08:27:14 UTC (rev 763)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-01-18 08:40:52 UTC (rev 764)
@@ -103,12 +103,17 @@
.id = -1,
};
+/* USB */
static int palmz72_udc_is_connected(void)
{
int ret = !(GET_GPIO(GPIO_NR_PALMZ72_USB_DETECT));
- printk (KERN_INFO "palmz72_udc: gpio status is %d\n",ret);
- return ret;
+ if (ret)
+ printk (KERN_INFO "palmz72_udc: device detected [USB_DETECT: %d]\n",ret);
+ else
+ printk (KERN_INFO "palmz72_udc: no device detected [USB_DETECT: %d]\n",ret);
+
+ return ret;
}
static void palmz72_udc_command (int cmd){
@@ -183,13 +188,15 @@
},
};
+
+/* 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;
@@ -273,16 +280,6 @@
-#if 0
-
-/* touchscreen */
-
-static struct platform_device palmz72_touch = {
- .name = "wm97xx",
- .id = -1,
-};
-
-#endif
/**
* Backlight
*/
@@ -309,7 +306,6 @@
static struct platform_device *devices[] __initdata = {
&palmz72_ac97,
- //&palmz72_touch,
&palmz72_backlight,
&palmz72_keypad,
&palmz72led_device,
@@ -363,9 +359,14 @@
palmz72lcd.lccr3=0x04700007;
break;
}
+
+#ifdef CONFIG_PM
+ extern struct pxa_ll_pm_ops palmz72_ll_pm_ops;
+ pxa_pm_set_ll_ops(&palmz72_ll_pm_ops);
+#endif
set_pxa_fb_info(&palmz72lcd);
pxa_set_mci_info( &palmz72_mci_platform_data );
- pxa_set_udc_info(&palmz72_udc_mach_info );
+ pxa_set_udc_info(&palmz72_udc_mach_info );
stuart_device.dev.platform_data = &palmz72_pxa_irda_funcs;
platform_add_devices( devices, ARRAY_SIZE(devices) );
#if 0
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c 2007-01-18 08:27:14 UTC (rev 763)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c 2007-01-18 08:40:52 UTC (rev 764)
@@ -147,14 +147,6 @@
ac97->bus->ops->write(ac97, AC97_WM97XX_DIGITISER2, d2base | value);
}
-
-/*
- * note: for the TX there's some code that gets enabled in linux/sound/pxa2xx-ac97.c
- * (ifdef CONFIG_MACH_PALMZ72) that tries to implement some recommended procedure for
- * reading/writing reg 0x54 from a Intel's document
- * (PXA27x Specification Update: 28007109.pdf sec.: E54)
- */
-
static int palmz72_ac97_take_reading(int adcsel)
{
@@ -280,6 +272,49 @@
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 */
@@ -324,7 +359,7 @@
{
if (battery_registered){
palmz72_battery_read_adc(0);
- //printk("Battery [mV]: %d\n", current_voltage + PALMZ72_BMON_TO_VBATT );
+ //printk("Battery [mV]: %d\n", current_voltage * 1889/1000 + 7678/10 );
return current_voltage * 1889/1000 + 7678/10;
}
else{
@@ -363,8 +398,6 @@
};
-
-
static int __init palmz72_ac97_probe(struct device *dev)
{
int err;
@@ -445,7 +478,8 @@
}
static int palmz72_ac_is_connected (void){
- int ret = !(GET_GPIO(GPIO_NR_PALMZ72_POWER_DETECT));
+ /* when charger is plugged and USB si 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
@@ -519,8 +553,8 @@
.remove = palmz72_ac97_remove,
#ifdef CONFIG_PM
- .suspend = NULL,
- .resume = NULL,
+ .suspend = palmz72_ac97_suspend,
+ .resume = palmz72_ac97_resume,
#endif
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|