aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/linux/modules/input.mk
blob: 32adc1ecf49b34df42bf28b465924b575282e3d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
#
# Copyright (C) 2006-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

INPUT_MODULES_MENU:=Input modules

define KernelPackage/hid
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=HID Devices
  KCONFIG:=CONFIG_HID CONFIG_HIDRAW=y
  FILES:=$(LINUX_DIR)/drivers/hid/hid.ko
  AUTOLOAD:=$(call AutoLoad,61,hid)
  $(call AddDepends/input,+kmod-input-evdev)
endef

define KernelPackage/hid/description
 Kernel modules for HID devices
endef

$(eval $(call KernelPackage,hid))

define KernelPackage/hid-generic
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Generic HID device support
  KCONFIG:=CONFIG_HID_GENERIC
  FILES:=$(LINUX_DIR)/drivers/hid/hid-generic.ko
  AUTOLOAD:=$(call AutoProbe,hid-generic)
  $(call AddDepends/hid)
endef

define KernelPackage/hid/description
 Kernel modules for generic HID device (e.g. keyboards and mice) support
endef

$(eval $(call KernelPackage,hid-generic))

define KernelPackage/input-core
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Input device core
  KCONFIG:=CONFIG_INPUT
  FILES:=$(LINUX_DIR)/drivers/input/input-core.ko
endef

define KernelPackage/input-core/description
 Kernel modules for support of input device
endef

$(eval $(call KernelPackage,input-core))


define KernelPackage/input-evdev
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Input event device
  KCONFIG:=CONFIG_INPUT_EVDEV
  FILES:=$(LINUX_DIR)/drivers/input/evdev.ko
  AUTOLOAD:=$(call AutoLoad,60,evdev)
  $(call AddDepends/input)
endef

define KernelPackage/input-evdev/description
 Kernel modules for support of input device events
endef

$(eval $(call KernelPackage,input-evdev))


define KernelPackage/input-gpio-keys
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=GPIO key support
  DEPENDS:= @GPIO_SUPPORT
  KCONFIG:= \
	CONFIG_KEYBOARD_GPIO \
	CONFIG_INPUT_KEYBOARD=y
  FILES:=$(LINUX_DIR)/drivers/input/keyboard/gpio_keys.ko
  AUTOLOAD:=$(call AutoProbe,gpio_keys)
  $(call AddDepends/input)
endef

define KernelPackage/input-gpio-keys/description
 This driver implements support for buttons connected
 to GPIO pins of various CPUs (and some other chips).
endef

$(eval $(call KernelPackage,input-gpio-keys))


define KernelPackage/input-gpio-keys-polled
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Polled GPIO key support
  DEPENDS:=@GPIO_SUPPORT +kmod-input-polldev
  KCONFIG:= \
	CONFIG_KEYBOARD_GPIO_POLLED \
	CONFIG_INPUT_KEYBOARD=y
  FILES:=$(LINUX_DIR)/drivers/input/keyboard/gpio_keys_polled.ko
  AUTOLOAD:=$(call AutoProbe,gpio_keys_polled,1)
  $(call AddDepends/input)
endef

define KernelPackage/input-gpio-keys-polled/description
 Kernel module for support polled GPIO keys input device
endef

$(eval $(call KernelPackage,input-gpio-keys-polled))


define KernelPackage/input-gpio-encoder
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=GPIO rotay encoder
  KCONFIG:=CONFIG_INPUT_GPIO_ROTARY_ENCODER
  FILES:=$(LINUX_DIR)/drivers/input/misc/rotary_encoder.ko
  AUTOLOAD:=$(call AutoProbe,rotary_encoder)
  $(call AddDepends/input,@GPIO_SUPPORT)
endef

define KernelPackage/gpio-encoder/description
 Kernel module to use rotary encoders connected to GPIO pins
endef

$(eval $(call KernelPackage,input-gpio-encoder))


define KernelPackage/input-joydev
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Joystick device support
  KCONFIG:=CONFIG_INPUT_JOYDEV
  FILES:=$(LINUX_DIR)/drivers/input/joydev.ko
  AUTOLOAD:=$(call AutoProbe,joydev)
  $(call AddDepends/input)
endef

define KernelPackage/input-joydev/description
 Kernel module for joystick support
endef

$(eval $(call KernelPackage,input-joydev))


