]> cvs.zerfleddert.de Git - ms2-fixes/blobdiff - debounce.c
add (disabled) fixup-handler
[ms2-fixes] / debounce.c
index f06cf2233248219d9e1d3ba78c3d7865ff5a8f6a..399e97bbdb28fdecf0b572fced0dc995487f5cb3 100644 (file)
@@ -12,6 +12,7 @@ static unsigned old_flags = 0;
 static ktime_t old_debounce_delay;
 static ktime_t old_settle_time;
 static ktime_t old_poll_time;
+static int (*old_sw_fixup)(int index);
 static struct gpio_event_matrix_info *gpio_evmi = NULL;
 static int hw_debounce = 0;
 static int hw_debounce_time = 0;
@@ -469,6 +470,21 @@ static DEVICE_ATTR(drive_inactive_flag, (S_IRUGO | S_IWUGO), show_drive_inactive
 static DEVICE_ATTR(hw_debounce, (S_IRUGO | S_IWUGO), show_hw_debounce, store_hw_debounce);
 static DEVICE_ATTR(hw_debounce_time, (S_IRUGO | S_IWUGO), show_hw_debounce_time, store_hw_debounce_time);
 
+#if 0
+static int debounce_fixup(int index)
+{
+       int ret;
+
+       printk(KERN_INFO PREFIX "0x%x\n", index);
+
+       ret = old_sw_fixup(index);
+       if (!ret)
+               printk(KERN_INFO PREFIX "IGNORED!\n");
+
+       return ret;
+}
+#endif
+
 static void debounce_release(struct device *dev)
 {
 }
@@ -528,8 +544,12 @@ static int __init debounce_init(void)
        old_settle_time = gpio_evmi->settle_time;
        old_poll_time = gpio_evmi->poll_time;
        old_flags = gpio_evmi->flags;
+       old_sw_fixup = gpio_evmi->sw_fixup;
 
-       printk(KERN_INFO PREFIX "flags: 0x%x\n", gpio_evmi->flags);
+#if 0
+       printk(KERN_INFO PREFIX "Registering fixup handler\n");
+       gpio_evmi->sw_fixup = debounce_fixup;
+#endif
 
        return 0;
 }
@@ -550,6 +570,11 @@ static void __exit debounce_exit(void)
                }
                gpio_evmi->settle_time = old_settle_time;
                gpio_evmi->poll_time = old_poll_time;
+
+               if (gpio_evmi->sw_fixup != old_sw_fixup) {
+                       printk(KERN_INFO PREFIX "Restoring fixup handler\n");
+                       gpio_evmi->sw_fixup = old_sw_fixup;
+               }
        }
        hw_debounce_set(0, 0);
        device_remove_file(&debounce_device, &dev_attr_debounce_delay);
Impressum, Datenschutz