22 #include <linux/kernel.h>
23 #include <linux/module.h>
24 #include <linux/input.h>
27 #include <linux/slab.h>
29 #define PM800_LONG_ONKEY_EN (1 << 0)
30 #define PM800_LONG_KEY_DELAY (8)
31 #define PM800_LONKEY_PRESS_TIME ((PM800_LONG_KEY_DELAY-1) << 4)
32 #define PM800_LONKEY_PRESS_TIME_MASK (0xF0)
33 #define PM800_SW_PDOWN (1 << 5)
51 dev_err(info->
idev->dev.parent,
"failed to read status: %d\n", ret);
57 input_sync(info->
idev);
92 info->
idev = input_allocate_device();
94 dev_err(&pdev->
dev,
"Failed to allocate input dev\n");
99 info->
idev->name =
"88pm80x_on";
100 info->
idev->phys =
"88pm80x_on/input0";
102 info->
idev->dev.parent = &pdev->
dev;
106 err = pm80x_request_irq(info->
pm80x, info->
irq, pm80x_onkey_handler,
109 dev_err(&pdev->
dev,
"Failed to request IRQ: #%d: %d\n",
114 err = input_register_device(info->
idev);
116 dev_err(&pdev->
dev,
"Can't register input device: %d\n", err);
120 platform_set_drvdata(pdev, info);
134 pm80x_free_irq(info->
pm80x, info->
irq, info);
136 input_free_device(info->
idev);
147 pm80x_free_irq(info->
pm80x, info->
irq, info);
148 input_unregister_device(info->
idev);
155 .name =
"88pm80x-onkey",
157 .pm = &pm80x_onkey_pm_ops,
159 .probe = pm80x_onkey_probe,