aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/m5602/m5602_ov7660.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/m5602/m5602_ov7660.c')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_ov7660.c92
1 files changed, 92 insertions, 0 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_ov7660.c b/drivers/media/video/gspca/m5602/m5602_ov7660.c
new file mode 100644
index 000000000000..466de667a60d
--- /dev/null
+++ b/drivers/media/video/gspca/m5602/m5602_ov7660.c
@@ -0,0 +1,92 @@
1/*
2 * Driver for the ov7660 sensor
3 *
4 * Copyright (C) 2009 Erik Andrén
5 * Copyright (C) 2007 Ilyes Gouta. Based on the m5603x Linux Driver Project.
6 * Copyright (C) 2005 m5603x Linux Driver Project <m5602@x3ng.com.br>
7 *
8 * Portions of code to USB interface and ALi driver software,
9 * Copyright (c) 2006 Willem Duinker
10 * v4l2 interface modeled after the V4L2 driver
11 * for SN9C10x PC Camera Controllers
12 *
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License as
15 * published by the Free Software Foundation, version 2.
16 *
17 */
18
19#include "m5602_ov7660.h"
20
21const static struct ctrl ov7660_ctrls[] = {};
22
23static struct v4l2_pix_format ov7660_modes[] = {
24 {
25 640,
26 480,
27 V4L2_PIX_FMT_SBGGR8,
28 V4L2_FIELD_NONE,
29 .sizeimage =
30 640 * 480,
31 .bytesperline = 640,
32 .colorspace = V4L2_COLORSPACE_SRGB,
33 .priv = 0
34 }
35};
36
37static void ov7660_dump_registers(struct sd *sd);
38
39int ov7660_probe(struct sd *sd)
40{
41 return -ENODEV;
42}
43
44int ov7660_init(struct sd *sd)
45{
46 return 0;
47}
48
49int ov7660_start(struct sd *sd)
50{
51 return 0;
52}
53
54int ov7660_stop(struct sd *sd)
55{
56 return 0;
57}
58
59void ov7660_disconnect(struct sd *sd) {}
60
61static void ov7660_dump_registers(struct sd *sd)
62{
63 int address;
64 info("Dumping the ov7660 register state");
65 for (address = 0; address < 0xa9; address++) {
66 u8 value;
67 m5602_read_sensor(sd, address, &value, 1);
68 info("register 0x%x contains 0x%x",
69 address, value);
70 }
71
72 info("ov7660 register state dump complete");
73
74 info("Probing for which registers that are read/write");
75 for (address = 0; address < 0xff; address++) {
76 u8 old_value, ctrl_value;
77 u8 test_value[2] = {0xff, 0xff};
78
79 m5602_read_sensor(sd, address, &old_value, 1);
80 m5602_write_sensor(sd, address, test_value, 1);
81 m5602_read_sensor(sd, address, &ctrl_value, 1);
82
83 if (ctrl_value == test_value[0])
84 info("register 0x%x is writeable", address);
85 else
86 info("register 0x%x is read only", address);
87
88 /* Restore original value */
89 m5602_write_sensor(sd, address, &old_value, 1);
90 }
91}
92