This source file includes following definitions.
- via_pmu_event_init
- via_pmu_event
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 #include <linux/input.h>
24 #include <linux/adb.h>
25 #include <linux/pmu.h>
26 #include "via-pmu-event.h"
27
28 static struct input_dev *pmu_input_dev;
29
30 static int __init via_pmu_event_init(void)
31 {
32 int err;
33
34
35 if (pmu_get_model() != PMU_KEYLARGO_BASED)
36 return -ENODEV;
37
38 pmu_input_dev = input_allocate_device();
39 if (!pmu_input_dev)
40 return -ENOMEM;
41
42 pmu_input_dev->name = "PMU";
43 pmu_input_dev->id.bustype = BUS_HOST;
44 pmu_input_dev->id.vendor = 0x0001;
45 pmu_input_dev->id.product = 0x0001;
46 pmu_input_dev->id.version = 0x0100;
47
48 set_bit(EV_KEY, pmu_input_dev->evbit);
49 set_bit(EV_SW, pmu_input_dev->evbit);
50 set_bit(KEY_POWER, pmu_input_dev->keybit);
51 set_bit(SW_LID, pmu_input_dev->swbit);
52
53 err = input_register_device(pmu_input_dev);
54 if (err)
55 input_free_device(pmu_input_dev);
56 return err;
57 }
58
59 void via_pmu_event(int key, int down)
60 {
61
62 if (unlikely(!pmu_input_dev))
63 return;
64
65 switch (key) {
66 case PMU_EVT_POWER:
67 input_report_key(pmu_input_dev, KEY_POWER, down);
68 break;
69 case PMU_EVT_LID:
70 input_report_switch(pmu_input_dev, SW_LID, down);
71 break;
72 default:
73
74 return;
75 }
76
77 input_sync(pmu_input_dev);
78 }
79
80 late_initcall(via_pmu_event_init);