aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-07-29 13:14:04 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-08-06 05:57:13 -0400
commit8f47a3cefbb275893ce26ade7094599e4b129bb3 (patch)
tree4f88729afc9e4e9602805c4f926483fa874aa105
parent0cd6759da646aae9d117df278ce3d5f3cab31904 (diff)
V4L/DVB (8569): gspca: Set back the old values of Sonix sn9c120 and cleanup source.
The values from win traces do not seem to work while the webcams did work with gspca v1. Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/video/gspca/sonixj.c184
1 files changed, 59 insertions, 125 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index 65452f3b1945..b60ff600a757 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -148,55 +148,58 @@ static struct v4l2_pix_format vga_mode[] = {
148 148
149/*Data from sn9c102p+hv71331r */ 149/*Data from sn9c102p+hv71331r */
150static const __u8 sn_hv7131[] = { 150static const __u8 sn_hv7131[] = {
151/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */ 151/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
152 0x00, 0x03, 0x64, 0x00, 0x1A, 0x20, 0x20, 0x20, 0xA1, 0x11, 152 0x00, 0x03, 0x64, 0x00, 0x1a, 0x20, 0x20, 0x20,
153/* rega regb regc regd rege regf reg10 reg11 */ 153/* reg8 reg9 rega regb regc regd rege regf */
154 0x02, 0x09, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, /* 00 */ 154 0xa1, 0x11, 0x02, 0x09, 0x00, 0x00, 0x00, 0x10,
155/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */ 155/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
156 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41, 0x0a, 0x00, 0x00, 0x00, 156 0x03, 0x00, 0x00, 0x01, 0x03, 0x28, 0x1e, 0x41,
157/* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */ 157/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
158 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 158 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
159}; 159};
160 160
161static const __u8 sn_mi0360[] = { 161static const __u8 sn_mi0360[] = {
162/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 reg9 */ 162/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
163 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xb1, 0x5d, 163 0x00, 0x61, 0x44, 0x00, 0x1a, 0x20, 0x20, 0x20,
164/* rega regb regc regd rege regf reg10 reg11 */ 164/* reg8 reg9 rega regb regc regd rege regf */
165 0x07, 0x00, 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 165 0xb1, 0x5d, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10,
166/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a reg1b */ 166/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
167 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61, 0x06, 0x00, 0x00, 0x00, 167 0x03, 0x00, 0x00, 0x02, 0x0a, 0x28, 0x1e, 0x61,
168/* reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23 */ 168/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
169 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 169 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
170}; 170};
171 171
172static const __u8 sn_mo4000[] = { 172static const __u8 sn_mo4000[] = {
173/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */ 173/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
174 0x12, 0x23, 0x60, 0x00, 0x1A, 0x00, 0x20, 0x18, 0x81, 174 0x12, 0x23, 0x60, 0x00, 0x1a, 0x00, 0x20, 0x18,
175/* reg9 rega regb regc regd rege regf reg10 reg11*/ 175/* reg8 reg9 rega regb regc regd rege regf */
176 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 176 0x81, 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
177/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a*/ 177/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
178 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40, 0x08, 0x00, 0x00, 178 0x03, 0x00, 0x0b, 0x0f, 0x14, 0x28, 0x1e, 0x40,
179/* reg1b reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23*/ 179/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
180 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x25, 0x39, 0x4b, 180 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
181 0x5c, 0x6b, 0x79, 0x87, 0x95, 0xa2, 0xaf, 0xbb, 0xc7,
182 0xd3, 0xdf, 0xea, 0xf5
183}; 181};
184 182
185static const __u8 sn_ov7648[] = { 183static const __u8 sn_ov7648[] = {
186 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20, 0xA1, 0x6E, 0x18, 0x65, 184/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
187 0x00, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1E, 0x82, 185 0x00, 0x21, 0x62, 0x00, 0x1a, 0x20, 0x20, 0x20,
188 0x07, 0x00, 0x00, 0x00, 0x00, 0x00 186/* reg8 reg9 rega regb regc regd rege regf */
187 0xa1, 0x6e, 0x18, 0x65, 0x00, 0x00, 0x00, 0x10,
188/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
189 0x03, 0x00, 0x00, 0x06, 0x06, 0x28, 0x1e, 0x82,
190/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
191 0x07, 0x00, 0x00, 0x00, 0x00, 0x00
189}; 192};
190 193
191static const __u8 sn_ov7660[] = { 194static const __u8 sn_ov7660[] = {
192/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 */ 195/* reg0 reg1 reg2 reg3 reg4 reg5 reg6 reg7 */
193 0x00, 0x61, 0x40, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x81, 196 0x00, 0x61, 0x40, 0x00, 0x1a, 0x20, 0x20, 0x20,
194/* reg9 rega regb regc regd rege regf reg10 reg11*/ 197/* reg8 reg9 rega regb regc regd rege regf */
195 0x21, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 198 0x81, 0x21, 0x07, 0x00, 0x00, 0x00, 0x00, 0x10,
196/* reg12 reg13 reg14 reg15 reg16 reg17 reg18 reg19 reg1a*/ 199/* reg10 reg11 reg12 reg13 reg14 reg15 reg16 reg17 */
197 0x01, 0x01, 0x14, 0x28, 0x1e, 0x00, 0x07, 0x00, 0x00, 200 0x03, 0x00, 0x01, 0x01, 0x08, 0x28, 0x1e, 0x20,
198/* reg1b reg1c reg1d reg1e reg1f reg20 reg21 reg22 reg23*/ 201/* reg18 reg19 reg1a reg1b reg1c reg1d reg1e reg1f */
199 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 202 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
200}; 203};
201 204
202/* sequence specific to the sensors - !! index = SENSOR_xxx */ 205/* sequence specific to the sensors - !! index = SENSOR_xxx */
@@ -212,10 +215,6 @@ static const __u8 regsn20[] = {
212 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99, 215 0x00, 0x2d, 0x46, 0x5a, 0x6c, 0x7c, 0x8b, 0x99,
213 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff 216 0xa6, 0xb2, 0xbf, 0xca, 0xd5, 0xe0, 0xeb, 0xf5, 0xff
214}; 217};
215static const __u8 regsn20_sn9c120[] = {
216 0x00, 0x25, 0x3c, 0x50, 0x62, 0x72, 0x81, 0x90,
217 0x9e, 0xab, 0xb8, 0xc5, 0xd1, 0xdd, 0xe9, 0xf4, 0xff
218};
219static const __u8 regsn20_sn9c325[] = { 218static const __u8 regsn20_sn9c325[] = {
220 0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4, 219 0x0a, 0x3a, 0x56, 0x6c, 0x7e, 0x8d, 0x9a, 0xa4,
221 0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5 220 0xaf, 0xbb, 0xc5, 0xcd, 0xd5, 0xde, 0xe8, 0xed, 0xf5
@@ -227,21 +226,6 @@ static const __u8 reg84[] = {
227/* 0x00, 0x00, 0x00, 0x00, 0x00 */ 226/* 0x00, 0x00, 0x00, 0x00, 0x00 */
228 0xf7, 0x0f, 0x0a, 0x00, 0x00 227 0xf7, 0x0f, 0x0a, 0x00, 0x00
229}; 228};
230static const __u8 reg84_sn9c120_1[] = {
231 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
232 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
233 0x00, 0x00, 0x0c, 0x00, 0x00
234};
235static const __u8 reg84_sn9c120_2[] = {
236 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
237 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
238 0x00, 0x00, 0x0c, 0x02, 0x3b
239};
240static const __u8 reg84_sn9c120_3[] = {
241 0x14, 0x00, 0x27, 0x00, 0x08, 0x00, 0xeb, 0x0f,
242 0xd5, 0x0f, 0x42, 0x00, 0x41, 0x00, 0xca, 0x0f,
243 0xf5, 0x0f, 0x0c, 0x02, 0x3b
244};
245static const __u8 reg84_sn9c325[] = { 229static const __u8 reg84_sn9c325[] = {
246 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f, 230 0x14, 0x00, 0x27, 0x00, 0x07, 0x00, 0xe4, 0x0f,
247 0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f, 231 0xd3, 0x0f, 0x4b, 0x00, 0x48, 0x00, 0xc0, 0x0f,
@@ -676,13 +660,12 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
676 const __u8 *reg9a; 660 const __u8 *reg9a;
677 static const __u8 reg9a_def[] = 661 static const __u8 reg9a_def[] =
678 {0x08, 0x40, 0x20, 0x10, 0x00, 0x04}; 662 {0x08, 0x40, 0x20, 0x10, 0x00, 0x04};
679 static const __u8 reg9a_sn9c120[] = /* from win trace */
680 {0x00, 0x40, 0x38, 0x30, 0x00, 0x20};
681 static const __u8 reg9a_sn9c325[] = 663 static const __u8 reg9a_sn9c325[] =
682 {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20}; 664 {0x0a, 0x40, 0x38, 0x30, 0x00, 0x20};
665 static const __u8 regd4[] = {0x60, 0x00, 0x00};
683 666
684 reg_w1(gspca_dev, 0xf1, 0x00); 667 reg_w1(gspca_dev, 0xf1, 0x00);
685 reg_w1(gspca_dev, 0x01, sn9c1xx[0]); /*fixme:jfm was [1] en v1*/ 668 reg_w1(gspca_dev, 0x01, 0x00); /*jfm was sn9c1xx[1] in v1*/
686 669
687 /* configure gpio */ 670 /* configure gpio */
688 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2); 671 reg_w(gspca_dev, 0x01, &sn9c1xx[1], 2);
@@ -692,25 +675,17 @@ static int configure_gpio(struct gspca_dev *gspca_dev,
692 case BRIDGE_SN9C325: 675 case BRIDGE_SN9C325:
693 reg9a = reg9a_sn9c325; 676 reg9a = reg9a_sn9c325;
694 break; 677 break;
695 case BRIDGE_SN9C120:
696 reg9a = reg9a_sn9c120;
697 break;
698 default: 678 default:
699 reg9a = reg9a_def; 679 reg9a = reg9a_def;
700 break; 680 break;
701 } 681 }
702 reg_w(gspca_dev, 0x9a, reg9a, 6); 682 reg_w(gspca_dev, 0x9a, reg9a, 6);
703 683
704 reg_w1(gspca_dev, 0xd4, 0x60); /*fixme:jfm 60 00 00 (3) ? */ 684 reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); /*fixme:jfm was 60 only*/
705 685
706 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); 686 reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f);
707 687
708 switch (sd->bridge) { 688 switch (sd->bridge) {
709 case BRIDGE_SN9C120: /* from win trace */
710 reg_w1(gspca_dev, 0x01, 0x61);
711 reg_w1(gspca_dev, 0x17, 0x20);
712 reg_w1(gspca_dev, 0x01, 0x60);
713 break;
714 case BRIDGE_SN9C325: 689 case BRIDGE_SN9C325:
715 reg_w1(gspca_dev, 0x01, 0x43); 690 reg_w1(gspca_dev, 0x01, 0x43);
716 reg_w1(gspca_dev, 0x17, 0xae); 691 reg_w1(gspca_dev, 0x17, 0xae);
@@ -819,10 +794,11 @@ static int sd_open(struct gspca_dev *gspca_dev)
819 794
820 /* setup a selector by bridge */ 795 /* setup a selector by bridge */
821 reg_w1(gspca_dev, 0xf1, 0x01); 796 reg_w1(gspca_dev, 0xf1, 0x01);
822 reg_r(gspca_dev, 0x00, 1); /* -> regF1 = 0x00 */
823 reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
824 reg_r(gspca_dev, 0x00, 1); 797 reg_r(gspca_dev, 0x00, 1);
798 reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]);
799 reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */
825 regF1 = gspca_dev->usb_buf[0]; 800 regF1 = gspca_dev->usb_buf[0];
801 PDEBUG(D_PROBE, "Sonix chip id: %02x", regF1);
826 switch (sd->bridge) { 802 switch (sd->bridge) {
827 case BRIDGE_SN9C102P: 803 case BRIDGE_SN9C102P:
828 if (regF1 != 0x11) 804 if (regF1 != 0x11)
@@ -933,15 +909,10 @@ static void setbrightness(struct gspca_dev *gspca_dev)
933 sd->exposure = setexposure(gspca_dev, expo); 909 sd->exposure = setexposure(gspca_dev, expo);
934 break; 910 break;
935 case SENSOR_MI0360: 911 case SENSOR_MI0360:
936 expo = sd->brightness >> 4;
937 sd->exposure = setexposure(gspca_dev, expo);
938 break;
939 case SENSOR_MO4000: 912 case SENSOR_MO4000:
940 expo = sd->brightness >> 4; 913 expo = sd->brightness >> 4;
941 sd->exposure = setexposure(gspca_dev, expo); 914 sd->exposure = setexposure(gspca_dev, expo);
942 break; 915 break;
943 case SENSOR_OV7660:
944 return; /*jfm??*/
945 } 916 }
946 917
947 k2 = sd->brightness >> 10; 918 k2 = sd->brightness >> 10;
@@ -954,8 +925,6 @@ static void setcontrast(struct gspca_dev *gspca_dev)
954 __u8 k2; 925 __u8 k2;
955 __u8 contrast[] = { 0x00, 0x00, 0x28, 0x00, 0x07, 0x00 }; 926 __u8 contrast[] = { 0x00, 0x00, 0x28, 0x00, 0x07, 0x00 };
956 927
957 if (sd->sensor == SENSOR_OV7660)
958 return; /*jfm??*/
959 k2 = sd->contrast; 928 k2 = sd->contrast;
960 contrast[2] = k2; 929 contrast[2] = k2;
961 contrast[0] = (k2 + 1) >> 1; 930 contrast[0] = (k2 + 1) >> 1;
@@ -982,15 +951,11 @@ static void sd_start(struct gspca_dev *gspca_dev)
982{ 951{
983 struct sd *sd = (struct sd *) gspca_dev; 952 struct sd *sd = (struct sd *) gspca_dev;
984 int i; 953 int i;
985 __u8 data; 954 __u8 reg1, reg17, reg18;
986 __u8 reg1;
987 __u8 reg17;
988 const __u8 *sn9c1xx; 955 const __u8 *sn9c1xx;
989 int mode; 956 int mode;
990 static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; 957 static const __u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f };
991 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; 958 static const __u8 CA[] = { 0x28, 0xd8, 0x14, 0xec };
992 static const __u8 CA_sn9c120[] =
993 { 0x14, 0xec, 0x0a, 0xf6 }; /* SN9C120 */
994 static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */ 959 static const __u8 CE[] = { 0x32, 0xdd, 0x2d, 0xdd }; /* MI0360 */
995 static const __u8 CE_sn9c325[] = 960 static const __u8 CE_sn9c325[] =
996 { 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */ 961 { 0x32, 0xdd, 0x32, 0xdd }; /* OV7648 - SN9C325 */
@@ -998,9 +963,7 @@ static void sd_start(struct gspca_dev *gspca_dev)
998 sn9c1xx = sn_tb[(int) sd->sensor]; 963 sn9c1xx = sn_tb[(int) sd->sensor];
999 configure_gpio(gspca_dev, sn9c1xx); 964 configure_gpio(gspca_dev, sn9c1xx);
1000 965
1001/*fixme:jfm this sequence should appear at end of sd_start */ 966/* reg_w1(gspca_dev, 0x01, 0x44); jfm from win trace*/
1002/* with
1003 reg_w1(gspca_dev, 0x01, 0x44); */
1004 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]); 967 reg_w1(gspca_dev, 0x15, sn9c1xx[0x15]);
1005 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]); 968 reg_w1(gspca_dev, 0x16, sn9c1xx[0x16]);
1006 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]); 969 reg_w1(gspca_dev, 0x12, sn9c1xx[0x12]);
@@ -1012,20 +975,16 @@ static void sd_start(struct gspca_dev *gspca_dev)
1012 reg_w1(gspca_dev, 0xc7, 0x00); 975 reg_w1(gspca_dev, 0xc7, 0x00);
1013 reg_w1(gspca_dev, 0xc8, 0x50); 976 reg_w1(gspca_dev, 0xc8, 0x50);
1014 reg_w1(gspca_dev, 0xc9, 0x3c); 977 reg_w1(gspca_dev, 0xc9, 0x3c);
1015/*fixme:jfm end of ending sequence */
1016 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); 978 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]);
1017 switch (sd->bridge) { 979 switch (sd->bridge) {
1018 case BRIDGE_SN9C325: 980 case BRIDGE_SN9C325:
1019 data = 0xae; 981 reg17 = 0xae;
1020 break;
1021 case BRIDGE_SN9C120:
1022 data = 0xa0;
1023 break; 982 break;
1024 default: 983 default:
1025 data = 0x60; 984 reg17 = 0x60;
1026 break; 985 break;
1027 } 986 }
1028 reg_w1(gspca_dev, 0x17, data); 987 reg_w1(gspca_dev, 0x17, reg17);
1029 reg_w1(gspca_dev, 0x05, sn9c1xx[5]); 988 reg_w1(gspca_dev, 0x05, sn9c1xx[5]);
1030 reg_w1(gspca_dev, 0x07, sn9c1xx[7]); 989 reg_w1(gspca_dev, 0x07, sn9c1xx[7]);
1031 reg_w1(gspca_dev, 0x06, sn9c1xx[6]); 990 reg_w1(gspca_dev, 0x06, sn9c1xx[6]);
@@ -1040,20 +999,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
1040 reg_w1(gspca_dev, 0x9a, 0x0a); 999 reg_w1(gspca_dev, 0x9a, 0x0a);
1041 reg_w1(gspca_dev, 0x99, 0x60); 1000 reg_w1(gspca_dev, 0x99, 0x60);
1042 break; 1001 break;
1043 case BRIDGE_SN9C120:
1044 reg_w(gspca_dev, 0x20, regsn20_sn9c120,
1045 sizeof regsn20_sn9c120);
1046 for (i = 0; i < 2; i++)
1047 reg_w(gspca_dev, 0x84, reg84_sn9c120_1,
1048 sizeof reg84_sn9c120_1);
1049 for (i = 0; i < 6; i++)
1050 reg_w(gspca_dev, 0x84, reg84_sn9c120_2,
1051 sizeof reg84_sn9c120_2);
1052 reg_w(gspca_dev, 0x84, reg84_sn9c120_3,
1053 sizeof reg84_sn9c120_3);
1054 reg_w1(gspca_dev, 0x9a, 0x05);
1055 reg_w1(gspca_dev, 0x99, 0x5b);
1056 break;
1057 default: 1002 default:
1058 reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20); 1003 reg_w(gspca_dev, 0x20, regsn20, sizeof regsn20);
1059 for (i = 0; i < 8; i++) 1004 for (i = 0; i < 8; i++)
@@ -1103,22 +1048,14 @@ static void sd_start(struct gspca_dev *gspca_dev)
1103/* reg1 = 0x44; */ 1048/* reg1 = 0x44; */
1104/* reg1 = 0x46; (done) */ 1049/* reg1 = 0x46; (done) */
1105 } else { 1050 } else {
1106 reg17 = 0xa2; /* 640 */ 1051 reg17 = 0x22; /* 640 MCKSIZE */
1107 reg1 = 0x40; 1052 reg1 = 0x06;
1108 } 1053 }
1109 break; 1054 break;
1110 } 1055 }
1111 reg_w(gspca_dev, 0xc0, C0, 6); 1056 reg_w(gspca_dev, 0xc0, C0, 6);
1057 reg_w(gspca_dev, 0xca, CA, 4);
1112 switch (sd->bridge) { 1058 switch (sd->bridge) {
1113 case BRIDGE_SN9C120: /*jfm ?? */
1114 reg_w(gspca_dev, 0xca, CA_sn9c120, 4);
1115 break;
1116 default:
1117 reg_w(gspca_dev, 0xca, CA, 4);
1118 break;
1119 }
1120 switch (sd->bridge) {
1121 case BRIDGE_SN9C120: /*jfm ?? */
1122 case BRIDGE_SN9C325: 1059 case BRIDGE_SN9C325:
1123 reg_w(gspca_dev, 0xce, CE_sn9c325, 4); 1060 reg_w(gspca_dev, 0xce, CE_sn9c325, 4);
1124 break; 1061 break;
@@ -1129,14 +1066,13 @@ static void sd_start(struct gspca_dev *gspca_dev)
1129 } 1066 }
1130 1067
1131 /* here change size mode 0 -> VGA; 1 -> CIF */ 1068 /* here change size mode 0 -> VGA; 1 -> CIF */
1132 data = 0x40 | sn9c1xx[0x18] | (mode << 4); 1069 reg18 = sn9c1xx[0x18] | (mode << 4);
1133 reg_w1(gspca_dev, 0x18, data); 1070 reg_w1(gspca_dev, 0x18, reg18 | 0x40);
1134 1071
1135 reg_w(gspca_dev, 0x100, qtable4, 0x40); 1072 reg_w(gspca_dev, 0x100, qtable4, 0x40);
1136 reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40); 1073 reg_w(gspca_dev, 0x140, qtable4 + 0x40, 0x40);
1137 1074
1138 data = sn9c1xx[0x18] | (mode << 4); 1075 reg_w1(gspca_dev, 0x18, reg18);
1139 reg_w1(gspca_dev, 0x18, data);
1140 1076
1141 reg_w1(gspca_dev, 0x17, reg17); 1077 reg_w1(gspca_dev, 0x17, reg17);
1142 reg_w1(gspca_dev, 0x01, reg1); 1078 reg_w1(gspca_dev, 0x01, reg1);
@@ -1164,12 +1100,11 @@ static void sd_stopN(struct gspca_dev *gspca_dev)
1164 i2c_w8(gspca_dev, stopmi0360); 1100 i2c_w8(gspca_dev, stopmi0360);
1165 data = 0x29; 1101 data = 0x29;
1166 break; 1102 break;
1167 case SENSOR_MO4000:
1168 break;
1169 case SENSOR_OV7648: 1103 case SENSOR_OV7648:
1170 data = 0x29; 1104 data = 0x29;
1171 break; 1105 break;
1172 default: 1106 default:
1107/* case SENSOR_MO4000: */
1173/* case SENSOR_OV7660: */ 1108/* case SENSOR_OV7660: */
1174 break; 1109 break;
1175 } 1110 }
@@ -1296,6 +1231,7 @@ static unsigned int getexposure(struct gspca_dev *gspca_dev)
1296 (hexpo << 10) | (mexpo << 2) | lexpo); 1231 (hexpo << 10) | (mexpo << 2) | lexpo);
1297 return (hexpo << 10) | (mexpo << 2) | lexpo; 1232 return (hexpo << 10) | (mexpo << 2) | lexpo;
1298 default: 1233 default:
1234/* case SENSOR_OV7648: * jfm: is it ok for 7648? */
1299/* case SENSOR_OV7660: */ 1235/* case SENSOR_OV7660: */
1300 /* read sensor exposure */ 1236 /* read sensor exposure */
1301 i2c_r5(gspca_dev, 0x04); 1237 i2c_r5(gspca_dev, 0x04);
@@ -1314,14 +1250,12 @@ static void getbrightness(struct gspca_dev *gspca_dev)
1314 /* hardcoded registers seem not readable */ 1250 /* hardcoded registers seem not readable */
1315 switch (sd->sensor) { 1251 switch (sd->sensor) {
1316 case SENSOR_HV7131R: 1252 case SENSOR_HV7131R:
1317/* sd->brightness = 0x7fff; */
1318 sd->brightness = getexposure(gspca_dev) >> 4; 1253 sd->brightness = getexposure(gspca_dev) >> 4;
1319 break; 1254 break;
1320 case SENSOR_MI0360: 1255 case SENSOR_MI0360:
1321 sd->brightness = getexposure(gspca_dev) << 4; 1256 sd->brightness = getexposure(gspca_dev) << 4;
1322 break; 1257 break;
1323 case SENSOR_MO4000: 1258 case SENSOR_MO4000:
1324/* sd->brightness = 0x1fff; */
1325 sd->brightness = getexposure(gspca_dev) << 4; 1259 sd->brightness = getexposure(gspca_dev) << 4;
1326 break; 1260 break;
1327 } 1261 }