aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/IR/mceusb.c
diff options
context:
space:
mode:
authorJarod Wilson <jarod@redhat.com>2010-10-22 13:42:54 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-22 18:05:38 -0400
commit4a8839187a613cbc34cf21f4f58ae5d5176ec26d (patch)
tree4b04f26600eb8c041b227d3bcbba245675afd82c /drivers/media/IR/mceusb.c
parent3459d4553b95084a6390e9b62687488538f33c57 (diff)
[media] mceusb: add symbolic names for commands
And replace usage of hex values w/symbolic names wherever possible Signed-off-by: Jarod Wilson <jarod@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/IR/mceusb.c')
-rw-r--r--drivers/media/IR/mceusb.c193
1 files changed, 117 insertions, 76 deletions
diff --git a/drivers/media/IR/mceusb.c b/drivers/media/IR/mceusb.c
index 6c3918867257..0a2981ac7429 100644
--- a/drivers/media/IR/mceusb.c
+++ b/drivers/media/IR/mceusb.c
@@ -46,26 +46,58 @@
46 "device driver" 46 "device driver"
47#define DRIVER_NAME "mceusb" 47#define DRIVER_NAME "mceusb"
48 48
49#define USB_BUFLEN 32 /* USB reception buffer length */ 49#define USB_BUFLEN 32 /* USB reception buffer length */
50#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */ 50#define USB_CTRL_MSG_SZ 2 /* Size of usb ctrl msg on gen1 hw */
51#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */ 51#define MCE_G1_INIT_MSGS 40 /* Init messages on gen1 hw to throw out */
52 52
53/* MCE constants */ 53/* MCE constants */
54#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */ 54#define MCE_CMDBUF_SIZE 384 /* MCE Command buffer length */
55#define MCE_TIME_UNIT 50 /* Approx 50us resolution */ 55#define MCE_TIME_UNIT 50 /* Approx 50us resolution */
56#define MCE_CODE_LENGTH 5 /* Normal length of packet (with header) */ 56#define MCE_CODE_LENGTH 5 /* Normal length of packet (with header) */
57#define MCE_PACKET_SIZE 4 /* Normal length of packet (without header) */ 57#define MCE_PACKET_SIZE 4 /* Normal length of packet (without header) */
58#define MCE_PACKET_HEADER 0x84 /* Actual header format is 0x80 + num_bytes */ 58#define MCE_IRDATA_HEADER 0x84 /* Actual header format is 0x80 + num_bytes */
59#define MCE_CONTROL_HEADER 0x9f /* MCE status header */ 59#define MCE_IRDATA_TRAILER 0x80 /* End of IR data */
60#define MCE_TX_HEADER_LENGTH 3 /* # of bytes in the initializing tx header */ 60#define MCE_TX_HEADER_LENGTH 3 /* # of bytes in the initializing tx header */
61#define MCE_MAX_CHANNELS 2 /* Two transmitters, hardware dependent? */ 61#define MCE_MAX_CHANNELS 2 /* Two transmitters, hardware dependent? */
62#define MCE_DEFAULT_TX_MASK 0x03 /* Val opts: TX1=0x01, TX2=0x02, ALL=0x03 */ 62#define MCE_DEFAULT_TX_MASK 0x03 /* Vals: TX1=0x01, TX2=0x02, ALL=0x03 */
63#define MCE_PULSE_BIT 0x80 /* Pulse bit, MSB set == PULSE else SPACE */ 63#define MCE_PULSE_BIT 0x80 /* Pulse bit, MSB set == PULSE else SPACE */
64#define MCE_PULSE_MASK 0x7f /* Pulse mask */ 64#define MCE_PULSE_MASK 0x7f /* Pulse mask */
65#define MCE_MAX_PULSE_LENGTH 0x7f /* Longest transmittable pulse symbol */ 65#define MCE_MAX_PULSE_LENGTH 0x7f /* Longest transmittable pulse symbol */
66#define MCE_COMMAND_MASK 0xe0 /* Mask out command bits */ 66
67#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */ 67#define MCE_HW_CMD_HEADER 0xff /* MCE hardware command header */
68#define MCE_COMMAND_IRDATA 0x80 /* buf & MCE_COMMAND_MASK == 0x80 -> IR data */ 68#define MCE_COMMAND_HEADER 0x9f /* MCE command header */
69#define MCE_COMMAND_MASK 0xe0 /* Mask out command bits */
70#define MCE_COMMAND_NULL 0x00 /* These show up various places... */
71/* if buf[i] & MCE_COMMAND_MASK == 0x80 and buf[i] != MCE_COMMAND_HEADER,
72 * then we're looking at a raw IR data sample */
73#define MCE_COMMAND_IRDATA 0x80
74#define MCE_PACKET_LENGTH_MASK 0x1f /* Packet length mask */
75
76/* Sub-commands, which follow MCE_COMMAND_HEADER or MCE_HW_CMD_HEADER */
77#define MCE_CMD_PING 0x03 /* Ping device */
78#define MCE_CMD_UNKNOWN 0x04 /* Unknown */
79#define MCE_CMD_UNKNOWN2 0x05 /* Unknown */
80#define MCE_CMD_S_CARRIER 0x06 /* Set TX carrier frequency */
81#define MCE_CMD_G_CARRIER 0x07 /* Get TX carrier frequency */
82#define MCE_CMD_S_TXMASK 0x08 /* Set TX port bitmask */
83#define MCE_CMD_UNKNOWN3 0x09 /* Unknown */
84#define MCE_CMD_UNKNOWN4 0x0a /* Unknown */
85#define MCE_CMD_G_REVISION 0x0b /* Get hw/sw revision */
86#define MCE_CMD_S_TIMEOUT 0x0c /* Set RX timeout value */
87#define MCE_CMD_G_TIMEOUT 0x0d /* Get RX timeout value */
88#define MCE_CMD_UNKNOWN5 0x0e /* Unknown */
89#define MCE_CMD_UNKNOWN6 0x0f /* Unknown */
90#define MCE_CMD_G_RXPORTSTS 0x11 /* Get RX port status */
91#define MCE_CMD_G_TXMASK 0x13 /* Set TX port bitmask */
92#define MCE_CMD_S_RXSENSOR 0x14 /* Set RX sensor (std/learning) */
93#define MCE_CMD_G_RXSENSOR 0x15 /* Get RX sensor (std/learning) */
94#define MCE_CMD_TX_PORTS 0x16 /* Get number of TX ports */
95#define MCE_CMD_G_WAKESRC 0x17 /* Get wake source */
96#define MCE_CMD_UNKNOWN7 0x18 /* Unknown */
97#define MCE_CMD_UNKNOWN8 0x19 /* Unknown */
98#define MCE_CMD_UNKNOWN9 0x1b /* Unknown */
99#define MCE_CMD_DEVICE_RESET 0xaa /* Reset the hardware */
100#define MCE_RSP_CMD_INVALID 0xfe /* Invalid command issued */
69 101
70 102
71/* module parameters */ 103/* module parameters */
@@ -336,20 +368,24 @@ struct mceusb_dev {
336 * - SET_RX_TIMEOUT sets the receiver timeout 368 * - SET_RX_TIMEOUT sets the receiver timeout
337 * - SET_RX_SENSOR sets which receiver sensor to use 369 * - SET_RX_SENSOR sets which receiver sensor to use
338 */ 370 */
339static char DEVICE_RESET[] = {0x00, 0xff, 0xaa}; 371static char DEVICE_RESET[] = {MCE_COMMAND_NULL, MCE_HW_CMD_HEADER,
340static char GET_REVISION[] = {0xff, 0x0b}; 372 MCE_CMD_DEVICE_RESET};
341static char GET_UNKNOWN[] = {0xff, 0x18}; 373static char GET_REVISION[] = {MCE_HW_CMD_HEADER, MCE_CMD_G_REVISION};
342static char GET_UNKNOWN2[] = {MCE_CONTROL_HEADER, 0x05}; 374static char GET_UNKNOWN[] = {MCE_HW_CMD_HEADER, MCE_CMD_UNKNOWN7};
343static char GET_CARRIER_FREQ[] = {MCE_CONTROL_HEADER, 0x07}; 375static char GET_UNKNOWN2[] = {MCE_COMMAND_HEADER, MCE_CMD_UNKNOWN2};
344static char GET_RX_TIMEOUT[] = {MCE_CONTROL_HEADER, 0x0d}; 376static char GET_CARRIER_FREQ[] = {MCE_COMMAND_HEADER, MCE_CMD_G_CARRIER};
345static char GET_TX_BITMASK[] = {MCE_CONTROL_HEADER, 0x13}; 377static char GET_RX_TIMEOUT[] = {MCE_COMMAND_HEADER, MCE_CMD_G_TIMEOUT};
346static char GET_RX_SENSOR[] = {MCE_CONTROL_HEADER, 0x15}; 378static char GET_TX_BITMASK[] = {MCE_COMMAND_HEADER, MCE_CMD_G_TXMASK};
379static char GET_RX_SENSOR[] = {MCE_COMMAND_HEADER, MCE_CMD_G_RXSENSOR};
347/* sub in desired values in lower byte or bytes for full command */ 380/* sub in desired values in lower byte or bytes for full command */
348/* FIXME: make use of these for transmit. 381/* FIXME: make use of these for transmit.
349static char SET_CARRIER_FREQ[] = {MCE_CONTROL_HEADER, 0x06, 0x00, 0x00}; 382static char SET_CARRIER_FREQ[] = {MCE_COMMAND_HEADER,
350static char SET_TX_BITMASK[] = {MCE_CONTROL_HEADER, 0x08, 0x00}; 383 MCE_CMD_S_CARRIER, 0x00, 0x00};
351static char SET_RX_TIMEOUT[] = {MCE_CONTROL_HEADER, 0x0c, 0x00, 0x00}; 384static char SET_TX_BITMASK[] = {MCE_COMMAND_HEADER, MCE_CMD_S_TXMASK, 0x00};
352static char SET_RX_SENSOR[] = {MCE_CONTROL_HEADER, 0x14, 0x00}; 385static char SET_RX_TIMEOUT[] = {MCE_COMMAND_HEADER,
386 MCE_CMD_S_TIMEOUT, 0x00, 0x00};
387static char SET_RX_SENSOR[] = {MCE_COMMAND_HEADER,
388 MCE_CMD_S_RXSENSOR, 0x00};
353*/ 389*/
354 390
355static int mceusb_cmdsize(u8 cmd, u8 subcmd) 391static int mceusb_cmdsize(u8 cmd, u8 subcmd)
@@ -357,26 +393,26 @@ static int mceusb_cmdsize(u8 cmd, u8 subcmd)
357 int datasize = 0; 393 int datasize = 0;
358 394
359 switch (cmd) { 395 switch (cmd) {
360 case 0x00: 396 case MCE_COMMAND_NULL:
361 if (subcmd == 0xff) 397 if (subcmd == MCE_HW_CMD_HEADER)
362 datasize = 1; 398 datasize = 1;
363 break; 399 break;
364 case 0xff: 400 case MCE_HW_CMD_HEADER:
365 switch (subcmd) { 401 switch (subcmd) {
366 case 0x0b: 402 case MCE_CMD_G_REVISION:
367 datasize = 2; 403 datasize = 2;
368 break; 404 break;
369 } 405 }
370 case MCE_CONTROL_HEADER: 406 case MCE_COMMAND_HEADER:
371 switch (subcmd) { 407 switch (subcmd) {
372 case 0x04: 408 case MCE_CMD_UNKNOWN:
373 case 0x06: 409 case MCE_CMD_S_CARRIER:
374 case 0x0c: 410 case MCE_CMD_S_TIMEOUT:
375 case 0x15: 411 case MCE_CMD_G_RXSENSOR:
376 datasize = 2; 412 datasize = 2;
377 break; 413 break;
378 case 0x08: 414 case MCE_CMD_S_TXMASK:
379 case 0x14: 415 case MCE_CMD_S_RXSENSOR:
380 datasize = 1; 416 datasize = 1;
381 break; 417 break;
382 } 418 }
@@ -402,7 +438,7 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
402 return; 438 return;
403 439
404 for (i = 0; i < len && i < USB_BUFLEN; i++) 440 for (i = 0; i < len && i < USB_BUFLEN; i++)
405 snprintf(codes + i * 3, 4, "%02x ", buf[i] & 0xFF); 441 snprintf(codes + i * 3, 4, "%02x ", buf[i] & 0xff);
406 442
407 dev_info(dev, "%sx data: %s (length=%d)\n", 443 dev_info(dev, "%sx data: %s (length=%d)\n",
408 (out ? "t" : "r"), codes, len); 444 (out ? "t" : "r"), codes, len);
@@ -418,16 +454,17 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
418 data2 = buf[idx + 3] & 0xff; 454 data2 = buf[idx + 3] & 0xff;
419 455
420 switch (cmd) { 456 switch (cmd) {
421 case 0x00: 457 case MCE_COMMAND_NULL:
422 if (subcmd == 0xff && data1 == 0xaa) 458 if ((subcmd == MCE_HW_CMD_HEADER) &&
459 (data1 == MCE_CMD_DEVICE_RESET))
423 dev_info(dev, "Device reset requested\n"); 460 dev_info(dev, "Device reset requested\n");
424 else 461 else
425 dev_info(dev, "Unknown command 0x%02x 0x%02x\n", 462 dev_info(dev, "Unknown command 0x%02x 0x%02x\n",
426 cmd, subcmd); 463 cmd, subcmd);
427 break; 464 break;
428 case 0xff: 465 case MCE_HW_CMD_HEADER:
429 switch (subcmd) { 466 switch (subcmd) {
430 case 0x0b: 467 case MCE_CMD_G_REVISION:
431 if (len == 2) 468 if (len == 2)
432 dev_info(dev, "Get hw/sw rev?\n"); 469 dev_info(dev, "Get hw/sw rev?\n");
433 else 470 else
@@ -435,68 +472,68 @@ static void mceusb_dev_printdata(struct mceusb_dev *ir, char *buf,
435 "0x%02x 0x%02x\n", data1, data2, 472 "0x%02x 0x%02x\n", data1, data2,
436 buf[idx + 4], buf[idx + 5]); 473 buf[idx + 4], buf[idx + 5]);
437 break; 474 break;
438 case 0xaa: 475 case MCE_CMD_DEVICE_RESET:
439 dev_info(dev, "Device reset requested\n"); 476 dev_info(dev, "Device reset requested\n");
440 break; 477 break;
441 case 0xfe: 478 case MCE_RSP_CMD_INVALID:
442 dev_info(dev, "Previous command not supported\n"); 479 dev_info(dev, "Previous command not supported\n");
443 break; 480 break;
444 case 0x18: 481 case MCE_CMD_UNKNOWN7:
445 case 0x1b: 482 case MCE_CMD_UNKNOWN9:
446 default: 483 default:
447 dev_info(dev, "Unknown command 0x%02x 0x%02x\n", 484 dev_info(dev, "Unknown command 0x%02x 0x%02x\n",
448 cmd, subcmd); 485 cmd, subcmd);
449 break; 486 break;
450 } 487 }
451 break; 488 break;
452 case MCE_CONTROL_HEADER: 489 case MCE_COMMAND_HEADER:
453 switch (subcmd) { 490 switch (subcmd) {
454 case 0x03: 491 case MCE_CMD_PING:
455 dev_info(dev, "Ping\n"); 492 dev_info(dev, "Ping\n");
456 break; 493 break;
457 case 0x04: 494 case MCE_CMD_UNKNOWN:
458 dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n", 495 dev_info(dev, "Resp to 9f 05 of 0x%02x 0x%02x\n",
459 data1, data2); 496 data1, data2);
460 break; 497 break;
461 case 0x06: 498 case MCE_CMD_S_CARRIER:
462 dev_info(dev, "%s carrier mode and freq of " 499 dev_info(dev, "%s carrier mode and freq of "
463 "0x%02x 0x%02x\n", inout, data1, data2); 500 "0x%02x 0x%02x\n", inout, data1, data2);
464 break; 501 break;
465 case 0x07: 502 case MCE_CMD_G_CARRIER:
466 dev_info(dev, "Get carrier mode and freq\n"); 503 dev_info(dev, "Get carrier mode and freq\n");
467 break; 504 break;
468 case 0x08: 505 case MCE_CMD_S_TXMASK:
469 dev_info(dev, "%s transmit blaster mask of 0x%02x\n", 506 dev_info(dev, "%s transmit blaster mask of 0x%02x\n",
470 inout, data1); 507 inout, data1);
471 break; 508 break;
472 case 0x0c: 509 case MCE_CMD_S_TIMEOUT:
473 /* value is in units of 50us, so x*50/100 or x/2 ms */ 510 /* value is in units of 50us, so x*50/100 or x/2 ms */
474 dev_info(dev, "%s receive timeout of %d ms\n", 511 dev_info(dev, "%s receive timeout of %d ms\n",
475 inout, ((data1 << 8) | data2) / 2); 512 inout, ((data1 << 8) | data2) / 2);
476 break; 513 break;
477 case 0x0d: 514 case MCE_CMD_G_TIMEOUT:
478 dev_info(dev, "Get receive timeout\n"); 515 dev_info(dev, "Get receive timeout\n");
479 break; 516 break;
480 case 0x13: 517 case MCE_CMD_G_TXMASK:
481 dev_info(dev, "Get transmit blaster mask\n"); 518 dev_info(dev, "Get transmit blaster mask\n");
482 break; 519 break;
483 case 0x14: 520 case MCE_CMD_S_RXSENSOR:
484 dev_info(dev, "%s %s-range receive sensor in use\n", 521 dev_info(dev, "%s %s-range receive sensor in use\n",
485 inout, data1 == 0x02 ? "short" : "long"); 522 inout, data1 == 0x02 ? "short" : "long");
486 break; 523 break;
487 case 0x15: 524 case MCE_CMD_G_RXSENSOR:
488 if (len == 2) 525 if (len == 2)
489 dev_info(dev, "Get receive sensor\n"); 526 dev_info(dev, "Get receive sensor\n");
490 else 527 else
491 dev_info(dev, "Received pulse count is %d\n", 528 dev_info(dev, "Received pulse count is %d\n",
492 ((data1 << 8) | data2)); 529 ((data1 << 8) | data2));
493 break; 530 break;
494 case 0xfe: 531 case MCE_RSP_CMD_INVALID:
495 dev_info(dev, "Error! Hardware is likely wedged...\n"); 532 dev_info(dev, "Error! Hardware is likely wedged...\n");
496 break; 533 break;
497 case 0x05: 534 case MCE_CMD_UNKNOWN2:
498 case 0x09: 535 case MCE_CMD_UNKNOWN3:
499 case 0x0f: 536 case MCE_CMD_UNKNOWN5:
500 default: 537 default:
501 dev_info(dev, "Unknown command 0x%02x 0x%02x\n", 538 dev_info(dev, "Unknown command 0x%02x 0x%02x\n",
502 cmd, subcmd); 539 cmd, subcmd);
@@ -613,8 +650,8 @@ static int mceusb_tx_ir(void *priv, int *txbuf, u32 n)
613 return -ENOMEM; 650 return -ENOMEM;
614 651
615 /* MCE tx init header */ 652 /* MCE tx init header */
616 cmdbuf[cmdcount++] = MCE_CONTROL_HEADER; 653 cmdbuf[cmdcount++] = MCE_COMMAND_HEADER;
617 cmdbuf[cmdcount++] = 0x08; 654 cmdbuf[cmdcount++] = MCE_CMD_S_TXMASK;
618 cmdbuf[cmdcount++] = ir->tx_mask; 655 cmdbuf[cmdcount++] = ir->tx_mask;
619 656
620 /* Generate mce packet data */ 657 /* Generate mce packet data */
@@ -628,7 +665,7 @@ static int mceusb_tx_ir(void *priv, int *txbuf, u32 n)
628 if ((cmdcount < MCE_CMDBUF_SIZE) && 665 if ((cmdcount < MCE_CMDBUF_SIZE) &&
629 (cmdcount - MCE_TX_HEADER_LENGTH) % 666 (cmdcount - MCE_TX_HEADER_LENGTH) %
630 MCE_CODE_LENGTH == 0) 667 MCE_CODE_LENGTH == 0)
631 cmdbuf[cmdcount++] = MCE_PACKET_HEADER; 668 cmdbuf[cmdcount++] = MCE_IRDATA_HEADER;
632 669
633 /* Insert mce packet data */ 670 /* Insert mce packet data */
634 if (cmdcount < MCE_CMDBUF_SIZE) 671 if (cmdcount < MCE_CMDBUF_SIZE)
@@ -647,7 +684,8 @@ static int mceusb_tx_ir(void *priv, int *txbuf, u32 n)
647 684
648 /* Fix packet length in last header */ 685 /* Fix packet length in last header */
649 cmdbuf[cmdcount - (cmdcount - MCE_TX_HEADER_LENGTH) % MCE_CODE_LENGTH] = 686 cmdbuf[cmdcount - (cmdcount - MCE_TX_HEADER_LENGTH) % MCE_CODE_LENGTH] =
650 0x80 + (cmdcount - MCE_TX_HEADER_LENGTH) % MCE_CODE_LENGTH - 1; 687 MCE_COMMAND_IRDATA + (cmdcount - MCE_TX_HEADER_LENGTH) %
688 MCE_CODE_LENGTH - 1;
651 689
652 /* Check if we have room for the empty packet at the end */ 690 /* Check if we have room for the empty packet at the end */
653 if (cmdcount >= MCE_CMDBUF_SIZE) { 691 if (cmdcount >= MCE_CMDBUF_SIZE) {
@@ -656,7 +694,7 @@ static int mceusb_tx_ir(void *priv, int *txbuf, u32 n)
656 } 694 }
657 695
658 /* All mce commands end with an empty packet (0x80) */ 696 /* All mce commands end with an empty packet (0x80) */
659 cmdbuf[cmdcount++] = 0x80; 697 cmdbuf[cmdcount++] = MCE_IRDATA_TRAILER;
660 698
661 /* Transmit the command to the mce device */ 699 /* Transmit the command to the mce device */
662 mce_async_out(ir, cmdbuf, cmdcount); 700 mce_async_out(ir, cmdbuf, cmdcount);
@@ -685,7 +723,8 @@ static int mceusb_set_tx_mask(void *priv, u32 mask)
685 struct mceusb_dev *ir = priv; 723 struct mceusb_dev *ir = priv;
686 724
687 if (ir->flags.tx_mask_inverted) 725 if (ir->flags.tx_mask_inverted)
688 ir->tx_mask = (mask != 0x03 ? mask ^ 0x03 : mask) << 1; 726 ir->tx_mask = (mask != MCE_DEFAULT_TX_MASK ?
727 mask ^ MCE_DEFAULT_TX_MASK : mask) << 1;
689 else 728 else
690 ir->tx_mask = mask; 729 ir->tx_mask = mask;
691 730
@@ -698,7 +737,8 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)
698 struct mceusb_dev *ir = priv; 737 struct mceusb_dev *ir = priv;
699 int clk = 10000000; 738 int clk = 10000000;
700 int prescaler = 0, divisor = 0; 739 int prescaler = 0, divisor = 0;
701 unsigned char cmdbuf[4] = { MCE_CONTROL_HEADER, 0x06, 0x00, 0x00 }; 740 unsigned char cmdbuf[4] = { MCE_COMMAND_HEADER,
741 MCE_CMD_S_CARRIER, 0x00, 0x00 };
702 742
703 /* Carrier has changed */ 743 /* Carrier has changed */
704 if (ir->carrier != carrier) { 744 if (ir->carrier != carrier) {
@@ -706,7 +746,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)
706 if (carrier == 0) { 746 if (carrier == 0) {
707 ir->carrier = carrier; 747 ir->carrier = carrier;
708 cmdbuf[2] = 0x01; 748 cmdbuf[2] = 0x01;
709 cmdbuf[3] = 0x80; 749 cmdbuf[3] = MCE_IRDATA_TRAILER;
710 dev_dbg(ir->dev, "%s: disabling carrier " 750 dev_dbg(ir->dev, "%s: disabling carrier "
711 "modulation\n", __func__); 751 "modulation\n", __func__);
712 mce_async_out(ir, cmdbuf, sizeof(cmdbuf)); 752 mce_async_out(ir, cmdbuf, sizeof(cmdbuf));
@@ -715,7 +755,7 @@ static int mceusb_set_tx_carrier(void *priv, u32 carrier)
715 755
716 for (prescaler = 0; prescaler < 4; ++prescaler) { 756 for (prescaler = 0; prescaler < 4; ++prescaler) {
717 divisor = (clk >> (2 * prescaler)) / carrier; 757 divisor = (clk >> (2 * prescaler)) / carrier;
718 if (divisor <= 0xFF) { 758 if (divisor <= 0xff) {
719 ir->carrier = carrier; 759 ir->carrier = carrier;
720 cmdbuf[2] = prescaler; 760 cmdbuf[2] = prescaler;
721 cmdbuf[3] = divisor; 761 cmdbuf[3] = divisor;
@@ -783,8 +823,9 @@ static void mceusb_process_ir_data(struct mceusb_dev *ir, int buf_len)
783 /* decode mce packets of the form (84),AA,BB,CC,DD */ 823 /* decode mce packets of the form (84),AA,BB,CC,DD */
784 /* IR data packets can span USB messages - rem */ 824 /* IR data packets can span USB messages - rem */
785 ir->cmd = ir->buf_in[i]; 825 ir->cmd = ir->buf_in[i];
786 if ((ir->cmd == MCE_CONTROL_HEADER) || 826 if ((ir->cmd == MCE_COMMAND_HEADER) ||
787 ((ir->cmd & MCE_COMMAND_MASK) != MCE_COMMAND_IRDATA)) { 827 ((ir->cmd & MCE_COMMAND_MASK) !=
828 MCE_COMMAND_IRDATA)) {
788 ir->parser_state = SUBCMD; 829 ir->parser_state = SUBCMD;
789 continue; 830 continue;
790 } 831 }