23 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/errno.h>
27 #include <linux/input.h>
32 #define PWR_PWRON_IRQ (1 << 0)
34 #define STS_HW_CONDITIONS 0xf
36 static irqreturn_t powerbutton_irq(
int irq,
void *_pwr)
38 struct input_dev *pwr = _pwr;
49 dev_err(pwr->dev.parent,
"twl4030: i2c error %d while reading"
50 " TWL4030 PM_MASTER STS_HW_CONDITIONS register\n", err);
58 struct input_dev *pwr;
62 pwr = input_allocate_device();
64 dev_dbg(&pdev->
dev,
"Can't allocate power button\n");
70 pwr->name =
"twl4030_pwrbutton";
71 pwr->phys =
"twl4030_pwrbutton/input0";
72 pwr->dev.parent = &pdev->
dev;
76 "twl4030_pwrbutton", pwr);
78 dev_dbg(&pdev->
dev,
"Can't get IRQ for pwrbutton: %d\n", err);
82 err = input_register_device(pwr);
84 dev_dbg(&pdev->
dev,
"Can't register power button: %d\n", err);
88 platform_set_drvdata(pdev, pwr);
95 input_free_device(pwr);
101 struct input_dev *pwr = platform_get_drvdata(pdev);
105 input_unregister_device(pwr);
111 .remove =
__exit_p(twl4030_pwrbutton_remove),
113 .name =
"twl4030_pwrbutton",
118 static int __init twl4030_pwrbutton_init(
void)
121 twl4030_pwrbutton_probe);
125 static void __exit twl4030_pwrbutton_exit(
void)