Lines Matching full:sd

27 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)  in subdev_fh_init()  argument
31 state = v4l2_subdev_alloc_state(sd); in subdev_fh_init()
49 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_open() local
57 ret = subdev_fh_init(subdev_fh, sd); in subdev_open()
67 if (sd->v4l2_dev->mdev && sd->entity.graph_obj.mdev->dev) { in subdev_open()
70 owner = sd->entity.graph_obj.mdev->dev->driver->owner; in subdev_open()
79 if (sd->internal_ops && sd->internal_ops->open) { in subdev_open()
80 ret = sd->internal_ops->open(sd, subdev_fh); in subdev_open()
100 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_close() local
104 if (sd->internal_ops && sd->internal_ops->close) in subdev_close()
105 sd->internal_ops->close(sd, subdev_fh); in subdev_close()
136 static inline int check_pad(struct v4l2_subdev *sd, u32 pad) in check_pad() argument
139 if (sd->entity.num_pads) { in check_pad()
140 if (pad >= sd->entity.num_pads) in check_pad()
159 static inline int check_format(struct v4l2_subdev *sd, in check_format() argument
166 return check_which(format->which) ? : check_pad(sd, format->pad) ? : in check_format()
170 static int call_get_fmt(struct v4l2_subdev *sd, in call_get_fmt() argument
174 return check_format(sd, state, format) ? : in call_get_fmt()
175 sd->ops->pad->get_fmt(sd, state, format); in call_get_fmt()
178 static int call_set_fmt(struct v4l2_subdev *sd, in call_set_fmt() argument
182 return check_format(sd, state, format) ? : in call_set_fmt()
183 sd->ops->pad->set_fmt(sd, state, format); in call_set_fmt()
186 static int call_enum_mbus_code(struct v4l2_subdev *sd, in call_enum_mbus_code() argument
193 return check_which(code->which) ? : check_pad(sd, code->pad) ? : in call_enum_mbus_code()
195 sd->ops->pad->enum_mbus_code(sd, state, code); in call_enum_mbus_code()
198 static int call_enum_frame_size(struct v4l2_subdev *sd, in call_enum_frame_size() argument
205 return check_which(fse->which) ? : check_pad(sd, fse->pad) ? : in call_enum_frame_size()
207 sd->ops->pad->enum_frame_size(sd, state, fse); in call_enum_frame_size()
210 static inline int check_frame_interval(struct v4l2_subdev *sd, in check_frame_interval() argument
216 return check_pad(sd, fi->pad); in check_frame_interval()
219 static int call_g_frame_interval(struct v4l2_subdev *sd, in call_g_frame_interval() argument
222 return check_frame_interval(sd, fi) ? : in call_g_frame_interval()
223 sd->ops->video->g_frame_interval(sd, fi); in call_g_frame_interval()
226 static int call_s_frame_interval(struct v4l2_subdev *sd, in call_s_frame_interval() argument
229 return check_frame_interval(sd, fi) ? : in call_s_frame_interval()
230 sd->ops->video->s_frame_interval(sd, fi); in call_s_frame_interval()
233 static int call_enum_frame_interval(struct v4l2_subdev *sd, in call_enum_frame_interval() argument
240 return check_which(fie->which) ? : check_pad(sd, fie->pad) ? : in call_enum_frame_interval()
242 sd->ops->pad->enum_frame_interval(sd, state, fie); in call_enum_frame_interval()
245 static inline int check_selection(struct v4l2_subdev *sd, in check_selection() argument
252 return check_which(sel->which) ? : check_pad(sd, sel->pad) ? : in check_selection()
256 static int call_get_selection(struct v4l2_subdev *sd, in call_get_selection() argument
260 return check_selection(sd, state, sel) ? : in call_get_selection()
261 sd->ops->pad->get_selection(sd, state, sel); in call_get_selection()
264 static int call_set_selection(struct v4l2_subdev *sd, in call_set_selection() argument
268 return check_selection(sd, state, sel) ? : in call_set_selection()
269 sd->ops->pad->set_selection(sd, state, sel); in call_set_selection()
272 static inline int check_edid(struct v4l2_subdev *sd, in check_edid() argument
281 return check_pad(sd, edid->pad); in check_edid()
284 static int call_get_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) in call_get_edid() argument
286 return check_edid(sd, edid) ? : sd->ops->pad->get_edid(sd, edid); in call_get_edid()
289 static int call_set_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) in call_set_edid() argument
291 return check_edid(sd, edid) ? : sd->ops->pad->set_edid(sd, edid); in call_set_edid()
294 static int call_dv_timings_cap(struct v4l2_subdev *sd, in call_dv_timings_cap() argument
300 return check_pad(sd, cap->pad) ? : in call_dv_timings_cap()
301 sd->ops->pad->dv_timings_cap(sd, cap); in call_dv_timings_cap()
304 static int call_enum_dv_timings(struct v4l2_subdev *sd, in call_enum_dv_timings() argument
310 return check_pad(sd, dvt->pad) ? : in call_enum_dv_timings()
311 sd->ops->pad->enum_dv_timings(sd, dvt); in call_enum_dv_timings()
314 static int call_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad, in call_get_mbus_config() argument
317 return check_pad(sd, pad) ? : in call_get_mbus_config()
318 sd->ops->pad->get_mbus_config(sd, pad, config); in call_get_mbus_config()
321 static int call_set_mbus_config(struct v4l2_subdev *sd, unsigned int pad, in call_set_mbus_config() argument
324 return check_pad(sd, pad) ? : in call_set_mbus_config()
325 sd->ops->pad->get_mbus_config(sd, pad, config); in call_set_mbus_config()
359 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_do_ioctl() local
413 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
419 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
425 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
428 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) in subdev_do_ioctl()
434 return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg); in subdev_do_ioctl()
437 return v4l2_subdev_call(sd, core, unsubscribe_event, vfh, arg); in subdev_do_ioctl()
446 return v4l2_subdev_call(sd, core, g_register, p); in subdev_do_ioctl()
454 return v4l2_subdev_call(sd, core, s_register, p); in subdev_do_ioctl()
462 if (sd->ops->core && sd->ops->core->s_register) in subdev_do_ioctl()
464 if (sd->ops->core && sd->ops->core->g_register) in subdev_do_ioctl()
466 strscpy(p->name, sd->name, sizeof(p->name)); in subdev_do_ioctl()
475 sd->name); in subdev_do_ioctl()
476 ret = v4l2_subdev_call(sd, core, log_status); in subdev_do_ioctl()
478 sd->name); in subdev_do_ioctl()
487 return v4l2_subdev_call(sd, pad, get_fmt, subdev_fh->state, format); in subdev_do_ioctl()
498 return v4l2_subdev_call(sd, pad, set_fmt, subdev_fh->state, format); in subdev_do_ioctl()
512 sd, pad, get_selection, subdev_fh->state, &sel); in subdev_do_ioctl()
534 sd, pad, set_selection, subdev_fh->state, &sel); in subdev_do_ioctl()
545 return v4l2_subdev_call(sd, pad, enum_mbus_code, subdev_fh->state, in subdev_do_ioctl()
553 return v4l2_subdev_call(sd, pad, enum_frame_size, subdev_fh->state, in subdev_do_ioctl()
561 return v4l2_subdev_call(sd, video, g_frame_interval, arg); in subdev_do_ioctl()
571 return v4l2_subdev_call(sd, video, s_frame_interval, arg); in subdev_do_ioctl()
578 return v4l2_subdev_call(sd, pad, enum_frame_interval, subdev_fh->state, in subdev_do_ioctl()
587 sd, pad, get_selection, subdev_fh->state, sel); in subdev_do_ioctl()
598 sd, pad, set_selection, subdev_fh->state, sel); in subdev_do_ioctl()
604 return v4l2_subdev_call(sd, pad, get_edid, edid); in subdev_do_ioctl()
610 return v4l2_subdev_call(sd, pad, set_edid, edid); in subdev_do_ioctl()
616 return v4l2_subdev_call(sd, pad, dv_timings_cap, cap); in subdev_do_ioctl()
622 return v4l2_subdev_call(sd, pad, enum_dv_timings, dvt); in subdev_do_ioctl()
626 return v4l2_subdev_call(sd, video, query_dv_timings, arg); in subdev_do_ioctl()
629 return v4l2_subdev_call(sd, video, g_dv_timings, arg); in subdev_do_ioctl()
635 return v4l2_subdev_call(sd, video, s_dv_timings, arg); in subdev_do_ioctl()
638 return v4l2_subdev_call(sd, video, g_std, arg); in subdev_do_ioctl()
646 return v4l2_subdev_call(sd, video, s_std, *std); in subdev_do_ioctl()
653 if (v4l2_subdev_call(sd, video, g_tvnorms, &id)) in subdev_do_ioctl()
660 return v4l2_subdev_call(sd, video, querystd, arg); in subdev_do_ioctl()
663 return v4l2_subdev_call(sd, core, ioctl, cmd, arg); in subdev_do_ioctl()
695 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_compat_ioctl32() local
697 return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg); in subdev_compat_ioctl32()
720 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_poll() local
723 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) in subdev_poll()
751 struct v4l2_subdev *sd; in v4l2_subdev_get_fwnode_pad_1_to_1() local
756 sd = media_entity_to_v4l2_subdev(entity); in v4l2_subdev_get_fwnode_pad_1_to_1()
761 if (dev_fwnode(sd->dev) == fwnode) in v4l2_subdev_get_fwnode_pad_1_to_1()
768 int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, in v4l2_subdev_link_validate_default() argument
777 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
785 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
793 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
806 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
816 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
830 struct v4l2_subdev *sd = in v4l2_subdev_link_validate_get_format() local
835 return v4l2_subdev_call(sd, pad, get_fmt, NULL, fmt); in v4l2_subdev_link_validate_get_format()
873 struct v4l2_subdev_state *v4l2_subdev_alloc_state(struct v4l2_subdev *sd) in v4l2_subdev_alloc_state() argument
882 if (sd->entity.num_pads) { in v4l2_subdev_alloc_state()
883 state->pads = kvmalloc_array(sd->entity.num_pads, in v4l2_subdev_alloc_state()
892 ret = v4l2_subdev_call(sd, pad, init_cfg, state); in v4l2_subdev_alloc_state()
920 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) in v4l2_subdev_init() argument
922 INIT_LIST_HEAD(&sd->list); in v4l2_subdev_init()
924 sd->ops = ops; in v4l2_subdev_init()
925 sd->v4l2_dev = NULL; in v4l2_subdev_init()
926 sd->flags = 0; in v4l2_subdev_init()
927 sd->name[0] = '\0'; in v4l2_subdev_init()
928 sd->grp_id = 0; in v4l2_subdev_init()
929 sd->dev_priv = NULL; in v4l2_subdev_init()
930 sd->host_priv = NULL; in v4l2_subdev_init()
932 sd->entity.name = sd->name; in v4l2_subdev_init()
933 sd->entity.obj_type = MEDIA_ENTITY_TYPE_V4L2_SUBDEV; in v4l2_subdev_init()
934 sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; in v4l2_subdev_init()
939 void v4l2_subdev_notify_event(struct v4l2_subdev *sd, in v4l2_subdev_notify_event() argument
942 v4l2_event_queue(sd->devnode, ev); in v4l2_subdev_notify_event()
943 v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, (void *)ev); in v4l2_subdev_notify_event()