]> git.zerfleddert.de Git - ms2-fixes/commitdiff
change padconfig to drive the matrix active high, needs UI integration
authorMichael Gernoth <michael@gernoth.net>
Wed, 7 Sep 2011 06:12:10 +0000 (08:12 +0200)
committerMichael Gernoth <michael@gernoth.net>
Wed, 7 Sep 2011 06:12:10 +0000 (08:12 +0200)
MS2Debounce/assets/debounce.ko
debounce.c

index 54912b8a56fcb7465c1b749dae040e5609faa02e..df79df7fc9c02f877599c64df14435d0ccf7a846 100644 (file)
Binary files a/MS2Debounce/assets/debounce.ko and b/MS2Debounce/assets/debounce.ko differ
index 9b8af30985f553d1f0a1dcc14dee1ffe351ddea0..b69e1bc8cdfbe2b73587b029077a79f8ef57a3e3 100644 (file)
@@ -7,9 +7,24 @@
 #include <mach/gpio.h>
 #include <linux/earlysuspend.h>
 #include <linux/wakelock.h>
 #include <mach/gpio.h>
 #include <linux/earlysuspend.h>
 #include <linux/wakelock.h>
+#include <plat/board-mapphone.h>
 
 #define PREFIX "debounce: "
 
 
 #define PREFIX "debounce: "
 
+#define PADCONF_PULL_UP                ( OMAP343X_PADCONF_OFF_WAKEUP_ENABLED | \
+                               OMAP343X_PADCONF_INPUT_ENABLED | \
+                               OMAP343X_PADCONF_PULL_UP | \
+                               OMAP343X_PADCONF_PUD_ENABLED | \
+                               OMAP343X_PADCONF_MUXMODE4 )
+
+#define PADCONF_PULL_DOWN      ( OMAP343X_PADCONF_OFF_WAKEUP_ENABLED | \
+                               OMAP343X_PADCONF_INPUT_ENABLED | \
+                               OMAP343X_PADCONF_PULL_DOWN | \
+                               OMAP343X_PADCONF_PUD_ENABLED | \
+                               OMAP343X_PADCONF_MUXMODE4 )
+
+#define OMAP_CTRL_REGADDR(reg)            (OMAP2_L4_IO_ADDRESS(OMAP343X_CTRL_BASE) + (reg))
+
 static unsigned old_flags = 0;
 static ktime_t old_debounce_delay;
 static ktime_t old_settle_time;
 static unsigned old_flags = 0;
 static ktime_t old_debounce_delay;
 static ktime_t old_settle_time;
@@ -360,6 +375,7 @@ static ssize_t show_active_high_flag(struct device *dev, struct device_attribute
 static ssize_t store_active_high_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        unsigned flag;
 static ssize_t store_active_high_flag(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
        unsigned flag;
+       int i;
 
        if (!gpio_evmi) 
                return -ENODEV;
 
        if (!gpio_evmi) 
                return -ENODEV;
@@ -368,8 +384,14 @@ static ssize_t store_active_high_flag(struct device *dev, struct device_attribut
 
        if (flag) {
                gpio_evmi->flags |= GPIOKPF_ACTIVE_HIGH;
 
        if (flag) {
                gpio_evmi->flags |= GPIOKPF_ACTIVE_HIGH;
+               for (i = 0x7a; i <= 0x88; i += 2) {
+                       __raw_writew(PADCONF_PULL_DOWN, OMAP_CTRL_REGADDR(i));
+               }
        } else {
                gpio_evmi->flags &= ~GPIOKPF_ACTIVE_HIGH;
        } else {
                gpio_evmi->flags &= ~GPIOKPF_ACTIVE_HIGH;
+               for (i = 0x7a; i <= 0x88; i += 2) {
+                       __raw_writew(PADCONF_PULL_UP, OMAP_CTRL_REGADDR(i));
+               }
        }
 
        set_irq_types();
        }
 
        set_irq_types();
@@ -613,6 +635,8 @@ static int __init debounce_init(void)
 
 static void __exit debounce_exit(void)
 {
 
 static void __exit debounce_exit(void)
 {
+       int i;
+
        if (gpio_evmi) {
                if (gpio_evmi->debounce_delay.tv.nsec != old_debounce_delay.tv.nsec) {
                        printk(KERN_INFO PREFIX "Restoring debounce_delay\n");
        if (gpio_evmi) {
                if (gpio_evmi->debounce_delay.tv.nsec != old_debounce_delay.tv.nsec) {
                        printk(KERN_INFO PREFIX "Restoring debounce_delay\n");
@@ -623,6 +647,15 @@ static void __exit debounce_exit(void)
                        printk(KERN_INFO PREFIX "Restoring flags\n");
                        gpio_evmi->flags = old_flags;
                        printk(KERN_INFO PREFIX "flags: 0x%x\n", gpio_evmi->flags);
                        printk(KERN_INFO PREFIX "Restoring flags\n");
                        gpio_evmi->flags = old_flags;
                        printk(KERN_INFO PREFIX "flags: 0x%x\n", gpio_evmi->flags);
+                       if (gpio_evmi->flags & GPIOKPF_ACTIVE_HIGH) {
+                               for (i = 0x7a; i <= 0x88; i += 2) {
+                                       __raw_writew(PADCONF_PULL_DOWN, OMAP_CTRL_REGADDR(i));
+                               }
+                       } else {
+                               for (i = 0x7a; i <= 0x88; i += 2) {
+                                       __raw_writew(PADCONF_PULL_UP, OMAP_CTRL_REGADDR(i));
+                               }
+                       }
                        set_irq_types();
                }
                gpio_evmi->settle_time = old_settle_time;
                        set_irq_types();
                }
                gpio_evmi->settle_time = old_settle_time;
Impressum, Datenschutz