Lines Matching full:sd

51 static int subdev_fh_init(struct v4l2_subdev_fh *fh, struct v4l2_subdev *sd)  in subdev_fh_init()  argument
56 state = __v4l2_subdev_state_alloc(sd, "fh->state->lock", &key); in subdev_fh_init()
74 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_open() local
82 ret = subdev_fh_init(subdev_fh, sd); in subdev_open()
92 if (sd->v4l2_dev->mdev && sd->entity.graph_obj.mdev->dev) { in subdev_open()
95 owner = sd->entity.graph_obj.mdev->dev->driver->owner; in subdev_open()
103 if (sd->internal_ops && sd->internal_ops->open) { in subdev_open()
104 ret = sd->internal_ops->open(sd, subdev_fh); in subdev_open()
124 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_close() local
128 if (sd->internal_ops && sd->internal_ops->close) in subdev_close()
129 sd->internal_ops->close(sd, subdev_fh); in subdev_close()
151 static void v4l2_subdev_enable_privacy_led(struct v4l2_subdev *sd) in v4l2_subdev_enable_privacy_led() argument
154 if (!IS_ERR_OR_NULL(sd->privacy_led)) in v4l2_subdev_enable_privacy_led()
155 led_set_brightness(sd->privacy_led, in v4l2_subdev_enable_privacy_led()
156 sd->privacy_led->max_brightness); in v4l2_subdev_enable_privacy_led()
160 static void v4l2_subdev_disable_privacy_led(struct v4l2_subdev *sd) in v4l2_subdev_disable_privacy_led() argument
163 if (!IS_ERR_OR_NULL(sd->privacy_led)) in v4l2_subdev_disable_privacy_led()
164 led_set_brightness(sd->privacy_led, 0); in v4l2_subdev_disable_privacy_led()
177 static inline int check_pad(struct v4l2_subdev *sd, u32 pad) in check_pad() argument
180 if (sd->entity.num_pads) { in check_pad()
181 if (pad >= sd->entity.num_pads) in check_pad()
192 static int check_state(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, in check_state() argument
195 if (sd->flags & V4L2_SUBDEV_FL_STREAMS) { in check_state()
214 static inline int check_format(struct v4l2_subdev *sd, in check_format() argument
221 return check_which(format->which) ? : check_pad(sd, format->pad) ? : in check_format()
222 check_state(sd, state, format->which, format->pad, format->stream); in check_format()
225 static int call_get_fmt(struct v4l2_subdev *sd, in call_get_fmt() argument
229 return check_format(sd, state, format) ? : in call_get_fmt()
230 sd->ops->pad->get_fmt(sd, state, format); in call_get_fmt()
233 static int call_set_fmt(struct v4l2_subdev *sd, in call_set_fmt() argument
237 return check_format(sd, state, format) ? : in call_set_fmt()
238 sd->ops->pad->set_fmt(sd, state, format); in call_set_fmt()
241 static int call_enum_mbus_code(struct v4l2_subdev *sd, in call_enum_mbus_code() argument
248 return check_which(code->which) ? : check_pad(sd, code->pad) ? : in call_enum_mbus_code()
249 check_state(sd, state, code->which, code->pad, code->stream) ? : in call_enum_mbus_code()
250 sd->ops->pad->enum_mbus_code(sd, state, code); in call_enum_mbus_code()
253 static int call_enum_frame_size(struct v4l2_subdev *sd, in call_enum_frame_size() argument
260 return check_which(fse->which) ? : check_pad(sd, fse->pad) ? : in call_enum_frame_size()
261 check_state(sd, state, fse->which, fse->pad, fse->stream) ? : in call_enum_frame_size()
262 sd->ops->pad->enum_frame_size(sd, state, fse); in call_enum_frame_size()
265 static int call_enum_frame_interval(struct v4l2_subdev *sd, in call_enum_frame_interval() argument
272 return check_which(fie->which) ? : check_pad(sd, fie->pad) ? : in call_enum_frame_interval()
273 check_state(sd, state, fie->which, fie->pad, fie->stream) ? : in call_enum_frame_interval()
274 sd->ops->pad->enum_frame_interval(sd, state, fie); in call_enum_frame_interval()
277 static inline int check_selection(struct v4l2_subdev *sd, in check_selection() argument
284 return check_which(sel->which) ? : check_pad(sd, sel->pad) ? : in check_selection()
285 check_state(sd, state, sel->which, sel->pad, sel->stream); in check_selection()
288 static int call_get_selection(struct v4l2_subdev *sd, in call_get_selection() argument
292 return check_selection(sd, state, sel) ? : in call_get_selection()
293 sd->ops->pad->get_selection(sd, state, sel); in call_get_selection()
296 static int call_set_selection(struct v4l2_subdev *sd, in call_set_selection() argument
300 return check_selection(sd, state, sel) ? : in call_set_selection()
301 sd->ops->pad->set_selection(sd, state, sel); in call_set_selection()
304 static inline int check_frame_interval(struct v4l2_subdev *sd, in check_frame_interval() argument
311 return check_which(fi->which) ? : check_pad(sd, fi->pad) ? : in check_frame_interval()
312 check_state(sd, state, fi->which, fi->pad, fi->stream); in check_frame_interval()
315 static int call_get_frame_interval(struct v4l2_subdev *sd, in call_get_frame_interval() argument
319 return check_frame_interval(sd, state, fi) ? : in call_get_frame_interval()
320 sd->ops->pad->get_frame_interval(sd, state, fi); in call_get_frame_interval()
323 static int call_set_frame_interval(struct v4l2_subdev *sd, in call_set_frame_interval() argument
327 return check_frame_interval(sd, state, fi) ? : in call_set_frame_interval()
328 sd->ops->pad->set_frame_interval(sd, state, fi); in call_set_frame_interval()
331 static int call_get_frame_desc(struct v4l2_subdev *sd, unsigned int pad, in call_get_frame_desc() argument
338 if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)) in call_get_frame_desc()
344 ret = sd->ops->pad->get_frame_desc(sd, pad, fd); in call_get_frame_desc()
348 dev_dbg(sd->dev, "Frame descriptor on pad %u, type %s\n", pad, in call_get_frame_desc()
363 dev_dbg(sd->dev, in call_get_frame_desc()
372 static inline int check_edid(struct v4l2_subdev *sd, in check_edid() argument
381 return check_pad(sd, edid->pad); in check_edid()
384 static int call_get_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) in call_get_edid() argument
386 return check_edid(sd, edid) ? : sd->ops->pad->get_edid(sd, edid); in call_get_edid()
389 static int call_set_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) in call_set_edid() argument
391 return check_edid(sd, edid) ? : sd->ops->pad->set_edid(sd, edid); in call_set_edid()
394 static int call_s_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in call_s_dv_timings() argument
400 return check_pad(sd, pad) ? : in call_s_dv_timings()
401 sd->ops->pad->s_dv_timings(sd, pad, timings); in call_s_dv_timings()
404 static int call_g_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in call_g_dv_timings() argument
410 return check_pad(sd, pad) ? : in call_g_dv_timings()
411 sd->ops->pad->g_dv_timings(sd, pad, timings); in call_g_dv_timings()
414 static int call_query_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in call_query_dv_timings() argument
420 return check_pad(sd, pad) ? : in call_query_dv_timings()
421 sd->ops->pad->query_dv_timings(sd, pad, timings); in call_query_dv_timings()
424 static int call_dv_timings_cap(struct v4l2_subdev *sd, in call_dv_timings_cap() argument
430 return check_pad(sd, cap->pad) ? : in call_dv_timings_cap()
431 sd->ops->pad->dv_timings_cap(sd, cap); in call_dv_timings_cap()
434 static int call_enum_dv_timings(struct v4l2_subdev *sd, in call_enum_dv_timings() argument
440 return check_pad(sd, dvt->pad) ? : in call_enum_dv_timings()
441 sd->ops->pad->enum_dv_timings(sd, dvt); in call_enum_dv_timings()
444 static int call_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad, in call_get_mbus_config() argument
447 return check_pad(sd, pad) ? : in call_get_mbus_config()
448 sd->ops->pad->get_mbus_config(sd, pad, config); in call_get_mbus_config()
451 static int call_s_stream(struct v4l2_subdev *sd, int enable) in call_s_stream() argument
460 if (WARN_ON(sd->s_stream_enabled == !!enable)) in call_s_stream()
463 ret = sd->ops->video->s_stream(sd, enable); in call_s_stream()
466 dev_warn(sd->dev, "disabling streaming failed (%d)\n", ret); in call_s_stream()
471 sd->s_stream_enabled = enable; in call_s_stream()
474 v4l2_subdev_enable_privacy_led(sd); in call_s_stream()
476 v4l2_subdev_disable_privacy_led(sd); in call_s_stream()
489 static int call_##f##_state(struct v4l2_subdev *sd, \
496 state = v4l2_subdev_lock_and_get_active_state(sd); \
497 ret = call_##f(sd, state, arg); \
506 static int call_##f##_state(struct v4l2_subdev *sd, \
510 return call_##f(sd, state, arg); \
557 subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, in subdev_ioctl_get_state() argument
605 v4l2_subdev_get_unlocked_active_state(sd); in subdev_ioctl_get_state()
612 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_do_ioctl() local
616 bool streams_subdev = sd->flags & V4L2_SUBDEV_FL_STREAMS; in subdev_do_ioctl()
678 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
684 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
690 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
693 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) in subdev_do_ioctl()
699 if (v4l2_subdev_has_op(sd, core, subscribe_event)) in subdev_do_ioctl()
700 return v4l2_subdev_call(sd, core, subscribe_event, in subdev_do_ioctl()
703 if ((sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS) && in subdev_do_ioctl()
705 return v4l2_ctrl_subdev_subscribe_event(sd, vfh, arg); in subdev_do_ioctl()
710 if (v4l2_subdev_has_op(sd, core, unsubscribe_event)) in subdev_do_ioctl()
711 return v4l2_subdev_call(sd, core, unsubscribe_event, in subdev_do_ioctl()
714 if (sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS) in subdev_do_ioctl()
715 return v4l2_event_subdev_unsubscribe(sd, vfh, arg); in subdev_do_ioctl()
726 return v4l2_subdev_call(sd, core, g_register, p); in subdev_do_ioctl()
734 return v4l2_subdev_call(sd, core, s_register, p); in subdev_do_ioctl()
742 if (sd->ops->core && sd->ops->core->s_register) in subdev_do_ioctl()
744 if (sd->ops->core && sd->ops->core->g_register) in subdev_do_ioctl()
746 strscpy(p->name, sd->name, sizeof(p->name)); in subdev_do_ioctl()
755 sd->name); in subdev_do_ioctl()
756 ret = v4l2_subdev_call(sd, core, log_status); in subdev_do_ioctl()
758 sd->name); in subdev_do_ioctl()
770 return v4l2_subdev_call(sd, pad, get_fmt, state, format); in subdev_do_ioctl()
784 return v4l2_subdev_call(sd, pad, set_fmt, state, format); in subdev_do_ioctl()
802 sd, pad, get_selection, state, &sel); in subdev_do_ioctl()
828 sd, pad, set_selection, state, &sel); in subdev_do_ioctl()
842 return v4l2_subdev_call(sd, pad, enum_mbus_code, state, in subdev_do_ioctl()
853 return v4l2_subdev_call(sd, pad, enum_frame_size, state, in subdev_do_ioctl()
864 return v4l2_subdev_call(sd, pad, get_frame_interval, state, fi); in subdev_do_ioctl()
877 return v4l2_subdev_call(sd, pad, set_frame_interval, state, fi); in subdev_do_ioctl()
887 return v4l2_subdev_call(sd, pad, enum_frame_interval, state, in subdev_do_ioctl()
899 sd, pad, get_selection, state, sel); in subdev_do_ioctl()
913 sd, pad, set_selection, state, sel); in subdev_do_ioctl()
919 return v4l2_subdev_call(sd, pad, get_edid, edid); in subdev_do_ioctl()
925 return v4l2_subdev_call(sd, pad, set_edid, edid); in subdev_do_ioctl()
931 return v4l2_subdev_call(sd, pad, dv_timings_cap, cap); in subdev_do_ioctl()
937 return v4l2_subdev_call(sd, pad, enum_dv_timings, dvt); in subdev_do_ioctl()
941 return v4l2_subdev_call(sd, pad, query_dv_timings, 0, arg); in subdev_do_ioctl()
944 return v4l2_subdev_call(sd, pad, g_dv_timings, 0, arg); in subdev_do_ioctl()
950 return v4l2_subdev_call(sd, pad, s_dv_timings, 0, arg); in subdev_do_ioctl()
953 return v4l2_subdev_call(sd, video, g_std, arg); in subdev_do_ioctl()
961 return v4l2_subdev_call(sd, video, s_std, *std); in subdev_do_ioctl()
968 if (v4l2_subdev_call(sd, video, g_tvnorms, &id)) in subdev_do_ioctl()
975 return v4l2_subdev_call(sd, video, querystd, arg); in subdev_do_ioctl()
984 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) in subdev_do_ioctl()
1010 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) in subdev_do_ioctl()
1023 const struct media_pad *pads = sd->entity.pads; in subdev_do_ioctl()
1029 if (route->sink_pad >= sd->entity.num_pads) in subdev_do_ioctl()
1036 if (route->source_pad >= sd->entity.num_pads) in subdev_do_ioctl()
1048 if (!v4l2_subdev_has_op(sd, pad, set_routing)) { in subdev_do_ioctl()
1062 rval = v4l2_subdev_call(sd, pad, set_routing, state, in subdev_do_ioctl()
1105 return v4l2_subdev_call(sd, core, ioctl, cmd, arg); in subdev_do_ioctl()
1121 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_do_ioctl_lock() local
1126 state = subdev_ioctl_get_state(sd, subdev_fh, cmd, arg); in subdev_do_ioctl_lock()
1153 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_compat_ioctl32() local
1155 return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg); in subdev_compat_ioctl32()
1178 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_poll() local
1181 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) in subdev_poll()
1209 struct v4l2_subdev *sd; in v4l2_subdev_get_fwnode_pad_1_to_1() local
1214 sd = media_entity_to_v4l2_subdev(entity); in v4l2_subdev_get_fwnode_pad_1_to_1()
1219 if (device_match_fwnode(sd->dev, fwnode)) in v4l2_subdev_get_fwnode_pad_1_to_1()
1226 int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, in v4l2_subdev_link_validate_default() argument
1235 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1243 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1251 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1264 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1274 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1289 struct v4l2_subdev *sd; in v4l2_subdev_link_validate_get_format() local
1292 sd = media_entity_to_v4l2_subdev(pad->entity); in v4l2_subdev_link_validate_get_format()
1299 state = v4l2_subdev_get_locked_active_state(sd); in v4l2_subdev_link_validate_get_format()
1301 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_link_validate_get_format()
1303 ret = v4l2_subdev_call(sd, pad, get_fmt, state, fmt); in v4l2_subdev_link_validate_get_format()
1536 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); in v4l2_subdev_has_pad_interdep() local
1541 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_has_pad_interdep()
1565 __v4l2_subdev_state_alloc(struct v4l2_subdev *sd, const char *lock_name, in __v4l2_subdev_state_alloc() argument
1576 if (sd->state_lock) in __v4l2_subdev_state_alloc()
1577 state->lock = sd->state_lock; in __v4l2_subdev_state_alloc()
1581 state->sd = sd; in __v4l2_subdev_state_alloc()
1584 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS) && sd->entity.num_pads) { in __v4l2_subdev_state_alloc()
1585 state->pads = kvcalloc(sd->entity.num_pads, in __v4l2_subdev_state_alloc()
1593 if (sd->internal_ops && sd->internal_ops->init_state) { in __v4l2_subdev_state_alloc()
1599 ret = sd->internal_ops->init_state(sd, state); in __v4l2_subdev_state_alloc()
1632 int __v4l2_subdev_init_finalize(struct v4l2_subdev *sd, const char *name, in __v4l2_subdev_init_finalize() argument
1636 struct device *dev = sd->dev; in __v4l2_subdev_init_finalize()
1643 has_s_stream = v4l2_subdev_has_op(sd, video, s_stream); in __v4l2_subdev_init_finalize()
1644 has_enable_streams = v4l2_subdev_has_op(sd, pad, enable_streams); in __v4l2_subdev_init_finalize()
1645 has_disable_streams = v4l2_subdev_has_op(sd, pad, disable_streams); in __v4l2_subdev_init_finalize()
1650 sd->name); in __v4l2_subdev_init_finalize()
1654 if (sd->flags & V4L2_SUBDEV_FL_STREAMS) { in __v4l2_subdev_init_finalize()
1658 sd->name); in __v4l2_subdev_init_finalize()
1664 if (sd->ctrl_handler) in __v4l2_subdev_init_finalize()
1665 sd->flags |= V4L2_SUBDEV_FL_HAS_EVENTS; in __v4l2_subdev_init_finalize()
1667 state = __v4l2_subdev_state_alloc(sd, name, key); in __v4l2_subdev_init_finalize()
1671 sd->active_state = state; in __v4l2_subdev_init_finalize()
1677 void v4l2_subdev_cleanup(struct v4l2_subdev *sd) in v4l2_subdev_cleanup() argument
1681 __v4l2_subdev_state_free(sd->active_state); in v4l2_subdev_cleanup()
1682 sd->active_state = NULL; in v4l2_subdev_cleanup()
1685 if (!sd->async_subdev_endpoint_list.next) in v4l2_subdev_cleanup()
1688 list_for_each_entry_safe(ase, ase_tmp, &sd->async_subdev_endpoint_list, in v4l2_subdev_cleanup()
1711 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_format()
1745 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_crop()
1779 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_compose()
1815 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_interval()
1886 int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, in v4l2_subdev_get_fmt() argument
1901 int v4l2_subdev_get_frame_interval(struct v4l2_subdev *sd, in v4l2_subdev_get_frame_interval() argument
1917 int v4l2_subdev_set_routing(struct v4l2_subdev *sd, in v4l2_subdev_set_routing() argument
1975 int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd, in v4l2_subdev_set_routing_with_fmt() argument
1984 ret = v4l2_subdev_set_routing(sd, state, routing); in v4l2_subdev_set_routing_with_fmt()
2071 int v4l2_subdev_routing_validate(struct v4l2_subdev *sd, in v4l2_subdev_routing_validate() argument
2081 remote_pads = kcalloc(sd->entity.num_pads, sizeof(*remote_pads), in v4l2_subdev_routing_validate()
2086 for (i = 0; i < sd->entity.num_pads; ++i) in v4l2_subdev_routing_validate()
2094 if (route->sink_pad >= sd->entity.num_pads || in v4l2_subdev_routing_validate()
2095 !(sd->entity.pads[route->sink_pad].flags & MEDIA_PAD_FL_SINK)) { in v4l2_subdev_routing_validate()
2096 dev_dbg(sd->dev, "route %u sink (%u) is not a sink pad\n", in v4l2_subdev_routing_validate()
2101 if (route->source_pad >= sd->entity.num_pads || in v4l2_subdev_routing_validate()
2102 !(sd->entity.pads[route->source_pad].flags & MEDIA_PAD_FL_SOURCE)) { in v4l2_subdev_routing_validate()
2103 dev_dbg(sd->dev, "route %u source (%u) is not a source pad\n", in v4l2_subdev_routing_validate()
2115 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2129 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2143 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2157 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2179 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2193 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2210 static void v4l2_subdev_collect_streams(struct v4l2_subdev *sd, in v4l2_subdev_collect_streams() argument
2216 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) { in v4l2_subdev_collect_streams()
2219 (sd->enabled_pads & BIT_ULL(pad)) ? BIT_ULL(0) : 0; in v4l2_subdev_collect_streams()
2239 static void v4l2_subdev_set_streams_enabled(struct v4l2_subdev *sd, in v4l2_subdev_set_streams_enabled() argument
2244 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) { in v4l2_subdev_set_streams_enabled()
2246 sd->enabled_pads |= BIT_ULL(pad); in v4l2_subdev_set_streams_enabled()
2248 sd->enabled_pads &= ~BIT_ULL(pad); in v4l2_subdev_set_streams_enabled()
2261 int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad, in v4l2_subdev_enable_streams() argument
2264 struct device *dev = sd->entity.graph_obj.mdev->dev; in v4l2_subdev_enable_streams()
2273 if (pad >= sd->entity.num_pads) in v4l2_subdev_enable_streams()
2276 if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)) in v4l2_subdev_enable_streams()
2283 if (pad >= sizeof(sd->enabled_pads) * BITS_PER_BYTE) in v4l2_subdev_enable_streams()
2290 use_s_stream = !v4l2_subdev_has_op(sd, pad, enable_streams); in v4l2_subdev_enable_streams()
2293 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_enable_streams()
2302 v4l2_subdev_collect_streams(sd, state, pad, streams_mask, in v4l2_subdev_enable_streams()
2307 streams_mask & ~found_streams, sd->entity.name, pad); in v4l2_subdev_enable_streams()
2314 enabled_streams, sd->entity.name, pad); in v4l2_subdev_enable_streams()
2321 already_streaming = v4l2_subdev_is_streaming(sd); in v4l2_subdev_enable_streams()
2325 ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad, in v4l2_subdev_enable_streams()
2330 ret = v4l2_subdev_call(sd, video, s_stream, 1); in v4l2_subdev_enable_streams()
2342 v4l2_subdev_set_streams_enabled(sd, state, pad, streams_mask, true); in v4l2_subdev_enable_streams()
2352 v4l2_subdev_enable_privacy_led(sd); in v4l2_subdev_enable_streams()
2362 int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad, in v4l2_subdev_disable_streams() argument
2365 struct device *dev = sd->entity.graph_obj.mdev->dev; in v4l2_subdev_disable_streams()
2373 if (pad >= sd->entity.num_pads) in v4l2_subdev_disable_streams()
2376 if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)) in v4l2_subdev_disable_streams()
2383 if (pad >= sizeof(sd->enabled_pads) * BITS_PER_BYTE) in v4l2_subdev_disable_streams()
2390 use_s_stream = !v4l2_subdev_has_op(sd, pad, disable_streams); in v4l2_subdev_disable_streams()
2393 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_disable_streams()
2402 v4l2_subdev_collect_streams(sd, state, pad, streams_mask, in v4l2_subdev_disable_streams()
2407 streams_mask & ~found_streams, sd->entity.name, pad); in v4l2_subdev_disable_streams()
2414 streams_mask & ~enabled_streams, sd->entity.name, pad); in v4l2_subdev_disable_streams()
2423 ret = v4l2_subdev_call(sd, pad, disable_streams, state, pad, in v4l2_subdev_disable_streams()
2428 if (!(sd->enabled_pads & ~BIT_ULL(pad))) in v4l2_subdev_disable_streams()
2429 ret = v4l2_subdev_call(sd, video, s_stream, 0); in v4l2_subdev_disable_streams()
2440 v4l2_subdev_set_streams_enabled(sd, state, pad, streams_mask, false); in v4l2_subdev_disable_streams()
2444 if (!v4l2_subdev_is_streaming(sd)) in v4l2_subdev_disable_streams()
2445 v4l2_subdev_disable_privacy_led(sd); in v4l2_subdev_disable_streams()
2454 int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable) in v4l2_subdev_s_stream_helper() argument
2467 media_entity_for_each_pad(&sd->entity, pad) { in v4l2_subdev_s_stream_helper()
2477 if (sd->flags & V4L2_SUBDEV_FL_STREAMS) { in v4l2_subdev_s_stream_helper()
2482 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_s_stream_helper()
2497 return v4l2_subdev_enable_streams(sd, pad_index, source_mask); in v4l2_subdev_s_stream_helper()
2499 return v4l2_subdev_disable_streams(sd, pad_index, source_mask); in v4l2_subdev_s_stream_helper()
2507 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) in v4l2_subdev_init() argument
2509 INIT_LIST_HEAD(&sd->list); in v4l2_subdev_init()
2511 sd->ops = ops; in v4l2_subdev_init()
2512 sd->v4l2_dev = NULL; in v4l2_subdev_init()
2513 sd->flags = 0; in v4l2_subdev_init()
2514 sd->name[0] = '\0'; in v4l2_subdev_init()
2515 sd->grp_id = 0; in v4l2_subdev_init()
2516 sd->dev_priv = NULL; in v4l2_subdev_init()
2517 sd->host_priv = NULL; in v4l2_subdev_init()
2518 sd->privacy_led = NULL; in v4l2_subdev_init()
2519 INIT_LIST_HEAD(&sd->async_subdev_endpoint_list); in v4l2_subdev_init()
2521 sd->entity.name = sd->name; in v4l2_subdev_init()
2522 sd->entity.obj_type = MEDIA_ENTITY_TYPE_V4L2_SUBDEV; in v4l2_subdev_init()
2523 sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; in v4l2_subdev_init()
2528 void v4l2_subdev_notify_event(struct v4l2_subdev *sd, in v4l2_subdev_notify_event() argument
2531 v4l2_event_queue(sd->devnode, ev); in v4l2_subdev_notify_event()
2532 v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, (void *)ev); in v4l2_subdev_notify_event()
2536 bool v4l2_subdev_is_streaming(struct v4l2_subdev *sd) in v4l2_subdev_is_streaming() argument
2540 if (!v4l2_subdev_has_op(sd, pad, enable_streams)) in v4l2_subdev_is_streaming()
2541 return sd->s_stream_enabled; in v4l2_subdev_is_streaming()
2543 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) in v4l2_subdev_is_streaming()
2544 return !!sd->enabled_pads; in v4l2_subdev_is_streaming()
2546 state = v4l2_subdev_get_locked_active_state(sd); in v4l2_subdev_is_streaming()
2561 int v4l2_subdev_get_privacy_led(struct v4l2_subdev *sd) in v4l2_subdev_get_privacy_led() argument
2564 sd->privacy_led = led_get(sd->dev, "privacy-led"); in v4l2_subdev_get_privacy_led()
2565 if (IS_ERR(sd->privacy_led) && PTR_ERR(sd->privacy_led) != -ENOENT) in v4l2_subdev_get_privacy_led()
2566 return dev_err_probe(sd->dev, PTR_ERR(sd->privacy_led), in v4l2_subdev_get_privacy_led()
2569 if (!IS_ERR_OR_NULL(sd->privacy_led)) { in v4l2_subdev_get_privacy_led()
2570 mutex_lock(&sd->privacy_led->led_access); in v4l2_subdev_get_privacy_led()
2571 led_sysfs_disable(sd->privacy_led); in v4l2_subdev_get_privacy_led()
2572 led_trigger_remove(sd->privacy_led); in v4l2_subdev_get_privacy_led()
2573 led_set_brightness(sd->privacy_led, 0); in v4l2_subdev_get_privacy_led()
2574 mutex_unlock(&sd->privacy_led->led_access); in v4l2_subdev_get_privacy_led()
2581 void v4l2_subdev_put_privacy_led(struct v4l2_subdev *sd) in v4l2_subdev_put_privacy_led() argument
2584 if (!IS_ERR_OR_NULL(sd->privacy_led)) { in v4l2_subdev_put_privacy_led()
2585 mutex_lock(&sd->privacy_led->led_access); in v4l2_subdev_put_privacy_led()
2586 led_sysfs_enable(sd->privacy_led); in v4l2_subdev_put_privacy_led()
2587 mutex_unlock(&sd->privacy_led->led_access); in v4l2_subdev_put_privacy_led()
2588 led_put(sd->privacy_led); in v4l2_subdev_put_privacy_led()