aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/common/tuners/xc4000.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-06-06 15:51:11 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-07-27 16:52:40 -0400
commit941830c9278a72e31389eb04cdfc397f66866de0 (patch)
tree13f9c4657a0b2c8296e0da0d9a1ec6f9e949af7e /drivers/media/common/tuners/xc4000.c
parent8edeb6eb1ae113b8f25a79e5076c1a1ec93538d0 (diff)
[media] xc4000: make checkpatch.pl happy
Solve the ./scripts/checkpatch.pl compliants for the patches that added xc4000 support, including a few changes at dib0700. While here, remove a few printk noise by converting some msgs into debug ones. Cc: Istvan Varga <istvan_v@mailbox.hu> Cc: Patrick Boettcher <pboettcher@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common/tuners/xc4000.c')
-rw-r--r--drivers/media/common/tuners/xc4000.c139
1 files changed, 69 insertions, 70 deletions
diff --git a/drivers/media/common/tuners/xc4000.c b/drivers/media/common/tuners/xc4000.c
index 479c198e9469..634f4d9b6c63 100644
--- a/drivers/media/common/tuners/xc4000.c
+++ b/drivers/media/common/tuners/xc4000.c
@@ -244,8 +244,8 @@ static struct XC_TV_STANDARD xc4000_standard[MAX_TV_STANDARD] = {
244 {"DTV8", 0x00C0, 0x800B, 0}, 244 {"DTV8", 0x00C0, 0x800B, 0},
245 {"DTV7/8", 0x00C0, 0x801B, 0}, 245 {"DTV7/8", 0x00C0, 0x801B, 0},
246 {"DTV7", 0x00C0, 0x8007, 0}, 246 {"DTV7", 0x00C0, 0x8007, 0},
247 {"FM Radio-INPUT2", 0x0008, 0x9800,10700}, 247 {"FM Radio-INPUT2", 0x0008, 0x9800, 10700},
248 {"FM Radio-INPUT1", 0x0008, 0x9000,10700} 248 {"FM Radio-INPUT1", 0x0008, 0x9000, 10700}
249}; 249};
250 250
251static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val); 251static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val);
@@ -261,7 +261,7 @@ static int xc_send_i2c_data(struct xc4000_priv *priv, u8 *buf, int len)
261 printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n", 261 printk(KERN_ERR "xc4000: I2C write failed (len=%i)\n",
262 len); 262 len);
263 if (len == 4) { 263 if (len == 4) {
264 printk("bytes %02x %02x %02x %02x\n", buf[0], 264 printk(KERN_ERR "bytes %02x %02x %02x %02x\n", buf[0],
265 buf[1], buf[2], buf[3]); 265 buf[1], buf[2], buf[3]);
266 } 266 }
267 return -EREMOTEIO; 267 return -EREMOTEIO;
@@ -546,7 +546,7 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val)
546 }; 546 };
547 547
548 if (i2c_transfer(priv->i2c_props.adap, msg, 2) != 2) { 548 if (i2c_transfer(priv->i2c_props.adap, msg, 2) != 2) {
549 printk(KERN_WARNING "xc4000: I2C read failed\n"); 549 printk(KERN_ERR "xc4000: I2C read failed\n");
550 return -EREMOTEIO; 550 return -EREMOTEIO;
551 } 551 }
552 552
@@ -558,67 +558,67 @@ static int xc4000_readreg(struct xc4000_priv *priv, u16 reg, u16 *val)
558static void dump_firm_type_and_int_freq(unsigned int type, u16 int_freq) 558static void dump_firm_type_and_int_freq(unsigned int type, u16 int_freq)
559{ 559{
560 if (type & BASE) 560 if (type & BASE)
561 printk("BASE "); 561 printk(KERN_CONT "BASE ");
562 if (type & INIT1) 562 if (type & INIT1)
563 printk("INIT1 "); 563 printk(KERN_CONT "INIT1 ");
564 if (type & F8MHZ) 564 if (type & F8MHZ)
565 printk("F8MHZ "); 565 printk(KERN_CONT "F8MHZ ");
566 if (type & MTS) 566 if (type & MTS)
567 printk("MTS "); 567 printk(KERN_CONT "MTS ");
568 if (type & D2620) 568 if (type & D2620)
569 printk("D2620 "); 569 printk(KERN_CONT "D2620 ");
570 if (type & D2633) 570 if (type & D2633)
571 printk("D2633 "); 571 printk(KERN_CONT "D2633 ");
572 if (type & DTV6) 572 if (type & DTV6)
573 printk("DTV6 "); 573 printk(KERN_CONT "DTV6 ");
574 if (type & QAM) 574 if (type & QAM)
575 printk("QAM "); 575 printk(KERN_CONT "QAM ");
576 if (type & DTV7) 576 if (type & DTV7)
577 printk("DTV7 "); 577 printk(KERN_CONT "DTV7 ");
578 if (type & DTV78) 578 if (type & DTV78)
579 printk("DTV78 "); 579 printk(KERN_CONT "DTV78 ");
580 if (type & DTV8) 580 if (type & DTV8)
581 printk("DTV8 "); 581 printk(KERN_CONT "DTV8 ");
582 if (type & FM) 582 if (type & FM)
583 printk("FM "); 583 printk(KERN_CONT "FM ");
584 if (type & INPUT1) 584 if (type & INPUT1)
585 printk("INPUT1 "); 585 printk(KERN_CONT "INPUT1 ");
586 if (type & LCD) 586 if (type & LCD)
587 printk("LCD "); 587 printk(KERN_CONT "LCD ");
588 if (type & NOGD) 588 if (type & NOGD)
589 printk("NOGD "); 589 printk(KERN_CONT "NOGD ");
590 if (type & MONO) 590 if (type & MONO)
591 printk("MONO "); 591 printk(KERN_CONT "MONO ");
592 if (type & ATSC) 592 if (type & ATSC)
593 printk("ATSC "); 593 printk(KERN_CONT "ATSC ");
594 if (type & IF) 594 if (type & IF)
595 printk("IF "); 595 printk(KERN_CONT "IF ");
596 if (type & LG60) 596 if (type & LG60)
597 printk("LG60 "); 597 printk(KERN_CONT "LG60 ");
598 if (type & ATI638) 598 if (type & ATI638)
599 printk("ATI638 "); 599 printk(KERN_CONT "ATI638 ");
600 if (type & OREN538) 600 if (type & OREN538)
601 printk("OREN538 "); 601 printk(KERN_CONT "OREN538 ");
602 if (type & OREN36) 602 if (type & OREN36)
603 printk("OREN36 "); 603 printk(KERN_CONT "OREN36 ");
604 if (type & TOYOTA388) 604 if (type & TOYOTA388)
605 printk("TOYOTA388 "); 605 printk(KERN_CONT "TOYOTA388 ");
606 if (type & TOYOTA794) 606 if (type & TOYOTA794)
607 printk("TOYOTA794 "); 607 printk(KERN_CONT "TOYOTA794 ");
608 if (type & DIBCOM52) 608 if (type & DIBCOM52)
609 printk("DIBCOM52 "); 609 printk(KERN_CONT "DIBCOM52 ");
610 if (type & ZARLINK456) 610 if (type & ZARLINK456)
611 printk("ZARLINK456 "); 611 printk(KERN_CONT "ZARLINK456 ");
612 if (type & CHINA) 612 if (type & CHINA)
613 printk("CHINA "); 613 printk(KERN_CONT "CHINA ");
614 if (type & F6MHZ) 614 if (type & F6MHZ)
615 printk("F6MHZ "); 615 printk(KERN_CONT "F6MHZ ");
616 if (type & INPUT2) 616 if (type & INPUT2)
617 printk("INPUT2 "); 617 printk(KERN_CONT "INPUT2 ");
618 if (type & SCODE) 618 if (type & SCODE)
619 printk("SCODE "); 619 printk(KERN_CONT "SCODE ");
620 if (type & HAS_IF) 620 if (type & HAS_IF)
621 printk("HAS_IF_%d ", int_freq); 621 printk(KERN_CONT "HAS_IF_%d ", int_freq);
622} 622}
623 623
624static int seek_firmware(struct dvb_frontend *fe, unsigned int type, 624static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
@@ -666,7 +666,8 @@ static int seek_firmware(struct dvb_frontend *fe, unsigned int type,
666 } 666 }
667 667
668 if (best_nr_diffs > 0U) { 668 if (best_nr_diffs > 0U) {
669 printk("Selecting best matching firmware (%u bits differ) for " 669 printk(KERN_WARNING
670 "Selecting best matching firmware (%u bits differ) for "
670 "type=(%x), id %016llx:\n", 671 "type=(%x), id %016llx:\n",
671 best_nr_diffs, type, (unsigned long long)*id); 672 best_nr_diffs, type, (unsigned long long)*id);
672 i = best_i; 673 i = best_i;
@@ -677,10 +678,10 @@ found:
677 678
678ret: 679ret:
679 if (debug) { 680 if (debug) {
680 printk("%s firmware for type=", 681 printk(KERN_DEBUG "%s firmware for type=",
681 (i < 0) ? "Can't find" : "Found"); 682 (i < 0) ? "Can't find" : "Found");
682 dump_firm_type(type); 683 dump_firm_type(type);
683 printk("(%x), id %016llx.\n", type, (unsigned long long)*id); 684 printk(KERN_DEBUG "(%x), id %016llx.\n", type, (unsigned long long)*id);
684 } 685 }
685 return i; 686 return i;
686} 687}
@@ -723,13 +724,13 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
723 else 724 else
724 fname = XC4000_DEFAULT_FIRMWARE; 725 fname = XC4000_DEFAULT_FIRMWARE;
725 726
726 printk("Reading firmware %s\n", fname); 727 dprintk(1, "Reading firmware %s\n", fname);
727 rc = request_firmware(&fw, fname, priv->i2c_props.adap->dev.parent); 728 rc = request_firmware(&fw, fname, priv->i2c_props.adap->dev.parent);
728 if (rc < 0) { 729 if (rc < 0) {
729 if (rc == -ENOENT) 730 if (rc == -ENOENT)
730 printk("Error: firmware %s not found.\n", fname); 731 printk(KERN_ERR "Error: firmware %s not found.\n", fname);
731 else 732 else
732 printk("Error %d while requesting firmware %s \n", 733 printk(KERN_ERR "Error %d while requesting firmware %s\n",
733 rc, fname); 734 rc, fname);
734 735
735 return rc; 736 return rc;
@@ -738,7 +739,8 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
738 endp = p + fw->size; 739 endp = p + fw->size;
739 740
740 if (fw->size < sizeof(name) - 1 + 2 + 2) { 741 if (fw->size < sizeof(name) - 1 + 2 + 2) {
741 printk("Error: firmware file %s has invalid size!\n", fname); 742 printk(KERN_ERR "Error: firmware file %s has invalid size!\n",
743 fname);
742 goto corrupt; 744 goto corrupt;
743 } 745 }
744 746
@@ -758,9 +760,9 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
758 760
759 priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL); 761 priv->firm = kzalloc(sizeof(*priv->firm) * n_array, GFP_KERNEL);
760 if (priv->firm == NULL) { 762 if (priv->firm == NULL) {
761 printk("Not enough memory to load firmware file.\n"); 763 printk(KERN_ERR "Not enough memory to load firmware file.\n");
762 rc = -ENOMEM; 764 rc = -ENOMEM;
763 goto err; 765 goto done;
764 } 766 }
765 priv->firm_size = n_array; 767 priv->firm_size = n_array;
766 768
@@ -772,7 +774,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
772 774
773 n++; 775 n++;
774 if (n >= n_array) { 776 if (n >= n_array) {
775 printk("More firmware images in file than " 777 printk(KERN_ERR "More firmware images in file than "
776 "were expected!\n"); 778 "were expected!\n");
777 goto corrupt; 779 goto corrupt;
778 } 780 }
@@ -798,8 +800,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
798 p += sizeof(size); 800 p += sizeof(size);
799 801
800 if (!size || size > endp - p) { 802 if (!size || size > endp - p) {
801 printk("Firmware type (%x), id %llx is corrupted " 803 printk(KERN_ERR "Firmware type (%x), id %llx is corrupted (size=%d, expected %d)\n",
802 "(size=%d, expected %d)\n",
803 type, (unsigned long long)id, 804 type, (unsigned long long)id,
804 (unsigned)(endp - p), size); 805 (unsigned)(endp - p), size);
805 goto corrupt; 806 goto corrupt;
@@ -807,15 +808,15 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
807 808
808 priv->firm[n].ptr = kzalloc(size, GFP_KERNEL); 809 priv->firm[n].ptr = kzalloc(size, GFP_KERNEL);
809 if (priv->firm[n].ptr == NULL) { 810 if (priv->firm[n].ptr == NULL) {
810 printk("Not enough memory to load firmware file.\n"); 811 printk(KERN_ERR "Not enough memory to load firmware file.\n");
811 rc = -ENOMEM; 812 rc = -ENOMEM;
812 goto err; 813 goto done;
813 } 814 }
814 815
815 if (debug) { 816 if (debug) {
816 printk("Reading firmware type "); 817 printk(KERN_DEBUG "Reading firmware type ");
817 dump_firm_type_and_int_freq(type, int_freq); 818 dump_firm_type_and_int_freq(type, int_freq);
818 printk("(%x), id %llx, size=%d.\n", 819 printk(KERN_DEBUG "(%x), id %llx, size=%d.\n",
819 type, (unsigned long long)id, size); 820 type, (unsigned long long)id, size);
820 } 821 }
821 822
@@ -829,20 +830,17 @@ static int xc4000_fwupload(struct dvb_frontend *fe)
829 } 830 }
830 831
831 if (n + 1 != priv->firm_size) { 832 if (n + 1 != priv->firm_size) {
832 printk("Firmware file is incomplete!\n"); 833 printk(KERN_ERR "Firmware file is incomplete!\n");
833 goto corrupt; 834 goto corrupt;
834 } 835 }
835 836
836 goto done; 837 goto done;
837 838
838header: 839header:
839 printk("Firmware header is incomplete!\n"); 840 printk(KERN_ERR "Firmware header is incomplete!\n");
840corrupt: 841corrupt:
841 rc = -EINVAL; 842 rc = -EINVAL;
842 printk("Error: firmware file is corrupted!\n"); 843 printk(KERN_ERR "Error: firmware file is corrupted!\n");
843
844err:
845 printk("Releasing partially loaded firmware file.\n");
846 844
847done: 845done:
848 release_firmware(fw); 846 release_firmware(fw);
@@ -883,11 +881,13 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type,
883 return -EINVAL; 881 return -EINVAL;
884 p += 12 * scode; 882 p += 12 * scode;
885 883
886 tuner_info("Loading SCODE for type="); 884 if (debug) {
887 dump_firm_type_and_int_freq(priv->firm[pos].type, 885 tuner_info("Loading SCODE for type=");
888 priv->firm[pos].int_freq); 886 dump_firm_type_and_int_freq(priv->firm[pos].type,
889 printk("(%x), id %016llx.\n", priv->firm[pos].type, 887 priv->firm[pos].int_freq);
890 (unsigned long long)*id); 888 printk(KERN_CONT "(%x), id %016llx.\n", priv->firm[pos].type,
889 (unsigned long long)*id);
890 }
891 891
892 scode_buf[0] = 0x00; 892 scode_buf[0] = 0x00;
893 memcpy(&scode_buf[1], p, 12); 893 memcpy(&scode_buf[1], p, 12);
@@ -895,7 +895,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type,
895 /* Enter direct-mode */ 895 /* Enter direct-mode */
896 rc = xc_write_reg(priv, XREG_DIRECTSITTING_MODE, 0); 896 rc = xc_write_reg(priv, XREG_DIRECTSITTING_MODE, 0);
897 if (rc < 0) { 897 if (rc < 0) {
898 printk("failed to put device into direct mode!\n"); 898 printk(KERN_ERR "failed to put device into direct mode!\n");
899 return -EIO; 899 return -EIO;
900 } 900 }
901 901
@@ -903,7 +903,7 @@ static int load_scode(struct dvb_frontend *fe, unsigned int type,
903 if (rc != 0) { 903 if (rc != 0) {
904 /* Even if the send failed, make sure we set back to indirect 904 /* Even if the send failed, make sure we set back to indirect
905 mode */ 905 mode */
906 printk("Failed to set scode %d\n", rc); 906 printk(KERN_ERR "Failed to set scode %d\n", rc);
907 } 907 }
908 908
909 /* Switch back to indirect-mode */ 909 /* Switch back to indirect-mode */
@@ -944,7 +944,7 @@ retry:
944 dprintk(1, "checking firmware, user requested type="); 944 dprintk(1, "checking firmware, user requested type=");
945 if (debug) { 945 if (debug) {
946 dump_firm_type(new_fw.type); 946 dump_firm_type(new_fw.type);
947 printk("(%x), id %016llx, ", new_fw.type, 947 printk(KERN_CONT "(%x), id %016llx, ", new_fw.type,
948 (unsigned long long)new_fw.std_req); 948 (unsigned long long)new_fw.std_req);
949 if (!int_freq) 949 if (!int_freq)
950 printk(KERN_CONT "scode_tbl "); 950 printk(KERN_CONT "scode_tbl ");
@@ -971,7 +971,7 @@ retry:
971 std0 = 0; 971 std0 = 0;
972 rc = load_firmware(fe, BASE, &std0); 972 rc = load_firmware(fe, BASE, &std0);
973 if (rc < 0) { 973 if (rc < 0) {
974 printk("Error %d while loading base firmware\n", rc); 974 printk(KERN_ERR "Error %d while loading base firmware\n", rc);
975 goto fail; 975 goto fail;
976 } 976 }
977 977
@@ -1025,7 +1025,7 @@ check_device:
1025 1025
1026 if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major, 1026 if (xc_get_version(priv, &hw_major, &hw_minor, &fw_major,
1027 &fw_minor) != 0) { 1027 &fw_minor) != 0) {
1028 printk("Unable to read tuner registers.\n"); 1028 printk(KERN_ERR "Unable to read tuner registers.\n");
1029 goto fail; 1029 goto fail;
1030 } 1030 }
1031 1031
@@ -1340,11 +1340,10 @@ static int xc4000_set_analog_params(struct dvb_frontend *fe,
1340 if (params->std & V4L2_STD_PAL_I) { 1340 if (params->std & V4L2_STD_PAL_I) {
1341 /* default to NICAM audio standard */ 1341 /* default to NICAM audio standard */
1342 params->std = V4L2_STD_PAL_I | V4L2_STD_NICAM; 1342 params->std = V4L2_STD_PAL_I | V4L2_STD_NICAM;
1343 if (audio_std & XC4000_AUDIO_STD_MONO) { 1343 if (audio_std & XC4000_AUDIO_STD_MONO)
1344 priv->video_standard = XC4000_I_PAL_NICAM_MONO; 1344 priv->video_standard = XC4000_I_PAL_NICAM_MONO;
1345 } else { 1345 else
1346 priv->video_standard = XC4000_I_PAL_NICAM; 1346 priv->video_standard = XC4000_I_PAL_NICAM;
1347 }
1348 goto tune_channel; 1347 goto tune_channel;
1349 } 1348 }
1350 1349