Lines Matching full:sd
42 struct v4l2_subdev sd; member
53 static inline struct saa7110 *to_saa7110(struct v4l2_subdev *sd) in to_saa7110() argument
55 return container_of(sd, struct saa7110, sd); in to_saa7110()
60 return &container_of(ctrl->handler, struct saa7110, hdl)->sd; in to_sd()
67 static int saa7110_write(struct v4l2_subdev *sd, u8 reg, u8 value) in saa7110_write() argument
69 struct i2c_client *client = v4l2_get_subdevdata(sd); in saa7110_write()
70 struct saa7110 *decoder = to_saa7110(sd); in saa7110_write()
76 static int saa7110_write_block(struct v4l2_subdev *sd, const u8 *data, unsigned int len) in saa7110_write_block() argument
78 struct i2c_client *client = v4l2_get_subdevdata(sd); in saa7110_write_block()
79 struct saa7110 *decoder = to_saa7110(sd); in saa7110_write_block()
96 ret = saa7110_write(sd, reg++, *data++); in saa7110_write_block()
105 static inline int saa7110_read(struct v4l2_subdev *sd) in saa7110_read() argument
107 struct i2c_client *client = v4l2_get_subdevdata(sd); in saa7110_read()
120 static int saa7110_selmux(struct v4l2_subdev *sd, int chan) in saa7110_selmux() argument
151 struct saa7110 *decoder = to_saa7110(sd); in saa7110_selmux()
154 saa7110_write(sd, 0x06, ptr[0]); /* Luminance control */ in saa7110_selmux()
155 saa7110_write(sd, 0x20, ptr[1]); /* Analog Control #1 */ in saa7110_selmux()
156 saa7110_write(sd, 0x21, ptr[2]); /* Analog Control #2 */ in saa7110_selmux()
157 saa7110_write(sd, 0x22, ptr[3]); /* Mixer Control #1 */ in saa7110_selmux()
158 saa7110_write(sd, 0x2C, ptr[4]); /* Mixer Control #2 */ in saa7110_selmux()
159 saa7110_write(sd, 0x30, ptr[5]); /* ADCs gain control */ in saa7110_selmux()
160 saa7110_write(sd, 0x31, ptr[6]); /* Mixer Control #3 */ in saa7110_selmux()
161 saa7110_write(sd, 0x21, ptr[7]); /* Analog Control #2 */ in saa7110_selmux()
177 static v4l2_std_id determine_norm(struct v4l2_subdev *sd) in determine_norm() argument
180 struct saa7110 *decoder = to_saa7110(sd); in determine_norm()
184 saa7110_write_block(sd, initseq, sizeof(initseq)); in determine_norm()
185 saa7110_selmux(sd, decoder->input); in determine_norm()
189 status = saa7110_read(sd); in determine_norm()
191 v4l2_dbg(1, debug, sd, "status=0x%02x (no signal)\n", status); in determine_norm()
195 saa7110_write(sd, 0x06, 0x83); in determine_norm()
197 v4l2_dbg(1, debug, sd, "status=0x%02x (NTSC/no color)\n", status); in determine_norm()
198 /*saa7110_write(sd,0x2E,0x81);*/ in determine_norm()
201 v4l2_dbg(1, debug, sd, "status=0x%02x (PAL/no color)\n", status); in determine_norm()
202 /*saa7110_write(sd,0x2E,0x9A);*/ in determine_norm()
205 /*saa7110_write(sd,0x06,0x03);*/ in determine_norm()
207 v4l2_dbg(1, debug, sd, "status=0x%02x (NTSC)\n", status); in determine_norm()
208 saa7110_write(sd, 0x0D, 0x86); in determine_norm()
209 saa7110_write(sd, 0x0F, 0x50); in determine_norm()
210 saa7110_write(sd, 0x11, 0x2C); in determine_norm()
211 /*saa7110_write(sd,0x2E,0x81);*/ in determine_norm()
216 saa7110_write(sd, 0x0D, 0x86); in determine_norm()
217 saa7110_write(sd, 0x0F, 0x10); in determine_norm()
218 saa7110_write(sd, 0x11, 0x59); in determine_norm()
219 /*saa7110_write(sd,0x2E,0x9A);*/ in determine_norm()
225 status = saa7110_read(sd); in determine_norm()
227 v4l2_dbg(1, debug, sd, "status=0x%02x (SECAM)\n", status); in determine_norm()
228 saa7110_write(sd, 0x0D, 0x87); in determine_norm()
231 v4l2_dbg(1, debug, sd, "status=0x%02x (PAL)\n", status); in determine_norm()
235 static int saa7110_g_input_status(struct v4l2_subdev *sd, u32 *pstatus) in saa7110_g_input_status() argument
237 struct saa7110 *decoder = to_saa7110(sd); in saa7110_g_input_status()
239 int status = saa7110_read(sd); in saa7110_g_input_status()
241 v4l2_dbg(1, debug, sd, "status=0x%02x norm=%llx\n", in saa7110_g_input_status()
252 static int saa7110_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) in saa7110_querystd() argument
254 *std &= determine_norm(sd); in saa7110_querystd()
258 static int saa7110_s_std(struct v4l2_subdev *sd, v4l2_std_id std) in saa7110_s_std() argument
260 struct saa7110 *decoder = to_saa7110(sd); in saa7110_s_std()
264 /*saa7110_write(sd, 0x06, 0x03);*/ in saa7110_s_std()
266 saa7110_write(sd, 0x0D, 0x86); in saa7110_s_std()
267 saa7110_write(sd, 0x0F, 0x50); in saa7110_s_std()
268 saa7110_write(sd, 0x11, 0x2C); in saa7110_s_std()
269 /*saa7110_write(sd, 0x2E, 0x81);*/ in saa7110_s_std()
270 v4l2_dbg(1, debug, sd, "switched to NTSC\n"); in saa7110_s_std()
272 saa7110_write(sd, 0x0D, 0x86); in saa7110_s_std()
273 saa7110_write(sd, 0x0F, 0x10); in saa7110_s_std()
274 saa7110_write(sd, 0x11, 0x59); in saa7110_s_std()
275 /*saa7110_write(sd, 0x2E, 0x9A);*/ in saa7110_s_std()
276 v4l2_dbg(1, debug, sd, "switched to PAL\n"); in saa7110_s_std()
278 saa7110_write(sd, 0x0D, 0x87); in saa7110_s_std()
279 saa7110_write(sd, 0x0F, 0x10); in saa7110_s_std()
280 saa7110_write(sd, 0x11, 0x59); in saa7110_s_std()
281 /*saa7110_write(sd, 0x2E, 0x9A);*/ in saa7110_s_std()
282 v4l2_dbg(1, debug, sd, "switched to SECAM\n"); in saa7110_s_std()
290 static int saa7110_s_routing(struct v4l2_subdev *sd, in saa7110_s_routing() argument
293 struct saa7110 *decoder = to_saa7110(sd); in saa7110_s_routing()
296 v4l2_dbg(1, debug, sd, "input=%d not available\n", input); in saa7110_s_routing()
300 saa7110_selmux(sd, input); in saa7110_s_routing()
301 v4l2_dbg(1, debug, sd, "switched to input=%d\n", input); in saa7110_s_routing()
306 static int saa7110_s_stream(struct v4l2_subdev *sd, int enable) in saa7110_s_stream() argument
308 struct saa7110 *decoder = to_saa7110(sd); in saa7110_s_stream()
312 saa7110_write(sd, 0x0E, enable ? 0x18 : 0x80); in saa7110_s_stream()
313 v4l2_dbg(1, debug, sd, "YUV %s\n", enable ? "on" : "off"); in saa7110_s_stream()
320 struct v4l2_subdev *sd = to_sd(ctrl); in saa7110_s_ctrl() local
324 saa7110_write(sd, 0x19, ctrl->val); in saa7110_s_ctrl()
327 saa7110_write(sd, 0x13, ctrl->val); in saa7110_s_ctrl()
330 saa7110_write(sd, 0x12, ctrl->val); in saa7110_s_ctrl()
333 saa7110_write(sd, 0x07, ctrl->val); in saa7110_s_ctrl()
364 struct v4l2_subdev *sd; in saa7110_probe() local
378 sd = &decoder->sd; in saa7110_probe()
379 v4l2_i2c_subdev_init(sd, client, &saa7110_ops); in saa7110_probe()
392 sd->ctrl_handler = &decoder->hdl; in saa7110_probe()
403 rv = saa7110_write_block(sd, initseq, sizeof(initseq)); in saa7110_probe()
405 v4l2_dbg(1, debug, sd, "init status %d\n", rv); in saa7110_probe()
408 saa7110_write(sd, 0x21, 0x10); in saa7110_probe()
409 saa7110_write(sd, 0x0e, 0x18); in saa7110_probe()
410 saa7110_write(sd, 0x0D, 0x04); in saa7110_probe()
411 ver = saa7110_read(sd); in saa7110_probe()
412 saa7110_write(sd, 0x0D, 0x06); in saa7110_probe()
414 status = saa7110_read(sd); in saa7110_probe()
415 v4l2_dbg(1, debug, sd, "version %x, status=0x%02x\n", in saa7110_probe()
417 saa7110_write(sd, 0x0D, 0x86); in saa7110_probe()
418 saa7110_write(sd, 0x0F, 0x10); in saa7110_probe()
419 saa7110_write(sd, 0x11, 0x59); in saa7110_probe()
420 /*saa7110_write(sd, 0x2E, 0x9A);*/ in saa7110_probe()
423 /*saa7110_selmux(sd,0);*/ in saa7110_probe()
424 /*determine_norm(sd);*/ in saa7110_probe()
432 struct v4l2_subdev *sd = i2c_get_clientdata(client); in saa7110_remove() local
433 struct saa7110 *decoder = to_saa7110(sd); in saa7110_remove()
435 v4l2_device_unregister_subdev(sd); in saa7110_remove()