24 #include <linux/module.h>
25 #include <linux/kernel.h>
26 #include <linux/i2c.h>
27 #include <linux/videodev2.h>
28 #include <linux/slab.h>
36 #define GR_MODE_MASK 0xc0
37 #define DIRECT_3DYCS_CONNECT_MASK 0xc0
38 #define SYNC_CIRCUIT_MASK 0xa0
77 static u8 upd64031a_init[] = {
78 0x00, 0xb8, 0x48, 0xd2, 0xe6,
79 0x03, 0x10, 0x0b, 0xaf, 0x7f,
80 0x00, 0x00, 0x1d, 0x5e, 0x00,
91 if (reg >=
sizeof(buf))
101 struct i2c_client *client = v4l2_get_subdevdata(sd);
106 v4l2_dbg(1,
debug, sd,
"write reg: %02X val: %02X\n", reg, val);
108 v4l2_err(sd,
"I/O error write 0x%02x/0x%02x\n", reg, val);
120 upd64031a_write(sd,
R00, reg | 0x10);
121 upd64031a_write(sd,
R00, reg & ~0x10);
127 static int upd64031a_s_routing(
struct v4l2_subdev *sd,
133 state->
gr_mode = (input & 3) << 6;
144 upd64031a_write(sd,
R00, r00);
145 upd64031a_write(sd,
R05, r05);
146 upd64031a_write(sd,
R08, r08);
147 return upd64031a_s_frequency(sd,
NULL);
152 struct i2c_client *client = v4l2_get_subdevdata(sd);
157 static int upd64031a_log_status(
struct v4l2_subdev *sd)
159 v4l2_info(sd,
"Status: SA00=0x%02x SA01=0x%02x\n",
160 upd64031a_read(sd, 0), upd64031a_read(sd, 1));
164 #ifdef CONFIG_VIDEO_ADV_DEBUG
167 struct i2c_client *client = v4l2_get_subdevdata(sd);
173 reg->
val = upd64031a_read(sd, reg->
reg & 0xff);
180 struct i2c_client *client = v4l2_get_subdevdata(sd);
186 upd64031a_write(sd, reg->
reg & 0xff, reg->
val & 0xff);
194 .log_status = upd64031a_log_status,
195 .g_chip_ident = upd64031a_g_chip_ident,
196 #ifdef CONFIG_VIDEO_ADV_DEBUG
197 .g_register = upd64031a_g_register,
198 .s_register = upd64031a_s_register,
203 .s_frequency = upd64031a_s_frequency,
207 .s_routing = upd64031a_s_routing,
211 .core = &upd64031a_core_ops,
212 .tuner = &upd64031a_tuner_ops,
213 .video = &upd64031a_video_ops,
220 static int upd64031a_probe(
struct i2c_client *client,
230 v4l_info(client,
"chip found @ 0x%x (%s)\n",
243 upd64031a_write(sd, i, state->
regs[i]);
247 static int upd64031a_remove(
struct i2c_client *client)
249 struct v4l2_subdev *sd = i2c_get_clientdata(client);
269 .probe = upd64031a_probe,
270 .remove = upd64031a_remove,
271 .id_table = upd64031a_id,