27 #include <linux/module.h>
28 #include <linux/types.h>
29 #include <linux/slab.h>
31 #include <asm/uaccess.h>
32 #include <linux/i2c.h>
33 #include <linux/videodev2.h>
50 unsigned char reg[128];
72 struct saa7185 *encoder = to_saa7185(sd);
80 const u8 *
data,
unsigned int len)
83 struct saa7185 *encoder = to_saa7185(sd);
96 block_data[block_len++] = reg = data[0];
98 block_data[block_len++] =
99 encoder->
reg[reg++] = data[1];
102 }
while (len >= 2 && data[0] == reg && block_len < 32);
111 ret = saa7185_write(sd, reg, *data++);
123 static const unsigned char init_common[] = {
200 static const unsigned char init_pal[] = {
210 static const unsigned char init_ntsc[] = {
223 struct saa7185 *encoder = to_saa7185(sd);
225 saa7185_write_block(sd, init_common,
sizeof(init_common));
227 saa7185_write_block(sd, init_ntsc,
sizeof(init_ntsc));
229 saa7185_write_block(sd, init_pal,
sizeof(init_pal));
235 struct saa7185 *encoder = to_saa7185(sd);
238 saa7185_write_block(sd, init_ntsc,
sizeof(init_ntsc));
240 saa7185_write_block(sd, init_pal,
sizeof(init_pal));
247 static int saa7185_s_routing(
struct v4l2_subdev *sd,
250 struct saa7185 *encoder = to_saa7185(sd);
258 saa7185_write(sd, 0x3a, 0x0f);
260 saa7185_write(sd, 0x61, (encoder->
reg[0x61] & 0xf7) | 0x08);
261 saa7185_write(sd, 0x6e, 0x01);
266 saa7185_write(sd, 0x3a, 0x0f);
268 saa7185_write(sd, 0x61, (encoder->
reg[0x61] & 0xf7) | 0x00);
270 saa7185_write(sd, 0x6e, 0x00);
275 saa7185_write(sd, 0x3a, 0x8f);
277 saa7185_write(sd, 0x61, (encoder->
reg[0x61] & 0xf7) | 0x08);
279 saa7185_write(sd, 0x6e, 0x01);
290 struct i2c_client *client = v4l2_get_subdevdata(sd);
298 .g_chip_ident = saa7185_g_chip_ident,
299 .init = saa7185_init,
303 .s_std_output = saa7185_s_std_output,
304 .s_routing = saa7185_s_routing,
308 .core = &saa7185_core_ops,
309 .video = &saa7185_video_ops,
315 static int saa7185_probe(
struct i2c_client *client,
326 v4l_info(client,
"chip found @ 0x%x (%s)\n",
336 i = saa7185_write_block(sd, init_common,
sizeof(init_common));
338 i = saa7185_write_block(sd, init_ntsc,
sizeof(init_ntsc));
343 saa7185_read(sd) >> 5);
347 static int saa7185_remove(
struct i2c_client *client)
349 struct v4l2_subdev *sd = i2c_get_clientdata(client);
350 struct saa7185 *encoder = to_saa7185(sd);
354 saa7185_write(sd, 0x61, (encoder->
reg[0x61]) | 0x40);
372 .probe = saa7185_probe,
373 .remove = saa7185_remove,
374 .id_table = saa7185_id,