aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/pci
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 /drivers/media/pci
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>
Diffstat (limited to 'drivers/media/pci')
-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
5 files changed, 13 insertions, 13 deletions
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: