ia64/linux-2.6.18-xen.hg

view drivers/macintosh/via-pmu-event.c @ 893:f994bfe9b93b

linux/blktap2: reduce TLB flush scope

c/s 885 added very coarse TLB flushing. Since these flushes always
follow single page updates, single page flushes (when available) are
sufficient.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jun 04 10:32:57 2009 +0100 (2009-06-04)
parents 831230e53067
children
line source
1 /*
2 * via-pmu event device for reporting some events that come through the PMU
3 *
4 * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
14 * NON INFRINGEMENT. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
23 #include <linux/input.h>
24 #include <linux/adb.h>
25 #include <linux/pmu.h>
26 #include "via-pmu-event.h"
28 static struct input_dev *pmu_input_dev;
30 static int __init via_pmu_event_init(void)
31 {
32 int err;
34 /* do other models report button/lid status? */
35 if (pmu_get_model() != PMU_KEYLARGO_BASED)
36 return -ENODEV;
38 pmu_input_dev = input_allocate_device();
39 if (!pmu_input_dev)
40 return -ENOMEM;
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;
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);
53 err = input_register_device(pmu_input_dev);
54 if (err)
55 input_free_device(pmu_input_dev);
56 return err;
57 }
59 void via_pmu_event(int key, int down)
60 {
62 if (unlikely(!pmu_input_dev))
63 return;
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 /* no such key handled */
74 return;
75 }
77 input_sync(pmu_input_dev);
78 }
80 late_initcall(via_pmu_event_init);