aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2009-11-14 07:45:38 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-12-05 15:42:06 -0500
commit569691a5a0fe844e36890e49833130e665868136 (patch)
treefdff1853b7c572bd73096ceb9f99a76b6b8a0def /drivers/media
parentb8415f5314ce0b190b5963d2180441cd862efa26 (diff)
V4L/DVB (13487): gspca - ov534: Add svga, xga and sxga modes for ov965x.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/gspca/ov534.c299
1 files changed, 262 insertions, 37 deletions
diff --git a/drivers/media/video/gspca/ov534.c b/drivers/media/video/gspca/ov534.c
index 193129a59ab7..4f0f60ebd6c7 100644
--- a/drivers/media/video/gspca/ov534.c
+++ b/drivers/media/video/gspca/ov534.c
@@ -274,7 +274,7 @@ static struct ctrl sd_ctrls_ov772x[] = {
274static struct ctrl sd_ctrls_ov965x[] = { 274static struct ctrl sd_ctrls_ov965x[] = {
275}; 275};
276 276
277static const struct v4l2_pix_format vga_yuyv_mode[] = { 277static const struct v4l2_pix_format ov772x_mode[] = {
278 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE, 278 {320, 240, V4L2_PIX_FMT_YUYV, V4L2_FIELD_NONE,
279 .bytesperline = 320 * 2, 279 .bytesperline = 320 * 2,
280 .sizeimage = 320 * 240 * 2, 280 .sizeimage = 320 * 240 * 2,
@@ -287,16 +287,31 @@ static const struct v4l2_pix_format vga_yuyv_mode[] = {
287 .priv = 0}, 287 .priv = 0},
288}; 288};
289 289
290static const struct v4l2_pix_format vga_jpeg_mode[] = { 290static const struct v4l2_pix_format ov965x_mode[] = {
291 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, 291 {320, 240, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
292 .bytesperline = 320, 292 .bytesperline = 320,
293 .sizeimage = 320 * 240 * 3 / 8 + 590, 293 .sizeimage = 320 * 240 * 3 / 8 + 590,
294 .colorspace = V4L2_COLORSPACE_JPEG, 294 .colorspace = V4L2_COLORSPACE_JPEG,
295 .priv = 1}, 295 .priv = 4},
296 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE, 296 {640, 480, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
297 .bytesperline = 640, 297 .bytesperline = 640,
298 .sizeimage = 640 * 480 * 3 / 8 + 590, 298 .sizeimage = 640 * 480 * 3 / 8 + 590,
299 .colorspace = V4L2_COLORSPACE_JPEG, 299 .colorspace = V4L2_COLORSPACE_JPEG,
300 .priv = 3},
301 {800, 600, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
302 .bytesperline = 800,
303 .sizeimage = 800 * 600 * 3 / 8 + 590,
304 .colorspace = V4L2_COLORSPACE_JPEG,
305 .priv = 2},
306 {1024, 768, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
307 .bytesperline = 1024,
308 .sizeimage = 1024 * 768 * 3 / 8 + 590,
309 .colorspace = V4L2_COLORSPACE_JPEG,
310 .priv = 1},
311 {1280, 1024, V4L2_PIX_FMT_JPEG, V4L2_FIELD_NONE,
312 .bytesperline = 1280,
313 .sizeimage = 1280 * 1024 * 3 / 8 + 590,
314 .colorspace = V4L2_COLORSPACE_JPEG,
300 .priv = 0}, 315 .priv = 0},
301}; 316};
302static const u8 bridge_init_ov772x[][2] = { 317static const u8 bridge_init_ov772x[][2] = {
@@ -773,7 +788,7 @@ static const u8 sensor_init_ov965x_2[][2] = {
773 {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ 788 {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */
774}; 789};
775 790
776static const u8 sensor_start_ov965x[][2] = { 791static const u8 sensor_start_ov965x_1_vga[][2] = { /* same for qvga */
777 {0x12, 0x62}, /* com7 - 30fps VGA YUV */ 792 {0x12, 0x62}, /* com7 - 30fps VGA YUV */
778 {0x36, 0xfa}, /* aref3 */ 793 {0x36, 0xfa}, /* aref3 */
779 {0x69, 0x0a}, /* hv */ 794 {0x69, 0x0a}, /* hv */
@@ -797,7 +812,78 @@ static const u8 sensor_start_ov965x[][2] = {
797 {} 812 {}
798}; 813};
799 814
800static const u8 bridge_start_ov965x[][2] = { 815static const u8 sensor_start_ov965x_1_svga[][2] = {
816 {0x12, 0x02}, /* com7 - YUYV - VGA 15 full resolution */
817 {0x36, 0xf8}, /* aref3 */
818 {0x69, 0x02}, /* hv */
819 {0x8c, 0x0d}, /* com22 */
820 {0x3e, 0x0c}, /* com14 */
821 {0x41, 0x40}, /* com16 */
822 {0x72, 0x00},
823 {0x73, 0x01},
824 {0x74, 0x3a},
825 {0x75, 0x35},
826 {0x76, 0x01},
827 {0xc7, 0x80}, /* com24 */
828 {0x03, 0x1b}, /* vref */
829 {0x17, 0x1d}, /* hstart */
830 {0x18, 0xbd}, /* hstop */
831 {0x19, 0x01}, /* vstrt */
832 {0x1a, 0x81}, /* vstop */
833 {0x32, 0xff}, /* href */
834 {0xc0, 0xe2},
835 {}
836};
837
838static const u8 sensor_start_ov965x_1_xga[][2] = {
839 {0x12, 0x02}, /* com7 */
840 {0x36, 0xf8}, /* aref3 */
841 {0x69, 0x02}, /* hv */
842 {0x8c, 0x89}, /* com22 */
843 {0x14, 0x28}, /* com9 */
844 {0x3e, 0x0c}, /* com14 */
845 {0x41, 0x40}, /* com16 */
846 {0x72, 0x00},
847 {0x73, 0x01},
848 {0x74, 0x3a},
849 {0x75, 0x35},
850 {0x76, 0x01},
851 {0xc7, 0x80}, /* com24 */
852 {0x03, 0x1b}, /* vref */
853 {0x17, 0x1d}, /* hstart */
854 {0x18, 0xbd}, /* hstop */
855 {0x19, 0x01}, /* vstrt */
856 {0x1a, 0x81}, /* vstop */
857 {0x32, 0xff}, /* href */
858 {0xc0, 0xe2},
859 {}
860};
861
862static const u8 sensor_start_ov965x_1_sxga[][2] = {
863 {0x12, 0x02}, /* com7 */
864 {0x36, 0xf8}, /* aref3 */
865 {0x69, 0x02}, /* hv */
866 {0x8c, 0x89}, /* com22 */
867 {0x14, 0x28}, /* com9 */
868 {0x3e, 0x0c}, /* com14 */
869 {0x41, 0x40}, /* com16 */
870 {0x72, 0x00},
871 {0x73, 0x01},
872 {0x74, 0x3a},
873 {0x75, 0x35},
874 {0x76, 0x01},
875 {0xc7, 0x80}, /* com24 */
876 {0x03, 0x1b}, /* vref */
877 {0x17, 0x1d}, /* hstart */
878 {0x18, 0x02}, /* hstop */
879 {0x19, 0x01}, /* vstrt */
880 {0x1a, 0x81}, /* vstop */
881 {0x32, 0xff}, /* href */
882 {0xc0, 0xe2},
883 {}
884};
885
886static const u8 bridge_start_ov965x_qvga[][2] = {
801 {0x94, 0xaa}, 887 {0x94, 0xaa},
802 {0xf1, 0x60}, 888 {0xf1, 0x60},
803 {0xe5, 0x04}, 889 {0xe5, 0x04},
@@ -806,10 +892,35 @@ static const u8 bridge_start_ov965x[][2] = {
806 {0x8c, 0x00}, 892 {0x8c, 0x00},
807 {0x8d, 0x1c}, 893 {0x8d, 0x1c},
808 {0x34, 0x05}, 894 {0x34, 0x05},
895
896 {0xc2, 0x4c},
897 {0xc3, 0xf9},
898 {0xda, 0x00},
899 {0x50, 0x00},
900 {0x51, 0xa0},
901 {0x52, 0x78},
902 {0x53, 0x00},
903 {0x54, 0x00},
904 {0x55, 0x00},
905 {0x57, 0x00},
906 {0x5c, 0x00},
907 {0x5a, 0x50},
908 {0x5b, 0x3c},
909 {0x35, 0x02},
910 {0xd9, 0x10},
911 {0x94, 0x11},
809 {} 912 {}
810}; 913};
811 914
812static const u8 bridge_start_ov965x_vga[][2] = { 915static const u8 bridge_start_ov965x_vga[][2] = {
916 {0x94, 0xaa},
917 {0xf1, 0x60},
918 {0xe5, 0x04},
919 {0xc0, 0x50},
920 {0xc1, 0x3c},
921 {0x8c, 0x00},
922 {0x8d, 0x1c},
923 {0x34, 0x05},
813 {0xc2, 0x0c}, 924 {0xc2, 0x0c},
814 {0xc3, 0xf9}, 925 {0xc3, 0xf9},
815 {0xda, 0x01}, 926 {0xda, 0x01},
@@ -829,27 +940,101 @@ static const u8 bridge_start_ov965x_vga[][2] = {
829 {} 940 {}
830}; 941};
831 942
832static const u8 bridge_start_ov965x_qvga[][2] = { 943static const u8 bridge_start_ov965x_svga[][2] = {
944 {0x94, 0xaa},
945 {0xf1, 0x60},
946 {0xe5, 0x04},
947 {0xc0, 0xa0},
948 {0xc1, 0x80},
949 {0x8c, 0x00},
950 {0x8d, 0x1c},
951 {0x34, 0x05},
952
833 {0xc2, 0x4c}, 953 {0xc2, 0x4c},
834 {0xc3, 0xf9}, 954 {0xc3, 0xf9},
835 {0xda, 0x00},
836 {0x50, 0x00}, 955 {0x50, 0x00},
837 {0x51, 0xa0}, 956 {0x51, 0x40},
838 {0x52, 0x78}, 957 {0x52, 0x00},
839 {0x53, 0x00}, 958 {0x53, 0x00},
840 {0x54, 0x00}, 959 {0x54, 0x00},
841 {0x55, 0x00}, 960 {0x55, 0x88},
842 {0x57, 0x00}, 961 {0x57, 0x00},
843 {0x5c, 0x00}, 962 {0x5c, 0x00},
844 {0x5a, 0x50}, 963 {0x5a, 0xc8},
845 {0x5b, 0x3c}, 964 {0x5b, 0x96},
965 {0x35, 0x02},
966 {0xd9, 0x10},
967 {0xda, 0x00},
968 {0x94, 0x11},
969 {}
970};
971
972static const u8 bridge_start_ov965x_xga[][2] = {
973 {0x94, 0xaa},
974 {0xf1, 0x60},
975 {0xe5, 0x04},
976 {0xc0, 0xa0},
977 {0xc1, 0x80},
978 {0x8c, 0x00},
979 {0x8d, 0x1c},
980 {0x34, 0x05},
981 {0xc2, 0x4c},
982 {0xc3, 0xf9},
983 {0x50, 0x00},
984 {0x51, 0x40},
985 {0x52, 0x00},
986 {0x53, 0x00},
987 {0x54, 0x00},
988 {0x55, 0x88},
989 {0x57, 0x00},
990 {0x5c, 0x01},
991 {0x5a, 0x00},
992 {0x5b, 0xc0},
846 {0x35, 0x02}, 993 {0x35, 0x02},
847 {0xd9, 0x10}, 994 {0xd9, 0x10},
995 {0xda, 0x01},
848 {0x94, 0x11}, 996 {0x94, 0x11},
849 {} 997 {}
850}; 998};
851 999
852static const u8 sensor_start_ov965x_vga[][2] = { 1000static const u8 bridge_start_ov965x_sxga[][2] = {
1001 {0x94, 0xaa},
1002 {0xf1, 0x60},
1003 {0xe5, 0x04},
1004 {0xc0, 0xa0},
1005 {0xc1, 0x80},
1006 {0x8c, 0x00},
1007 {0x8d, 0x1c},
1008 {0x34, 0x05},
1009 {0xc2, 0x0c},
1010 {0xc3, 0xf9},
1011 {0xda, 0x00},
1012 {0x35, 0x02},
1013 {0xd9, 0x10},
1014 {0x94, 0x11},
1015 {}
1016};
1017
1018static const u8 sensor_start_ov965x_2_qvga[][2] = {
1019 {0x3b, 0xe4}, /* com11 - night mode 1/4 frame rate */
1020 {0x1e, 0x04}, /* mvfp */
1021 {0x13, 0xe0}, /* com8 */
1022 {0x00, 0x00},
1023 {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */
1024 {0x11, 0x01}, /* clkrc */
1025 {0x6b, 0x5a}, /* dblv */
1026 {0x6a, 0x02}, /* 50 Hz banding filter */
1027 {0xc5, 0x03}, /* 60 Hz banding filter */
1028 {0xa2, 0x96}, /* bd50 */
1029 {0xa3, 0x7d}, /* bd60 */
1030
1031 {0xff, 0x13}, /* read 13, write ff 00 */
1032 {0x13, 0xe7},
1033 {0x3a, 0x80}, /* tslb - yuyv */
1034 {}
1035};
1036
1037static const u8 sensor_start_ov965x_2_vga[][2] = {
853 {0x3b, 0xc4}, /* com11 - night mode 1/4 frame rate */ 1038 {0x3b, 0xc4}, /* com11 - night mode 1/4 frame rate */
854 {0x1e, 0x04}, /* mvfp */ 1039 {0x1e, 0x04}, /* mvfp */
855 {0x13, 0xe0}, /* com8 */ 1040 {0x13, 0xe0}, /* com8 */
@@ -866,22 +1051,35 @@ static const u8 sensor_start_ov965x_vga[][2] = {
866 {} 1051 {}
867}; 1052};
868 1053
869static const u8 sensor_start_ov965x_qvga[][2] = { 1054static const u8 sensor_start_ov965x_2_svga[][2] = { /* same for xga */
870 {0x3b, 0xe4}, /* com11 - night mode 1/4 frame rate */ 1055 {0x3b, 0xc4}, /* com11 - night mode 1/4 frame rate */
871 {0x1e, 0x04}, /* mvfp */ 1056 {0x1e, 0x04}, /* mvfp */
872 {0x13, 0xe0}, /* com8 */ 1057 {0x13, 0xe0}, /* com8 */
873 {0x00, 0x00}, 1058 {0x00, 0x00},
874 {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */ 1059 {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */
875 {0x11, 0x01}, /* clkrc */ 1060 {0x11, 0x01}, /* clkrc */
876 {0x6b, 0x5a}, /* dblv */ 1061 {0x6b, 0x5a}, /* dblv */
877 {0x6a, 0x02}, /* 50 Hz banding filter */ 1062 {0x6a, 0x0c}, /* 50 Hz banding filter */
878 {0xc5, 0x03}, /* 60 Hz banding filter */ 1063 {0xc5, 0x0f}, /* 60 Hz banding filter */
879 {0xa2, 0x96}, /* bd50 */ 1064 {0xa2, 0x4e}, /* bd50 */
880 {0xa3, 0x7d}, /* bd60 */ 1065 {0xa3, 0x41}, /* bd60 */
1066 {0x2d, 0x00}, /* advfl */
1067 {}
1068};
881 1069
882 {0xff, 0x13}, /* read 13, write ff 00 */ 1070static const u8 sensor_start_ov965x_2_sxga[][2] = {
883 {0x13, 0xe7}, 1071 {0x13, 0xe0}, /* com8 */
884 {0x3a, 0x80}, /* tslb - yuyv */ 1072 {0x00, 0x00},
1073 {0x13, 0xe7}, /* com8 - everything (AGC, AWB and AEC) */
1074 {0x3b, 0xc4}, /* com11 - night mode 1/4 frame rate */
1075 {0x1e, 0x04}, /* mvfp */
1076 {0x11, 0x01}, /* clkrc */
1077 {0x6b, 0x5a}, /* dblv */
1078 {0x6a, 0x0c}, /* 50 Hz banding filter */
1079 {0xc5, 0x0f}, /* 60 Hz banding filter */
1080 {0xa2, 0x4e}, /* bd50 */
1081 {0xa3, 0x41}, /* bd60 */
1082 {0x2d, 0x00}, /* advfl */
885 {} 1083 {}
886}; 1084};
887 1085
@@ -1216,15 +1414,15 @@ static int sd_config(struct gspca_dev *gspca_dev,
1216 cam = &gspca_dev->cam; 1414 cam = &gspca_dev->cam;
1217 1415
1218 if (sd->sensor == SENSOR_OV772X) { 1416 if (sd->sensor == SENSOR_OV772X) {
1219 cam->cam_mode = vga_yuyv_mode; 1417 cam->cam_mode = ov772x_mode;
1220 cam->nmodes = ARRAY_SIZE(vga_yuyv_mode); 1418 cam->nmodes = ARRAY_SIZE(ov772x_mode);
1221 1419
1222 cam->bulk = 1; 1420 cam->bulk = 1;
1223 cam->bulk_size = 16384; 1421 cam->bulk_size = 16384;
1224 cam->bulk_nurbs = 2; 1422 cam->bulk_nurbs = 2;
1225 } else { /* ov965x */ 1423 } else { /* ov965x */
1226 cam->cam_mode = vga_jpeg_mode; 1424 cam->cam_mode = ov965x_mode;
1227 cam->nmodes = ARRAY_SIZE(vga_jpeg_mode); 1425 cam->nmodes = ARRAY_SIZE(ov965x_mode);
1228 } 1426 }
1229 1427
1230 sd->frame_rate = 30; 1428 sd->frame_rate = 30;
@@ -1355,22 +1553,49 @@ static int sd_start_ov965x(struct gspca_dev *gspca_dev)
1355{ 1553{
1356 int mode; 1554 int mode;
1357 1555
1358 sccb_w_array(gspca_dev, sensor_start_ov965x,
1359 ARRAY_SIZE(sensor_start_ov965x));
1360 reg_w_array(gspca_dev, bridge_start_ov965x,
1361 ARRAY_SIZE(bridge_start_ov965x));
1362
1363 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; 1556 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
1364 if (mode != 0) { /* 320x240 */ 1557 switch (mode) {
1558 default:
1559/* case 4: * 320x240 */
1560 sccb_w_array(gspca_dev, sensor_start_ov965x_1_vga,
1561 ARRAY_SIZE(sensor_start_ov965x_1_vga));
1365 reg_w_array(gspca_dev, bridge_start_ov965x_qvga, 1562 reg_w_array(gspca_dev, bridge_start_ov965x_qvga,
1366 ARRAY_SIZE(bridge_start_ov965x_qvga)); 1563 ARRAY_SIZE(bridge_start_ov965x_qvga));
1367 sccb_w_array(gspca_dev, sensor_start_ov965x_qvga, 1564 sccb_w_array(gspca_dev, sensor_start_ov965x_2_qvga,
1368 ARRAY_SIZE(sensor_start_ov965x_qvga)); 1565 ARRAY_SIZE(sensor_start_ov965x_2_qvga));
1369 } else { /* 640x480 */ 1566 break;
1567 case 3: /* 640x480 */
1568 sccb_w_array(gspca_dev, sensor_start_ov965x_1_vga,
1569 ARRAY_SIZE(sensor_start_ov965x_1_vga));
1370 reg_w_array(gspca_dev, bridge_start_ov965x_vga, 1570 reg_w_array(gspca_dev, bridge_start_ov965x_vga,
1371 ARRAY_SIZE(bridge_start_ov965x_vga)); 1571 ARRAY_SIZE(bridge_start_ov965x_vga));
1372 sccb_w_array(gspca_dev, sensor_start_ov965x_vga, 1572 sccb_w_array(gspca_dev, sensor_start_ov965x_2_vga,
1373 ARRAY_SIZE(sensor_start_ov965x_vga)); 1573 ARRAY_SIZE(sensor_start_ov965x_2_vga));
1574 break;
1575 case 2: /* 800x600 */
1576 sccb_w_array(gspca_dev, sensor_start_ov965x_1_svga,
1577 ARRAY_SIZE(sensor_start_ov965x_1_svga));
1578 reg_w_array(gspca_dev, bridge_start_ov965x_svga,
1579 ARRAY_SIZE(bridge_start_ov965x_svga));
1580 sccb_w_array(gspca_dev, sensor_start_ov965x_2_svga,
1581 ARRAY_SIZE(sensor_start_ov965x_2_svga));
1582 break;
1583 case 1: /* 1024x768 */
1584 sccb_w_array(gspca_dev, sensor_start_ov965x_1_xga,
1585 ARRAY_SIZE(sensor_start_ov965x_1_xga));
1586 reg_w_array(gspca_dev, bridge_start_ov965x_xga,
1587 ARRAY_SIZE(bridge_start_ov965x_xga));
1588 sccb_w_array(gspca_dev, sensor_start_ov965x_2_svga,
1589 ARRAY_SIZE(sensor_start_ov965x_2_svga));
1590 break;
1591 case 0: /* 1280x1024 */
1592 sccb_w_array(gspca_dev, sensor_start_ov965x_1_sxga,
1593 ARRAY_SIZE(sensor_start_ov965x_1_sxga));
1594 reg_w_array(gspca_dev, bridge_start_ov965x_sxga,
1595 ARRAY_SIZE(bridge_start_ov965x_sxga));
1596 sccb_w_array(gspca_dev, sensor_start_ov965x_2_sxga,
1597 ARRAY_SIZE(sensor_start_ov965x_2_sxga));
1598 break;
1374 } 1599 }
1375 sccb_w_array(gspca_dev, sensor_start_ov965x_2, 1600 sccb_w_array(gspca_dev, sensor_start_ov965x_2,
1376 ARRAY_SIZE(sensor_start_ov965x_2)); 1601 ARRAY_SIZE(sensor_start_ov965x_2));