aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/sonixj.c
diff options
context:
space:
mode:
authorNémeth Márton <nm127@freemail.hu>2010-10-18 06:00:48 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 12:30:03 -0400
commitccbc5df21ca0c616c5e47d1e7f58ff5b312e03a7 (patch)
tree9162738874f5d73592357c75b4d67f07096fba42 /drivers/media/video/gspca/sonixj.c
parent75f05ba09f50ef934cf6dbe9bf7460a9618d8e88 (diff)
[media] gspca - sonixj: Remove magic numbers for delay
The number 0xdd is used for marking delay init sequence steps. Replace 0xdd values only if the meaning is delay. Signed-off-by: Jean-François Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/sonixj.c')
-rw-r--r--drivers/media/video/gspca/sonixj.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c
index c0573c405a11..da64947fc08f 100644
--- a/drivers/media/video/gspca/sonixj.c
+++ b/drivers/media/video/gspca/sonixj.c
@@ -552,20 +552,23 @@ static const u8 reg84[] = {
552 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f, /* VR VG VB */ 552 0x3e, 0x00, 0xcd, 0x0f, 0xf7, 0x0f, /* VR VG VB */
553 0x00, 0x00, 0x00 /* YUV offsets */ 553 0x00, 0x00, 0x00 /* YUV offsets */
554}; 554};
555
556#define DELAY 0xdd
557
555static const u8 adcm1700_sensor_init[][8] = { 558static const u8 adcm1700_sensor_init[][8] = {
556 {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10}, 559 {0xa0, 0x51, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x10},
557 {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10}, /* reset */ 560 {0xb0, 0x51, 0x04, 0x08, 0x00, 0x00, 0x00, 0x10}, /* reset */
558 {0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 561 {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
559 {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10}, 562 {0xb0, 0x51, 0x04, 0x00, 0x00, 0x00, 0x00, 0x10},
560 {0xdd, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 563 {DELAY, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
561 {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10}, 564 {0xb0, 0x51, 0x0c, 0xe0, 0x2e, 0x00, 0x00, 0x10},
562 {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10}, 565 {0xb0, 0x51, 0x10, 0x02, 0x02, 0x00, 0x00, 0x10},
563 {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10}, 566 {0xb0, 0x51, 0x14, 0x0e, 0x0e, 0x00, 0x00, 0x10},
564 {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10}, 567 {0xb0, 0x51, 0x1c, 0x00, 0x80, 0x00, 0x00, 0x10},
565 {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10}, 568 {0xb0, 0x51, 0x20, 0x01, 0x00, 0x00, 0x00, 0x10},
566 {0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 569 {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
567 {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10}, 570 {0xb0, 0x51, 0x04, 0x04, 0x00, 0x00, 0x00, 0x10},
568 {0xdd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, 571 {DELAY, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
569 {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10}, 572 {0xb0, 0x51, 0x04, 0x01, 0x00, 0x00, 0x00, 0x10},
570 {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10}, 573 {0xa0, 0x51, 0xfe, 0x10, 0x00, 0x00, 0x00, 0x10},
571 {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10}, 574 {0xb0, 0x51, 0x14, 0x01, 0x00, 0x00, 0x00, 0x10},
@@ -609,7 +612,7 @@ static const u8 gc0307_sensor_init[][8] = {
609 {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10}, 612 {0xa0, 0x21, 0x0e, 0x02, 0x00, 0x00, 0x00, 0x10},
610 {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10}, 613 {0xa0, 0x21, 0x0f, 0xb2, 0x00, 0x00, 0x00, 0x10},
611 {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10}, 614 {0xa0, 0x21, 0x12, 0x70, 0x00, 0x00, 0x00, 0x10},
612 {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/ 615 {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 10ms*/
613 {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10}, 616 {0xa0, 0x21, 0x13, 0x00, 0x00, 0x00, 0x00, 0x10},
614 {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10}, 617 {0xa0, 0x21, 0x15, 0xb8, 0x00, 0x00, 0x00, 0x10},
615 {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10}, 618 {0xa0, 0x21, 0x16, 0x13, 0x00, 0x00, 0x00, 0x10},
@@ -730,9 +733,9 @@ static const u8 mi0360_sensor_init[][8] = {
730static const u8 mi0360b_sensor_init[][8] = { 733static const u8 mi0360b_sensor_init[][8] = {
731 {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10}, 734 {0xb1, 0x5d, 0x07, 0x00, 0x02, 0x00, 0x00, 0x10},
732 {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, 735 {0xb1, 0x5d, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10},
733 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/ 736 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/
734 {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, 737 {0xb1, 0x5d, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
735 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/ 738 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /*delay 20ms*/
736 {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10}, 739 {0xd1, 0x5d, 0x01, 0x00, 0x08, 0x00, 0x16, 0x10},
737 {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10}, 740 {0xd1, 0x5d, 0x03, 0x01, 0xe2, 0x02, 0x82, 0x10},
738 {0xd1, 0x5d, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10}, 741 {0xd1, 0x5d, 0x05, 0x00, 0x00, 0x00, 0x00, 0x10},
@@ -808,7 +811,7 @@ static const u8 mo4000_sensor_init[][8] = {
808}; 811};
809static const u8 mt9v111_sensor_init[][8] = { 812static const u8 mt9v111_sensor_init[][8] = {
810 {0xb1, 0x5c, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, /* reset? */ 813 {0xb1, 0x5c, 0x0d, 0x00, 0x01, 0x00, 0x00, 0x10}, /* reset? */
811 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ 814 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
812 {0xb1, 0x5c, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10}, 815 {0xb1, 0x5c, 0x0d, 0x00, 0x00, 0x00, 0x00, 0x10},
813 {0xb1, 0x5c, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10}, /* IFP select */ 816 {0xb1, 0x5c, 0x01, 0x00, 0x01, 0x00, 0x00, 0x10}, /* IFP select */
814 {0xb1, 0x5c, 0x08, 0x04, 0x80, 0x00, 0x00, 0x10}, /* output fmt ctrl */ 817 {0xb1, 0x5c, 0x08, 0x04, 0x80, 0x00, 0x00, 0x10}, /* output fmt ctrl */
@@ -896,10 +899,10 @@ static const u8 om6802_sensor_param1[][8] = {
896static const u8 ov7630_sensor_init[][8] = { 899static const u8 ov7630_sensor_init[][8] = {
897 {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10}, 900 {0xa1, 0x21, 0x76, 0x01, 0x00, 0x00, 0x00, 0x10},
898 {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, 901 {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10},
899 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ 902 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
900 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, 903 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
901 {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10}, 904 {0xa1, 0x21, 0x12, 0xc8, 0x00, 0x00, 0x00, 0x10},
902 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ 905 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
903 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10}, 906 {0xa1, 0x21, 0x12, 0x48, 0x00, 0x00, 0x00, 0x10},
904/* win: i2c_r from 00 to 80 */ 907/* win: i2c_r from 00 to 80 */
905 {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10}, 908 {0xd1, 0x21, 0x03, 0x80, 0x10, 0x20, 0x80, 0x10},
@@ -953,7 +956,7 @@ static const u8 ov7630_sensor_param1[][8] = {
953static const u8 ov7648_sensor_init[][8] = { 956static const u8 ov7648_sensor_init[][8] = {
954 {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10}, 957 {0xa1, 0x21, 0x76, 0x00, 0x00, 0x00, 0x00, 0x10},
955 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ 958 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */
956 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ 959 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
957 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, 960 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
958 {0xd1, 0x21, 0x03, 0xa4, 0x30, 0x88, 0x00, 0x10}, 961 {0xd1, 0x21, 0x03, 0xa4, 0x30, 0x88, 0x00, 0x10},
959 {0xb1, 0x21, 0x11, 0x80, 0x08, 0x00, 0x00, 0x10}, 962 {0xb1, 0x21, 0x11, 0x80, 0x08, 0x00, 0x00, 0x10},
@@ -1002,7 +1005,7 @@ static const u8 ov7648_sensor_param1[][8] = {
1002 1005
1003static const u8 ov7660_sensor_init[][8] = { 1006static const u8 ov7660_sensor_init[][8] = {
1004 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */ 1007 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset SCCB */
1005 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ 1008 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
1006 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10}, 1009 {0xa1, 0x21, 0x12, 0x05, 0x00, 0x00, 0x00, 0x10},
1007 /* Outformat = rawRGB */ 1010 /* Outformat = rawRGB */
1008 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */ 1011 {0xa1, 0x21, 0x13, 0xb8, 0x00, 0x00, 0x00, 0x10}, /* init COM8 */
@@ -1098,7 +1101,7 @@ static const u8 ov7660_sensor_param1[][8] = {
1098static const u8 po1030_sensor_init[][8] = { 1101static const u8 po1030_sensor_init[][8] = {
1099/* the sensor registers are described in m5602/m5602_po1030.h */ 1102/* the sensor registers are described in m5602/m5602_po1030.h */
1100 {0xa1, 0x6e, 0x3f, 0x20, 0x00, 0x00, 0x00, 0x10}, /* sensor reset */ 1103 {0xa1, 0x6e, 0x3f, 0x20, 0x00, 0x00, 0x00, 0x10}, /* sensor reset */
1101 {0xdd, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */ 1104 {DELAY, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 20ms */
1102 {0xa1, 0x6e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x10}, 1105 {0xa1, 0x6e, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x10},
1103 {0xa1, 0x6e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x10}, 1106 {0xa1, 0x6e, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x10},
1104 {0xd1, 0x6e, 0x04, 0x02, 0xb1, 0x02, 0x39, 0x10}, 1107 {0xd1, 0x6e, 0x04, 0x02, 0xb1, 0x02, 0x39, 0x10},
@@ -1152,10 +1155,10 @@ static const u8 po1030_sensor_param1[][8] = {
1152static const u8 po2030n_sensor_init[][8] = { 1155static const u8 po2030n_sensor_init[][8] = {
1153 {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10}, 1156 {0xa1, 0x6e, 0x1e, 0x1a, 0x00, 0x00, 0x00, 0x10},
1154 {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10}, 1157 {0xa1, 0x6e, 0x1f, 0x99, 0x00, 0x00, 0x00, 0x10},
1155 {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ 1158 {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
1156 {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10}, 1159 {0xa1, 0x6e, 0x1e, 0x0a, 0x00, 0x00, 0x00, 0x10},
1157 {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10}, 1160 {0xa1, 0x6e, 0x1f, 0x19, 0x00, 0x00, 0x00, 0x10},
1158 {0xdd, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */ 1161 {DELAY, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 10ms */
1159 {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10}, 1162 {0xa1, 0x6e, 0x20, 0x44, 0x00, 0x00, 0x00, 0x10},
1160 {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10}, 1163 {0xa1, 0x6e, 0x04, 0x03, 0x00, 0x00, 0x00, 0x10},
1161 {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10}, 1164 {0xa1, 0x6e, 0x05, 0x70, 0x00, 0x00, 0x00, 0x10},
@@ -1204,7 +1207,7 @@ static const u8 po2030n_sensor_init[][8] = {
1204}; 1207};
1205static const u8 po2030n_sensor_param1[][8] = { 1208static const u8 po2030n_sensor_param1[][8] = {
1206 {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10}, 1209 {0xa1, 0x6e, 0x1a, 0x01, 0x00, 0x00, 0x00, 0x10},
1207 {0xdd, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */ 1210 {DELAY, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 8ms */
1208 {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10}, 1211 {0xa1, 0x6e, 0x1b, 0xf4, 0x00, 0x00, 0x00, 0x10},
1209 {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10}, 1212 {0xa1, 0x6e, 0x15, 0x04, 0x00, 0x00, 0x00, 0x10},
1210 {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10}, 1213 {0xd1, 0x6e, 0x16, 0x50, 0x40, 0x49, 0x40, 0x10},
@@ -1218,16 +1221,16 @@ static const u8 po2030n_sensor_param1[][8] = {
1218 {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10}, 1221 {0xc1, 0x6e, 0x16, 0x52, 0x40, 0x48, 0x00, 0x10},
1219/*after start*/ 1222/*after start*/
1220 {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10}, 1223 {0xa1, 0x6e, 0x15, 0x0f, 0x00, 0x00, 0x00, 0x10},
1221 {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ 1224 {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
1222 {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10}, 1225 {0xa1, 0x6e, 0x1a, 0x05, 0x00, 0x00, 0x00, 0x10},
1223 {0xdd, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */ 1226 {DELAY, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 5ms */
1224 {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10}, 1227 {0xa1, 0x6e, 0x1b, 0x53, 0x00, 0x00, 0x00, 0x10},
1225 {} 1228 {}
1226}; 1229};
1227 1230
1228static const u8 soi768_sensor_init[][8] = { 1231static const u8 soi768_sensor_init[][8] = {
1229 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */ 1232 {0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10}, /* reset */
1230 {0xdd, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 96ms */ 1233 {DELAY, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* delay 96ms */
1231 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10}, 1234 {0xa1, 0x21, 0x12, 0x00, 0x00, 0x00, 0x00, 0x10},
1232 {0xa1, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10}, 1235 {0xa1, 0x21, 0x13, 0x80, 0x00, 0x00, 0x00, 0x10},
1233 {0xa1, 0x21, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x10}, 1236 {0xa1, 0x21, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x10},
@@ -1542,7 +1545,7 @@ static void i2c_w_seq(struct gspca_dev *gspca_dev,
1542 const u8 (*data)[8]) 1545 const u8 (*data)[8])
1543{ 1546{
1544 while ((*data)[0] != 0) { 1547 while ((*data)[0] != 0) {
1545 if ((*data)[0] != 0xdd) 1548 if ((*data)[0] != DELAY)
1546 i2c_w8(gspca_dev, *data); 1549 i2c_w8(gspca_dev, *data);
1547 else 1550 else
1548 msleep((*data)[1]); 1551 msleep((*data)[1]);