define KernelPackage/input-polldev
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Polled Input device support
  KCONFIG:=CONFIG_INPUT_POLLDEV
  FILES:=$(LINUX_DIR)/drivers/input/input-polldev.ko
  $(call AddDepends/input)
endef

define KernelPackage/input-polldev/description
 Kernel module for support of polled input devices
endef

$(eval $(call KernelPackage,input-polldev))


define KernelPackage/input-matrixkmap
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=Input matrix devices support
  KCONFIG:=CONFIG_INPUT_MATRIXKMAP
  DEPENDS:=@!LINUX_3_3
  FILES:=$(LINUX_DIR)/drivers/input/matrix-keymap.ko
  AUTOLOAD:=$(call AutoProbe,matrix-keymap)
  $(call AddDepends/input)
endef

define KernelPackage/input-matrix/description
 Kernel module support for input matrix devices
endef

$(eval $(call KernelPackage,input-matrixkmap))


define KernelPackage/acpi-button
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=ACPI Button Support
  DEPENDS:=@(TARGET_x86_generic||TARGET_x86_kvm_guest||TARGET_x86_xen_domu) +kmod-input-evdev
  KCONFIG:=CONFIG_ACPI_BUTTON
  FILES:=$(LINUX_DIR)/drivers/acpi/button.ko
  AUTOLOAD:=$(call AutoLoad,06,button)
endef

define KernelPackage/acpi-button/description
 Kernel module for ACPI Button support
endef

$(eval $(call KernelPackage,acpi-button))


define KernelPackage/keyboard-imx
  SUBMENU:=$(INPUT_MODULES_MENU)
  TITLE:=IMX keypad support
  DEPENDS:=@(TARGET_mxs||TARGET_imx6) +kmod-input-matrixkmap
  KCONFIG:= \
	CONFIG_KEYBOARD_IMX \
	CONFIG_INPUT_KEYBOARD=y
  FILES:=$(LINUX_DIR)/drivers/input/keyboard/imx_keypad.ko
  AUTOLOAD:=$(call AutoProbe,imx_keypad)
endef

define KernelPackage/keyboard-imx/description
 Enable support for IMX keypad port.
endef

