|
From: <hap...@us...> - 2006-10-06 10:05:56
|
Revision: 621
http://svn.sourceforge.net/hackndev/?rev=621&view=rev
Author: happy-slapin
Date: 2006-10-06 03:05:40 -0700 (Fri, 06 Oct 2006)
Log Message:
-----------
z72: Finally made keypad work again
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
Removed Paths:
-------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2006-10-06 09:27:14 UTC (rev 620)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2006-10-06 10:05:40 UTC (rev 621)
@@ -3,12 +3,3 @@
select PXA27x
help
This enables support for Palm Zire 72 handheld.
-
-config PALMZ72_BUTTONS
- tristate "Palm LifeDrive buttons driver"
- depends on MACH_PALMZ72
- default y
- help
- This driver translates button presses on a Palm
- Zire 72 to Linux input subsystem events.
-
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2006-10-06 09:27:14 UTC (rev 620)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2006-10-06 10:05:40 UTC (rev 621)
@@ -3,4 +3,3 @@
#
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
-obj-$(CONFIG_PALMZ72_BUTTONS) += palmz72_buttons.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2006-10-06 09:27:14 UTC (rev 620)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2006-10-06 10:05:40 UTC (rev 621)
@@ -9,6 +9,7 @@
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/input.h>
#include <asm/mach/arch.h>
#include <asm/mach-types.h>
#include <asm/arch/hardware.h>
@@ -114,17 +115,17 @@
},
.gpio_modes = {
- GPIO_NR_PALMZ72_KP_MKIN0_MD,
- GPIO_NR_PALMZ72_KP_MKIN1_MD,
- GPIO_NR_PALMZ72_KP_MKIN2_MD,
- GPIO_NR_PALMZ72_KP_MKIN3_MD,
- GPIO_NR_PALMZ72_KP_MKOUT0_MD,
- GPIO_NR_PALMZ72_KP_MKOUT1_MD,
- GPIO_NR_PALMZ72_KP_MKOUT2_MD,
+ GPIO_NR_ZIRE72_KP_MKIN0_MD,
+ GPIO_NR_ZIRE72_KP_MKIN1_MD,
+ GPIO_NR_ZIRE72_KP_MKIN2_MD,
+ GPIO_NR_ZIRE72_KP_MKIN3_MD,
+ GPIO_NR_ZIRE72_KP_MKOUT0_MD,
+ GPIO_NR_ZIRE72_KP_MKOUT1_MD,
+ GPIO_NR_ZIRE72_KP_MKOUT2_MD,
},
};
-static struct platform_device palmld_kbd = {
+static struct platform_device palmz72_keypad = {
.name = "pxa27x-keyboard",
.id = -1,
.dev = {
Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c 2006-10-06 09:27:14 UTC (rev 620)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_buttons.c 2006-10-06 10:05:40 UTC (rev 621)
@@ -1,201 +0,0 @@
-/*
- * linux/arch/arm/mach-pxa/zire72/zire72-buttons.c
- *
- * Button driver for Palm Zire 72
- *
- * Author: Alex Osborne <bob...@gm...>
- * Author: Sergey Lapin <sla...@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/platform_device.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 <asm/arch/palmz72-gpio.h>
-
-#define KPASMKP(col) (col/2==0 ? KPASMKP0 : KPASMKP1)
-#define KPASMKPx_MKC(row, col) (1 << (row + 16*(col%2)))
-
-#define ZIRE72_KM_ROWS 4
-#define ZIRE72_KM_COLS 3
-
-
-static struct {
- int keycode;
- char *desc;
-} button_matrix[ZIRE72_KM_ROWS][ZIRE72_KM_COLS] = {
- { /* row 0 */
- { -1, "(unused)" }, // suspend is here
- { KEY_P, "Picture" },
- { KEY_ENTER, "Center" },
- }, { /* row 1 */
- { KEY_T, "Tasks" },
- { KEY_C, "Contacts" },
- { KEY_M, "Music" },
- }, { /* row 2 */
- { KEY_UP, "Up" },
- { -1, "(unused)" }, // not found
- { KEY_DOWN, "Down" },
- }, { /* row 3 */
- { KEY_RIGHT, "Right" },
- { KEY_ENTER, "Center" },
- { KEY_LEFT, "Left" },
- }
-};
-
-static struct input_dev *button_dev;
-
-static void zire72_buttons_report_event(int row, int col, int pressed)
-{
-#if 1
- if(row >= ZIRE72_KM_ROWS || col >= ZIRE72_KM_COLS) {
- printk(KERN_ERR "zire72_buttons_report_event: out of bounds "
- "key event row=%d col=%d pressed=%d\n", row, col,
- pressed);
- return;
- }
-
- if( button_matrix[row][col].keycode >= 0 ) {
- input_report_key(button_dev, button_matrix[row][col].keycode, pressed);
- }
-#else
-printk(KERN_INFO "palmz72_buttons_report_event: "
- "key event row=%d col=%d pressed=%d\n", row, col,
- pressed);
-#endif
-}
-
-static irqreturn_t zire72_keypad_irq_handler(int irq, void *dev_id, struct pt_regs *regs)
-{
- int mi;
- int row=-1, col=-1;
-
-
- /*
- * notify controller that interrupt was handled, otherwise it'll
- * constantly send interrupts and lock up the device.
- */
- mi = KPC & KPC_MI;
-
- /* report the status of every button */
- for(row=0; row < ZIRE72_KM_ROWS; row++) {
- for(col=0; col < ZIRE72_KM_COLS; col++) {
- zire72_buttons_report_event(row, col, KPASMKP(col) & KPASMKPx_MKC(row, col));
- }
- }
-
- return IRQ_HANDLED;
-}
-
-static int __init zire72_buttons_probe(struct device *dev)
-{
- int err;
- int row, col;
-
-/* if(!machine_is_xscale_zire72())
- return -ENODEV;
-*/
- button_dev = input_allocate_device();
- button_dev->evbit[0] = BIT(EV_KEY);
- for(row=0; row < ZIRE72_KM_ROWS; row++) {
- for(col=0; col < ZIRE72_KM_COLS; col++) {
- if( button_matrix[row][col].keycode >= 0 ) {
- button_dev->keybit[ LONG
- (button_matrix[row][col].keycode)] |=
- BIT(button_matrix[row][col].keycode);
- }
- }
- }
-
- button_dev->name = "Palm Zire 72 buttons";
- button_dev->id.bustype = BUS_HOST;
- input_register_device(button_dev);
-
-
- /*
- * setup GPIOs for the LifeDrive keypad matrix
- */
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN0_MD);
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN1_MD);
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN2_MD);
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKIN3_MD);
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKOUT0_MD);
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKOUT1_MD);
- pxa_gpio_mode(GPIO_NR_ZIRE72_KP_MKOUT2_MD);
-
-
- /*
- * setup the PXA270 keypad controller for automatic on-activity scanning
- */
- KPC |= ZIRE72_KM_ROWS << 26; /* lifedrive keypad matrix has 4 rows */
- KPC |= ZIRE72_KM_COLS << 23; /* and 3 columns */
-
- KPC |= KPC_ASACT; /* enable automatic scan on activity */
- KPC &= ~KPC_AS; /* disable automatic scan */
- KPC &= ~KPC_IMKP; /* do not ignore multiple keypresses */
-
- KPC &= ~KPC_DE; /* disable direct keypad */
- KPC &= ~KPC_DIE; /* disable direct keypad interrupt */
-
- err = request_irq(IRQ_KEYPAD, zire72_keypad_irq_handler, SA_INTERRUPT,
- "keypad", NULL);
- if(err) {
- printk(KERN_ERR "zire72_buttons_probe: cannot request keypad IRQ\n");
- return -1;
- }
-
- KPC |= KPC_ME; /* matrix keypad enabled */
- KPC |= KPC_ME; /* matrix keypad interrupt enabled */
-
- return 0;
-}
-
-static int zire72_buttons_remove (struct device *dev)
-{
- free_irq(IRQ_KEYPAD, NULL);
- return 0;
-}
-
-static struct device_driver zire72_buttons_driver = {
- .name = "zire72-buttons",
- .bus = &platform_bus_type,
- .probe = zire72_buttons_probe,
- .remove = zire72_buttons_remove,
-#ifdef CONFIG_PM
- .suspend = NULL,
- .resume = NULL,
-#endif
-};
-
-static int __init zire72_buttons_init(void)
-{
-/* if(!machine_is_xscale_zire72())
- return -ENODEV;
-*/
- return driver_register(&zire72_buttons_driver);
-}
-
-static void __exit zire72_buttons_exit(void)
-{
- input_unregister_device(button_dev);
- driver_unregister(&zire72_buttons_driver);
-}
-
-module_init(zire72_buttons_init);
-module_exit(zire72_buttons_exit);
-
-MODULE_AUTHOR ("Alex Osborne <bob...@gm...>");
-MODULE_AUTHOR ("Sergey Lapin <sla...@gm...>");
-MODULE_DESCRIPTION ("Button support for Palm Zire 72");
-MODULE_LICENSE ("GPL");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <z7...@us...> - 2007-01-08 10:27:42
|
Revision: 741
http://svn.sourceforge.net/hackndev/?rev=741&view=rev
Author: z72ka
Date: 2007-01-08 02:27:39 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
Added gpioed and gpioed-ng for developing (as modules)
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
Added Paths:
-----------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-01-08 10:24:30 UTC (rev 740)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-01-08 10:27:39 UTC (rev 741)
@@ -4,3 +4,26 @@
select KEYBOARD_PXA27x
help
This enables support for Palm Zire 72 handheld.
+
+config PALMZ72_AC97
+ tristate "Palm Zire 72 AC97 Driver"
+ depends on MACH_PALMZ72
+ default y if MACH_PALMZ72
+ help
+ Enable support for WM9712 touchscreen and battery driver for
+ the PalmOne Zire 72 PDA
+
+config GPIOED
+ tristate "GPIOED"
+ depends on MACH_PALMZ72
+ default n
+ help
+ Only for debuging and testing
+
+config GPIOEDNG
+ tristate "GPIOEDNG"
+ depends on MACH_PALMZ72
+ default n
+ help
+ Gpioed-ng only for debugging and testing
+
\ No newline at end of file
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-01-08 10:24:30 UTC (rev 740)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-01-08 10:27:39 UTC (rev 741)
@@ -3,3 +3,6 @@
#
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
+obj-$(CONFIG_PALMZ72_AC97) += palmz72_ac97.o
+obj-$(CONFIG_GPIOED) += gpioed.o
+obj-$(CONFIG_GPIOEDNG) += gpioed-ng.o
Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c (rev 0)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed-ng.c 2007-01-08 10:27:39 UTC (rev 741)
@@ -0,0 +1,175 @@
+#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");
+
Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c (rev 0)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpioed.c 2007-01-08 10:27:39 UTC (rev 741)
@@ -0,0 +1,226 @@
+/*** 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");
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <z7...@us...> - 2007-01-18 08:27:15
|
Revision: 763
http://svn.sourceforge.net/hackndev/?rev=763&view=rev
Author: z72ka
Date: 2007-01-18 00:27:14 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
Palmz72: Added suspend/resume support
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-01-18 08:25:56 UTC (rev 762)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-01-18 08:27:14 UTC (rev 763)
@@ -12,6 +12,13 @@
help
Enable support for WM9712 touchscreen and battery driver for
the PalmOne Zire 72 PDA
+
+config PALMZ72_PM
+ tristate "Palm Zire 72 Power Management support"
+ depends on MACH_PALMZ72
+ default y if MACH_PALMZ72
+ help
+ Enable support for suspend/resume the PalmOne Zire 72 PDA
config GPIOED
tristate "GPIOED"
@@ -26,4 +33,5 @@
default n
help
Gpioed-ng only for debugging and testing
+
\ No newline at end of file
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-01-18 08:25:56 UTC (rev 762)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-01-18 08:27:14 UTC (rev 763)
@@ -4,5 +4,6 @@
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
obj-$(CONFIG_PALMZ72_AC97) += palmz72_ac97.o
+obj-$(CONFIG_PALMZ72_PM) += palmz72_pm.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-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.
|
|
From: <z7...@us...> - 2007-01-23 18:09:32
|
Revision: 776
http://svn.sourceforge.net/hackndev/?rev=776&view=rev
Author: z72ka
Date: 2007-01-23 10:08:22 -0800 (Tue, 23 Jan 2007)
Log Message:
-----------
Palmz72: - Partially fixed problems with old LCD panels
- new power management driver (suspend/resume support)
- clear code (for lucidity)
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-01-23 09:53:18 UTC (rev 775)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-01-23 18:08:22 UTC (rev 776)
@@ -1,12 +1,12 @@
-/*
- * Hardware definitions for Palm Zire 72
- *
- * Authors:
- * Vladimir "Farcaller" Pouzanov <far...@gm...>
- * Sergey Lapin <sla...@gm...>
- * Alex Osborne <bob...@gm...>
- * Jan Herman <2h...@se...>
- */
+/****************************************************************
+ * Hardware definitions for PalmOne Zire 72 *
+ * *
+ * Authors: *
+ * Vladimir "Farcaller" Pouzanov <far...@gm...> *
+ * Sergey Lapin <sla...@gm...> *
+ * Alex Osborne <bob...@gm...> *
+ * Jan Herman <2h...@se...> *
+ ****************************************************************/
#include <linux/kernel.h>
#include <linux/init.h>
@@ -50,34 +50,26 @@
#define DEBUG
-#define IR_TRANSCEIVER_ON \
- SET_HX4700_GPIO_N(IR_ON, 1)
-
-#define IR_TRANSCEIVER_OFF \
- SET_HX4700_GPIO_N(IR_ON, 0)
-
-
-/**
- * SD/MMC card controller
- */
+/**************************
+ * SD/MMC card controller *
+ **************************/
static int palmz72_mci_init(struct device *dev, irqreturn_t (*palmz72_detect_int)(int, void *, struct pt_regs *), void *data)
{
int err;
- /**
+ /*
* Setup an interrupt for detecting card insert/remove events
*/
set_irq_type(IRQ_GPIO_PALMZ72_SD_DETECT_N, IRQT_BOTHEDGE);
err = request_irq(IRQ_GPIO_PALMZ72_SD_DETECT_N, palmz72_detect_int,
- SA_INTERRUPT, "SD/MMC card detect", data);
+ SA_INTERRUPT, "SD/MMC card detected", data);
if(err) {
printk(KERN_ERR "palmz72_mci_init: cannot request SD/MMC card detect IRQ\n");
return -1;
}
-
printk("palmz72_mci_init: irq registered\n");
return 0;
@@ -96,14 +88,18 @@
};
-/* * LED */
+/*******
+ * LED *
+ *******/
-static struct platform_device palmz72led_device = {
+static struct platform_device palmz72_led_device = {
.name = "palmz72-led",
.id = -1,
};
-/* USB */
+/*******
+ * USB *
+ *******/
static int palmz72_udc_is_connected(void)
{
@@ -138,34 +134,34 @@
.udc_command = palmz72_udc_command,
};
-/*
- * Keypad
- */
+/**********
+ * Keypad *
+ **********/
static struct pxa27x_keyboard_platform_data palmz72_kbd_data = {
.nr_rows = 4,
.nr_cols = 3,
.keycodes = {
{ /* row 0 */
- KEY_POWER, /* Power KEY */
- KEY_F13, /* Photos */
- KEY_ENTER, /* DPAD Center*/
+ KEY_POWER, /* Power key */
+ KEY_F13, /* Photos */
+ KEY_ENTER, /* DPAD Center */
},
{ /* row 1 */
- KEY_F9, /* Calendar*/
- KEY_F10, /* Contacts */
- KEY_F12, /* Media */
+ KEY_F9, /* Calendar */
+ KEY_F10, /* Contacts */
+ KEY_F12, /* Media */
},
{ /* row 2 */
- KEY_UP, /* D-PAD UP*/
- KEY_V, /* unused */
- KEY_DOWN, /* D-PAD DOWN */
+ KEY_UP, /* D-PAD UP */
+ 0, /* unused */
+ KEY_DOWN, /* D-PAD DOWN */
},
{
/* row 3 */
- KEY_RIGHT, /* D-PAD RIGHT */
- KEY_S, /* ?? */
- KEY_LEFT, /* D-PAD LEFT */
+ KEY_RIGHT, /* D-PAD RIGHT */
+ 0, /* unused */
+ KEY_LEFT, /* D-PAD LEFT */
},
},
.gpio_modes = {
@@ -189,7 +185,9 @@
};
-/* IRDA */
+/********
+ * IRDA *
+ ********/
static void
palmz72_irda_configure (struct uart_pxa_port *up, int enable)
@@ -204,15 +202,9 @@
/* configure STUART to for SIR */
STISR = STISR_XMODE | STISR_RCVEIR | STISR_RXPL;
GPSR(91) = GPIO_bit(91);
-
-// STIER = STIER | IER_UUE;
- //IR_TRANSCEIVER_ON;
} else {
STISR = 0;
-// GPCR(91) = GPIO_bit(91);
-// STIER = STIER & ~IER_UUE;
- //IR_TRANSCEIVER_OFF;
- }
+ }
}
static void
@@ -236,9 +228,7 @@
if (new_stisr != old_stisr) {
while (!(STLSR & LSR_TEMT))
;
- //IR_TRANSCEIVER_OFF;
STISR = new_stisr;
- //IR_TRANSCEIVER_ON;
}
}
@@ -256,9 +246,9 @@
.get_txrx = palmz72_irda_get_txrx,
};
-/**
- * AC97 audio controller
- */
+/*************************
+ * AC97 audio controller *
+ *************************/
static pxa2xx_audio_ops_t palmz72_audio_ops = {
@@ -280,9 +270,9 @@
-/**
- * Backlight
- */
+/*************
+ * Backlight *
+ *************/
#define PALMZ72_MAX_INTENSITY 0x100
#define PALMZ72_DEFAULT_INTENSITY 0x7E
@@ -304,33 +294,64 @@
},
};
-static struct platform_device *devices[] __initdata = {
- &palmz72_ac97,
- &palmz72_backlight,
- &palmz72_keypad,
- &palmz72led_device,
-};
-/* framebuffer */
+/***************
+ * framebuffer *
+ ***************/
+
static struct pxafb_mach_info palmz72lcd __initdata = {
- .pixclock = 80000,
+
+ /* Dump at 94000000 to 9400000c
+ LCCR1: 1b070d3f: 1b = 27 = left_margin
+ 07 = 7 = right_margin
+ 0d = 13 = hsync_lenght
+ LCCR2: 0708013f: 07 = 7 = upper_margin
+ 08 = 8 = lower_margin
+ 01 = 1 = vsync_lenght
+ */
+
+ .pixclock = 0,
.xres = 320,
.yres = 320,
.bpp = 16,
- .hsync_len = 4,
+ .hsync_len = 6, // This value is optimized for older problematic LCD panels
.left_margin = 27,
.right_margin = 7,
.vsync_len = 1,
- .upper_margin = 8,
- .lower_margin = 7,
+ .upper_margin = 6, // This value is optimized for older problematic LCD panels
+ .lower_margin = 9, // This value is optimized for older problematic LCD panels
.sync = FB_SYNC_HOR_HIGH_ACT|FB_SYNC_VERT_HIGH_ACT,
.lccr0 = 0x07B008F9,
- .lccr3 = 0x03700007,
+ .lccr3 = 0x03700007,
.pxafb_backlight_power = NULL,
};
+/********************
+ * Power Management *
+ ********************/
+
+struct platform_device palmz72_pm = {
+ .name = "palmz72-pm",
+ .id = -1,
+ .dev = {
+ .platform_data = NULL,
+ },
+};
+
+/****************
+ * Init Machine *
+ ****************/
+
+static struct platform_device *devices[] __initdata = {
+ &palmz72_ac97,
+ &palmz72_pm,
+ &palmz72_backlight,
+ &palmz72_keypad,
+ &palmz72_led_device,
+};
+
static void __init palmz72_init(void)
{
GCR &= ~GCR_PRIRDY_IEN;
@@ -346,10 +367,7 @@
pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
pxa_gpio_mode(GPIO30_SDATA_OUT_AC97_MD);
pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
-
- // testing
-// GPSR(91) = GPIO_bit(91);
-
+
switch(palmz72lcd.bpp)
{
case 8:
@@ -359,29 +377,22 @@
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 );
stuart_device.dev.platform_data = &palmz72_pxa_irda_funcs;
platform_add_devices( devices, ARRAY_SIZE(devices) );
-#if 0
-#ifdef EARLY_SIR_CONSOLE
- palmlz72_irda_configure (NULL, 1);
- palmlz72_irda_set_txrx (NULL, PXA_SERIAL_TX);
-#endif
-#endif
-// LED_OFF;
}
MACHINE_START(PALMZ72, "Palm Zire 72")
- /* Maintainer: Vladimir Pouzanov <far...@gm...> */
- /* Maintainer: Sergey Lapin <sla...@gm...> */
- /* Maintainer: Jan Herman <2h...@se...> */
+
+ /********************************************************/
+ /* Maintainers: Vladimir Pouzanov <far...@gm...> */
+ /* Sergey Lapin <sla...@gm...> */
+ /* Jan Herman <2h...@se...> */
+ /********************************************************/
+
.boot_params = 0xa0000100,
.phys_io = 0x40000000,
.io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
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-23 09:53:18 UTC (rev 775)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_ac97.c 2007-01-23 18:08:22 UTC (rev 776)
@@ -1,11 +1,11 @@
-/*
- * 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
- *
- */
+/************************************************************************
+ * 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>
@@ -54,7 +54,9 @@
#define palmz72_ac97_WORK_QUEUE_NAME "palmz72_ac97_workqueue"
-/* module parameters */
+/*********************
+ * Module parameters *
+ *********************/
static int ptrsh = DEFAULT_PRESSURE_TRESHOLD;
module_param(ptrsh, int, 0);
@@ -91,9 +93,9 @@
static int previous_voltage;
static u16 d2base;
-/*
- * ac97 codec
- */
+/**************
+ * ac97 codec *
+ **************/
void wm97xx_gpio_func(int gpio, int func)
{
@@ -239,7 +241,7 @@
polarity = ac97->bus->ops->read(ac97, 0x4e);
if(polarity & levels & WM97XX_GPIO_13) {
- // power up digitiser:
+ /* power up digitiser: */
down(&digitiser_sem);
wm97xx_set_digitiser_power(WM97XX_PRP_DET_DIG);
@@ -304,7 +306,7 @@
wm97xx_gpio_mode(WM97XX_GPIO_13, WM97XX_GPIO_OUT, WM97XX_GPIO_POL_HIGH,
WM97XX_GPIO_STICKY, WM97XX_GPIO_WAKE);
- // setup work queue
+ /* setup work queue */
palmz72_ac97_workqueue = create_workqueue(palmz72_ac97_WORK_QUEUE_NAME);
INIT_WORK(&palmz72_ac97_irq_task, palmz72_ac97_irq_work, dev);
@@ -315,7 +317,9 @@
-/* battery */
+/***********
+ * Battery *
+ ***********/
void palmz72_battery_read_adc(int force)
@@ -353,7 +357,10 @@
return PALMZ72_BAT_MAX_VOLTAGE; /* mV */
}
-// V-batt = ADCSEL_BMON * 1,889 + 767,8 [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)
{
@@ -378,7 +385,6 @@
return BATTERY_STATUS_UNKNOWN;
if (ac_connected || usb_connected){
- // TODO: ok maybe this is too stupid ... to be reviewed
if ( ( current_voltage > previous_voltage ) || (current_voltage <= PALMZ72_BAT_MAX_VOLTAGE) )
return BATTERY_STATUS_CHARGING;
return BATTERY_STATUS_NOT_CHARGING;
@@ -401,7 +407,7 @@
static int __init palmz72_ac97_probe(struct device *dev)
{
int err;
- u16 d2 = DIG2_INIT; // init d1 too?
+ u16 d2 = DIG2_INIT;
if(!machine_is_palmz72())
return -ENODEV;
@@ -478,7 +484,7 @@
}
static int palmz72_ac_is_connected (void){
- /* when charger is plugged and USB si not connected, then status is ONLINE */
+ /* 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;
@@ -488,7 +494,10 @@
return ret;
}
-/* APM */
+/*******
+ * APM *
+ *******/
+
static void palmz72_apm_get_power_status(struct apm_power_info *info)
{
int min, max, curr, percent;
@@ -536,8 +545,6 @@
static int palmz72_ac97_remove (struct device *dev)
{
- // TODO: stop running tasks if any?
-
battery_class_unregister(&palmz72_battery);
ac97 = NULL;
input_unregister_device(palmz72_ac97_input);
@@ -564,6 +571,7 @@
driver_register(&palmz72_ac97_driver);
/* register battery to APM layer */
+
#ifdef CONFIG_PM
apm_get_power_status = palmz72_apm_get_power_status;
return 0;
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-01-23 09:53:18 UTC (rev 775)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-01-23 18:08:22 UTC (rev 776)
@@ -1,17 +1,22 @@
-/*
- * PalmOne Zire72 suspend/resume support
- *
- * Author: Jan Herman <2h...@se...>
- *
- * 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.
- *
- */
+/************************************************************************
+ * PalmOne Zire72 suspend/resume support *
+ * *
+ * Author: Jan Herman <2h...@se...> *
+ * *
+ * *
+ * 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/pxa-pm_ll.h>
#include <asm/arch/hardware.h>
@@ -19,53 +24,103 @@
#include <asm/arch/palmz72-gpio.h>
+typedef struct
+{
+ int brightness;
+} pm_save_data;
-static void palmz72_pxa_ll_pm_suspend(unsigned long resume_addr)
+#ifdef CONFIG_PM
+static int palmz72_suspend(struct device *dev, pm_message_t state)
{
-
- /* Wake up on Voice Memo button*/
- PWER |= PWER_GPIO13;
- /* Wake up on RTC alaram is possibile */
- //PWER |= PWER_RTC;
+ /* Wake-Up on Voice memo button - GPIO 13 */
+ PWER |= PWER_GPIO13 | PWER_RTC | PWER_WEP1;
+
PRER |= PWER_GPIO13;
-
- /* USB, in theory this can even wake us from deep sleep */
- PWER |= PWER_GPIO15;
- PFER |= PWER_GPIO15;
- PRER |= PWER_GPIO15;
+ /* Enabled Deep-Sleep mode ?? */
+ PCFR |= PCFR_DS;
+ /* 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 off USB power */
SET_PALMZ72_GPIO(USB_POWER,0);
+
+ /* disable GPIO reset - DO NOT REMOVE! */
+ PCFR &= PCFR_GPR_EN;
-
- /* disable GPIO reset, palm bootloader will hang us */
- //PCFR |= PCFR_GPR_EN | PCFR_OPDE;
- PCFR &= PCFR_GPR_EN;
-
- return;
+ return 0;
}
-static void palmz72_pxa_ll_pm_resume(void)
+static int palmz72_resume(struct device *dev, pm_message_t state)
{
-
- /* re-enable GPIO reset */
- PCFR |= PCFR_GPR_EN;
+
+ /* 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 Zire 72 */
+
/* Turn on LCD power */
SET_PALMZ72_GPIO(LCD_POWER,1);
-
/* Turn on USB power */
SET_PALMZ72_GPIO(USB_POWER,1);
+
+ return 0;
}
+#else
+#define palmz72_suspend NULL
+#define palmz72_resume NULL
+#endif
+static void palmz72_pxa_ll_pm_suspend(unsigned long resume_addr)
+{
+ /* For future */
+ return;
+}
+
+static void palmz72_pxa_ll_pm_resume(void)
+{
+ /* For future */
+}
+
struct pxa_ll_pm_ops palmz72_ll_pm_ops = {
- .suspend = palmz72_pxa_ll_pm_suspend,
- .resume = palmz72_pxa_ll_pm_resume,
+ .suspend = palmz72_pxa_ll_pm_suspend,
+ .resume = palmz72_pxa_ll_pm_resume,
};
+static int palmz72_pm_probe(struct device *dev)
+{
+ printk(KERN_NOTICE "PalmOne Zire72 power management driver registered\n");
+ return 0;
+}
+
+struct device_driver palmz72_pm_driver = {
+ .name = "palmz72-pm",
+ .bus = &platform_bus_type,
+ .probe = palmz72_pm_probe,
+ .suspend = palmz72_suspend,
+ .resume = palmz72_resume,
+};
+
+static int __init palmz72_pm_init(void)
+{
+ return driver_register(&palmz72_pm_driver);
+}
+
+static void __exit palmz72_pm_exit(void)
+{
+ driver_unregister(&palmz72_pm_driver);
+}
+
+module_init(palmz72_pm_init);
+module_exit(palmz72_pm_exit);
+
MODULE_AUTHOR("Jan Herman <2h...@se...>");
-MODULE_DESCRIPTION("PalmOne Zire72 suspend/resume support driver");
+MODULE_DESCRIPTION("PalmOne Zire 72 power management driver");
MODULE_LICENSE("GPL");
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <z7...@us...> - 2007-01-31 20:16:02
|
Revision: 787
http://svn.sourceforge.net/hackndev/?rev=787&view=rev
Author: z72ka
Date: 2007-01-31 12:14:56 -0800 (Wed, 31 Jan 2007)
Log Message:
-----------
Palmz72: Added new experimental driver for battery monitor based on latest WM9712 driver
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
Added Paths:
-----------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-01-31 18:52:36 UTC (rev 786)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-01-31 20:14:56 UTC (rev 787)
@@ -19,6 +19,13 @@
default y if MACH_PALMZ72
help
Enable support for suspend/resume the PalmOne Zire 72 PDA.
+
+config PALMZ72_BATTERY
+ tristate "Palm Zire 72 Battery support"
+ depends on MACH_PALMZ72
+ default y if MACH_PALMZ72
+ help
+ Battery.
config GPIOED
tristate "GPIOED"
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-01-31 18:52:36 UTC (rev 786)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-01-31 20:14:56 UTC (rev 787)
@@ -5,5 +5,6 @@
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
obj-$(CONFIG_PALMZ72_AC97) += palmz72_ac97.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
Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c (rev 0)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c 2007-01-31 20:14:56 UTC (rev 787)
@@ -0,0 +1,256 @@
+/************************************************************************
+ * 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 <linux/wm97xx.h>
+//#include <sound/wm9712.h>
+#include <asm/arch/palmz72-gpio.h>
+#include <asm/arch/palmz72-init.h>
+
+
+#define palmz72_ac97_WORK_QUEUE_NAME "palmz72_ac97_workqueue"
+
+
+/*********************
+ * Module parameters *
+ *********************/
+static DECLARE_MUTEX(battery_update_mutex);
+
+//static struct work_struct palmz72_ac97_irq_task;
+
+//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;
+
+
+
+//EXPERIMENTAL DRIVER...
+
+/***********
+ * Battery *
+ ***********/
+
+
+void palmz72_battery_read_adc(unsigned long data)
+{
+ //unsigned long data;
+ u16 vread;
+ //int force;
+
+ struct wm97xx *wm = (struct wm97xx*) data;
+ //struct wm97xx* wm;
+
+ //if(wm == NULL) {
+ // printk("Batt update error: struct wm97xx* wm is null!\n");
+ // return;
+ //}
+
+ //if(!force && ((last_battery_update + 10 *HZ) > jiffies))
+ // return;
+ //
+ //if(down_trylock(&battery_update_mutex))
+ // return;
+
+ //aux_waiting:1;
+ //vread = wm97xx_read_aux_adc(wm, WM97XX_AUX_ID3);
+
+ vread = 1680; // THIS MUST READ AUX_ID3 on WM9712 -- for slapin.. other of battery works
+
+ previous_voltage = current_voltage;
+ current_voltage = vread & 0xfff;
+ last_battery_update = jiffies;
+
+ printk("Battery: %d\n", current_voltage);
+
+ 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 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 __init palmz72_ac97_init(void)
+{
+
+/* register battery to APM layer */
+
+ if(battery_class_register(&palmz72_battery)) {
+ printk(KERN_ERR "palmz72_ac97_probe: could not register battery class\n");
+ }
+ else{
+ battery_registered = 1;
+ printk("Battery registered\n");
+ }
+#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_battery);
+}
+
+
+module_init(palmz72_ac97_init);
+module_exit(palmz72_ac97_exit);
+
+MODULE_AUTHOR ("Jan Herman <2h...@se...>");
+MODULE_DESCRIPTION ("WM9712 battery 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: <hap...@us...> - 2007-02-02 23:37:57
|
Revision: 790
http://svn.sourceforge.net/hackndev/?rev=790&view=rev
Author: happy-slapin
Date: 2007-02-02 15:37:44 -0800 (Fri, 02 Feb 2007)
Log Message:
-----------
z72: New battery infrastructure
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-02-02 09:01:13 UTC (rev 789)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-02-02 23:37:44 UTC (rev 790)
@@ -5,14 +5,6 @@
help
This enables support for PalmOne Zire 72 handheld.
-config PALMZ72_AC97
- tristate "Palm Zire 72 AC97 Driver"
- depends on MACH_PALMZ72
- default y if MACH_PALMZ72
- help
- Enable support for WM9712 touchscreen and battery driver for
- the PalmOne Zire 72 PDA.
-
config PALMZ72_PM
tristate "Palm Zire 72 Power Management support"
depends on MACH_PALMZ72
@@ -22,10 +14,12 @@
config PALMZ72_BATTERY
tristate "Palm Zire 72 Battery support"
- depends on MACH_PALMZ72 && TOUCHSCREEN_WM97XX
- default n
+ select TOUCHSCREEN_WM97XX
+ depends on MACH_PALMZ72
+ default m
help
Enable support for PalmOne Zire 72 battery to APM.
+ ATM use it only as module, otherwise it hangs.
config GPIOED
tristate "GPIOED"
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-02-02 09:01:13 UTC (rev 789)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-02-02 23:37:44 UTC (rev 790)
@@ -3,7 +3,6 @@
#
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
-obj-$(CONFIG_PALMZ72_AC97) += palmz72_ac97.o
obj-$(CONFIG_PALMZ72_PM) += palmz72_pm.o
obj-$(CONFIG_PALMZ72_BATTERY) += palmz72_battery.o
obj-$(CONFIG_GPIOED) += gpioed.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c 2007-02-02 09:01:13 UTC (rev 789)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_battery.c 2007-02-02 23:37:44 UTC (rev 790)
@@ -1,9 +1,9 @@
/************************************************************************
- * linux/arch/arm/mach-pxa/palmz72/palmz72_ac97.c *
+ * linux/arch/arm/mach-pxa/palmz72/palmz72_battery.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 *
+ * Authos: Jan Herman <2h...@se...> *
+ * Sergey Lapin <sl...@ha...> *
* *
************************************************************************/
@@ -32,75 +32,22 @@
#include <sound/pcm.h>
#include <sound/initval.h>
#include <linux/wm97xx.h>
-//#include <sound/wm9712.h>
#include <asm/arch/palmz72-gpio.h>
#include <asm/arch/palmz72-init.h>
-#define palmz72_ac97_WORK_QUEUE_NAME "palmz72_ac97_workqueue"
-
-
-/*********************
- * Module parameters *
- *********************/
-static DECLARE_MUTEX(battery_update_mutex);
-
-//static struct work_struct palmz72_ac97_irq_task;
-
-//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;
-
-
-
-//EXPERIMENTAL DRIVER...
-
-/***********
- * Battery *
- ***********/
-
-
-void palmz72_battery_read_adc(unsigned long data)
+struct palmz72_battery_dev
{
- //unsigned long data;
- u16 vread;
- //int force;
-
- struct wm97xx *wm = (struct wm97xx*) data;
- //struct wm97xx* wm;
+ struct wm97xx * wm;
+ int battery_registered;
+ int current_voltage;
+ int previous_voltage;
+ u32 last_battery_update;
+};
- //if(wm == NULL) {
- // printk("Batt update error: struct wm97xx* wm is null!\n");
- // return;
- //}
+struct palmz72_battery_dev bat;
- //if(!force && ((last_battery_update + 10 *HZ) > jiffies))
- // return;
- //
- //if(down_trylock(&battery_update_mutex))
- // return;
-
- //aux_waiting:1;
- //vread = wm97xx_read_aux_adc(wm, WM97XX_AUX_ID3);
- vread = 1680; // THIS MUST READ AUX_ID3 on WM9712 -- for slapin.. other of battery works
-
- previous_voltage = current_voltage;
- current_voltage = vread & 0xfff;
- last_battery_update = jiffies;
-
- printk("Battery: %d\n", current_voltage);
-
- up(&battery_update_mutex);
-}
-
-
int palmz72_battery_min_voltage(struct battery *b)
{
return PALMZ72_BAT_MIN_VOLTAGE;
@@ -119,10 +66,12 @@
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;
+ if (bat.battery_registered){
+ bat.previous_voltage = bat.current_voltage;
+ bat.current_voltage = wm97xx_read_aux_adc(bat.wm, TS_BMON);
+ bat.last_battery_update = jiffies;
+ printk("Battery [mV]: %d\n", bat.current_voltage * 1889/1000 + 7678/10 );
+ return bat.current_voltage * 1889/1000 + 7678/10;
}
else{
printk("palmz72_battery: cannot get voltage -> battery driver unregistered\n");
@@ -136,11 +85,11 @@
int ac_connected = GET_GPIO(GPIO_NR_PALMZ72_POWER_DETECT);
int usb_connected = !GET_GPIO(GPIO_NR_PALMZ72_USB_DETECT);
- if (current_voltage <= 0)
+ if (bat.current_voltage <= 0)
return BATTERY_STATUS_UNKNOWN;
if (ac_connected || usb_connected){
- if ( ( current_voltage > previous_voltage ) || (current_voltage <= PALMZ72_BAT_MAX_VOLTAGE) )
+ if ( ( bat.current_voltage > bat.previous_voltage ) || (bat.current_voltage <= PALMZ72_BAT_MAX_VOLTAGE) )
return BATTERY_STATUS_CHARGING;
return BATTERY_STATUS_NOT_CHARGING;
}
@@ -148,7 +97,6 @@
return BATTERY_STATUS_DISCHARGING;
}
-
struct battery palmz72_battery = {
.name = "palmz72_battery",
.id = "battery0",
@@ -158,8 +106,29 @@
.get_status = palmz72_battery_get_status,
};
+static int palmz72_wm97xx_probe(struct device *dev)
+{
+ struct wm97xx *wm = dev->driver_data;
+ bat.wm = wm;
+ return 0;
+}
+static int palmz72_wm97xx_remove(struct device *dev)
+{
+// struct wm97xx *wm = dev->driver_data;
+ return 0;
+}
+static struct device_driver palmz72_wm97xx_driver = {
+ .name = "wm97xx-touchscreen",
+ .bus = &wm97xx_bus_type,
+ .owner = THIS_MODULE,
+ .probe = palmz72_wm97xx_probe,
+ .remove = palmz72_wm97xx_remove,
+ .suspend = NULL,
+ .resume = NULL
+};
+
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)));;
@@ -171,17 +140,16 @@
return ret;
}
-/*******
- * APM *
- *******/
-
+#ifdef CONFIG_APM
+
+/* APM status query callback implementation */
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 = palmz72_battery_get_voltage(&palmz72_battery);
+ min = palmz72_battery_min_voltage(&palmz72_battery);
+ max = palmz72_battery_max_voltage(&palmz72_battery);
curr = curr - min;
if (curr < 0) curr = 0;
@@ -207,50 +175,36 @@
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)
+#endif
+static int __init palmz72_wm97xx_init(void)
{
- apm_get_power_status = t;
+ /* register battery to APM layer */
+ bat.battery_registered = 0;
- return 0;
-}
-
-
-/* end of APM implementing */
-
-
-
-static int __init palmz72_ac97_init(void)
-{
-
-/* register battery to APM layer */
-
- if(battery_class_register(&palmz72_battery)) {
- printk(KERN_ERR "palmz72_ac97_probe: could not register battery class\n");
- }
- else{
- battery_registered = 1;
- printk("Battery registered\n");
- }
-#ifdef CONFIG_PM
- apm_get_power_status = palmz72_apm_get_power_status;
- return 0;
+ if(battery_class_register(&palmz72_battery)) {
+ printk(KERN_ERR "palmz72_ac97_probe: could not register battery class\n");
+ }
+ else {
+ bat.battery_registered = 1;
+ printk("Battery registered\n");
+ }
+#ifdef CONFIG_APM
+ apm_get_power_status = palmz72_apm_get_power_status;
#endif
-
+ return driver_register(&palmz72_wm97xx_driver);
}
-
-static void __exit palmz72_ac97_exit(void)
+static void __exit palmz72_wm97xx_exit(void)
{
- driver_unregister(&palmz72_battery);
+/* TODO - recover APM callback to original state */
+ battery_class_unregister(&palmz72_battery);
+ driver_unregister(&palmz72_wm97xx_driver);
}
+module_init(palmz72_wm97xx_init);
+module_exit(palmz72_wm97xx_exit);
-module_init(palmz72_ac97_init);
-module_exit(palmz72_ac97_exit);
-
-MODULE_AUTHOR ("Jan Herman <2h...@se...>");
-MODULE_DESCRIPTION ("WM9712 battery support for PalmOne Zire 72");
-MODULE_LICENSE ("GPL");
+/* Module information */
+MODULE_AUTHOR("Sergey Lapin <sl...@ha...> Jan Herman <2h...@se...>");
+MODULE_DESCRIPTION("wm97xx battery driver for Palm Zire 72");
+MODULE_LICENSE("GPL");
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-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: <z7...@us...> - 2007-06-27 08:26:42
|
Revision: 1086
http://svn.sourceforge.net/hackndev/?rev=1086&view=rev
Author: z72ka
Date: 2007-06-27 01:26:37 -0700 (Wed, 27 Jun 2007)
Log Message:
-----------
palmz72: Fixed backlight problem, hack to reducing whine, revert latest revision for PM (last commit is test for fixing BL)
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-06-27 08:23:55 UTC (rev 1085)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-06-27 08:26:37 UTC (rev 1086)
@@ -334,8 +334,8 @@
.max_intensity = PALMZ72_MAX_INTENSITY,
.default_intensity = PALMZ72_DEFAULT_INTENSITY,
.limit_mask = PALMZ72_LIMIT_MASK,
- .prescaler = 1,
- .period = 0x12c,
+ .prescaler = PALMZ72_PRESCALER,
+ .period = PALMZ72_PERIOD,
.turn_bl_on = palmz72_bl_on,
.turn_bl_off = palmz72_bl_off,
};
@@ -435,7 +435,8 @@
palmz72_lcd_screen.lccr3=0x03700007;
break;
case 16:
- palmz72_lcd_screen.lccr3=0x04700007;
+ /* right value for lcc3 is 0x04700007, but little change reducing display whine */
+ palmz72_lcd_screen.lccr3=0x04700004;
break;
}
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-06-27 08:23:55 UTC (rev 1085)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_pm.c 2007-06-27 08:26:37 UTC (rev 1086)
@@ -15,7 +15,6 @@
#include <linux/pm.h>
#include <linux/fb.h>
#include <linux/platform_device.h>
-#include <linux/delay.h>
#include <asm/mach-types.h>
#include <asm/hardware.h>
@@ -53,9 +52,6 @@
/* Turn off USB power */
SET_PALMZ72_GPIO(USB_POWER,0);
- SET_PALMZ72_GPIO(BL_POWER, 0);
- mdelay(50);
-
/* disable GPIO reset - DO NOT REMOVE! */
PCFR &= PCFR_GPR_EN;
@@ -81,9 +77,6 @@
SET_PALMZ72_GPIO(SCREEN,1);
/* Turn on USB power */
SET_PALMZ72_GPIO(USB_POWER,1);
- /* Hack - something seems to switch it off in-between */
- SET_PALMZ72_GPIO(BL_POWER, 1);
- mdelay(50);
return 0;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hap...@us...> - 2007-06-30 01:13:04
|
Revision: 1096
http://svn.sourceforge.net/hackndev/?rev=1096&view=rev
Author: happy-slapin
Date: 2007-06-29 18:13:00 -0700 (Fri, 29 Jun 2007)
Log Message:
-----------
z72: enabling camera clock in device file for now
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.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-06-29 01:08:29 UTC (rev 1095)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-06-30 01:13:00 UTC (rev 1096)
@@ -90,7 +90,7 @@
GPIO_88 0 O 00 LED
GPIO_89 0 O 01 AC97_SYSCLK
GPIO_90 0 O 00
-GPIO_91 1 O 00
+GPIO_91 1 O 00 1->0 disables I2C0?
GPIO_92 0 O 00
GPIO_93 1 I 02 CIF_DD6
GPIO_94 0 I 00
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-06-29 01:08:29 UTC (rev 1095)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-06-30 01:13:00 UTC (rev 1096)
@@ -511,6 +511,7 @@
break;
}
+ pxa_set_cken(CKEN24_CAMERA, 1);
set_pxa_fb_info( &palmz72_lcd_screen );
pxa_set_btuart_info(&bcm2035_pxa_bt_funcs);
pxa_set_mci_info( &palmz72_mci_platform_data );
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <hap...@us...> - 2007-07-20 10:18:23
|
Revision: 1184
http://svn.sourceforge.net/hackndev/?rev=1184&view=rev
Author: happy-slapin
Date: 2007-07-20 03:18:21 -0700 (Fri, 20 Jul 2007)
Log Message:
-----------
z72: added hacksome piece of code, removed camera clock playing from platform
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
Added Paths:
-----------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/pxaci.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-07-20 08:17:31 UTC (rev 1183)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-07-20 10:18:21 UTC (rev 1184)
@@ -435,6 +435,13 @@
},
};
+static struct platform_device palmz72_ci = {
+ .name = "pxacif",
+ .id = -1,
+ .dev = {
+ .platform_data = NULL,
+ },
+};
/****************
* Init Machine *
@@ -450,6 +457,7 @@
#endif
&palmz72_led_device,
&bcm2035_bt,
+ &palmz72_ci,
#if 0
&ov9640,
#endif
@@ -515,7 +523,6 @@
break;
}
- pxa_set_cken(CKEN24_CAMERA, 1);
set_pxa_fb_info( &palmz72_lcd_screen );
pxa_set_btuart_info(&bcm2035_pxa_bt_funcs);
pxa_set_mci_info( &palmz72_mci_platform_data );
Added: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/pxaci.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/pxaci.c (rev 0)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/pxaci.c 2007-07-20 10:18:21 UTC (rev 1184)
@@ -0,0 +1,134 @@
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <asm/arch/pxa-regs.h>
+#include <asm/arch/hardware.h>
+
+static int pxaci_enabled = 0;
+static DEFINE_MUTEX(enable_mutex);
+
+static void show_ci_regs(void)
+{
+ printk(KERN_INFO "CI regs:\nCICR0=%08x CICR1=%08x\nCICR2=%08x CICR3=%08x\nCICR4=%08x\n", CICR0, CICR1, CICR2, CICR3, CICR4);
+ printk(KERN_INFO "CISR=%08x\n", CISR);
+}
+
+static ssize_t pxaci_enable_show(struct device *dev,
+ struct device_attribute *attr, char *buf)
+{
+ printk(KERN_INFO "PXACIF: read\n");
+ show_ci_regs();
+ return sprintf(buf, "%u\n", pxaci_enabled);
+}
+/*
+CICR0 = 0x800003f7 DMA_EN|~PAR_EN|~SL_CAP_EN|~ENB|~DIS|SIM=000 (master-parallel)|TOM|RDAVM|FEM|EOLM|PERRM|QDM|CDM|~SOFM|~EOFM
+CICR1 = 0x009f8412 ~TBIT|RGBT_CONV=00 (No) |
+CICR2 = 0
+CICR3 = 0x000000ef
+CICR4 = 0x00880001
+
+*/
+
+
+static ssize_t pxaci_enable_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ int state;
+
+ printk(KERN_INFO "PXACIF: write\n");
+ show_ci_regs();
+ if (sscanf(buf, "%u", &state) != 1)
+ return -EINVAL;
+
+ if ((state != 1) && (state != 0))
+ return -EINVAL;
+
+ mutex_lock(&enable_mutex);
+ if (state != pxaci_enabled) {
+ pxaci_enabled = state;
+ pxa_set_cken(CKEN24_CAMERA, state);
+ if(pxaci_enabled) {
+ CICR0 = 0x3ff;
+ CICR1 = 0x009f8412;
+ CICR2 = 0x0;
+ CICR3 = 0xef;
+ CICR4 = 0x00880001;
+ CICR0 = CICR0_ENB|0x3ff;
+ } else {
+ CICR0 = 0x3ff;
+ CICR1 = 0x009f8412;
+ CICR2 = 0x0;
+ CICR3 = 0xef;
+ CICR4 = 0x00880001;
+ }
+ }
+ mutex_unlock(&enable_mutex);
+
+ return strnlen(buf, count);
+}
+
+static DEVICE_ATTR(enable, S_IRUGO | S_IWUSR, pxaci_enable_show, pxaci_enable_store);
+
+
+#ifdef CONFIG_PM
+static int pxaci_suspend(struct platform_device *pdev, pm_message_t state)
+{
+ pxa_set_cken(CKEN24_CAMERA, 0);
+ return 0;
+}
+
+static int pxaci_resume(struct platform_device *pdev)
+{
+ pxa_set_cken(CKEN24_CAMERA, pxaci_enabled);
+ return 0;
+}
+#else
+#define pxaci_suspend NULL
+#define pxaci_resume NULL
+#endif
+
+
+static int pxaci_probe(struct platform_device *pdev)
+{
+ int ret;
+ pxa_set_cken(CKEN24_CAMERA, 0);
+ show_ci_regs();
+ ret = device_create_file(&pdev->dev, &dev_attr_enable);
+ printk(KERN_INFO "Initialized device PXACI\n");
+ return 0;
+}
+
+static int pxaci_remove(struct platform_device *pdev)
+{
+ pxa_set_cken(CKEN24_CAMERA, 0);
+ printk(KERN_INFO "Denitialized device PXACI\n");
+ return 0;
+}
+
+static struct platform_driver pxaci_driver = {
+ .probe = pxaci_probe,
+ .remove = pxaci_remove,
+ .suspend = pxaci_suspend,
+ .resume = pxaci_resume,
+ .driver = {
+ .name = "pxacif",
+ },
+};
+
+static int __init pxacif_init(void)
+{
+ int pdreg = platform_driver_register(&pxaci_driver);
+
+ return pdreg;
+}
+
+static void __exit pxacif_exit(void)
+{
+ platform_driver_unregister(&pxaci_driver);
+}
+
+module_init(pxacif_init);
+module_exit(pxacif_exit);
+
+MODULE_AUTHOR("Sergey Lapin <sl...@ha...>");
+MODULE_DESCRIPTION("XScale Camera Interface Experiments Driver");
+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-09-21 00:53:22
|
Revision: 1335
http://hackndev.svn.sourceforge.net/hackndev/?rev=1335&view=rev
Author: marex_z71
Date: 2007-09-20 17:53:12 -0700 (Thu, 20 Sep 2007)
Log Message:
-----------
PalmZ72: migrate to universal LCD border driver - palmlcd_border
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
Removed Paths:
-------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_border.c
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-09-21 00:51:33 UTC (rev 1334)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Kconfig 2007-09-21 00:53:12 UTC (rev 1335)
@@ -21,9 +21,3 @@
help
Enable support for PalmOne Zire 72 battery to APM.
ATM use it only as module, otherwise it hangs.
-
-config PALMZ72_BORDER
- tristate "Palm Zire 72 Display border switch"
- depends on MACH_PALMZ72
- help
- Enable support for turning LCD border on/off
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-09-21 00:51:33 UTC (rev 1334)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/Makefile 2007-09-21 00:53:12 UTC (rev 1335)
@@ -5,4 +5,3 @@
obj-$(CONFIG_MACH_PALMZ72) += palmz72.o
obj-$(CONFIG_PALMZ72_PM) += palmz72_pm.o
obj-$(CONFIG_PALMZ72_BATTERY) += palmz72_battery.o
-obj-$(CONFIG_PALMZ72_BORDER) += palmz72_border.o
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-09-21 00:51:33 UTC (rev 1334)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-09-21 00:53:12 UTC (rev 1335)
@@ -42,6 +42,7 @@
#include <asm/arch/palmz72-init.h>
#include <asm/arch/pxa_camera.h>
#include <asm/arch/pxa2xx_udc_gpio.h>
+#include <asm/arch/palmlcd-border.h>
#include <sound/driver.h>
#include <sound/core.h>
@@ -315,9 +316,17 @@
/**************
* LCD Border *
**************/
+static struct palmlcd_border_pdata border_machinfo = {
+ .select_gpio = GPIO_NR_PALMZ72_BORDER_SELECT,
+ .switch_gpio = GPIO_NR_PALMZ72_BORDER_SWITCH,
+};
+
struct platform_device palmz72_border = {
- .name = "palmz72-border",
- .id = -1,
+ .name = "palmlcd-border",
+ .id = -1,
+ .dev = {
+ .platform_data = &border_machinfo,
+ },
};
/*************
Deleted: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_border.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_border.c 2007-09-21 00:51:33 UTC (rev 1334)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72_border.c 2007-09-21 00:53:12 UTC (rev 1335)
@@ -1,115 +0,0 @@
-/*
- * PalmOne Zire 72 LCD Border switch
- * (Based on Palm LD LCD border switch)
- *
- * Author: Marek Vasut <mar...@gm...>
- * Modification for Palm Zire 72: Jan Herman <z7...@ha...>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/platform_device.h>
-#include <linux/delay.h>
-
-#include <asm/arch/hardware.h>
-#include <asm/arch/palmz72-gpio.h>
-
-static ssize_t palmz72_border_write(struct device *dev, struct device_attribute *attr,
- const char *buf, size_t count)
-{
- signed long state = simple_strtol(buf, NULL, 10);
-
- if ( state >= 1 )
- SET_PALMZ72_GPIO(BORDER_SELECT, 1);
- else
- SET_PALMZ72_GPIO(BORDER_SELECT, 0);
-
- msleep(50);
- SET_PALMZ72_GPIO(BORDER_SWITCH, 1);
-
- if ((state == 1) || (state == 0)) /* default - switch border on/off */
- msleep(200);
- else { /* hidden functionality - colored border */
- if (state >= 0)
- msleep(state);
- else
- msleep(-state);
- }
-
- SET_PALMZ72_GPIO(BORDER_SWITCH, 0);
-
- return count;
-}
-
-static ssize_t palmz72_border_read(struct device *dev,
- struct device_attribute *attr,
- char *buf)
-{
- return strlcpy(buf, GET_PALMZ72_GPIO(BORDER_SELECT) ? "1\n" : "0\n", 3);
-}
-
-static DEVICE_ATTR(border_power, 0644, palmz72_border_read, palmz72_border_write);
-
-static struct attribute *palmz72_border_attrs[] = {
- &dev_attr_border_power.attr,
- NULL
-};
-
-static struct attribute_group palmz72_border_attr_group = {
- .attrs = palmz72_border_attrs,
-};
-
-static int __devinit palmz72_border_probe(struct platform_device *pdev)
-{
- return sysfs_create_group(&pdev->dev.kobj, &palmz72_border_attr_group);
-}
-
-static int palmz72_border_remove(struct platform_device *pdev)
-{
- sysfs_remove_group(&pdev->dev.kobj, &palmz72_border_attr_group);
- return 0;
-}
-
-static struct platform_driver palmz72_border_driver = {
- .probe = palmz72_border_probe,
- .remove = palmz72_border_remove,
- .suspend = NULL,
- .resume = NULL,
- .driver = {
- .name = "palmz72-border",
- }
-};
-
-static int __init palmz72_border_init(void)
-{
- printk(KERN_INFO "LCD border driver registered\n");
- return platform_driver_register(&palmz72_border_driver);
-}
-
-static void palmz72_border_exit(void)
-{
- printk(KERN_INFO "LCD border driver unregistered\n");
- platform_driver_unregister(&palmz72_border_driver);
-}
-
-module_init(palmz72_border_init);
-module_exit(palmz72_border_exit);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Jan Herman <z7...@ha...>");
-MODULE_DESCRIPTION("PalmOne Zire72 Border switch");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <z7...@us...> - 2007-11-05 12:28:22
|
Revision: 1350
http://hackndev.svn.sourceforge.net/hackndev/?rev=1350&view=rev
Author: z72ka
Date: 2007-11-05 04:28:17 -0800 (Mon, 05 Nov 2007)
Log Message:
-----------
palmz72: MMC_POWER GPIO found and used for pxamci .setpower function -> extended battery life in suspend
Modified Paths:
--------------
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt
linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.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-11-05 12:26:26 UTC (rev 1349)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/gpio_map.txt 2007-11-05 12:28:17 UTC (rev 1350)
@@ -97,7 +97,7 @@
GPIO_95 0 O 00 USB_POWER
GPIO_96 1 O 00 LCD_POWER (LCD OFF when 0)
GPIO_97 0 I 03 KP_MKIN3
-GPIO_98 1 O 00
+GPIO_98 0 O 00 MMC_SETPOWER (MMC OFF when 1)
GPIO_99 1 I 00
GPIO100 0 I 01 KP_MKIN0
GPIO101 0 I 01 KP_MKIN1
Modified: linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c
===================================================================
--- linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-11-05 12:26:26 UTC (rev 1349)
+++ linux4palm/linux/trunk/arch/arm/mach-pxa/palmz72/palmz72.c 2007-11-05 12:28:17 UTC (rev 1350)
@@ -85,10 +85,25 @@
free_irq(IRQ_GPIO_PALMZ72_SD_DETECT_N, data);
}
+static void palmz72_mci_setpower(struct device *dev, unsigned int vdd)
+{
+ struct pxamci_platform_data* p_d = dev->platform_data;
+
+ if (( 1 << vdd) & p_d->ocr_mask)
+ {
+ SET_GPIO(GPIO_NR_PALMZ72_MMC_POWER, 0);
+ }
+ else
+ {
+ SET_GPIO(GPIO_NR_PALMZ72_MMC_POWER, 1);
+ }
+}
+
+
static struct pxamci_platform_data palmz72_mci_platform_data = {
.ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34,
.init = palmz72_mci_init,
- /* .setpower = palmz72_mci_setpower, */
+ .setpower = palmz72_mci_setpower,
.exit = palmz72_mci_exit,
};
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|