aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/rc
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-24 12:50:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-24 12:50:13 -0400
commit76d21c563569bcea6bc67d65cc2c460cff643058 (patch)
tree4dd2c9846ea7838077099646418978e354df1680 /drivers/media/rc
parent6e50e9f9f4a8277b4d76de417ca77cf3921bd524 (diff)
parent472af2b05bdefcaee7e754e22cbf131110017ad6 (diff)
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6: (442 commits) [media] videobuf2-dma-contig: make cookie() return a pointer to dma_addr_t [media] sh_mobile_ceu_camera: Do not call vb2's mem_ops directly [media] V4L: soc-camera: explicitly require V4L2_BUF_TYPE_VIDEO_CAPTURE [media] v4l: soc-camera: Store negotiated buffer settings [media] rc: interim support for 32-bit NEC-ish scancodes [media] mceusb: topseed 0x0011 needs gen3 init for tx to work [media] lirc_zilog: error out if buffer read bytes != chunk size [media] lirc: silence some compile warnings [media] hdpvr: use same polling interval as other OS [media] ir-kbd-i2c: pass device code w/key in hauppauge case [media] rc/keymaps: Remove the obsolete rc-rc5-tv keymap [media] remove the old RC_MAP_HAUPPAUGE_NEW RC map [media] rc/keymaps: Rename Hauppauge table as rc-hauppauge [media] rc-rc5-hauppauge-new: Fix Hauppauge Grey mapping [media] rc-rc5-hauppauge-new: Add support for the old Black RC [media] rc-rc5-hauppauge-new: Add the old control to the table [media] rc-winfast: Fix the keycode tables [media] a800: Fix a few wrong IR key assignments [media] opera1: Use multimedia keys instead of an app-specific mapping [media] dw2102: Use multimedia keys instead of an app-specific mapping ... Fix up trivial conflicts (remove/modify and some real conflicts) in: arch/arm/mach-omap2/devices.c drivers/staging/Kconfig drivers/staging/Makefile drivers/staging/dabusb/dabusb.c drivers/staging/dabusb/dabusb.h drivers/staging/easycap/easycap_ioctl.c drivers/staging/usbvideo/usbvideo.c drivers/staging/usbvideo/vicam.c
Diffstat (limited to 'drivers/media/rc')
-rw-r--r--drivers/media/rc/Kconfig35
-rw-r--r--drivers/media/rc/Makefile1
-rw-r--r--drivers/media/rc/imon.c11
-rw-r--r--drivers/media/rc/ir-nec-decoder.c10
-rw-r--r--drivers/media/rc/ite-cir.c1736
-rw-r--r--drivers/media/rc/ite-cir.h481
-rw-r--r--drivers/media/rc/keymaps/Makefile6
-rw-r--r--drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c6
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-dvbt.c4
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-m135a.c2
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c2
-rw-r--r--drivers/media/rc/keymaps/rc-avermedia-rm-ks.c2
-rw-r--r--drivers/media/rc/keymaps/rc-behold-columbus.c2
-rw-r--r--drivers/media/rc/keymaps/rc-behold.c2
-rw-r--r--drivers/media/rc/keymaps/rc-budget-ci-old.c3
-rw-r--r--drivers/media/rc/keymaps/rc-cinergy.c2
-rw-r--r--drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c2
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv.c4
-rw-r--r--drivers/media/rc/keymaps/rc-encore-enltv2.c2
-rw-r--r--drivers/media/rc/keymaps/rc-flydvb.c4
-rw-r--r--drivers/media/rc/keymaps/rc-hauppauge-new.c100
-rw-r--r--drivers/media/rc/keymaps/rc-hauppauge.c (renamed from drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c)190
-rw-r--r--drivers/media/rc/keymaps/rc-imon-mce.c2
-rw-r--r--drivers/media/rc/keymaps/rc-imon-pad.c2
-rw-r--r--drivers/media/rc/keymaps/rc-kworld-315u.c2
-rw-r--r--drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c2
-rw-r--r--drivers/media/rc/keymaps/rc-lme2510.c96
-rw-r--r--drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c2
-rw-r--r--drivers/media/rc/keymaps/rc-nebula.c2
-rw-r--r--drivers/media/rc/keymaps/rc-norwood.c2
-rw-r--r--drivers/media/rc/keymaps/rc-pctv-sedna.c2
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview-mk12.c2
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview-new.c2
-rw-r--r--drivers/media/rc/keymaps/rc-pixelview.c2
-rw-r--r--drivers/media/rc/keymaps/rc-pv951.c4
-rw-r--r--drivers/media/rc/keymaps/rc-rc5-tv.c81
-rw-r--r--drivers/media/rc/keymaps/rc-rc6-mce.c2
-rw-r--r--drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c2
-rw-r--r--drivers/media/rc/keymaps/rc-technisat-usb2.c93
-rw-r--r--drivers/media/rc/keymaps/rc-terratec-slim-2.c72
-rw-r--r--drivers/media/rc/keymaps/rc-winfast.c22
-rw-r--r--drivers/media/rc/mceusb.c4
42 files changed, 2689 insertions, 316 deletions
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index 3785162f928e..7f03142a329f 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -135,6 +135,19 @@ config IR_MCEUSB
135 To compile this driver as a module, choose M here: the 135 To compile this driver as a module, choose M here: the
136 module will be called mceusb. 136 module will be called mceusb.
137 137
138config IR_ITE_CIR
139 tristate "ITE Tech Inc. IT8712/IT8512 Consumer Infrared Transceiver"
140 depends on PNP
141 depends on RC_CORE
142 ---help---
143 Say Y here to enable support for integrated infrared receivers
144 /transceivers made by ITE Tech Inc. These are found in
145 several ASUS devices, like the ASUS Digimatrix or the ASUS
146 EEEBox 1501U.
147
148 To compile this driver as a module, choose M here: the
149 module will be called ite-cir.
150
138config IR_NUVOTON 151config IR_NUVOTON
139 tristate "Nuvoton w836x7hg Consumer Infrared Transceiver" 152 tristate "Nuvoton w836x7hg Consumer Infrared Transceiver"
140 depends on PNP 153 depends on PNP
@@ -161,20 +174,20 @@ config IR_STREAMZAP
161 module will be called streamzap. 174 module will be called streamzap.
162 175
163config IR_WINBOND_CIR 176config IR_WINBOND_CIR
164 tristate "Winbond IR remote control" 177 tristate "Winbond IR remote control"
165 depends on X86 && PNP 178 depends on X86 && PNP
166 depends on RC_CORE 179 depends on RC_CORE
167 select NEW_LEDS 180 select NEW_LEDS
168 select LEDS_CLASS 181 select LEDS_CLASS
169 select LEDS_TRIGGERS 182 select LEDS_TRIGGERS
170 select BITREVERSE 183 select BITREVERSE
171 ---help--- 184 ---help---
172 Say Y here if you want to use the IR remote functionality found 185 Say Y here if you want to use the IR remote functionality found
173 in some Winbond SuperI/O chips. Currently only the WPCD376I 186 in some Winbond SuperI/O chips. Currently only the WPCD376I
174 chip is supported (included in some Intel Media series 187 chip is supported (included in some Intel Media series
175 motherboards). 188 motherboards).
176 189
177 To compile this driver as a module, choose M here: the module will 190 To compile this driver as a module, choose M here: the module will
178 be called winbond_cir. 191 be called winbond_cir.
179 192
180config RC_LOOPBACK 193config RC_LOOPBACK
diff --git a/drivers/media/rc/Makefile b/drivers/media/rc/Makefile
index 67b4f7fe2577..c6cfe70d862f 100644
--- a/drivers/media/rc/Makefile
+++ b/drivers/media/rc/Makefile
@@ -14,6 +14,7 @@ obj-$(CONFIG_IR_LIRC_CODEC) += ir-lirc-codec.o
14 14
15# stand-alone IR receivers/transmitters 15# stand-alone IR receivers/transmitters
16obj-$(CONFIG_IR_IMON) += imon.o 16obj-$(CONFIG_IR_IMON) += imon.o
17obj-$(CONFIG_IR_ITE_CIR) += ite-cir.o
17obj-$(CONFIG_IR_MCEUSB) += mceusb.o 18obj-$(CONFIG_IR_MCEUSB) += mceusb.o
18obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o 19obj-$(CONFIG_IR_NUVOTON) += nuvoton-cir.o
19obj-$(CONFIG_IR_ENE) += ene_ir.o 20obj-$(CONFIG_IR_ENE) += ene_ir.o
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index e7dc6b46fdfa..f714e1a22c92 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -277,12 +277,21 @@ static const struct {
277 u64 hw_code; 277 u64 hw_code;
278 u32 keycode; 278 u32 keycode;
279} imon_panel_key_table[] = { 279} imon_panel_key_table[] = {
280 { 0x000000000f00ffeell, KEY_PROG1 }, /* Go */ 280 { 0x000000000f00ffeell, KEY_MEDIA }, /* Go */
281 { 0x000000001200ffeell, KEY_UP },
282 { 0x000000001300ffeell, KEY_DOWN },
283 { 0x000000001400ffeell, KEY_LEFT },
284 { 0x000000001500ffeell, KEY_RIGHT },
285 { 0x000000001600ffeell, KEY_ENTER },
286 { 0x000000001700ffeell, KEY_ESC },
281 { 0x000000001f00ffeell, KEY_AUDIO }, 287 { 0x000000001f00ffeell, KEY_AUDIO },
282 { 0x000000002000ffeell, KEY_VIDEO }, 288 { 0x000000002000ffeell, KEY_VIDEO },
283 { 0x000000002100ffeell, KEY_CAMERA }, 289 { 0x000000002100ffeell, KEY_CAMERA },
284 { 0x000000002700ffeell, KEY_DVD }, 290 { 0x000000002700ffeell, KEY_DVD },
285 { 0x000000002300ffeell, KEY_TV }, 291 { 0x000000002300ffeell, KEY_TV },
292 { 0x000000002b00ffeell, KEY_EXIT },
293 { 0x000000002c00ffeell, KEY_SELECT },
294 { 0x000000002d00ffeell, KEY_MENU },
286 { 0x000000000500ffeell, KEY_PREVIOUS }, 295 { 0x000000000500ffeell, KEY_PREVIOUS },
287 { 0x000000000700ffeell, KEY_REWIND }, 296 { 0x000000000700ffeell, KEY_REWIND },
288 { 0x000000000400ffeell, KEY_STOP }, 297 { 0x000000000400ffeell, KEY_STOP },
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
index 7b58b4a1729b..63ee722dbd02 100644
--- a/drivers/media/rc/ir-nec-decoder.c
+++ b/drivers/media/rc/ir-nec-decoder.c
@@ -49,6 +49,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
49 struct nec_dec *data = &dev->raw->nec; 49 struct nec_dec *data = &dev->raw->nec;
50 u32 scancode; 50 u32 scancode;
51 u8 address, not_address, command, not_command; 51 u8 address, not_address, command, not_command;
52 bool send_32bits = false;
52 53
53 if (!(dev->raw->enabled_protocols & RC_TYPE_NEC)) 54 if (!(dev->raw->enabled_protocols & RC_TYPE_NEC))
54 return 0; 55 return 0;
@@ -164,10 +165,15 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
164 if ((command ^ not_command) != 0xff) { 165 if ((command ^ not_command) != 0xff) {
165 IR_dprintk(1, "NEC checksum error: received 0x%08x\n", 166 IR_dprintk(1, "NEC checksum error: received 0x%08x\n",
166 data->bits); 167 data->bits);
167 break; 168 send_32bits = true;
168 } 169 }
169 170
170 if ((address ^ not_address) != 0xff) { 171 if (send_32bits) {
172 /* NEC transport, but modified protocol, used by at
173 * least Apple and TiVo remotes */
174 scancode = data->bits;
175 IR_dprintk(1, "NEC (modified) scancode 0x%08x\n", scancode);
176 } else if ((address ^ not_address) != 0xff) {
171 /* Extended NEC */ 177 /* Extended NEC */
172 scancode = address << 16 | 178 scancode = address << 16 |
173 not_address << 8 | 179 not_address << 8 |
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
new file mode 100644
index 000000000000..9be6a830f1d2
--- /dev/null
+++ b/drivers/media/rc/ite-cir.c
@@ -0,0 +1,1736 @@
1/*
2 * Driver for ITE Tech Inc. IT8712F/IT8512 CIR
3 *
4 * Copyright (C) 2010 Juan Jesús García de Soria <skandalfo@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 * Inspired by the original lirc_it87 and lirc_ite8709 drivers, on top of the
22 * skeleton provided by the nuvoton-cir driver.
23 *
24 * The lirc_it87 driver was originally written by Hans-Gunter Lutke Uphues
25 * <hg_lu@web.de> in 2001, with enhancements by Christoph Bartelmus
26 * <lirc@bartelmus.de>, Andrew Calkin <r_tay@hotmail.com> and James Edwards
27 * <jimbo-lirc@edwardsclan.net>.
28 *
29 * The lirc_ite8709 driver was written by Grégory Lardière
30 * <spmf2004-lirc@yahoo.fr> in 2008.
31 */
32
33#include <linux/kernel.h>
34#include <linux/module.h>
35#include <linux/pnp.h>
36#include <linux/io.h>
37#include <linux/interrupt.h>
38#include <linux/sched.h>
39#include <linux/slab.h>
40#include <linux/input.h>
41#include <linux/bitops.h>
42#include <media/rc-core.h>
43#include <linux/pci_ids.h>
44
45#include "ite-cir.h"
46
47/* module parameters */
48
49/* debug level */
50static int debug;
51module_param(debug, int, S_IRUGO | S_IWUSR);
52MODULE_PARM_DESC(debug, "Enable debugging output");
53
54/* low limit for RX carrier freq, Hz, 0 for no RX demodulation */
55static int rx_low_carrier_freq;
56module_param(rx_low_carrier_freq, int, S_IRUGO | S_IWUSR);
57MODULE_PARM_DESC(rx_low_carrier_freq, "Override low RX carrier frequency, Hz, "
58 "0 for no RX demodulation");
59
60/* high limit for RX carrier freq, Hz, 0 for no RX demodulation */
61static int rx_high_carrier_freq;
62module_param(rx_high_carrier_freq, int, S_IRUGO | S_IWUSR);
63MODULE_PARM_DESC(rx_high_carrier_freq, "Override high RX carrier frequency, "
64 "Hz, 0 for no RX demodulation");
65
66/* override tx carrier frequency */
67static int tx_carrier_freq;
68module_param(tx_carrier_freq, int, S_IRUGO | S_IWUSR);
69MODULE_PARM_DESC(tx_carrier_freq, "Override TX carrier frequency, Hz");
70
71/* override tx duty cycle */
72static int tx_duty_cycle;
73module_param(tx_duty_cycle, int, S_IRUGO | S_IWUSR);
74MODULE_PARM_DESC(tx_duty_cycle, "Override TX duty cycle, 1-100");
75
76/* override default sample period */
77static long sample_period;
78module_param(sample_period, long, S_IRUGO | S_IWUSR);
79MODULE_PARM_DESC(sample_period, "Override carrier sample period, us");
80
81/* override detected model id */
82static int model_number = -1;
83module_param(model_number, int, S_IRUGO | S_IWUSR);
84MODULE_PARM_DESC(model_number, "Use this model number, don't autodetect");
85
86
87/* HW-independent code functions */
88
89/* check whether carrier frequency is high frequency */
90static inline bool ite_is_high_carrier_freq(unsigned int freq)
91{
92 return freq >= ITE_HCF_MIN_CARRIER_FREQ;
93}
94
95/* get the bits required to program the carrier frequency in CFQ bits,
96 * unshifted */
97static u8 ite_get_carrier_freq_bits(unsigned int freq)
98{
99 if (ite_is_high_carrier_freq(freq)) {
100 if (freq < 425000)
101 return ITE_CFQ_400;
102
103 else if (freq < 465000)
104 return ITE_CFQ_450;
105
106 else if (freq < 490000)
107 return ITE_CFQ_480;
108
109 else
110 return ITE_CFQ_500;
111 } else {
112 /* trim to limits */
113 if (freq < ITE_LCF_MIN_CARRIER_FREQ)
114 freq = ITE_LCF_MIN_CARRIER_FREQ;
115 if (freq > ITE_LCF_MAX_CARRIER_FREQ)
116 freq = ITE_LCF_MAX_CARRIER_FREQ;
117
118 /* convert to kHz and subtract the base freq */
119 freq =
120 DIV_ROUND_CLOSEST(freq - ITE_LCF_MIN_CARRIER_FREQ,
121 1000);
122
123 return (u8) freq;
124 }
125}
126
127/* get the bits required to program the pulse with in TXMPW */
128static u8 ite_get_pulse_width_bits(unsigned int freq, int duty_cycle)
129{
130 unsigned long period_ns, on_ns;
131
132 /* sanitize freq into range */
133 if (freq < ITE_LCF_MIN_CARRIER_FREQ)
134 freq = ITE_LCF_MIN_CARRIER_FREQ;
135 if (freq > ITE_HCF_MAX_CARRIER_FREQ)
136 freq = ITE_HCF_MAX_CARRIER_FREQ;
137
138 period_ns = 1000000000UL / freq;
139 on_ns = period_ns * duty_cycle / 100;
140
141 if (ite_is_high_carrier_freq(freq)) {
142 if (on_ns < 750)
143 return ITE_TXMPW_A;
144
145 else if (on_ns < 850)
146 return ITE_TXMPW_B;
147
148 else if (on_ns < 950)
149 return ITE_TXMPW_C;
150
151 else if (on_ns < 1080)
152 return ITE_TXMPW_D;
153
154 else
155 return ITE_TXMPW_E;
156 } else {
157 if (on_ns < 6500)
158 return ITE_TXMPW_A;
159
160 else if (on_ns < 7850)
161 return ITE_TXMPW_B;
162
163 else if (on_ns < 9650)
164 return ITE_TXMPW_C;
165
166 else if (on_ns < 11950)
167 return ITE_TXMPW_D;
168
169 else
170 return ITE_TXMPW_E;
171 }
172}
173
174/* decode raw bytes as received by the hardware, and push them to the ir-core
175 * layer */
176static void ite_decode_bytes(struct ite_dev *dev, const u8 * data, int
177 length)
178{
179 u32 sample_period;
180 unsigned long *ldata;
181 unsigned int next_one, next_zero, size;
182 DEFINE_IR_RAW_EVENT(ev);
183
184 if (length == 0)
185 return;
186
187 sample_period = dev->params.sample_period;
188 ldata = (unsigned long *)data;
189 size = length << 3;
190 next_one = generic_find_next_le_bit(ldata, size, 0);
191 if (next_one > 0) {
192 ev.pulse = true;
193 ev.duration =
194 ITE_BITS_TO_NS(next_one, sample_period);
195 ir_raw_event_store_with_filter(dev->rdev, &ev);
196 }
197
198 while (next_one < size) {
199 next_zero = generic_find_next_zero_le_bit(ldata, size, next_one + 1);
200 ev.pulse = false;
201 ev.duration = ITE_BITS_TO_NS(next_zero - next_one, sample_period);
202 ir_raw_event_store_with_filter(dev->rdev, &ev);
203
204 if (next_zero < size) {
205 next_one =
206 generic_find_next_le_bit(ldata,
207 size,
208 next_zero + 1);
209 ev.pulse = true;
210 ev.duration =
211 ITE_BITS_TO_NS(next_one - next_zero,
212 sample_period);
213 ir_raw_event_store_with_filter
214 (dev->rdev, &ev);
215 } else
216 next_one = size;
217 }
218
219 ir_raw_event_handle(dev->rdev);
220
221 ite_dbg_verbose("decoded %d bytes.", length);
222}
223
224/* set all the rx/tx carrier parameters; this must be called with the device
225 * spinlock held */
226static void ite_set_carrier_params(struct ite_dev *dev)
227{
228 unsigned int freq, low_freq, high_freq;
229 int allowance;
230 bool use_demodulator;
231 bool for_tx = dev->transmitting;
232
233 ite_dbg("%s called", __func__);
234
235 if (for_tx) {
236 /* we don't need no stinking calculations */
237 freq = dev->params.tx_carrier_freq;
238 allowance = ITE_RXDCR_DEFAULT;
239 use_demodulator = false;
240 } else {
241 low_freq = dev->params.rx_low_carrier_freq;
242 high_freq = dev->params.rx_high_carrier_freq;
243
244 if (low_freq == 0) {
245 /* don't demodulate */
246 freq =
247 ITE_DEFAULT_CARRIER_FREQ;
248 allowance = ITE_RXDCR_DEFAULT;
249 use_demodulator = false;
250 } else {
251 /* calculate the middle freq */
252 freq = (low_freq + high_freq) / 2;
253
254 /* calculate the allowance */
255 allowance =
256 DIV_ROUND_CLOSEST(10000 * (high_freq - low_freq),
257 ITE_RXDCR_PER_10000_STEP
258 * (high_freq + low_freq));
259
260 if (allowance < 1)
261 allowance = 1;
262
263 if (allowance > ITE_RXDCR_MAX)
264 allowance = ITE_RXDCR_MAX;
265 }
266 }
267
268 /* set the carrier parameters in a device-dependent way */
269 dev->params.set_carrier_params(dev, ite_is_high_carrier_freq(freq),
270 use_demodulator, ite_get_carrier_freq_bits(freq), allowance,
271 ite_get_pulse_width_bits(freq, dev->params.tx_duty_cycle));
272}
273
274/* interrupt service routine for incoming and outgoing CIR data */
275static irqreturn_t ite_cir_isr(int irq, void *data)
276{
277 struct ite_dev *dev = data;
278 unsigned long flags;
279 irqreturn_t ret = IRQ_RETVAL(IRQ_NONE);
280 u8 rx_buf[ITE_RX_FIFO_LEN];
281 int rx_bytes;
282 int iflags;
283
284 ite_dbg_verbose("%s firing", __func__);
285
286 /* grab the spinlock */
287 spin_lock_irqsave(&dev->lock, flags);
288
289 /* read the interrupt flags */
290 iflags = dev->params.get_irq_causes(dev);
291
292 /* check for the receive interrupt */
293 if (iflags & (ITE_IRQ_RX_FIFO | ITE_IRQ_RX_FIFO_OVERRUN)) {
294 /* read the FIFO bytes */
295 rx_bytes =
296 dev->params.get_rx_bytes(dev, rx_buf,
297 ITE_RX_FIFO_LEN);
298
299 if (rx_bytes > 0) {
300 /* drop the spinlock, since the ir-core layer
301 * may call us back again through
302 * ite_s_idle() */
303 spin_unlock_irqrestore(&dev->
304 lock,
305 flags);
306
307 /* decode the data we've just received */
308 ite_decode_bytes(dev, rx_buf,
309 rx_bytes);
310
311 /* reacquire the spinlock */
312 spin_lock_irqsave(&dev->lock,
313 flags);
314
315 /* mark the interrupt as serviced */
316 ret = IRQ_RETVAL(IRQ_HANDLED);
317 }
318 } else if (iflags & ITE_IRQ_TX_FIFO) {
319 /* FIFO space available interrupt */
320 ite_dbg_verbose("got interrupt for TX FIFO");
321
322 /* wake any sleeping transmitter */
323 wake_up_interruptible(&dev->tx_queue);
324
325 /* mark the interrupt as serviced */
326 ret = IRQ_RETVAL(IRQ_HANDLED);
327 }
328
329 /* drop the spinlock */
330 spin_unlock_irqrestore(&dev->lock, flags);
331
332 ite_dbg_verbose("%s done returning %d", __func__, (int)ret);
333
334 return ret;
335}
336
337/* set the rx carrier freq range, guess it's in Hz... */
338static int ite_set_rx_carrier_range(struct rc_dev *rcdev, u32 carrier_low, u32
339 carrier_high)
340{
341 unsigned long flags;
342 struct ite_dev *dev = rcdev->priv;
343
344 spin_lock_irqsave(&dev->lock, flags);
345 dev->params.rx_low_carrier_freq = carrier_low;
346 dev->params.rx_high_carrier_freq = carrier_high;
347 ite_set_carrier_params(dev);
348 spin_unlock_irqrestore(&dev->lock, flags);
349
350 return 0;
351}
352
353/* set the tx carrier freq, guess it's in Hz... */
354static int ite_set_tx_carrier(struct rc_dev *rcdev, u32 carrier)
355{
356 unsigned long flags;
357 struct ite_dev *dev = rcdev->priv;
358
359 spin_lock_irqsave(&dev->lock, flags);
360 dev->params.tx_carrier_freq = carrier;
361 ite_set_carrier_params(dev);
362 spin_unlock_irqrestore(&dev->lock, flags);
363
364 return 0;
365}
366
367/* set the tx duty cycle by controlling the pulse width */
368static int ite_set_tx_duty_cycle(struct rc_dev *rcdev, u32 duty_cycle)
369{
370 unsigned long flags;
371 struct ite_dev *dev = rcdev->priv;
372
373 spin_lock_irqsave(&dev->lock, flags);
374 dev->params.tx_duty_cycle = duty_cycle;
375 ite_set_carrier_params(dev);
376 spin_unlock_irqrestore(&dev->lock, flags);
377
378 return 0;
379}
380
381/* transmit out IR pulses; what you get here is a batch of alternating
382 * pulse/space/pulse/space lengths that we should write out completely through
383 * the FIFO, blocking on a full FIFO */
384static int ite_tx_ir(struct rc_dev *rcdev, int *txbuf, u32 n)
385{
386 unsigned long flags;
387 struct ite_dev *dev = rcdev->priv;
388 bool is_pulse = false;
389 int remaining_us, fifo_avail, fifo_remaining, last_idx = 0;
390 int max_rle_us, next_rle_us;
391 int ret = n;
392 u8 last_sent[ITE_TX_FIFO_LEN];
393 u8 val;
394
395 ite_dbg("%s called", __func__);
396
397 /* clear the array just in case */
398 memset(last_sent, 0, ARRAY_SIZE(last_sent));
399
400 /* n comes in bytes; convert to ints */
401 n /= sizeof(int);
402
403 spin_lock_irqsave(&dev->lock, flags);
404
405 /* let everybody know we're now transmitting */
406 dev->transmitting = true;
407
408 /* and set the carrier values for transmission */
409 ite_set_carrier_params(dev);
410
411 /* calculate how much time we can send in one byte */
412 max_rle_us =
413 (ITE_BAUDRATE_DIVISOR * dev->params.sample_period *
414 ITE_TX_MAX_RLE) / 1000;
415
416 /* disable the receiver */
417 dev->params.disable_rx(dev);
418
419 /* this is where we'll begin filling in the FIFO, until it's full.
420 * then we'll just activate the interrupt, wait for it to wake us up
421 * again, disable it, continue filling the FIFO... until everything
422 * has been pushed out */
423 fifo_avail =
424 ITE_TX_FIFO_LEN - dev->params.get_tx_used_slots(dev);
425
426 while (n > 0 && dev->in_use) {
427 /* transmit the next sample */
428 is_pulse = !is_pulse;
429 remaining_us = *(txbuf++);
430 n--;
431
432 ite_dbg("%s: %ld",
433 ((is_pulse) ? "pulse" : "space"),
434 (long int)
435 remaining_us);
436
437 /* repeat while the pulse is non-zero length */
438 while (remaining_us > 0 && dev->in_use) {
439 if (remaining_us > max_rle_us)
440 next_rle_us = max_rle_us;
441
442 else
443 next_rle_us = remaining_us;
444
445 remaining_us -= next_rle_us;
446
447 /* check what's the length we have to pump out */
448 val = (ITE_TX_MAX_RLE * next_rle_us) / max_rle_us;
449
450 /* put it into the sent buffer */
451 last_sent[last_idx++] = val;
452 last_idx &= (ITE_TX_FIFO_LEN);
453
454 /* encode it for 7 bits */
455 val = (val - 1) & ITE_TX_RLE_MASK;
456
457 /* take into account pulse/space prefix */
458 if (is_pulse)
459 val |= ITE_TX_PULSE;
460
461 else
462 val |= ITE_TX_SPACE;
463
464 /*
465 * if we get to 0 available, read again, just in case
466 * some other slot got freed
467 */
468 if (fifo_avail <= 0)
469 fifo_avail = ITE_TX_FIFO_LEN - dev->params.get_tx_used_slots(dev);
470
471 /* if it's still full */
472 if (fifo_avail <= 0) {
473 /* enable the tx interrupt */
474 dev->params.
475 enable_tx_interrupt(dev);
476
477 /* drop the spinlock */
478 spin_unlock_irqrestore(&dev->lock, flags);
479
480 /* wait for the FIFO to empty enough */
481 wait_event_interruptible(dev->tx_queue, (fifo_avail = ITE_TX_FIFO_LEN - dev->params.get_tx_used_slots(dev)) >= 8);
482
483 /* get the spinlock again */
484 spin_lock_irqsave(&dev->lock, flags);
485
486 /* disable the tx interrupt again. */
487 dev->params.
488 disable_tx_interrupt(dev);
489 }
490
491 /* now send the byte through the FIFO */
492 dev->params.put_tx_byte(dev, val);
493 fifo_avail--;
494 }
495 }
496
497 /* wait and don't return until the whole FIFO has been sent out;
498 * otherwise we could configure the RX carrier params instead of the
499 * TX ones while the transmission is still being performed! */
500 fifo_remaining = dev->params.get_tx_used_slots(dev);
501 remaining_us = 0;
502 while (fifo_remaining > 0) {
503 fifo_remaining--;
504 last_idx--;
505 last_idx &= (ITE_TX_FIFO_LEN - 1);
506 remaining_us += last_sent[last_idx];
507 }
508 remaining_us = (remaining_us * max_rle_us) / (ITE_TX_MAX_RLE);
509
510 /* drop the spinlock while we sleep */
511 spin_unlock_irqrestore(&dev->lock, flags);
512
513 /* sleep remaining_us microseconds */
514 mdelay(DIV_ROUND_UP(remaining_us, 1000));
515
516 /* reacquire the spinlock */
517 spin_lock_irqsave(&dev->lock, flags);
518
519 /* now we're not transmitting anymore */
520 dev->transmitting = false;
521
522 /* and set the carrier values for reception */
523 ite_set_carrier_params(dev);
524
525 /* reenable the receiver */
526 if (dev->in_use)
527 dev->params.enable_rx(dev);
528
529 /* notify transmission end */
530 wake_up_interruptible(&dev->tx_ended);
531
532 spin_unlock_irqrestore(&dev->lock, flags);
533
534 return ret;
535}
536
537/* idle the receiver if needed */
538static void ite_s_idle(struct rc_dev *rcdev, bool enable)
539{
540 unsigned long flags;
541 struct ite_dev *dev = rcdev->priv;
542
543 ite_dbg("%s called", __func__);
544
545 if (enable) {
546 spin_lock_irqsave(&dev->lock, flags);
547 dev->params.idle_rx(dev);
548 spin_unlock_irqrestore(&dev->lock, flags);
549 }
550}
551
552
553/* IT8712F HW-specific functions */
554
555/* retrieve a bitmask of the current causes for a pending interrupt; this may
556 * be composed of ITE_IRQ_TX_FIFO, ITE_IRQ_RX_FIFO and ITE_IRQ_RX_FIFO_OVERRUN
557 * */
558static int it87_get_irq_causes(struct ite_dev *dev)
559{
560 u8 iflags;
561 int ret = 0;
562
563 ite_dbg("%s called", __func__);
564
565 /* read the interrupt flags */
566 iflags = inb(dev->cir_addr + IT87_IIR) & IT87_II;
567
568 switch (iflags) {
569 case IT87_II_RXDS:
570 ret = ITE_IRQ_RX_FIFO;
571 break;
572 case IT87_II_RXFO:
573 ret = ITE_IRQ_RX_FIFO_OVERRUN;
574 break;
575 case IT87_II_TXLDL:
576 ret = ITE_IRQ_TX_FIFO;
577 break;
578 }
579
580 return ret;
581}
582
583/* set the carrier parameters; to be called with the spinlock held */
584static void it87_set_carrier_params(struct ite_dev *dev, bool high_freq,
585 bool use_demodulator,
586 u8 carrier_freq_bits, u8 allowance_bits,
587 u8 pulse_width_bits)
588{
589 u8 val;
590
591 ite_dbg("%s called", __func__);
592
593 /* program the RCR register */
594 val = inb(dev->cir_addr + IT87_RCR)
595 & ~(IT87_HCFS | IT87_RXEND | IT87_RXDCR);
596
597 if (high_freq)
598 val |= IT87_HCFS;
599
600 if (use_demodulator)
601 val |= IT87_RXEND;
602
603 val |= allowance_bits;
604
605 outb(val, dev->cir_addr + IT87_RCR);
606
607 /* program the TCR2 register */
608 outb((carrier_freq_bits << IT87_CFQ_SHIFT) | pulse_width_bits,
609 dev->cir_addr + IT87_TCR2);
610}
611
612/* read up to buf_size bytes from the RX FIFO; to be called with the spinlock
613 * held */
614static int it87_get_rx_bytes(struct ite_dev *dev, u8 * buf, int buf_size)
615{
616 int fifo, read = 0;
617
618 ite_dbg("%s called", __func__);
619
620 /* read how many bytes are still in the FIFO */
621 fifo = inb(dev->cir_addr + IT87_RSR) & IT87_RXFBC;
622
623 while (fifo > 0 && buf_size > 0) {
624 *(buf++) = inb(dev->cir_addr + IT87_DR);
625 fifo--;
626 read++;
627 buf_size--;
628 }
629
630 return read;
631}
632
633/* return how many bytes are still in the FIFO; this will be called
634 * with the device spinlock NOT HELD while waiting for the TX FIFO to get
635 * empty; let's expect this won't be a problem */
636static int it87_get_tx_used_slots(struct ite_dev *dev)
637{
638 ite_dbg("%s called", __func__);
639
640 return inb(dev->cir_addr + IT87_TSR) & IT87_TXFBC;
641}
642
643/* put a byte to the TX fifo; this should be called with the spinlock held */
644static void it87_put_tx_byte(struct ite_dev *dev, u8 value)
645{
646 outb(value, dev->cir_addr + IT87_DR);
647}
648
649/* idle the receiver so that we won't receive samples until another
650 pulse is detected; this must be called with the device spinlock held */
651static void it87_idle_rx(struct ite_dev *dev)
652{
653 ite_dbg("%s called", __func__);
654
655 /* disable streaming by clearing RXACT writing it as 1 */
656 outb(inb(dev->cir_addr + IT87_RCR) | IT87_RXACT,
657 dev->cir_addr + IT87_RCR);
658
659 /* clear the FIFO */
660 outb(inb(dev->cir_addr + IT87_TCR1) | IT87_FIFOCLR,
661 dev->cir_addr + IT87_TCR1);
662}
663
664/* disable the receiver; this must be called with the device spinlock held */
665static void it87_disable_rx(struct ite_dev *dev)
666{
667 ite_dbg("%s called", __func__);
668
669 /* disable the receiver interrupts */
670 outb(inb(dev->cir_addr + IT87_IER) & ~(IT87_RDAIE | IT87_RFOIE),
671 dev->cir_addr + IT87_IER);
672
673 /* disable the receiver */
674 outb(inb(dev->cir_addr + IT87_RCR) & ~IT87_RXEN,
675 dev->cir_addr + IT87_RCR);
676
677 /* clear the FIFO and RXACT (actually RXACT should have been cleared
678 * in the previous outb() call) */
679 it87_idle_rx(dev);
680}
681
682/* enable the receiver; this must be called with the device spinlock held */
683static void it87_enable_rx(struct ite_dev *dev)
684{
685 ite_dbg("%s called", __func__);
686
687 /* enable the receiver by setting RXEN */
688 outb(inb(dev->cir_addr + IT87_RCR) | IT87_RXEN,
689 dev->cir_addr + IT87_RCR);
690
691 /* just prepare it to idle for the next reception */
692 it87_idle_rx(dev);
693
694 /* enable the receiver interrupts and master enable flag */
695 outb(inb(dev->cir_addr + IT87_IER) | IT87_RDAIE | IT87_RFOIE | IT87_IEC,
696 dev->cir_addr + IT87_IER);
697}
698
699/* disable the transmitter interrupt; this must be called with the device
700 * spinlock held */
701static void it87_disable_tx_interrupt(struct ite_dev *dev)
702{
703 ite_dbg("%s called", __func__);
704
705 /* disable the transmitter interrupts */
706 outb(inb(dev->cir_addr + IT87_IER) & ~IT87_TLDLIE,
707 dev->cir_addr + IT87_IER);
708}
709
710/* enable the transmitter interrupt; this must be called with the device
711 * spinlock held */
712static void it87_enable_tx_interrupt(struct ite_dev *dev)
713{
714 ite_dbg("%s called", __func__);
715
716 /* enable the transmitter interrupts and master enable flag */
717 outb(inb(dev->cir_addr + IT87_IER) | IT87_TLDLIE | IT87_IEC,
718 dev->cir_addr + IT87_IER);
719}
720
721/* disable the device; this must be called with the device spinlock held */
722static void it87_disable(struct ite_dev *dev)
723{
724 ite_dbg("%s called", __func__);
725
726 /* clear out all interrupt enable flags */
727 outb(inb(dev->cir_addr + IT87_IER) &
728 ~(IT87_IEC | IT87_RFOIE | IT87_RDAIE | IT87_TLDLIE),
729 dev->cir_addr + IT87_IER);
730
731 /* disable the receiver */
732 it87_disable_rx(dev);
733
734 /* erase the FIFO */
735 outb(IT87_FIFOCLR | inb(dev->cir_addr + IT87_TCR1),
736 dev->cir_addr + IT87_TCR1);
737}
738
739/* initialize the hardware */
740static void it87_init_hardware(struct ite_dev *dev)
741{
742 ite_dbg("%s called", __func__);
743
744 /* enable just the baud rate divisor register,
745 disabling all the interrupts at the same time */
746 outb((inb(dev->cir_addr + IT87_IER) &
747 ~(IT87_IEC | IT87_RFOIE | IT87_RDAIE | IT87_TLDLIE)) | IT87_BR,
748 dev->cir_addr + IT87_IER);
749
750 /* write out the baud rate divisor */
751 outb(ITE_BAUDRATE_DIVISOR & 0xff, dev->cir_addr + IT87_BDLR);
752 outb((ITE_BAUDRATE_DIVISOR >> 8) & 0xff, dev->cir_addr + IT87_BDHR);
753
754 /* disable the baud rate divisor register again */
755 outb(inb(dev->cir_addr + IT87_IER) & ~IT87_BR,
756 dev->cir_addr + IT87_IER);
757
758 /* program the RCR register defaults */
759 outb(ITE_RXDCR_DEFAULT, dev->cir_addr + IT87_RCR);
760
761 /* program the TCR1 register */
762 outb(IT87_TXMPM_DEFAULT | IT87_TXENDF | IT87_TXRLE
763 | IT87_FIFOTL_DEFAULT | IT87_FIFOCLR,
764 dev->cir_addr + IT87_TCR1);
765
766 /* program the carrier parameters */
767 ite_set_carrier_params(dev);
768}
769
770/* IT8512F on ITE8708 HW-specific functions */
771
772/* retrieve a bitmask of the current causes for a pending interrupt; this may
773 * be composed of ITE_IRQ_TX_FIFO, ITE_IRQ_RX_FIFO and ITE_IRQ_RX_FIFO_OVERRUN
774 * */
775static int it8708_get_irq_causes(struct ite_dev *dev)
776{
777 u8 iflags;
778 int ret = 0;
779
780 ite_dbg("%s called", __func__);
781
782 /* read the interrupt flags */
783 iflags = inb(dev->cir_addr + IT8708_C0IIR);
784
785 if (iflags & IT85_TLDLI)
786 ret |= ITE_IRQ_TX_FIFO;
787 if (iflags & IT85_RDAI)
788 ret |= ITE_IRQ_RX_FIFO;
789 if (iflags & IT85_RFOI)
790 ret |= ITE_IRQ_RX_FIFO_OVERRUN;
791
792 return ret;
793}
794
795/* set the carrier parameters; to be called with the spinlock held */
796static void it8708_set_carrier_params(struct ite_dev *dev, bool high_freq,
797 bool use_demodulator,
798 u8 carrier_freq_bits, u8 allowance_bits,
799 u8 pulse_width_bits)
800{
801 u8 val;
802
803 ite_dbg("%s called", __func__);
804
805 /* program the C0CFR register, with HRAE=1 */
806 outb(inb(dev->cir_addr + IT8708_BANKSEL) | IT8708_HRAE,
807 dev->cir_addr + IT8708_BANKSEL);
808
809 val = (inb(dev->cir_addr + IT8708_C0CFR)
810 & ~(IT85_HCFS | IT85_CFQ)) | carrier_freq_bits;
811
812 if (high_freq)
813 val |= IT85_HCFS;
814
815 outb(val, dev->cir_addr + IT8708_C0CFR);
816
817 outb(inb(dev->cir_addr + IT8708_BANKSEL) & ~IT8708_HRAE,
818 dev->cir_addr + IT8708_BANKSEL);
819
820 /* program the C0RCR register */
821 val = inb(dev->cir_addr + IT8708_C0RCR)
822 & ~(IT85_RXEND | IT85_RXDCR);
823
824 if (use_demodulator)
825 val |= IT85_RXEND;
826
827 val |= allowance_bits;
828
829 outb(val, dev->cir_addr + IT8708_C0RCR);
830
831 /* program the C0TCR register */
832 val = inb(dev->cir_addr + IT8708_C0TCR) & ~IT85_TXMPW;
833 val |= pulse_width_bits;
834 outb(val, dev->cir_addr + IT8708_C0TCR);
835}
836
837/* read up to buf_size bytes from the RX FIFO; to be called with the spinlock
838 * held */
839static int it8708_get_rx_bytes(struct ite_dev *dev, u8 * buf, int buf_size)
840{
841 int fifo, read = 0;
842
843 ite_dbg("%s called", __func__);
844
845 /* read how many bytes are still in the FIFO */
846 fifo = inb(dev->cir_addr + IT8708_C0RFSR) & IT85_RXFBC;
847
848 while (fifo > 0 && buf_size > 0) {
849 *(buf++) = inb(dev->cir_addr + IT8708_C0DR);
850 fifo--;
851 read++;
852 buf_size--;
853 }
854
855 return read;
856}
857
858/* return how many bytes are still in the FIFO; this will be called
859 * with the device spinlock NOT HELD while waiting for the TX FIFO to get
860 * empty; let's expect this won't be a problem */
861static int it8708_get_tx_used_slots(struct ite_dev *dev)
862{
863 ite_dbg("%s called", __func__);
864
865 return inb(dev->cir_addr + IT8708_C0TFSR) & IT85_TXFBC;
866}
867
868/* put a byte to the TX fifo; this should be called with the spinlock held */
869static void it8708_put_tx_byte(struct ite_dev *dev, u8 value)
870{
871 outb(value, dev->cir_addr + IT8708_C0DR);
872}
873
874/* idle the receiver so that we won't receive samples until another
875 pulse is detected; this must be called with the device spinlock held */
876static void it8708_idle_rx(struct ite_dev *dev)
877{
878 ite_dbg("%s called", __func__);
879
880 /* disable streaming by clearing RXACT writing it as 1 */
881 outb(inb(dev->cir_addr + IT8708_C0RCR) | IT85_RXACT,
882 dev->cir_addr + IT8708_C0RCR);
883
884 /* clear the FIFO */
885 outb(inb(dev->cir_addr + IT8708_C0MSTCR) | IT85_FIFOCLR,
886 dev->cir_addr + IT8708_C0MSTCR);
887}
888
889/* disable the receiver; this must be called with the device spinlock held */
890static void it8708_disable_rx(struct ite_dev *dev)
891{
892 ite_dbg("%s called", __func__);
893
894 /* disable the receiver interrupts */
895 outb(inb(dev->cir_addr + IT8708_C0IER) &
896 ~(IT85_RDAIE | IT85_RFOIE),
897 dev->cir_addr + IT8708_C0IER);
898
899 /* disable the receiver */
900 outb(inb(dev->cir_addr + IT8708_C0RCR) & ~IT85_RXEN,
901 dev->cir_addr + IT8708_C0RCR);
902
903 /* clear the FIFO and RXACT (actually RXACT should have been cleared
904 * in the previous outb() call) */
905 it8708_idle_rx(dev);
906}
907
908/* enable the receiver; this must be called with the device spinlock held */
909static void it8708_enable_rx(struct ite_dev *dev)
910{
911 ite_dbg("%s called", __func__);
912
913 /* enable the receiver by setting RXEN */
914 outb(inb(dev->cir_addr + IT8708_C0RCR) | IT85_RXEN,
915 dev->cir_addr + IT8708_C0RCR);
916
917 /* just prepare it to idle for the next reception */
918 it8708_idle_rx(dev);
919
920 /* enable the receiver interrupts and master enable flag */
921 outb(inb(dev->cir_addr + IT8708_C0IER)
922 |IT85_RDAIE | IT85_RFOIE | IT85_IEC,
923 dev->cir_addr + IT8708_C0IER);
924}
925
926/* disable the transmitter interrupt; this must be called with the device
927 * spinlock held */
928static void it8708_disable_tx_interrupt(struct ite_dev *dev)
929{
930 ite_dbg("%s called", __func__);
931
932 /* disable the transmitter interrupts */
933 outb(inb(dev->cir_addr + IT8708_C0IER) & ~IT85_TLDLIE,
934 dev->cir_addr + IT8708_C0IER);
935}
936
937/* enable the transmitter interrupt; this must be called with the device
938 * spinlock held */
939static void it8708_enable_tx_interrupt(struct ite_dev *dev)
940{
941 ite_dbg("%s called", __func__);
942
943 /* enable the transmitter interrupts and master enable flag */
944 outb(inb(dev->cir_addr + IT8708_C0IER)
945 |IT85_TLDLIE | IT85_IEC,
946 dev->cir_addr + IT8708_C0IER);
947}
948
949/* disable the device; this must be called with the device spinlock held */
950static void it8708_disable(struct ite_dev *dev)
951{
952 ite_dbg("%s called", __func__);
953
954 /* clear out all interrupt enable flags */
955 outb(inb(dev->cir_addr + IT8708_C0IER) &
956 ~(IT85_IEC | IT85_RFOIE | IT85_RDAIE | IT85_TLDLIE),
957 dev->cir_addr + IT8708_C0IER);
958
959 /* disable the receiver */
960 it8708_disable_rx(dev);
961
962 /* erase the FIFO */
963 outb(IT85_FIFOCLR | inb(dev->cir_addr + IT8708_C0MSTCR),
964 dev->cir_addr + IT8708_C0MSTCR);
965}
966
967/* initialize the hardware */
968static void it8708_init_hardware(struct ite_dev *dev)
969{
970 ite_dbg("%s called", __func__);
971
972 /* disable all the interrupts */
973 outb(inb(dev->cir_addr + IT8708_C0IER) &
974 ~(IT85_IEC | IT85_RFOIE | IT85_RDAIE | IT85_TLDLIE),
975 dev->cir_addr + IT8708_C0IER);
976
977 /* program the baud rate divisor */
978 outb(inb(dev->cir_addr + IT8708_BANKSEL) | IT8708_HRAE,
979 dev->cir_addr + IT8708_BANKSEL);
980
981 outb(ITE_BAUDRATE_DIVISOR & 0xff, dev->cir_addr + IT8708_C0BDLR);
982 outb((ITE_BAUDRATE_DIVISOR >> 8) & 0xff,
983 dev->cir_addr + IT8708_C0BDHR);
984
985 outb(inb(dev->cir_addr + IT8708_BANKSEL) & ~IT8708_HRAE,
986 dev->cir_addr + IT8708_BANKSEL);
987
988 /* program the C0MSTCR register defaults */
989 outb((inb(dev->cir_addr + IT8708_C0MSTCR) &
990 ~(IT85_ILSEL | IT85_ILE | IT85_FIFOTL |
991 IT85_FIFOCLR | IT85_RESET)) |
992 IT85_FIFOTL_DEFAULT,
993 dev->cir_addr + IT8708_C0MSTCR);
994
995 /* program the C0RCR register defaults */
996 outb((inb(dev->cir_addr + IT8708_C0RCR) &
997 ~(IT85_RXEN | IT85_RDWOS | IT85_RXEND |
998 IT85_RXACT | IT85_RXDCR)) |
999 ITE_RXDCR_DEFAULT,
1000 dev->cir_addr + IT8708_C0RCR);
1001
1002 /* program the C0TCR register defaults */
1003 outb((inb(dev->cir_addr + IT8708_C0TCR) &
1004 ~(IT85_TXMPM | IT85_TXMPW))
1005 |IT85_TXRLE | IT85_TXENDF |
1006 IT85_TXMPM_DEFAULT | IT85_TXMPW_DEFAULT,
1007 dev->cir_addr + IT8708_C0TCR);
1008
1009 /* program the carrier parameters */
1010 ite_set_carrier_params(dev);
1011}
1012
1013/* IT8512F on ITE8709 HW-specific functions */
1014
1015/* read a byte from the SRAM module */
1016static inline u8 it8709_rm(struct ite_dev *dev, int index)
1017{
1018 outb(index, dev->cir_addr + IT8709_RAM_IDX);
1019 return inb(dev->cir_addr + IT8709_RAM_VAL);
1020}
1021
1022/* write a byte to the SRAM module */
1023static inline void it8709_wm(struct ite_dev *dev, u8 val, int index)
1024{
1025 outb(index, dev->cir_addr + IT8709_RAM_IDX);
1026 outb(val, dev->cir_addr + IT8709_RAM_VAL);
1027}
1028
1029static void it8709_wait(struct ite_dev *dev)
1030{
1031 int i = 0;
1032 /*
1033 * loop until device tells it's ready to continue
1034 * iterations count is usually ~750 but can sometimes achieve 13000
1035 */
1036 for (i = 0; i < 15000; i++) {
1037 udelay(2);
1038 if (it8709_rm(dev, IT8709_MODE) == IT8709_IDLE)
1039 break;
1040 }
1041}
1042
1043/* read the value of a CIR register */
1044static u8 it8709_rr(struct ite_dev *dev, int index)
1045{
1046 /* just wait in case the previous access was a write */
1047 it8709_wait(dev);
1048 it8709_wm(dev, index, IT8709_REG_IDX);
1049 it8709_wm(dev, IT8709_READ, IT8709_MODE);
1050
1051 /* wait for the read data to be available */
1052 it8709_wait(dev);
1053
1054 /* return the read value */
1055 return it8709_rm(dev, IT8709_REG_VAL);
1056}
1057
1058/* write the value of a CIR register */
1059static void it8709_wr(struct ite_dev *dev, u8 val, int index)
1060{
1061 /* we wait before writing, and not afterwards, since this allows us to
1062 * pipeline the host CPU with the microcontroller */
1063 it8709_wait(dev);
1064 it8709_wm(dev, val, IT8709_REG_VAL);
1065 it8709_wm(dev, index, IT8709_REG_IDX);
1066 it8709_wm(dev, IT8709_WRITE, IT8709_MODE);
1067}
1068
1069/* retrieve a bitmask of the current causes for a pending interrupt; this may
1070 * be composed of ITE_IRQ_TX_FIFO, ITE_IRQ_RX_FIFO and ITE_IRQ_RX_FIFO_OVERRUN
1071 * */
1072static int it8709_get_irq_causes(struct ite_dev *dev)
1073{
1074 u8 iflags;
1075 int ret = 0;
1076
1077 ite_dbg("%s called", __func__);
1078
1079 /* read the interrupt flags */
1080 iflags = it8709_rm(dev, IT8709_IIR);
1081
1082 if (iflags & IT85_TLDLI)
1083 ret |= ITE_IRQ_TX_FIFO;
1084 if (iflags & IT85_RDAI)
1085 ret |= ITE_IRQ_RX_FIFO;
1086 if (iflags & IT85_RFOI)
1087 ret |= ITE_IRQ_RX_FIFO_OVERRUN;
1088
1089 return ret;
1090}
1091
1092/* set the carrier parameters; to be called with the spinlock held */
1093static void it8709_set_carrier_params(struct ite_dev *dev, bool high_freq,
1094 bool use_demodulator,
1095 u8 carrier_freq_bits, u8 allowance_bits,
1096 u8 pulse_width_bits)
1097{
1098 u8 val;
1099
1100 ite_dbg("%s called", __func__);
1101
1102 val = (it8709_rr(dev, IT85_C0CFR)
1103 &~(IT85_HCFS | IT85_CFQ)) |
1104 carrier_freq_bits;
1105
1106 if (high_freq)
1107 val |= IT85_HCFS;
1108
1109 it8709_wr(dev, val, IT85_C0CFR);
1110
1111 /* program the C0RCR register */
1112 val = it8709_rr(dev, IT85_C0RCR)
1113 & ~(IT85_RXEND | IT85_RXDCR);
1114
1115 if (use_demodulator)
1116 val |= IT85_RXEND;
1117
1118 val |= allowance_bits;
1119
1120 it8709_wr(dev, val, IT85_C0RCR);
1121
1122 /* program the C0TCR register */
1123 val = it8709_rr(dev, IT85_C0TCR) & ~IT85_TXMPW;
1124 val |= pulse_width_bits;
1125 it8709_wr(dev, val, IT85_C0TCR);
1126}
1127
1128/* read up to buf_size bytes from the RX FIFO; to be called with the spinlock
1129 * held */
1130static int it8709_get_rx_bytes(struct ite_dev *dev, u8 * buf, int buf_size)
1131{
1132 int fifo, read = 0;
1133
1134 ite_dbg("%s called", __func__);
1135
1136 /* read how many bytes are still in the FIFO */
1137 fifo = it8709_rm(dev, IT8709_RFSR) & IT85_RXFBC;
1138
1139 while (fifo > 0 && buf_size > 0) {
1140 *(buf++) = it8709_rm(dev, IT8709_FIFO + read);
1141 fifo--;
1142 read++;
1143 buf_size--;
1144 }
1145
1146 /* 'clear' the FIFO by setting the writing index to 0; this is
1147 * completely bound to be racy, but we can't help it, since it's a
1148 * limitation of the protocol */
1149 it8709_wm(dev, 0, IT8709_RFSR);
1150
1151 return read;
1152}
1153
1154/* return how many bytes are still in the FIFO; this will be called
1155 * with the device spinlock NOT HELD while waiting for the TX FIFO to get
1156 * empty; let's expect this won't be a problem */
1157static int it8709_get_tx_used_slots(struct ite_dev *dev)
1158{
1159 ite_dbg("%s called", __func__);
1160
1161 return it8709_rr(dev, IT85_C0TFSR) & IT85_TXFBC;
1162}
1163
1164/* put a byte to the TX fifo; this should be called with the spinlock held */
1165static void it8709_put_tx_byte(struct ite_dev *dev, u8 value)
1166{
1167 it8709_wr(dev, value, IT85_C0DR);
1168}
1169
1170/* idle the receiver so that we won't receive samples until another
1171 pulse is detected; this must be called with the device spinlock held */
1172static void it8709_idle_rx(struct ite_dev *dev)
1173{
1174 ite_dbg("%s called", __func__);
1175
1176 /* disable streaming by clearing RXACT writing it as 1 */
1177 it8709_wr(dev, it8709_rr(dev, IT85_C0RCR) | IT85_RXACT,
1178 IT85_C0RCR);
1179
1180 /* clear the FIFO */
1181 it8709_wr(dev, it8709_rr(dev, IT85_C0MSTCR) | IT85_FIFOCLR,
1182 IT85_C0MSTCR);
1183}
1184
1185/* disable the receiver; this must be called with the device spinlock held */
1186static void it8709_disable_rx(struct ite_dev *dev)
1187{
1188 ite_dbg("%s called", __func__);
1189
1190 /* disable the receiver interrupts */
1191 it8709_wr(dev, it8709_rr(dev, IT85_C0IER) &
1192 ~(IT85_RDAIE | IT85_RFOIE),
1193 IT85_C0IER);
1194
1195 /* disable the receiver */
1196 it8709_wr(dev, it8709_rr(dev, IT85_C0RCR) & ~IT85_RXEN,
1197 IT85_C0RCR);
1198
1199 /* clear the FIFO and RXACT (actually RXACT should have been cleared
1200 * in the previous it8709_wr(dev, ) call) */
1201 it8709_idle_rx(dev);
1202}
1203
1204/* enable the receiver; this must be called with the device spinlock held */
1205static void it8709_enable_rx(struct ite_dev *dev)
1206{
1207 ite_dbg("%s called", __func__);
1208
1209 /* enable the receiver by setting RXEN */
1210 it8709_wr(dev, it8709_rr(dev, IT85_C0RCR) | IT85_RXEN,
1211 IT85_C0RCR);
1212
1213 /* just prepare it to idle for the next reception */
1214 it8709_idle_rx(dev);
1215
1216 /* enable the receiver interrupts and master enable flag */
1217 it8709_wr(dev, it8709_rr(dev, IT85_C0IER)
1218 |IT85_RDAIE | IT85_RFOIE | IT85_IEC,
1219 IT85_C0IER);
1220}
1221
1222/* disable the transmitter interrupt; this must be called with the device
1223 * spinlock held */
1224static void it8709_disable_tx_interrupt(struct ite_dev *dev)
1225{
1226 ite_dbg("%s called", __func__);
1227
1228 /* disable the transmitter interrupts */
1229 it8709_wr(dev, it8709_rr(dev, IT85_C0IER) & ~IT85_TLDLIE,
1230 IT85_C0IER);
1231}
1232
1233/* enable the transmitter interrupt; this must be called with the device
1234 * spinlock held */
1235static void it8709_enable_tx_interrupt(struct ite_dev *dev)
1236{
1237 ite_dbg("%s called", __func__);
1238
1239 /* enable the transmitter interrupts and master enable flag */
1240 it8709_wr(dev, it8709_rr(dev, IT85_C0IER)
1241 |IT85_TLDLIE | IT85_IEC,
1242 IT85_C0IER);
1243}
1244
1245/* disable the device; this must be called with the device spinlock held */
1246static void it8709_disable(struct ite_dev *dev)
1247{
1248 ite_dbg("%s called", __func__);
1249
1250 /* clear out all interrupt enable flags */
1251 it8709_wr(dev,
1252 it8709_rr(dev,
1253 IT85_C0IER) & ~(IT85_IEC | IT85_RFOIE |
1254 IT85_RDAIE |
1255 IT85_TLDLIE), IT85_C0IER);
1256
1257 /* disable the receiver */
1258 it8709_disable_rx(dev);
1259
1260 /* erase the FIFO */
1261 it8709_wr(dev, IT85_FIFOCLR | it8709_rr(dev, IT85_C0MSTCR),
1262 IT85_C0MSTCR);
1263}
1264
1265/* initialize the hardware */
1266static void it8709_init_hardware(struct ite_dev *dev)
1267{
1268 ite_dbg("%s called", __func__);
1269
1270 /* disable all the interrupts */
1271 it8709_wr(dev,
1272 it8709_rr(dev,
1273 IT85_C0IER) & ~(IT85_IEC | IT85_RFOIE |
1274 IT85_RDAIE |
1275 IT85_TLDLIE), IT85_C0IER);
1276
1277 /* program the baud rate divisor */
1278 it8709_wr(dev, ITE_BAUDRATE_DIVISOR & 0xff, IT85_C0BDLR);
1279 it8709_wr(dev, (ITE_BAUDRATE_DIVISOR >> 8) & 0xff,
1280 IT85_C0BDHR);
1281
1282 /* program the C0MSTCR register defaults */
1283 it8709_wr(dev, (it8709_rr(dev, IT85_C0MSTCR) & ~(IT85_ILSEL |
1284 IT85_ILE
1285 | IT85_FIFOTL
1286 |
1287 IT85_FIFOCLR
1288 |
1289 IT85_RESET))
1290 | IT85_FIFOTL_DEFAULT, IT85_C0MSTCR);
1291
1292 /* program the C0RCR register defaults */
1293 it8709_wr(dev,
1294 (it8709_rr(dev, IT85_C0RCR) &
1295 ~(IT85_RXEN | IT85_RDWOS | IT85_RXEND
1296 | IT85_RXACT | IT85_RXDCR)) |
1297 ITE_RXDCR_DEFAULT, IT85_C0RCR);
1298
1299 /* program the C0TCR register defaults */
1300 it8709_wr(dev, (it8709_rr(dev, IT85_C0TCR)
1301 &~(IT85_TXMPM | IT85_TXMPW))
1302 |IT85_TXRLE | IT85_TXENDF |
1303 IT85_TXMPM_DEFAULT |
1304 IT85_TXMPW_DEFAULT, IT85_C0TCR);
1305
1306 /* program the carrier parameters */
1307 ite_set_carrier_params(dev);
1308}
1309
1310
1311/* generic hardware setup/teardown code */
1312
1313/* activate the device for use */
1314static int ite_open(struct rc_dev *rcdev)
1315{
1316 struct ite_dev *dev = rcdev->priv;
1317 unsigned long flags;
1318
1319 ite_dbg("%s called", __func__);
1320
1321 spin_lock_irqsave(&dev->lock, flags);
1322 dev->in_use = true;
1323
1324 /* enable the receiver */
1325 dev->params.enable_rx(dev);
1326
1327 spin_unlock_irqrestore(&dev->lock, flags);
1328
1329 return 0;
1330}
1331
1332/* deactivate the device for use */
1333static void ite_close(struct rc_dev *rcdev)
1334{
1335 struct ite_dev *dev = rcdev->priv;
1336 unsigned long flags;
1337
1338 ite_dbg("%s called", __func__);
1339
1340 spin_lock_irqsave(&dev->lock, flags);
1341 dev->in_use = false;
1342
1343 /* wait for any transmission to end */
1344 spin_unlock_irqrestore(&dev->lock, flags);
1345 wait_event_interruptible(dev->tx_ended, !dev->transmitting);
1346 spin_lock_irqsave(&dev->lock, flags);
1347
1348 dev->params.disable(dev);
1349
1350 spin_unlock_irqrestore(&dev->lock, flags);
1351}
1352
1353/* supported models and their parameters */
1354static const struct ite_dev_params ite_dev_descs[] = {
1355 { /* 0: ITE8704 */
1356 .model = "ITE8704 CIR transceiver",
1357 .io_region_size = IT87_IOREG_LENGTH,
1358 .hw_tx_capable = true,
1359 .sample_period = (u32) (1000000000ULL / 115200),
1360 .tx_carrier_freq = 38000,
1361 .tx_duty_cycle = 33,
1362 .rx_low_carrier_freq = 0,
1363 .rx_high_carrier_freq = 0,
1364
1365 /* operations */
1366 .get_irq_causes = it87_get_irq_causes,
1367 .enable_rx = it87_enable_rx,
1368 .idle_rx = it87_idle_rx,
1369 .disable_rx = it87_idle_rx,
1370 .get_rx_bytes = it87_get_rx_bytes,
1371 .enable_tx_interrupt = it87_enable_tx_interrupt,
1372 .disable_tx_interrupt = it87_disable_tx_interrupt,
1373 .get_tx_used_slots = it87_get_tx_used_slots,
1374 .put_tx_byte = it87_put_tx_byte,
1375 .disable = it87_disable,
1376 .init_hardware = it87_init_hardware,
1377 .set_carrier_params = it87_set_carrier_params,
1378 },
1379 { /* 1: ITE8713 */
1380 .model = "ITE8713 CIR transceiver",
1381 .io_region_size = IT87_IOREG_LENGTH,
1382 .hw_tx_capable = true,
1383 .sample_period = (u32) (1000000000ULL / 115200),
1384 .tx_carrier_freq = 38000,
1385 .tx_duty_cycle = 33,
1386 .rx_low_carrier_freq = 0,
1387 .rx_high_carrier_freq = 0,
1388
1389 /* operations */
1390 .get_irq_causes = it87_get_irq_causes,
1391 .enable_rx = it87_enable_rx,
1392 .idle_rx = it87_idle_rx,
1393 .disable_rx = it87_idle_rx,
1394 .get_rx_bytes = it87_get_rx_bytes,
1395 .enable_tx_interrupt = it87_enable_tx_interrupt,
1396 .disable_tx_interrupt = it87_disable_tx_interrupt,
1397 .get_tx_used_slots = it87_get_tx_used_slots,
1398 .put_tx_byte = it87_put_tx_byte,
1399 .disable = it87_disable,
1400 .init_hardware = it87_init_hardware,
1401 .set_carrier_params = it87_set_carrier_params,
1402 },
1403 { /* 2: ITE8708 */
1404 .model = "ITE8708 CIR transceiver",
1405 .io_region_size = IT8708_IOREG_LENGTH,
1406 .hw_tx_capable = true,
1407 .sample_period = (u32) (1000000000ULL / 115200),
1408 .tx_carrier_freq = 38000,
1409 .tx_duty_cycle = 33,
1410 .rx_low_carrier_freq = 0,
1411 .rx_high_carrier_freq = 0,
1412
1413 /* operations */
1414 .get_irq_causes = it8708_get_irq_causes,
1415 .enable_rx = it8708_enable_rx,
1416 .idle_rx = it8708_idle_rx,
1417 .disable_rx = it8708_idle_rx,
1418 .get_rx_bytes = it8708_get_rx_bytes,
1419 .enable_tx_interrupt = it8708_enable_tx_interrupt,
1420 .disable_tx_interrupt =
1421 it8708_disable_tx_interrupt,
1422 .get_tx_used_slots = it8708_get_tx_used_slots,
1423 .put_tx_byte = it8708_put_tx_byte,
1424 .disable = it8708_disable,
1425 .init_hardware = it8708_init_hardware,
1426 .set_carrier_params = it8708_set_carrier_params,
1427 },
1428 { /* 3: ITE8709 */
1429 .model = "ITE8709 CIR transceiver",
1430 .io_region_size = IT8709_IOREG_LENGTH,
1431 .hw_tx_capable = true,
1432 .sample_period = (u32) (1000000000ULL / 115200),
1433 .tx_carrier_freq = 38000,
1434 .tx_duty_cycle = 33,
1435 .rx_low_carrier_freq = 0,
1436 .rx_high_carrier_freq = 0,
1437
1438 /* operations */
1439 .get_irq_causes = it8709_get_irq_causes,
1440 .enable_rx = it8709_enable_rx,
1441 .idle_rx = it8709_idle_rx,
1442 .disable_rx = it8709_idle_rx,
1443 .get_rx_bytes = it8709_get_rx_bytes,
1444 .enable_tx_interrupt = it8709_enable_tx_interrupt,
1445 .disable_tx_interrupt =
1446 it8709_disable_tx_interrupt,
1447 .get_tx_used_slots = it8709_get_tx_used_slots,
1448 .put_tx_byte = it8709_put_tx_byte,
1449 .disable = it8709_disable,
1450 .init_hardware = it8709_init_hardware,
1451 .set_carrier_params = it8709_set_carrier_params,
1452 },
1453};
1454
1455static const struct pnp_device_id ite_ids[] = {
1456 {"ITE8704", 0}, /* Default model */
1457 {"ITE8713", 1}, /* CIR found in EEEBox 1501U */
1458 {"ITE8708", 2}, /* Bridged IT8512 */
1459 {"ITE8709", 3}, /* SRAM-Bridged IT8512 */
1460 {"", 0},
1461};
1462
1463/* allocate memory, probe hardware, and initialize everything */
1464static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1465 *dev_id)
1466{
1467 const struct ite_dev_params *dev_desc = NULL;
1468 struct ite_dev *itdev = NULL;
1469 struct rc_dev *rdev = NULL;
1470 int ret = -ENOMEM;
1471 int model_no;
1472
1473 ite_dbg("%s called", __func__);
1474
1475 itdev = kzalloc(sizeof(struct ite_dev), GFP_KERNEL);
1476 if (!itdev)
1477 return ret;
1478
1479 /* input device for IR remote (and tx) */
1480 rdev = rc_allocate_device();
1481 if (!rdev)
1482 goto failure;
1483
1484 ret = -ENODEV;
1485
1486 /* get the model number */
1487 model_no = (int)dev_id->driver_data;
1488 ite_pr(KERN_NOTICE, "Auto-detected model: %s\n",
1489 ite_dev_descs[model_no].model);
1490
1491 if (model_number >= 0 && model_number < ARRAY_SIZE(ite_dev_descs)) {
1492 model_no = model_number;
1493 ite_pr(KERN_NOTICE, "The model has been fixed by a module "
1494 "parameter.");
1495 }
1496
1497 ite_pr(KERN_NOTICE, "Using model: %s\n", ite_dev_descs[model_no].model);
1498
1499 /* get the description for the device */
1500 dev_desc = &ite_dev_descs[model_no];
1501
1502 /* validate pnp resources */
1503 if (!pnp_port_valid(pdev, 0) ||
1504 pnp_port_len(pdev, 0) != dev_desc->io_region_size) {
1505 dev_err(&pdev->dev, "IR PNP Port not valid!\n");
1506 goto failure;
1507 }
1508
1509 if (!pnp_irq_valid(pdev, 0)) {
1510 dev_err(&pdev->dev, "PNP IRQ not valid!\n");
1511 goto failure;
1512 }
1513
1514 /* store resource values */
1515 itdev->cir_addr = pnp_port_start(pdev, 0);
1516 itdev->cir_irq = pnp_irq(pdev, 0);
1517
1518 /* initialize spinlocks */
1519 spin_lock_init(&itdev->lock);
1520
1521 /* initialize raw event */
1522 init_ir_raw_event(&itdev->rawir);
1523
1524 ret = -EBUSY;
1525 /* now claim resources */
1526 if (!request_region(itdev->cir_addr,
1527 dev_desc->io_region_size, ITE_DRIVER_NAME))
1528 goto failure;
1529
1530 if (request_irq(itdev->cir_irq, ite_cir_isr, IRQF_SHARED,
1531 ITE_DRIVER_NAME, (void *)itdev))
1532 goto failure;
1533
1534 /* set driver data into the pnp device */
1535 pnp_set_drvdata(pdev, itdev);
1536 itdev->pdev = pdev;
1537
1538 /* initialize waitqueues for transmission */
1539 init_waitqueue_head(&itdev->tx_queue);
1540 init_waitqueue_head(&itdev->tx_ended);
1541
1542 /* copy model-specific parameters */
1543 itdev->params = *dev_desc;
1544
1545 /* apply any overrides */
1546 if (sample_period > 0)
1547 itdev->params.sample_period = sample_period;
1548
1549 if (tx_carrier_freq > 0)
1550 itdev->params.tx_carrier_freq = tx_carrier_freq;
1551
1552 if (tx_duty_cycle > 0 && tx_duty_cycle <= 100)
1553 itdev->params.tx_duty_cycle = tx_duty_cycle;
1554
1555 if (rx_low_carrier_freq > 0)
1556 itdev->params.rx_low_carrier_freq = rx_low_carrier_freq;
1557
1558 if (rx_high_carrier_freq > 0)
1559 itdev->params.rx_high_carrier_freq = rx_high_carrier_freq;
1560
1561 /* print out parameters */
1562 ite_pr(KERN_NOTICE, "TX-capable: %d\n", (int)
1563 itdev->params.hw_tx_capable);
1564 ite_pr(KERN_NOTICE, "Sample period (ns): %ld\n", (long)
1565 itdev->params.sample_period);
1566 ite_pr(KERN_NOTICE, "TX carrier frequency (Hz): %d\n", (int)
1567 itdev->params.tx_carrier_freq);
1568 ite_pr(KERN_NOTICE, "TX duty cycle (%%): %d\n", (int)
1569 itdev->params.tx_duty_cycle);
1570 ite_pr(KERN_NOTICE, "RX low carrier frequency (Hz): %d\n", (int)
1571 itdev->params.rx_low_carrier_freq);
1572 ite_pr(KERN_NOTICE, "RX high carrier frequency (Hz): %d\n", (int)
1573 itdev->params.rx_high_carrier_freq);
1574
1575 /* set up hardware initial state */
1576 itdev->params.init_hardware(itdev);
1577
1578 /* set up ir-core props */
1579 rdev->priv = itdev;
1580 rdev->driver_type = RC_DRIVER_IR_RAW;
1581 rdev->allowed_protos = RC_TYPE_ALL;
1582 rdev->open = ite_open;
1583 rdev->close = ite_close;
1584 rdev->s_idle = ite_s_idle;
1585 rdev->s_rx_carrier_range = ite_set_rx_carrier_range;
1586 rdev->min_timeout = ITE_MIN_IDLE_TIMEOUT;
1587 rdev->max_timeout = ITE_MAX_IDLE_TIMEOUT;
1588 rdev->timeout = ITE_IDLE_TIMEOUT;
1589 rdev->rx_resolution = ITE_BAUDRATE_DIVISOR *
1590 itdev->params.sample_period;
1591 rdev->tx_resolution = ITE_BAUDRATE_DIVISOR *
1592 itdev->params.sample_period;
1593
1594 /* set up transmitter related values if needed */
1595 if (itdev->params.hw_tx_capable) {
1596 rdev->tx_ir = ite_tx_ir;
1597 rdev->s_tx_carrier = ite_set_tx_carrier;
1598 rdev->s_tx_duty_cycle = ite_set_tx_duty_cycle;
1599 }
1600
1601 rdev->input_name = dev_desc->model;
1602 rdev->input_id.bustype = BUS_HOST;
1603 rdev->input_id.vendor = PCI_VENDOR_ID_ITE;
1604 rdev->input_id.product = 0;
1605 rdev->input_id.version = 0;
1606 rdev->driver_name = ITE_DRIVER_NAME;
1607 rdev->map_name = RC_MAP_RC6_MCE;
1608
1609 ret = rc_register_device(rdev);
1610 if (ret)
1611 goto failure;
1612
1613 itdev->rdev = rdev;
1614 ite_pr(KERN_NOTICE, "driver has been successfully loaded\n");
1615
1616 return 0;
1617
1618failure:
1619 if (itdev->cir_irq)
1620 free_irq(itdev->cir_irq, itdev);
1621
1622 if (itdev->cir_addr)
1623 release_region(itdev->cir_addr, itdev->params.io_region_size);
1624
1625 rc_free_device(rdev);
1626 kfree(itdev);
1627
1628 return ret;
1629}
1630
1631static void __devexit ite_remove(struct pnp_dev *pdev)
1632{
1633 struct ite_dev *dev = pnp_get_drvdata(pdev);
1634 unsigned long flags;
1635
1636 ite_dbg("%s called", __func__);
1637
1638 spin_lock_irqsave(&dev->lock, flags);
1639
1640 /* disable hardware */
1641 dev->params.disable(dev);
1642
1643 spin_unlock_irqrestore(&dev->lock, flags);
1644
1645 /* free resources */
1646 free_irq(dev->cir_irq, dev);
1647 release_region(dev->cir_addr, dev->params.io_region_size);
1648
1649 rc_unregister_device(dev->rdev);
1650
1651 kfree(dev);
1652}
1653
1654static int ite_suspend(struct pnp_dev *pdev, pm_message_t state)
1655{
1656 struct ite_dev *dev = pnp_get_drvdata(pdev);
1657 unsigned long flags;
1658
1659 ite_dbg("%s called", __func__);
1660
1661 spin_lock_irqsave(&dev->lock, flags);
1662
1663 /* disable all interrupts */
1664 dev->params.disable(dev);
1665
1666 spin_unlock_irqrestore(&dev->lock, flags);
1667
1668 return 0;
1669}
1670
1671static int ite_resume(struct pnp_dev *pdev)
1672{
1673 int ret = 0;
1674 struct ite_dev *dev = pnp_get_drvdata(pdev);
1675 unsigned long flags;
1676
1677 ite_dbg("%s called", __func__);
1678
1679 spin_lock_irqsave(&dev->lock, flags);
1680
1681 if (dev->transmitting) {
1682 /* wake up the transmitter */
1683 wake_up_interruptible(&dev->tx_queue);
1684 } else {
1685 /* enable the receiver */
1686 dev->params.enable_rx(dev);
1687 }
1688
1689 spin_unlock_irqrestore(&dev->lock, flags);
1690
1691 return ret;
1692}
1693
1694static void ite_shutdown(struct pnp_dev *pdev)
1695{
1696 struct ite_dev *dev = pnp_get_drvdata(pdev);
1697 unsigned long flags;
1698
1699 ite_dbg("%s called", __func__);
1700
1701 spin_lock_irqsave(&dev->lock, flags);
1702
1703 /* disable all interrupts */
1704 dev->params.disable(dev);
1705
1706 spin_unlock_irqrestore(&dev->lock, flags);
1707}
1708
1709static struct pnp_driver ite_driver = {
1710 .name = ITE_DRIVER_NAME,
1711 .id_table = ite_ids,
1712 .probe = ite_probe,
1713 .remove = __devexit_p(ite_remove),
1714 .suspend = ite_suspend,
1715 .resume = ite_resume,
1716 .shutdown = ite_shutdown,
1717};
1718
1719int ite_init(void)
1720{
1721 return pnp_register_driver(&ite_driver);
1722}
1723
1724void ite_exit(void)
1725{
1726 pnp_unregister_driver(&ite_driver);
1727}
1728
1729MODULE_DEVICE_TABLE(pnp, ite_ids);
1730MODULE_DESCRIPTION("ITE Tech Inc. IT8712F/ITE8512F CIR driver");
1731
1732MODULE_AUTHOR("Juan J. Garcia de Soria <skandalfo@gmail.com>");
1733MODULE_LICENSE("GPL");
1734
1735module_init(ite_init);
1736module_exit(ite_exit);
diff --git a/drivers/media/rc/ite-cir.h b/drivers/media/rc/ite-cir.h
new file mode 100644
index 000000000000..16a19f5fd718
--- /dev/null
+++ b/drivers/media/rc/ite-cir.h
@@ -0,0 +1,481 @@
1/*
2 * Driver for ITE Tech Inc. IT8712F/IT8512F CIR
3 *
4 * Copyright (C) 2010 Juan Jesús García de Soria <skandalfo@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/* platform driver name to register */
23#define ITE_DRIVER_NAME "ite-cir"
24
25/* logging macros */
26#define ite_pr(level, text, ...) \
27 printk(level KBUILD_MODNAME ": " text, ## __VA_ARGS__)
28#define ite_dbg(text, ...) do { \
29 if (debug) \
30 printk(KERN_DEBUG \
31 KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__); \
32} while (0)
33
34#define ite_dbg_verbose(text, ...) do {\
35 if (debug > 1) \
36 printk(KERN_DEBUG \
37 KBUILD_MODNAME ": " text "\n" , ## __VA_ARGS__); \
38} while (0)
39
40/* FIFO sizes */
41#define ITE_TX_FIFO_LEN 32
42#define ITE_RX_FIFO_LEN 32
43
44/* interrupt types */
45#define ITE_IRQ_TX_FIFO 1
46#define ITE_IRQ_RX_FIFO 2
47#define ITE_IRQ_RX_FIFO_OVERRUN 4
48
49/* forward declaration */
50struct ite_dev;
51
52/* struct for storing the parameters of different recognized devices */
53struct ite_dev_params {
54 /* model of the device */
55 const char *model;
56
57 /* size of the I/O region */
58 int io_region_size;
59
60 /* true if the hardware supports transmission */
61 bool hw_tx_capable;
62
63 /* base sampling period, in ns */
64 u32 sample_period;
65
66 /* rx low carrier frequency, in Hz, 0 means no demodulation */
67 unsigned int rx_low_carrier_freq;
68
69 /* tx high carrier frequency, in Hz, 0 means no demodulation */
70 unsigned int rx_high_carrier_freq;
71
72 /* tx carrier frequency, in Hz */
73 unsigned int tx_carrier_freq;
74
75 /* duty cycle, 0-100 */
76 int tx_duty_cycle;
77
78 /* hw-specific operation function pointers; most of these must be
79 * called while holding the spin lock, except for the TX FIFO length
80 * one */
81 /* get pending interrupt causes */
82 int (*get_irq_causes) (struct ite_dev *dev);
83
84 /* enable rx */
85 void (*enable_rx) (struct ite_dev *dev);
86
87 /* make rx enter the idle state; keep listening for a pulse, but stop
88 * streaming space bytes */
89 void (*idle_rx) (struct ite_dev *dev);
90
91 /* disable rx completely */
92 void (*disable_rx) (struct ite_dev *dev);
93
94 /* read bytes from RX FIFO; return read count */
95 int (*get_rx_bytes) (struct ite_dev *dev, u8 *buf, int buf_size);
96
97 /* enable tx FIFO space available interrupt */
98 void (*enable_tx_interrupt) (struct ite_dev *dev);
99
100 /* disable tx FIFO space available interrupt */
101 void (*disable_tx_interrupt) (struct ite_dev *dev);
102
103 /* get number of full TX FIFO slots */
104 int (*get_tx_used_slots) (struct ite_dev *dev);
105
106 /* put a byte to the TX FIFO */
107 void (*put_tx_byte) (struct ite_dev *dev, u8 value);
108
109 /* disable hardware completely */
110 void (*disable) (struct ite_dev *dev);
111
112 /* initialize the hardware */
113 void (*init_hardware) (struct ite_dev *dev);
114
115 /* set the carrier parameters */
116 void (*set_carrier_params) (struct ite_dev *dev, bool high_freq,
117 bool use_demodulator, u8 carrier_freq_bits,
118 u8 allowance_bits, u8 pulse_width_bits);
119};
120
121/* ITE CIR device structure */
122struct ite_dev {
123 struct pnp_dev *pdev;
124 struct rc_dev *rdev;
125 struct ir_raw_event rawir;
126
127 /* sync data */
128 spinlock_t lock;
129 bool in_use, transmitting;
130
131 /* transmit support */
132 int tx_fifo_allowance;
133 wait_queue_head_t tx_queue, tx_ended;
134
135 /* hardware I/O settings */
136 unsigned long cir_addr;
137 int cir_irq;
138
139 /* overridable copy of model parameters */
140 struct ite_dev_params params;
141};
142
143/* common values for all kinds of hardware */
144
145/* baud rate divisor default */
146#define ITE_BAUDRATE_DIVISOR 1
147
148/* low-speed carrier frequency limits (Hz) */
149#define ITE_LCF_MIN_CARRIER_FREQ 27000
150#define ITE_LCF_MAX_CARRIER_FREQ 58000
151
152/* high-speed carrier frequency limits (Hz) */
153#define ITE_HCF_MIN_CARRIER_FREQ 400000
154#define ITE_HCF_MAX_CARRIER_FREQ 500000
155
156/* default carrier freq for when demodulator is off (Hz) */
157#define ITE_DEFAULT_CARRIER_FREQ 38000
158
159/* default idling timeout in ns (0.2 seconds) */
160#define ITE_IDLE_TIMEOUT 200000000UL
161
162/* limit timeout values */
163#define ITE_MIN_IDLE_TIMEOUT 100000000UL
164#define ITE_MAX_IDLE_TIMEOUT 1000000000UL
165
166/* convert bits to us */
167#define ITE_BITS_TO_NS(bits, sample_period) \
168((u32) ((bits) * ITE_BAUDRATE_DIVISOR * sample_period))
169
170/*
171 * n in RDCR produces a tolerance of +/- n * 6.25% around the center
172 * carrier frequency...
173 *
174 * From two limit frequencies, L (low) and H (high), we can get both the
175 * center frequency F = (L + H) / 2 and the variation from the center
176 * frequency A = (H - L) / (H + L). We can use this in order to honor the
177 * s_rx_carrier_range() call in ir-core. We'll suppose that any request
178 * setting L=0 means we must shut down the demodulator.
179 */
180#define ITE_RXDCR_PER_10000_STEP 625
181
182/* high speed carrier freq values */
183#define ITE_CFQ_400 0x03
184#define ITE_CFQ_450 0x08
185#define ITE_CFQ_480 0x0b
186#define ITE_CFQ_500 0x0d
187
188/* values for pulse widths */
189#define ITE_TXMPW_A 0x02
190#define ITE_TXMPW_B 0x03
191#define ITE_TXMPW_C 0x04
192#define ITE_TXMPW_D 0x05
193#define ITE_TXMPW_E 0x06
194
195/* values for demodulator carrier range allowance */
196#define ITE_RXDCR_DEFAULT 0x01 /* default carrier range */
197#define ITE_RXDCR_MAX 0x07 /* default carrier range */
198
199/* DR TX bits */
200#define ITE_TX_PULSE 0x00
201#define ITE_TX_SPACE 0x80
202#define ITE_TX_MAX_RLE 0x80
203#define ITE_TX_RLE_MASK 0x7f
204
205/*
206 * IT8712F
207 *
208 * hardware data obtained from:
209 *
210 * IT8712F
211 * Environment Control – Low Pin Count Input / Output
212 * (EC - LPC I/O)
213 * Preliminary Specification V0. 81
214 */
215
216/* register offsets */
217#define IT87_DR 0x00 /* data register */
218#define IT87_IER 0x01 /* interrupt enable register */
219#define IT87_RCR 0x02 /* receiver control register */
220#define IT87_TCR1 0x03 /* transmitter control register 1 */
221#define IT87_TCR2 0x04 /* transmitter control register 2 */
222#define IT87_TSR 0x05 /* transmitter status register */
223#define IT87_RSR 0x06 /* receiver status register */
224#define IT87_BDLR 0x05 /* baud rate divisor low byte register */
225#define IT87_BDHR 0x06 /* baud rate divisor high byte register */
226#define IT87_IIR 0x07 /* interrupt identification register */
227
228#define IT87_IOREG_LENGTH 0x08 /* length of register file */
229
230/* IER bits */
231#define IT87_TLDLIE 0x01 /* transmitter low data interrupt enable */
232#define IT87_RDAIE 0x02 /* receiver data available interrupt enable */
233#define IT87_RFOIE 0x04 /* receiver FIFO overrun interrupt enable */
234#define IT87_IEC 0x08 /* interrupt enable control */
235#define IT87_BR 0x10 /* baud rate register enable */
236#define IT87_RESET 0x20 /* reset */
237
238/* RCR bits */
239#define IT87_RXDCR 0x07 /* receiver demodulation carrier range mask */
240#define IT87_RXACT 0x08 /* receiver active */
241#define IT87_RXEND 0x10 /* receiver demodulation enable */
242#define IT87_RXEN 0x20 /* receiver enable */
243#define IT87_HCFS 0x40 /* high-speed carrier frequency select */
244#define IT87_RDWOS 0x80 /* receiver data without sync */
245
246/* TCR1 bits */
247#define IT87_TXMPM 0x03 /* transmitter modulation pulse mode mask */
248#define IT87_TXMPM_DEFAULT 0x00 /* modulation pulse mode default */
249#define IT87_TXENDF 0x04 /* transmitter deferral */
250#define IT87_TXRLE 0x08 /* transmitter run length enable */
251#define IT87_FIFOTL 0x30 /* FIFO level threshold mask */
252#define IT87_FIFOTL_DEFAULT 0x20 /* FIFO level threshold default
253 * 0x00 -> 1, 0x10 -> 7, 0x20 -> 17,
254 * 0x30 -> 25 */
255#define IT87_ILE 0x40 /* internal loopback enable */
256#define IT87_FIFOCLR 0x80 /* FIFO clear bit */
257
258/* TCR2 bits */
259#define IT87_TXMPW 0x07 /* transmitter modulation pulse width mask */
260#define IT87_TXMPW_DEFAULT 0x04 /* default modulation pulse width */
261#define IT87_CFQ 0xf8 /* carrier frequency mask */
262#define IT87_CFQ_SHIFT 3 /* carrier frequency bit shift */
263
264/* TSR bits */
265#define IT87_TXFBC 0x3f /* transmitter FIFO byte count mask */
266
267/* RSR bits */
268#define IT87_RXFBC 0x3f /* receiver FIFO byte count mask */
269#define IT87_RXFTO 0x80 /* receiver FIFO time-out */
270
271/* IIR bits */
272#define IT87_IP 0x01 /* interrupt pending */
273#define IT87_II 0x06 /* interrupt identification mask */
274#define IT87_II_NOINT 0x00 /* no interrupt */
275#define IT87_II_TXLDL 0x02 /* transmitter low data level */
276#define IT87_II_RXDS 0x04 /* receiver data stored */
277#define IT87_II_RXFO 0x06 /* receiver FIFO overrun */
278
279/*
280 * IT8512E/F
281 *
282 * Hardware data obtained from:
283 *
284 * IT8512E/F
285 * Embedded Controller
286 * Preliminary Specification V0.4.1
287 *
288 * Note that the CIR registers are not directly available to the host, because
289 * they only are accessible to the integrated microcontroller. Thus, in order
290 * use it, some kind of bridging is required. As the bridging may depend on
291 * the controller firmware in use, we are going to use the PNP ID in order to
292 * determine the strategy and ports available. See after these generic
293 * IT8512E/F register definitions for register definitions for those
294 * strategies.
295 */
296
297/* register offsets */
298#define IT85_C0DR 0x00 /* data register */
299#define IT85_C0MSTCR 0x01 /* master control register */
300#define IT85_C0IER 0x02 /* interrupt enable register */
301#define IT85_C0IIR 0x03 /* interrupt identification register */
302#define IT85_C0CFR 0x04 /* carrier frequency register */
303#define IT85_C0RCR 0x05 /* receiver control register */
304#define IT85_C0TCR 0x06 /* transmitter control register */
305#define IT85_C0SCK 0x07 /* slow clock control register */
306#define IT85_C0BDLR 0x08 /* baud rate divisor low byte register */
307#define IT85_C0BDHR 0x09 /* baud rate divisor high byte register */
308#define IT85_C0TFSR 0x0a /* transmitter FIFO status register */
309#define IT85_C0RFSR 0x0b /* receiver FIFO status register */
310#define IT85_C0WCL 0x0d /* wakeup code length register */
311#define IT85_C0WCR 0x0e /* wakeup code read/write register */
312#define IT85_C0WPS 0x0f /* wakeup power control/status register */
313
314#define IT85_IOREG_LENGTH 0x10 /* length of register file */
315
316/* C0MSTCR bits */
317#define IT85_RESET 0x01 /* reset */
318#define IT85_FIFOCLR 0x02 /* FIFO clear bit */
319#define IT85_FIFOTL 0x0c /* FIFO level threshold mask */
320#define IT85_FIFOTL_DEFAULT 0x08 /* FIFO level threshold default
321 * 0x00 -> 1, 0x04 -> 7, 0x08 -> 17,
322 * 0x0c -> 25 */
323#define IT85_ILE 0x10 /* internal loopback enable */
324#define IT85_ILSEL 0x20 /* internal loopback select */
325
326/* C0IER bits */
327#define IT85_TLDLIE 0x01 /* TX low data level interrupt enable */
328#define IT85_RDAIE 0x02 /* RX data available interrupt enable */
329#define IT85_RFOIE 0x04 /* RX FIFO overrun interrupt enable */
330#define IT85_IEC 0x80 /* interrupt enable function control */
331
332/* C0IIR bits */
333#define IT85_TLDLI 0x01 /* transmitter low data level interrupt */
334#define IT85_RDAI 0x02 /* receiver data available interrupt */
335#define IT85_RFOI 0x04 /* receiver FIFO overrun interrupt */
336#define IT85_NIP 0x80 /* no interrupt pending */
337
338/* C0CFR bits */
339#define IT85_CFQ 0x1f /* carrier frequency mask */
340#define IT85_HCFS 0x20 /* high speed carrier frequency select */
341
342/* C0RCR bits */
343#define IT85_RXDCR 0x07 /* receiver demodulation carrier range mask */
344#define IT85_RXACT 0x08 /* receiver active */
345#define IT85_RXEND 0x10 /* receiver demodulation enable */
346#define IT85_RDWOS 0x20 /* receiver data without sync */
347#define IT85_RXEN 0x80 /* receiver enable */
348
349/* C0TCR bits */
350#define IT85_TXMPW 0x07 /* transmitter modulation pulse width mask */
351#define IT85_TXMPW_DEFAULT 0x04 /* default modulation pulse width */
352#define IT85_TXMPM 0x18 /* transmitter modulation pulse mode mask */
353#define IT85_TXMPM_DEFAULT 0x00 /* modulation pulse mode default */
354#define IT85_TXENDF 0x20 /* transmitter deferral */
355#define IT85_TXRLE 0x40 /* transmitter run length enable */
356
357/* C0SCK bits */
358#define IT85_SCKS 0x01 /* slow clock select */
359#define IT85_TXDCKG 0x02 /* TXD clock gating */
360#define IT85_DLL1P8E 0x04 /* DLL 1.8432M enable */
361#define IT85_DLLTE 0x08 /* DLL test enable */
362#define IT85_BRCM 0x70 /* baud rate count mode */
363#define IT85_DLLOCK 0x80 /* DLL lock */
364
365/* C0TFSR bits */
366#define IT85_TXFBC 0x3f /* transmitter FIFO count mask */
367
368/* C0RFSR bits */
369#define IT85_RXFBC 0x3f /* receiver FIFO count mask */
370#define IT85_RXFTO 0x80 /* receiver FIFO time-out */
371
372/* C0WCL bits */
373#define IT85_WCL 0x3f /* wakeup code length mask */
374
375/* C0WPS bits */
376#define IT85_CIRPOSIE 0x01 /* power on/off status interrupt enable */
377#define IT85_CIRPOIS 0x02 /* power on/off interrupt status */
378#define IT85_CIRPOII 0x04 /* power on/off interrupt identification */
379#define IT85_RCRST 0x10 /* wakeup code reading counter reset bit */
380#define IT85_WCRST 0x20 /* wakeup code writing counter reset bit */
381
382/*
383 * ITE8708
384 *
385 * Hardware data obtained from hacked driver for IT8512 in this forum post:
386 *
387 * http://ubuntuforums.org/showthread.php?t=1028640
388 *
389 * Although there's no official documentation for that driver, analysis would
390 * suggest that it maps the 16 registers of IT8512 onto two 8-register banks,
391 * selectable by a single bank-select bit that's mapped onto both banks. The
392 * IT8512 registers are mapped in a different order, so that the first bank
393 * maps the ones that are used more often, and two registers that share a
394 * reserved high-order bit are placed at the same offset in both banks in
395 * order to reuse the reserved bit as the bank select bit.
396 */
397
398/* register offsets */
399
400/* mapped onto both banks */
401#define IT8708_BANKSEL 0x07 /* bank select register */
402#define IT8708_HRAE 0x80 /* high registers access enable */
403
404/* mapped onto the low bank */
405#define IT8708_C0DR 0x00 /* data register */
406#define IT8708_C0MSTCR 0x01 /* master control register */
407#define IT8708_C0IER 0x02 /* interrupt enable register */
408#define IT8708_C0IIR 0x03 /* interrupt identification register */
409#define IT8708_C0RFSR 0x04 /* receiver FIFO status register */
410#define IT8708_C0RCR 0x05 /* receiver control register */
411#define IT8708_C0TFSR 0x06 /* transmitter FIFO status register */
412#define IT8708_C0TCR 0x07 /* transmitter control register */
413
414/* mapped onto the high bank */
415#define IT8708_C0BDLR 0x01 /* baud rate divisor low byte register */
416#define IT8708_C0BDHR 0x02 /* baud rate divisor high byte register */
417#define IT8708_C0CFR 0x04 /* carrier frequency register */
418
419/* registers whose bank mapping we don't know, since they weren't being used
420 * in the hacked driver... most probably they belong to the high bank too,
421 * since they fit in the holes the other registers leave */
422#define IT8708_C0SCK 0x03 /* slow clock control register */
423#define IT8708_C0WCL 0x05 /* wakeup code length register */
424#define IT8708_C0WCR 0x06 /* wakeup code read/write register */
425#define IT8708_C0WPS 0x07 /* wakeup power control/status register */
426
427#define IT8708_IOREG_LENGTH 0x08 /* length of register file */
428
429/* two more registers that are defined in the hacked driver, but can't be
430 * found in the data sheets; no idea what they are or how they are accessed,
431 * since the hacked driver doesn't seem to use them */
432#define IT8708_CSCRR 0x00
433#define IT8708_CGPINTR 0x01
434
435/* CSCRR bits */
436#define IT8708_CSCRR_SCRB 0x3f
437#define IT8708_CSCRR_PM 0x80
438
439/* CGPINTR bits */
440#define IT8708_CGPINT 0x01
441
442/*
443 * ITE8709
444 *
445 * Hardware interfacing data obtained from the original lirc_ite8709 driver.
446 * Verbatim from its sources:
447 *
448 * The ITE8709 device seems to be the combination of IT8512 superIO chip and
449 * a specific firmware running on the IT8512's embedded micro-controller.
450 * In addition of the embedded micro-controller, the IT8512 chip contains a
451 * CIR module and several other modules. A few modules are directly accessible
452 * by the host CPU, but most of them are only accessible by the
453 * micro-controller. The CIR module is only accessible by the
454 * micro-controller.
455 *
456 * The battery-backed SRAM module is accessible by the host CPU and the
457 * micro-controller. So one of the MC's firmware role is to act as a bridge
458 * between the host CPU and the CIR module. The firmware implements a kind of
459 * communication protocol using the SRAM module as a shared memory. The IT8512
460 * specification is publicly available on ITE's web site, but the
461 * communication protocol is not, so it was reverse-engineered.
462 */
463
464/* register offsets */
465#define IT8709_RAM_IDX 0x00 /* index into the SRAM module bytes */
466#define IT8709_RAM_VAL 0x01 /* read/write data to the indexed byte */
467
468#define IT8709_IOREG_LENGTH 0x02 /* length of register file */
469
470/* register offsets inside the SRAM module */
471#define IT8709_MODE 0x1a /* request/ack byte */
472#define IT8709_REG_IDX 0x1b /* index of the CIR register to access */
473#define IT8709_REG_VAL 0x1c /* value read/to be written */
474#define IT8709_IIR 0x1e /* interrupt identification register */
475#define IT8709_RFSR 0x1f /* receiver FIFO status register */
476#define IT8709_FIFO 0x20 /* start of in RAM RX FIFO copy */
477
478/* MODE values */
479#define IT8709_IDLE 0x00
480#define IT8709_WRITE 0x01
481#define IT8709_READ 0x02
diff --git a/drivers/media/rc/keymaps/Makefile b/drivers/media/rc/keymaps/Makefile
index 0659e9f50144..85cac7ddbcec 100644
--- a/drivers/media/rc/keymaps/Makefile
+++ b/drivers/media/rc/keymaps/Makefile
@@ -37,7 +37,6 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
37 rc-gadmei-rm008z.o \ 37 rc-gadmei-rm008z.o \
38 rc-genius-tvgo-a11mce.o \ 38 rc-genius-tvgo-a11mce.o \
39 rc-gotview7135.o \ 39 rc-gotview7135.o \
40 rc-hauppauge-new.o \
41 rc-imon-mce.o \ 40 rc-imon-mce.o \
42 rc-imon-pad.o \ 41 rc-imon-pad.o \
43 rc-iodata-bctv7e.o \ 42 rc-iodata-bctv7e.o \
@@ -68,14 +67,15 @@ obj-$(CONFIG_RC_MAP) += rc-adstech-dvb-t-pci.o \
68 rc-proteus-2309.o \ 67 rc-proteus-2309.o \
69 rc-purpletv.o \ 68 rc-purpletv.o \
70 rc-pv951.o \ 69 rc-pv951.o \
71 rc-rc5-hauppauge-new.o \ 70 rc-hauppauge.o \
72 rc-rc5-tv.o \
73 rc-rc6-mce.o \ 71 rc-rc6-mce.o \
74 rc-real-audio-220-32-keys.o \ 72 rc-real-audio-220-32-keys.o \
75 rc-streamzap.o \ 73 rc-streamzap.o \
76 rc-tbs-nec.o \ 74 rc-tbs-nec.o \
75 rc-technisat-usb2.o \
77 rc-terratec-cinergy-xs.o \ 76 rc-terratec-cinergy-xs.o \
78 rc-terratec-slim.o \ 77 rc-terratec-slim.o \
78 rc-terratec-slim-2.o \
79 rc-tevii-nec.o \ 79 rc-tevii-nec.o \
80 rc-total-media-in-hand.o \ 80 rc-total-media-in-hand.o \
81 rc-trekstor.o \ 81 rc-trekstor.o \
diff --git a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c
index 136d3952dedc..9a8752fdcca1 100644
--- a/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c
+++ b/drivers/media/rc/keymaps/rc-adstech-dvb-t-pci.c
@@ -50,9 +50,9 @@ static struct rc_map_table adstech_dvb_t_pci[] = {
50 { 0x13, KEY_TUNER }, /* Live */ 50 { 0x13, KEY_TUNER }, /* Live */
51 { 0x0a, KEY_A }, 51 { 0x0a, KEY_A },
52 { 0x12, KEY_B }, 52 { 0x12, KEY_B },
53 { 0x03, KEY_PROG1 }, /* 1 */ 53 { 0x03, KEY_RED }, /* 1 */
54 { 0x01, KEY_PROG2 }, /* 2 */ 54 { 0x01, KEY_GREEN }, /* 2 */
55 { 0x00, KEY_PROG3 }, /* 3 */ 55 { 0x00, KEY_YELLOW }, /* 3 */
56 { 0x06, KEY_DVD }, 56 { 0x06, KEY_DVD },
57 { 0x48, KEY_AUX }, /* Photo */ 57 { 0x48, KEY_AUX }, /* Photo */
58 { 0x40, KEY_VIDEO }, 58 { 0x40, KEY_VIDEO },
diff --git a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c
index 3ddb41bc075e..c25809d4c813 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-dvbt.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-dvbt.c
@@ -26,12 +26,12 @@ static struct rc_map_table avermedia_dvbt[] = {
26 { 0x16, KEY_8 }, /* '8' / 'down arrow' */ 26 { 0x16, KEY_8 }, /* '8' / 'down arrow' */
27 { 0x36, KEY_9 }, /* '9' */ 27 { 0x36, KEY_9 }, /* '9' */
28 28
29 { 0x20, KEY_LIST }, /* 'source' */ 29 { 0x20, KEY_VIDEO }, /* 'source' */
30 { 0x10, KEY_TEXT }, /* 'teletext' */ 30 { 0x10, KEY_TEXT }, /* 'teletext' */
31 { 0x00, KEY_POWER }, /* 'power' */ 31 { 0x00, KEY_POWER }, /* 'power' */
32 { 0x04, KEY_AUDIO }, /* 'audio' */ 32 { 0x04, KEY_AUDIO }, /* 'audio' */
33 { 0x06, KEY_ZOOM }, /* 'full screen' */ 33 { 0x06, KEY_ZOOM }, /* 'full screen' */
34 { 0x18, KEY_VIDEO }, /* 'display' */ 34 { 0x18, KEY_SWITCHVIDEOMODE }, /* 'display' */
35 { 0x38, KEY_SEARCH }, /* 'loop' */ 35 { 0x38, KEY_SEARCH }, /* 'loop' */
36 { 0x08, KEY_INFO }, /* 'preview' */ 36 { 0x08, KEY_INFO }, /* 'preview' */
37 { 0x2a, KEY_REWIND }, /* 'backward <<' */ 37 { 0x2a, KEY_REWIND }, /* 'backward <<' */
diff --git a/drivers/media/rc/keymaps/rc-avermedia-m135a.c b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
index 357fea58a46e..3d2cbe4e5e46 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-m135a.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-m135a.c
@@ -108,7 +108,7 @@ static struct rc_map_table avermedia_m135a[] = {
108 { 0x0414, KEY_TEXT }, 108 { 0x0414, KEY_TEXT },
109 { 0x0415, KEY_EPG }, 109 { 0x0415, KEY_EPG },
110 { 0x041a, KEY_TV2 }, /* PIP */ 110 { 0x041a, KEY_TV2 }, /* PIP */
111 { 0x041b, KEY_MHP }, /* Snapshot */ 111 { 0x041b, KEY_CAMERA }, /* Snapshot */
112 112
113 { 0x0417, KEY_RECORD }, 113 { 0x0417, KEY_RECORD },
114 { 0x0416, KEY_PLAYPAUSE }, 114 { 0x0416, KEY_PLAYPAUSE },
diff --git a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c
index e694e6eac37e..8cd7f28808bd 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-m733a-rm-k6.c
@@ -56,7 +56,7 @@ static struct rc_map_table avermedia_m733a_rm_k6[] = {
56 { 0x0414, KEY_TEXT }, 56 { 0x0414, KEY_TEXT },
57 { 0x0415, KEY_EPG }, 57 { 0x0415, KEY_EPG },
58 { 0x041a, KEY_TV2 }, /* PIP */ 58 { 0x041a, KEY_TV2 }, /* PIP */
59 { 0x041b, KEY_MHP }, /* Snapshot */ 59 { 0x041b, KEY_CAMERA }, /* Snapshot */
60 60
61 { 0x0417, KEY_RECORD }, 61 { 0x0417, KEY_RECORD },
62 { 0x0416, KEY_PLAYPAUSE }, 62 { 0x0416, KEY_PLAYPAUSE },
diff --git a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c
index f4ca1fff455d..9d68af217d8b 100644
--- a/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c
+++ b/drivers/media/rc/keymaps/rc-avermedia-rm-ks.c
@@ -31,7 +31,7 @@ static struct rc_map_table avermedia_rm_ks[] = {
31 { 0x0505, KEY_VOLUMEDOWN }, 31 { 0x0505, KEY_VOLUMEDOWN },
32 { 0x0506, KEY_MUTE }, 32 { 0x0506, KEY_MUTE },
33 { 0x0507, KEY_RIGHT }, 33 { 0x0507, KEY_RIGHT },
34 { 0x0508, KEY_PROG1 }, 34 { 0x0508, KEY_RED },
35 { 0x0509, KEY_1 }, 35 { 0x0509, KEY_1 },
36 { 0x050a, KEY_2 }, 36 { 0x050a, KEY_2 },
37 { 0x050b, KEY_3 }, 37 { 0x050b, KEY_3 },
diff --git a/drivers/media/rc/keymaps/rc-behold-columbus.c b/drivers/media/rc/keymaps/rc-behold-columbus.c
index 4b787fa94f08..8bf058f67f0c 100644
--- a/drivers/media/rc/keymaps/rc-behold-columbus.c
+++ b/drivers/media/rc/keymaps/rc-behold-columbus.c
@@ -28,7 +28,7 @@ static struct rc_map_table behold_columbus[] = {
28 * */ 28 * */
29 29
30 { 0x13, KEY_MUTE }, 30 { 0x13, KEY_MUTE },
31 { 0x11, KEY_PROPS }, 31 { 0x11, KEY_VIDEO },
32 { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */ 32 { 0x1C, KEY_TUNER }, /* KEY_TV/KEY_RADIO */
33 { 0x12, KEY_POWER }, 33 { 0x12, KEY_POWER },
34 34
diff --git a/drivers/media/rc/keymaps/rc-behold.c b/drivers/media/rc/keymaps/rc-behold.c
index 0ee1f149364c..c909a234c776 100644
--- a/drivers/media/rc/keymaps/rc-behold.c
+++ b/drivers/media/rc/keymaps/rc-behold.c
@@ -97,7 +97,7 @@ static struct rc_map_table behold[] = {
97 { 0x6b861a, KEY_STOP }, 97 { 0x6b861a, KEY_STOP },
98 { 0x6b860e, KEY_TEXT }, 98 { 0x6b860e, KEY_TEXT },
99 { 0x6b861f, KEY_RED }, /*XXX KEY_AUDIO */ 99 { 0x6b861f, KEY_RED }, /*XXX KEY_AUDIO */
100 { 0x6b861e, KEY_YELLOW }, /*XXX KEY_SOURCE */ 100 { 0x6b861e, KEY_VIDEO },
101 101
102 /* 0x1d 0x13 0x19 * 102 /* 0x1d 0x13 0x19 *
103 * SLEEP PREVIEW DVB * 103 * SLEEP PREVIEW DVB *
diff --git a/drivers/media/rc/keymaps/rc-budget-ci-old.c b/drivers/media/rc/keymaps/rc-budget-ci-old.c
index 97fc3862f608..2f66e4310d20 100644
--- a/drivers/media/rc/keymaps/rc-budget-ci-old.c
+++ b/drivers/media/rc/keymaps/rc-budget-ci-old.c
@@ -12,7 +12,8 @@
12 12
13#include <media/rc-map.h> 13#include <media/rc-map.h>
14 14
15/* From reading the following remotes: 15/*
16 * From reading the following remotes:
16 * Zenith Universal 7 / TV Mode 807 / VCR Mode 837 17 * Zenith Universal 7 / TV Mode 807 / VCR Mode 837
17 * Hauppauge (from NOVA-CI-s box product) 18 * Hauppauge (from NOVA-CI-s box product)
18 * This is a "middle of the road" approach, differences are noted 19 * This is a "middle of the road" approach, differences are noted
diff --git a/drivers/media/rc/keymaps/rc-cinergy.c b/drivers/media/rc/keymaps/rc-cinergy.c
index 99520ff65b61..cf3a6bfb190c 100644
--- a/drivers/media/rc/keymaps/rc-cinergy.c
+++ b/drivers/media/rc/keymaps/rc-cinergy.c
@@ -25,7 +25,7 @@ static struct rc_map_table cinergy[] = {
25 { 0x09, KEY_9 }, 25 { 0x09, KEY_9 },
26 26
27 { 0x0a, KEY_POWER }, 27 { 0x0a, KEY_POWER },
28 { 0x0b, KEY_PROG1 }, /* app */ 28 { 0x0b, KEY_MEDIA }, /* app */
29 { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */ 29 { 0x0c, KEY_ZOOM }, /* zoom/fullscreen */
30 { 0x0d, KEY_CHANNELUP }, /* channel */ 30 { 0x0d, KEY_CHANNELUP }, /* channel */
31 { 0x0e, KEY_CHANNELDOWN }, /* channel- */ 31 { 0x0e, KEY_CHANNELDOWN }, /* channel- */
diff --git a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c
index 43912bd02a9e..82c0200029af 100644
--- a/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c
+++ b/drivers/media/rc/keymaps/rc-dntv-live-dvb-t.c
@@ -32,7 +32,7 @@ static struct rc_map_table dntv_live_dvb_t[] = {
32 { 0x0c, KEY_SEARCH }, /* scan */ 32 { 0x0c, KEY_SEARCH }, /* scan */
33 { 0x0d, KEY_STOP }, 33 { 0x0d, KEY_STOP },
34 { 0x0e, KEY_PAUSE }, 34 { 0x0e, KEY_PAUSE },
35 { 0x0f, KEY_LIST }, /* source */ 35 { 0x0f, KEY_VIDEO }, /* source */
36 36
37 { 0x10, KEY_MUTE }, 37 { 0x10, KEY_MUTE },
38 { 0x11, KEY_REWIND }, /* backward << */ 38 { 0x11, KEY_REWIND }, /* backward << */
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv.c b/drivers/media/rc/keymaps/rc-encore-enltv.c
index afa4e92284ef..e56ac6e9670a 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv.c
@@ -24,7 +24,7 @@ static struct rc_map_table encore_enltv[] = {
24 { 0x1e, KEY_TV }, 24 { 0x1e, KEY_TV },
25 { 0x00, KEY_VIDEO }, 25 { 0x00, KEY_VIDEO },
26 { 0x01, KEY_AUDIO }, /* music */ 26 { 0x01, KEY_AUDIO }, /* music */
27 { 0x02, KEY_MHP }, /* picture */ 27 { 0x02, KEY_CAMERA }, /* picture */
28 28
29 { 0x1f, KEY_1 }, 29 { 0x1f, KEY_1 },
30 { 0x03, KEY_2 }, 30 { 0x03, KEY_2 },
@@ -77,7 +77,7 @@ static struct rc_map_table encore_enltv[] = {
77 { 0x50, KEY_SLEEP }, /* shutdown */ 77 { 0x50, KEY_SLEEP }, /* shutdown */
78 { 0x51, KEY_MODE }, /* stereo > main */ 78 { 0x51, KEY_MODE }, /* stereo > main */
79 { 0x52, KEY_SELECT }, /* stereo > sap */ 79 { 0x52, KEY_SELECT }, /* stereo > sap */
80 { 0x53, KEY_PROG1 }, /* teletext */ 80 { 0x53, KEY_TEXT }, /* teletext */
81 81
82 82
83 { 0x59, KEY_RED }, /* AP1 */ 83 { 0x59, KEY_RED }, /* AP1 */
diff --git a/drivers/media/rc/keymaps/rc-encore-enltv2.c b/drivers/media/rc/keymaps/rc-encore-enltv2.c
index 7d5b00ed4ff2..b6264f1bc4c1 100644
--- a/drivers/media/rc/keymaps/rc-encore-enltv2.c
+++ b/drivers/media/rc/keymaps/rc-encore-enltv2.c
@@ -32,7 +32,7 @@ static struct rc_map_table encore_enltv2[] = {
32 { 0x64, KEY_LAST }, /* +100 */ 32 { 0x64, KEY_LAST }, /* +100 */
33 { 0x4e, KEY_AGAIN }, /* Recall */ 33 { 0x4e, KEY_AGAIN }, /* Recall */
34 34
35 { 0x6c, KEY_SWITCHVIDEOMODE }, /* Video Source */ 35 { 0x6c, KEY_VIDEO }, /* Video Source */
36 { 0x5e, KEY_MENU }, 36 { 0x5e, KEY_MENU },
37 { 0x56, KEY_SCREEN }, 37 { 0x56, KEY_SCREEN },
38 { 0x7a, KEY_SETUP }, 38 { 0x7a, KEY_SETUP },
diff --git a/drivers/media/rc/keymaps/rc-flydvb.c b/drivers/media/rc/keymaps/rc-flydvb.c
index aea2f4acf7d8..a8b0f66edaa9 100644
--- a/drivers/media/rc/keymaps/rc-flydvb.c
+++ b/drivers/media/rc/keymaps/rc-flydvb.c
@@ -37,8 +37,8 @@ static struct rc_map_table flydvb[] = {
37 { 0x13, KEY_CHANNELDOWN }, /* CH- */ 37 { 0x13, KEY_CHANNELDOWN }, /* CH- */
38 { 0x1d, KEY_ENTER }, /* Enter */ 38 { 0x1d, KEY_ENTER }, /* Enter */
39 39
40 { 0x1a, KEY_MODE }, /* PIP */ 40 { 0x1a, KEY_TV2 }, /* PIP */
41 { 0x18, KEY_TUNER }, /* Source */ 41 { 0x18, KEY_VIDEO }, /* Source */
42 42
43 { 0x1e, KEY_RECORD }, /* Record/Pause */ 43 { 0x1e, KEY_RECORD }, /* Record/Pause */
44 { 0x15, KEY_ANGLE }, /* Swap (no label on key) */ 44 { 0x15, KEY_ANGLE }, /* Swap (no label on key) */
diff --git a/drivers/media/rc/keymaps/rc-hauppauge-new.c b/drivers/media/rc/keymaps/rc-hauppauge-new.c
deleted file mode 100644
index bd11da46e56a..000000000000
--- a/drivers/media/rc/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
19static struct rc_map_table 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
77static struct rc_map_list hauppauge_new_map = {
78 .map = {
79 .scan = hauppauge_new,
80 .size = ARRAY_SIZE(hauppauge_new),
81 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
82 .name = RC_MAP_HAUPPAUGE_NEW,
83 }
84};
85
86static int __init init_rc_map_hauppauge_new(void)
87{
88 return rc_map_register(&hauppauge_new_map);
89}
90
91static void __exit exit_rc_map_hauppauge_new(void)
92{
93 rc_map_unregister(&hauppauge_new_map);
94}
95
96module_init(init_rc_map_hauppauge_new)
97module_exit(exit_rc_map_hauppauge_new)
98
99MODULE_LICENSE("GPL");
100MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
diff --git a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c b/drivers/media/rc/keymaps/rc-hauppauge.c
index dfc9b15f43a9..cd3db7779772 100644
--- a/drivers/media/rc/keymaps/rc-rc5-hauppauge-new.c
+++ b/drivers/media/rc/keymaps/rc-hauppauge.c
@@ -1,8 +1,14 @@
1/* rc5-hauppauge-new.h - Keytable for rc5_hauppauge_new Remote Controller 1/* rc-hauppauge.c - Keytable for Hauppauge Remote Controllers
2 * 2 *
3 * keymap imported from ir-keymaps.c 3 * keymap imported from ir-keymaps.c
4 * 4 *
5 * Copyright (c) 2010 by Mauro Carvalho Chehab <mchehab@redhat.com> 5 * This map currently contains the code for four different RCs:
6 * - New Hauppauge Gray;
7 * - Old Hauppauge Gray (with a golden screen for media keys);
8 * - Hauppauge Black;
9 * - DSR-0112 remote bundled with Haupauge MiniStick.
10 *
11 * Copyright (c) 2010-2011 by Mauro Carvalho Chehab <mchehab@redhat.com>
6 * 12 *
7 * This program is free software; you can redistribute it and/or modify 13 * 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 14 * it under the terms of the GNU General Public License as published by
@@ -20,63 +26,124 @@
20 */ 26 */
21 27
22static struct rc_map_table rc5_hauppauge_new[] = { 28static struct rc_map_table rc5_hauppauge_new[] = {
23 /* Keys 0 to 9 */ 29 /*
24 { 0x1e00, KEY_0 }, 30 * Remote Controller Hauppauge Gray found on modern devices
31 * Keycodes start with address = 0x1e
32 */
33
34 { 0x1e3b, KEY_SELECT }, /* GO / house symbol */
35 { 0x1e3d, KEY_POWER2 }, /* system power (green button) */
36
37 { 0x1e1c, KEY_TV },
38 { 0x1e18, KEY_VIDEO }, /* Videos */
39 { 0x1e19, KEY_AUDIO }, /* Music */
40 { 0x1e1a, KEY_CAMERA }, /* Pictures */
41
42 { 0x1e1b, KEY_EPG }, /* Guide */
43 { 0x1e0c, KEY_RADIO },
44
45 { 0x1e14, KEY_UP },
46 { 0x1e15, KEY_DOWN },
47 { 0x1e16, KEY_LEFT },
48 { 0x1e17, KEY_RIGHT },
49 { 0x1e25, KEY_OK }, /* OK */
50
51 { 0x1e1f, KEY_EXIT }, /* back/exit */
52 { 0x1e0d, KEY_MENU },
53
54 { 0x1e10, KEY_VOLUMEUP },
55 { 0x1e11, KEY_VOLUMEDOWN },
56
57 { 0x1e12, KEY_PREVIOUS }, /* previous channel */
58 { 0x1e0f, KEY_MUTE },
59
60 { 0x1e20, KEY_CHANNELUP }, /* channel / program + */
61 { 0x1e21, KEY_CHANNELDOWN }, /* channel / program - */
62
63 { 0x1e37, KEY_RECORD }, /* recording */
64 { 0x1e36, KEY_STOP },
65
66 { 0x1e32, KEY_REWIND }, /* backward << */
67 { 0x1e35, KEY_PLAY },
68 { 0x1e34, KEY_FASTFORWARD }, /* forward >> */
69
70 { 0x1e24, KEY_PREVIOUSSONG }, /* replay |< */
71 { 0x1e30, KEY_PAUSE }, /* pause */
72 { 0x1e1e, KEY_NEXTSONG }, /* skip >| */
73
25 { 0x1e01, KEY_1 }, 74 { 0x1e01, KEY_1 },
26 { 0x1e02, KEY_2 }, 75 { 0x1e02, KEY_2 },
27 { 0x1e03, KEY_3 }, 76 { 0x1e03, KEY_3 },
77
28 { 0x1e04, KEY_4 }, 78 { 0x1e04, KEY_4 },
29 { 0x1e05, KEY_5 }, 79 { 0x1e05, KEY_5 },
30 { 0x1e06, KEY_6 }, 80 { 0x1e06, KEY_6 },
81
31 { 0x1e07, KEY_7 }, 82 { 0x1e07, KEY_7 },
32 { 0x1e08, KEY_8 }, 83 { 0x1e08, KEY_8 },
33 { 0x1e09, KEY_9 }, 84 { 0x1e09, KEY_9 },
34 85
35 { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */ 86 { 0x1e0a, KEY_TEXT }, /* keypad asterisk as well */
36 { 0x1e0b, KEY_RED }, /* red button */ 87 { 0x1e00, KEY_0 },
37 { 0x1e0c, KEY_RADIO }, 88 { 0x1e0e, KEY_SUBTITLE }, /* also the Pound key (#) */
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 89
56 { 0x1e1b, KEY_EPG }, /* Guide */ 90 { 0x1e0b, KEY_RED }, /* red button */
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 */ 91 { 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 */ 92 { 0x1e38, KEY_YELLOW }, /* yellow key */
75 { 0x1e3b, KEY_SELECT }, /* top right button */ 93 { 0x1e29, KEY_BLUE }, /* blue key */
76 { 0x1e3c, KEY_ZOOM }, /* full */ 94
77 { 0x1e3d, KEY_POWER }, /* system power (green button) */ 95 /*
96 * Old Remote Controller Hauppauge Gray with a golden screen
97 * Keycodes start with address = 0x1f
98 */
99 { 0x1f3d, KEY_POWER2 }, /* system power (green button) */
100 { 0x1f3b, KEY_SELECT }, /* GO */
101
102 /* Keys 0 to 9 */
103 { 0x1f00, KEY_0 },
104 { 0x1f01, KEY_1 },
105 { 0x1f02, KEY_2 },
106 { 0x1f03, KEY_3 },
107 { 0x1f04, KEY_4 },
108 { 0x1f05, KEY_5 },
109 { 0x1f06, KEY_6 },
110 { 0x1f07, KEY_7 },
111 { 0x1f08, KEY_8 },
112 { 0x1f09, KEY_9 },
113
114 { 0x1f1f, KEY_EXIT }, /* back/exit */
115 { 0x1f0d, KEY_MENU },
116
117 { 0x1f10, KEY_VOLUMEUP },
118 { 0x1f11, KEY_VOLUMEDOWN },
119 { 0x1f20, KEY_CHANNELUP }, /* channel / program + */
120 { 0x1f21, KEY_CHANNELDOWN }, /* channel / program - */
121 { 0x1f25, KEY_ENTER }, /* OK */
122
123 { 0x1f0b, KEY_RED }, /* red button */
124 { 0x1f2e, KEY_GREEN }, /* green button */
125 { 0x1f38, KEY_YELLOW }, /* yellow key */
126 { 0x1f29, KEY_BLUE }, /* blue key */
127
128 { 0x1f0f, KEY_MUTE },
129 { 0x1f0c, KEY_RADIO }, /* There's no indicator on this key */
130 { 0x1f3c, KEY_ZOOM }, /* full */
131
132 { 0x1f32, KEY_REWIND }, /* backward << */
133 { 0x1f35, KEY_PLAY },
134 { 0x1f34, KEY_FASTFORWARD }, /* forward >> */
78 135
79 /* Keycodes for DSR-0112 remote bundled with Haupauge MiniStick */ 136 { 0x1f37, KEY_RECORD }, /* recording */
137 { 0x1f36, KEY_STOP },
138 { 0x1f30, KEY_PAUSE }, /* pause */
139
140 { 0x1f24, KEY_PREVIOUSSONG }, /* replay |< */
141 { 0x1f1e, KEY_NEXTSONG }, /* skip >| */
142
143 /*
144 * Keycodes for DSR-0112 remote bundled with Haupauge MiniStick
145 * Keycodes start with address = 0x1d
146 */
80 { 0x1d00, KEY_0 }, 147 { 0x1d00, KEY_0 },
81 { 0x1d01, KEY_1 }, 148 { 0x1d01, KEY_1 },
82 { 0x1d02, KEY_2 }, 149 { 0x1d02, KEY_2 },
@@ -113,6 +180,39 @@ static struct rc_map_table rc5_hauppauge_new[] = {
113 { 0x1d3b, KEY_GOTO }, 180 { 0x1d3b, KEY_GOTO },
114 { 0x1d3d, KEY_POWER }, 181 { 0x1d3d, KEY_POWER },
115 { 0x1d3f, KEY_HOME }, 182 { 0x1d3f, KEY_HOME },
183
184 /*
185 * Keycodes for the old Black Remote Controller
186 * This one also uses RC-5 protocol
187 * Keycodes start with address = 0x00
188 */
189 { 0x001f, KEY_TV },
190 { 0x0020, KEY_CHANNELUP },
191 { 0x000c, KEY_RADIO },
192
193 { 0x0011, KEY_VOLUMEDOWN },
194 { 0x002e, KEY_ZOOM }, /* full screen */
195 { 0x0010, KEY_VOLUMEUP },
196
197 { 0x000d, KEY_MUTE },
198 { 0x0021, KEY_CHANNELDOWN },
199 { 0x0022, KEY_VIDEO }, /* source */
200
201 { 0x0001, KEY_1 },
202 { 0x0002, KEY_2 },
203 { 0x0003, KEY_3 },
204
205 { 0x0004, KEY_4 },
206 { 0x0005, KEY_5 },
207 { 0x0006, KEY_6 },
208
209 { 0x0007, KEY_7 },
210 { 0x0008, KEY_8 },
211 { 0x0009, KEY_9 },
212
213 { 0x001e, KEY_RED }, /* Reserved */
214 { 0x0000, KEY_0 },
215 { 0x0026, KEY_SLEEP }, /* Minimize */
116}; 216};
117 217
118static struct rc_map_list rc5_hauppauge_new_map = { 218static struct rc_map_list rc5_hauppauge_new_map = {
@@ -120,7 +220,7 @@ static struct rc_map_list rc5_hauppauge_new_map = {
120 .scan = rc5_hauppauge_new, 220 .scan = rc5_hauppauge_new,
121 .size = ARRAY_SIZE(rc5_hauppauge_new), 221 .size = ARRAY_SIZE(rc5_hauppauge_new),
122 .rc_type = RC_TYPE_RC5, 222 .rc_type = RC_TYPE_RC5,
123 .name = RC_MAP_RC5_HAUPPAUGE_NEW, 223 .name = RC_MAP_HAUPPAUGE,
124 } 224 }
125}; 225};
126 226
diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c
index cb67184e015c..937a81989f00 100644
--- a/drivers/media/rc/keymaps/rc-imon-mce.c
+++ b/drivers/media/rc/keymaps/rc-imon-mce.c
@@ -111,7 +111,7 @@ static struct rc_map_table imon_mce[] = {
111 { 0x800ff44d, KEY_TITLE }, 111 { 0x800ff44d, KEY_TITLE },
112 112
113 { 0x800ff40c, KEY_POWER }, 113 { 0x800ff40c, KEY_POWER },
114 { 0x800ff40d, KEY_PROG1 }, /* Windows MCE button */ 114 { 0x800ff40d, KEY_LEFTMETA }, /* Windows MCE button */
115 115
116}; 116};
117 117
diff --git a/drivers/media/rc/keymaps/rc-imon-pad.c b/drivers/media/rc/keymaps/rc-imon-pad.c
index eef46b73ca7b..63d42bd24c9e 100644
--- a/drivers/media/rc/keymaps/rc-imon-pad.c
+++ b/drivers/media/rc/keymaps/rc-imon-pad.c
@@ -125,7 +125,7 @@ static struct rc_map_table imon_pad[] = {
125 { 0x2b8195b7, KEY_CONTEXT_MENU }, /* Left Menu*/ 125 { 0x2b8195b7, KEY_CONTEXT_MENU }, /* Left Menu*/
126 { 0x02000065, KEY_COMPOSE }, /* RightMenu */ 126 { 0x02000065, KEY_COMPOSE }, /* RightMenu */
127 { 0x28b715b7, KEY_COMPOSE }, /* RightMenu */ 127 { 0x28b715b7, KEY_COMPOSE }, /* RightMenu */
128 { 0x2ab195b7, KEY_PROG1 }, /* Go or MultiMon */ 128 { 0x2ab195b7, KEY_LEFTMETA }, /* Go or MultiMon */
129 { 0x29b715b7, KEY_DASHBOARD }, /* AppLauncher */ 129 { 0x29b715b7, KEY_DASHBOARD }, /* AppLauncher */
130}; 130};
131 131
diff --git a/drivers/media/rc/keymaps/rc-kworld-315u.c b/drivers/media/rc/keymaps/rc-kworld-315u.c
index 3ce6ef79fc34..7f33edb47244 100644
--- a/drivers/media/rc/keymaps/rc-kworld-315u.c
+++ b/drivers/media/rc/keymaps/rc-kworld-315u.c
@@ -17,7 +17,7 @@
17 17
18static struct rc_map_table kworld_315u[] = { 18static struct rc_map_table kworld_315u[] = {
19 { 0x6143, KEY_POWER }, 19 { 0x6143, KEY_POWER },
20 { 0x6101, KEY_TUNER }, /* source */ 20 { 0x6101, KEY_VIDEO }, /* source */
21 { 0x610b, KEY_ZOOM }, 21 { 0x610b, KEY_ZOOM },
22 { 0x6103, KEY_POWER2 }, /* shutdown */ 22 { 0x6103, KEY_POWER2 }, /* shutdown */
23 23
diff --git a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
index e45f0b8759d0..08d183120e41 100644
--- a/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
+++ b/drivers/media/rc/keymaps/rc-kworld-plus-tv-analog.c
@@ -17,7 +17,7 @@
17 */ 17 */
18 18
19static struct rc_map_table kworld_plus_tv_analog[] = { 19static struct rc_map_table kworld_plus_tv_analog[] = {
20 { 0x0c, KEY_PROG1 }, /* Kworld key */ 20 { 0x0c, KEY_LEFTMETA }, /* Kworld key */
21 { 0x16, KEY_CLOSECD }, /* -> ) */ 21 { 0x16, KEY_CLOSECD }, /* -> ) */
22 { 0x1d, KEY_POWER2 }, 22 { 0x1d, KEY_POWER2 },
23 23
diff --git a/drivers/media/rc/keymaps/rc-lme2510.c b/drivers/media/rc/keymaps/rc-lme2510.c
index 875cd81477c7..3c1913926c1a 100644
--- a/drivers/media/rc/keymaps/rc-lme2510.c
+++ b/drivers/media/rc/keymaps/rc-lme2510.c
@@ -13,33 +13,75 @@
13 13
14 14
15static struct rc_map_table lme2510_rc[] = { 15static struct rc_map_table lme2510_rc[] = {
16 { 0xba45, KEY_0 }, 16 /* Type 1 - 26 buttons */
17 { 0xa05f, KEY_1 }, 17 { 0xef12ba45, KEY_0 },
18 { 0xaf50, KEY_2 }, 18 { 0xef12a05f, KEY_1 },
19 { 0xa25d, KEY_3 }, 19 { 0xef12af50, KEY_2 },
20 { 0xbe41, KEY_4 }, 20 { 0xef12a25d, KEY_3 },
21 { 0xf50a, KEY_5 }, 21 { 0xef12be41, KEY_4 },
22 { 0xbd42, KEY_6 }, 22 { 0xef12f50a, KEY_5 },
23 { 0xb847, KEY_7 }, 23 { 0xef12bd42, KEY_6 },
24 { 0xb649, KEY_8 }, 24 { 0xef12b847, KEY_7 },
25 { 0xfa05, KEY_9 }, 25 { 0xef12b649, KEY_8 },
26 { 0xbc43, KEY_POWER }, 26 { 0xef12fa05, KEY_9 },
27 { 0xb946, KEY_SUBTITLE }, 27 { 0xef12bc43, KEY_POWER },
28 { 0xf906, KEY_PAUSE }, 28 { 0xef12b946, KEY_SUBTITLE },
29 { 0xfc03, KEY_MEDIA_REPEAT}, 29 { 0xef12f906, KEY_PAUSE },
30 { 0xfd02, KEY_PAUSE }, 30 { 0xef12fc03, KEY_MEDIA_REPEAT},
31 { 0xa15e, KEY_VOLUMEUP }, 31 { 0xef12fd02, KEY_PAUSE },
32 { 0xa35c, KEY_VOLUMEDOWN }, 32 { 0xef12a15e, KEY_VOLUMEUP },
33 { 0xf609, KEY_CHANNELUP }, 33 { 0xef12a35c, KEY_VOLUMEDOWN },
34 { 0xe51a, KEY_CHANNELDOWN }, 34 { 0xef12f609, KEY_CHANNELUP },
35 { 0xe11e, KEY_PLAY }, 35 { 0xef12e51a, KEY_CHANNELDOWN },
36 { 0xe41b, KEY_ZOOM }, 36 { 0xef12e11e, KEY_PLAY },
37 { 0xa659, KEY_MUTE }, 37 { 0xef12e41b, KEY_ZOOM },
38 { 0xa55a, KEY_TV }, 38 { 0xef12a659, KEY_MUTE },
39 { 0xe718, KEY_RECORD }, 39 { 0xef12a55a, KEY_TV },
40 { 0xf807, KEY_EPG }, 40 { 0xef12e718, KEY_RECORD },
41 { 0xfe01, KEY_STOP }, 41 { 0xef12f807, KEY_EPG },
42 42 { 0xef12fe01, KEY_STOP },
43 /* Type 2 - 20 buttons */
44 { 0xff40ea15, KEY_0 },
45 { 0xff40f708, KEY_1 },
46 { 0xff40f609, KEY_2 },
47 { 0xff40f50a, KEY_3 },
48 { 0xff40f30c, KEY_4 },
49 { 0xff40f20d, KEY_5 },
50 { 0xff40f10e, KEY_6 },
51 { 0xff40ef10, KEY_7 },
52 { 0xff40ee11, KEY_8 },
53 { 0xff40ed12, KEY_9 },
54 { 0xff40ff00, KEY_POWER },
55 { 0xff40fb04, KEY_MEDIA_REPEAT}, /* Recall */
56 { 0xff40e51a, KEY_PAUSE }, /* Timeshift */
57 { 0xff40fd02, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
58 { 0xff40f906, KEY_VOLUMEDOWN }, /* Volumne defined as right hand*/
59 { 0xff40fe01, KEY_CHANNELUP },
60 { 0xff40fa05, KEY_CHANNELDOWN },
61 { 0xff40eb14, KEY_ZOOM },
62 { 0xff40e718, KEY_RECORD },
63 { 0xff40e916, KEY_STOP },
64 /* Type 3 - 20 buttons */
65 { 0xff00e31c, KEY_0 },
66 { 0xff00f807, KEY_1 },
67 { 0xff00ea15, KEY_2 },
68 { 0xff00f609, KEY_3 },
69 { 0xff00e916, KEY_4 },
70 { 0xff00e619, KEY_5 },
71 { 0xff00f20d, KEY_6 },
72 { 0xff00f30c, KEY_7 },
73 { 0xff00e718, KEY_8 },
74 { 0xff00a15e, KEY_9 },
75 { 0xff00ba45, KEY_POWER },
76 { 0xff00bb44, KEY_MEDIA_REPEAT}, /* Recall */
77 { 0xff00b54a, KEY_PAUSE }, /* Timeshift */
78 { 0xff00b847, KEY_VOLUMEUP }, /* 2 x -/+ Keys not marked */
79 { 0xff00bc43, KEY_VOLUMEDOWN }, /* Volumne defined as right hand*/
80 { 0xff00b946, KEY_CHANNELUP },
81 { 0xff00bf40, KEY_CHANNELDOWN },
82 { 0xff00f708, KEY_ZOOM },
83 { 0xff00bd42, KEY_RECORD },
84 { 0xff00a55a, KEY_STOP },
43}; 85};
44 86
45static struct rc_map_list lme2510_map = { 87static struct rc_map_list lme2510_map = {
diff --git a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c
index fa8fd0ab94c7..8e9969d1239b 100644
--- a/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c
+++ b/drivers/media/rc/keymaps/rc-msi-tvanywhere-plus.c
@@ -62,7 +62,7 @@ static struct rc_map_table msi_tvanywhere_plus[] = {
62 { 0x13, KEY_AGAIN }, /* Recall */ 62 { 0x13, KEY_AGAIN }, /* Recall */
63 63
64 { 0x1e, KEY_POWER }, /* Power */ 64 { 0x1e, KEY_POWER }, /* Power */
65 { 0x07, KEY_TUNER }, /* Source */ 65 { 0x07, KEY_VIDEO }, /* Source */
66 { 0x1c, KEY_SEARCH }, /* Scan */ 66 { 0x1c, KEY_SEARCH }, /* Scan */
67 { 0x18, KEY_MUTE }, /* Mute */ 67 { 0x18, KEY_MUTE }, /* Mute */
68 68
diff --git a/drivers/media/rc/keymaps/rc-nebula.c b/drivers/media/rc/keymaps/rc-nebula.c
index 3e6f077eb700..ddae20e9cd96 100644
--- a/drivers/media/rc/keymaps/rc-nebula.c
+++ b/drivers/media/rc/keymaps/rc-nebula.c
@@ -27,7 +27,7 @@ static struct rc_map_table nebula[] = {
27 { 0x0b, KEY_AUX }, 27 { 0x0b, KEY_AUX },
28 { 0x0c, KEY_DVD }, 28 { 0x0c, KEY_DVD },
29 { 0x0d, KEY_POWER }, 29 { 0x0d, KEY_POWER },
30 { 0x0e, KEY_MHP }, /* labelled 'Picture' */ 30 { 0x0e, KEY_CAMERA }, /* labelled 'Picture' */
31 { 0x0f, KEY_AUDIO }, 31 { 0x0f, KEY_AUDIO },
32 { 0x10, KEY_INFO }, 32 { 0x10, KEY_INFO },
33 { 0x11, KEY_F13 }, /* 16:9 */ 33 { 0x11, KEY_F13 }, /* 16:9 */
diff --git a/drivers/media/rc/keymaps/rc-norwood.c b/drivers/media/rc/keymaps/rc-norwood.c
index 629ee9d84537..f1c1281fbc17 100644
--- a/drivers/media/rc/keymaps/rc-norwood.c
+++ b/drivers/media/rc/keymaps/rc-norwood.c
@@ -29,7 +29,7 @@ static struct rc_map_table norwood[] = {
29 { 0x28, KEY_8 }, 29 { 0x28, KEY_8 },
30 { 0x29, KEY_9 }, 30 { 0x29, KEY_9 },
31 31
32 { 0x78, KEY_TUNER }, /* Video Source */ 32 { 0x78, KEY_VIDEO }, /* Video Source */
33 { 0x2c, KEY_EXIT }, /* Open/Close software */ 33 { 0x2c, KEY_EXIT }, /* Open/Close software */
34 { 0x2a, KEY_SELECT }, /* 2 Digit Select */ 34 { 0x2a, KEY_SELECT }, /* 2 Digit Select */
35 { 0x69, KEY_AGAIN }, /* Recall */ 35 { 0x69, KEY_AGAIN }, /* Recall */
diff --git a/drivers/media/rc/keymaps/rc-pctv-sedna.c b/drivers/media/rc/keymaps/rc-pctv-sedna.c
index fa5ae5981eb8..7cdef6e6cc0f 100644
--- a/drivers/media/rc/keymaps/rc-pctv-sedna.c
+++ b/drivers/media/rc/keymaps/rc-pctv-sedna.c
@@ -36,7 +36,7 @@ static struct rc_map_table pctv_sedna[] = {
36 { 0x0e, KEY_STOP }, 36 { 0x0e, KEY_STOP },
37 { 0x0f, KEY_PREVIOUSSONG }, 37 { 0x0f, KEY_PREVIOUSSONG },
38 { 0x10, KEY_ZOOM }, 38 { 0x10, KEY_ZOOM },
39 { 0x11, KEY_TUNER }, /* Source */ 39 { 0x11, KEY_VIDEO }, /* Source */
40 { 0x12, KEY_POWER }, 40 { 0x12, KEY_POWER },
41 { 0x13, KEY_MUTE }, 41 { 0x13, KEY_MUTE },
42 { 0x15, KEY_CHANNELDOWN }, 42 { 0x15, KEY_CHANNELDOWN },
diff --git a/drivers/media/rc/keymaps/rc-pixelview-mk12.c b/drivers/media/rc/keymaps/rc-pixelview-mk12.c
index 8d9f664e0a2d..125fc3949c15 100644
--- a/drivers/media/rc/keymaps/rc-pixelview-mk12.c
+++ b/drivers/media/rc/keymaps/rc-pixelview-mk12.c
@@ -34,7 +34,7 @@ static struct rc_map_table pixelview_mk12[] = {
34 { 0x866b13, KEY_AGAIN }, /* loop */ 34 { 0x866b13, KEY_AGAIN }, /* loop */
35 { 0x866b10, KEY_DIGITS }, /* +100 */ 35 { 0x866b10, KEY_DIGITS }, /* +100 */
36 36
37 { 0x866b00, KEY_MEDIA }, /* source */ 37 { 0x866b00, KEY_VIDEO }, /* source */
38 { 0x866b18, KEY_MUTE }, /* mute */ 38 { 0x866b18, KEY_MUTE }, /* mute */
39 { 0x866b19, KEY_CAMERA }, /* snapshot */ 39 { 0x866b19, KEY_CAMERA }, /* snapshot */
40 { 0x866b1a, KEY_SEARCH }, /* scan */ 40 { 0x866b1a, KEY_SEARCH }, /* scan */
diff --git a/drivers/media/rc/keymaps/rc-pixelview-new.c b/drivers/media/rc/keymaps/rc-pixelview-new.c
index 777a70076be2..bd78d6ac1e16 100644
--- a/drivers/media/rc/keymaps/rc-pixelview-new.c
+++ b/drivers/media/rc/keymaps/rc-pixelview-new.c
@@ -33,7 +33,7 @@ static struct rc_map_table pixelview_new[] = {
33 { 0x3e, KEY_0 }, 33 { 0x3e, KEY_0 },
34 34
35 { 0x1c, KEY_AGAIN }, /* LOOP */ 35 { 0x1c, KEY_AGAIN }, /* LOOP */
36 { 0x3f, KEY_MEDIA }, /* Source */ 36 { 0x3f, KEY_VIDEO }, /* Source */
37 { 0x1f, KEY_LAST }, /* +100 */ 37 { 0x1f, KEY_LAST }, /* +100 */
38 { 0x1b, KEY_MUTE }, 38 { 0x1b, KEY_MUTE },
39 39
diff --git a/drivers/media/rc/keymaps/rc-pixelview.c b/drivers/media/rc/keymaps/rc-pixelview.c
index 0ec5988916b9..06187e7db446 100644
--- a/drivers/media/rc/keymaps/rc-pixelview.c
+++ b/drivers/media/rc/keymaps/rc-pixelview.c
@@ -15,7 +15,7 @@
15static struct rc_map_table pixelview[] = { 15static struct rc_map_table pixelview[] = {
16 16
17 { 0x1e, KEY_POWER }, /* power */ 17 { 0x1e, KEY_POWER }, /* power */
18 { 0x07, KEY_MEDIA }, /* source */ 18 { 0x07, KEY_VIDEO }, /* source */
19 { 0x1c, KEY_SEARCH }, /* scan */ 19 { 0x1c, KEY_SEARCH }, /* scan */
20 20
21 21
diff --git a/drivers/media/rc/keymaps/rc-pv951.c b/drivers/media/rc/keymaps/rc-pv951.c
index 83a418de12c6..5e8beee94de4 100644
--- a/drivers/media/rc/keymaps/rc-pv951.c
+++ b/drivers/media/rc/keymaps/rc-pv951.c
@@ -46,10 +46,10 @@ static struct rc_map_table pv951[] = {
46 { 0x0c, KEY_SEARCH }, /* AUTOSCAN */ 46 { 0x0c, KEY_SEARCH }, /* AUTOSCAN */
47 47
48 /* Not sure what to do with these ones! */ 48 /* Not sure what to do with these ones! */
49 { 0x0f, KEY_SELECT }, /* SOURCE */ 49 { 0x0f, KEY_VIDEO }, /* SOURCE */
50 { 0x0a, KEY_KPPLUS }, /* +100 */ 50 { 0x0a, KEY_KPPLUS }, /* +100 */
51 { 0x14, KEY_EQUAL }, /* SYNC */ 51 { 0x14, KEY_EQUAL }, /* SYNC */
52 { 0x1c, KEY_MEDIA }, /* PC/TV */ 52 { 0x1c, KEY_TV }, /* PC/TV */
53}; 53};
54 54
55static struct rc_map_list pv951_map = { 55static struct rc_map_list pv951_map = {
diff --git a/drivers/media/rc/keymaps/rc-rc5-tv.c b/drivers/media/rc/keymaps/rc-rc5-tv.c
deleted file mode 100644
index 4fcef9f1f721..000000000000
--- a/drivers/media/rc/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
19static struct rc_map_table 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
58static struct rc_map_list rc5_tv_map = {
59 .map = {
60 .scan = rc5_tv,
61 .size = ARRAY_SIZE(rc5_tv),
62 .rc_type = RC_TYPE_UNKNOWN, /* Legacy IR type */
63 .name = RC_MAP_RC5_TV,
64 }
65};
66
67static int __init init_rc_map_rc5_tv(void)
68{
69 return rc_map_register(&rc5_tv_map);
70}
71
72static void __exit exit_rc_map_rc5_tv(void)
73{
74 rc_map_unregister(&rc5_tv_map);
75}
76
77module_init(init_rc_map_rc5_tv)
78module_exit(exit_rc_map_rc5_tv)
79
80MODULE_LICENSE("GPL");
81MODULE_AUTHOR("Mauro Carvalho Chehab <mchehab@redhat.com>");
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c
index 2f5dc0622b94..8dd519ecc58e 100644
--- a/drivers/media/rc/keymaps/rc-rc6-mce.c
+++ b/drivers/media/rc/keymaps/rc-rc6-mce.c
@@ -30,7 +30,7 @@ static struct rc_map_table rc6_mce[] = {
30 { 0x800f040a, KEY_DELETE }, 30 { 0x800f040a, KEY_DELETE },
31 { 0x800f040b, KEY_ENTER }, 31 { 0x800f040b, KEY_ENTER },
32 { 0x800f040c, KEY_POWER }, /* PC Power */ 32 { 0x800f040c, KEY_POWER }, /* PC Power */
33 { 0x800f040d, KEY_PROG1 }, /* Windows MCE button */ 33 { 0x800f040d, KEY_LEFTMETA }, /* Windows MCE button */
34 { 0x800f040e, KEY_MUTE }, 34 { 0x800f040e, KEY_MUTE },
35 { 0x800f040f, KEY_INFO }, 35 { 0x800f040f, KEY_INFO },
36 36
diff --git a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c
index 2d14598592d8..6813d1102118 100644
--- a/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c
+++ b/drivers/media/rc/keymaps/rc-real-audio-220-32-keys.c
@@ -35,7 +35,7 @@ static struct rc_map_table real_audio_220_32_keys[] = {
35 { 0x15, KEY_CHANNELDOWN}, 35 { 0x15, KEY_CHANNELDOWN},
36 { 0x16, KEY_ENTER}, 36 { 0x16, KEY_ENTER},
37 37
38 { 0x11, KEY_LIST}, /* Source */ 38 { 0x11, KEY_VIDEO}, /* Source */
39 { 0x0d, KEY_AUDIO}, /* stereo */ 39 { 0x0d, KEY_AUDIO}, /* stereo */
40 40
41 { 0x0f, KEY_PREVIOUS}, /* Prev */ 41 { 0x0f, KEY_PREVIOUS}, /* Prev */
diff --git a/drivers/media/rc/keymaps/rc-technisat-usb2.c b/drivers/media/rc/keymaps/rc-technisat-usb2.c
new file mode 100644
index 000000000000..4afe5774f192
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-technisat-usb2.c
@@ -0,0 +1,93 @@
1/* rc-technisat-usb2.c - Keytable for SkyStar HD USB
2 *
3 * Copyright (C) 2010 Patrick Boettcher,
4 * Kernel Labs Inc. PO Box 745, St James, NY 11780
5 *
6 * Development was sponsored by Technisat Digital UK Limited, whose
7 * registered office is Witan Gate House 500 - 600 Witan Gate West,
8 * Milton Keynes, MK9 1SH
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of the
13 * License, or (at your option) any later version.
14 *
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., 675 Mass Ave, Cambridge, MA 02139, USA.
19 *
20 * THIS PROGRAM IS PROVIDED "AS IS" AND BOTH THE COPYRIGHT HOLDER AND
21 * TECHNISAT DIGITAL UK LTD DISCLAIM ALL WARRANTIES WITH REGARD TO
22 * THIS PROGRAM INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY OR
23 * FITNESS FOR A PARTICULAR PURPOSE. NEITHER THE COPYRIGHT HOLDER
24 * NOR TECHNISAT DIGITAL UK LIMITED SHALL BE LIABLE FOR ANY SPECIAL,
25 * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
26 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
27 * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
28 * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS PROGRAM. See the
29 * GNU General Public License for more details.
30 */
31
32#include <media/rc-map.h>
33
34static struct rc_map_table technisat_usb2[] = {
35 {0x0a0c, KEY_POWER},
36 {0x0a01, KEY_1},
37 {0x0a02, KEY_2},
38 {0x0a03, KEY_3},
39 {0x0a0d, KEY_MUTE},
40 {0x0a04, KEY_4},
41 {0x0a05, KEY_5},
42 {0x0a06, KEY_6},
43 {0x0a38, KEY_VIDEO}, /* EXT */
44 {0x0a07, KEY_7},
45 {0x0a08, KEY_8},
46 {0x0a09, KEY_9},
47 {0x0a00, KEY_0},
48 {0x0a4f, KEY_INFO},
49 {0x0a20, KEY_CHANNELUP},
50 {0x0a52, KEY_MENU},
51 {0x0a11, KEY_VOLUMEUP},
52 {0x0a57, KEY_OK},
53 {0x0a10, KEY_VOLUMEDOWN},
54 {0x0a2f, KEY_EPG},
55 {0x0a21, KEY_CHANNELDOWN},
56 {0x0a22, KEY_REFRESH},
57 {0x0a3c, KEY_TEXT},
58 {0x0a76, KEY_ENTER}, /* HOOK */
59 {0x0a0f, KEY_HELP},
60 {0x0a6b, KEY_RED},
61 {0x0a6c, KEY_GREEN},
62 {0x0a6d, KEY_YELLOW},
63 {0x0a6e, KEY_BLUE},
64 {0x0a29, KEY_STOP},
65 {0x0a23, KEY_LANGUAGE},
66 {0x0a53, KEY_TV},
67 {0x0a0a, KEY_PROGRAM},
68};
69
70static struct rc_map_list technisat_usb2_map = {
71 .map = {
72 .scan = technisat_usb2,
73 .size = ARRAY_SIZE(technisat_usb2),
74 .rc_type = RC_TYPE_RC5,
75 .name = RC_MAP_TECHNISAT_USB2,
76 }
77};
78
79static int __init init_rc_map(void)
80{
81 return rc_map_register(&technisat_usb2_map);
82}
83
84static void __exit exit_rc_map(void)
85{
86 rc_map_unregister(&technisat_usb2_map);
87}
88
89module_init(init_rc_map)
90module_exit(exit_rc_map)
91
92MODULE_AUTHOR("Patrick Boettcher <pboettcher@kernellabs.com>");
93MODULE_LICENSE("GPL");
diff --git a/drivers/media/rc/keymaps/rc-terratec-slim-2.c b/drivers/media/rc/keymaps/rc-terratec-slim-2.c
new file mode 100644
index 000000000000..44093918cf03
--- /dev/null
+++ b/drivers/media/rc/keymaps/rc-terratec-slim-2.c
@@ -0,0 +1,72 @@
1/*
2 * TerraTec remote controller keytable
3 *
4 * Copyright (C) 2011 Martin Groszhauser <mgroszhauser@gmail.com>
5 * Copyright (C) 2011 Antti Palosaari <crope@iki.fi>
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 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 */
21
22#include <media/rc-map.h>
23
24/*
25 * TerraTec slim remote, 6 rows, 3 columns.
26 * Keytable from Martin Groszhauser <mgroszhauser@gmail.com>
27 */
28static struct rc_map_table terratec_slim_2[] = {
29 { 0x8001, KEY_MUTE }, /* MUTE */
30 { 0x8002, KEY_VOLUMEDOWN },
31 { 0x8003, KEY_CHANNELDOWN },
32 { 0x8004, KEY_1 },
33 { 0x8005, KEY_2 },
34 { 0x8006, KEY_3 },
35 { 0x8007, KEY_4 },
36 { 0x8008, KEY_5 },
37 { 0x8009, KEY_6 },
38 { 0x800a, KEY_7 },
39 { 0x800c, KEY_ZOOM }, /* [fullscreen] */
40 { 0x800d, KEY_0 },
41 { 0x800e, KEY_AGAIN }, /* [two arrows forming a circle] */
42 { 0x8012, KEY_POWER2 }, /* [red power button] */
43 { 0x801a, KEY_VOLUMEUP },
44 { 0x801b, KEY_8 },
45 { 0x801e, KEY_CHANNELUP },
46 { 0x801f, KEY_9 },
47};
48
49static struct rc_map_list terratec_slim_2_map = {
50 .map = {
51 .scan = terratec_slim_2,
52 .size = ARRAY_SIZE(terratec_slim_2),
53 .rc_type = RC_TYPE_NEC,
54 .name = RC_MAP_TERRATEC_SLIM_2,
55 }
56};
57
58static int __init init_rc_map_terratec_slim_2(void)
59{
60 return rc_map_register(&terratec_slim_2_map);
61}
62
63static void __exit exit_rc_map_terratec_slim_2(void)
64{
65 rc_map_unregister(&terratec_slim_2_map);
66}
67
68module_init(init_rc_map_terratec_slim_2)
69module_exit(exit_rc_map_terratec_slim_2)
70
71MODULE_LICENSE("GPL");
72MODULE_AUTHOR("Antti Palosaari <crope@iki.fi>");
diff --git a/drivers/media/rc/keymaps/rc-winfast.c b/drivers/media/rc/keymaps/rc-winfast.c
index 2747db43b70c..0062ca291959 100644
--- a/drivers/media/rc/keymaps/rc-winfast.c
+++ b/drivers/media/rc/keymaps/rc-winfast.c
@@ -27,15 +27,15 @@ static struct rc_map_table winfast[] = {
27 { 0x0e, KEY_8 }, 27 { 0x0e, KEY_8 },
28 { 0x0f, KEY_9 }, 28 { 0x0f, KEY_9 },
29 29
30 { 0x00, KEY_POWER }, 30 { 0x00, KEY_POWER2 },
31 { 0x1b, KEY_AUDIO }, /* Audio Source */ 31 { 0x1b, KEY_AUDIO }, /* Audio Source */
32 { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */ 32 { 0x02, KEY_TUNER }, /* TV/FM, not on Y0400052 */
33 { 0x1e, KEY_VIDEO }, /* Video Source */ 33 { 0x1e, KEY_VIDEO }, /* Video Source */
34 { 0x16, KEY_INFO }, /* Display information */ 34 { 0x16, KEY_INFO }, /* Display information */
35 { 0x04, KEY_VOLUMEUP }, 35 { 0x04, KEY_LEFT },
36 { 0x08, KEY_VOLUMEDOWN }, 36 { 0x08, KEY_RIGHT },
37 { 0x0c, KEY_CHANNELUP }, 37 { 0x0c, KEY_UP },
38 { 0x10, KEY_CHANNELDOWN }, 38 { 0x10, KEY_DOWN },
39 { 0x03, KEY_ZOOM }, /* fullscreen */ 39 { 0x03, KEY_ZOOM }, /* fullscreen */
40 { 0x1f, KEY_TEXT }, /* closed caption/teletext */ 40 { 0x1f, KEY_TEXT }, /* closed caption/teletext */
41 { 0x20, KEY_SLEEP }, 41 { 0x20, KEY_SLEEP },
@@ -47,7 +47,7 @@ static struct rc_map_table winfast[] = {
47 { 0x2e, KEY_BLUE }, 47 { 0x2e, KEY_BLUE },
48 { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */ 48 { 0x18, KEY_KPPLUS }, /* fine tune + , not on Y040052 */
49 { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */ 49 { 0x19, KEY_KPMINUS }, /* fine tune - , not on Y040052 */
50 { 0x2a, KEY_MEDIA }, /* PIP (Picture in picture */ 50 { 0x2a, KEY_TV2 }, /* PIP (Picture in picture */
51 { 0x21, KEY_DOT }, 51 { 0x21, KEY_DOT },
52 { 0x13, KEY_ENTER }, 52 { 0x13, KEY_ENTER },
53 { 0x11, KEY_LAST }, /* Recall (last channel */ 53 { 0x11, KEY_LAST }, /* Recall (last channel */
@@ -57,7 +57,7 @@ static struct rc_map_table winfast[] = {
57 { 0x25, KEY_TIME }, /* Time Shifting */ 57 { 0x25, KEY_TIME }, /* Time Shifting */
58 { 0x26, KEY_STOP }, 58 { 0x26, KEY_STOP },
59 { 0x27, KEY_RECORD }, 59 { 0x27, KEY_RECORD },
60 { 0x28, KEY_SAVE }, /* Screenshot */ 60 { 0x28, KEY_CAMERA }, /* Screenshot */
61 { 0x2f, KEY_MENU }, 61 { 0x2f, KEY_MENU },
62 { 0x30, KEY_CANCEL }, 62 { 0x30, KEY_CANCEL },
63 { 0x31, KEY_CHANNEL }, /* Channel Surf */ 63 { 0x31, KEY_CHANNEL }, /* Channel Surf */
@@ -70,10 +70,10 @@ static struct rc_map_table winfast[] = {
70 { 0x38, KEY_DVD }, 70 { 0x38, KEY_DVD },
71 71
72 { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */ 72 { 0x1a, KEY_MODE}, /* change to MCE mode on Y04G0051 */
73 { 0x3e, KEY_F21 }, /* MCE +VOL, on Y04G0033 */ 73 { 0x3e, KEY_VOLUMEUP }, /* MCE +VOL, on Y04G0033 */
74 { 0x3a, KEY_F22 }, /* MCE -VOL, on Y04G0033 */ 74 { 0x3a, KEY_VOLUMEDOWN }, /* MCE -VOL, on Y04G0033 */
75 { 0x3b, KEY_F23 }, /* MCE +CH, on Y04G0033 */ 75 { 0x3b, KEY_CHANNELUP }, /* MCE +CH, on Y04G0033 */
76 { 0x3f, KEY_F24 } /* MCE -CH, on Y04G0033 */ 76 { 0x3f, KEY_CHANNELDOWN } /* MCE -CH, on Y04G0033 */
77}; 77};
78 78
79static struct rc_map_list winfast_map = { 79static struct rc_map_list winfast_map = {
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index e4f8eac7f717..044fb7a382d6 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -186,7 +186,7 @@ static const struct mceusb_model mceusb_model[] = {
186 * remotes, but we should have something handy, 186 * remotes, but we should have something handy,
187 * to allow testing it 187 * to allow testing it
188 */ 188 */
189 .rc_map = RC_MAP_RC5_HAUPPAUGE_NEW, 189 .rc_map = RC_MAP_HAUPPAUGE,
190 .name = "Conexant Hybrid TV (cx231xx) MCE IR", 190 .name = "Conexant Hybrid TV (cx231xx) MCE IR",
191 }, 191 },
192 [CX_HYBRID_TV] = { 192 [CX_HYBRID_TV] = {
@@ -261,7 +261,7 @@ static struct usb_device_id mceusb_dev_table[] = {
261 .driver_info = MCE_GEN2_TX_INV }, 261 .driver_info = MCE_GEN2_TX_INV },
262 /* Topseed eHome Infrared Transceiver */ 262 /* Topseed eHome Infrared Transceiver */
263 { USB_DEVICE(VENDOR_TOPSEED, 0x0011), 263 { USB_DEVICE(VENDOR_TOPSEED, 0x0011),
264 .driver_info = MCE_GEN2_TX_INV }, 264 .driver_info = MCE_GEN3 },
265 /* Ricavision internal Infrared Transceiver */ 265 /* Ricavision internal Infrared Transceiver */
266 { USB_DEVICE(VENDOR_RICAVISION, 0x0010) }, 266 { USB_DEVICE(VENDOR_RICAVISION, 0x0010) },
267 /* Itron ione Libra Q-11 */ 267 /* Itron ione Libra Q-11 */