Lines Matching refs:sd

46 	struct v4l2_subdev sd;  member
55 static inline struct vpx3220 *to_vpx3220(struct v4l2_subdev *sd) in to_vpx3220() argument
57 return container_of(sd, struct vpx3220, sd); in to_vpx3220()
62 return &container_of(ctrl->handler, struct vpx3220, hdl)->sd; in to_sd()
69 static inline int vpx3220_write(struct v4l2_subdev *sd, u8 reg, u8 value) in vpx3220_write() argument
71 struct i2c_client *client = v4l2_get_subdevdata(sd); in vpx3220_write()
78 static inline int vpx3220_read(struct v4l2_subdev *sd, u8 reg) in vpx3220_read() argument
80 struct i2c_client *client = v4l2_get_subdevdata(sd); in vpx3220_read()
85 static int vpx3220_fp_status(struct v4l2_subdev *sd) in vpx3220_fp_status() argument
91 status = vpx3220_read(sd, 0x29); in vpx3220_fp_status()
105 static int vpx3220_fp_write(struct v4l2_subdev *sd, u8 fpaddr, u16 data) in vpx3220_fp_write() argument
107 struct i2c_client *client = v4l2_get_subdevdata(sd); in vpx3220_fp_write()
111 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); in vpx3220_fp_write()
115 if (vpx3220_fp_status(sd) < 0) in vpx3220_fp_write()
120 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); in vpx3220_fp_write()
127 static u16 vpx3220_fp_read(struct v4l2_subdev *sd, u16 fpaddr) in vpx3220_fp_read() argument
129 struct i2c_client *client = v4l2_get_subdevdata(sd); in vpx3220_fp_read()
134 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); in vpx3220_fp_read()
138 if (vpx3220_fp_status(sd) < 0) in vpx3220_fp_read()
144 v4l2_dbg(1, debug, sd, "%s: failed\n", __func__); in vpx3220_fp_read()
151 static int vpx3220_write_block(struct v4l2_subdev *sd, const u8 *data, unsigned int len) in vpx3220_write_block() argument
158 ret = vpx3220_write(sd, reg, *data++); in vpx3220_write_block()
167 static int vpx3220_write_fp_block(struct v4l2_subdev *sd, in vpx3220_write_fp_block() argument
175 ret |= vpx3220_fp_write(sd, reg, *data++); in vpx3220_write_fp_block()
278 static int vpx3220_init(struct v4l2_subdev *sd, u32 val) in vpx3220_init() argument
280 struct vpx3220 *decoder = to_vpx3220(sd); in vpx3220_init()
282 vpx3220_write_block(sd, init_common, sizeof(init_common)); in vpx3220_init()
283 vpx3220_write_fp_block(sd, init_fp, sizeof(init_fp) >> 1); in vpx3220_init()
285 vpx3220_write_fp_block(sd, init_ntsc, sizeof(init_ntsc) >> 1); in vpx3220_init()
287 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); in vpx3220_init()
289 vpx3220_write_fp_block(sd, init_secam, sizeof(init_secam) >> 1); in vpx3220_init()
291 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); in vpx3220_init()
295 static int vpx3220_status(struct v4l2_subdev *sd, u32 *pstatus, v4l2_std_id *pstd) in vpx3220_status() argument
300 status = vpx3220_fp_read(sd, 0x0f3); in vpx3220_status()
302 v4l2_dbg(1, debug, sd, "status: 0x%04x\n", status); in vpx3220_status()
338 static int vpx3220_querystd(struct v4l2_subdev *sd, v4l2_std_id *std) in vpx3220_querystd() argument
340 v4l2_dbg(1, debug, sd, "querystd\n"); in vpx3220_querystd()
341 return vpx3220_status(sd, NULL, std); in vpx3220_querystd()
344 static int vpx3220_g_input_status(struct v4l2_subdev *sd, u32 *status) in vpx3220_g_input_status() argument
346 v4l2_dbg(1, debug, sd, "g_input_status\n"); in vpx3220_g_input_status()
347 return vpx3220_status(sd, status, NULL); in vpx3220_g_input_status()
350 static int vpx3220_s_std(struct v4l2_subdev *sd, v4l2_std_id std) in vpx3220_s_std() argument
352 struct vpx3220 *decoder = to_vpx3220(sd); in vpx3220_s_std()
358 temp_input = vpx3220_fp_read(sd, 0xf2); in vpx3220_s_std()
360 v4l2_dbg(1, debug, sd, "s_std %llx\n", (unsigned long long)std); in vpx3220_s_std()
362 vpx3220_write_fp_block(sd, init_ntsc, sizeof(init_ntsc) >> 1); in vpx3220_s_std()
363 v4l2_dbg(1, debug, sd, "norm switched to NTSC\n"); in vpx3220_s_std()
365 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); in vpx3220_s_std()
366 v4l2_dbg(1, debug, sd, "norm switched to PAL\n"); in vpx3220_s_std()
368 vpx3220_write_fp_block(sd, init_secam, sizeof(init_secam) >> 1); in vpx3220_s_std()
369 v4l2_dbg(1, debug, sd, "norm switched to SECAM\n"); in vpx3220_s_std()
377 vpx3220_fp_write(sd, 0xf2, temp_input | 0x0010); in vpx3220_s_std()
382 static int vpx3220_s_routing(struct v4l2_subdev *sd, in vpx3220_s_routing() argument
400 v4l2_dbg(1, debug, sd, "input switched to %s\n", inputs[input]); in vpx3220_s_routing()
402 vpx3220_write(sd, 0x33, input_vals[input][0]); in vpx3220_s_routing()
404 data = vpx3220_fp_read(sd, 0xf2) & ~(0x0020); in vpx3220_s_routing()
408 vpx3220_fp_write(sd, 0xf2, in vpx3220_s_routing()
415 static int vpx3220_s_stream(struct v4l2_subdev *sd, int enable) in vpx3220_s_stream() argument
417 v4l2_dbg(1, debug, sd, "s_stream %s\n", enable ? "on" : "off"); in vpx3220_s_stream()
419 vpx3220_write(sd, 0xf2, (enable ? 0x1b : 0x00)); in vpx3220_s_stream()
425 struct v4l2_subdev *sd = to_sd(ctrl); in vpx3220_s_ctrl() local
429 vpx3220_write(sd, 0xe6, ctrl->val); in vpx3220_s_ctrl()
433 vpx3220_write(sd, 0xe7, ctrl->val + 192); in vpx3220_s_ctrl()
436 vpx3220_fp_write(sd, 0xa0, ctrl->val); in vpx3220_s_ctrl()
439 vpx3220_fp_write(sd, 0x1c, ctrl->val); in vpx3220_s_ctrl()
476 struct v4l2_subdev *sd; in vpx3220_probe() local
489 sd = &decoder->sd; in vpx3220_probe()
490 v4l2_i2c_subdev_init(sd, client, &vpx3220_ops); in vpx3220_probe()
503 sd->ctrl_handler = &decoder->hdl; in vpx3220_probe()
529 v4l2_info(sd, "%s found @ 0x%x (%s)\n", name, in vpx3220_probe()
532 v4l2_info(sd, "chip (%02x:%04x) found @ 0x%x (%s)\n", in vpx3220_probe()
535 vpx3220_write_block(sd, init_common, sizeof(init_common)); in vpx3220_probe()
536 vpx3220_write_fp_block(sd, init_fp, sizeof(init_fp) >> 1); in vpx3220_probe()
538 vpx3220_write_fp_block(sd, init_pal, sizeof(init_pal) >> 1); in vpx3220_probe()
544 struct v4l2_subdev *sd = i2c_get_clientdata(client); in vpx3220_remove() local
545 struct vpx3220 *decoder = to_vpx3220(sd); in vpx3220_remove()
547 v4l2_device_unregister_subdev(sd); in vpx3220_remove()