1 /***************************************************************************
2 * Plug-in for PB-0330 image sensor connected to the ZC0301P Image *
3 * Processor and Control Chip *
5 * Copyright (C) 2006-2007 by Luca Risolia <luca.risolia@studio.unibo.it> *
7 * Initialization values of the ZC0301[P] have been taken from the SPCA5XX *
8 * driver maintained by Michel Xhaard <mxhaard@magic.fr> *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 * This program is distributed in the hope that it will be useful, *
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
18 * GNU General Public License for more details. *
20 * You should have received a copy of the GNU General Public License *
21 * along with this program; if not, write to the Free Software *
22 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
23 ***************************************************************************/
25 #include <linux/delay.h>
26 #include "zc0301_sensor.h"
29 static struct zc0301_sensor pb0330
;
32 static int pb0330_init(struct zc0301_device
* cam
)
36 err
+= zc0301_write_reg(cam
, 0x0000, 0x01);
37 err
+= zc0301_write_reg(cam
, 0x0008, 0x03);
38 err
+= zc0301_write_reg(cam
, 0x0010, 0x0A);
39 err
+= zc0301_write_reg(cam
, 0x0002, 0x00);
40 err
+= zc0301_write_reg(cam
, 0x0003, 0x02);
41 err
+= zc0301_write_reg(cam
, 0x0004, 0x80);
42 err
+= zc0301_write_reg(cam
, 0x0005, 0x01);
43 err
+= zc0301_write_reg(cam
, 0x0006, 0xE0);
44 err
+= zc0301_write_reg(cam
, 0x0001, 0x01);
45 err
+= zc0301_write_reg(cam
, 0x0012, 0x05);
46 err
+= zc0301_write_reg(cam
, 0x0012, 0x07);
47 err
+= zc0301_write_reg(cam
, 0x0098, 0x00);
48 err
+= zc0301_write_reg(cam
, 0x009A, 0x00);
49 err
+= zc0301_write_reg(cam
, 0x011A, 0x00);
50 err
+= zc0301_write_reg(cam
, 0x011C, 0x00);
51 err
+= zc0301_write_reg(cam
, 0x0012, 0x05);
53 err
+= zc0301_i2c_write(cam
, 0x01, 0x0006);
54 err
+= zc0301_i2c_write(cam
, 0x02, 0x0011);
55 err
+= zc0301_i2c_write(cam
, 0x03, 0x01E7);
56 err
+= zc0301_i2c_write(cam
, 0x04, 0x0287);
57 err
+= zc0301_i2c_write(cam
, 0x06, 0x0003);
58 err
+= zc0301_i2c_write(cam
, 0x07, 0x3002);
59 err
+= zc0301_i2c_write(cam
, 0x20, 0x1100);
60 err
+= zc0301_i2c_write(cam
, 0x2F, 0xF7B0);
61 err
+= zc0301_i2c_write(cam
, 0x30, 0x0005);
62 err
+= zc0301_i2c_write(cam
, 0x31, 0x0000);
63 err
+= zc0301_i2c_write(cam
, 0x34, 0x0100);
64 err
+= zc0301_i2c_write(cam
, 0x35, 0x0060);
65 err
+= zc0301_i2c_write(cam
, 0x3D, 0x068F);
66 err
+= zc0301_i2c_write(cam
, 0x40, 0x01E0);
67 err
+= zc0301_i2c_write(cam
, 0x58, 0x0078);
68 err
+= zc0301_i2c_write(cam
, 0x62, 0x0411);
70 err
+= zc0301_write_reg(cam
, 0x0087, 0x10);
71 err
+= zc0301_write_reg(cam
, 0x0101, 0x37);
72 err
+= zc0301_write_reg(cam
, 0x0012, 0x05);
73 err
+= zc0301_write_reg(cam
, 0x0100, 0x0D);
74 err
+= zc0301_write_reg(cam
, 0x0189, 0x06);
75 err
+= zc0301_write_reg(cam
, 0x01AD, 0x00);
76 err
+= zc0301_write_reg(cam
, 0x01C5, 0x03);
77 err
+= zc0301_write_reg(cam
, 0x01CB, 0x13);
78 err
+= zc0301_write_reg(cam
, 0x0250, 0x08);
79 err
+= zc0301_write_reg(cam
, 0x0301, 0x08);
80 err
+= zc0301_write_reg(cam
, 0x01A8, 0x60);
81 err
+= zc0301_write_reg(cam
, 0x018D, 0x6C);
82 err
+= zc0301_write_reg(cam
, 0x01AD, 0x09);
83 err
+= zc0301_write_reg(cam
, 0x01AE, 0x15);
84 err
+= zc0301_write_reg(cam
, 0x010A, 0x50);
85 err
+= zc0301_write_reg(cam
, 0x010B, 0xF8);
86 err
+= zc0301_write_reg(cam
, 0x010C, 0xF8);
87 err
+= zc0301_write_reg(cam
, 0x010D, 0xF8);
88 err
+= zc0301_write_reg(cam
, 0x010E, 0x50);
89 err
+= zc0301_write_reg(cam
, 0x010F, 0xF8);
90 err
+= zc0301_write_reg(cam
, 0x0110, 0xF8);
91 err
+= zc0301_write_reg(cam
, 0x0111, 0xF8);
92 err
+= zc0301_write_reg(cam
, 0x0112, 0x50);
93 err
+= zc0301_write_reg(cam
, 0x0008, 0x03);
94 err
+= zc0301_write_reg(cam
, 0x01C6, 0x08);
95 err
+= zc0301_write_reg(cam
, 0x01CB, 0x0F);
96 err
+= zc0301_write_reg(cam
, 0x010A, 0x50);
97 err
+= zc0301_write_reg(cam
, 0x010B, 0xF8);
98 err
+= zc0301_write_reg(cam
, 0x010C, 0xF8);
99 err
+= zc0301_write_reg(cam
, 0x010D, 0xF8);
100 err
+= zc0301_write_reg(cam
, 0x010E, 0x50);
101 err
+= zc0301_write_reg(cam
, 0x010F, 0xF8);
102 err
+= zc0301_write_reg(cam
, 0x0110, 0xF8);
103 err
+= zc0301_write_reg(cam
, 0x0111, 0xF8);
104 err
+= zc0301_write_reg(cam
, 0x0112, 0x50);
105 err
+= zc0301_write_reg(cam
, 0x0180, 0x00);
106 err
+= zc0301_write_reg(cam
, 0x0019, 0x00);
108 err
+= zc0301_i2c_write(cam
, 0x05, 0x0066);
109 err
+= zc0301_i2c_write(cam
, 0x09, 0x02B2);
110 err
+= zc0301_i2c_write(cam
, 0x10, 0x0002);
112 err
+= zc0301_write_reg(cam
, 0x011D, 0x60);
113 err
+= zc0301_write_reg(cam
, 0x0190, 0x00);
114 err
+= zc0301_write_reg(cam
, 0x0191, 0x07);
115 err
+= zc0301_write_reg(cam
, 0x0192, 0x8C);
116 err
+= zc0301_write_reg(cam
, 0x0195, 0x00);
117 err
+= zc0301_write_reg(cam
, 0x0196, 0x00);
118 err
+= zc0301_write_reg(cam
, 0x0197, 0x8A);
119 err
+= zc0301_write_reg(cam
, 0x018C, 0x10);
120 err
+= zc0301_write_reg(cam
, 0x018F, 0x20);
121 err
+= zc0301_write_reg(cam
, 0x01A9, 0x14);
122 err
+= zc0301_write_reg(cam
, 0x01AA, 0x24);
123 err
+= zc0301_write_reg(cam
, 0x001D, 0xD7);
124 err
+= zc0301_write_reg(cam
, 0x001E, 0xF0);
125 err
+= zc0301_write_reg(cam
, 0x001F, 0xF8);
126 err
+= zc0301_write_reg(cam
, 0x0020, 0xFF);
127 err
+= zc0301_write_reg(cam
, 0x01AD, 0x09);
128 err
+= zc0301_write_reg(cam
, 0x01AE, 0x15);
129 err
+= zc0301_write_reg(cam
, 0x0180, 0x40);
130 err
+= zc0301_write_reg(cam
, 0x0180, 0x42);
138 static struct zc0301_sensor pb0330
= {
140 .init
= &pb0330_init
,
158 .pixelformat
= V4L2_PIX_FMT_JPEG
,
164 int zc0301_probe_pb0330(struct zc0301_device
* cam
)
168 err
+= zc0301_write_reg(cam
, 0x0000, 0x01);
169 err
+= zc0301_write_reg(cam
, 0x0010, 0x0a);
170 err
+= zc0301_write_reg(cam
, 0x0001, 0x01);
171 err
+= zc0301_write_reg(cam
, 0x0012, 0x03);
172 err
+= zc0301_write_reg(cam
, 0x0012, 0x01);
176 r0
= zc0301_i2c_read(cam
, 0x00, 2);
184 zc0301_attach_sensor(cam
, &pb0330
);