diff options
author | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
---|---|---|
committer | Glenn Elliott <gelliott@cs.unc.edu> | 2012-03-04 19:47:13 -0500 |
commit | c71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch) | |
tree | ecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/media/IR | |
parent | ea53c912f8a86a8567697115b6a0d8152beee5c8 (diff) | |
parent | 6a00f206debf8a5c8899055726ad127dbeeed098 (diff) |
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts:
litmus/sched_cedf.c
Diffstat (limited to 'drivers/media/IR')
94 files changed, 0 insertions, 16519 deletions
diff --git a/drivers/media/IR/Kconfig b/drivers/media/IR/Kconfig deleted file mode 100644 index 490c57cc4cfe..000000000000 --- a/drivers/media/IR/Kconfig +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | menuconfig IR_CORE | ||
2 | tristate "Infrared remote controller adapters" | ||
3 | depends on INPUT | ||
4 | default INPUT | ||
5 | ---help--- | ||
6 | Enable support for Remote Controllers on Linux. This is | ||
7 | needed in order to support several video capture adapters. | ||
8 | |||
9 | Enable this option if you have a video capture board even | ||
10 | if you don't need IR, as otherwise, you may not be able to | ||
11 | compile the driver for your adapter. | ||
12 | |||
13 | config VIDEO_IR | ||
14 | tristate | ||
15 | depends on IR_CORE | ||
16 | default IR_CORE | ||
17 | |||
18 | if IR_CORE | ||
19 | |||
20 | config LIRC | ||
21 | tristate | ||
22 | default y | ||
23 | |||
24 | ---help--- | ||
25 | Enable this option to build the Linux Infrared Remote | ||
26 | Control (LIRC) core device interface driver. The LIRC | ||
27 | interface passes raw IR to and from userspace, where the | ||
28 | LIRC daemon handles protocol decoding for IR reception and | ||
29 | encoding for IR transmitting (aka "blasting"). | ||
30 | |||
31 | source "drivers/media/IR/keymaps/Kconfig" | ||
32 | |||
33 | config IR_NEC_DECODER | ||
34 | tristate "Enable IR raw decoder for the NEC protocol" | ||
35 | depends on IR_CORE | ||
36 | select BITREVERSE | ||
37 | default y | ||
38 | |||
39 | ---help--- | ||
40 | Enable this option if you have IR with NEC protocol, and | ||
41 | if the IR is decoded in software | ||
42 | |||
43 | config IR_RC5_DECODER | ||
44 | tristate "Enable IR raw decoder for the RC-5 protocol" | ||
45 | depends on IR_CORE | ||
46 | select BITREVERSE | ||
47 | default y | ||
48 | |||
49 | ---help--- | ||
50 | Enable this option if you have IR with RC-5 protocol, and | ||
51 | if the IR is decoded in software | ||
52 | |||
53 | config IR_RC6_DECODER | ||
54 | tristate "Enable IR raw decoder for the RC6 protocol" | ||
55 | depends on IR_CORE | ||
56 | select BITREVERSE | ||
57 | default y | ||
58 | |||
59 | ---help--- | ||
60 | Enable this option if you have an infrared remote control which | ||
61 | uses the RC6 protocol, and you need software decoding support. | ||
62 | |||
63 | config IR_JVC_DECODER | ||
64 | tristate "Enable IR raw decoder for the JVC protocol" | ||
65 | depends on IR_CORE | ||
66 | select BITREVERSE | ||
67 | default y | ||
68 | |||
69 | ---help--- | ||
70 | Enable this option if you have an infrared remote control which | ||
71 | uses the JVC protocol, and you need software decoding support. | ||
72 | |||
73 | config IR_SONY_DECODER | ||
74 | tristate "Enable IR raw decoder for the Sony protocol" | ||
75 | depends on IR_CORE | ||
76 | default y | ||
77 | |||
78 | ---help--- | ||
79 | Enable this option if you have an infrared remote control which | ||
80 | uses the Sony protocol, and you need software decoding support. | ||
81 | |||
82 | config IR_LIRC_CODEC | ||
83 | tristate "Enable IR to LIRC bridge" | ||
84 | depends on IR_CORE | ||
85 | depends on LIRC | ||
86 | default y | ||
87 | |||
88 | ---help--- | ||
89 | Enable this option to pass raw IR to and from userspace via | ||
90 | the LIRC interface. | ||
91 | |||
92 | config IR_IMON | ||
93 | tristate "SoundGraph iMON Receiver and Display" | ||
94 | depends on USB_ARCH_HAS_HCD | ||
95 | depends on IR_CORE | ||
96 | select USB | ||
97 | ---help--- | ||
98 | Say Y here if you want to use a SoundGraph iMON (aka Antec Veris) | ||
99 | IR Receiver and/or LCD/VFD/VGA display. | ||
100 | |||
101 | To compile this driver as a module, choose M here: the | ||
102 | module will be called imon. | ||
103 | |||
104 | config IR_MCEUSB | ||
105 | tristate "Windows Media Center Ed. eHome Infrared Transceiver" | ||
106 | depends on USB_ARCH_HAS_HCD | ||
107 | depends on IR_CORE | ||
108 | select USB | ||
109 | ---help--- | ||
110 | Say Y here if you want to use a Windows Media Center Edition | ||
111 | eHome Infrared Transceiver. | ||
112 | |||
113 | To compile this driver as a module, choose M here: the | ||
114 | module will be called mceusb. | ||
115 | |||
116 | config IR_ENE | ||
117 | tristate "ENE eHome Receiver/Transciever (pnp id: ENE0100/ENE02xxx)" | ||
118 | depends on PNP | ||
119 | depends on IR_CORE | ||
120 | ---help--- | ||
121 | Say Y here to enable support for integrated infrared receiver | ||
122 | /transciever made by ENE. | ||
123 | |||
124 | You can see if you have it by looking at lspnp output. | ||
125 | Output should include ENE0100 ENE0200 or something similiar. | ||
126 | |||
127 | To compile this driver as a module, choose M here: the | ||
128 | module will be called ene_ir. | ||
129 | |||
130 | config IR_STREAMZAP | ||
131 | tristate "Streamzap PC Remote IR Receiver" | ||
132 | depends on USB_ARCH_HAS_HCD | ||
133 | depends on IR_CORE | ||
134 | select USB | ||
135 | ---help--- | ||
136 | Say Y here if you want to use a Streamzap PC Remote | ||
137 | Infrared Receiver. | ||
138 | |||
139 | To compile this driver as a module, choose M here: the | ||
140 | module will be called streamzap. | ||
141 | |||
142 | endif #IR_CORE | ||
diff --git a/drivers/media/IR/Makefile b/drivers/media/IR/Makefile deleted file mode 100644 index 53676838fe97..000000000000 --- a/drivers/media/IR/Makefile +++ /dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | ir-common-objs := ir-functions.o | ||
2 | ir-core-objs := ir-keytable.o ir-sysfs.o ir-raw-event.o rc-map.o | ||
3 | |||
4 | obj-y += keymaps/ | ||
5 | |||
6 | obj-$(CONFIG_IR_CORE) += ir-core.o | ||
7 | obj-$(CONFIG_VIDEO_IR) += ir-common.o | ||
8 | obj-$(CONFIG_LIRC) += lirc_dev.o | ||
9 | obj-$(CONFIG_IR_NEC_DECODER) += ir-nec-decoder.o | ||
10 | obj-$(CONFIG_IR_RC5_DECODER) += ir-rc5-decoder.o | ||
11 | obj-$(CONFIG_IR_RC6_DECODER) += ir-rc6-decoder.o | ||
12 | obj-$(CONFIG_IR_JVC_DECODER) += ir-jvc-decoder.o | ||
13 | obj-$(CONFIG_IR_SONY_DECODER) += ir-sony-decoder.o | ||
14 | obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o | ||
15 | |||
16 | # stand-alone IR receivers/transmitters | ||
17 | obj-$(CONFIG_IR_IMON) += imon.o | ||
18 | obj-$(CONFIG_IR_MCEUSB) += mceusb.o | ||
19 | obj-$(CONFIG_IR_ENE) += ene_ir.o | ||
20 | obj-$(CONFIG_IR_STREAMZAP) += streamzap.o | ||
diff --git a/drivers/media/IR/ene_ir.c b/drivers/media/IR/ene_ir.c deleted file mode 100644 index 5447750f5e38..000000000000 --- a/drivers/media/IR/ene_ir.c +++ /dev/null | |||
@@ -1,1023 +0,0 @@ | |||
1 | /* | ||
2 | * driver for ENE KB3926 B/C/D CIR (pnp id: ENE0XXX) | ||
3 | * | ||
4 | * Copyright (C) 2010 Maxim Levitsky <maximlevitsky@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation; either version 2 of the | ||
9 | * License, or (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. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
19 | * USA | ||
20 | */ | ||
21 | |||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/module.h> | ||
24 | #include <linux/pnp.h> | ||
25 | #include <linux/io.h> | ||
26 | #include <linux/interrupt.h> | ||
27 | #include <linux/sched.h> | ||
28 | #include <linux/slab.h> | ||
29 | #include <linux/input.h> | ||
30 | #include <media/ir-core.h> | ||
31 | #include <media/ir-common.h> | ||
32 | #include "ene_ir.h" | ||
33 | |||
34 | |||
35 | static int sample_period = -1; | ||
36 | static int enable_idle = 1; | ||
37 | static int input = 1; | ||
38 | static int debug; | ||
39 | static int txsim; | ||
40 | |||
41 | static int ene_irq_status(struct ene_device *dev); | ||
42 | |||
43 | /* read a hardware register */ | ||
44 | static u8 ene_hw_read_reg(struct ene_device *dev, u16 reg) | ||
45 | { | ||
46 | u8 retval; | ||
47 | outb(reg >> 8, dev->hw_io + ENE_ADDR_HI); | ||
48 | outb(reg & 0xFF, dev->hw_io + ENE_ADDR_LO); | ||
49 | retval = inb(dev->hw_io + ENE_IO); | ||
50 | |||
51 | ene_dbg_verbose("reg %04x == %02x", reg, retval); | ||
52 | return retval; | ||
53 | } | ||
54 | |||
55 | /* write a hardware register */ | ||
56 | static void ene_hw_write_reg(struct ene_device *dev, u16 reg, u8 value) | ||
57 | { | ||
58 | outb(reg >> 8, dev->hw_io + ENE_ADDR_HI); | ||
59 | outb(reg & 0xFF, dev->hw_io + ENE_ADDR_LO); | ||
60 | outb(value, dev->hw_io + ENE_IO); | ||
61 | |||
62 | ene_dbg_verbose("reg %04x <- %02x", reg, value); | ||
63 | } | ||
64 | |||
65 | /* change specific bits in hardware register */ | ||
66 | static void ene_hw_write_reg_mask(struct ene_device *dev, | ||
67 | u16 reg, u8 value, u8 mask) | ||
68 | { | ||
69 | u8 regvalue; | ||
70 | |||
71 | outb(reg >> 8, dev->hw_io + ENE_ADDR_HI); | ||
72 | outb(reg & 0xFF, dev->hw_io + ENE_ADDR_LO); | ||
73 | |||
74 | regvalue = inb(dev->hw_io + ENE_IO) & ~mask; | ||
75 | regvalue |= (value & mask); | ||
76 | outb(regvalue, dev->hw_io + ENE_IO); | ||
77 | |||
78 | ene_dbg_verbose("reg %04x <- %02x (mask=%02x)", reg, value, mask); | ||
79 | } | ||
80 | |||
81 | /* detect hardware features */ | ||
82 | static int ene_hw_detect(struct ene_device *dev) | ||
83 | { | ||
84 | u8 chip_major, chip_minor; | ||
85 | u8 hw_revision, old_ver; | ||
86 | u8 tmp; | ||
87 | u8 fw_capabilities; | ||
88 | int pll_freq; | ||
89 | |||
90 | tmp = ene_hw_read_reg(dev, ENE_HW_UNK); | ||
91 | ene_hw_write_reg(dev, ENE_HW_UNK, tmp & ~ENE_HW_UNK_CLR); | ||
92 | |||
93 | chip_major = ene_hw_read_reg(dev, ENE_HW_VER_MAJOR); | ||
94 | chip_minor = ene_hw_read_reg(dev, ENE_HW_VER_MINOR); | ||
95 | |||
96 | ene_hw_write_reg(dev, ENE_HW_UNK, tmp); | ||
97 | hw_revision = ene_hw_read_reg(dev, ENE_HW_VERSION); | ||
98 | old_ver = ene_hw_read_reg(dev, ENE_HW_VER_OLD); | ||
99 | |||
100 | pll_freq = (ene_hw_read_reg(dev, ENE_PLLFRH) << 4) + | ||
101 | (ene_hw_read_reg(dev, ENE_PLLFRL) >> 4); | ||
102 | |||
103 | if (pll_freq != 1000) | ||
104 | dev->rx_period_adjust = 4; | ||
105 | else | ||
106 | dev->rx_period_adjust = 2; | ||
107 | |||
108 | |||
109 | ene_printk(KERN_NOTICE, "PLL freq = %d\n", pll_freq); | ||
110 | |||
111 | if (hw_revision == 0xFF) { | ||
112 | |||
113 | ene_printk(KERN_WARNING, "device seems to be disabled\n"); | ||
114 | ene_printk(KERN_WARNING, | ||
115 | "send a mail to lirc-list@lists.sourceforge.net\n"); | ||
116 | ene_printk(KERN_WARNING, "please attach output of acpidump\n"); | ||
117 | return -ENODEV; | ||
118 | } | ||
119 | |||
120 | if (chip_major == 0x33) { | ||
121 | ene_printk(KERN_WARNING, "chips 0x33xx aren't supported\n"); | ||
122 | return -ENODEV; | ||
123 | } | ||
124 | |||
125 | if (chip_major == 0x39 && chip_minor == 0x26 && hw_revision == 0xC0) { | ||
126 | dev->hw_revision = ENE_HW_C; | ||
127 | } else if (old_ver == 0x24 && hw_revision == 0xC0) { | ||
128 | dev->hw_revision = ENE_HW_B; | ||
129 | ene_printk(KERN_NOTICE, "KB3926B detected\n"); | ||
130 | } else { | ||
131 | dev->hw_revision = ENE_HW_D; | ||
132 | ene_printk(KERN_WARNING, | ||
133 | "unknown ENE chip detected, assuming KB3926D\n"); | ||
134 | ene_printk(KERN_WARNING, | ||
135 | "driver support might be not complete"); | ||
136 | |||
137 | } | ||
138 | |||
139 | ene_printk(KERN_DEBUG, | ||
140 | "chip is 0x%02x%02x - kbver = 0x%02x, rev = 0x%02x\n", | ||
141 | chip_major, chip_minor, old_ver, hw_revision); | ||
142 | |||
143 | /* detect features hardware supports */ | ||
144 | if (dev->hw_revision < ENE_HW_C) | ||
145 | return 0; | ||
146 | |||
147 | fw_capabilities = ene_hw_read_reg(dev, ENE_FW2); | ||
148 | ene_dbg("Firmware capabilities: %02x", fw_capabilities); | ||
149 | |||
150 | dev->hw_gpio40_learning = fw_capabilities & ENE_FW2_GP40_AS_LEARN; | ||
151 | dev->hw_learning_and_tx_capable = fw_capabilities & ENE_FW2_LEARNING; | ||
152 | |||
153 | dev->hw_fan_as_normal_input = dev->hw_learning_and_tx_capable && | ||
154 | (fw_capabilities & ENE_FW2_FAN_AS_NRML_IN); | ||
155 | |||
156 | ene_printk(KERN_NOTICE, "hardware features:\n"); | ||
157 | ene_printk(KERN_NOTICE, | ||
158 | "learning and transmit %s, gpio40_learn %s, fan_in %s\n", | ||
159 | dev->hw_learning_and_tx_capable ? "on" : "off", | ||
160 | dev->hw_gpio40_learning ? "on" : "off", | ||
161 | dev->hw_fan_as_normal_input ? "on" : "off"); | ||
162 | |||
163 | if (dev->hw_learning_and_tx_capable) { | ||
164 | ene_printk(KERN_WARNING, | ||
165 | "Device supports transmitting, but that support is\n"); | ||
166 | ene_printk(KERN_WARNING, | ||
167 | "lightly tested. Please test it and mail\n"); | ||
168 | ene_printk(KERN_WARNING, | ||
169 | "lirc-list@lists.sourceforge.net\n"); | ||
170 | } | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | /* this enables/disables IR input via gpio40*/ | ||
175 | static void ene_enable_gpio40_receive(struct ene_device *dev, int enable) | ||
176 | { | ||
177 | ene_hw_write_reg_mask(dev, ENE_CIR_CONF2, enable ? | ||
178 | 0 : ENE_CIR_CONF2_GPIO40DIS, | ||
179 | ENE_CIR_CONF2_GPIO40DIS); | ||
180 | } | ||
181 | |||
182 | /* this enables/disables IR via standard input */ | ||
183 | static void ene_enable_normal_receive(struct ene_device *dev, int enable) | ||
184 | { | ||
185 | ene_hw_write_reg(dev, ENE_CIR_CONF1, enable ? ENE_CIR_CONF1_RX_ON : 0); | ||
186 | } | ||
187 | |||
188 | /* this enables/disables IR input via unused fan tachtometer input */ | ||
189 | static void ene_enable_fan_receive(struct ene_device *dev, int enable) | ||
190 | { | ||
191 | if (!enable) | ||
192 | ene_hw_write_reg(dev, ENE_FAN_AS_IN1, 0); | ||
193 | else { | ||
194 | ene_hw_write_reg(dev, ENE_FAN_AS_IN1, ENE_FAN_AS_IN1_EN); | ||
195 | ene_hw_write_reg(dev, ENE_FAN_AS_IN2, ENE_FAN_AS_IN2_EN); | ||
196 | } | ||
197 | dev->rx_fan_input_inuse = enable; | ||
198 | } | ||
199 | |||
200 | |||
201 | /* Sense current received carrier */ | ||
202 | static int ene_rx_sense_carrier(struct ene_device *dev) | ||
203 | { | ||
204 | int period = ene_hw_read_reg(dev, ENE_RX_CARRIER); | ||
205 | int carrier; | ||
206 | ene_dbg("RX: hardware carrier period = %02x", period); | ||
207 | |||
208 | if (!(period & ENE_RX_CARRIER_VALID)) | ||
209 | return 0; | ||
210 | |||
211 | period &= ~ENE_RX_CARRIER_VALID; | ||
212 | |||
213 | if (!period) | ||
214 | return 0; | ||
215 | |||
216 | carrier = 2000000 / period; | ||
217 | ene_dbg("RX: sensed carrier = %d Hz", carrier); | ||
218 | return carrier; | ||
219 | } | ||
220 | |||
221 | /* determine which input to use*/ | ||
222 | static void ene_rx_set_inputs(struct ene_device *dev) | ||
223 | { | ||
224 | int learning_mode = dev->learning_enabled; | ||
225 | |||
226 | ene_dbg("RX: setup receiver, learning mode = %d", learning_mode); | ||
227 | |||
228 | ene_enable_normal_receive(dev, 1); | ||
229 | |||
230 | /* old hardware doesn't support learning mode for sure */ | ||
231 | if (dev->hw_revision <= ENE_HW_B) | ||
232 | return; | ||
233 | |||
234 | /* receiver not learning capable, still set gpio40 correctly */ | ||
235 | if (!dev->hw_learning_and_tx_capable) { | ||
236 | ene_enable_gpio40_receive(dev, !dev->hw_gpio40_learning); | ||
237 | return; | ||
238 | } | ||
239 | |||
240 | /* enable learning mode */ | ||
241 | if (learning_mode) { | ||
242 | ene_enable_gpio40_receive(dev, dev->hw_gpio40_learning); | ||
243 | |||
244 | /* fan input is not used for learning */ | ||
245 | if (dev->hw_fan_as_normal_input) | ||
246 | ene_enable_fan_receive(dev, 0); | ||
247 | |||
248 | /* disable learning mode */ | ||
249 | } else { | ||
250 | if (dev->hw_fan_as_normal_input) { | ||
251 | ene_enable_fan_receive(dev, 1); | ||
252 | ene_enable_normal_receive(dev, 0); | ||
253 | } else | ||
254 | ene_enable_gpio40_receive(dev, | ||
255 | !dev->hw_gpio40_learning); | ||
256 | } | ||
257 | |||
258 | /* set few additional settings for this mode */ | ||
259 | ene_hw_write_reg_mask(dev, ENE_CIR_CONF1, learning_mode ? | ||
260 | ENE_CIR_CONF1_LEARN1 : 0, ENE_CIR_CONF1_LEARN1); | ||
261 | |||
262 | ene_hw_write_reg_mask(dev, ENE_CIR_CONF2, learning_mode ? | ||
263 | ENE_CIR_CONF2_LEARN2 : 0, ENE_CIR_CONF2_LEARN2); | ||
264 | |||
265 | if (dev->rx_fan_input_inuse) { | ||
266 | dev->props->rx_resolution = ENE_SAMPLE_PERIOD_FAN * 1000; | ||
267 | |||
268 | dev->props->timeout = | ||
269 | ENE_FAN_VALUE_MASK * ENE_SAMPLE_PERIOD_FAN * 1000; | ||
270 | } else { | ||
271 | dev->props->rx_resolution = sample_period * 1000; | ||
272 | dev->props->timeout = ENE_MAXGAP * 1000; | ||
273 | } | ||
274 | } | ||
275 | |||
276 | /* Enable the device for receive */ | ||
277 | static void ene_rx_enable(struct ene_device *dev) | ||
278 | { | ||
279 | u8 reg_value; | ||
280 | |||
281 | if (dev->hw_revision < ENE_HW_C) { | ||
282 | ene_hw_write_reg(dev, ENEB_IRQ, dev->irq << 1); | ||
283 | ene_hw_write_reg(dev, ENEB_IRQ_UNK1, 0x01); | ||
284 | } else { | ||
285 | reg_value = ene_hw_read_reg(dev, ENEC_IRQ) & 0xF0; | ||
286 | reg_value |= ENEC_IRQ_UNK_EN; | ||
287 | reg_value &= ~ENEC_IRQ_STATUS; | ||
288 | reg_value |= (dev->irq & ENEC_IRQ_MASK); | ||
289 | ene_hw_write_reg(dev, ENEC_IRQ, reg_value); | ||
290 | ene_hw_write_reg(dev, ENE_TX_UNK1, 0x63); | ||
291 | } | ||
292 | |||
293 | ene_hw_write_reg(dev, ENE_CIR_CONF2, 0x00); | ||
294 | ene_rx_set_inputs(dev); | ||
295 | |||
296 | /* set sampling period */ | ||
297 | ene_hw_write_reg(dev, ENE_CIR_SAMPLE_PERIOD, sample_period); | ||
298 | |||
299 | /* ack any pending irqs - just in case */ | ||
300 | ene_irq_status(dev); | ||
301 | |||
302 | /* enable firmware bits */ | ||
303 | ene_hw_write_reg_mask(dev, ENE_FW1, | ||
304 | ENE_FW1_ENABLE | ENE_FW1_IRQ, | ||
305 | ENE_FW1_ENABLE | ENE_FW1_IRQ); | ||
306 | |||
307 | /* enter idle mode */ | ||
308 | ir_raw_event_set_idle(dev->idev, 1); | ||
309 | ir_raw_event_reset(dev->idev); | ||
310 | |||
311 | } | ||
312 | |||
313 | /* Disable the device receiver */ | ||
314 | static void ene_rx_disable(struct ene_device *dev) | ||
315 | { | ||
316 | /* disable inputs */ | ||
317 | ene_enable_normal_receive(dev, 0); | ||
318 | |||
319 | if (dev->hw_fan_as_normal_input) | ||
320 | ene_enable_fan_receive(dev, 0); | ||
321 | |||
322 | /* disable hardware IRQ and firmware flag */ | ||
323 | ene_hw_write_reg_mask(dev, ENE_FW1, 0, ENE_FW1_ENABLE | ENE_FW1_IRQ); | ||
324 | |||
325 | ir_raw_event_set_idle(dev->idev, 1); | ||
326 | ir_raw_event_reset(dev->idev); | ||
327 | } | ||
328 | |||
329 | |||
330 | /* prepare transmission */ | ||
331 | static void ene_tx_prepare(struct ene_device *dev) | ||
332 | { | ||
333 | u8 conf1; | ||
334 | |||
335 | conf1 = ene_hw_read_reg(dev, ENE_CIR_CONF1); | ||
336 | dev->saved_conf1 = conf1; | ||
337 | |||
338 | if (dev->hw_revision == ENE_HW_C) | ||
339 | conf1 &= ~ENE_CIR_CONF1_TX_CLEAR; | ||
340 | |||
341 | /* Enable TX engine */ | ||
342 | conf1 |= ENE_CIR_CONF1_TX_ON; | ||
343 | |||
344 | /* Set carrier */ | ||
345 | if (dev->tx_period) { | ||
346 | |||
347 | /* NOTE: duty cycle handling is just a guess, it might | ||
348 | not be aviable. Default values were tested */ | ||
349 | int tx_period_in500ns = dev->tx_period * 2; | ||
350 | |||
351 | int tx_pulse_width_in_500ns = | ||
352 | tx_period_in500ns / (100 / dev->tx_duty_cycle); | ||
353 | |||
354 | if (!tx_pulse_width_in_500ns) | ||
355 | tx_pulse_width_in_500ns = 1; | ||
356 | |||
357 | ene_dbg("TX: pulse distance = %d * 500 ns", tx_period_in500ns); | ||
358 | ene_dbg("TX: pulse width = %d * 500 ns", | ||
359 | tx_pulse_width_in_500ns); | ||
360 | |||
361 | ene_hw_write_reg(dev, ENE_TX_PERIOD, ENE_TX_PERIOD_UNKBIT | | ||
362 | tx_period_in500ns); | ||
363 | |||
364 | ene_hw_write_reg(dev, ENE_TX_PERIOD_PULSE, | ||
365 | tx_pulse_width_in_500ns); | ||
366 | |||
367 | conf1 |= ENE_CIR_CONF1_TX_CARR; | ||
368 | } else | ||
369 | conf1 &= ~ENE_CIR_CONF1_TX_CARR; | ||
370 | |||
371 | ene_hw_write_reg(dev, ENE_CIR_CONF1, conf1); | ||
372 | |||
373 | } | ||
374 | |||
375 | /* end transmission */ | ||
376 | static void ene_tx_complete(struct ene_device *dev) | ||
377 | { | ||
378 | ene_hw_write_reg(dev, ENE_CIR_CONF1, dev->saved_conf1); | ||
379 | dev->tx_buffer = NULL; | ||
380 | } | ||
381 | |||
382 | /* set transmit mask */ | ||
383 | static void ene_tx_hw_set_transmiter_mask(struct ene_device *dev) | ||
384 | { | ||
385 | u8 txport1 = ene_hw_read_reg(dev, ENE_TX_PORT1) & ~ENE_TX_PORT1_EN; | ||
386 | u8 txport2 = ene_hw_read_reg(dev, ENE_TX_PORT2) & ~ENE_TX_PORT2_EN; | ||
387 | |||
388 | if (dev->transmitter_mask & 0x01) | ||
389 | txport1 |= ENE_TX_PORT1_EN; | ||
390 | |||
391 | if (dev->transmitter_mask & 0x02) | ||
392 | txport2 |= ENE_TX_PORT2_EN; | ||
393 | |||
394 | ene_hw_write_reg(dev, ENE_TX_PORT1, txport1); | ||
395 | ene_hw_write_reg(dev, ENE_TX_PORT2, txport2); | ||
396 | } | ||
397 | |||
398 | /* TX one sample - must be called with dev->hw_lock*/ | ||
399 | static void ene_tx_sample(struct ene_device *dev) | ||
400 | { | ||
401 | u8 raw_tx; | ||
402 | u32 sample; | ||
403 | |||
404 | if (!dev->tx_buffer) { | ||
405 | ene_dbg("TX: attempt to transmit NULL buffer"); | ||
406 | return; | ||
407 | } | ||
408 | |||
409 | /* Grab next TX sample */ | ||
410 | if (!dev->tx_sample) { | ||
411 | again: | ||
412 | if (dev->tx_pos == dev->tx_len + 1) { | ||
413 | if (!dev->tx_done) { | ||
414 | ene_dbg("TX: no more data to send"); | ||
415 | dev->tx_done = 1; | ||
416 | goto exit; | ||
417 | } else { | ||
418 | ene_dbg("TX: last sample sent by hardware"); | ||
419 | ene_tx_complete(dev); | ||
420 | complete(&dev->tx_complete); | ||
421 | return; | ||
422 | } | ||
423 | } | ||
424 | |||
425 | sample = dev->tx_buffer[dev->tx_pos++]; | ||
426 | dev->tx_sample_pulse = !dev->tx_sample_pulse; | ||
427 | |||
428 | ene_dbg("TX: sample %8d (%s)", sample, dev->tx_sample_pulse ? | ||
429 | "pulse" : "space"); | ||
430 | |||
431 | dev->tx_sample = DIV_ROUND_CLOSEST(sample, ENE_TX_SMPL_PERIOD); | ||
432 | |||
433 | /* guard against too short samples */ | ||
434 | if (!dev->tx_sample) | ||
435 | goto again; | ||
436 | } | ||
437 | |||
438 | raw_tx = min(dev->tx_sample , (unsigned int)ENE_TX_SMLP_MASK); | ||
439 | dev->tx_sample -= raw_tx; | ||
440 | |||
441 | if (dev->tx_sample_pulse) | ||
442 | raw_tx |= ENE_TX_PULSE_MASK; | ||
443 | |||
444 | ene_hw_write_reg(dev, ENE_TX_INPUT1 + dev->tx_reg, raw_tx); | ||
445 | dev->tx_reg = !dev->tx_reg; | ||
446 | exit: | ||
447 | /* simulate TX done interrupt */ | ||
448 | if (txsim) | ||
449 | mod_timer(&dev->tx_sim_timer, jiffies + HZ / 500); | ||
450 | } | ||
451 | |||
452 | /* timer to simulate tx done interrupt */ | ||
453 | static void ene_tx_irqsim(unsigned long data) | ||
454 | { | ||
455 | struct ene_device *dev = (struct ene_device *)data; | ||
456 | unsigned long flags; | ||
457 | |||
458 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
459 | ene_tx_sample(dev); | ||
460 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
461 | } | ||
462 | |||
463 | |||
464 | /* read irq status and ack it */ | ||
465 | static int ene_irq_status(struct ene_device *dev) | ||
466 | { | ||
467 | u8 irq_status; | ||
468 | u8 fw_flags1, fw_flags2; | ||
469 | int cur_rx_pointer; | ||
470 | int retval = 0; | ||
471 | |||
472 | fw_flags2 = ene_hw_read_reg(dev, ENE_FW2); | ||
473 | cur_rx_pointer = !!(fw_flags2 & ENE_FW2_BUF_HIGH); | ||
474 | |||
475 | if (dev->hw_revision < ENE_HW_C) { | ||
476 | irq_status = ene_hw_read_reg(dev, ENEB_IRQ_STATUS); | ||
477 | |||
478 | if (!(irq_status & ENEB_IRQ_STATUS_IR)) | ||
479 | return 0; | ||
480 | |||
481 | ene_hw_write_reg(dev, ENEB_IRQ_STATUS, | ||
482 | irq_status & ~ENEB_IRQ_STATUS_IR); | ||
483 | dev->rx_pointer = cur_rx_pointer; | ||
484 | return ENE_IRQ_RX; | ||
485 | } | ||
486 | |||
487 | irq_status = ene_hw_read_reg(dev, ENEC_IRQ); | ||
488 | |||
489 | if (!(irq_status & ENEC_IRQ_STATUS)) | ||
490 | return 0; | ||
491 | |||
492 | /* original driver does that twice - a workaround ? */ | ||
493 | ene_hw_write_reg(dev, ENEC_IRQ, irq_status & ~ENEC_IRQ_STATUS); | ||
494 | ene_hw_write_reg(dev, ENEC_IRQ, irq_status & ~ENEC_IRQ_STATUS); | ||
495 | |||
496 | /* clear unknown flag in F8F9 */ | ||
497 | if (fw_flags2 & ENE_FW2_IRQ_CLR) | ||
498 | ene_hw_write_reg(dev, ENE_FW2, fw_flags2 & ~ENE_FW2_IRQ_CLR); | ||
499 | |||
500 | /* check if this is a TX interrupt */ | ||
501 | fw_flags1 = ene_hw_read_reg(dev, ENE_FW1); | ||
502 | if (fw_flags1 & ENE_FW1_TXIRQ) { | ||
503 | ene_hw_write_reg(dev, ENE_FW1, fw_flags1 & ~ENE_FW1_TXIRQ); | ||
504 | retval |= ENE_IRQ_TX; | ||
505 | } | ||
506 | |||
507 | /* Check if this is RX interrupt */ | ||
508 | if (dev->rx_pointer != cur_rx_pointer) { | ||
509 | retval |= ENE_IRQ_RX; | ||
510 | dev->rx_pointer = cur_rx_pointer; | ||
511 | |||
512 | } else if (!(retval & ENE_IRQ_TX)) { | ||
513 | ene_dbg("RX: interrupt without change in RX pointer(%d)", | ||
514 | dev->rx_pointer); | ||
515 | retval |= ENE_IRQ_RX; | ||
516 | } | ||
517 | |||
518 | if ((retval & ENE_IRQ_RX) && (retval & ENE_IRQ_TX)) | ||
519 | ene_dbg("both RX and TX interrupt at same time"); | ||
520 | |||
521 | return retval; | ||
522 | } | ||
523 | |||
524 | /* interrupt handler */ | ||
525 | static irqreturn_t ene_isr(int irq, void *data) | ||
526 | { | ||
527 | u16 hw_value; | ||
528 | int i, hw_sample; | ||
529 | int pulse; | ||
530 | int irq_status; | ||
531 | unsigned long flags; | ||
532 | int carrier = 0; | ||
533 | irqreturn_t retval = IRQ_NONE; | ||
534 | struct ene_device *dev = (struct ene_device *)data; | ||
535 | struct ir_raw_event ev; | ||
536 | |||
537 | |||
538 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
539 | irq_status = ene_irq_status(dev); | ||
540 | |||
541 | if (!irq_status) | ||
542 | goto unlock; | ||
543 | |||
544 | retval = IRQ_HANDLED; | ||
545 | |||
546 | if (irq_status & ENE_IRQ_TX) { | ||
547 | |||
548 | if (!dev->hw_learning_and_tx_capable) { | ||
549 | ene_dbg("TX interrupt on unsupported device!"); | ||
550 | goto unlock; | ||
551 | } | ||
552 | ene_tx_sample(dev); | ||
553 | } | ||
554 | |||
555 | if (!(irq_status & ENE_IRQ_RX)) | ||
556 | goto unlock; | ||
557 | |||
558 | |||
559 | if (dev->carrier_detect_enabled || debug) | ||
560 | carrier = ene_rx_sense_carrier(dev); | ||
561 | #if 0 | ||
562 | /* TODO */ | ||
563 | if (dev->carrier_detect_enabled && carrier) | ||
564 | ir_raw_event_report_frequency(dev->idev, carrier); | ||
565 | #endif | ||
566 | |||
567 | for (i = 0; i < ENE_SAMPLES_SIZE; i++) { | ||
568 | hw_value = ene_hw_read_reg(dev, | ||
569 | ENE_SAMPLE_BUFFER + dev->rx_pointer * 4 + i); | ||
570 | |||
571 | if (dev->rx_fan_input_inuse) { | ||
572 | /* read high part of the sample */ | ||
573 | hw_value |= ene_hw_read_reg(dev, | ||
574 | ENE_SAMPLE_BUFFER_FAN + | ||
575 | dev->rx_pointer * 4 + i) << 8; | ||
576 | pulse = hw_value & ENE_FAN_SMPL_PULS_MSK; | ||
577 | |||
578 | /* clear space bit, and other unused bits */ | ||
579 | hw_value &= ENE_FAN_VALUE_MASK; | ||
580 | hw_sample = hw_value * ENE_SAMPLE_PERIOD_FAN; | ||
581 | |||
582 | } else { | ||
583 | pulse = !(hw_value & ENE_SAMPLE_SPC_MASK); | ||
584 | hw_value &= ENE_SAMPLE_VALUE_MASK; | ||
585 | hw_sample = hw_value * sample_period; | ||
586 | |||
587 | if (dev->rx_period_adjust) { | ||
588 | hw_sample *= (100 - dev->rx_period_adjust); | ||
589 | hw_sample /= 100; | ||
590 | } | ||
591 | } | ||
592 | /* no more data */ | ||
593 | if (!(hw_value)) | ||
594 | break; | ||
595 | |||
596 | ene_dbg("RX: %d (%s)", hw_sample, pulse ? "pulse" : "space"); | ||
597 | |||
598 | |||
599 | ev.duration = hw_sample * 1000; | ||
600 | ev.pulse = pulse; | ||
601 | ir_raw_event_store_with_filter(dev->idev, &ev); | ||
602 | } | ||
603 | |||
604 | ir_raw_event_handle(dev->idev); | ||
605 | unlock: | ||
606 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
607 | return retval; | ||
608 | } | ||
609 | |||
610 | /* Initialize default settings */ | ||
611 | static void ene_setup_settings(struct ene_device *dev) | ||
612 | { | ||
613 | dev->tx_period = 32; | ||
614 | dev->tx_duty_cycle = 25; /*%*/ | ||
615 | dev->transmitter_mask = 3; | ||
616 | |||
617 | /* Force learning mode if (input == 2), otherwise | ||
618 | let user set it with LIRC_SET_REC_CARRIER */ | ||
619 | dev->learning_enabled = | ||
620 | (input == 2 && dev->hw_learning_and_tx_capable); | ||
621 | |||
622 | dev->rx_pointer = -1; | ||
623 | |||
624 | } | ||
625 | |||
626 | /* outside interface: called on first open*/ | ||
627 | static int ene_open(void *data) | ||
628 | { | ||
629 | struct ene_device *dev = (struct ene_device *)data; | ||
630 | unsigned long flags; | ||
631 | |||
632 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
633 | dev->in_use = 1; | ||
634 | ene_setup_settings(dev); | ||
635 | ene_rx_enable(dev); | ||
636 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
637 | return 0; | ||
638 | } | ||
639 | |||
640 | /* outside interface: called on device close*/ | ||
641 | static void ene_close(void *data) | ||
642 | { | ||
643 | struct ene_device *dev = (struct ene_device *)data; | ||
644 | unsigned long flags; | ||
645 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
646 | |||
647 | ene_rx_disable(dev); | ||
648 | dev->in_use = 0; | ||
649 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
650 | } | ||
651 | |||
652 | /* outside interface: set transmitter mask */ | ||
653 | static int ene_set_tx_mask(void *data, u32 tx_mask) | ||
654 | { | ||
655 | struct ene_device *dev = (struct ene_device *)data; | ||
656 | unsigned long flags; | ||
657 | ene_dbg("TX: attempt to set transmitter mask %02x", tx_mask); | ||
658 | |||
659 | /* invalid txmask */ | ||
660 | if (!tx_mask || tx_mask & ~0x3) { | ||
661 | ene_dbg("TX: invalid mask"); | ||
662 | /* return count of transmitters */ | ||
663 | return 2; | ||
664 | } | ||
665 | |||
666 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
667 | dev->transmitter_mask = tx_mask; | ||
668 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
669 | return 0; | ||
670 | } | ||
671 | |||
672 | /* outside interface : set tx carrier */ | ||
673 | static int ene_set_tx_carrier(void *data, u32 carrier) | ||
674 | { | ||
675 | struct ene_device *dev = (struct ene_device *)data; | ||
676 | unsigned long flags; | ||
677 | u32 period = 1000000 / carrier; /* (1 / freq) (* # usec in 1 sec) */ | ||
678 | |||
679 | ene_dbg("TX: attempt to set tx carrier to %d kHz", carrier); | ||
680 | |||
681 | if (period && (period > ENE_TX_PERIOD_MAX || | ||
682 | period < ENE_TX_PERIOD_MIN)) { | ||
683 | |||
684 | ene_dbg("TX: out of range %d-%d carrier, " | ||
685 | "falling back to 32 kHz", | ||
686 | 1000 / ENE_TX_PERIOD_MIN, | ||
687 | 1000 / ENE_TX_PERIOD_MAX); | ||
688 | |||
689 | period = 32; /* this is just a coincidence!!! */ | ||
690 | } | ||
691 | ene_dbg("TX: set carrier to %d kHz", carrier); | ||
692 | |||
693 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
694 | dev->tx_period = period; | ||
695 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
696 | return 0; | ||
697 | } | ||
698 | |||
699 | |||
700 | /* outside interface: enable learning mode */ | ||
701 | static int ene_set_learning_mode(void *data, int enable) | ||
702 | { | ||
703 | struct ene_device *dev = (struct ene_device *)data; | ||
704 | unsigned long flags; | ||
705 | if (enable == dev->learning_enabled) | ||
706 | return 0; | ||
707 | |||
708 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
709 | dev->learning_enabled = enable; | ||
710 | ene_rx_set_inputs(dev); | ||
711 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
712 | return 0; | ||
713 | } | ||
714 | |||
715 | /* outside interface: set rec carrier */ | ||
716 | static int ene_set_rec_carrier(void *data, u32 min, u32 max) | ||
717 | { | ||
718 | struct ene_device *dev = (struct ene_device *)data; | ||
719 | ene_set_learning_mode(dev, | ||
720 | max > ENE_NORMAL_RX_HI || min < ENE_NORMAL_RX_LOW); | ||
721 | return 0; | ||
722 | } | ||
723 | |||
724 | /* outside interface: enable or disable idle mode */ | ||
725 | static void ene_rx_set_idle(void *data, int idle) | ||
726 | { | ||
727 | struct ene_device *dev = (struct ene_device *)data; | ||
728 | ene_dbg("%sabling idle mode", idle ? "en" : "dis"); | ||
729 | |||
730 | ene_hw_write_reg_mask(dev, ENE_CIR_SAMPLE_PERIOD, | ||
731 | (enable_idle && idle) ? 0 : ENE_CIR_SAMPLE_OVERFLOW, | ||
732 | ENE_CIR_SAMPLE_OVERFLOW); | ||
733 | } | ||
734 | |||
735 | |||
736 | /* outside interface: transmit */ | ||
737 | static int ene_transmit(void *data, int *buf, u32 n) | ||
738 | { | ||
739 | struct ene_device *dev = (struct ene_device *)data; | ||
740 | unsigned long flags; | ||
741 | |||
742 | dev->tx_buffer = buf; | ||
743 | dev->tx_len = n / sizeof(int); | ||
744 | dev->tx_pos = 0; | ||
745 | dev->tx_reg = 0; | ||
746 | dev->tx_done = 0; | ||
747 | dev->tx_sample = 0; | ||
748 | dev->tx_sample_pulse = 0; | ||
749 | |||
750 | ene_dbg("TX: %d samples", dev->tx_len); | ||
751 | |||
752 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
753 | |||
754 | ene_tx_hw_set_transmiter_mask(dev); | ||
755 | ene_tx_prepare(dev); | ||
756 | |||
757 | /* Transmit first two samples */ | ||
758 | ene_tx_sample(dev); | ||
759 | ene_tx_sample(dev); | ||
760 | |||
761 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
762 | |||
763 | if (wait_for_completion_timeout(&dev->tx_complete, 2 * HZ) == 0) { | ||
764 | ene_dbg("TX: timeout"); | ||
765 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
766 | ene_tx_complete(dev); | ||
767 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
768 | } else | ||
769 | ene_dbg("TX: done"); | ||
770 | return n; | ||
771 | } | ||
772 | |||
773 | |||
774 | /* probe entry */ | ||
775 | static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) | ||
776 | { | ||
777 | int error = -ENOMEM; | ||
778 | struct ir_dev_props *ir_props; | ||
779 | struct input_dev *input_dev; | ||
780 | struct ene_device *dev; | ||
781 | |||
782 | /* allocate memory */ | ||
783 | input_dev = input_allocate_device(); | ||
784 | ir_props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); | ||
785 | dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); | ||
786 | |||
787 | if (!input_dev || !ir_props || !dev) | ||
788 | goto error; | ||
789 | |||
790 | /* validate resources */ | ||
791 | error = -ENODEV; | ||
792 | |||
793 | if (!pnp_port_valid(pnp_dev, 0) || | ||
794 | pnp_port_len(pnp_dev, 0) < ENE_MAX_IO) | ||
795 | goto error; | ||
796 | |||
797 | if (!pnp_irq_valid(pnp_dev, 0)) | ||
798 | goto error; | ||
799 | |||
800 | dev->hw_io = pnp_port_start(pnp_dev, 0); | ||
801 | dev->irq = pnp_irq(pnp_dev, 0); | ||
802 | spin_lock_init(&dev->hw_lock); | ||
803 | |||
804 | /* claim the resources */ | ||
805 | error = -EBUSY; | ||
806 | if (!request_region(dev->hw_io, ENE_MAX_IO, ENE_DRIVER_NAME)) | ||
807 | goto error; | ||
808 | |||
809 | if (request_irq(dev->irq, ene_isr, | ||
810 | IRQF_SHARED, ENE_DRIVER_NAME, (void *)dev)) | ||
811 | goto error; | ||
812 | |||
813 | pnp_set_drvdata(pnp_dev, dev); | ||
814 | dev->pnp_dev = pnp_dev; | ||
815 | |||
816 | /* detect hardware version and features */ | ||
817 | error = ene_hw_detect(dev); | ||
818 | if (error) | ||
819 | goto error; | ||
820 | |||
821 | ene_setup_settings(dev); | ||
822 | |||
823 | if (!dev->hw_learning_and_tx_capable && txsim) { | ||
824 | dev->hw_learning_and_tx_capable = 1; | ||
825 | setup_timer(&dev->tx_sim_timer, ene_tx_irqsim, | ||
826 | (long unsigned int)dev); | ||
827 | ene_printk(KERN_WARNING, | ||
828 | "Simulation of TX activated\n"); | ||
829 | } | ||
830 | |||
831 | ir_props->driver_type = RC_DRIVER_IR_RAW; | ||
832 | ir_props->allowed_protos = IR_TYPE_ALL; | ||
833 | ir_props->priv = dev; | ||
834 | ir_props->open = ene_open; | ||
835 | ir_props->close = ene_close; | ||
836 | ir_props->min_timeout = ENE_MINGAP * 1000; | ||
837 | ir_props->max_timeout = ENE_MAXGAP * 1000; | ||
838 | ir_props->timeout = ENE_MAXGAP * 1000; | ||
839 | |||
840 | if (dev->hw_revision == ENE_HW_B) | ||
841 | ir_props->s_idle = ene_rx_set_idle; | ||
842 | |||
843 | |||
844 | dev->props = ir_props; | ||
845 | dev->idev = input_dev; | ||
846 | |||
847 | /* don't allow too short/long sample periods */ | ||
848 | if (sample_period < 5 || sample_period > 0x7F) | ||
849 | sample_period = -1; | ||
850 | |||
851 | /* choose default sample period */ | ||
852 | if (sample_period == -1) { | ||
853 | |||
854 | sample_period = 50; | ||
855 | |||
856 | /* on revB, hardware idle mode eats first sample | ||
857 | if we set too low sample period */ | ||
858 | if (dev->hw_revision == ENE_HW_B && enable_idle) | ||
859 | sample_period = 75; | ||
860 | } | ||
861 | |||
862 | ir_props->rx_resolution = sample_period * 1000; | ||
863 | |||
864 | if (dev->hw_learning_and_tx_capable) { | ||
865 | |||
866 | ir_props->s_learning_mode = ene_set_learning_mode; | ||
867 | |||
868 | if (input == 0) | ||
869 | ir_props->s_rx_carrier_range = ene_set_rec_carrier; | ||
870 | |||
871 | init_completion(&dev->tx_complete); | ||
872 | ir_props->tx_ir = ene_transmit; | ||
873 | ir_props->s_tx_mask = ene_set_tx_mask; | ||
874 | ir_props->s_tx_carrier = ene_set_tx_carrier; | ||
875 | ir_props->tx_resolution = ENE_TX_SMPL_PERIOD * 1000; | ||
876 | /* ir_props->s_carrier_report = ene_set_carrier_report; */ | ||
877 | } | ||
878 | |||
879 | |||
880 | device_set_wakeup_capable(&pnp_dev->dev, 1); | ||
881 | device_set_wakeup_enable(&pnp_dev->dev, 1); | ||
882 | |||
883 | if (dev->hw_learning_and_tx_capable) | ||
884 | input_dev->name = "ENE eHome Infrared Remote Transceiver"; | ||
885 | else | ||
886 | input_dev->name = "ENE eHome Infrared Remote Receiver"; | ||
887 | |||
888 | |||
889 | error = -ENODEV; | ||
890 | if (ir_input_register(input_dev, RC_MAP_RC6_MCE, ir_props, | ||
891 | ENE_DRIVER_NAME)) | ||
892 | goto error; | ||
893 | |||
894 | |||
895 | ene_printk(KERN_NOTICE, "driver has been succesfully loaded\n"); | ||
896 | return 0; | ||
897 | error: | ||
898 | if (dev->irq) | ||
899 | free_irq(dev->irq, dev); | ||
900 | if (dev->hw_io) | ||
901 | release_region(dev->hw_io, ENE_MAX_IO); | ||
902 | |||
903 | input_free_device(input_dev); | ||
904 | kfree(ir_props); | ||
905 | kfree(dev); | ||
906 | return error; | ||
907 | } | ||
908 | |||
909 | /* main unload function */ | ||
910 | static void ene_remove(struct pnp_dev *pnp_dev) | ||
911 | { | ||
912 | struct ene_device *dev = pnp_get_drvdata(pnp_dev); | ||
913 | unsigned long flags; | ||
914 | |||
915 | spin_lock_irqsave(&dev->hw_lock, flags); | ||
916 | ene_rx_disable(dev); | ||
917 | spin_unlock_irqrestore(&dev->hw_lock, flags); | ||
918 | |||
919 | free_irq(dev->irq, dev); | ||
920 | release_region(dev->hw_io, ENE_MAX_IO); | ||
921 | ir_input_unregister(dev->idev); | ||
922 | kfree(dev->props); | ||
923 | kfree(dev); | ||
924 | } | ||
925 | |||
926 | /* enable wake on IR (wakes on specific button on original remote) */ | ||
927 | static void ene_enable_wake(struct ene_device *dev, int enable) | ||
928 | { | ||
929 | enable = enable && device_may_wakeup(&dev->pnp_dev->dev); | ||
930 | |||
931 | ene_dbg("wake on IR %s", enable ? "enabled" : "disabled"); | ||
932 | |||
933 | ene_hw_write_reg_mask(dev, ENE_FW1, enable ? | ||
934 | ENE_FW1_WAKE : 0, ENE_FW1_WAKE); | ||
935 | } | ||
936 | |||
937 | #ifdef CONFIG_PM | ||
938 | static int ene_suspend(struct pnp_dev *pnp_dev, pm_message_t state) | ||
939 | { | ||
940 | struct ene_device *dev = pnp_get_drvdata(pnp_dev); | ||
941 | ene_enable_wake(dev, 1); | ||
942 | return 0; | ||
943 | } | ||
944 | |||
945 | static int ene_resume(struct pnp_dev *pnp_dev) | ||
946 | { | ||
947 | struct ene_device *dev = pnp_get_drvdata(pnp_dev); | ||
948 | if (dev->in_use) | ||
949 | ene_rx_enable(dev); | ||
950 | |||
951 | ene_enable_wake(dev, 0); | ||
952 | return 0; | ||
953 | } | ||
954 | #endif | ||
955 | |||
956 | static void ene_shutdown(struct pnp_dev *pnp_dev) | ||
957 | { | ||
958 | struct ene_device *dev = pnp_get_drvdata(pnp_dev); | ||
959 | ene_enable_wake(dev, 1); | ||
960 | } | ||
961 | |||
962 | static const struct pnp_device_id ene_ids[] = { | ||
963 | {.id = "ENE0100",}, | ||
964 | {.id = "ENE0200",}, | ||
965 | {.id = "ENE0201",}, | ||
966 | {.id = "ENE0202",}, | ||
967 | {}, | ||
968 | }; | ||
969 | |||
970 | static struct pnp_driver ene_driver = { | ||
971 | .name = ENE_DRIVER_NAME, | ||
972 | .id_table = ene_ids, | ||
973 | .flags = PNP_DRIVER_RES_DO_NOT_CHANGE, | ||
974 | |||
975 | .probe = ene_probe, | ||
976 | .remove = __devexit_p(ene_remove), | ||
977 | #ifdef CONFIG_PM | ||
978 | .suspend = ene_suspend, | ||
979 | .resume = ene_resume, | ||
980 | #endif | ||
981 | .shutdown = ene_shutdown, | ||
982 | }; | ||
983 | |||
984 | static int __init ene_init(void) | ||
985 | { | ||
986 | return pnp_register_driver(&ene_driver); | ||
987 | } | ||
988 | |||
989 | static void ene_exit(void) | ||
990 | { | ||
991 | pnp_unregister_driver(&ene_driver); | ||
992 | } | ||
993 | |||
994 | module_param(sample_period, int, S_IRUGO); | ||
995 | MODULE_PARM_DESC(sample_period, "Hardware sample period (50 us default)"); | ||
996 | |||
997 | module_param(enable_idle, bool, S_IRUGO | S_IWUSR); | ||
998 | MODULE_PARM_DESC(enable_idle, | ||
999 | "Enables turning off signal sampling after long inactivity time; " | ||
1000 | "if disabled might help detecting input signal (default: enabled)" | ||
1001 | " (KB3926B only)"); | ||
1002 | |||
1003 | module_param(input, bool, S_IRUGO); | ||
1004 | MODULE_PARM_DESC(input, "select which input to use " | ||
1005 | "0 - auto, 1 - standard, 2 - wideband(KB3926C+)"); | ||
1006 | |||
1007 | module_param(debug, int, S_IRUGO | S_IWUSR); | ||
1008 | MODULE_PARM_DESC(debug, "Enable debug (debug=2 verbose debug output)"); | ||
1009 | |||
1010 | module_param(txsim, bool, S_IRUGO); | ||
1011 | MODULE_PARM_DESC(txsim, | ||
1012 | "Simulate TX features on unsupported hardware (dangerous)"); | ||
1013 | |||
1014 | MODULE_DEVICE_TABLE(pnp, ene_ids); | ||
1015 | MODULE_DESCRIPTION | ||
1016 | ("Infrared input driver for KB3926B/KB3926C/KB3926D " | ||
1017 | "(aka ENE0100/ENE0200/ENE0201) CIR port"); | ||
1018 | |||
1019 | MODULE_AUTHOR("Maxim Levitsky"); | ||
1020 | MODULE_LICENSE("GPL"); | ||
1021 | |||
1022 | module_init(ene_init); | ||
1023 | module_exit(ene_exit); | ||
diff --git a/drivers/media/IR/ene_ir.h b/drivers/media/IR/ene_ir.h deleted file mode 100644 index 54c76af0d033..000000000000 --- a/drivers/media/IR/ene_ir.h +++ /dev/null | |||
@@ -1,235 +0,0 @@ | |||
1 | /* | ||
2 | * driver for ENE KB3926 B/C/D CIR (also known as ENE0XXX) | ||
3 | * | ||
4 | * Copyright (C) 2010 Maxim Levitsky <maximlevitsky@gmail.com> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU General Public License as | ||
8 | * published by the Free Software Foundation; either version 2 of the | ||
9 | * License, or (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. See the GNU | ||
14 | * General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | ||
19 | * USA | ||
20 | */ | ||
21 | #include <linux/spinlock.h> | ||
22 | |||
23 | |||
24 | /* hardware address */ | ||
25 | #define ENE_STATUS 0 /* hardware status - unused */ | ||
26 | #define ENE_ADDR_HI 1 /* hi byte of register address */ | ||
27 | #define ENE_ADDR_LO 2 /* low byte of register address */ | ||
28 | #define ENE_IO 3 /* read/write window */ | ||
29 | #define ENE_MAX_IO 4 | ||
30 | |||
31 | /* 8 bytes of samples, divided in 2 halfs*/ | ||
32 | #define ENE_SAMPLE_BUFFER 0xF8F0 /* regular sample buffer */ | ||
33 | #define ENE_SAMPLE_SPC_MASK 0x80 /* sample is space */ | ||
34 | #define ENE_SAMPLE_VALUE_MASK 0x7F | ||
35 | #define ENE_SAMPLE_OVERFLOW 0x7F | ||
36 | #define ENE_SAMPLES_SIZE 4 | ||
37 | |||
38 | /* fan input sample buffer */ | ||
39 | #define ENE_SAMPLE_BUFFER_FAN 0xF8FB /* this buffer holds high byte of */ | ||
40 | /* each sample of normal buffer */ | ||
41 | #define ENE_FAN_SMPL_PULS_MSK 0x8000 /* this bit of combined sample */ | ||
42 | /* if set, says that sample is pulse */ | ||
43 | #define ENE_FAN_VALUE_MASK 0x0FFF /* mask for valid bits of the value */ | ||
44 | |||
45 | /* first firmware register */ | ||
46 | #define ENE_FW1 0xF8F8 | ||
47 | #define ENE_FW1_ENABLE 0x01 /* enable fw processing */ | ||
48 | #define ENE_FW1_TXIRQ 0x02 /* TX interrupt pending */ | ||
49 | #define ENE_FW1_WAKE 0x40 /* enable wake from S3 */ | ||
50 | #define ENE_FW1_IRQ 0x80 /* enable interrupt */ | ||
51 | |||
52 | /* second firmware register */ | ||
53 | #define ENE_FW2 0xF8F9 | ||
54 | #define ENE_FW2_BUF_HIGH 0x01 /* which half of the buffer to read */ | ||
55 | #define ENE_FW2_IRQ_CLR 0x04 /* clear this on IRQ */ | ||
56 | #define ENE_FW2_GP40_AS_LEARN 0x08 /* normal input is used as */ | ||
57 | /* learning input */ | ||
58 | #define ENE_FW2_FAN_AS_NRML_IN 0x40 /* fan is used as normal input */ | ||
59 | #define ENE_FW2_LEARNING 0x80 /* hardware supports learning and TX */ | ||
60 | |||
61 | /* transmitter ports */ | ||
62 | #define ENE_TX_PORT2 0xFC01 /* this enables one or both */ | ||
63 | #define ENE_TX_PORT2_EN 0x20 /* TX ports */ | ||
64 | #define ENE_TX_PORT1 0xFC08 | ||
65 | #define ENE_TX_PORT1_EN 0x02 | ||
66 | |||
67 | /* IRQ registers block (for revision B) */ | ||
68 | #define ENEB_IRQ 0xFD09 /* IRQ number */ | ||
69 | #define ENEB_IRQ_UNK1 0xFD17 /* unknown setting = 1 */ | ||
70 | #define ENEB_IRQ_STATUS 0xFD80 /* irq status */ | ||
71 | #define ENEB_IRQ_STATUS_IR 0x20 /* IR irq */ | ||
72 | |||
73 | /* fan as input settings - only if learning capable */ | ||
74 | #define ENE_FAN_AS_IN1 0xFE30 /* fan init reg 1 */ | ||
75 | #define ENE_FAN_AS_IN1_EN 0xCD | ||
76 | #define ENE_FAN_AS_IN2 0xFE31 /* fan init reg 2 */ | ||
77 | #define ENE_FAN_AS_IN2_EN 0x03 | ||
78 | #define ENE_SAMPLE_PERIOD_FAN 61 /* fan input has fixed sample period */ | ||
79 | |||
80 | /* IRQ registers block (for revision C,D) */ | ||
81 | #define ENEC_IRQ 0xFE9B /* new irq settings register */ | ||
82 | #define ENEC_IRQ_MASK 0x0F /* irq number mask */ | ||
83 | #define ENEC_IRQ_UNK_EN 0x10 /* always enabled */ | ||
84 | #define ENEC_IRQ_STATUS 0x20 /* irq status and ACK */ | ||
85 | |||
86 | /* CIR block settings */ | ||
87 | #define ENE_CIR_CONF1 0xFEC0 | ||
88 | #define ENE_CIR_CONF1_TX_CLEAR 0x01 /* clear that on revC */ | ||
89 | /* while transmitting */ | ||
90 | #define ENE_CIR_CONF1_RX_ON 0x07 /* normal receiver enabled */ | ||
91 | #define ENE_CIR_CONF1_LEARN1 0x08 /* enabled on learning mode */ | ||
92 | #define ENE_CIR_CONF1_TX_ON 0x30 /* enabled on transmit */ | ||
93 | #define ENE_CIR_CONF1_TX_CARR 0x80 /* send TX carrier or not */ | ||
94 | |||
95 | #define ENE_CIR_CONF2 0xFEC1 /* unknown setting = 0 */ | ||
96 | #define ENE_CIR_CONF2_LEARN2 0x10 /* set on enable learning */ | ||
97 | #define ENE_CIR_CONF2_GPIO40DIS 0x20 /* disable input via gpio40 */ | ||
98 | |||
99 | #define ENE_CIR_SAMPLE_PERIOD 0xFEC8 /* sample period in us */ | ||
100 | #define ENE_CIR_SAMPLE_OVERFLOW 0x80 /* interrupt on overflows if set */ | ||
101 | |||
102 | |||
103 | /* Two byte tx buffer */ | ||
104 | #define ENE_TX_INPUT1 0xFEC9 | ||
105 | #define ENE_TX_INPUT2 0xFECA | ||
106 | #define ENE_TX_PULSE_MASK 0x80 /* Transmitted sample is pulse */ | ||
107 | #define ENE_TX_SMLP_MASK 0x7F | ||
108 | #define ENE_TX_SMPL_PERIOD 50 /* transmit sample period - fixed */ | ||
109 | |||
110 | |||
111 | /* Unknown TX setting - TX sample period ??? */ | ||
112 | #define ENE_TX_UNK1 0xFECB /* set to 0x63 */ | ||
113 | |||
114 | /* Current received carrier period */ | ||
115 | #define ENE_RX_CARRIER 0xFECC /* RX period (500 ns) */ | ||
116 | #define ENE_RX_CARRIER_VALID 0x80 /* Register content valid */ | ||
117 | |||
118 | |||
119 | /* TX period (1/carrier) */ | ||
120 | #define ENE_TX_PERIOD 0xFECE /* TX period (500 ns) */ | ||
121 | #define ENE_TX_PERIOD_UNKBIT 0x80 /* This bit set on transmit*/ | ||
122 | #define ENE_TX_PERIOD_PULSE 0xFECF /* TX pulse period (500 ns)*/ | ||
123 | |||
124 | /* Hardware versions */ | ||
125 | #define ENE_HW_VERSION 0xFF00 /* hardware revision */ | ||
126 | #define ENE_PLLFRH 0xFF16 | ||
127 | #define ENE_PLLFRL 0xFF17 | ||
128 | |||
129 | #define ENE_HW_UNK 0xFF1D | ||
130 | #define ENE_HW_UNK_CLR 0x04 | ||
131 | #define ENE_HW_VER_MAJOR 0xFF1E /* chip version */ | ||
132 | #define ENE_HW_VER_MINOR 0xFF1F | ||
133 | #define ENE_HW_VER_OLD 0xFD00 | ||
134 | |||
135 | /* Normal/Learning carrier ranges - only valid if we have learning input*/ | ||
136 | /* TODO: test */ | ||
137 | #define ENE_NORMAL_RX_LOW 34 | ||
138 | #define ENE_NORMAL_RX_HI 38 | ||
139 | |||
140 | /* Tx carrier range */ | ||
141 | /* Hardware might be able to do more, but this range is enough for | ||
142 | all purposes */ | ||
143 | #define ENE_TX_PERIOD_MAX 32 /* corresponds to 29.4 kHz */ | ||
144 | #define ENE_TX_PERIOD_MIN 16 /* corrsponds to 62.5 kHz */ | ||
145 | |||
146 | |||
147 | |||
148 | /* Minimal and maximal gaps */ | ||
149 | |||
150 | /* Normal case: | ||
151 | Minimal gap is 0x7F * sample period | ||
152 | Maximum gap depends on hardware. | ||
153 | For KB3926B, it is unlimited, for newer models its around | ||
154 | 250000, after which HW stops sending samples, and that is | ||
155 | not possible to change */ | ||
156 | |||
157 | /* Fan case: | ||
158 | Both minimal and maximal gaps are same, and equal to 0xFFF * 0x61 | ||
159 | And there is nothing to change this setting | ||
160 | */ | ||
161 | |||
162 | #define ENE_MAXGAP 250000 | ||
163 | #define ENE_MINGAP (127 * sample_period) | ||
164 | |||
165 | /******************************************************************************/ | ||
166 | |||
167 | #define ENE_DRIVER_NAME "ene_ir" | ||
168 | |||
169 | #define ENE_IRQ_RX 1 | ||
170 | #define ENE_IRQ_TX 2 | ||
171 | |||
172 | #define ENE_HW_B 1 /* 3926B */ | ||
173 | #define ENE_HW_C 2 /* 3926C */ | ||
174 | #define ENE_HW_D 3 /* 3926D */ | ||
175 | |||
176 | #define ene_printk(level, text, ...) \ | ||
177 | printk(level ENE_DRIVER_NAME ": " text, ## __VA_ARGS__) | ||
178 | |||
179 | #define ene_dbg(text, ...) \ | ||
180 | if (debug) \ | ||
181 | printk(KERN_DEBUG \ | ||
182 | ENE_DRIVER_NAME ": " text "\n" , ## __VA_ARGS__) | ||
183 | |||
184 | #define ene_dbg_verbose(text, ...) \ | ||
185 | if (debug > 1) \ | ||
186 | printk(KERN_DEBUG \ | ||
187 | ENE_DRIVER_NAME ": " text "\n" , ## __VA_ARGS__) | ||
188 | |||
189 | |||
190 | struct ene_device { | ||
191 | struct pnp_dev *pnp_dev; | ||
192 | struct input_dev *idev; | ||
193 | struct ir_dev_props *props; | ||
194 | int in_use; | ||
195 | |||
196 | /* hw IO settings */ | ||
197 | unsigned long hw_io; | ||
198 | int irq; | ||
199 | spinlock_t hw_lock; | ||
200 | |||
201 | /* HW features */ | ||
202 | int hw_revision; /* hardware revision */ | ||
203 | bool hw_learning_and_tx_capable; /* learning capable */ | ||
204 | bool hw_gpio40_learning; /* gpio40 is learning */ | ||
205 | bool hw_fan_as_normal_input; /* fan input is used as */ | ||
206 | /* regular input */ | ||
207 | /* HW state*/ | ||
208 | int rx_pointer; /* hw pointer to rx buffer */ | ||
209 | bool rx_fan_input_inuse; /* is fan input in use for rx*/ | ||
210 | int tx_reg; /* current reg used for TX */ | ||
211 | u8 saved_conf1; /* saved FEC0 reg */ | ||
212 | |||
213 | /* TX sample handling */ | ||
214 | unsigned int tx_sample; /* current sample for TX */ | ||
215 | bool tx_sample_pulse; /* current sample is pulse */ | ||
216 | |||
217 | /* TX buffer */ | ||
218 | int *tx_buffer; /* input samples buffer*/ | ||
219 | int tx_pos; /* position in that bufer */ | ||
220 | int tx_len; /* current len of tx buffer */ | ||
221 | int tx_done; /* done transmitting */ | ||
222 | /* one more sample pending*/ | ||
223 | struct completion tx_complete; /* TX completion */ | ||
224 | struct timer_list tx_sim_timer; | ||
225 | |||
226 | /* TX settings */ | ||
227 | int tx_period; | ||
228 | int tx_duty_cycle; | ||
229 | int transmitter_mask; | ||
230 | |||
231 | /* RX settings */ | ||
232 | bool learning_enabled; /* learning input enabled */ | ||
233 | bool carrier_detect_enabled; /* carrier detect enabled */ | ||
234 | int rx_period_adjust; | ||
235 | }; | ||
diff --git a/drivers/media/IR/imon.c b/drivers/media/IR/imon.c deleted file mode 100644 index c185422ef28c..000000000000 --- a/drivers/media/IR/imon.c +++ /dev/null | |||
@@ -1,2386 +0,0 @@ | |||
1 | /* | ||
2 | * imon.c: input and display driver for SoundGraph iMON IR/VFD/LCD | ||
3 | * | ||
4 | * Copyright(C) 2009 Jarod Wilson <jarod@wilsonet.com> | ||
5 | * Portions based on the original lirc_imon driver, | ||
6 | * Copyright(C) 2004 Venky Raju(dev@venky.ws) | ||
7 | * | ||
8 | * Huge thanks to R. Geoff Newbury for invaluable debugging on the | ||
9 | * 0xffdc iMON devices, and for sending me one to hack on, without | ||
10 | * which the support for them wouldn't be nearly as good. Thanks | ||
11 | * also to the numerous 0xffdc device owners that tested auto-config | ||
12 | * support for me and provided debug dumps from their devices. | ||
13 | * | ||
14 | * imon is free software; you can redistribute it and/or modify | ||
15 | * it under the terms of the GNU General Public License as published by | ||
16 | * the Free Software Foundation; either version 2 of the License, or | ||
17 | * (at your option) any later version. | ||
18 | * | ||
19 | * This program is distributed in the hope that it will be useful, | ||
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
21 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
22 | * GNU General Public License for more details. | ||
23 | * | ||
24 | * You should have received a copy of the GNU General Public License | ||
25 | * along with this program; if not, write to the Free Software | ||
26 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
27 | */ | ||
28 | |||
29 | #include <linux/errno.h> | ||
30 | #include <linux/init.h> | ||
31 | #include <linux/kernel.h> | ||
32 | #include <linux/module.h> | ||
33 | #include <linux/slab.h> | ||
34 | #include <linux/uaccess.h> | ||
35 | |||
36 | #include <linux/input.h> | ||
37 | #include <linux/usb.h> | ||
38 | #include <linux/usb/input.h> | ||
39 | #include <media/ir-core.h> | ||
40 | |||
41 | #include <linux/time.h> | ||
42 | #include <linux/timer.h> | ||
43 | |||
44 | #define MOD_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" | ||
45 | #define MOD_DESC "Driver for SoundGraph iMON MultiMedia IR/Display" | ||
46 | #define MOD_NAME "imon" | ||
47 | #define MOD_VERSION "0.9.1" | ||
48 | |||
49 | #define DISPLAY_MINOR_BASE 144 | ||
50 | #define DEVICE_NAME "lcd%d" | ||
51 | |||
52 | #define BUF_CHUNK_SIZE 8 | ||
53 | #define BUF_SIZE 128 | ||
54 | |||
55 | #define BIT_DURATION 250 /* each bit received is 250us */ | ||
56 | |||
57 | #define IMON_CLOCK_ENABLE_PACKETS 2 | ||
58 | |||
59 | /*** P R O T O T Y P E S ***/ | ||
60 | |||
61 | /* USB Callback prototypes */ | ||
62 | static int imon_probe(struct usb_interface *interface, | ||
63 | const struct usb_device_id *id); | ||
64 | static void imon_disconnect(struct usb_interface *interface); | ||
65 | static void usb_rx_callback_intf0(struct urb *urb); | ||
66 | static void usb_rx_callback_intf1(struct urb *urb); | ||
67 | static void usb_tx_callback(struct urb *urb); | ||
68 | |||
69 | /* suspend/resume support */ | ||
70 | static int imon_resume(struct usb_interface *intf); | ||
71 | static int imon_suspend(struct usb_interface *intf, pm_message_t message); | ||
72 | |||
73 | /* Display file_operations function prototypes */ | ||
74 | static int display_open(struct inode *inode, struct file *file); | ||
75 | static int display_close(struct inode *inode, struct file *file); | ||
76 | |||
77 | /* VFD write operation */ | ||
78 | static ssize_t vfd_write(struct file *file, const char *buf, | ||
79 | size_t n_bytes, loff_t *pos); | ||
80 | |||
81 | /* LCD file_operations override function prototypes */ | ||
82 | static ssize_t lcd_write(struct file *file, const char *buf, | ||
83 | size_t n_bytes, loff_t *pos); | ||
84 | |||
85 | /*** G L O B A L S ***/ | ||
86 | |||
87 | struct imon_context { | ||
88 | struct device *dev; | ||
89 | struct ir_dev_props *props; | ||
90 | /* Newer devices have two interfaces */ | ||
91 | struct usb_device *usbdev_intf0; | ||
92 | struct usb_device *usbdev_intf1; | ||
93 | |||
94 | bool display_supported; /* not all controllers do */ | ||
95 | bool display_isopen; /* display port has been opened */ | ||
96 | bool rf_device; /* true if iMON 2.4G LT/DT RF device */ | ||
97 | bool rf_isassociating; /* RF remote associating */ | ||
98 | bool dev_present_intf0; /* USB device presence, interface 0 */ | ||
99 | bool dev_present_intf1; /* USB device presence, interface 1 */ | ||
100 | |||
101 | struct mutex lock; /* to lock this object */ | ||
102 | wait_queue_head_t remove_ok; /* For unexpected USB disconnects */ | ||
103 | |||
104 | struct usb_endpoint_descriptor *rx_endpoint_intf0; | ||
105 | struct usb_endpoint_descriptor *rx_endpoint_intf1; | ||
106 | struct usb_endpoint_descriptor *tx_endpoint; | ||
107 | struct urb *rx_urb_intf0; | ||
108 | struct urb *rx_urb_intf1; | ||
109 | struct urb *tx_urb; | ||
110 | bool tx_control; | ||
111 | unsigned char usb_rx_buf[8]; | ||
112 | unsigned char usb_tx_buf[8]; | ||
113 | |||
114 | struct tx_t { | ||
115 | unsigned char data_buf[35]; /* user data buffer */ | ||
116 | struct completion finished; /* wait for write to finish */ | ||
117 | bool busy; /* write in progress */ | ||
118 | int status; /* status of tx completion */ | ||
119 | } tx; | ||
120 | |||
121 | u16 vendor; /* usb vendor ID */ | ||
122 | u16 product; /* usb product ID */ | ||
123 | |||
124 | struct input_dev *idev; /* input device for remote */ | ||
125 | struct input_dev *touch; /* input device for touchscreen */ | ||
126 | |||
127 | u32 kc; /* current input keycode */ | ||
128 | u32 last_keycode; /* last reported input keycode */ | ||
129 | u64 ir_type; /* iMON or MCE (RC6) IR protocol? */ | ||
130 | u8 mce_toggle_bit; /* last mce toggle bit */ | ||
131 | bool release_code; /* some keys send a release code */ | ||
132 | |||
133 | u8 display_type; /* store the display type */ | ||
134 | bool pad_mouse; /* toggle kbd(0)/mouse(1) mode */ | ||
135 | |||
136 | char name_idev[128]; /* input device name */ | ||
137 | char phys_idev[64]; /* input device phys path */ | ||
138 | struct timer_list itimer; /* input device timer, need for rc6 */ | ||
139 | |||
140 | char name_touch[128]; /* touch screen name */ | ||
141 | char phys_touch[64]; /* touch screen phys path */ | ||
142 | struct timer_list ttimer; /* touch screen timer */ | ||
143 | int touch_x; /* x coordinate on touchscreen */ | ||
144 | int touch_y; /* y coordinate on touchscreen */ | ||
145 | }; | ||
146 | |||
147 | #define TOUCH_TIMEOUT (HZ/30) | ||
148 | |||
149 | /* vfd character device file operations */ | ||
150 | static const struct file_operations vfd_fops = { | ||
151 | .owner = THIS_MODULE, | ||
152 | .open = &display_open, | ||
153 | .write = &vfd_write, | ||
154 | .release = &display_close | ||
155 | }; | ||
156 | |||
157 | /* lcd character device file operations */ | ||
158 | static const struct file_operations lcd_fops = { | ||
159 | .owner = THIS_MODULE, | ||
160 | .open = &display_open, | ||
161 | .write = &lcd_write, | ||
162 | .release = &display_close | ||
163 | }; | ||
164 | |||
165 | enum { | ||
166 | IMON_DISPLAY_TYPE_AUTO = 0, | ||
167 | IMON_DISPLAY_TYPE_VFD = 1, | ||
168 | IMON_DISPLAY_TYPE_LCD = 2, | ||
169 | IMON_DISPLAY_TYPE_VGA = 3, | ||
170 | IMON_DISPLAY_TYPE_NONE = 4, | ||
171 | }; | ||
172 | |||
173 | enum { | ||
174 | IMON_KEY_IMON = 0, | ||
175 | IMON_KEY_MCE = 1, | ||
176 | IMON_KEY_PANEL = 2, | ||
177 | }; | ||
178 | |||
179 | /* | ||
180 | * USB Device ID for iMON USB Control Boards | ||
181 | * | ||
182 | * The Windows drivers contain 6 different inf files, more or less one for | ||
183 | * each new device until the 0x0034-0x0046 devices, which all use the same | ||
184 | * driver. Some of the devices in the 34-46 range haven't been definitively | ||
185 | * identified yet. Early devices have either a TriGem Computer, Inc. or a | ||
186 | * Samsung vendor ID (0x0aa8 and 0x04e8 respectively), while all later | ||
187 | * devices use the SoundGraph vendor ID (0x15c2). This driver only supports | ||
188 | * the ffdc and later devices, which do onboard decoding. | ||
189 | */ | ||
190 | static struct usb_device_id imon_usb_id_table[] = { | ||
191 | /* | ||
192 | * Several devices with this same device ID, all use iMON_PAD.inf | ||
193 | * SoundGraph iMON PAD (IR & VFD) | ||
194 | * SoundGraph iMON PAD (IR & LCD) | ||
195 | * SoundGraph iMON Knob (IR only) | ||
196 | */ | ||
197 | { USB_DEVICE(0x15c2, 0xffdc) }, | ||
198 | |||
199 | /* | ||
200 | * Newer devices, all driven by the latest iMON Windows driver, full | ||
201 | * list of device IDs extracted via 'strings Setup/data1.hdr |grep 15c2' | ||
202 | * Need user input to fill in details on unknown devices. | ||
203 | */ | ||
204 | /* SoundGraph iMON OEM Touch LCD (IR & 7" VGA LCD) */ | ||
205 | { USB_DEVICE(0x15c2, 0x0034) }, | ||
206 | /* SoundGraph iMON OEM Touch LCD (IR & 4.3" VGA LCD) */ | ||
207 | { USB_DEVICE(0x15c2, 0x0035) }, | ||
208 | /* SoundGraph iMON OEM VFD (IR & VFD) */ | ||
209 | { USB_DEVICE(0x15c2, 0x0036) }, | ||
210 | /* device specifics unknown */ | ||
211 | { USB_DEVICE(0x15c2, 0x0037) }, | ||
212 | /* SoundGraph iMON OEM LCD (IR & LCD) */ | ||
213 | { USB_DEVICE(0x15c2, 0x0038) }, | ||
214 | /* SoundGraph iMON UltraBay (IR & LCD) */ | ||
215 | { USB_DEVICE(0x15c2, 0x0039) }, | ||
216 | /* device specifics unknown */ | ||
217 | { USB_DEVICE(0x15c2, 0x003a) }, | ||
218 | /* device specifics unknown */ | ||
219 | { USB_DEVICE(0x15c2, 0x003b) }, | ||
220 | /* SoundGraph iMON OEM Inside (IR only) */ | ||
221 | { USB_DEVICE(0x15c2, 0x003c) }, | ||
222 | /* device specifics unknown */ | ||
223 | { USB_DEVICE(0x15c2, 0x003d) }, | ||
224 | /* device specifics unknown */ | ||
225 | { USB_DEVICE(0x15c2, 0x003e) }, | ||
226 | /* device specifics unknown */ | ||
227 | { USB_DEVICE(0x15c2, 0x003f) }, | ||
228 | /* device specifics unknown */ | ||
229 | { USB_DEVICE(0x15c2, 0x0040) }, | ||
230 | /* SoundGraph iMON MINI (IR only) */ | ||
231 | { USB_DEVICE(0x15c2, 0x0041) }, | ||
232 | /* Antec Veris Multimedia Station EZ External (IR only) */ | ||
233 | { USB_DEVICE(0x15c2, 0x0042) }, | ||
234 | /* Antec Veris Multimedia Station Basic Internal (IR only) */ | ||
235 | { USB_DEVICE(0x15c2, 0x0043) }, | ||
236 | /* Antec Veris Multimedia Station Elite (IR & VFD) */ | ||
237 | { USB_DEVICE(0x15c2, 0x0044) }, | ||
238 | /* Antec Veris Multimedia Station Premiere (IR & LCD) */ | ||
239 | { USB_DEVICE(0x15c2, 0x0045) }, | ||
240 | /* device specifics unknown */ | ||
241 | { USB_DEVICE(0x15c2, 0x0046) }, | ||
242 | {} | ||
243 | }; | ||
244 | |||
245 | /* USB Device data */ | ||
246 | static struct usb_driver imon_driver = { | ||
247 | .name = MOD_NAME, | ||
248 | .probe = imon_probe, | ||
249 | .disconnect = imon_disconnect, | ||
250 | .suspend = imon_suspend, | ||
251 | .resume = imon_resume, | ||
252 | .id_table = imon_usb_id_table, | ||
253 | }; | ||
254 | |||
255 | static struct usb_class_driver imon_vfd_class = { | ||
256 | .name = DEVICE_NAME, | ||
257 | .fops = &vfd_fops, | ||
258 | .minor_base = DISPLAY_MINOR_BASE, | ||
259 | }; | ||
260 | |||
261 | static struct usb_class_driver imon_lcd_class = { | ||
262 | .name = DEVICE_NAME, | ||
263 | .fops = &lcd_fops, | ||
264 | .minor_base = DISPLAY_MINOR_BASE, | ||
265 | }; | ||
266 | |||
267 | /* imon receiver front panel/knob key table */ | ||
268 | static const struct { | ||
269 | u64 hw_code; | ||
270 | u32 keycode; | ||
271 | } imon_panel_key_table[] = { | ||
272 | { 0x000000000f00ffeell, KEY_PROG1 }, /* Go */ | ||
273 | { 0x000000001f00ffeell, KEY_AUDIO }, | ||
274 | { 0x000000002000ffeell, KEY_VIDEO }, | ||
275 | { 0x000000002100ffeell, KEY_CAMERA }, | ||
276 | { 0x000000002700ffeell, KEY_DVD }, | ||
277 | { 0x000000002300ffeell, KEY_TV }, | ||
278 | { 0x000000000500ffeell, KEY_PREVIOUS }, | ||
279 | { 0x000000000700ffeell, KEY_REWIND }, | ||
280 | { 0x000000000400ffeell, KEY_STOP }, | ||
281 | { 0x000000003c00ffeell, KEY_PLAYPAUSE }, | ||
282 | { 0x000000000800ffeell, KEY_FASTFORWARD }, | ||
283 | { 0x000000000600ffeell, KEY_NEXT }, | ||
284 | { 0x000000010000ffeell, KEY_RIGHT }, | ||
285 | { 0x000001000000ffeell, KEY_LEFT }, | ||
286 | { 0x000000003d00ffeell, KEY_SELECT }, | ||
287 | { 0x000100000000ffeell, KEY_VOLUMEUP }, | ||
288 | { 0x010000000000ffeell, KEY_VOLUMEDOWN }, | ||
289 | { 0x000000000100ffeell, KEY_MUTE }, | ||
290 | /* iMON Knob values */ | ||
291 | { 0x000100ffffffffeell, KEY_VOLUMEUP }, | ||
292 | { 0x010000ffffffffeell, KEY_VOLUMEDOWN }, | ||
293 | { 0x000008ffffffffeell, KEY_MUTE }, | ||
294 | }; | ||
295 | |||
296 | /* to prevent races between open() and disconnect(), probing, etc */ | ||
297 | static DEFINE_MUTEX(driver_lock); | ||
298 | |||
299 | /* Module bookkeeping bits */ | ||
300 | MODULE_AUTHOR(MOD_AUTHOR); | ||
301 | MODULE_DESCRIPTION(MOD_DESC); | ||
302 | MODULE_VERSION(MOD_VERSION); | ||
303 | MODULE_LICENSE("GPL"); | ||
304 | MODULE_DEVICE_TABLE(usb, imon_usb_id_table); | ||
305 | |||
306 | static bool debug; | ||
307 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
308 | MODULE_PARM_DESC(debug, "Debug messages: 0=no, 1=yes(default: no)"); | ||
309 | |||
310 | /* lcd, vfd, vga or none? should be auto-detected, but can be overridden... */ | ||
311 | static int display_type; | ||
312 | module_param(display_type, int, S_IRUGO); | ||
313 | MODULE_PARM_DESC(display_type, "Type of attached display. 0=autodetect, " | ||
314 | "1=vfd, 2=lcd, 3=vga, 4=none (default: autodetect)"); | ||
315 | |||
316 | static int pad_stabilize = 1; | ||
317 | module_param(pad_stabilize, int, S_IRUGO | S_IWUSR); | ||
318 | MODULE_PARM_DESC(pad_stabilize, "Apply stabilization algorithm to iMON PAD " | ||
319 | "presses in arrow key mode. 0=disable, 1=enable (default)."); | ||
320 | |||
321 | /* | ||
322 | * In certain use cases, mouse mode isn't really helpful, and could actually | ||
323 | * cause confusion, so allow disabling it when the IR device is open. | ||
324 | */ | ||
325 | static bool nomouse; | ||
326 | module_param(nomouse, bool, S_IRUGO | S_IWUSR); | ||
327 | MODULE_PARM_DESC(nomouse, "Disable mouse input device mode when IR device is " | ||
328 | "open. 0=don't disable, 1=disable. (default: don't disable)"); | ||
329 | |||
330 | /* threshold at which a pad push registers as an arrow key in kbd mode */ | ||
331 | static int pad_thresh; | ||
332 | module_param(pad_thresh, int, S_IRUGO | S_IWUSR); | ||
333 | MODULE_PARM_DESC(pad_thresh, "Threshold at which a pad push registers as an " | ||
334 | "arrow key in kbd mode (default: 28)"); | ||
335 | |||
336 | |||
337 | static void free_imon_context(struct imon_context *ictx) | ||
338 | { | ||
339 | struct device *dev = ictx->dev; | ||
340 | |||
341 | usb_free_urb(ictx->tx_urb); | ||
342 | usb_free_urb(ictx->rx_urb_intf0); | ||
343 | usb_free_urb(ictx->rx_urb_intf1); | ||
344 | kfree(ictx); | ||
345 | |||
346 | dev_dbg(dev, "%s: iMON context freed\n", __func__); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Called when the Display device (e.g. /dev/lcd0) | ||
351 | * is opened by the application. | ||
352 | */ | ||
353 | static int display_open(struct inode *inode, struct file *file) | ||
354 | { | ||
355 | struct usb_interface *interface; | ||
356 | struct imon_context *ictx = NULL; | ||
357 | int subminor; | ||
358 | int retval = 0; | ||
359 | |||
360 | /* prevent races with disconnect */ | ||
361 | mutex_lock(&driver_lock); | ||
362 | |||
363 | subminor = iminor(inode); | ||
364 | interface = usb_find_interface(&imon_driver, subminor); | ||
365 | if (!interface) { | ||
366 | err("%s: could not find interface for minor %d", | ||
367 | __func__, subminor); | ||
368 | retval = -ENODEV; | ||
369 | goto exit; | ||
370 | } | ||
371 | ictx = usb_get_intfdata(interface); | ||
372 | |||
373 | if (!ictx) { | ||
374 | err("%s: no context found for minor %d", __func__, subminor); | ||
375 | retval = -ENODEV; | ||
376 | goto exit; | ||
377 | } | ||
378 | |||
379 | mutex_lock(&ictx->lock); | ||
380 | |||
381 | if (!ictx->display_supported) { | ||
382 | err("%s: display not supported by device", __func__); | ||
383 | retval = -ENODEV; | ||
384 | } else if (ictx->display_isopen) { | ||
385 | err("%s: display port is already open", __func__); | ||
386 | retval = -EBUSY; | ||
387 | } else { | ||
388 | ictx->display_isopen = true; | ||
389 | file->private_data = ictx; | ||
390 | dev_dbg(ictx->dev, "display port opened\n"); | ||
391 | } | ||
392 | |||
393 | mutex_unlock(&ictx->lock); | ||
394 | |||
395 | exit: | ||
396 | mutex_unlock(&driver_lock); | ||
397 | return retval; | ||
398 | } | ||
399 | |||
400 | /** | ||
401 | * Called when the display device (e.g. /dev/lcd0) | ||
402 | * is closed by the application. | ||
403 | */ | ||
404 | static int display_close(struct inode *inode, struct file *file) | ||
405 | { | ||
406 | struct imon_context *ictx = NULL; | ||
407 | int retval = 0; | ||
408 | |||
409 | ictx = file->private_data; | ||
410 | |||
411 | if (!ictx) { | ||
412 | err("%s: no context for device", __func__); | ||
413 | return -ENODEV; | ||
414 | } | ||
415 | |||
416 | mutex_lock(&ictx->lock); | ||
417 | |||
418 | if (!ictx->display_supported) { | ||
419 | err("%s: display not supported by device", __func__); | ||
420 | retval = -ENODEV; | ||
421 | } else if (!ictx->display_isopen) { | ||
422 | err("%s: display is not open", __func__); | ||
423 | retval = -EIO; | ||
424 | } else { | ||
425 | ictx->display_isopen = false; | ||
426 | dev_dbg(ictx->dev, "display port closed\n"); | ||
427 | if (!ictx->dev_present_intf0) { | ||
428 | /* | ||
429 | * Device disconnected before close and IR port is not | ||
430 | * open. If IR port is open, context will be deleted by | ||
431 | * ir_close. | ||
432 | */ | ||
433 | mutex_unlock(&ictx->lock); | ||
434 | free_imon_context(ictx); | ||
435 | return retval; | ||
436 | } | ||
437 | } | ||
438 | |||
439 | mutex_unlock(&ictx->lock); | ||
440 | return retval; | ||
441 | } | ||
442 | |||
443 | /** | ||
444 | * Sends a packet to the device -- this function must be called | ||
445 | * with ictx->lock held. | ||
446 | */ | ||
447 | static int send_packet(struct imon_context *ictx) | ||
448 | { | ||
449 | unsigned int pipe; | ||
450 | unsigned long timeout; | ||
451 | int interval = 0; | ||
452 | int retval = 0; | ||
453 | struct usb_ctrlrequest *control_req = NULL; | ||
454 | |||
455 | /* Check if we need to use control or interrupt urb */ | ||
456 | if (!ictx->tx_control) { | ||
457 | pipe = usb_sndintpipe(ictx->usbdev_intf0, | ||
458 | ictx->tx_endpoint->bEndpointAddress); | ||
459 | interval = ictx->tx_endpoint->bInterval; | ||
460 | |||
461 | usb_fill_int_urb(ictx->tx_urb, ictx->usbdev_intf0, pipe, | ||
462 | ictx->usb_tx_buf, | ||
463 | sizeof(ictx->usb_tx_buf), | ||
464 | usb_tx_callback, ictx, interval); | ||
465 | |||
466 | ictx->tx_urb->actual_length = 0; | ||
467 | } else { | ||
468 | /* fill request into kmalloc'ed space: */ | ||
469 | control_req = kmalloc(sizeof(struct usb_ctrlrequest), | ||
470 | GFP_KERNEL); | ||
471 | if (control_req == NULL) | ||
472 | return -ENOMEM; | ||
473 | |||
474 | /* setup packet is '21 09 0200 0001 0008' */ | ||
475 | control_req->bRequestType = 0x21; | ||
476 | control_req->bRequest = 0x09; | ||
477 | control_req->wValue = cpu_to_le16(0x0200); | ||
478 | control_req->wIndex = cpu_to_le16(0x0001); | ||
479 | control_req->wLength = cpu_to_le16(0x0008); | ||
480 | |||
481 | /* control pipe is endpoint 0x00 */ | ||
482 | pipe = usb_sndctrlpipe(ictx->usbdev_intf0, 0); | ||
483 | |||
484 | /* build the control urb */ | ||
485 | usb_fill_control_urb(ictx->tx_urb, ictx->usbdev_intf0, | ||
486 | pipe, (unsigned char *)control_req, | ||
487 | ictx->usb_tx_buf, | ||
488 | sizeof(ictx->usb_tx_buf), | ||
489 | usb_tx_callback, ictx); | ||
490 | ictx->tx_urb->actual_length = 0; | ||
491 | } | ||
492 | |||
493 | init_completion(&ictx->tx.finished); | ||
494 | ictx->tx.busy = true; | ||
495 | smp_rmb(); /* ensure later readers know we're busy */ | ||
496 | |||
497 | retval = usb_submit_urb(ictx->tx_urb, GFP_KERNEL); | ||
498 | if (retval) { | ||
499 | ictx->tx.busy = false; | ||
500 | smp_rmb(); /* ensure later readers know we're not busy */ | ||
501 | err("%s: error submitting urb(%d)", __func__, retval); | ||
502 | } else { | ||
503 | /* Wait for transmission to complete (or abort) */ | ||
504 | mutex_unlock(&ictx->lock); | ||
505 | retval = wait_for_completion_interruptible( | ||
506 | &ictx->tx.finished); | ||
507 | if (retval) | ||
508 | err("%s: task interrupted", __func__); | ||
509 | mutex_lock(&ictx->lock); | ||
510 | |||
511 | retval = ictx->tx.status; | ||
512 | if (retval) | ||
513 | err("%s: packet tx failed (%d)", __func__, retval); | ||
514 | } | ||
515 | |||
516 | kfree(control_req); | ||
517 | |||
518 | /* | ||
519 | * Induce a mandatory 5ms delay before returning, as otherwise, | ||
520 | * send_packet can get called so rapidly as to overwhelm the device, | ||
521 | * particularly on faster systems and/or those with quirky usb. | ||
522 | */ | ||
523 | timeout = msecs_to_jiffies(5); | ||
524 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
525 | schedule_timeout(timeout); | ||
526 | |||
527 | return retval; | ||
528 | } | ||
529 | |||
530 | /** | ||
531 | * Sends an associate packet to the iMON 2.4G. | ||
532 | * | ||
533 | * This might not be such a good idea, since it has an id collision with | ||
534 | * some versions of the "IR & VFD" combo. The only way to determine if it | ||
535 | * is an RF version is to look at the product description string. (Which | ||
536 | * we currently do not fetch). | ||
537 | */ | ||
538 | static int send_associate_24g(struct imon_context *ictx) | ||
539 | { | ||
540 | int retval; | ||
541 | const unsigned char packet[8] = { 0x01, 0x00, 0x00, 0x00, | ||
542 | 0x00, 0x00, 0x00, 0x20 }; | ||
543 | |||
544 | if (!ictx) { | ||
545 | err("%s: no context for device", __func__); | ||
546 | return -ENODEV; | ||
547 | } | ||
548 | |||
549 | if (!ictx->dev_present_intf0) { | ||
550 | err("%s: no iMON device present", __func__); | ||
551 | return -ENODEV; | ||
552 | } | ||
553 | |||
554 | memcpy(ictx->usb_tx_buf, packet, sizeof(packet)); | ||
555 | retval = send_packet(ictx); | ||
556 | |||
557 | return retval; | ||
558 | } | ||
559 | |||
560 | /** | ||
561 | * Sends packets to setup and show clock on iMON display | ||
562 | * | ||
563 | * Arguments: year - last 2 digits of year, month - 1..12, | ||
564 | * day - 1..31, dow - day of the week (0-Sun...6-Sat), | ||
565 | * hour - 0..23, minute - 0..59, second - 0..59 | ||
566 | */ | ||
567 | static int send_set_imon_clock(struct imon_context *ictx, | ||
568 | unsigned int year, unsigned int month, | ||
569 | unsigned int day, unsigned int dow, | ||
570 | unsigned int hour, unsigned int minute, | ||
571 | unsigned int second) | ||
572 | { | ||
573 | unsigned char clock_enable_pkt[IMON_CLOCK_ENABLE_PACKETS][8]; | ||
574 | int retval = 0; | ||
575 | int i; | ||
576 | |||
577 | if (!ictx) { | ||
578 | err("%s: no context for device", __func__); | ||
579 | return -ENODEV; | ||
580 | } | ||
581 | |||
582 | switch (ictx->display_type) { | ||
583 | case IMON_DISPLAY_TYPE_LCD: | ||
584 | clock_enable_pkt[0][0] = 0x80; | ||
585 | clock_enable_pkt[0][1] = year; | ||
586 | clock_enable_pkt[0][2] = month-1; | ||
587 | clock_enable_pkt[0][3] = day; | ||
588 | clock_enable_pkt[0][4] = hour; | ||
589 | clock_enable_pkt[0][5] = minute; | ||
590 | clock_enable_pkt[0][6] = second; | ||
591 | |||
592 | clock_enable_pkt[1][0] = 0x80; | ||
593 | clock_enable_pkt[1][1] = 0; | ||
594 | clock_enable_pkt[1][2] = 0; | ||
595 | clock_enable_pkt[1][3] = 0; | ||
596 | clock_enable_pkt[1][4] = 0; | ||
597 | clock_enable_pkt[1][5] = 0; | ||
598 | clock_enable_pkt[1][6] = 0; | ||
599 | |||
600 | if (ictx->product == 0xffdc) { | ||
601 | clock_enable_pkt[0][7] = 0x50; | ||
602 | clock_enable_pkt[1][7] = 0x51; | ||
603 | } else { | ||
604 | clock_enable_pkt[0][7] = 0x88; | ||
605 | clock_enable_pkt[1][7] = 0x8a; | ||
606 | } | ||
607 | |||
608 | break; | ||
609 | |||
610 | case IMON_DISPLAY_TYPE_VFD: | ||
611 | clock_enable_pkt[0][0] = year; | ||
612 | clock_enable_pkt[0][1] = month-1; | ||
613 | clock_enable_pkt[0][2] = day; | ||
614 | clock_enable_pkt[0][3] = dow; | ||
615 | clock_enable_pkt[0][4] = hour; | ||
616 | clock_enable_pkt[0][5] = minute; | ||
617 | clock_enable_pkt[0][6] = second; | ||
618 | clock_enable_pkt[0][7] = 0x40; | ||
619 | |||
620 | clock_enable_pkt[1][0] = 0; | ||
621 | clock_enable_pkt[1][1] = 0; | ||
622 | clock_enable_pkt[1][2] = 1; | ||
623 | clock_enable_pkt[1][3] = 0; | ||
624 | clock_enable_pkt[1][4] = 0; | ||
625 | clock_enable_pkt[1][5] = 0; | ||
626 | clock_enable_pkt[1][6] = 0; | ||
627 | clock_enable_pkt[1][7] = 0x42; | ||
628 | |||
629 | break; | ||
630 | |||
631 | default: | ||
632 | return -ENODEV; | ||
633 | } | ||
634 | |||
635 | for (i = 0; i < IMON_CLOCK_ENABLE_PACKETS; i++) { | ||
636 | memcpy(ictx->usb_tx_buf, clock_enable_pkt[i], 8); | ||
637 | retval = send_packet(ictx); | ||
638 | if (retval) { | ||
639 | err("%s: send_packet failed for packet %d", | ||
640 | __func__, i); | ||
641 | break; | ||
642 | } | ||
643 | } | ||
644 | |||
645 | return retval; | ||
646 | } | ||
647 | |||
648 | /** | ||
649 | * These are the sysfs functions to handle the association on the iMON 2.4G LT. | ||
650 | */ | ||
651 | static ssize_t show_associate_remote(struct device *d, | ||
652 | struct device_attribute *attr, | ||
653 | char *buf) | ||
654 | { | ||
655 | struct imon_context *ictx = dev_get_drvdata(d); | ||
656 | |||
657 | if (!ictx) | ||
658 | return -ENODEV; | ||
659 | |||
660 | mutex_lock(&ictx->lock); | ||
661 | if (ictx->rf_isassociating) | ||
662 | strcpy(buf, "associating\n"); | ||
663 | else | ||
664 | strcpy(buf, "closed\n"); | ||
665 | |||
666 | dev_info(d, "Visit http://www.lirc.org/html/imon-24g.html for " | ||
667 | "instructions on how to associate your iMON 2.4G DT/LT " | ||
668 | "remote\n"); | ||
669 | mutex_unlock(&ictx->lock); | ||
670 | return strlen(buf); | ||
671 | } | ||
672 | |||
673 | static ssize_t store_associate_remote(struct device *d, | ||
674 | struct device_attribute *attr, | ||
675 | const char *buf, size_t count) | ||
676 | { | ||
677 | struct imon_context *ictx; | ||
678 | |||
679 | ictx = dev_get_drvdata(d); | ||
680 | |||
681 | if (!ictx) | ||
682 | return -ENODEV; | ||
683 | |||
684 | mutex_lock(&ictx->lock); | ||
685 | ictx->rf_isassociating = true; | ||
686 | send_associate_24g(ictx); | ||
687 | mutex_unlock(&ictx->lock); | ||
688 | |||
689 | return count; | ||
690 | } | ||
691 | |||
692 | /** | ||
693 | * sysfs functions to control internal imon clock | ||
694 | */ | ||
695 | static ssize_t show_imon_clock(struct device *d, | ||
696 | struct device_attribute *attr, char *buf) | ||
697 | { | ||
698 | struct imon_context *ictx = dev_get_drvdata(d); | ||
699 | size_t len; | ||
700 | |||
701 | if (!ictx) | ||
702 | return -ENODEV; | ||
703 | |||
704 | mutex_lock(&ictx->lock); | ||
705 | |||
706 | if (!ictx->display_supported) { | ||
707 | len = snprintf(buf, PAGE_SIZE, "Not supported."); | ||
708 | } else { | ||
709 | len = snprintf(buf, PAGE_SIZE, | ||
710 | "To set the clock on your iMON display:\n" | ||
711 | "# date \"+%%y %%m %%d %%w %%H %%M %%S\" > imon_clock\n" | ||
712 | "%s", ictx->display_isopen ? | ||
713 | "\nNOTE: imon device must be closed\n" : ""); | ||
714 | } | ||
715 | |||
716 | mutex_unlock(&ictx->lock); | ||
717 | |||
718 | return len; | ||
719 | } | ||
720 | |||
721 | static ssize_t store_imon_clock(struct device *d, | ||
722 | struct device_attribute *attr, | ||
723 | const char *buf, size_t count) | ||
724 | { | ||
725 | struct imon_context *ictx = dev_get_drvdata(d); | ||
726 | ssize_t retval; | ||
727 | unsigned int year, month, day, dow, hour, minute, second; | ||
728 | |||
729 | if (!ictx) | ||
730 | return -ENODEV; | ||
731 | |||
732 | mutex_lock(&ictx->lock); | ||
733 | |||
734 | if (!ictx->display_supported) { | ||
735 | retval = -ENODEV; | ||
736 | goto exit; | ||
737 | } else if (ictx->display_isopen) { | ||
738 | retval = -EBUSY; | ||
739 | goto exit; | ||
740 | } | ||
741 | |||
742 | if (sscanf(buf, "%u %u %u %u %u %u %u", &year, &month, &day, &dow, | ||
743 | &hour, &minute, &second) != 7) { | ||
744 | retval = -EINVAL; | ||
745 | goto exit; | ||
746 | } | ||
747 | |||
748 | if ((month < 1 || month > 12) || | ||
749 | (day < 1 || day > 31) || (dow > 6) || | ||
750 | (hour > 23) || (minute > 59) || (second > 59)) { | ||
751 | retval = -EINVAL; | ||
752 | goto exit; | ||
753 | } | ||
754 | |||
755 | retval = send_set_imon_clock(ictx, year, month, day, dow, | ||
756 | hour, minute, second); | ||
757 | if (retval) | ||
758 | goto exit; | ||
759 | |||
760 | retval = count; | ||
761 | exit: | ||
762 | mutex_unlock(&ictx->lock); | ||
763 | |||
764 | return retval; | ||
765 | } | ||
766 | |||
767 | |||
768 | static DEVICE_ATTR(imon_clock, S_IWUSR | S_IRUGO, show_imon_clock, | ||
769 | store_imon_clock); | ||
770 | |||
771 | static DEVICE_ATTR(associate_remote, S_IWUSR | S_IRUGO, show_associate_remote, | ||
772 | store_associate_remote); | ||
773 | |||
774 | static struct attribute *imon_display_sysfs_entries[] = { | ||
775 | &dev_attr_imon_clock.attr, | ||
776 | NULL | ||
777 | }; | ||
778 | |||
779 | static struct attribute_group imon_display_attribute_group = { | ||
780 | .attrs = imon_display_sysfs_entries | ||
781 | }; | ||
782 | |||
783 | static struct attribute *imon_rf_sysfs_entries[] = { | ||
784 | &dev_attr_associate_remote.attr, | ||
785 | NULL | ||
786 | }; | ||
787 | |||
788 | static struct attribute_group imon_rf_attribute_group = { | ||
789 | .attrs = imon_rf_sysfs_entries | ||
790 | }; | ||
791 | |||
792 | /** | ||
793 | * Writes data to the VFD. The iMON VFD is 2x16 characters | ||
794 | * and requires data in 5 consecutive USB interrupt packets, | ||
795 | * each packet but the last carrying 7 bytes. | ||
796 | * | ||
797 | * I don't know if the VFD board supports features such as | ||
798 | * scrolling, clearing rows, blanking, etc. so at | ||
799 | * the caller must provide a full screen of data. If fewer | ||
800 | * than 32 bytes are provided spaces will be appended to | ||
801 | * generate a full screen. | ||
802 | */ | ||
803 | static ssize_t vfd_write(struct file *file, const char *buf, | ||
804 | size_t n_bytes, loff_t *pos) | ||
805 | { | ||
806 | int i; | ||
807 | int offset; | ||
808 | int seq; | ||
809 | int retval = 0; | ||
810 | struct imon_context *ictx; | ||
811 | const unsigned char vfd_packet6[] = { | ||
812 | 0x01, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF }; | ||
813 | |||
814 | ictx = file->private_data; | ||
815 | if (!ictx) { | ||
816 | err("%s: no context for device", __func__); | ||
817 | return -ENODEV; | ||
818 | } | ||
819 | |||
820 | mutex_lock(&ictx->lock); | ||
821 | |||
822 | if (!ictx->dev_present_intf0) { | ||
823 | err("%s: no iMON device present", __func__); | ||
824 | retval = -ENODEV; | ||
825 | goto exit; | ||
826 | } | ||
827 | |||
828 | if (n_bytes <= 0 || n_bytes > 32) { | ||
829 | err("%s: invalid payload size", __func__); | ||
830 | retval = -EINVAL; | ||
831 | goto exit; | ||
832 | } | ||
833 | |||
834 | if (copy_from_user(ictx->tx.data_buf, buf, n_bytes)) { | ||
835 | retval = -EFAULT; | ||
836 | goto exit; | ||
837 | } | ||
838 | |||
839 | /* Pad with spaces */ | ||
840 | for (i = n_bytes; i < 32; ++i) | ||
841 | ictx->tx.data_buf[i] = ' '; | ||
842 | |||
843 | for (i = 32; i < 35; ++i) | ||
844 | ictx->tx.data_buf[i] = 0xFF; | ||
845 | |||
846 | offset = 0; | ||
847 | seq = 0; | ||
848 | |||
849 | do { | ||
850 | memcpy(ictx->usb_tx_buf, ictx->tx.data_buf + offset, 7); | ||
851 | ictx->usb_tx_buf[7] = (unsigned char) seq; | ||
852 | |||
853 | retval = send_packet(ictx); | ||
854 | if (retval) { | ||
855 | err("%s: send packet failed for packet #%d", | ||
856 | __func__, seq/2); | ||
857 | goto exit; | ||
858 | } else { | ||
859 | seq += 2; | ||
860 | offset += 7; | ||
861 | } | ||
862 | |||
863 | } while (offset < 35); | ||
864 | |||
865 | /* Send packet #6 */ | ||
866 | memcpy(ictx->usb_tx_buf, &vfd_packet6, sizeof(vfd_packet6)); | ||
867 | ictx->usb_tx_buf[7] = (unsigned char) seq; | ||
868 | retval = send_packet(ictx); | ||
869 | if (retval) | ||
870 | err("%s: send packet failed for packet #%d", | ||
871 | __func__, seq / 2); | ||
872 | |||
873 | exit: | ||
874 | mutex_unlock(&ictx->lock); | ||
875 | |||
876 | return (!retval) ? n_bytes : retval; | ||
877 | } | ||
878 | |||
879 | /** | ||
880 | * Writes data to the LCD. The iMON OEM LCD screen expects 8-byte | ||
881 | * packets. We accept data as 16 hexadecimal digits, followed by a | ||
882 | * newline (to make it easy to drive the device from a command-line | ||
883 | * -- even though the actual binary data is a bit complicated). | ||
884 | * | ||
885 | * The device itself is not a "traditional" text-mode display. It's | ||
886 | * actually a 16x96 pixel bitmap display. That means if you want to | ||
887 | * display text, you've got to have your own "font" and translate the | ||
888 | * text into bitmaps for display. This is really flexible (you can | ||
889 | * display whatever diacritics you need, and so on), but it's also | ||
890 | * a lot more complicated than most LCDs... | ||
891 | */ | ||
892 | static ssize_t lcd_write(struct file *file, const char *buf, | ||
893 | size_t n_bytes, loff_t *pos) | ||
894 | { | ||
895 | int retval = 0; | ||
896 | struct imon_context *ictx; | ||
897 | |||
898 | ictx = file->private_data; | ||
899 | if (!ictx) { | ||
900 | err("%s: no context for device", __func__); | ||
901 | return -ENODEV; | ||
902 | } | ||
903 | |||
904 | mutex_lock(&ictx->lock); | ||
905 | |||
906 | if (!ictx->display_supported) { | ||
907 | err("%s: no iMON display present", __func__); | ||
908 | retval = -ENODEV; | ||
909 | goto exit; | ||
910 | } | ||
911 | |||
912 | if (n_bytes != 8) { | ||
913 | err("%s: invalid payload size: %d (expecting 8)", | ||
914 | __func__, (int) n_bytes); | ||
915 | retval = -EINVAL; | ||
916 | goto exit; | ||
917 | } | ||
918 | |||
919 | if (copy_from_user(ictx->usb_tx_buf, buf, 8)) { | ||
920 | retval = -EFAULT; | ||
921 | goto exit; | ||
922 | } | ||
923 | |||
924 | retval = send_packet(ictx); | ||
925 | if (retval) { | ||
926 | err("%s: send packet failed!", __func__); | ||
927 | goto exit; | ||
928 | } else { | ||
929 | dev_dbg(ictx->dev, "%s: write %d bytes to LCD\n", | ||
930 | __func__, (int) n_bytes); | ||
931 | } | ||
932 | exit: | ||
933 | mutex_unlock(&ictx->lock); | ||
934 | return (!retval) ? n_bytes : retval; | ||
935 | } | ||
936 | |||
937 | /** | ||
938 | * Callback function for USB core API: transmit data | ||
939 | */ | ||
940 | static void usb_tx_callback(struct urb *urb) | ||
941 | { | ||
942 | struct imon_context *ictx; | ||
943 | |||
944 | if (!urb) | ||
945 | return; | ||
946 | ictx = (struct imon_context *)urb->context; | ||
947 | if (!ictx) | ||
948 | return; | ||
949 | |||
950 | ictx->tx.status = urb->status; | ||
951 | |||
952 | /* notify waiters that write has finished */ | ||
953 | ictx->tx.busy = false; | ||
954 | smp_rmb(); /* ensure later readers know we're not busy */ | ||
955 | complete(&ictx->tx.finished); | ||
956 | } | ||
957 | |||
958 | /** | ||
959 | * mce/rc6 keypresses have no distinct release code, use timer | ||
960 | */ | ||
961 | static void imon_mce_timeout(unsigned long data) | ||
962 | { | ||
963 | struct imon_context *ictx = (struct imon_context *)data; | ||
964 | |||
965 | input_report_key(ictx->idev, ictx->last_keycode, 0); | ||
966 | input_sync(ictx->idev); | ||
967 | } | ||
968 | |||
969 | /** | ||
970 | * report touchscreen input | ||
971 | */ | ||
972 | static void imon_touch_display_timeout(unsigned long data) | ||
973 | { | ||
974 | struct imon_context *ictx = (struct imon_context *)data; | ||
975 | |||
976 | if (ictx->display_type != IMON_DISPLAY_TYPE_VGA) | ||
977 | return; | ||
978 | |||
979 | input_report_abs(ictx->touch, ABS_X, ictx->touch_x); | ||
980 | input_report_abs(ictx->touch, ABS_Y, ictx->touch_y); | ||
981 | input_report_key(ictx->touch, BTN_TOUCH, 0x00); | ||
982 | input_sync(ictx->touch); | ||
983 | } | ||
984 | |||
985 | /** | ||
986 | * iMON IR receivers support two different signal sets -- those used by | ||
987 | * the iMON remotes, and those used by the Windows MCE remotes (which is | ||
988 | * really just RC-6), but only one or the other at a time, as the signals | ||
989 | * are decoded onboard the receiver. | ||
990 | */ | ||
991 | int imon_ir_change_protocol(void *priv, u64 ir_type) | ||
992 | { | ||
993 | int retval; | ||
994 | struct imon_context *ictx = priv; | ||
995 | struct device *dev = ictx->dev; | ||
996 | bool pad_mouse; | ||
997 | unsigned char ir_proto_packet[] = { | ||
998 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; | ||
999 | |||
1000 | if (ir_type && !(ir_type & ictx->props->allowed_protos)) | ||
1001 | dev_warn(dev, "Looks like you're trying to use an IR protocol " | ||
1002 | "this device does not support\n"); | ||
1003 | |||
1004 | switch (ir_type) { | ||
1005 | case IR_TYPE_RC6: | ||
1006 | dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); | ||
1007 | ir_proto_packet[0] = 0x01; | ||
1008 | pad_mouse = false; | ||
1009 | init_timer(&ictx->itimer); | ||
1010 | ictx->itimer.data = (unsigned long)ictx; | ||
1011 | ictx->itimer.function = imon_mce_timeout; | ||
1012 | break; | ||
1013 | case IR_TYPE_UNKNOWN: | ||
1014 | case IR_TYPE_OTHER: | ||
1015 | dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); | ||
1016 | if (pad_stabilize) | ||
1017 | pad_mouse = true; | ||
1018 | else { | ||
1019 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | ||
1020 | pad_mouse = false; | ||
1021 | } | ||
1022 | /* ir_proto_packet[0] = 0x00; // already the default */ | ||
1023 | ir_type = IR_TYPE_OTHER; | ||
1024 | break; | ||
1025 | default: | ||
1026 | dev_warn(dev, "Unsupported IR protocol specified, overriding " | ||
1027 | "to iMON IR protocol\n"); | ||
1028 | if (pad_stabilize) | ||
1029 | pad_mouse = true; | ||
1030 | else { | ||
1031 | dev_dbg(dev, "PAD stabilize functionality disabled\n"); | ||
1032 | pad_mouse = false; | ||
1033 | } | ||
1034 | /* ir_proto_packet[0] = 0x00; // already the default */ | ||
1035 | ir_type = IR_TYPE_OTHER; | ||
1036 | break; | ||
1037 | } | ||
1038 | |||
1039 | memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); | ||
1040 | |||
1041 | retval = send_packet(ictx); | ||
1042 | if (retval) | ||
1043 | goto out; | ||
1044 | |||
1045 | ictx->ir_type = ir_type; | ||
1046 | ictx->pad_mouse = pad_mouse; | ||
1047 | |||
1048 | out: | ||
1049 | return retval; | ||
1050 | } | ||
1051 | |||
1052 | static inline int tv2int(const struct timeval *a, const struct timeval *b) | ||
1053 | { | ||
1054 | int usecs = 0; | ||
1055 | int sec = 0; | ||
1056 | |||
1057 | if (b->tv_usec > a->tv_usec) { | ||
1058 | usecs = 1000000; | ||
1059 | sec--; | ||
1060 | } | ||
1061 | |||
1062 | usecs += a->tv_usec - b->tv_usec; | ||
1063 | |||
1064 | sec += a->tv_sec - b->tv_sec; | ||
1065 | sec *= 1000; | ||
1066 | usecs /= 1000; | ||
1067 | sec += usecs; | ||
1068 | |||
1069 | if (sec < 0) | ||
1070 | sec = 1000; | ||
1071 | |||
1072 | return sec; | ||
1073 | } | ||
1074 | |||
1075 | /** | ||
1076 | * The directional pad behaves a bit differently, depending on whether this is | ||
1077 | * one of the older ffdc devices or a newer device. Newer devices appear to | ||
1078 | * have a higher resolution matrix for more precise mouse movement, but it | ||
1079 | * makes things overly sensitive in keyboard mode, so we do some interesting | ||
1080 | * contortions to make it less touchy. Older devices run through the same | ||
1081 | * routine with shorter timeout and a smaller threshold. | ||
1082 | */ | ||
1083 | static int stabilize(int a, int b, u16 timeout, u16 threshold) | ||
1084 | { | ||
1085 | struct timeval ct; | ||
1086 | static struct timeval prev_time = {0, 0}; | ||
1087 | static struct timeval hit_time = {0, 0}; | ||
1088 | static int x, y, prev_result, hits; | ||
1089 | int result = 0; | ||
1090 | int msec, msec_hit; | ||
1091 | |||
1092 | do_gettimeofday(&ct); | ||
1093 | msec = tv2int(&ct, &prev_time); | ||
1094 | msec_hit = tv2int(&ct, &hit_time); | ||
1095 | |||
1096 | if (msec > 100) { | ||
1097 | x = 0; | ||
1098 | y = 0; | ||
1099 | hits = 0; | ||
1100 | } | ||
1101 | |||
1102 | x += a; | ||
1103 | y += b; | ||
1104 | |||
1105 | prev_time = ct; | ||
1106 | |||
1107 | if (abs(x) > threshold || abs(y) > threshold) { | ||
1108 | if (abs(y) > abs(x)) | ||
1109 | result = (y > 0) ? 0x7F : 0x80; | ||
1110 | else | ||
1111 | result = (x > 0) ? 0x7F00 : 0x8000; | ||
1112 | |||
1113 | x = 0; | ||
1114 | y = 0; | ||
1115 | |||
1116 | if (result == prev_result) { | ||
1117 | hits++; | ||
1118 | |||
1119 | if (hits > 3) { | ||
1120 | switch (result) { | ||
1121 | case 0x7F: | ||
1122 | y = 17 * threshold / 30; | ||
1123 | break; | ||
1124 | case 0x80: | ||
1125 | y -= 17 * threshold / 30; | ||
1126 | break; | ||
1127 | case 0x7F00: | ||
1128 | x = 17 * threshold / 30; | ||
1129 | break; | ||
1130 | case 0x8000: | ||
1131 | x -= 17 * threshold / 30; | ||
1132 | break; | ||
1133 | } | ||
1134 | } | ||
1135 | |||
1136 | if (hits == 2 && msec_hit < timeout) { | ||
1137 | result = 0; | ||
1138 | hits = 1; | ||
1139 | } | ||
1140 | } else { | ||
1141 | prev_result = result; | ||
1142 | hits = 1; | ||
1143 | hit_time = ct; | ||
1144 | } | ||
1145 | } | ||
1146 | |||
1147 | return result; | ||
1148 | } | ||
1149 | |||
1150 | static u32 imon_remote_key_lookup(struct imon_context *ictx, u32 hw_code) | ||
1151 | { | ||
1152 | u32 scancode = be32_to_cpu(hw_code); | ||
1153 | u32 keycode; | ||
1154 | u32 release; | ||
1155 | bool is_release_code = false; | ||
1156 | |||
1157 | /* Look for the initial press of a button */ | ||
1158 | keycode = ir_g_keycode_from_table(ictx->idev, scancode); | ||
1159 | |||
1160 | /* Look for the release of a button */ | ||
1161 | if (keycode == KEY_RESERVED) { | ||
1162 | release = scancode & ~0x4000; | ||
1163 | keycode = ir_g_keycode_from_table(ictx->idev, release); | ||
1164 | if (keycode != KEY_RESERVED) | ||
1165 | is_release_code = true; | ||
1166 | } | ||
1167 | |||
1168 | ictx->release_code = is_release_code; | ||
1169 | |||
1170 | return keycode; | ||
1171 | } | ||
1172 | |||
1173 | static u32 imon_mce_key_lookup(struct imon_context *ictx, u32 hw_code) | ||
1174 | { | ||
1175 | u32 scancode = be32_to_cpu(hw_code); | ||
1176 | u32 keycode; | ||
1177 | |||
1178 | #define MCE_KEY_MASK 0x7000 | ||
1179 | #define MCE_TOGGLE_BIT 0x8000 | ||
1180 | |||
1181 | /* | ||
1182 | * On some receivers, mce keys decode to 0x8000f04xx and 0x8000f84xx | ||
1183 | * (the toggle bit flipping between alternating key presses), while | ||
1184 | * on other receivers, we see 0x8000f74xx and 0x8000ff4xx. To keep | ||
1185 | * the table trim, we always or in the bits to look up 0x8000ff4xx, | ||
1186 | * but we can't or them into all codes, as some keys are decoded in | ||
1187 | * a different way w/o the same use of the toggle bit... | ||
1188 | */ | ||
1189 | if ((scancode >> 24) & 0x80) | ||
1190 | scancode = scancode | MCE_KEY_MASK | MCE_TOGGLE_BIT; | ||
1191 | |||
1192 | keycode = ir_g_keycode_from_table(ictx->idev, scancode); | ||
1193 | |||
1194 | return keycode; | ||
1195 | } | ||
1196 | |||
1197 | static u32 imon_panel_key_lookup(u64 hw_code) | ||
1198 | { | ||
1199 | int i; | ||
1200 | u64 code = be64_to_cpu(hw_code); | ||
1201 | u32 keycode = KEY_RESERVED; | ||
1202 | |||
1203 | for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++) { | ||
1204 | if (imon_panel_key_table[i].hw_code == (code | 0xffee)) { | ||
1205 | keycode = imon_panel_key_table[i].keycode; | ||
1206 | break; | ||
1207 | } | ||
1208 | } | ||
1209 | |||
1210 | return keycode; | ||
1211 | } | ||
1212 | |||
1213 | static bool imon_mouse_event(struct imon_context *ictx, | ||
1214 | unsigned char *buf, int len) | ||
1215 | { | ||
1216 | char rel_x = 0x00, rel_y = 0x00; | ||
1217 | u8 right_shift = 1; | ||
1218 | bool mouse_input = true; | ||
1219 | int dir = 0; | ||
1220 | |||
1221 | /* newer iMON device PAD or mouse button */ | ||
1222 | if (ictx->product != 0xffdc && (buf[0] & 0x01) && len == 5) { | ||
1223 | rel_x = buf[2]; | ||
1224 | rel_y = buf[3]; | ||
1225 | right_shift = 1; | ||
1226 | /* 0xffdc iMON PAD or mouse button input */ | ||
1227 | } else if (ictx->product == 0xffdc && (buf[0] & 0x40) && | ||
1228 | !((buf[1] & 0x01) || ((buf[1] >> 2) & 0x01))) { | ||
1229 | rel_x = (buf[1] & 0x08) | (buf[1] & 0x10) >> 2 | | ||
1230 | (buf[1] & 0x20) >> 4 | (buf[1] & 0x40) >> 6; | ||
1231 | if (buf[0] & 0x02) | ||
1232 | rel_x |= ~0x0f; | ||
1233 | rel_x = rel_x + rel_x / 2; | ||
1234 | rel_y = (buf[2] & 0x08) | (buf[2] & 0x10) >> 2 | | ||
1235 | (buf[2] & 0x20) >> 4 | (buf[2] & 0x40) >> 6; | ||
1236 | if (buf[0] & 0x01) | ||
1237 | rel_y |= ~0x0f; | ||
1238 | rel_y = rel_y + rel_y / 2; | ||
1239 | right_shift = 2; | ||
1240 | /* some ffdc devices decode mouse buttons differently... */ | ||
1241 | } else if (ictx->product == 0xffdc && (buf[0] == 0x68)) { | ||
1242 | right_shift = 2; | ||
1243 | /* ch+/- buttons, which we use for an emulated scroll wheel */ | ||
1244 | } else if (ictx->kc == KEY_CHANNELUP && (buf[2] & 0x40) != 0x40) { | ||
1245 | dir = 1; | ||
1246 | } else if (ictx->kc == KEY_CHANNELDOWN && (buf[2] & 0x40) != 0x40) { | ||
1247 | dir = -1; | ||
1248 | } else | ||
1249 | mouse_input = false; | ||
1250 | |||
1251 | if (mouse_input) { | ||
1252 | dev_dbg(ictx->dev, "sending mouse data via input subsystem\n"); | ||
1253 | |||
1254 | if (dir) { | ||
1255 | input_report_rel(ictx->idev, REL_WHEEL, dir); | ||
1256 | } else if (rel_x || rel_y) { | ||
1257 | input_report_rel(ictx->idev, REL_X, rel_x); | ||
1258 | input_report_rel(ictx->idev, REL_Y, rel_y); | ||
1259 | } else { | ||
1260 | input_report_key(ictx->idev, BTN_LEFT, buf[1] & 0x1); | ||
1261 | input_report_key(ictx->idev, BTN_RIGHT, | ||
1262 | buf[1] >> right_shift & 0x1); | ||
1263 | } | ||
1264 | input_sync(ictx->idev); | ||
1265 | ictx->last_keycode = ictx->kc; | ||
1266 | } | ||
1267 | |||
1268 | return mouse_input; | ||
1269 | } | ||
1270 | |||
1271 | static void imon_touch_event(struct imon_context *ictx, unsigned char *buf) | ||
1272 | { | ||
1273 | mod_timer(&ictx->ttimer, jiffies + TOUCH_TIMEOUT); | ||
1274 | ictx->touch_x = (buf[0] << 4) | (buf[1] >> 4); | ||
1275 | ictx->touch_y = 0xfff - ((buf[2] << 4) | (buf[1] & 0xf)); | ||
1276 | input_report_abs(ictx->touch, ABS_X, ictx->touch_x); | ||
1277 | input_report_abs(ictx->touch, ABS_Y, ictx->touch_y); | ||
1278 | input_report_key(ictx->touch, BTN_TOUCH, 0x01); | ||
1279 | input_sync(ictx->touch); | ||
1280 | } | ||
1281 | |||
1282 | static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf) | ||
1283 | { | ||
1284 | int dir = 0; | ||
1285 | char rel_x = 0x00, rel_y = 0x00; | ||
1286 | u16 timeout, threshold; | ||
1287 | u64 temp_key; | ||
1288 | u32 remote_key; | ||
1289 | |||
1290 | /* | ||
1291 | * The imon directional pad functions more like a touchpad. Bytes 3 & 4 | ||
1292 | * contain a position coordinate (x,y), with each component ranging | ||
1293 | * from -14 to 14. We want to down-sample this to only 4 discrete values | ||
1294 | * for up/down/left/right arrow keys. Also, when you get too close to | ||
1295 | * diagonals, it has a tendancy to jump back and forth, so lets try to | ||
1296 | * ignore when they get too close. | ||
1297 | */ | ||
1298 | if (ictx->product != 0xffdc) { | ||
1299 | /* first, pad to 8 bytes so it conforms with everything else */ | ||
1300 | buf[5] = buf[6] = buf[7] = 0; | ||
1301 | timeout = 500; /* in msecs */ | ||
1302 | /* (2*threshold) x (2*threshold) square */ | ||
1303 | threshold = pad_thresh ? pad_thresh : 28; | ||
1304 | rel_x = buf[2]; | ||
1305 | rel_y = buf[3]; | ||
1306 | |||
1307 | if (ictx->ir_type == IR_TYPE_OTHER && pad_stabilize) { | ||
1308 | if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { | ||
1309 | dir = stabilize((int)rel_x, (int)rel_y, | ||
1310 | timeout, threshold); | ||
1311 | if (!dir) { | ||
1312 | ictx->kc = KEY_UNKNOWN; | ||
1313 | return; | ||
1314 | } | ||
1315 | buf[2] = dir & 0xFF; | ||
1316 | buf[3] = (dir >> 8) & 0xFF; | ||
1317 | memcpy(&temp_key, buf, sizeof(temp_key)); | ||
1318 | remote_key = (u32) (le64_to_cpu(temp_key) | ||
1319 | & 0xffffffff); | ||
1320 | ictx->kc = imon_remote_key_lookup(ictx, | ||
1321 | remote_key); | ||
1322 | } | ||
1323 | } else { | ||
1324 | if (abs(rel_y) > abs(rel_x)) { | ||
1325 | buf[2] = (rel_y > 0) ? 0x7F : 0x80; | ||
1326 | buf[3] = 0; | ||
1327 | ictx->kc = (rel_y > 0) ? KEY_DOWN : KEY_UP; | ||
1328 | } else { | ||
1329 | buf[2] = 0; | ||
1330 | buf[3] = (rel_x > 0) ? 0x7F : 0x80; | ||
1331 | ictx->kc = (rel_x > 0) ? KEY_RIGHT : KEY_LEFT; | ||
1332 | } | ||
1333 | } | ||
1334 | |||
1335 | /* | ||
1336 | * Handle on-board decoded pad events for e.g. older VFD/iMON-Pad | ||
1337 | * device (15c2:ffdc). The remote generates various codes from | ||
1338 | * 0x68nnnnB7 to 0x6AnnnnB7, the left mouse button generates | ||
1339 | * 0x688301b7 and the right one 0x688481b7. All other keys generate | ||
1340 | * 0x2nnnnnnn. Position coordinate is encoded in buf[1] and buf[2] with | ||
1341 | * reversed endianess. Extract direction from buffer, rotate endianess, | ||
1342 | * adjust sign and feed the values into stabilize(). The resulting codes | ||
1343 | * will be 0x01008000, 0x01007F00, which match the newer devices. | ||
1344 | */ | ||
1345 | } else { | ||
1346 | timeout = 10; /* in msecs */ | ||
1347 | /* (2*threshold) x (2*threshold) square */ | ||
1348 | threshold = pad_thresh ? pad_thresh : 15; | ||
1349 | |||
1350 | /* buf[1] is x */ | ||
1351 | rel_x = (buf[1] & 0x08) | (buf[1] & 0x10) >> 2 | | ||
1352 | (buf[1] & 0x20) >> 4 | (buf[1] & 0x40) >> 6; | ||
1353 | if (buf[0] & 0x02) | ||
1354 | rel_x |= ~0x10+1; | ||
1355 | /* buf[2] is y */ | ||
1356 | rel_y = (buf[2] & 0x08) | (buf[2] & 0x10) >> 2 | | ||
1357 | (buf[2] & 0x20) >> 4 | (buf[2] & 0x40) >> 6; | ||
1358 | if (buf[0] & 0x01) | ||
1359 | rel_y |= ~0x10+1; | ||
1360 | |||
1361 | buf[0] = 0x01; | ||
1362 | buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; | ||
1363 | |||
1364 | if (ictx->ir_type == IR_TYPE_OTHER && pad_stabilize) { | ||
1365 | dir = stabilize((int)rel_x, (int)rel_y, | ||
1366 | timeout, threshold); | ||
1367 | if (!dir) { | ||
1368 | ictx->kc = KEY_UNKNOWN; | ||
1369 | return; | ||
1370 | } | ||
1371 | buf[2] = dir & 0xFF; | ||
1372 | buf[3] = (dir >> 8) & 0xFF; | ||
1373 | memcpy(&temp_key, buf, sizeof(temp_key)); | ||
1374 | remote_key = (u32) (le64_to_cpu(temp_key) & 0xffffffff); | ||
1375 | ictx->kc = imon_remote_key_lookup(ictx, remote_key); | ||
1376 | } else { | ||
1377 | if (abs(rel_y) > abs(rel_x)) { | ||
1378 | buf[2] = (rel_y > 0) ? 0x7F : 0x80; | ||
1379 | buf[3] = 0; | ||
1380 | ictx->kc = (rel_y > 0) ? KEY_DOWN : KEY_UP; | ||
1381 | } else { | ||
1382 | buf[2] = 0; | ||
1383 | buf[3] = (rel_x > 0) ? 0x7F : 0x80; | ||
1384 | ictx->kc = (rel_x > 0) ? KEY_RIGHT : KEY_LEFT; | ||
1385 | } | ||
1386 | } | ||
1387 | } | ||
1388 | } | ||
1389 | |||
1390 | static int imon_parse_press_type(struct imon_context *ictx, | ||
1391 | unsigned char *buf, u8 ktype) | ||
1392 | { | ||
1393 | int press_type = 0; | ||
1394 | int rep_delay = ictx->idev->rep[REP_DELAY]; | ||
1395 | int rep_period = ictx->idev->rep[REP_PERIOD]; | ||
1396 | |||
1397 | /* key release of 0x02XXXXXX key */ | ||
1398 | if (ictx->kc == KEY_RESERVED && buf[0] == 0x02 && buf[3] == 0x00) | ||
1399 | ictx->kc = ictx->last_keycode; | ||
1400 | |||
1401 | /* mouse button release on (some) 0xffdc devices */ | ||
1402 | else if (ictx->kc == KEY_RESERVED && buf[0] == 0x68 && buf[1] == 0x82 && | ||
1403 | buf[2] == 0x81 && buf[3] == 0xb7) | ||
1404 | ictx->kc = ictx->last_keycode; | ||
1405 | |||
1406 | /* mouse button release on (some other) 0xffdc devices */ | ||
1407 | else if (ictx->kc == KEY_RESERVED && buf[0] == 0x01 && buf[1] == 0x00 && | ||
1408 | buf[2] == 0x81 && buf[3] == 0xb7) | ||
1409 | ictx->kc = ictx->last_keycode; | ||
1410 | |||
1411 | /* mce-specific button handling */ | ||
1412 | else if (ktype == IMON_KEY_MCE) { | ||
1413 | /* initial press */ | ||
1414 | if (ictx->kc != ictx->last_keycode | ||
1415 | || buf[2] != ictx->mce_toggle_bit) { | ||
1416 | ictx->last_keycode = ictx->kc; | ||
1417 | ictx->mce_toggle_bit = buf[2]; | ||
1418 | press_type = 1; | ||
1419 | mod_timer(&ictx->itimer, | ||
1420 | jiffies + msecs_to_jiffies(rep_delay)); | ||
1421 | /* repeat */ | ||
1422 | } else { | ||
1423 | press_type = 2; | ||
1424 | mod_timer(&ictx->itimer, | ||
1425 | jiffies + msecs_to_jiffies(rep_period)); | ||
1426 | } | ||
1427 | |||
1428 | /* incoherent or irrelevant data */ | ||
1429 | } else if (ictx->kc == KEY_RESERVED) | ||
1430 | press_type = -EINVAL; | ||
1431 | |||
1432 | /* key release of 0xXXXXXXb7 key */ | ||
1433 | else if (ictx->release_code) | ||
1434 | press_type = 0; | ||
1435 | |||
1436 | /* this is a button press */ | ||
1437 | else | ||
1438 | press_type = 1; | ||
1439 | |||
1440 | return press_type; | ||
1441 | } | ||
1442 | |||
1443 | /** | ||
1444 | * Process the incoming packet | ||
1445 | */ | ||
1446 | static void imon_incoming_packet(struct imon_context *ictx, | ||
1447 | struct urb *urb, int intf) | ||
1448 | { | ||
1449 | int len = urb->actual_length; | ||
1450 | unsigned char *buf = urb->transfer_buffer; | ||
1451 | struct device *dev = ictx->dev; | ||
1452 | u32 kc; | ||
1453 | bool norelease = false; | ||
1454 | int i; | ||
1455 | u64 temp_key; | ||
1456 | u64 panel_key = 0; | ||
1457 | u32 remote_key = 0; | ||
1458 | struct input_dev *idev = NULL; | ||
1459 | int press_type = 0; | ||
1460 | int msec; | ||
1461 | struct timeval t; | ||
1462 | static struct timeval prev_time = { 0, 0 }; | ||
1463 | u8 ktype = IMON_KEY_IMON; | ||
1464 | |||
1465 | idev = ictx->idev; | ||
1466 | |||
1467 | /* filter out junk data on the older 0xffdc imon devices */ | ||
1468 | if ((buf[0] == 0xff) && (buf[1] == 0xff) && (buf[2] == 0xff)) | ||
1469 | return; | ||
1470 | |||
1471 | /* Figure out what key was pressed */ | ||
1472 | memcpy(&temp_key, buf, sizeof(temp_key)); | ||
1473 | if (len == 8 && buf[7] == 0xee) { | ||
1474 | ktype = IMON_KEY_PANEL; | ||
1475 | panel_key = le64_to_cpu(temp_key); | ||
1476 | kc = imon_panel_key_lookup(panel_key); | ||
1477 | } else { | ||
1478 | remote_key = (u32) (le64_to_cpu(temp_key) & 0xffffffff); | ||
1479 | if (ictx->ir_type == IR_TYPE_RC6) { | ||
1480 | if (buf[0] == 0x80) | ||
1481 | ktype = IMON_KEY_MCE; | ||
1482 | kc = imon_mce_key_lookup(ictx, remote_key); | ||
1483 | } else | ||
1484 | kc = imon_remote_key_lookup(ictx, remote_key); | ||
1485 | } | ||
1486 | |||
1487 | /* keyboard/mouse mode toggle button */ | ||
1488 | if (kc == KEY_KEYBOARD && !ictx->release_code) { | ||
1489 | ictx->last_keycode = kc; | ||
1490 | if (!nomouse) { | ||
1491 | ictx->pad_mouse = ~(ictx->pad_mouse) & 0x1; | ||
1492 | dev_dbg(dev, "toggling to %s mode\n", | ||
1493 | ictx->pad_mouse ? "mouse" : "keyboard"); | ||
1494 | return; | ||
1495 | } else { | ||
1496 | ictx->pad_mouse = 0; | ||
1497 | dev_dbg(dev, "mouse mode disabled, passing key value\n"); | ||
1498 | } | ||
1499 | } | ||
1500 | |||
1501 | ictx->kc = kc; | ||
1502 | |||
1503 | /* send touchscreen events through input subsystem if touchpad data */ | ||
1504 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA && len == 8 && | ||
1505 | buf[7] == 0x86) { | ||
1506 | imon_touch_event(ictx, buf); | ||
1507 | |||
1508 | /* look for mouse events with pad in mouse mode */ | ||
1509 | } else if (ictx->pad_mouse) { | ||
1510 | if (imon_mouse_event(ictx, buf, len)) | ||
1511 | return; | ||
1512 | } | ||
1513 | |||
1514 | /* Now for some special handling to convert pad input to arrow keys */ | ||
1515 | if (((len == 5) && (buf[0] == 0x01) && (buf[4] == 0x00)) || | ||
1516 | ((len == 8) && (buf[0] & 0x40) && | ||
1517 | !(buf[1] & 0x1 || buf[1] >> 2 & 0x1))) { | ||
1518 | len = 8; | ||
1519 | imon_pad_to_keys(ictx, buf); | ||
1520 | norelease = true; | ||
1521 | } | ||
1522 | |||
1523 | if (debug) { | ||
1524 | printk(KERN_INFO "intf%d decoded packet: ", intf); | ||
1525 | for (i = 0; i < len; ++i) | ||
1526 | printk("%02x ", buf[i]); | ||
1527 | printk("\n"); | ||
1528 | } | ||
1529 | |||
1530 | press_type = imon_parse_press_type(ictx, buf, ktype); | ||
1531 | if (press_type < 0) | ||
1532 | goto not_input_data; | ||
1533 | |||
1534 | if (ictx->kc == KEY_UNKNOWN) | ||
1535 | goto unknown_key; | ||
1536 | |||
1537 | /* KEY_MUTE repeats from MCE and knob need to be suppressed */ | ||
1538 | if ((ictx->kc == KEY_MUTE && ictx->kc == ictx->last_keycode) | ||
1539 | && (buf[7] == 0xee || ktype == IMON_KEY_MCE)) { | ||
1540 | do_gettimeofday(&t); | ||
1541 | msec = tv2int(&t, &prev_time); | ||
1542 | prev_time = t; | ||
1543 | if (msec < idev->rep[REP_DELAY]) | ||
1544 | return; | ||
1545 | } | ||
1546 | |||
1547 | input_report_key(idev, ictx->kc, press_type); | ||
1548 | input_sync(idev); | ||
1549 | |||
1550 | /* panel keys and some remote keys don't generate a release */ | ||
1551 | if (panel_key || norelease) { | ||
1552 | input_report_key(idev, ictx->kc, 0); | ||
1553 | input_sync(idev); | ||
1554 | } | ||
1555 | |||
1556 | ictx->last_keycode = ictx->kc; | ||
1557 | |||
1558 | return; | ||
1559 | |||
1560 | unknown_key: | ||
1561 | dev_info(dev, "%s: unknown keypress, code 0x%llx\n", __func__, | ||
1562 | (panel_key ? be64_to_cpu(panel_key) : | ||
1563 | be32_to_cpu(remote_key))); | ||
1564 | return; | ||
1565 | |||
1566 | not_input_data: | ||
1567 | if (len != 8) { | ||
1568 | dev_warn(dev, "imon %s: invalid incoming packet " | ||
1569 | "size (len = %d, intf%d)\n", __func__, len, intf); | ||
1570 | return; | ||
1571 | } | ||
1572 | |||
1573 | /* iMON 2.4G associate frame */ | ||
1574 | if (buf[0] == 0x00 && | ||
1575 | buf[2] == 0xFF && /* REFID */ | ||
1576 | buf[3] == 0xFF && | ||
1577 | buf[4] == 0xFF && | ||
1578 | buf[5] == 0xFF && /* iMON 2.4G */ | ||
1579 | ((buf[6] == 0x4E && buf[7] == 0xDF) || /* LT */ | ||
1580 | (buf[6] == 0x5E && buf[7] == 0xDF))) { /* DT */ | ||
1581 | dev_warn(dev, "%s: remote associated refid=%02X\n", | ||
1582 | __func__, buf[1]); | ||
1583 | ictx->rf_isassociating = false; | ||
1584 | } | ||
1585 | } | ||
1586 | |||
1587 | /** | ||
1588 | * Callback function for USB core API: receive data | ||
1589 | */ | ||
1590 | static void usb_rx_callback_intf0(struct urb *urb) | ||
1591 | { | ||
1592 | struct imon_context *ictx; | ||
1593 | int intfnum = 0; | ||
1594 | |||
1595 | if (!urb) | ||
1596 | return; | ||
1597 | |||
1598 | ictx = (struct imon_context *)urb->context; | ||
1599 | if (!ictx) | ||
1600 | return; | ||
1601 | |||
1602 | switch (urb->status) { | ||
1603 | case -ENOENT: /* usbcore unlink successful! */ | ||
1604 | return; | ||
1605 | |||
1606 | case -ESHUTDOWN: /* transport endpoint was shut down */ | ||
1607 | break; | ||
1608 | |||
1609 | case 0: | ||
1610 | imon_incoming_packet(ictx, urb, intfnum); | ||
1611 | break; | ||
1612 | |||
1613 | default: | ||
1614 | dev_warn(ictx->dev, "imon %s: status(%d): ignored\n", | ||
1615 | __func__, urb->status); | ||
1616 | break; | ||
1617 | } | ||
1618 | |||
1619 | usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC); | ||
1620 | } | ||
1621 | |||
1622 | static void usb_rx_callback_intf1(struct urb *urb) | ||
1623 | { | ||
1624 | struct imon_context *ictx; | ||
1625 | int intfnum = 1; | ||
1626 | |||
1627 | if (!urb) | ||
1628 | return; | ||
1629 | |||
1630 | ictx = (struct imon_context *)urb->context; | ||
1631 | if (!ictx) | ||
1632 | return; | ||
1633 | |||
1634 | switch (urb->status) { | ||
1635 | case -ENOENT: /* usbcore unlink successful! */ | ||
1636 | return; | ||
1637 | |||
1638 | case -ESHUTDOWN: /* transport endpoint was shut down */ | ||
1639 | break; | ||
1640 | |||
1641 | case 0: | ||
1642 | imon_incoming_packet(ictx, urb, intfnum); | ||
1643 | break; | ||
1644 | |||
1645 | default: | ||
1646 | dev_warn(ictx->dev, "imon %s: status(%d): ignored\n", | ||
1647 | __func__, urb->status); | ||
1648 | break; | ||
1649 | } | ||
1650 | |||
1651 | usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC); | ||
1652 | } | ||
1653 | |||
1654 | static struct input_dev *imon_init_idev(struct imon_context *ictx) | ||
1655 | { | ||
1656 | struct input_dev *idev; | ||
1657 | struct ir_dev_props *props; | ||
1658 | int ret, i; | ||
1659 | |||
1660 | idev = input_allocate_device(); | ||
1661 | if (!idev) { | ||
1662 | dev_err(ictx->dev, "remote input dev allocation failed\n"); | ||
1663 | goto idev_alloc_failed; | ||
1664 | } | ||
1665 | |||
1666 | props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); | ||
1667 | if (!props) { | ||
1668 | dev_err(ictx->dev, "remote ir dev props allocation failed\n"); | ||
1669 | goto props_alloc_failed; | ||
1670 | } | ||
1671 | |||
1672 | snprintf(ictx->name_idev, sizeof(ictx->name_idev), | ||
1673 | "iMON Remote (%04x:%04x)", ictx->vendor, ictx->product); | ||
1674 | idev->name = ictx->name_idev; | ||
1675 | |||
1676 | usb_make_path(ictx->usbdev_intf0, ictx->phys_idev, | ||
1677 | sizeof(ictx->phys_idev)); | ||
1678 | strlcat(ictx->phys_idev, "/input0", sizeof(ictx->phys_idev)); | ||
1679 | idev->phys = ictx->phys_idev; | ||
1680 | |||
1681 | idev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP) | BIT_MASK(EV_REL); | ||
1682 | |||
1683 | idev->keybit[BIT_WORD(BTN_MOUSE)] = | ||
1684 | BIT_MASK(BTN_LEFT) | BIT_MASK(BTN_RIGHT); | ||
1685 | idev->relbit[0] = BIT_MASK(REL_X) | BIT_MASK(REL_Y) | | ||
1686 | BIT_MASK(REL_WHEEL); | ||
1687 | |||
1688 | /* panel and/or knob code support */ | ||
1689 | for (i = 0; i < ARRAY_SIZE(imon_panel_key_table); i++) { | ||
1690 | u32 kc = imon_panel_key_table[i].keycode; | ||
1691 | __set_bit(kc, idev->keybit); | ||
1692 | } | ||
1693 | |||
1694 | props->priv = ictx; | ||
1695 | props->driver_type = RC_DRIVER_SCANCODE; | ||
1696 | /* IR_TYPE_OTHER maps to iMON PAD remote, IR_TYPE_RC6 to MCE remote */ | ||
1697 | props->allowed_protos = IR_TYPE_OTHER | IR_TYPE_RC6; | ||
1698 | props->change_protocol = imon_ir_change_protocol; | ||
1699 | ictx->props = props; | ||
1700 | |||
1701 | usb_to_input_id(ictx->usbdev_intf0, &idev->id); | ||
1702 | idev->dev.parent = ictx->dev; | ||
1703 | |||
1704 | ret = ir_input_register(idev, RC_MAP_IMON_PAD, props, MOD_NAME); | ||
1705 | if (ret < 0) { | ||
1706 | dev_err(ictx->dev, "remote input dev register failed\n"); | ||
1707 | goto idev_register_failed; | ||
1708 | } | ||
1709 | |||
1710 | return idev; | ||
1711 | |||
1712 | idev_register_failed: | ||
1713 | kfree(props); | ||
1714 | props_alloc_failed: | ||
1715 | input_free_device(idev); | ||
1716 | idev_alloc_failed: | ||
1717 | |||
1718 | return NULL; | ||
1719 | } | ||
1720 | |||
1721 | static struct input_dev *imon_init_touch(struct imon_context *ictx) | ||
1722 | { | ||
1723 | struct input_dev *touch; | ||
1724 | int ret; | ||
1725 | |||
1726 | touch = input_allocate_device(); | ||
1727 | if (!touch) { | ||
1728 | dev_err(ictx->dev, "touchscreen input dev allocation failed\n"); | ||
1729 | goto touch_alloc_failed; | ||
1730 | } | ||
1731 | |||
1732 | snprintf(ictx->name_touch, sizeof(ictx->name_touch), | ||
1733 | "iMON USB Touchscreen (%04x:%04x)", | ||
1734 | ictx->vendor, ictx->product); | ||
1735 | touch->name = ictx->name_touch; | ||
1736 | |||
1737 | usb_make_path(ictx->usbdev_intf1, ictx->phys_touch, | ||
1738 | sizeof(ictx->phys_touch)); | ||
1739 | strlcat(ictx->phys_touch, "/input1", sizeof(ictx->phys_touch)); | ||
1740 | touch->phys = ictx->phys_touch; | ||
1741 | |||
1742 | touch->evbit[0] = | ||
1743 | BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); | ||
1744 | touch->keybit[BIT_WORD(BTN_TOUCH)] = | ||
1745 | BIT_MASK(BTN_TOUCH); | ||
1746 | input_set_abs_params(touch, ABS_X, | ||
1747 | 0x00, 0xfff, 0, 0); | ||
1748 | input_set_abs_params(touch, ABS_Y, | ||
1749 | 0x00, 0xfff, 0, 0); | ||
1750 | |||
1751 | input_set_drvdata(touch, ictx); | ||
1752 | |||
1753 | usb_to_input_id(ictx->usbdev_intf1, &touch->id); | ||
1754 | touch->dev.parent = ictx->dev; | ||
1755 | ret = input_register_device(touch); | ||
1756 | if (ret < 0) { | ||
1757 | dev_info(ictx->dev, "touchscreen input dev register failed\n"); | ||
1758 | goto touch_register_failed; | ||
1759 | } | ||
1760 | |||
1761 | return touch; | ||
1762 | |||
1763 | touch_register_failed: | ||
1764 | input_free_device(ictx->touch); | ||
1765 | |||
1766 | touch_alloc_failed: | ||
1767 | return NULL; | ||
1768 | } | ||
1769 | |||
1770 | static bool imon_find_endpoints(struct imon_context *ictx, | ||
1771 | struct usb_host_interface *iface_desc) | ||
1772 | { | ||
1773 | struct usb_endpoint_descriptor *ep; | ||
1774 | struct usb_endpoint_descriptor *rx_endpoint = NULL; | ||
1775 | struct usb_endpoint_descriptor *tx_endpoint = NULL; | ||
1776 | int ifnum = iface_desc->desc.bInterfaceNumber; | ||
1777 | int num_endpts = iface_desc->desc.bNumEndpoints; | ||
1778 | int i, ep_dir, ep_type; | ||
1779 | bool ir_ep_found = false; | ||
1780 | bool display_ep_found = false; | ||
1781 | bool tx_control = false; | ||
1782 | |||
1783 | /* | ||
1784 | * Scan the endpoint list and set: | ||
1785 | * first input endpoint = IR endpoint | ||
1786 | * first output endpoint = display endpoint | ||
1787 | */ | ||
1788 | for (i = 0; i < num_endpts && !(ir_ep_found && display_ep_found); ++i) { | ||
1789 | ep = &iface_desc->endpoint[i].desc; | ||
1790 | ep_dir = ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK; | ||
1791 | ep_type = ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; | ||
1792 | |||
1793 | if (!ir_ep_found && ep_dir == USB_DIR_IN && | ||
1794 | ep_type == USB_ENDPOINT_XFER_INT) { | ||
1795 | |||
1796 | rx_endpoint = ep; | ||
1797 | ir_ep_found = true; | ||
1798 | dev_dbg(ictx->dev, "%s: found IR endpoint\n", __func__); | ||
1799 | |||
1800 | } else if (!display_ep_found && ep_dir == USB_DIR_OUT && | ||
1801 | ep_type == USB_ENDPOINT_XFER_INT) { | ||
1802 | tx_endpoint = ep; | ||
1803 | display_ep_found = true; | ||
1804 | dev_dbg(ictx->dev, "%s: found display endpoint\n", __func__); | ||
1805 | } | ||
1806 | } | ||
1807 | |||
1808 | if (ifnum == 0) { | ||
1809 | ictx->rx_endpoint_intf0 = rx_endpoint; | ||
1810 | /* | ||
1811 | * tx is used to send characters to lcd/vfd, associate RF | ||
1812 | * remotes, set IR protocol, and maybe more... | ||
1813 | */ | ||
1814 | ictx->tx_endpoint = tx_endpoint; | ||
1815 | } else { | ||
1816 | ictx->rx_endpoint_intf1 = rx_endpoint; | ||
1817 | } | ||
1818 | |||
1819 | /* | ||
1820 | * If we didn't find a display endpoint, this is probably one of the | ||
1821 | * newer iMON devices that use control urb instead of interrupt | ||
1822 | */ | ||
1823 | if (!display_ep_found) { | ||
1824 | tx_control = true; | ||
1825 | display_ep_found = true; | ||
1826 | dev_dbg(ictx->dev, "%s: device uses control endpoint, not " | ||
1827 | "interface OUT endpoint\n", __func__); | ||
1828 | } | ||
1829 | |||
1830 | /* | ||
1831 | * Some iMON receivers have no display. Unfortunately, it seems | ||
1832 | * that SoundGraph recycles device IDs between devices both with | ||
1833 | * and without... :\ | ||
1834 | */ | ||
1835 | if (ictx->display_type == IMON_DISPLAY_TYPE_NONE) { | ||
1836 | display_ep_found = false; | ||
1837 | dev_dbg(ictx->dev, "%s: device has no display\n", __func__); | ||
1838 | } | ||
1839 | |||
1840 | /* | ||
1841 | * iMON Touch devices have a VGA touchscreen, but no "display", as | ||
1842 | * that refers to e.g. /dev/lcd0 (a character device LCD or VFD). | ||
1843 | */ | ||
1844 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { | ||
1845 | display_ep_found = false; | ||
1846 | dev_dbg(ictx->dev, "%s: iMON Touch device found\n", __func__); | ||
1847 | } | ||
1848 | |||
1849 | /* Input endpoint is mandatory */ | ||
1850 | if (!ir_ep_found) | ||
1851 | err("%s: no valid input (IR) endpoint found.", __func__); | ||
1852 | |||
1853 | ictx->tx_control = tx_control; | ||
1854 | |||
1855 | if (display_ep_found) | ||
1856 | ictx->display_supported = true; | ||
1857 | |||
1858 | return ir_ep_found; | ||
1859 | |||
1860 | } | ||
1861 | |||
1862 | static struct imon_context *imon_init_intf0(struct usb_interface *intf) | ||
1863 | { | ||
1864 | struct imon_context *ictx; | ||
1865 | struct urb *rx_urb; | ||
1866 | struct urb *tx_urb; | ||
1867 | struct device *dev = &intf->dev; | ||
1868 | struct usb_host_interface *iface_desc; | ||
1869 | int ret = -ENOMEM; | ||
1870 | |||
1871 | ictx = kzalloc(sizeof(struct imon_context), GFP_KERNEL); | ||
1872 | if (!ictx) { | ||
1873 | dev_err(dev, "%s: kzalloc failed for context", __func__); | ||
1874 | goto exit; | ||
1875 | } | ||
1876 | rx_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
1877 | if (!rx_urb) { | ||
1878 | dev_err(dev, "%s: usb_alloc_urb failed for IR urb", __func__); | ||
1879 | goto rx_urb_alloc_failed; | ||
1880 | } | ||
1881 | tx_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
1882 | if (!tx_urb) { | ||
1883 | dev_err(dev, "%s: usb_alloc_urb failed for display urb", | ||
1884 | __func__); | ||
1885 | goto tx_urb_alloc_failed; | ||
1886 | } | ||
1887 | |||
1888 | mutex_init(&ictx->lock); | ||
1889 | |||
1890 | mutex_lock(&ictx->lock); | ||
1891 | |||
1892 | ictx->dev = dev; | ||
1893 | ictx->usbdev_intf0 = usb_get_dev(interface_to_usbdev(intf)); | ||
1894 | ictx->dev_present_intf0 = true; | ||
1895 | ictx->rx_urb_intf0 = rx_urb; | ||
1896 | ictx->tx_urb = tx_urb; | ||
1897 | ictx->rf_device = false; | ||
1898 | |||
1899 | ictx->vendor = le16_to_cpu(ictx->usbdev_intf0->descriptor.idVendor); | ||
1900 | ictx->product = le16_to_cpu(ictx->usbdev_intf0->descriptor.idProduct); | ||
1901 | |||
1902 | ret = -ENODEV; | ||
1903 | iface_desc = intf->cur_altsetting; | ||
1904 | if (!imon_find_endpoints(ictx, iface_desc)) { | ||
1905 | goto find_endpoint_failed; | ||
1906 | } | ||
1907 | |||
1908 | ictx->idev = imon_init_idev(ictx); | ||
1909 | if (!ictx->idev) { | ||
1910 | dev_err(dev, "%s: input device setup failed\n", __func__); | ||
1911 | goto idev_setup_failed; | ||
1912 | } | ||
1913 | |||
1914 | usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, | ||
1915 | usb_rcvintpipe(ictx->usbdev_intf0, | ||
1916 | ictx->rx_endpoint_intf0->bEndpointAddress), | ||
1917 | ictx->usb_rx_buf, sizeof(ictx->usb_rx_buf), | ||
1918 | usb_rx_callback_intf0, ictx, | ||
1919 | ictx->rx_endpoint_intf0->bInterval); | ||
1920 | |||
1921 | ret = usb_submit_urb(ictx->rx_urb_intf0, GFP_KERNEL); | ||
1922 | if (ret) { | ||
1923 | err("%s: usb_submit_urb failed for intf0 (%d)", | ||
1924 | __func__, ret); | ||
1925 | goto urb_submit_failed; | ||
1926 | } | ||
1927 | |||
1928 | return ictx; | ||
1929 | |||
1930 | urb_submit_failed: | ||
1931 | ir_input_unregister(ictx->idev); | ||
1932 | idev_setup_failed: | ||
1933 | find_endpoint_failed: | ||
1934 | mutex_unlock(&ictx->lock); | ||
1935 | usb_free_urb(tx_urb); | ||
1936 | tx_urb_alloc_failed: | ||
1937 | usb_free_urb(rx_urb); | ||
1938 | rx_urb_alloc_failed: | ||
1939 | kfree(ictx); | ||
1940 | exit: | ||
1941 | dev_err(dev, "unable to initialize intf0, err %d\n", ret); | ||
1942 | |||
1943 | return NULL; | ||
1944 | } | ||
1945 | |||
1946 | static struct imon_context *imon_init_intf1(struct usb_interface *intf, | ||
1947 | struct imon_context *ictx) | ||
1948 | { | ||
1949 | struct urb *rx_urb; | ||
1950 | struct usb_host_interface *iface_desc; | ||
1951 | int ret = -ENOMEM; | ||
1952 | |||
1953 | rx_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
1954 | if (!rx_urb) { | ||
1955 | err("%s: usb_alloc_urb failed for IR urb", __func__); | ||
1956 | goto rx_urb_alloc_failed; | ||
1957 | } | ||
1958 | |||
1959 | mutex_lock(&ictx->lock); | ||
1960 | |||
1961 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { | ||
1962 | init_timer(&ictx->ttimer); | ||
1963 | ictx->ttimer.data = (unsigned long)ictx; | ||
1964 | ictx->ttimer.function = imon_touch_display_timeout; | ||
1965 | } | ||
1966 | |||
1967 | ictx->usbdev_intf1 = usb_get_dev(interface_to_usbdev(intf)); | ||
1968 | ictx->dev_present_intf1 = true; | ||
1969 | ictx->rx_urb_intf1 = rx_urb; | ||
1970 | |||
1971 | ret = -ENODEV; | ||
1972 | iface_desc = intf->cur_altsetting; | ||
1973 | if (!imon_find_endpoints(ictx, iface_desc)) | ||
1974 | goto find_endpoint_failed; | ||
1975 | |||
1976 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) { | ||
1977 | ictx->touch = imon_init_touch(ictx); | ||
1978 | if (!ictx->touch) | ||
1979 | goto touch_setup_failed; | ||
1980 | } else | ||
1981 | ictx->touch = NULL; | ||
1982 | |||
1983 | usb_fill_int_urb(ictx->rx_urb_intf1, ictx->usbdev_intf1, | ||
1984 | usb_rcvintpipe(ictx->usbdev_intf1, | ||
1985 | ictx->rx_endpoint_intf1->bEndpointAddress), | ||
1986 | ictx->usb_rx_buf, sizeof(ictx->usb_rx_buf), | ||
1987 | usb_rx_callback_intf1, ictx, | ||
1988 | ictx->rx_endpoint_intf1->bInterval); | ||
1989 | |||
1990 | ret = usb_submit_urb(ictx->rx_urb_intf1, GFP_KERNEL); | ||
1991 | |||
1992 | if (ret) { | ||
1993 | err("%s: usb_submit_urb failed for intf1 (%d)", | ||
1994 | __func__, ret); | ||
1995 | goto urb_submit_failed; | ||
1996 | } | ||
1997 | |||
1998 | return ictx; | ||
1999 | |||
2000 | urb_submit_failed: | ||
2001 | if (ictx->touch) | ||
2002 | input_unregister_device(ictx->touch); | ||
2003 | touch_setup_failed: | ||
2004 | find_endpoint_failed: | ||
2005 | mutex_unlock(&ictx->lock); | ||
2006 | usb_free_urb(rx_urb); | ||
2007 | rx_urb_alloc_failed: | ||
2008 | dev_err(ictx->dev, "unable to initialize intf0, err %d\n", ret); | ||
2009 | |||
2010 | return NULL; | ||
2011 | } | ||
2012 | |||
2013 | /* | ||
2014 | * The 0x15c2:0xffdc device ID was used for umpteen different imon | ||
2015 | * devices, and all of them constantly spew interrupts, even when there | ||
2016 | * is no actual data to report. However, byte 6 of this buffer looks like | ||
2017 | * its unique across device variants, so we're trying to key off that to | ||
2018 | * figure out which display type (if any) and what IR protocol the device | ||
2019 | * actually supports. These devices have their IR protocol hard-coded into | ||
2020 | * their firmware, they can't be changed on the fly like the newer hardware. | ||
2021 | */ | ||
2022 | static void imon_get_ffdc_type(struct imon_context *ictx) | ||
2023 | { | ||
2024 | u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; | ||
2025 | u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; | ||
2026 | u64 allowed_protos = IR_TYPE_OTHER; | ||
2027 | |||
2028 | switch (ffdc_cfg_byte) { | ||
2029 | /* iMON Knob, no display, iMON IR + vol knob */ | ||
2030 | case 0x21: | ||
2031 | dev_info(ictx->dev, "0xffdc iMON Knob, iMON IR"); | ||
2032 | ictx->display_supported = false; | ||
2033 | break; | ||
2034 | /* iMON 2.4G LT (usb stick), no display, iMON RF */ | ||
2035 | case 0x4e: | ||
2036 | dev_info(ictx->dev, "0xffdc iMON 2.4G LT, iMON RF"); | ||
2037 | ictx->display_supported = false; | ||
2038 | ictx->rf_device = true; | ||
2039 | break; | ||
2040 | /* iMON VFD, no IR (does have vol knob tho) */ | ||
2041 | case 0x35: | ||
2042 | dev_info(ictx->dev, "0xffdc iMON VFD + knob, no IR"); | ||
2043 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | ||
2044 | break; | ||
2045 | /* iMON VFD, iMON IR */ | ||
2046 | case 0x24: | ||
2047 | case 0x85: | ||
2048 | dev_info(ictx->dev, "0xffdc iMON VFD, iMON IR"); | ||
2049 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | ||
2050 | break; | ||
2051 | /* iMON LCD, MCE IR */ | ||
2052 | case 0x9e: | ||
2053 | case 0x9f: | ||
2054 | dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); | ||
2055 | detected_display_type = IMON_DISPLAY_TYPE_LCD; | ||
2056 | allowed_protos = IR_TYPE_RC6; | ||
2057 | break; | ||
2058 | default: | ||
2059 | dev_info(ictx->dev, "Unknown 0xffdc device, " | ||
2060 | "defaulting to VFD and iMON IR"); | ||
2061 | detected_display_type = IMON_DISPLAY_TYPE_VFD; | ||
2062 | break; | ||
2063 | } | ||
2064 | |||
2065 | printk(KERN_CONT " (id 0x%02x)\n", ffdc_cfg_byte); | ||
2066 | |||
2067 | ictx->display_type = detected_display_type; | ||
2068 | ictx->props->allowed_protos = allowed_protos; | ||
2069 | ictx->ir_type = allowed_protos; | ||
2070 | } | ||
2071 | |||
2072 | static void imon_set_display_type(struct imon_context *ictx, | ||
2073 | struct usb_interface *intf) | ||
2074 | { | ||
2075 | u8 configured_display_type = IMON_DISPLAY_TYPE_VFD; | ||
2076 | |||
2077 | /* | ||
2078 | * Try to auto-detect the type of display if the user hasn't set | ||
2079 | * it by hand via the display_type modparam. Default is VFD. | ||
2080 | */ | ||
2081 | |||
2082 | if (display_type == IMON_DISPLAY_TYPE_AUTO) { | ||
2083 | switch (ictx->product) { | ||
2084 | case 0xffdc: | ||
2085 | /* set in imon_get_ffdc_type() */ | ||
2086 | configured_display_type = ictx->display_type; | ||
2087 | break; | ||
2088 | case 0x0034: | ||
2089 | case 0x0035: | ||
2090 | configured_display_type = IMON_DISPLAY_TYPE_VGA; | ||
2091 | break; | ||
2092 | case 0x0038: | ||
2093 | case 0x0039: | ||
2094 | case 0x0045: | ||
2095 | configured_display_type = IMON_DISPLAY_TYPE_LCD; | ||
2096 | break; | ||
2097 | case 0x003c: | ||
2098 | case 0x0041: | ||
2099 | case 0x0042: | ||
2100 | case 0x0043: | ||
2101 | configured_display_type = IMON_DISPLAY_TYPE_NONE; | ||
2102 | ictx->display_supported = false; | ||
2103 | break; | ||
2104 | case 0x0036: | ||
2105 | case 0x0044: | ||
2106 | default: | ||
2107 | configured_display_type = IMON_DISPLAY_TYPE_VFD; | ||
2108 | break; | ||
2109 | } | ||
2110 | } else { | ||
2111 | configured_display_type = display_type; | ||
2112 | if (display_type == IMON_DISPLAY_TYPE_NONE) | ||
2113 | ictx->display_supported = false; | ||
2114 | else | ||
2115 | ictx->display_supported = true; | ||
2116 | dev_info(ictx->dev, "%s: overriding display type to %d via " | ||
2117 | "modparam\n", __func__, display_type); | ||
2118 | } | ||
2119 | |||
2120 | ictx->display_type = configured_display_type; | ||
2121 | } | ||
2122 | |||
2123 | static void imon_init_display(struct imon_context *ictx, | ||
2124 | struct usb_interface *intf) | ||
2125 | { | ||
2126 | int ret; | ||
2127 | |||
2128 | dev_dbg(ictx->dev, "Registering iMON display with sysfs\n"); | ||
2129 | |||
2130 | /* set up sysfs entry for built-in clock */ | ||
2131 | ret = sysfs_create_group(&intf->dev.kobj, | ||
2132 | &imon_display_attribute_group); | ||
2133 | if (ret) | ||
2134 | dev_err(ictx->dev, "Could not create display sysfs " | ||
2135 | "entries(%d)", ret); | ||
2136 | |||
2137 | if (ictx->display_type == IMON_DISPLAY_TYPE_LCD) | ||
2138 | ret = usb_register_dev(intf, &imon_lcd_class); | ||
2139 | else | ||
2140 | ret = usb_register_dev(intf, &imon_vfd_class); | ||
2141 | if (ret) | ||
2142 | /* Not a fatal error, so ignore */ | ||
2143 | dev_info(ictx->dev, "could not get a minor number for " | ||
2144 | "display\n"); | ||
2145 | |||
2146 | } | ||
2147 | |||
2148 | /** | ||
2149 | * Callback function for USB core API: Probe | ||
2150 | */ | ||
2151 | static int __devinit imon_probe(struct usb_interface *interface, | ||
2152 | const struct usb_device_id *id) | ||
2153 | { | ||
2154 | struct usb_device *usbdev = NULL; | ||
2155 | struct usb_host_interface *iface_desc = NULL; | ||
2156 | struct usb_interface *first_if; | ||
2157 | struct device *dev = &interface->dev; | ||
2158 | int ifnum, code_length, sysfs_err; | ||
2159 | int ret = 0; | ||
2160 | struct imon_context *ictx = NULL; | ||
2161 | struct imon_context *first_if_ctx = NULL; | ||
2162 | u16 vendor, product; | ||
2163 | const unsigned char fp_packet[] = { 0x40, 0x00, 0x00, 0x00, | ||
2164 | 0x00, 0x00, 0x00, 0x88 }; | ||
2165 | |||
2166 | code_length = BUF_CHUNK_SIZE * 8; | ||
2167 | |||
2168 | usbdev = usb_get_dev(interface_to_usbdev(interface)); | ||
2169 | iface_desc = interface->cur_altsetting; | ||
2170 | ifnum = iface_desc->desc.bInterfaceNumber; | ||
2171 | vendor = le16_to_cpu(usbdev->descriptor.idVendor); | ||
2172 | product = le16_to_cpu(usbdev->descriptor.idProduct); | ||
2173 | |||
2174 | dev_dbg(dev, "%s: found iMON device (%04x:%04x, intf%d)\n", | ||
2175 | __func__, vendor, product, ifnum); | ||
2176 | |||
2177 | /* prevent races probing devices w/multiple interfaces */ | ||
2178 | mutex_lock(&driver_lock); | ||
2179 | |||
2180 | first_if = usb_ifnum_to_if(usbdev, 0); | ||
2181 | first_if_ctx = (struct imon_context *)usb_get_intfdata(first_if); | ||
2182 | |||
2183 | if (ifnum == 0) { | ||
2184 | ictx = imon_init_intf0(interface); | ||
2185 | if (!ictx) { | ||
2186 | err("%s: failed to initialize context!\n", __func__); | ||
2187 | ret = -ENODEV; | ||
2188 | goto fail; | ||
2189 | } | ||
2190 | |||
2191 | } else { | ||
2192 | /* this is the secondary interface on the device */ | ||
2193 | ictx = imon_init_intf1(interface, first_if_ctx); | ||
2194 | if (!ictx) { | ||
2195 | err("%s: failed to attach to context!\n", __func__); | ||
2196 | ret = -ENODEV; | ||
2197 | goto fail; | ||
2198 | } | ||
2199 | |||
2200 | } | ||
2201 | |||
2202 | usb_set_intfdata(interface, ictx); | ||
2203 | |||
2204 | if (ifnum == 0) { | ||
2205 | /* Enable front-panel buttons and/or knobs */ | ||
2206 | memcpy(ictx->usb_tx_buf, &fp_packet, sizeof(fp_packet)); | ||
2207 | ret = send_packet(ictx); | ||
2208 | /* Not fatal, but warn about it */ | ||
2209 | if (ret) | ||
2210 | dev_info(dev, "failed to enable panel buttons " | ||
2211 | "and/or knobs\n"); | ||
2212 | |||
2213 | if (product == 0xffdc) | ||
2214 | imon_get_ffdc_type(ictx); | ||
2215 | |||
2216 | imon_set_display_type(ictx, interface); | ||
2217 | |||
2218 | if (product == 0xffdc && ictx->rf_device) { | ||
2219 | sysfs_err = sysfs_create_group(&interface->dev.kobj, | ||
2220 | &imon_rf_attribute_group); | ||
2221 | if (sysfs_err) | ||
2222 | err("%s: Could not create RF sysfs entries(%d)", | ||
2223 | __func__, sysfs_err); | ||
2224 | } | ||
2225 | |||
2226 | if (ictx->display_supported) | ||
2227 | imon_init_display(ictx, interface); | ||
2228 | } | ||
2229 | |||
2230 | /* set IR protocol/remote type */ | ||
2231 | ret = imon_ir_change_protocol(ictx, ictx->ir_type); | ||
2232 | if (ret) { | ||
2233 | dev_warn(dev, "%s: failed to set IR protocol, falling back " | ||
2234 | "to standard iMON protocol mode\n", __func__); | ||
2235 | ictx->ir_type = IR_TYPE_OTHER; | ||
2236 | } | ||
2237 | |||
2238 | dev_info(dev, "iMON device (%04x:%04x, intf%d) on " | ||
2239 | "usb<%d:%d> initialized\n", vendor, product, ifnum, | ||
2240 | usbdev->bus->busnum, usbdev->devnum); | ||
2241 | |||
2242 | mutex_unlock(&ictx->lock); | ||
2243 | mutex_unlock(&driver_lock); | ||
2244 | |||
2245 | return 0; | ||
2246 | |||
2247 | fail: | ||
2248 | mutex_unlock(&driver_lock); | ||
2249 | dev_err(dev, "unable to register, err %d\n", ret); | ||
2250 | |||
2251 | return ret; | ||
2252 | } | ||
2253 | |||
2254 | /** | ||
2255 | * Callback function for USB core API: disconnect | ||
2256 | */ | ||
2257 | static void __devexit imon_disconnect(struct usb_interface *interface) | ||
2258 | { | ||
2259 | struct imon_context *ictx; | ||
2260 | struct device *dev; | ||
2261 | int ifnum; | ||
2262 | |||
2263 | /* prevent races with multi-interface device probing and display_open */ | ||
2264 | mutex_lock(&driver_lock); | ||
2265 | |||
2266 | ictx = usb_get_intfdata(interface); | ||
2267 | dev = ictx->dev; | ||
2268 | ifnum = interface->cur_altsetting->desc.bInterfaceNumber; | ||
2269 | |||
2270 | mutex_lock(&ictx->lock); | ||
2271 | |||
2272 | /* | ||
2273 | * sysfs_remove_group is safe to call even if sysfs_create_group | ||
2274 | * hasn't been called | ||
2275 | */ | ||
2276 | sysfs_remove_group(&interface->dev.kobj, | ||
2277 | &imon_display_attribute_group); | ||
2278 | sysfs_remove_group(&interface->dev.kobj, | ||
2279 | &imon_rf_attribute_group); | ||
2280 | |||
2281 | usb_set_intfdata(interface, NULL); | ||
2282 | |||
2283 | /* Abort ongoing write */ | ||
2284 | if (ictx->tx.busy) { | ||
2285 | usb_kill_urb(ictx->tx_urb); | ||
2286 | complete_all(&ictx->tx.finished); | ||
2287 | } | ||
2288 | |||
2289 | if (ifnum == 0) { | ||
2290 | ictx->dev_present_intf0 = false; | ||
2291 | usb_kill_urb(ictx->rx_urb_intf0); | ||
2292 | ir_input_unregister(ictx->idev); | ||
2293 | if (ictx->display_supported) { | ||
2294 | if (ictx->display_type == IMON_DISPLAY_TYPE_LCD) | ||
2295 | usb_deregister_dev(interface, &imon_lcd_class); | ||
2296 | else | ||
2297 | usb_deregister_dev(interface, &imon_vfd_class); | ||
2298 | } | ||
2299 | } else { | ||
2300 | ictx->dev_present_intf1 = false; | ||
2301 | usb_kill_urb(ictx->rx_urb_intf1); | ||
2302 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) | ||
2303 | input_unregister_device(ictx->touch); | ||
2304 | } | ||
2305 | |||
2306 | if (!ictx->dev_present_intf0 && !ictx->dev_present_intf1) { | ||
2307 | if (ictx->display_type == IMON_DISPLAY_TYPE_VGA) | ||
2308 | del_timer_sync(&ictx->ttimer); | ||
2309 | mutex_unlock(&ictx->lock); | ||
2310 | if (!ictx->display_isopen) | ||
2311 | free_imon_context(ictx); | ||
2312 | } else { | ||
2313 | if (ictx->ir_type == IR_TYPE_RC6) | ||
2314 | del_timer_sync(&ictx->itimer); | ||
2315 | mutex_unlock(&ictx->lock); | ||
2316 | } | ||
2317 | |||
2318 | mutex_unlock(&driver_lock); | ||
2319 | |||
2320 | dev_dbg(dev, "%s: iMON device (intf%d) disconnected\n", | ||
2321 | __func__, ifnum); | ||
2322 | } | ||
2323 | |||
2324 | static int imon_suspend(struct usb_interface *intf, pm_message_t message) | ||
2325 | { | ||
2326 | struct imon_context *ictx = usb_get_intfdata(intf); | ||
2327 | int ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | ||
2328 | |||
2329 | if (ifnum == 0) | ||
2330 | usb_kill_urb(ictx->rx_urb_intf0); | ||
2331 | else | ||
2332 | usb_kill_urb(ictx->rx_urb_intf1); | ||
2333 | |||
2334 | return 0; | ||
2335 | } | ||
2336 | |||
2337 | static int imon_resume(struct usb_interface *intf) | ||
2338 | { | ||
2339 | int rc = 0; | ||
2340 | struct imon_context *ictx = usb_get_intfdata(intf); | ||
2341 | int ifnum = intf->cur_altsetting->desc.bInterfaceNumber; | ||
2342 | |||
2343 | if (ifnum == 0) { | ||
2344 | usb_fill_int_urb(ictx->rx_urb_intf0, ictx->usbdev_intf0, | ||
2345 | usb_rcvintpipe(ictx->usbdev_intf0, | ||
2346 | ictx->rx_endpoint_intf0->bEndpointAddress), | ||
2347 | ictx->usb_rx_buf, sizeof(ictx->usb_rx_buf), | ||
2348 | usb_rx_callback_intf0, ictx, | ||
2349 | ictx->rx_endpoint_intf0->bInterval); | ||
2350 | |||
2351 | rc = usb_submit_urb(ictx->rx_urb_intf0, GFP_ATOMIC); | ||
2352 | |||
2353 | } else { | ||
2354 | usb_fill_int_urb(ictx->rx_urb_intf1, ictx->usbdev_intf1, | ||
2355 | usb_rcvintpipe(ictx->usbdev_intf1, | ||
2356 | ictx->rx_endpoint_intf1->bEndpointAddress), | ||
2357 | ictx->usb_rx_buf, sizeof(ictx->usb_rx_buf), | ||
2358 | usb_rx_callback_intf1, ictx, | ||
2359 | ictx->rx_endpoint_intf1->bInterval); | ||
2360 | |||
2361 | rc = usb_submit_urb(ictx->rx_urb_intf1, GFP_ATOMIC); | ||
2362 | } | ||
2363 | |||
2364 | return rc; | ||
2365 | } | ||
2366 | |||
2367 | static int __init imon_init(void) | ||
2368 | { | ||
2369 | int rc; | ||
2370 | |||
2371 | rc = usb_register(&imon_driver); | ||
2372 | if (rc) { | ||
2373 | err("%s: usb register failed(%d)", __func__, rc); | ||
2374 | rc = -ENODEV; | ||
2375 | } | ||
2376 | |||
2377 | return rc; | ||
2378 | } | ||
2379 | |||
2380 | static void __exit imon_exit(void) | ||
2381 | { | ||
2382 | usb_deregister(&imon_driver); | ||
2383 | } | ||
2384 | |||
2385 | module_init(imon_init); | ||
2386 | module_exit(imon_exit); | ||
diff --git a/drivers/media/IR/ir-core-priv.h b/drivers/media/IR/ir-core-priv.h deleted file mode 100644 index a85a8c7c905a..000000000000 --- a/drivers/media/IR/ir-core-priv.h +++ /dev/null | |||
@@ -1,183 +0,0 @@ | |||
1 | /* | ||
2 | * Remote Controller core raw events header | ||
3 | * | ||
4 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
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 version 2 of the License. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | */ | ||
15 | |||
16 | #ifndef _IR_RAW_EVENT | ||
17 | #define _IR_RAW_EVENT | ||
18 | |||
19 | #include <linux/slab.h> | ||
20 | #include <media/ir-core.h> | ||
21 | |||
22 | struct ir_raw_handler { | ||
23 | struct list_head list; | ||
24 | |||
25 | u64 protocols; /* which are handled by this handler */ | ||
26 | int (*decode)(struct input_dev *input_dev, struct ir_raw_event event); | ||
27 | |||
28 | /* These two should only be used by the lirc decoder */ | ||
29 | int (*raw_register)(struct input_dev *input_dev); | ||
30 | int (*raw_unregister)(struct input_dev *input_dev); | ||
31 | }; | ||
32 | |||
33 | struct ir_raw_event_ctrl { | ||
34 | struct list_head list; /* to keep track of raw clients */ | ||
35 | struct task_struct *thread; | ||
36 | struct kfifo kfifo; /* fifo for the pulse/space durations */ | ||
37 | ktime_t last_event; /* when last event occurred */ | ||
38 | enum raw_event_type last_type; /* last event type */ | ||
39 | struct input_dev *input_dev; /* pointer to the parent input_dev */ | ||
40 | u64 enabled_protocols; /* enabled raw protocol decoders */ | ||
41 | |||
42 | /* raw decoder state follows */ | ||
43 | struct ir_raw_event prev_ev; | ||
44 | struct ir_raw_event this_ev; | ||
45 | struct nec_dec { | ||
46 | int state; | ||
47 | unsigned count; | ||
48 | u32 bits; | ||
49 | bool is_nec_x; | ||
50 | bool necx_repeat; | ||
51 | } nec; | ||
52 | struct rc5_dec { | ||
53 | int state; | ||
54 | u32 bits; | ||
55 | unsigned count; | ||
56 | unsigned wanted_bits; | ||
57 | } rc5; | ||
58 | struct rc6_dec { | ||
59 | int state; | ||
60 | u8 header; | ||
61 | u32 body; | ||
62 | bool toggle; | ||
63 | unsigned count; | ||
64 | unsigned wanted_bits; | ||
65 | } rc6; | ||
66 | struct sony_dec { | ||
67 | int state; | ||
68 | u32 bits; | ||
69 | unsigned count; | ||
70 | } sony; | ||
71 | struct jvc_dec { | ||
72 | int state; | ||
73 | u16 bits; | ||
74 | u16 old_bits; | ||
75 | unsigned count; | ||
76 | bool first; | ||
77 | bool toggle; | ||
78 | } jvc; | ||
79 | struct lirc_codec { | ||
80 | struct ir_input_dev *ir_dev; | ||
81 | struct lirc_driver *drv; | ||
82 | int carrier_low; | ||
83 | } lirc; | ||
84 | }; | ||
85 | |||
86 | /* macros for IR decoders */ | ||
87 | static inline bool geq_margin(unsigned d1, unsigned d2, unsigned margin) | ||
88 | { | ||
89 | return d1 > (d2 - margin); | ||
90 | } | ||
91 | |||
92 | static inline bool eq_margin(unsigned d1, unsigned d2, unsigned margin) | ||
93 | { | ||
94 | return ((d1 > (d2 - margin)) && (d1 < (d2 + margin))); | ||
95 | } | ||
96 | |||
97 | static inline bool is_transition(struct ir_raw_event *x, struct ir_raw_event *y) | ||
98 | { | ||
99 | return x->pulse != y->pulse; | ||
100 | } | ||
101 | |||
102 | static inline void decrease_duration(struct ir_raw_event *ev, unsigned duration) | ||
103 | { | ||
104 | if (duration > ev->duration) | ||
105 | ev->duration = 0; | ||
106 | else | ||
107 | ev->duration -= duration; | ||
108 | } | ||
109 | |||
110 | #define TO_US(duration) DIV_ROUND_CLOSEST((duration), 1000) | ||
111 | #define TO_STR(is_pulse) ((is_pulse) ? "pulse" : "space") | ||
112 | #define IS_RESET(ev) (ev.duration == 0) | ||
113 | /* | ||
114 | * Routines from ir-sysfs.c - Meant to be called only internally inside | ||
115 | * ir-core | ||
116 | */ | ||
117 | |||
118 | int ir_register_class(struct input_dev *input_dev); | ||
119 | void ir_unregister_class(struct input_dev *input_dev); | ||
120 | |||
121 | /* | ||
122 | * Routines from ir-raw-event.c to be used internally and by decoders | ||
123 | */ | ||
124 | u64 ir_raw_get_allowed_protocols(void); | ||
125 | int ir_raw_event_register(struct input_dev *input_dev); | ||
126 | void ir_raw_event_unregister(struct input_dev *input_dev); | ||
127 | int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler); | ||
128 | void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler); | ||
129 | void ir_raw_init(void); | ||
130 | |||
131 | int ir_rcmap_init(void); | ||
132 | void ir_rcmap_cleanup(void); | ||
133 | /* | ||
134 | * Decoder initialization code | ||
135 | * | ||
136 | * Those load logic are called during ir-core init, and automatically | ||
137 | * loads the compiled decoders for their usage with IR raw events | ||
138 | */ | ||
139 | |||
140 | /* from ir-nec-decoder.c */ | ||
141 | #ifdef CONFIG_IR_NEC_DECODER_MODULE | ||
142 | #define load_nec_decode() request_module("ir-nec-decoder") | ||
143 | #else | ||
144 | #define load_nec_decode() 0 | ||
145 | #endif | ||
146 | |||
147 | /* from ir-rc5-decoder.c */ | ||
148 | #ifdef CONFIG_IR_RC5_DECODER_MODULE | ||
149 | #define load_rc5_decode() request_module("ir-rc5-decoder") | ||
150 | #else | ||
151 | #define load_rc5_decode() 0 | ||
152 | #endif | ||
153 | |||
154 | /* from ir-rc6-decoder.c */ | ||
155 | #ifdef CONFIG_IR_RC6_DECODER_MODULE | ||
156 | #define load_rc6_decode() request_module("ir-rc6-decoder") | ||
157 | #else | ||
158 | #define load_rc6_decode() 0 | ||
159 | #endif | ||
160 | |||
161 | /* from ir-jvc-decoder.c */ | ||
162 | #ifdef CONFIG_IR_JVC_DECODER_MODULE | ||
163 | #define load_jvc_decode() request_module("ir-jvc-decoder") | ||
164 | #else | ||
165 | #define load_jvc_decode() 0 | ||
166 | #endif | ||
167 | |||
168 | /* from ir-sony-decoder.c */ | ||
169 | #ifdef CONFIG_IR_SONY_DECODER_MODULE | ||
170 | #define load_sony_decode() request_module("ir-sony-decoder") | ||
171 | #else | ||
172 | #define load_sony_decode() 0 | ||
173 | #endif | ||
174 | |||
175 | /* from ir-lirc-codec.c */ | ||
176 | #ifdef CONFIG_IR_LIRC_CODEC_MODULE | ||
177 | #define load_lirc_codec() request_module("ir-lirc-codec") | ||
178 | #else | ||
179 | #define load_lirc_codec() 0 | ||
180 | #endif | ||
181 | |||
182 | |||
183 | #endif /* _IR_RAW_EVENT */ | ||
diff --git a/drivers/media/IR/ir-functions.c b/drivers/media/IR/ir-functions.c deleted file mode 100644 index db591e421887..000000000000 --- a/drivers/media/IR/ir-functions.c +++ /dev/null | |||
@@ -1,356 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * some common structs and functions to handle infrared remotes via | ||
4 | * input layer ... | ||
5 | * | ||
6 | * (c) 2003 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/string.h> | ||
25 | #include <linux/jiffies.h> | ||
26 | #include <media/ir-common.h> | ||
27 | #include "ir-core-priv.h" | ||
28 | |||
29 | /* -------------------------------------------------------------------------- */ | ||
30 | |||
31 | MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); | ||
32 | MODULE_LICENSE("GPL"); | ||
33 | |||
34 | static int repeat = 1; | ||
35 | module_param(repeat, int, 0444); | ||
36 | MODULE_PARM_DESC(repeat,"auto-repeat for IR keys (default: on)"); | ||
37 | |||
38 | /* -------------------------------------------------------------------------- */ | ||
39 | |||
40 | static void ir_input_key_event(struct input_dev *dev, struct ir_input_state *ir) | ||
41 | { | ||
42 | if (KEY_RESERVED == ir->keycode) { | ||
43 | printk(KERN_INFO "%s: unknown key: key=0x%02x down=%d\n", | ||
44 | dev->name, ir->ir_key, ir->keypressed); | ||
45 | return; | ||
46 | } | ||
47 | IR_dprintk(1,"%s: key event code=%d down=%d\n", | ||
48 | dev->name,ir->keycode,ir->keypressed); | ||
49 | input_report_key(dev,ir->keycode,ir->keypressed); | ||
50 | input_sync(dev); | ||
51 | } | ||
52 | |||
53 | /* -------------------------------------------------------------------------- */ | ||
54 | |||
55 | int ir_input_init(struct input_dev *dev, struct ir_input_state *ir, | ||
56 | const u64 ir_type) | ||
57 | { | ||
58 | ir->ir_type = ir_type; | ||
59 | |||
60 | if (repeat) | ||
61 | set_bit(EV_REP, dev->evbit); | ||
62 | |||
63 | return 0; | ||
64 | } | ||
65 | EXPORT_SYMBOL_GPL(ir_input_init); | ||
66 | |||
67 | |||
68 | void ir_input_nokey(struct input_dev *dev, struct ir_input_state *ir) | ||
69 | { | ||
70 | if (ir->keypressed) { | ||
71 | ir->keypressed = 0; | ||
72 | ir_input_key_event(dev,ir); | ||
73 | } | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(ir_input_nokey); | ||
76 | |||
77 | void ir_input_keydown(struct input_dev *dev, struct ir_input_state *ir, | ||
78 | u32 ir_key) | ||
79 | { | ||
80 | u32 keycode = ir_g_keycode_from_table(dev, ir_key); | ||
81 | |||
82 | if (ir->keypressed && ir->keycode != keycode) { | ||
83 | ir->keypressed = 0; | ||
84 | ir_input_key_event(dev,ir); | ||
85 | } | ||
86 | if (!ir->keypressed) { | ||
87 | ir->ir_key = ir_key; | ||
88 | ir->keycode = keycode; | ||
89 | ir->keypressed = 1; | ||
90 | ir_input_key_event(dev,ir); | ||
91 | } | ||
92 | } | ||
93 | EXPORT_SYMBOL_GPL(ir_input_keydown); | ||
94 | |||
95 | /* -------------------------------------------------------------------------- */ | ||
96 | /* extract mask bits out of data and pack them into the result */ | ||
97 | u32 ir_extract_bits(u32 data, u32 mask) | ||
98 | { | ||
99 | u32 vbit = 1, value = 0; | ||
100 | |||
101 | do { | ||
102 | if (mask&1) { | ||
103 | if (data&1) | ||
104 | value |= vbit; | ||
105 | vbit<<=1; | ||
106 | } | ||
107 | data>>=1; | ||
108 | } while (mask>>=1); | ||
109 | |||
110 | return value; | ||
111 | } | ||
112 | EXPORT_SYMBOL_GPL(ir_extract_bits); | ||
113 | |||
114 | static int inline getbit(u32 *samples, int bit) | ||
115 | { | ||
116 | return (samples[bit/32] & (1 << (31-(bit%32)))) ? 1 : 0; | ||
117 | } | ||
118 | |||
119 | /* sump raw samples for visual debugging ;) */ | ||
120 | int ir_dump_samples(u32 *samples, int count) | ||
121 | { | ||
122 | int i, bit, start; | ||
123 | |||
124 | printk(KERN_DEBUG "ir samples: "); | ||
125 | start = 0; | ||
126 | for (i = 0; i < count * 32; i++) { | ||
127 | bit = getbit(samples,i); | ||
128 | if (bit) | ||
129 | start = 1; | ||
130 | if (0 == start) | ||
131 | continue; | ||
132 | printk("%s", bit ? "#" : "_"); | ||
133 | } | ||
134 | printk("\n"); | ||
135 | return 0; | ||
136 | } | ||
137 | EXPORT_SYMBOL_GPL(ir_dump_samples); | ||
138 | |||
139 | /* decode raw samples, pulse distance coding used by NEC remotes */ | ||
140 | int ir_decode_pulsedistance(u32 *samples, int count, int low, int high) | ||
141 | { | ||
142 | int i,last,bit,len; | ||
143 | u32 curBit; | ||
144 | u32 value; | ||
145 | |||
146 | /* find start burst */ | ||
147 | for (i = len = 0; i < count * 32; i++) { | ||
148 | bit = getbit(samples,i); | ||
149 | if (bit) { | ||
150 | len++; | ||
151 | } else { | ||
152 | if (len >= 29) | ||
153 | break; | ||
154 | len = 0; | ||
155 | } | ||
156 | } | ||
157 | |||
158 | /* start burst to short */ | ||
159 | if (len < 29) | ||
160 | return 0xffffffff; | ||
161 | |||
162 | /* find start silence */ | ||
163 | for (len = 0; i < count * 32; i++) { | ||
164 | bit = getbit(samples,i); | ||
165 | if (bit) { | ||
166 | break; | ||
167 | } else { | ||
168 | len++; | ||
169 | } | ||
170 | } | ||
171 | |||
172 | /* silence to short */ | ||
173 | if (len < 7) | ||
174 | return 0xffffffff; | ||
175 | |||
176 | /* go decoding */ | ||
177 | len = 0; | ||
178 | last = 1; | ||
179 | value = 0; curBit = 1; | ||
180 | for (; i < count * 32; i++) { | ||
181 | bit = getbit(samples,i); | ||
182 | if (last) { | ||
183 | if(bit) { | ||
184 | continue; | ||
185 | } else { | ||
186 | len = 1; | ||
187 | } | ||
188 | } else { | ||
189 | if (bit) { | ||
190 | if (len > (low + high) /2) | ||
191 | value |= curBit; | ||
192 | curBit <<= 1; | ||
193 | if (curBit == 1) | ||
194 | break; | ||
195 | } else { | ||
196 | len++; | ||
197 | } | ||
198 | } | ||
199 | last = bit; | ||
200 | } | ||
201 | |||
202 | return value; | ||
203 | } | ||
204 | EXPORT_SYMBOL_GPL(ir_decode_pulsedistance); | ||
205 | |||
206 | /* decode raw samples, biphase coding, used by rc5 for example */ | ||
207 | int ir_decode_biphase(u32 *samples, int count, int low, int high) | ||
208 | { | ||
209 | int i,last,bit,len,flips; | ||
210 | u32 value; | ||
211 | |||
212 | /* find start bit (1) */ | ||
213 | for (i = 0; i < 32; i++) { | ||
214 | bit = getbit(samples,i); | ||
215 | if (bit) | ||
216 | break; | ||
217 | } | ||
218 | |||
219 | /* go decoding */ | ||
220 | len = 0; | ||
221 | flips = 0; | ||
222 | value = 1; | ||
223 | for (; i < count * 32; i++) { | ||
224 | if (len > high) | ||
225 | break; | ||
226 | if (flips > 1) | ||
227 | break; | ||
228 | last = bit; | ||
229 | bit = getbit(samples,i); | ||
230 | if (last == bit) { | ||
231 | len++; | ||
232 | continue; | ||
233 | } | ||
234 | if (len < low) { | ||
235 | len++; | ||
236 | flips++; | ||
237 | continue; | ||
238 | } | ||
239 | value <<= 1; | ||
240 | value |= bit; | ||
241 | flips = 0; | ||
242 | len = 1; | ||
243 | } | ||
244 | return value; | ||
245 | } | ||
246 | EXPORT_SYMBOL_GPL(ir_decode_biphase); | ||
247 | |||
248 | /* RC5 decoding stuff, moved from bttv-input.c to share it with | ||
249 | * saa7134 */ | ||
250 | |||
251 | /* decode raw bit pattern to RC5 code */ | ||
252 | u32 ir_rc5_decode(unsigned int code) | ||
253 | { | ||
254 | unsigned int org_code = code; | ||
255 | unsigned int pair; | ||
256 | unsigned int rc5 = 0; | ||
257 | int i; | ||
258 | |||
259 | for (i = 0; i < 14; ++i) { | ||
260 | pair = code & 0x3; | ||
261 | code >>= 2; | ||
262 | |||
263 | rc5 <<= 1; | ||
264 | switch (pair) { | ||
265 | case 0: | ||
266 | case 2: | ||
267 | break; | ||
268 | case 1: | ||
269 | rc5 |= 1; | ||
270 | break; | ||
271 | case 3: | ||
272 | IR_dprintk(1, "ir-common: ir_rc5_decode(%x) bad code\n", org_code); | ||
273 | return 0; | ||
274 | } | ||
275 | } | ||
276 | IR_dprintk(1, "ir-common: code=%x, rc5=%x, start=%x, toggle=%x, address=%x, " | ||
277 | "instr=%x\n", rc5, org_code, RC5_START(rc5), | ||
278 | RC5_TOGGLE(rc5), RC5_ADDR(rc5), RC5_INSTR(rc5)); | ||
279 | return rc5; | ||
280 | } | ||
281 | EXPORT_SYMBOL_GPL(ir_rc5_decode); | ||
282 | |||
283 | void ir_rc5_timer_end(unsigned long data) | ||
284 | { | ||
285 | struct card_ir *ir = (struct card_ir *)data; | ||
286 | struct timeval tv; | ||
287 | unsigned long current_jiffies, timeout; | ||
288 | u32 gap; | ||
289 | u32 rc5 = 0; | ||
290 | |||
291 | /* get time */ | ||
292 | current_jiffies = jiffies; | ||
293 | do_gettimeofday(&tv); | ||
294 | |||
295 | /* avoid overflow with gap >1s */ | ||
296 | if (tv.tv_sec - ir->base_time.tv_sec > 1) { | ||
297 | gap = 200000; | ||
298 | } else { | ||
299 | gap = 1000000 * (tv.tv_sec - ir->base_time.tv_sec) + | ||
300 | tv.tv_usec - ir->base_time.tv_usec; | ||
301 | } | ||
302 | |||
303 | /* signal we're ready to start a new code */ | ||
304 | ir->active = 0; | ||
305 | |||
306 | /* Allow some timer jitter (RC5 is ~24ms anyway so this is ok) */ | ||
307 | if (gap < 28000) { | ||
308 | IR_dprintk(1, "ir-common: spurious timer_end\n"); | ||
309 | return; | ||
310 | } | ||
311 | |||
312 | if (ir->last_bit < 20) { | ||
313 | /* ignore spurious codes (caused by light/other remotes) */ | ||
314 | IR_dprintk(1, "ir-common: short code: %x\n", ir->code); | ||
315 | } else { | ||
316 | ir->code = (ir->code << ir->shift_by) | 1; | ||
317 | rc5 = ir_rc5_decode(ir->code); | ||
318 | |||
319 | /* two start bits? */ | ||
320 | if (RC5_START(rc5) != ir->start) { | ||
321 | IR_dprintk(1, "ir-common: rc5 start bits invalid: %u\n", RC5_START(rc5)); | ||
322 | |||
323 | /* right address? */ | ||
324 | } else if (RC5_ADDR(rc5) == ir->addr) { | ||
325 | u32 toggle = RC5_TOGGLE(rc5); | ||
326 | u32 instr = RC5_INSTR(rc5); | ||
327 | |||
328 | /* Good code, decide if repeat/repress */ | ||
329 | if (toggle != RC5_TOGGLE(ir->last_rc5) || | ||
330 | instr != RC5_INSTR(ir->last_rc5)) { | ||
331 | IR_dprintk(1, "ir-common: instruction %x, toggle %x\n", instr, | ||
332 | toggle); | ||
333 | ir_input_nokey(ir->dev, &ir->ir); | ||
334 | ir_input_keydown(ir->dev, &ir->ir, instr); | ||
335 | } | ||
336 | |||
337 | /* Set/reset key-up timer */ | ||
338 | timeout = current_jiffies + | ||
339 | msecs_to_jiffies(ir->rc5_key_timeout); | ||
340 | mod_timer(&ir->timer_keyup, timeout); | ||
341 | |||
342 | /* Save code for repeat test */ | ||
343 | ir->last_rc5 = rc5; | ||
344 | } | ||
345 | } | ||
346 | } | ||
347 | EXPORT_SYMBOL_GPL(ir_rc5_timer_end); | ||
348 | |||
349 | void ir_rc5_timer_keyup(unsigned long data) | ||
350 | { | ||
351 | struct card_ir *ir = (struct card_ir *)data; | ||
352 | |||
353 | IR_dprintk(1, "ir-common: key released\n"); | ||
354 | ir_input_nokey(ir->dev, &ir->ir); | ||
355 | } | ||
356 | EXPORT_SYMBOL_GPL(ir_rc5_timer_keyup); | ||
diff --git a/drivers/media/IR/ir-jvc-decoder.c b/drivers/media/IR/ir-jvc-decoder.c deleted file mode 100644 index 77a89c4de014..000000000000 --- a/drivers/media/IR/ir-jvc-decoder.c +++ /dev/null | |||
@@ -1,198 +0,0 @@ | |||
1 | /* ir-jvc-decoder.c - handle JVC IR Pulse/Space protocol | ||
2 | * | ||
3 | * Copyright (C) 2010 by David Härdeman <david@hardeman.nu> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/bitrev.h> | ||
16 | #include "ir-core-priv.h" | ||
17 | |||
18 | #define JVC_NBITS 16 /* dev(8) + func(8) */ | ||
19 | #define JVC_UNIT 525000 /* ns */ | ||
20 | #define JVC_HEADER_PULSE (16 * JVC_UNIT) /* lack of header -> repeat */ | ||
21 | #define JVC_HEADER_SPACE (8 * JVC_UNIT) | ||
22 | #define JVC_BIT_PULSE (1 * JVC_UNIT) | ||
23 | #define JVC_BIT_0_SPACE (1 * JVC_UNIT) | ||
24 | #define JVC_BIT_1_SPACE (3 * JVC_UNIT) | ||
25 | #define JVC_TRAILER_PULSE (1 * JVC_UNIT) | ||
26 | #define JVC_TRAILER_SPACE (35 * JVC_UNIT) | ||
27 | |||
28 | enum jvc_state { | ||
29 | STATE_INACTIVE, | ||
30 | STATE_HEADER_SPACE, | ||
31 | STATE_BIT_PULSE, | ||
32 | STATE_BIT_SPACE, | ||
33 | STATE_TRAILER_PULSE, | ||
34 | STATE_TRAILER_SPACE, | ||
35 | STATE_CHECK_REPEAT, | ||
36 | }; | ||
37 | |||
38 | /** | ||
39 | * ir_jvc_decode() - Decode one JVC pulse or space | ||
40 | * @input_dev: the struct input_dev descriptor of the device | ||
41 | * @duration: the struct ir_raw_event descriptor of the pulse/space | ||
42 | * | ||
43 | * This function returns -EINVAL if the pulse violates the state machine | ||
44 | */ | ||
45 | static int ir_jvc_decode(struct input_dev *input_dev, struct ir_raw_event ev) | ||
46 | { | ||
47 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
48 | struct jvc_dec *data = &ir_dev->raw->jvc; | ||
49 | |||
50 | if (!(ir_dev->raw->enabled_protocols & IR_TYPE_JVC)) | ||
51 | return 0; | ||
52 | |||
53 | if (IS_RESET(ev)) { | ||
54 | data->state = STATE_INACTIVE; | ||
55 | return 0; | ||
56 | } | ||
57 | |||
58 | if (!geq_margin(ev.duration, JVC_UNIT, JVC_UNIT / 2)) | ||
59 | goto out; | ||
60 | |||
61 | IR_dprintk(2, "JVC decode started at state %d (%uus %s)\n", | ||
62 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
63 | |||
64 | again: | ||
65 | switch (data->state) { | ||
66 | |||
67 | case STATE_INACTIVE: | ||
68 | if (!ev.pulse) | ||
69 | break; | ||
70 | |||
71 | if (!eq_margin(ev.duration, JVC_HEADER_PULSE, JVC_UNIT / 2)) | ||
72 | break; | ||
73 | |||
74 | data->count = 0; | ||
75 | data->first = true; | ||
76 | data->toggle = !data->toggle; | ||
77 | data->state = STATE_HEADER_SPACE; | ||
78 | return 0; | ||
79 | |||
80 | case STATE_HEADER_SPACE: | ||
81 | if (ev.pulse) | ||
82 | break; | ||
83 | |||
84 | if (!eq_margin(ev.duration, JVC_HEADER_SPACE, JVC_UNIT / 2)) | ||
85 | break; | ||
86 | |||
87 | data->state = STATE_BIT_PULSE; | ||
88 | return 0; | ||
89 | |||
90 | case STATE_BIT_PULSE: | ||
91 | if (!ev.pulse) | ||
92 | break; | ||
93 | |||
94 | if (!eq_margin(ev.duration, JVC_BIT_PULSE, JVC_UNIT / 2)) | ||
95 | break; | ||
96 | |||
97 | data->state = STATE_BIT_SPACE; | ||
98 | return 0; | ||
99 | |||
100 | case STATE_BIT_SPACE: | ||
101 | if (ev.pulse) | ||
102 | break; | ||
103 | |||
104 | data->bits <<= 1; | ||
105 | if (eq_margin(ev.duration, JVC_BIT_1_SPACE, JVC_UNIT / 2)) { | ||
106 | data->bits |= 1; | ||
107 | decrease_duration(&ev, JVC_BIT_1_SPACE); | ||
108 | } else if (eq_margin(ev.duration, JVC_BIT_0_SPACE, JVC_UNIT / 2)) | ||
109 | decrease_duration(&ev, JVC_BIT_0_SPACE); | ||
110 | else | ||
111 | break; | ||
112 | data->count++; | ||
113 | |||
114 | if (data->count == JVC_NBITS) | ||
115 | data->state = STATE_TRAILER_PULSE; | ||
116 | else | ||
117 | data->state = STATE_BIT_PULSE; | ||
118 | return 0; | ||
119 | |||
120 | case STATE_TRAILER_PULSE: | ||
121 | if (!ev.pulse) | ||
122 | break; | ||
123 | |||
124 | if (!eq_margin(ev.duration, JVC_TRAILER_PULSE, JVC_UNIT / 2)) | ||
125 | break; | ||
126 | |||
127 | data->state = STATE_TRAILER_SPACE; | ||
128 | return 0; | ||
129 | |||
130 | case STATE_TRAILER_SPACE: | ||
131 | if (ev.pulse) | ||
132 | break; | ||
133 | |||
134 | if (!geq_margin(ev.duration, JVC_TRAILER_SPACE, JVC_UNIT / 2)) | ||
135 | break; | ||
136 | |||
137 | if (data->first) { | ||
138 | u32 scancode; | ||
139 | scancode = (bitrev8((data->bits >> 8) & 0xff) << 8) | | ||
140 | (bitrev8((data->bits >> 0) & 0xff) << 0); | ||
141 | IR_dprintk(1, "JVC scancode 0x%04x\n", scancode); | ||
142 | ir_keydown(input_dev, scancode, data->toggle); | ||
143 | data->first = false; | ||
144 | data->old_bits = data->bits; | ||
145 | } else if (data->bits == data->old_bits) { | ||
146 | IR_dprintk(1, "JVC repeat\n"); | ||
147 | ir_repeat(input_dev); | ||
148 | } else { | ||
149 | IR_dprintk(1, "JVC invalid repeat msg\n"); | ||
150 | break; | ||
151 | } | ||
152 | |||
153 | data->count = 0; | ||
154 | data->state = STATE_CHECK_REPEAT; | ||
155 | return 0; | ||
156 | |||
157 | case STATE_CHECK_REPEAT: | ||
158 | if (!ev.pulse) | ||
159 | break; | ||
160 | |||
161 | if (eq_margin(ev.duration, JVC_HEADER_PULSE, JVC_UNIT / 2)) | ||
162 | data->state = STATE_INACTIVE; | ||
163 | else | ||
164 | data->state = STATE_BIT_PULSE; | ||
165 | goto again; | ||
166 | } | ||
167 | |||
168 | out: | ||
169 | IR_dprintk(1, "JVC decode failed at state %d (%uus %s)\n", | ||
170 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
171 | data->state = STATE_INACTIVE; | ||
172 | return -EINVAL; | ||
173 | } | ||
174 | |||
175 | static struct ir_raw_handler jvc_handler = { | ||
176 | .protocols = IR_TYPE_JVC, | ||
177 | .decode = ir_jvc_decode, | ||
178 | }; | ||
179 | |||
180 | static int __init ir_jvc_decode_init(void) | ||
181 | { | ||
182 | ir_raw_handler_register(&jvc_handler); | ||
183 | |||
184 | printk(KERN_INFO "IR JVC protocol handler initialized\n"); | ||
185 | return 0; | ||
186 | } | ||
187 | |||
188 | static void __exit ir_jvc_decode_exit(void) | ||
189 | { | ||
190 | ir_raw_handler_unregister(&jvc_handler); | ||
191 | } | ||
192 | |||
193 | module_init(ir_jvc_decode_init); | ||
194 | module_exit(ir_jvc_decode_exit); | ||
195 | |||
196 | MODULE_LICENSE("GPL"); | ||
197 | MODULE_AUTHOR("David Härdeman <david@hardeman.nu>"); | ||
198 | MODULE_DESCRIPTION("JVC IR protocol decoder"); | ||
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c deleted file mode 100644 index 7961d59f5cac..000000000000 --- a/drivers/media/IR/ir-keytable.c +++ /dev/null | |||
@@ -1,572 +0,0 @@ | |||
1 | /* ir-keytable.c - handle IR scancode->keycode tables | ||
2 | * | ||
3 | * Copyright (C) 2009 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | |||
16 | #include <linux/input.h> | ||
17 | #include <linux/slab.h> | ||
18 | #include "ir-core-priv.h" | ||
19 | |||
20 | /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */ | ||
21 | #define IR_TAB_MIN_SIZE 256 | ||
22 | #define IR_TAB_MAX_SIZE 8192 | ||
23 | |||
24 | /* FIXME: IR_KEYPRESS_TIMEOUT should be protocol specific */ | ||
25 | #define IR_KEYPRESS_TIMEOUT 250 | ||
26 | |||
27 | /** | ||
28 | * ir_resize_table() - resizes a scancode table if necessary | ||
29 | * @rc_tab: the ir_scancode_table to resize | ||
30 | * @return: zero on success or a negative error code | ||
31 | * | ||
32 | * This routine will shrink the ir_scancode_table if it has lots of | ||
33 | * unused entries and grow it if it is full. | ||
34 | */ | ||
35 | static int ir_resize_table(struct ir_scancode_table *rc_tab) | ||
36 | { | ||
37 | unsigned int oldalloc = rc_tab->alloc; | ||
38 | unsigned int newalloc = oldalloc; | ||
39 | struct ir_scancode *oldscan = rc_tab->scan; | ||
40 | struct ir_scancode *newscan; | ||
41 | |||
42 | if (rc_tab->size == rc_tab->len) { | ||
43 | /* All entries in use -> grow keytable */ | ||
44 | if (rc_tab->alloc >= IR_TAB_MAX_SIZE) | ||
45 | return -ENOMEM; | ||
46 | |||
47 | newalloc *= 2; | ||
48 | IR_dprintk(1, "Growing table to %u bytes\n", newalloc); | ||
49 | } | ||
50 | |||
51 | if ((rc_tab->len * 3 < rc_tab->size) && (oldalloc > IR_TAB_MIN_SIZE)) { | ||
52 | /* Less than 1/3 of entries in use -> shrink keytable */ | ||
53 | newalloc /= 2; | ||
54 | IR_dprintk(1, "Shrinking table to %u bytes\n", newalloc); | ||
55 | } | ||
56 | |||
57 | if (newalloc == oldalloc) | ||
58 | return 0; | ||
59 | |||
60 | newscan = kmalloc(newalloc, GFP_ATOMIC); | ||
61 | if (!newscan) { | ||
62 | IR_dprintk(1, "Failed to kmalloc %u bytes\n", newalloc); | ||
63 | return -ENOMEM; | ||
64 | } | ||
65 | |||
66 | memcpy(newscan, rc_tab->scan, rc_tab->len * sizeof(struct ir_scancode)); | ||
67 | rc_tab->scan = newscan; | ||
68 | rc_tab->alloc = newalloc; | ||
69 | rc_tab->size = rc_tab->alloc / sizeof(struct ir_scancode); | ||
70 | kfree(oldscan); | ||
71 | return 0; | ||
72 | } | ||
73 | |||
74 | /** | ||
75 | * ir_do_setkeycode() - internal function to set a keycode in the | ||
76 | * scancode->keycode table | ||
77 | * @dev: the struct input_dev device descriptor | ||
78 | * @rc_tab: the struct ir_scancode_table to set the keycode in | ||
79 | * @scancode: the scancode for the ir command | ||
80 | * @keycode: the keycode for the ir command | ||
81 | * @resize: whether the keytable may be shrunk | ||
82 | * @return: -EINVAL if the keycode could not be inserted, otherwise zero. | ||
83 | * | ||
84 | * This routine is used internally to manipulate the scancode->keycode table. | ||
85 | * The caller has to hold @rc_tab->lock. | ||
86 | */ | ||
87 | static int ir_do_setkeycode(struct input_dev *dev, | ||
88 | struct ir_scancode_table *rc_tab, | ||
89 | unsigned scancode, unsigned keycode, | ||
90 | bool resize) | ||
91 | { | ||
92 | unsigned int i; | ||
93 | int old_keycode = KEY_RESERVED; | ||
94 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | ||
95 | |||
96 | /* | ||
97 | * Unfortunately, some hardware-based IR decoders don't provide | ||
98 | * all bits for the complete IR code. In general, they provide only | ||
99 | * the command part of the IR code. Yet, as it is possible to replace | ||
100 | * the provided IR with another one, it is needed to allow loading | ||
101 | * IR tables from other remotes. So, | ||
102 | */ | ||
103 | if (ir_dev->props && ir_dev->props->scanmask) { | ||
104 | scancode &= ir_dev->props->scanmask; | ||
105 | } | ||
106 | |||
107 | /* First check if we already have a mapping for this ir command */ | ||
108 | for (i = 0; i < rc_tab->len; i++) { | ||
109 | /* Keytable is sorted from lowest to highest scancode */ | ||
110 | if (rc_tab->scan[i].scancode > scancode) | ||
111 | break; | ||
112 | else if (rc_tab->scan[i].scancode < scancode) | ||
113 | continue; | ||
114 | |||
115 | old_keycode = rc_tab->scan[i].keycode; | ||
116 | rc_tab->scan[i].keycode = keycode; | ||
117 | |||
118 | /* Did the user wish to remove the mapping? */ | ||
119 | if (keycode == KEY_RESERVED || keycode == KEY_UNKNOWN) { | ||
120 | IR_dprintk(1, "#%d: Deleting scan 0x%04x\n", | ||
121 | i, scancode); | ||
122 | rc_tab->len--; | ||
123 | memmove(&rc_tab->scan[i], &rc_tab->scan[i + 1], | ||
124 | (rc_tab->len - i) * sizeof(struct ir_scancode)); | ||
125 | } | ||
126 | |||
127 | /* Possibly shrink the keytable, failure is not a problem */ | ||
128 | ir_resize_table(rc_tab); | ||
129 | break; | ||
130 | } | ||
131 | |||
132 | if (old_keycode == KEY_RESERVED && keycode != KEY_RESERVED) { | ||
133 | /* No previous mapping found, we might need to grow the table */ | ||
134 | if (resize && ir_resize_table(rc_tab)) | ||
135 | return -ENOMEM; | ||
136 | |||
137 | IR_dprintk(1, "#%d: New scan 0x%04x with key 0x%04x\n", | ||
138 | i, scancode, keycode); | ||
139 | |||
140 | /* i is the proper index to insert our new keycode */ | ||
141 | memmove(&rc_tab->scan[i + 1], &rc_tab->scan[i], | ||
142 | (rc_tab->len - i) * sizeof(struct ir_scancode)); | ||
143 | rc_tab->scan[i].scancode = scancode; | ||
144 | rc_tab->scan[i].keycode = keycode; | ||
145 | rc_tab->len++; | ||
146 | set_bit(keycode, dev->keybit); | ||
147 | } else { | ||
148 | IR_dprintk(1, "#%d: Replacing scan 0x%04x with key 0x%04x\n", | ||
149 | i, scancode, keycode); | ||
150 | /* A previous mapping was updated... */ | ||
151 | clear_bit(old_keycode, dev->keybit); | ||
152 | /* ...but another scancode might use the same keycode */ | ||
153 | for (i = 0; i < rc_tab->len; i++) { | ||
154 | if (rc_tab->scan[i].keycode == old_keycode) { | ||
155 | set_bit(old_keycode, dev->keybit); | ||
156 | break; | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | |||
161 | return 0; | ||
162 | } | ||
163 | |||
164 | /** | ||
165 | * ir_setkeycode() - set a keycode in the scancode->keycode table | ||
166 | * @dev: the struct input_dev device descriptor | ||
167 | * @scancode: the desired scancode | ||
168 | * @keycode: result | ||
169 | * @return: -EINVAL if the keycode could not be inserted, otherwise zero. | ||
170 | * | ||
171 | * This routine is used to handle evdev EVIOCSKEY ioctl. | ||
172 | */ | ||
173 | static int ir_setkeycode(struct input_dev *dev, | ||
174 | unsigned int scancode, unsigned int keycode) | ||
175 | { | ||
176 | int rc; | ||
177 | unsigned long flags; | ||
178 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | ||
179 | struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; | ||
180 | |||
181 | spin_lock_irqsave(&rc_tab->lock, flags); | ||
182 | rc = ir_do_setkeycode(dev, rc_tab, scancode, keycode, true); | ||
183 | spin_unlock_irqrestore(&rc_tab->lock, flags); | ||
184 | return rc; | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * ir_setkeytable() - sets several entries in the scancode->keycode table | ||
189 | * @dev: the struct input_dev device descriptor | ||
190 | * @to: the struct ir_scancode_table to copy entries to | ||
191 | * @from: the struct ir_scancode_table to copy entries from | ||
192 | * @return: -EINVAL if all keycodes could not be inserted, otherwise zero. | ||
193 | * | ||
194 | * This routine is used to handle table initialization. | ||
195 | */ | ||
196 | static int ir_setkeytable(struct input_dev *dev, | ||
197 | struct ir_scancode_table *to, | ||
198 | const struct ir_scancode_table *from) | ||
199 | { | ||
200 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | ||
201 | struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; | ||
202 | unsigned long flags; | ||
203 | unsigned int i; | ||
204 | int rc = 0; | ||
205 | |||
206 | spin_lock_irqsave(&rc_tab->lock, flags); | ||
207 | for (i = 0; i < from->size; i++) { | ||
208 | rc = ir_do_setkeycode(dev, to, from->scan[i].scancode, | ||
209 | from->scan[i].keycode, false); | ||
210 | if (rc) | ||
211 | break; | ||
212 | } | ||
213 | spin_unlock_irqrestore(&rc_tab->lock, flags); | ||
214 | return rc; | ||
215 | } | ||
216 | |||
217 | /** | ||
218 | * ir_getkeycode() - get a keycode from the scancode->keycode table | ||
219 | * @dev: the struct input_dev device descriptor | ||
220 | * @scancode: the desired scancode | ||
221 | * @keycode: used to return the keycode, if found, or KEY_RESERVED | ||
222 | * @return: always returns zero. | ||
223 | * | ||
224 | * This routine is used to handle evdev EVIOCGKEY ioctl. | ||
225 | */ | ||
226 | static int ir_getkeycode(struct input_dev *dev, | ||
227 | unsigned int scancode, unsigned int *keycode) | ||
228 | { | ||
229 | int start, end, mid; | ||
230 | unsigned long flags; | ||
231 | int key = KEY_RESERVED; | ||
232 | struct ir_input_dev *ir_dev = input_get_drvdata(dev); | ||
233 | struct ir_scancode_table *rc_tab = &ir_dev->rc_tab; | ||
234 | |||
235 | spin_lock_irqsave(&rc_tab->lock, flags); | ||
236 | start = 0; | ||
237 | end = rc_tab->len - 1; | ||
238 | while (start <= end) { | ||
239 | mid = (start + end) / 2; | ||
240 | if (rc_tab->scan[mid].scancode < scancode) | ||
241 | start = mid + 1; | ||
242 | else if (rc_tab->scan[mid].scancode > scancode) | ||
243 | end = mid - 1; | ||
244 | else { | ||
245 | key = rc_tab->scan[mid].keycode; | ||
246 | break; | ||
247 | } | ||
248 | } | ||
249 | spin_unlock_irqrestore(&rc_tab->lock, flags); | ||
250 | |||
251 | if (key == KEY_RESERVED) | ||
252 | IR_dprintk(1, "unknown key for scancode 0x%04x\n", | ||
253 | scancode); | ||
254 | |||
255 | *keycode = key; | ||
256 | return 0; | ||
257 | } | ||
258 | |||
259 | /** | ||
260 | * ir_g_keycode_from_table() - gets the keycode that corresponds to a scancode | ||
261 | * @input_dev: the struct input_dev descriptor of the device | ||
262 | * @scancode: the scancode that we're seeking | ||
263 | * | ||
264 | * This routine is used by the input routines when a key is pressed at the | ||
265 | * IR. The scancode is received and needs to be converted into a keycode. | ||
266 | * If the key is not found, it returns KEY_RESERVED. Otherwise, returns the | ||
267 | * corresponding keycode from the table. | ||
268 | */ | ||
269 | u32 ir_g_keycode_from_table(struct input_dev *dev, u32 scancode) | ||
270 | { | ||
271 | int keycode; | ||
272 | |||
273 | ir_getkeycode(dev, scancode, &keycode); | ||
274 | if (keycode != KEY_RESERVED) | ||
275 | IR_dprintk(1, "%s: scancode 0x%04x keycode 0x%02x\n", | ||
276 | dev->name, scancode, keycode); | ||
277 | return keycode; | ||
278 | } | ||
279 | EXPORT_SYMBOL_GPL(ir_g_keycode_from_table); | ||
280 | |||
281 | /** | ||
282 | * ir_keyup() - generates input event to cleanup a key press | ||
283 | * @ir: the struct ir_input_dev descriptor of the device | ||
284 | * | ||
285 | * This routine is used to signal that a key has been released on the | ||
286 | * remote control. It reports a keyup input event via input_report_key(). | ||
287 | */ | ||
288 | static void ir_keyup(struct ir_input_dev *ir) | ||
289 | { | ||
290 | if (!ir->keypressed) | ||
291 | return; | ||
292 | |||
293 | IR_dprintk(1, "keyup key 0x%04x\n", ir->last_keycode); | ||
294 | input_report_key(ir->input_dev, ir->last_keycode, 0); | ||
295 | input_sync(ir->input_dev); | ||
296 | ir->keypressed = false; | ||
297 | } | ||
298 | |||
299 | /** | ||
300 | * ir_timer_keyup() - generates a keyup event after a timeout | ||
301 | * @cookie: a pointer to struct ir_input_dev passed to setup_timer() | ||
302 | * | ||
303 | * This routine will generate a keyup event some time after a keydown event | ||
304 | * is generated when no further activity has been detected. | ||
305 | */ | ||
306 | static void ir_timer_keyup(unsigned long cookie) | ||
307 | { | ||
308 | struct ir_input_dev *ir = (struct ir_input_dev *)cookie; | ||
309 | unsigned long flags; | ||
310 | |||
311 | /* | ||
312 | * ir->keyup_jiffies is used to prevent a race condition if a | ||
313 | * hardware interrupt occurs at this point and the keyup timer | ||
314 | * event is moved further into the future as a result. | ||
315 | * | ||
316 | * The timer will then be reactivated and this function called | ||
317 | * again in the future. We need to exit gracefully in that case | ||
318 | * to allow the input subsystem to do its auto-repeat magic or | ||
319 | * a keyup event might follow immediately after the keydown. | ||
320 | */ | ||
321 | spin_lock_irqsave(&ir->keylock, flags); | ||
322 | if (time_is_before_eq_jiffies(ir->keyup_jiffies)) | ||
323 | ir_keyup(ir); | ||
324 | spin_unlock_irqrestore(&ir->keylock, flags); | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * ir_repeat() - notifies the IR core that a key is still pressed | ||
329 | * @dev: the struct input_dev descriptor of the device | ||
330 | * | ||
331 | * This routine is used by IR decoders when a repeat message which does | ||
332 | * not include the necessary bits to reproduce the scancode has been | ||
333 | * received. | ||
334 | */ | ||
335 | void ir_repeat(struct input_dev *dev) | ||
336 | { | ||
337 | unsigned long flags; | ||
338 | struct ir_input_dev *ir = input_get_drvdata(dev); | ||
339 | |||
340 | spin_lock_irqsave(&ir->keylock, flags); | ||
341 | |||
342 | input_event(dev, EV_MSC, MSC_SCAN, ir->last_scancode); | ||
343 | |||
344 | if (!ir->keypressed) | ||
345 | goto out; | ||
346 | |||
347 | ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); | ||
348 | mod_timer(&ir->timer_keyup, ir->keyup_jiffies); | ||
349 | |||
350 | out: | ||
351 | spin_unlock_irqrestore(&ir->keylock, flags); | ||
352 | } | ||
353 | EXPORT_SYMBOL_GPL(ir_repeat); | ||
354 | |||
355 | /** | ||
356 | * ir_keydown() - generates input event for a key press | ||
357 | * @dev: the struct input_dev descriptor of the device | ||
358 | * @scancode: the scancode that we're seeking | ||
359 | * @toggle: the toggle value (protocol dependent, if the protocol doesn't | ||
360 | * support toggle values, this should be set to zero) | ||
361 | * | ||
362 | * This routine is used by the input routines when a key is pressed at the | ||
363 | * IR. It gets the keycode for a scancode and reports an input event via | ||
364 | * input_report_key(). | ||
365 | */ | ||
366 | void ir_keydown(struct input_dev *dev, int scancode, u8 toggle) | ||
367 | { | ||
368 | unsigned long flags; | ||
369 | struct ir_input_dev *ir = input_get_drvdata(dev); | ||
370 | |||
371 | u32 keycode = ir_g_keycode_from_table(dev, scancode); | ||
372 | |||
373 | spin_lock_irqsave(&ir->keylock, flags); | ||
374 | |||
375 | input_event(dev, EV_MSC, MSC_SCAN, scancode); | ||
376 | |||
377 | /* Repeat event? */ | ||
378 | if (ir->keypressed && | ||
379 | ir->last_scancode == scancode && | ||
380 | ir->last_toggle == toggle) | ||
381 | goto set_timer; | ||
382 | |||
383 | /* Release old keypress */ | ||
384 | ir_keyup(ir); | ||
385 | |||
386 | ir->last_scancode = scancode; | ||
387 | ir->last_toggle = toggle; | ||
388 | ir->last_keycode = keycode; | ||
389 | |||
390 | |||
391 | if (keycode == KEY_RESERVED) | ||
392 | goto out; | ||
393 | |||
394 | |||
395 | /* Register a keypress */ | ||
396 | ir->keypressed = true; | ||
397 | IR_dprintk(1, "%s: key down event, key 0x%04x, scancode 0x%04x\n", | ||
398 | dev->name, keycode, scancode); | ||
399 | input_report_key(dev, ir->last_keycode, 1); | ||
400 | input_sync(dev); | ||
401 | |||
402 | set_timer: | ||
403 | ir->keyup_jiffies = jiffies + msecs_to_jiffies(IR_KEYPRESS_TIMEOUT); | ||
404 | mod_timer(&ir->timer_keyup, ir->keyup_jiffies); | ||
405 | out: | ||
406 | spin_unlock_irqrestore(&ir->keylock, flags); | ||
407 | } | ||
408 | EXPORT_SYMBOL_GPL(ir_keydown); | ||
409 | |||
410 | static int ir_open(struct input_dev *input_dev) | ||
411 | { | ||
412 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
413 | |||
414 | return ir_dev->props->open(ir_dev->props->priv); | ||
415 | } | ||
416 | |||
417 | static void ir_close(struct input_dev *input_dev) | ||
418 | { | ||
419 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
420 | |||
421 | ir_dev->props->close(ir_dev->props->priv); | ||
422 | } | ||
423 | |||
424 | /** | ||
425 | * __ir_input_register() - sets the IR keycode table and add the handlers | ||
426 | * for keymap table get/set | ||
427 | * @input_dev: the struct input_dev descriptor of the device | ||
428 | * @rc_tab: the struct ir_scancode_table table of scancode/keymap | ||
429 | * | ||
430 | * This routine is used to initialize the input infrastructure | ||
431 | * to work with an IR. | ||
432 | * It will register the input/evdev interface for the device and | ||
433 | * register the syfs code for IR class | ||
434 | */ | ||
435 | int __ir_input_register(struct input_dev *input_dev, | ||
436 | const struct ir_scancode_table *rc_tab, | ||
437 | struct ir_dev_props *props, | ||
438 | const char *driver_name) | ||
439 | { | ||
440 | struct ir_input_dev *ir_dev; | ||
441 | int rc; | ||
442 | |||
443 | if (rc_tab->scan == NULL || !rc_tab->size) | ||
444 | return -EINVAL; | ||
445 | |||
446 | ir_dev = kzalloc(sizeof(*ir_dev), GFP_KERNEL); | ||
447 | if (!ir_dev) | ||
448 | return -ENOMEM; | ||
449 | |||
450 | ir_dev->driver_name = kasprintf(GFP_KERNEL, "%s", driver_name); | ||
451 | if (!ir_dev->driver_name) { | ||
452 | rc = -ENOMEM; | ||
453 | goto out_dev; | ||
454 | } | ||
455 | |||
456 | input_dev->getkeycode = ir_getkeycode; | ||
457 | input_dev->setkeycode = ir_setkeycode; | ||
458 | input_set_drvdata(input_dev, ir_dev); | ||
459 | ir_dev->input_dev = input_dev; | ||
460 | |||
461 | spin_lock_init(&ir_dev->rc_tab.lock); | ||
462 | spin_lock_init(&ir_dev->keylock); | ||
463 | setup_timer(&ir_dev->timer_keyup, ir_timer_keyup, (unsigned long)ir_dev); | ||
464 | |||
465 | ir_dev->rc_tab.name = rc_tab->name; | ||
466 | ir_dev->rc_tab.ir_type = rc_tab->ir_type; | ||
467 | ir_dev->rc_tab.alloc = roundup_pow_of_two(rc_tab->size * | ||
468 | sizeof(struct ir_scancode)); | ||
469 | ir_dev->rc_tab.scan = kmalloc(ir_dev->rc_tab.alloc, GFP_KERNEL); | ||
470 | ir_dev->rc_tab.size = ir_dev->rc_tab.alloc / sizeof(struct ir_scancode); | ||
471 | if (props) { | ||
472 | ir_dev->props = props; | ||
473 | if (props->open) | ||
474 | input_dev->open = ir_open; | ||
475 | if (props->close) | ||
476 | input_dev->close = ir_close; | ||
477 | } | ||
478 | |||
479 | if (!ir_dev->rc_tab.scan) { | ||
480 | rc = -ENOMEM; | ||
481 | goto out_name; | ||
482 | } | ||
483 | |||
484 | IR_dprintk(1, "Allocated space for %u keycode entries (%u bytes)\n", | ||
485 | ir_dev->rc_tab.size, ir_dev->rc_tab.alloc); | ||
486 | |||
487 | set_bit(EV_KEY, input_dev->evbit); | ||
488 | set_bit(EV_REP, input_dev->evbit); | ||
489 | set_bit(EV_MSC, input_dev->evbit); | ||
490 | set_bit(MSC_SCAN, input_dev->mscbit); | ||
491 | |||
492 | if (ir_setkeytable(input_dev, &ir_dev->rc_tab, rc_tab)) { | ||
493 | rc = -ENOMEM; | ||
494 | goto out_table; | ||
495 | } | ||
496 | |||
497 | rc = ir_register_class(input_dev); | ||
498 | if (rc < 0) | ||
499 | goto out_table; | ||
500 | |||
501 | if (ir_dev->props) | ||
502 | if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) { | ||
503 | rc = ir_raw_event_register(input_dev); | ||
504 | if (rc < 0) | ||
505 | goto out_event; | ||
506 | } | ||
507 | |||
508 | IR_dprintk(1, "Registered input device on %s for %s remote%s.\n", | ||
509 | driver_name, rc_tab->name, | ||
510 | (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_IR_RAW) ? | ||
511 | " in raw mode" : ""); | ||
512 | |||
513 | /* | ||
514 | * Default delay of 250ms is too short for some protocols, expecially | ||
515 | * since the timeout is currently set to 250ms. Increase it to 500ms, | ||
516 | * to avoid wrong repetition of the keycodes. | ||
517 | */ | ||
518 | input_dev->rep[REP_DELAY] = 500; | ||
519 | |||
520 | return 0; | ||
521 | |||
522 | out_event: | ||
523 | ir_unregister_class(input_dev); | ||
524 | out_table: | ||
525 | kfree(ir_dev->rc_tab.scan); | ||
526 | out_name: | ||
527 | kfree(ir_dev->driver_name); | ||
528 | out_dev: | ||
529 | kfree(ir_dev); | ||
530 | return rc; | ||
531 | } | ||
532 | EXPORT_SYMBOL_GPL(__ir_input_register); | ||
533 | |||
534 | /** | ||
535 | * ir_input_unregister() - unregisters IR and frees resources | ||
536 | * @input_dev: the struct input_dev descriptor of the device | ||
537 | |||
538 | * This routine is used to free memory and de-register interfaces. | ||
539 | */ | ||
540 | void ir_input_unregister(struct input_dev *input_dev) | ||
541 | { | ||
542 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
543 | struct ir_scancode_table *rc_tab; | ||
544 | |||
545 | if (!ir_dev) | ||
546 | return; | ||
547 | |||
548 | IR_dprintk(1, "Freed keycode table\n"); | ||
549 | |||
550 | del_timer_sync(&ir_dev->timer_keyup); | ||
551 | if (ir_dev->props) | ||
552 | if (ir_dev->props->driver_type == RC_DRIVER_IR_RAW) | ||
553 | ir_raw_event_unregister(input_dev); | ||
554 | |||
555 | rc_tab = &ir_dev->rc_tab; | ||
556 | rc_tab->size = 0; | ||
557 | kfree(rc_tab->scan); | ||
558 | rc_tab->scan = NULL; | ||
559 | |||
560 | ir_unregister_class(input_dev); | ||
561 | |||
562 | kfree(ir_dev->driver_name); | ||
563 | kfree(ir_dev); | ||
564 | } | ||
565 | EXPORT_SYMBOL_GPL(ir_input_unregister); | ||
566 | |||
567 | int ir_core_debug; /* ir_debug level (0,1,2) */ | ||
568 | EXPORT_SYMBOL_GPL(ir_core_debug); | ||
569 | module_param_named(debug, ir_core_debug, int, 0644); | ||
570 | |||
571 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
572 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/media/IR/ir-lirc-codec.c b/drivers/media/IR/ir-lirc-codec.c deleted file mode 100644 index e63f757d5d72..000000000000 --- a/drivers/media/IR/ir-lirc-codec.c +++ /dev/null | |||
@@ -1,354 +0,0 @@ | |||
1 | /* ir-lirc-codec.c - ir-core to classic lirc interface bridge | ||
2 | * | ||
3 | * Copyright (C) 2010 by Jarod Wilson <jarod@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/sched.h> | ||
16 | #include <linux/wait.h> | ||
17 | #include <media/lirc.h> | ||
18 | #include <media/lirc_dev.h> | ||
19 | #include <media/ir-core.h> | ||
20 | #include "ir-core-priv.h" | ||
21 | |||
22 | #define LIRCBUF_SIZE 256 | ||
23 | |||
24 | /** | ||
25 | * ir_lirc_decode() - Send raw IR data to lirc_dev to be relayed to the | ||
26 | * lircd userspace daemon for decoding. | ||
27 | * @input_dev: the struct input_dev descriptor of the device | ||
28 | * @duration: the struct ir_raw_event descriptor of the pulse/space | ||
29 | * | ||
30 | * This function returns -EINVAL if the lirc interfaces aren't wired up. | ||
31 | */ | ||
32 | static int ir_lirc_decode(struct input_dev *input_dev, struct ir_raw_event ev) | ||
33 | { | ||
34 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
35 | int sample; | ||
36 | |||
37 | if (!(ir_dev->raw->enabled_protocols & IR_TYPE_LIRC)) | ||
38 | return 0; | ||
39 | |||
40 | if (!ir_dev->raw->lirc.drv || !ir_dev->raw->lirc.drv->rbuf) | ||
41 | return -EINVAL; | ||
42 | |||
43 | if (IS_RESET(ev)) | ||
44 | return 0; | ||
45 | |||
46 | IR_dprintk(2, "LIRC data transfer started (%uus %s)\n", | ||
47 | TO_US(ev.duration), TO_STR(ev.pulse)); | ||
48 | |||
49 | sample = ev.duration / 1000; | ||
50 | if (ev.pulse) | ||
51 | sample |= PULSE_BIT; | ||
52 | |||
53 | lirc_buffer_write(ir_dev->raw->lirc.drv->rbuf, | ||
54 | (unsigned char *) &sample); | ||
55 | wake_up(&ir_dev->raw->lirc.drv->rbuf->wait_poll); | ||
56 | |||
57 | |||
58 | return 0; | ||
59 | } | ||
60 | |||
61 | static ssize_t ir_lirc_transmit_ir(struct file *file, const char *buf, | ||
62 | size_t n, loff_t *ppos) | ||
63 | { | ||
64 | struct lirc_codec *lirc; | ||
65 | struct ir_input_dev *ir_dev; | ||
66 | int *txbuf; /* buffer with values to transmit */ | ||
67 | int ret = 0, count; | ||
68 | |||
69 | lirc = lirc_get_pdata(file); | ||
70 | if (!lirc) | ||
71 | return -EFAULT; | ||
72 | |||
73 | if (n % sizeof(int)) | ||
74 | return -EINVAL; | ||
75 | |||
76 | count = n / sizeof(int); | ||
77 | if (count > LIRCBUF_SIZE || count % 2 == 0) | ||
78 | return -EINVAL; | ||
79 | |||
80 | txbuf = memdup_user(buf, n); | ||
81 | if (IS_ERR(txbuf)) | ||
82 | return PTR_ERR(txbuf); | ||
83 | |||
84 | ir_dev = lirc->ir_dev; | ||
85 | if (!ir_dev) { | ||
86 | ret = -EFAULT; | ||
87 | goto out; | ||
88 | } | ||
89 | |||
90 | if (ir_dev->props && ir_dev->props->tx_ir) | ||
91 | ret = ir_dev->props->tx_ir(ir_dev->props->priv, txbuf, (u32)n); | ||
92 | |||
93 | out: | ||
94 | kfree(txbuf); | ||
95 | return ret; | ||
96 | } | ||
97 | |||
98 | static long ir_lirc_ioctl(struct file *filep, unsigned int cmd, | ||
99 | unsigned long __user arg) | ||
100 | { | ||
101 | struct lirc_codec *lirc; | ||
102 | struct ir_input_dev *ir_dev; | ||
103 | int ret = 0; | ||
104 | void *drv_data; | ||
105 | unsigned long val = 0; | ||
106 | |||
107 | lirc = lirc_get_pdata(filep); | ||
108 | if (!lirc) | ||
109 | return -EFAULT; | ||
110 | |||
111 | ir_dev = lirc->ir_dev; | ||
112 | if (!ir_dev || !ir_dev->props || !ir_dev->props->priv) | ||
113 | return -EFAULT; | ||
114 | |||
115 | drv_data = ir_dev->props->priv; | ||
116 | |||
117 | if (_IOC_DIR(cmd) & _IOC_WRITE) { | ||
118 | ret = get_user(val, (unsigned long *)arg); | ||
119 | if (ret) | ||
120 | return ret; | ||
121 | } | ||
122 | |||
123 | switch (cmd) { | ||
124 | |||
125 | /* legacy support */ | ||
126 | case LIRC_GET_SEND_MODE: | ||
127 | val = LIRC_CAN_SEND_PULSE & LIRC_CAN_SEND_MASK; | ||
128 | break; | ||
129 | |||
130 | case LIRC_SET_SEND_MODE: | ||
131 | if (val != (LIRC_MODE_PULSE & LIRC_CAN_SEND_MASK)) | ||
132 | return -EINVAL; | ||
133 | break; | ||
134 | |||
135 | /* TX settings */ | ||
136 | case LIRC_SET_TRANSMITTER_MASK: | ||
137 | if (ir_dev->props->s_tx_mask) | ||
138 | ret = ir_dev->props->s_tx_mask(drv_data, (u32)val); | ||
139 | else | ||
140 | return -EINVAL; | ||
141 | break; | ||
142 | |||
143 | case LIRC_SET_SEND_CARRIER: | ||
144 | if (ir_dev->props->s_tx_carrier) | ||
145 | ir_dev->props->s_tx_carrier(drv_data, (u32)val); | ||
146 | else | ||
147 | return -EINVAL; | ||
148 | break; | ||
149 | |||
150 | case LIRC_SET_SEND_DUTY_CYCLE: | ||
151 | if (!ir_dev->props->s_tx_duty_cycle) | ||
152 | return -ENOSYS; | ||
153 | |||
154 | if (val <= 0 || val >= 100) | ||
155 | return -EINVAL; | ||
156 | |||
157 | ir_dev->props->s_tx_duty_cycle(ir_dev->props->priv, val); | ||
158 | break; | ||
159 | |||
160 | /* RX settings */ | ||
161 | case LIRC_SET_REC_CARRIER: | ||
162 | if (ir_dev->props->s_rx_carrier_range) | ||
163 | ret = ir_dev->props->s_rx_carrier_range( | ||
164 | ir_dev->props->priv, | ||
165 | ir_dev->raw->lirc.carrier_low, val); | ||
166 | else | ||
167 | return -ENOSYS; | ||
168 | |||
169 | if (!ret) | ||
170 | ir_dev->raw->lirc.carrier_low = 0; | ||
171 | break; | ||
172 | |||
173 | case LIRC_SET_REC_CARRIER_RANGE: | ||
174 | if (val >= 0) | ||
175 | ir_dev->raw->lirc.carrier_low = val; | ||
176 | break; | ||
177 | |||
178 | |||
179 | case LIRC_GET_REC_RESOLUTION: | ||
180 | val = ir_dev->props->rx_resolution; | ||
181 | break; | ||
182 | |||
183 | case LIRC_SET_WIDEBAND_RECEIVER: | ||
184 | if (ir_dev->props->s_learning_mode) | ||
185 | return ir_dev->props->s_learning_mode( | ||
186 | ir_dev->props->priv, !!val); | ||
187 | else | ||
188 | return -ENOSYS; | ||
189 | |||
190 | /* Generic timeout support */ | ||
191 | case LIRC_GET_MIN_TIMEOUT: | ||
192 | if (!ir_dev->props->max_timeout) | ||
193 | return -ENOSYS; | ||
194 | val = ir_dev->props->min_timeout / 1000; | ||
195 | break; | ||
196 | |||
197 | case LIRC_GET_MAX_TIMEOUT: | ||
198 | if (!ir_dev->props->max_timeout) | ||
199 | return -ENOSYS; | ||
200 | val = ir_dev->props->max_timeout / 1000; | ||
201 | break; | ||
202 | |||
203 | case LIRC_SET_REC_TIMEOUT: | ||
204 | if (val < ir_dev->props->min_timeout || | ||
205 | val > ir_dev->props->max_timeout) | ||
206 | return -EINVAL; | ||
207 | ir_dev->props->timeout = val * 1000; | ||
208 | break; | ||
209 | |||
210 | default: | ||
211 | return lirc_dev_fop_ioctl(filep, cmd, arg); | ||
212 | } | ||
213 | |||
214 | if (_IOC_DIR(cmd) & _IOC_READ) | ||
215 | ret = put_user(val, (unsigned long *)arg); | ||
216 | |||
217 | return ret; | ||
218 | } | ||
219 | |||
220 | static int ir_lirc_open(void *data) | ||
221 | { | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static void ir_lirc_close(void *data) | ||
226 | { | ||
227 | return; | ||
228 | } | ||
229 | |||
230 | static struct file_operations lirc_fops = { | ||
231 | .owner = THIS_MODULE, | ||
232 | .write = ir_lirc_transmit_ir, | ||
233 | .unlocked_ioctl = ir_lirc_ioctl, | ||
234 | .read = lirc_dev_fop_read, | ||
235 | .poll = lirc_dev_fop_poll, | ||
236 | .open = lirc_dev_fop_open, | ||
237 | .release = lirc_dev_fop_close, | ||
238 | }; | ||
239 | |||
240 | static int ir_lirc_register(struct input_dev *input_dev) | ||
241 | { | ||
242 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
243 | struct lirc_driver *drv; | ||
244 | struct lirc_buffer *rbuf; | ||
245 | int rc = -ENOMEM; | ||
246 | unsigned long features; | ||
247 | |||
248 | drv = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL); | ||
249 | if (!drv) | ||
250 | return rc; | ||
251 | |||
252 | rbuf = kzalloc(sizeof(struct lirc_buffer), GFP_KERNEL); | ||
253 | if (!rbuf) | ||
254 | goto rbuf_alloc_failed; | ||
255 | |||
256 | rc = lirc_buffer_init(rbuf, sizeof(int), LIRCBUF_SIZE); | ||
257 | if (rc) | ||
258 | goto rbuf_init_failed; | ||
259 | |||
260 | features = LIRC_CAN_REC_MODE2; | ||
261 | if (ir_dev->props->tx_ir) { | ||
262 | |||
263 | features |= LIRC_CAN_SEND_PULSE; | ||
264 | if (ir_dev->props->s_tx_mask) | ||
265 | features |= LIRC_CAN_SET_TRANSMITTER_MASK; | ||
266 | if (ir_dev->props->s_tx_carrier) | ||
267 | features |= LIRC_CAN_SET_SEND_CARRIER; | ||
268 | |||
269 | if (ir_dev->props->s_tx_duty_cycle) | ||
270 | features |= LIRC_CAN_SET_SEND_DUTY_CYCLE; | ||
271 | } | ||
272 | |||
273 | if (ir_dev->props->s_rx_carrier_range) | ||
274 | features |= LIRC_CAN_SET_REC_CARRIER | | ||
275 | LIRC_CAN_SET_REC_CARRIER_RANGE; | ||
276 | |||
277 | if (ir_dev->props->s_learning_mode) | ||
278 | features |= LIRC_CAN_USE_WIDEBAND_RECEIVER; | ||
279 | |||
280 | if (ir_dev->props->max_timeout) | ||
281 | features |= LIRC_CAN_SET_REC_TIMEOUT; | ||
282 | |||
283 | |||
284 | snprintf(drv->name, sizeof(drv->name), "ir-lirc-codec (%s)", | ||
285 | ir_dev->driver_name); | ||
286 | drv->minor = -1; | ||
287 | drv->features = features; | ||
288 | drv->data = &ir_dev->raw->lirc; | ||
289 | drv->rbuf = rbuf; | ||
290 | drv->set_use_inc = &ir_lirc_open; | ||
291 | drv->set_use_dec = &ir_lirc_close; | ||
292 | drv->code_length = sizeof(struct ir_raw_event) * 8; | ||
293 | drv->fops = &lirc_fops; | ||
294 | drv->dev = &ir_dev->dev; | ||
295 | drv->owner = THIS_MODULE; | ||
296 | |||
297 | drv->minor = lirc_register_driver(drv); | ||
298 | if (drv->minor < 0) { | ||
299 | rc = -ENODEV; | ||
300 | goto lirc_register_failed; | ||
301 | } | ||
302 | |||
303 | ir_dev->raw->lirc.drv = drv; | ||
304 | ir_dev->raw->lirc.ir_dev = ir_dev; | ||
305 | return 0; | ||
306 | |||
307 | lirc_register_failed: | ||
308 | rbuf_init_failed: | ||
309 | kfree(rbuf); | ||
310 | rbuf_alloc_failed: | ||
311 | kfree(drv); | ||
312 | |||
313 | return rc; | ||
314 | } | ||
315 | |||
316 | static int ir_lirc_unregister(struct input_dev *input_dev) | ||
317 | { | ||
318 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
319 | struct lirc_codec *lirc = &ir_dev->raw->lirc; | ||
320 | |||
321 | lirc_unregister_driver(lirc->drv->minor); | ||
322 | lirc_buffer_free(lirc->drv->rbuf); | ||
323 | kfree(lirc->drv); | ||
324 | |||
325 | return 0; | ||
326 | } | ||
327 | |||
328 | static struct ir_raw_handler lirc_handler = { | ||
329 | .protocols = IR_TYPE_LIRC, | ||
330 | .decode = ir_lirc_decode, | ||
331 | .raw_register = ir_lirc_register, | ||
332 | .raw_unregister = ir_lirc_unregister, | ||
333 | }; | ||
334 | |||
335 | static int __init ir_lirc_codec_init(void) | ||
336 | { | ||
337 | ir_raw_handler_register(&lirc_handler); | ||
338 | |||
339 | printk(KERN_INFO "IR LIRC bridge handler initialized\n"); | ||
340 | return 0; | ||
341 | } | ||
342 | |||
343 | static void __exit ir_lirc_codec_exit(void) | ||
344 | { | ||
345 | ir_raw_handler_unregister(&lirc_handler); | ||
346 | } | ||
347 | |||
348 | module_init(ir_lirc_codec_init); | ||
349 | module_exit(ir_lirc_codec_exit); | ||
350 | |||
351 | MODULE_LICENSE("GPL"); | ||
352 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); | ||
353 | MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); | ||
354 | MODULE_DESCRIPTION("LIRC IR handler bridge"); | ||
diff --git a/drivers/media/IR/ir-nec-decoder.c b/drivers/media/IR/ir-nec-decoder.c deleted file mode 100644 index d597421d6547..000000000000 --- a/drivers/media/IR/ir-nec-decoder.c +++ /dev/null | |||
@@ -1,216 +0,0 @@ | |||
1 | /* ir-nec-decoder.c - handle NEC IR Pulse/Space protocol | ||
2 | * | ||
3 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/bitrev.h> | ||
16 | #include "ir-core-priv.h" | ||
17 | |||
18 | #define NEC_NBITS 32 | ||
19 | #define NEC_UNIT 562500 /* ns */ | ||
20 | #define NEC_HEADER_PULSE (16 * NEC_UNIT) | ||
21 | #define NECX_HEADER_PULSE (8 * NEC_UNIT) /* Less common NEC variant */ | ||
22 | #define NEC_HEADER_SPACE (8 * NEC_UNIT) | ||
23 | #define NEC_REPEAT_SPACE (4 * NEC_UNIT) | ||
24 | #define NEC_BIT_PULSE (1 * NEC_UNIT) | ||
25 | #define NEC_BIT_0_SPACE (1 * NEC_UNIT) | ||
26 | #define NEC_BIT_1_SPACE (3 * NEC_UNIT) | ||
27 | #define NEC_TRAILER_PULSE (1 * NEC_UNIT) | ||
28 | #define NEC_TRAILER_SPACE (10 * NEC_UNIT) /* even longer in reality */ | ||
29 | #define NECX_REPEAT_BITS 1 | ||
30 | |||
31 | enum nec_state { | ||
32 | STATE_INACTIVE, | ||
33 | STATE_HEADER_SPACE, | ||
34 | STATE_BIT_PULSE, | ||
35 | STATE_BIT_SPACE, | ||
36 | STATE_TRAILER_PULSE, | ||
37 | STATE_TRAILER_SPACE, | ||
38 | }; | ||
39 | |||
40 | /** | ||
41 | * ir_nec_decode() - Decode one NEC pulse or space | ||
42 | * @input_dev: the struct input_dev descriptor of the device | ||
43 | * @duration: the struct ir_raw_event descriptor of the pulse/space | ||
44 | * | ||
45 | * This function returns -EINVAL if the pulse violates the state machine | ||
46 | */ | ||
47 | static int ir_nec_decode(struct input_dev *input_dev, struct ir_raw_event ev) | ||
48 | { | ||
49 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
50 | struct nec_dec *data = &ir_dev->raw->nec; | ||
51 | u32 scancode; | ||
52 | u8 address, not_address, command, not_command; | ||
53 | |||
54 | if (!(ir_dev->raw->enabled_protocols & IR_TYPE_NEC)) | ||
55 | return 0; | ||
56 | |||
57 | if (IS_RESET(ev)) { | ||
58 | data->state = STATE_INACTIVE; | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | IR_dprintk(2, "NEC decode started at state %d (%uus %s)\n", | ||
63 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
64 | |||
65 | switch (data->state) { | ||
66 | |||
67 | case STATE_INACTIVE: | ||
68 | if (!ev.pulse) | ||
69 | break; | ||
70 | |||
71 | if (eq_margin(ev.duration, NEC_HEADER_PULSE, NEC_UNIT / 2)) { | ||
72 | data->is_nec_x = false; | ||
73 | data->necx_repeat = false; | ||
74 | } else if (eq_margin(ev.duration, NECX_HEADER_PULSE, NEC_UNIT / 2)) | ||
75 | data->is_nec_x = true; | ||
76 | else | ||
77 | break; | ||
78 | |||
79 | data->count = 0; | ||
80 | data->state = STATE_HEADER_SPACE; | ||
81 | return 0; | ||
82 | |||
83 | case STATE_HEADER_SPACE: | ||
84 | if (ev.pulse) | ||
85 | break; | ||
86 | |||
87 | if (eq_margin(ev.duration, NEC_HEADER_SPACE, NEC_UNIT / 2)) { | ||
88 | data->state = STATE_BIT_PULSE; | ||
89 | return 0; | ||
90 | } else if (eq_margin(ev.duration, NEC_REPEAT_SPACE, NEC_UNIT / 2)) { | ||
91 | ir_repeat(input_dev); | ||
92 | IR_dprintk(1, "Repeat last key\n"); | ||
93 | data->state = STATE_TRAILER_PULSE; | ||
94 | return 0; | ||
95 | } | ||
96 | |||
97 | break; | ||
98 | |||
99 | case STATE_BIT_PULSE: | ||
100 | if (!ev.pulse) | ||
101 | break; | ||
102 | |||
103 | if (!eq_margin(ev.duration, NEC_BIT_PULSE, NEC_UNIT / 2)) | ||
104 | break; | ||
105 | |||
106 | data->state = STATE_BIT_SPACE; | ||
107 | return 0; | ||
108 | |||
109 | case STATE_BIT_SPACE: | ||
110 | if (ev.pulse) | ||
111 | break; | ||
112 | |||
113 | if (data->necx_repeat && data->count == NECX_REPEAT_BITS && | ||
114 | geq_margin(ev.duration, | ||
115 | NEC_TRAILER_SPACE, NEC_UNIT / 2)) { | ||
116 | IR_dprintk(1, "Repeat last key\n"); | ||
117 | ir_repeat(input_dev); | ||
118 | data->state = STATE_INACTIVE; | ||
119 | return 0; | ||
120 | |||
121 | } else if (data->count > NECX_REPEAT_BITS) | ||
122 | data->necx_repeat = false; | ||
123 | |||
124 | data->bits <<= 1; | ||
125 | if (eq_margin(ev.duration, NEC_BIT_1_SPACE, NEC_UNIT / 2)) | ||
126 | data->bits |= 1; | ||
127 | else if (!eq_margin(ev.duration, NEC_BIT_0_SPACE, NEC_UNIT / 2)) | ||
128 | break; | ||
129 | data->count++; | ||
130 | |||
131 | if (data->count == NEC_NBITS) | ||
132 | data->state = STATE_TRAILER_PULSE; | ||
133 | else | ||
134 | data->state = STATE_BIT_PULSE; | ||
135 | |||
136 | return 0; | ||
137 | |||
138 | case STATE_TRAILER_PULSE: | ||
139 | if (!ev.pulse) | ||
140 | break; | ||
141 | |||
142 | if (!eq_margin(ev.duration, NEC_TRAILER_PULSE, NEC_UNIT / 2)) | ||
143 | break; | ||
144 | |||
145 | data->state = STATE_TRAILER_SPACE; | ||
146 | return 0; | ||
147 | |||
148 | case STATE_TRAILER_SPACE: | ||
149 | if (ev.pulse) | ||
150 | break; | ||
151 | |||
152 | if (!geq_margin(ev.duration, NEC_TRAILER_SPACE, NEC_UNIT / 2)) | ||
153 | break; | ||
154 | |||
155 | address = bitrev8((data->bits >> 24) & 0xff); | ||
156 | not_address = bitrev8((data->bits >> 16) & 0xff); | ||
157 | command = bitrev8((data->bits >> 8) & 0xff); | ||
158 | not_command = bitrev8((data->bits >> 0) & 0xff); | ||
159 | |||
160 | if ((command ^ not_command) != 0xff) { | ||
161 | IR_dprintk(1, "NEC checksum error: received 0x%08x\n", | ||
162 | data->bits); | ||
163 | break; | ||
164 | } | ||
165 | |||
166 | if ((address ^ not_address) != 0xff) { | ||
167 | /* Extended NEC */ | ||
168 | scancode = address << 16 | | ||
169 | not_address << 8 | | ||
170 | command; | ||
171 | IR_dprintk(1, "NEC (Ext) scancode 0x%06x\n", scancode); | ||
172 | } else { | ||
173 | /* Normal NEC */ | ||
174 | scancode = address << 8 | command; | ||
175 | IR_dprintk(1, "NEC scancode 0x%04x\n", scancode); | ||
176 | } | ||
177 | |||
178 | if (data->is_nec_x) | ||
179 | data->necx_repeat = true; | ||
180 | |||
181 | ir_keydown(input_dev, scancode, 0); | ||
182 | data->state = STATE_INACTIVE; | ||
183 | return 0; | ||
184 | } | ||
185 | |||
186 | IR_dprintk(1, "NEC decode failed at state %d (%uus %s)\n", | ||
187 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
188 | data->state = STATE_INACTIVE; | ||
189 | return -EINVAL; | ||
190 | } | ||
191 | |||
192 | static struct ir_raw_handler nec_handler = { | ||
193 | .protocols = IR_TYPE_NEC, | ||
194 | .decode = ir_nec_decode, | ||
195 | }; | ||
196 | |||
197 | static int __init ir_nec_decode_init(void) | ||
198 | { | ||
199 | ir_raw_handler_register(&nec_handler); | ||
200 | |||
201 | printk(KERN_INFO "IR NEC protocol handler initialized\n"); | ||
202 | return 0; | ||
203 | } | ||
204 | |||
205 | static void __exit ir_nec_decode_exit(void) | ||
206 | { | ||
207 | ir_raw_handler_unregister(&nec_handler); | ||
208 | } | ||
209 | |||
210 | module_init(ir_nec_decode_init); | ||
211 | module_exit(ir_nec_decode_exit); | ||
212 | |||
213 | MODULE_LICENSE("GPL"); | ||
214 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
215 | MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); | ||
216 | MODULE_DESCRIPTION("NEC IR protocol decoder"); | ||
diff --git a/drivers/media/IR/ir-raw-event.c b/drivers/media/IR/ir-raw-event.c deleted file mode 100644 index 8e0e1b1f8c87..000000000000 --- a/drivers/media/IR/ir-raw-event.c +++ /dev/null | |||
@@ -1,379 +0,0 @@ | |||
1 | /* ir-raw-event.c - handle IR Pulse/Space event | ||
2 | * | ||
3 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/kthread.h> | ||
16 | #include <linux/mutex.h> | ||
17 | #include <linux/sched.h> | ||
18 | #include <linux/freezer.h> | ||
19 | #include "ir-core-priv.h" | ||
20 | |||
21 | /* Define the max number of pulse/space transitions to buffer */ | ||
22 | #define MAX_IR_EVENT_SIZE 512 | ||
23 | |||
24 | /* Used to keep track of IR raw clients, protected by ir_raw_handler_lock */ | ||
25 | static LIST_HEAD(ir_raw_client_list); | ||
26 | |||
27 | /* Used to handle IR raw handler extensions */ | ||
28 | static DEFINE_MUTEX(ir_raw_handler_lock); | ||
29 | static LIST_HEAD(ir_raw_handler_list); | ||
30 | static u64 available_protocols; | ||
31 | |||
32 | #ifdef MODULE | ||
33 | /* Used to load the decoders */ | ||
34 | static struct work_struct wq_load; | ||
35 | #endif | ||
36 | |||
37 | static int ir_raw_event_thread(void *data) | ||
38 | { | ||
39 | struct ir_raw_event ev; | ||
40 | struct ir_raw_handler *handler; | ||
41 | struct ir_raw_event_ctrl *raw = (struct ir_raw_event_ctrl *)data; | ||
42 | |||
43 | while (!kthread_should_stop()) { | ||
44 | try_to_freeze(); | ||
45 | |||
46 | mutex_lock(&ir_raw_handler_lock); | ||
47 | |||
48 | while (kfifo_out(&raw->kfifo, &ev, sizeof(ev)) == sizeof(ev)) { | ||
49 | list_for_each_entry(handler, &ir_raw_handler_list, list) | ||
50 | handler->decode(raw->input_dev, ev); | ||
51 | raw->prev_ev = ev; | ||
52 | } | ||
53 | |||
54 | mutex_unlock(&ir_raw_handler_lock); | ||
55 | |||
56 | set_current_state(TASK_INTERRUPTIBLE); | ||
57 | schedule(); | ||
58 | } | ||
59 | |||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | /** | ||
64 | * ir_raw_event_store() - pass a pulse/space duration to the raw ir decoders | ||
65 | * @input_dev: the struct input_dev device descriptor | ||
66 | * @ev: the struct ir_raw_event descriptor of the pulse/space | ||
67 | * | ||
68 | * This routine (which may be called from an interrupt context) stores a | ||
69 | * pulse/space duration for the raw ir decoding state machines. Pulses are | ||
70 | * signalled as positive values and spaces as negative values. A zero value | ||
71 | * will reset the decoding state machines. | ||
72 | */ | ||
73 | int ir_raw_event_store(struct input_dev *input_dev, struct ir_raw_event *ev) | ||
74 | { | ||
75 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
76 | |||
77 | if (!ir->raw) | ||
78 | return -EINVAL; | ||
79 | |||
80 | IR_dprintk(2, "sample: (05%dus %s)\n", | ||
81 | TO_US(ev->duration), TO_STR(ev->pulse)); | ||
82 | |||
83 | if (kfifo_in(&ir->raw->kfifo, ev, sizeof(*ev)) != sizeof(*ev)) | ||
84 | return -ENOMEM; | ||
85 | |||
86 | return 0; | ||
87 | } | ||
88 | EXPORT_SYMBOL_GPL(ir_raw_event_store); | ||
89 | |||
90 | /** | ||
91 | * ir_raw_event_store_edge() - notify raw ir decoders of the start of a pulse/space | ||
92 | * @input_dev: the struct input_dev device descriptor | ||
93 | * @type: the type of the event that has occurred | ||
94 | * | ||
95 | * This routine (which may be called from an interrupt context) is used to | ||
96 | * store the beginning of an ir pulse or space (or the start/end of ir | ||
97 | * reception) for the raw ir decoding state machines. This is used by | ||
98 | * hardware which does not provide durations directly but only interrupts | ||
99 | * (or similar events) on state change. | ||
100 | */ | ||
101 | int ir_raw_event_store_edge(struct input_dev *input_dev, enum raw_event_type type) | ||
102 | { | ||
103 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
104 | ktime_t now; | ||
105 | s64 delta; /* ns */ | ||
106 | struct ir_raw_event ev; | ||
107 | int rc = 0; | ||
108 | |||
109 | if (!ir->raw) | ||
110 | return -EINVAL; | ||
111 | |||
112 | now = ktime_get(); | ||
113 | delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event)); | ||
114 | |||
115 | /* Check for a long duration since last event or if we're | ||
116 | * being called for the first time, note that delta can't | ||
117 | * possibly be negative. | ||
118 | */ | ||
119 | ev.duration = 0; | ||
120 | if (delta > IR_MAX_DURATION || !ir->raw->last_type) | ||
121 | type |= IR_START_EVENT; | ||
122 | else | ||
123 | ev.duration = delta; | ||
124 | |||
125 | if (type & IR_START_EVENT) | ||
126 | ir_raw_event_reset(input_dev); | ||
127 | else if (ir->raw->last_type & IR_SPACE) { | ||
128 | ev.pulse = false; | ||
129 | rc = ir_raw_event_store(input_dev, &ev); | ||
130 | } else if (ir->raw->last_type & IR_PULSE) { | ||
131 | ev.pulse = true; | ||
132 | rc = ir_raw_event_store(input_dev, &ev); | ||
133 | } else | ||
134 | return 0; | ||
135 | |||
136 | ir->raw->last_event = now; | ||
137 | ir->raw->last_type = type; | ||
138 | return rc; | ||
139 | } | ||
140 | EXPORT_SYMBOL_GPL(ir_raw_event_store_edge); | ||
141 | |||
142 | /** | ||
143 | * ir_raw_event_store_with_filter() - pass next pulse/space to decoders with some processing | ||
144 | * @input_dev: the struct input_dev device descriptor | ||
145 | * @type: the type of the event that has occurred | ||
146 | * | ||
147 | * This routine (which may be called from an interrupt context) works | ||
148 | * in similiar manner to ir_raw_event_store_edge. | ||
149 | * This routine is intended for devices with limited internal buffer | ||
150 | * It automerges samples of same type, and handles timeouts | ||
151 | */ | ||
152 | int ir_raw_event_store_with_filter(struct input_dev *input_dev, | ||
153 | struct ir_raw_event *ev) | ||
154 | { | ||
155 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
156 | struct ir_raw_event_ctrl *raw = ir->raw; | ||
157 | |||
158 | if (!raw || !ir->props) | ||
159 | return -EINVAL; | ||
160 | |||
161 | /* Ignore spaces in idle mode */ | ||
162 | if (ir->idle && !ev->pulse) | ||
163 | return 0; | ||
164 | else if (ir->idle) | ||
165 | ir_raw_event_set_idle(input_dev, 0); | ||
166 | |||
167 | if (!raw->this_ev.duration) { | ||
168 | raw->this_ev = *ev; | ||
169 | } else if (ev->pulse == raw->this_ev.pulse) { | ||
170 | raw->this_ev.duration += ev->duration; | ||
171 | } else { | ||
172 | ir_raw_event_store(input_dev, &raw->this_ev); | ||
173 | raw->this_ev = *ev; | ||
174 | } | ||
175 | |||
176 | /* Enter idle mode if nessesary */ | ||
177 | if (!ev->pulse && ir->props->timeout && | ||
178 | raw->this_ev.duration >= ir->props->timeout) | ||
179 | ir_raw_event_set_idle(input_dev, 1); | ||
180 | return 0; | ||
181 | } | ||
182 | EXPORT_SYMBOL_GPL(ir_raw_event_store_with_filter); | ||
183 | |||
184 | void ir_raw_event_set_idle(struct input_dev *input_dev, int idle) | ||
185 | { | ||
186 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
187 | struct ir_raw_event_ctrl *raw = ir->raw; | ||
188 | ktime_t now; | ||
189 | u64 delta; | ||
190 | |||
191 | if (!ir->props) | ||
192 | return; | ||
193 | |||
194 | if (!ir->raw) | ||
195 | goto out; | ||
196 | |||
197 | if (idle) { | ||
198 | IR_dprintk(2, "enter idle mode\n"); | ||
199 | raw->last_event = ktime_get(); | ||
200 | } else { | ||
201 | IR_dprintk(2, "exit idle mode\n"); | ||
202 | |||
203 | now = ktime_get(); | ||
204 | delta = ktime_to_ns(ktime_sub(now, ir->raw->last_event)); | ||
205 | |||
206 | WARN_ON(raw->this_ev.pulse); | ||
207 | |||
208 | raw->this_ev.duration = | ||
209 | min(raw->this_ev.duration + delta, | ||
210 | (u64)IR_MAX_DURATION); | ||
211 | |||
212 | ir_raw_event_store(input_dev, &raw->this_ev); | ||
213 | |||
214 | if (raw->this_ev.duration == IR_MAX_DURATION) | ||
215 | ir_raw_event_reset(input_dev); | ||
216 | |||
217 | raw->this_ev.duration = 0; | ||
218 | } | ||
219 | out: | ||
220 | if (ir->props->s_idle) | ||
221 | ir->props->s_idle(ir->props->priv, idle); | ||
222 | ir->idle = idle; | ||
223 | } | ||
224 | EXPORT_SYMBOL_GPL(ir_raw_event_set_idle); | ||
225 | |||
226 | /** | ||
227 | * ir_raw_event_handle() - schedules the decoding of stored ir data | ||
228 | * @input_dev: the struct input_dev device descriptor | ||
229 | * | ||
230 | * This routine will signal the workqueue to start decoding stored ir data. | ||
231 | */ | ||
232 | void ir_raw_event_handle(struct input_dev *input_dev) | ||
233 | { | ||
234 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
235 | |||
236 | if (!ir->raw) | ||
237 | return; | ||
238 | |||
239 | wake_up_process(ir->raw->thread); | ||
240 | } | ||
241 | EXPORT_SYMBOL_GPL(ir_raw_event_handle); | ||
242 | |||
243 | /* used internally by the sysfs interface */ | ||
244 | u64 | ||
245 | ir_raw_get_allowed_protocols() | ||
246 | { | ||
247 | u64 protocols; | ||
248 | mutex_lock(&ir_raw_handler_lock); | ||
249 | protocols = available_protocols; | ||
250 | mutex_unlock(&ir_raw_handler_lock); | ||
251 | return protocols; | ||
252 | } | ||
253 | |||
254 | /* | ||
255 | * Used to (un)register raw event clients | ||
256 | */ | ||
257 | int ir_raw_event_register(struct input_dev *input_dev) | ||
258 | { | ||
259 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
260 | int rc; | ||
261 | struct ir_raw_handler *handler; | ||
262 | |||
263 | ir->raw = kzalloc(sizeof(*ir->raw), GFP_KERNEL); | ||
264 | if (!ir->raw) | ||
265 | return -ENOMEM; | ||
266 | |||
267 | ir->raw->input_dev = input_dev; | ||
268 | |||
269 | ir->raw->enabled_protocols = ~0; | ||
270 | rc = kfifo_alloc(&ir->raw->kfifo, sizeof(s64) * MAX_IR_EVENT_SIZE, | ||
271 | GFP_KERNEL); | ||
272 | if (rc < 0) { | ||
273 | kfree(ir->raw); | ||
274 | ir->raw = NULL; | ||
275 | return rc; | ||
276 | } | ||
277 | |||
278 | ir->raw->thread = kthread_run(ir_raw_event_thread, ir->raw, | ||
279 | "rc%u", (unsigned int)ir->devno); | ||
280 | |||
281 | if (IS_ERR(ir->raw->thread)) { | ||
282 | int ret = PTR_ERR(ir->raw->thread); | ||
283 | |||
284 | kfree(ir->raw); | ||
285 | ir->raw = NULL; | ||
286 | return ret; | ||
287 | } | ||
288 | |||
289 | mutex_lock(&ir_raw_handler_lock); | ||
290 | list_add_tail(&ir->raw->list, &ir_raw_client_list); | ||
291 | list_for_each_entry(handler, &ir_raw_handler_list, list) | ||
292 | if (handler->raw_register) | ||
293 | handler->raw_register(ir->raw->input_dev); | ||
294 | mutex_unlock(&ir_raw_handler_lock); | ||
295 | |||
296 | return 0; | ||
297 | } | ||
298 | |||
299 | void ir_raw_event_unregister(struct input_dev *input_dev) | ||
300 | { | ||
301 | struct ir_input_dev *ir = input_get_drvdata(input_dev); | ||
302 | struct ir_raw_handler *handler; | ||
303 | |||
304 | if (!ir->raw) | ||
305 | return; | ||
306 | |||
307 | kthread_stop(ir->raw->thread); | ||
308 | |||
309 | mutex_lock(&ir_raw_handler_lock); | ||
310 | list_del(&ir->raw->list); | ||
311 | list_for_each_entry(handler, &ir_raw_handler_list, list) | ||
312 | if (handler->raw_unregister) | ||
313 | handler->raw_unregister(ir->raw->input_dev); | ||
314 | mutex_unlock(&ir_raw_handler_lock); | ||
315 | |||
316 | kfifo_free(&ir->raw->kfifo); | ||
317 | kfree(ir->raw); | ||
318 | ir->raw = NULL; | ||
319 | } | ||
320 | |||
321 | /* | ||
322 | * Extension interface - used to register the IR decoders | ||
323 | */ | ||
324 | |||
325 | int ir_raw_handler_register(struct ir_raw_handler *ir_raw_handler) | ||
326 | { | ||
327 | struct ir_raw_event_ctrl *raw; | ||
328 | |||
329 | mutex_lock(&ir_raw_handler_lock); | ||
330 | list_add_tail(&ir_raw_handler->list, &ir_raw_handler_list); | ||
331 | if (ir_raw_handler->raw_register) | ||
332 | list_for_each_entry(raw, &ir_raw_client_list, list) | ||
333 | ir_raw_handler->raw_register(raw->input_dev); | ||
334 | available_protocols |= ir_raw_handler->protocols; | ||
335 | mutex_unlock(&ir_raw_handler_lock); | ||
336 | |||
337 | return 0; | ||
338 | } | ||
339 | EXPORT_SYMBOL(ir_raw_handler_register); | ||
340 | |||
341 | void ir_raw_handler_unregister(struct ir_raw_handler *ir_raw_handler) | ||
342 | { | ||
343 | struct ir_raw_event_ctrl *raw; | ||
344 | |||
345 | mutex_lock(&ir_raw_handler_lock); | ||
346 | list_del(&ir_raw_handler->list); | ||
347 | if (ir_raw_handler->raw_unregister) | ||
348 | list_for_each_entry(raw, &ir_raw_client_list, list) | ||
349 | ir_raw_handler->raw_unregister(raw->input_dev); | ||
350 | available_protocols &= ~ir_raw_handler->protocols; | ||
351 | mutex_unlock(&ir_raw_handler_lock); | ||
352 | } | ||
353 | EXPORT_SYMBOL(ir_raw_handler_unregister); | ||
354 | |||
355 | #ifdef MODULE | ||
356 | static void init_decoders(struct work_struct *work) | ||
357 | { | ||
358 | /* Load the decoder modules */ | ||
359 | |||
360 | load_nec_decode(); | ||
361 | load_rc5_decode(); | ||
362 | load_rc6_decode(); | ||
363 | load_jvc_decode(); | ||
364 | load_sony_decode(); | ||
365 | load_lirc_codec(); | ||
366 | |||
367 | /* If needed, we may later add some init code. In this case, | ||
368 | it is needed to change the CONFIG_MODULE test at ir-core.h | ||
369 | */ | ||
370 | } | ||
371 | #endif | ||
372 | |||
373 | void ir_raw_init(void) | ||
374 | { | ||
375 | #ifdef MODULE | ||
376 | INIT_WORK(&wq_load, init_decoders); | ||
377 | schedule_work(&wq_load); | ||
378 | #endif | ||
379 | } | ||
diff --git a/drivers/media/IR/ir-rc5-decoder.c b/drivers/media/IR/ir-rc5-decoder.c deleted file mode 100644 index df4770d978ad..000000000000 --- a/drivers/media/IR/ir-rc5-decoder.c +++ /dev/null | |||
@@ -1,189 +0,0 @@ | |||
1 | /* ir-rc5-decoder.c - handle RC5(x) IR Pulse/Space protocol | ||
2 | * | ||
3 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | /* | ||
16 | * This code handles 14 bits RC5 protocols and 20 bits RC5x protocols. | ||
17 | * There are other variants that use a different number of bits. | ||
18 | * This is currently unsupported. | ||
19 | * It considers a carrier of 36 kHz, with a total of 14/20 bits, where | ||
20 | * the first two bits are start bits, and a third one is a filing bit | ||
21 | */ | ||
22 | |||
23 | #include "ir-core-priv.h" | ||
24 | |||
25 | #define RC5_NBITS 14 | ||
26 | #define RC5X_NBITS 20 | ||
27 | #define CHECK_RC5X_NBITS 8 | ||
28 | #define RC5_UNIT 888888 /* ns */ | ||
29 | #define RC5_BIT_START (1 * RC5_UNIT) | ||
30 | #define RC5_BIT_END (1 * RC5_UNIT) | ||
31 | #define RC5X_SPACE (4 * RC5_UNIT) | ||
32 | |||
33 | enum rc5_state { | ||
34 | STATE_INACTIVE, | ||
35 | STATE_BIT_START, | ||
36 | STATE_BIT_END, | ||
37 | STATE_CHECK_RC5X, | ||
38 | STATE_FINISHED, | ||
39 | }; | ||
40 | |||
41 | /** | ||
42 | * ir_rc5_decode() - Decode one RC-5 pulse or space | ||
43 | * @input_dev: the struct input_dev descriptor of the device | ||
44 | * @ev: the struct ir_raw_event descriptor of the pulse/space | ||
45 | * | ||
46 | * This function returns -EINVAL if the pulse violates the state machine | ||
47 | */ | ||
48 | static int ir_rc5_decode(struct input_dev *input_dev, struct ir_raw_event ev) | ||
49 | { | ||
50 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
51 | struct rc5_dec *data = &ir_dev->raw->rc5; | ||
52 | u8 toggle; | ||
53 | u32 scancode; | ||
54 | |||
55 | if (!(ir_dev->raw->enabled_protocols & IR_TYPE_RC5)) | ||
56 | return 0; | ||
57 | |||
58 | if (IS_RESET(ev)) { | ||
59 | data->state = STATE_INACTIVE; | ||
60 | return 0; | ||
61 | } | ||
62 | |||
63 | if (!geq_margin(ev.duration, RC5_UNIT, RC5_UNIT / 2)) | ||
64 | goto out; | ||
65 | |||
66 | again: | ||
67 | IR_dprintk(2, "RC5(x) decode started at state %i (%uus %s)\n", | ||
68 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
69 | |||
70 | if (!geq_margin(ev.duration, RC5_UNIT, RC5_UNIT / 2)) | ||
71 | return 0; | ||
72 | |||
73 | switch (data->state) { | ||
74 | |||
75 | case STATE_INACTIVE: | ||
76 | if (!ev.pulse) | ||
77 | break; | ||
78 | |||
79 | data->state = STATE_BIT_START; | ||
80 | data->count = 1; | ||
81 | /* We just need enough bits to get to STATE_CHECK_RC5X */ | ||
82 | data->wanted_bits = RC5X_NBITS; | ||
83 | decrease_duration(&ev, RC5_BIT_START); | ||
84 | goto again; | ||
85 | |||
86 | case STATE_BIT_START: | ||
87 | if (!eq_margin(ev.duration, RC5_BIT_START, RC5_UNIT / 2)) | ||
88 | break; | ||
89 | |||
90 | data->bits <<= 1; | ||
91 | if (!ev.pulse) | ||
92 | data->bits |= 1; | ||
93 | data->count++; | ||
94 | data->state = STATE_BIT_END; | ||
95 | return 0; | ||
96 | |||
97 | case STATE_BIT_END: | ||
98 | if (!is_transition(&ev, &ir_dev->raw->prev_ev)) | ||
99 | break; | ||
100 | |||
101 | if (data->count == data->wanted_bits) | ||
102 | data->state = STATE_FINISHED; | ||
103 | else if (data->count == CHECK_RC5X_NBITS) | ||
104 | data->state = STATE_CHECK_RC5X; | ||
105 | else | ||
106 | data->state = STATE_BIT_START; | ||
107 | |||
108 | decrease_duration(&ev, RC5_BIT_END); | ||
109 | goto again; | ||
110 | |||
111 | case STATE_CHECK_RC5X: | ||
112 | if (!ev.pulse && geq_margin(ev.duration, RC5X_SPACE, RC5_UNIT / 2)) { | ||
113 | /* RC5X */ | ||
114 | data->wanted_bits = RC5X_NBITS; | ||
115 | decrease_duration(&ev, RC5X_SPACE); | ||
116 | } else { | ||
117 | /* RC5 */ | ||
118 | data->wanted_bits = RC5_NBITS; | ||
119 | } | ||
120 | data->state = STATE_BIT_START; | ||
121 | goto again; | ||
122 | |||
123 | case STATE_FINISHED: | ||
124 | if (ev.pulse) | ||
125 | break; | ||
126 | |||
127 | if (data->wanted_bits == RC5X_NBITS) { | ||
128 | /* RC5X */ | ||
129 | u8 xdata, command, system; | ||
130 | xdata = (data->bits & 0x0003F) >> 0; | ||
131 | command = (data->bits & 0x00FC0) >> 6; | ||
132 | system = (data->bits & 0x1F000) >> 12; | ||
133 | toggle = (data->bits & 0x20000) ? 1 : 0; | ||
134 | command += (data->bits & 0x01000) ? 0 : 0x40; | ||
135 | scancode = system << 16 | command << 8 | xdata; | ||
136 | |||
137 | IR_dprintk(1, "RC5X scancode 0x%06x (toggle: %u)\n", | ||
138 | scancode, toggle); | ||
139 | |||
140 | } else { | ||
141 | /* RC5 */ | ||
142 | u8 command, system; | ||
143 | command = (data->bits & 0x0003F) >> 0; | ||
144 | system = (data->bits & 0x007C0) >> 6; | ||
145 | toggle = (data->bits & 0x00800) ? 1 : 0; | ||
146 | command += (data->bits & 0x01000) ? 0 : 0x40; | ||
147 | scancode = system << 8 | command; | ||
148 | |||
149 | IR_dprintk(1, "RC5 scancode 0x%04x (toggle: %u)\n", | ||
150 | scancode, toggle); | ||
151 | } | ||
152 | |||
153 | ir_keydown(input_dev, scancode, toggle); | ||
154 | data->state = STATE_INACTIVE; | ||
155 | return 0; | ||
156 | } | ||
157 | |||
158 | out: | ||
159 | IR_dprintk(1, "RC5(x) decode failed at state %i (%uus %s)\n", | ||
160 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
161 | data->state = STATE_INACTIVE; | ||
162 | return -EINVAL; | ||
163 | } | ||
164 | |||
165 | static struct ir_raw_handler rc5_handler = { | ||
166 | .protocols = IR_TYPE_RC5, | ||
167 | .decode = ir_rc5_decode, | ||
168 | }; | ||
169 | |||
170 | static int __init ir_rc5_decode_init(void) | ||
171 | { | ||
172 | ir_raw_handler_register(&rc5_handler); | ||
173 | |||
174 | printk(KERN_INFO "IR RC5(x) protocol handler initialized\n"); | ||
175 | return 0; | ||
176 | } | ||
177 | |||
178 | static void __exit ir_rc5_decode_exit(void) | ||
179 | { | ||
180 | ir_raw_handler_unregister(&rc5_handler); | ||
181 | } | ||
182 | |||
183 | module_init(ir_rc5_decode_init); | ||
184 | module_exit(ir_rc5_decode_exit); | ||
185 | |||
186 | MODULE_LICENSE("GPL"); | ||
187 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
188 | MODULE_AUTHOR("Red Hat Inc. (http://www.redhat.com)"); | ||
189 | MODULE_DESCRIPTION("RC5(x) IR protocol decoder"); | ||
diff --git a/drivers/media/IR/ir-rc6-decoder.c b/drivers/media/IR/ir-rc6-decoder.c deleted file mode 100644 index f1624b8279bc..000000000000 --- a/drivers/media/IR/ir-rc6-decoder.c +++ /dev/null | |||
@@ -1,280 +0,0 @@ | |||
1 | /* ir-rc6-decoder.c - A decoder for the RC6 IR protocol | ||
2 | * | ||
3 | * Copyright (C) 2010 by David Härdeman <david@hardeman.nu> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include "ir-core-priv.h" | ||
16 | |||
17 | /* | ||
18 | * This decoder currently supports: | ||
19 | * RC6-0-16 (standard toggle bit in header) | ||
20 | * RC6-6A-24 (no toggle bit) | ||
21 | * RC6-6A-32 (MCE version with toggle bit in body) | ||
22 | */ | ||
23 | |||
24 | #define RC6_UNIT 444444 /* us */ | ||
25 | #define RC6_HEADER_NBITS 4 /* not including toggle bit */ | ||
26 | #define RC6_0_NBITS 16 | ||
27 | #define RC6_6A_SMALL_NBITS 24 | ||
28 | #define RC6_6A_LARGE_NBITS 32 | ||
29 | #define RC6_PREFIX_PULSE (6 * RC6_UNIT) | ||
30 | #define RC6_PREFIX_SPACE (2 * RC6_UNIT) | ||
31 | #define RC6_BIT_START (1 * RC6_UNIT) | ||
32 | #define RC6_BIT_END (1 * RC6_UNIT) | ||
33 | #define RC6_TOGGLE_START (2 * RC6_UNIT) | ||
34 | #define RC6_TOGGLE_END (2 * RC6_UNIT) | ||
35 | #define RC6_MODE_MASK 0x07 /* for the header bits */ | ||
36 | #define RC6_STARTBIT_MASK 0x08 /* for the header bits */ | ||
37 | #define RC6_6A_MCE_TOGGLE_MASK 0x8000 /* for the body bits */ | ||
38 | |||
39 | enum rc6_mode { | ||
40 | RC6_MODE_0, | ||
41 | RC6_MODE_6A, | ||
42 | RC6_MODE_UNKNOWN, | ||
43 | }; | ||
44 | |||
45 | enum rc6_state { | ||
46 | STATE_INACTIVE, | ||
47 | STATE_PREFIX_SPACE, | ||
48 | STATE_HEADER_BIT_START, | ||
49 | STATE_HEADER_BIT_END, | ||
50 | STATE_TOGGLE_START, | ||
51 | STATE_TOGGLE_END, | ||
52 | STATE_BODY_BIT_START, | ||
53 | STATE_BODY_BIT_END, | ||
54 | STATE_FINISHED, | ||
55 | }; | ||
56 | |||
57 | static enum rc6_mode rc6_mode(struct rc6_dec *data) | ||
58 | { | ||
59 | switch (data->header & RC6_MODE_MASK) { | ||
60 | case 0: | ||
61 | return RC6_MODE_0; | ||
62 | case 6: | ||
63 | if (!data->toggle) | ||
64 | return RC6_MODE_6A; | ||
65 | /* fall through */ | ||
66 | default: | ||
67 | return RC6_MODE_UNKNOWN; | ||
68 | } | ||
69 | } | ||
70 | |||
71 | /** | ||
72 | * ir_rc6_decode() - Decode one RC6 pulse or space | ||
73 | * @input_dev: the struct input_dev descriptor of the device | ||
74 | * @ev: the struct ir_raw_event descriptor of the pulse/space | ||
75 | * | ||
76 | * This function returns -EINVAL if the pulse violates the state machine | ||
77 | */ | ||
78 | static int ir_rc6_decode(struct input_dev *input_dev, struct ir_raw_event ev) | ||
79 | { | ||
80 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
81 | struct rc6_dec *data = &ir_dev->raw->rc6; | ||
82 | u32 scancode; | ||
83 | u8 toggle; | ||
84 | |||
85 | if (!(ir_dev->raw->enabled_protocols & IR_TYPE_RC6)) | ||
86 | return 0; | ||
87 | |||
88 | if (IS_RESET(ev)) { | ||
89 | data->state = STATE_INACTIVE; | ||
90 | return 0; | ||
91 | } | ||
92 | |||
93 | if (!geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) | ||
94 | goto out; | ||
95 | |||
96 | again: | ||
97 | IR_dprintk(2, "RC6 decode started at state %i (%uus %s)\n", | ||
98 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
99 | |||
100 | if (!geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) | ||
101 | return 0; | ||
102 | |||
103 | switch (data->state) { | ||
104 | |||
105 | case STATE_INACTIVE: | ||
106 | if (!ev.pulse) | ||
107 | break; | ||
108 | |||
109 | /* Note: larger margin on first pulse since each RC6_UNIT | ||
110 | is quite short and some hardware takes some time to | ||
111 | adjust to the signal */ | ||
112 | if (!eq_margin(ev.duration, RC6_PREFIX_PULSE, RC6_UNIT)) | ||
113 | break; | ||
114 | |||
115 | data->state = STATE_PREFIX_SPACE; | ||
116 | data->count = 0; | ||
117 | return 0; | ||
118 | |||
119 | case STATE_PREFIX_SPACE: | ||
120 | if (ev.pulse) | ||
121 | break; | ||
122 | |||
123 | if (!eq_margin(ev.duration, RC6_PREFIX_SPACE, RC6_UNIT / 2)) | ||
124 | break; | ||
125 | |||
126 | data->state = STATE_HEADER_BIT_START; | ||
127 | return 0; | ||
128 | |||
129 | case STATE_HEADER_BIT_START: | ||
130 | if (!eq_margin(ev.duration, RC6_BIT_START, RC6_UNIT / 2)) | ||
131 | break; | ||
132 | |||
133 | data->header <<= 1; | ||
134 | if (ev.pulse) | ||
135 | data->header |= 1; | ||
136 | data->count++; | ||
137 | data->state = STATE_HEADER_BIT_END; | ||
138 | return 0; | ||
139 | |||
140 | case STATE_HEADER_BIT_END: | ||
141 | if (!is_transition(&ev, &ir_dev->raw->prev_ev)) | ||
142 | break; | ||
143 | |||
144 | if (data->count == RC6_HEADER_NBITS) | ||
145 | data->state = STATE_TOGGLE_START; | ||
146 | else | ||
147 | data->state = STATE_HEADER_BIT_START; | ||
148 | |||
149 | decrease_duration(&ev, RC6_BIT_END); | ||
150 | goto again; | ||
151 | |||
152 | case STATE_TOGGLE_START: | ||
153 | if (!eq_margin(ev.duration, RC6_TOGGLE_START, RC6_UNIT / 2)) | ||
154 | break; | ||
155 | |||
156 | data->toggle = ev.pulse; | ||
157 | data->state = STATE_TOGGLE_END; | ||
158 | return 0; | ||
159 | |||
160 | case STATE_TOGGLE_END: | ||
161 | if (!is_transition(&ev, &ir_dev->raw->prev_ev) || | ||
162 | !geq_margin(ev.duration, RC6_TOGGLE_END, RC6_UNIT / 2)) | ||
163 | break; | ||
164 | |||
165 | if (!(data->header & RC6_STARTBIT_MASK)) { | ||
166 | IR_dprintk(1, "RC6 invalid start bit\n"); | ||
167 | break; | ||
168 | } | ||
169 | |||
170 | data->state = STATE_BODY_BIT_START; | ||
171 | decrease_duration(&ev, RC6_TOGGLE_END); | ||
172 | data->count = 0; | ||
173 | |||
174 | switch (rc6_mode(data)) { | ||
175 | case RC6_MODE_0: | ||
176 | data->wanted_bits = RC6_0_NBITS; | ||
177 | break; | ||
178 | case RC6_MODE_6A: | ||
179 | /* This might look weird, but we basically | ||
180 | check the value of the first body bit to | ||
181 | determine the number of bits in mode 6A */ | ||
182 | if ((!ev.pulse && !geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) || | ||
183 | geq_margin(ev.duration, RC6_UNIT, RC6_UNIT / 2)) | ||
184 | data->wanted_bits = RC6_6A_LARGE_NBITS; | ||
185 | else | ||
186 | data->wanted_bits = RC6_6A_SMALL_NBITS; | ||
187 | break; | ||
188 | default: | ||
189 | IR_dprintk(1, "RC6 unknown mode\n"); | ||
190 | goto out; | ||
191 | } | ||
192 | goto again; | ||
193 | |||
194 | case STATE_BODY_BIT_START: | ||
195 | if (!eq_margin(ev.duration, RC6_BIT_START, RC6_UNIT / 2)) | ||
196 | break; | ||
197 | |||
198 | data->body <<= 1; | ||
199 | if (ev.pulse) | ||
200 | data->body |= 1; | ||
201 | data->count++; | ||
202 | data->state = STATE_BODY_BIT_END; | ||
203 | return 0; | ||
204 | |||
205 | case STATE_BODY_BIT_END: | ||
206 | if (!is_transition(&ev, &ir_dev->raw->prev_ev)) | ||
207 | break; | ||
208 | |||
209 | if (data->count == data->wanted_bits) | ||
210 | data->state = STATE_FINISHED; | ||
211 | else | ||
212 | data->state = STATE_BODY_BIT_START; | ||
213 | |||
214 | decrease_duration(&ev, RC6_BIT_END); | ||
215 | goto again; | ||
216 | |||
217 | case STATE_FINISHED: | ||
218 | if (ev.pulse) | ||
219 | break; | ||
220 | |||
221 | switch (rc6_mode(data)) { | ||
222 | case RC6_MODE_0: | ||
223 | scancode = data->body & 0xffff; | ||
224 | toggle = data->toggle; | ||
225 | IR_dprintk(1, "RC6(0) scancode 0x%04x (toggle: %u)\n", | ||
226 | scancode, toggle); | ||
227 | break; | ||
228 | case RC6_MODE_6A: | ||
229 | if (data->wanted_bits == RC6_6A_LARGE_NBITS) { | ||
230 | toggle = data->body & RC6_6A_MCE_TOGGLE_MASK ? 1 : 0; | ||
231 | scancode = data->body & ~RC6_6A_MCE_TOGGLE_MASK; | ||
232 | } else { | ||
233 | toggle = 0; | ||
234 | scancode = data->body & 0xffffff; | ||
235 | } | ||
236 | |||
237 | IR_dprintk(1, "RC6(6A) scancode 0x%08x (toggle: %u)\n", | ||
238 | scancode, toggle); | ||
239 | break; | ||
240 | default: | ||
241 | IR_dprintk(1, "RC6 unknown mode\n"); | ||
242 | goto out; | ||
243 | } | ||
244 | |||
245 | ir_keydown(input_dev, scancode, toggle); | ||
246 | data->state = STATE_INACTIVE; | ||
247 | return 0; | ||
248 | } | ||
249 | |||
250 | out: | ||
251 | IR_dprintk(1, "RC6 decode failed at state %i (%uus %s)\n", | ||
252 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
253 | data->state = STATE_INACTIVE; | ||
254 | return -EINVAL; | ||
255 | } | ||
256 | |||
257 | static struct ir_raw_handler rc6_handler = { | ||
258 | .protocols = IR_TYPE_RC6, | ||
259 | .decode = ir_rc6_decode, | ||
260 | }; | ||
261 | |||
262 | static int __init ir_rc6_decode_init(void) | ||
263 | { | ||
264 | ir_raw_handler_register(&rc6_handler); | ||
265 | |||
266 | printk(KERN_INFO "IR RC6 protocol handler initialized\n"); | ||
267 | return 0; | ||
268 | } | ||
269 | |||
270 | static void __exit ir_rc6_decode_exit(void) | ||
271 | { | ||
272 | ir_raw_handler_unregister(&rc6_handler); | ||
273 | } | ||
274 | |||
275 | module_init(ir_rc6_decode_init); | ||
276 | module_exit(ir_rc6_decode_exit); | ||
277 | |||
278 | MODULE_LICENSE("GPL"); | ||
279 | MODULE_AUTHOR("David Härdeman <david@hardeman.nu>"); | ||
280 | MODULE_DESCRIPTION("RC6 IR protocol decoder"); | ||
diff --git a/drivers/media/IR/ir-sony-decoder.c b/drivers/media/IR/ir-sony-decoder.c deleted file mode 100644 index b9074f07c7a0..000000000000 --- a/drivers/media/IR/ir-sony-decoder.c +++ /dev/null | |||
@@ -1,181 +0,0 @@ | |||
1 | /* ir-sony-decoder.c - handle Sony IR Pulse/Space protocol | ||
2 | * | ||
3 | * Copyright (C) 2010 by David Härdeman <david@hardeman.nu> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/bitrev.h> | ||
16 | #include "ir-core-priv.h" | ||
17 | |||
18 | #define SONY_UNIT 600000 /* ns */ | ||
19 | #define SONY_HEADER_PULSE (4 * SONY_UNIT) | ||
20 | #define SONY_HEADER_SPACE (1 * SONY_UNIT) | ||
21 | #define SONY_BIT_0_PULSE (1 * SONY_UNIT) | ||
22 | #define SONY_BIT_1_PULSE (2 * SONY_UNIT) | ||
23 | #define SONY_BIT_SPACE (1 * SONY_UNIT) | ||
24 | #define SONY_TRAILER_SPACE (10 * SONY_UNIT) /* minimum */ | ||
25 | |||
26 | enum sony_state { | ||
27 | STATE_INACTIVE, | ||
28 | STATE_HEADER_SPACE, | ||
29 | STATE_BIT_PULSE, | ||
30 | STATE_BIT_SPACE, | ||
31 | STATE_FINISHED, | ||
32 | }; | ||
33 | |||
34 | /** | ||
35 | * ir_sony_decode() - Decode one Sony pulse or space | ||
36 | * @input_dev: the struct input_dev descriptor of the device | ||
37 | * @ev: the struct ir_raw_event descriptor of the pulse/space | ||
38 | * | ||
39 | * This function returns -EINVAL if the pulse violates the state machine | ||
40 | */ | ||
41 | static int ir_sony_decode(struct input_dev *input_dev, struct ir_raw_event ev) | ||
42 | { | ||
43 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
44 | struct sony_dec *data = &ir_dev->raw->sony; | ||
45 | u32 scancode; | ||
46 | u8 device, subdevice, function; | ||
47 | |||
48 | if (!(ir_dev->raw->enabled_protocols & IR_TYPE_SONY)) | ||
49 | return 0; | ||
50 | |||
51 | if (IS_RESET(ev)) { | ||
52 | data->state = STATE_INACTIVE; | ||
53 | return 0; | ||
54 | } | ||
55 | |||
56 | if (!geq_margin(ev.duration, SONY_UNIT, SONY_UNIT / 2)) | ||
57 | goto out; | ||
58 | |||
59 | IR_dprintk(2, "Sony decode started at state %d (%uus %s)\n", | ||
60 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
61 | |||
62 | switch (data->state) { | ||
63 | |||
64 | case STATE_INACTIVE: | ||
65 | if (!ev.pulse) | ||
66 | break; | ||
67 | |||
68 | if (!eq_margin(ev.duration, SONY_HEADER_PULSE, SONY_UNIT / 2)) | ||
69 | break; | ||
70 | |||
71 | data->count = 0; | ||
72 | data->state = STATE_HEADER_SPACE; | ||
73 | return 0; | ||
74 | |||
75 | case STATE_HEADER_SPACE: | ||
76 | if (ev.pulse) | ||
77 | break; | ||
78 | |||
79 | if (!eq_margin(ev.duration, SONY_HEADER_SPACE, SONY_UNIT / 2)) | ||
80 | break; | ||
81 | |||
82 | data->state = STATE_BIT_PULSE; | ||
83 | return 0; | ||
84 | |||
85 | case STATE_BIT_PULSE: | ||
86 | if (!ev.pulse) | ||
87 | break; | ||
88 | |||
89 | data->bits <<= 1; | ||
90 | if (eq_margin(ev.duration, SONY_BIT_1_PULSE, SONY_UNIT / 2)) | ||
91 | data->bits |= 1; | ||
92 | else if (!eq_margin(ev.duration, SONY_BIT_0_PULSE, SONY_UNIT / 2)) | ||
93 | break; | ||
94 | |||
95 | data->count++; | ||
96 | data->state = STATE_BIT_SPACE; | ||
97 | return 0; | ||
98 | |||
99 | case STATE_BIT_SPACE: | ||
100 | if (ev.pulse) | ||
101 | break; | ||
102 | |||
103 | if (!geq_margin(ev.duration, SONY_BIT_SPACE, SONY_UNIT / 2)) | ||
104 | break; | ||
105 | |||
106 | decrease_duration(&ev, SONY_BIT_SPACE); | ||
107 | |||
108 | if (!geq_margin(ev.duration, SONY_UNIT, SONY_UNIT / 2)) { | ||
109 | data->state = STATE_BIT_PULSE; | ||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | data->state = STATE_FINISHED; | ||
114 | /* Fall through */ | ||
115 | |||
116 | case STATE_FINISHED: | ||
117 | if (ev.pulse) | ||
118 | break; | ||
119 | |||
120 | if (!geq_margin(ev.duration, SONY_TRAILER_SPACE, SONY_UNIT / 2)) | ||
121 | break; | ||
122 | |||
123 | switch (data->count) { | ||
124 | case 12: | ||
125 | device = bitrev8((data->bits << 3) & 0xF8); | ||
126 | subdevice = 0; | ||
127 | function = bitrev8((data->bits >> 4) & 0xFE); | ||
128 | break; | ||
129 | case 15: | ||
130 | device = bitrev8((data->bits >> 0) & 0xFF); | ||
131 | subdevice = 0; | ||
132 | function = bitrev8((data->bits >> 7) & 0xFD); | ||
133 | break; | ||
134 | case 20: | ||
135 | device = bitrev8((data->bits >> 5) & 0xF8); | ||
136 | subdevice = bitrev8((data->bits >> 0) & 0xFF); | ||
137 | function = bitrev8((data->bits >> 12) & 0xFE); | ||
138 | break; | ||
139 | default: | ||
140 | IR_dprintk(1, "Sony invalid bitcount %u\n", data->count); | ||
141 | goto out; | ||
142 | } | ||
143 | |||
144 | scancode = device << 16 | subdevice << 8 | function; | ||
145 | IR_dprintk(1, "Sony(%u) scancode 0x%05x\n", data->count, scancode); | ||
146 | ir_keydown(input_dev, scancode, 0); | ||
147 | data->state = STATE_INACTIVE; | ||
148 | return 0; | ||
149 | } | ||
150 | |||
151 | out: | ||
152 | IR_dprintk(1, "Sony decode failed at state %d (%uus %s)\n", | ||
153 | data->state, TO_US(ev.duration), TO_STR(ev.pulse)); | ||
154 | data->state = STATE_INACTIVE; | ||
155 | return -EINVAL; | ||
156 | } | ||
157 | |||
158 | static struct ir_raw_handler sony_handler = { | ||
159 | .protocols = IR_TYPE_SONY, | ||
160 | .decode = ir_sony_decode, | ||
161 | }; | ||
162 | |||
163 | static int __init ir_sony_decode_init(void) | ||
164 | { | ||
165 | ir_raw_handler_register(&sony_handler); | ||
166 | |||
167 | printk(KERN_INFO "IR Sony protocol handler initialized\n"); | ||
168 | return 0; | ||
169 | } | ||
170 | |||
171 | static void __exit ir_sony_decode_exit(void) | ||
172 | { | ||
173 | ir_raw_handler_unregister(&sony_handler); | ||
174 | } | ||
175 | |||
176 | module_init(ir_sony_decode_init); | ||
177 | module_exit(ir_sony_decode_exit); | ||
178 | |||
179 | MODULE_LICENSE("GPL"); | ||
180 | MODULE_AUTHOR("David Härdeman <david@hardeman.nu>"); | ||
181 | MODULE_DESCRIPTION("Sony IR protocol decoder"); | ||
diff --git a/drivers/media/IR/ir-sysfs.c b/drivers/media/IR/ir-sysfs.c deleted file mode 100644 index 46d42467f9b4..000000000000 --- a/drivers/media/IR/ir-sysfs.c +++ /dev/null | |||
@@ -1,345 +0,0 @@ | |||
1 | /* ir-sysfs.c - sysfs interface for RC devices (/sys/class/rc) | ||
2 | * | ||
3 | * Copyright (C) 2009-2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <linux/slab.h> | ||
16 | #include <linux/input.h> | ||
17 | #include <linux/device.h> | ||
18 | #include "ir-core-priv.h" | ||
19 | |||
20 | #define IRRCV_NUM_DEVICES 256 | ||
21 | |||
22 | /* bit array to represent IR sysfs device number */ | ||
23 | static unsigned long ir_core_dev_number; | ||
24 | |||
25 | /* class for /sys/class/rc */ | ||
26 | static char *ir_devnode(struct device *dev, mode_t *mode) | ||
27 | { | ||
28 | return kasprintf(GFP_KERNEL, "rc/%s", dev_name(dev)); | ||
29 | } | ||
30 | |||
31 | static struct class ir_input_class = { | ||
32 | .name = "rc", | ||
33 | .devnode = ir_devnode, | ||
34 | }; | ||
35 | |||
36 | static struct { | ||
37 | u64 type; | ||
38 | char *name; | ||
39 | } proto_names[] = { | ||
40 | { IR_TYPE_UNKNOWN, "unknown" }, | ||
41 | { IR_TYPE_RC5, "rc-5" }, | ||
42 | { IR_TYPE_NEC, "nec" }, | ||
43 | { IR_TYPE_RC6, "rc-6" }, | ||
44 | { IR_TYPE_JVC, "jvc" }, | ||
45 | { IR_TYPE_SONY, "sony" }, | ||
46 | { IR_TYPE_LIRC, "lirc" }, | ||
47 | }; | ||
48 | |||
49 | #define PROTO_NONE "none" | ||
50 | |||
51 | /** | ||
52 | * show_protocols() - shows the current IR protocol(s) | ||
53 | * @d: the device descriptor | ||
54 | * @mattr: the device attribute struct (unused) | ||
55 | * @buf: a pointer to the output buffer | ||
56 | * | ||
57 | * This routine is a callback routine for input read the IR protocol type(s). | ||
58 | * it is trigged by reading /sys/class/rc/rc?/protocols. | ||
59 | * It returns the protocol names of supported protocols. | ||
60 | * Enabled protocols are printed in brackets. | ||
61 | */ | ||
62 | static ssize_t show_protocols(struct device *d, | ||
63 | struct device_attribute *mattr, char *buf) | ||
64 | { | ||
65 | struct ir_input_dev *ir_dev = dev_get_drvdata(d); | ||
66 | u64 allowed, enabled; | ||
67 | char *tmp = buf; | ||
68 | int i; | ||
69 | |||
70 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { | ||
71 | enabled = ir_dev->rc_tab.ir_type; | ||
72 | allowed = ir_dev->props->allowed_protos; | ||
73 | } else if (ir_dev->raw) { | ||
74 | enabled = ir_dev->raw->enabled_protocols; | ||
75 | allowed = ir_raw_get_allowed_protocols(); | ||
76 | } else | ||
77 | return sprintf(tmp, "[builtin]\n"); | ||
78 | |||
79 | IR_dprintk(1, "allowed - 0x%llx, enabled - 0x%llx\n", | ||
80 | (long long)allowed, | ||
81 | (long long)enabled); | ||
82 | |||
83 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { | ||
84 | if (allowed & enabled & proto_names[i].type) | ||
85 | tmp += sprintf(tmp, "[%s] ", proto_names[i].name); | ||
86 | else if (allowed & proto_names[i].type) | ||
87 | tmp += sprintf(tmp, "%s ", proto_names[i].name); | ||
88 | } | ||
89 | |||
90 | if (tmp != buf) | ||
91 | tmp--; | ||
92 | *tmp = '\n'; | ||
93 | return tmp + 1 - buf; | ||
94 | } | ||
95 | |||
96 | /** | ||
97 | * store_protocols() - changes the current IR protocol(s) | ||
98 | * @d: the device descriptor | ||
99 | * @mattr: the device attribute struct (unused) | ||
100 | * @buf: a pointer to the input buffer | ||
101 | * @len: length of the input buffer | ||
102 | * | ||
103 | * This routine is a callback routine for changing the IR protocol type. | ||
104 | * It is trigged by writing to /sys/class/rc/rc?/protocols. | ||
105 | * Writing "+proto" will add a protocol to the list of enabled protocols. | ||
106 | * Writing "-proto" will remove a protocol from the list of enabled protocols. | ||
107 | * Writing "proto" will enable only "proto". | ||
108 | * Writing "none" will disable all protocols. | ||
109 | * Returns -EINVAL if an invalid protocol combination or unknown protocol name | ||
110 | * is used, otherwise @len. | ||
111 | */ | ||
112 | static ssize_t store_protocols(struct device *d, | ||
113 | struct device_attribute *mattr, | ||
114 | const char *data, | ||
115 | size_t len) | ||
116 | { | ||
117 | struct ir_input_dev *ir_dev = dev_get_drvdata(d); | ||
118 | bool enable, disable; | ||
119 | const char *tmp; | ||
120 | u64 type; | ||
121 | u64 mask; | ||
122 | int rc, i, count = 0; | ||
123 | unsigned long flags; | ||
124 | |||
125 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) | ||
126 | type = ir_dev->rc_tab.ir_type; | ||
127 | else if (ir_dev->raw) | ||
128 | type = ir_dev->raw->enabled_protocols; | ||
129 | else { | ||
130 | IR_dprintk(1, "Protocol switching not supported\n"); | ||
131 | return -EINVAL; | ||
132 | } | ||
133 | |||
134 | while ((tmp = strsep((char **) &data, " \n")) != NULL) { | ||
135 | if (!*tmp) | ||
136 | break; | ||
137 | |||
138 | if (*tmp == '+') { | ||
139 | enable = true; | ||
140 | disable = false; | ||
141 | tmp++; | ||
142 | } else if (*tmp == '-') { | ||
143 | enable = false; | ||
144 | disable = true; | ||
145 | tmp++; | ||
146 | } else { | ||
147 | enable = false; | ||
148 | disable = false; | ||
149 | } | ||
150 | |||
151 | if (!enable && !disable && !strncasecmp(tmp, PROTO_NONE, sizeof(PROTO_NONE))) { | ||
152 | tmp += sizeof(PROTO_NONE); | ||
153 | mask = 0; | ||
154 | count++; | ||
155 | } else { | ||
156 | for (i = 0; i < ARRAY_SIZE(proto_names); i++) { | ||
157 | if (!strncasecmp(tmp, proto_names[i].name, strlen(proto_names[i].name))) { | ||
158 | tmp += strlen(proto_names[i].name); | ||
159 | mask = proto_names[i].type; | ||
160 | break; | ||
161 | } | ||
162 | } | ||
163 | if (i == ARRAY_SIZE(proto_names)) { | ||
164 | IR_dprintk(1, "Unknown protocol: '%s'\n", tmp); | ||
165 | return -EINVAL; | ||
166 | } | ||
167 | count++; | ||
168 | } | ||
169 | |||
170 | if (enable) | ||
171 | type |= mask; | ||
172 | else if (disable) | ||
173 | type &= ~mask; | ||
174 | else | ||
175 | type = mask; | ||
176 | } | ||
177 | |||
178 | if (!count) { | ||
179 | IR_dprintk(1, "Protocol not specified\n"); | ||
180 | return -EINVAL; | ||
181 | } | ||
182 | |||
183 | if (ir_dev->props && ir_dev->props->change_protocol) { | ||
184 | rc = ir_dev->props->change_protocol(ir_dev->props->priv, | ||
185 | type); | ||
186 | if (rc < 0) { | ||
187 | IR_dprintk(1, "Error setting protocols to 0x%llx\n", | ||
188 | (long long)type); | ||
189 | return -EINVAL; | ||
190 | } | ||
191 | } | ||
192 | |||
193 | if (ir_dev->props && ir_dev->props->driver_type == RC_DRIVER_SCANCODE) { | ||
194 | spin_lock_irqsave(&ir_dev->rc_tab.lock, flags); | ||
195 | ir_dev->rc_tab.ir_type = type; | ||
196 | spin_unlock_irqrestore(&ir_dev->rc_tab.lock, flags); | ||
197 | } else { | ||
198 | ir_dev->raw->enabled_protocols = type; | ||
199 | } | ||
200 | |||
201 | IR_dprintk(1, "Current protocol(s): 0x%llx\n", | ||
202 | (long long)type); | ||
203 | |||
204 | return len; | ||
205 | } | ||
206 | |||
207 | #define ADD_HOTPLUG_VAR(fmt, val...) \ | ||
208 | do { \ | ||
209 | int err = add_uevent_var(env, fmt, val); \ | ||
210 | if (err) \ | ||
211 | return err; \ | ||
212 | } while (0) | ||
213 | |||
214 | static int rc_dev_uevent(struct device *device, struct kobj_uevent_env *env) | ||
215 | { | ||
216 | struct ir_input_dev *ir_dev = dev_get_drvdata(device); | ||
217 | |||
218 | if (ir_dev->rc_tab.name) | ||
219 | ADD_HOTPLUG_VAR("NAME=%s", ir_dev->rc_tab.name); | ||
220 | if (ir_dev->driver_name) | ||
221 | ADD_HOTPLUG_VAR("DRV_NAME=%s", ir_dev->driver_name); | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | /* | ||
227 | * Static device attribute struct with the sysfs attributes for IR's | ||
228 | */ | ||
229 | static DEVICE_ATTR(protocols, S_IRUGO | S_IWUSR, | ||
230 | show_protocols, store_protocols); | ||
231 | |||
232 | static struct attribute *rc_dev_attrs[] = { | ||
233 | &dev_attr_protocols.attr, | ||
234 | NULL, | ||
235 | }; | ||
236 | |||
237 | static struct attribute_group rc_dev_attr_grp = { | ||
238 | .attrs = rc_dev_attrs, | ||
239 | }; | ||
240 | |||
241 | static const struct attribute_group *rc_dev_attr_groups[] = { | ||
242 | &rc_dev_attr_grp, | ||
243 | NULL | ||
244 | }; | ||
245 | |||
246 | static struct device_type rc_dev_type = { | ||
247 | .groups = rc_dev_attr_groups, | ||
248 | .uevent = rc_dev_uevent, | ||
249 | }; | ||
250 | |||
251 | /** | ||
252 | * ir_register_class() - creates the sysfs for /sys/class/rc/rc? | ||
253 | * @input_dev: the struct input_dev descriptor of the device | ||
254 | * | ||
255 | * This routine is used to register the syfs code for IR class | ||
256 | */ | ||
257 | int ir_register_class(struct input_dev *input_dev) | ||
258 | { | ||
259 | int rc; | ||
260 | const char *path; | ||
261 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
262 | int devno = find_first_zero_bit(&ir_core_dev_number, | ||
263 | IRRCV_NUM_DEVICES); | ||
264 | |||
265 | if (unlikely(devno < 0)) | ||
266 | return devno; | ||
267 | |||
268 | ir_dev->dev.type = &rc_dev_type; | ||
269 | |||
270 | ir_dev->dev.class = &ir_input_class; | ||
271 | ir_dev->dev.parent = input_dev->dev.parent; | ||
272 | dev_set_name(&ir_dev->dev, "rc%d", devno); | ||
273 | dev_set_drvdata(&ir_dev->dev, ir_dev); | ||
274 | rc = device_register(&ir_dev->dev); | ||
275 | if (rc) | ||
276 | return rc; | ||
277 | |||
278 | |||
279 | input_dev->dev.parent = &ir_dev->dev; | ||
280 | rc = input_register_device(input_dev); | ||
281 | if (rc < 0) { | ||
282 | device_del(&ir_dev->dev); | ||
283 | return rc; | ||
284 | } | ||
285 | |||
286 | __module_get(THIS_MODULE); | ||
287 | |||
288 | path = kobject_get_path(&ir_dev->dev.kobj, GFP_KERNEL); | ||
289 | printk(KERN_INFO "%s: %s as %s\n", | ||
290 | dev_name(&ir_dev->dev), | ||
291 | input_dev->name ? input_dev->name : "Unspecified device", | ||
292 | path ? path : "N/A"); | ||
293 | kfree(path); | ||
294 | |||
295 | ir_dev->devno = devno; | ||
296 | set_bit(devno, &ir_core_dev_number); | ||
297 | |||
298 | return 0; | ||
299 | }; | ||
300 | |||
301 | /** | ||
302 | * ir_unregister_class() - removes the sysfs for sysfs for | ||
303 | * /sys/class/rc/rc? | ||
304 | * @input_dev: the struct input_dev descriptor of the device | ||
305 | * | ||
306 | * This routine is used to unregister the syfs code for IR class | ||
307 | */ | ||
308 | void ir_unregister_class(struct input_dev *input_dev) | ||
309 | { | ||
310 | struct ir_input_dev *ir_dev = input_get_drvdata(input_dev); | ||
311 | |||
312 | clear_bit(ir_dev->devno, &ir_core_dev_number); | ||
313 | input_unregister_device(input_dev); | ||
314 | device_del(&ir_dev->dev); | ||
315 | |||
316 | module_put(THIS_MODULE); | ||
317 | } | ||
318 | |||
319 | /* | ||
320 | * Init/exit code for the module. Basically, creates/removes /sys/class/rc | ||
321 | */ | ||
322 | |||
323 | static int __init ir_core_init(void) | ||
324 | { | ||
325 | int rc = class_register(&ir_input_class); | ||
326 | if (rc) { | ||
327 | printk(KERN_ERR "ir_core: unable to register rc class\n"); | ||
328 | return rc; | ||
329 | } | ||
330 | |||
331 | /* Initialize/load the decoders/keymap code that will be used */ | ||
332 | ir_raw_init(); | ||
333 | ir_rcmap_init(); | ||
334 | |||
335 | return 0; | ||
336 | } | ||
337 | |||
338 | static void __exit ir_core_exit(void) | ||
339 | { | ||
340 | class_unregister(&ir_input_class); | ||
341 | ir_rcmap_cleanup(); | ||
342 | } | ||
343 | |||
344 | module_init(ir_core_init); | ||
345 | module_exit(ir_core_exit); | ||
diff --git a/drivers/media/IR/keymaps/Kconfig b/drivers/media/IR/keymaps/Kconfig deleted file mode 100644 index 14b22f58f823..000000000000 --- a/drivers/media/IR/keymaps/Kconfig +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | config RC_MAP | ||
2 | tristate "Compile Remote Controller keymap modules" | ||
3 | depends on IR_CORE | ||
4 | default y | ||
5 | |||
6 | ---help--- | ||
7 | This option enables the compilation of lots of Remote | ||
8 | Controller tables. They are short tables, but if you | ||
9 | don't use a remote controller, or prefer to load the | ||
10 | tables on userspace, you should disable it. | ||
11 | |||
12 | The ir-keytable program, available at v4l-utils package | ||
13 | provide the tool and the same RC maps for load from | ||
14 | userspace. Its available at | ||
15 | http://git.linuxtv.org/v4l-utils | ||
diff --git a/drivers/media/IR/keymaps/Makefile b/drivers/media/IR/keymaps/Makefile deleted file mode 100644 index 950e5d953c6f..000000000000 --- a/drivers/media/IR/keymaps/Makefile +++ /dev/null | |||
@@ -1,72 +0,0 @@ | |||
1 | obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \ | ||
2 | rc-apac-viewcomp.o \ | ||
3 | rc-asus-pc39.o \ | ||
4 | rc-ati-tv-wonder-hd-600.o \ | ||
5 | rc-avermedia-a16d.o \ | ||
6 | rc-avermedia.o \ | ||
7 | rc-avermedia-cardbus.o \ | ||
8 | rc-avermedia-dvbt.o \ | ||
9 | rc-avermedia-m135a.o \ | ||
10 | rc-avermedia-m733a-rm-k6.o \ | ||
11 | rc-avertv-303.o \ | ||
12 | rc-behold.o \ | ||
13 | rc-behold-columbus.o \ | ||
14 | rc-budget-ci-old.o \ | ||
15 | rc-cinergy-1400.o \ | ||
16 | rc-cinergy.o \ | ||
17 | rc-dib0700-nec.o \ | ||
18 | rc-dib0700-rc5.o \ | ||
19 | rc-dm1105-nec.o \ | ||
20 | rc-dntv-live-dvb-t.o \ | ||
21 | rc-dntv-live-dvbt-pro.o \ | ||
22 | rc-em-terratec.o \ | ||
23 | rc-encore-enltv2.o \ | ||
24 | rc-encore-enltv.o \ | ||
25 | rc-encore-enltv-fm53.o \ | ||
26 | rc-evga-indtube.o \ | ||
27 | rc-eztv.o \ | ||
28 | rc-flydvb.o \ | ||
29 | rc-flyvideo.o \ | ||
30 | rc-fusionhdtv-mce.o \ | ||
31 | rc-gadmei-rm008z.o \ | ||
32 | rc-genius-tvgo-a11mce.o \ | ||
33 | rc-gotview7135.o \ | ||
34 | rc-hauppauge-new.o \ | ||
35 | rc-imon-mce.o \ | ||
36 | rc-imon-pad.o \ | ||
37 | rc-iodata-bctv7e.o \ | ||
38 | rc-kaiomy.o \ | ||
39 | rc-kworld-315u.o \ | ||
40 | rc-kworld-plus-tv-analog.o \ | ||
41 | rc-lirc.o \ | ||
42 | rc-manli.o \ | ||
43 | rc-msi-tvanywhere.o \ | ||
44 | rc-msi-tvanywhere-plus.o \ | ||
45 | rc-nebula.o \ | ||
46 | rc-nec-terratec-cinergy-xs.o \ | ||
47 | rc-norwood.o \ | ||
48 | rc-npgtech.o \ | ||
49 | rc-pctv-sedna.o \ | ||
50 | rc-pinnacle-color.o \ | ||
51 | rc-pinnacle-grey.o \ | ||
52 | rc-pinnacle-pctv-hd.o \ | ||
53 | rc-pixelview.o \ | ||
54 | rc-pixelview-mk12.o \ | ||
55 | rc-pixelview-new.o \ | ||
56 | rc-powercolor-real-angel.o \ | ||
57 | rc-proteus-2309.o \ | ||
58 | rc-purpletv.o \ | ||
59 | rc-pv951.o \ | ||
60 | rc-rc5-hauppauge-new.o \ | ||
61 | rc-rc5-streamzap.o \ | ||
62 | rc-rc5-tv.o \ | ||
63 | rc-rc6-mce.o \ | ||
64 | rc-real-audio-220-32-keys.o \ | ||
65 | rc-tbs-nec.o \ | ||
66 | rc-terratec-cinergy-xs.o \ | ||
67 | rc-tevii-nec.o \ | ||
68 | rc-tt-1500.o \ | ||
69 | rc-videomate-s350.o \ | ||
70 | rc-videomate-tv-pvr.o \ | ||
71 | rc-winfast.o \ | ||
72 | rc-winfast-usbii-deluxe.o | ||
diff --git a/drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c b/drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c deleted file mode 100644 index b17283176ecd..000000000000 --- a/drivers/media/IR/keymaps/rc-adstech-dvb-t-pci.c +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* adstech-dvb-t-pci.h - Keytable for adstech_dvb_t_pci Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* ADS Tech Instant TV DVB-T PCI Remote */ | ||
16 | |||
17 | static struct ir_scancode adstech_dvb_t_pci[] = { | ||
18 | /* Keys 0 to 9 */ | ||
19 | { 0x4d, KEY_0 }, | ||
20 | { 0x57, KEY_1 }, | ||
21 | { 0x4f, KEY_2 }, | ||
22 | { 0x53, KEY_3 }, | ||
23 | { 0x56, KEY_4 }, | ||
24 | { 0x4e, KEY_5 }, | ||
25 | { 0x5e, KEY_6 }, | ||
26 | { 0x54, KEY_7 }, | ||
27 | { 0x4c, KEY_8 }, | ||
28 | { 0x5c, KEY_9 }, | ||
29 | |||
30 | { 0x5b, KEY_POWER }, | ||
31 | { 0x5f, KEY_MUTE }, | ||
32 | { 0x55, KEY_GOTO }, | ||
33 | { 0x5d, KEY_SEARCH }, | ||
34 | { 0x17, KEY_EPG }, /* Guide */ | ||
35 | { 0x1f, KEY_MENU }, | ||
36 | { 0x0f, KEY_UP }, | ||
37 | { 0x46, KEY_DOWN }, | ||
38 | { 0x16, KEY_LEFT }, | ||
39 | { 0x1e, KEY_RIGHT }, | ||
40 | { 0x0e, KEY_SELECT }, /* Enter */ | ||
41 | { 0x5a, KEY_INFO }, | ||
42 | { 0x52, KEY_EXIT }, | ||
43 | { 0x59, KEY_PREVIOUS }, | ||
44 | { 0x51, KEY_NEXT }, | ||
45 | { 0x58, KEY_REWIND }, | ||
46 | { 0x50, KEY_FORWARD }, | ||
47 | { 0x44, KEY_PLAYPAUSE }, | ||
48 | { 0x07, KEY_STOP }, | ||
49 | { 0x1b, KEY_RECORD }, | ||
50 | { 0x13, KEY_TUNER }, /* Live */ | ||
51 | { 0x0a, KEY_A }, | ||
52 | { 0x12, KEY_B }, | ||
53 | { 0x03, KEY_PROG1 }, /* 1 */ | ||
54 | { 0x01, KEY_PROG2 }, /* 2 */ | ||
55 | { 0x00, KEY_PROG3 }, /* 3 */ | ||
56 | { 0x06, KEY_DVD }, | ||
57 | { 0x48, KEY_AUX }, /* Photo */ | ||
58 | { 0x40, KEY_VIDEO }, | ||
59 | { 0x19, KEY_AUDIO }, /* Music */ | ||
60 | { 0x0b, KEY_CHANNELUP }, | ||
61 | { 0x08, KEY_CHANNELDOWN }, | ||
62 | { 0x15, KEY_VOLUMEUP }, | ||
63 | { 0x1c, KEY_VOLUMEDOWN }, | ||
64 | }; | ||
65 | |||
66 | static struct rc_keymap adstech_dvb_t_pci_map = { | ||
67 | .map = { | ||
68 | .scan = adstech_dvb_t_pci, | ||
69 | .size = ARRAY_SIZE(adstech_dvb_t_pci), | ||
70 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
71 | .name = RC_MAP_ADSTECH_DVB_T_PCI, | ||
72 | } | ||
73 | }; | ||
74 | |||
75 | static int __init init_rc_map_adstech_dvb_t_pci(void) | ||
76 | { | ||
77 | return ir_register_map(&adstech_dvb_t_pci_map); | ||
78 | } | ||
79 | |||
80 | static void __exit exit_rc_map_adstech_dvb_t_pci(void) | ||
81 | { | ||
82 | ir_unregister_map(&adstech_dvb_t_pci_map); | ||
83 | } | ||
84 | |||
85 | module_init(init_rc_map_adstech_dvb_t_pci) | ||
86 | module_exit(exit_rc_map_adstech_dvb_t_pci) | ||
87 | |||
88 | MODULE_LICENSE("GPL"); | ||
89 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-apac-viewcomp.c b/drivers/media/IR/keymaps/rc-apac-viewcomp.c deleted file mode 100644 index 0ef2b562baf0..000000000000 --- a/drivers/media/IR/keymaps/rc-apac-viewcomp.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* apac-viewcomp.h - Keytable for apac_viewcomp Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Attila Kondoros <attila.kondoros@chello.hu> */ | ||
16 | |||
17 | static struct ir_scancode apac_viewcomp[] = { | ||
18 | |||
19 | { 0x01, KEY_1 }, | ||
20 | { 0x02, KEY_2 }, | ||
21 | { 0x03, KEY_3 }, | ||
22 | { 0x04, KEY_4 }, | ||
23 | { 0x05, KEY_5 }, | ||
24 | { 0x06, KEY_6 }, | ||
25 | { 0x07, KEY_7 }, | ||
26 | { 0x08, KEY_8 }, | ||
27 | { 0x09, KEY_9 }, | ||
28 | { 0x00, KEY_0 }, | ||
29 | { 0x17, KEY_LAST }, /* +100 */ | ||
30 | { 0x0a, KEY_LIST }, /* recall */ | ||
31 | |||
32 | |||
33 | { 0x1c, KEY_TUNER }, /* TV/FM */ | ||
34 | { 0x15, KEY_SEARCH }, /* scan */ | ||
35 | { 0x12, KEY_POWER }, /* power */ | ||
36 | { 0x1f, KEY_VOLUMEDOWN }, /* vol up */ | ||
37 | { 0x1b, KEY_VOLUMEUP }, /* vol down */ | ||
38 | { 0x1e, KEY_CHANNELDOWN }, /* chn up */ | ||
39 | { 0x1a, KEY_CHANNELUP }, /* chn down */ | ||
40 | |||
41 | { 0x11, KEY_VIDEO }, /* video */ | ||
42 | { 0x0f, KEY_ZOOM }, /* full screen */ | ||
43 | { 0x13, KEY_MUTE }, /* mute/unmute */ | ||
44 | { 0x10, KEY_TEXT }, /* min */ | ||
45 | |||
46 | { 0x0d, KEY_STOP }, /* freeze */ | ||
47 | { 0x0e, KEY_RECORD }, /* record */ | ||
48 | { 0x1d, KEY_PLAYPAUSE }, /* stop */ | ||
49 | { 0x19, KEY_PLAY }, /* play */ | ||
50 | |||
51 | { 0x16, KEY_GOTO }, /* osd */ | ||
52 | { 0x14, KEY_REFRESH }, /* default */ | ||
53 | { 0x0c, KEY_KPPLUS }, /* fine tune >>>> */ | ||
54 | { 0x18, KEY_KPMINUS }, /* fine tune <<<< */ | ||
55 | }; | ||
56 | |||
57 | static struct rc_keymap apac_viewcomp_map = { | ||
58 | .map = { | ||
59 | .scan = apac_viewcomp, | ||
60 | .size = ARRAY_SIZE(apac_viewcomp), | ||
61 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
62 | .name = RC_MAP_APAC_VIEWCOMP, | ||
63 | } | ||
64 | }; | ||
65 | |||
66 | static int __init init_rc_map_apac_viewcomp(void) | ||
67 | { | ||
68 | return ir_register_map(&apac_viewcomp_map); | ||
69 | } | ||
70 | |||
71 | static void __exit exit_rc_map_apac_viewcomp(void) | ||
72 | { | ||
73 | ir_unregister_map(&apac_viewcomp_map); | ||
74 | } | ||
75 | |||
76 | module_init(init_rc_map_apac_viewcomp) | ||
77 | module_exit(exit_rc_map_apac_viewcomp) | ||
78 | |||
79 | MODULE_LICENSE("GPL"); | ||
80 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-asus-pc39.c b/drivers/media/IR/keymaps/rc-asus-pc39.c deleted file mode 100644 index 2aa068cd6c75..000000000000 --- a/drivers/media/IR/keymaps/rc-asus-pc39.c +++ /dev/null | |||
@@ -1,91 +0,0 @@ | |||
1 | /* asus-pc39.h - Keytable for asus_pc39 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | * Marc Fargas <telenieko@telenieko.com> | ||
17 | * this is the remote control that comes with the asus p7131 | ||
18 | * which has a label saying is "Model PC-39" | ||
19 | */ | ||
20 | |||
21 | static struct ir_scancode asus_pc39[] = { | ||
22 | /* Keys 0 to 9 */ | ||
23 | { 0x15, KEY_0 }, | ||
24 | { 0x29, KEY_1 }, | ||
25 | { 0x2d, KEY_2 }, | ||
26 | { 0x2b, KEY_3 }, | ||
27 | { 0x09, KEY_4 }, | ||
28 | { 0x0d, KEY_5 }, | ||
29 | { 0x0b, KEY_6 }, | ||
30 | { 0x31, KEY_7 }, | ||
31 | { 0x35, KEY_8 }, | ||
32 | { 0x33, KEY_9 }, | ||
33 | |||
34 | { 0x3e, KEY_RADIO }, /* radio */ | ||
35 | { 0x03, KEY_MENU }, /* dvd/menu */ | ||
36 | { 0x2a, KEY_VOLUMEUP }, | ||
37 | { 0x19, KEY_VOLUMEDOWN }, | ||
38 | { 0x37, KEY_UP }, | ||
39 | { 0x3b, KEY_DOWN }, | ||
40 | { 0x27, KEY_LEFT }, | ||
41 | { 0x2f, KEY_RIGHT }, | ||
42 | { 0x25, KEY_VIDEO }, /* video */ | ||
43 | { 0x39, KEY_AUDIO }, /* music */ | ||
44 | |||
45 | { 0x21, KEY_TV }, /* tv */ | ||
46 | { 0x1d, KEY_EXIT }, /* back */ | ||
47 | { 0x0a, KEY_CHANNELUP }, /* channel / program + */ | ||
48 | { 0x1b, KEY_CHANNELDOWN }, /* channel / program - */ | ||
49 | { 0x1a, KEY_ENTER }, /* enter */ | ||
50 | |||
51 | { 0x06, KEY_PAUSE }, /* play/pause */ | ||
52 | { 0x1e, KEY_PREVIOUS }, /* rew */ | ||
53 | { 0x26, KEY_NEXT }, /* forward */ | ||
54 | { 0x0e, KEY_REWIND }, /* backward << */ | ||
55 | { 0x3a, KEY_FASTFORWARD }, /* forward >> */ | ||
56 | { 0x36, KEY_STOP }, | ||
57 | { 0x2e, KEY_RECORD }, /* recording */ | ||
58 | { 0x16, KEY_POWER }, /* the button that reads "close" */ | ||
59 | |||
60 | { 0x11, KEY_ZOOM }, /* full screen */ | ||
61 | { 0x13, KEY_MACRO }, /* recall */ | ||
62 | { 0x23, KEY_HOME }, /* home */ | ||
63 | { 0x05, KEY_PVR }, /* picture */ | ||
64 | { 0x3d, KEY_MUTE }, /* mute */ | ||
65 | { 0x01, KEY_DVD }, /* dvd */ | ||
66 | }; | ||
67 | |||
68 | static struct rc_keymap asus_pc39_map = { | ||
69 | .map = { | ||
70 | .scan = asus_pc39, | ||
71 | .size = ARRAY_SIZE(asus_pc39), | ||
72 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
73 | .name = RC_MAP_ASUS_PC39, | ||
74 | } | ||
75 | }; | ||
76 | |||
77 | static int __init init_rc_map_asus_pc39(void) | ||
78 | { | ||
79 | return ir_register_map(&asus_pc39_map); | ||
80 | } | ||
81 | |||
82 | static void __exit exit_rc_map_asus_pc39(void) | ||
83 | { | ||
84 | ir_unregister_map(&asus_pc39_map); | ||
85 | } | ||
86 | |||
87 | module_init(init_rc_map_asus_pc39) | ||
88 | module_exit(exit_rc_map_asus_pc39) | ||
89 | |||
90 | MODULE_LICENSE("GPL"); | ||
91 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c b/drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c deleted file mode 100644 index 8edfd293d010..000000000000 --- a/drivers/media/IR/keymaps/rc-ati-tv-wonder-hd-600.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* ati-tv-wonder-hd-600.h - Keytable for ati_tv_wonder_hd_600 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* ATI TV Wonder HD 600 USB | ||
16 | Devin Heitmueller <devin.heitmueller@gmail.com> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode ati_tv_wonder_hd_600[] = { | ||
20 | { 0x00, KEY_RECORD}, /* Row 1 */ | ||
21 | { 0x01, KEY_PLAYPAUSE}, | ||
22 | { 0x02, KEY_STOP}, | ||
23 | { 0x03, KEY_POWER}, | ||
24 | { 0x04, KEY_PREVIOUS}, /* Row 2 */ | ||
25 | { 0x05, KEY_REWIND}, | ||
26 | { 0x06, KEY_FORWARD}, | ||
27 | { 0x07, KEY_NEXT}, | ||
28 | { 0x08, KEY_EPG}, /* Row 3 */ | ||
29 | { 0x09, KEY_HOME}, | ||
30 | { 0x0a, KEY_MENU}, | ||
31 | { 0x0b, KEY_CHANNELUP}, | ||
32 | { 0x0c, KEY_BACK}, /* Row 4 */ | ||
33 | { 0x0d, KEY_UP}, | ||
34 | { 0x0e, KEY_INFO}, | ||
35 | { 0x0f, KEY_CHANNELDOWN}, | ||
36 | { 0x10, KEY_LEFT}, /* Row 5 */ | ||
37 | { 0x11, KEY_SELECT}, | ||
38 | { 0x12, KEY_RIGHT}, | ||
39 | { 0x13, KEY_VOLUMEUP}, | ||
40 | { 0x14, KEY_LAST}, /* Row 6 */ | ||
41 | { 0x15, KEY_DOWN}, | ||
42 | { 0x16, KEY_MUTE}, | ||
43 | { 0x17, KEY_VOLUMEDOWN}, | ||
44 | }; | ||
45 | |||
46 | static struct rc_keymap ati_tv_wonder_hd_600_map = { | ||
47 | .map = { | ||
48 | .scan = ati_tv_wonder_hd_600, | ||
49 | .size = ARRAY_SIZE(ati_tv_wonder_hd_600), | ||
50 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
51 | .name = RC_MAP_ATI_TV_WONDER_HD_600, | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | static int __init init_rc_map_ati_tv_wonder_hd_600(void) | ||
56 | { | ||
57 | return ir_register_map(&ati_tv_wonder_hd_600_map); | ||
58 | } | ||
59 | |||
60 | static void __exit exit_rc_map_ati_tv_wonder_hd_600(void) | ||
61 | { | ||
62 | ir_unregister_map(&ati_tv_wonder_hd_600_map); | ||
63 | } | ||
64 | |||
65 | module_init(init_rc_map_ati_tv_wonder_hd_600) | ||
66 | module_exit(exit_rc_map_ati_tv_wonder_hd_600) | ||
67 | |||
68 | MODULE_LICENSE("GPL"); | ||
69 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avermedia-a16d.c b/drivers/media/IR/keymaps/rc-avermedia-a16d.c deleted file mode 100644 index 12f043587f2e..000000000000 --- a/drivers/media/IR/keymaps/rc-avermedia-a16d.c +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | /* avermedia-a16d.h - Keytable for avermedia_a16d Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode avermedia_a16d[] = { | ||
16 | { 0x20, KEY_LIST}, | ||
17 | { 0x00, KEY_POWER}, | ||
18 | { 0x28, KEY_1}, | ||
19 | { 0x18, KEY_2}, | ||
20 | { 0x38, KEY_3}, | ||
21 | { 0x24, KEY_4}, | ||
22 | { 0x14, KEY_5}, | ||
23 | { 0x34, KEY_6}, | ||
24 | { 0x2c, KEY_7}, | ||
25 | { 0x1c, KEY_8}, | ||
26 | { 0x3c, KEY_9}, | ||
27 | { 0x12, KEY_SUBTITLE}, | ||
28 | { 0x22, KEY_0}, | ||
29 | { 0x32, KEY_REWIND}, | ||
30 | { 0x3a, KEY_SHUFFLE}, | ||
31 | { 0x02, KEY_PRINT}, | ||
32 | { 0x11, KEY_CHANNELDOWN}, | ||
33 | { 0x31, KEY_CHANNELUP}, | ||
34 | { 0x0c, KEY_ZOOM}, | ||
35 | { 0x1e, KEY_VOLUMEDOWN}, | ||
36 | { 0x3e, KEY_VOLUMEUP}, | ||
37 | { 0x0a, KEY_MUTE}, | ||
38 | { 0x04, KEY_AUDIO}, | ||
39 | { 0x26, KEY_RECORD}, | ||
40 | { 0x06, KEY_PLAY}, | ||
41 | { 0x36, KEY_STOP}, | ||
42 | { 0x16, KEY_PAUSE}, | ||
43 | { 0x2e, KEY_REWIND}, | ||
44 | { 0x0e, KEY_FASTFORWARD}, | ||
45 | { 0x30, KEY_TEXT}, | ||
46 | { 0x21, KEY_GREEN}, | ||
47 | { 0x01, KEY_BLUE}, | ||
48 | { 0x08, KEY_EPG}, | ||
49 | { 0x2a, KEY_MENU}, | ||
50 | }; | ||
51 | |||
52 | static struct rc_keymap avermedia_a16d_map = { | ||
53 | .map = { | ||
54 | .scan = avermedia_a16d, | ||
55 | .size = ARRAY_SIZE(avermedia_a16d), | ||
56 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
57 | .name = RC_MAP_AVERMEDIA_A16D, | ||
58 | } | ||
59 | }; | ||
60 | |||
61 | static int __init init_rc_map_avermedia_a16d(void) | ||
62 | { | ||
63 | return ir_register_map(&avermedia_a16d_map); | ||
64 | } | ||
65 | |||
66 | static void __exit exit_rc_map_avermedia_a16d(void) | ||
67 | { | ||
68 | ir_unregister_map(&avermedia_a16d_map); | ||
69 | } | ||
70 | |||
71 | module_init(init_rc_map_avermedia_a16d) | ||
72 | module_exit(exit_rc_map_avermedia_a16d) | ||
73 | |||
74 | MODULE_LICENSE("GPL"); | ||
75 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avermedia-cardbus.c b/drivers/media/IR/keymaps/rc-avermedia-cardbus.c deleted file mode 100644 index 2a945b02e8ca..000000000000 --- a/drivers/media/IR/keymaps/rc-avermedia-cardbus.c +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | /* avermedia-cardbus.h - Keytable for avermedia_cardbus Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Oldrich Jedlicka <oldium.pro@seznam.cz> */ | ||
16 | |||
17 | static struct ir_scancode avermedia_cardbus[] = { | ||
18 | { 0x00, KEY_POWER }, | ||
19 | { 0x01, KEY_TUNER }, /* TV/FM */ | ||
20 | { 0x03, KEY_TEXT }, /* Teletext */ | ||
21 | { 0x04, KEY_EPG }, | ||
22 | { 0x05, KEY_1 }, | ||
23 | { 0x06, KEY_2 }, | ||
24 | { 0x07, KEY_3 }, | ||
25 | { 0x08, KEY_AUDIO }, | ||
26 | { 0x09, KEY_4 }, | ||
27 | { 0x0a, KEY_5 }, | ||
28 | { 0x0b, KEY_6 }, | ||
29 | { 0x0c, KEY_ZOOM }, /* Full screen */ | ||
30 | { 0x0d, KEY_7 }, | ||
31 | { 0x0e, KEY_8 }, | ||
32 | { 0x0f, KEY_9 }, | ||
33 | { 0x10, KEY_PAGEUP }, /* 16-CH PREV */ | ||
34 | { 0x11, KEY_0 }, | ||
35 | { 0x12, KEY_INFO }, | ||
36 | { 0x13, KEY_AGAIN }, /* CH RTN - channel return */ | ||
37 | { 0x14, KEY_MUTE }, | ||
38 | { 0x15, KEY_EDIT }, /* Autoscan */ | ||
39 | { 0x17, KEY_SAVE }, /* Screenshot */ | ||
40 | { 0x18, KEY_PLAYPAUSE }, | ||
41 | { 0x19, KEY_RECORD }, | ||
42 | { 0x1a, KEY_PLAY }, | ||
43 | { 0x1b, KEY_STOP }, | ||
44 | { 0x1c, KEY_FASTFORWARD }, | ||
45 | { 0x1d, KEY_REWIND }, | ||
46 | { 0x1e, KEY_VOLUMEDOWN }, | ||
47 | { 0x1f, KEY_VOLUMEUP }, | ||
48 | { 0x22, KEY_SLEEP }, /* Sleep */ | ||
49 | { 0x23, KEY_ZOOM }, /* Aspect */ | ||
50 | { 0x26, KEY_SCREEN }, /* Pos */ | ||
51 | { 0x27, KEY_ANGLE }, /* Size */ | ||
52 | { 0x28, KEY_SELECT }, /* Select */ | ||
53 | { 0x29, KEY_BLUE }, /* Blue/Picture */ | ||
54 | { 0x2a, KEY_BACKSPACE }, /* Back */ | ||
55 | { 0x2b, KEY_MEDIA }, /* PIP (Picture-in-picture) */ | ||
56 | { 0x2c, KEY_DOWN }, | ||
57 | { 0x2e, KEY_DOT }, | ||
58 | { 0x2f, KEY_TV }, /* Live TV */ | ||
59 | { 0x32, KEY_LEFT }, | ||
60 | { 0x33, KEY_CLEAR }, /* Clear */ | ||
61 | { 0x35, KEY_RED }, /* Red/TV */ | ||
62 | { 0x36, KEY_UP }, | ||
63 | { 0x37, KEY_HOME }, /* Home */ | ||
64 | { 0x39, KEY_GREEN }, /* Green/Video */ | ||
65 | { 0x3d, KEY_YELLOW }, /* Yellow/Music */ | ||
66 | { 0x3e, KEY_OK }, /* Ok */ | ||
67 | { 0x3f, KEY_RIGHT }, | ||
68 | { 0x40, KEY_NEXT }, /* Next */ | ||
69 | { 0x41, KEY_PREVIOUS }, /* Previous */ | ||
70 | { 0x42, KEY_CHANNELDOWN }, /* Channel down */ | ||
71 | { 0x43, KEY_CHANNELUP }, /* Channel up */ | ||
72 | }; | ||
73 | |||
74 | static struct rc_keymap avermedia_cardbus_map = { | ||
75 | .map = { | ||
76 | .scan = avermedia_cardbus, | ||
77 | .size = ARRAY_SIZE(avermedia_cardbus), | ||
78 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
79 | .name = RC_MAP_AVERMEDIA_CARDBUS, | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | static int __init init_rc_map_avermedia_cardbus(void) | ||
84 | { | ||
85 | return ir_register_map(&avermedia_cardbus_map); | ||
86 | } | ||
87 | |||
88 | static void __exit exit_rc_map_avermedia_cardbus(void) | ||
89 | { | ||
90 | ir_unregister_map(&avermedia_cardbus_map); | ||
91 | } | ||
92 | |||
93 | module_init(init_rc_map_avermedia_cardbus) | ||
94 | module_exit(exit_rc_map_avermedia_cardbus) | ||
95 | |||
96 | MODULE_LICENSE("GPL"); | ||
97 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avermedia-dvbt.c b/drivers/media/IR/keymaps/rc-avermedia-dvbt.c deleted file mode 100644 index 39dde6222875..000000000000 --- a/drivers/media/IR/keymaps/rc-avermedia-dvbt.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* avermedia-dvbt.h - Keytable for avermedia_dvbt Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Matt Jesson <dvb@jesson.eclipse.co.uk */ | ||
16 | |||
17 | static struct ir_scancode avermedia_dvbt[] = { | ||
18 | { 0x28, KEY_0 }, /* '0' / 'enter' */ | ||
19 | { 0x22, KEY_1 }, /* '1' */ | ||
20 | { 0x12, KEY_2 }, /* '2' / 'up arrow' */ | ||
21 | { 0x32, KEY_3 }, /* '3' */ | ||
22 | { 0x24, KEY_4 }, /* '4' / 'left arrow' */ | ||
23 | { 0x14, KEY_5 }, /* '5' */ | ||
24 | { 0x34, KEY_6 }, /* '6' / 'right arrow' */ | ||
25 | { 0x26, KEY_7 }, /* '7' */ | ||
26 | { 0x16, KEY_8 }, /* '8' / 'down arrow' */ | ||
27 | { 0x36, KEY_9 }, /* '9' */ | ||
28 | |||
29 | { 0x20, KEY_LIST }, /* 'source' */ | ||
30 | { 0x10, KEY_TEXT }, /* 'teletext' */ | ||
31 | { 0x00, KEY_POWER }, /* 'power' */ | ||
32 | { 0x04, KEY_AUDIO }, /* 'audio' */ | ||
33 | { 0x06, KEY_ZOOM }, /* 'full screen' */ | ||
34 | { 0x18, KEY_VIDEO }, /* 'display' */ | ||
35 | { 0x38, KEY_SEARCH }, /* 'loop' */ | ||
36 | { 0x08, KEY_INFO }, /* 'preview' */ | ||
37 | { 0x2a, KEY_REWIND }, /* 'backward <<' */ | ||
38 | { 0x1a, KEY_FASTFORWARD }, /* 'forward >>' */ | ||
39 | { 0x3a, KEY_RECORD }, /* 'capture' */ | ||
40 | { 0x0a, KEY_MUTE }, /* 'mute' */ | ||
41 | { 0x2c, KEY_RECORD }, /* 'record' */ | ||
42 | { 0x1c, KEY_PAUSE }, /* 'pause' */ | ||
43 | { 0x3c, KEY_STOP }, /* 'stop' */ | ||
44 | { 0x0c, KEY_PLAY }, /* 'play' */ | ||
45 | { 0x2e, KEY_RED }, /* 'red' */ | ||
46 | { 0x01, KEY_BLUE }, /* 'blue' / 'cancel' */ | ||
47 | { 0x0e, KEY_YELLOW }, /* 'yellow' / 'ok' */ | ||
48 | { 0x21, KEY_GREEN }, /* 'green' */ | ||
49 | { 0x11, KEY_CHANNELDOWN }, /* 'channel -' */ | ||
50 | { 0x31, KEY_CHANNELUP }, /* 'channel +' */ | ||
51 | { 0x1e, KEY_VOLUMEDOWN }, /* 'volume -' */ | ||
52 | { 0x3e, KEY_VOLUMEUP }, /* 'volume +' */ | ||
53 | }; | ||
54 | |||
55 | static struct rc_keymap avermedia_dvbt_map = { | ||
56 | .map = { | ||
57 | .scan = avermedia_dvbt, | ||
58 | .size = ARRAY_SIZE(avermedia_dvbt), | ||
59 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
60 | .name = RC_MAP_AVERMEDIA_DVBT, | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | static int __init init_rc_map_avermedia_dvbt(void) | ||
65 | { | ||
66 | return ir_register_map(&avermedia_dvbt_map); | ||
67 | } | ||
68 | |||
69 | static void __exit exit_rc_map_avermedia_dvbt(void) | ||
70 | { | ||
71 | ir_unregister_map(&avermedia_dvbt_map); | ||
72 | } | ||
73 | |||
74 | module_init(init_rc_map_avermedia_dvbt) | ||
75 | module_exit(exit_rc_map_avermedia_dvbt) | ||
76 | |||
77 | MODULE_LICENSE("GPL"); | ||
78 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avermedia-m135a.c b/drivers/media/IR/keymaps/rc-avermedia-m135a.c deleted file mode 100644 index e4471fb2ad1e..000000000000 --- a/drivers/media/IR/keymaps/rc-avermedia-m135a.c +++ /dev/null | |||
@@ -1,147 +0,0 @@ | |||
1 | /* avermedia-m135a.c - Keytable for Avermedia M135A Remote Controllers | ||
2 | * | ||
3 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * Copyright (c) 2010 by Herton Ronaldo Krzesinski <herton@mandriva.com.br> | ||
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 | |||
12 | #include <media/rc-map.h> | ||
13 | |||
14 | /* | ||
15 | * Avermedia M135A with RM-JX and RM-K6 remote controls | ||
16 | * | ||
17 | * On Avermedia M135A with IR model RM-JX, the same codes exist on both | ||
18 | * Positivo (BR) and original IR, initial version and remote control codes | ||
19 | * added by Mauro Carvalho Chehab <mchehab@infradead.org> | ||
20 | * | ||
21 | * Positivo also ships Avermedia M135A with model RM-K6, extra control | ||
22 | * codes added by Herton Ronaldo Krzesinski <herton@mandriva.com.br> | ||
23 | */ | ||
24 | |||
25 | static struct ir_scancode avermedia_m135a[] = { | ||
26 | /* RM-JX */ | ||
27 | { 0x0200, KEY_POWER2 }, | ||
28 | { 0x022e, KEY_DOT }, /* '.' */ | ||
29 | { 0x0201, KEY_MODE }, /* TV/FM or SOURCE */ | ||
30 | |||
31 | { 0x0205, KEY_1 }, | ||
32 | { 0x0206, KEY_2 }, | ||
33 | { 0x0207, KEY_3 }, | ||
34 | { 0x0209, KEY_4 }, | ||
35 | { 0x020a, KEY_5 }, | ||
36 | { 0x020b, KEY_6 }, | ||
37 | { 0x020d, KEY_7 }, | ||
38 | { 0x020e, KEY_8 }, | ||
39 | { 0x020f, KEY_9 }, | ||
40 | { 0x0211, KEY_0 }, | ||
41 | |||
42 | { 0x0213, KEY_RIGHT }, /* -> or L */ | ||
43 | { 0x0212, KEY_LEFT }, /* <- or R */ | ||
44 | |||
45 | { 0x0217, KEY_SLEEP }, /* Capturar Imagem or Snapshot */ | ||
46 | { 0x0210, KEY_SHUFFLE }, /* Amostra or 16 chan prev */ | ||
47 | |||
48 | { 0x0303, KEY_CHANNELUP }, | ||
49 | { 0x0302, KEY_CHANNELDOWN }, | ||
50 | { 0x021f, KEY_VOLUMEUP }, | ||
51 | { 0x021e, KEY_VOLUMEDOWN }, | ||
52 | { 0x020c, KEY_ENTER }, /* Full Screen */ | ||
53 | |||
54 | { 0x0214, KEY_MUTE }, | ||
55 | { 0x0208, KEY_AUDIO }, | ||
56 | |||
57 | { 0x0203, KEY_TEXT }, /* Teletext */ | ||
58 | { 0x0204, KEY_EPG }, | ||
59 | { 0x022b, KEY_TV2 }, /* TV2 or PIP */ | ||
60 | |||
61 | { 0x021d, KEY_RED }, | ||
62 | { 0x021c, KEY_YELLOW }, | ||
63 | { 0x0301, KEY_GREEN }, | ||
64 | { 0x0300, KEY_BLUE }, | ||
65 | |||
66 | { 0x021a, KEY_PLAYPAUSE }, | ||
67 | { 0x0219, KEY_RECORD }, | ||
68 | { 0x0218, KEY_PLAY }, | ||
69 | { 0x021b, KEY_STOP }, | ||
70 | |||
71 | /* RM-K6 */ | ||
72 | { 0x0401, KEY_POWER2 }, | ||
73 | { 0x0406, KEY_MUTE }, | ||
74 | { 0x0408, KEY_MODE }, /* TV/FM */ | ||
75 | |||
76 | { 0x0409, KEY_1 }, | ||
77 | { 0x040a, KEY_2 }, | ||
78 | { 0x040b, KEY_3 }, | ||
79 | { 0x040c, KEY_4 }, | ||
80 | { 0x040d, KEY_5 }, | ||
81 | { 0x040e, KEY_6 }, | ||
82 | { 0x040f, KEY_7 }, | ||
83 | { 0x0410, KEY_8 }, | ||
84 | { 0x0411, KEY_9 }, | ||
85 | { 0x044c, KEY_DOT }, /* '.' */ | ||
86 | { 0x0412, KEY_0 }, | ||
87 | { 0x0407, KEY_REFRESH }, /* Refresh/Reload */ | ||
88 | |||
89 | { 0x0413, KEY_AUDIO }, | ||
90 | { 0x0440, KEY_SCREEN }, /* Full Screen toggle */ | ||
91 | { 0x0441, KEY_HOME }, | ||
92 | { 0x0442, KEY_BACK }, | ||
93 | { 0x0447, KEY_UP }, | ||
94 | { 0x0448, KEY_DOWN }, | ||
95 | { 0x0449, KEY_LEFT }, | ||
96 | { 0x044a, KEY_RIGHT }, | ||
97 | { 0x044b, KEY_OK }, | ||
98 | { 0x0404, KEY_VOLUMEUP }, | ||
99 | { 0x0405, KEY_VOLUMEDOWN }, | ||
100 | { 0x0402, KEY_CHANNELUP }, | ||
101 | { 0x0403, KEY_CHANNELDOWN }, | ||
102 | |||
103 | { 0x0443, KEY_RED }, | ||
104 | { 0x0444, KEY_GREEN }, | ||
105 | { 0x0445, KEY_YELLOW }, | ||
106 | { 0x0446, KEY_BLUE }, | ||
107 | |||
108 | { 0x0414, KEY_TEXT }, | ||
109 | { 0x0415, KEY_EPG }, | ||
110 | { 0x041a, KEY_TV2 }, /* PIP */ | ||
111 | { 0x041b, KEY_MHP }, /* Snapshot */ | ||
112 | |||
113 | { 0x0417, KEY_RECORD }, | ||
114 | { 0x0416, KEY_PLAYPAUSE }, | ||
115 | { 0x0418, KEY_STOP }, | ||
116 | { 0x0419, KEY_PAUSE }, | ||
117 | |||
118 | { 0x041f, KEY_PREVIOUS }, | ||
119 | { 0x041c, KEY_REWIND }, | ||
120 | { 0x041d, KEY_FORWARD }, | ||
121 | { 0x041e, KEY_NEXT }, | ||
122 | }; | ||
123 | |||
124 | static struct rc_keymap avermedia_m135a_map = { | ||
125 | .map = { | ||
126 | .scan = avermedia_m135a, | ||
127 | .size = ARRAY_SIZE(avermedia_m135a), | ||
128 | .ir_type = IR_TYPE_NEC, | ||
129 | .name = RC_MAP_AVERMEDIA_M135A, | ||
130 | } | ||
131 | }; | ||
132 | |||
133 | static int __init init_rc_map_avermedia_m135a(void) | ||
134 | { | ||
135 | return ir_register_map(&avermedia_m135a_map); | ||
136 | } | ||
137 | |||
138 | static void __exit exit_rc_map_avermedia_m135a(void) | ||
139 | { | ||
140 | ir_unregister_map(&avermedia_m135a_map); | ||
141 | } | ||
142 | |||
143 | module_init(init_rc_map_avermedia_m135a) | ||
144 | module_exit(exit_rc_map_avermedia_m135a) | ||
145 | |||
146 | MODULE_LICENSE("GPL"); | ||
147 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c b/drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c deleted file mode 100644 index cf8d45717cb3..000000000000 --- a/drivers/media/IR/keymaps/rc-avermedia-m733a-rm-k6.c +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | /* avermedia-m733a-rm-k6.h - Keytable for avermedia_m733a_rm_k6 Remote Controller | ||
2 | * | ||
3 | * Copyright (c) 2010 by Herton Ronaldo Krzesinski <herton@mandriva.com.br> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation; either version 2 of the License, or | ||
8 | * (at your option) any later version. | ||
9 | */ | ||
10 | |||
11 | #include <media/rc-map.h> | ||
12 | |||
13 | /* | ||
14 | * Avermedia M733A with IR model RM-K6 | ||
15 | * This is the stock remote controller used with Positivo machines with M733A | ||
16 | * Herton Ronaldo Krzesinski <herton@mandriva.com.br> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode avermedia_m733a_rm_k6[] = { | ||
20 | { 0x0401, KEY_POWER2 }, | ||
21 | { 0x0406, KEY_MUTE }, | ||
22 | { 0x0408, KEY_MODE }, /* TV/FM */ | ||
23 | |||
24 | { 0x0409, KEY_1 }, | ||
25 | { 0x040a, KEY_2 }, | ||
26 | { 0x040b, KEY_3 }, | ||
27 | { 0x040c, KEY_4 }, | ||
28 | { 0x040d, KEY_5 }, | ||
29 | { 0x040e, KEY_6 }, | ||
30 | { 0x040f, KEY_7 }, | ||
31 | { 0x0410, KEY_8 }, | ||
32 | { 0x0411, KEY_9 }, | ||
33 | { 0x044c, KEY_DOT }, /* '.' */ | ||
34 | { 0x0412, KEY_0 }, | ||
35 | { 0x0407, KEY_REFRESH }, /* Refresh/Reload */ | ||
36 | |||
37 | { 0x0413, KEY_AUDIO }, | ||
38 | { 0x0440, KEY_SCREEN }, /* Full Screen toggle */ | ||
39 | { 0x0441, KEY_HOME }, | ||
40 | { 0x0442, KEY_BACK }, | ||
41 | { 0x0447, KEY_UP }, | ||
42 | { 0x0448, KEY_DOWN }, | ||
43 | { 0x0449, KEY_LEFT }, | ||
44 | { 0x044a, KEY_RIGHT }, | ||
45 | { 0x044b, KEY_OK }, | ||
46 | { 0x0404, KEY_VOLUMEUP }, | ||
47 | { 0x0405, KEY_VOLUMEDOWN }, | ||
48 | { 0x0402, KEY_CHANNELUP }, | ||
49 | { 0x0403, KEY_CHANNELDOWN }, | ||
50 | |||
51 | { 0x0443, KEY_RED }, | ||
52 | { 0x0444, KEY_GREEN }, | ||
53 | { 0x0445, KEY_YELLOW }, | ||
54 | { 0x0446, KEY_BLUE }, | ||
55 | |||
56 | { 0x0414, KEY_TEXT }, | ||
57 | { 0x0415, KEY_EPG }, | ||
58 | { 0x041a, KEY_TV2 }, /* PIP */ | ||
59 | { 0x041b, KEY_MHP }, /* Snapshot */ | ||
60 | |||
61 | { 0x0417, KEY_RECORD }, | ||
62 | { 0x0416, KEY_PLAYPAUSE }, | ||
63 | { 0x0418, KEY_STOP }, | ||
64 | { 0x0419, KEY_PAUSE }, | ||
65 | |||
66 | { 0x041f, KEY_PREVIOUS }, | ||
67 | { 0x041c, KEY_REWIND }, | ||
68 | { 0x041d, KEY_FORWARD }, | ||
69 | { 0x041e, KEY_NEXT }, | ||
70 | }; | ||
71 | |||
72 | static struct rc_keymap avermedia_m733a_rm_k6_map = { | ||
73 | .map = { | ||
74 | .scan = avermedia_m733a_rm_k6, | ||
75 | .size = ARRAY_SIZE(avermedia_m733a_rm_k6), | ||
76 | .ir_type = IR_TYPE_NEC, | ||
77 | .name = RC_MAP_AVERMEDIA_M733A_RM_K6, | ||
78 | } | ||
79 | }; | ||
80 | |||
81 | static int __init init_rc_map_avermedia_m733a_rm_k6(void) | ||
82 | { | ||
83 | return ir_register_map(&avermedia_m733a_rm_k6_map); | ||
84 | } | ||
85 | |||
86 | static void __exit exit_rc_map_avermedia_m733a_rm_k6(void) | ||
87 | { | ||
88 | ir_unregister_map(&avermedia_m733a_rm_k6_map); | ||
89 | } | ||
90 | |||
91 | module_init(init_rc_map_avermedia_m733a_rm_k6) | ||
92 | module_exit(exit_rc_map_avermedia_m733a_rm_k6) | ||
93 | |||
94 | MODULE_LICENSE("GPL"); | ||
95 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avermedia.c b/drivers/media/IR/keymaps/rc-avermedia.c deleted file mode 100644 index 21effd5bfb0d..000000000000 --- a/drivers/media/IR/keymaps/rc-avermedia.c +++ /dev/null | |||
@@ -1,86 +0,0 @@ | |||
1 | /* avermedia.h - Keytable for avermedia Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Alex Hermann <gaaf@gmx.net> */ | ||
16 | |||
17 | static struct ir_scancode avermedia[] = { | ||
18 | { 0x28, KEY_1 }, | ||
19 | { 0x18, KEY_2 }, | ||
20 | { 0x38, KEY_3 }, | ||
21 | { 0x24, KEY_4 }, | ||
22 | { 0x14, KEY_5 }, | ||
23 | { 0x34, KEY_6 }, | ||
24 | { 0x2c, KEY_7 }, | ||
25 | { 0x1c, KEY_8 }, | ||
26 | { 0x3c, KEY_9 }, | ||
27 | { 0x22, KEY_0 }, | ||
28 | |||
29 | { 0x20, KEY_TV }, /* TV/FM */ | ||
30 | { 0x10, KEY_CD }, /* CD */ | ||
31 | { 0x30, KEY_TEXT }, /* TELETEXT */ | ||
32 | { 0x00, KEY_POWER }, /* POWER */ | ||
33 | |||
34 | { 0x08, KEY_VIDEO }, /* VIDEO */ | ||
35 | { 0x04, KEY_AUDIO }, /* AUDIO */ | ||
36 | { 0x0c, KEY_ZOOM }, /* FULL SCREEN */ | ||
37 | |||
38 | { 0x12, KEY_SUBTITLE }, /* DISPLAY */ | ||
39 | { 0x32, KEY_REWIND }, /* LOOP */ | ||
40 | { 0x02, KEY_PRINT }, /* PREVIEW */ | ||
41 | |||
42 | { 0x2a, KEY_SEARCH }, /* AUTOSCAN */ | ||
43 | { 0x1a, KEY_SLEEP }, /* FREEZE */ | ||
44 | { 0x3a, KEY_CAMERA }, /* SNAPSHOT */ | ||
45 | { 0x0a, KEY_MUTE }, /* MUTE */ | ||
46 | |||
47 | { 0x26, KEY_RECORD }, /* RECORD */ | ||
48 | { 0x16, KEY_PAUSE }, /* PAUSE */ | ||
49 | { 0x36, KEY_STOP }, /* STOP */ | ||
50 | { 0x06, KEY_PLAY }, /* PLAY */ | ||
51 | |||
52 | { 0x2e, KEY_RED }, /* RED */ | ||
53 | { 0x21, KEY_GREEN }, /* GREEN */ | ||
54 | { 0x0e, KEY_YELLOW }, /* YELLOW */ | ||
55 | { 0x01, KEY_BLUE }, /* BLUE */ | ||
56 | |||
57 | { 0x1e, KEY_VOLUMEDOWN }, /* VOLUME- */ | ||
58 | { 0x3e, KEY_VOLUMEUP }, /* VOLUME+ */ | ||
59 | { 0x11, KEY_CHANNELDOWN }, /* CHANNEL/PAGE- */ | ||
60 | { 0x31, KEY_CHANNELUP } /* CHANNEL/PAGE+ */ | ||
61 | }; | ||
62 | |||
63 | static struct rc_keymap avermedia_map = { | ||
64 | .map = { | ||
65 | .scan = avermedia, | ||
66 | .size = ARRAY_SIZE(avermedia), | ||
67 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
68 | .name = RC_MAP_AVERMEDIA, | ||
69 | } | ||
70 | }; | ||
71 | |||
72 | static int __init init_rc_map_avermedia(void) | ||
73 | { | ||
74 | return ir_register_map(&avermedia_map); | ||
75 | } | ||
76 | |||
77 | static void __exit exit_rc_map_avermedia(void) | ||
78 | { | ||
79 | ir_unregister_map(&avermedia_map); | ||
80 | } | ||
81 | |||
82 | module_init(init_rc_map_avermedia) | ||
83 | module_exit(exit_rc_map_avermedia) | ||
84 | |||
85 | MODULE_LICENSE("GPL"); | ||
86 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-avertv-303.c b/drivers/media/IR/keymaps/rc-avertv-303.c deleted file mode 100644 index 971c59d6f9d6..000000000000 --- a/drivers/media/IR/keymaps/rc-avertv-303.c +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* avertv-303.h - Keytable for avertv_303 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* AVERTV STUDIO 303 Remote */ | ||
16 | |||
17 | static struct ir_scancode avertv_303[] = { | ||
18 | { 0x2a, KEY_1 }, | ||
19 | { 0x32, KEY_2 }, | ||
20 | { 0x3a, KEY_3 }, | ||
21 | { 0x4a, KEY_4 }, | ||
22 | { 0x52, KEY_5 }, | ||
23 | { 0x5a, KEY_6 }, | ||
24 | { 0x6a, KEY_7 }, | ||
25 | { 0x72, KEY_8 }, | ||
26 | { 0x7a, KEY_9 }, | ||
27 | { 0x0e, KEY_0 }, | ||
28 | |||
29 | { 0x02, KEY_POWER }, | ||
30 | { 0x22, KEY_VIDEO }, | ||
31 | { 0x42, KEY_AUDIO }, | ||
32 | { 0x62, KEY_ZOOM }, | ||
33 | { 0x0a, KEY_TV }, | ||
34 | { 0x12, KEY_CD }, | ||
35 | { 0x1a, KEY_TEXT }, | ||
36 | |||
37 | { 0x16, KEY_SUBTITLE }, | ||
38 | { 0x1e, KEY_REWIND }, | ||
39 | { 0x06, KEY_PRINT }, | ||
40 | |||
41 | { 0x2e, KEY_SEARCH }, | ||
42 | { 0x36, KEY_SLEEP }, | ||
43 | { 0x3e, KEY_SHUFFLE }, | ||
44 | { 0x26, KEY_MUTE }, | ||
45 | |||
46 | { 0x4e, KEY_RECORD }, | ||
47 | { 0x56, KEY_PAUSE }, | ||
48 | { 0x5e, KEY_STOP }, | ||
49 | { 0x46, KEY_PLAY }, | ||
50 | |||
51 | { 0x6e, KEY_RED }, | ||
52 | { 0x0b, KEY_GREEN }, | ||
53 | { 0x66, KEY_YELLOW }, | ||
54 | { 0x03, KEY_BLUE }, | ||
55 | |||
56 | { 0x76, KEY_LEFT }, | ||
57 | { 0x7e, KEY_RIGHT }, | ||
58 | { 0x13, KEY_DOWN }, | ||
59 | { 0x1b, KEY_UP }, | ||
60 | }; | ||
61 | |||
62 | static struct rc_keymap avertv_303_map = { | ||
63 | .map = { | ||
64 | .scan = avertv_303, | ||
65 | .size = ARRAY_SIZE(avertv_303), | ||
66 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
67 | .name = RC_MAP_AVERTV_303, | ||
68 | } | ||
69 | }; | ||
70 | |||
71 | static int __init init_rc_map_avertv_303(void) | ||
72 | { | ||
73 | return ir_register_map(&avertv_303_map); | ||
74 | } | ||
75 | |||
76 | static void __exit exit_rc_map_avertv_303(void) | ||
77 | { | ||
78 | ir_unregister_map(&avertv_303_map); | ||
79 | } | ||
80 | |||
81 | module_init(init_rc_map_avertv_303) | ||
82 | module_exit(exit_rc_map_avertv_303) | ||
83 | |||
84 | MODULE_LICENSE("GPL"); | ||
85 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-behold-columbus.c b/drivers/media/IR/keymaps/rc-behold-columbus.c deleted file mode 100644 index 9f56c98fef5b..000000000000 --- a/drivers/media/IR/keymaps/rc-behold-columbus.c +++ /dev/null | |||
@@ -1,108 +0,0 @@ | |||
1 | /* behold-columbus.h - Keytable for behold_columbus Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Beholder Intl. Ltd. 2008 | ||
16 | * Dmitry Belimov d.belimov@google.com | ||
17 | * Keytable is used by BeholdTV Columbus | ||
18 | * The "ascii-art picture" below (in comments, first row | ||
19 | * is the keycode in hex, and subsequent row(s) shows | ||
20 | * the button labels (several variants when appropriate) | ||
21 | * helps to descide which keycodes to assign to the buttons. | ||
22 | */ | ||
23 | |||
24 | static struct ir_scancode behold_columbus[] = { | ||
25 | |||
26 | /* 0x13 0x11 0x1C 0x12 * | ||
27 | * Mute Source TV/FM Power * | ||
28 | * */ | ||
29 | |||
30 | { 0x13, KEY_MUTE }, | ||
31 | { 0x11, KEY_PROPS }, | ||
32 | { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ | ||
33 | { 0x12, KEY_POWER }, | ||
34 | |||
35 | /* 0x01 0x02 0x03 0x0D * | ||
36 | * 1 2 3 Stereo * | ||
37 | * * | ||
38 | * 0x04 0x05 0x06 0x19 * | ||
39 | * 4 5 6 Snapshot * | ||
40 | * * | ||
41 | * 0x07 0x08 0x09 0x10 * | ||
42 | * 7 8 9 Zoom * | ||
43 | * */ | ||
44 | { 0x01, KEY_1 }, | ||
45 | { 0x02, KEY_2 }, | ||
46 | { 0x03, KEY_3 }, | ||
47 | { 0x0D, KEY_SETUP }, /* Setup key */ | ||
48 | { 0x04, KEY_4 }, | ||
49 | { 0x05, KEY_5 }, | ||
50 | { 0x06, KEY_6 }, | ||
51 | { 0x19, KEY_CAMERA }, /* Snapshot key */ | ||
52 | { 0x07, KEY_7 }, | ||
53 | { 0x08, KEY_8 }, | ||
54 | { 0x09, KEY_9 }, | ||
55 | { 0x10, KEY_ZOOM }, | ||
56 | |||
57 | /* 0x0A 0x00 0x0B 0x0C * | ||
58 | * RECALL 0 ChannelUp VolumeUp * | ||
59 | * */ | ||
60 | { 0x0A, KEY_AGAIN }, | ||
61 | { 0x00, KEY_0 }, | ||
62 | { 0x0B, KEY_CHANNELUP }, | ||
63 | { 0x0C, KEY_VOLUMEUP }, | ||
64 | |||
65 | /* 0x1B 0x1D 0x15 0x18 * | ||
66 | * Timeshift Record ChannelDown VolumeDown * | ||
67 | * */ | ||
68 | |||
69 | { 0x1B, KEY_TIME }, | ||
70 | { 0x1D, KEY_RECORD }, | ||
71 | { 0x15, KEY_CHANNELDOWN }, | ||
72 | { 0x18, KEY_VOLUMEDOWN }, | ||
73 | |||
74 | /* 0x0E 0x1E 0x0F 0x1A * | ||
75 | * Stop Pause Previouse Next * | ||
76 | * */ | ||
77 | |||
78 | { 0x0E, KEY_STOP }, | ||
79 | { 0x1E, KEY_PAUSE }, | ||
80 | { 0x0F, KEY_PREVIOUS }, | ||
81 | { 0x1A, KEY_NEXT }, | ||
82 | |||
83 | }; | ||
84 | |||
85 | static struct rc_keymap behold_columbus_map = { | ||
86 | .map = { | ||
87 | .scan = behold_columbus, | ||
88 | .size = ARRAY_SIZE(behold_columbus), | ||
89 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
90 | .name = RC_MAP_BEHOLD_COLUMBUS, | ||
91 | } | ||
92 | }; | ||
93 | |||
94 | static int __init init_rc_map_behold_columbus(void) | ||
95 | { | ||
96 | return ir_register_map(&behold_columbus_map); | ||
97 | } | ||
98 | |||
99 | static void __exit exit_rc_map_behold_columbus(void) | ||
100 | { | ||
101 | ir_unregister_map(&behold_columbus_map); | ||
102 | } | ||
103 | |||
104 | module_init(init_rc_map_behold_columbus) | ||
105 | module_exit(exit_rc_map_behold_columbus) | ||
106 | |||
107 | MODULE_LICENSE("GPL"); | ||
108 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-behold.c b/drivers/media/IR/keymaps/rc-behold.c deleted file mode 100644 index abc140b2098b..000000000000 --- a/drivers/media/IR/keymaps/rc-behold.c +++ /dev/null | |||
@@ -1,141 +0,0 @@ | |||
1 | /* behold.h - Keytable for behold Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | * Igor Kuznetsov <igk72@ya.ru> | ||
17 | * Andrey J. Melnikov <temnota@kmv.ru> | ||
18 | * | ||
19 | * Keytable is used by BeholdTV 60x series, M6 series at | ||
20 | * least, and probably other cards too. | ||
21 | * The "ascii-art picture" below (in comments, first row | ||
22 | * is the keycode in hex, and subsequent row(s) shows | ||
23 | * the button labels (several variants when appropriate) | ||
24 | * helps to descide which keycodes to assign to the buttons. | ||
25 | */ | ||
26 | |||
27 | static struct ir_scancode behold[] = { | ||
28 | |||
29 | /* 0x1c 0x12 * | ||
30 | * TV/FM POWER * | ||
31 | * */ | ||
32 | { 0x1c, KEY_TUNER }, /* XXX KEY_TV / KEY_RADIO */ | ||
33 | { 0x12, KEY_POWER }, | ||
34 | |||
35 | /* 0x01 0x02 0x03 * | ||
36 | * 1 2 3 * | ||
37 | * * | ||
38 | * 0x04 0x05 0x06 * | ||
39 | * 4 5 6 * | ||
40 | * * | ||
41 | * 0x07 0x08 0x09 * | ||
42 | * 7 8 9 * | ||
43 | * */ | ||
44 | { 0x01, KEY_1 }, | ||
45 | { 0x02, KEY_2 }, | ||
46 | { 0x03, KEY_3 }, | ||
47 | { 0x04, KEY_4 }, | ||
48 | { 0x05, KEY_5 }, | ||
49 | { 0x06, KEY_6 }, | ||
50 | { 0x07, KEY_7 }, | ||
51 | { 0x08, KEY_8 }, | ||
52 | { 0x09, KEY_9 }, | ||
53 | |||
54 | /* 0x0a 0x00 0x17 * | ||
55 | * RECALL 0 MODE * | ||
56 | * */ | ||
57 | { 0x0a, KEY_AGAIN }, | ||
58 | { 0x00, KEY_0 }, | ||
59 | { 0x17, KEY_MODE }, | ||
60 | |||
61 | /* 0x14 0x10 * | ||
62 | * ASPECT FULLSCREEN * | ||
63 | * */ | ||
64 | { 0x14, KEY_SCREEN }, | ||
65 | { 0x10, KEY_ZOOM }, | ||
66 | |||
67 | /* 0x0b * | ||
68 | * Up * | ||
69 | * * | ||
70 | * 0x18 0x16 0x0c * | ||
71 | * Left Ok Right * | ||
72 | * * | ||
73 | * 0x015 * | ||
74 | * Down * | ||
75 | * */ | ||
76 | { 0x0b, KEY_CHANNELUP }, | ||
77 | { 0x18, KEY_VOLUMEDOWN }, | ||
78 | { 0x16, KEY_OK }, /* XXX KEY_ENTER */ | ||
79 | { 0x0c, KEY_VOLUMEUP }, | ||
80 | { 0x15, KEY_CHANNELDOWN }, | ||
81 | |||
82 | /* 0x11 0x0d * | ||
83 | * MUTE INFO * | ||
84 | * */ | ||
85 | { 0x11, KEY_MUTE }, | ||
86 | { 0x0d, KEY_INFO }, | ||
87 | |||
88 | /* 0x0f 0x1b 0x1a * | ||
89 | * RECORD PLAY/PAUSE STOP * | ||
90 | * * | ||
91 | * 0x0e 0x1f 0x1e * | ||
92 | *TELETEXT AUDIO SOURCE * | ||
93 | * RED YELLOW * | ||
94 | * */ | ||
95 | { 0x0f, KEY_RECORD }, | ||
96 | { 0x1b, KEY_PLAYPAUSE }, | ||
97 | { 0x1a, KEY_STOP }, | ||
98 | { 0x0e, KEY_TEXT }, | ||
99 | { 0x1f, KEY_RED }, /*XXX KEY_AUDIO */ | ||
100 | { 0x1e, KEY_YELLOW }, /*XXX KEY_SOURCE */ | ||
101 | |||
102 | /* 0x1d 0x13 0x19 * | ||
103 | * SLEEP PREVIEW DVB * | ||
104 | * GREEN BLUE * | ||
105 | * */ | ||
106 | { 0x1d, KEY_SLEEP }, | ||
107 | { 0x13, KEY_GREEN }, | ||
108 | { 0x19, KEY_BLUE }, /* XXX KEY_SAT */ | ||
109 | |||
110 | /* 0x58 0x5c * | ||
111 | * FREEZE SNAPSHOT * | ||
112 | * */ | ||
113 | { 0x58, KEY_SLOW }, | ||
114 | { 0x5c, KEY_CAMERA }, | ||
115 | |||
116 | }; | ||
117 | |||
118 | static struct rc_keymap behold_map = { | ||
119 | .map = { | ||
120 | .scan = behold, | ||
121 | .size = ARRAY_SIZE(behold), | ||
122 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
123 | .name = RC_MAP_BEHOLD, | ||
124 | } | ||
125 | }; | ||
126 | |||
127 | static int __init init_rc_map_behold(void) | ||
128 | { | ||
129 | return ir_register_map(&behold_map); | ||
130 | } | ||
131 | |||
132 | static void __exit exit_rc_map_behold(void) | ||
133 | { | ||
134 | ir_unregister_map(&behold_map); | ||
135 | } | ||
136 | |||
137 | module_init(init_rc_map_behold) | ||
138 | module_exit(exit_rc_map_behold) | ||
139 | |||
140 | MODULE_LICENSE("GPL"); | ||
141 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-budget-ci-old.c b/drivers/media/IR/keymaps/rc-budget-ci-old.c deleted file mode 100644 index 64c2ac913338..000000000000 --- a/drivers/media/IR/keymaps/rc-budget-ci-old.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* budget-ci-old.h - Keytable for budget_ci_old Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* From reading the following remotes: | ||
16 | * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 | ||
17 | * Hauppauge (from NOVA-CI-s box product) | ||
18 | * This is a "middle of the road" approach, differences are noted | ||
19 | */ | ||
20 | |||
21 | static struct ir_scancode budget_ci_old[] = { | ||
22 | { 0x00, KEY_0 }, | ||
23 | { 0x01, KEY_1 }, | ||
24 | { 0x02, KEY_2 }, | ||
25 | { 0x03, KEY_3 }, | ||
26 | { 0x04, KEY_4 }, | ||
27 | { 0x05, KEY_5 }, | ||
28 | { 0x06, KEY_6 }, | ||
29 | { 0x07, KEY_7 }, | ||
30 | { 0x08, KEY_8 }, | ||
31 | { 0x09, KEY_9 }, | ||
32 | { 0x0a, KEY_ENTER }, | ||
33 | { 0x0b, KEY_RED }, | ||
34 | { 0x0c, KEY_POWER }, /* RADIO on Hauppauge */ | ||
35 | { 0x0d, KEY_MUTE }, | ||
36 | { 0x0f, KEY_A }, /* TV on Hauppauge */ | ||
37 | { 0x10, KEY_VOLUMEUP }, | ||
38 | { 0x11, KEY_VOLUMEDOWN }, | ||
39 | { 0x14, KEY_B }, | ||
40 | { 0x1c, KEY_UP }, | ||
41 | { 0x1d, KEY_DOWN }, | ||
42 | { 0x1e, KEY_OPTION }, /* RESERVED on Hauppauge */ | ||
43 | { 0x1f, KEY_BREAK }, | ||
44 | { 0x20, KEY_CHANNELUP }, | ||
45 | { 0x21, KEY_CHANNELDOWN }, | ||
46 | { 0x22, KEY_PREVIOUS }, /* Prev Ch on Zenith, SOURCE on Hauppauge */ | ||
47 | { 0x24, KEY_RESTART }, | ||
48 | { 0x25, KEY_OK }, | ||
49 | { 0x26, KEY_CYCLEWINDOWS }, /* MINIMIZE on Hauppauge */ | ||
50 | { 0x28, KEY_ENTER }, /* VCR mode on Zenith */ | ||
51 | { 0x29, KEY_PAUSE }, | ||
52 | { 0x2b, KEY_RIGHT }, | ||
53 | { 0x2c, KEY_LEFT }, | ||
54 | { 0x2e, KEY_MENU }, /* FULL SCREEN on Hauppauge */ | ||
55 | { 0x30, KEY_SLOW }, | ||
56 | { 0x31, KEY_PREVIOUS }, /* VCR mode on Zenith */ | ||
57 | { 0x32, KEY_REWIND }, | ||
58 | { 0x34, KEY_FASTFORWARD }, | ||
59 | { 0x35, KEY_PLAY }, | ||
60 | { 0x36, KEY_STOP }, | ||
61 | { 0x37, KEY_RECORD }, | ||
62 | { 0x38, KEY_TUNER }, /* TV/VCR on Zenith */ | ||
63 | { 0x3a, KEY_C }, | ||
64 | { 0x3c, KEY_EXIT }, | ||
65 | { 0x3d, KEY_POWER2 }, | ||
66 | { 0x3e, KEY_TUNER }, | ||
67 | }; | ||
68 | |||
69 | static struct rc_keymap budget_ci_old_map = { | ||
70 | .map = { | ||
71 | .scan = budget_ci_old, | ||
72 | .size = ARRAY_SIZE(budget_ci_old), | ||
73 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
74 | .name = RC_MAP_BUDGET_CI_OLD, | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | static int __init init_rc_map_budget_ci_old(void) | ||
79 | { | ||
80 | return ir_register_map(&budget_ci_old_map); | ||
81 | } | ||
82 | |||
83 | static void __exit exit_rc_map_budget_ci_old(void) | ||
84 | { | ||
85 | ir_unregister_map(&budget_ci_old_map); | ||
86 | } | ||
87 | |||
88 | module_init(init_rc_map_budget_ci_old) | ||
89 | module_exit(exit_rc_map_budget_ci_old) | ||
90 | |||
91 | MODULE_LICENSE("GPL"); | ||
92 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-cinergy-1400.c b/drivers/media/IR/keymaps/rc-cinergy-1400.c deleted file mode 100644 index 074f2c2c2c61..000000000000 --- a/drivers/media/IR/keymaps/rc-cinergy-1400.c +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /* cinergy-1400.h - Keytable for cinergy_1400 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Cinergy 1400 DVB-T */ | ||
16 | |||
17 | static struct ir_scancode cinergy_1400[] = { | ||
18 | { 0x01, KEY_POWER }, | ||
19 | { 0x02, KEY_1 }, | ||
20 | { 0x03, KEY_2 }, | ||
21 | { 0x04, KEY_3 }, | ||
22 | { 0x05, KEY_4 }, | ||
23 | { 0x06, KEY_5 }, | ||
24 | { 0x07, KEY_6 }, | ||
25 | { 0x08, KEY_7 }, | ||
26 | { 0x09, KEY_8 }, | ||
27 | { 0x0a, KEY_9 }, | ||
28 | { 0x0c, KEY_0 }, | ||
29 | |||
30 | { 0x0b, KEY_VIDEO }, | ||
31 | { 0x0d, KEY_REFRESH }, | ||
32 | { 0x0e, KEY_SELECT }, | ||
33 | { 0x0f, KEY_EPG }, | ||
34 | { 0x10, KEY_UP }, | ||
35 | { 0x11, KEY_LEFT }, | ||
36 | { 0x12, KEY_OK }, | ||
37 | { 0x13, KEY_RIGHT }, | ||
38 | { 0x14, KEY_DOWN }, | ||
39 | { 0x15, KEY_TEXT }, | ||
40 | { 0x16, KEY_INFO }, | ||
41 | |||
42 | { 0x17, KEY_RED }, | ||
43 | { 0x18, KEY_GREEN }, | ||
44 | { 0x19, KEY_YELLOW }, | ||
45 | { 0x1a, KEY_BLUE }, | ||
46 | |||
47 | { 0x1b, KEY_CHANNELUP }, | ||
48 | { 0x1c, KEY_VOLUMEUP }, | ||
49 | { 0x1d, KEY_MUTE }, | ||
50 | { 0x1e, KEY_VOLUMEDOWN }, | ||
51 | { 0x1f, KEY_CHANNELDOWN }, | ||
52 | |||
53 | { 0x40, KEY_PAUSE }, | ||
54 | { 0x4c, KEY_PLAY }, | ||
55 | { 0x58, KEY_RECORD }, | ||
56 | { 0x54, KEY_PREVIOUS }, | ||
57 | { 0x48, KEY_STOP }, | ||
58 | { 0x5c, KEY_NEXT }, | ||
59 | }; | ||
60 | |||
61 | static struct rc_keymap cinergy_1400_map = { | ||
62 | .map = { | ||
63 | .scan = cinergy_1400, | ||
64 | .size = ARRAY_SIZE(cinergy_1400), | ||
65 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
66 | .name = RC_MAP_CINERGY_1400, | ||
67 | } | ||
68 | }; | ||
69 | |||
70 | static int __init init_rc_map_cinergy_1400(void) | ||
71 | { | ||
72 | return ir_register_map(&cinergy_1400_map); | ||
73 | } | ||
74 | |||
75 | static void __exit exit_rc_map_cinergy_1400(void) | ||
76 | { | ||
77 | ir_unregister_map(&cinergy_1400_map); | ||
78 | } | ||
79 | |||
80 | module_init(init_rc_map_cinergy_1400) | ||
81 | module_exit(exit_rc_map_cinergy_1400) | ||
82 | |||
83 | MODULE_LICENSE("GPL"); | ||
84 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-cinergy.c b/drivers/media/IR/keymaps/rc-cinergy.c deleted file mode 100644 index cf84c3dba742..000000000000 --- a/drivers/media/IR/keymaps/rc-cinergy.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* cinergy.h - Keytable for cinergy Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode cinergy[] = { | ||
16 | { 0x00, KEY_0 }, | ||
17 | { 0x01, KEY_1 }, | ||
18 | { 0x02, KEY_2 }, | ||
19 | { 0x03, KEY_3 }, | ||
20 | { 0x04, KEY_4 }, | ||
21 | { 0x05, KEY_5 }, | ||
22 | { 0x06, KEY_6 }, | ||
23 | { 0x07, KEY_7 }, | ||
24 | { 0x08, KEY_8 }, | ||
25 | { 0x09, KEY_9 }, | ||
26 | |||
27 | { 0x0a, KEY_POWER }, | ||
28 | { 0x0b, KEY_PROG1 }, /* app */ | ||
29 | { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */ | ||
30 | { 0x0d, KEY_CHANNELUP }, /* channel */ | ||
31 | { 0x0e, KEY_CHANNELDOWN }, /* channel- */ | ||
32 | { 0x0f, KEY_VOLUMEUP }, | ||
33 | { 0x10, KEY_VOLUMEDOWN }, | ||
34 | { 0x11, KEY_TUNER }, /* AV */ | ||
35 | { 0x12, KEY_NUMLOCK }, /* -/-- */ | ||
36 | { 0x13, KEY_AUDIO }, /* audio */ | ||
37 | { 0x14, KEY_MUTE }, | ||
38 | { 0x15, KEY_UP }, | ||
39 | { 0x16, KEY_DOWN }, | ||
40 | { 0x17, KEY_LEFT }, | ||
41 | { 0x18, KEY_RIGHT }, | ||
42 | { 0x19, BTN_LEFT, }, | ||
43 | { 0x1a, BTN_RIGHT, }, | ||
44 | { 0x1b, KEY_WWW }, /* text */ | ||
45 | { 0x1c, KEY_REWIND }, | ||
46 | { 0x1d, KEY_FORWARD }, | ||
47 | { 0x1e, KEY_RECORD }, | ||
48 | { 0x1f, KEY_PLAY }, | ||
49 | { 0x20, KEY_PREVIOUSSONG }, | ||
50 | { 0x21, KEY_NEXTSONG }, | ||
51 | { 0x22, KEY_PAUSE }, | ||
52 | { 0x23, KEY_STOP }, | ||
53 | }; | ||
54 | |||
55 | static struct rc_keymap cinergy_map = { | ||
56 | .map = { | ||
57 | .scan = cinergy, | ||
58 | .size = ARRAY_SIZE(cinergy), | ||
59 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
60 | .name = RC_MAP_CINERGY, | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | static int __init init_rc_map_cinergy(void) | ||
65 | { | ||
66 | return ir_register_map(&cinergy_map); | ||
67 | } | ||
68 | |||
69 | static void __exit exit_rc_map_cinergy(void) | ||
70 | { | ||
71 | ir_unregister_map(&cinergy_map); | ||
72 | } | ||
73 | |||
74 | module_init(init_rc_map_cinergy) | ||
75 | module_exit(exit_rc_map_cinergy) | ||
76 | |||
77 | MODULE_LICENSE("GPL"); | ||
78 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-dib0700-nec.c b/drivers/media/IR/keymaps/rc-dib0700-nec.c deleted file mode 100644 index ae1832038fbe..000000000000 --- a/drivers/media/IR/keymaps/rc-dib0700-nec.c +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | /* rc-dvb0700-big.c - Keytable for devices in dvb0700 | ||
2 | * | ||
3 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * TODO: This table is a real mess, as it merges RC codes from several | ||
6 | * devices into a big table. It also has both RC-5 and NEC codes inside. | ||
7 | * It should be broken into small tables, and the protocols should properly | ||
8 | * be indentificated. | ||
9 | * | ||
10 | * The table were imported from dib0700_devices.c. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <media/rc-map.h> | ||
19 | |||
20 | static struct ir_scancode dib0700_nec_table[] = { | ||
21 | /* Key codes for the Pixelview SBTVD remote */ | ||
22 | { 0x8613, KEY_MUTE }, | ||
23 | { 0x8612, KEY_POWER }, | ||
24 | { 0x8601, KEY_1 }, | ||
25 | { 0x8602, KEY_2 }, | ||
26 | { 0x8603, KEY_3 }, | ||
27 | { 0x8604, KEY_4 }, | ||
28 | { 0x8605, KEY_5 }, | ||
29 | { 0x8606, KEY_6 }, | ||
30 | { 0x8607, KEY_7 }, | ||
31 | { 0x8608, KEY_8 }, | ||
32 | { 0x8609, KEY_9 }, | ||
33 | { 0x8600, KEY_0 }, | ||
34 | { 0x860d, KEY_CHANNELUP }, | ||
35 | { 0x8619, KEY_CHANNELDOWN }, | ||
36 | { 0x8610, KEY_VOLUMEUP }, | ||
37 | { 0x860c, KEY_VOLUMEDOWN }, | ||
38 | |||
39 | { 0x860a, KEY_CAMERA }, | ||
40 | { 0x860b, KEY_ZOOM }, | ||
41 | { 0x861b, KEY_BACKSPACE }, | ||
42 | { 0x8615, KEY_ENTER }, | ||
43 | |||
44 | { 0x861d, KEY_UP }, | ||
45 | { 0x861e, KEY_DOWN }, | ||
46 | { 0x860e, KEY_LEFT }, | ||
47 | { 0x860f, KEY_RIGHT }, | ||
48 | |||
49 | { 0x8618, KEY_RECORD }, | ||
50 | { 0x861a, KEY_STOP }, | ||
51 | |||
52 | /* Key codes for the EvolutePC TVWay+ remote */ | ||
53 | { 0x7a00, KEY_MENU }, | ||
54 | { 0x7a01, KEY_RECORD }, | ||
55 | { 0x7a02, KEY_PLAY }, | ||
56 | { 0x7a03, KEY_STOP }, | ||
57 | { 0x7a10, KEY_CHANNELUP }, | ||
58 | { 0x7a11, KEY_CHANNELDOWN }, | ||
59 | { 0x7a12, KEY_VOLUMEUP }, | ||
60 | { 0x7a13, KEY_VOLUMEDOWN }, | ||
61 | { 0x7a40, KEY_POWER }, | ||
62 | { 0x7a41, KEY_MUTE }, | ||
63 | |||
64 | /* Key codes for the Elgato EyeTV Diversity silver remote */ | ||
65 | { 0x4501, KEY_POWER }, | ||
66 | { 0x4502, KEY_MUTE }, | ||
67 | { 0x4503, KEY_1 }, | ||
68 | { 0x4504, KEY_2 }, | ||
69 | { 0x4505, KEY_3 }, | ||
70 | { 0x4506, KEY_4 }, | ||
71 | { 0x4507, KEY_5 }, | ||
72 | { 0x4508, KEY_6 }, | ||
73 | { 0x4509, KEY_7 }, | ||
74 | { 0x450a, KEY_8 }, | ||
75 | { 0x450b, KEY_9 }, | ||
76 | { 0x450c, KEY_LAST }, | ||
77 | { 0x450d, KEY_0 }, | ||
78 | { 0x450e, KEY_ENTER }, | ||
79 | { 0x450f, KEY_RED }, | ||
80 | { 0x4510, KEY_CHANNELUP }, | ||
81 | { 0x4511, KEY_GREEN }, | ||
82 | { 0x4512, KEY_VOLUMEDOWN }, | ||
83 | { 0x4513, KEY_OK }, | ||
84 | { 0x4514, KEY_VOLUMEUP }, | ||
85 | { 0x4515, KEY_YELLOW }, | ||
86 | { 0x4516, KEY_CHANNELDOWN }, | ||
87 | { 0x4517, KEY_BLUE }, | ||
88 | { 0x4518, KEY_LEFT }, /* Skip backwards */ | ||
89 | { 0x4519, KEY_PLAYPAUSE }, | ||
90 | { 0x451a, KEY_RIGHT }, /* Skip forward */ | ||
91 | { 0x451b, KEY_REWIND }, | ||
92 | { 0x451c, KEY_L }, /* Live */ | ||
93 | { 0x451d, KEY_FASTFORWARD }, | ||
94 | { 0x451e, KEY_STOP }, /* 'Reveal' for Teletext */ | ||
95 | { 0x451f, KEY_MENU }, /* KEY_TEXT for Teletext */ | ||
96 | { 0x4540, KEY_RECORD }, /* Font 'Size' for Teletext */ | ||
97 | { 0x4541, KEY_SCREEN }, /* Full screen toggle, 'Hold' for Teletext */ | ||
98 | { 0x4542, KEY_SELECT }, /* Select video input, 'Select' for Teletext */ | ||
99 | }; | ||
100 | |||
101 | static struct rc_keymap dib0700_nec_map = { | ||
102 | .map = { | ||
103 | .scan = dib0700_nec_table, | ||
104 | .size = ARRAY_SIZE(dib0700_nec_table), | ||
105 | .ir_type = IR_TYPE_NEC, | ||
106 | .name = RC_MAP_DIB0700_NEC_TABLE, | ||
107 | } | ||
108 | }; | ||
109 | |||
110 | static int __init init_rc_map(void) | ||
111 | { | ||
112 | return ir_register_map(&dib0700_nec_map); | ||
113 | } | ||
114 | |||
115 | static void __exit exit_rc_map(void) | ||
116 | { | ||
117 | ir_unregister_map(&dib0700_nec_map); | ||
118 | } | ||
119 | |||
120 | module_init(init_rc_map) | ||
121 | module_exit(exit_rc_map) | ||
122 | |||
123 | MODULE_LICENSE("GPL"); | ||
124 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-dib0700-rc5.c b/drivers/media/IR/keymaps/rc-dib0700-rc5.c deleted file mode 100644 index 4a4797cfd77d..000000000000 --- a/drivers/media/IR/keymaps/rc-dib0700-rc5.c +++ /dev/null | |||
@@ -1,235 +0,0 @@ | |||
1 | /* rc-dvb0700-big.c - Keytable for devices in dvb0700 | ||
2 | * | ||
3 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * TODO: This table is a real mess, as it merges RC codes from several | ||
6 | * devices into a big table. It also has both RC-5 and NEC codes inside. | ||
7 | * It should be broken into small tables, and the protocols should properly | ||
8 | * be indentificated. | ||
9 | * | ||
10 | * The table were imported from dib0700_devices.c. | ||
11 | * | ||
12 | * This program is free software; you can redistribute it and/or modify | ||
13 | * it under the terms of the GNU General Public License as published by | ||
14 | * the Free Software Foundation; either version 2 of the License, or | ||
15 | * (at your option) any later version. | ||
16 | */ | ||
17 | |||
18 | #include <media/rc-map.h> | ||
19 | |||
20 | static struct ir_scancode dib0700_rc5_table[] = { | ||
21 | /* Key codes for the tiny Pinnacle remote*/ | ||
22 | { 0x0700, KEY_MUTE }, | ||
23 | { 0x0701, KEY_MENU }, /* Pinnacle logo */ | ||
24 | { 0x0739, KEY_POWER }, | ||
25 | { 0x0703, KEY_VOLUMEUP }, | ||
26 | { 0x0709, KEY_VOLUMEDOWN }, | ||
27 | { 0x0706, KEY_CHANNELUP }, | ||
28 | { 0x070c, KEY_CHANNELDOWN }, | ||
29 | { 0x070f, KEY_1 }, | ||
30 | { 0x0715, KEY_2 }, | ||
31 | { 0x0710, KEY_3 }, | ||
32 | { 0x0718, KEY_4 }, | ||
33 | { 0x071b, KEY_5 }, | ||
34 | { 0x071e, KEY_6 }, | ||
35 | { 0x0711, KEY_7 }, | ||
36 | { 0x0721, KEY_8 }, | ||
37 | { 0x0712, KEY_9 }, | ||
38 | { 0x0727, KEY_0 }, | ||
39 | { 0x0724, KEY_SCREEN }, /* 'Square' key */ | ||
40 | { 0x072a, KEY_TEXT }, /* 'T' key */ | ||
41 | { 0x072d, KEY_REWIND }, | ||
42 | { 0x0730, KEY_PLAY }, | ||
43 | { 0x0733, KEY_FASTFORWARD }, | ||
44 | { 0x0736, KEY_RECORD }, | ||
45 | { 0x073c, KEY_STOP }, | ||
46 | { 0x073f, KEY_CANCEL }, /* '?' key */ | ||
47 | |||
48 | /* Key codes for the Terratec Cinergy DT XS Diversity, similar to cinergyT2.c */ | ||
49 | { 0xeb01, KEY_POWER }, | ||
50 | { 0xeb02, KEY_1 }, | ||
51 | { 0xeb03, KEY_2 }, | ||
52 | { 0xeb04, KEY_3 }, | ||
53 | { 0xeb05, KEY_4 }, | ||
54 | { 0xeb06, KEY_5 }, | ||
55 | { 0xeb07, KEY_6 }, | ||
56 | { 0xeb08, KEY_7 }, | ||
57 | { 0xeb09, KEY_8 }, | ||
58 | { 0xeb0a, KEY_9 }, | ||
59 | { 0xeb0b, KEY_VIDEO }, | ||
60 | { 0xeb0c, KEY_0 }, | ||
61 | { 0xeb0d, KEY_REFRESH }, | ||
62 | { 0xeb0f, KEY_EPG }, | ||
63 | { 0xeb10, KEY_UP }, | ||
64 | { 0xeb11, KEY_LEFT }, | ||
65 | { 0xeb12, KEY_OK }, | ||
66 | { 0xeb13, KEY_RIGHT }, | ||
67 | { 0xeb14, KEY_DOWN }, | ||
68 | { 0xeb16, KEY_INFO }, | ||
69 | { 0xeb17, KEY_RED }, | ||
70 | { 0xeb18, KEY_GREEN }, | ||
71 | { 0xeb19, KEY_YELLOW }, | ||
72 | { 0xeb1a, KEY_BLUE }, | ||
73 | { 0xeb1b, KEY_CHANNELUP }, | ||
74 | { 0xeb1c, KEY_VOLUMEUP }, | ||
75 | { 0xeb1d, KEY_MUTE }, | ||
76 | { 0xeb1e, KEY_VOLUMEDOWN }, | ||
77 | { 0xeb1f, KEY_CHANNELDOWN }, | ||
78 | { 0xeb40, KEY_PAUSE }, | ||
79 | { 0xeb41, KEY_HOME }, | ||
80 | { 0xeb42, KEY_MENU }, /* DVD Menu */ | ||
81 | { 0xeb43, KEY_SUBTITLE }, | ||
82 | { 0xeb44, KEY_TEXT }, /* Teletext */ | ||
83 | { 0xeb45, KEY_DELETE }, | ||
84 | { 0xeb46, KEY_TV }, | ||
85 | { 0xeb47, KEY_DVD }, | ||
86 | { 0xeb48, KEY_STOP }, | ||
87 | { 0xeb49, KEY_VIDEO }, | ||
88 | { 0xeb4a, KEY_AUDIO }, /* Music */ | ||
89 | { 0xeb4b, KEY_SCREEN }, /* Pic */ | ||
90 | { 0xeb4c, KEY_PLAY }, | ||
91 | { 0xeb4d, KEY_BACK }, | ||
92 | { 0xeb4e, KEY_REWIND }, | ||
93 | { 0xeb4f, KEY_FASTFORWARD }, | ||
94 | { 0xeb54, KEY_PREVIOUS }, | ||
95 | { 0xeb58, KEY_RECORD }, | ||
96 | { 0xeb5c, KEY_NEXT }, | ||
97 | |||
98 | /* Key codes for the Haupauge WinTV Nova-TD, copied from nova-t-usb2.c (Nova-T USB2) */ | ||
99 | { 0x1e00, KEY_0 }, | ||
100 | { 0x1e01, KEY_1 }, | ||
101 | { 0x1e02, KEY_2 }, | ||
102 | { 0x1e03, KEY_3 }, | ||
103 | { 0x1e04, KEY_4 }, | ||
104 | { 0x1e05, KEY_5 }, | ||
105 | { 0x1e06, KEY_6 }, | ||
106 | { 0x1e07, KEY_7 }, | ||
107 | { 0x1e08, KEY_8 }, | ||
108 | { 0x1e09, KEY_9 }, | ||
109 | { 0x1e0a, KEY_KPASTERISK }, | ||
110 | { 0x1e0b, KEY_RED }, | ||
111 | { 0x1e0c, KEY_RADIO }, | ||
112 | { 0x1e0d, KEY_MENU }, | ||
113 | { 0x1e0e, KEY_GRAVE }, /* # */ | ||
114 | { 0x1e0f, KEY_MUTE }, | ||
115 | { 0x1e10, KEY_VOLUMEUP }, | ||
116 | { 0x1e11, KEY_VOLUMEDOWN }, | ||
117 | { 0x1e12, KEY_CHANNEL }, | ||
118 | { 0x1e14, KEY_UP }, | ||
119 | { 0x1e15, KEY_DOWN }, | ||
120 | { 0x1e16, KEY_LEFT }, | ||
121 | { 0x1e17, KEY_RIGHT }, | ||
122 | { 0x1e18, KEY_VIDEO }, | ||
123 | { 0x1e19, KEY_AUDIO }, | ||
124 | { 0x1e1a, KEY_MEDIA }, | ||
125 | { 0x1e1b, KEY_EPG }, | ||
126 | { 0x1e1c, KEY_TV }, | ||
127 | { 0x1e1e, KEY_NEXT }, | ||
128 | { 0x1e1f, KEY_BACK }, | ||
129 | { 0x1e20, KEY_CHANNELUP }, | ||
130 | { 0x1e21, KEY_CHANNELDOWN }, | ||
131 | { 0x1e24, KEY_LAST }, /* Skip backwards */ | ||
132 | { 0x1e25, KEY_OK }, | ||
133 | { 0x1e29, KEY_BLUE}, | ||
134 | { 0x1e2e, KEY_GREEN }, | ||
135 | { 0x1e30, KEY_PAUSE }, | ||
136 | { 0x1e32, KEY_REWIND }, | ||
137 | { 0x1e34, KEY_FASTFORWARD }, | ||
138 | { 0x1e35, KEY_PLAY }, | ||
139 | { 0x1e36, KEY_STOP }, | ||
140 | { 0x1e37, KEY_RECORD }, | ||
141 | { 0x1e38, KEY_YELLOW }, | ||
142 | { 0x1e3b, KEY_GOTO }, | ||
143 | { 0x1e3d, KEY_POWER }, | ||
144 | |||
145 | /* Key codes for the Leadtek Winfast DTV Dongle */ | ||
146 | { 0x0042, KEY_POWER }, | ||
147 | { 0x077c, KEY_TUNER }, | ||
148 | { 0x0f4e, KEY_PRINT }, /* PREVIEW */ | ||
149 | { 0x0840, KEY_SCREEN }, /* full screen toggle*/ | ||
150 | { 0x0f71, KEY_DOT }, /* frequency */ | ||
151 | { 0x0743, KEY_0 }, | ||
152 | { 0x0c41, KEY_1 }, | ||
153 | { 0x0443, KEY_2 }, | ||
154 | { 0x0b7f, KEY_3 }, | ||
155 | { 0x0e41, KEY_4 }, | ||
156 | { 0x0643, KEY_5 }, | ||
157 | { 0x097f, KEY_6 }, | ||
158 | { 0x0d7e, KEY_7 }, | ||
159 | { 0x057c, KEY_8 }, | ||
160 | { 0x0a40, KEY_9 }, | ||
161 | { 0x0e4e, KEY_CLEAR }, | ||
162 | { 0x047c, KEY_CHANNEL }, /* show channel number */ | ||
163 | { 0x0f41, KEY_LAST }, /* recall */ | ||
164 | { 0x0342, KEY_MUTE }, | ||
165 | { 0x064c, KEY_RESERVED }, /* PIP button*/ | ||
166 | { 0x0172, KEY_SHUFFLE }, /* SNAPSHOT */ | ||
167 | { 0x0c4e, KEY_PLAYPAUSE }, /* TIMESHIFT */ | ||
168 | { 0x0b70, KEY_RECORD }, | ||
169 | { 0x037d, KEY_VOLUMEUP }, | ||
170 | { 0x017d, KEY_VOLUMEDOWN }, | ||
171 | { 0x0242, KEY_CHANNELUP }, | ||
172 | { 0x007d, KEY_CHANNELDOWN }, | ||
173 | |||
174 | /* Key codes for Nova-TD "credit card" remote control. */ | ||
175 | { 0x1d00, KEY_0 }, | ||
176 | { 0x1d01, KEY_1 }, | ||
177 | { 0x1d02, KEY_2 }, | ||
178 | { 0x1d03, KEY_3 }, | ||
179 | { 0x1d04, KEY_4 }, | ||
180 | { 0x1d05, KEY_5 }, | ||
181 | { 0x1d06, KEY_6 }, | ||
182 | { 0x1d07, KEY_7 }, | ||
183 | { 0x1d08, KEY_8 }, | ||
184 | { 0x1d09, KEY_9 }, | ||
185 | { 0x1d0a, KEY_TEXT }, | ||
186 | { 0x1d0d, KEY_MENU }, | ||
187 | { 0x1d0f, KEY_MUTE }, | ||
188 | { 0x1d10, KEY_VOLUMEUP }, | ||
189 | { 0x1d11, KEY_VOLUMEDOWN }, | ||
190 | { 0x1d12, KEY_CHANNEL }, | ||
191 | { 0x1d14, KEY_UP }, | ||
192 | { 0x1d15, KEY_DOWN }, | ||
193 | { 0x1d16, KEY_LEFT }, | ||
194 | { 0x1d17, KEY_RIGHT }, | ||
195 | { 0x1d1c, KEY_TV }, | ||
196 | { 0x1d1e, KEY_NEXT }, | ||
197 | { 0x1d1f, KEY_BACK }, | ||
198 | { 0x1d20, KEY_CHANNELUP }, | ||
199 | { 0x1d21, KEY_CHANNELDOWN }, | ||
200 | { 0x1d24, KEY_LAST }, | ||
201 | { 0x1d25, KEY_OK }, | ||
202 | { 0x1d30, KEY_PAUSE }, | ||
203 | { 0x1d32, KEY_REWIND }, | ||
204 | { 0x1d34, KEY_FASTFORWARD }, | ||
205 | { 0x1d35, KEY_PLAY }, | ||
206 | { 0x1d36, KEY_STOP }, | ||
207 | { 0x1d37, KEY_RECORD }, | ||
208 | { 0x1d3b, KEY_GOTO }, | ||
209 | { 0x1d3d, KEY_POWER }, | ||
210 | }; | ||
211 | |||
212 | static struct rc_keymap dib0700_rc5_map = { | ||
213 | .map = { | ||
214 | .scan = dib0700_rc5_table, | ||
215 | .size = ARRAY_SIZE(dib0700_rc5_table), | ||
216 | .ir_type = IR_TYPE_RC5, | ||
217 | .name = RC_MAP_DIB0700_RC5_TABLE, | ||
218 | } | ||
219 | }; | ||
220 | |||
221 | static int __init init_rc_map(void) | ||
222 | { | ||
223 | return ir_register_map(&dib0700_rc5_map); | ||
224 | } | ||
225 | |||
226 | static void __exit exit_rc_map(void) | ||
227 | { | ||
228 | ir_unregister_map(&dib0700_rc5_map); | ||
229 | } | ||
230 | |||
231 | module_init(init_rc_map) | ||
232 | module_exit(exit_rc_map) | ||
233 | |||
234 | MODULE_LICENSE("GPL"); | ||
235 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-dm1105-nec.c b/drivers/media/IR/keymaps/rc-dm1105-nec.c deleted file mode 100644 index 90684d0efea3..000000000000 --- a/drivers/media/IR/keymaps/rc-dm1105-nec.c +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | /* dm1105-nec.h - Keytable for dm1105_nec Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* DVBWorld remotes | ||
16 | Igor M. Liplianin <liplianin@me.by> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode dm1105_nec[] = { | ||
20 | { 0x0a, KEY_POWER2}, /* power */ | ||
21 | { 0x0c, KEY_MUTE}, /* mute */ | ||
22 | { 0x11, KEY_1}, | ||
23 | { 0x12, KEY_2}, | ||
24 | { 0x13, KEY_3}, | ||
25 | { 0x14, KEY_4}, | ||
26 | { 0x15, KEY_5}, | ||
27 | { 0x16, KEY_6}, | ||
28 | { 0x17, KEY_7}, | ||
29 | { 0x18, KEY_8}, | ||
30 | { 0x19, KEY_9}, | ||
31 | { 0x10, KEY_0}, | ||
32 | { 0x1c, KEY_CHANNELUP}, /* ch+ */ | ||
33 | { 0x0f, KEY_CHANNELDOWN}, /* ch- */ | ||
34 | { 0x1a, KEY_VOLUMEUP}, /* vol+ */ | ||
35 | { 0x0e, KEY_VOLUMEDOWN}, /* vol- */ | ||
36 | { 0x04, KEY_RECORD}, /* rec */ | ||
37 | { 0x09, KEY_CHANNEL}, /* fav */ | ||
38 | { 0x08, KEY_BACKSPACE}, /* rewind */ | ||
39 | { 0x07, KEY_FASTFORWARD}, /* fast */ | ||
40 | { 0x0b, KEY_PAUSE}, /* pause */ | ||
41 | { 0x02, KEY_ESC}, /* cancel */ | ||
42 | { 0x03, KEY_TAB}, /* tab */ | ||
43 | { 0x00, KEY_UP}, /* up */ | ||
44 | { 0x1f, KEY_ENTER}, /* ok */ | ||
45 | { 0x01, KEY_DOWN}, /* down */ | ||
46 | { 0x05, KEY_RECORD}, /* cap */ | ||
47 | { 0x06, KEY_STOP}, /* stop */ | ||
48 | { 0x40, KEY_ZOOM}, /* full */ | ||
49 | { 0x1e, KEY_TV}, /* tvmode */ | ||
50 | { 0x1b, KEY_B}, /* recall */ | ||
51 | }; | ||
52 | |||
53 | static struct rc_keymap dm1105_nec_map = { | ||
54 | .map = { | ||
55 | .scan = dm1105_nec, | ||
56 | .size = ARRAY_SIZE(dm1105_nec), | ||
57 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
58 | .name = RC_MAP_DM1105_NEC, | ||
59 | } | ||
60 | }; | ||
61 | |||
62 | static int __init init_rc_map_dm1105_nec(void) | ||
63 | { | ||
64 | return ir_register_map(&dm1105_nec_map); | ||
65 | } | ||
66 | |||
67 | static void __exit exit_rc_map_dm1105_nec(void) | ||
68 | { | ||
69 | ir_unregister_map(&dm1105_nec_map); | ||
70 | } | ||
71 | |||
72 | module_init(init_rc_map_dm1105_nec) | ||
73 | module_exit(exit_rc_map_dm1105_nec) | ||
74 | |||
75 | MODULE_LICENSE("GPL"); | ||
76 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c b/drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c deleted file mode 100644 index 8a4027af964a..000000000000 --- a/drivers/media/IR/keymaps/rc-dntv-live-dvb-t.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* dntv-live-dvb-t.h - Keytable for dntv_live_dvb_t Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* DigitalNow DNTV Live DVB-T Remote */ | ||
16 | |||
17 | static struct ir_scancode dntv_live_dvb_t[] = { | ||
18 | { 0x00, KEY_ESC }, /* 'go up a level?' */ | ||
19 | /* Keys 0 to 9 */ | ||
20 | { 0x0a, KEY_0 }, | ||
21 | { 0x01, KEY_1 }, | ||
22 | { 0x02, KEY_2 }, | ||
23 | { 0x03, KEY_3 }, | ||
24 | { 0x04, KEY_4 }, | ||
25 | { 0x05, KEY_5 }, | ||
26 | { 0x06, KEY_6 }, | ||
27 | { 0x07, KEY_7 }, | ||
28 | { 0x08, KEY_8 }, | ||
29 | { 0x09, KEY_9 }, | ||
30 | |||
31 | { 0x0b, KEY_TUNER }, /* tv/fm */ | ||
32 | { 0x0c, KEY_SEARCH }, /* scan */ | ||
33 | { 0x0d, KEY_STOP }, | ||
34 | { 0x0e, KEY_PAUSE }, | ||
35 | { 0x0f, KEY_LIST }, /* source */ | ||
36 | |||
37 | { 0x10, KEY_MUTE }, | ||
38 | { 0x11, KEY_REWIND }, /* backward << */ | ||
39 | { 0x12, KEY_POWER }, | ||
40 | { 0x13, KEY_CAMERA }, /* snap */ | ||
41 | { 0x14, KEY_AUDIO }, /* stereo */ | ||
42 | { 0x15, KEY_CLEAR }, /* reset */ | ||
43 | { 0x16, KEY_PLAY }, | ||
44 | { 0x17, KEY_ENTER }, | ||
45 | { 0x18, KEY_ZOOM }, /* full screen */ | ||
46 | { 0x19, KEY_FASTFORWARD }, /* forward >> */ | ||
47 | { 0x1a, KEY_CHANNELUP }, | ||
48 | { 0x1b, KEY_VOLUMEUP }, | ||
49 | { 0x1c, KEY_INFO }, /* preview */ | ||
50 | { 0x1d, KEY_RECORD }, /* record */ | ||
51 | { 0x1e, KEY_CHANNELDOWN }, | ||
52 | { 0x1f, KEY_VOLUMEDOWN }, | ||
53 | }; | ||
54 | |||
55 | static struct rc_keymap dntv_live_dvb_t_map = { | ||
56 | .map = { | ||
57 | .scan = dntv_live_dvb_t, | ||
58 | .size = ARRAY_SIZE(dntv_live_dvb_t), | ||
59 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
60 | .name = RC_MAP_DNTV_LIVE_DVB_T, | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | static int __init init_rc_map_dntv_live_dvb_t(void) | ||
65 | { | ||
66 | return ir_register_map(&dntv_live_dvb_t_map); | ||
67 | } | ||
68 | |||
69 | static void __exit exit_rc_map_dntv_live_dvb_t(void) | ||
70 | { | ||
71 | ir_unregister_map(&dntv_live_dvb_t_map); | ||
72 | } | ||
73 | |||
74 | module_init(init_rc_map_dntv_live_dvb_t) | ||
75 | module_exit(exit_rc_map_dntv_live_dvb_t) | ||
76 | |||
77 | MODULE_LICENSE("GPL"); | ||
78 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c b/drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c deleted file mode 100644 index 6f4d60764d59..000000000000 --- a/drivers/media/IR/keymaps/rc-dntv-live-dvbt-pro.c +++ /dev/null | |||
@@ -1,97 +0,0 @@ | |||
1 | /* dntv-live-dvbt-pro.h - Keytable for dntv_live_dvbt_pro Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* DigitalNow DNTV Live! DVB-T Pro Remote */ | ||
16 | |||
17 | static struct ir_scancode dntv_live_dvbt_pro[] = { | ||
18 | { 0x16, KEY_POWER }, | ||
19 | { 0x5b, KEY_HOME }, | ||
20 | |||
21 | { 0x55, KEY_TV }, /* live tv */ | ||
22 | { 0x58, KEY_TUNER }, /* digital Radio */ | ||
23 | { 0x5a, KEY_RADIO }, /* FM radio */ | ||
24 | { 0x59, KEY_DVD }, /* dvd menu */ | ||
25 | { 0x03, KEY_1 }, | ||
26 | { 0x01, KEY_2 }, | ||
27 | { 0x06, KEY_3 }, | ||
28 | { 0x09, KEY_4 }, | ||
29 | { 0x1d, KEY_5 }, | ||
30 | { 0x1f, KEY_6 }, | ||
31 | { 0x0d, KEY_7 }, | ||
32 | { 0x19, KEY_8 }, | ||
33 | { 0x1b, KEY_9 }, | ||
34 | { 0x0c, KEY_CANCEL }, | ||
35 | { 0x15, KEY_0 }, | ||
36 | { 0x4a, KEY_CLEAR }, | ||
37 | { 0x13, KEY_BACK }, | ||
38 | { 0x00, KEY_TAB }, | ||
39 | { 0x4b, KEY_UP }, | ||
40 | { 0x4e, KEY_LEFT }, | ||
41 | { 0x4f, KEY_OK }, | ||
42 | { 0x52, KEY_RIGHT }, | ||
43 | { 0x51, KEY_DOWN }, | ||
44 | { 0x1e, KEY_VOLUMEUP }, | ||
45 | { 0x0a, KEY_VOLUMEDOWN }, | ||
46 | { 0x02, KEY_CHANNELDOWN }, | ||
47 | { 0x05, KEY_CHANNELUP }, | ||
48 | { 0x11, KEY_RECORD }, | ||
49 | { 0x14, KEY_PLAY }, | ||
50 | { 0x4c, KEY_PAUSE }, | ||
51 | { 0x1a, KEY_STOP }, | ||
52 | { 0x40, KEY_REWIND }, | ||
53 | { 0x12, KEY_FASTFORWARD }, | ||
54 | { 0x41, KEY_PREVIOUSSONG }, /* replay |< */ | ||
55 | { 0x42, KEY_NEXTSONG }, /* skip >| */ | ||
56 | { 0x54, KEY_CAMERA }, /* capture */ | ||
57 | { 0x50, KEY_LANGUAGE }, /* sap */ | ||
58 | { 0x47, KEY_TV2 }, /* pip */ | ||
59 | { 0x4d, KEY_SCREEN }, | ||
60 | { 0x43, KEY_SUBTITLE }, | ||
61 | { 0x10, KEY_MUTE }, | ||
62 | { 0x49, KEY_AUDIO }, /* l/r */ | ||
63 | { 0x07, KEY_SLEEP }, | ||
64 | { 0x08, KEY_VIDEO }, /* a/v */ | ||
65 | { 0x0e, KEY_PREVIOUS }, /* recall */ | ||
66 | { 0x45, KEY_ZOOM }, /* zoom + */ | ||
67 | { 0x46, KEY_ANGLE }, /* zoom - */ | ||
68 | { 0x56, KEY_RED }, | ||
69 | { 0x57, KEY_GREEN }, | ||
70 | { 0x5c, KEY_YELLOW }, | ||
71 | { 0x5d, KEY_BLUE }, | ||
72 | }; | ||
73 | |||
74 | static struct rc_keymap dntv_live_dvbt_pro_map = { | ||
75 | .map = { | ||
76 | .scan = dntv_live_dvbt_pro, | ||
77 | .size = ARRAY_SIZE(dntv_live_dvbt_pro), | ||
78 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
79 | .name = RC_MAP_DNTV_LIVE_DVBT_PRO, | ||
80 | } | ||
81 | }; | ||
82 | |||
83 | static int __init init_rc_map_dntv_live_dvbt_pro(void) | ||
84 | { | ||
85 | return ir_register_map(&dntv_live_dvbt_pro_map); | ||
86 | } | ||
87 | |||
88 | static void __exit exit_rc_map_dntv_live_dvbt_pro(void) | ||
89 | { | ||
90 | ir_unregister_map(&dntv_live_dvbt_pro_map); | ||
91 | } | ||
92 | |||
93 | module_init(init_rc_map_dntv_live_dvbt_pro) | ||
94 | module_exit(exit_rc_map_dntv_live_dvbt_pro) | ||
95 | |||
96 | MODULE_LICENSE("GPL"); | ||
97 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-em-terratec.c b/drivers/media/IR/keymaps/rc-em-terratec.c deleted file mode 100644 index 3130c9c29e6b..000000000000 --- a/drivers/media/IR/keymaps/rc-em-terratec.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* em-terratec.h - Keytable for em_terratec Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode em_terratec[] = { | ||
16 | { 0x01, KEY_CHANNEL }, | ||
17 | { 0x02, KEY_SELECT }, | ||
18 | { 0x03, KEY_MUTE }, | ||
19 | { 0x04, KEY_POWER }, | ||
20 | { 0x05, KEY_1 }, | ||
21 | { 0x06, KEY_2 }, | ||
22 | { 0x07, KEY_3 }, | ||
23 | { 0x08, KEY_CHANNELUP }, | ||
24 | { 0x09, KEY_4 }, | ||
25 | { 0x0a, KEY_5 }, | ||
26 | { 0x0b, KEY_6 }, | ||
27 | { 0x0c, KEY_CHANNELDOWN }, | ||
28 | { 0x0d, KEY_7 }, | ||
29 | { 0x0e, KEY_8 }, | ||
30 | { 0x0f, KEY_9 }, | ||
31 | { 0x10, KEY_VOLUMEUP }, | ||
32 | { 0x11, KEY_0 }, | ||
33 | { 0x12, KEY_MENU }, | ||
34 | { 0x13, KEY_PRINT }, | ||
35 | { 0x14, KEY_VOLUMEDOWN }, | ||
36 | { 0x16, KEY_PAUSE }, | ||
37 | { 0x18, KEY_RECORD }, | ||
38 | { 0x19, KEY_REWIND }, | ||
39 | { 0x1a, KEY_PLAY }, | ||
40 | { 0x1b, KEY_FORWARD }, | ||
41 | { 0x1c, KEY_BACKSPACE }, | ||
42 | { 0x1e, KEY_STOP }, | ||
43 | { 0x40, KEY_ZOOM }, | ||
44 | }; | ||
45 | |||
46 | static struct rc_keymap em_terratec_map = { | ||
47 | .map = { | ||
48 | .scan = em_terratec, | ||
49 | .size = ARRAY_SIZE(em_terratec), | ||
50 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
51 | .name = RC_MAP_EM_TERRATEC, | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | static int __init init_rc_map_em_terratec(void) | ||
56 | { | ||
57 | return ir_register_map(&em_terratec_map); | ||
58 | } | ||
59 | |||
60 | static void __exit exit_rc_map_em_terratec(void) | ||
61 | { | ||
62 | ir_unregister_map(&em_terratec_map); | ||
63 | } | ||
64 | |||
65 | module_init(init_rc_map_em_terratec) | ||
66 | module_exit(exit_rc_map_em_terratec) | ||
67 | |||
68 | MODULE_LICENSE("GPL"); | ||
69 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-encore-enltv-fm53.c b/drivers/media/IR/keymaps/rc-encore-enltv-fm53.c deleted file mode 100644 index 4b816967877e..000000000000 --- a/drivers/media/IR/keymaps/rc-encore-enltv-fm53.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* encore-enltv-fm53.h - Keytable for encore_enltv_fm53 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Encore ENLTV-FM v5.3 | ||
16 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode encore_enltv_fm53[] = { | ||
20 | { 0x10, KEY_POWER2}, | ||
21 | { 0x06, KEY_MUTE}, | ||
22 | |||
23 | { 0x09, KEY_1}, | ||
24 | { 0x1d, KEY_2}, | ||
25 | { 0x1f, KEY_3}, | ||
26 | { 0x19, KEY_4}, | ||
27 | { 0x1b, KEY_5}, | ||
28 | { 0x11, KEY_6}, | ||
29 | { 0x17, KEY_7}, | ||
30 | { 0x12, KEY_8}, | ||
31 | { 0x16, KEY_9}, | ||
32 | { 0x48, KEY_0}, | ||
33 | |||
34 | { 0x04, KEY_LIST}, /* -/-- */ | ||
35 | { 0x40, KEY_LAST}, /* recall */ | ||
36 | |||
37 | { 0x02, KEY_MODE}, /* TV/AV */ | ||
38 | { 0x05, KEY_CAMERA}, /* SNAPSHOT */ | ||
39 | |||
40 | { 0x4c, KEY_CHANNELUP}, /* UP */ | ||
41 | { 0x00, KEY_CHANNELDOWN}, /* DOWN */ | ||
42 | { 0x0d, KEY_VOLUMEUP}, /* RIGHT */ | ||
43 | { 0x15, KEY_VOLUMEDOWN}, /* LEFT */ | ||
44 | { 0x49, KEY_ENTER}, /* OK */ | ||
45 | |||
46 | { 0x54, KEY_RECORD}, | ||
47 | { 0x4d, KEY_PLAY}, /* pause */ | ||
48 | |||
49 | { 0x1e, KEY_MENU}, /* video setting */ | ||
50 | { 0x0e, KEY_RIGHT}, /* <- */ | ||
51 | { 0x1a, KEY_LEFT}, /* -> */ | ||
52 | |||
53 | { 0x0a, KEY_CLEAR}, /* video default */ | ||
54 | { 0x0c, KEY_ZOOM}, /* hide pannel */ | ||
55 | { 0x47, KEY_SLEEP}, /* shutdown */ | ||
56 | }; | ||
57 | |||
58 | static struct rc_keymap encore_enltv_fm53_map = { | ||
59 | .map = { | ||
60 | .scan = encore_enltv_fm53, | ||
61 | .size = ARRAY_SIZE(encore_enltv_fm53), | ||
62 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
63 | .name = RC_MAP_ENCORE_ENLTV_FM53, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static int __init init_rc_map_encore_enltv_fm53(void) | ||
68 | { | ||
69 | return ir_register_map(&encore_enltv_fm53_map); | ||
70 | } | ||
71 | |||
72 | static void __exit exit_rc_map_encore_enltv_fm53(void) | ||
73 | { | ||
74 | ir_unregister_map(&encore_enltv_fm53_map); | ||
75 | } | ||
76 | |||
77 | module_init(init_rc_map_encore_enltv_fm53) | ||
78 | module_exit(exit_rc_map_encore_enltv_fm53) | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-encore-enltv.c b/drivers/media/IR/keymaps/rc-encore-enltv.c deleted file mode 100644 index 9fabffd28cc9..000000000000 --- a/drivers/media/IR/keymaps/rc-encore-enltv.c +++ /dev/null | |||
@@ -1,112 +0,0 @@ | |||
1 | /* encore-enltv.h - Keytable for encore_enltv Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Encore ENLTV-FM - black plastic, white front cover with white glowing buttons | ||
16 | Juan Pablo Sormani <sorman@gmail.com> */ | ||
17 | |||
18 | static struct ir_scancode encore_enltv[] = { | ||
19 | |||
20 | /* Power button does nothing, neither in Windows app, | ||
21 | although it sends data (used for BIOS wakeup?) */ | ||
22 | { 0x0d, KEY_MUTE }, | ||
23 | |||
24 | { 0x1e, KEY_TV }, | ||
25 | { 0x00, KEY_VIDEO }, | ||
26 | { 0x01, KEY_AUDIO }, /* music */ | ||
27 | { 0x02, KEY_MHP }, /* picture */ | ||
28 | |||
29 | { 0x1f, KEY_1 }, | ||
30 | { 0x03, KEY_2 }, | ||
31 | { 0x04, KEY_3 }, | ||
32 | { 0x05, KEY_4 }, | ||
33 | { 0x1c, KEY_5 }, | ||
34 | { 0x06, KEY_6 }, | ||
35 | { 0x07, KEY_7 }, | ||
36 | { 0x08, KEY_8 }, | ||
37 | { 0x1d, KEY_9 }, | ||
38 | { 0x0a, KEY_0 }, | ||
39 | |||
40 | { 0x09, KEY_LIST }, /* -/-- */ | ||
41 | { 0x0b, KEY_LAST }, /* recall */ | ||
42 | |||
43 | { 0x14, KEY_HOME }, /* win start menu */ | ||
44 | { 0x15, KEY_EXIT }, /* exit */ | ||
45 | { 0x16, KEY_CHANNELUP }, /* UP */ | ||
46 | { 0x12, KEY_CHANNELDOWN }, /* DOWN */ | ||
47 | { 0x0c, KEY_VOLUMEUP }, /* RIGHT */ | ||
48 | { 0x17, KEY_VOLUMEDOWN }, /* LEFT */ | ||
49 | |||
50 | { 0x18, KEY_ENTER }, /* OK */ | ||
51 | |||
52 | { 0x0e, KEY_ESC }, | ||
53 | { 0x13, KEY_CYCLEWINDOWS }, /* desktop */ | ||
54 | { 0x11, KEY_TAB }, | ||
55 | { 0x19, KEY_SWITCHVIDEOMODE }, /* switch */ | ||
56 | |||
57 | { 0x1a, KEY_MENU }, | ||
58 | { 0x1b, KEY_ZOOM }, /* fullscreen */ | ||
59 | { 0x44, KEY_TIME }, /* time shift */ | ||
60 | { 0x40, KEY_MODE }, /* source */ | ||
61 | |||
62 | { 0x5a, KEY_RECORD }, | ||
63 | { 0x42, KEY_PLAY }, /* play/pause */ | ||
64 | { 0x45, KEY_STOP }, | ||
65 | { 0x43, KEY_CAMERA }, /* camera icon */ | ||
66 | |||
67 | { 0x48, KEY_REWIND }, | ||
68 | { 0x4a, KEY_FASTFORWARD }, | ||
69 | { 0x49, KEY_PREVIOUS }, | ||
70 | { 0x4b, KEY_NEXT }, | ||
71 | |||
72 | { 0x4c, KEY_FAVORITES }, /* tv wall */ | ||
73 | { 0x4d, KEY_SOUND }, /* DVD sound */ | ||
74 | { 0x4e, KEY_LANGUAGE }, /* DVD lang */ | ||
75 | { 0x4f, KEY_TEXT }, /* DVD text */ | ||
76 | |||
77 | { 0x50, KEY_SLEEP }, /* shutdown */ | ||
78 | { 0x51, KEY_MODE }, /* stereo > main */ | ||
79 | { 0x52, KEY_SELECT }, /* stereo > sap */ | ||
80 | { 0x53, KEY_PROG1 }, /* teletext */ | ||
81 | |||
82 | |||
83 | { 0x59, KEY_RED }, /* AP1 */ | ||
84 | { 0x41, KEY_GREEN }, /* AP2 */ | ||
85 | { 0x47, KEY_YELLOW }, /* AP3 */ | ||
86 | { 0x57, KEY_BLUE }, /* AP4 */ | ||
87 | }; | ||
88 | |||
89 | static struct rc_keymap encore_enltv_map = { | ||
90 | .map = { | ||
91 | .scan = encore_enltv, | ||
92 | .size = ARRAY_SIZE(encore_enltv), | ||
93 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
94 | .name = RC_MAP_ENCORE_ENLTV, | ||
95 | } | ||
96 | }; | ||
97 | |||
98 | static int __init init_rc_map_encore_enltv(void) | ||
99 | { | ||
100 | return ir_register_map(&encore_enltv_map); | ||
101 | } | ||
102 | |||
103 | static void __exit exit_rc_map_encore_enltv(void) | ||
104 | { | ||
105 | ir_unregister_map(&encore_enltv_map); | ||
106 | } | ||
107 | |||
108 | module_init(init_rc_map_encore_enltv) | ||
109 | module_exit(exit_rc_map_encore_enltv) | ||
110 | |||
111 | MODULE_LICENSE("GPL"); | ||
112 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-encore-enltv2.c b/drivers/media/IR/keymaps/rc-encore-enltv2.c deleted file mode 100644 index efefd5166618..000000000000 --- a/drivers/media/IR/keymaps/rc-encore-enltv2.c +++ /dev/null | |||
@@ -1,90 +0,0 @@ | |||
1 | /* encore-enltv2.h - Keytable for encore_enltv2 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Encore ENLTV2-FM - silver plastic - "Wand Media" written at the botton | ||
16 | Mauro Carvalho Chehab <mchehab@infradead.org> */ | ||
17 | |||
18 | static struct ir_scancode encore_enltv2[] = { | ||
19 | { 0x4c, KEY_POWER2 }, | ||
20 | { 0x4a, KEY_TUNER }, | ||
21 | { 0x40, KEY_1 }, | ||
22 | { 0x60, KEY_2 }, | ||
23 | { 0x50, KEY_3 }, | ||
24 | { 0x70, KEY_4 }, | ||
25 | { 0x48, KEY_5 }, | ||
26 | { 0x68, KEY_6 }, | ||
27 | { 0x58, KEY_7 }, | ||
28 | { 0x78, KEY_8 }, | ||
29 | { 0x44, KEY_9 }, | ||
30 | { 0x54, KEY_0 }, | ||
31 | |||
32 | { 0x64, KEY_LAST }, /* +100 */ | ||
33 | { 0x4e, KEY_AGAIN }, /* Recall */ | ||
34 | |||
35 | { 0x6c, KEY_SWITCHVIDEOMODE }, /* Video Source */ | ||
36 | { 0x5e, KEY_MENU }, | ||
37 | { 0x56, KEY_SCREEN }, | ||
38 | { 0x7a, KEY_SETUP }, | ||
39 | |||
40 | { 0x46, KEY_MUTE }, | ||
41 | { 0x5c, KEY_MODE }, /* Stereo */ | ||
42 | { 0x74, KEY_INFO }, | ||
43 | { 0x7c, KEY_CLEAR }, | ||
44 | |||
45 | { 0x55, KEY_UP }, | ||
46 | { 0x49, KEY_DOWN }, | ||
47 | { 0x7e, KEY_LEFT }, | ||
48 | { 0x59, KEY_RIGHT }, | ||
49 | { 0x6a, KEY_ENTER }, | ||
50 | |||
51 | { 0x42, KEY_VOLUMEUP }, | ||
52 | { 0x62, KEY_VOLUMEDOWN }, | ||
53 | { 0x52, KEY_CHANNELUP }, | ||
54 | { 0x72, KEY_CHANNELDOWN }, | ||
55 | |||
56 | { 0x41, KEY_RECORD }, | ||
57 | { 0x51, KEY_CAMERA }, /* Snapshot */ | ||
58 | { 0x75, KEY_TIME }, /* Timeshift */ | ||
59 | { 0x71, KEY_TV2 }, /* PIP */ | ||
60 | |||
61 | { 0x45, KEY_REWIND }, | ||
62 | { 0x6f, KEY_PAUSE }, | ||
63 | { 0x7d, KEY_FORWARD }, | ||
64 | { 0x79, KEY_STOP }, | ||
65 | }; | ||
66 | |||
67 | static struct rc_keymap encore_enltv2_map = { | ||
68 | .map = { | ||
69 | .scan = encore_enltv2, | ||
70 | .size = ARRAY_SIZE(encore_enltv2), | ||
71 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
72 | .name = RC_MAP_ENCORE_ENLTV2, | ||
73 | } | ||
74 | }; | ||
75 | |||
76 | static int __init init_rc_map_encore_enltv2(void) | ||
77 | { | ||
78 | return ir_register_map(&encore_enltv2_map); | ||
79 | } | ||
80 | |||
81 | static void __exit exit_rc_map_encore_enltv2(void) | ||
82 | { | ||
83 | ir_unregister_map(&encore_enltv2_map); | ||
84 | } | ||
85 | |||
86 | module_init(init_rc_map_encore_enltv2) | ||
87 | module_exit(exit_rc_map_encore_enltv2) | ||
88 | |||
89 | MODULE_LICENSE("GPL"); | ||
90 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-evga-indtube.c b/drivers/media/IR/keymaps/rc-evga-indtube.c deleted file mode 100644 index 3f3fb13813b3..000000000000 --- a/drivers/media/IR/keymaps/rc-evga-indtube.c +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | /* evga-indtube.h - Keytable for evga_indtube Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* EVGA inDtube | ||
16 | Devin Heitmueller <devin.heitmueller@gmail.com> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode evga_indtube[] = { | ||
20 | { 0x12, KEY_POWER}, | ||
21 | { 0x02, KEY_MODE}, /* TV */ | ||
22 | { 0x14, KEY_MUTE}, | ||
23 | { 0x1a, KEY_CHANNELUP}, | ||
24 | { 0x16, KEY_TV2}, /* PIP */ | ||
25 | { 0x1d, KEY_VOLUMEUP}, | ||
26 | { 0x05, KEY_CHANNELDOWN}, | ||
27 | { 0x0f, KEY_PLAYPAUSE}, | ||
28 | { 0x19, KEY_VOLUMEDOWN}, | ||
29 | { 0x1c, KEY_REWIND}, | ||
30 | { 0x0d, KEY_RECORD}, | ||
31 | { 0x18, KEY_FORWARD}, | ||
32 | { 0x1e, KEY_PREVIOUS}, | ||
33 | { 0x1b, KEY_STOP}, | ||
34 | { 0x1f, KEY_NEXT}, | ||
35 | { 0x13, KEY_CAMERA}, | ||
36 | }; | ||
37 | |||
38 | static struct rc_keymap evga_indtube_map = { | ||
39 | .map = { | ||
40 | .scan = evga_indtube, | ||
41 | .size = ARRAY_SIZE(evga_indtube), | ||
42 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
43 | .name = RC_MAP_EVGA_INDTUBE, | ||
44 | } | ||
45 | }; | ||
46 | |||
47 | static int __init init_rc_map_evga_indtube(void) | ||
48 | { | ||
49 | return ir_register_map(&evga_indtube_map); | ||
50 | } | ||
51 | |||
52 | static void __exit exit_rc_map_evga_indtube(void) | ||
53 | { | ||
54 | ir_unregister_map(&evga_indtube_map); | ||
55 | } | ||
56 | |||
57 | module_init(init_rc_map_evga_indtube) | ||
58 | module_exit(exit_rc_map_evga_indtube) | ||
59 | |||
60 | MODULE_LICENSE("GPL"); | ||
61 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-eztv.c b/drivers/media/IR/keymaps/rc-eztv.c deleted file mode 100644 index 660907a78db9..000000000000 --- a/drivers/media/IR/keymaps/rc-eztv.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* eztv.h - Keytable for eztv Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Alfons Geser <a.geser@cox.net> | ||
16 | * updates from Job D. R. Borges <jobdrb@ig.com.br> */ | ||
17 | |||
18 | static struct ir_scancode eztv[] = { | ||
19 | { 0x12, KEY_POWER }, | ||
20 | { 0x01, KEY_TV }, /* DVR */ | ||
21 | { 0x15, KEY_DVD }, /* DVD */ | ||
22 | { 0x17, KEY_AUDIO }, /* music */ | ||
23 | /* DVR mode / DVD mode / music mode */ | ||
24 | |||
25 | { 0x1b, KEY_MUTE }, /* mute */ | ||
26 | { 0x02, KEY_LANGUAGE }, /* MTS/SAP / audio / autoseek */ | ||
27 | { 0x1e, KEY_SUBTITLE }, /* closed captioning / subtitle / seek */ | ||
28 | { 0x16, KEY_ZOOM }, /* full screen */ | ||
29 | { 0x1c, KEY_VIDEO }, /* video source / eject / delall */ | ||
30 | { 0x1d, KEY_RESTART }, /* playback / angle / del */ | ||
31 | { 0x2f, KEY_SEARCH }, /* scan / menu / playlist */ | ||
32 | { 0x30, KEY_CHANNEL }, /* CH surfing / bookmark / memo */ | ||
33 | |||
34 | { 0x31, KEY_HELP }, /* help */ | ||
35 | { 0x32, KEY_MODE }, /* num/memo */ | ||
36 | { 0x33, KEY_ESC }, /* cancel */ | ||
37 | |||
38 | { 0x0c, KEY_UP }, /* up */ | ||
39 | { 0x10, KEY_DOWN }, /* down */ | ||
40 | { 0x08, KEY_LEFT }, /* left */ | ||
41 | { 0x04, KEY_RIGHT }, /* right */ | ||
42 | { 0x03, KEY_SELECT }, /* select */ | ||
43 | |||
44 | { 0x1f, KEY_REWIND }, /* rewind */ | ||
45 | { 0x20, KEY_PLAYPAUSE },/* play/pause */ | ||
46 | { 0x29, KEY_FORWARD }, /* forward */ | ||
47 | { 0x14, KEY_AGAIN }, /* repeat */ | ||
48 | { 0x2b, KEY_RECORD }, /* recording */ | ||
49 | { 0x2c, KEY_STOP }, /* stop */ | ||
50 | { 0x2d, KEY_PLAY }, /* play */ | ||
51 | { 0x2e, KEY_CAMERA }, /* snapshot / shuffle */ | ||
52 | |||
53 | { 0x00, KEY_0 }, | ||
54 | { 0x05, KEY_1 }, | ||
55 | { 0x06, KEY_2 }, | ||
56 | { 0x07, KEY_3 }, | ||
57 | { 0x09, KEY_4 }, | ||
58 | { 0x0a, KEY_5 }, | ||
59 | { 0x0b, KEY_6 }, | ||
60 | { 0x0d, KEY_7 }, | ||
61 | { 0x0e, KEY_8 }, | ||
62 | { 0x0f, KEY_9 }, | ||
63 | |||
64 | { 0x2a, KEY_VOLUMEUP }, | ||
65 | { 0x11, KEY_VOLUMEDOWN }, | ||
66 | { 0x18, KEY_CHANNELUP },/* CH.tracking up */ | ||
67 | { 0x19, KEY_CHANNELDOWN },/* CH.tracking down */ | ||
68 | |||
69 | { 0x13, KEY_ENTER }, /* enter */ | ||
70 | { 0x21, KEY_DOT }, /* . (decimal dot) */ | ||
71 | }; | ||
72 | |||
73 | static struct rc_keymap eztv_map = { | ||
74 | .map = { | ||
75 | .scan = eztv, | ||
76 | .size = ARRAY_SIZE(eztv), | ||
77 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
78 | .name = RC_MAP_EZTV, | ||
79 | } | ||
80 | }; | ||
81 | |||
82 | static int __init init_rc_map_eztv(void) | ||
83 | { | ||
84 | return ir_register_map(&eztv_map); | ||
85 | } | ||
86 | |||
87 | static void __exit exit_rc_map_eztv(void) | ||
88 | { | ||
89 | ir_unregister_map(&eztv_map); | ||
90 | } | ||
91 | |||
92 | module_init(init_rc_map_eztv) | ||
93 | module_exit(exit_rc_map_eztv) | ||
94 | |||
95 | MODULE_LICENSE("GPL"); | ||
96 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-flydvb.c b/drivers/media/IR/keymaps/rc-flydvb.c deleted file mode 100644 index a173c81035f4..000000000000 --- a/drivers/media/IR/keymaps/rc-flydvb.c +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | /* flydvb.h - Keytable for flydvb Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode flydvb[] = { | ||
16 | { 0x01, KEY_ZOOM }, /* Full Screen */ | ||
17 | { 0x00, KEY_POWER }, /* Power */ | ||
18 | |||
19 | { 0x03, KEY_1 }, | ||
20 | { 0x04, KEY_2 }, | ||
21 | { 0x05, KEY_3 }, | ||
22 | { 0x07, KEY_4 }, | ||
23 | { 0x08, KEY_5 }, | ||
24 | { 0x09, KEY_6 }, | ||
25 | { 0x0b, KEY_7 }, | ||
26 | { 0x0c, KEY_8 }, | ||
27 | { 0x0d, KEY_9 }, | ||
28 | { 0x06, KEY_AGAIN }, /* Recall */ | ||
29 | { 0x0f, KEY_0 }, | ||
30 | { 0x10, KEY_MUTE }, /* Mute */ | ||
31 | { 0x02, KEY_RADIO }, /* TV/Radio */ | ||
32 | { 0x1b, KEY_LANGUAGE }, /* SAP (Second Audio Program) */ | ||
33 | |||
34 | { 0x14, KEY_VOLUMEUP }, /* VOL+ */ | ||
35 | { 0x17, KEY_VOLUMEDOWN }, /* VOL- */ | ||
36 | { 0x12, KEY_CHANNELUP }, /* CH+ */ | ||
37 | { 0x13, KEY_CHANNELDOWN }, /* CH- */ | ||
38 | { 0x1d, KEY_ENTER }, /* Enter */ | ||
39 | |||
40 | { 0x1a, KEY_MODE }, /* PIP */ | ||
41 | { 0x18, KEY_TUNER }, /* Source */ | ||
42 | |||
43 | { 0x1e, KEY_RECORD }, /* Record/Pause */ | ||
44 | { 0x15, KEY_ANGLE }, /* Swap (no label on key) */ | ||
45 | { 0x1c, KEY_PAUSE }, /* Timeshift/Pause */ | ||
46 | { 0x19, KEY_BACK }, /* Rewind << */ | ||
47 | { 0x0a, KEY_PLAYPAUSE }, /* Play/Pause */ | ||
48 | { 0x1f, KEY_FORWARD }, /* Forward >> */ | ||
49 | { 0x16, KEY_PREVIOUS }, /* Back |<< */ | ||
50 | { 0x11, KEY_STOP }, /* Stop */ | ||
51 | { 0x0e, KEY_NEXT }, /* End >>| */ | ||
52 | }; | ||
53 | |||
54 | static struct rc_keymap flydvb_map = { | ||
55 | .map = { | ||
56 | .scan = flydvb, | ||
57 | .size = ARRAY_SIZE(flydvb), | ||
58 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
59 | .name = RC_MAP_FLYDVB, | ||
60 | } | ||
61 | }; | ||
62 | |||
63 | static int __init init_rc_map_flydvb(void) | ||
64 | { | ||
65 | return ir_register_map(&flydvb_map); | ||
66 | } | ||
67 | |||
68 | static void __exit exit_rc_map_flydvb(void) | ||
69 | { | ||
70 | ir_unregister_map(&flydvb_map); | ||
71 | } | ||
72 | |||
73 | module_init(init_rc_map_flydvb) | ||
74 | module_exit(exit_rc_map_flydvb) | ||
75 | |||
76 | MODULE_LICENSE("GPL"); | ||
77 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-flyvideo.c b/drivers/media/IR/keymaps/rc-flyvideo.c deleted file mode 100644 index 9c73043cbdba..000000000000 --- a/drivers/media/IR/keymaps/rc-flyvideo.c +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | /* flyvideo.h - Keytable for flyvideo Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode flyvideo[] = { | ||
16 | { 0x0f, KEY_0 }, | ||
17 | { 0x03, KEY_1 }, | ||
18 | { 0x04, KEY_2 }, | ||
19 | { 0x05, KEY_3 }, | ||
20 | { 0x07, KEY_4 }, | ||
21 | { 0x08, KEY_5 }, | ||
22 | { 0x09, KEY_6 }, | ||
23 | { 0x0b, KEY_7 }, | ||
24 | { 0x0c, KEY_8 }, | ||
25 | { 0x0d, KEY_9 }, | ||
26 | |||
27 | { 0x0e, KEY_MODE }, /* Air/Cable */ | ||
28 | { 0x11, KEY_VIDEO }, /* Video */ | ||
29 | { 0x15, KEY_AUDIO }, /* Audio */ | ||
30 | { 0x00, KEY_POWER }, /* Power */ | ||
31 | { 0x18, KEY_TUNER }, /* AV Source */ | ||
32 | { 0x02, KEY_ZOOM }, /* Fullscreen */ | ||
33 | { 0x1a, KEY_LANGUAGE }, /* Stereo */ | ||
34 | { 0x1b, KEY_MUTE }, /* Mute */ | ||
35 | { 0x14, KEY_VOLUMEUP }, /* Volume + */ | ||
36 | { 0x17, KEY_VOLUMEDOWN },/* Volume - */ | ||
37 | { 0x12, KEY_CHANNELUP },/* Channel + */ | ||
38 | { 0x13, KEY_CHANNELDOWN },/* Channel - */ | ||
39 | { 0x06, KEY_AGAIN }, /* Recall */ | ||
40 | { 0x10, KEY_ENTER }, /* Enter */ | ||
41 | |||
42 | { 0x19, KEY_BACK }, /* Rewind ( <<< ) */ | ||
43 | { 0x1f, KEY_FORWARD }, /* Forward ( >>> ) */ | ||
44 | { 0x0a, KEY_ANGLE }, /* no label, may be used as the PAUSE button */ | ||
45 | }; | ||
46 | |||
47 | static struct rc_keymap flyvideo_map = { | ||
48 | .map = { | ||
49 | .scan = flyvideo, | ||
50 | .size = ARRAY_SIZE(flyvideo), | ||
51 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
52 | .name = RC_MAP_FLYVIDEO, | ||
53 | } | ||
54 | }; | ||
55 | |||
56 | static int __init init_rc_map_flyvideo(void) | ||
57 | { | ||
58 | return ir_register_map(&flyvideo_map); | ||
59 | } | ||
60 | |||
61 | static void __exit exit_rc_map_flyvideo(void) | ||
62 | { | ||
63 | ir_unregister_map(&flyvideo_map); | ||
64 | } | ||
65 | |||
66 | module_init(init_rc_map_flyvideo) | ||
67 | module_exit(exit_rc_map_flyvideo) | ||
68 | |||
69 | MODULE_LICENSE("GPL"); | ||
70 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-fusionhdtv-mce.c b/drivers/media/IR/keymaps/rc-fusionhdtv-mce.c deleted file mode 100644 index cdb10389b10e..000000000000 --- a/drivers/media/IR/keymaps/rc-fusionhdtv-mce.c +++ /dev/null | |||
@@ -1,98 +0,0 @@ | |||
1 | /* fusionhdtv-mce.h - Keytable for fusionhdtv_mce Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* DViCO FUSION HDTV MCE remote */ | ||
16 | |||
17 | static struct ir_scancode fusionhdtv_mce[] = { | ||
18 | |||
19 | { 0x0b, KEY_1 }, | ||
20 | { 0x17, KEY_2 }, | ||
21 | { 0x1b, KEY_3 }, | ||
22 | { 0x07, KEY_4 }, | ||
23 | { 0x50, KEY_5 }, | ||
24 | { 0x54, KEY_6 }, | ||
25 | { 0x48, KEY_7 }, | ||
26 | { 0x4c, KEY_8 }, | ||
27 | { 0x58, KEY_9 }, | ||
28 | { 0x03, KEY_0 }, | ||
29 | |||
30 | { 0x5e, KEY_OK }, | ||
31 | { 0x51, KEY_UP }, | ||
32 | { 0x53, KEY_DOWN }, | ||
33 | { 0x5b, KEY_LEFT }, | ||
34 | { 0x5f, KEY_RIGHT }, | ||
35 | |||
36 | { 0x02, KEY_TV }, /* Labeled DTV on remote */ | ||
37 | { 0x0e, KEY_MP3 }, | ||
38 | { 0x1a, KEY_DVD }, | ||
39 | { 0x1e, KEY_FAVORITES }, /* Labeled CPF on remote */ | ||
40 | { 0x16, KEY_SETUP }, | ||
41 | { 0x46, KEY_POWER2 }, /* TV On/Off button on remote */ | ||
42 | { 0x0a, KEY_EPG }, /* Labeled Guide on remote */ | ||
43 | |||
44 | { 0x49, KEY_BACK }, | ||
45 | { 0x59, KEY_INFO }, /* Labeled MORE on remote */ | ||
46 | { 0x4d, KEY_MENU }, /* Labeled DVDMENU on remote */ | ||
47 | { 0x55, KEY_CYCLEWINDOWS }, /* Labeled ALT-TAB on remote */ | ||
48 | |||
49 | { 0x0f, KEY_PREVIOUSSONG }, /* Labeled |<< REPLAY on remote */ | ||
50 | { 0x12, KEY_NEXTSONG }, /* Labeled >>| SKIP on remote */ | ||
51 | { 0x42, KEY_ENTER }, /* Labeled START with a green | ||
52 | MS windows logo on remote */ | ||
53 | |||
54 | { 0x15, KEY_VOLUMEUP }, | ||
55 | { 0x05, KEY_VOLUMEDOWN }, | ||
56 | { 0x11, KEY_CHANNELUP }, | ||
57 | { 0x09, KEY_CHANNELDOWN }, | ||
58 | |||
59 | { 0x52, KEY_CAMERA }, | ||
60 | { 0x5a, KEY_TUNER }, | ||
61 | { 0x19, KEY_OPEN }, | ||
62 | |||
63 | { 0x13, KEY_MODE }, /* 4:3 16:9 select */ | ||
64 | { 0x1f, KEY_ZOOM }, | ||
65 | |||
66 | { 0x43, KEY_REWIND }, | ||
67 | { 0x47, KEY_PLAYPAUSE }, | ||
68 | { 0x4f, KEY_FASTFORWARD }, | ||
69 | { 0x57, KEY_MUTE }, | ||
70 | { 0x0d, KEY_STOP }, | ||
71 | { 0x01, KEY_RECORD }, | ||
72 | { 0x4e, KEY_POWER }, | ||
73 | }; | ||
74 | |||
75 | static struct rc_keymap fusionhdtv_mce_map = { | ||
76 | .map = { | ||
77 | .scan = fusionhdtv_mce, | ||
78 | .size = ARRAY_SIZE(fusionhdtv_mce), | ||
79 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
80 | .name = RC_MAP_FUSIONHDTV_MCE, | ||
81 | } | ||
82 | }; | ||
83 | |||
84 | static int __init init_rc_map_fusionhdtv_mce(void) | ||
85 | { | ||
86 | return ir_register_map(&fusionhdtv_mce_map); | ||
87 | } | ||
88 | |||
89 | static void __exit exit_rc_map_fusionhdtv_mce(void) | ||
90 | { | ||
91 | ir_unregister_map(&fusionhdtv_mce_map); | ||
92 | } | ||
93 | |||
94 | module_init(init_rc_map_fusionhdtv_mce) | ||
95 | module_exit(exit_rc_map_fusionhdtv_mce) | ||
96 | |||
97 | MODULE_LICENSE("GPL"); | ||
98 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-gadmei-rm008z.c b/drivers/media/IR/keymaps/rc-gadmei-rm008z.c deleted file mode 100644 index c16c0d1263ac..000000000000 --- a/drivers/media/IR/keymaps/rc-gadmei-rm008z.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* gadmei-rm008z.h - Keytable for gadmei_rm008z Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* GADMEI UTV330+ RM008Z remote | ||
16 | Shine Liu <shinel@foxmail.com> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode gadmei_rm008z[] = { | ||
20 | { 0x14, KEY_POWER2}, /* POWER OFF */ | ||
21 | { 0x0c, KEY_MUTE}, /* MUTE */ | ||
22 | |||
23 | { 0x18, KEY_TV}, /* TV */ | ||
24 | { 0x0e, KEY_VIDEO}, /* AV */ | ||
25 | { 0x0b, KEY_AUDIO}, /* SV */ | ||
26 | { 0x0f, KEY_RADIO}, /* FM */ | ||
27 | |||
28 | { 0x00, KEY_1}, | ||
29 | { 0x01, KEY_2}, | ||
30 | { 0x02, KEY_3}, | ||
31 | { 0x03, KEY_4}, | ||
32 | { 0x04, KEY_5}, | ||
33 | { 0x05, KEY_6}, | ||
34 | { 0x06, KEY_7}, | ||
35 | { 0x07, KEY_8}, | ||
36 | { 0x08, KEY_9}, | ||
37 | { 0x09, KEY_0}, | ||
38 | { 0x0a, KEY_INFO}, /* OSD */ | ||
39 | { 0x1c, KEY_BACKSPACE}, /* LAST */ | ||
40 | |||
41 | { 0x0d, KEY_PLAY}, /* PLAY */ | ||
42 | { 0x1e, KEY_CAMERA}, /* SNAPSHOT */ | ||
43 | { 0x1a, KEY_RECORD}, /* RECORD */ | ||
44 | { 0x17, KEY_STOP}, /* STOP */ | ||
45 | |||
46 | { 0x1f, KEY_UP}, /* UP */ | ||
47 | { 0x44, KEY_DOWN}, /* DOWN */ | ||
48 | { 0x46, KEY_TAB}, /* BACK */ | ||
49 | { 0x4a, KEY_ZOOM}, /* FULLSECREEN */ | ||
50 | |||
51 | { 0x10, KEY_VOLUMEUP}, /* VOLUMEUP */ | ||
52 | { 0x11, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ | ||
53 | { 0x12, KEY_CHANNELUP}, /* CHANNELUP */ | ||
54 | { 0x13, KEY_CHANNELDOWN}, /* CHANNELDOWN */ | ||
55 | { 0x15, KEY_ENTER}, /* OK */ | ||
56 | }; | ||
57 | |||
58 | static struct rc_keymap gadmei_rm008z_map = { | ||
59 | .map = { | ||
60 | .scan = gadmei_rm008z, | ||
61 | .size = ARRAY_SIZE(gadmei_rm008z), | ||
62 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
63 | .name = RC_MAP_GADMEI_RM008Z, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static int __init init_rc_map_gadmei_rm008z(void) | ||
68 | { | ||
69 | return ir_register_map(&gadmei_rm008z_map); | ||
70 | } | ||
71 | |||
72 | static void __exit exit_rc_map_gadmei_rm008z(void) | ||
73 | { | ||
74 | ir_unregister_map(&gadmei_rm008z_map); | ||
75 | } | ||
76 | |||
77 | module_init(init_rc_map_gadmei_rm008z) | ||
78 | module_exit(exit_rc_map_gadmei_rm008z) | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c b/drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c deleted file mode 100644 index 89f8e384e52a..000000000000 --- a/drivers/media/IR/keymaps/rc-genius-tvgo-a11mce.c +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | /* genius-tvgo-a11mce.h - Keytable for genius_tvgo_a11mce Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | * Remote control for the Genius TVGO A11MCE | ||
17 | * Adrian Pardini <pardo.bsso@gmail.com> | ||
18 | */ | ||
19 | |||
20 | static struct ir_scancode genius_tvgo_a11mce[] = { | ||
21 | /* Keys 0 to 9 */ | ||
22 | { 0x48, KEY_0 }, | ||
23 | { 0x09, KEY_1 }, | ||
24 | { 0x1d, KEY_2 }, | ||
25 | { 0x1f, KEY_3 }, | ||
26 | { 0x19, KEY_4 }, | ||
27 | { 0x1b, KEY_5 }, | ||
28 | { 0x11, KEY_6 }, | ||
29 | { 0x17, KEY_7 }, | ||
30 | { 0x12, KEY_8 }, | ||
31 | { 0x16, KEY_9 }, | ||
32 | |||
33 | { 0x54, KEY_RECORD }, /* recording */ | ||
34 | { 0x06, KEY_MUTE }, /* mute */ | ||
35 | { 0x10, KEY_POWER }, | ||
36 | { 0x40, KEY_LAST }, /* recall */ | ||
37 | { 0x4c, KEY_CHANNELUP }, /* channel / program + */ | ||
38 | { 0x00, KEY_CHANNELDOWN }, /* channel / program - */ | ||
39 | { 0x0d, KEY_VOLUMEUP }, | ||
40 | { 0x15, KEY_VOLUMEDOWN }, | ||
41 | { 0x4d, KEY_OK }, /* also labeled as Pause */ | ||
42 | { 0x1c, KEY_ZOOM }, /* full screen and Stop*/ | ||
43 | { 0x02, KEY_MODE }, /* AV Source or Rewind*/ | ||
44 | { 0x04, KEY_LIST }, /* -/-- */ | ||
45 | /* small arrows above numbers */ | ||
46 | { 0x1a, KEY_NEXT }, /* also Fast Forward */ | ||
47 | { 0x0e, KEY_PREVIOUS }, /* also Rewind */ | ||
48 | /* these are in a rather non standard layout and have | ||
49 | an alternate name written */ | ||
50 | { 0x1e, KEY_UP }, /* Video Setting */ | ||
51 | { 0x0a, KEY_DOWN }, /* Video Default */ | ||
52 | { 0x05, KEY_CAMERA }, /* Snapshot */ | ||
53 | { 0x0c, KEY_RIGHT }, /* Hide Panel */ | ||
54 | /* Four buttons without label */ | ||
55 | { 0x49, KEY_RED }, | ||
56 | { 0x0b, KEY_GREEN }, | ||
57 | { 0x13, KEY_YELLOW }, | ||
58 | { 0x50, KEY_BLUE }, | ||
59 | }; | ||
60 | |||
61 | static struct rc_keymap genius_tvgo_a11mce_map = { | ||
62 | .map = { | ||
63 | .scan = genius_tvgo_a11mce, | ||
64 | .size = ARRAY_SIZE(genius_tvgo_a11mce), | ||
65 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
66 | .name = RC_MAP_GENIUS_TVGO_A11MCE, | ||
67 | } | ||
68 | }; | ||
69 | |||
70 | static int __init init_rc_map_genius_tvgo_a11mce(void) | ||
71 | { | ||
72 | return ir_register_map(&genius_tvgo_a11mce_map); | ||
73 | } | ||
74 | |||
75 | static void __exit exit_rc_map_genius_tvgo_a11mce(void) | ||
76 | { | ||
77 | ir_unregister_map(&genius_tvgo_a11mce_map); | ||
78 | } | ||
79 | |||
80 | module_init(init_rc_map_genius_tvgo_a11mce) | ||
81 | module_exit(exit_rc_map_genius_tvgo_a11mce) | ||
82 | |||
83 | MODULE_LICENSE("GPL"); | ||
84 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-gotview7135.c b/drivers/media/IR/keymaps/rc-gotview7135.c deleted file mode 100644 index 52f025bb35f6..000000000000 --- a/drivers/media/IR/keymaps/rc-gotview7135.c +++ /dev/null | |||
@@ -1,79 +0,0 @@ | |||
1 | /* gotview7135.h - Keytable for gotview7135 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Mike Baikov <mike@baikov.com> */ | ||
16 | |||
17 | static struct ir_scancode gotview7135[] = { | ||
18 | |||
19 | { 0x11, KEY_POWER }, | ||
20 | { 0x35, KEY_TV }, | ||
21 | { 0x1b, KEY_0 }, | ||
22 | { 0x29, KEY_1 }, | ||
23 | { 0x19, KEY_2 }, | ||
24 | { 0x39, KEY_3 }, | ||
25 | { 0x1f, KEY_4 }, | ||
26 | { 0x2c, KEY_5 }, | ||
27 | { 0x21, KEY_6 }, | ||
28 | { 0x24, KEY_7 }, | ||
29 | { 0x18, KEY_8 }, | ||
30 | { 0x2b, KEY_9 }, | ||
31 | { 0x3b, KEY_AGAIN }, /* LOOP */ | ||
32 | { 0x06, KEY_AUDIO }, | ||
33 | { 0x31, KEY_PRINT }, /* PREVIEW */ | ||
34 | { 0x3e, KEY_VIDEO }, | ||
35 | { 0x10, KEY_CHANNELUP }, | ||
36 | { 0x20, KEY_CHANNELDOWN }, | ||
37 | { 0x0c, KEY_VOLUMEDOWN }, | ||
38 | { 0x28, KEY_VOLUMEUP }, | ||
39 | { 0x08, KEY_MUTE }, | ||
40 | { 0x26, KEY_SEARCH }, /* SCAN */ | ||
41 | { 0x3f, KEY_CAMERA }, /* SNAPSHOT */ | ||
42 | { 0x12, KEY_RECORD }, | ||
43 | { 0x32, KEY_STOP }, | ||
44 | { 0x3c, KEY_PLAY }, | ||
45 | { 0x1d, KEY_REWIND }, | ||
46 | { 0x2d, KEY_PAUSE }, | ||
47 | { 0x0d, KEY_FORWARD }, | ||
48 | { 0x05, KEY_ZOOM }, /*FULL*/ | ||
49 | |||
50 | { 0x2a, KEY_F21 }, /* LIVE TIMESHIFT */ | ||
51 | { 0x0e, KEY_F22 }, /* MIN TIMESHIFT */ | ||
52 | { 0x1e, KEY_TIME }, /* TIMESHIFT */ | ||
53 | { 0x38, KEY_F24 }, /* NORMAL TIMESHIFT */ | ||
54 | }; | ||
55 | |||
56 | static struct rc_keymap gotview7135_map = { | ||
57 | .map = { | ||
58 | .scan = gotview7135, | ||
59 | .size = ARRAY_SIZE(gotview7135), | ||
60 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
61 | .name = RC_MAP_GOTVIEW7135, | ||
62 | } | ||
63 | }; | ||
64 | |||
65 | static int __init init_rc_map_gotview7135(void) | ||
66 | { | ||
67 | return ir_register_map(&gotview7135_map); | ||
68 | } | ||
69 | |||
70 | static void __exit exit_rc_map_gotview7135(void) | ||
71 | { | ||
72 | ir_unregister_map(&gotview7135_map); | ||
73 | } | ||
74 | |||
75 | module_init(init_rc_map_gotview7135) | ||
76 | module_exit(exit_rc_map_gotview7135) | ||
77 | |||
78 | MODULE_LICENSE("GPL"); | ||
79 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-hauppauge-new.c b/drivers/media/IR/keymaps/rc-hauppauge-new.c deleted file mode 100644 index c6f8cd7c5186..000000000000 --- a/drivers/media/IR/keymaps/rc-hauppauge-new.c +++ /dev/null | |||
@@ -1,100 +0,0 @@ | |||
1 | /* hauppauge-new.h - Keytable for hauppauge_new Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Hauppauge: the newer, gray remotes (seems there are multiple | ||
16 | * slightly different versions), shipped with cx88+ivtv cards. | ||
17 | * almost rc5 coding, but some non-standard keys */ | ||
18 | |||
19 | static struct ir_scancode hauppauge_new[] = { | ||
20 | /* Keys 0 to 9 */ | ||
21 | { 0x00, KEY_0 }, | ||
22 | { 0x01, KEY_1 }, | ||
23 | { 0x02, KEY_2 }, | ||
24 | { 0x03, KEY_3 }, | ||
25 | { 0x04, KEY_4 }, | ||
26 | { 0x05, KEY_5 }, | ||
27 | { 0x06, KEY_6 }, | ||
28 | { 0x07, KEY_7 }, | ||
29 | { 0x08, KEY_8 }, | ||
30 | { 0x09, KEY_9 }, | ||
31 | |||
32 | { 0x0a, KEY_TEXT }, /* keypad asterisk as well */ | ||
33 | { 0x0b, KEY_RED }, /* red button */ | ||
34 | { 0x0c, KEY_RADIO }, | ||
35 | { 0x0d, KEY_MENU }, | ||
36 | { 0x0e, KEY_SUBTITLE }, /* also the # key */ | ||
37 | { 0x0f, KEY_MUTE }, | ||
38 | { 0x10, KEY_VOLUMEUP }, | ||
39 | { 0x11, KEY_VOLUMEDOWN }, | ||
40 | { 0x12, KEY_PREVIOUS }, /* previous channel */ | ||
41 | { 0x14, KEY_UP }, | ||
42 | { 0x15, KEY_DOWN }, | ||
43 | { 0x16, KEY_LEFT }, | ||
44 | { 0x17, KEY_RIGHT }, | ||
45 | { 0x18, KEY_VIDEO }, /* Videos */ | ||
46 | { 0x19, KEY_AUDIO }, /* Music */ | ||
47 | /* 0x1a: Pictures - presume this means | ||
48 | "Multimedia Home Platform" - | ||
49 | no "PICTURES" key in input.h | ||
50 | */ | ||
51 | { 0x1a, KEY_MHP }, | ||
52 | |||
53 | { 0x1b, KEY_EPG }, /* Guide */ | ||
54 | { 0x1c, KEY_TV }, | ||
55 | { 0x1e, KEY_NEXTSONG }, /* skip >| */ | ||
56 | { 0x1f, KEY_EXIT }, /* back/exit */ | ||
57 | { 0x20, KEY_CHANNELUP }, /* channel / program + */ | ||
58 | { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ | ||
59 | { 0x22, KEY_CHANNEL }, /* source (old black remote) */ | ||
60 | { 0x24, KEY_PREVIOUSSONG }, /* replay |< */ | ||
61 | { 0x25, KEY_ENTER }, /* OK */ | ||
62 | { 0x26, KEY_SLEEP }, /* minimize (old black remote) */ | ||
63 | { 0x29, KEY_BLUE }, /* blue key */ | ||
64 | { 0x2e, KEY_GREEN }, /* green button */ | ||
65 | { 0x30, KEY_PAUSE }, /* pause */ | ||
66 | { 0x32, KEY_REWIND }, /* backward << */ | ||
67 | { 0x34, KEY_FASTFORWARD }, /* forward >> */ | ||
68 | { 0x35, KEY_PLAY }, | ||
69 | { 0x36, KEY_STOP }, | ||
70 | { 0x37, KEY_RECORD }, /* recording */ | ||
71 | { 0x38, KEY_YELLOW }, /* yellow key */ | ||
72 | { 0x3b, KEY_SELECT }, /* top right button */ | ||
73 | { 0x3c, KEY_ZOOM }, /* full */ | ||
74 | { 0x3d, KEY_POWER }, /* system power (green button) */ | ||
75 | }; | ||
76 | |||
77 | static struct rc_keymap hauppauge_new_map = { | ||
78 | .map = { | ||
79 | .scan = hauppauge_new, | ||
80 | .size = ARRAY_SIZE(hauppauge_new), | ||
81 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
82 | .name = RC_MAP_HAUPPAUGE_NEW, | ||
83 | } | ||
84 | }; | ||
85 | |||
86 | static int __init init_rc_map_hauppauge_new(void) | ||
87 | { | ||
88 | return ir_register_map(&hauppauge_new_map); | ||
89 | } | ||
90 | |||
91 | static void __exit exit_rc_map_hauppauge_new(void) | ||
92 | { | ||
93 | ir_unregister_map(&hauppauge_new_map); | ||
94 | } | ||
95 | |||
96 | module_init(init_rc_map_hauppauge_new) | ||
97 | module_exit(exit_rc_map_hauppauge_new) | ||
98 | |||
99 | MODULE_LICENSE("GPL"); | ||
100 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-imon-mce.c b/drivers/media/IR/keymaps/rc-imon-mce.c deleted file mode 100644 index e49f350e3a0d..000000000000 --- a/drivers/media/IR/keymaps/rc-imon-mce.c +++ /dev/null | |||
@@ -1,142 +0,0 @@ | |||
1 | /* rc5-imon-mce.c - Keytable for Windows Media Center RC-6 remotes for use | ||
2 | * with the SoundGraph iMON/Antec Veris hardware IR decoder | ||
3 | * | ||
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | ||
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 | |||
12 | #include <media/rc-map.h> | ||
13 | |||
14 | /* mce-mode imon mce remote key table */ | ||
15 | static struct ir_scancode imon_mce[] = { | ||
16 | /* keys sorted mostly by frequency of use to optimize lookups */ | ||
17 | { 0x800ff415, KEY_REWIND }, | ||
18 | { 0x800ff414, KEY_FASTFORWARD }, | ||
19 | { 0x800ff41b, KEY_PREVIOUS }, | ||
20 | { 0x800ff41a, KEY_NEXT }, | ||
21 | |||
22 | { 0x800ff416, KEY_PLAY }, | ||
23 | { 0x800ff418, KEY_PAUSE }, | ||
24 | { 0x800ff419, KEY_STOP }, | ||
25 | { 0x800ff417, KEY_RECORD }, | ||
26 | |||
27 | { 0x02000052, KEY_UP }, | ||
28 | { 0x02000051, KEY_DOWN }, | ||
29 | { 0x02000050, KEY_LEFT }, | ||
30 | { 0x0200004f, KEY_RIGHT }, | ||
31 | |||
32 | { 0x800ff41e, KEY_UP }, | ||
33 | { 0x800ff41f, KEY_DOWN }, | ||
34 | { 0x800ff420, KEY_LEFT }, | ||
35 | { 0x800ff421, KEY_RIGHT }, | ||
36 | |||
37 | /* 0x800ff40b also KEY_NUMERIC_POUND on some receivers */ | ||
38 | { 0x800ff40b, KEY_ENTER }, | ||
39 | { 0x02000028, KEY_ENTER }, | ||
40 | /* the OK and Enter buttons decode to the same value on some remotes | ||
41 | { 0x02000028, KEY_OK }, */ | ||
42 | { 0x800ff422, KEY_OK }, | ||
43 | { 0x0200002a, KEY_EXIT }, | ||
44 | { 0x800ff423, KEY_EXIT }, | ||
45 | { 0x02000029, KEY_DELETE }, | ||
46 | /* 0x800ff40a also KEY_NUMERIC_STAR on some receivers */ | ||
47 | { 0x800ff40a, KEY_DELETE }, | ||
48 | |||
49 | { 0x800ff40e, KEY_MUTE }, | ||
50 | { 0x800ff410, KEY_VOLUMEUP }, | ||
51 | { 0x800ff411, KEY_VOLUMEDOWN }, | ||
52 | { 0x800ff412, KEY_CHANNELUP }, | ||
53 | { 0x800ff413, KEY_CHANNELDOWN }, | ||
54 | |||
55 | { 0x0200001e, KEY_NUMERIC_1 }, | ||
56 | { 0x0200001f, KEY_NUMERIC_2 }, | ||
57 | { 0x02000020, KEY_NUMERIC_3 }, | ||
58 | { 0x02000021, KEY_NUMERIC_4 }, | ||
59 | { 0x02000022, KEY_NUMERIC_5 }, | ||
60 | { 0x02000023, KEY_NUMERIC_6 }, | ||
61 | { 0x02000024, KEY_NUMERIC_7 }, | ||
62 | { 0x02000025, KEY_NUMERIC_8 }, | ||
63 | { 0x02000026, KEY_NUMERIC_9 }, | ||
64 | { 0x02000027, KEY_NUMERIC_0 }, | ||
65 | |||
66 | { 0x800ff401, KEY_NUMERIC_1 }, | ||
67 | { 0x800ff402, KEY_NUMERIC_2 }, | ||
68 | { 0x800ff403, KEY_NUMERIC_3 }, | ||
69 | { 0x800ff404, KEY_NUMERIC_4 }, | ||
70 | { 0x800ff405, KEY_NUMERIC_5 }, | ||
71 | { 0x800ff406, KEY_NUMERIC_6 }, | ||
72 | { 0x800ff407, KEY_NUMERIC_7 }, | ||
73 | { 0x800ff408, KEY_NUMERIC_8 }, | ||
74 | { 0x800ff409, KEY_NUMERIC_9 }, | ||
75 | { 0x800ff400, KEY_NUMERIC_0 }, | ||
76 | |||
77 | { 0x02200025, KEY_NUMERIC_STAR }, | ||
78 | { 0x02200020, KEY_NUMERIC_POUND }, | ||
79 | /* 0x800ff41d also KEY_BLUE on some receivers */ | ||
80 | { 0x800ff41d, KEY_NUMERIC_STAR }, | ||
81 | /* 0x800ff41c also KEY_PREVIOUS on some receivers */ | ||
82 | { 0x800ff41c, KEY_NUMERIC_POUND }, | ||
83 | |||
84 | { 0x800ff446, KEY_TV }, | ||
85 | { 0x800ff447, KEY_AUDIO }, /* My Music */ | ||
86 | { 0x800ff448, KEY_PVR }, /* RecordedTV */ | ||
87 | { 0x800ff449, KEY_CAMERA }, | ||
88 | { 0x800ff44a, KEY_VIDEO }, | ||
89 | /* 0x800ff424 also KEY_MENU on some receivers */ | ||
90 | { 0x800ff424, KEY_DVD }, | ||
91 | /* 0x800ff425 also KEY_GREEN on some receivers */ | ||
92 | { 0x800ff425, KEY_TUNER }, /* LiveTV */ | ||
93 | { 0x800ff450, KEY_RADIO }, | ||
94 | |||
95 | { 0x800ff44c, KEY_LANGUAGE }, | ||
96 | { 0x800ff427, KEY_ZOOM }, /* Aspect */ | ||
97 | |||
98 | { 0x800ff45b, KEY_RED }, | ||
99 | { 0x800ff45c, KEY_GREEN }, | ||
100 | { 0x800ff45d, KEY_YELLOW }, | ||
101 | { 0x800ff45e, KEY_BLUE }, | ||
102 | |||
103 | { 0x800ff466, KEY_RED }, | ||
104 | /* { 0x800ff425, KEY_GREEN }, */ | ||
105 | { 0x800ff468, KEY_YELLOW }, | ||
106 | /* { 0x800ff41d, KEY_BLUE }, */ | ||
107 | |||
108 | { 0x800ff40f, KEY_INFO }, | ||
109 | { 0x800ff426, KEY_EPG }, /* Guide */ | ||
110 | { 0x800ff45a, KEY_SUBTITLE }, /* Caption/Teletext */ | ||
111 | { 0x800ff44d, KEY_TITLE }, | ||
112 | |||
113 | { 0x800ff40c, KEY_POWER }, | ||
114 | { 0x800ff40d, KEY_PROG1 }, /* Windows MCE button */ | ||
115 | |||
116 | }; | ||
117 | |||
118 | static struct rc_keymap imon_mce_map = { | ||
119 | .map = { | ||
120 | .scan = imon_mce, | ||
121 | .size = ARRAY_SIZE(imon_mce), | ||
122 | /* its RC6, but w/a hardware decoder */ | ||
123 | .ir_type = IR_TYPE_RC6, | ||
124 | .name = RC_MAP_IMON_MCE, | ||
125 | } | ||
126 | }; | ||
127 | |||
128 | static int __init init_rc_map_imon_mce(void) | ||
129 | { | ||
130 | return ir_register_map(&imon_mce_map); | ||
131 | } | ||
132 | |||
133 | static void __exit exit_rc_map_imon_mce(void) | ||
134 | { | ||
135 | ir_unregister_map(&imon_mce_map); | ||
136 | } | ||
137 | |||
138 | module_init(init_rc_map_imon_mce) | ||
139 | module_exit(exit_rc_map_imon_mce) | ||
140 | |||
141 | MODULE_LICENSE("GPL"); | ||
142 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-imon-pad.c b/drivers/media/IR/keymaps/rc-imon-pad.c deleted file mode 100644 index bc4db72f02e6..000000000000 --- a/drivers/media/IR/keymaps/rc-imon-pad.c +++ /dev/null | |||
@@ -1,156 +0,0 @@ | |||
1 | /* rc5-imon-pad.c - Keytable for SoundGraph iMON PAD and Antec Veris | ||
2 | * RM-200 Remote Control | ||
3 | * | ||
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | ||
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 | |||
12 | #include <media/rc-map.h> | ||
13 | |||
14 | /* | ||
15 | * standard imon remote key table, which isn't really entirely | ||
16 | * "standard", as different receivers decode the same key on the | ||
17 | * same remote to different hex codes, and the silkscreened names | ||
18 | * vary a bit between the SoundGraph and Antec remotes... ugh. | ||
19 | */ | ||
20 | static struct ir_scancode imon_pad[] = { | ||
21 | /* keys sorted mostly by frequency of use to optimize lookups */ | ||
22 | { 0x2a8195b7, KEY_REWIND }, | ||
23 | { 0x298315b7, KEY_REWIND }, | ||
24 | { 0x2b8115b7, KEY_FASTFORWARD }, | ||
25 | { 0x2b8315b7, KEY_FASTFORWARD }, | ||
26 | { 0x2b9115b7, KEY_PREVIOUS }, | ||
27 | { 0x298195b7, KEY_NEXT }, | ||
28 | |||
29 | { 0x2a8115b7, KEY_PLAY }, | ||
30 | { 0x2a8315b7, KEY_PLAY }, | ||
31 | { 0x2a9115b7, KEY_PAUSE }, | ||
32 | { 0x2b9715b7, KEY_STOP }, | ||
33 | { 0x298115b7, KEY_RECORD }, | ||
34 | |||
35 | { 0x01008000, KEY_UP }, | ||
36 | { 0x01007f00, KEY_DOWN }, | ||
37 | { 0x01000080, KEY_LEFT }, | ||
38 | { 0x0100007f, KEY_RIGHT }, | ||
39 | |||
40 | { 0x2aa515b7, KEY_UP }, | ||
41 | { 0x289515b7, KEY_DOWN }, | ||
42 | { 0x29a515b7, KEY_LEFT }, | ||
43 | { 0x2ba515b7, KEY_RIGHT }, | ||
44 | |||
45 | { 0x0200002c, KEY_SPACE }, /* Select/Space */ | ||
46 | { 0x2a9315b7, KEY_SPACE }, /* Select/Space */ | ||
47 | { 0x02000028, KEY_ENTER }, | ||
48 | { 0x28a195b7, KEY_ENTER }, | ||
49 | { 0x288195b7, KEY_EXIT }, | ||
50 | { 0x02000029, KEY_ESC }, | ||
51 | { 0x2bb715b7, KEY_ESC }, | ||
52 | { 0x0200002a, KEY_BACKSPACE }, | ||
53 | { 0x28a115b7, KEY_BACKSPACE }, | ||
54 | |||
55 | { 0x2b9595b7, KEY_MUTE }, | ||
56 | { 0x28a395b7, KEY_VOLUMEUP }, | ||
57 | { 0x28a595b7, KEY_VOLUMEDOWN }, | ||
58 | { 0x289395b7, KEY_CHANNELUP }, | ||
59 | { 0x288795b7, KEY_CHANNELDOWN }, | ||
60 | |||
61 | { 0x0200001e, KEY_NUMERIC_1 }, | ||
62 | { 0x0200001f, KEY_NUMERIC_2 }, | ||
63 | { 0x02000020, KEY_NUMERIC_3 }, | ||
64 | { 0x02000021, KEY_NUMERIC_4 }, | ||
65 | { 0x02000022, KEY_NUMERIC_5 }, | ||
66 | { 0x02000023, KEY_NUMERIC_6 }, | ||
67 | { 0x02000024, KEY_NUMERIC_7 }, | ||
68 | { 0x02000025, KEY_NUMERIC_8 }, | ||
69 | { 0x02000026, KEY_NUMERIC_9 }, | ||
70 | { 0x02000027, KEY_NUMERIC_0 }, | ||
71 | |||
72 | { 0x28b595b7, KEY_NUMERIC_1 }, | ||
73 | { 0x2bb195b7, KEY_NUMERIC_2 }, | ||
74 | { 0x28b195b7, KEY_NUMERIC_3 }, | ||
75 | { 0x2a8595b7, KEY_NUMERIC_4 }, | ||
76 | { 0x299595b7, KEY_NUMERIC_5 }, | ||
77 | { 0x2aa595b7, KEY_NUMERIC_6 }, | ||
78 | { 0x2b9395b7, KEY_NUMERIC_7 }, | ||
79 | { 0x2a8515b7, KEY_NUMERIC_8 }, | ||
80 | { 0x2aa115b7, KEY_NUMERIC_9 }, | ||
81 | { 0x2ba595b7, KEY_NUMERIC_0 }, | ||
82 | |||
83 | { 0x02200025, KEY_NUMERIC_STAR }, | ||
84 | { 0x28b515b7, KEY_NUMERIC_STAR }, | ||
85 | { 0x02200020, KEY_NUMERIC_POUND }, | ||
86 | { 0x29a115b7, KEY_NUMERIC_POUND }, | ||
87 | |||
88 | { 0x2b8515b7, KEY_VIDEO }, | ||
89 | { 0x299195b7, KEY_AUDIO }, | ||
90 | { 0x2ba115b7, KEY_CAMERA }, | ||
91 | { 0x28a515b7, KEY_TV }, | ||
92 | { 0x29a395b7, KEY_DVD }, | ||
93 | { 0x29a295b7, KEY_DVD }, | ||
94 | |||
95 | /* the Menu key between DVD and Subtitle on the RM-200... */ | ||
96 | { 0x2ba385b7, KEY_MENU }, | ||
97 | { 0x2ba395b7, KEY_MENU }, | ||
98 | |||
99 | { 0x288515b7, KEY_BOOKMARKS }, | ||
100 | { 0x2ab715b7, KEY_MEDIA }, /* Thumbnail */ | ||
101 | { 0x298595b7, KEY_SUBTITLE }, | ||
102 | { 0x2b8595b7, KEY_LANGUAGE }, | ||
103 | |||
104 | { 0x29a595b7, KEY_ZOOM }, | ||
105 | { 0x2aa395b7, KEY_SCREEN }, /* FullScreen */ | ||
106 | |||
107 | { 0x299115b7, KEY_KEYBOARD }, | ||
108 | { 0x299135b7, KEY_KEYBOARD }, | ||
109 | |||
110 | { 0x01010000, BTN_LEFT }, | ||
111 | { 0x01020000, BTN_RIGHT }, | ||
112 | { 0x01010080, BTN_LEFT }, | ||
113 | { 0x01020080, BTN_RIGHT }, | ||
114 | { 0x688301b7, BTN_LEFT }, | ||
115 | { 0x688481b7, BTN_RIGHT }, | ||
116 | |||
117 | { 0x2a9395b7, KEY_CYCLEWINDOWS }, /* TaskSwitcher */ | ||
118 | { 0x2b8395b7, KEY_TIME }, /* Timer */ | ||
119 | |||
120 | { 0x289115b7, KEY_POWER }, | ||
121 | { 0x29b195b7, KEY_EJECTCD }, /* the one next to play */ | ||
122 | { 0x299395b7, KEY_EJECTCLOSECD }, /* eject (by TaskSw) */ | ||
123 | |||
124 | { 0x02800000, KEY_CONTEXT_MENU }, /* Left Menu */ | ||
125 | { 0x2b8195b7, KEY_CONTEXT_MENU }, /* Left Menu*/ | ||
126 | { 0x02000065, KEY_COMPOSE }, /* RightMenu */ | ||
127 | { 0x28b715b7, KEY_COMPOSE }, /* RightMenu */ | ||
128 | { 0x2ab195b7, KEY_PROG1 }, /* Go or MultiMon */ | ||
129 | { 0x29b715b7, KEY_DASHBOARD }, /* AppLauncher */ | ||
130 | }; | ||
131 | |||
132 | static struct rc_keymap imon_pad_map = { | ||
133 | .map = { | ||
134 | .scan = imon_pad, | ||
135 | .size = ARRAY_SIZE(imon_pad), | ||
136 | /* actual protocol details unknown, hardware decoder */ | ||
137 | .ir_type = IR_TYPE_OTHER, | ||
138 | .name = RC_MAP_IMON_PAD, | ||
139 | } | ||
140 | }; | ||
141 | |||
142 | static int __init init_rc_map_imon_pad(void) | ||
143 | { | ||
144 | return ir_register_map(&imon_pad_map); | ||
145 | } | ||
146 | |||
147 | static void __exit exit_rc_map_imon_pad(void) | ||
148 | { | ||
149 | ir_unregister_map(&imon_pad_map); | ||
150 | } | ||
151 | |||
152 | module_init(init_rc_map_imon_pad) | ||
153 | module_exit(exit_rc_map_imon_pad) | ||
154 | |||
155 | MODULE_LICENSE("GPL"); | ||
156 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-iodata-bctv7e.c b/drivers/media/IR/keymaps/rc-iodata-bctv7e.c deleted file mode 100644 index ef6600259fc0..000000000000 --- a/drivers/media/IR/keymaps/rc-iodata-bctv7e.c +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* iodata-bctv7e.h - Keytable for iodata_bctv7e Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* IO-DATA BCTV7E Remote */ | ||
16 | |||
17 | static struct ir_scancode iodata_bctv7e[] = { | ||
18 | { 0x40, KEY_TV }, | ||
19 | { 0x20, KEY_RADIO }, /* FM */ | ||
20 | { 0x60, KEY_EPG }, | ||
21 | { 0x00, KEY_POWER }, | ||
22 | |||
23 | /* Keys 0 to 9 */ | ||
24 | { 0x44, KEY_0 }, /* 10 */ | ||
25 | { 0x50, KEY_1 }, | ||
26 | { 0x30, KEY_2 }, | ||
27 | { 0x70, KEY_3 }, | ||
28 | { 0x48, KEY_4 }, | ||
29 | { 0x28, KEY_5 }, | ||
30 | { 0x68, KEY_6 }, | ||
31 | { 0x58, KEY_7 }, | ||
32 | { 0x38, KEY_8 }, | ||
33 | { 0x78, KEY_9 }, | ||
34 | |||
35 | { 0x10, KEY_L }, /* Live */ | ||
36 | { 0x08, KEY_TIME }, /* Time Shift */ | ||
37 | |||
38 | { 0x18, KEY_PLAYPAUSE }, /* Play */ | ||
39 | |||
40 | { 0x24, KEY_ENTER }, /* 11 */ | ||
41 | { 0x64, KEY_ESC }, /* 12 */ | ||
42 | { 0x04, KEY_M }, /* Multi */ | ||
43 | |||
44 | { 0x54, KEY_VIDEO }, | ||
45 | { 0x34, KEY_CHANNELUP }, | ||
46 | { 0x74, KEY_VOLUMEUP }, | ||
47 | { 0x14, KEY_MUTE }, | ||
48 | |||
49 | { 0x4c, KEY_VCR }, /* SVIDEO */ | ||
50 | { 0x2c, KEY_CHANNELDOWN }, | ||
51 | { 0x6c, KEY_VOLUMEDOWN }, | ||
52 | { 0x0c, KEY_ZOOM }, | ||
53 | |||
54 | { 0x5c, KEY_PAUSE }, | ||
55 | { 0x3c, KEY_RED }, /* || (red) */ | ||
56 | { 0x7c, KEY_RECORD }, /* recording */ | ||
57 | { 0x1c, KEY_STOP }, | ||
58 | |||
59 | { 0x41, KEY_REWIND }, /* backward << */ | ||
60 | { 0x21, KEY_PLAY }, | ||
61 | { 0x61, KEY_FASTFORWARD }, /* forward >> */ | ||
62 | { 0x01, KEY_NEXT }, /* skip >| */ | ||
63 | }; | ||
64 | |||
65 | static struct rc_keymap iodata_bctv7e_map = { | ||
66 | .map = { | ||
67 | .scan = iodata_bctv7e, | ||
68 | .size = ARRAY_SIZE(iodata_bctv7e), | ||
69 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
70 | .name = RC_MAP_IODATA_BCTV7E, | ||
71 | } | ||
72 | }; | ||
73 | |||
74 | static int __init init_rc_map_iodata_bctv7e(void) | ||
75 | { | ||
76 | return ir_register_map(&iodata_bctv7e_map); | ||
77 | } | ||
78 | |||
79 | static void __exit exit_rc_map_iodata_bctv7e(void) | ||
80 | { | ||
81 | ir_unregister_map(&iodata_bctv7e_map); | ||
82 | } | ||
83 | |||
84 | module_init(init_rc_map_iodata_bctv7e) | ||
85 | module_exit(exit_rc_map_iodata_bctv7e) | ||
86 | |||
87 | MODULE_LICENSE("GPL"); | ||
88 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-kaiomy.c b/drivers/media/IR/keymaps/rc-kaiomy.c deleted file mode 100644 index 4c7883ba0f15..000000000000 --- a/drivers/media/IR/keymaps/rc-kaiomy.c +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* kaiomy.h - Keytable for kaiomy Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Kaiomy TVnPC U2 | ||
16 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode kaiomy[] = { | ||
20 | { 0x43, KEY_POWER2}, | ||
21 | { 0x01, KEY_LIST}, | ||
22 | { 0x0b, KEY_ZOOM}, | ||
23 | { 0x03, KEY_POWER}, | ||
24 | |||
25 | { 0x04, KEY_1}, | ||
26 | { 0x08, KEY_2}, | ||
27 | { 0x02, KEY_3}, | ||
28 | |||
29 | { 0x0f, KEY_4}, | ||
30 | { 0x05, KEY_5}, | ||
31 | { 0x06, KEY_6}, | ||
32 | |||
33 | { 0x0c, KEY_7}, | ||
34 | { 0x0d, KEY_8}, | ||
35 | { 0x0a, KEY_9}, | ||
36 | |||
37 | { 0x11, KEY_0}, | ||
38 | |||
39 | { 0x09, KEY_CHANNELUP}, | ||
40 | { 0x07, KEY_CHANNELDOWN}, | ||
41 | |||
42 | { 0x0e, KEY_VOLUMEUP}, | ||
43 | { 0x13, KEY_VOLUMEDOWN}, | ||
44 | |||
45 | { 0x10, KEY_HOME}, | ||
46 | { 0x12, KEY_ENTER}, | ||
47 | |||
48 | { 0x14, KEY_RECORD}, | ||
49 | { 0x15, KEY_STOP}, | ||
50 | { 0x16, KEY_PLAY}, | ||
51 | { 0x17, KEY_MUTE}, | ||
52 | |||
53 | { 0x18, KEY_UP}, | ||
54 | { 0x19, KEY_DOWN}, | ||
55 | { 0x1a, KEY_LEFT}, | ||
56 | { 0x1b, KEY_RIGHT}, | ||
57 | |||
58 | { 0x1c, KEY_RED}, | ||
59 | { 0x1d, KEY_GREEN}, | ||
60 | { 0x1e, KEY_YELLOW}, | ||
61 | { 0x1f, KEY_BLUE}, | ||
62 | }; | ||
63 | |||
64 | static struct rc_keymap kaiomy_map = { | ||
65 | .map = { | ||
66 | .scan = kaiomy, | ||
67 | .size = ARRAY_SIZE(kaiomy), | ||
68 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
69 | .name = RC_MAP_KAIOMY, | ||
70 | } | ||
71 | }; | ||
72 | |||
73 | static int __init init_rc_map_kaiomy(void) | ||
74 | { | ||
75 | return ir_register_map(&kaiomy_map); | ||
76 | } | ||
77 | |||
78 | static void __exit exit_rc_map_kaiomy(void) | ||
79 | { | ||
80 | ir_unregister_map(&kaiomy_map); | ||
81 | } | ||
82 | |||
83 | module_init(init_rc_map_kaiomy) | ||
84 | module_exit(exit_rc_map_kaiomy) | ||
85 | |||
86 | MODULE_LICENSE("GPL"); | ||
87 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-kworld-315u.c b/drivers/media/IR/keymaps/rc-kworld-315u.c deleted file mode 100644 index 618c817374e6..000000000000 --- a/drivers/media/IR/keymaps/rc-kworld-315u.c +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* kworld-315u.h - Keytable for kworld_315u Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Kworld 315U | ||
16 | */ | ||
17 | |||
18 | static struct ir_scancode kworld_315u[] = { | ||
19 | { 0x6143, KEY_POWER }, | ||
20 | { 0x6101, KEY_TUNER }, /* source */ | ||
21 | { 0x610b, KEY_ZOOM }, | ||
22 | { 0x6103, KEY_POWER2 }, /* shutdown */ | ||
23 | |||
24 | { 0x6104, KEY_1 }, | ||
25 | { 0x6108, KEY_2 }, | ||
26 | { 0x6102, KEY_3 }, | ||
27 | { 0x6109, KEY_CHANNELUP }, | ||
28 | |||
29 | { 0x610f, KEY_4 }, | ||
30 | { 0x6105, KEY_5 }, | ||
31 | { 0x6106, KEY_6 }, | ||
32 | { 0x6107, KEY_CHANNELDOWN }, | ||
33 | |||
34 | { 0x610c, KEY_7 }, | ||
35 | { 0x610d, KEY_8 }, | ||
36 | { 0x610a, KEY_9 }, | ||
37 | { 0x610e, KEY_VOLUMEUP }, | ||
38 | |||
39 | { 0x6110, KEY_LAST }, | ||
40 | { 0x6111, KEY_0 }, | ||
41 | { 0x6112, KEY_ENTER }, | ||
42 | { 0x6113, KEY_VOLUMEDOWN }, | ||
43 | |||
44 | { 0x6114, KEY_RECORD }, | ||
45 | { 0x6115, KEY_STOP }, | ||
46 | { 0x6116, KEY_PLAY }, | ||
47 | { 0x6117, KEY_MUTE }, | ||
48 | |||
49 | { 0x6118, KEY_UP }, | ||
50 | { 0x6119, KEY_DOWN }, | ||
51 | { 0x611a, KEY_LEFT }, | ||
52 | { 0x611b, KEY_RIGHT }, | ||
53 | |||
54 | { 0x611c, KEY_RED }, | ||
55 | { 0x611d, KEY_GREEN }, | ||
56 | { 0x611e, KEY_YELLOW }, | ||
57 | { 0x611f, KEY_BLUE }, | ||
58 | }; | ||
59 | |||
60 | static struct rc_keymap kworld_315u_map = { | ||
61 | .map = { | ||
62 | .scan = kworld_315u, | ||
63 | .size = ARRAY_SIZE(kworld_315u), | ||
64 | .ir_type = IR_TYPE_NEC, | ||
65 | .name = RC_MAP_KWORLD_315U, | ||
66 | } | ||
67 | }; | ||
68 | |||
69 | static int __init init_rc_map_kworld_315u(void) | ||
70 | { | ||
71 | return ir_register_map(&kworld_315u_map); | ||
72 | } | ||
73 | |||
74 | static void __exit exit_rc_map_kworld_315u(void) | ||
75 | { | ||
76 | ir_unregister_map(&kworld_315u_map); | ||
77 | } | ||
78 | |||
79 | module_init(init_rc_map_kworld_315u) | ||
80 | module_exit(exit_rc_map_kworld_315u) | ||
81 | |||
82 | MODULE_LICENSE("GPL"); | ||
83 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c deleted file mode 100644 index 366732f1f7b7..000000000000 --- a/drivers/media/IR/keymaps/rc-kworld-plus-tv-analog.c +++ /dev/null | |||
@@ -1,99 +0,0 @@ | |||
1 | /* kworld-plus-tv-analog.h - Keytable for kworld_plus_tv_analog Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Kworld Plus TV Analog Lite PCI IR | ||
16 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode kworld_plus_tv_analog[] = { | ||
20 | { 0x0c, KEY_PROG1 }, /* Kworld key */ | ||
21 | { 0x16, KEY_CLOSECD }, /* -> ) */ | ||
22 | { 0x1d, KEY_POWER2 }, | ||
23 | |||
24 | { 0x00, KEY_1 }, | ||
25 | { 0x01, KEY_2 }, | ||
26 | { 0x02, KEY_3 }, /* Two keys have the same code: 3 and left */ | ||
27 | { 0x03, KEY_4 }, /* Two keys have the same code: 3 and right */ | ||
28 | { 0x04, KEY_5 }, | ||
29 | { 0x05, KEY_6 }, | ||
30 | { 0x06, KEY_7 }, | ||
31 | { 0x07, KEY_8 }, | ||
32 | { 0x08, KEY_9 }, | ||
33 | { 0x0a, KEY_0 }, | ||
34 | |||
35 | { 0x09, KEY_AGAIN }, | ||
36 | { 0x14, KEY_MUTE }, | ||
37 | |||
38 | { 0x20, KEY_UP }, | ||
39 | { 0x21, KEY_DOWN }, | ||
40 | { 0x0b, KEY_ENTER }, | ||
41 | |||
42 | { 0x10, KEY_CHANNELUP }, | ||
43 | { 0x11, KEY_CHANNELDOWN }, | ||
44 | |||
45 | /* Couldn't map key left/key right since those | ||
46 | conflict with '3' and '4' scancodes | ||
47 | I dunno what the original driver does | ||
48 | */ | ||
49 | |||
50 | { 0x13, KEY_VOLUMEUP }, | ||
51 | { 0x12, KEY_VOLUMEDOWN }, | ||
52 | |||
53 | /* The lower part of the IR | ||
54 | There are several duplicated keycodes there. | ||
55 | Most of them conflict with digits. | ||
56 | Add mappings just to the unused scancodes. | ||
57 | Somehow, the original driver has a way to know, | ||
58 | but this doesn't seem to be on some GPIO. | ||
59 | Also, it is not related to the time between keyup | ||
60 | and keydown. | ||
61 | */ | ||
62 | { 0x19, KEY_TIME}, /* Timeshift */ | ||
63 | { 0x1a, KEY_STOP}, | ||
64 | { 0x1b, KEY_RECORD}, | ||
65 | |||
66 | { 0x22, KEY_TEXT}, | ||
67 | |||
68 | { 0x15, KEY_AUDIO}, /* ((*)) */ | ||
69 | { 0x0f, KEY_ZOOM}, | ||
70 | { 0x1c, KEY_CAMERA}, /* snapshot */ | ||
71 | |||
72 | { 0x18, KEY_RED}, /* B */ | ||
73 | { 0x23, KEY_GREEN}, /* C */ | ||
74 | }; | ||
75 | |||
76 | static struct rc_keymap kworld_plus_tv_analog_map = { | ||
77 | .map = { | ||
78 | .scan = kworld_plus_tv_analog, | ||
79 | .size = ARRAY_SIZE(kworld_plus_tv_analog), | ||
80 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
81 | .name = RC_MAP_KWORLD_PLUS_TV_ANALOG, | ||
82 | } | ||
83 | }; | ||
84 | |||
85 | static int __init init_rc_map_kworld_plus_tv_analog(void) | ||
86 | { | ||
87 | return ir_register_map(&kworld_plus_tv_analog_map); | ||
88 | } | ||
89 | |||
90 | static void __exit exit_rc_map_kworld_plus_tv_analog(void) | ||
91 | { | ||
92 | ir_unregister_map(&kworld_plus_tv_analog_map); | ||
93 | } | ||
94 | |||
95 | module_init(init_rc_map_kworld_plus_tv_analog) | ||
96 | module_exit(exit_rc_map_kworld_plus_tv_analog) | ||
97 | |||
98 | MODULE_LICENSE("GPL"); | ||
99 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-lirc.c b/drivers/media/IR/keymaps/rc-lirc.c deleted file mode 100644 index 43fcf9035082..000000000000 --- a/drivers/media/IR/keymaps/rc-lirc.c +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | /* rc-lirc.c - Empty dummy keytable, for use when its preferred to pass | ||
2 | * all raw IR data to the lirc userspace decoder. | ||
3 | * | ||
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | ||
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 | |||
12 | #include <media/ir-core.h> | ||
13 | |||
14 | static struct ir_scancode lirc[] = { | ||
15 | { }, | ||
16 | }; | ||
17 | |||
18 | static struct rc_keymap lirc_map = { | ||
19 | .map = { | ||
20 | .scan = lirc, | ||
21 | .size = ARRAY_SIZE(lirc), | ||
22 | .ir_type = IR_TYPE_LIRC, | ||
23 | .name = RC_MAP_LIRC, | ||
24 | } | ||
25 | }; | ||
26 | |||
27 | static int __init init_rc_map_lirc(void) | ||
28 | { | ||
29 | return ir_register_map(&lirc_map); | ||
30 | } | ||
31 | |||
32 | static void __exit exit_rc_map_lirc(void) | ||
33 | { | ||
34 | ir_unregister_map(&lirc_map); | ||
35 | } | ||
36 | |||
37 | module_init(init_rc_map_lirc) | ||
38 | module_exit(exit_rc_map_lirc) | ||
39 | |||
40 | MODULE_LICENSE("GPL"); | ||
41 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-manli.c b/drivers/media/IR/keymaps/rc-manli.c deleted file mode 100644 index 1e9fbfa90a1e..000000000000 --- a/drivers/media/IR/keymaps/rc-manli.c +++ /dev/null | |||
@@ -1,135 +0,0 @@ | |||
1 | /* manli.h - Keytable for manli Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Michael Tokarev <mjt@tls.msk.ru> | ||
16 | http://www.corpit.ru/mjt/beholdTV/remote_control.jpg | ||
17 | keytable is used by MANLI MTV00[0x0c] and BeholdTV 40[13] at | ||
18 | least, and probably other cards too. | ||
19 | The "ascii-art picture" below (in comments, first row | ||
20 | is the keycode in hex, and subsequent row(s) shows | ||
21 | the button labels (several variants when appropriate) | ||
22 | helps to descide which keycodes to assign to the buttons. | ||
23 | */ | ||
24 | |||
25 | static struct ir_scancode manli[] = { | ||
26 | |||
27 | /* 0x1c 0x12 * | ||
28 | * FUNCTION POWER * | ||
29 | * FM (|) * | ||
30 | * */ | ||
31 | { 0x1c, KEY_RADIO }, /*XXX*/ | ||
32 | { 0x12, KEY_POWER }, | ||
33 | |||
34 | /* 0x01 0x02 0x03 * | ||
35 | * 1 2 3 * | ||
36 | * * | ||
37 | * 0x04 0x05 0x06 * | ||
38 | * 4 5 6 * | ||
39 | * * | ||
40 | * 0x07 0x08 0x09 * | ||
41 | * 7 8 9 * | ||
42 | * */ | ||
43 | { 0x01, KEY_1 }, | ||
44 | { 0x02, KEY_2 }, | ||
45 | { 0x03, KEY_3 }, | ||
46 | { 0x04, KEY_4 }, | ||
47 | { 0x05, KEY_5 }, | ||
48 | { 0x06, KEY_6 }, | ||
49 | { 0x07, KEY_7 }, | ||
50 | { 0x08, KEY_8 }, | ||
51 | { 0x09, KEY_9 }, | ||
52 | |||
53 | /* 0x0a 0x00 0x17 * | ||
54 | * RECALL 0 +100 * | ||
55 | * PLUS * | ||
56 | * */ | ||
57 | { 0x0a, KEY_AGAIN }, /*XXX KEY_REWIND? */ | ||
58 | { 0x00, KEY_0 }, | ||
59 | { 0x17, KEY_DIGITS }, /*XXX*/ | ||
60 | |||
61 | /* 0x14 0x10 * | ||
62 | * MENU INFO * | ||
63 | * OSD */ | ||
64 | { 0x14, KEY_MENU }, | ||
65 | { 0x10, KEY_INFO }, | ||
66 | |||
67 | /* 0x0b * | ||
68 | * Up * | ||
69 | * * | ||
70 | * 0x18 0x16 0x0c * | ||
71 | * Left Ok Right * | ||
72 | * * | ||
73 | * 0x015 * | ||
74 | * Down * | ||
75 | * */ | ||
76 | { 0x0b, KEY_UP }, | ||
77 | { 0x18, KEY_LEFT }, | ||
78 | { 0x16, KEY_OK }, /*XXX KEY_SELECT? KEY_ENTER? */ | ||
79 | { 0x0c, KEY_RIGHT }, | ||
80 | { 0x15, KEY_DOWN }, | ||
81 | |||
82 | /* 0x11 0x0d * | ||
83 | * TV/AV MODE * | ||
84 | * SOURCE STEREO * | ||
85 | * */ | ||
86 | { 0x11, KEY_TV }, /*XXX*/ | ||
87 | { 0x0d, KEY_MODE }, /*XXX there's no KEY_STEREO */ | ||
88 | |||
89 | /* 0x0f 0x1b 0x1a * | ||
90 | * AUDIO Vol+ Chan+ * | ||
91 | * TIMESHIFT??? * | ||
92 | * * | ||
93 | * 0x0e 0x1f 0x1e * | ||
94 | * SLEEP Vol- Chan- * | ||
95 | * */ | ||
96 | { 0x0f, KEY_AUDIO }, | ||
97 | { 0x1b, KEY_VOLUMEUP }, | ||
98 | { 0x1a, KEY_CHANNELUP }, | ||
99 | { 0x0e, KEY_TIME }, | ||
100 | { 0x1f, KEY_VOLUMEDOWN }, | ||
101 | { 0x1e, KEY_CHANNELDOWN }, | ||
102 | |||
103 | /* 0x13 0x19 * | ||
104 | * MUTE SNAPSHOT* | ||
105 | * */ | ||
106 | { 0x13, KEY_MUTE }, | ||
107 | { 0x19, KEY_CAMERA }, | ||
108 | |||
109 | /* 0x1d unused ? */ | ||
110 | }; | ||
111 | |||
112 | static struct rc_keymap manli_map = { | ||
113 | .map = { | ||
114 | .scan = manli, | ||
115 | .size = ARRAY_SIZE(manli), | ||
116 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
117 | .name = RC_MAP_MANLI, | ||
118 | } | ||
119 | }; | ||
120 | |||
121 | static int __init init_rc_map_manli(void) | ||
122 | { | ||
123 | return ir_register_map(&manli_map); | ||
124 | } | ||
125 | |||
126 | static void __exit exit_rc_map_manli(void) | ||
127 | { | ||
128 | ir_unregister_map(&manli_map); | ||
129 | } | ||
130 | |||
131 | module_init(init_rc_map_manli) | ||
132 | module_exit(exit_rc_map_manli) | ||
133 | |||
134 | MODULE_LICENSE("GPL"); | ||
135 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c deleted file mode 100644 index eb8e42c18ff9..000000000000 --- a/drivers/media/IR/keymaps/rc-msi-tvanywhere-plus.c +++ /dev/null | |||
@@ -1,123 +0,0 @@ | |||
1 | /* msi-tvanywhere-plus.h - Keytable for msi_tvanywhere_plus Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | Keycodes for remote on the MSI TV@nywhere Plus. The controller IC on the card | ||
17 | is marked "KS003". The controller is I2C at address 0x30, but does not seem | ||
18 | to respond to probes until a read is performed from a valid device. | ||
19 | I don't know why... | ||
20 | |||
21 | Note: This remote may be of similar or identical design to the | ||
22 | Pixelview remote (?). The raw codes and duplicate button codes | ||
23 | appear to be the same. | ||
24 | |||
25 | Henry Wong <henry@stuffedcow.net> | ||
26 | Some changes to formatting and keycodes by Mark Schultz <n9xmj@yahoo.com> | ||
27 | */ | ||
28 | |||
29 | static struct ir_scancode msi_tvanywhere_plus[] = { | ||
30 | |||
31 | /* ---- Remote Button Layout ---- | ||
32 | |||
33 | POWER SOURCE SCAN MUTE | ||
34 | TV/FM 1 2 3 | ||
35 | |> 4 5 6 | ||
36 | <| 7 8 9 | ||
37 | ^^UP 0 + RECALL | ||
38 | vvDN RECORD STOP PLAY | ||
39 | |||
40 | MINIMIZE ZOOM | ||
41 | |||
42 | CH+ | ||
43 | VOL- VOL+ | ||
44 | CH- | ||
45 | |||
46 | SNAPSHOT MTS | ||
47 | |||
48 | << FUNC >> RESET | ||
49 | */ | ||
50 | |||
51 | { 0x01, KEY_1 }, /* 1 */ | ||
52 | { 0x0b, KEY_2 }, /* 2 */ | ||
53 | { 0x1b, KEY_3 }, /* 3 */ | ||
54 | { 0x05, KEY_4 }, /* 4 */ | ||
55 | { 0x09, KEY_5 }, /* 5 */ | ||
56 | { 0x15, KEY_6 }, /* 6 */ | ||
57 | { 0x06, KEY_7 }, /* 7 */ | ||
58 | { 0x0a, KEY_8 }, /* 8 */ | ||
59 | { 0x12, KEY_9 }, /* 9 */ | ||
60 | { 0x02, KEY_0 }, /* 0 */ | ||
61 | { 0x10, KEY_KPPLUS }, /* + */ | ||
62 | { 0x13, KEY_AGAIN }, /* Recall */ | ||
63 | |||
64 | { 0x1e, KEY_POWER }, /* Power */ | ||
65 | { 0x07, KEY_TUNER }, /* Source */ | ||
66 | { 0x1c, KEY_SEARCH }, /* Scan */ | ||
67 | { 0x18, KEY_MUTE }, /* Mute */ | ||
68 | |||
69 | { 0x03, KEY_RADIO }, /* TV/FM */ | ||
70 | /* The next four keys are duplicates that appear to send the | ||
71 | same IR code as Ch+, Ch-, >>, and << . The raw code assigned | ||
72 | to them is the actual code + 0x20 - they will never be | ||
73 | detected as such unless some way is discovered to distinguish | ||
74 | these buttons from those that have the same code. */ | ||
75 | { 0x3f, KEY_RIGHT }, /* |> and Ch+ */ | ||
76 | { 0x37, KEY_LEFT }, /* <| and Ch- */ | ||
77 | { 0x2c, KEY_UP }, /* ^^Up and >> */ | ||
78 | { 0x24, KEY_DOWN }, /* vvDn and << */ | ||
79 | |||
80 | { 0x00, KEY_RECORD }, /* Record */ | ||
81 | { 0x08, KEY_STOP }, /* Stop */ | ||
82 | { 0x11, KEY_PLAY }, /* Play */ | ||
83 | |||
84 | { 0x0f, KEY_CLOSE }, /* Minimize */ | ||
85 | { 0x19, KEY_ZOOM }, /* Zoom */ | ||
86 | { 0x1a, KEY_CAMERA }, /* Snapshot */ | ||
87 | { 0x0d, KEY_LANGUAGE }, /* MTS */ | ||
88 | |||
89 | { 0x14, KEY_VOLUMEDOWN }, /* Vol- */ | ||
90 | { 0x16, KEY_VOLUMEUP }, /* Vol+ */ | ||
91 | { 0x17, KEY_CHANNELDOWN }, /* Ch- */ | ||
92 | { 0x1f, KEY_CHANNELUP }, /* Ch+ */ | ||
93 | |||
94 | { 0x04, KEY_REWIND }, /* << */ | ||
95 | { 0x0e, KEY_MENU }, /* Function */ | ||
96 | { 0x0c, KEY_FASTFORWARD }, /* >> */ | ||
97 | { 0x1d, KEY_RESTART }, /* Reset */ | ||
98 | }; | ||
99 | |||
100 | static struct rc_keymap msi_tvanywhere_plus_map = { | ||
101 | .map = { | ||
102 | .scan = msi_tvanywhere_plus, | ||
103 | .size = ARRAY_SIZE(msi_tvanywhere_plus), | ||
104 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
105 | .name = RC_MAP_MSI_TVANYWHERE_PLUS, | ||
106 | } | ||
107 | }; | ||
108 | |||
109 | static int __init init_rc_map_msi_tvanywhere_plus(void) | ||
110 | { | ||
111 | return ir_register_map(&msi_tvanywhere_plus_map); | ||
112 | } | ||
113 | |||
114 | static void __exit exit_rc_map_msi_tvanywhere_plus(void) | ||
115 | { | ||
116 | ir_unregister_map(&msi_tvanywhere_plus_map); | ||
117 | } | ||
118 | |||
119 | module_init(init_rc_map_msi_tvanywhere_plus) | ||
120 | module_exit(exit_rc_map_msi_tvanywhere_plus) | ||
121 | |||
122 | MODULE_LICENSE("GPL"); | ||
123 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-msi-tvanywhere.c b/drivers/media/IR/keymaps/rc-msi-tvanywhere.c deleted file mode 100644 index ef411854f067..000000000000 --- a/drivers/media/IR/keymaps/rc-msi-tvanywhere.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* msi-tvanywhere.h - Keytable for msi_tvanywhere Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* MSI TV@nywhere MASTER remote */ | ||
16 | |||
17 | static struct ir_scancode msi_tvanywhere[] = { | ||
18 | /* Keys 0 to 9 */ | ||
19 | { 0x00, KEY_0 }, | ||
20 | { 0x01, KEY_1 }, | ||
21 | { 0x02, KEY_2 }, | ||
22 | { 0x03, KEY_3 }, | ||
23 | { 0x04, KEY_4 }, | ||
24 | { 0x05, KEY_5 }, | ||
25 | { 0x06, KEY_6 }, | ||
26 | { 0x07, KEY_7 }, | ||
27 | { 0x08, KEY_8 }, | ||
28 | { 0x09, KEY_9 }, | ||
29 | |||
30 | { 0x0c, KEY_MUTE }, | ||
31 | { 0x0f, KEY_SCREEN }, /* Full Screen */ | ||
32 | { 0x10, KEY_FN }, /* Funtion */ | ||
33 | { 0x11, KEY_TIME }, /* Time shift */ | ||
34 | { 0x12, KEY_POWER }, | ||
35 | { 0x13, KEY_MEDIA }, /* MTS */ | ||
36 | { 0x14, KEY_SLOW }, | ||
37 | { 0x16, KEY_REWIND }, /* backward << */ | ||
38 | { 0x17, KEY_ENTER }, /* Return */ | ||
39 | { 0x18, KEY_FASTFORWARD }, /* forward >> */ | ||
40 | { 0x1a, KEY_CHANNELUP }, | ||
41 | { 0x1b, KEY_VOLUMEUP }, | ||
42 | { 0x1e, KEY_CHANNELDOWN }, | ||
43 | { 0x1f, KEY_VOLUMEDOWN }, | ||
44 | }; | ||
45 | |||
46 | static struct rc_keymap msi_tvanywhere_map = { | ||
47 | .map = { | ||
48 | .scan = msi_tvanywhere, | ||
49 | .size = ARRAY_SIZE(msi_tvanywhere), | ||
50 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
51 | .name = RC_MAP_MSI_TVANYWHERE, | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | static int __init init_rc_map_msi_tvanywhere(void) | ||
56 | { | ||
57 | return ir_register_map(&msi_tvanywhere_map); | ||
58 | } | ||
59 | |||
60 | static void __exit exit_rc_map_msi_tvanywhere(void) | ||
61 | { | ||
62 | ir_unregister_map(&msi_tvanywhere_map); | ||
63 | } | ||
64 | |||
65 | module_init(init_rc_map_msi_tvanywhere) | ||
66 | module_exit(exit_rc_map_msi_tvanywhere) | ||
67 | |||
68 | MODULE_LICENSE("GPL"); | ||
69 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-nebula.c b/drivers/media/IR/keymaps/rc-nebula.c deleted file mode 100644 index ccc50eb402ec..000000000000 --- a/drivers/media/IR/keymaps/rc-nebula.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* nebula.h - Keytable for nebula Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode nebula[] = { | ||
16 | { 0x00, KEY_0 }, | ||
17 | { 0x01, KEY_1 }, | ||
18 | { 0x02, KEY_2 }, | ||
19 | { 0x03, KEY_3 }, | ||
20 | { 0x04, KEY_4 }, | ||
21 | { 0x05, KEY_5 }, | ||
22 | { 0x06, KEY_6 }, | ||
23 | { 0x07, KEY_7 }, | ||
24 | { 0x08, KEY_8 }, | ||
25 | { 0x09, KEY_9 }, | ||
26 | { 0x0a, KEY_TV }, | ||
27 | { 0x0b, KEY_AUX }, | ||
28 | { 0x0c, KEY_DVD }, | ||
29 | { 0x0d, KEY_POWER }, | ||
30 | { 0x0e, KEY_MHP }, /* labelled 'Picture' */ | ||
31 | { 0x0f, KEY_AUDIO }, | ||
32 | { 0x10, KEY_INFO }, | ||
33 | { 0x11, KEY_F13 }, /* 16:9 */ | ||
34 | { 0x12, KEY_F14 }, /* 14:9 */ | ||
35 | { 0x13, KEY_EPG }, | ||
36 | { 0x14, KEY_EXIT }, | ||
37 | { 0x15, KEY_MENU }, | ||
38 | { 0x16, KEY_UP }, | ||
39 | { 0x17, KEY_DOWN }, | ||
40 | { 0x18, KEY_LEFT }, | ||
41 | { 0x19, KEY_RIGHT }, | ||
42 | { 0x1a, KEY_ENTER }, | ||
43 | { 0x1b, KEY_CHANNELUP }, | ||
44 | { 0x1c, KEY_CHANNELDOWN }, | ||
45 | { 0x1d, KEY_VOLUMEUP }, | ||
46 | { 0x1e, KEY_VOLUMEDOWN }, | ||
47 | { 0x1f, KEY_RED }, | ||
48 | { 0x20, KEY_GREEN }, | ||
49 | { 0x21, KEY_YELLOW }, | ||
50 | { 0x22, KEY_BLUE }, | ||
51 | { 0x23, KEY_SUBTITLE }, | ||
52 | { 0x24, KEY_F15 }, /* AD */ | ||
53 | { 0x25, KEY_TEXT }, | ||
54 | { 0x26, KEY_MUTE }, | ||
55 | { 0x27, KEY_REWIND }, | ||
56 | { 0x28, KEY_STOP }, | ||
57 | { 0x29, KEY_PLAY }, | ||
58 | { 0x2a, KEY_FASTFORWARD }, | ||
59 | { 0x2b, KEY_F16 }, /* chapter */ | ||
60 | { 0x2c, KEY_PAUSE }, | ||
61 | { 0x2d, KEY_PLAY }, | ||
62 | { 0x2e, KEY_RECORD }, | ||
63 | { 0x2f, KEY_F17 }, /* picture in picture */ | ||
64 | { 0x30, KEY_KPPLUS }, /* zoom in */ | ||
65 | { 0x31, KEY_KPMINUS }, /* zoom out */ | ||
66 | { 0x32, KEY_F18 }, /* capture */ | ||
67 | { 0x33, KEY_F19 }, /* web */ | ||
68 | { 0x34, KEY_EMAIL }, | ||
69 | { 0x35, KEY_PHONE }, | ||
70 | { 0x36, KEY_PC }, | ||
71 | }; | ||
72 | |||
73 | static struct rc_keymap nebula_map = { | ||
74 | .map = { | ||
75 | .scan = nebula, | ||
76 | .size = ARRAY_SIZE(nebula), | ||
77 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
78 | .name = RC_MAP_NEBULA, | ||
79 | } | ||
80 | }; | ||
81 | |||
82 | static int __init init_rc_map_nebula(void) | ||
83 | { | ||
84 | return ir_register_map(&nebula_map); | ||
85 | } | ||
86 | |||
87 | static void __exit exit_rc_map_nebula(void) | ||
88 | { | ||
89 | ir_unregister_map(&nebula_map); | ||
90 | } | ||
91 | |||
92 | module_init(init_rc_map_nebula) | ||
93 | module_exit(exit_rc_map_nebula) | ||
94 | |||
95 | MODULE_LICENSE("GPL"); | ||
96 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c b/drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c deleted file mode 100644 index e1b54d20db60..000000000000 --- a/drivers/media/IR/keymaps/rc-nec-terratec-cinergy-xs.c +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | /* nec-terratec-cinergy-xs.h - Keytable for nec_terratec_cinergy_xs Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Terratec Cinergy Hybrid T USB XS FM | ||
16 | Mauro Carvalho Chehab <mchehab@redhat.com> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode nec_terratec_cinergy_xs[] = { | ||
20 | { 0x1441, KEY_HOME}, | ||
21 | { 0x1401, KEY_POWER2}, | ||
22 | |||
23 | { 0x1442, KEY_MENU}, /* DVD menu */ | ||
24 | { 0x1443, KEY_SUBTITLE}, | ||
25 | { 0x1444, KEY_TEXT}, /* Teletext */ | ||
26 | { 0x1445, KEY_DELETE}, | ||
27 | |||
28 | { 0x1402, KEY_1}, | ||
29 | { 0x1403, KEY_2}, | ||
30 | { 0x1404, KEY_3}, | ||
31 | { 0x1405, KEY_4}, | ||
32 | { 0x1406, KEY_5}, | ||
33 | { 0x1407, KEY_6}, | ||
34 | { 0x1408, KEY_7}, | ||
35 | { 0x1409, KEY_8}, | ||
36 | { 0x140a, KEY_9}, | ||
37 | { 0x140c, KEY_0}, | ||
38 | |||
39 | { 0x140b, KEY_TUNER}, /* AV */ | ||
40 | { 0x140d, KEY_MODE}, /* A.B */ | ||
41 | |||
42 | { 0x1446, KEY_TV}, | ||
43 | { 0x1447, KEY_DVD}, | ||
44 | { 0x1449, KEY_VIDEO}, | ||
45 | { 0x144a, KEY_RADIO}, /* Music */ | ||
46 | { 0x144b, KEY_CAMERA}, /* PIC */ | ||
47 | |||
48 | { 0x1410, KEY_UP}, | ||
49 | { 0x1411, KEY_LEFT}, | ||
50 | { 0x1412, KEY_OK}, | ||
51 | { 0x1413, KEY_RIGHT}, | ||
52 | { 0x1414, KEY_DOWN}, | ||
53 | |||
54 | { 0x140f, KEY_EPG}, | ||
55 | { 0x1416, KEY_INFO}, | ||
56 | { 0x144d, KEY_BACKSPACE}, | ||
57 | |||
58 | { 0x141c, KEY_VOLUMEUP}, | ||
59 | { 0x141e, KEY_VOLUMEDOWN}, | ||
60 | |||
61 | { 0x144c, KEY_PLAY}, | ||
62 | { 0x141d, KEY_MUTE}, | ||
63 | |||
64 | { 0x141b, KEY_CHANNELUP}, | ||
65 | { 0x141f, KEY_CHANNELDOWN}, | ||
66 | |||
67 | { 0x1417, KEY_RED}, | ||
68 | { 0x1418, KEY_GREEN}, | ||
69 | { 0x1419, KEY_YELLOW}, | ||
70 | { 0x141a, KEY_BLUE}, | ||
71 | |||
72 | { 0x1458, KEY_RECORD}, | ||
73 | { 0x1448, KEY_STOP}, | ||
74 | { 0x1440, KEY_PAUSE}, | ||
75 | |||
76 | { 0x1454, KEY_LAST}, | ||
77 | { 0x144e, KEY_REWIND}, | ||
78 | { 0x144f, KEY_FASTFORWARD}, | ||
79 | { 0x145c, KEY_NEXT}, | ||
80 | }; | ||
81 | |||
82 | static struct rc_keymap nec_terratec_cinergy_xs_map = { | ||
83 | .map = { | ||
84 | .scan = nec_terratec_cinergy_xs, | ||
85 | .size = ARRAY_SIZE(nec_terratec_cinergy_xs), | ||
86 | .ir_type = IR_TYPE_NEC, | ||
87 | .name = RC_MAP_NEC_TERRATEC_CINERGY_XS, | ||
88 | } | ||
89 | }; | ||
90 | |||
91 | static int __init init_rc_map_nec_terratec_cinergy_xs(void) | ||
92 | { | ||
93 | return ir_register_map(&nec_terratec_cinergy_xs_map); | ||
94 | } | ||
95 | |||
96 | static void __exit exit_rc_map_nec_terratec_cinergy_xs(void) | ||
97 | { | ||
98 | ir_unregister_map(&nec_terratec_cinergy_xs_map); | ||
99 | } | ||
100 | |||
101 | module_init(init_rc_map_nec_terratec_cinergy_xs) | ||
102 | module_exit(exit_rc_map_nec_terratec_cinergy_xs) | ||
103 | |||
104 | MODULE_LICENSE("GPL"); | ||
105 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-norwood.c b/drivers/media/IR/keymaps/rc-norwood.c deleted file mode 100644 index e5849a6b3f05..000000000000 --- a/drivers/media/IR/keymaps/rc-norwood.c +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* norwood.h - Keytable for norwood Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Norwood Micro (non-Pro) TV Tuner | ||
16 | By Peter Naulls <peter@chocky.org> | ||
17 | Key comments are the functions given in the manual */ | ||
18 | |||
19 | static struct ir_scancode norwood[] = { | ||
20 | /* Keys 0 to 9 */ | ||
21 | { 0x20, KEY_0 }, | ||
22 | { 0x21, KEY_1 }, | ||
23 | { 0x22, KEY_2 }, | ||
24 | { 0x23, KEY_3 }, | ||
25 | { 0x24, KEY_4 }, | ||
26 | { 0x25, KEY_5 }, | ||
27 | { 0x26, KEY_6 }, | ||
28 | { 0x27, KEY_7 }, | ||
29 | { 0x28, KEY_8 }, | ||
30 | { 0x29, KEY_9 }, | ||
31 | |||
32 | { 0x78, KEY_TUNER }, /* Video Source */ | ||
33 | { 0x2c, KEY_EXIT }, /* Open/Close software */ | ||
34 | { 0x2a, KEY_SELECT }, /* 2 Digit Select */ | ||
35 | { 0x69, KEY_AGAIN }, /* Recall */ | ||
36 | |||
37 | { 0x32, KEY_BRIGHTNESSUP }, /* Brightness increase */ | ||
38 | { 0x33, KEY_BRIGHTNESSDOWN }, /* Brightness decrease */ | ||
39 | { 0x6b, KEY_KPPLUS }, /* (not named >>>>>) */ | ||
40 | { 0x6c, KEY_KPMINUS }, /* (not named <<<<<) */ | ||
41 | |||
42 | { 0x2d, KEY_MUTE }, /* Mute */ | ||
43 | { 0x30, KEY_VOLUMEUP }, /* Volume up */ | ||
44 | { 0x31, KEY_VOLUMEDOWN }, /* Volume down */ | ||
45 | { 0x60, KEY_CHANNELUP }, /* Channel up */ | ||
46 | { 0x61, KEY_CHANNELDOWN }, /* Channel down */ | ||
47 | |||
48 | { 0x3f, KEY_RECORD }, /* Record */ | ||
49 | { 0x37, KEY_PLAY }, /* Play */ | ||
50 | { 0x36, KEY_PAUSE }, /* Pause */ | ||
51 | { 0x2b, KEY_STOP }, /* Stop */ | ||
52 | { 0x67, KEY_FASTFORWARD }, /* Foward */ | ||
53 | { 0x66, KEY_REWIND }, /* Rewind */ | ||
54 | { 0x3e, KEY_SEARCH }, /* Auto Scan */ | ||
55 | { 0x2e, KEY_CAMERA }, /* Capture Video */ | ||
56 | { 0x6d, KEY_MENU }, /* Show/Hide Control */ | ||
57 | { 0x2f, KEY_ZOOM }, /* Full Screen */ | ||
58 | { 0x34, KEY_RADIO }, /* FM */ | ||
59 | { 0x65, KEY_POWER }, /* Computer power */ | ||
60 | }; | ||
61 | |||
62 | static struct rc_keymap norwood_map = { | ||
63 | .map = { | ||
64 | .scan = norwood, | ||
65 | .size = ARRAY_SIZE(norwood), | ||
66 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
67 | .name = RC_MAP_NORWOOD, | ||
68 | } | ||
69 | }; | ||
70 | |||
71 | static int __init init_rc_map_norwood(void) | ||
72 | { | ||
73 | return ir_register_map(&norwood_map); | ||
74 | } | ||
75 | |||
76 | static void __exit exit_rc_map_norwood(void) | ||
77 | { | ||
78 | ir_unregister_map(&norwood_map); | ||
79 | } | ||
80 | |||
81 | module_init(init_rc_map_norwood) | ||
82 | module_exit(exit_rc_map_norwood) | ||
83 | |||
84 | MODULE_LICENSE("GPL"); | ||
85 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-npgtech.c b/drivers/media/IR/keymaps/rc-npgtech.c deleted file mode 100644 index b9ece1e90296..000000000000 --- a/drivers/media/IR/keymaps/rc-npgtech.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* npgtech.h - Keytable for npgtech Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode npgtech[] = { | ||
16 | { 0x1d, KEY_SWITCHVIDEOMODE }, /* switch inputs */ | ||
17 | { 0x2a, KEY_FRONT }, | ||
18 | |||
19 | { 0x3e, KEY_1 }, | ||
20 | { 0x02, KEY_2 }, | ||
21 | { 0x06, KEY_3 }, | ||
22 | { 0x0a, KEY_4 }, | ||
23 | { 0x0e, KEY_5 }, | ||
24 | { 0x12, KEY_6 }, | ||
25 | { 0x16, KEY_7 }, | ||
26 | { 0x1a, KEY_8 }, | ||
27 | { 0x1e, KEY_9 }, | ||
28 | { 0x3a, KEY_0 }, | ||
29 | { 0x22, KEY_NUMLOCK }, /* -/-- */ | ||
30 | { 0x20, KEY_REFRESH }, | ||
31 | |||
32 | { 0x03, KEY_BRIGHTNESSDOWN }, | ||
33 | { 0x28, KEY_AUDIO }, | ||
34 | { 0x3c, KEY_CHANNELUP }, | ||
35 | { 0x3f, KEY_VOLUMEDOWN }, | ||
36 | { 0x2e, KEY_MUTE }, | ||
37 | { 0x3b, KEY_VOLUMEUP }, | ||
38 | { 0x00, KEY_CHANNELDOWN }, | ||
39 | { 0x07, KEY_BRIGHTNESSUP }, | ||
40 | { 0x2c, KEY_TEXT }, | ||
41 | |||
42 | { 0x37, KEY_RECORD }, | ||
43 | { 0x17, KEY_PLAY }, | ||
44 | { 0x13, KEY_PAUSE }, | ||
45 | { 0x26, KEY_STOP }, | ||
46 | { 0x18, KEY_FASTFORWARD }, | ||
47 | { 0x14, KEY_REWIND }, | ||
48 | { 0x33, KEY_ZOOM }, | ||
49 | { 0x32, KEY_KEYBOARD }, | ||
50 | { 0x30, KEY_GOTO }, /* Pointing arrow */ | ||
51 | { 0x36, KEY_MACRO }, /* Maximize/Minimize (yellow) */ | ||
52 | { 0x0b, KEY_RADIO }, | ||
53 | { 0x10, KEY_POWER }, | ||
54 | |||
55 | }; | ||
56 | |||
57 | static struct rc_keymap npgtech_map = { | ||
58 | .map = { | ||
59 | .scan = npgtech, | ||
60 | .size = ARRAY_SIZE(npgtech), | ||
61 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
62 | .name = RC_MAP_NPGTECH, | ||
63 | } | ||
64 | }; | ||
65 | |||
66 | static int __init init_rc_map_npgtech(void) | ||
67 | { | ||
68 | return ir_register_map(&npgtech_map); | ||
69 | } | ||
70 | |||
71 | static void __exit exit_rc_map_npgtech(void) | ||
72 | { | ||
73 | ir_unregister_map(&npgtech_map); | ||
74 | } | ||
75 | |||
76 | module_init(init_rc_map_npgtech) | ||
77 | module_exit(exit_rc_map_npgtech) | ||
78 | |||
79 | MODULE_LICENSE("GPL"); | ||
80 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pctv-sedna.c b/drivers/media/IR/keymaps/rc-pctv-sedna.c deleted file mode 100644 index 4129bb44a25b..000000000000 --- a/drivers/media/IR/keymaps/rc-pctv-sedna.c +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | /* pctv-sedna.h - Keytable for pctv_sedna Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Mapping for the 28 key remote control as seen at | ||
16 | http://www.sednacomputer.com/photo/cardbus-tv.jpg | ||
17 | Pavel Mihaylov <bin@bash.info> | ||
18 | Also for the remote bundled with Kozumi KTV-01C card */ | ||
19 | |||
20 | static struct ir_scancode pctv_sedna[] = { | ||
21 | { 0x00, KEY_0 }, | ||
22 | { 0x01, KEY_1 }, | ||
23 | { 0x02, KEY_2 }, | ||
24 | { 0x03, KEY_3 }, | ||
25 | { 0x04, KEY_4 }, | ||
26 | { 0x05, KEY_5 }, | ||
27 | { 0x06, KEY_6 }, | ||
28 | { 0x07, KEY_7 }, | ||
29 | { 0x08, KEY_8 }, | ||
30 | { 0x09, KEY_9 }, | ||
31 | |||
32 | { 0x0a, KEY_AGAIN }, /* Recall */ | ||
33 | { 0x0b, KEY_CHANNELUP }, | ||
34 | { 0x0c, KEY_VOLUMEUP }, | ||
35 | { 0x0d, KEY_MODE }, /* Stereo */ | ||
36 | { 0x0e, KEY_STOP }, | ||
37 | { 0x0f, KEY_PREVIOUSSONG }, | ||
38 | { 0x10, KEY_ZOOM }, | ||
39 | { 0x11, KEY_TUNER }, /* Source */ | ||
40 | { 0x12, KEY_POWER }, | ||
41 | { 0x13, KEY_MUTE }, | ||
42 | { 0x15, KEY_CHANNELDOWN }, | ||
43 | { 0x18, KEY_VOLUMEDOWN }, | ||
44 | { 0x19, KEY_CAMERA }, /* Snapshot */ | ||
45 | { 0x1a, KEY_NEXTSONG }, | ||
46 | { 0x1b, KEY_TIME }, /* Time Shift */ | ||
47 | { 0x1c, KEY_RADIO }, /* FM Radio */ | ||
48 | { 0x1d, KEY_RECORD }, | ||
49 | { 0x1e, KEY_PAUSE }, | ||
50 | /* additional codes for Kozumi's remote */ | ||
51 | { 0x14, KEY_INFO }, /* OSD */ | ||
52 | { 0x16, KEY_OK }, /* OK */ | ||
53 | { 0x17, KEY_DIGITS }, /* Plus */ | ||
54 | { 0x1f, KEY_PLAY }, /* Play */ | ||
55 | }; | ||
56 | |||
57 | static struct rc_keymap pctv_sedna_map = { | ||
58 | .map = { | ||
59 | .scan = pctv_sedna, | ||
60 | .size = ARRAY_SIZE(pctv_sedna), | ||
61 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
62 | .name = RC_MAP_PCTV_SEDNA, | ||
63 | } | ||
64 | }; | ||
65 | |||
66 | static int __init init_rc_map_pctv_sedna(void) | ||
67 | { | ||
68 | return ir_register_map(&pctv_sedna_map); | ||
69 | } | ||
70 | |||
71 | static void __exit exit_rc_map_pctv_sedna(void) | ||
72 | { | ||
73 | ir_unregister_map(&pctv_sedna_map); | ||
74 | } | ||
75 | |||
76 | module_init(init_rc_map_pctv_sedna) | ||
77 | module_exit(exit_rc_map_pctv_sedna) | ||
78 | |||
79 | MODULE_LICENSE("GPL"); | ||
80 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pinnacle-color.c b/drivers/media/IR/keymaps/rc-pinnacle-color.c deleted file mode 100644 index 326e023ce126..000000000000 --- a/drivers/media/IR/keymaps/rc-pinnacle-color.c +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | /* pinnacle-color.h - Keytable for pinnacle_color Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode pinnacle_color[] = { | ||
16 | { 0x59, KEY_MUTE }, | ||
17 | { 0x4a, KEY_POWER }, | ||
18 | |||
19 | { 0x18, KEY_TEXT }, | ||
20 | { 0x26, KEY_TV }, | ||
21 | { 0x3d, KEY_PRINT }, | ||
22 | |||
23 | { 0x48, KEY_RED }, | ||
24 | { 0x04, KEY_GREEN }, | ||
25 | { 0x11, KEY_YELLOW }, | ||
26 | { 0x00, KEY_BLUE }, | ||
27 | |||
28 | { 0x2d, KEY_VOLUMEUP }, | ||
29 | { 0x1e, KEY_VOLUMEDOWN }, | ||
30 | |||
31 | { 0x49, KEY_MENU }, | ||
32 | |||
33 | { 0x16, KEY_CHANNELUP }, | ||
34 | { 0x17, KEY_CHANNELDOWN }, | ||
35 | |||
36 | { 0x20, KEY_UP }, | ||
37 | { 0x21, KEY_DOWN }, | ||
38 | { 0x22, KEY_LEFT }, | ||
39 | { 0x23, KEY_RIGHT }, | ||
40 | { 0x0d, KEY_SELECT }, | ||
41 | |||
42 | { 0x08, KEY_BACK }, | ||
43 | { 0x07, KEY_REFRESH }, | ||
44 | |||
45 | { 0x2f, KEY_ZOOM }, | ||
46 | { 0x29, KEY_RECORD }, | ||
47 | |||
48 | { 0x4b, KEY_PAUSE }, | ||
49 | { 0x4d, KEY_REWIND }, | ||
50 | { 0x2e, KEY_PLAY }, | ||
51 | { 0x4e, KEY_FORWARD }, | ||
52 | { 0x53, KEY_PREVIOUS }, | ||
53 | { 0x4c, KEY_STOP }, | ||
54 | { 0x54, KEY_NEXT }, | ||
55 | |||
56 | { 0x69, KEY_0 }, | ||
57 | { 0x6a, KEY_1 }, | ||
58 | { 0x6b, KEY_2 }, | ||
59 | { 0x6c, KEY_3 }, | ||
60 | { 0x6d, KEY_4 }, | ||
61 | { 0x6e, KEY_5 }, | ||
62 | { 0x6f, KEY_6 }, | ||
63 | { 0x70, KEY_7 }, | ||
64 | { 0x71, KEY_8 }, | ||
65 | { 0x72, KEY_9 }, | ||
66 | |||
67 | { 0x74, KEY_CHANNEL }, | ||
68 | { 0x0a, KEY_BACKSPACE }, | ||
69 | }; | ||
70 | |||
71 | static struct rc_keymap pinnacle_color_map = { | ||
72 | .map = { | ||
73 | .scan = pinnacle_color, | ||
74 | .size = ARRAY_SIZE(pinnacle_color), | ||
75 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
76 | .name = RC_MAP_PINNACLE_COLOR, | ||
77 | } | ||
78 | }; | ||
79 | |||
80 | static int __init init_rc_map_pinnacle_color(void) | ||
81 | { | ||
82 | return ir_register_map(&pinnacle_color_map); | ||
83 | } | ||
84 | |||
85 | static void __exit exit_rc_map_pinnacle_color(void) | ||
86 | { | ||
87 | ir_unregister_map(&pinnacle_color_map); | ||
88 | } | ||
89 | |||
90 | module_init(init_rc_map_pinnacle_color) | ||
91 | module_exit(exit_rc_map_pinnacle_color) | ||
92 | |||
93 | MODULE_LICENSE("GPL"); | ||
94 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pinnacle-grey.c b/drivers/media/IR/keymaps/rc-pinnacle-grey.c deleted file mode 100644 index 14cb772515c6..000000000000 --- a/drivers/media/IR/keymaps/rc-pinnacle-grey.c +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | /* pinnacle-grey.h - Keytable for pinnacle_grey Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode pinnacle_grey[] = { | ||
16 | { 0x3a, KEY_0 }, | ||
17 | { 0x31, KEY_1 }, | ||
18 | { 0x32, KEY_2 }, | ||
19 | { 0x33, KEY_3 }, | ||
20 | { 0x34, KEY_4 }, | ||
21 | { 0x35, KEY_5 }, | ||
22 | { 0x36, KEY_6 }, | ||
23 | { 0x37, KEY_7 }, | ||
24 | { 0x38, KEY_8 }, | ||
25 | { 0x39, KEY_9 }, | ||
26 | |||
27 | { 0x2f, KEY_POWER }, | ||
28 | |||
29 | { 0x2e, KEY_P }, | ||
30 | { 0x1f, KEY_L }, | ||
31 | { 0x2b, KEY_I }, | ||
32 | |||
33 | { 0x2d, KEY_SCREEN }, | ||
34 | { 0x1e, KEY_ZOOM }, | ||
35 | { 0x1b, KEY_VOLUMEUP }, | ||
36 | { 0x0f, KEY_VOLUMEDOWN }, | ||
37 | { 0x17, KEY_CHANNELUP }, | ||
38 | { 0x1c, KEY_CHANNELDOWN }, | ||
39 | { 0x25, KEY_INFO }, | ||
40 | |||
41 | { 0x3c, KEY_MUTE }, | ||
42 | |||
43 | { 0x3d, KEY_LEFT }, | ||
44 | { 0x3b, KEY_RIGHT }, | ||
45 | |||
46 | { 0x3f, KEY_UP }, | ||
47 | { 0x3e, KEY_DOWN }, | ||
48 | { 0x1a, KEY_ENTER }, | ||
49 | |||
50 | { 0x1d, KEY_MENU }, | ||
51 | { 0x19, KEY_AGAIN }, | ||
52 | { 0x16, KEY_PREVIOUSSONG }, | ||
53 | { 0x13, KEY_NEXTSONG }, | ||
54 | { 0x15, KEY_PAUSE }, | ||
55 | { 0x0e, KEY_REWIND }, | ||
56 | { 0x0d, KEY_PLAY }, | ||
57 | { 0x0b, KEY_STOP }, | ||
58 | { 0x07, KEY_FORWARD }, | ||
59 | { 0x27, KEY_RECORD }, | ||
60 | { 0x26, KEY_TUNER }, | ||
61 | { 0x29, KEY_TEXT }, | ||
62 | { 0x2a, KEY_MEDIA }, | ||
63 | { 0x18, KEY_EPG }, | ||
64 | }; | ||
65 | |||
66 | static struct rc_keymap pinnacle_grey_map = { | ||
67 | .map = { | ||
68 | .scan = pinnacle_grey, | ||
69 | .size = ARRAY_SIZE(pinnacle_grey), | ||
70 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
71 | .name = RC_MAP_PINNACLE_GREY, | ||
72 | } | ||
73 | }; | ||
74 | |||
75 | static int __init init_rc_map_pinnacle_grey(void) | ||
76 | { | ||
77 | return ir_register_map(&pinnacle_grey_map); | ||
78 | } | ||
79 | |||
80 | static void __exit exit_rc_map_pinnacle_grey(void) | ||
81 | { | ||
82 | ir_unregister_map(&pinnacle_grey_map); | ||
83 | } | ||
84 | |||
85 | module_init(init_rc_map_pinnacle_grey) | ||
86 | module_exit(exit_rc_map_pinnacle_grey) | ||
87 | |||
88 | MODULE_LICENSE("GPL"); | ||
89 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c b/drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c deleted file mode 100644 index 835bf4ef8de7..000000000000 --- a/drivers/media/IR/keymaps/rc-pinnacle-pctv-hd.c +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* pinnacle-pctv-hd.h - Keytable for pinnacle_pctv_hd Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Pinnacle PCTV HD 800i mini remote */ | ||
16 | |||
17 | static struct ir_scancode pinnacle_pctv_hd[] = { | ||
18 | |||
19 | { 0x0f, KEY_1 }, | ||
20 | { 0x15, KEY_2 }, | ||
21 | { 0x10, KEY_3 }, | ||
22 | { 0x18, KEY_4 }, | ||
23 | { 0x1b, KEY_5 }, | ||
24 | { 0x1e, KEY_6 }, | ||
25 | { 0x11, KEY_7 }, | ||
26 | { 0x21, KEY_8 }, | ||
27 | { 0x12, KEY_9 }, | ||
28 | { 0x27, KEY_0 }, | ||
29 | |||
30 | { 0x24, KEY_ZOOM }, | ||
31 | { 0x2a, KEY_SUBTITLE }, | ||
32 | |||
33 | { 0x00, KEY_MUTE }, | ||
34 | { 0x01, KEY_ENTER }, /* Pinnacle Logo */ | ||
35 | { 0x39, KEY_POWER }, | ||
36 | |||
37 | { 0x03, KEY_VOLUMEUP }, | ||
38 | { 0x09, KEY_VOLUMEDOWN }, | ||
39 | { 0x06, KEY_CHANNELUP }, | ||
40 | { 0x0c, KEY_CHANNELDOWN }, | ||
41 | |||
42 | { 0x2d, KEY_REWIND }, | ||
43 | { 0x30, KEY_PLAYPAUSE }, | ||
44 | { 0x33, KEY_FASTFORWARD }, | ||
45 | { 0x3c, KEY_STOP }, | ||
46 | { 0x36, KEY_RECORD }, | ||
47 | { 0x3f, KEY_EPG }, /* Labeled "?" */ | ||
48 | }; | ||
49 | |||
50 | static struct rc_keymap pinnacle_pctv_hd_map = { | ||
51 | .map = { | ||
52 | .scan = pinnacle_pctv_hd, | ||
53 | .size = ARRAY_SIZE(pinnacle_pctv_hd), | ||
54 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
55 | .name = RC_MAP_PINNACLE_PCTV_HD, | ||
56 | } | ||
57 | }; | ||
58 | |||
59 | static int __init init_rc_map_pinnacle_pctv_hd(void) | ||
60 | { | ||
61 | return ir_register_map(&pinnacle_pctv_hd_map); | ||
62 | } | ||
63 | |||
64 | static void __exit exit_rc_map_pinnacle_pctv_hd(void) | ||
65 | { | ||
66 | ir_unregister_map(&pinnacle_pctv_hd_map); | ||
67 | } | ||
68 | |||
69 | module_init(init_rc_map_pinnacle_pctv_hd) | ||
70 | module_exit(exit_rc_map_pinnacle_pctv_hd) | ||
71 | |||
72 | MODULE_LICENSE("GPL"); | ||
73 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pixelview-mk12.c b/drivers/media/IR/keymaps/rc-pixelview-mk12.c deleted file mode 100644 index 5a735d569a8b..000000000000 --- a/drivers/media/IR/keymaps/rc-pixelview-mk12.c +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* rc-pixelview-mk12.h - Keytable for pixelview Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | * Keytable for MK-F12 IR remote provided together with Pixelview | ||
17 | * Ultra Pro Remote Controller. Uses NEC extended format. | ||
18 | */ | ||
19 | static struct ir_scancode pixelview_mk12[] = { | ||
20 | { 0x866b03, KEY_TUNER }, /* Timeshift */ | ||
21 | { 0x866b1e, KEY_POWER2 }, /* power */ | ||
22 | |||
23 | { 0x866b01, KEY_1 }, | ||
24 | { 0x866b0b, KEY_2 }, | ||
25 | { 0x866b1b, KEY_3 }, | ||
26 | { 0x866b05, KEY_4 }, | ||
27 | { 0x866b09, KEY_5 }, | ||
28 | { 0x866b15, KEY_6 }, | ||
29 | { 0x866b06, KEY_7 }, | ||
30 | { 0x866b0a, KEY_8 }, | ||
31 | { 0x866b12, KEY_9 }, | ||
32 | { 0x866b02, KEY_0 }, | ||
33 | |||
34 | { 0x866b13, KEY_AGAIN }, /* loop */ | ||
35 | { 0x866b10, KEY_DIGITS }, /* +100 */ | ||
36 | |||
37 | { 0x866b00, KEY_MEDIA }, /* source */ | ||
38 | { 0x866b18, KEY_MUTE }, /* mute */ | ||
39 | { 0x866b19, KEY_CAMERA }, /* snapshot */ | ||
40 | { 0x866b1a, KEY_SEARCH }, /* scan */ | ||
41 | |||
42 | { 0x866b16, KEY_CHANNELUP }, /* chn + */ | ||
43 | { 0x866b14, KEY_CHANNELDOWN }, /* chn - */ | ||
44 | { 0x866b1f, KEY_VOLUMEUP }, /* vol + */ | ||
45 | { 0x866b17, KEY_VOLUMEDOWN }, /* vol - */ | ||
46 | { 0x866b1c, KEY_ZOOM }, /* zoom */ | ||
47 | |||
48 | { 0x866b04, KEY_REWIND }, | ||
49 | { 0x866b0e, KEY_RECORD }, | ||
50 | { 0x866b0c, KEY_FORWARD }, | ||
51 | |||
52 | { 0x866b1d, KEY_STOP }, | ||
53 | { 0x866b08, KEY_PLAY }, | ||
54 | { 0x866b0f, KEY_PAUSE }, | ||
55 | |||
56 | { 0x866b0d, KEY_TV }, | ||
57 | { 0x866b07, KEY_RADIO }, /* FM */ | ||
58 | }; | ||
59 | |||
60 | static struct rc_keymap pixelview_map = { | ||
61 | .map = { | ||
62 | .scan = pixelview_mk12, | ||
63 | .size = ARRAY_SIZE(pixelview_mk12), | ||
64 | .ir_type = IR_TYPE_NEC, | ||
65 | .name = RC_MAP_PIXELVIEW_MK12, | ||
66 | } | ||
67 | }; | ||
68 | |||
69 | static int __init init_rc_map_pixelview(void) | ||
70 | { | ||
71 | return ir_register_map(&pixelview_map); | ||
72 | } | ||
73 | |||
74 | static void __exit exit_rc_map_pixelview(void) | ||
75 | { | ||
76 | ir_unregister_map(&pixelview_map); | ||
77 | } | ||
78 | |||
79 | module_init(init_rc_map_pixelview) | ||
80 | module_exit(exit_rc_map_pixelview) | ||
81 | |||
82 | MODULE_LICENSE("GPL"); | ||
83 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pixelview-new.c b/drivers/media/IR/keymaps/rc-pixelview-new.c deleted file mode 100644 index 7bbbbf5735e6..000000000000 --- a/drivers/media/IR/keymaps/rc-pixelview-new.c +++ /dev/null | |||
@@ -1,83 +0,0 @@ | |||
1 | /* pixelview-new.h - Keytable for pixelview_new Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | Mauro Carvalho Chehab <mchehab@infradead.org> | ||
17 | present on PV MPEG 8000GT | ||
18 | */ | ||
19 | |||
20 | static struct ir_scancode pixelview_new[] = { | ||
21 | { 0x3c, KEY_TIME }, /* Timeshift */ | ||
22 | { 0x12, KEY_POWER }, | ||
23 | |||
24 | { 0x3d, KEY_1 }, | ||
25 | { 0x38, KEY_2 }, | ||
26 | { 0x18, KEY_3 }, | ||
27 | { 0x35, KEY_4 }, | ||
28 | { 0x39, KEY_5 }, | ||
29 | { 0x15, KEY_6 }, | ||
30 | { 0x36, KEY_7 }, | ||
31 | { 0x3a, KEY_8 }, | ||
32 | { 0x1e, KEY_9 }, | ||
33 | { 0x3e, KEY_0 }, | ||
34 | |||
35 | { 0x1c, KEY_AGAIN }, /* LOOP */ | ||
36 | { 0x3f, KEY_MEDIA }, /* Source */ | ||
37 | { 0x1f, KEY_LAST }, /* +100 */ | ||
38 | { 0x1b, KEY_MUTE }, | ||
39 | |||
40 | { 0x17, KEY_CHANNELDOWN }, | ||
41 | { 0x16, KEY_CHANNELUP }, | ||
42 | { 0x10, KEY_VOLUMEUP }, | ||
43 | { 0x14, KEY_VOLUMEDOWN }, | ||
44 | { 0x13, KEY_ZOOM }, | ||
45 | |||
46 | { 0x19, KEY_CAMERA }, /* SNAPSHOT */ | ||
47 | { 0x1a, KEY_SEARCH }, /* scan */ | ||
48 | |||
49 | { 0x37, KEY_REWIND }, /* << */ | ||
50 | { 0x32, KEY_RECORD }, /* o (red) */ | ||
51 | { 0x33, KEY_FORWARD }, /* >> */ | ||
52 | { 0x11, KEY_STOP }, /* square */ | ||
53 | { 0x3b, KEY_PLAY }, /* > */ | ||
54 | { 0x30, KEY_PLAYPAUSE }, /* || */ | ||
55 | |||
56 | { 0x31, KEY_TV }, | ||
57 | { 0x34, KEY_RADIO }, | ||
58 | }; | ||
59 | |||
60 | static struct rc_keymap pixelview_new_map = { | ||
61 | .map = { | ||
62 | .scan = pixelview_new, | ||
63 | .size = ARRAY_SIZE(pixelview_new), | ||
64 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
65 | .name = RC_MAP_PIXELVIEW_NEW, | ||
66 | } | ||
67 | }; | ||
68 | |||
69 | static int __init init_rc_map_pixelview_new(void) | ||
70 | { | ||
71 | return ir_register_map(&pixelview_new_map); | ||
72 | } | ||
73 | |||
74 | static void __exit exit_rc_map_pixelview_new(void) | ||
75 | { | ||
76 | ir_unregister_map(&pixelview_new_map); | ||
77 | } | ||
78 | |||
79 | module_init(init_rc_map_pixelview_new) | ||
80 | module_exit(exit_rc_map_pixelview_new) | ||
81 | |||
82 | MODULE_LICENSE("GPL"); | ||
83 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pixelview.c b/drivers/media/IR/keymaps/rc-pixelview.c deleted file mode 100644 index 82ff12e182a0..000000000000 --- a/drivers/media/IR/keymaps/rc-pixelview.c +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* pixelview.h - Keytable for pixelview Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode pixelview[] = { | ||
16 | |||
17 | { 0x1e, KEY_POWER }, /* power */ | ||
18 | { 0x07, KEY_MEDIA }, /* source */ | ||
19 | { 0x1c, KEY_SEARCH }, /* scan */ | ||
20 | |||
21 | |||
22 | { 0x03, KEY_TUNER }, /* TV/FM */ | ||
23 | |||
24 | { 0x00, KEY_RECORD }, | ||
25 | { 0x08, KEY_STOP }, | ||
26 | { 0x11, KEY_PLAY }, | ||
27 | |||
28 | { 0x1a, KEY_PLAYPAUSE }, /* freeze */ | ||
29 | { 0x19, KEY_ZOOM }, /* zoom */ | ||
30 | { 0x0f, KEY_TEXT }, /* min */ | ||
31 | |||
32 | { 0x01, KEY_1 }, | ||
33 | { 0x0b, KEY_2 }, | ||
34 | { 0x1b, KEY_3 }, | ||
35 | { 0x05, KEY_4 }, | ||
36 | { 0x09, KEY_5 }, | ||
37 | { 0x15, KEY_6 }, | ||
38 | { 0x06, KEY_7 }, | ||
39 | { 0x0a, KEY_8 }, | ||
40 | { 0x12, KEY_9 }, | ||
41 | { 0x02, KEY_0 }, | ||
42 | { 0x10, KEY_LAST }, /* +100 */ | ||
43 | { 0x13, KEY_LIST }, /* recall */ | ||
44 | |||
45 | { 0x1f, KEY_CHANNELUP }, /* chn down */ | ||
46 | { 0x17, KEY_CHANNELDOWN }, /* chn up */ | ||
47 | { 0x16, KEY_VOLUMEUP }, /* vol down */ | ||
48 | { 0x14, KEY_VOLUMEDOWN }, /* vol up */ | ||
49 | |||
50 | { 0x04, KEY_KPMINUS }, /* <<< */ | ||
51 | { 0x0e, KEY_SETUP }, /* function */ | ||
52 | { 0x0c, KEY_KPPLUS }, /* >>> */ | ||
53 | |||
54 | { 0x0d, KEY_GOTO }, /* mts */ | ||
55 | { 0x1d, KEY_REFRESH }, /* reset */ | ||
56 | { 0x18, KEY_MUTE }, /* mute/unmute */ | ||
57 | }; | ||
58 | |||
59 | static struct rc_keymap pixelview_map = { | ||
60 | .map = { | ||
61 | .scan = pixelview, | ||
62 | .size = ARRAY_SIZE(pixelview), | ||
63 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
64 | .name = RC_MAP_PIXELVIEW, | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | static int __init init_rc_map_pixelview(void) | ||
69 | { | ||
70 | return ir_register_map(&pixelview_map); | ||
71 | } | ||
72 | |||
73 | static void __exit exit_rc_map_pixelview(void) | ||
74 | { | ||
75 | ir_unregister_map(&pixelview_map); | ||
76 | } | ||
77 | |||
78 | module_init(init_rc_map_pixelview) | ||
79 | module_exit(exit_rc_map_pixelview) | ||
80 | |||
81 | MODULE_LICENSE("GPL"); | ||
82 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-powercolor-real-angel.c b/drivers/media/IR/keymaps/rc-powercolor-real-angel.c deleted file mode 100644 index 7cef8190a224..000000000000 --- a/drivers/media/IR/keymaps/rc-powercolor-real-angel.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* powercolor-real-angel.h - Keytable for powercolor_real_angel Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | * Remote control for Powercolor Real Angel 330 | ||
17 | * Daniel Fraga <fragabr@gmail.com> | ||
18 | */ | ||
19 | |||
20 | static struct ir_scancode powercolor_real_angel[] = { | ||
21 | { 0x38, KEY_SWITCHVIDEOMODE }, /* switch inputs */ | ||
22 | { 0x0c, KEY_MEDIA }, /* Turn ON/OFF App */ | ||
23 | { 0x00, KEY_0 }, | ||
24 | { 0x01, KEY_1 }, | ||
25 | { 0x02, KEY_2 }, | ||
26 | { 0x03, KEY_3 }, | ||
27 | { 0x04, KEY_4 }, | ||
28 | { 0x05, KEY_5 }, | ||
29 | { 0x06, KEY_6 }, | ||
30 | { 0x07, KEY_7 }, | ||
31 | { 0x08, KEY_8 }, | ||
32 | { 0x09, KEY_9 }, | ||
33 | { 0x0a, KEY_DIGITS }, /* single, double, tripple digit */ | ||
34 | { 0x29, KEY_PREVIOUS }, /* previous channel */ | ||
35 | { 0x12, KEY_BRIGHTNESSUP }, | ||
36 | { 0x13, KEY_BRIGHTNESSDOWN }, | ||
37 | { 0x2b, KEY_MODE }, /* stereo/mono */ | ||
38 | { 0x2c, KEY_TEXT }, /* teletext */ | ||
39 | { 0x20, KEY_CHANNELUP }, /* channel up */ | ||
40 | { 0x21, KEY_CHANNELDOWN }, /* channel down */ | ||
41 | { 0x10, KEY_VOLUMEUP }, /* volume up */ | ||
42 | { 0x11, KEY_VOLUMEDOWN }, /* volume down */ | ||
43 | { 0x0d, KEY_MUTE }, | ||
44 | { 0x1f, KEY_RECORD }, | ||
45 | { 0x17, KEY_PLAY }, | ||
46 | { 0x16, KEY_PAUSE }, | ||
47 | { 0x0b, KEY_STOP }, | ||
48 | { 0x27, KEY_FASTFORWARD }, | ||
49 | { 0x26, KEY_REWIND }, | ||
50 | { 0x1e, KEY_SEARCH }, /* autoscan */ | ||
51 | { 0x0e, KEY_CAMERA }, /* snapshot */ | ||
52 | { 0x2d, KEY_SETUP }, | ||
53 | { 0x0f, KEY_SCREEN }, /* full screen */ | ||
54 | { 0x14, KEY_RADIO }, /* FM radio */ | ||
55 | { 0x25, KEY_POWER }, /* power */ | ||
56 | }; | ||
57 | |||
58 | static struct rc_keymap powercolor_real_angel_map = { | ||
59 | .map = { | ||
60 | .scan = powercolor_real_angel, | ||
61 | .size = ARRAY_SIZE(powercolor_real_angel), | ||
62 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
63 | .name = RC_MAP_POWERCOLOR_REAL_ANGEL, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static int __init init_rc_map_powercolor_real_angel(void) | ||
68 | { | ||
69 | return ir_register_map(&powercolor_real_angel_map); | ||
70 | } | ||
71 | |||
72 | static void __exit exit_rc_map_powercolor_real_angel(void) | ||
73 | { | ||
74 | ir_unregister_map(&powercolor_real_angel_map); | ||
75 | } | ||
76 | |||
77 | module_init(init_rc_map_powercolor_real_angel) | ||
78 | module_exit(exit_rc_map_powercolor_real_angel) | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-proteus-2309.c b/drivers/media/IR/keymaps/rc-proteus-2309.c deleted file mode 100644 index 22e92d39dee5..000000000000 --- a/drivers/media/IR/keymaps/rc-proteus-2309.c +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
1 | /* proteus-2309.h - Keytable for proteus_2309 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Michal Majchrowicz <mmajchrowicz@gmail.com> */ | ||
16 | |||
17 | static struct ir_scancode proteus_2309[] = { | ||
18 | /* numeric */ | ||
19 | { 0x00, KEY_0 }, | ||
20 | { 0x01, KEY_1 }, | ||
21 | { 0x02, KEY_2 }, | ||
22 | { 0x03, KEY_3 }, | ||
23 | { 0x04, KEY_4 }, | ||
24 | { 0x05, KEY_5 }, | ||
25 | { 0x06, KEY_6 }, | ||
26 | { 0x07, KEY_7 }, | ||
27 | { 0x08, KEY_8 }, | ||
28 | { 0x09, KEY_9 }, | ||
29 | |||
30 | { 0x5c, KEY_POWER }, /* power */ | ||
31 | { 0x20, KEY_ZOOM }, /* full screen */ | ||
32 | { 0x0f, KEY_BACKSPACE }, /* recall */ | ||
33 | { 0x1b, KEY_ENTER }, /* mute */ | ||
34 | { 0x41, KEY_RECORD }, /* record */ | ||
35 | { 0x43, KEY_STOP }, /* stop */ | ||
36 | { 0x16, KEY_S }, | ||
37 | { 0x1a, KEY_POWER2 }, /* off */ | ||
38 | { 0x2e, KEY_RED }, | ||
39 | { 0x1f, KEY_CHANNELDOWN }, /* channel - */ | ||
40 | { 0x1c, KEY_CHANNELUP }, /* channel + */ | ||
41 | { 0x10, KEY_VOLUMEDOWN }, /* volume - */ | ||
42 | { 0x1e, KEY_VOLUMEUP }, /* volume + */ | ||
43 | { 0x14, KEY_F1 }, | ||
44 | }; | ||
45 | |||
46 | static struct rc_keymap proteus_2309_map = { | ||
47 | .map = { | ||
48 | .scan = proteus_2309, | ||
49 | .size = ARRAY_SIZE(proteus_2309), | ||
50 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
51 | .name = RC_MAP_PROTEUS_2309, | ||
52 | } | ||
53 | }; | ||
54 | |||
55 | static int __init init_rc_map_proteus_2309(void) | ||
56 | { | ||
57 | return ir_register_map(&proteus_2309_map); | ||
58 | } | ||
59 | |||
60 | static void __exit exit_rc_map_proteus_2309(void) | ||
61 | { | ||
62 | ir_unregister_map(&proteus_2309_map); | ||
63 | } | ||
64 | |||
65 | module_init(init_rc_map_proteus_2309) | ||
66 | module_exit(exit_rc_map_proteus_2309) | ||
67 | |||
68 | MODULE_LICENSE("GPL"); | ||
69 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-purpletv.c b/drivers/media/IR/keymaps/rc-purpletv.c deleted file mode 100644 index 4e20fc2269f7..000000000000 --- a/drivers/media/IR/keymaps/rc-purpletv.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* purpletv.h - Keytable for purpletv Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode purpletv[] = { | ||
16 | { 0x03, KEY_POWER }, | ||
17 | { 0x6f, KEY_MUTE }, | ||
18 | { 0x10, KEY_BACKSPACE }, /* Recall */ | ||
19 | |||
20 | { 0x11, KEY_0 }, | ||
21 | { 0x04, KEY_1 }, | ||
22 | { 0x05, KEY_2 }, | ||
23 | { 0x06, KEY_3 }, | ||
24 | { 0x08, KEY_4 }, | ||
25 | { 0x09, KEY_5 }, | ||
26 | { 0x0a, KEY_6 }, | ||
27 | { 0x0c, KEY_7 }, | ||
28 | { 0x0d, KEY_8 }, | ||
29 | { 0x0e, KEY_9 }, | ||
30 | { 0x12, KEY_DOT }, /* 100+ */ | ||
31 | |||
32 | { 0x07, KEY_VOLUMEUP }, | ||
33 | { 0x0b, KEY_VOLUMEDOWN }, | ||
34 | { 0x1a, KEY_KPPLUS }, | ||
35 | { 0x18, KEY_KPMINUS }, | ||
36 | { 0x15, KEY_UP }, | ||
37 | { 0x1d, KEY_DOWN }, | ||
38 | { 0x0f, KEY_CHANNELUP }, | ||
39 | { 0x13, KEY_CHANNELDOWN }, | ||
40 | { 0x48, KEY_ZOOM }, | ||
41 | |||
42 | { 0x1b, KEY_VIDEO }, /* Video source */ | ||
43 | { 0x1f, KEY_CAMERA }, /* Snapshot */ | ||
44 | { 0x49, KEY_LANGUAGE }, /* MTS Select */ | ||
45 | { 0x19, KEY_SEARCH }, /* Auto Scan */ | ||
46 | |||
47 | { 0x4b, KEY_RECORD }, | ||
48 | { 0x46, KEY_PLAY }, | ||
49 | { 0x45, KEY_PAUSE }, /* Pause */ | ||
50 | { 0x44, KEY_STOP }, | ||
51 | { 0x43, KEY_TIME }, /* Time Shift */ | ||
52 | { 0x17, KEY_CHANNEL }, /* SURF CH */ | ||
53 | { 0x40, KEY_FORWARD }, /* Forward ? */ | ||
54 | { 0x42, KEY_REWIND }, /* Backward ? */ | ||
55 | |||
56 | }; | ||
57 | |||
58 | static struct rc_keymap purpletv_map = { | ||
59 | .map = { | ||
60 | .scan = purpletv, | ||
61 | .size = ARRAY_SIZE(purpletv), | ||
62 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
63 | .name = RC_MAP_PURPLETV, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static int __init init_rc_map_purpletv(void) | ||
68 | { | ||
69 | return ir_register_map(&purpletv_map); | ||
70 | } | ||
71 | |||
72 | static void __exit exit_rc_map_purpletv(void) | ||
73 | { | ||
74 | ir_unregister_map(&purpletv_map); | ||
75 | } | ||
76 | |||
77 | module_init(init_rc_map_purpletv) | ||
78 | module_exit(exit_rc_map_purpletv) | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-pv951.c b/drivers/media/IR/keymaps/rc-pv951.c deleted file mode 100644 index 36679e706cf3..000000000000 --- a/drivers/media/IR/keymaps/rc-pv951.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* pv951.h - Keytable for pv951 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Mark Phalan <phalanm@o2.ie> */ | ||
16 | |||
17 | static struct ir_scancode pv951[] = { | ||
18 | { 0x00, KEY_0 }, | ||
19 | { 0x01, KEY_1 }, | ||
20 | { 0x02, KEY_2 }, | ||
21 | { 0x03, KEY_3 }, | ||
22 | { 0x04, KEY_4 }, | ||
23 | { 0x05, KEY_5 }, | ||
24 | { 0x06, KEY_6 }, | ||
25 | { 0x07, KEY_7 }, | ||
26 | { 0x08, KEY_8 }, | ||
27 | { 0x09, KEY_9 }, | ||
28 | |||
29 | { 0x12, KEY_POWER }, | ||
30 | { 0x10, KEY_MUTE }, | ||
31 | { 0x1f, KEY_VOLUMEDOWN }, | ||
32 | { 0x1b, KEY_VOLUMEUP }, | ||
33 | { 0x1a, KEY_CHANNELUP }, | ||
34 | { 0x1e, KEY_CHANNELDOWN }, | ||
35 | { 0x0e, KEY_PAGEUP }, | ||
36 | { 0x1d, KEY_PAGEDOWN }, | ||
37 | { 0x13, KEY_SOUND }, | ||
38 | |||
39 | { 0x18, KEY_KPPLUSMINUS }, /* CH +/- */ | ||
40 | { 0x16, KEY_SUBTITLE }, /* CC */ | ||
41 | { 0x0d, KEY_TEXT }, /* TTX */ | ||
42 | { 0x0b, KEY_TV }, /* AIR/CBL */ | ||
43 | { 0x11, KEY_PC }, /* PC/TV */ | ||
44 | { 0x17, KEY_OK }, /* CH RTN */ | ||
45 | { 0x19, KEY_MODE }, /* FUNC */ | ||
46 | { 0x0c, KEY_SEARCH }, /* AUTOSCAN */ | ||
47 | |||
48 | /* Not sure what to do with these ones! */ | ||
49 | { 0x0f, KEY_SELECT }, /* SOURCE */ | ||
50 | { 0x0a, KEY_KPPLUS }, /* +100 */ | ||
51 | { 0x14, KEY_EQUAL }, /* SYNC */ | ||
52 | { 0x1c, KEY_MEDIA }, /* PC/TV */ | ||
53 | }; | ||
54 | |||
55 | static struct rc_keymap pv951_map = { | ||
56 | .map = { | ||
57 | .scan = pv951, | ||
58 | .size = ARRAY_SIZE(pv951), | ||
59 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
60 | .name = RC_MAP_PV951, | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | static int __init init_rc_map_pv951(void) | ||
65 | { | ||
66 | return ir_register_map(&pv951_map); | ||
67 | } | ||
68 | |||
69 | static void __exit exit_rc_map_pv951(void) | ||
70 | { | ||
71 | ir_unregister_map(&pv951_map); | ||
72 | } | ||
73 | |||
74 | module_init(init_rc_map_pv951) | ||
75 | module_exit(exit_rc_map_pv951) | ||
76 | |||
77 | MODULE_LICENSE("GPL"); | ||
78 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c b/drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c deleted file mode 100644 index cc6b8f548747..000000000000 --- a/drivers/media/IR/keymaps/rc-rc5-hauppauge-new.c +++ /dev/null | |||
@@ -1,103 +0,0 @@ | |||
1 | /* rc5-hauppauge-new.h - Keytable for rc5_hauppauge_new Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* | ||
16 | * Hauppauge:the newer, gray remotes (seems there are multiple | ||
17 | * slightly different versions), shipped with cx88+ivtv cards. | ||
18 | * | ||
19 | * This table contains the complete RC5 code, instead of just the data part | ||
20 | */ | ||
21 | |||
22 | static struct ir_scancode rc5_hauppauge_new[] = { | ||
23 | /* Keys 0 to 9 */ | ||
24 | { 0x1e00, KEY_0 }, | ||
25 | { 0x1e01, KEY_1 }, | ||
26 | { 0x1e02, KEY_2 }, | ||
27 | { 0x1e03, KEY_3 }, | ||
28 | { 0x1e04, KEY_4 }, | ||
29 | { 0x1e05, KEY_5 }, | ||
30 | { 0x1e06, KEY_6 }, | ||
31 | { 0x1e07, KEY_7 }, | ||
32 | { 0x1e08, KEY_8 }, | ||
33 | { 0x1e09, KEY_9 }, | ||
34 | |||
35 | { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */ | ||
36 | { 0x1e0b, KEY_RED }, /* red button */ | ||
37 | { 0x1e0c, KEY_RADIO }, | ||
38 | { 0x1e0d, KEY_MENU }, | ||
39 | { 0x1e0e, KEY_SUBTITLE }, /* also the # key */ | ||
40 | { 0x1e0f, KEY_MUTE }, | ||
41 | { 0x1e10, KEY_VOLUMEUP }, | ||
42 | { 0x1e11, KEY_VOLUMEDOWN }, | ||
43 | { 0x1e12, KEY_PREVIOUS }, /* previous channel */ | ||
44 | { 0x1e14, KEY_UP }, | ||
45 | { 0x1e15, KEY_DOWN }, | ||
46 | { 0x1e16, KEY_LEFT }, | ||
47 | { 0x1e17, KEY_RIGHT }, | ||
48 | { 0x1e18, KEY_VIDEO }, /* Videos */ | ||
49 | { 0x1e19, KEY_AUDIO }, /* Music */ | ||
50 | /* 0x1e1a: Pictures - presume this means | ||
51 | "Multimedia Home Platform" - | ||
52 | no "PICTURES" key in input.h | ||
53 | */ | ||
54 | { 0x1e1a, KEY_MHP }, | ||
55 | |||
56 | { 0x1e1b, KEY_EPG }, /* Guide */ | ||
57 | { 0x1e1c, KEY_TV }, | ||
58 | { 0x1e1e, KEY_NEXTSONG }, /* skip >| */ | ||
59 | { 0x1e1f, KEY_EXIT }, /* back/exit */ | ||
60 | { 0x1e20, KEY_CHANNELUP }, /* channel / program + */ | ||
61 | { 0x1e21, KEY_CHANNELDOWN }, /* channel / program - */ | ||
62 | { 0x1e22, KEY_CHANNEL }, /* source (old black remote) */ | ||
63 | { 0x1e24, KEY_PREVIOUSSONG }, /* replay |< */ | ||
64 | { 0x1e25, KEY_ENTER }, /* OK */ | ||
65 | { 0x1e26, KEY_SLEEP }, /* minimize (old black remote) */ | ||
66 | { 0x1e29, KEY_BLUE }, /* blue key */ | ||
67 | { 0x1e2e, KEY_GREEN }, /* green button */ | ||
68 | { 0x1e30, KEY_PAUSE }, /* pause */ | ||
69 | { 0x1e32, KEY_REWIND }, /* backward << */ | ||
70 | { 0x1e34, KEY_FASTFORWARD }, /* forward >> */ | ||
71 | { 0x1e35, KEY_PLAY }, | ||
72 | { 0x1e36, KEY_STOP }, | ||
73 | { 0x1e37, KEY_RECORD }, /* recording */ | ||
74 | { 0x1e38, KEY_YELLOW }, /* yellow key */ | ||
75 | { 0x1e3b, KEY_SELECT }, /* top right button */ | ||
76 | { 0x1e3c, KEY_ZOOM }, /* full */ | ||
77 | { 0x1e3d, KEY_POWER }, /* system power (green button) */ | ||
78 | }; | ||
79 | |||
80 | static struct rc_keymap rc5_hauppauge_new_map = { | ||
81 | .map = { | ||
82 | .scan = rc5_hauppauge_new, | ||
83 | .size = ARRAY_SIZE(rc5_hauppauge_new), | ||
84 | .ir_type = IR_TYPE_RC5, | ||
85 | .name = RC_MAP_RC5_HAUPPAUGE_NEW, | ||
86 | } | ||
87 | }; | ||
88 | |||
89 | static int __init init_rc_map_rc5_hauppauge_new(void) | ||
90 | { | ||
91 | return ir_register_map(&rc5_hauppauge_new_map); | ||
92 | } | ||
93 | |||
94 | static void __exit exit_rc_map_rc5_hauppauge_new(void) | ||
95 | { | ||
96 | ir_unregister_map(&rc5_hauppauge_new_map); | ||
97 | } | ||
98 | |||
99 | module_init(init_rc_map_rc5_hauppauge_new) | ||
100 | module_exit(exit_rc_map_rc5_hauppauge_new) | ||
101 | |||
102 | MODULE_LICENSE("GPL"); | ||
103 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-rc5-streamzap.c b/drivers/media/IR/keymaps/rc-rc5-streamzap.c deleted file mode 100644 index 4c19c58b46d8..000000000000 --- a/drivers/media/IR/keymaps/rc-rc5-streamzap.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* rc-rc5-streamzap.c - Keytable for Streamzap PC Remote, for use | ||
2 | * with the Streamzap PC Remote IR Receiver. | ||
3 | * | ||
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | ||
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 | |||
12 | #include <media/rc-map.h> | ||
13 | |||
14 | static struct ir_scancode rc5_streamzap[] = { | ||
15 | /* | ||
16 | * FIXME: The Streamzap remote isn't actually true RC-5, it has an extra | ||
17 | * bit in it, which presently throws the in-kernel RC-5 decoder for a loop. | ||
18 | * We either have to enhance the decoder to support it, add a new decoder, | ||
19 | * or just rely on lirc userspace decoding. | ||
20 | */ | ||
21 | { 0x00, KEY_NUMERIC_0 }, | ||
22 | { 0x01, KEY_NUMERIC_1 }, | ||
23 | { 0x02, KEY_NUMERIC_2 }, | ||
24 | { 0x03, KEY_NUMERIC_3 }, | ||
25 | { 0x04, KEY_NUMERIC_4 }, | ||
26 | { 0x05, KEY_NUMERIC_5 }, | ||
27 | { 0x06, KEY_NUMERIC_6 }, | ||
28 | { 0x07, KEY_NUMERIC_7 }, | ||
29 | { 0x08, KEY_NUMERIC_8 }, | ||
30 | { 0x0a, KEY_POWER }, | ||
31 | { 0x0b, KEY_MUTE }, | ||
32 | { 0x0c, KEY_CHANNELUP }, | ||
33 | { 0x0d, KEY_VOLUMEUP }, | ||
34 | { 0x0e, KEY_CHANNELDOWN }, | ||
35 | { 0x0f, KEY_VOLUMEDOWN }, | ||
36 | { 0x10, KEY_UP }, | ||
37 | { 0x11, KEY_LEFT }, | ||
38 | { 0x12, KEY_OK }, | ||
39 | { 0x13, KEY_RIGHT }, | ||
40 | { 0x14, KEY_DOWN }, | ||
41 | { 0x15, KEY_MENU }, | ||
42 | { 0x16, KEY_EXIT }, | ||
43 | { 0x17, KEY_PLAY }, | ||
44 | { 0x18, KEY_PAUSE }, | ||
45 | { 0x19, KEY_STOP }, | ||
46 | { 0x1a, KEY_BACK }, | ||
47 | { 0x1b, KEY_FORWARD }, | ||
48 | { 0x1c, KEY_RECORD }, | ||
49 | { 0x1d, KEY_REWIND }, | ||
50 | { 0x1e, KEY_FASTFORWARD }, | ||
51 | { 0x20, KEY_RED }, | ||
52 | { 0x21, KEY_GREEN }, | ||
53 | { 0x22, KEY_YELLOW }, | ||
54 | { 0x23, KEY_BLUE }, | ||
55 | |||
56 | }; | ||
57 | |||
58 | static struct rc_keymap rc5_streamzap_map = { | ||
59 | .map = { | ||
60 | .scan = rc5_streamzap, | ||
61 | .size = ARRAY_SIZE(rc5_streamzap), | ||
62 | .ir_type = IR_TYPE_RC5, | ||
63 | .name = RC_MAP_RC5_STREAMZAP, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static int __init init_rc_map_rc5_streamzap(void) | ||
68 | { | ||
69 | return ir_register_map(&rc5_streamzap_map); | ||
70 | } | ||
71 | |||
72 | static void __exit exit_rc_map_rc5_streamzap(void) | ||
73 | { | ||
74 | ir_unregister_map(&rc5_streamzap_map); | ||
75 | } | ||
76 | |||
77 | module_init(init_rc_map_rc5_streamzap) | ||
78 | module_exit(exit_rc_map_rc5_streamzap) | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-rc5-tv.c b/drivers/media/IR/keymaps/rc-rc5-tv.c deleted file mode 100644 index 73cce2f8ddfb..000000000000 --- a/drivers/media/IR/keymaps/rc-rc5-tv.c +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | /* rc5-tv.h - Keytable for rc5_tv Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* generic RC5 keytable */ | ||
16 | /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */ | ||
17 | /* used by old (black) Hauppauge remotes */ | ||
18 | |||
19 | static struct ir_scancode rc5_tv[] = { | ||
20 | /* Keys 0 to 9 */ | ||
21 | { 0x00, KEY_0 }, | ||
22 | { 0x01, KEY_1 }, | ||
23 | { 0x02, KEY_2 }, | ||
24 | { 0x03, KEY_3 }, | ||
25 | { 0x04, KEY_4 }, | ||
26 | { 0x05, KEY_5 }, | ||
27 | { 0x06, KEY_6 }, | ||
28 | { 0x07, KEY_7 }, | ||
29 | { 0x08, KEY_8 }, | ||
30 | { 0x09, KEY_9 }, | ||
31 | |||
32 | { 0x0b, KEY_CHANNEL }, /* channel / program (japan: 11) */ | ||
33 | { 0x0c, KEY_POWER }, /* standby */ | ||
34 | { 0x0d, KEY_MUTE }, /* mute / demute */ | ||
35 | { 0x0f, KEY_TV }, /* display */ | ||
36 | { 0x10, KEY_VOLUMEUP }, | ||
37 | { 0x11, KEY_VOLUMEDOWN }, | ||
38 | { 0x12, KEY_BRIGHTNESSUP }, | ||
39 | { 0x13, KEY_BRIGHTNESSDOWN }, | ||
40 | { 0x1e, KEY_SEARCH }, /* search + */ | ||
41 | { 0x20, KEY_CHANNELUP }, /* channel / program + */ | ||
42 | { 0x21, KEY_CHANNELDOWN }, /* channel / program - */ | ||
43 | { 0x22, KEY_CHANNEL }, /* alt / channel */ | ||
44 | { 0x23, KEY_LANGUAGE }, /* 1st / 2nd language */ | ||
45 | { 0x26, KEY_SLEEP }, /* sleeptimer */ | ||
46 | { 0x2e, KEY_MENU }, /* 2nd controls (USA: menu) */ | ||
47 | { 0x30, KEY_PAUSE }, | ||
48 | { 0x32, KEY_REWIND }, | ||
49 | { 0x33, KEY_GOTO }, | ||
50 | { 0x35, KEY_PLAY }, | ||
51 | { 0x36, KEY_STOP }, | ||
52 | { 0x37, KEY_RECORD }, /* recording */ | ||
53 | { 0x3c, KEY_TEXT }, /* teletext submode (Japan: 12) */ | ||
54 | { 0x3d, KEY_SUSPEND }, /* system standby */ | ||
55 | |||
56 | }; | ||
57 | |||
58 | static struct rc_keymap rc5_tv_map = { | ||
59 | .map = { | ||
60 | .scan = rc5_tv, | ||
61 | .size = ARRAY_SIZE(rc5_tv), | ||
62 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
63 | .name = RC_MAP_RC5_TV, | ||
64 | } | ||
65 | }; | ||
66 | |||
67 | static int __init init_rc_map_rc5_tv(void) | ||
68 | { | ||
69 | return ir_register_map(&rc5_tv_map); | ||
70 | } | ||
71 | |||
72 | static void __exit exit_rc_map_rc5_tv(void) | ||
73 | { | ||
74 | ir_unregister_map(&rc5_tv_map); | ||
75 | } | ||
76 | |||
77 | module_init(init_rc_map_rc5_tv) | ||
78 | module_exit(exit_rc_map_rc5_tv) | ||
79 | |||
80 | MODULE_LICENSE("GPL"); | ||
81 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-rc6-mce.c b/drivers/media/IR/keymaps/rc-rc6-mce.c deleted file mode 100644 index 39557ad401b6..000000000000 --- a/drivers/media/IR/keymaps/rc-rc6-mce.c +++ /dev/null | |||
@@ -1,110 +0,0 @@ | |||
1 | /* rc-rc6-mce.c - Keytable for Windows Media Center RC-6 remotes for use | ||
2 | * with the Media Center Edition eHome Infrared Transceiver. | ||
3 | * | ||
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | ||
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 | |||
12 | #include <media/rc-map.h> | ||
13 | |||
14 | static struct ir_scancode rc6_mce[] = { | ||
15 | { 0x800f0415, KEY_REWIND }, | ||
16 | { 0x800f0414, KEY_FASTFORWARD }, | ||
17 | { 0x800f041b, KEY_PREVIOUS }, | ||
18 | { 0x800f041a, KEY_NEXT }, | ||
19 | |||
20 | { 0x800f0416, KEY_PLAY }, | ||
21 | { 0x800f0418, KEY_PAUSE }, | ||
22 | { 0x800f046e, KEY_PLAYPAUSE }, | ||
23 | { 0x800f0419, KEY_STOP }, | ||
24 | { 0x800f0417, KEY_RECORD }, | ||
25 | |||
26 | { 0x800f041e, KEY_UP }, | ||
27 | { 0x800f041f, KEY_DOWN }, | ||
28 | { 0x800f0420, KEY_LEFT }, | ||
29 | { 0x800f0421, KEY_RIGHT }, | ||
30 | |||
31 | { 0x800f040b, KEY_ENTER }, | ||
32 | { 0x800f0422, KEY_OK }, | ||
33 | { 0x800f0423, KEY_EXIT }, | ||
34 | { 0x800f040a, KEY_DELETE }, | ||
35 | |||
36 | { 0x800f040e, KEY_MUTE }, | ||
37 | { 0x800f0410, KEY_VOLUMEUP }, | ||
38 | { 0x800f0411, KEY_VOLUMEDOWN }, | ||
39 | { 0x800f0412, KEY_CHANNELUP }, | ||
40 | { 0x800f0413, KEY_CHANNELDOWN }, | ||
41 | { 0x800f043a, KEY_BRIGHTNESSUP }, | ||
42 | { 0x800f0480, KEY_BRIGHTNESSDOWN }, | ||
43 | |||
44 | { 0x800f0401, KEY_NUMERIC_1 }, | ||
45 | { 0x800f0402, KEY_NUMERIC_2 }, | ||
46 | { 0x800f0403, KEY_NUMERIC_3 }, | ||
47 | { 0x800f0404, KEY_NUMERIC_4 }, | ||
48 | { 0x800f0405, KEY_NUMERIC_5 }, | ||
49 | { 0x800f0406, KEY_NUMERIC_6 }, | ||
50 | { 0x800f0407, KEY_NUMERIC_7 }, | ||
51 | { 0x800f0408, KEY_NUMERIC_8 }, | ||
52 | { 0x800f0409, KEY_NUMERIC_9 }, | ||
53 | { 0x800f0400, KEY_NUMERIC_0 }, | ||
54 | |||
55 | { 0x800f041d, KEY_NUMERIC_STAR }, | ||
56 | { 0x800f041c, KEY_NUMERIC_POUND }, | ||
57 | |||
58 | { 0x800f0446, KEY_TV }, | ||
59 | { 0x800f0447, KEY_AUDIO }, /* My Music */ | ||
60 | { 0x800f0448, KEY_PVR }, /* RecordedTV */ | ||
61 | { 0x800f0449, KEY_CAMERA }, | ||
62 | { 0x800f044a, KEY_VIDEO }, | ||
63 | { 0x800f0424, KEY_DVD }, | ||
64 | { 0x800f0425, KEY_TUNER }, /* LiveTV */ | ||
65 | { 0x800f0450, KEY_RADIO }, | ||
66 | |||
67 | { 0x800f044c, KEY_LANGUAGE }, | ||
68 | { 0x800f0427, KEY_ZOOM }, /* Aspect */ | ||
69 | |||
70 | { 0x800f045b, KEY_RED }, | ||
71 | { 0x800f045c, KEY_GREEN }, | ||
72 | { 0x800f045d, KEY_YELLOW }, | ||
73 | { 0x800f045e, KEY_BLUE }, | ||
74 | |||
75 | { 0x800f040f, KEY_INFO }, | ||
76 | { 0x800f0426, KEY_EPG }, /* Guide */ | ||
77 | { 0x800f045a, KEY_SUBTITLE }, /* Caption/Teletext */ | ||
78 | { 0x800f044d, KEY_TITLE }, | ||
79 | |||
80 | { 0x800f044e, KEY_PRINT }, /* Print - HP OEM version of remote */ | ||
81 | |||
82 | { 0x800f040c, KEY_POWER }, | ||
83 | { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ | ||
84 | |||
85 | }; | ||
86 | |||
87 | static struct rc_keymap rc6_mce_map = { | ||
88 | .map = { | ||
89 | .scan = rc6_mce, | ||
90 | .size = ARRAY_SIZE(rc6_mce), | ||
91 | .ir_type = IR_TYPE_RC6, | ||
92 | .name = RC_MAP_RC6_MCE, | ||
93 | } | ||
94 | }; | ||
95 | |||
96 | static int __init init_rc_map_rc6_mce(void) | ||
97 | { | ||
98 | return ir_register_map(&rc6_mce_map); | ||
99 | } | ||
100 | |||
101 | static void __exit exit_rc_map_rc6_mce(void) | ||
102 | { | ||
103 | ir_unregister_map(&rc6_mce_map); | ||
104 | } | ||
105 | |||
106 | module_init(init_rc_map_rc6_mce) | ||
107 | module_exit(exit_rc_map_rc6_mce) | ||
108 | |||
109 | MODULE_LICENSE("GPL"); | ||
110 | MODULE_AUTHOR("Jarod Wilson <jarod@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c b/drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c deleted file mode 100644 index ab1a6d2baf72..000000000000 --- a/drivers/media/IR/keymaps/rc-real-audio-220-32-keys.c +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | /* real-audio-220-32-keys.h - Keytable for real_audio_220_32_keys Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Zogis Real Audio 220 - 32 keys IR */ | ||
16 | |||
17 | static struct ir_scancode real_audio_220_32_keys[] = { | ||
18 | { 0x1c, KEY_RADIO}, | ||
19 | { 0x12, KEY_POWER2}, | ||
20 | |||
21 | { 0x01, KEY_1}, | ||
22 | { 0x02, KEY_2}, | ||
23 | { 0x03, KEY_3}, | ||
24 | { 0x04, KEY_4}, | ||
25 | { 0x05, KEY_5}, | ||
26 | { 0x06, KEY_6}, | ||
27 | { 0x07, KEY_7}, | ||
28 | { 0x08, KEY_8}, | ||
29 | { 0x09, KEY_9}, | ||
30 | { 0x00, KEY_0}, | ||
31 | |||
32 | { 0x0c, KEY_VOLUMEUP}, | ||
33 | { 0x18, KEY_VOLUMEDOWN}, | ||
34 | { 0x0b, KEY_CHANNELUP}, | ||
35 | { 0x15, KEY_CHANNELDOWN}, | ||
36 | { 0x16, KEY_ENTER}, | ||
37 | |||
38 | { 0x11, KEY_LIST}, /* Source */ | ||
39 | { 0x0d, KEY_AUDIO}, /* stereo */ | ||
40 | |||
41 | { 0x0f, KEY_PREVIOUS}, /* Prev */ | ||
42 | { 0x1b, KEY_TIME}, /* Timeshift */ | ||
43 | { 0x1a, KEY_NEXT}, /* Next */ | ||
44 | |||
45 | { 0x0e, KEY_STOP}, | ||
46 | { 0x1f, KEY_PLAY}, | ||
47 | { 0x1e, KEY_PLAYPAUSE}, /* Pause */ | ||
48 | |||
49 | { 0x1d, KEY_RECORD}, | ||
50 | { 0x13, KEY_MUTE}, | ||
51 | { 0x19, KEY_CAMERA}, /* Snapshot */ | ||
52 | |||
53 | }; | ||
54 | |||
55 | static struct rc_keymap real_audio_220_32_keys_map = { | ||
56 | .map = { | ||
57 | .scan = real_audio_220_32_keys, | ||
58 | .size = ARRAY_SIZE(real_audio_220_32_keys), | ||
59 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
60 | .name = RC_MAP_REAL_AUDIO_220_32_KEYS, | ||
61 | } | ||
62 | }; | ||
63 | |||
64 | static int __init init_rc_map_real_audio_220_32_keys(void) | ||
65 | { | ||
66 | return ir_register_map(&real_audio_220_32_keys_map); | ||
67 | } | ||
68 | |||
69 | static void __exit exit_rc_map_real_audio_220_32_keys(void) | ||
70 | { | ||
71 | ir_unregister_map(&real_audio_220_32_keys_map); | ||
72 | } | ||
73 | |||
74 | module_init(init_rc_map_real_audio_220_32_keys) | ||
75 | module_exit(exit_rc_map_real_audio_220_32_keys) | ||
76 | |||
77 | MODULE_LICENSE("GPL"); | ||
78 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-tbs-nec.c b/drivers/media/IR/keymaps/rc-tbs-nec.c deleted file mode 100644 index 3309631e6f80..000000000000 --- a/drivers/media/IR/keymaps/rc-tbs-nec.c +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | /* tbs-nec.h - Keytable for tbs_nec Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode tbs_nec[] = { | ||
16 | { 0x04, KEY_POWER2}, /*power*/ | ||
17 | { 0x14, KEY_MUTE}, /*mute*/ | ||
18 | { 0x07, KEY_1}, | ||
19 | { 0x06, KEY_2}, | ||
20 | { 0x05, KEY_3}, | ||
21 | { 0x0b, KEY_4}, | ||
22 | { 0x0a, KEY_5}, | ||
23 | { 0x09, KEY_6}, | ||
24 | { 0x0f, KEY_7}, | ||
25 | { 0x0e, KEY_8}, | ||
26 | { 0x0d, KEY_9}, | ||
27 | { 0x12, KEY_0}, | ||
28 | { 0x16, KEY_CHANNELUP}, /*ch+*/ | ||
29 | { 0x11, KEY_CHANNELDOWN},/*ch-*/ | ||
30 | { 0x13, KEY_VOLUMEUP}, /*vol+*/ | ||
31 | { 0x0c, KEY_VOLUMEDOWN},/*vol-*/ | ||
32 | { 0x03, KEY_RECORD}, /*rec*/ | ||
33 | { 0x18, KEY_PAUSE}, /*pause*/ | ||
34 | { 0x19, KEY_OK}, /*ok*/ | ||
35 | { 0x1a, KEY_CAMERA}, /* snapshot */ | ||
36 | { 0x01, KEY_UP}, | ||
37 | { 0x10, KEY_LEFT}, | ||
38 | { 0x02, KEY_RIGHT}, | ||
39 | { 0x08, KEY_DOWN}, | ||
40 | { 0x15, KEY_FAVORITES}, | ||
41 | { 0x17, KEY_SUBTITLE}, | ||
42 | { 0x1d, KEY_ZOOM}, | ||
43 | { 0x1f, KEY_EXIT}, | ||
44 | { 0x1e, KEY_MENU}, | ||
45 | { 0x1c, KEY_EPG}, | ||
46 | { 0x00, KEY_PREVIOUS}, | ||
47 | { 0x1b, KEY_MODE}, | ||
48 | }; | ||
49 | |||
50 | static struct rc_keymap tbs_nec_map = { | ||
51 | .map = { | ||
52 | .scan = tbs_nec, | ||
53 | .size = ARRAY_SIZE(tbs_nec), | ||
54 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
55 | .name = RC_MAP_TBS_NEC, | ||
56 | } | ||
57 | }; | ||
58 | |||
59 | static int __init init_rc_map_tbs_nec(void) | ||
60 | { | ||
61 | return ir_register_map(&tbs_nec_map); | ||
62 | } | ||
63 | |||
64 | static void __exit exit_rc_map_tbs_nec(void) | ||
65 | { | ||
66 | ir_unregister_map(&tbs_nec_map); | ||
67 | } | ||
68 | |||
69 | module_init(init_rc_map_tbs_nec) | ||
70 | module_exit(exit_rc_map_tbs_nec) | ||
71 | |||
72 | MODULE_LICENSE("GPL"); | ||
73 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c b/drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c deleted file mode 100644 index 5326a0b444c1..000000000000 --- a/drivers/media/IR/keymaps/rc-terratec-cinergy-xs.c +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | /* terratec-cinergy-xs.h - Keytable for terratec_cinergy_xs Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Terratec Cinergy Hybrid T USB XS | ||
16 | Devin Heitmueller <dheitmueller@linuxtv.org> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode terratec_cinergy_xs[] = { | ||
20 | { 0x41, KEY_HOME}, | ||
21 | { 0x01, KEY_POWER}, | ||
22 | { 0x42, KEY_MENU}, | ||
23 | { 0x02, KEY_1}, | ||
24 | { 0x03, KEY_2}, | ||
25 | { 0x04, KEY_3}, | ||
26 | { 0x43, KEY_SUBTITLE}, | ||
27 | { 0x05, KEY_4}, | ||
28 | { 0x06, KEY_5}, | ||
29 | { 0x07, KEY_6}, | ||
30 | { 0x44, KEY_TEXT}, | ||
31 | { 0x08, KEY_7}, | ||
32 | { 0x09, KEY_8}, | ||
33 | { 0x0a, KEY_9}, | ||
34 | { 0x45, KEY_DELETE}, | ||
35 | { 0x0b, KEY_TUNER}, | ||
36 | { 0x0c, KEY_0}, | ||
37 | { 0x0d, KEY_MODE}, | ||
38 | { 0x46, KEY_TV}, | ||
39 | { 0x47, KEY_DVD}, | ||
40 | { 0x49, KEY_VIDEO}, | ||
41 | { 0x4b, KEY_AUX}, | ||
42 | { 0x10, KEY_UP}, | ||
43 | { 0x11, KEY_LEFT}, | ||
44 | { 0x12, KEY_OK}, | ||
45 | { 0x13, KEY_RIGHT}, | ||
46 | { 0x14, KEY_DOWN}, | ||
47 | { 0x0f, KEY_EPG}, | ||
48 | { 0x16, KEY_INFO}, | ||
49 | { 0x4d, KEY_BACKSPACE}, | ||
50 | { 0x1c, KEY_VOLUMEUP}, | ||
51 | { 0x4c, KEY_PLAY}, | ||
52 | { 0x1b, KEY_CHANNELUP}, | ||
53 | { 0x1e, KEY_VOLUMEDOWN}, | ||
54 | { 0x1d, KEY_MUTE}, | ||
55 | { 0x1f, KEY_CHANNELDOWN}, | ||
56 | { 0x17, KEY_RED}, | ||
57 | { 0x18, KEY_GREEN}, | ||
58 | { 0x19, KEY_YELLOW}, | ||
59 | { 0x1a, KEY_BLUE}, | ||
60 | { 0x58, KEY_RECORD}, | ||
61 | { 0x48, KEY_STOP}, | ||
62 | { 0x40, KEY_PAUSE}, | ||
63 | { 0x54, KEY_LAST}, | ||
64 | { 0x4e, KEY_REWIND}, | ||
65 | { 0x4f, KEY_FASTFORWARD}, | ||
66 | { 0x5c, KEY_NEXT}, | ||
67 | }; | ||
68 | |||
69 | static struct rc_keymap terratec_cinergy_xs_map = { | ||
70 | .map = { | ||
71 | .scan = terratec_cinergy_xs, | ||
72 | .size = ARRAY_SIZE(terratec_cinergy_xs), | ||
73 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
74 | .name = RC_MAP_TERRATEC_CINERGY_XS, | ||
75 | } | ||
76 | }; | ||
77 | |||
78 | static int __init init_rc_map_terratec_cinergy_xs(void) | ||
79 | { | ||
80 | return ir_register_map(&terratec_cinergy_xs_map); | ||
81 | } | ||
82 | |||
83 | static void __exit exit_rc_map_terratec_cinergy_xs(void) | ||
84 | { | ||
85 | ir_unregister_map(&terratec_cinergy_xs_map); | ||
86 | } | ||
87 | |||
88 | module_init(init_rc_map_terratec_cinergy_xs) | ||
89 | module_exit(exit_rc_map_terratec_cinergy_xs) | ||
90 | |||
91 | MODULE_LICENSE("GPL"); | ||
92 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-tevii-nec.c b/drivers/media/IR/keymaps/rc-tevii-nec.c deleted file mode 100644 index e30d411c07bb..000000000000 --- a/drivers/media/IR/keymaps/rc-tevii-nec.c +++ /dev/null | |||
@@ -1,88 +0,0 @@ | |||
1 | /* tevii-nec.h - Keytable for tevii_nec Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode tevii_nec[] = { | ||
16 | { 0x0a, KEY_POWER2}, | ||
17 | { 0x0c, KEY_MUTE}, | ||
18 | { 0x11, KEY_1}, | ||
19 | { 0x12, KEY_2}, | ||
20 | { 0x13, KEY_3}, | ||
21 | { 0x14, KEY_4}, | ||
22 | { 0x15, KEY_5}, | ||
23 | { 0x16, KEY_6}, | ||
24 | { 0x17, KEY_7}, | ||
25 | { 0x18, KEY_8}, | ||
26 | { 0x19, KEY_9}, | ||
27 | { 0x10, KEY_0}, | ||
28 | { 0x1c, KEY_MENU}, | ||
29 | { 0x0f, KEY_VOLUMEDOWN}, | ||
30 | { 0x1a, KEY_LAST}, | ||
31 | { 0x0e, KEY_OPEN}, | ||
32 | { 0x04, KEY_RECORD}, | ||
33 | { 0x09, KEY_VOLUMEUP}, | ||
34 | { 0x08, KEY_CHANNELUP}, | ||
35 | { 0x07, KEY_PVR}, | ||
36 | { 0x0b, KEY_TIME}, | ||
37 | { 0x02, KEY_RIGHT}, | ||
38 | { 0x03, KEY_LEFT}, | ||
39 | { 0x00, KEY_UP}, | ||
40 | { 0x1f, KEY_OK}, | ||
41 | { 0x01, KEY_DOWN}, | ||
42 | { 0x05, KEY_TUNER}, | ||
43 | { 0x06, KEY_CHANNELDOWN}, | ||
44 | { 0x40, KEY_PLAYPAUSE}, | ||
45 | { 0x1e, KEY_REWIND}, | ||
46 | { 0x1b, KEY_FAVORITES}, | ||
47 | { 0x1d, KEY_BACK}, | ||
48 | { 0x4d, KEY_FASTFORWARD}, | ||
49 | { 0x44, KEY_EPG}, | ||
50 | { 0x4c, KEY_INFO}, | ||
51 | { 0x41, KEY_AB}, | ||
52 | { 0x43, KEY_AUDIO}, | ||
53 | { 0x45, KEY_SUBTITLE}, | ||
54 | { 0x4a, KEY_LIST}, | ||
55 | { 0x46, KEY_F1}, | ||
56 | { 0x47, KEY_F2}, | ||
57 | { 0x5e, KEY_F3}, | ||
58 | { 0x5c, KEY_F4}, | ||
59 | { 0x52, KEY_F5}, | ||
60 | { 0x5a, KEY_F6}, | ||
61 | { 0x56, KEY_MODE}, | ||
62 | { 0x58, KEY_SWITCHVIDEOMODE}, | ||
63 | }; | ||
64 | |||
65 | static struct rc_keymap tevii_nec_map = { | ||
66 | .map = { | ||
67 | .scan = tevii_nec, | ||
68 | .size = ARRAY_SIZE(tevii_nec), | ||
69 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
70 | .name = RC_MAP_TEVII_NEC, | ||
71 | } | ||
72 | }; | ||
73 | |||
74 | static int __init init_rc_map_tevii_nec(void) | ||
75 | { | ||
76 | return ir_register_map(&tevii_nec_map); | ||
77 | } | ||
78 | |||
79 | static void __exit exit_rc_map_tevii_nec(void) | ||
80 | { | ||
81 | ir_unregister_map(&tevii_nec_map); | ||
82 | } | ||
83 | |||
84 | module_init(init_rc_map_tevii_nec) | ||
85 | module_exit(exit_rc_map_tevii_nec) | ||
86 | |||
87 | MODULE_LICENSE("GPL"); | ||
88 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-tt-1500.c b/drivers/media/IR/keymaps/rc-tt-1500.c deleted file mode 100644 index bc88de011d5d..000000000000 --- a/drivers/media/IR/keymaps/rc-tt-1500.c +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* tt-1500.h - Keytable for tt_1500 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* for the Technotrend 1500 bundled remotes (grey and black): */ | ||
16 | |||
17 | static struct ir_scancode tt_1500[] = { | ||
18 | { 0x01, KEY_POWER }, | ||
19 | { 0x02, KEY_SHUFFLE }, /* ? double-arrow key */ | ||
20 | { 0x03, KEY_1 }, | ||
21 | { 0x04, KEY_2 }, | ||
22 | { 0x05, KEY_3 }, | ||
23 | { 0x06, KEY_4 }, | ||
24 | { 0x07, KEY_5 }, | ||
25 | { 0x08, KEY_6 }, | ||
26 | { 0x09, KEY_7 }, | ||
27 | { 0x0a, KEY_8 }, | ||
28 | { 0x0b, KEY_9 }, | ||
29 | { 0x0c, KEY_0 }, | ||
30 | { 0x0d, KEY_UP }, | ||
31 | { 0x0e, KEY_LEFT }, | ||
32 | { 0x0f, KEY_OK }, | ||
33 | { 0x10, KEY_RIGHT }, | ||
34 | { 0x11, KEY_DOWN }, | ||
35 | { 0x12, KEY_INFO }, | ||
36 | { 0x13, KEY_EXIT }, | ||
37 | { 0x14, KEY_RED }, | ||
38 | { 0x15, KEY_GREEN }, | ||
39 | { 0x16, KEY_YELLOW }, | ||
40 | { 0x17, KEY_BLUE }, | ||
41 | { 0x18, KEY_MUTE }, | ||
42 | { 0x19, KEY_TEXT }, | ||
43 | { 0x1a, KEY_MODE }, /* ? TV/Radio */ | ||
44 | { 0x21, KEY_OPTION }, | ||
45 | { 0x22, KEY_EPG }, | ||
46 | { 0x23, KEY_CHANNELUP }, | ||
47 | { 0x24, KEY_CHANNELDOWN }, | ||
48 | { 0x25, KEY_VOLUMEUP }, | ||
49 | { 0x26, KEY_VOLUMEDOWN }, | ||
50 | { 0x27, KEY_SETUP }, | ||
51 | { 0x3a, KEY_RECORD }, /* these keys are only in the black remote */ | ||
52 | { 0x3b, KEY_PLAY }, | ||
53 | { 0x3c, KEY_STOP }, | ||
54 | { 0x3d, KEY_REWIND }, | ||
55 | { 0x3e, KEY_PAUSE }, | ||
56 | { 0x3f, KEY_FORWARD }, | ||
57 | }; | ||
58 | |||
59 | static struct rc_keymap tt_1500_map = { | ||
60 | .map = { | ||
61 | .scan = tt_1500, | ||
62 | .size = ARRAY_SIZE(tt_1500), | ||
63 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
64 | .name = RC_MAP_TT_1500, | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | static int __init init_rc_map_tt_1500(void) | ||
69 | { | ||
70 | return ir_register_map(&tt_1500_map); | ||
71 | } | ||
72 | |||
73 | static void __exit exit_rc_map_tt_1500(void) | ||
74 | { | ||
75 | ir_unregister_map(&tt_1500_map); | ||
76 | } | ||
77 | |||
78 | module_init(init_rc_map_tt_1500) | ||
79 | module_exit(exit_rc_map_tt_1500) | ||
80 | |||
81 | MODULE_LICENSE("GPL"); | ||
82 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-videomate-s350.c b/drivers/media/IR/keymaps/rc-videomate-s350.c deleted file mode 100644 index 4df7fcd1d2fc..000000000000 --- a/drivers/media/IR/keymaps/rc-videomate-s350.c +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* videomate-s350.h - Keytable for videomate_s350 Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode videomate_s350[] = { | ||
16 | { 0x00, KEY_TV}, | ||
17 | { 0x01, KEY_DVD}, | ||
18 | { 0x04, KEY_RECORD}, | ||
19 | { 0x05, KEY_VIDEO}, /* TV/Video */ | ||
20 | { 0x07, KEY_STOP}, | ||
21 | { 0x08, KEY_PLAYPAUSE}, | ||
22 | { 0x0a, KEY_REWIND}, | ||
23 | { 0x0f, KEY_FASTFORWARD}, | ||
24 | { 0x10, KEY_CHANNELUP}, | ||
25 | { 0x12, KEY_VOLUMEUP}, | ||
26 | { 0x13, KEY_CHANNELDOWN}, | ||
27 | { 0x14, KEY_MUTE}, | ||
28 | { 0x15, KEY_VOLUMEDOWN}, | ||
29 | { 0x16, KEY_1}, | ||
30 | { 0x17, KEY_2}, | ||
31 | { 0x18, KEY_3}, | ||
32 | { 0x19, KEY_4}, | ||
33 | { 0x1a, KEY_5}, | ||
34 | { 0x1b, KEY_6}, | ||
35 | { 0x1c, KEY_7}, | ||
36 | { 0x1d, KEY_8}, | ||
37 | { 0x1e, KEY_9}, | ||
38 | { 0x1f, KEY_0}, | ||
39 | { 0x21, KEY_SLEEP}, | ||
40 | { 0x24, KEY_ZOOM}, | ||
41 | { 0x25, KEY_LAST}, /* Recall */ | ||
42 | { 0x26, KEY_SUBTITLE}, /* CC */ | ||
43 | { 0x27, KEY_LANGUAGE}, /* MTS */ | ||
44 | { 0x29, KEY_CHANNEL}, /* SURF */ | ||
45 | { 0x2b, KEY_A}, | ||
46 | { 0x2c, KEY_B}, | ||
47 | { 0x2f, KEY_CAMERA}, /* Snapshot */ | ||
48 | { 0x23, KEY_RADIO}, | ||
49 | { 0x02, KEY_PREVIOUSSONG}, | ||
50 | { 0x06, KEY_NEXTSONG}, | ||
51 | { 0x03, KEY_EPG}, | ||
52 | { 0x09, KEY_SETUP}, | ||
53 | { 0x22, KEY_BACKSPACE}, | ||
54 | { 0x0c, KEY_UP}, | ||
55 | { 0x0e, KEY_DOWN}, | ||
56 | { 0x0b, KEY_LEFT}, | ||
57 | { 0x0d, KEY_RIGHT}, | ||
58 | { 0x11, KEY_ENTER}, | ||
59 | { 0x20, KEY_TEXT}, | ||
60 | }; | ||
61 | |||
62 | static struct rc_keymap videomate_s350_map = { | ||
63 | .map = { | ||
64 | .scan = videomate_s350, | ||
65 | .size = ARRAY_SIZE(videomate_s350), | ||
66 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
67 | .name = RC_MAP_VIDEOMATE_S350, | ||
68 | } | ||
69 | }; | ||
70 | |||
71 | static int __init init_rc_map_videomate_s350(void) | ||
72 | { | ||
73 | return ir_register_map(&videomate_s350_map); | ||
74 | } | ||
75 | |||
76 | static void __exit exit_rc_map_videomate_s350(void) | ||
77 | { | ||
78 | ir_unregister_map(&videomate_s350_map); | ||
79 | } | ||
80 | |||
81 | module_init(init_rc_map_videomate_s350) | ||
82 | module_exit(exit_rc_map_videomate_s350) | ||
83 | |||
84 | MODULE_LICENSE("GPL"); | ||
85 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-videomate-tv-pvr.c b/drivers/media/IR/keymaps/rc-videomate-tv-pvr.c deleted file mode 100644 index 776b0a638d87..000000000000 --- a/drivers/media/IR/keymaps/rc-videomate-tv-pvr.c +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | /* videomate-tv-pvr.h - Keytable for videomate_tv_pvr Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | static struct ir_scancode videomate_tv_pvr[] = { | ||
16 | { 0x14, KEY_MUTE }, | ||
17 | { 0x24, KEY_ZOOM }, | ||
18 | |||
19 | { 0x01, KEY_DVD }, | ||
20 | { 0x23, KEY_RADIO }, | ||
21 | { 0x00, KEY_TV }, | ||
22 | |||
23 | { 0x0a, KEY_REWIND }, | ||
24 | { 0x08, KEY_PLAYPAUSE }, | ||
25 | { 0x0f, KEY_FORWARD }, | ||
26 | |||
27 | { 0x02, KEY_PREVIOUS }, | ||
28 | { 0x07, KEY_STOP }, | ||
29 | { 0x06, KEY_NEXT }, | ||
30 | |||
31 | { 0x0c, KEY_UP }, | ||
32 | { 0x0e, KEY_DOWN }, | ||
33 | { 0x0b, KEY_LEFT }, | ||
34 | { 0x0d, KEY_RIGHT }, | ||
35 | { 0x11, KEY_OK }, | ||
36 | |||
37 | { 0x03, KEY_MENU }, | ||
38 | { 0x09, KEY_SETUP }, | ||
39 | { 0x05, KEY_VIDEO }, | ||
40 | { 0x22, KEY_CHANNEL }, | ||
41 | |||
42 | { 0x12, KEY_VOLUMEUP }, | ||
43 | { 0x15, KEY_VOLUMEDOWN }, | ||
44 | { 0x10, KEY_CHANNELUP }, | ||
45 | { 0x13, KEY_CHANNELDOWN }, | ||
46 | |||
47 | { 0x04, KEY_RECORD }, | ||
48 | |||
49 | { 0x16, KEY_1 }, | ||
50 | { 0x17, KEY_2 }, | ||
51 | { 0x18, KEY_3 }, | ||
52 | { 0x19, KEY_4 }, | ||
53 | { 0x1a, KEY_5 }, | ||
54 | { 0x1b, KEY_6 }, | ||
55 | { 0x1c, KEY_7 }, | ||
56 | { 0x1d, KEY_8 }, | ||
57 | { 0x1e, KEY_9 }, | ||
58 | { 0x1f, KEY_0 }, | ||
59 | |||
60 | { 0x20, KEY_LANGUAGE }, | ||
61 | { 0x21, KEY_SLEEP }, | ||
62 | }; | ||
63 | |||
64 | static struct rc_keymap videomate_tv_pvr_map = { | ||
65 | .map = { | ||
66 | .scan = videomate_tv_pvr, | ||
67 | .size = ARRAY_SIZE(videomate_tv_pvr), | ||
68 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
69 | .name = RC_MAP_VIDEOMATE_TV_PVR, | ||
70 | } | ||
71 | }; | ||
72 | |||
73 | static int __init init_rc_map_videomate_tv_pvr(void) | ||
74 | { | ||
75 | return ir_register_map(&videomate_tv_pvr_map); | ||
76 | } | ||
77 | |||
78 | static void __exit exit_rc_map_videomate_tv_pvr(void) | ||
79 | { | ||
80 | ir_unregister_map(&videomate_tv_pvr_map); | ||
81 | } | ||
82 | |||
83 | module_init(init_rc_map_videomate_tv_pvr) | ||
84 | module_exit(exit_rc_map_videomate_tv_pvr) | ||
85 | |||
86 | MODULE_LICENSE("GPL"); | ||
87 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c b/drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c deleted file mode 100644 index 9d2d550aaa90..000000000000 --- a/drivers/media/IR/keymaps/rc-winfast-usbii-deluxe.c +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | /* winfast-usbii-deluxe.h - Keytable for winfast_usbii_deluxe Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Leadtek Winfast TV USB II Deluxe remote | ||
16 | Magnus Alm <magnus.alm@gmail.com> | ||
17 | */ | ||
18 | |||
19 | static struct ir_scancode winfast_usbii_deluxe[] = { | ||
20 | { 0x62, KEY_0}, | ||
21 | { 0x75, KEY_1}, | ||
22 | { 0x76, KEY_2}, | ||
23 | { 0x77, KEY_3}, | ||
24 | { 0x79, KEY_4}, | ||
25 | { 0x7a, KEY_5}, | ||
26 | { 0x7b, KEY_6}, | ||
27 | { 0x7d, KEY_7}, | ||
28 | { 0x7e, KEY_8}, | ||
29 | { 0x7f, KEY_9}, | ||
30 | |||
31 | { 0x38, KEY_CAMERA}, /* SNAPSHOT */ | ||
32 | { 0x37, KEY_RECORD}, /* RECORD */ | ||
33 | { 0x35, KEY_TIME}, /* TIMESHIFT */ | ||
34 | |||
35 | { 0x74, KEY_VOLUMEUP}, /* VOLUMEUP */ | ||
36 | { 0x78, KEY_VOLUMEDOWN}, /* VOLUMEDOWN */ | ||
37 | { 0x64, KEY_MUTE}, /* MUTE */ | ||
38 | |||
39 | { 0x21, KEY_CHANNEL}, /* SURF */ | ||
40 | { 0x7c, KEY_CHANNELUP}, /* CHANNELUP */ | ||
41 | { 0x60, KEY_CHANNELDOWN}, /* CHANNELDOWN */ | ||
42 | { 0x61, KEY_LAST}, /* LAST CHANNEL (RECALL) */ | ||
43 | |||
44 | { 0x72, KEY_VIDEO}, /* INPUT MODES (TV/FM) */ | ||
45 | |||
46 | { 0x70, KEY_POWER2}, /* TV ON/OFF */ | ||
47 | |||
48 | { 0x39, KEY_CYCLEWINDOWS}, /* MINIMIZE (BOSS) */ | ||
49 | { 0x3a, KEY_NEW}, /* PIP */ | ||
50 | { 0x73, KEY_ZOOM}, /* FULLSECREEN */ | ||
51 | |||
52 | { 0x66, KEY_INFO}, /* OSD (DISPLAY) */ | ||
53 | |||
54 | { 0x31, KEY_DOT}, /* '.' */ | ||
55 | { 0x63, KEY_ENTER}, /* ENTER */ | ||
56 | |||
57 | }; | ||
58 | |||
59 | static struct rc_keymap winfast_usbii_deluxe_map = { | ||
60 | .map = { | ||
61 | .scan = winfast_usbii_deluxe, | ||
62 | .size = ARRAY_SIZE(winfast_usbii_deluxe), | ||
63 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
64 | .name = RC_MAP_WINFAST_USBII_DELUXE, | ||
65 | } | ||
66 | }; | ||
67 | |||
68 | static int __init init_rc_map_winfast_usbii_deluxe(void) | ||
69 | { | ||
70 | return ir_register_map(&winfast_usbii_deluxe_map); | ||
71 | } | ||
72 | |||
73 | static void __exit exit_rc_map_winfast_usbii_deluxe(void) | ||
74 | { | ||
75 | ir_unregister_map(&winfast_usbii_deluxe_map); | ||
76 | } | ||
77 | |||
78 | module_init(init_rc_map_winfast_usbii_deluxe) | ||
79 | module_exit(exit_rc_map_winfast_usbii_deluxe) | ||
80 | |||
81 | MODULE_LICENSE("GPL"); | ||
82 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/keymaps/rc-winfast.c b/drivers/media/IR/keymaps/rc-winfast.c deleted file mode 100644 index 0e90a3bd9499..000000000000 --- a/drivers/media/IR/keymaps/rc-winfast.c +++ /dev/null | |||
@@ -1,102 +0,0 @@ | |||
1 | /* winfast.h - Keytable for winfast Remote Controller | ||
2 | * | ||
3 | * keymap imported from ir-keymaps.c | ||
4 | * | ||
5 | * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
6 | * | ||
7 | * This program is free software; you can redistribute it and/or modify | ||
8 | * it under the terms of the GNU General Public License as published by | ||
9 | * the Free Software Foundation; either version 2 of the License, or | ||
10 | * (at your option) any later version. | ||
11 | */ | ||
12 | |||
13 | #include <media/rc-map.h> | ||
14 | |||
15 | /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */ | ||
16 | |||
17 | static struct ir_scancode winfast[] = { | ||
18 | /* Keys 0 to 9 */ | ||
19 | { 0x12, KEY_0 }, | ||
20 | { 0x05, KEY_1 }, | ||
21 | { 0x06, KEY_2 }, | ||
22 | { 0x07, KEY_3 }, | ||
23 | { 0x09, KEY_4 }, | ||
24 | { 0x0a, KEY_5 }, | ||
25 | { 0x0b, KEY_6 }, | ||
26 | { 0x0d, KEY_7 }, | ||
27 | { 0x0e, KEY_8 }, | ||
28 | { 0x0f, KEY_9 }, | ||
29 | |||
30 | { 0x00, KEY_POWER }, | ||
31 | { 0x1b, KEY_AUDIO }, /* Audio Source */ | ||
32 | { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */ | ||
33 | { 0x1e, KEY_VIDEO }, /* Video Source */ | ||
34 | { 0x16, KEY_INFO }, /* Display information */ | ||
35 | { 0x04, KEY_VOLUMEUP }, | ||
36 | { 0x08, KEY_VOLUMEDOWN }, | ||
37 | { 0x0c, KEY_CHANNELUP }, | ||
38 | { 0x10, KEY_CHANNELDOWN }, | ||
39 | { 0x03, KEY_ZOOM }, /* fullscreen */ | ||
40 | { 0x1f, KEY_TEXT }, /* closed caption/teletext */ | ||
41 | { 0x20, KEY_SLEEP }, | ||
42 | { 0x29, KEY_CLEAR }, /* boss key */ | ||
43 | { 0x14, KEY_MUTE }, | ||
44 | { 0x2b, KEY_RED }, | ||
45 | { 0x2c, KEY_GREEN }, | ||
46 | { 0x2d, KEY_YELLOW }, | ||
47 | { 0x2e, KEY_BLUE }, | ||
48 | { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */ | ||
49 | { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */ | ||
50 | { 0x2a, KEY_MEDIA }, /* PIP (Picture in picture */ | ||
51 | { 0x21, KEY_DOT }, | ||
52 | { 0x13, KEY_ENTER }, | ||
53 | { 0x11, KEY_LAST }, /* Recall (last channel */ | ||
54 | { 0x22, KEY_PREVIOUS }, | ||
55 | { 0x23, KEY_PLAYPAUSE }, | ||
56 | { 0x24, KEY_NEXT }, | ||
57 | { 0x25, KEY_TIME }, /* Time Shifting */ | ||
58 | { 0x26, KEY_STOP }, | ||
59 | { 0x27, KEY_RECORD }, | ||
60 | { 0x28, KEY_SAVE }, /* Screenshot */ | ||
61 | { 0x2f, KEY_MENU }, | ||
62 | { 0x30, KEY_CANCEL }, | ||
63 | { 0x31, KEY_CHANNEL }, /* Channel Surf */ | ||
64 | { 0x32, KEY_SUBTITLE }, | ||
65 | { 0x33, KEY_LANGUAGE }, | ||
66 | { 0x34, KEY_REWIND }, | ||
67 | { 0x35, KEY_FASTFORWARD }, | ||
68 | { 0x36, KEY_TV }, | ||
69 | { 0x37, KEY_RADIO }, /* FM */ | ||
70 | { 0x38, KEY_DVD }, | ||
71 | |||
72 | { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */ | ||
73 | { 0x3e, KEY_F21 }, /* MCE +VOL, on Y04G0033 */ | ||
74 | { 0x3a, KEY_F22 }, /* MCE -VOL, on Y04G0033 */ | ||
75 | { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ | ||
76 | { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ | ||
77 | }; | ||
78 | |||
79 | static struct rc_keymap winfast_map = { | ||
80 | .map = { | ||
81 | .scan = winfast, | ||
82 | .size = ARRAY_SIZE(winfast), | ||
83 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
84 | .name = RC_MAP_WINFAST, | ||
85 | } | ||
86 | }; | ||
87 | |||
88 | static int __init init_rc_map_winfast(void) | ||
89 | { | ||
90 | return ir_register_map(&winfast_map); | ||
91 | } | ||
92 | |||
93 | static void __exit exit_rc_map_winfast(void) | ||
94 | { | ||
95 | ir_unregister_map(&winfast_map); | ||
96 | } | ||
97 | |||
98 | module_init(init_rc_map_winfast) | ||
99 | module_exit(exit_rc_map_winfast) | ||
100 | |||
101 | MODULE_LICENSE("GPL"); | ||
102 | MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>"); | ||
diff --git a/drivers/media/IR/lirc_dev.c b/drivers/media/IR/lirc_dev.c deleted file mode 100644 index 899891bec352..000000000000 --- a/drivers/media/IR/lirc_dev.c +++ /dev/null | |||
@@ -1,764 +0,0 @@ | |||
1 | /* | ||
2 | * LIRC base driver | ||
3 | * | ||
4 | * by Artur Lipowski <alipowski@interia.pl> | ||
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, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | * | ||
16 | * You should have received a copy of the GNU General Public License | ||
17 | * along with this program; if not, write to the Free Software | ||
18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
19 | * | ||
20 | */ | ||
21 | |||
22 | #include <linux/module.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/errno.h> | ||
26 | #include <linux/ioctl.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/poll.h> | ||
29 | #include <linux/completion.h> | ||
30 | #include <linux/errno.h> | ||
31 | #include <linux/mutex.h> | ||
32 | #include <linux/wait.h> | ||
33 | #include <linux/unistd.h> | ||
34 | #include <linux/kthread.h> | ||
35 | #include <linux/bitops.h> | ||
36 | #include <linux/device.h> | ||
37 | #include <linux/cdev.h> | ||
38 | |||
39 | #include <media/lirc.h> | ||
40 | #include <media/lirc_dev.h> | ||
41 | |||
42 | static int debug; | ||
43 | |||
44 | #define IRCTL_DEV_NAME "BaseRemoteCtl" | ||
45 | #define NOPLUG -1 | ||
46 | #define LOGHEAD "lirc_dev (%s[%d]): " | ||
47 | |||
48 | static dev_t lirc_base_dev; | ||
49 | |||
50 | struct irctl { | ||
51 | struct lirc_driver d; | ||
52 | int attached; | ||
53 | int open; | ||
54 | |||
55 | struct mutex irctl_lock; | ||
56 | struct lirc_buffer *buf; | ||
57 | unsigned int chunk_size; | ||
58 | |||
59 | struct task_struct *task; | ||
60 | long jiffies_to_wait; | ||
61 | |||
62 | struct cdev cdev; | ||
63 | }; | ||
64 | |||
65 | static DEFINE_MUTEX(lirc_dev_lock); | ||
66 | |||
67 | static struct irctl *irctls[MAX_IRCTL_DEVICES]; | ||
68 | |||
69 | /* Only used for sysfs but defined to void otherwise */ | ||
70 | static struct class *lirc_class; | ||
71 | |||
72 | /* helper function | ||
73 | * initializes the irctl structure | ||
74 | */ | ||
75 | static void init_irctl(struct irctl *ir) | ||
76 | { | ||
77 | dev_dbg(ir->d.dev, LOGHEAD "initializing irctl\n", | ||
78 | ir->d.name, ir->d.minor); | ||
79 | mutex_init(&ir->irctl_lock); | ||
80 | ir->d.minor = NOPLUG; | ||
81 | } | ||
82 | |||
83 | static void cleanup(struct irctl *ir) | ||
84 | { | ||
85 | dev_dbg(ir->d.dev, LOGHEAD "cleaning up\n", ir->d.name, ir->d.minor); | ||
86 | |||
87 | device_destroy(lirc_class, MKDEV(MAJOR(lirc_base_dev), ir->d.minor)); | ||
88 | |||
89 | if (ir->buf != ir->d.rbuf) { | ||
90 | lirc_buffer_free(ir->buf); | ||
91 | kfree(ir->buf); | ||
92 | } | ||
93 | ir->buf = NULL; | ||
94 | } | ||
95 | |||
96 | /* helper function | ||
97 | * reads key codes from driver and puts them into buffer | ||
98 | * returns 0 on success | ||
99 | */ | ||
100 | static int add_to_buf(struct irctl *ir) | ||
101 | { | ||
102 | if (ir->d.add_to_buf) { | ||
103 | int res = -ENODATA; | ||
104 | int got_data = 0; | ||
105 | |||
106 | /* | ||
107 | * service the device as long as it is returning | ||
108 | * data and we have space | ||
109 | */ | ||
110 | get_data: | ||
111 | res = ir->d.add_to_buf(ir->d.data, ir->buf); | ||
112 | if (res == 0) { | ||
113 | got_data++; | ||
114 | goto get_data; | ||
115 | } | ||
116 | |||
117 | if (res == -ENODEV) | ||
118 | kthread_stop(ir->task); | ||
119 | |||
120 | return got_data ? 0 : res; | ||
121 | } | ||
122 | |||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | /* main function of the polling thread | ||
127 | */ | ||
128 | static int lirc_thread(void *irctl) | ||
129 | { | ||
130 | struct irctl *ir = irctl; | ||
131 | |||
132 | dev_dbg(ir->d.dev, LOGHEAD "poll thread started\n", | ||
133 | ir->d.name, ir->d.minor); | ||
134 | |||
135 | do { | ||
136 | if (ir->open) { | ||
137 | if (ir->jiffies_to_wait) { | ||
138 | set_current_state(TASK_INTERRUPTIBLE); | ||
139 | schedule_timeout(ir->jiffies_to_wait); | ||
140 | } | ||
141 | if (kthread_should_stop()) | ||
142 | break; | ||
143 | if (!add_to_buf(ir)) | ||
144 | wake_up_interruptible(&ir->buf->wait_poll); | ||
145 | } else { | ||
146 | set_current_state(TASK_INTERRUPTIBLE); | ||
147 | schedule(); | ||
148 | } | ||
149 | } while (!kthread_should_stop()); | ||
150 | |||
151 | dev_dbg(ir->d.dev, LOGHEAD "poll thread ended\n", | ||
152 | ir->d.name, ir->d.minor); | ||
153 | |||
154 | return 0; | ||
155 | } | ||
156 | |||
157 | |||
158 | static struct file_operations fops = { | ||
159 | .owner = THIS_MODULE, | ||
160 | .read = lirc_dev_fop_read, | ||
161 | .write = lirc_dev_fop_write, | ||
162 | .poll = lirc_dev_fop_poll, | ||
163 | .unlocked_ioctl = lirc_dev_fop_ioctl, | ||
164 | .open = lirc_dev_fop_open, | ||
165 | .release = lirc_dev_fop_close, | ||
166 | }; | ||
167 | |||
168 | static int lirc_cdev_add(struct irctl *ir) | ||
169 | { | ||
170 | int retval; | ||
171 | struct lirc_driver *d = &ir->d; | ||
172 | |||
173 | if (d->fops) { | ||
174 | cdev_init(&ir->cdev, d->fops); | ||
175 | ir->cdev.owner = d->owner; | ||
176 | } else { | ||
177 | cdev_init(&ir->cdev, &fops); | ||
178 | ir->cdev.owner = THIS_MODULE; | ||
179 | } | ||
180 | kobject_set_name(&ir->cdev.kobj, "lirc%d", d->minor); | ||
181 | |||
182 | retval = cdev_add(&ir->cdev, MKDEV(MAJOR(lirc_base_dev), d->minor), 1); | ||
183 | if (retval) | ||
184 | kobject_put(&ir->cdev.kobj); | ||
185 | |||
186 | return retval; | ||
187 | } | ||
188 | |||
189 | int lirc_register_driver(struct lirc_driver *d) | ||
190 | { | ||
191 | struct irctl *ir; | ||
192 | int minor; | ||
193 | int bytes_in_key; | ||
194 | unsigned int chunk_size; | ||
195 | unsigned int buffer_size; | ||
196 | int err; | ||
197 | |||
198 | if (!d) { | ||
199 | printk(KERN_ERR "lirc_dev: lirc_register_driver: " | ||
200 | "driver pointer must be not NULL!\n"); | ||
201 | err = -EBADRQC; | ||
202 | goto out; | ||
203 | } | ||
204 | |||
205 | if (MAX_IRCTL_DEVICES <= d->minor) { | ||
206 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
207 | "\"minor\" must be between 0 and %d (%d)!\n", | ||
208 | MAX_IRCTL_DEVICES-1, d->minor); | ||
209 | err = -EBADRQC; | ||
210 | goto out; | ||
211 | } | ||
212 | |||
213 | if (1 > d->code_length || (BUFLEN * 8) < d->code_length) { | ||
214 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
215 | "code length in bits for minor (%d) " | ||
216 | "must be less than %d!\n", | ||
217 | d->minor, BUFLEN * 8); | ||
218 | err = -EBADRQC; | ||
219 | goto out; | ||
220 | } | ||
221 | |||
222 | dev_dbg(d->dev, "lirc_dev: lirc_register_driver: sample_rate: %d\n", | ||
223 | d->sample_rate); | ||
224 | if (d->sample_rate) { | ||
225 | if (2 > d->sample_rate || HZ < d->sample_rate) { | ||
226 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
227 | "sample_rate must be between 2 and %d!\n", HZ); | ||
228 | err = -EBADRQC; | ||
229 | goto out; | ||
230 | } | ||
231 | if (!d->add_to_buf) { | ||
232 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
233 | "add_to_buf cannot be NULL when " | ||
234 | "sample_rate is set\n"); | ||
235 | err = -EBADRQC; | ||
236 | goto out; | ||
237 | } | ||
238 | } else if (!(d->fops && d->fops->read) && !d->rbuf) { | ||
239 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
240 | "fops->read and rbuf cannot all be NULL!\n"); | ||
241 | err = -EBADRQC; | ||
242 | goto out; | ||
243 | } else if (!d->rbuf) { | ||
244 | if (!(d->fops && d->fops->read && d->fops->poll && | ||
245 | d->fops->unlocked_ioctl)) { | ||
246 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
247 | "neither read, poll nor unlocked_ioctl can be NULL!\n"); | ||
248 | err = -EBADRQC; | ||
249 | goto out; | ||
250 | } | ||
251 | } | ||
252 | |||
253 | mutex_lock(&lirc_dev_lock); | ||
254 | |||
255 | minor = d->minor; | ||
256 | |||
257 | if (minor < 0) { | ||
258 | /* find first free slot for driver */ | ||
259 | for (minor = 0; minor < MAX_IRCTL_DEVICES; minor++) | ||
260 | if (!irctls[minor]) | ||
261 | break; | ||
262 | if (MAX_IRCTL_DEVICES == minor) { | ||
263 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
264 | "no free slots for drivers!\n"); | ||
265 | err = -ENOMEM; | ||
266 | goto out_lock; | ||
267 | } | ||
268 | } else if (irctls[minor]) { | ||
269 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
270 | "minor (%d) just registered!\n", minor); | ||
271 | err = -EBUSY; | ||
272 | goto out_lock; | ||
273 | } | ||
274 | |||
275 | ir = kzalloc(sizeof(struct irctl), GFP_KERNEL); | ||
276 | if (!ir) { | ||
277 | err = -ENOMEM; | ||
278 | goto out_lock; | ||
279 | } | ||
280 | init_irctl(ir); | ||
281 | irctls[minor] = ir; | ||
282 | d->minor = minor; | ||
283 | |||
284 | if (d->sample_rate) { | ||
285 | ir->jiffies_to_wait = HZ / d->sample_rate; | ||
286 | } else { | ||
287 | /* it means - wait for external event in task queue */ | ||
288 | ir->jiffies_to_wait = 0; | ||
289 | } | ||
290 | |||
291 | /* some safety check 8-) */ | ||
292 | d->name[sizeof(d->name)-1] = '\0'; | ||
293 | |||
294 | bytes_in_key = BITS_TO_LONGS(d->code_length) + | ||
295 | (d->code_length % 8 ? 1 : 0); | ||
296 | buffer_size = d->buffer_size ? d->buffer_size : BUFLEN / bytes_in_key; | ||
297 | chunk_size = d->chunk_size ? d->chunk_size : bytes_in_key; | ||
298 | |||
299 | if (d->rbuf) { | ||
300 | ir->buf = d->rbuf; | ||
301 | } else { | ||
302 | ir->buf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL); | ||
303 | if (!ir->buf) { | ||
304 | err = -ENOMEM; | ||
305 | goto out_lock; | ||
306 | } | ||
307 | err = lirc_buffer_init(ir->buf, chunk_size, buffer_size); | ||
308 | if (err) { | ||
309 | kfree(ir->buf); | ||
310 | goto out_lock; | ||
311 | } | ||
312 | } | ||
313 | ir->chunk_size = ir->buf->chunk_size; | ||
314 | |||
315 | if (d->features == 0) | ||
316 | d->features = LIRC_CAN_REC_LIRCCODE; | ||
317 | |||
318 | ir->d = *d; | ||
319 | ir->d.minor = minor; | ||
320 | |||
321 | device_create(lirc_class, ir->d.dev, | ||
322 | MKDEV(MAJOR(lirc_base_dev), ir->d.minor), NULL, | ||
323 | "lirc%u", ir->d.minor); | ||
324 | |||
325 | if (d->sample_rate) { | ||
326 | /* try to fire up polling thread */ | ||
327 | ir->task = kthread_run(lirc_thread, (void *)ir, "lirc_dev"); | ||
328 | if (IS_ERR(ir->task)) { | ||
329 | dev_err(d->dev, "lirc_dev: lirc_register_driver: " | ||
330 | "cannot run poll thread for minor = %d\n", | ||
331 | d->minor); | ||
332 | err = -ECHILD; | ||
333 | goto out_sysfs; | ||
334 | } | ||
335 | } | ||
336 | |||
337 | err = lirc_cdev_add(ir); | ||
338 | if (err) | ||
339 | goto out_sysfs; | ||
340 | |||
341 | ir->attached = 1; | ||
342 | mutex_unlock(&lirc_dev_lock); | ||
343 | |||
344 | dev_info(ir->d.dev, "lirc_dev: driver %s registered at minor = %d\n", | ||
345 | ir->d.name, ir->d.minor); | ||
346 | return minor; | ||
347 | |||
348 | out_sysfs: | ||
349 | device_destroy(lirc_class, MKDEV(MAJOR(lirc_base_dev), ir->d.minor)); | ||
350 | out_lock: | ||
351 | mutex_unlock(&lirc_dev_lock); | ||
352 | out: | ||
353 | return err; | ||
354 | } | ||
355 | EXPORT_SYMBOL(lirc_register_driver); | ||
356 | |||
357 | int lirc_unregister_driver(int minor) | ||
358 | { | ||
359 | struct irctl *ir; | ||
360 | |||
361 | if (minor < 0 || minor >= MAX_IRCTL_DEVICES) { | ||
362 | printk(KERN_ERR "lirc_dev: lirc_unregister_driver: " | ||
363 | "\"minor (%d)\" must be between 0 and %d!\n", | ||
364 | minor, MAX_IRCTL_DEVICES-1); | ||
365 | return -EBADRQC; | ||
366 | } | ||
367 | |||
368 | ir = irctls[minor]; | ||
369 | |||
370 | mutex_lock(&lirc_dev_lock); | ||
371 | |||
372 | if (ir->d.minor != minor) { | ||
373 | printk(KERN_ERR "lirc_dev: lirc_unregister_driver: " | ||
374 | "minor (%d) device not registered!", minor); | ||
375 | mutex_unlock(&lirc_dev_lock); | ||
376 | return -ENOENT; | ||
377 | } | ||
378 | |||
379 | /* end up polling thread */ | ||
380 | if (ir->task) | ||
381 | kthread_stop(ir->task); | ||
382 | |||
383 | dev_dbg(ir->d.dev, "lirc_dev: driver %s unregistered from minor = %d\n", | ||
384 | ir->d.name, ir->d.minor); | ||
385 | |||
386 | ir->attached = 0; | ||
387 | if (ir->open) { | ||
388 | dev_dbg(ir->d.dev, LOGHEAD "releasing opened driver\n", | ||
389 | ir->d.name, ir->d.minor); | ||
390 | wake_up_interruptible(&ir->buf->wait_poll); | ||
391 | mutex_lock(&ir->irctl_lock); | ||
392 | ir->d.set_use_dec(ir->d.data); | ||
393 | module_put(ir->d.owner); | ||
394 | mutex_unlock(&ir->irctl_lock); | ||
395 | cdev_del(&ir->cdev); | ||
396 | } else { | ||
397 | cleanup(ir); | ||
398 | cdev_del(&ir->cdev); | ||
399 | kfree(ir); | ||
400 | irctls[minor] = NULL; | ||
401 | } | ||
402 | |||
403 | mutex_unlock(&lirc_dev_lock); | ||
404 | |||
405 | return 0; | ||
406 | } | ||
407 | EXPORT_SYMBOL(lirc_unregister_driver); | ||
408 | |||
409 | int lirc_dev_fop_open(struct inode *inode, struct file *file) | ||
410 | { | ||
411 | struct irctl *ir; | ||
412 | int retval = 0; | ||
413 | |||
414 | if (iminor(inode) >= MAX_IRCTL_DEVICES) { | ||
415 | printk(KERN_WARNING "lirc_dev [%d]: open result = -ENODEV\n", | ||
416 | iminor(inode)); | ||
417 | return -ENODEV; | ||
418 | } | ||
419 | |||
420 | if (mutex_lock_interruptible(&lirc_dev_lock)) | ||
421 | return -ERESTARTSYS; | ||
422 | |||
423 | ir = irctls[iminor(inode)]; | ||
424 | if (!ir) { | ||
425 | retval = -ENODEV; | ||
426 | goto error; | ||
427 | } | ||
428 | file->private_data = ir; | ||
429 | |||
430 | dev_dbg(ir->d.dev, LOGHEAD "open called\n", ir->d.name, ir->d.minor); | ||
431 | |||
432 | if (ir->d.minor == NOPLUG) { | ||
433 | retval = -ENODEV; | ||
434 | goto error; | ||
435 | } | ||
436 | |||
437 | if (ir->open) { | ||
438 | retval = -EBUSY; | ||
439 | goto error; | ||
440 | } | ||
441 | |||
442 | if (try_module_get(ir->d.owner)) { | ||
443 | ++ir->open; | ||
444 | retval = ir->d.set_use_inc(ir->d.data); | ||
445 | |||
446 | if (retval) { | ||
447 | module_put(ir->d.owner); | ||
448 | --ir->open; | ||
449 | } else { | ||
450 | lirc_buffer_clear(ir->buf); | ||
451 | } | ||
452 | if (ir->task) | ||
453 | wake_up_process(ir->task); | ||
454 | } | ||
455 | |||
456 | error: | ||
457 | if (ir) | ||
458 | dev_dbg(ir->d.dev, LOGHEAD "open result = %d\n", | ||
459 | ir->d.name, ir->d.minor, retval); | ||
460 | |||
461 | mutex_unlock(&lirc_dev_lock); | ||
462 | |||
463 | return retval; | ||
464 | } | ||
465 | EXPORT_SYMBOL(lirc_dev_fop_open); | ||
466 | |||
467 | int lirc_dev_fop_close(struct inode *inode, struct file *file) | ||
468 | { | ||
469 | struct irctl *ir = irctls[iminor(inode)]; | ||
470 | |||
471 | dev_dbg(ir->d.dev, LOGHEAD "close called\n", ir->d.name, ir->d.minor); | ||
472 | |||
473 | WARN_ON(mutex_lock_killable(&lirc_dev_lock)); | ||
474 | |||
475 | --ir->open; | ||
476 | if (ir->attached) { | ||
477 | ir->d.set_use_dec(ir->d.data); | ||
478 | module_put(ir->d.owner); | ||
479 | } else { | ||
480 | cleanup(ir); | ||
481 | irctls[ir->d.minor] = NULL; | ||
482 | kfree(ir); | ||
483 | } | ||
484 | |||
485 | mutex_unlock(&lirc_dev_lock); | ||
486 | |||
487 | return 0; | ||
488 | } | ||
489 | EXPORT_SYMBOL(lirc_dev_fop_close); | ||
490 | |||
491 | unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) | ||
492 | { | ||
493 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | ||
494 | unsigned int ret; | ||
495 | |||
496 | dev_dbg(ir->d.dev, LOGHEAD "poll called\n", ir->d.name, ir->d.minor); | ||
497 | |||
498 | if (!ir->attached) { | ||
499 | mutex_unlock(&ir->irctl_lock); | ||
500 | return POLLERR; | ||
501 | } | ||
502 | |||
503 | poll_wait(file, &ir->buf->wait_poll, wait); | ||
504 | |||
505 | if (ir->buf) | ||
506 | if (lirc_buffer_empty(ir->buf)) | ||
507 | ret = 0; | ||
508 | else | ||
509 | ret = POLLIN | POLLRDNORM; | ||
510 | else | ||
511 | ret = POLLERR; | ||
512 | |||
513 | dev_dbg(ir->d.dev, LOGHEAD "poll result = %d\n", | ||
514 | ir->d.name, ir->d.minor, ret); | ||
515 | |||
516 | return ret; | ||
517 | } | ||
518 | EXPORT_SYMBOL(lirc_dev_fop_poll); | ||
519 | |||
520 | long lirc_dev_fop_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | ||
521 | { | ||
522 | unsigned long mode; | ||
523 | int result = 0; | ||
524 | struct irctl *ir = file->private_data; | ||
525 | |||
526 | dev_dbg(ir->d.dev, LOGHEAD "ioctl called (0x%x)\n", | ||
527 | ir->d.name, ir->d.minor, cmd); | ||
528 | |||
529 | if (ir->d.minor == NOPLUG || !ir->attached) { | ||
530 | dev_dbg(ir->d.dev, LOGHEAD "ioctl result = -ENODEV\n", | ||
531 | ir->d.name, ir->d.minor); | ||
532 | return -ENODEV; | ||
533 | } | ||
534 | |||
535 | mutex_lock(&ir->irctl_lock); | ||
536 | |||
537 | switch (cmd) { | ||
538 | case LIRC_GET_FEATURES: | ||
539 | result = put_user(ir->d.features, (unsigned long *)arg); | ||
540 | break; | ||
541 | case LIRC_GET_REC_MODE: | ||
542 | if (!(ir->d.features & LIRC_CAN_REC_MASK)) { | ||
543 | result = -ENOSYS; | ||
544 | break; | ||
545 | } | ||
546 | |||
547 | result = put_user(LIRC_REC2MODE | ||
548 | (ir->d.features & LIRC_CAN_REC_MASK), | ||
549 | (unsigned long *)arg); | ||
550 | break; | ||
551 | case LIRC_SET_REC_MODE: | ||
552 | if (!(ir->d.features & LIRC_CAN_REC_MASK)) { | ||
553 | result = -ENOSYS; | ||
554 | break; | ||
555 | } | ||
556 | |||
557 | result = get_user(mode, (unsigned long *)arg); | ||
558 | if (!result && !(LIRC_MODE2REC(mode) & ir->d.features)) | ||
559 | result = -EINVAL; | ||
560 | /* | ||
561 | * FIXME: We should actually set the mode somehow but | ||
562 | * for now, lirc_serial doesn't support mode changing either | ||
563 | */ | ||
564 | break; | ||
565 | case LIRC_GET_LENGTH: | ||
566 | result = put_user(ir->d.code_length, (unsigned long *)arg); | ||
567 | break; | ||
568 | case LIRC_GET_MIN_TIMEOUT: | ||
569 | if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) || | ||
570 | ir->d.min_timeout == 0) { | ||
571 | result = -ENOSYS; | ||
572 | break; | ||
573 | } | ||
574 | |||
575 | result = put_user(ir->d.min_timeout, (unsigned long *)arg); | ||
576 | break; | ||
577 | case LIRC_GET_MAX_TIMEOUT: | ||
578 | if (!(ir->d.features & LIRC_CAN_SET_REC_TIMEOUT) || | ||
579 | ir->d.max_timeout == 0) { | ||
580 | result = -ENOSYS; | ||
581 | break; | ||
582 | } | ||
583 | |||
584 | result = put_user(ir->d.max_timeout, (unsigned long *)arg); | ||
585 | break; | ||
586 | default: | ||
587 | result = -EINVAL; | ||
588 | } | ||
589 | |||
590 | dev_dbg(ir->d.dev, LOGHEAD "ioctl result = %d\n", | ||
591 | ir->d.name, ir->d.minor, result); | ||
592 | |||
593 | mutex_unlock(&ir->irctl_lock); | ||
594 | |||
595 | return result; | ||
596 | } | ||
597 | EXPORT_SYMBOL(lirc_dev_fop_ioctl); | ||
598 | |||
599 | ssize_t lirc_dev_fop_read(struct file *file, | ||
600 | char *buffer, | ||
601 | size_t length, | ||
602 | loff_t *ppos) | ||
603 | { | ||
604 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | ||
605 | unsigned char buf[ir->chunk_size]; | ||
606 | int ret = 0, written = 0; | ||
607 | DECLARE_WAITQUEUE(wait, current); | ||
608 | |||
609 | dev_dbg(ir->d.dev, LOGHEAD "read called\n", ir->d.name, ir->d.minor); | ||
610 | |||
611 | if (mutex_lock_interruptible(&ir->irctl_lock)) | ||
612 | return -ERESTARTSYS; | ||
613 | if (!ir->attached) { | ||
614 | mutex_unlock(&ir->irctl_lock); | ||
615 | return -ENODEV; | ||
616 | } | ||
617 | |||
618 | if (length % ir->chunk_size) { | ||
619 | dev_dbg(ir->d.dev, LOGHEAD "read result = -EINVAL\n", | ||
620 | ir->d.name, ir->d.minor); | ||
621 | mutex_unlock(&ir->irctl_lock); | ||
622 | return -EINVAL; | ||
623 | } | ||
624 | |||
625 | /* | ||
626 | * we add ourselves to the task queue before buffer check | ||
627 | * to avoid losing scan code (in case when queue is awaken somewhere | ||
628 | * between while condition checking and scheduling) | ||
629 | */ | ||
630 | add_wait_queue(&ir->buf->wait_poll, &wait); | ||
631 | set_current_state(TASK_INTERRUPTIBLE); | ||
632 | |||
633 | /* | ||
634 | * while we didn't provide 'length' bytes, device is opened in blocking | ||
635 | * mode and 'copy_to_user' is happy, wait for data. | ||
636 | */ | ||
637 | while (written < length && ret == 0) { | ||
638 | if (lirc_buffer_empty(ir->buf)) { | ||
639 | /* According to the read(2) man page, 'written' can be | ||
640 | * returned as less than 'length', instead of blocking | ||
641 | * again, returning -EWOULDBLOCK, or returning | ||
642 | * -ERESTARTSYS */ | ||
643 | if (written) | ||
644 | break; | ||
645 | if (file->f_flags & O_NONBLOCK) { | ||
646 | ret = -EWOULDBLOCK; | ||
647 | break; | ||
648 | } | ||
649 | if (signal_pending(current)) { | ||
650 | ret = -ERESTARTSYS; | ||
651 | break; | ||
652 | } | ||
653 | |||
654 | mutex_unlock(&ir->irctl_lock); | ||
655 | schedule(); | ||
656 | set_current_state(TASK_INTERRUPTIBLE); | ||
657 | |||
658 | if (mutex_lock_interruptible(&ir->irctl_lock)) { | ||
659 | ret = -ERESTARTSYS; | ||
660 | remove_wait_queue(&ir->buf->wait_poll, &wait); | ||
661 | set_current_state(TASK_RUNNING); | ||
662 | goto out_unlocked; | ||
663 | } | ||
664 | |||
665 | if (!ir->attached) { | ||
666 | ret = -ENODEV; | ||
667 | break; | ||
668 | } | ||
669 | } else { | ||
670 | lirc_buffer_read(ir->buf, buf); | ||
671 | ret = copy_to_user((void *)buffer+written, buf, | ||
672 | ir->buf->chunk_size); | ||
673 | written += ir->buf->chunk_size; | ||
674 | } | ||
675 | } | ||
676 | |||
677 | remove_wait_queue(&ir->buf->wait_poll, &wait); | ||
678 | set_current_state(TASK_RUNNING); | ||
679 | mutex_unlock(&ir->irctl_lock); | ||
680 | |||
681 | out_unlocked: | ||
682 | dev_dbg(ir->d.dev, LOGHEAD "read result = %s (%d)\n", | ||
683 | ir->d.name, ir->d.minor, ret ? "-EFAULT" : "OK", ret); | ||
684 | |||
685 | return ret ? ret : written; | ||
686 | } | ||
687 | EXPORT_SYMBOL(lirc_dev_fop_read); | ||
688 | |||
689 | void *lirc_get_pdata(struct file *file) | ||
690 | { | ||
691 | void *data = NULL; | ||
692 | |||
693 | if (file && file->f_dentry && file->f_dentry->d_inode && | ||
694 | file->f_dentry->d_inode->i_rdev) { | ||
695 | struct irctl *ir; | ||
696 | ir = irctls[iminor(file->f_dentry->d_inode)]; | ||
697 | data = ir->d.data; | ||
698 | } | ||
699 | |||
700 | return data; | ||
701 | } | ||
702 | EXPORT_SYMBOL(lirc_get_pdata); | ||
703 | |||
704 | |||
705 | ssize_t lirc_dev_fop_write(struct file *file, const char *buffer, | ||
706 | size_t length, loff_t *ppos) | ||
707 | { | ||
708 | struct irctl *ir = irctls[iminor(file->f_dentry->d_inode)]; | ||
709 | |||
710 | dev_dbg(ir->d.dev, LOGHEAD "write called\n", ir->d.name, ir->d.minor); | ||
711 | |||
712 | if (!ir->attached) | ||
713 | return -ENODEV; | ||
714 | |||
715 | return -EINVAL; | ||
716 | } | ||
717 | EXPORT_SYMBOL(lirc_dev_fop_write); | ||
718 | |||
719 | |||
720 | static int __init lirc_dev_init(void) | ||
721 | { | ||
722 | int retval; | ||
723 | |||
724 | lirc_class = class_create(THIS_MODULE, "lirc"); | ||
725 | if (IS_ERR(lirc_class)) { | ||
726 | retval = PTR_ERR(lirc_class); | ||
727 | printk(KERN_ERR "lirc_dev: class_create failed\n"); | ||
728 | goto error; | ||
729 | } | ||
730 | |||
731 | retval = alloc_chrdev_region(&lirc_base_dev, 0, MAX_IRCTL_DEVICES, | ||
732 | IRCTL_DEV_NAME); | ||
733 | if (retval) { | ||
734 | class_destroy(lirc_class); | ||
735 | printk(KERN_ERR "lirc_dev: alloc_chrdev_region failed\n"); | ||
736 | goto error; | ||
737 | } | ||
738 | |||
739 | |||
740 | printk(KERN_INFO "lirc_dev: IR Remote Control driver registered, " | ||
741 | "major %d \n", MAJOR(lirc_base_dev)); | ||
742 | |||
743 | error: | ||
744 | return retval; | ||
745 | } | ||
746 | |||
747 | |||
748 | |||
749 | static void __exit lirc_dev_exit(void) | ||
750 | { | ||
751 | class_destroy(lirc_class); | ||
752 | unregister_chrdev_region(lirc_base_dev, MAX_IRCTL_DEVICES); | ||
753 | printk(KERN_INFO "lirc_dev: module unloaded\n"); | ||
754 | } | ||
755 | |||
756 | module_init(lirc_dev_init); | ||
757 | module_exit(lirc_dev_exit); | ||
758 | |||
759 | MODULE_DESCRIPTION("LIRC base driver module"); | ||
760 | MODULE_AUTHOR("Artur Lipowski"); | ||
761 | MODULE_LICENSE("GPL"); | ||
762 | |||
763 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
764 | MODULE_PARM_DESC(debug, "Enable debugging messages"); | ||
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c deleted file mode 100644 index bc620e10ef77..000000000000 --- a/drivers/media/IR/mceusb.c +++ /dev/null | |||
@@ -1,1132 +0,0 @@ | |||
1 | /* | ||
2 | * Driver for USB Windows Media Center Ed. eHome Infrared Transceivers | ||
3 | * | ||
4 | * Copyright (c) 2010 by Jarod Wilson <jarod@redhat.com> | ||
5 | * | ||
6 | * Based on the original lirc_mceusb and lirc_mceusb2 drivers, by Dan | ||
7 | * Conti, Martin Blatter and Daniel Melander, the latter of which was | ||
8 | * in turn also based on the lirc_atiusb driver by Paul Miller. The | ||
9 | * two mce drivers were merged into one by Jarod Wilson, with transmit | ||
10 | * support for the 1st-gen device added primarily by Patrick Calhoun, | ||
11 | * with a bit of tweaks by Jarod. Debugging improvements and proper | ||
12 | * support for what appears to be 3rd-gen hardware added by Jarod. | ||
13 | * Initial port from lirc driver to ir-core drivery by Jarod, based | ||
14 | * partially on a port to an earlier proposed IR infrastructure by | ||
15 | * Jon Smirl, which included enhancements and simplifications to the | ||
16 | * incoming IR buffer parsing routines. | ||
17 | * | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify | ||
20 | * it under the terms of the GNU General Public License as published by | ||
21 | * the Free Software Foundation; either version 2 of the License, or | ||
22 | * (at your option) any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, | ||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | * GNU General Public License for more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License | ||
30 | * along with this program; if not, write to the Free Software | ||
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
32 | * | ||
33 | */ | ||
34 | |||
35 | #include <linux/device.h> | ||
36 | #include <linux/module.h> | ||
37 | #include <linux/slab.h> | ||
38 | #include <linux/usb.h> | ||
39 | #include <linux/input.h> | ||
40 | #include <media/ir-core.h> | ||
41 | #include <media/ir-common.h> | ||
42 | |||
43 | #define DRIVER_VERSION "1.91" | ||
44 | #define DRIVER_AUTHOR "Jarod Wilson <jarod@wilsonet.com>" | ||
45 | #define DRIVER_DESC "Windows Media Center Ed. eHome Infrared Transceiver " \ | ||
46 | "device driver" | ||
47 | #define DRIVER_NAME "mceusb" | ||
48 | |||
49 | #define USB_BUFLEN 32 /* USB reception buffer length */ | ||
50 | #define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ | ||
51 | #define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ | ||
52 | |||
53 | /* MCE constants */ | ||
54 | #define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ | ||
55 | #define MCE_TIME_UNIT 50 /* Approx 50us resolution */ | ||
56 | #define MCE_CODE_LENGTH 5 /* Normal length of packet (with header) */ | ||
57 | #define MCE_PACKET_SIZE 4 /* Normal length of packet (without header) */ | ||
58 | #define MCE_PACKET_HEADER 0x84 /* Actual header format is 0x80 + num_bytes */ | ||
59 | #define MCE_CONTROL_HEADER 0x9F /* MCE status header */ | ||
60 | #define MCE_TX_HEADER_LENGTH 3 /* # of bytes in the initializing tx header */ | ||
61 | #define MCE_MAX_CHANNELS 2 /* Two transmitters, hardware dependent? */ | ||
62 | #define MCE_DEFAULT_TX_MASK 0x03 /* Val opts: TX1=0x01, TX2=0x02, ALL=0x03 */ | ||
63 | #define MCE_PULSE_BIT 0x80 /* Pulse bit, MSB set == PULSE else SPACE */ | ||
64 | #define MCE_PULSE_MASK 0x7F /* Pulse mask */ | ||
65 | #define MCE_MAX_PULSE_LENGTH 0x7F /* Longest transmittable pulse symbol */ | ||
66 | #define MCE_PACKET_LENGTH_MASK 0x1F /* Packet length mask */ | ||
67 | |||
68 | |||
69 | /* module parameters */ | ||
70 | #ifdef CONFIG_USB_DEBUG | ||
71 | static int debug = 1; | ||
72 | #else | ||
73 | static int debug; | ||
74 | #endif | ||
75 | |||
76 | /* general constants */ | ||
77 | #define SEND_FLAG_IN_PROGRESS 1 | ||
78 | #define SEND_FLAG_COMPLETE 2 | ||
79 | #define RECV_FLAG_IN_PROGRESS 3 | ||
80 | #define RECV_FLAG_COMPLETE 4 | ||
81 | |||
82 | #define MCEUSB_RX 1 | ||
83 | #define MCEUSB_TX 2 | ||
84 | |||
85 | #define VENDOR_PHILIPS 0x0471 | ||
86 | #define VENDOR_SMK 0x0609 | ||
87 | #define VENDOR_TATUNG 0x1460 | ||
88 | #define VENDOR_GATEWAY 0x107b | ||
89 | #define VENDOR_SHUTTLE 0x1308 | ||
90 | #define VENDOR_SHUTTLE2 0x051c | ||
91 | #define VENDOR_MITSUMI 0x03ee | ||
92 | #define VENDOR_TOPSEED 0x1784 | ||
93 | #define VENDOR_RICAVISION 0x179d | ||
94 | #define VENDOR_ITRON 0x195d | ||
95 | #define VENDOR_FIC 0x1509 | ||
96 | #define VENDOR_LG 0x043e | ||
97 | #define VENDOR_MICROSOFT 0x045e | ||
98 | #define VENDOR_FORMOSA 0x147a | ||
99 | #define VENDOR_FINTEK 0x1934 | ||
100 | #define VENDOR_PINNACLE 0x2304 | ||
101 | #define VENDOR_ECS 0x1019 | ||
102 | #define VENDOR_WISTRON 0x0fb8 | ||
103 | #define VENDOR_COMPRO 0x185b | ||
104 | #define VENDOR_NORTHSTAR 0x04eb | ||
105 | #define VENDOR_REALTEK 0x0bda | ||
106 | #define VENDOR_TIVO 0x105a | ||
107 | |||
108 | static struct usb_device_id mceusb_dev_table[] = { | ||
109 | /* Original Microsoft MCE IR Transceiver (often HP-branded) */ | ||
110 | { USB_DEVICE(VENDOR_MICROSOFT, 0x006d) }, | ||
111 | /* Philips Infrared Transceiver - Sahara branded */ | ||
112 | { USB_DEVICE(VENDOR_PHILIPS, 0x0608) }, | ||
113 | /* Philips Infrared Transceiver - HP branded */ | ||
114 | { USB_DEVICE(VENDOR_PHILIPS, 0x060c) }, | ||
115 | /* Philips SRM5100 */ | ||
116 | { USB_DEVICE(VENDOR_PHILIPS, 0x060d) }, | ||
117 | /* Philips Infrared Transceiver - Omaura */ | ||
118 | { USB_DEVICE(VENDOR_PHILIPS, 0x060f) }, | ||
119 | /* Philips Infrared Transceiver - Spinel plus */ | ||
120 | { USB_DEVICE(VENDOR_PHILIPS, 0x0613) }, | ||
121 | /* Philips eHome Infrared Transceiver */ | ||
122 | { USB_DEVICE(VENDOR_PHILIPS, 0x0815) }, | ||
123 | /* Philips/Spinel plus IR transceiver for ASUS */ | ||
124 | { USB_DEVICE(VENDOR_PHILIPS, 0x206c) }, | ||
125 | /* Philips/Spinel plus IR transceiver for ASUS */ | ||
126 | { USB_DEVICE(VENDOR_PHILIPS, 0x2088) }, | ||
127 | /* Realtek MCE IR Receiver */ | ||
128 | { USB_DEVICE(VENDOR_REALTEK, 0x0161) }, | ||
129 | /* SMK/Toshiba G83C0004D410 */ | ||
130 | { USB_DEVICE(VENDOR_SMK, 0x031d) }, | ||
131 | /* SMK eHome Infrared Transceiver (Sony VAIO) */ | ||
132 | { USB_DEVICE(VENDOR_SMK, 0x0322) }, | ||
133 | /* bundled with Hauppauge PVR-150 */ | ||
134 | { USB_DEVICE(VENDOR_SMK, 0x0334) }, | ||
135 | /* SMK eHome Infrared Transceiver */ | ||
136 | { USB_DEVICE(VENDOR_SMK, 0x0338) }, | ||
137 | /* Tatung eHome Infrared Transceiver */ | ||
138 | { USB_DEVICE(VENDOR_TATUNG, 0x9150) }, | ||
139 | /* Shuttle eHome Infrared Transceiver */ | ||
140 | { USB_DEVICE(VENDOR_SHUTTLE, 0xc001) }, | ||
141 | /* Shuttle eHome Infrared Transceiver */ | ||
142 | { USB_DEVICE(VENDOR_SHUTTLE2, 0xc001) }, | ||
143 | /* Gateway eHome Infrared Transceiver */ | ||
144 | { USB_DEVICE(VENDOR_GATEWAY, 0x3009) }, | ||
145 | /* Mitsumi */ | ||
146 | { USB_DEVICE(VENDOR_MITSUMI, 0x2501) }, | ||
147 | /* Topseed eHome Infrared Transceiver */ | ||
148 | { USB_DEVICE(VENDOR_TOPSEED, 0x0001) }, | ||
149 | /* Topseed HP eHome Infrared Transceiver */ | ||
150 | { USB_DEVICE(VENDOR_TOPSEED, 0x0006) }, | ||
151 | /* Topseed eHome Infrared Transceiver */ | ||
152 | { USB_DEVICE(VENDOR_TOPSEED, 0x0007) }, | ||
153 | /* Topseed eHome Infrared Transceiver */ | ||
154 | { USB_DEVICE(VENDOR_TOPSEED, 0x0008) }, | ||
155 | /* Topseed eHome Infrared Transceiver */ | ||
156 | { USB_DEVICE(VENDOR_TOPSEED, 0x000a) }, | ||
157 | /* Topseed eHome Infrared Transceiver */ | ||
158 | { USB_DEVICE(VENDOR_TOPSEED, 0x0011) }, | ||
159 | /* Ricavision internal Infrared Transceiver */ | ||
160 | { USB_DEVICE(VENDOR_RICAVISION, 0x0010) }, | ||
161 | /* Itron ione Libra Q-11 */ | ||
162 | { USB_DEVICE(VENDOR_ITRON, 0x7002) }, | ||
163 | /* FIC eHome Infrared Transceiver */ | ||
164 | { USB_DEVICE(VENDOR_FIC, 0x9242) }, | ||
165 | /* LG eHome Infrared Transceiver */ | ||
166 | { USB_DEVICE(VENDOR_LG, 0x9803) }, | ||
167 | /* Microsoft MCE Infrared Transceiver */ | ||
168 | { USB_DEVICE(VENDOR_MICROSOFT, 0x00a0) }, | ||
169 | /* Formosa eHome Infrared Transceiver */ | ||
170 | { USB_DEVICE(VENDOR_FORMOSA, 0xe015) }, | ||
171 | /* Formosa21 / eHome Infrared Receiver */ | ||
172 | { USB_DEVICE(VENDOR_FORMOSA, 0xe016) }, | ||
173 | /* Formosa aim / Trust MCE Infrared Receiver */ | ||
174 | { USB_DEVICE(VENDOR_FORMOSA, 0xe017) }, | ||
175 | /* Formosa Industrial Computing / Beanbag Emulation Device */ | ||
176 | { USB_DEVICE(VENDOR_FORMOSA, 0xe018) }, | ||
177 | /* Formosa21 / eHome Infrared Receiver */ | ||
178 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03a) }, | ||
179 | /* Formosa Industrial Computing AIM IR605/A */ | ||
180 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03c) }, | ||
181 | /* Formosa Industrial Computing */ | ||
182 | { USB_DEVICE(VENDOR_FORMOSA, 0xe03e) }, | ||
183 | /* Fintek eHome Infrared Transceiver */ | ||
184 | { USB_DEVICE(VENDOR_FINTEK, 0x0602) }, | ||
185 | /* Fintek eHome Infrared Transceiver (in the AOpen MP45) */ | ||
186 | { USB_DEVICE(VENDOR_FINTEK, 0x0702) }, | ||
187 | /* Pinnacle Remote Kit */ | ||
188 | { USB_DEVICE(VENDOR_PINNACLE, 0x0225) }, | ||
189 | /* Elitegroup Computer Systems IR */ | ||
190 | { USB_DEVICE(VENDOR_ECS, 0x0f38) }, | ||
191 | /* Wistron Corp. eHome Infrared Receiver */ | ||
192 | { USB_DEVICE(VENDOR_WISTRON, 0x0002) }, | ||
193 | /* Compro K100 */ | ||
194 | { USB_DEVICE(VENDOR_COMPRO, 0x3020) }, | ||
195 | /* Compro K100 v2 */ | ||
196 | { USB_DEVICE(VENDOR_COMPRO, 0x3082) }, | ||
197 | /* Northstar Systems, Inc. eHome Infrared Transceiver */ | ||
198 | { USB_DEVICE(VENDOR_NORTHSTAR, 0xe004) }, | ||
199 | /* TiVo PC IR Receiver */ | ||
200 | { USB_DEVICE(VENDOR_TIVO, 0x2000) }, | ||
201 | /* Terminating entry */ | ||
202 | { } | ||
203 | }; | ||
204 | |||
205 | static struct usb_device_id gen3_list[] = { | ||
206 | { USB_DEVICE(VENDOR_PINNACLE, 0x0225) }, | ||
207 | { USB_DEVICE(VENDOR_TOPSEED, 0x0008) }, | ||
208 | {} | ||
209 | }; | ||
210 | |||
211 | static struct usb_device_id microsoft_gen1_list[] = { | ||
212 | { USB_DEVICE(VENDOR_MICROSOFT, 0x006d) }, | ||
213 | {} | ||
214 | }; | ||
215 | |||
216 | static struct usb_device_id std_tx_mask_list[] = { | ||
217 | { USB_DEVICE(VENDOR_MICROSOFT, 0x006d) }, | ||
218 | { USB_DEVICE(VENDOR_PHILIPS, 0x060c) }, | ||
219 | { USB_DEVICE(VENDOR_SMK, 0x031d) }, | ||
220 | { USB_DEVICE(VENDOR_SMK, 0x0322) }, | ||
221 | { USB_DEVICE(VENDOR_SMK, 0x0334) }, | ||
222 | { USB_DEVICE(VENDOR_TOPSEED, 0x0001) }, | ||
223 | { USB_DEVICE(VENDOR_TOPSEED, 0x0006) }, | ||
224 | { USB_DEVICE(VENDOR_TOPSEED, 0x0007) }, | ||
225 | { USB_DEVICE(VENDOR_TOPSEED, 0x0008) }, | ||
226 | { USB_DEVICE(VENDOR_TOPSEED, 0x000a) }, | ||
227 | { USB_DEVICE(VENDOR_TOPSEED, 0x0011) }, | ||
228 | { USB_DEVICE(VENDOR_PINNACLE, 0x0225) }, | ||
229 | {} | ||
230 | }; | ||
231 | |||
232 | /* data structure for each usb transceiver */ | ||
233 | struct mceusb_dev { | ||
234 | /* ir-core bits */ | ||
235 | struct ir_dev_props *props; | ||
236 | struct ir_raw_event rawir; | ||
237 | |||
238 | /* core device bits */ | ||
239 | struct device *dev; | ||
240 | struct input_dev *idev; | ||
241 | |||
242 | /* usb */ | ||
243 | struct usb_device *usbdev; | ||
244 | struct urb *urb_in; | ||
245 | struct usb_endpoint_descriptor *usb_ep_in; | ||
246 | struct usb_endpoint_descriptor *usb_ep_out; | ||
247 | |||
248 | /* buffers and dma */ | ||
249 | unsigned char *buf_in; | ||
250 | unsigned int len_in; | ||
251 | u8 cmd; /* MCE command type */ | ||
252 | u8 rem; /* Remaining IR data bytes in packet */ | ||
253 | dma_addr_t dma_in; | ||
254 | dma_addr_t dma_out; | ||
255 | |||
256 | struct { | ||
257 | u32 connected:1; | ||
258 | u32 tx_mask_inverted:1; | ||
259 | u32 microsoft_gen1:1; | ||
260 | u32 reserved:29; | ||
261 | } flags; | ||
262 | |||
263 | /* transmit support */ | ||
264 | int send_flags; | ||
265 | u32 carrier; | ||
266 | unsigned char tx_mask; | ||
267 | |||
268 | char name[128]; | ||
269 | char phys[64]; | ||
270 | }; | ||
271 | |||
272 | /* | ||
273 | * MCE Device Command Strings | ||
274 | * Device command responses vary from device to device... | ||
275 | * - DEVICE_RESET resets the hardware to its default state | ||
276 | * - GET_REVISION fetches the hardware/software revision, common | ||
277 | * replies are ff 0b 45 ff 1b 08 and ff 0b 50 ff 1b 42 | ||
278 | * - GET_CARRIER_FREQ gets the carrier mode and frequency of the | ||
279 | * device, with replies in the form of 9f 06 MM FF, where MM is 0-3, | ||
280 | * meaning clk of 10000000, 2500000, 625000 or 156250, and FF is | ||
281 | * ((clk / frequency) - 1) | ||
282 | * - GET_RX_TIMEOUT fetches the receiver timeout in units of 50us, | ||
283 | * response in the form of 9f 0c msb lsb | ||
284 | * - GET_TX_BITMASK fetches the transmitter bitmask, replies in | ||
285 | * the form of 9f 08 bm, where bm is the bitmask | ||
286 | * - GET_RX_SENSOR fetches the RX sensor setting -- long-range | ||
287 | * general use one or short-range learning one, in the form of | ||
288 | * 9f 14 ss, where ss is either 01 for long-range or 02 for short | ||
289 | * - SET_CARRIER_FREQ sets a new carrier mode and frequency | ||
290 | * - SET_TX_BITMASK sets the transmitter bitmask | ||
291 | * - SET_RX_TIMEOUT sets the receiver timeout | ||
292 | * - SET_RX_SENSOR sets which receiver sensor to use | ||
293 | */ | ||
294 | static char DEVICE_RESET[] = {0x00, 0xff, 0xaa}; | ||
295 | static char GET_REVISION[] = {0xff, 0x0b}; | ||
296 | static char GET_UNKNOWN[] = {0xff, 0x18}; | ||
297 | static char GET_UNKNOWN2[] = {0x9f, 0x05}; | ||
298 | static char GET_CARRIER_FREQ[] = {0x9f, 0x07}; | ||
299 | static char GET_RX_TIMEOUT[] = {0x9f, 0x0d}; | ||
300 | static char GET_TX_BITMASK[] = {0x9f, 0x13}; | ||
301 | static char GET_RX_SENSOR[] = {0x9f, 0x15}; | ||
302 | /* sub in desired values in lower byte or bytes for full command */ | ||
303 | /* FIXME: make use of these for transmit. | ||
304 | static char SET_CARRIER_FREQ[] = {0x9f, 0x06, 0x00, 0x00}; | ||
305 | static char SET_TX_BITMASK[] = {0x9f, 0x08, 0x00}; | ||
306 | static char SET_RX_TIMEOUT[] = {0x9f, 0x0c, 0x00, 0x00}; | ||
307 | static char SET_RX_SENSOR[] = {0x9f, 0x14, 0x00}; | ||
308 | */ | ||
309 | |||
310 | static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf, | ||
311 | int len, bool out) | ||
312 | { | ||
313 | char codes[USB_BUFLEN * 3 + 1]; | ||
314 | char inout[9]; | ||
315 | int i; | ||
316 | u8 cmd, subcmd, data1, data2; | ||
317 | struct device *dev = ir->dev; | ||
318 | int idx = 0; | ||
319 | |||
320 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ | ||
321 | if (ir->flags.microsoft_gen1 && !out) | ||
322 | idx = 2; | ||
323 | |||
324 | if (len <= idx) | ||
325 | return; | ||
326 | |||
327 | for (i = 0; i < len && i < USB_BUFLEN; i++) | ||
328 | snprintf(codes + i * 3, 4, "%02x ", buf[i] & 0xFF); | ||
329 | |||
330 | dev_info(dev, "%sx data: %s (length=%d)\n", | ||
331 | (out ? "t" : "r"), codes, len); | ||
332 | |||
333 | if (out) | ||
334 | strcpy(inout, "Request\0"); | ||
335 | else | ||
336 | strcpy(inout, "Got\0"); | ||
337 | |||
338 | cmd = buf[idx] & 0xff; | ||
339 | subcmd = buf[idx + 1] & 0xff; | ||
340 | data1 = buf[idx + 2] & 0xff; | ||
341 | data2 = buf[idx + 3] & 0xff; | ||
342 | |||
343 | switch (cmd) { | ||
344 | case 0x00: | ||
345 | if (subcmd == 0xff && data1 == 0xaa) | ||
346 | dev_info(dev, "Device reset requested\n"); | ||
347 | else | ||
348 | dev_info(dev, "Unknown command 0x%02x 0x%02x\n", | ||
349 | cmd, subcmd); | ||
350 | break; | ||
351 | case 0xff: | ||
352 | switch (subcmd) { | ||
353 | case 0x0b: | ||
354 | if (len == 2) | ||
355 | dev_info(dev, "Get hw/sw rev?\n"); | ||
356 | else | ||
357 | dev_info(dev, "hw/sw rev 0x%02x 0x%02x " | ||
358 | "0x%02x 0x%02x\n", data1, data2, | ||
359 | buf[idx + 4], buf[idx + 5]); | ||
360 | break; | ||
361 | case 0xaa: | ||
362 | dev_info(dev, "Device reset requested\n"); | ||
363 | break; | ||
364 | case 0xfe: | ||
365 | dev_info(dev, "Previous command not supported\n"); | ||
366 | break; | ||
367 | case 0x18: | ||
368 | case 0x1b: | ||
369 | default: | ||
370 | dev_info(dev, "Unknown command 0x%02x 0x%02x\n", | ||
371 | cmd, subcmd); | ||
372 | break; | ||
373 | } | ||
374 | break; | ||
375 | case 0x9f: | ||
376 | switch (subcmd) { | ||
377 | case 0x03: | ||
378 | dev_info(dev, "Ping\n"); | ||
379 | break; | ||
380 | case 0x04: | ||
381 | dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", | ||
382 | data1, data2); | ||
383 | break; | ||
384 | case 0x06: | ||
385 | dev_info(dev, "%s carrier mode and freq of " | ||
386 | "0x%02x 0x%02x\n", inout, data1, data2); | ||
387 | break; | ||
388 | case 0x07: | ||
389 | dev_info(dev, "Get carrier mode and freq\n"); | ||
390 | break; | ||
391 | case 0x08: | ||
392 | dev_info(dev, "%s transmit blaster mask of 0x%02x\n", | ||
393 | inout, data1); | ||
394 | break; | ||
395 | case 0x0c: | ||
396 | /* value is in units of 50us, so x*50/100 or x/2 ms */ | ||
397 | dev_info(dev, "%s receive timeout of %d ms\n", | ||
398 | inout, ((data1 << 8) | data2) / 2); | ||
399 | break; | ||
400 | case 0x0d: | ||
401 | dev_info(dev, "Get receive timeout\n"); | ||
402 | break; | ||
403 | case 0x13: | ||
404 | dev_info(dev, "Get transmit blaster mask\n"); | ||
405 | break; | ||
406 | case 0x14: | ||
407 | dev_info(dev, "%s %s-range receive sensor in use\n", | ||
408 | inout, data1 == 0x02 ? "short" : "long"); | ||
409 | break; | ||
410 | case 0x15: | ||
411 | if (len == 2) | ||
412 | dev_info(dev, "Get receive sensor\n"); | ||
413 | else | ||
414 | dev_info(dev, "Received pulse count is %d\n", | ||
415 | ((data1 << 8) | data2)); | ||
416 | break; | ||
417 | case 0xfe: | ||
418 | dev_info(dev, "Error! Hardware is likely wedged...\n"); | ||
419 | break; | ||
420 | case 0x05: | ||
421 | case 0x09: | ||
422 | case 0x0f: | ||
423 | default: | ||
424 | dev_info(dev, "Unknown command 0x%02x 0x%02x\n", | ||
425 | cmd, subcmd); | ||
426 | break; | ||
427 | } | ||
428 | break; | ||
429 | default: | ||
430 | break; | ||
431 | } | ||
432 | } | ||
433 | |||
434 | static void mce_async_callback(struct urb *urb, struct pt_regs *regs) | ||
435 | { | ||
436 | struct mceusb_dev *ir; | ||
437 | int len; | ||
438 | |||
439 | if (!urb) | ||
440 | return; | ||
441 | |||
442 | ir = urb->context; | ||
443 | if (ir) { | ||
444 | len = urb->actual_length; | ||
445 | |||
446 | dev_dbg(ir->dev, "callback called (status=%d len=%d)\n", | ||
447 | urb->status, len); | ||
448 | |||
449 | if (debug) | ||
450 | mceusb_dev_printdata(ir, urb->transfer_buffer, | ||
451 | len, true); | ||
452 | } | ||
453 | |||
454 | } | ||
455 | |||
456 | /* request incoming or send outgoing usb packet - used to initialize remote */ | ||
457 | static void mce_request_packet(struct mceusb_dev *ir, | ||
458 | struct usb_endpoint_descriptor *ep, | ||
459 | unsigned char *data, int size, int urb_type) | ||
460 | { | ||
461 | int res; | ||
462 | struct urb *async_urb; | ||
463 | struct device *dev = ir->dev; | ||
464 | unsigned char *async_buf; | ||
465 | |||
466 | if (urb_type == MCEUSB_TX) { | ||
467 | async_urb = usb_alloc_urb(0, GFP_KERNEL); | ||
468 | if (unlikely(!async_urb)) { | ||
469 | dev_err(dev, "Error, couldn't allocate urb!\n"); | ||
470 | return; | ||
471 | } | ||
472 | |||
473 | async_buf = kzalloc(size, GFP_KERNEL); | ||
474 | if (!async_buf) { | ||
475 | dev_err(dev, "Error, couldn't allocate buf!\n"); | ||
476 | usb_free_urb(async_urb); | ||
477 | return; | ||
478 | } | ||
479 | |||
480 | /* outbound data */ | ||
481 | usb_fill_int_urb(async_urb, ir->usbdev, | ||
482 | usb_sndintpipe(ir->usbdev, ep->bEndpointAddress), | ||
483 | async_buf, size, (usb_complete_t)mce_async_callback, | ||
484 | ir, ep->bInterval); | ||
485 | memcpy(async_buf, data, size); | ||
486 | |||
487 | } else if (urb_type == MCEUSB_RX) { | ||
488 | /* standard request */ | ||
489 | async_urb = ir->urb_in; | ||
490 | ir->send_flags = RECV_FLAG_IN_PROGRESS; | ||
491 | |||
492 | } else { | ||
493 | dev_err(dev, "Error! Unknown urb type %d\n", urb_type); | ||
494 | return; | ||
495 | } | ||
496 | |||
497 | dev_dbg(dev, "receive request called (size=%#x)\n", size); | ||
498 | |||
499 | async_urb->transfer_buffer_length = size; | ||
500 | async_urb->dev = ir->usbdev; | ||
501 | |||
502 | res = usb_submit_urb(async_urb, GFP_ATOMIC); | ||
503 | if (res) { | ||
504 | dev_dbg(dev, "receive request FAILED! (res=%d)\n", res); | ||
505 | return; | ||
506 | } | ||
507 | dev_dbg(dev, "receive request complete (res=%d)\n", res); | ||
508 | } | ||
509 | |||
510 | static void mce_async_out(struct mceusb_dev *ir, unsigned char *data, int size) | ||
511 | { | ||
512 | mce_request_packet(ir, ir->usb_ep_out, data, size, MCEUSB_TX); | ||
513 | } | ||
514 | |||
515 | static void mce_sync_in(struct mceusb_dev *ir, unsigned char *data, int size) | ||
516 | { | ||
517 | mce_request_packet(ir, ir->usb_ep_in, data, size, MCEUSB_RX); | ||
518 | } | ||
519 | |||
520 | /* Send data out the IR blaster port(s) */ | ||
521 | static int mceusb_tx_ir(void *priv, int *txbuf, u32 n) | ||
522 | { | ||
523 | struct mceusb_dev *ir = priv; | ||
524 | int i, ret = 0; | ||
525 | int count, cmdcount = 0; | ||
526 | unsigned char *cmdbuf; /* MCE command buffer */ | ||
527 | long signal_duration = 0; /* Singnal length in us */ | ||
528 | struct timeval start_time, end_time; | ||
529 | |||
530 | do_gettimeofday(&start_time); | ||
531 | |||
532 | count = n / sizeof(int); | ||
533 | |||
534 | cmdbuf = kzalloc(sizeof(int) * MCE_CMDBUF_SIZE, GFP_KERNEL); | ||
535 | if (!cmdbuf) | ||
536 | return -ENOMEM; | ||
537 | |||
538 | /* MCE tx init header */ | ||
539 | cmdbuf[cmdcount++] = MCE_CONTROL_HEADER; | ||
540 | cmdbuf[cmdcount++] = 0x08; | ||
541 | cmdbuf[cmdcount++] = ir->tx_mask; | ||
542 | |||
543 | /* Generate mce packet data */ | ||
544 | for (i = 0; (i < count) && (cmdcount < MCE_CMDBUF_SIZE); i++) { | ||
545 | signal_duration += txbuf[i]; | ||
546 | txbuf[i] = txbuf[i] / MCE_TIME_UNIT; | ||
547 | |||
548 | do { /* loop to support long pulses/spaces > 127*50us=6.35ms */ | ||
549 | |||
550 | /* Insert mce packet header every 4th entry */ | ||
551 | if ((cmdcount < MCE_CMDBUF_SIZE) && | ||
552 | (cmdcount - MCE_TX_HEADER_LENGTH) % | ||
553 | MCE_CODE_LENGTH == 0) | ||
554 | cmdbuf[cmdcount++] = MCE_PACKET_HEADER; | ||
555 | |||
556 | /* Insert mce packet data */ | ||
557 | if (cmdcount < MCE_CMDBUF_SIZE) | ||
558 | cmdbuf[cmdcount++] = | ||
559 | (txbuf[i] < MCE_PULSE_BIT ? | ||
560 | txbuf[i] : MCE_MAX_PULSE_LENGTH) | | ||
561 | (i & 1 ? 0x00 : MCE_PULSE_BIT); | ||
562 | else { | ||
563 | ret = -EINVAL; | ||
564 | goto out; | ||
565 | } | ||
566 | |||
567 | } while ((txbuf[i] > MCE_MAX_PULSE_LENGTH) && | ||
568 | (txbuf[i] -= MCE_MAX_PULSE_LENGTH)); | ||
569 | } | ||
570 | |||
571 | /* Fix packet length in last header */ | ||
572 | cmdbuf[cmdcount - (cmdcount - MCE_TX_HEADER_LENGTH) % MCE_CODE_LENGTH] = | ||
573 | 0x80 + (cmdcount - MCE_TX_HEADER_LENGTH) % MCE_CODE_LENGTH - 1; | ||
574 | |||
575 | /* Check if we have room for the empty packet at the end */ | ||
576 | if (cmdcount >= MCE_CMDBUF_SIZE) { | ||
577 | ret = -EINVAL; | ||
578 | goto out; | ||
579 | } | ||
580 | |||
581 | /* All mce commands end with an empty packet (0x80) */ | ||
582 | cmdbuf[cmdcount++] = 0x80; | ||
583 | |||
584 | /* Transmit the command to the mce device */ | ||
585 | mce_async_out(ir, cmdbuf, cmdcount); | ||
586 | |||
587 | /* | ||
588 | * The lircd gap calculation expects the write function to | ||
589 | * wait the time it takes for the ircommand to be sent before | ||
590 | * it returns. | ||
591 | */ | ||
592 | do_gettimeofday(&end_time); | ||
593 | signal_duration -= (end_time.tv_usec - start_time.tv_usec) + | ||
594 | (end_time.tv_sec - start_time.tv_sec) * 1000000; | ||
595 | |||
596 | /* delay with the closest number of ticks */ | ||
597 | set_current_state(TASK_INTERRUPTIBLE); | ||
598 | schedule_timeout(usecs_to_jiffies(signal_duration)); | ||
599 | |||
600 | out: | ||
601 | kfree(cmdbuf); | ||
602 | return ret ? ret : n; | ||
603 | } | ||
604 | |||
605 | /* Sets active IR outputs -- mce devices typically (all?) have two */ | ||
606 | static int mceusb_set_tx_mask(void *priv, u32 mask) | ||
607 | { | ||
608 | struct mceusb_dev *ir = priv; | ||
609 | |||
610 | if (ir->flags.tx_mask_inverted) | ||
611 | ir->tx_mask = (mask != 0x03 ? mask ^ 0x03 : mask) << 1; | ||
612 | else | ||
613 | ir->tx_mask = mask; | ||
614 | |||
615 | return 0; | ||
616 | } | ||
617 | |||
618 | /* Sets the send carrier frequency and mode */ | ||
619 | static int mceusb_set_tx_carrier(void *priv, u32 carrier) | ||
620 | { | ||
621 | struct mceusb_dev *ir = priv; | ||
622 | int clk = 10000000; | ||
623 | int prescaler = 0, divisor = 0; | ||
624 | unsigned char cmdbuf[4] = { 0x9f, 0x06, 0x00, 0x00 }; | ||
625 | |||
626 | /* Carrier has changed */ | ||
627 | if (ir->carrier != carrier) { | ||
628 | |||
629 | if (carrier == 0) { | ||
630 | ir->carrier = carrier; | ||
631 | cmdbuf[2] = 0x01; | ||
632 | cmdbuf[3] = 0x80; | ||
633 | dev_dbg(ir->dev, "%s: disabling carrier " | ||
634 | "modulation\n", __func__); | ||
635 | mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); | ||
636 | return carrier; | ||
637 | } | ||
638 | |||
639 | for (prescaler = 0; prescaler < 4; ++prescaler) { | ||
640 | divisor = (clk >> (2 * prescaler)) / carrier; | ||
641 | if (divisor <= 0xFF) { | ||
642 | ir->carrier = carrier; | ||
643 | cmdbuf[2] = prescaler; | ||
644 | cmdbuf[3] = divisor; | ||
645 | dev_dbg(ir->dev, "%s: requesting %u HZ " | ||
646 | "carrier\n", __func__, carrier); | ||
647 | |||
648 | /* Transmit new carrier to mce device */ | ||
649 | mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); | ||
650 | return carrier; | ||
651 | } | ||
652 | } | ||
653 | |||
654 | return -EINVAL; | ||
655 | |||
656 | } | ||
657 | |||
658 | return carrier; | ||
659 | } | ||
660 | |||
661 | static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len) | ||
662 | { | ||
663 | struct ir_raw_event rawir = { .pulse = false, .duration = 0 }; | ||
664 | int i, start_index = 0; | ||
665 | u8 hdr = MCE_CONTROL_HEADER; | ||
666 | |||
667 | /* skip meaningless 0xb1 0x60 header bytes on orig receiver */ | ||
668 | if (ir->flags.microsoft_gen1) | ||
669 | start_index = 2; | ||
670 | |||
671 | for (i = start_index; i < buf_len;) { | ||
672 | if (ir->rem == 0) { | ||
673 | /* decode mce packets of the form (84),AA,BB,CC,DD */ | ||
674 | /* IR data packets can span USB messages - rem */ | ||
675 | hdr = ir->buf_in[i]; | ||
676 | ir->rem = (hdr & MCE_PACKET_LENGTH_MASK); | ||
677 | ir->cmd = (hdr & ~MCE_PACKET_LENGTH_MASK); | ||
678 | dev_dbg(ir->dev, "New data. rem: 0x%02x, cmd: 0x%02x\n", | ||
679 | ir->rem, ir->cmd); | ||
680 | i++; | ||
681 | } | ||
682 | |||
683 | /* don't process MCE commands */ | ||
684 | if (hdr == MCE_CONTROL_HEADER || hdr == 0xff) { | ||
685 | ir->rem = 0; | ||
686 | return; | ||
687 | } | ||
688 | |||
689 | for (; (ir->rem > 0) && (i < buf_len); i++) { | ||
690 | ir->rem--; | ||
691 | |||
692 | rawir.pulse = ((ir->buf_in[i] & MCE_PULSE_BIT) != 0); | ||
693 | rawir.duration = (ir->buf_in[i] & MCE_PULSE_MASK) | ||
694 | * MCE_TIME_UNIT * 1000; | ||
695 | |||
696 | if ((ir->buf_in[i] & MCE_PULSE_MASK) == 0x7f) { | ||
697 | if (ir->rawir.pulse == rawir.pulse) | ||
698 | ir->rawir.duration += rawir.duration; | ||
699 | else { | ||
700 | ir->rawir.duration = rawir.duration; | ||
701 | ir->rawir.pulse = rawir.pulse; | ||
702 | } | ||
703 | continue; | ||
704 | } | ||
705 | rawir.duration += ir->rawir.duration; | ||
706 | ir->rawir.duration = 0; | ||
707 | ir->rawir.pulse = rawir.pulse; | ||
708 | |||
709 | dev_dbg(ir->dev, "Storing %s with duration %d\n", | ||
710 | rawir.pulse ? "pulse" : "space", | ||
711 | rawir.duration); | ||
712 | |||
713 | ir_raw_event_store(ir->idev, &rawir); | ||
714 | } | ||
715 | |||
716 | if (ir->buf_in[i] == 0x80 || ir->buf_in[i] == 0x9f) | ||
717 | ir->rem = 0; | ||
718 | |||
719 | dev_dbg(ir->dev, "calling ir_raw_event_handle\n"); | ||
720 | ir_raw_event_handle(ir->idev); | ||
721 | } | ||
722 | } | ||
723 | |||
724 | static void mceusb_dev_recv(struct urb *urb, struct pt_regs *regs) | ||
725 | { | ||
726 | struct mceusb_dev *ir; | ||
727 | int buf_len; | ||
728 | |||
729 | if (!urb) | ||
730 | return; | ||
731 | |||
732 | ir = urb->context; | ||
733 | if (!ir) { | ||
734 | usb_unlink_urb(urb); | ||
735 | return; | ||
736 | } | ||
737 | |||
738 | buf_len = urb->actual_length; | ||
739 | |||
740 | if (debug) | ||
741 | mceusb_dev_printdata(ir, urb->transfer_buffer, buf_len, false); | ||
742 | |||
743 | if (ir->send_flags == RECV_FLAG_IN_PROGRESS) { | ||
744 | ir->send_flags = SEND_FLAG_COMPLETE; | ||
745 | dev_dbg(ir->dev, "setup answer received %d bytes\n", | ||
746 | buf_len); | ||
747 | } | ||
748 | |||
749 | switch (urb->status) { | ||
750 | /* success */ | ||
751 | case 0: | ||
752 | mceusb_process_ir_data(ir, buf_len); | ||
753 | break; | ||
754 | |||
755 | case -ECONNRESET: | ||
756 | case -ENOENT: | ||
757 | case -ESHUTDOWN: | ||
758 | usb_unlink_urb(urb); | ||
759 | return; | ||
760 | |||
761 | case -EPIPE: | ||
762 | default: | ||
763 | break; | ||
764 | } | ||
765 | |||
766 | usb_submit_urb(urb, GFP_ATOMIC); | ||
767 | } | ||
768 | |||
769 | static void mceusb_gen1_init(struct mceusb_dev *ir) | ||
770 | { | ||
771 | int ret; | ||
772 | int maxp = ir->len_in; | ||
773 | struct device *dev = ir->dev; | ||
774 | char *data; | ||
775 | |||
776 | data = kzalloc(USB_CTRL_MSG_SZ, GFP_KERNEL); | ||
777 | if (!data) { | ||
778 | dev_err(dev, "%s: memory allocation failed!\n", __func__); | ||
779 | return; | ||
780 | } | ||
781 | |||
782 | /* | ||
783 | * This is a strange one. Windows issues a set address to the device | ||
784 | * on the receive control pipe and expect a certain value pair back | ||
785 | */ | ||
786 | ret = usb_control_msg(ir->usbdev, usb_rcvctrlpipe(ir->usbdev, 0), | ||
787 | USB_REQ_SET_ADDRESS, USB_TYPE_VENDOR, 0, 0, | ||
788 | data, USB_CTRL_MSG_SZ, HZ * 3); | ||
789 | dev_dbg(dev, "%s - ret = %d\n", __func__, ret); | ||
790 | dev_dbg(dev, "%s - data[0] = %d, data[1] = %d\n", | ||
791 | __func__, data[0], data[1]); | ||
792 | |||
793 | /* set feature: bit rate 38400 bps */ | ||
794 | ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), | ||
795 | USB_REQ_SET_FEATURE, USB_TYPE_VENDOR, | ||
796 | 0xc04e, 0x0000, NULL, 0, HZ * 3); | ||
797 | |||
798 | dev_dbg(dev, "%s - ret = %d\n", __func__, ret); | ||
799 | |||
800 | /* bRequest 4: set char length to 8 bits */ | ||
801 | ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), | ||
802 | 4, USB_TYPE_VENDOR, | ||
803 | 0x0808, 0x0000, NULL, 0, HZ * 3); | ||
804 | dev_dbg(dev, "%s - retB = %d\n", __func__, ret); | ||
805 | |||
806 | /* bRequest 2: set handshaking to use DTR/DSR */ | ||
807 | ret = usb_control_msg(ir->usbdev, usb_sndctrlpipe(ir->usbdev, 0), | ||
808 | 2, USB_TYPE_VENDOR, | ||
809 | 0x0000, 0x0100, NULL, 0, HZ * 3); | ||
810 | dev_dbg(dev, "%s - retC = %d\n", __func__, ret); | ||
811 | |||
812 | /* device reset */ | ||
813 | mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET)); | ||
814 | mce_sync_in(ir, NULL, maxp); | ||
815 | |||
816 | /* get hw/sw revision? */ | ||
817 | mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); | ||
818 | mce_sync_in(ir, NULL, maxp); | ||
819 | |||
820 | kfree(data); | ||
821 | }; | ||
822 | |||
823 | static void mceusb_gen2_init(struct mceusb_dev *ir) | ||
824 | { | ||
825 | int maxp = ir->len_in; | ||
826 | |||
827 | /* device reset */ | ||
828 | mce_async_out(ir, DEVICE_RESET, sizeof(DEVICE_RESET)); | ||
829 | mce_sync_in(ir, NULL, maxp); | ||
830 | |||
831 | /* get hw/sw revision? */ | ||
832 | mce_async_out(ir, GET_REVISION, sizeof(GET_REVISION)); | ||
833 | mce_sync_in(ir, NULL, maxp); | ||
834 | |||
835 | /* unknown what the next two actually return... */ | ||
836 | mce_async_out(ir, GET_UNKNOWN, sizeof(GET_UNKNOWN)); | ||
837 | mce_sync_in(ir, NULL, maxp); | ||
838 | mce_async_out(ir, GET_UNKNOWN2, sizeof(GET_UNKNOWN2)); | ||
839 | mce_sync_in(ir, NULL, maxp); | ||
840 | } | ||
841 | |||
842 | static void mceusb_get_parameters(struct mceusb_dev *ir) | ||
843 | { | ||
844 | int maxp = ir->len_in; | ||
845 | |||
846 | /* get the carrier and frequency */ | ||
847 | mce_async_out(ir, GET_CARRIER_FREQ, sizeof(GET_CARRIER_FREQ)); | ||
848 | mce_sync_in(ir, NULL, maxp); | ||
849 | |||
850 | /* get the transmitter bitmask */ | ||
851 | mce_async_out(ir, GET_TX_BITMASK, sizeof(GET_TX_BITMASK)); | ||
852 | mce_sync_in(ir, NULL, maxp); | ||
853 | |||
854 | /* get receiver timeout value */ | ||
855 | mce_async_out(ir, GET_RX_TIMEOUT, sizeof(GET_RX_TIMEOUT)); | ||
856 | mce_sync_in(ir, NULL, maxp); | ||
857 | |||
858 | /* get receiver sensor setting */ | ||
859 | mce_async_out(ir, GET_RX_SENSOR, sizeof(GET_RX_SENSOR)); | ||
860 | mce_sync_in(ir, NULL, maxp); | ||
861 | } | ||
862 | |||
863 | static struct input_dev *mceusb_init_input_dev(struct mceusb_dev *ir) | ||
864 | { | ||
865 | struct input_dev *idev; | ||
866 | struct ir_dev_props *props; | ||
867 | struct device *dev = ir->dev; | ||
868 | int ret = -ENODEV; | ||
869 | |||
870 | idev = input_allocate_device(); | ||
871 | if (!idev) { | ||
872 | dev_err(dev, "remote input dev allocation failed\n"); | ||
873 | goto idev_alloc_failed; | ||
874 | } | ||
875 | |||
876 | ret = -ENOMEM; | ||
877 | props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); | ||
878 | if (!props) { | ||
879 | dev_err(dev, "remote ir dev props allocation failed\n"); | ||
880 | goto props_alloc_failed; | ||
881 | } | ||
882 | |||
883 | snprintf(ir->name, sizeof(ir->name), "Media Center Ed. eHome " | ||
884 | "Infrared Remote Transceiver (%04x:%04x)", | ||
885 | le16_to_cpu(ir->usbdev->descriptor.idVendor), | ||
886 | le16_to_cpu(ir->usbdev->descriptor.idProduct)); | ||
887 | |||
888 | idev->name = ir->name; | ||
889 | usb_make_path(ir->usbdev, ir->phys, sizeof(ir->phys)); | ||
890 | strlcat(ir->phys, "/input0", sizeof(ir->phys)); | ||
891 | idev->phys = ir->phys; | ||
892 | |||
893 | props->priv = ir; | ||
894 | props->driver_type = RC_DRIVER_IR_RAW; | ||
895 | props->allowed_protos = IR_TYPE_ALL; | ||
896 | props->s_tx_mask = mceusb_set_tx_mask; | ||
897 | props->s_tx_carrier = mceusb_set_tx_carrier; | ||
898 | props->tx_ir = mceusb_tx_ir; | ||
899 | |||
900 | ir->props = props; | ||
901 | |||
902 | ret = ir_input_register(idev, RC_MAP_RC6_MCE, props, DRIVER_NAME); | ||
903 | if (ret < 0) { | ||
904 | dev_err(dev, "remote input device register failed\n"); | ||
905 | goto irdev_failed; | ||
906 | } | ||
907 | |||
908 | return idev; | ||
909 | |||
910 | irdev_failed: | ||
911 | kfree(props); | ||
912 | props_alloc_failed: | ||
913 | input_free_device(idev); | ||
914 | idev_alloc_failed: | ||
915 | return NULL; | ||
916 | } | ||
917 | |||
918 | static int __devinit mceusb_dev_probe(struct usb_interface *intf, | ||
919 | const struct usb_device_id *id) | ||
920 | { | ||
921 | struct usb_device *dev = interface_to_usbdev(intf); | ||
922 | struct usb_host_interface *idesc; | ||
923 | struct usb_endpoint_descriptor *ep = NULL; | ||
924 | struct usb_endpoint_descriptor *ep_in = NULL; | ||
925 | struct usb_endpoint_descriptor *ep_out = NULL; | ||
926 | struct mceusb_dev *ir = NULL; | ||
927 | int pipe, maxp, i; | ||
928 | char buf[63], name[128] = ""; | ||
929 | bool is_gen3; | ||
930 | bool is_microsoft_gen1; | ||
931 | bool tx_mask_inverted; | ||
932 | |||
933 | dev_dbg(&intf->dev, ": %s called\n", __func__); | ||
934 | |||
935 | idesc = intf->cur_altsetting; | ||
936 | |||
937 | is_gen3 = usb_match_id(intf, gen3_list) ? 1 : 0; | ||
938 | is_microsoft_gen1 = usb_match_id(intf, microsoft_gen1_list) ? 1 : 0; | ||
939 | tx_mask_inverted = usb_match_id(intf, std_tx_mask_list) ? 0 : 1; | ||
940 | |||
941 | /* step through the endpoints to find first bulk in and out endpoint */ | ||
942 | for (i = 0; i < idesc->desc.bNumEndpoints; ++i) { | ||
943 | ep = &idesc->endpoint[i].desc; | ||
944 | |||
945 | if ((ep_in == NULL) | ||
946 | && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) | ||
947 | == USB_DIR_IN) | ||
948 | && (((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
949 | == USB_ENDPOINT_XFER_BULK) | ||
950 | || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
951 | == USB_ENDPOINT_XFER_INT))) { | ||
952 | |||
953 | ep_in = ep; | ||
954 | ep_in->bmAttributes = USB_ENDPOINT_XFER_INT; | ||
955 | ep_in->bInterval = 1; | ||
956 | dev_dbg(&intf->dev, ": acceptable inbound endpoint " | ||
957 | "found\n"); | ||
958 | } | ||
959 | |||
960 | if ((ep_out == NULL) | ||
961 | && ((ep->bEndpointAddress & USB_ENDPOINT_DIR_MASK) | ||
962 | == USB_DIR_OUT) | ||
963 | && (((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
964 | == USB_ENDPOINT_XFER_BULK) | ||
965 | || ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
966 | == USB_ENDPOINT_XFER_INT))) { | ||
967 | |||
968 | ep_out = ep; | ||
969 | ep_out->bmAttributes = USB_ENDPOINT_XFER_INT; | ||
970 | ep_out->bInterval = 1; | ||
971 | dev_dbg(&intf->dev, ": acceptable outbound endpoint " | ||
972 | "found\n"); | ||
973 | } | ||
974 | } | ||
975 | if (ep_in == NULL) { | ||
976 | dev_dbg(&intf->dev, ": inbound and/or endpoint not found\n"); | ||
977 | return -ENODEV; | ||
978 | } | ||
979 | |||
980 | pipe = usb_rcvintpipe(dev, ep_in->bEndpointAddress); | ||
981 | maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); | ||
982 | |||
983 | ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL); | ||
984 | if (!ir) | ||
985 | goto mem_alloc_fail; | ||
986 | |||
987 | ir->buf_in = usb_alloc_coherent(dev, maxp, GFP_ATOMIC, &ir->dma_in); | ||
988 | if (!ir->buf_in) | ||
989 | goto buf_in_alloc_fail; | ||
990 | |||
991 | ir->urb_in = usb_alloc_urb(0, GFP_KERNEL); | ||
992 | if (!ir->urb_in) | ||
993 | goto urb_in_alloc_fail; | ||
994 | |||
995 | ir->usbdev = dev; | ||
996 | ir->dev = &intf->dev; | ||
997 | ir->len_in = maxp; | ||
998 | ir->flags.microsoft_gen1 = is_microsoft_gen1; | ||
999 | ir->flags.tx_mask_inverted = tx_mask_inverted; | ||
1000 | |||
1001 | /* Saving usb interface data for use by the transmitter routine */ | ||
1002 | ir->usb_ep_in = ep_in; | ||
1003 | ir->usb_ep_out = ep_out; | ||
1004 | |||
1005 | if (dev->descriptor.iManufacturer | ||
1006 | && usb_string(dev, dev->descriptor.iManufacturer, | ||
1007 | buf, sizeof(buf)) > 0) | ||
1008 | strlcpy(name, buf, sizeof(name)); | ||
1009 | if (dev->descriptor.iProduct | ||
1010 | && usb_string(dev, dev->descriptor.iProduct, | ||
1011 | buf, sizeof(buf)) > 0) | ||
1012 | snprintf(name + strlen(name), sizeof(name) - strlen(name), | ||
1013 | " %s", buf); | ||
1014 | |||
1015 | ir->idev = mceusb_init_input_dev(ir); | ||
1016 | if (!ir->idev) | ||
1017 | goto input_dev_fail; | ||
1018 | |||
1019 | /* flush buffers on the device */ | ||
1020 | mce_sync_in(ir, NULL, maxp); | ||
1021 | mce_sync_in(ir, NULL, maxp); | ||
1022 | |||
1023 | /* wire up inbound data handler */ | ||
1024 | usb_fill_int_urb(ir->urb_in, dev, pipe, ir->buf_in, | ||
1025 | maxp, (usb_complete_t) mceusb_dev_recv, ir, ep_in->bInterval); | ||
1026 | ir->urb_in->transfer_dma = ir->dma_in; | ||
1027 | ir->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
1028 | |||
1029 | /* initialize device */ | ||
1030 | if (ir->flags.microsoft_gen1) | ||
1031 | mceusb_gen1_init(ir); | ||
1032 | else if (!is_gen3) | ||
1033 | mceusb_gen2_init(ir); | ||
1034 | |||
1035 | mceusb_get_parameters(ir); | ||
1036 | |||
1037 | mceusb_set_tx_mask(ir, MCE_DEFAULT_TX_MASK); | ||
1038 | |||
1039 | usb_set_intfdata(intf, ir); | ||
1040 | |||
1041 | dev_info(&intf->dev, "Registered %s on usb%d:%d\n", name, | ||
1042 | dev->bus->busnum, dev->devnum); | ||
1043 | |||
1044 | return 0; | ||
1045 | |||
1046 | /* Error-handling path */ | ||
1047 | input_dev_fail: | ||
1048 | usb_free_urb(ir->urb_in); | ||
1049 | urb_in_alloc_fail: | ||
1050 | usb_free_coherent(dev, maxp, ir->buf_in, ir->dma_in); | ||
1051 | buf_in_alloc_fail: | ||
1052 | kfree(ir); | ||
1053 | mem_alloc_fail: | ||
1054 | dev_err(&intf->dev, "%s: device setup failed!\n", __func__); | ||
1055 | |||
1056 | return -ENOMEM; | ||
1057 | } | ||
1058 | |||
1059 | |||
1060 | static void __devexit mceusb_dev_disconnect(struct usb_interface *intf) | ||
1061 | { | ||
1062 | struct usb_device *dev = interface_to_usbdev(intf); | ||
1063 | struct mceusb_dev *ir = usb_get_intfdata(intf); | ||
1064 | |||
1065 | usb_set_intfdata(intf, NULL); | ||
1066 | |||
1067 | if (!ir) | ||
1068 | return; | ||
1069 | |||
1070 | ir->usbdev = NULL; | ||
1071 | ir_input_unregister(ir->idev); | ||
1072 | usb_kill_urb(ir->urb_in); | ||
1073 | usb_free_urb(ir->urb_in); | ||
1074 | usb_free_coherent(dev, ir->len_in, ir->buf_in, ir->dma_in); | ||
1075 | |||
1076 | kfree(ir); | ||
1077 | } | ||
1078 | |||
1079 | static int mceusb_dev_suspend(struct usb_interface *intf, pm_message_t message) | ||
1080 | { | ||
1081 | struct mceusb_dev *ir = usb_get_intfdata(intf); | ||
1082 | dev_info(ir->dev, "suspend\n"); | ||
1083 | usb_kill_urb(ir->urb_in); | ||
1084 | return 0; | ||
1085 | } | ||
1086 | |||
1087 | static int mceusb_dev_resume(struct usb_interface *intf) | ||
1088 | { | ||
1089 | struct mceusb_dev *ir = usb_get_intfdata(intf); | ||
1090 | dev_info(ir->dev, "resume\n"); | ||
1091 | if (usb_submit_urb(ir->urb_in, GFP_ATOMIC)) | ||
1092 | return -EIO; | ||
1093 | return 0; | ||
1094 | } | ||
1095 | |||
1096 | static struct usb_driver mceusb_dev_driver = { | ||
1097 | .name = DRIVER_NAME, | ||
1098 | .probe = mceusb_dev_probe, | ||
1099 | .disconnect = mceusb_dev_disconnect, | ||
1100 | .suspend = mceusb_dev_suspend, | ||
1101 | .resume = mceusb_dev_resume, | ||
1102 | .reset_resume = mceusb_dev_resume, | ||
1103 | .id_table = mceusb_dev_table | ||
1104 | }; | ||
1105 | |||
1106 | static int __init mceusb_dev_init(void) | ||
1107 | { | ||
1108 | int ret; | ||
1109 | |||
1110 | ret = usb_register(&mceusb_dev_driver); | ||
1111 | if (ret < 0) | ||
1112 | printk(KERN_ERR DRIVER_NAME | ||
1113 | ": usb register failed, result = %d\n", ret); | ||
1114 | |||
1115 | return ret; | ||
1116 | } | ||
1117 | |||
1118 | static void __exit mceusb_dev_exit(void) | ||
1119 | { | ||
1120 | usb_deregister(&mceusb_dev_driver); | ||
1121 | } | ||
1122 | |||
1123 | module_init(mceusb_dev_init); | ||
1124 | module_exit(mceusb_dev_exit); | ||
1125 | |||
1126 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
1127 | MODULE_AUTHOR(DRIVER_AUTHOR); | ||
1128 | MODULE_LICENSE("GPL"); | ||
1129 | MODULE_DEVICE_TABLE(usb, mceusb_dev_table); | ||
1130 | |||
1131 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
1132 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | ||
diff --git a/drivers/media/IR/rc-map.c b/drivers/media/IR/rc-map.c deleted file mode 100644 index 689143f2fff0..000000000000 --- a/drivers/media/IR/rc-map.c +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /* ir-raw-event.c - handle IR Pulse/Space event | ||
2 | * | ||
3 | * Copyright (C) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> | ||
4 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU General Public License as published by | ||
7 | * the Free Software Foundation version 2 of the License. | ||
8 | * | ||
9 | * This program is distributed in the hope that it will be useful, | ||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
12 | * GNU General Public License for more details. | ||
13 | */ | ||
14 | |||
15 | #include <media/ir-core.h> | ||
16 | #include <linux/spinlock.h> | ||
17 | #include <linux/delay.h> | ||
18 | |||
19 | /* Used to handle IR raw handler extensions */ | ||
20 | static LIST_HEAD(rc_map_list); | ||
21 | static DEFINE_SPINLOCK(rc_map_lock); | ||
22 | |||
23 | static struct rc_keymap *seek_rc_map(const char *name) | ||
24 | { | ||
25 | struct rc_keymap *map = NULL; | ||
26 | |||
27 | spin_lock(&rc_map_lock); | ||
28 | list_for_each_entry(map, &rc_map_list, list) { | ||
29 | if (!strcmp(name, map->map.name)) { | ||
30 | spin_unlock(&rc_map_lock); | ||
31 | return map; | ||
32 | } | ||
33 | } | ||
34 | spin_unlock(&rc_map_lock); | ||
35 | |||
36 | return NULL; | ||
37 | } | ||
38 | |||
39 | struct ir_scancode_table *get_rc_map(const char *name) | ||
40 | { | ||
41 | |||
42 | struct rc_keymap *map; | ||
43 | |||
44 | map = seek_rc_map(name); | ||
45 | #ifdef MODULE | ||
46 | if (!map) { | ||
47 | int rc = request_module(name); | ||
48 | if (rc < 0) { | ||
49 | printk(KERN_ERR "Couldn't load IR keymap %s\n", name); | ||
50 | return NULL; | ||
51 | } | ||
52 | msleep(20); /* Give some time for IR to register */ | ||
53 | |||
54 | map = seek_rc_map(name); | ||
55 | } | ||
56 | #endif | ||
57 | if (!map) { | ||
58 | printk(KERN_ERR "IR keymap %s not found\n", name); | ||
59 | return NULL; | ||
60 | } | ||
61 | |||
62 | printk(KERN_INFO "Registered IR keymap %s\n", map->map.name); | ||
63 | |||
64 | return &map->map; | ||
65 | } | ||
66 | EXPORT_SYMBOL_GPL(get_rc_map); | ||
67 | |||
68 | int ir_register_map(struct rc_keymap *map) | ||
69 | { | ||
70 | spin_lock(&rc_map_lock); | ||
71 | list_add_tail(&map->list, &rc_map_list); | ||
72 | spin_unlock(&rc_map_lock); | ||
73 | return 0; | ||
74 | } | ||
75 | EXPORT_SYMBOL_GPL(ir_register_map); | ||
76 | |||
77 | void ir_unregister_map(struct rc_keymap *map) | ||
78 | { | ||
79 | spin_lock(&rc_map_lock); | ||
80 | list_del(&map->list); | ||
81 | spin_unlock(&rc_map_lock); | ||
82 | } | ||
83 | EXPORT_SYMBOL_GPL(ir_unregister_map); | ||
84 | |||
85 | |||
86 | static struct ir_scancode empty[] = { | ||
87 | { 0x2a, KEY_COFFEE }, | ||
88 | }; | ||
89 | |||
90 | static struct rc_keymap empty_map = { | ||
91 | .map = { | ||
92 | .scan = empty, | ||
93 | .size = ARRAY_SIZE(empty), | ||
94 | .ir_type = IR_TYPE_UNKNOWN, /* Legacy IR type */ | ||
95 | .name = RC_MAP_EMPTY, | ||
96 | } | ||
97 | }; | ||
98 | |||
99 | int ir_rcmap_init(void) | ||
100 | { | ||
101 | return ir_register_map(&empty_map); | ||
102 | } | ||
103 | |||
104 | void ir_rcmap_cleanup(void) | ||
105 | { | ||
106 | ir_unregister_map(&empty_map); | ||
107 | } | ||
diff --git a/drivers/media/IR/streamzap.c b/drivers/media/IR/streamzap.c deleted file mode 100644 index 058e29fd478c..000000000000 --- a/drivers/media/IR/streamzap.c +++ /dev/null | |||
@@ -1,741 +0,0 @@ | |||
1 | /* | ||
2 | * Streamzap Remote Control driver | ||
3 | * | ||
4 | * Copyright (c) 2005 Christoph Bartelmus <lirc@bartelmus.de> | ||
5 | * Copyright (c) 2010 Jarod Wilson <jarod@wilsonet.com> | ||
6 | * | ||
7 | * This driver was based on the work of Greg Wickham and Adrian | ||
8 | * Dewhurst. It was substantially rewritten to support correct signal | ||
9 | * gaps and now maintains a delay buffer, which is used to present | ||
10 | * consistent timing behaviour to user space applications. Without the | ||
11 | * delay buffer an ugly hack would be required in lircd, which can | ||
12 | * cause sluggish signal decoding in certain situations. | ||
13 | * | ||
14 | * Ported to in-kernel ir-core interface by Jarod Wilson | ||
15 | * | ||
16 | * This driver is based on the USB skeleton driver packaged with the | ||
17 | * kernel; copyright (C) 2001-2003 Greg Kroah-Hartman (greg@kroah.com) | ||
18 | * | ||
19 | * This program is free software; you can redistribute it and/or modify | ||
20 | * it under the terms of the GNU General Public License as published by | ||
21 | * the Free Software Foundation; either version 2 of the License, or | ||
22 | * (at your option) any later version. | ||
23 | * | ||
24 | * This program is distributed in the hope that it will be useful, | ||
25 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
26 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
27 | * GNU General Public License for more details. | ||
28 | * | ||
29 | * You should have received a copy of the GNU General Public License | ||
30 | * along with this program; if not, write to the Free Software | ||
31 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
32 | */ | ||
33 | |||
34 | #include <linux/device.h> | ||
35 | #include <linux/module.h> | ||
36 | #include <linux/slab.h> | ||
37 | #include <linux/usb.h> | ||
38 | #include <linux/input.h> | ||
39 | #include <media/ir-core.h> | ||
40 | |||
41 | #define DRIVER_VERSION "1.60" | ||
42 | #define DRIVER_NAME "streamzap" | ||
43 | #define DRIVER_DESC "Streamzap Remote Control driver" | ||
44 | |||
45 | #ifdef CONFIG_USB_DEBUG | ||
46 | static int debug = 1; | ||
47 | #else | ||
48 | static int debug; | ||
49 | #endif | ||
50 | |||
51 | #define USB_STREAMZAP_VENDOR_ID 0x0e9c | ||
52 | #define USB_STREAMZAP_PRODUCT_ID 0x0000 | ||
53 | |||
54 | /* table of devices that work with this driver */ | ||
55 | static struct usb_device_id streamzap_table[] = { | ||
56 | /* Streamzap Remote Control */ | ||
57 | { USB_DEVICE(USB_STREAMZAP_VENDOR_ID, USB_STREAMZAP_PRODUCT_ID) }, | ||
58 | /* Terminating entry */ | ||
59 | { } | ||
60 | }; | ||
61 | |||
62 | MODULE_DEVICE_TABLE(usb, streamzap_table); | ||
63 | |||
64 | #define STREAMZAP_PULSE_MASK 0xf0 | ||
65 | #define STREAMZAP_SPACE_MASK 0x0f | ||
66 | #define STREAMZAP_TIMEOUT 0xff | ||
67 | #define STREAMZAP_RESOLUTION 256 | ||
68 | |||
69 | /* number of samples buffered */ | ||
70 | #define SZ_BUF_LEN 128 | ||
71 | |||
72 | enum StreamzapDecoderState { | ||
73 | PulseSpace, | ||
74 | FullPulse, | ||
75 | FullSpace, | ||
76 | IgnorePulse | ||
77 | }; | ||
78 | |||
79 | /* structure to hold our device specific stuff */ | ||
80 | struct streamzap_ir { | ||
81 | |||
82 | /* ir-core */ | ||
83 | struct ir_dev_props *props; | ||
84 | struct ir_raw_event rawir; | ||
85 | |||
86 | /* core device info */ | ||
87 | struct device *dev; | ||
88 | struct input_dev *idev; | ||
89 | |||
90 | /* usb */ | ||
91 | struct usb_device *usbdev; | ||
92 | struct usb_interface *interface; | ||
93 | struct usb_endpoint_descriptor *endpoint; | ||
94 | struct urb *urb_in; | ||
95 | |||
96 | /* buffer & dma */ | ||
97 | unsigned char *buf_in; | ||
98 | dma_addr_t dma_in; | ||
99 | unsigned int buf_in_len; | ||
100 | |||
101 | /* timer used to support delay buffering */ | ||
102 | struct timer_list delay_timer; | ||
103 | bool timer_running; | ||
104 | spinlock_t timer_lock; | ||
105 | struct timer_list flush_timer; | ||
106 | bool flush; | ||
107 | |||
108 | /* delay buffer */ | ||
109 | struct kfifo fifo; | ||
110 | bool fifo_initialized; | ||
111 | |||
112 | /* track what state we're in */ | ||
113 | enum StreamzapDecoderState decoder_state; | ||
114 | /* tracks whether we are currently receiving some signal */ | ||
115 | bool idle; | ||
116 | /* sum of signal lengths received since signal start */ | ||
117 | unsigned long sum; | ||
118 | /* start time of signal; necessary for gap tracking */ | ||
119 | struct timeval signal_last; | ||
120 | struct timeval signal_start; | ||
121 | /* bool timeout_enabled; */ | ||
122 | |||
123 | char name[128]; | ||
124 | char phys[64]; | ||
125 | }; | ||
126 | |||
127 | |||
128 | /* local function prototypes */ | ||
129 | static int streamzap_probe(struct usb_interface *interface, | ||
130 | const struct usb_device_id *id); | ||
131 | static void streamzap_disconnect(struct usb_interface *interface); | ||
132 | static void streamzap_callback(struct urb *urb); | ||
133 | static int streamzap_suspend(struct usb_interface *intf, pm_message_t message); | ||
134 | static int streamzap_resume(struct usb_interface *intf); | ||
135 | |||
136 | /* usb specific object needed to register this driver with the usb subsystem */ | ||
137 | static struct usb_driver streamzap_driver = { | ||
138 | .name = DRIVER_NAME, | ||
139 | .probe = streamzap_probe, | ||
140 | .disconnect = streamzap_disconnect, | ||
141 | .suspend = streamzap_suspend, | ||
142 | .resume = streamzap_resume, | ||
143 | .id_table = streamzap_table, | ||
144 | }; | ||
145 | |||
146 | static void streamzap_stop_timer(struct streamzap_ir *sz) | ||
147 | { | ||
148 | unsigned long flags; | ||
149 | |||
150 | spin_lock_irqsave(&sz->timer_lock, flags); | ||
151 | if (sz->timer_running) { | ||
152 | sz->timer_running = false; | ||
153 | spin_unlock_irqrestore(&sz->timer_lock, flags); | ||
154 | del_timer_sync(&sz->delay_timer); | ||
155 | } else { | ||
156 | spin_unlock_irqrestore(&sz->timer_lock, flags); | ||
157 | } | ||
158 | } | ||
159 | |||
160 | static void streamzap_flush_timeout(unsigned long arg) | ||
161 | { | ||
162 | struct streamzap_ir *sz = (struct streamzap_ir *)arg; | ||
163 | |||
164 | dev_info(sz->dev, "%s: callback firing\n", __func__); | ||
165 | |||
166 | /* finally start accepting data */ | ||
167 | sz->flush = false; | ||
168 | } | ||
169 | |||
170 | static void streamzap_delay_timeout(unsigned long arg) | ||
171 | { | ||
172 | struct streamzap_ir *sz = (struct streamzap_ir *)arg; | ||
173 | struct ir_raw_event rawir = { .pulse = false, .duration = 0 }; | ||
174 | unsigned long flags; | ||
175 | int len, ret; | ||
176 | static unsigned long delay; | ||
177 | bool wake = false; | ||
178 | |||
179 | /* deliver data every 10 ms */ | ||
180 | delay = msecs_to_jiffies(10); | ||
181 | |||
182 | spin_lock_irqsave(&sz->timer_lock, flags); | ||
183 | |||
184 | if (kfifo_len(&sz->fifo) > 0) { | ||
185 | ret = kfifo_out(&sz->fifo, &rawir, sizeof(rawir)); | ||
186 | if (ret != sizeof(rawir)) | ||
187 | dev_err(sz->dev, "Problem w/kfifo_out...\n"); | ||
188 | ir_raw_event_store(sz->idev, &rawir); | ||
189 | wake = true; | ||
190 | } | ||
191 | |||
192 | len = kfifo_len(&sz->fifo); | ||
193 | if (len > 0) { | ||
194 | while ((len < SZ_BUF_LEN / 2) && | ||
195 | (len < SZ_BUF_LEN * sizeof(int))) { | ||
196 | ret = kfifo_out(&sz->fifo, &rawir, sizeof(rawir)); | ||
197 | if (ret != sizeof(rawir)) | ||
198 | dev_err(sz->dev, "Problem w/kfifo_out...\n"); | ||
199 | ir_raw_event_store(sz->idev, &rawir); | ||
200 | wake = true; | ||
201 | len = kfifo_len(&sz->fifo); | ||
202 | } | ||
203 | if (sz->timer_running) | ||
204 | mod_timer(&sz->delay_timer, jiffies + delay); | ||
205 | |||
206 | } else { | ||
207 | sz->timer_running = false; | ||
208 | } | ||
209 | |||
210 | if (wake) | ||
211 | ir_raw_event_handle(sz->idev); | ||
212 | |||
213 | spin_unlock_irqrestore(&sz->timer_lock, flags); | ||
214 | } | ||
215 | |||
216 | static void streamzap_flush_delay_buffer(struct streamzap_ir *sz) | ||
217 | { | ||
218 | struct ir_raw_event rawir = { .pulse = false, .duration = 0 }; | ||
219 | bool wake = false; | ||
220 | int ret; | ||
221 | |||
222 | while (kfifo_len(&sz->fifo) > 0) { | ||
223 | ret = kfifo_out(&sz->fifo, &rawir, sizeof(rawir)); | ||
224 | if (ret != sizeof(rawir)) | ||
225 | dev_err(sz->dev, "Problem w/kfifo_out...\n"); | ||
226 | ir_raw_event_store(sz->idev, &rawir); | ||
227 | wake = true; | ||
228 | } | ||
229 | |||
230 | if (wake) | ||
231 | ir_raw_event_handle(sz->idev); | ||
232 | } | ||
233 | |||
234 | static void sz_push(struct streamzap_ir *sz) | ||
235 | { | ||
236 | struct ir_raw_event rawir = { .pulse = false, .duration = 0 }; | ||
237 | unsigned long flags; | ||
238 | int ret; | ||
239 | |||
240 | spin_lock_irqsave(&sz->timer_lock, flags); | ||
241 | if (kfifo_len(&sz->fifo) >= sizeof(int) * SZ_BUF_LEN) { | ||
242 | ret = kfifo_out(&sz->fifo, &rawir, sizeof(rawir)); | ||
243 | if (ret != sizeof(rawir)) | ||
244 | dev_err(sz->dev, "Problem w/kfifo_out...\n"); | ||
245 | ir_raw_event_store(sz->idev, &rawir); | ||
246 | } | ||
247 | |||
248 | kfifo_in(&sz->fifo, &sz->rawir, sizeof(rawir)); | ||
249 | |||
250 | if (!sz->timer_running) { | ||
251 | sz->delay_timer.expires = jiffies + (HZ / 10); | ||
252 | add_timer(&sz->delay_timer); | ||
253 | sz->timer_running = true; | ||
254 | } | ||
255 | |||
256 | spin_unlock_irqrestore(&sz->timer_lock, flags); | ||
257 | } | ||
258 | |||
259 | static void sz_push_full_pulse(struct streamzap_ir *sz, | ||
260 | unsigned char value) | ||
261 | { | ||
262 | if (sz->idle) { | ||
263 | long deltv; | ||
264 | |||
265 | sz->signal_last = sz->signal_start; | ||
266 | do_gettimeofday(&sz->signal_start); | ||
267 | |||
268 | deltv = sz->signal_start.tv_sec - sz->signal_last.tv_sec; | ||
269 | sz->rawir.pulse = false; | ||
270 | if (deltv > 15) { | ||
271 | /* really long time */ | ||
272 | sz->rawir.duration = IR_MAX_DURATION; | ||
273 | } else { | ||
274 | sz->rawir.duration = (int)(deltv * 1000000 + | ||
275 | sz->signal_start.tv_usec - | ||
276 | sz->signal_last.tv_usec); | ||
277 | sz->rawir.duration -= sz->sum; | ||
278 | sz->rawir.duration *= 1000; | ||
279 | sz->rawir.duration &= IR_MAX_DURATION; | ||
280 | } | ||
281 | dev_dbg(sz->dev, "ls %u\n", sz->rawir.duration); | ||
282 | sz_push(sz); | ||
283 | |||
284 | sz->idle = 0; | ||
285 | sz->sum = 0; | ||
286 | } | ||
287 | |||
288 | sz->rawir.pulse = true; | ||
289 | sz->rawir.duration = ((int) value) * STREAMZAP_RESOLUTION; | ||
290 | sz->rawir.duration += STREAMZAP_RESOLUTION / 2; | ||
291 | sz->sum += sz->rawir.duration; | ||
292 | sz->rawir.duration *= 1000; | ||
293 | sz->rawir.duration &= IR_MAX_DURATION; | ||
294 | dev_dbg(sz->dev, "p %u\n", sz->rawir.duration); | ||
295 | sz_push(sz); | ||
296 | } | ||
297 | |||
298 | static void sz_push_half_pulse(struct streamzap_ir *sz, | ||
299 | unsigned char value) | ||
300 | { | ||
301 | sz_push_full_pulse(sz, (value & STREAMZAP_PULSE_MASK) >> 4); | ||
302 | } | ||
303 | |||
304 | static void sz_push_full_space(struct streamzap_ir *sz, | ||
305 | unsigned char value) | ||
306 | { | ||
307 | sz->rawir.pulse = false; | ||
308 | sz->rawir.duration = ((int) value) * STREAMZAP_RESOLUTION; | ||
309 | sz->rawir.duration += STREAMZAP_RESOLUTION / 2; | ||
310 | sz->sum += sz->rawir.duration; | ||
311 | sz->rawir.duration *= 1000; | ||
312 | dev_dbg(sz->dev, "s %u\n", sz->rawir.duration); | ||
313 | sz_push(sz); | ||
314 | } | ||
315 | |||
316 | static void sz_push_half_space(struct streamzap_ir *sz, | ||
317 | unsigned long value) | ||
318 | { | ||
319 | sz_push_full_space(sz, value & STREAMZAP_SPACE_MASK); | ||
320 | } | ||
321 | |||
322 | /** | ||
323 | * streamzap_callback - usb IRQ handler callback | ||
324 | * | ||
325 | * This procedure is invoked on reception of data from | ||
326 | * the usb remote. | ||
327 | */ | ||
328 | static void streamzap_callback(struct urb *urb) | ||
329 | { | ||
330 | struct streamzap_ir *sz; | ||
331 | unsigned int i; | ||
332 | int len; | ||
333 | #if 0 | ||
334 | static int timeout = (((STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION) & | ||
335 | IR_MAX_DURATION) | 0x03000000); | ||
336 | #endif | ||
337 | |||
338 | if (!urb) | ||
339 | return; | ||
340 | |||
341 | sz = urb->context; | ||
342 | len = urb->actual_length; | ||
343 | |||
344 | switch (urb->status) { | ||
345 | case -ECONNRESET: | ||
346 | case -ENOENT: | ||
347 | case -ESHUTDOWN: | ||
348 | /* | ||
349 | * this urb is terminated, clean up. | ||
350 | * sz might already be invalid at this point | ||
351 | */ | ||
352 | dev_err(sz->dev, "urb terminated, status: %d\n", urb->status); | ||
353 | return; | ||
354 | default: | ||
355 | break; | ||
356 | } | ||
357 | |||
358 | dev_dbg(sz->dev, "%s: received urb, len %d\n", __func__, len); | ||
359 | if (!sz->flush) { | ||
360 | for (i = 0; i < urb->actual_length; i++) { | ||
361 | dev_dbg(sz->dev, "%d: %x\n", i, | ||
362 | (unsigned char)sz->buf_in[i]); | ||
363 | switch (sz->decoder_state) { | ||
364 | case PulseSpace: | ||
365 | if ((sz->buf_in[i] & STREAMZAP_PULSE_MASK) == | ||
366 | STREAMZAP_PULSE_MASK) { | ||
367 | sz->decoder_state = FullPulse; | ||
368 | continue; | ||
369 | } else if ((sz->buf_in[i] & STREAMZAP_SPACE_MASK) | ||
370 | == STREAMZAP_SPACE_MASK) { | ||
371 | sz_push_half_pulse(sz, sz->buf_in[i]); | ||
372 | sz->decoder_state = FullSpace; | ||
373 | continue; | ||
374 | } else { | ||
375 | sz_push_half_pulse(sz, sz->buf_in[i]); | ||
376 | sz_push_half_space(sz, sz->buf_in[i]); | ||
377 | } | ||
378 | break; | ||
379 | case FullPulse: | ||
380 | sz_push_full_pulse(sz, sz->buf_in[i]); | ||
381 | sz->decoder_state = IgnorePulse; | ||
382 | break; | ||
383 | case FullSpace: | ||
384 | if (sz->buf_in[i] == STREAMZAP_TIMEOUT) { | ||
385 | sz->idle = 1; | ||
386 | streamzap_stop_timer(sz); | ||
387 | #if 0 | ||
388 | if (sz->timeout_enabled) { | ||
389 | sz->rawir.pulse = false; | ||
390 | sz->rawir.duration = timeout; | ||
391 | sz->rawir.duration *= 1000; | ||
392 | sz_push(sz); | ||
393 | } | ||
394 | #endif | ||
395 | streamzap_flush_delay_buffer(sz); | ||
396 | } else | ||
397 | sz_push_full_space(sz, sz->buf_in[i]); | ||
398 | sz->decoder_state = PulseSpace; | ||
399 | break; | ||
400 | case IgnorePulse: | ||
401 | if ((sz->buf_in[i]&STREAMZAP_SPACE_MASK) == | ||
402 | STREAMZAP_SPACE_MASK) { | ||
403 | sz->decoder_state = FullSpace; | ||
404 | continue; | ||
405 | } | ||
406 | sz_push_half_space(sz, sz->buf_in[i]); | ||
407 | sz->decoder_state = PulseSpace; | ||
408 | break; | ||
409 | } | ||
410 | } | ||
411 | } | ||
412 | |||
413 | usb_submit_urb(urb, GFP_ATOMIC); | ||
414 | |||
415 | return; | ||
416 | } | ||
417 | |||
418 | static struct input_dev *streamzap_init_input_dev(struct streamzap_ir *sz) | ||
419 | { | ||
420 | struct input_dev *idev; | ||
421 | struct ir_dev_props *props; | ||
422 | struct device *dev = sz->dev; | ||
423 | int ret; | ||
424 | |||
425 | idev = input_allocate_device(); | ||
426 | if (!idev) { | ||
427 | dev_err(dev, "remote input dev allocation failed\n"); | ||
428 | goto idev_alloc_failed; | ||
429 | } | ||
430 | |||
431 | props = kzalloc(sizeof(struct ir_dev_props), GFP_KERNEL); | ||
432 | if (!props) { | ||
433 | dev_err(dev, "remote ir dev props allocation failed\n"); | ||
434 | goto props_alloc_failed; | ||
435 | } | ||
436 | |||
437 | snprintf(sz->name, sizeof(sz->name), "Streamzap PC Remote Infrared " | ||
438 | "Receiver (%04x:%04x)", | ||
439 | le16_to_cpu(sz->usbdev->descriptor.idVendor), | ||
440 | le16_to_cpu(sz->usbdev->descriptor.idProduct)); | ||
441 | |||
442 | idev->name = sz->name; | ||
443 | usb_make_path(sz->usbdev, sz->phys, sizeof(sz->phys)); | ||
444 | strlcat(sz->phys, "/input0", sizeof(sz->phys)); | ||
445 | idev->phys = sz->phys; | ||
446 | |||
447 | props->priv = sz; | ||
448 | props->driver_type = RC_DRIVER_IR_RAW; | ||
449 | /* FIXME: not sure about supported protocols, check on this */ | ||
450 | props->allowed_protos = IR_TYPE_RC5 | IR_TYPE_RC6; | ||
451 | |||
452 | sz->props = props; | ||
453 | |||
454 | ret = ir_input_register(idev, RC_MAP_RC5_STREAMZAP, props, DRIVER_NAME); | ||
455 | if (ret < 0) { | ||
456 | dev_err(dev, "remote input device register failed\n"); | ||
457 | goto irdev_failed; | ||
458 | } | ||
459 | |||
460 | return idev; | ||
461 | |||
462 | irdev_failed: | ||
463 | kfree(props); | ||
464 | props_alloc_failed: | ||
465 | input_free_device(idev); | ||
466 | idev_alloc_failed: | ||
467 | return NULL; | ||
468 | } | ||
469 | |||
470 | static int streamzap_delay_buf_init(struct streamzap_ir *sz) | ||
471 | { | ||
472 | int ret; | ||
473 | |||
474 | ret = kfifo_alloc(&sz->fifo, sizeof(int) * SZ_BUF_LEN, | ||
475 | GFP_KERNEL); | ||
476 | if (ret == 0) | ||
477 | sz->fifo_initialized = 1; | ||
478 | |||
479 | return ret; | ||
480 | } | ||
481 | |||
482 | static void streamzap_start_flush_timer(struct streamzap_ir *sz) | ||
483 | { | ||
484 | sz->flush_timer.expires = jiffies + HZ; | ||
485 | sz->flush = true; | ||
486 | add_timer(&sz->flush_timer); | ||
487 | |||
488 | sz->urb_in->dev = sz->usbdev; | ||
489 | if (usb_submit_urb(sz->urb_in, GFP_ATOMIC)) | ||
490 | dev_err(sz->dev, "urb submit failed\n"); | ||
491 | } | ||
492 | |||
493 | /** | ||
494 | * streamzap_probe | ||
495 | * | ||
496 | * Called by usb-core to associated with a candidate device | ||
497 | * On any failure the return value is the ERROR | ||
498 | * On success return 0 | ||
499 | */ | ||
500 | static int __devinit streamzap_probe(struct usb_interface *intf, | ||
501 | const struct usb_device_id *id) | ||
502 | { | ||
503 | struct usb_device *usbdev = interface_to_usbdev(intf); | ||
504 | struct usb_host_interface *iface_host; | ||
505 | struct streamzap_ir *sz = NULL; | ||
506 | char buf[63], name[128] = ""; | ||
507 | int retval = -ENOMEM; | ||
508 | int pipe, maxp; | ||
509 | |||
510 | /* Allocate space for device driver specific data */ | ||
511 | sz = kzalloc(sizeof(struct streamzap_ir), GFP_KERNEL); | ||
512 | if (!sz) | ||
513 | return -ENOMEM; | ||
514 | |||
515 | sz->usbdev = usbdev; | ||
516 | sz->interface = intf; | ||
517 | |||
518 | /* Check to ensure endpoint information matches requirements */ | ||
519 | iface_host = intf->cur_altsetting; | ||
520 | |||
521 | if (iface_host->desc.bNumEndpoints != 1) { | ||
522 | dev_err(&intf->dev, "%s: Unexpected desc.bNumEndpoints (%d)\n", | ||
523 | __func__, iface_host->desc.bNumEndpoints); | ||
524 | retval = -ENODEV; | ||
525 | goto free_sz; | ||
526 | } | ||
527 | |||
528 | sz->endpoint = &(iface_host->endpoint[0].desc); | ||
529 | if ((sz->endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) | ||
530 | != USB_DIR_IN) { | ||
531 | dev_err(&intf->dev, "%s: endpoint doesn't match input device " | ||
532 | "02%02x\n", __func__, sz->endpoint->bEndpointAddress); | ||
533 | retval = -ENODEV; | ||
534 | goto free_sz; | ||
535 | } | ||
536 | |||
537 | if ((sz->endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | ||
538 | != USB_ENDPOINT_XFER_INT) { | ||
539 | dev_err(&intf->dev, "%s: endpoint attributes don't match xfer " | ||
540 | "02%02x\n", __func__, sz->endpoint->bmAttributes); | ||
541 | retval = -ENODEV; | ||
542 | goto free_sz; | ||
543 | } | ||
544 | |||
545 | pipe = usb_rcvintpipe(usbdev, sz->endpoint->bEndpointAddress); | ||
546 | maxp = usb_maxpacket(usbdev, pipe, usb_pipeout(pipe)); | ||
547 | |||
548 | if (maxp == 0) { | ||
549 | dev_err(&intf->dev, "%s: endpoint Max Packet Size is 0!?!\n", | ||
550 | __func__); | ||
551 | retval = -ENODEV; | ||
552 | goto free_sz; | ||
553 | } | ||
554 | |||
555 | /* Allocate the USB buffer and IRQ URB */ | ||
556 | sz->buf_in = usb_alloc_coherent(usbdev, maxp, GFP_ATOMIC, &sz->dma_in); | ||
557 | if (!sz->buf_in) | ||
558 | goto free_sz; | ||
559 | |||
560 | sz->urb_in = usb_alloc_urb(0, GFP_KERNEL); | ||
561 | if (!sz->urb_in) | ||
562 | goto free_buf_in; | ||
563 | |||
564 | sz->dev = &intf->dev; | ||
565 | sz->buf_in_len = maxp; | ||
566 | |||
567 | if (usbdev->descriptor.iManufacturer | ||
568 | && usb_string(usbdev, usbdev->descriptor.iManufacturer, | ||
569 | buf, sizeof(buf)) > 0) | ||
570 | strlcpy(name, buf, sizeof(name)); | ||
571 | |||
572 | if (usbdev->descriptor.iProduct | ||
573 | && usb_string(usbdev, usbdev->descriptor.iProduct, | ||
574 | buf, sizeof(buf)) > 0) | ||
575 | snprintf(name + strlen(name), sizeof(name) - strlen(name), | ||
576 | " %s", buf); | ||
577 | |||
578 | retval = streamzap_delay_buf_init(sz); | ||
579 | if (retval) { | ||
580 | dev_err(&intf->dev, "%s: delay buffer init failed\n", __func__); | ||
581 | goto free_urb_in; | ||
582 | } | ||
583 | |||
584 | sz->idev = streamzap_init_input_dev(sz); | ||
585 | if (!sz->idev) | ||
586 | goto input_dev_fail; | ||
587 | |||
588 | sz->idle = true; | ||
589 | sz->decoder_state = PulseSpace; | ||
590 | #if 0 | ||
591 | /* not yet supported, depends on patches from maxim */ | ||
592 | /* see also: LIRC_GET_REC_RESOLUTION and LIRC_SET_REC_TIMEOUT */ | ||
593 | sz->timeout_enabled = false; | ||
594 | sz->min_timeout = STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION * 1000; | ||
595 | sz->max_timeout = STREAMZAP_TIMEOUT * STREAMZAP_RESOLUTION * 1000; | ||
596 | #endif | ||
597 | |||
598 | init_timer(&sz->delay_timer); | ||
599 | sz->delay_timer.function = streamzap_delay_timeout; | ||
600 | sz->delay_timer.data = (unsigned long)sz; | ||
601 | spin_lock_init(&sz->timer_lock); | ||
602 | |||
603 | init_timer(&sz->flush_timer); | ||
604 | sz->flush_timer.function = streamzap_flush_timeout; | ||
605 | sz->flush_timer.data = (unsigned long)sz; | ||
606 | |||
607 | do_gettimeofday(&sz->signal_start); | ||
608 | |||
609 | /* Complete final initialisations */ | ||
610 | usb_fill_int_urb(sz->urb_in, usbdev, pipe, sz->buf_in, | ||
611 | maxp, (usb_complete_t)streamzap_callback, | ||
612 | sz, sz->endpoint->bInterval); | ||
613 | sz->urb_in->transfer_dma = sz->dma_in; | ||
614 | sz->urb_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; | ||
615 | |||
616 | usb_set_intfdata(intf, sz); | ||
617 | |||
618 | streamzap_start_flush_timer(sz); | ||
619 | |||
620 | dev_info(sz->dev, "Registered %s on usb%d:%d\n", name, | ||
621 | usbdev->bus->busnum, usbdev->devnum); | ||
622 | |||
623 | return 0; | ||
624 | |||
625 | input_dev_fail: | ||
626 | kfifo_free(&sz->fifo); | ||
627 | free_urb_in: | ||
628 | usb_free_urb(sz->urb_in); | ||
629 | free_buf_in: | ||
630 | usb_free_coherent(usbdev, maxp, sz->buf_in, sz->dma_in); | ||
631 | free_sz: | ||
632 | kfree(sz); | ||
633 | |||
634 | return retval; | ||
635 | } | ||
636 | |||
637 | /** | ||
638 | * streamzap_disconnect | ||
639 | * | ||
640 | * Called by the usb core when the device is removed from the system. | ||
641 | * | ||
642 | * This routine guarantees that the driver will not submit any more urbs | ||
643 | * by clearing dev->usbdev. It is also supposed to terminate any currently | ||
644 | * active urbs. Unfortunately, usb_bulk_msg(), used in streamzap_read(), | ||
645 | * does not provide any way to do this. | ||
646 | */ | ||
647 | static void streamzap_disconnect(struct usb_interface *interface) | ||
648 | { | ||
649 | struct streamzap_ir *sz = usb_get_intfdata(interface); | ||
650 | struct usb_device *usbdev = interface_to_usbdev(interface); | ||
651 | |||
652 | usb_set_intfdata(interface, NULL); | ||
653 | |||
654 | if (!sz) | ||
655 | return; | ||
656 | |||
657 | if (sz->flush) { | ||
658 | sz->flush = false; | ||
659 | del_timer_sync(&sz->flush_timer); | ||
660 | } | ||
661 | |||
662 | streamzap_stop_timer(sz); | ||
663 | |||
664 | sz->usbdev = NULL; | ||
665 | ir_input_unregister(sz->idev); | ||
666 | usb_kill_urb(sz->urb_in); | ||
667 | usb_free_urb(sz->urb_in); | ||
668 | usb_free_coherent(usbdev, sz->buf_in_len, sz->buf_in, sz->dma_in); | ||
669 | |||
670 | kfree(sz); | ||
671 | } | ||
672 | |||
673 | static int streamzap_suspend(struct usb_interface *intf, pm_message_t message) | ||
674 | { | ||
675 | struct streamzap_ir *sz = usb_get_intfdata(intf); | ||
676 | |||
677 | if (sz->flush) { | ||
678 | sz->flush = false; | ||
679 | del_timer_sync(&sz->flush_timer); | ||
680 | } | ||
681 | |||
682 | streamzap_stop_timer(sz); | ||
683 | |||
684 | usb_kill_urb(sz->urb_in); | ||
685 | |||
686 | return 0; | ||
687 | } | ||
688 | |||
689 | static int streamzap_resume(struct usb_interface *intf) | ||
690 | { | ||
691 | struct streamzap_ir *sz = usb_get_intfdata(intf); | ||
692 | |||
693 | if (sz->fifo_initialized) | ||
694 | kfifo_reset(&sz->fifo); | ||
695 | |||
696 | sz->flush_timer.expires = jiffies + HZ; | ||
697 | sz->flush = true; | ||
698 | add_timer(&sz->flush_timer); | ||
699 | |||
700 | if (usb_submit_urb(sz->urb_in, GFP_ATOMIC)) { | ||
701 | dev_err(sz->dev, "Error sumbiting urb\n"); | ||
702 | return -EIO; | ||
703 | } | ||
704 | |||
705 | return 0; | ||
706 | } | ||
707 | |||
708 | /** | ||
709 | * streamzap_init | ||
710 | */ | ||
711 | static int __init streamzap_init(void) | ||
712 | { | ||
713 | int ret; | ||
714 | |||
715 | /* register this driver with the USB subsystem */ | ||
716 | ret = usb_register(&streamzap_driver); | ||
717 | if (ret < 0) | ||
718 | printk(KERN_ERR DRIVER_NAME ": usb register failed, " | ||
719 | "result = %d\n", ret); | ||
720 | |||
721 | return ret; | ||
722 | } | ||
723 | |||
724 | /** | ||
725 | * streamzap_exit | ||
726 | */ | ||
727 | static void __exit streamzap_exit(void) | ||
728 | { | ||
729 | usb_deregister(&streamzap_driver); | ||
730 | } | ||
731 | |||
732 | |||
733 | module_init(streamzap_init); | ||
734 | module_exit(streamzap_exit); | ||
735 | |||
736 | MODULE_AUTHOR("Jarod Wilson <jarod@wilsonet.com>"); | ||
737 | MODULE_DESCRIPTION(DRIVER_DESC); | ||
738 | MODULE_LICENSE("GPL"); | ||
739 | |||
740 | module_param(debug, bool, S_IRUGO | S_IWUSR); | ||
741 | MODULE_PARM_DESC(debug, "Enable debugging messages"); | ||