$(eval $(call KernelPackage,keyboard-imx))
class="s">"GPL"); struct pci_dev *xen_platform_pdev; static unsigned long shared_info_frame; static uint64_t callback_via; static int __devinit init_xen_info(void) { struct xen_add_to_physmap xatp; extern void *shared_info_area; #ifdef __ia64__ xencomm_initialize(); #endif setup_xen_features(); shared_info_frame = alloc_xen_mmio(PAGE_SIZE) >> PAGE_SHIFT; xatp.domid = DOMID_SELF; xatp.idx = 0; xatp.space = XENMAPSPACE_shared_info; xatp.gpfn = shared_info_frame; if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) BUG(); shared_info_area = ioremap(shared_info_frame << PAGE_SHIFT, PAGE_SIZE); if (shared_info_area == NULL) panic("can't map shared info\n"); return 0; } static unsigned long platform_mmio; static unsigned long platform_mmio_alloc; static unsigned long platform_mmiolen; unsigned long alloc_xen_mmio(unsigned long len) { unsigned long addr; addr = platform_mmio + platform_mmio_alloc; platform_mmio_alloc += len; BUG_ON(platform_mmio_alloc > platform_mmiolen); return addr; } #ifndef __ia64__ static uint32_t xen_cpuid_base(void) { uint32_t base, eax, ebx, ecx, edx; char signature[13]; for (base = 0x40000000; base < 0x40001000; base += 0x100) { cpuid(base, &eax, &ebx, &ecx, &edx); *(uint32_t*)(signature + 0) = ebx; *(uint32_t*)(signature + 4) = ecx; *(uint32_t*)(signature + 8) = edx; signature[12] = 0; if (!strcmp("XenVMMXenVMM", signature) && ((eax - base) >= 2)) return base; } return 0; } static int init_hypercall_stubs(void) { uint32_t eax, ebx, ecx, edx, pages, msr, i, base; base = xen_cpuid_base(); if (base == 0) { printk(KERN_WARNING "Detected Xen platform device but not Xen VMM?\n"); return -EINVAL; } cpuid(base + 1, &eax, &ebx, &ecx, &edx); printk(KERN_INFO "Xen version %d.%d.\n", eax >> 16, eax & 0xffff); /* * Find largest supported number of hypercall pages. * We'll create as many as possible up to this number. */ cpuid(base + 2, &pages, &msr, &ecx, &edx); /* * Use __vmalloc() because vmalloc_exec() is not an exported symbol. * PAGE_KERNEL_EXEC also is not exported, hence we use PAGE_KERNEL. * hypercall_stubs = vmalloc_exec(pages * PAGE_SIZE); */ while (pages > 0) { hypercall_stubs = __vmalloc( pages * PAGE_SIZE, GFP_KERNEL | __GFP_HIGHMEM, __pgprot(__PAGE_KERNEL & ~_PAGE_NX)); if (hypercall_stubs != NULL) break; pages--; /* vmalloc failed: try one fewer pages */ } if (hypercall_stubs == NULL) return -ENOMEM; for (i = 0; i < pages; i++) { unsigned long pfn; pfn = vmalloc_to_pfn((char *)hypercall_stubs + i*PAGE_SIZE); wrmsrl(msr, ((u64)pfn << PAGE_SHIFT) + i); } nr_hypercall_stub_pages = pages; max_hypercall_stub_pages = pages; printk(KERN_INFO "Hypercall area is %u pages.\n", pages); return 0; } static void resume_hypercall_stubs(void) { uint32_t base, ecx, edx, pages, msr, i; base = xen_cpuid_base(); BUG_ON(base == 0); cpuid(base + 2, &pages, &msr, &ecx, &edx); if (pages > max_hypercall_stub_pages) pages = max_hypercall_stub_pages; for (i = 0; i < pages; i++) { unsigned long pfn; pfn = vmalloc_to_pfn((char *)hypercall_stubs + i*PAGE_SIZE); wrmsrl(msr, ((u64)pfn << PAGE_SHIFT) + i); } nr_hypercall_stub_pages = pages; } #else /* __ia64__ */ #define init_hypercall_stubs() (0) #define resume_hypercall_stubs() ((void)0) #endif static uint64_t get_callback_via(struct pci_dev *pdev) { u8 pin; int irq; #ifdef __ia64__ for (irq = 0; irq < 16; irq++) { if (isa_irq_to_vector(irq) == pdev->irq) return irq; /* ISA IRQ */ } #else /* !__ia64__ */ irq = pdev->irq; if (irq < 16) return irq; /* ISA IRQ */ #endif #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) pin = pdev->pin; #else pci_read_config_byte(pdev, PCI_INTERRUPT_PIN, &pin); #endif /* We don't know the GSI. Specify the PCI INTx line instead. */ return (((uint64_t)0x01 << 56) | /* PCI INTx identifier */ ((uint64_t)pci_domain_nr(pdev->bus) << 32) | ((uint64_t)pdev->bus->number << 16) | ((uint64_t)(pdev->devfn & 0xff) << 8) | ((uint64_t)(pin - 1) & 3)); } static int set_callback_via(uint64_t via) { struct xen_hvm_param a; a.domid = DOMID_SELF; a.index = HVM_PARAM_CALLBACK_IRQ; a.value = via; return HYPERVISOR_hvm_op(HVMOP_set_param, &a); } int xen_irq_init(struct pci_dev *pdev); int xenbus_init(void); int xen_reboot_init(void); int xen_panic_handler_init(void); int gnttab_init(void); #define XEN_IOPORT_BASE 0x10 #define XEN_IOPORT_PLATFLAGS (XEN_IOPORT_BASE + 0) /* 1 byte access (R/W) */ #define XEN_IOPORT_MAGIC (XEN_IOPORT_BASE + 0) /* 2 byte access (R) */ #define XEN_IOPORT_UNPLUG (XEN_IOPORT_BASE + 0) /* 2 byte access (W) */ #define XEN_IOPORT_DRVVER (XEN_IOPORT_BASE + 0) /* 4 byte access (W) */ #define XEN_IOPORT_SYSLOG (XEN_IOPORT_BASE + 2) /* 1 byte access (W) */ #define XEN_IOPORT_PROTOVER (XEN_IOPORT_BASE + 2) /* 1 byte access (R) */ #define XEN_IOPORT_PRODNUM (XEN_IOPORT_BASE + 2) /* 2 byte access (W) */ #define XEN_IOPORT_MAGIC_VAL 0x49d2 #define XEN_IOPORT_LINUX_PRODNUM 0xffff /* NB: register a proper one */ #define XEN_IOPORT_LINUX_DRVVER ((LINUX_VERSION_CODE << 8) + 0x0) static int check_platform_magic(struct device *dev, long ioaddr, long iolen) { short magic; char protocol; if (iolen < 0x16) return -ENODEV; magic = inw(XEN_IOPORT_MAGIC); if (magic != XEN_IOPORT_MAGIC_VAL) { dev_err(dev, "invalid magic %#x", magic); return -ENODEV; } protocol = inb(XEN_IOPORT_PROTOVER); dev_info(dev, "I/O protocol version %d\n", protocol); switch (protocol) { case 1: outw(XEN_IOPORT_PRODNUM, 0xbeef); outl(XEN_IOPORT_DRVVER, 0xdead); if (inw(XEN_IOPORT_MAGIC) != XEN_IOPORT_MAGIC_VAL) { dev_err(dev, "blacklisted by host\n"); return -ENODEV; } /* Fall through */ case 0: outw(XEN_IOPORT_UNPLUG, 0xf); break; default: dev_err(dev, "unknown qemu version\n"); return -ENODEV; } return 0; } static int __devinit platform_pci_init(struct pci_dev *pdev, const struct pci_device_id *ent) { int i, ret; long ioaddr, iolen; long mmio_addr, mmio_len; if (xen_platform_pdev) return -EBUSY; xen_platform_pdev = pdev; i = pci_enable_device(pdev); if (i) return i; ioaddr = pci_resource_start(pdev, 0); iolen = pci_resource_len(pdev, 0); mmio_addr = pci_resource_start(pdev, 1); mmio_len = pci_resource_len(pdev, 1); callback_via = get_callback_via(pdev); if (mmio_addr == 0 || ioaddr == 0 || callback_via == 0) { printk(KERN_WARNING DRV_NAME ":no resources found\n"); return -ENOENT; } if (request_mem_region(mmio_addr, mmio_len, DRV_NAME) == NULL) { printk(KERN_ERR ":MEM I/O resource 0x%lx @ 0x%lx busy\n", mmio_addr, mmio_len); return -EBUSY; } if (request_region(ioaddr, iolen, DRV_NAME) == NULL) { printk(KERN_ERR DRV_NAME ":I/O resource 0x%lx @ 0x%lx busy\n", iolen, ioaddr); release_mem_region(mmio_addr, mmio_len); return -EBUSY; } platform_mmio = mmio_addr; platform_mmiolen = mmio_len; ret = init_hypercall_stubs(); if (ret < 0) goto out; ret = check_platform_magic(&pdev->dev, ioaddr, iolen); if (ret < 0) goto out; if ((ret = init_xen_info())) goto out; if ((ret = gnttab_init())) goto out; if ((ret = xen_irq_init(pdev))) goto out; if ((ret = set_callback_via(callback_via))) goto out; if ((ret = xenbus_init())) goto out; if ((ret = xen_reboot_init())) goto out; if ((ret = xen_panic_handler_init())) goto out; out: if (ret) { release_mem_region(mmio_addr, mmio_len); release_region(ioaddr, iolen); } return ret; } #define XEN_PLATFORM_VENDOR_ID 0x5853 #define XEN_PLATFORM_DEVICE_ID 0x0001 static struct pci_device_id platform_pci_tbl[] __devinitdata = { {XEN_PLATFORM_VENDOR_ID, XEN_PLATFORM_DEVICE_ID, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, /* Continue to recognise the old ID for now */ {0xfffd, 0x0101, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, {0,} }; MODULE_DEVICE_TABLE(pci, platform_pci_tbl); static struct pci_driver platform_driver = { name: DRV_NAME, probe: platform_pci_init, id_table: platform_pci_tbl, }; static int pci_device_registered; void platform_pci_resume(void) { struct xen_add_to_physmap xatp; resume_hypercall_stubs(); xatp.domid = DOMID_SELF; xatp.idx = 0; xatp.space = XENMAPSPACE_shared_info; xatp.gpfn = shared_info_frame; if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp)) BUG(); if (set_callback_via(callback_via)) printk("platform_pci_resume failure!\n"); } static int __init platform_pci_module_init(void) { int rc; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,10) rc = pci_module_init(&platform_driver); #else rc = pci_register_driver(&platform_driver); #endif if (rc) { printk(KERN_INFO DRV_NAME ": No platform pci device model found\n"); return rc; } pci_device_registered = 1; return 0; } module_init(platform_pci_module_init);