aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2012-10-11 18:11:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-10-27 09:49:51 -0400
commitc003ab1bedf028db15b0185b683d5c387204e8f5 (patch)
tree00f608e80e897589492eb2274c46ffb9fde769cf
parent304ce75dd501d84d33dbca3c544e903f1d3377f7 (diff)
[media] rc-core: add separate defines for protocol bitmaps and numbers
The RC_TYPE_* defines are currently used both where a single protocol is expected and where a bitmap of protocols is expected. Functions like rc_keydown() and functions which add/remove entries to the keytable want a single protocol. Future userspace APIs would also benefit from numeric protocols (rather than bitmap ones). Keytables are smaller if they can use a small(ish) integer rather than a bitmap. Other functions or struct members (e.g. allowed_protos, enabled_protocols, etc) accept multiple protocols and need a bitmap. Using different types reduces the risk of programmer error. Using a protocol enum whereever possible also makes for a more future-proof user-space API as we don't need to worry about a sufficient number of bits being available (e.g. in structs used for ioctl() calls). The use of both a number and a corresponding bit is dalso one in e.g. the input subsystem as well (see all the references to set/clear bit when changing keytables for example). This patch separate the different usages in preparation for upcoming patches. Where a single protocol is expected, enum rc_type is used; where one or more protocol(s) are expected, something like u64 is used. The patch has been rewritten so that the format of the sysfs "protocols" file is no longer altered (at the loss of some detail). The file itself should probably be deprecated in the future though. Signed-off-by: David Härdeman <david@hardeman.nu> Cc: Andy Walls <awalls@md.metrocast.net> Cc: Maxim Levitsky <maximlevitsky@gmail.com> Cc: Antti Palosaari <crope@iki.fi> Cc: Mike Isely <isely@pobox.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/siano/smsir.c2
-rw-r--r--drivers/media/i2c/ir-kbd-i2c.c14
-rw-r--r--drivers/media/pci/cx18/cx18-i2c.c2
-rw-r--r--drivers/media/pci/cx23885/cx23885-input.c6
-rw-r--r--drivers/media/pci/cx88/cx88-input.c8
-rw-r--r--drivers/media/pci/ivtv/ivtv-i2c.c8
-rw-r--r--drivers/media/pci/saa7134/saa7134-input.c2
-rw-r--r--drivers/media/rc/ati_remote.c2
-rw-r--r--drivers/media/rc/ene_ir.c2
-rw-r--r--drivers/media/rc/fintek-cir.c2
-rw-r--r--drivers/media/rc/gpio-ir-recv.c2
-rw-r--r--drivers/media/rc/iguanair.c2
-rw-r--r--drivers/media/rc/imon.c40
-rw-r--r--drivers/media/rc/ir-jvc-decoder.c4
-rw-r--r--drivers/media/rc/ir-lirc-codec.c4
-rw-r--r--drivers/media/rc/ir-mce_kbd-decoder.c4
-rw-r--r--drivers/media/rc/ir-nec-decoder.c4
-rw-r--r--drivers/media/rc/ir-rc5-decoder.c14
-rw-r--r--drivers/media/rc/ir-rc5-sz-decoder.c6
-rw-r--r--drivers/media/rc/ir-rc6-decoder.c8
-rw-r--r--drivers/media/rc/ir-sanyo-decoder.c4
-rw-r--r--drivers/media/rc/ir-sony-decoder.c17
-rw-r--r--drivers/media/rc/ite-cir.c2
-rw-r--r--drivers/media/rc/keymaps/rc-imon-mce.c2
-rw-r--r--drivers/media/rc/keymaps/rc-rc6-mce.c2
-rw-r--r--drivers/media/rc/mceusb.c2
-rw-r--r--drivers/media/rc/nuvoton-cir.c2
-rw-r--r--drivers/media/rc/rc-loopback.c2
-rw-r--r--drivers/media/rc/rc-main.c73
-rw-r--r--drivers/media/rc/redrat3.c2
-rw-r--r--drivers/media/rc/streamzap.c2
-rw-r--r--drivers/media/rc/ttusbir.c2
-rw-r--r--drivers/media/rc/winbond-cir.c2
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-input.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9015.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/af9035.c4
-rw-r--r--drivers/media/usb/dvb-usb-v2/anysee.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/az6007.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/dvb_usb.h2
-rw-r--r--drivers/media/usb/dvb-usb-v2/it913x.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/lmedm04.c2
-rw-r--r--drivers/media/usb/dvb-usb-v2/rtl28xxu.c4
-rw-r--r--drivers/media/usb/dvb-usb/dib0700.h2
-rw-r--r--drivers/media/usb/dvb-usb/dib0700_core.c16
-rw-r--r--drivers/media/usb/dvb-usb/dib0700_devices.c146
-rw-r--r--drivers/media/usb/dvb-usb/dvb-usb.h2
-rw-r--r--drivers/media/usb/dvb-usb/pctv452e.c4
-rw-r--r--drivers/media/usb/dvb-usb/technisat-usb2.c2
-rw-r--r--drivers/media/usb/dvb-usb/ttusb2.c2
-rw-r--r--drivers/media/usb/em28xx/em28xx-input.c16
-rw-r--r--drivers/media/usb/hdpvr/hdpvr-i2c.c2
-rw-r--r--drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c4
-rw-r--r--drivers/media/usb/tm6000/tm6000-input.c20
-rw-r--r--include/media/ir-kbd-i2c.h2
-rw-r--r--include/media/rc-core.h4
-rw-r--r--include/media/rc-map.h64
56 files changed, 314 insertions, 244 deletions
diff --git a/drivers/media/common/siano/smsir.c b/drivers/media/common/siano/smsir.c
index 37bc5c4b8ad8..b8c5cad78537 100644
--- a/drivers/media/common/siano/smsir.c
+++ b/drivers/media/common/siano/smsir.c
@@ -88,7 +88,7 @@ int sms_ir_init(struct smscore_device_t *coredev)
88 88
89 dev->priv = coredev; 89 dev->priv = coredev;
90 dev->driver_type = RC_DRIVER_IR_RAW; 90 dev->driver_type = RC_DRIVER_IR_RAW;
91 dev->allowed_protos = RC_TYPE_ALL; 91 dev->allowed_protos = RC_BIT_ALL;
92 dev->map_name = sms_get_board(board_id)->rc_codes; 92 dev->map_name = sms_get_board(board_id)->rc_codes;
93 dev->driver_name = MODULE_NAME; 93 dev->driver_name = MODULE_NAME;
94 94
diff --git a/drivers/media/i2c/ir-kbd-i2c.c b/drivers/media/i2c/ir-kbd-i2c.c
index 04f192a0398a..08ae067b2b6f 100644
--- a/drivers/media/i2c/ir-kbd-i2c.c
+++ b/drivers/media/i2c/ir-kbd-i2c.c
@@ -284,7 +284,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
284{ 284{
285 char *ir_codes = NULL; 285 char *ir_codes = NULL;
286 const char *name = NULL; 286 const char *name = NULL;
287 u64 rc_type = RC_TYPE_UNKNOWN; 287 u64 rc_type = RC_BIT_UNKNOWN;
288 struct IR_i2c *ir; 288 struct IR_i2c *ir;
289 struct rc_dev *rc = NULL; 289 struct rc_dev *rc = NULL;
290 struct i2c_adapter *adap = client->adapter; 290 struct i2c_adapter *adap = client->adapter;
@@ -303,7 +303,7 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
303 case 0x64: 303 case 0x64:
304 name = "Pixelview"; 304 name = "Pixelview";
305 ir->get_key = get_key_pixelview; 305 ir->get_key = get_key_pixelview;
306 rc_type = RC_TYPE_OTHER; 306 rc_type = RC_BIT_OTHER;
307 ir_codes = RC_MAP_EMPTY; 307 ir_codes = RC_MAP_EMPTY;
308 break; 308 break;
309 case 0x18: 309 case 0x18:
@@ -311,31 +311,31 @@ static int ir_probe(struct i2c_client *client, const struct i2c_device_id *id)
311 case 0x1a: 311 case 0x1a:
312 name = "Hauppauge"; 312 name = "Hauppauge";
313 ir->get_key = get_key_haup; 313 ir->get_key = get_key_haup;
314 rc_type = RC_TYPE_RC5; 314 rc_type = RC_BIT_RC5;
315 ir_codes = RC_MAP_HAUPPAUGE; 315 ir_codes = RC_MAP_HAUPPAUGE;
316 break; 316 break;
317 case 0x30: 317 case 0x30:
318 name = "KNC One"; 318 name = "KNC One";
319 ir->get_key = get_key_knc1; 319 ir->get_key = get_key_knc1;
320 rc_type = RC_TYPE_OTHER; 320 rc_type = RC_BIT_OTHER;
321 ir_codes = RC_MAP_EMPTY; 321 ir_codes = RC_MAP_EMPTY;
322 break; 322 break;
323 case 0x6b: 323 case 0x6b:
324 name = "FusionHDTV"; 324 name = "FusionHDTV";
325 ir->get_key = get_key_fusionhdtv; 325 ir->get_key = get_key_fusionhdtv;
326 rc_type = RC_TYPE_RC5; 326 rc_type = RC_BIT_RC5;
327 ir_codes = RC_MAP_FUSIONHDTV_MCE; 327 ir_codes = RC_MAP_FUSIONHDTV_MCE;
328 break; 328 break;
329 case 0x40: 329 case 0x40:
330 name = "AVerMedia Cardbus remote"; 330 name = "AVerMedia Cardbus remote";
331 ir->get_key = get_key_avermedia_cardbus; 331 ir->get_key = get_key_avermedia_cardbus;
332 rc_type = RC_TYPE_OTHER; 332 rc_type = RC_BIT_OTHER;
333 ir_codes = RC_MAP_AVERMEDIA_CARDBUS; 333 ir_codes = RC_MAP_AVERMEDIA_CARDBUS;
334 break; 334 break;
335 case 0x71: 335 case 0x71:
336 name = "Hauppauge/Zilog Z8"; 336 name = "Hauppauge/Zilog Z8";
337 ir->get_key = get_key_haup_xvr; 337 ir->get_key = get_key_haup_xvr;
338 rc_type = RC_TYPE_RC5; 338 rc_type = RC_BIT_RC5;
339 ir_codes = RC_MAP_HAUPPAUGE; 339 ir_codes = RC_MAP_HAUPPAUGE;
340 break; 340 break;
341 } 341 }
diff --git a/drivers/media/pci/cx18/cx18-i2c.c b/drivers/media/pci/cx18/cx18-i2c.c
index 51609d5c88ce..4908eb7bcf6c 100644
--- a/drivers/media/pci/cx18/cx18-i2c.c
+++ b/drivers/media/pci/cx18/cx18-i2c.c
@@ -98,7 +98,7 @@ static int cx18_i2c_new_ir(struct cx18 *cx, struct i2c_adapter *adap, u32 hw,
98 case CX18_HW_Z8F0811_IR_RX_HAUP: 98 case CX18_HW_Z8F0811_IR_RX_HAUP:
99 init_data->ir_codes = RC_MAP_HAUPPAUGE; 99 init_data->ir_codes = RC_MAP_HAUPPAUGE;
100 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 100 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
101 init_data->type = RC_TYPE_RC5; 101 init_data->type = RC_BIT_RC5;
102 init_data->name = cx->card_name; 102 init_data->name = cx->card_name;
103 info.platform_data = init_data; 103 info.platform_data = init_data;
104 break; 104 break;
diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c
index 2c925f77cf2a..2004039482df 100644
--- a/drivers/media/pci/cx23885/cx23885-input.c
+++ b/drivers/media/pci/cx23885/cx23885-input.c
@@ -270,21 +270,21 @@ int cx23885_input_init(struct cx23885_dev *dev)
270 case CX23885_BOARD_HAUPPAUGE_HVR1250: 270 case CX23885_BOARD_HAUPPAUGE_HVR1250:
271 /* Integrated CX2388[58] IR controller */ 271 /* Integrated CX2388[58] IR controller */
272 driver_type = RC_DRIVER_IR_RAW; 272 driver_type = RC_DRIVER_IR_RAW;
273 allowed_protos = RC_TYPE_ALL; 273 allowed_protos = RC_BIT_ALL;
274 /* The grey Hauppauge RC-5 remote */ 274 /* The grey Hauppauge RC-5 remote */
275 rc_map = RC_MAP_HAUPPAUGE; 275 rc_map = RC_MAP_HAUPPAUGE;
276 break; 276 break;
277 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL: 277 case CX23885_BOARD_TERRATEC_CINERGY_T_PCIE_DUAL:
278 /* Integrated CX23885 IR controller */ 278 /* Integrated CX23885 IR controller */
279 driver_type = RC_DRIVER_IR_RAW; 279 driver_type = RC_DRIVER_IR_RAW;
280 allowed_protos = RC_TYPE_NEC; 280 allowed_protos = RC_BIT_NEC;
281 /* The grey Terratec remote with orange buttons */ 281 /* The grey Terratec remote with orange buttons */
282 rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS; 282 rc_map = RC_MAP_NEC_TERRATEC_CINERGY_XS;
283 break; 283 break;
284 case CX23885_BOARD_TEVII_S470: 284 case CX23885_BOARD_TEVII_S470:
285 /* Integrated CX23885 IR controller */ 285 /* Integrated CX23885 IR controller */
286 driver_type = RC_DRIVER_IR_RAW; 286 driver_type = RC_DRIVER_IR_RAW;
287 allowed_protos = RC_TYPE_ALL; 287 allowed_protos = RC_BIT_ALL;
288 /* A guess at the remote */ 288 /* A guess at the remote */
289 rc_map = RC_MAP_TEVII_NEC; 289 rc_map = RC_MAP_TEVII_NEC;
290 break; 290 break;
diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c
index ebf448c48ca3..f29e18c72f44 100644
--- a/drivers/media/pci/cx88/cx88-input.c
+++ b/drivers/media/pci/cx88/cx88-input.c
@@ -248,7 +248,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
248 struct cx88_IR *ir; 248 struct cx88_IR *ir;
249 struct rc_dev *dev; 249 struct rc_dev *dev;
250 char *ir_codes = NULL; 250 char *ir_codes = NULL;
251 u64 rc_type = RC_TYPE_OTHER; 251 u64 rc_type = RC_BIT_OTHER;
252 int err = -ENOMEM; 252 int err = -ENOMEM;
253 u32 hardware_mask = 0; /* For devices with a hardware mask, when 253 u32 hardware_mask = 0; /* For devices with a hardware mask, when
254 * used with a full-code IR table 254 * used with a full-code IR table
@@ -416,7 +416,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
416 break; 416 break;
417 case CX88_BOARD_TWINHAN_VP1027_DVBS: 417 case CX88_BOARD_TWINHAN_VP1027_DVBS:
418 ir_codes = RC_MAP_TWINHAN_VP1027_DVBS; 418 ir_codes = RC_MAP_TWINHAN_VP1027_DVBS;
419 rc_type = RC_TYPE_NEC; 419 rc_type = RC_BIT_NEC;
420 ir->sampling = 0xff00; /* address */ 420 ir->sampling = 0xff00; /* address */
421 break; 421 break;
422 } 422 }
@@ -592,7 +592,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
592 case CX88_BOARD_LEADTEK_PVR2000: 592 case CX88_BOARD_LEADTEK_PVR2000:
593 addr_list = pvr2000_addr_list; 593 addr_list = pvr2000_addr_list;
594 core->init_data.name = "cx88 Leadtek PVR 2000 remote"; 594 core->init_data.name = "cx88 Leadtek PVR 2000 remote";
595 core->init_data.type = RC_TYPE_UNKNOWN; 595 core->init_data.type = RC_BIT_UNKNOWN;
596 core->init_data.get_key = get_key_pvr2000; 596 core->init_data.get_key = get_key_pvr2000;
597 core->init_data.ir_codes = RC_MAP_EMPTY; 597 core->init_data.ir_codes = RC_MAP_EMPTY;
598 break; 598 break;
@@ -613,7 +613,7 @@ void cx88_i2c_init_ir(struct cx88_core *core)
613 /* Hauppauge XVR */ 613 /* Hauppauge XVR */
614 core->init_data.name = "cx88 Hauppauge XVR remote"; 614 core->init_data.name = "cx88 Hauppauge XVR remote";
615 core->init_data.ir_codes = RC_MAP_HAUPPAUGE; 615 core->init_data.ir_codes = RC_MAP_HAUPPAUGE;
616 core->init_data.type = RC_TYPE_RC5; 616 core->init_data.type = RC_BIT_RC5;
617 core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 617 core->init_data.internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
618 618
619 info.platform_data = &core->init_data; 619 info.platform_data = &core->init_data;
diff --git a/drivers/media/pci/ivtv/ivtv-i2c.c b/drivers/media/pci/ivtv/ivtv-i2c.c
index d47f41a0ef66..46e262becb67 100644
--- a/drivers/media/pci/ivtv/ivtv-i2c.c
+++ b/drivers/media/pci/ivtv/ivtv-i2c.c
@@ -200,21 +200,21 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
200 init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS; 200 init_data->ir_codes = RC_MAP_AVERMEDIA_CARDBUS;
201 init_data->internal_get_key_func = 201 init_data->internal_get_key_func =
202 IR_KBD_GET_KEY_AVERMEDIA_CARDBUS; 202 IR_KBD_GET_KEY_AVERMEDIA_CARDBUS;
203 init_data->type = RC_TYPE_OTHER; 203 init_data->type = RC_BIT_OTHER;
204 init_data->name = "AVerMedia AVerTV card"; 204 init_data->name = "AVerMedia AVerTV card";
205 break; 205 break;
206 case IVTV_HW_I2C_IR_RX_HAUP_EXT: 206 case IVTV_HW_I2C_IR_RX_HAUP_EXT:
207 case IVTV_HW_I2C_IR_RX_HAUP_INT: 207 case IVTV_HW_I2C_IR_RX_HAUP_INT:
208 init_data->ir_codes = RC_MAP_HAUPPAUGE; 208 init_data->ir_codes = RC_MAP_HAUPPAUGE;
209 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; 209 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP;
210 init_data->type = RC_TYPE_RC5; 210 init_data->type = RC_BIT_RC5;
211 init_data->name = itv->card_name; 211 init_data->name = itv->card_name;
212 break; 212 break;
213 case IVTV_HW_Z8F0811_IR_RX_HAUP: 213 case IVTV_HW_Z8F0811_IR_RX_HAUP:
214 /* Default to grey remote */ 214 /* Default to grey remote */
215 init_data->ir_codes = RC_MAP_HAUPPAUGE; 215 init_data->ir_codes = RC_MAP_HAUPPAUGE;
216 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 216 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
217 init_data->type = RC_TYPE_RC5; 217 init_data->type = RC_BIT_RC5;
218 init_data->name = itv->card_name; 218 init_data->name = itv->card_name;
219 break; 219 break;
220 case IVTV_HW_I2C_IR_RX_ADAPTEC: 220 case IVTV_HW_I2C_IR_RX_ADAPTEC:
@@ -222,7 +222,7 @@ static int ivtv_i2c_new_ir(struct ivtv *itv, u32 hw, const char *type, u8 addr)
222 init_data->name = itv->card_name; 222 init_data->name = itv->card_name;
223 /* FIXME: The protocol and RC_MAP needs to be corrected */ 223 /* FIXME: The protocol and RC_MAP needs to be corrected */
224 init_data->ir_codes = RC_MAP_EMPTY; 224 init_data->ir_codes = RC_MAP_EMPTY;
225 init_data->type = RC_TYPE_UNKNOWN; 225 init_data->type = RC_BIT_UNKNOWN;
226 break; 226 break;
227 } 227 }
228 228
diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c
index 0f78f5e537e2..e761262f7475 100644
--- a/drivers/media/pci/saa7134/saa7134-input.c
+++ b/drivers/media/pci/saa7134/saa7134-input.c
@@ -990,7 +990,7 @@ void saa7134_probe_i2c_ir(struct saa7134_dev *dev)
990 dev->init_data.name = "BeholdTV"; 990 dev->init_data.name = "BeholdTV";
991 dev->init_data.get_key = get_key_beholdm6xx; 991 dev->init_data.get_key = get_key_beholdm6xx;
992 dev->init_data.ir_codes = RC_MAP_BEHOLD; 992 dev->init_data.ir_codes = RC_MAP_BEHOLD;
993 dev->init_data.type = RC_TYPE_NEC; 993 dev->init_data.type = RC_BIT_NEC;
994 info.addr = 0x2d; 994 info.addr = 0x2d;
995 break; 995 break;
996 case SAA7134_BOARD_AVERMEDIA_CARDBUS_501: 996 case SAA7134_BOARD_AVERMEDIA_CARDBUS_501:
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 49bb356ed14c..2d6fb26a0170 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -784,7 +784,7 @@ static void ati_remote_rc_init(struct ati_remote *ati_remote)
784 784
785 rdev->priv = ati_remote; 785 rdev->priv = ati_remote;
786 rdev->driver_type = RC_DRIVER_SCANCODE; 786 rdev->driver_type = RC_DRIVER_SCANCODE;
787 rdev->allowed_protos = RC_TYPE_OTHER; 787 rdev->allowed_protos = RC_BIT_OTHER;
788 rdev->driver_name = "ati_remote"; 788 rdev->driver_name = "ati_remote";
789 789
790 rdev->open = ati_remote_rc_open; 790 rdev->open = ati_remote_rc_open;
diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c
index d05ac15b5de4..7467a6da39ff 100644
--- a/drivers/media/rc/ene_ir.c
+++ b/drivers/media/rc/ene_ir.c
@@ -1046,7 +1046,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id)
1046 learning_mode_force = false; 1046 learning_mode_force = false;
1047 1047
1048 rdev->driver_type = RC_DRIVER_IR_RAW; 1048 rdev->driver_type = RC_DRIVER_IR_RAW;
1049 rdev->allowed_protos = RC_TYPE_ALL; 1049 rdev->allowed_protos = RC_BIT_ALL;
1050 rdev->priv = dev; 1050 rdev->priv = dev;
1051 rdev->open = ene_open; 1051 rdev->open = ene_open;
1052 rdev->close = ene_close; 1052 rdev->close = ene_close;
diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c
index 52fd7696b1ba..d2d93cbe628c 100644
--- a/drivers/media/rc/fintek-cir.c
+++ b/drivers/media/rc/fintek-cir.c
@@ -541,7 +541,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id
541 /* Set up the rc device */ 541 /* Set up the rc device */
542 rdev->priv = fintek; 542 rdev->priv = fintek;
543 rdev->driver_type = RC_DRIVER_IR_RAW; 543 rdev->driver_type = RC_DRIVER_IR_RAW;
544 rdev->allowed_protos = RC_TYPE_ALL; 544 rdev->allowed_protos = RC_BIT_ALL;
545 rdev->open = fintek_open; 545 rdev->open = fintek_open;
546 rdev->close = fintek_close; 546 rdev->close = fintek_close;
547 rdev->input_name = FINTEK_DESCRIPTION; 547 rdev->input_name = FINTEK_DESCRIPTION;
diff --git a/drivers/media/rc/gpio-ir-recv.c b/drivers/media/rc/gpio-ir-recv.c
index 04cb272db16a..ba1a1eb356cf 100644
--- a/drivers/media/rc/gpio-ir-recv.c
+++ b/drivers/media/rc/gpio-ir-recv.c
@@ -95,7 +95,7 @@ static int __devinit gpio_ir_recv_probe(struct platform_device *pdev)
95 if (pdata->allowed_protos) 95 if (pdata->allowed_protos)
96 rcdev->allowed_protos = pdata->allowed_protos; 96 rcdev->allowed_protos = pdata->allowed_protos;
97 else 97 else
98 rcdev->allowed_protos = RC_TYPE_ALL; 98 rcdev->allowed_protos = RC_BIT_ALL;
99 rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY; 99 rcdev->map_name = pdata->map_name ?: RC_MAP_EMPTY;
100 100
101 gpio_dev->rcdev = rcdev; 101 gpio_dev->rcdev = rcdev;
diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c
index 51d7057aca04..5a9163da63c3 100644
--- a/drivers/media/rc/iguanair.c
+++ b/drivers/media/rc/iguanair.c
@@ -499,7 +499,7 @@ static int __devinit iguanair_probe(struct usb_interface *intf,
499 usb_to_input_id(ir->udev, &rc->input_id); 499 usb_to_input_id(ir->udev, &rc->input_id);
500 rc->dev.parent = &intf->dev; 500 rc->dev.parent = &intf->dev;
501 rc->driver_type = RC_DRIVER_IR_RAW; 501 rc->driver_type = RC_DRIVER_IR_RAW;
502 rc->allowed_protos = RC_TYPE_ALL; 502 rc->allowed_protos = RC_BIT_ALL;
503 rc->priv = ir; 503 rc->priv = ir;
504 rc->open = iguanair_open; 504 rc->open = iguanair_open;
505 rc->close = iguanair_close; 505 rc->close = iguanair_close;
diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c
index 5dd0386604f0..8f6a28921ed4 100644
--- a/drivers/media/rc/imon.c
+++ b/drivers/media/rc/imon.c
@@ -1001,7 +1001,7 @@ static void imon_touch_display_timeout(unsigned long data)
1001 * it is not, so we must acquire it prior to calling send_packet, which 1001 * it is not, so we must acquire it prior to calling send_packet, which
1002 * requires that the lock is held. 1002 * requires that the lock is held.
1003 */ 1003 */
1004static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type) 1004static int imon_ir_change_protocol(struct rc_dev *rc, u64 *rc_type)
1005{ 1005{
1006 int retval; 1006 int retval;
1007 struct imon_context *ictx = rc->priv; 1007 struct imon_context *ictx = rc->priv;
@@ -1010,31 +1010,27 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
1010 unsigned char ir_proto_packet[] = { 1010 unsigned char ir_proto_packet[] = {
1011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 }; 1011 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86 };
1012 1012
1013 if (rc_type && !(rc_type & rc->allowed_protos)) 1013 if (*rc_type && !(*rc_type & rc->allowed_protos))
1014 dev_warn(dev, "Looks like you're trying to use an IR protocol " 1014 dev_warn(dev, "Looks like you're trying to use an IR protocol "
1015 "this device does not support\n"); 1015 "this device does not support\n");
1016 1016
1017 switch (rc_type) { 1017 if (*rc_type & RC_BIT_RC6_MCE) {
1018 case RC_TYPE_RC6:
1019 dev_dbg(dev, "Configuring IR receiver for MCE protocol\n"); 1018 dev_dbg(dev, "Configuring IR receiver for MCE protocol\n");
1020 ir_proto_packet[0] = 0x01; 1019 ir_proto_packet[0] = 0x01;
1021 break; 1020 *rc_type = RC_BIT_RC6_MCE;
1022 case RC_TYPE_UNKNOWN: 1021 } else if (*rc_type & RC_BIT_OTHER) {
1023 case RC_TYPE_OTHER:
1024 dev_dbg(dev, "Configuring IR receiver for iMON protocol\n"); 1022 dev_dbg(dev, "Configuring IR receiver for iMON protocol\n");
1025 if (!pad_stabilize) 1023 if (!pad_stabilize)
1026 dev_dbg(dev, "PAD stabilize functionality disabled\n"); 1024 dev_dbg(dev, "PAD stabilize functionality disabled\n");
1027 /* ir_proto_packet[0] = 0x00; // already the default */ 1025 /* ir_proto_packet[0] = 0x00; // already the default */
1028 rc_type = RC_TYPE_OTHER; 1026 *rc_type = RC_BIT_OTHER;
1029 break; 1027 } else {
1030 default:
1031 dev_warn(dev, "Unsupported IR protocol specified, overriding " 1028 dev_warn(dev, "Unsupported IR protocol specified, overriding "
1032 "to iMON IR protocol\n"); 1029 "to iMON IR protocol\n");
1033 if (!pad_stabilize) 1030 if (!pad_stabilize)
1034 dev_dbg(dev, "PAD stabilize functionality disabled\n"); 1031 dev_dbg(dev, "PAD stabilize functionality disabled\n");
1035 /* ir_proto_packet[0] = 0x00; // already the default */ 1032 /* ir_proto_packet[0] = 0x00; // already the default */
1036 rc_type = RC_TYPE_OTHER; 1033 *rc_type = RC_BIT_OTHER;
1037 break;
1038 } 1034 }
1039 1035
1040 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet)); 1036 memcpy(ictx->usb_tx_buf, &ir_proto_packet, sizeof(ir_proto_packet));
@@ -1048,7 +1044,7 @@ static int imon_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
1048 if (retval) 1044 if (retval)
1049 goto out; 1045 goto out;
1050 1046
1051 ictx->rc_type = rc_type; 1047 ictx->rc_type = *rc_type;
1052 ictx->pad_mouse = false; 1048 ictx->pad_mouse = false;
1053 1049
1054out: 1050out:
@@ -1323,7 +1319,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1323 rel_x = buf[2]; 1319 rel_x = buf[2];
1324 rel_y = buf[3]; 1320 rel_y = buf[3];
1325 1321
1326 if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { 1322 if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) {
1327 if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) { 1323 if ((buf[1] == 0) && ((rel_x != 0) || (rel_y != 0))) {
1328 dir = stabilize((int)rel_x, (int)rel_y, 1324 dir = stabilize((int)rel_x, (int)rel_y,
1329 timeout, threshold); 1325 timeout, threshold);
@@ -1390,7 +1386,7 @@ static void imon_pad_to_keys(struct imon_context *ictx, unsigned char *buf)
1390 buf[0] = 0x01; 1386 buf[0] = 0x01;
1391 buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0; 1387 buf[1] = buf[4] = buf[5] = buf[6] = buf[7] = 0;
1392 1388
1393 if (ictx->rc_type == RC_TYPE_OTHER && pad_stabilize) { 1389 if (ictx->rc_type == RC_BIT_OTHER && pad_stabilize) {
1394 dir = stabilize((int)rel_x, (int)rel_y, 1390 dir = stabilize((int)rel_x, (int)rel_y,
1395 timeout, threshold); 1391 timeout, threshold);
1396 if (!dir) { 1392 if (!dir) {
@@ -1511,7 +1507,7 @@ static void imon_incoming_packet(struct imon_context *ictx,
1511 kc = imon_panel_key_lookup(scancode); 1507 kc = imon_panel_key_lookup(scancode);
1512 } else { 1508 } else {
1513 scancode = be32_to_cpu(*((u32 *)buf)); 1509 scancode = be32_to_cpu(*((u32 *)buf));
1514 if (ictx->rc_type == RC_TYPE_RC6) { 1510 if (ictx->rc_type == RC_BIT_RC6_MCE) {
1515 ktype = IMON_KEY_IMON; 1511 ktype = IMON_KEY_IMON;
1516 if (buf[0] == 0x80) 1512 if (buf[0] == 0x80)
1517 ktype = IMON_KEY_MCE; 1513 ktype = IMON_KEY_MCE;
@@ -1744,7 +1740,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1744{ 1740{
1745 u8 ffdc_cfg_byte = ictx->usb_rx_buf[6]; 1741 u8 ffdc_cfg_byte = ictx->usb_rx_buf[6];
1746 u8 detected_display_type = IMON_DISPLAY_TYPE_NONE; 1742 u8 detected_display_type = IMON_DISPLAY_TYPE_NONE;
1747 u64 allowed_protos = RC_TYPE_OTHER; 1743 u64 allowed_protos = RC_BIT_OTHER;
1748 1744
1749 switch (ffdc_cfg_byte) { 1745 switch (ffdc_cfg_byte) {
1750 /* iMON Knob, no display, iMON IR + vol knob */ 1746 /* iMON Knob, no display, iMON IR + vol knob */
@@ -1775,13 +1771,13 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1775 case 0x9e: 1771 case 0x9e:
1776 dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR"); 1772 dev_info(ictx->dev, "0xffdc iMON VFD, MCE IR");
1777 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1773 detected_display_type = IMON_DISPLAY_TYPE_VFD;
1778 allowed_protos = RC_TYPE_RC6; 1774 allowed_protos = RC_BIT_RC6_MCE;
1779 break; 1775 break;
1780 /* iMON LCD, MCE IR */ 1776 /* iMON LCD, MCE IR */
1781 case 0x9f: 1777 case 0x9f:
1782 dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR"); 1778 dev_info(ictx->dev, "0xffdc iMON LCD, MCE IR");
1783 detected_display_type = IMON_DISPLAY_TYPE_LCD; 1779 detected_display_type = IMON_DISPLAY_TYPE_LCD;
1784 allowed_protos = RC_TYPE_RC6; 1780 allowed_protos = RC_BIT_RC6_MCE;
1785 break; 1781 break;
1786 default: 1782 default:
1787 dev_info(ictx->dev, "Unknown 0xffdc device, " 1783 dev_info(ictx->dev, "Unknown 0xffdc device, "
@@ -1789,7 +1785,7 @@ static void imon_get_ffdc_type(struct imon_context *ictx)
1789 detected_display_type = IMON_DISPLAY_TYPE_VFD; 1785 detected_display_type = IMON_DISPLAY_TYPE_VFD;
1790 /* We don't know which one it is, allow user to set the 1786 /* We don't know which one it is, allow user to set the
1791 * RC6 one from userspace if OTHER wasn't correct. */ 1787 * RC6 one from userspace if OTHER wasn't correct. */
1792 allowed_protos |= RC_TYPE_RC6; 1788 allowed_protos |= RC_BIT_RC6_MCE;
1793 break; 1789 break;
1794 } 1790 }
1795 1791
@@ -1875,7 +1871,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1875 1871
1876 rdev->priv = ictx; 1872 rdev->priv = ictx;
1877 rdev->driver_type = RC_DRIVER_SCANCODE; 1873 rdev->driver_type = RC_DRIVER_SCANCODE;
1878 rdev->allowed_protos = RC_TYPE_OTHER | RC_TYPE_RC6; /* iMON PAD or MCE */ 1874 rdev->allowed_protos = RC_BIT_OTHER | RC_BIT_RC6_MCE; /* iMON PAD or MCE */
1879 rdev->change_protocol = imon_ir_change_protocol; 1875 rdev->change_protocol = imon_ir_change_protocol;
1880 rdev->driver_name = MOD_NAME; 1876 rdev->driver_name = MOD_NAME;
1881 1877
@@ -1893,7 +1889,7 @@ static struct rc_dev *imon_init_rdev(struct imon_context *ictx)
1893 1889
1894 imon_set_display_type(ictx); 1890 imon_set_display_type(ictx);
1895 1891
1896 if (ictx->rc_type == RC_TYPE_RC6) 1892 if (ictx->rc_type == RC_BIT_RC6_MCE)
1897 rdev->map_name = RC_MAP_IMON_MCE; 1893 rdev->map_name = RC_MAP_IMON_MCE;
1898 else 1894 else
1899 rdev->map_name = RC_MAP_IMON_PAD; 1895 rdev->map_name = RC_MAP_IMON_PAD;
diff --git a/drivers/media/rc/ir-jvc-decoder.c b/drivers/media/rc/ir-jvc-decoder.c
index 035668e27f6b..69edffb9fe9a 100644
--- a/drivers/media/rc/ir-jvc-decoder.c
+++ b/drivers/media/rc/ir-jvc-decoder.c
@@ -47,7 +47,7 @@ static int ir_jvc_decode(struct rc_dev *dev, struct ir_raw_event ev)
47{ 47{
48 struct jvc_dec *data = &dev->raw->jvc; 48 struct jvc_dec *data = &dev->raw->jvc;
49 49
50 if (!(dev->raw->enabled_protocols & RC_TYPE_JVC)) 50 if (!(dev->raw->enabled_protocols & RC_BIT_JVC))
51 return 0; 51 return 0;
52 52
53 if (!is_timing_event(ev)) { 53 if (!is_timing_event(ev)) {
@@ -174,7 +174,7 @@ out:
174} 174}
175 175
176static struct ir_raw_handler jvc_handler = { 176static struct ir_raw_handler jvc_handler = {
177 .protocols = RC_TYPE_JVC, 177 .protocols = RC_BIT_JVC,
178 .decode = ir_jvc_decode, 178 .decode = ir_jvc_decode,
179}; 179};
180 180
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 870c93052fd0..9945e5e7f61a 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -35,7 +35,7 @@ static int ir_lirc_decode(struct rc_dev *dev, struct ir_raw_event ev)
35 struct lirc_codec *lirc = &dev->raw->lirc; 35 struct lirc_codec *lirc = &dev->raw->lirc;
36 int sample; 36 int sample;
37 37
38 if (!(dev->raw->enabled_protocols & RC_TYPE_LIRC)) 38 if (!(dev->raw->enabled_protocols & RC_BIT_LIRC))
39 return 0; 39 return 0;
40 40
41 if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf) 41 if (!dev->raw->lirc.drv || !dev->raw->lirc.drv->rbuf)
@@ -408,7 +408,7 @@ static int ir_lirc_unregister(struct rc_dev *dev)
408} 408}
409 409
410static struct ir_raw_handler lirc_handler = { 410static struct ir_raw_handler lirc_handler = {
411 .protocols = RC_TYPE_LIRC, 411 .protocols = RC_BIT_LIRC,
412 .decode = ir_lirc_decode, 412 .decode = ir_lirc_decode,
413 .raw_register = ir_lirc_register, 413 .raw_register = ir_lirc_register,
414 .raw_unregister = ir_lirc_unregister, 414 .raw_unregister = ir_lirc_unregister,
diff --git a/drivers/media/rc/ir-mce_kbd-decoder.c b/drivers/media/rc/ir-mce_kbd-decoder.c
index 3784ebf80ec7..33fafa4cf7cb 100644
--- a/drivers/media/rc/ir-mce_kbd-decoder.c
+++ b/drivers/media/rc/ir-mce_kbd-decoder.c
@@ -216,7 +216,7 @@ static int ir_mce_kbd_decode(struct rc_dev *dev, struct ir_raw_event ev)
216 u32 scancode; 216 u32 scancode;
217 unsigned long delay; 217 unsigned long delay;
218 218
219 if (!(dev->raw->enabled_protocols & RC_TYPE_MCE_KBD)) 219 if (!(dev->raw->enabled_protocols & RC_BIT_MCE_KBD))
220 return 0; 220 return 0;
221 221
222 if (!is_timing_event(ev)) { 222 if (!is_timing_event(ev)) {
@@ -422,7 +422,7 @@ static int ir_mce_kbd_unregister(struct rc_dev *dev)
422} 422}
423 423
424static struct ir_raw_handler mce_kbd_handler = { 424static struct ir_raw_handler mce_kbd_handler = {
425 .protocols = RC_TYPE_MCE_KBD, 425 .protocols = RC_BIT_MCE_KBD,
426 .decode = ir_mce_kbd_decode, 426 .decode = ir_mce_kbd_decode,
427 .raw_register = ir_mce_kbd_register, 427 .raw_register = ir_mce_kbd_register,
428 .raw_unregister = ir_mce_kbd_unregister, 428 .raw_unregister = ir_mce_kbd_unregister,
diff --git a/drivers/media/rc/ir-nec-decoder.c b/drivers/media/rc/ir-nec-decoder.c
index 2ca509e6e16b..a47ee3634969 100644
--- a/drivers/media/rc/ir-nec-decoder.c
+++ b/drivers/media/rc/ir-nec-decoder.c
@@ -52,7 +52,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
52 u8 address, not_address, command, not_command; 52 u8 address, not_address, command, not_command;
53 bool send_32bits = false; 53 bool send_32bits = false;
54 54
55 if (!(dev->raw->enabled_protocols & RC_TYPE_NEC)) 55 if (!(dev->raw->enabled_protocols & RC_BIT_NEC))
56 return 0; 56 return 0;
57 57
58 if (!is_timing_event(ev)) { 58 if (!is_timing_event(ev)) {
@@ -201,7 +201,7 @@ static int ir_nec_decode(struct rc_dev *dev, struct ir_raw_event ev)
201} 201}
202 202
203static struct ir_raw_handler nec_handler = { 203static struct ir_raw_handler nec_handler = {
204 .protocols = RC_TYPE_NEC, 204 .protocols = RC_BIT_NEC,
205 .decode = ir_nec_decode, 205 .decode = ir_nec_decode,
206}; 206};
207 207
diff --git a/drivers/media/rc/ir-rc5-decoder.c b/drivers/media/rc/ir-rc5-decoder.c
index 9ab663a507a4..5b4d1ddeac4e 100644
--- a/drivers/media/rc/ir-rc5-decoder.c
+++ b/drivers/media/rc/ir-rc5-decoder.c
@@ -52,8 +52,8 @@ static int ir_rc5_decode(struct rc_dev *dev, struct ir_raw_event ev)
52 u8 toggle; 52 u8 toggle;
53 u32 scancode; 53 u32 scancode;
54 54
55 if (!(dev->raw->enabled_protocols & RC_TYPE_RC5)) 55 if (!(dev->raw->enabled_protocols & (RC_BIT_RC5 | RC_BIT_RC5X)))
56 return 0; 56 return 0;
57 57
58 if (!is_timing_event(ev)) { 58 if (!is_timing_event(ev)) {
59 if (ev.reset) 59 if (ev.reset)
@@ -128,6 +128,10 @@ again:
128 if (data->wanted_bits == RC5X_NBITS) { 128 if (data->wanted_bits == RC5X_NBITS) {
129 /* RC5X */ 129 /* RC5X */
130 u8 xdata, command, system; 130 u8 xdata, command, system;
131 if (!(dev->raw->enabled_protocols & RC_BIT_RC5X)) {
132 data->state = STATE_INACTIVE;
133 return 0;
134 }
131 xdata = (data->bits & 0x0003F) >> 0; 135 xdata = (data->bits & 0x0003F) >> 0;
132 command = (data->bits & 0x00FC0) >> 6; 136 command = (data->bits & 0x00FC0) >> 6;
133 system = (data->bits & 0x1F000) >> 12; 137 system = (data->bits & 0x1F000) >> 12;
@@ -141,6 +145,10 @@ again:
141 } else { 145 } else {
142 /* RC5 */ 146 /* RC5 */
143 u8 command, system; 147 u8 command, system;
148 if (!(dev->raw->enabled_protocols & RC_BIT_RC5)) {
149 data->state = STATE_INACTIVE;
150 return 0;
151 }
144 command = (data->bits & 0x0003F) >> 0; 152 command = (data->bits & 0x0003F) >> 0;
145 system = (data->bits & 0x007C0) >> 6; 153 system = (data->bits & 0x007C0) >> 6;
146 toggle = (data->bits & 0x00800) ? 1 : 0; 154 toggle = (data->bits & 0x00800) ? 1 : 0;
@@ -164,7 +172,7 @@ out:
164} 172}
165 173
166static struct ir_raw_handler rc5_handler = { 174static struct ir_raw_handler rc5_handler = {
167 .protocols = RC_TYPE_RC5, 175 .protocols = RC_BIT_RC5 | RC_BIT_RC5X,
168 .decode = ir_rc5_decode, 176 .decode = ir_rc5_decode,
169}; 177};
170 178
diff --git a/drivers/media/rc/ir-rc5-sz-decoder.c b/drivers/media/rc/ir-rc5-sz-decoder.c
index ec8d4a2e2c5a..fd807a8308d8 100644
--- a/drivers/media/rc/ir-rc5-sz-decoder.c
+++ b/drivers/media/rc/ir-rc5-sz-decoder.c
@@ -48,8 +48,8 @@ static int ir_rc5_sz_decode(struct rc_dev *dev, struct ir_raw_event ev)
48 u8 toggle, command, system; 48 u8 toggle, command, system;
49 u32 scancode; 49 u32 scancode;
50 50
51 if (!(dev->raw->enabled_protocols & RC_TYPE_RC5_SZ)) 51 if (!(dev->raw->enabled_protocols & RC_BIT_RC5_SZ))
52 return 0; 52 return 0;
53 53
54 if (!is_timing_event(ev)) { 54 if (!is_timing_event(ev)) {
55 if (ev.reset) 55 if (ev.reset)
@@ -128,7 +128,7 @@ out:
128} 128}
129 129
130static struct ir_raw_handler rc5_sz_handler = { 130static struct ir_raw_handler rc5_sz_handler = {
131 .protocols = RC_TYPE_RC5_SZ, 131 .protocols = RC_BIT_RC5_SZ,
132 .decode = ir_rc5_sz_decode, 132 .decode = ir_rc5_sz_decode,
133}; 133};
134 134
diff --git a/drivers/media/rc/ir-rc6-decoder.c b/drivers/media/rc/ir-rc6-decoder.c
index 4cfdd7fa4bbd..e19072ffb36c 100644
--- a/drivers/media/rc/ir-rc6-decoder.c
+++ b/drivers/media/rc/ir-rc6-decoder.c
@@ -89,7 +89,9 @@ static int ir_rc6_decode(struct rc_dev *dev, struct ir_raw_event ev)
89 u32 scancode; 89 u32 scancode;
90 u8 toggle; 90 u8 toggle;
91 91
92 if (!(dev->raw->enabled_protocols & RC_TYPE_RC6)) 92 if (!(dev->raw->enabled_protocols &
93 (RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 |
94 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)))
93 return 0; 95 return 0;
94 96
95 if (!is_timing_event(ev)) { 97 if (!is_timing_event(ev)) {
@@ -271,7 +273,9 @@ out:
271} 273}
272 274
273static struct ir_raw_handler rc6_handler = { 275static struct ir_raw_handler rc6_handler = {
274 .protocols = RC_TYPE_RC6, 276 .protocols = RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 |
277 RC_BIT_RC6_6A_24 | RC_BIT_RC6_6A_32 |
278 RC_BIT_RC6_MCE,
275 .decode = ir_rc6_decode, 279 .decode = ir_rc6_decode,
276}; 280};
277 281
diff --git a/drivers/media/rc/ir-sanyo-decoder.c b/drivers/media/rc/ir-sanyo-decoder.c
index 7e54ec57bcf9..7e69a3b65370 100644
--- a/drivers/media/rc/ir-sanyo-decoder.c
+++ b/drivers/media/rc/ir-sanyo-decoder.c
@@ -58,7 +58,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev)
58 u32 scancode; 58 u32 scancode;
59 u8 address, command, not_command; 59 u8 address, command, not_command;
60 60
61 if (!(dev->raw->enabled_protocols & RC_TYPE_SANYO)) 61 if (!(dev->raw->enabled_protocols & RC_BIT_SANYO))
62 return 0; 62 return 0;
63 63
64 if (!is_timing_event(ev)) { 64 if (!is_timing_event(ev)) {
@@ -179,7 +179,7 @@ static int ir_sanyo_decode(struct rc_dev *dev, struct ir_raw_event ev)
179} 179}
180 180
181static struct ir_raw_handler sanyo_handler = { 181static struct ir_raw_handler sanyo_handler = {
182 .protocols = RC_TYPE_SANYO, 182 .protocols = RC_BIT_SANYO,
183 .decode = ir_sanyo_decode, 183 .decode = ir_sanyo_decode,
184}; 184};
185 185
diff --git a/drivers/media/rc/ir-sony-decoder.c b/drivers/media/rc/ir-sony-decoder.c
index dab98b37621a..fb914342cf4d 100644
--- a/drivers/media/rc/ir-sony-decoder.c
+++ b/drivers/media/rc/ir-sony-decoder.c
@@ -45,7 +45,8 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
45 u32 scancode; 45 u32 scancode;
46 u8 device, subdevice, function; 46 u8 device, subdevice, function;
47 47
48 if (!(dev->raw->enabled_protocols & RC_TYPE_SONY)) 48 if (!(dev->raw->enabled_protocols &
49 (RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20)))
49 return 0; 50 return 0;
50 51
51 if (!is_timing_event(ev)) { 52 if (!is_timing_event(ev)) {
@@ -123,16 +124,28 @@ static int ir_sony_decode(struct rc_dev *dev, struct ir_raw_event ev)
123 124
124 switch (data->count) { 125 switch (data->count) {
125 case 12: 126 case 12:
127 if (!(dev->raw->enabled_protocols & RC_BIT_SONY12)) {
128 data->state = STATE_INACTIVE;
129 return 0;
130 }
126 device = bitrev8((data->bits << 3) & 0xF8); 131 device = bitrev8((data->bits << 3) & 0xF8);
127 subdevice = 0; 132 subdevice = 0;
128 function = bitrev8((data->bits >> 4) & 0xFE); 133 function = bitrev8((data->bits >> 4) & 0xFE);
129 break; 134 break;
130 case 15: 135 case 15:
136 if (!(dev->raw->enabled_protocols & RC_BIT_SONY15)) {
137 data->state = STATE_INACTIVE;
138 return 0;
139 }
131 device = bitrev8((data->bits >> 0) & 0xFF); 140 device = bitrev8((data->bits >> 0) & 0xFF);
132 subdevice = 0; 141 subdevice = 0;
133 function = bitrev8((data->bits >> 7) & 0xFE); 142 function = bitrev8((data->bits >> 7) & 0xFE);
134 break; 143 break;
135 case 20: 144 case 20:
145 if (!(dev->raw->enabled_protocols & RC_BIT_SONY20)) {
146 data->state = STATE_INACTIVE;
147 return 0;
148 }
136 device = bitrev8((data->bits >> 5) & 0xF8); 149 device = bitrev8((data->bits >> 5) & 0xF8);
137 subdevice = bitrev8((data->bits >> 0) & 0xFF); 150 subdevice = bitrev8((data->bits >> 0) & 0xFF);
138 function = bitrev8((data->bits >> 12) & 0xFE); 151 function = bitrev8((data->bits >> 12) & 0xFE);
@@ -157,7 +170,7 @@ out:
157} 170}
158 171
159static struct ir_raw_handler sony_handler = { 172static struct ir_raw_handler sony_handler = {
160 .protocols = RC_TYPE_SONY, 173 .protocols = RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20,
161 .decode = ir_sony_decode, 174 .decode = ir_sony_decode,
162}; 175};
163 176
diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c
index 24c77a42fc36..d63511511df4 100644
--- a/drivers/media/rc/ite-cir.c
+++ b/drivers/media/rc/ite-cir.c
@@ -1563,7 +1563,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id
1563 /* set up ir-core props */ 1563 /* set up ir-core props */
1564 rdev->priv = itdev; 1564 rdev->priv = itdev;
1565 rdev->driver_type = RC_DRIVER_IR_RAW; 1565 rdev->driver_type = RC_DRIVER_IR_RAW;
1566 rdev->allowed_protos = RC_TYPE_ALL; 1566 rdev->allowed_protos = RC_BIT_ALL;
1567 rdev->open = ite_open; 1567 rdev->open = ite_open;
1568 rdev->close = ite_close; 1568 rdev->close = ite_close;
1569 rdev->s_idle = ite_s_idle; 1569 rdev->s_idle = ite_s_idle;
diff --git a/drivers/media/rc/keymaps/rc-imon-mce.c b/drivers/media/rc/keymaps/rc-imon-mce.c
index 124c7228ba8c..f0da960560b0 100644
--- a/drivers/media/rc/keymaps/rc-imon-mce.c
+++ b/drivers/media/rc/keymaps/rc-imon-mce.c
@@ -121,7 +121,7 @@ static struct rc_map_list imon_mce_map = {
121 .scan = imon_mce, 121 .scan = imon_mce,
122 .size = ARRAY_SIZE(imon_mce), 122 .size = ARRAY_SIZE(imon_mce),
123 /* its RC6, but w/a hardware decoder */ 123 /* its RC6, but w/a hardware decoder */
124 .rc_type = RC_TYPE_RC6, 124 .rc_type = RC_TYPE_RC6_MCE,
125 .name = RC_MAP_IMON_MCE, 125 .name = RC_MAP_IMON_MCE,
126 } 126 }
127}; 127};
diff --git a/drivers/media/rc/keymaps/rc-rc6-mce.c b/drivers/media/rc/keymaps/rc-rc6-mce.c
index 753e43ec787b..ef4006fe4de0 100644
--- a/drivers/media/rc/keymaps/rc-rc6-mce.c
+++ b/drivers/media/rc/keymaps/rc-rc6-mce.c
@@ -97,7 +97,7 @@ static struct rc_map_list rc6_mce_map = {
97 .map = { 97 .map = {
98 .scan = rc6_mce, 98 .scan = rc6_mce,
99 .size = ARRAY_SIZE(rc6_mce), 99 .size = ARRAY_SIZE(rc6_mce),
100 .rc_type = RC_TYPE_RC6, 100 .rc_type = RC_TYPE_RC6_MCE,
101 .name = RC_MAP_RC6_MCE, 101 .name = RC_MAP_RC6_MCE,
102 } 102 }
103}; 103};
diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c
index 850547fe711c..b2146cd99fd8 100644
--- a/drivers/media/rc/mceusb.c
+++ b/drivers/media/rc/mceusb.c
@@ -1205,7 +1205,7 @@ static struct rc_dev *mceusb_init_rc_dev(struct mceusb_dev *ir)
1205 rc->dev.parent = dev; 1205 rc->dev.parent = dev;
1206 rc->priv = ir; 1206 rc->priv = ir;
1207 rc->driver_type = RC_DRIVER_IR_RAW; 1207 rc->driver_type = RC_DRIVER_IR_RAW;
1208 rc->allowed_protos = RC_TYPE_ALL; 1208 rc->allowed_protos = RC_BIT_ALL;
1209 rc->timeout = MS_TO_NS(100); 1209 rc->timeout = MS_TO_NS(100);
1210 if (!ir->flags.no_tx) { 1210 if (!ir->flags.no_tx) {
1211 rc->s_tx_mask = mceusb_set_tx_mask; 1211 rc->s_tx_mask = mceusb_set_tx_mask;
diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c
index 2ea913a44ae8..0190dfc2ad41 100644
--- a/drivers/media/rc/nuvoton-cir.c
+++ b/drivers/media/rc/nuvoton-cir.c
@@ -1045,7 +1045,7 @@ static int nvt_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id)
1045 /* Set up the rc device */ 1045 /* Set up the rc device */
1046 rdev->priv = nvt; 1046 rdev->priv = nvt;
1047 rdev->driver_type = RC_DRIVER_IR_RAW; 1047 rdev->driver_type = RC_DRIVER_IR_RAW;
1048 rdev->allowed_protos = RC_TYPE_ALL; 1048 rdev->allowed_protos = RC_BIT_ALL;
1049 rdev->open = nvt_open; 1049 rdev->open = nvt_open;
1050 rdev->close = nvt_close; 1050 rdev->close = nvt_close;
1051 rdev->tx_ir = nvt_tx_ir; 1051 rdev->tx_ir = nvt_tx_ir;
diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c
index f9be68132c67..53d02827a472 100644
--- a/drivers/media/rc/rc-loopback.c
+++ b/drivers/media/rc/rc-loopback.c
@@ -195,7 +195,7 @@ static int __init loop_init(void)
195 rc->map_name = RC_MAP_EMPTY; 195 rc->map_name = RC_MAP_EMPTY;
196 rc->priv = &loopdev; 196 rc->priv = &loopdev;
197 rc->driver_type = RC_DRIVER_IR_RAW; 197 rc->driver_type = RC_DRIVER_IR_RAW;
198 rc->allowed_protos = RC_TYPE_ALL; 198 rc->allowed_protos = RC_BIT_ALL;
199 rc->timeout = 100 * 1000 * 1000; /* 100 ms */ 199 rc->timeout = 100 * 1000 * 1000; /* 100 ms */
200 rc->min_timeout = 1; 200 rc->min_timeout = 1;
201 rc->max_timeout = UINT_MAX; 201 rc->max_timeout = UINT_MAX;
diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index cabc19c10515..601d1ac1c688 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -725,25 +725,36 @@ static struct class ir_input_class = {
725 .devnode = ir_devnode, 725 .devnode = ir_devnode,
726}; 726};
727 727
728/*
729 * These are the protocol textual descriptions that are
730 * used by the sysfs protocols file. Note that the order
731 * of the entries is relevant.
732 */
728static struct { 733static struct {
729 u64 type; 734 u64 type;
730 char *name; 735 char *name;
731} proto_names[] = { 736} proto_names[] = {
732 { RC_TYPE_UNKNOWN, "unknown" }, 737 { RC_BIT_NONE, "none" },
733 { RC_TYPE_RC5, "rc-5" }, 738 { RC_BIT_OTHER, "other" },
734 { RC_TYPE_NEC, "nec" }, 739 { RC_BIT_UNKNOWN, "unknown" },
735 { RC_TYPE_RC6, "rc-6" }, 740 { RC_BIT_RC5 |
736 { RC_TYPE_JVC, "jvc" }, 741 RC_BIT_RC5X, "rc-5" },
737 { RC_TYPE_SONY, "sony" }, 742 { RC_BIT_NEC, "nec" },
738 { RC_TYPE_RC5_SZ, "rc-5-sz" }, 743 { RC_BIT_RC6_0 |
739 { RC_TYPE_SANYO, "sanyo" }, 744 RC_BIT_RC6_6A_20 |
740 { RC_TYPE_MCE_KBD, "mce_kbd" }, 745 RC_BIT_RC6_6A_24 |
741 { RC_TYPE_LIRC, "lirc" }, 746 RC_BIT_RC6_6A_32 |
742 { RC_TYPE_OTHER, "other" }, 747 RC_BIT_RC6_MCE, "rc-6" },
748 { RC_BIT_JVC, "jvc" },
749 { RC_BIT_SONY12 |
750 RC_BIT_SONY15 |
751 RC_BIT_SONY20, "sony" },
752 { RC_BIT_RC5_SZ, "rc-5-sz" },
753 { RC_BIT_SANYO, "sanyo" },
754 { RC_BIT_MCE_KBD, "mce_kbd" },
755 { RC_BIT_LIRC, "lirc" },
743}; 756};
744 757
745#define PROTO_NONE "none"
746
747/** 758/**
748 * show_protocols() - shows the current IR protocol(s) 759 * show_protocols() - shows the current IR protocol(s)
749 * @device: the device descriptor 760 * @device: the device descriptor
@@ -790,6 +801,9 @@ static ssize_t show_protocols(struct device *device,
790 tmp += sprintf(tmp, "[%s] ", proto_names[i].name); 801 tmp += sprintf(tmp, "[%s] ", proto_names[i].name);
791 else if (allowed & proto_names[i].type) 802 else if (allowed & proto_names[i].type)
792 tmp += sprintf(tmp, "%s ", proto_names[i].name); 803 tmp += sprintf(tmp, "%s ", proto_names[i].name);
804
805 if (allowed & proto_names[i].type)
806 allowed &= ~proto_names[i].type;
793 } 807 }
794 808
795 if (tmp != buf) 809 if (tmp != buf)
@@ -867,26 +881,20 @@ static ssize_t store_protocols(struct device *device,
867 disable = false; 881 disable = false;
868 } 882 }
869 883
870 if (!enable && !disable && !strncasecmp(tmp, PROTO_NONE, sizeof(PROTO_NONE))) { 884 for (i = 0; i < ARRAY_SIZE(proto_names); i++) {
871 tmp += sizeof(PROTO_NONE); 885 if (!strcasecmp(tmp, proto_names[i].name)) {
872 mask = 0; 886 mask = proto_names[i].type;
873 count++; 887 break;
874 } else {
875 for (i = 0; i < ARRAY_SIZE(proto_names); i++) {
876 if (!strcasecmp(tmp, proto_names[i].name)) {
877 tmp += strlen(proto_names[i].name);
878 mask = proto_names[i].type;
879 break;
880 }
881 }
882 if (i == ARRAY_SIZE(proto_names)) {
883 IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
884 ret = -EINVAL;
885 goto out;
886 } 888 }
887 count++;
888 } 889 }
889 890
891 if (i == ARRAY_SIZE(proto_names)) {
892 IR_dprintk(1, "Unknown protocol: '%s'\n", tmp);
893 return -EINVAL;
894 }
895
896 count++;
897
890 if (enable) 898 if (enable)
891 type |= mask; 899 type |= mask;
892 else if (disable) 900 else if (disable)
@@ -902,7 +910,7 @@ static ssize_t store_protocols(struct device *device,
902 } 910 }
903 911
904 if (dev->change_protocol) { 912 if (dev->change_protocol) {
905 rc = dev->change_protocol(dev, type); 913 rc = dev->change_protocol(dev, &type);
906 if (rc < 0) { 914 if (rc < 0) {
907 IR_dprintk(1, "Error setting protocols to 0x%llx\n", 915 IR_dprintk(1, "Error setting protocols to 0x%llx\n",
908 (long long)type); 916 (long long)type);
@@ -1117,7 +1125,8 @@ int rc_register_device(struct rc_dev *dev)
1117 } 1125 }
1118 1126
1119 if (dev->change_protocol) { 1127 if (dev->change_protocol) {
1120 rc = dev->change_protocol(dev, rc_map->rc_type); 1128 u64 rc_type = (1 << rc_map->rc_type);
1129 rc = dev->change_protocol(dev, &rc_type);
1121 if (rc < 0) 1130 if (rc < 0)
1122 goto out_raw; 1131 goto out_raw;
1123 } 1132 }
diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c
index 9f5a17bb5ef5..a8887aba9faf 100644
--- a/drivers/media/rc/redrat3.c
+++ b/drivers/media/rc/redrat3.c
@@ -1082,7 +1082,7 @@ static struct rc_dev *redrat3_init_rc_dev(struct redrat3_dev *rr3)
1082 rc->dev.parent = dev; 1082 rc->dev.parent = dev;
1083 rc->priv = rr3; 1083 rc->priv = rr3;
1084 rc->driver_type = RC_DRIVER_IR_RAW; 1084 rc->driver_type = RC_DRIVER_IR_RAW;
1085 rc->allowed_protos = RC_TYPE_ALL; 1085 rc->allowed_protos = RC_BIT_ALL;
1086 rc->timeout = US_TO_NS(2750); 1086 rc->timeout = US_TO_NS(2750);
1087 rc->tx_ir = redrat3_transmit_ir; 1087 rc->tx_ir = redrat3_transmit_ir;
1088 rc->s_tx_carrier = redrat3_set_tx_carrier; 1088 rc->s_tx_carrier = redrat3_set_tx_carrier;
diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c
index d6f4bfe09391..c720f12f661e 100644
--- a/drivers/media/rc/streamzap.c
+++ b/drivers/media/rc/streamzap.c
@@ -322,7 +322,7 @@ static struct rc_dev *streamzap_init_rc_dev(struct streamzap_ir *sz)
322 rdev->dev.parent = dev; 322 rdev->dev.parent = dev;
323 rdev->priv = sz; 323 rdev->priv = sz;
324 rdev->driver_type = RC_DRIVER_IR_RAW; 324 rdev->driver_type = RC_DRIVER_IR_RAW;
325 rdev->allowed_protos = RC_TYPE_ALL; 325 rdev->allowed_protos = RC_BIT_ALL;
326 rdev->driver_name = DRIVER_NAME; 326 rdev->driver_name = DRIVER_NAME;
327 rdev->map_name = RC_MAP_STREAMZAP; 327 rdev->map_name = RC_MAP_STREAMZAP;
328 328
diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index fef05235234a..f0921b5483eb 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -316,7 +316,7 @@ static int __devinit ttusbir_probe(struct usb_interface *intf,
316 usb_to_input_id(tt->udev, &rc->input_id); 316 usb_to_input_id(tt->udev, &rc->input_id);
317 rc->dev.parent = &intf->dev; 317 rc->dev.parent = &intf->dev;
318 rc->driver_type = RC_DRIVER_IR_RAW; 318 rc->driver_type = RC_DRIVER_IR_RAW;
319 rc->allowed_protos = RC_TYPE_ALL; 319 rc->allowed_protos = RC_BIT_ALL;
320 rc->priv = tt; 320 rc->priv = tt;
321 rc->driver_name = DRIVER_NAME; 321 rc->driver_name = DRIVER_NAME;
322 rc->map_name = RC_MAP_TT_1500; 322 rc->map_name = RC_MAP_TT_1500;
diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c
index 7c9b5f33113b..569d8863f439 100644
--- a/drivers/media/rc/winbond-cir.c
+++ b/drivers/media/rc/winbond-cir.c
@@ -1022,7 +1022,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id)
1022 data->dev->priv = data; 1022 data->dev->priv = data;
1023 data->dev->dev.parent = &device->dev; 1023 data->dev->dev.parent = &device->dev;
1024 data->dev->timeout = MS_TO_NS(100); 1024 data->dev->timeout = MS_TO_NS(100);
1025 data->dev->allowed_protos = RC_TYPE_ALL; 1025 data->dev->allowed_protos = RC_BIT_ALL;
1026 1026
1027 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) { 1027 if (!request_region(data->wbase, WAKEUP_IOMEM_LEN, DRVNAME)) {
1028 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n", 1028 dev_err(dev, "Region 0x%lx-0x%lx already in use!\n",
diff --git a/drivers/media/usb/cx231xx/cx231xx-input.c b/drivers/media/usb/cx231xx/cx231xx-input.c
index 96176e9db5a2..0f7b42446826 100644
--- a/drivers/media/usb/cx231xx/cx231xx-input.c
+++ b/drivers/media/usb/cx231xx/cx231xx-input.c
@@ -99,7 +99,7 @@ int cx231xx_ir_init(struct cx231xx *dev)
99 /* The i2c micro-controller only outputs the cmd part of NEC protocol */ 99 /* The i2c micro-controller only outputs the cmd part of NEC protocol */
100 dev->init_data.rc_dev->scanmask = 0xff; 100 dev->init_data.rc_dev->scanmask = 0xff;
101 dev->init_data.rc_dev->driver_name = "cx231xx"; 101 dev->init_data.rc_dev->driver_name = "cx231xx";
102 dev->init_data.type = RC_TYPE_NEC; 102 dev->init_data.type = RC_BIT_NEC;
103 info.addr = 0x30; 103 info.addr = 0x30;
104 104
105 /* Load and bind ir-kbd-i2c */ 105 /* Load and bind ir-kbd-i2c */
diff --git a/drivers/media/usb/dvb-usb-v2/af9015.c b/drivers/media/usb/dvb-usb-v2/af9015.c
index 3d7526e28d42..943d93423705 100644
--- a/drivers/media/usb/dvb-usb-v2/af9015.c
+++ b/drivers/media/usb/dvb-usb-v2/af9015.c
@@ -1306,7 +1306,7 @@ static int af9015_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
1306 if (!rc->map_name) 1306 if (!rc->map_name)
1307 rc->map_name = RC_MAP_EMPTY; 1307 rc->map_name = RC_MAP_EMPTY;
1308 1308
1309 rc->allowed_protos = RC_TYPE_NEC; 1309 rc->allowed_protos = RC_BIT_NEC;
1310 rc->query = af9015_rc_query; 1310 rc->query = af9015_rc_query;
1311 rc->interval = 500; 1311 rc->interval = 500;
1312 1312
diff --git a/drivers/media/usb/dvb-usb-v2/af9035.c b/drivers/media/usb/dvb-usb-v2/af9035.c
index ea27eaff4e34..61ae7f9d0b27 100644
--- a/drivers/media/usb/dvb-usb-v2/af9035.c
+++ b/drivers/media/usb/dvb-usb-v2/af9035.c
@@ -1023,10 +1023,10 @@ static int af9035_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
1023 switch (tmp) { 1023 switch (tmp) {
1024 case 0: /* NEC */ 1024 case 0: /* NEC */
1025 default: 1025 default:
1026 rc->allowed_protos = RC_TYPE_NEC; 1026 rc->allowed_protos = RC_BIT_NEC;
1027 break; 1027 break;
1028 case 1: /* RC6 */ 1028 case 1: /* RC6 */
1029 rc->allowed_protos = RC_TYPE_RC6; 1029 rc->allowed_protos = RC_BIT_RC6_MCE;
1030 break; 1030 break;
1031 } 1031 }
1032 1032
diff --git a/drivers/media/usb/dvb-usb-v2/anysee.c b/drivers/media/usb/dvb-usb-v2/anysee.c
index ec540140c810..e78ca8fc7f85 100644
--- a/drivers/media/usb/dvb-usb-v2/anysee.c
+++ b/drivers/media/usb/dvb-usb-v2/anysee.c
@@ -1048,7 +1048,7 @@ static int anysee_rc_query(struct dvb_usb_device *d)
1048 1048
1049static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc) 1049static int anysee_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
1050{ 1050{
1051 rc->allowed_protos = RC_TYPE_NEC; 1051 rc->allowed_protos = RC_BIT_NEC;
1052 rc->query = anysee_rc_query; 1052 rc->query = anysee_rc_query;
1053 rc->interval = 250; /* windows driver uses 500ms */ 1053 rc->interval = 250; /* windows driver uses 500ms */
1054 1054
diff --git a/drivers/media/usb/dvb-usb-v2/az6007.c b/drivers/media/usb/dvb-usb-v2/az6007.c
index 54f1221d930d..d75dbf27e99e 100644
--- a/drivers/media/usb/dvb-usb-v2/az6007.c
+++ b/drivers/media/usb/dvb-usb-v2/az6007.c
@@ -826,7 +826,7 @@ static int az6007_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
826{ 826{
827 pr_debug("Getting az6007 Remote Control properties\n"); 827 pr_debug("Getting az6007 Remote Control properties\n");
828 828
829 rc->allowed_protos = RC_TYPE_NEC; 829 rc->allowed_protos = RC_BIT_NEC;
830 rc->query = az6007_rc_query; 830 rc->query = az6007_rc_query;
831 rc->interval = 400; 831 rc->interval = 400;
832 832
diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb.h b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
index bae16a1189d6..059291b892b8 100644
--- a/drivers/media/usb/dvb-usb-v2/dvb_usb.h
+++ b/drivers/media/usb/dvb-usb-v2/dvb_usb.h
@@ -137,7 +137,7 @@ struct dvb_usb_driver_info {
137struct dvb_usb_rc { 137struct dvb_usb_rc {
138 const char *map_name; 138 const char *map_name;
139 u64 allowed_protos; 139 u64 allowed_protos;
140 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 140 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
141 int (*query) (struct dvb_usb_device *d); 141 int (*query) (struct dvb_usb_device *d);
142 unsigned int interval; 142 unsigned int interval;
143 const enum rc_driver_type driver_type; 143 const enum rc_driver_type driver_type;
diff --git a/drivers/media/usb/dvb-usb-v2/it913x.c b/drivers/media/usb/dvb-usb-v2/it913x.c
index 695f9106bc54..0b1ddc24c47c 100644
--- a/drivers/media/usb/dvb-usb-v2/it913x.c
+++ b/drivers/media/usb/dvb-usb-v2/it913x.c
@@ -698,7 +698,7 @@ static int it913x_get_rc_config(struct dvb_usb_device *d, struct dvb_usb_rc *rc)
698 return 0; 698 return 0;
699 } 699 }
700 700
701 rc->allowed_protos = RC_TYPE_NEC; 701 rc->allowed_protos = RC_BIT_NEC;
702 rc->query = it913x_rc_query; 702 rc->query = it913x_rc_query;
703 rc->interval = 250; 703 rc->interval = 250;
704 704
diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c
index c41d9d9ec7b5..6a2445b48321 100644
--- a/drivers/media/usb/dvb-usb-v2/lmedm04.c
+++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c
@@ -1253,7 +1253,7 @@ static int lme2510_get_stream_config(struct dvb_frontend *fe, u8 *ts_type,
1253static int lme2510_get_rc_config(struct dvb_usb_device *d, 1253static int lme2510_get_rc_config(struct dvb_usb_device *d,
1254 struct dvb_usb_rc *rc) 1254 struct dvb_usb_rc *rc)
1255{ 1255{
1256 rc->allowed_protos = RC_TYPE_NEC; 1256 rc->allowed_protos = RC_BIT_NEC;
1257 return 0; 1257 return 0;
1258} 1258}
1259 1259
diff --git a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
index adabba8d28bc..ec9108e2a297 100644
--- a/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
+++ b/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
@@ -1197,7 +1197,7 @@ static int rtl2831u_get_rc_config(struct dvb_usb_device *d,
1197 struct dvb_usb_rc *rc) 1197 struct dvb_usb_rc *rc)
1198{ 1198{
1199 rc->map_name = RC_MAP_EMPTY; 1199 rc->map_name = RC_MAP_EMPTY;
1200 rc->allowed_protos = RC_TYPE_NEC; 1200 rc->allowed_protos = RC_BIT_NEC;
1201 rc->query = rtl2831u_rc_query; 1201 rc->query = rtl2831u_rc_query;
1202 rc->interval = 400; 1202 rc->interval = 400;
1203 1203
@@ -1269,7 +1269,7 @@ static int rtl2832u_get_rc_config(struct dvb_usb_device *d,
1269 struct dvb_usb_rc *rc) 1269 struct dvb_usb_rc *rc)
1270{ 1270{
1271 rc->map_name = RC_MAP_EMPTY; 1271 rc->map_name = RC_MAP_EMPTY;
1272 rc->allowed_protos = RC_TYPE_NEC; 1272 rc->allowed_protos = RC_BIT_NEC;
1273 rc->query = rtl2832u_rc_query; 1273 rc->query = rtl2832u_rc_query;
1274 rc->interval = 400; 1274 rc->interval = 400;
1275 1275
diff --git a/drivers/media/usb/dvb-usb/dib0700.h b/drivers/media/usb/dvb-usb/dib0700.h
index 7de125c0b36f..637b6123f391 100644
--- a/drivers/media/usb/dvb-usb/dib0700.h
+++ b/drivers/media/usb/dvb-usb/dib0700.h
@@ -64,7 +64,7 @@ extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
64extern struct i2c_algorithm dib0700_i2c_algo; 64extern struct i2c_algorithm dib0700_i2c_algo;
65extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props, 65extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
66 struct dvb_usb_device_description **desc, int *cold); 66 struct dvb_usb_device_description **desc, int *cold);
67extern int dib0700_change_protocol(struct rc_dev *dev, u64 rc_type); 67extern int dib0700_change_protocol(struct rc_dev *dev, u64 *rc_type);
68extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz); 68extern int dib0700_set_i2c_speed(struct dvb_usb_device *d, u16 scl_kHz);
69 69
70extern int dib0700_device_count; 70extern int dib0700_device_count;
diff --git a/drivers/media/usb/dvb-usb/dib0700_core.c b/drivers/media/usb/dvb-usb/dib0700_core.c
index ef87229de6af..19b5ed2825d7 100644
--- a/drivers/media/usb/dvb-usb/dib0700_core.c
+++ b/drivers/media/usb/dvb-usb/dib0700_core.c
@@ -605,7 +605,7 @@ int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
605 return ret; 605 return ret;
606} 606}
607 607
608int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type) 608int dib0700_change_protocol(struct rc_dev *rc, u64 *rc_type)
609{ 609{
610 struct dvb_usb_device *d = rc->priv; 610 struct dvb_usb_device *d = rc->priv;
611 struct dib0700_state *st = d->priv; 611 struct dib0700_state *st = d->priv;
@@ -621,17 +621,19 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type)
621 st->buf[2] = 0; 621 st->buf[2] = 0;
622 622
623 /* Set the IR mode */ 623 /* Set the IR mode */
624 if (rc_type == RC_TYPE_RC5) 624 if (*rc_type & RC_BIT_RC5) {
625 new_proto = 1; 625 new_proto = 1;
626 else if (rc_type == RC_TYPE_NEC) 626 *rc_type = RC_BIT_RC5;
627 } else if (*rc_type & RC_BIT_NEC) {
627 new_proto = 0; 628 new_proto = 0;
628 else if (rc_type == RC_TYPE_RC6) { 629 *rc_type = RC_BIT_NEC;
630 } else if (*rc_type & RC_BIT_RC6_MCE) {
629 if (st->fw_version < 0x10200) { 631 if (st->fw_version < 0x10200) {
630 ret = -EINVAL; 632 ret = -EINVAL;
631 goto out; 633 goto out;
632 } 634 }
633
634 new_proto = 2; 635 new_proto = 2;
636 *rc_type = RC_BIT_RC6_MCE;
635 } else { 637 } else {
636 ret = -EINVAL; 638 ret = -EINVAL;
637 goto out; 639 goto out;
@@ -645,7 +647,7 @@ int dib0700_change_protocol(struct rc_dev *rc, u64 rc_type)
645 goto out; 647 goto out;
646 } 648 }
647 649
648 d->props.rc.core.protocol = rc_type; 650 d->props.rc.core.protocol = *rc_type;
649 651
650out: 652out:
651 mutex_unlock(&d->usb_mutex); 653 mutex_unlock(&d->usb_mutex);
@@ -707,7 +709,7 @@ static void dib0700_rc_urb_completion(struct urb *purb)
707 purb->actual_length); 709 purb->actual_length);
708 710
709 switch (d->props.rc.core.protocol) { 711 switch (d->props.rc.core.protocol) {
710 case RC_TYPE_NEC: 712 case RC_BIT_NEC:
711 toggle = 0; 713 toggle = 0;
712 714
713 /* NEC protocol sends repeat code as 0 0 0 FF */ 715 /* NEC protocol sends repeat code as 0 0 0 FF */
diff --git a/drivers/media/usb/dvb-usb/dib0700_devices.c b/drivers/media/usb/dvb-usb/dib0700_devices.c
index 510001da6e83..11798426fa88 100644
--- a/drivers/media/usb/dvb-usb/dib0700_devices.c
+++ b/drivers/media/usb/dvb-usb/dib0700_devices.c
@@ -518,7 +518,7 @@ static int dib0700_rc_query_old_firmware(struct dvb_usb_device *d)
518 518
519 d->last_event = 0; 519 d->last_event = 0;
520 switch (d->props.rc.core.protocol) { 520 switch (d->props.rc.core.protocol) {
521 case RC_TYPE_NEC: 521 case RC_BIT_NEC:
522 /* NEC protocol sends repeat code as 0 0 0 FF */ 522 /* NEC protocol sends repeat code as 0 0 0 FF */
523 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) && 523 if ((key[3-2] == 0x00) && (key[3-3] == 0x00) &&
524 (key[3] == 0xff)) 524 (key[3] == 0xff))
@@ -3658,9 +3658,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3658 .rc_interval = DEFAULT_RC_INTERVAL, 3658 .rc_interval = DEFAULT_RC_INTERVAL,
3659 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3659 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3660 .rc_query = dib0700_rc_query_old_firmware, 3660 .rc_query = dib0700_rc_query_old_firmware,
3661 .allowed_protos = RC_TYPE_RC5 | 3661 .allowed_protos = RC_BIT_RC5 |
3662 RC_TYPE_RC6 | 3662 RC_BIT_RC6_MCE |
3663 RC_TYPE_NEC, 3663 RC_BIT_NEC,
3664 .change_protocol = dib0700_change_protocol, 3664 .change_protocol = dib0700_change_protocol,
3665 }, 3665 },
3666 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3666 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3698,9 +3698,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3698 .rc_interval = DEFAULT_RC_INTERVAL, 3698 .rc_interval = DEFAULT_RC_INTERVAL,
3699 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3699 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3700 .rc_query = dib0700_rc_query_old_firmware, 3700 .rc_query = dib0700_rc_query_old_firmware,
3701 .allowed_protos = RC_TYPE_RC5 | 3701 .allowed_protos = RC_BIT_RC5 |
3702 RC_TYPE_RC6 | 3702 RC_BIT_RC6_MCE |
3703 RC_TYPE_NEC, 3703 RC_BIT_NEC,
3704 .change_protocol = dib0700_change_protocol, 3704 .change_protocol = dib0700_change_protocol,
3705 }, 3705 },
3706 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3706 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3763,9 +3763,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3763 .rc_interval = DEFAULT_RC_INTERVAL, 3763 .rc_interval = DEFAULT_RC_INTERVAL,
3764 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3764 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3765 .rc_query = dib0700_rc_query_old_firmware, 3765 .rc_query = dib0700_rc_query_old_firmware,
3766 .allowed_protos = RC_TYPE_RC5 | 3766 .allowed_protos = RC_BIT_RC5 |
3767 RC_TYPE_RC6 | 3767 RC_BIT_RC6_MCE |
3768 RC_TYPE_NEC, 3768 RC_BIT_NEC,
3769 .change_protocol = dib0700_change_protocol, 3769 .change_protocol = dib0700_change_protocol,
3770 }, 3770 },
3771 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3771 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3808,9 +3808,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3808 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3808 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3809 .module_name = "dib0700", 3809 .module_name = "dib0700",
3810 .rc_query = dib0700_rc_query_old_firmware, 3810 .rc_query = dib0700_rc_query_old_firmware,
3811 .allowed_protos = RC_TYPE_RC5 | 3811 .allowed_protos = RC_BIT_RC5 |
3812 RC_TYPE_RC6 | 3812 RC_BIT_RC6_MCE |
3813 RC_TYPE_NEC, 3813 RC_BIT_NEC,
3814 .change_protocol = dib0700_change_protocol, 3814 .change_protocol = dib0700_change_protocol,
3815 }, 3815 },
3816 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3816 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3890,9 +3890,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3890 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3890 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3891 .module_name = "dib0700", 3891 .module_name = "dib0700",
3892 .rc_query = dib0700_rc_query_old_firmware, 3892 .rc_query = dib0700_rc_query_old_firmware,
3893 .allowed_protos = RC_TYPE_RC5 | 3893 .allowed_protos = RC_BIT_RC5 |
3894 RC_TYPE_RC6 | 3894 RC_BIT_RC6_MCE |
3895 RC_TYPE_NEC, 3895 RC_BIT_NEC,
3896 .change_protocol = dib0700_change_protocol, 3896 .change_protocol = dib0700_change_protocol,
3897 }, 3897 },
3898 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3898 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3936,9 +3936,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3936 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3936 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3937 .module_name = "dib0700", 3937 .module_name = "dib0700",
3938 .rc_query = dib0700_rc_query_old_firmware, 3938 .rc_query = dib0700_rc_query_old_firmware,
3939 .allowed_protos = RC_TYPE_RC5 | 3939 .allowed_protos = RC_BIT_RC5 |
3940 RC_TYPE_RC6 | 3940 RC_BIT_RC6_MCE |
3941 RC_TYPE_NEC, 3941 RC_BIT_NEC,
3942 .change_protocol = dib0700_change_protocol, 3942 .change_protocol = dib0700_change_protocol,
3943 }, 3943 },
3944 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3944 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -3987,9 +3987,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
3987 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 3987 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
3988 .module_name = "dib0700", 3988 .module_name = "dib0700",
3989 .rc_query = dib0700_rc_query_old_firmware, 3989 .rc_query = dib0700_rc_query_old_firmware,
3990 .allowed_protos = RC_TYPE_RC5 | 3990 .allowed_protos = RC_BIT_RC5 |
3991 RC_TYPE_RC6 | 3991 RC_BIT_RC6_MCE |
3992 RC_TYPE_NEC, 3992 RC_BIT_NEC,
3993 .change_protocol = dib0700_change_protocol, 3993 .change_protocol = dib0700_change_protocol,
3994 }, 3994 },
3995 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 3995 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4055,9 +4055,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4055 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4055 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4056 .module_name = "dib0700", 4056 .module_name = "dib0700",
4057 .rc_query = dib0700_rc_query_old_firmware, 4057 .rc_query = dib0700_rc_query_old_firmware,
4058 .allowed_protos = RC_TYPE_RC5 | 4058 .allowed_protos = RC_BIT_RC5 |
4059 RC_TYPE_RC6 | 4059 RC_BIT_RC6_MCE |
4060 RC_TYPE_NEC, 4060 RC_BIT_NEC,
4061 .change_protocol = dib0700_change_protocol, 4061 .change_protocol = dib0700_change_protocol,
4062 }, 4062 },
4063 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4063 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4106,9 +4106,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4106 .rc_codes = RC_MAP_DIB0700_NEC_TABLE, 4106 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4107 .module_name = "dib0700", 4107 .module_name = "dib0700",
4108 .rc_query = dib0700_rc_query_old_firmware, 4108 .rc_query = dib0700_rc_query_old_firmware,
4109 .allowed_protos = RC_TYPE_RC5 | 4109 .allowed_protos = RC_BIT_RC5 |
4110 RC_TYPE_RC6 | 4110 RC_BIT_RC6_MCE |
4111 RC_TYPE_NEC, 4111 RC_BIT_NEC,
4112 .change_protocol = dib0700_change_protocol, 4112 .change_protocol = dib0700_change_protocol,
4113 }, 4113 },
4114 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4114 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4177,9 +4177,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4177 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4177 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4178 .module_name = "dib0700", 4178 .module_name = "dib0700",
4179 .rc_query = dib0700_rc_query_old_firmware, 4179 .rc_query = dib0700_rc_query_old_firmware,
4180 .allowed_protos = RC_TYPE_RC5 | 4180 .allowed_protos = RC_BIT_RC5 |
4181 RC_TYPE_RC6 | 4181 RC_BIT_RC6_MCE |
4182 RC_TYPE_NEC, 4182 RC_BIT_NEC,
4183 .change_protocol = dib0700_change_protocol, 4183 .change_protocol = dib0700_change_protocol,
4184 }, 4184 },
4185 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4185 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4215,9 +4215,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4215 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4215 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4216 .module_name = "dib0700", 4216 .module_name = "dib0700",
4217 .rc_query = dib0700_rc_query_old_firmware, 4217 .rc_query = dib0700_rc_query_old_firmware,
4218 .allowed_protos = RC_TYPE_RC5 | 4218 .allowed_protos = RC_BIT_RC5 |
4219 RC_TYPE_RC6 | 4219 RC_BIT_RC6_MCE |
4220 RC_TYPE_NEC, 4220 RC_BIT_NEC,
4221 .change_protocol = dib0700_change_protocol, 4221 .change_protocol = dib0700_change_protocol,
4222 }, 4222 },
4223 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4223 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4295,9 +4295,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4295 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4295 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4296 .module_name = "dib0700", 4296 .module_name = "dib0700",
4297 .rc_query = dib0700_rc_query_old_firmware, 4297 .rc_query = dib0700_rc_query_old_firmware,
4298 .allowed_protos = RC_TYPE_RC5 | 4298 .allowed_protos = RC_BIT_RC5 |
4299 RC_TYPE_RC6 | 4299 RC_BIT_RC6_MCE |
4300 RC_TYPE_NEC, 4300 RC_BIT_NEC,
4301 .change_protocol = dib0700_change_protocol, 4301 .change_protocol = dib0700_change_protocol,
4302 }, 4302 },
4303 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4303 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4341,9 +4341,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4341 .rc_codes = RC_MAP_DIB0700_NEC_TABLE, 4341 .rc_codes = RC_MAP_DIB0700_NEC_TABLE,
4342 .module_name = "dib0700", 4342 .module_name = "dib0700",
4343 .rc_query = dib0700_rc_query_old_firmware, 4343 .rc_query = dib0700_rc_query_old_firmware,
4344 .allowed_protos = RC_TYPE_RC5 | 4344 .allowed_protos = RC_BIT_RC5 |
4345 RC_TYPE_RC6 | 4345 RC_BIT_RC6_MCE |
4346 RC_TYPE_NEC, 4346 RC_BIT_NEC,
4347 .change_protocol = dib0700_change_protocol, 4347 .change_protocol = dib0700_change_protocol,
4348 }, 4348 },
4349 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4349 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4394,9 +4394,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4394 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4394 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4395 .module_name = "dib0700", 4395 .module_name = "dib0700",
4396 .rc_query = dib0700_rc_query_old_firmware, 4396 .rc_query = dib0700_rc_query_old_firmware,
4397 .allowed_protos = RC_TYPE_RC5 | 4397 .allowed_protos = RC_BIT_RC5 |
4398 RC_TYPE_RC6 | 4398 RC_BIT_RC6_MCE |
4399 RC_TYPE_NEC, 4399 RC_BIT_NEC,
4400 .change_protocol = dib0700_change_protocol, 4400 .change_protocol = dib0700_change_protocol,
4401 }, 4401 },
4402 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4402 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4433,9 +4433,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4433 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4433 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4434 .module_name = "dib0700", 4434 .module_name = "dib0700",
4435 .rc_query = dib0700_rc_query_old_firmware, 4435 .rc_query = dib0700_rc_query_old_firmware,
4436 .allowed_protos = RC_TYPE_RC5 | 4436 .allowed_protos = RC_BIT_RC5 |
4437 RC_TYPE_RC6 | 4437 RC_BIT_RC6_MCE |
4438 RC_TYPE_NEC, 4438 RC_BIT_NEC,
4439 .change_protocol = dib0700_change_protocol, 4439 .change_protocol = dib0700_change_protocol,
4440 }, 4440 },
4441 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4441 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4472,9 +4472,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4472 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4472 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4473 .module_name = "dib0700", 4473 .module_name = "dib0700",
4474 .rc_query = dib0700_rc_query_old_firmware, 4474 .rc_query = dib0700_rc_query_old_firmware,
4475 .allowed_protos = RC_TYPE_RC5 | 4475 .allowed_protos = RC_BIT_RC5 |
4476 RC_TYPE_RC6 | 4476 RC_BIT_RC6_MCE |
4477 RC_TYPE_NEC, 4477 RC_BIT_NEC,
4478 .change_protocol = dib0700_change_protocol, 4478 .change_protocol = dib0700_change_protocol,
4479 }, 4479 },
4480 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4480 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4511,9 +4511,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4511 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4511 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4512 .module_name = "dib0700", 4512 .module_name = "dib0700",
4513 .rc_query = dib0700_rc_query_old_firmware, 4513 .rc_query = dib0700_rc_query_old_firmware,
4514 .allowed_protos = RC_TYPE_RC5 | 4514 .allowed_protos = RC_BIT_RC5 |
4515 RC_TYPE_RC6 | 4515 RC_BIT_RC6_MCE |
4516 RC_TYPE_NEC, 4516 RC_BIT_NEC,
4517 .change_protocol = dib0700_change_protocol, 4517 .change_protocol = dib0700_change_protocol,
4518 }, 4518 },
4519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4519 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4550,9 +4550,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4550 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4550 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4551 .module_name = "dib0700", 4551 .module_name = "dib0700",
4552 .rc_query = dib0700_rc_query_old_firmware, 4552 .rc_query = dib0700_rc_query_old_firmware,
4553 .allowed_protos = RC_TYPE_RC5 | 4553 .allowed_protos = RC_BIT_RC5 |
4554 RC_TYPE_RC6 | 4554 RC_BIT_RC6_MCE |
4555 RC_TYPE_NEC, 4555 RC_BIT_NEC,
4556 .change_protocol = dib0700_change_protocol, 4556 .change_protocol = dib0700_change_protocol,
4557 }, 4557 },
4558 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4558 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4589,9 +4589,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4589 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4589 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4590 .module_name = "dib0700", 4590 .module_name = "dib0700",
4591 .rc_query = dib0700_rc_query_old_firmware, 4591 .rc_query = dib0700_rc_query_old_firmware,
4592 .allowed_protos = RC_TYPE_RC5 | 4592 .allowed_protos = RC_BIT_RC5 |
4593 RC_TYPE_RC6 | 4593 RC_BIT_RC6_MCE |
4594 RC_TYPE_NEC, 4594 RC_BIT_NEC,
4595 .change_protocol = dib0700_change_protocol, 4595 .change_protocol = dib0700_change_protocol,
4596 }, 4596 },
4597 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4597 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4644,9 +4644,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4644 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4644 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4645 .module_name = "dib0700", 4645 .module_name = "dib0700",
4646 .rc_query = dib0700_rc_query_old_firmware, 4646 .rc_query = dib0700_rc_query_old_firmware,
4647 .allowed_protos = RC_TYPE_RC5 | 4647 .allowed_protos = RC_BIT_RC5 |
4648 RC_TYPE_RC6 | 4648 RC_BIT_RC6_MCE |
4649 RC_TYPE_NEC, 4649 RC_BIT_NEC,
4650 .change_protocol = dib0700_change_protocol, 4650 .change_protocol = dib0700_change_protocol,
4651 }, 4651 },
4652 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4652 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4681,9 +4681,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4681 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4681 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4682 .module_name = "dib0700", 4682 .module_name = "dib0700",
4683 .rc_query = dib0700_rc_query_old_firmware, 4683 .rc_query = dib0700_rc_query_old_firmware,
4684 .allowed_protos = RC_TYPE_RC5 | 4684 .allowed_protos = RC_BIT_RC5 |
4685 RC_TYPE_RC6 | 4685 RC_BIT_RC6_MCE |
4686 RC_TYPE_NEC, 4686 RC_BIT_NEC,
4687 .change_protocol = dib0700_change_protocol, 4687 .change_protocol = dib0700_change_protocol,
4688 }, 4688 },
4689 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4689 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4721,9 +4721,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4721 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4721 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4722 .module_name = "dib0700", 4722 .module_name = "dib0700",
4723 .rc_query = dib0700_rc_query_old_firmware, 4723 .rc_query = dib0700_rc_query_old_firmware,
4724 .allowed_protos = RC_TYPE_RC5 | 4724 .allowed_protos = RC_BIT_RC5 |
4725 RC_TYPE_RC6 | 4725 RC_BIT_RC6_MCE |
4726 RC_TYPE_NEC, 4726 RC_BIT_NEC,
4727 .change_protocol = dib0700_change_protocol, 4727 .change_protocol = dib0700_change_protocol,
4728 }, 4728 },
4729 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4729 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4761,9 +4761,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4761 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4761 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4762 .module_name = "dib0700", 4762 .module_name = "dib0700",
4763 .rc_query = dib0700_rc_query_old_firmware, 4763 .rc_query = dib0700_rc_query_old_firmware,
4764 .allowed_protos = RC_TYPE_RC5 | 4764 .allowed_protos = RC_BIT_RC5 |
4765 RC_TYPE_RC6 | 4765 RC_BIT_RC6_MCE |
4766 RC_TYPE_NEC, 4766 RC_BIT_NEC,
4767 .change_protocol = dib0700_change_protocol, 4767 .change_protocol = dib0700_change_protocol,
4768 }, 4768 },
4769 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, 4769 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
@@ -4802,9 +4802,9 @@ struct dvb_usb_device_properties dib0700_devices[] = {
4802 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 4802 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
4803 .module_name = "dib0700", 4803 .module_name = "dib0700",
4804 .rc_query = dib0700_rc_query_old_firmware, 4804 .rc_query = dib0700_rc_query_old_firmware,
4805 .allowed_protos = RC_TYPE_RC5 | 4805 .allowed_protos = RC_BIT_RC5 |
4806 RC_TYPE_RC6 | 4806 RC_BIT_RC6_MCE |
4807 RC_TYPE_NEC, 4807 RC_BIT_NEC,
4808 .change_protocol = dib0700_change_protocol, 4808 .change_protocol = dib0700_change_protocol,
4809 }, 4809 },
4810 }, 4810 },
diff --git a/drivers/media/usb/dvb-usb/dvb-usb.h b/drivers/media/usb/dvb-usb/dvb-usb.h
index aab0f99bc892..ce4c4e3b58bb 100644
--- a/drivers/media/usb/dvb-usb/dvb-usb.h
+++ b/drivers/media/usb/dvb-usb/dvb-usb.h
@@ -202,7 +202,7 @@ struct dvb_rc {
202 u64 protocol; 202 u64 protocol;
203 u64 allowed_protos; 203 u64 allowed_protos;
204 enum rc_driver_type driver_type; 204 enum rc_driver_type driver_type;
205 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 205 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
206 char *module_name; 206 char *module_name;
207 int (*rc_query) (struct dvb_usb_device *d); 207 int (*rc_query) (struct dvb_usb_device *d);
208 int rc_interval; 208 int rc_interval;
diff --git a/drivers/media/usb/dvb-usb/pctv452e.c b/drivers/media/usb/dvb-usb/pctv452e.c
index 02e878577c3d..d1ddfa13de86 100644
--- a/drivers/media/usb/dvb-usb/pctv452e.c
+++ b/drivers/media/usb/dvb-usb/pctv452e.c
@@ -927,7 +927,7 @@ static struct dvb_usb_device_properties pctv452e_properties = {
927 927
928 .rc.core = { 928 .rc.core = {
929 .rc_codes = RC_MAP_DIB0700_RC5_TABLE, 929 .rc_codes = RC_MAP_DIB0700_RC5_TABLE,
930 .allowed_protos = RC_TYPE_UNKNOWN, 930 .allowed_protos = RC_BIT_UNKNOWN,
931 .rc_query = pctv452e_rc_query, 931 .rc_query = pctv452e_rc_query,
932 .rc_interval = 100, 932 .rc_interval = 100,
933 }, 933 },
@@ -980,7 +980,7 @@ static struct dvb_usb_device_properties tt_connect_s2_3600_properties = {
980 980
981 .rc.core = { 981 .rc.core = {
982 .rc_codes = RC_MAP_TT_1500, 982 .rc_codes = RC_MAP_TT_1500,
983 .allowed_protos = RC_TYPE_UNKNOWN, 983 .allowed_protos = RC_BIT_UNKNOWN,
984 .rc_query = pctv452e_rc_query, 984 .rc_query = pctv452e_rc_query,
985 .rc_interval = 100, 985 .rc_interval = 100,
986 }, 986 },
diff --git a/drivers/media/usb/dvb-usb/technisat-usb2.c b/drivers/media/usb/dvb-usb/technisat-usb2.c
index 7a8c8c18590f..40832a1aef6c 100644
--- a/drivers/media/usb/dvb-usb/technisat-usb2.c
+++ b/drivers/media/usb/dvb-usb/technisat-usb2.c
@@ -732,7 +732,7 @@ static struct dvb_usb_device_properties technisat_usb2_devices = {
732 .rc_codes = RC_MAP_TECHNISAT_USB2, 732 .rc_codes = RC_MAP_TECHNISAT_USB2,
733 .module_name = "technisat-usb2", 733 .module_name = "technisat-usb2",
734 .rc_query = technisat_usb2_rc_query, 734 .rc_query = technisat_usb2_rc_query,
735 .allowed_protos = RC_TYPE_ALL, 735 .allowed_protos = RC_BIT_ALL,
736 .driver_type = RC_DRIVER_IR_RAW, 736 .driver_type = RC_DRIVER_IR_RAW,
737 } 737 }
738}; 738};
diff --git a/drivers/media/usb/dvb-usb/ttusb2.c b/drivers/media/usb/dvb-usb/ttusb2.c
index 6a50cdea3bce..bcdac225ebe1 100644
--- a/drivers/media/usb/dvb-usb/ttusb2.c
+++ b/drivers/media/usb/dvb-usb/ttusb2.c
@@ -741,7 +741,7 @@ static struct dvb_usb_device_properties ttusb2_properties_ct3650 = {
741 .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */ 741 .rc_interval = 150, /* Less than IR_KEYPRESS_TIMEOUT */
742 .rc_codes = RC_MAP_TT_1500, 742 .rc_codes = RC_MAP_TT_1500,
743 .rc_query = tt3650_rc_query, 743 .rc_query = tt3650_rc_query,
744 .allowed_protos = RC_TYPE_UNKNOWN, 744 .allowed_protos = RC_BIT_UNKNOWN,
745 }, 745 },
746 746
747 .num_adapters = 1, 747 .num_adapters = 1,
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index 97d36b4f19db..660bf803c9e4 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -345,7 +345,7 @@ static void em28xx_ir_stop(struct rc_dev *rc)
345 cancel_delayed_work_sync(&ir->work); 345 cancel_delayed_work_sync(&ir->work);
346} 346}
347 347
348static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type) 348static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 *rc_type)
349{ 349{
350 int rc = 0; 350 int rc = 0;
351 struct em28xx_IR *ir = rc_dev->priv; 351 struct em28xx_IR *ir = rc_dev->priv;
@@ -354,14 +354,16 @@ static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 rc_type)
354 354
355 /* Adjust xclk based o IR table for RC5/NEC tables */ 355 /* Adjust xclk based o IR table for RC5/NEC tables */
356 356
357 if (rc_type == RC_TYPE_RC5) { 357 if (*rc_type & RC_BIT_RC5) {
358 dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE; 358 dev->board.xclk |= EM28XX_XCLK_IR_RC5_MODE;
359 ir->full_code = 1; 359 ir->full_code = 1;
360 } else if (rc_type == RC_TYPE_NEC) { 360 *rc_type = RC_BIT_RC5;
361 } else if (*rc_type & RC_BIT_NEC) {
361 dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE; 362 dev->board.xclk &= ~EM28XX_XCLK_IR_RC5_MODE;
362 ir_config = EM2874_IR_NEC; 363 ir_config = EM2874_IR_NEC;
363 ir->full_code = 1; 364 ir->full_code = 1;
364 } else if (rc_type != RC_TYPE_UNKNOWN) 365 *rc_type = RC_BIT_NEC;
366 } else if (*rc_type != RC_BIT_UNKNOWN)
365 rc = -EINVAL; 367 rc = -EINVAL;
366 368
367 em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk, 369 em28xx_write_reg_bits(dev, EM28XX_R0F_XCLK, dev->board.xclk,
@@ -524,6 +526,7 @@ static int em28xx_ir_init(struct em28xx *dev)
524 struct em28xx_IR *ir; 526 struct em28xx_IR *ir;
525 struct rc_dev *rc; 527 struct rc_dev *rc;
526 int err = -ENOMEM; 528 int err = -ENOMEM;
529 u64 rc_type;
527 530
528 if (dev->board.ir_codes == NULL) { 531 if (dev->board.ir_codes == NULL) {
529 /* No remote control support */ 532 /* No remote control support */
@@ -546,14 +549,15 @@ static int em28xx_ir_init(struct em28xx *dev)
546 * em2874 supports more protocols. For now, let's just announce 549 * em2874 supports more protocols. For now, let's just announce
547 * the two protocols that were already tested 550 * the two protocols that were already tested
548 */ 551 */
549 rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; 552 rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC;
550 rc->priv = ir; 553 rc->priv = ir;
551 rc->change_protocol = em28xx_ir_change_protocol; 554 rc->change_protocol = em28xx_ir_change_protocol;
552 rc->open = em28xx_ir_start; 555 rc->open = em28xx_ir_start;
553 rc->close = em28xx_ir_stop; 556 rc->close = em28xx_ir_stop;
554 557
555 /* By default, keep protocol field untouched */ 558 /* By default, keep protocol field untouched */
556 err = em28xx_ir_change_protocol(rc, RC_TYPE_UNKNOWN); 559 rc_type = RC_BIT_UNKNOWN;
560 err = em28xx_ir_change_protocol(rc, &rc_type);
557 if (err) 561 if (err)
558 goto err_out_free; 562 goto err_out_free;
559 563
diff --git a/drivers/media/usb/hdpvr/hdpvr-i2c.c b/drivers/media/usb/hdpvr/hdpvr-i2c.c
index 82e819fa91c0..031cf024304c 100644
--- a/drivers/media/usb/hdpvr/hdpvr-i2c.c
+++ b/drivers/media/usb/hdpvr/hdpvr-i2c.c
@@ -55,7 +55,7 @@ struct i2c_client *hdpvr_register_ir_rx_i2c(struct hdpvr_device *dev)
55 /* Our default information for ir-kbd-i2c.c to use */ 55 /* Our default information for ir-kbd-i2c.c to use */
56 init_data->ir_codes = RC_MAP_HAUPPAUGE; 56 init_data->ir_codes = RC_MAP_HAUPPAUGE;
57 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 57 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
58 init_data->type = RC_TYPE_RC5; 58 init_data->type = RC_BIT_RC5;
59 init_data->name = "HD-PVR"; 59 init_data->name = "HD-PVR";
60 init_data->polling_interval = 405; /* ms, duplicated from Windows */ 60 init_data->polling_interval = 405; /* ms, duplicated from Windows */
61 hdpvr_ir_rx_i2c_board_info.platform_data = init_data; 61 hdpvr_ir_rx_i2c_board_info.platform_data = init_data;
diff --git a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
index 885ce11f222d..9ab596c78a4e 100644
--- a/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/usb/pvrusb2/pvrusb2-i2c-core.c
@@ -581,7 +581,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
581 case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */ 581 case PVR2_IR_SCHEME_29XXX: /* Original 29xxx device */
582 init_data->ir_codes = RC_MAP_HAUPPAUGE; 582 init_data->ir_codes = RC_MAP_HAUPPAUGE;
583 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP; 583 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP;
584 init_data->type = RC_TYPE_RC5; 584 init_data->type = RC_BIT_RC5;
585 init_data->name = hdw->hdw_desc->description; 585 init_data->name = hdw->hdw_desc->description;
586 init_data->polling_interval = 100; /* ms From ir-kbd-i2c */ 586 init_data->polling_interval = 100; /* ms From ir-kbd-i2c */
587 /* IR Receiver */ 587 /* IR Receiver */
@@ -596,7 +596,7 @@ static void pvr2_i2c_register_ir(struct pvr2_hdw *hdw)
596 case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */ 596 case PVR2_IR_SCHEME_24XXX_MCE: /* 24xxx MCE device */
597 init_data->ir_codes = RC_MAP_HAUPPAUGE; 597 init_data->ir_codes = RC_MAP_HAUPPAUGE;
598 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR; 598 init_data->internal_get_key_func = IR_KBD_GET_KEY_HAUP_XVR;
599 init_data->type = RC_TYPE_RC5; 599 init_data->type = RC_BIT_RC5;
600 init_data->name = hdw->hdw_desc->description; 600 init_data->name = hdw->hdw_desc->description;
601 /* IR Receiver */ 601 /* IR Receiver */
602 info.addr = 0x71; 602 info.addr = 0x71;
diff --git a/drivers/media/usb/tm6000/tm6000-input.c b/drivers/media/usb/tm6000/tm6000-input.c
index dffbd4bd47b1..8a6bbf1d80e1 100644
--- a/drivers/media/usb/tm6000/tm6000-input.c
+++ b/drivers/media/usb/tm6000/tm6000-input.c
@@ -109,12 +109,12 @@ static int tm6000_ir_config(struct tm6000_IR *ir)
109 */ 109 */
110 110
111 switch (ir->rc_type) { 111 switch (ir->rc_type) {
112 case RC_TYPE_NEC: 112 case RC_BIT_NEC:
113 leader = 900; /* ms */ 113 leader = 900; /* ms */
114 pulse = 700; /* ms - the actual value would be 562 */ 114 pulse = 700; /* ms - the actual value would be 562 */
115 break; 115 break;
116 default: 116 default:
117 case RC_TYPE_RC5: 117 case RC_BIT_RC5:
118 leader = 900; /* ms - from the NEC decoding */ 118 leader = 900; /* ms - from the NEC decoding */
119 pulse = 1780; /* ms - The actual value would be 1776 */ 119 pulse = 1780; /* ms - The actual value would be 1776 */
120 break; 120 break;
@@ -122,12 +122,12 @@ static int tm6000_ir_config(struct tm6000_IR *ir)
122 122
123 pulse = ir_clock_mhz * pulse; 123 pulse = ir_clock_mhz * pulse;
124 leader = ir_clock_mhz * leader; 124 leader = ir_clock_mhz * leader;
125 if (ir->rc_type == RC_TYPE_NEC) 125 if (ir->rc_type == RC_BIT_NEC)
126 leader = leader | 0x8000; 126 leader = leader | 0x8000;
127 127
128 dprintk(2, "%s: %s, %d MHz, leader = 0x%04x, pulse = 0x%06x \n", 128 dprintk(2, "%s: %s, %d MHz, leader = 0x%04x, pulse = 0x%06x \n",
129 __func__, 129 __func__,
130 (ir->rc_type == RC_TYPE_NEC) ? "NEC" : "RC-5", 130 (ir->rc_type == RC_BIT_NEC) ? "NEC" : "RC-5",
131 ir_clock_mhz, leader, pulse); 131 ir_clock_mhz, leader, pulse);
132 132
133 /* Remote WAKEUP = enable, normal mode, from IR decoder output */ 133 /* Remote WAKEUP = enable, normal mode, from IR decoder output */
@@ -297,7 +297,7 @@ static void tm6000_ir_stop(struct rc_dev *rc)
297 cancel_delayed_work_sync(&ir->work); 297 cancel_delayed_work_sync(&ir->work);
298} 298}
299 299
300static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type) 300static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 *rc_type)
301{ 301{
302 struct tm6000_IR *ir = rc->priv; 302 struct tm6000_IR *ir = rc->priv;
303 303
@@ -306,10 +306,10 @@ static int tm6000_ir_change_protocol(struct rc_dev *rc, u64 rc_type)
306 306
307 dprintk(2, "%s\n",__func__); 307 dprintk(2, "%s\n",__func__);
308 308
309 if ((rc->rc_map.scan) && (rc_type == RC_TYPE_NEC)) 309 if ((rc->rc_map.scan) && (*rc_type == RC_BIT_NEC))
310 ir->key_addr = ((rc->rc_map.scan[0].scancode >> 8) & 0xffff); 310 ir->key_addr = ((rc->rc_map.scan[0].scancode >> 8) & 0xffff);
311 311
312 ir->rc_type = rc_type; 312 ir->rc_type = *rc_type;
313 313
314 tm6000_ir_config(ir); 314 tm6000_ir_config(ir);
315 /* TODO */ 315 /* TODO */
@@ -398,6 +398,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
398 struct tm6000_IR *ir; 398 struct tm6000_IR *ir;
399 struct rc_dev *rc; 399 struct rc_dev *rc;
400 int err = -ENOMEM; 400 int err = -ENOMEM;
401 u64 rc_type;
401 402
402 if (!enable_ir) 403 if (!enable_ir)
403 return -ENODEV; 404 return -ENODEV;
@@ -421,7 +422,7 @@ int tm6000_ir_init(struct tm6000_core *dev)
421 ir->rc = rc; 422 ir->rc = rc;
422 423
423 /* input setup */ 424 /* input setup */
424 rc->allowed_protos = RC_TYPE_RC5 | RC_TYPE_NEC; 425 rc->allowed_protos = RC_BIT_RC5 | RC_BIT_NEC;
425 /* Neded, in order to support NEC remotes with 24 or 32 bits */ 426 /* Neded, in order to support NEC remotes with 24 or 32 bits */
426 rc->scanmask = 0xffff; 427 rc->scanmask = 0xffff;
427 rc->priv = ir; 428 rc->priv = ir;
@@ -444,7 +445,8 @@ int tm6000_ir_init(struct tm6000_core *dev)
444 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys)); 445 usb_make_path(dev->udev, ir->phys, sizeof(ir->phys));
445 strlcat(ir->phys, "/input0", sizeof(ir->phys)); 446 strlcat(ir->phys, "/input0", sizeof(ir->phys));
446 447
447 tm6000_ir_change_protocol(rc, RC_TYPE_UNKNOWN); 448 rc_type = RC_BIT_UNKNOWN;
449 tm6000_ir_change_protocol(rc, &rc_type);
448 450
449 rc->input_name = ir->name; 451 rc->input_name = ir->name;
450 rc->input_phys = ir->phys; 452 rc->input_phys = ir->phys;
diff --git a/include/media/ir-kbd-i2c.h b/include/media/ir-kbd-i2c.h
index 768aa77925cd..e221bc74020b 100644
--- a/include/media/ir-kbd-i2c.h
+++ b/include/media/ir-kbd-i2c.h
@@ -37,7 +37,7 @@ enum ir_kbd_get_key_fn {
37struct IR_i2c_init_data { 37struct IR_i2c_init_data {
38 char *ir_codes; 38 char *ir_codes;
39 const char *name; 39 const char *name;
40 u64 type; /* RC_TYPE_RC5, etc */ 40 u64 type; /* RC_BIT_RC5, etc */
41 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */ 41 u32 polling_interval; /* 0 means DEFAULT_POLLING_INTERVAL */
42 42
43 /* 43 /*
diff --git a/include/media/rc-core.h b/include/media/rc-core.h
index b0c494a69079..f03445f3c767 100644
--- a/include/media/rc-core.h
+++ b/include/media/rc-core.h
@@ -50,7 +50,7 @@ enum rc_driver_type {
50 * @input_dev: the input child device used to communicate events to userspace 50 * @input_dev: the input child device used to communicate events to userspace
51 * @driver_type: specifies if protocol decoding is done in hardware or software 51 * @driver_type: specifies if protocol decoding is done in hardware or software
52 * @idle: used to keep track of RX state 52 * @idle: used to keep track of RX state
53 * @allowed_protos: bitmask with the supported RC_TYPE_* protocols 53 * @allowed_protos: bitmask with the supported RC_BIT_* protocols
54 * @scanmask: some hardware decoders are not capable of providing the full 54 * @scanmask: some hardware decoders are not capable of providing the full
55 * scancode to the application. As this is a hardware limit, we can't do 55 * scancode to the application. As this is a hardware limit, we can't do
56 * anything with it. Yet, as the same keycode table can be used with other 56 * anything with it. Yet, as the same keycode table can be used with other
@@ -113,7 +113,7 @@ struct rc_dev {
113 u32 max_timeout; 113 u32 max_timeout;
114 u32 rx_resolution; 114 u32 rx_resolution;
115 u32 tx_resolution; 115 u32 tx_resolution;
116 int (*change_protocol)(struct rc_dev *dev, u64 rc_type); 116 int (*change_protocol)(struct rc_dev *dev, u64 *rc_type);
117 int (*open)(struct rc_dev *dev); 117 int (*open)(struct rc_dev *dev);
118 void (*close)(struct rc_dev *dev); 118 void (*close)(struct rc_dev *dev);
119 int (*s_tx_mask)(struct rc_dev *dev, u32 mask); 119 int (*s_tx_mask)(struct rc_dev *dev, u32 mask);
diff --git a/include/media/rc-map.h b/include/media/rc-map.h
index cfd5163ff7f3..74f55a3f14eb 100644
--- a/include/media/rc-map.h
+++ b/include/media/rc-map.h
@@ -11,22 +11,54 @@
11 11
12#include <linux/input.h> 12#include <linux/input.h>
13 13
14#define RC_TYPE_UNKNOWN 0 14enum rc_type {
15#define RC_TYPE_RC5 (1 << 0) /* Philips RC5 protocol */ 15 RC_TYPE_UNKNOWN = 0, /* Protocol not known */
16#define RC_TYPE_NEC (1 << 1) 16 RC_TYPE_OTHER = 1, /* Protocol known but proprietary */
17#define RC_TYPE_RC6 (1 << 2) /* Philips RC6 protocol */ 17 RC_TYPE_LIRC = 2, /* Pass raw IR to lirc userspace */
18#define RC_TYPE_JVC (1 << 3) /* JVC protocol */ 18 RC_TYPE_RC5 = 3, /* Philips RC5 protocol */
19#define RC_TYPE_SONY (1 << 4) /* Sony12/15/20 protocol */ 19 RC_TYPE_RC5X = 4, /* Philips RC5x protocol */
20#define RC_TYPE_RC5_SZ (1 << 5) /* RC5 variant used by Streamzap */ 20 RC_TYPE_RC5_SZ = 5, /* StreamZap variant of RC5 */
21#define RC_TYPE_SANYO (1 << 6) /* Sanyo protocol */ 21 RC_TYPE_JVC = 6, /* JVC protocol */
22#define RC_TYPE_MCE_KBD (1 << 29) /* RC6-ish MCE keyboard/mouse */ 22 RC_TYPE_SONY12 = 7, /* Sony 12 bit protocol */
23#define RC_TYPE_LIRC (1 << 30) /* Pass raw IR to lirc userspace */ 23 RC_TYPE_SONY15 = 8, /* Sony 15 bit protocol */
24#define RC_TYPE_OTHER (1u << 31) 24 RC_TYPE_SONY20 = 9, /* Sony 20 bit protocol */
25 RC_TYPE_NEC = 10, /* NEC protocol */
26 RC_TYPE_SANYO = 11, /* Sanyo protocol */
27 RC_TYPE_MCE_KBD = 12, /* RC6-ish MCE keyboard/mouse */
28 RC_TYPE_RC6_0 = 13, /* Philips RC6-0-16 protocol */
29 RC_TYPE_RC6_6A_20 = 14, /* Philips RC6-6A-20 protocol */
30 RC_TYPE_RC6_6A_24 = 15, /* Philips RC6-6A-24 protocol */
31 RC_TYPE_RC6_6A_32 = 16, /* Philips RC6-6A-32 protocol */
32 RC_TYPE_RC6_MCE = 17, /* MCE (Philips RC6-6A-32 subtype) protocol */
33};
34
35#define RC_BIT_NONE 0
36#define RC_BIT_UNKNOWN (1 << RC_TYPE_UNKNOWN)
37#define RC_BIT_OTHER (1 << RC_TYPE_OTHER)
38#define RC_BIT_LIRC (1 << RC_TYPE_LIRC)
39#define RC_BIT_RC5 (1 << RC_TYPE_RC5)
40#define RC_BIT_RC5X (1 << RC_TYPE_RC5X)
41#define RC_BIT_RC5_SZ (1 << RC_TYPE_RC5_SZ)
42#define RC_BIT_JVC (1 << RC_TYPE_JVC)
43#define RC_BIT_SONY12 (1 << RC_TYPE_SONY12)
44#define RC_BIT_SONY15 (1 << RC_TYPE_SONY15)
45#define RC_BIT_SONY20 (1 << RC_TYPE_SONY20)
46#define RC_BIT_NEC (1 << RC_TYPE_NEC)
47#define RC_BIT_SANYO (1 << RC_TYPE_SANYO)
48#define RC_BIT_MCE_KBD (1 << RC_TYPE_MCE_KBD)
49#define RC_BIT_RC6_0 (1 << RC_TYPE_RC6_0)
50#define RC_BIT_RC6_6A_20 (1 << RC_TYPE_RC6_6A_20)
51#define RC_BIT_RC6_6A_24 (1 << RC_TYPE_RC6_6A_24)
52#define RC_BIT_RC6_6A_32 (1 << RC_TYPE_RC6_6A_32)
53#define RC_BIT_RC6_MCE (1 << RC_TYPE_RC6_MCE)
25 54
26#define RC_TYPE_ALL (RC_TYPE_RC5 | RC_TYPE_NEC | RC_TYPE_RC6 | \ 55#define RC_BIT_ALL (RC_BIT_UNKNOWN | RC_BIT_OTHER | RC_BIT_LIRC | \
27 RC_TYPE_JVC | RC_TYPE_SONY | RC_TYPE_LIRC | \ 56 RC_BIT_RC5 | RC_BIT_RC5X | RC_BIT_RC5_SZ | \
28 RC_TYPE_RC5_SZ | RC_TYPE_SANYO | RC_TYPE_MCE_KBD | \ 57 RC_BIT_JVC | \
29 RC_TYPE_OTHER) 58 RC_BIT_SONY12 | RC_BIT_SONY15 | RC_BIT_SONY20 | \
59 RC_BIT_NEC | RC_BIT_SANYO | RC_BIT_MCE_KBD | \
60 RC_BIT_RC6_0 | RC_BIT_RC6_6A_20 | RC_BIT_RC6_6A_24 | \
61 RC_BIT_RC6_6A_32 | RC_BIT_RC6_MCE)
30 62
31struct rc_map_table { 63struct rc_map_table {
32 u32 scancode; 64 u32 scancode;
@@ -38,7 +70,7 @@ struct rc_map {
38 unsigned int size; /* Max number of entries */ 70 unsigned int size; /* Max number of entries */
39 unsigned int len; /* Used number of entries */ 71 unsigned int len; /* Used number of entries */
40 unsigned int alloc; /* Size of *scan in bytes */ 72 unsigned int alloc; /* Size of *scan in bytes */
41 u64 rc_type; 73 enum rc_type rc_type;
42 const char *name; 74 const char *name;
43 spinlock_t lock; 75 spinlock_t lock;
44}; 76};