diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-06-05 06:01:46 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 13:43:22 -0400 |
commit | 78b98cb9422533ecec32d8d30a23212c9a896ddc (patch) | |
tree | 25e63a05de0ea143789cd515ddcb9356270d3417 /drivers/media/video/gspca/t613.c | |
parent | cd8955b85efd7f460339f0ac8117be9e513a6996 (diff) |
V4L/DVB: gspca - t613: Adjust light frequency values per sensor
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/t613.c')
-rw-r--r-- | drivers/media/video/gspca/t613.c | 54 |
1 files changed, 34 insertions, 20 deletions
diff --git a/drivers/media/video/gspca/t613.c b/drivers/media/video/gspca/t613.c index abb2b605d578..b84c66b7fdcc 100644 --- a/drivers/media/video/gspca/t613.c +++ b/drivers/media/video/gspca/t613.c | |||
@@ -319,7 +319,6 @@ struct additional_sensor_data { | |||
319 | const u8 data1[10]; | 319 | const u8 data1[10]; |
320 | const u8 data2[9]; | 320 | const u8 data2[9]; |
321 | const u8 data3[9]; | 321 | const u8 data3[9]; |
322 | const u8 data4[4]; | ||
323 | const u8 data5[6]; | 322 | const u8 data5[6]; |
324 | const u8 stream[4]; | 323 | const u8 stream[4]; |
325 | }; | 324 | }; |
@@ -384,8 +383,6 @@ static const struct additional_sensor_data sensor_data[] = { | |||
384 | .data3 = | 383 | .data3 = |
385 | {0x80, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0xff, | 384 | {0x80, 0xff, 0xff, 0x80, 0xff, 0xff, 0x80, 0xff, |
386 | 0xff}, | 385 | 0xff}, |
387 | .data4 = /*Freq (50/60Hz). Splitted for test purpose */ | ||
388 | {0x66, 0xca, 0xa8, 0xf0}, | ||
389 | .data5 = /* this could be removed later */ | 386 | .data5 = /* this could be removed later */ |
390 | {0x0c, 0x03, 0xab, 0x13, 0x81, 0x23}, | 387 | {0x0c, 0x03, 0xab, 0x13, 0x81, 0x23}, |
391 | .stream = | 388 | .stream = |
@@ -408,8 +405,6 @@ static const struct additional_sensor_data sensor_data[] = { | |||
408 | .data3 = | 405 | .data3 = |
409 | {0x4e, 0x9c, 0xec, 0x40, 0x80, 0xc0, 0x48, 0x96, | 406 | {0x4e, 0x9c, 0xec, 0x40, 0x80, 0xc0, 0x48, 0x96, |
410 | 0xd9}, | 407 | 0xd9}, |
411 | .data4 = | ||
412 | {0x66, 0x00, 0xa8, 0xa8}, | ||
413 | .data5 = | 408 | .data5 = |
414 | {0x0c, 0x03, 0xab, 0x29, 0x81, 0x69}, | 409 | {0x0c, 0x03, 0xab, 0x29, 0x81, 0x69}, |
415 | .stream = | 410 | .stream = |
@@ -432,8 +427,6 @@ static const struct additional_sensor_data sensor_data[] = { | |||
432 | .data3 = | 427 | .data3 = |
433 | {0x60, 0xa8, 0xe0, 0x60, 0xa8, 0xe0, 0x60, 0xa8, | 428 | {0x60, 0xa8, 0xe0, 0x60, 0xa8, 0xe0, 0x60, 0xa8, |
434 | 0xe0}, | 429 | 0xe0}, |
435 | .data4 = /* Freq (50/60Hz). Splitted for test purpose */ | ||
436 | {0x66, 0x00, 0xa8, 0xe8}, | ||
437 | .data5 = | 430 | .data5 = |
438 | {0x0c, 0x03, 0xab, 0x10, 0x81, 0x20}, | 431 | {0x0c, 0x03, 0xab, 0x10, 0x81, 0x20}, |
439 | .stream = | 432 | .stream = |
@@ -452,7 +445,6 @@ static const struct additional_sensor_data sensor_data[] = { | |||
452 | 0xff}, | 445 | 0xff}, |
453 | .data3 = {0x40, 0x80, 0xc0, 0x50, 0xa0, 0xf0, 0x53, 0xa6, | 446 | .data3 = {0x40, 0x80, 0xc0, 0x50, 0xa0, 0xf0, 0x53, 0xa6, |
454 | 0xff}, | 447 | 0xff}, |
455 | .data4 = {0x66, 0x41, 0xa8, 0xf0}, | ||
456 | .data5 = {0x0c, 0x03, 0xab, 0x4b, 0x81, 0x2b}, | 448 | .data5 = {0x0c, 0x03, 0xab, 0x4b, 0x81, 0x2b}, |
457 | .stream = {0x0b, 0x04, 0x0a, 0x28}, | 449 | .stream = {0x0b, 0x04, 0x0a, 0x28}, |
458 | }, | 450 | }, |
@@ -800,6 +792,38 @@ static void setsharpness(struct gspca_dev *gspca_dev) | |||
800 | reg_w(gspca_dev, reg_to_write); | 792 | reg_w(gspca_dev, reg_to_write); |
801 | } | 793 | } |
802 | 794 | ||
795 | static void setfreq(struct gspca_dev *gspca_dev) | ||
796 | { | ||
797 | struct sd *sd = (struct sd *) gspca_dev; | ||
798 | u8 reg66; | ||
799 | u8 freq[4] = { 0x66, 0x00, 0xa8, 0xe8 }; | ||
800 | |||
801 | switch (sd->sensor) { | ||
802 | case SENSOR_LT168G: | ||
803 | if (sd->freq != 0) | ||
804 | freq[3] = 0xa8; | ||
805 | reg66 = 0x41; | ||
806 | break; | ||
807 | case SENSOR_OM6802: | ||
808 | reg66 = 0xca; | ||
809 | break; | ||
810 | default: | ||
811 | reg66 = 0x40; | ||
812 | break; | ||
813 | } | ||
814 | switch (sd->freq) { | ||
815 | case 0: /* no flicker */ | ||
816 | freq[3] = 0xf0; | ||
817 | break; | ||
818 | case 2: /* 60Hz */ | ||
819 | reg66 &= ~0x40; | ||
820 | break; | ||
821 | } | ||
822 | freq[1] = reg66; | ||
823 | |||
824 | reg_w_buf(gspca_dev, freq, sizeof freq); | ||
825 | } | ||
826 | |||
803 | /* this function is called at probe and resume time */ | 827 | /* this function is called at probe and resume time */ |
804 | static int sd_init(struct gspca_dev *gspca_dev) | 828 | static int sd_init(struct gspca_dev *gspca_dev) |
805 | { | 829 | { |
@@ -895,6 +919,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
895 | setcolors(gspca_dev); | 919 | setcolors(gspca_dev); |
896 | setsharpness(gspca_dev); | 920 | setsharpness(gspca_dev); |
897 | setawb(gspca_dev); | 921 | setawb(gspca_dev); |
922 | setfreq(gspca_dev); | ||
898 | 923 | ||
899 | reg_w(gspca_dev, 0x2087); /* tied to white balance? */ | 924 | reg_w(gspca_dev, 0x2087); /* tied to white balance? */ |
900 | reg_w(gspca_dev, 0x2088); | 925 | reg_w(gspca_dev, 0x2088); |
@@ -949,17 +974,6 @@ static void seteffect(struct gspca_dev *gspca_dev) | |||
949 | reg_w(gspca_dev, 0xfaa6); | 974 | reg_w(gspca_dev, 0xfaa6); |
950 | } | 975 | } |
951 | 976 | ||
952 | static void setlightfreq(struct gspca_dev *gspca_dev) | ||
953 | { | ||
954 | struct sd *sd = (struct sd *) gspca_dev; | ||
955 | u8 freq[4] = { 0x66, 0x40, 0xa8, 0xe8 }; | ||
956 | |||
957 | if (sd->freq == 2) /* 60hz */ | ||
958 | freq[1] = 0x00; | ||
959 | |||
960 | reg_w_buf(gspca_dev, freq, sizeof freq); | ||
961 | } | ||
962 | |||
963 | /* Is this really needed? | 977 | /* Is this really needed? |
964 | * i added some module parameters for test with some users */ | 978 | * i added some module parameters for test with some users */ |
965 | static void poll_sensor(struct gspca_dev *gspca_dev) | 979 | static void poll_sensor(struct gspca_dev *gspca_dev) |
@@ -1035,7 +1049,7 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
1035 | break; | 1049 | break; |
1036 | } | 1050 | } |
1037 | sensor = &sensor_data[sd->sensor]; | 1051 | sensor = &sensor_data[sd->sensor]; |
1038 | reg_w_buf(gspca_dev, sensor->data4, sizeof sensor->data4); | 1052 | setfreq(gspca_dev); |
1039 | reg_r(gspca_dev, 0x0012); | 1053 | reg_r(gspca_dev, 0x0012); |
1040 | reg_w_buf(gspca_dev, t2, sizeof t2); | 1054 | reg_w_buf(gspca_dev, t2, sizeof t2); |
1041 | reg_w_ixbuf(gspca_dev, 0xb3, t3, sizeof t3); | 1055 | reg_w_ixbuf(gspca_dev, 0xb3, t3, sizeof t3); |