Revision: 1107
http://svn.sourceforge.net/hackndev/?rev=1107&view=rev
Author: sleep_walker
Date: 2007-07-05 11:20:31 -0700 (Thu, 05 Jul 2007)
Log Message:
-----------
palmt3: forgoten file
Added Paths:
-----------
linux4palm/linux/trunk/drivers/input/misc/palmtt3-pwr_btn.c
Added: linux4palm/linux/trunk/drivers/input/misc/palmtt3-pwr_btn.c
===================================================================
--- linux4palm/linux/trunk/drivers/input/misc/palmtt3-pwr_btn.c (rev 0)
+++ linux4palm/linux/trunk/drivers/input/misc/palmtt3-pwr_btn.c 2007-07-05 18:20:31 UTC (rev 1107)
@@ -0,0 +1,96 @@
+/*
+ * Palm Tungsten|T3 Power Button Driver
+ *
+ * Author: Tomas Cech <Tom...@ma...>
+ *
+ * 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/init.h>
+#include <linux/input.h>
+#include <linux/input_pda.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.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 <asm/arch/pxa-regs.h>
+#include <asm/arch/irqs.h>
+
+#define PWRBTN_REPEAT_DELAY 1000
+#define PWRBTN_REPEAT_PERIOD 500
+struct input_dev *pwr_btn_input;
+char keycode = KEY_F8;
+
+
+int palmtt3_pwr_btn_press(void) {
+ printk("palmtt3_pwr_btn_press\n");
+ input_report_key(pwr_btn_input, keycode, 1);
+ input_report_key(pwr_btn_input, keycode, 0);
+ input_sync(pwr_btn_input);
+ return 0;
+}
+
+EXPORT_SYMBOL(palmtt3_pwr_btn_press);
+
+static int __init palmtt3_pwr_btn_probe(struct platform_device *pdev)
+{
+
+ pwr_btn_input = input_allocate_device();
+ if (!pwr_btn_input) {
+ printk("Input device wasn't allocated!\n");
+ goto err1;
+ }
+
+ pwr_btn_input->name = "palmtt3-pwr_btn";
+ pwr_btn_input->id.bustype = BUS_HOST;
+ set_bit(EV_KEY, pwr_btn_input->evbit);
+ set_bit(keycode,pwr_btn_input->keybit);
+ input_register_device(pwr_btn_input);
+
+ return 0;
+err1:
+ return -ENOMEM;
+}
+
+
+static int palmtt3_pwr_btn_remove(struct platform_device *pdev)
+{
+ input_unregister_device(pwr_btn_input);
+ return 0;
+}
+
+static struct platform_driver palmtt3_pwr_btn_driver = {
+ .driver = {
+ .name = "palmtt3-pwr_btn",
+ .owner = THIS_MODULE,
+ },
+ .probe = palmtt3_pwr_btn_probe,
+ .remove = palmtt3_pwr_btn_remove,
+ .suspend = NULL,
+ .resume = NULL,
+
+};
+
+static int __devinit palmtt3_pwr_btn_init(void)
+{
+ return platform_driver_register(&palmtt3_pwr_btn_driver);
+}
+
+static void __exit palmtt3_pwr_btn_exit(void)
+{
+ platform_driver_unregister(&palmtt3_pwr_btn_driver);
+}
+
+module_init(palmtt3_pwr_btn_init);
+module_exit(palmtt3_pwr_btn_exit);
+
+MODULE_AUTHOR("Tomas Cech <Tom...@ma...>");
+MODULE_DESCRIPTION("Power Button for Palm Tungsten|T3");
+MODULE_LICENSE("GPL");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|