aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/gl860
diff options
context:
space:
mode:
authorOlivier Lorin <o.lorin@laposte.net>2009-10-15 03:12:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:40:49 -0500
commit216f05aa2a704ab8dfbfb3ca36da1e04d2a9ee67 (patch)
tree648721ec1a7bc21696eb302b02ad2db0fed88530 /drivers/media/video/gspca/gl860
parent013db7575bdfb57d295e9a27186f52c7547ef2d2 (diff)
V4L/DVB (13194): gspca - gl860: improvement of the main driver part
- fix for warning compilation about sd_ctrls - trace improvement while probing the sensor Signed-off-by: Olivier Lorin <o.lorin@laposte.net> Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/gl860')
-rw-r--r--drivers/media/video/gspca/gl860/gl860.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/media/video/gspca/gl860/gl860.c b/drivers/media/video/gspca/gl860/gl860.c
index 6ef59ac7f502..1c3ec0242c32 100644
--- a/drivers/media/video/gspca/gl860/gl860.c
+++ b/drivers/media/video/gspca/gl860/gl860.c
@@ -23,8 +23,8 @@
23#include "gspca.h" 23#include "gspca.h"
24#include "gl860.h" 24#include "gl860.h"
25 25
26MODULE_AUTHOR("Olivier Lorin <lorin@laposte.net>"); 26MODULE_AUTHOR("Olivier Lorin <o.lorin@laposte.net>");
27MODULE_DESCRIPTION("GSPCA/Genesys Logic GL860 USB Camera Driver"); 27MODULE_DESCRIPTION("Genesys Logic USB PC Camera Driver");
28MODULE_LICENSE("GPL"); 28MODULE_LICENSE("GPL");
29 29
30/*======================== static function declarations ====================*/ 30/*======================== static function declarations ====================*/
@@ -53,7 +53,7 @@ MODULE_PARM_DESC(AC50Hz, " Does AC power frequency is 50Hz? (0/1)");
53static char sensor[7]; 53static char sensor[7];
54module_param_string(sensor, sensor, sizeof(sensor), 0644); 54module_param_string(sensor, sensor, sizeof(sensor), 0644);
55MODULE_PARM_DESC(sensor, 55MODULE_PARM_DESC(sensor,
56 " Driver sensor ('MI1320'/'MI2020'/'OV9655'/'OV2640'/'')"); 56 " Driver sensor ('MI1320'/'MI2020'/'OV9655'/'OV2640')");
57 57
58/*============================ webcam controls =============================*/ 58/*============================ webcam controls =============================*/
59 59
@@ -156,7 +156,7 @@ static int gl860_build_control_table(struct gspca_dev *gspca_dev)
156 SET_MY_CTRL(V4L2_CID_VFLIP, 156 SET_MY_CTRL(V4L2_CID_VFLIP,
157 V4L2_CTRL_TYPE_BOOLEAN, "Flip", flip) 157 V4L2_CTRL_TYPE_BOOLEAN, "Flip", flip)
158 SET_MY_CTRL(V4L2_CID_POWER_LINE_FREQUENCY, 158 SET_MY_CTRL(V4L2_CID_POWER_LINE_FREQUENCY,
159 V4L2_CTRL_TYPE_BOOLEAN, "50Hz", AC50Hz) 159 V4L2_CTRL_TYPE_BOOLEAN, "AC power 50Hz", AC50Hz)
160 160
161 return nCtrls; 161 return nCtrls;
162} 162}
@@ -702,6 +702,7 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev,
702 ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL); 702 ctrl_out(gspca_dev, 0x40, 1, 0x006a, 0x000d, 0, NULL);
703 msleep(56); 703 msleep(56);
704 704
705 PDEBUG(D_PROBE, "probing for sensor MI2020 or OVXXXX");
705 nOV = 0; 706 nOV = 0;
706 for (ntry = 0; ntry < 4; ntry++) { 707 for (ntry = 0; ntry < 4; ntry++) {
707 ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000, 0, NULL); 708 ctrl_out(gspca_dev, 0x40, 1, 0x0040, 0x0000, 0, NULL);
@@ -711,14 +712,14 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev,
711 ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL); 712 ctrl_out(gspca_dev, 0x40, 1, 0x7a00, 0x8030, 0, NULL);
712 msleep(10); 713 msleep(10);
713 ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, &probe); 714 ctrl_in(gspca_dev, 0xc0, 2, 0x7a00, 0x8030, 1, &probe);
714 PDEBUG(D_PROBE, "1st probe=%02x", probe); 715 PDEBUG(D_PROBE, "probe=0x%02x", probe);
715 if (probe == 0xff) 716 if (probe == 0xff)
716 nOV++; 717 nOV++;
717 } 718 }
718 719
719 if (nOV) { 720 if (nOV) {
720 PDEBUG(D_PROBE, "0xff -> sensor OVXXXX"); 721 PDEBUG(D_PROBE, "0xff -> OVXXXX");
721 PDEBUG(D_PROBE, "Probing for sensor OV2640 or OV9655"); 722 PDEBUG(D_PROBE, "probing for sensor OV2640 or OV9655");
722 723
723 nb26 = nb96 = 0; 724 nb26 = nb96 = 0;
724 for (ntry = 0; ntry < 4; ntry++) { 725 for (ntry = 0; ntry < 4; ntry++) {
@@ -728,40 +729,38 @@ static int gl860_guess_sensor(struct gspca_dev *gspca_dev,
728 ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x800a, 729 ctrl_out(gspca_dev, 0x40, 1, 0x6000, 0x800a,
729 0, NULL); 730 0, NULL);
730 msleep(10); 731 msleep(10);
732
731 /* Wait for 26(OV2640) or 96(OV9655) */ 733 /* Wait for 26(OV2640) or 96(OV9655) */
732 ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x800a, 734 ctrl_in(gspca_dev, 0xc0, 2, 0x6000, 0x800a,
733 1, &probe); 735 1, &probe);
734 736
735 PDEBUG(D_PROBE, "2nd probe=%02x", probe);
736 if (probe == 0x00)
737 nb26++;
738 if (probe == 0x26 || probe == 0x40) { 737 if (probe == 0x26 || probe == 0x40) {
738 PDEBUG(D_PROBE,
739 "probe=0x%02x -> OV2640",
740 probe);
739 sd->sensor = ID_OV2640; 741 sd->sensor = ID_OV2640;
740 nb26 += 4; 742 nb26 += 4;
741 break; 743 break;
742 } 744 }
743 if (probe == 0x96 || probe == 0x55) { 745 if (probe == 0x96 || probe == 0x55) {
746 PDEBUG(D_PROBE,
747 "probe=0x%02x -> OV9655",
748 probe);
744 sd->sensor = ID_OV9655; 749 sd->sensor = ID_OV9655;
745 nb96 += 4; 750 nb96 += 4;
746 break; 751 break;
747 } 752 }
753 PDEBUG(D_PROBE, "probe=0x%02x", probe);
754 if (probe == 0x00)
755 nb26++;
748 if (probe == 0xff) 756 if (probe == 0xff)
749 nb96++; 757 nb96++;
750 msleep(3); 758 msleep(3);
751 } 759 }
752 if (nb26 < 4 && nb96 < 4) { 760 if (nb26 < 4 && nb96 < 4)
753 PDEBUG(D_PROBE, "No relevant answer ");
754 PDEBUG(D_PROBE, "* 1.3Mpixels -> use OV9655");
755 PDEBUG(D_PROBE, "* 2.0Mpixels -> use OV2640");
756 PDEBUG(D_PROBE,
757 "To force a sensor, add that line to "
758 "/etc/modprobe.d/options.conf:");
759 PDEBUG(D_PROBE, "options gspca_gl860 "
760 "sensor=\"OV2640\" or \"OV9655\"");
761 return -1; 761 return -1;
762 } 762 } else {
763 } else { /* probe = 0 */ 763 PDEBUG(D_PROBE, "Not any 0xff -> MI2020");
764 PDEBUG(D_PROBE, "No 0xff -> sensor MI2020");
765 sd->sensor = ID_MI2020; 764 sd->sensor = ID_MI2020;
766 } 765 }
767 } 766 }