23 #include <linux/module.h>
25 #include <linux/slab.h>
27 #ifdef CONFIG_SGI_IP22
30 static inline u8 button_status(
void)
35 return ((status & 0x80) >> 6) | ((status & 0x20) >> 5);
39 #ifdef CONFIG_SGI_IP32
42 static inline u8 button_status(
void)
46 status =
readq(&
mace->perif.audio.control);
47 writeq(status & ~(3
U << 23), &
mace->perif.audio.control);
49 return (status >> 23) & 3;
53 #define BUTTONS_POLL_INTERVAL 30
54 #define BUTTONS_COUNT_THRESHOLD 3
56 static const unsigned short sgi_map[] = {
67 static void handle_buttons(
struct input_polled_dev *
dev)
70 struct input_dev *
input = dev->input;
74 status = button_status();
77 if (status & (1
U << i)) {
80 input_report_key(input, bdev->
keymap[i], 1);
86 input_report_key(input, bdev->
keymap[i], 0);
97 struct input_polled_dev *poll_dev;
98 struct input_dev *
input;
103 if (!bdev || !poll_dev) {
110 poll_dev->private = bdev;
111 poll_dev->poll = handle_buttons;
114 input = poll_dev->input;
115 input->name =
"SGI buttons";
116 input->phys =
"sgi/input0";
118 input->dev.parent = &pdev->
dev;
120 input->keycode = bdev->
keymap;
122 input->keycodesize =
sizeof(
unsigned short);
160 .probe = sgi_buttons_probe,