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
339 ret = sd->ops->pad->get_frame_desc(sd, pad, fd); in call_get_frame_desc()
343 dev_dbg(sd->dev, "Frame descriptor on pad %u, type %s\n", pad, in call_get_frame_desc()
358 dev_dbg(sd->dev, in call_get_frame_desc()
367 static inline int check_edid(struct v4l2_subdev *sd, in check_edid() argument
376 return check_pad(sd, edid->pad); in check_edid()
379 static int call_get_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) in call_get_edid() argument
381 return check_edid(sd, edid) ? : sd->ops->pad->get_edid(sd, edid); in call_get_edid()
384 static int call_set_edid(struct v4l2_subdev *sd, struct v4l2_subdev_edid *edid) in call_set_edid() argument
386 return check_edid(sd, edid) ? : sd->ops->pad->set_edid(sd, edid); in call_set_edid()
389 static int call_s_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in call_s_dv_timings() argument
395 return check_pad(sd, pad) ? : in call_s_dv_timings()
396 sd->ops->pad->s_dv_timings(sd, pad, timings); in call_s_dv_timings()
399 static int call_g_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in call_g_dv_timings() argument
405 return check_pad(sd, pad) ? : in call_g_dv_timings()
406 sd->ops->pad->g_dv_timings(sd, pad, timings); in call_g_dv_timings()
409 static int call_query_dv_timings(struct v4l2_subdev *sd, unsigned int pad, in call_query_dv_timings() argument
415 return check_pad(sd, pad) ? : in call_query_dv_timings()
416 sd->ops->pad->query_dv_timings(sd, pad, timings); in call_query_dv_timings()
419 static int call_dv_timings_cap(struct v4l2_subdev *sd, in call_dv_timings_cap() argument
425 return check_pad(sd, cap->pad) ? : in call_dv_timings_cap()
426 sd->ops->pad->dv_timings_cap(sd, cap); in call_dv_timings_cap()
429 static int call_enum_dv_timings(struct v4l2_subdev *sd, in call_enum_dv_timings() argument
435 return check_pad(sd, dvt->pad) ? : in call_enum_dv_timings()
436 sd->ops->pad->enum_dv_timings(sd, dvt); in call_enum_dv_timings()
439 static int call_get_mbus_config(struct v4l2_subdev *sd, unsigned int pad, in call_get_mbus_config() argument
442 return check_pad(sd, pad) ? : in call_get_mbus_config()
443 sd->ops->pad->get_mbus_config(sd, pad, config); in call_get_mbus_config()
446 static int call_s_stream(struct v4l2_subdev *sd, int enable) in call_s_stream() argument
455 if (WARN_ON(sd->s_stream_enabled == !!enable)) in call_s_stream()
458 ret = sd->ops->video->s_stream(sd, enable); in call_s_stream()
461 dev_warn(sd->dev, "disabling streaming failed (%d)\n", ret); in call_s_stream()
466 sd->s_stream_enabled = enable; in call_s_stream()
469 v4l2_subdev_enable_privacy_led(sd); in call_s_stream()
471 v4l2_subdev_disable_privacy_led(sd); in call_s_stream()
484 static int call_##f##_state(struct v4l2_subdev *sd, \
491 state = v4l2_subdev_lock_and_get_active_state(sd); \
492 ret = call_##f(sd, state, arg); \
501 static int call_##f##_state(struct v4l2_subdev *sd, \
505 return call_##f(sd, state, arg); \
552 subdev_ioctl_get_state(struct v4l2_subdev *sd, struct v4l2_subdev_fh *subdev_fh, in subdev_ioctl_get_state() argument
600 v4l2_subdev_get_unlocked_active_state(sd); in subdev_ioctl_get_state()
607 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_do_ioctl() local
611 bool streams_subdev = sd->flags & V4L2_SUBDEV_FL_STREAMS; in subdev_do_ioctl()
673 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
679 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
685 vdev, sd->v4l2_dev->mdev, arg); in subdev_do_ioctl()
688 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) in subdev_do_ioctl()
694 return v4l2_subdev_call(sd, core, subscribe_event, vfh, arg); in subdev_do_ioctl()
697 return v4l2_subdev_call(sd, core, unsubscribe_event, vfh, arg); in subdev_do_ioctl()
706 return v4l2_subdev_call(sd, core, g_register, p); in subdev_do_ioctl()
714 return v4l2_subdev_call(sd, core, s_register, p); in subdev_do_ioctl()
722 if (sd->ops->core && sd->ops->core->s_register) in subdev_do_ioctl()
724 if (sd->ops->core && sd->ops->core->g_register) in subdev_do_ioctl()
726 strscpy(p->name, sd->name, sizeof(p->name)); in subdev_do_ioctl()
735 sd->name); in subdev_do_ioctl()
736 ret = v4l2_subdev_call(sd, core, log_status); in subdev_do_ioctl()
738 sd->name); in subdev_do_ioctl()
750 return v4l2_subdev_call(sd, pad, get_fmt, state, format); in subdev_do_ioctl()
764 return v4l2_subdev_call(sd, pad, set_fmt, state, format); in subdev_do_ioctl()
782 sd, pad, get_selection, state, &sel); in subdev_do_ioctl()
808 sd, pad, set_selection, state, &sel); in subdev_do_ioctl()
822 return v4l2_subdev_call(sd, pad, enum_mbus_code, state, in subdev_do_ioctl()
833 return v4l2_subdev_call(sd, pad, enum_frame_size, state, in subdev_do_ioctl()
844 return v4l2_subdev_call(sd, pad, get_frame_interval, state, fi); in subdev_do_ioctl()
857 return v4l2_subdev_call(sd, pad, set_frame_interval, state, fi); in subdev_do_ioctl()
867 return v4l2_subdev_call(sd, pad, enum_frame_interval, state, in subdev_do_ioctl()
879 sd, pad, get_selection, state, sel); in subdev_do_ioctl()
893 sd, pad, set_selection, state, sel); in subdev_do_ioctl()
899 return v4l2_subdev_call(sd, pad, get_edid, edid); in subdev_do_ioctl()
905 return v4l2_subdev_call(sd, pad, set_edid, edid); in subdev_do_ioctl()
911 return v4l2_subdev_call(sd, pad, dv_timings_cap, cap); in subdev_do_ioctl()
917 return v4l2_subdev_call(sd, pad, enum_dv_timings, dvt); in subdev_do_ioctl()
921 return v4l2_subdev_call(sd, pad, query_dv_timings, 0, arg); in subdev_do_ioctl()
924 return v4l2_subdev_call(sd, pad, g_dv_timings, 0, arg); in subdev_do_ioctl()
930 return v4l2_subdev_call(sd, pad, s_dv_timings, 0, arg); in subdev_do_ioctl()
933 return v4l2_subdev_call(sd, video, g_std, arg); in subdev_do_ioctl()
941 return v4l2_subdev_call(sd, video, s_std, *std); in subdev_do_ioctl()
948 if (v4l2_subdev_call(sd, video, g_tvnorms, &id)) in subdev_do_ioctl()
955 return v4l2_subdev_call(sd, video, querystd, arg); in subdev_do_ioctl()
964 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) in subdev_do_ioctl()
990 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) in subdev_do_ioctl()
1003 const struct media_pad *pads = sd->entity.pads; in subdev_do_ioctl()
1009 if (route->sink_pad >= sd->entity.num_pads) in subdev_do_ioctl()
1016 if (route->source_pad >= sd->entity.num_pads) in subdev_do_ioctl()
1028 if (!v4l2_subdev_has_op(sd, pad, set_routing)) { in subdev_do_ioctl()
1042 rval = v4l2_subdev_call(sd, pad, set_routing, state, in subdev_do_ioctl()
1085 return v4l2_subdev_call(sd, core, ioctl, cmd, arg); in subdev_do_ioctl()
1101 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_do_ioctl_lock() local
1106 state = subdev_ioctl_get_state(sd, subdev_fh, cmd, arg); in subdev_do_ioctl_lock()
1133 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_compat_ioctl32() local
1135 return v4l2_subdev_call(sd, core, compat_ioctl32, cmd, arg); in subdev_compat_ioctl32()
1158 struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); in subdev_poll() local
1161 if (!(sd->flags & V4L2_SUBDEV_FL_HAS_EVENTS)) in subdev_poll()
1189 struct v4l2_subdev *sd; in v4l2_subdev_get_fwnode_pad_1_to_1() local
1194 sd = media_entity_to_v4l2_subdev(entity); in v4l2_subdev_get_fwnode_pad_1_to_1()
1199 if (device_match_fwnode(sd->dev, fwnode)) in v4l2_subdev_get_fwnode_pad_1_to_1()
1206 int v4l2_subdev_link_validate_default(struct v4l2_subdev *sd, in v4l2_subdev_link_validate_default() argument
1215 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1223 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1231 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1244 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1254 dev_dbg(sd->entity.graph_obj.mdev->dev, in v4l2_subdev_link_validate_default()
1269 struct v4l2_subdev *sd; in v4l2_subdev_link_validate_get_format() local
1272 sd = media_entity_to_v4l2_subdev(pad->entity); in v4l2_subdev_link_validate_get_format()
1279 state = v4l2_subdev_get_locked_active_state(sd); in v4l2_subdev_link_validate_get_format()
1281 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_link_validate_get_format()
1283 ret = v4l2_subdev_call(sd, pad, get_fmt, state, fmt); in v4l2_subdev_link_validate_get_format()
1516 struct v4l2_subdev *sd = media_entity_to_v4l2_subdev(entity); in v4l2_subdev_has_pad_interdep() local
1521 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_has_pad_interdep()
1545 __v4l2_subdev_state_alloc(struct v4l2_subdev *sd, const char *lock_name, in __v4l2_subdev_state_alloc() argument
1556 if (sd->state_lock) in __v4l2_subdev_state_alloc()
1557 state->lock = sd->state_lock; in __v4l2_subdev_state_alloc()
1561 state->sd = sd; in __v4l2_subdev_state_alloc()
1564 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS) && sd->entity.num_pads) { in __v4l2_subdev_state_alloc()
1565 state->pads = kvcalloc(sd->entity.num_pads, in __v4l2_subdev_state_alloc()
1573 if (sd->internal_ops && sd->internal_ops->init_state) { in __v4l2_subdev_state_alloc()
1579 ret = sd->internal_ops->init_state(sd, state); in __v4l2_subdev_state_alloc()
1612 int __v4l2_subdev_init_finalize(struct v4l2_subdev *sd, const char *name, in __v4l2_subdev_init_finalize() argument
1616 struct device *dev = sd->dev; in __v4l2_subdev_init_finalize()
1623 has_s_stream = v4l2_subdev_has_op(sd, video, s_stream); in __v4l2_subdev_init_finalize()
1624 has_enable_streams = v4l2_subdev_has_op(sd, pad, enable_streams); in __v4l2_subdev_init_finalize()
1625 has_disable_streams = v4l2_subdev_has_op(sd, pad, disable_streams); in __v4l2_subdev_init_finalize()
1630 sd->name); in __v4l2_subdev_init_finalize()
1634 if (sd->flags & V4L2_SUBDEV_FL_STREAMS) { in __v4l2_subdev_init_finalize()
1638 sd->name); in __v4l2_subdev_init_finalize()
1644 state = __v4l2_subdev_state_alloc(sd, name, key); in __v4l2_subdev_init_finalize()
1648 sd->active_state = state; in __v4l2_subdev_init_finalize()
1654 void v4l2_subdev_cleanup(struct v4l2_subdev *sd) in v4l2_subdev_cleanup() argument
1658 __v4l2_subdev_state_free(sd->active_state); in v4l2_subdev_cleanup()
1659 sd->active_state = NULL; in v4l2_subdev_cleanup()
1662 if (!sd->async_subdev_endpoint_list.next) in v4l2_subdev_cleanup()
1665 list_for_each_entry_safe(ase, ase_tmp, &sd->async_subdev_endpoint_list, in v4l2_subdev_cleanup()
1688 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_format()
1722 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_crop()
1756 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_compose()
1792 if (pad >= state->sd->entity.num_pads) in __v4l2_subdev_state_get_interval()
1863 int v4l2_subdev_get_fmt(struct v4l2_subdev *sd, struct v4l2_subdev_state *state, in v4l2_subdev_get_fmt() argument
1878 int v4l2_subdev_get_frame_interval(struct v4l2_subdev *sd, in v4l2_subdev_get_frame_interval() argument
1894 int v4l2_subdev_set_routing(struct v4l2_subdev *sd, in v4l2_subdev_set_routing() argument
1952 int v4l2_subdev_set_routing_with_fmt(struct v4l2_subdev *sd, in v4l2_subdev_set_routing_with_fmt() argument
1961 ret = v4l2_subdev_set_routing(sd, state, routing); in v4l2_subdev_set_routing_with_fmt()
2048 int v4l2_subdev_routing_validate(struct v4l2_subdev *sd, in v4l2_subdev_routing_validate() argument
2058 remote_pads = kcalloc(sd->entity.num_pads, sizeof(*remote_pads), in v4l2_subdev_routing_validate()
2063 for (i = 0; i < sd->entity.num_pads; ++i) in v4l2_subdev_routing_validate()
2071 if (route->sink_pad >= sd->entity.num_pads || in v4l2_subdev_routing_validate()
2072 !(sd->entity.pads[route->sink_pad].flags & MEDIA_PAD_FL_SINK)) { in v4l2_subdev_routing_validate()
2073 dev_dbg(sd->dev, "route %u sink (%u) is not a sink pad\n", in v4l2_subdev_routing_validate()
2078 if (route->source_pad >= sd->entity.num_pads || in v4l2_subdev_routing_validate()
2079 !(sd->entity.pads[route->source_pad].flags & MEDIA_PAD_FL_SOURCE)) { in v4l2_subdev_routing_validate()
2080 dev_dbg(sd->dev, "route %u source (%u) is not a source pad\n", in v4l2_subdev_routing_validate()
2092 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2106 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2120 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2134 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2156 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2170 dev_dbg(sd->dev, in v4l2_subdev_routing_validate()
2187 static void v4l2_subdev_collect_streams(struct v4l2_subdev *sd, in v4l2_subdev_collect_streams() argument
2193 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) { in v4l2_subdev_collect_streams()
2196 (sd->enabled_pads & BIT_ULL(pad)) ? BIT_ULL(0) : 0; in v4l2_subdev_collect_streams()
2216 static void v4l2_subdev_set_streams_enabled(struct v4l2_subdev *sd, in v4l2_subdev_set_streams_enabled() argument
2221 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) { in v4l2_subdev_set_streams_enabled()
2223 sd->enabled_pads |= BIT_ULL(pad); in v4l2_subdev_set_streams_enabled()
2225 sd->enabled_pads &= ~BIT_ULL(pad); in v4l2_subdev_set_streams_enabled()
2238 int v4l2_subdev_enable_streams(struct v4l2_subdev *sd, u32 pad, in v4l2_subdev_enable_streams() argument
2241 struct device *dev = sd->entity.graph_obj.mdev->dev; in v4l2_subdev_enable_streams()
2250 if (pad >= sd->entity.num_pads) in v4l2_subdev_enable_streams()
2253 if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)) in v4l2_subdev_enable_streams()
2260 if (pad >= sizeof(sd->enabled_pads) * BITS_PER_BYTE) in v4l2_subdev_enable_streams()
2267 use_s_stream = !v4l2_subdev_has_op(sd, pad, enable_streams); in v4l2_subdev_enable_streams()
2270 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_enable_streams()
2279 v4l2_subdev_collect_streams(sd, state, pad, streams_mask, in v4l2_subdev_enable_streams()
2284 streams_mask & ~found_streams, sd->entity.name, pad); in v4l2_subdev_enable_streams()
2291 enabled_streams, sd->entity.name, pad); in v4l2_subdev_enable_streams()
2298 already_streaming = v4l2_subdev_is_streaming(sd); in v4l2_subdev_enable_streams()
2302 ret = v4l2_subdev_call(sd, pad, enable_streams, state, pad, in v4l2_subdev_enable_streams()
2307 ret = v4l2_subdev_call(sd, video, s_stream, 1); in v4l2_subdev_enable_streams()
2319 v4l2_subdev_set_streams_enabled(sd, state, pad, streams_mask, true); in v4l2_subdev_enable_streams()
2329 v4l2_subdev_enable_privacy_led(sd); in v4l2_subdev_enable_streams()
2339 int v4l2_subdev_disable_streams(struct v4l2_subdev *sd, u32 pad, in v4l2_subdev_disable_streams() argument
2342 struct device *dev = sd->entity.graph_obj.mdev->dev; in v4l2_subdev_disable_streams()
2350 if (pad >= sd->entity.num_pads) in v4l2_subdev_disable_streams()
2353 if (!(sd->entity.pads[pad].flags & MEDIA_PAD_FL_SOURCE)) in v4l2_subdev_disable_streams()
2360 if (pad >= sizeof(sd->enabled_pads) * BITS_PER_BYTE) in v4l2_subdev_disable_streams()
2367 use_s_stream = !v4l2_subdev_has_op(sd, pad, disable_streams); in v4l2_subdev_disable_streams()
2370 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_disable_streams()
2379 v4l2_subdev_collect_streams(sd, state, pad, streams_mask, in v4l2_subdev_disable_streams()
2384 streams_mask & ~found_streams, sd->entity.name, pad); in v4l2_subdev_disable_streams()
2391 streams_mask & ~enabled_streams, sd->entity.name, pad); in v4l2_subdev_disable_streams()
2400 ret = v4l2_subdev_call(sd, pad, disable_streams, state, pad, in v4l2_subdev_disable_streams()
2405 if (!(sd->enabled_pads & ~BIT_ULL(pad))) in v4l2_subdev_disable_streams()
2406 ret = v4l2_subdev_call(sd, video, s_stream, 0); in v4l2_subdev_disable_streams()
2417 v4l2_subdev_set_streams_enabled(sd, state, pad, streams_mask, false); in v4l2_subdev_disable_streams()
2421 if (!v4l2_subdev_is_streaming(sd)) in v4l2_subdev_disable_streams()
2422 v4l2_subdev_disable_privacy_led(sd); in v4l2_subdev_disable_streams()
2431 int v4l2_subdev_s_stream_helper(struct v4l2_subdev *sd, int enable) in v4l2_subdev_s_stream_helper() argument
2444 media_entity_for_each_pad(&sd->entity, pad) { in v4l2_subdev_s_stream_helper()
2454 if (sd->flags & V4L2_SUBDEV_FL_STREAMS) { in v4l2_subdev_s_stream_helper()
2459 state = v4l2_subdev_lock_and_get_active_state(sd); in v4l2_subdev_s_stream_helper()
2474 return v4l2_subdev_enable_streams(sd, pad_index, source_mask); in v4l2_subdev_s_stream_helper()
2476 return v4l2_subdev_disable_streams(sd, pad_index, source_mask); in v4l2_subdev_s_stream_helper()
2484 void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops) in v4l2_subdev_init() argument
2486 INIT_LIST_HEAD(&sd->list); in v4l2_subdev_init()
2488 sd->ops = ops; in v4l2_subdev_init()
2489 sd->v4l2_dev = NULL; in v4l2_subdev_init()
2490 sd->flags = 0; in v4l2_subdev_init()
2491 sd->name[0] = '\0'; in v4l2_subdev_init()
2492 sd->grp_id = 0; in v4l2_subdev_init()
2493 sd->dev_priv = NULL; in v4l2_subdev_init()
2494 sd->host_priv = NULL; in v4l2_subdev_init()
2495 sd->privacy_led = NULL; in v4l2_subdev_init()
2496 INIT_LIST_HEAD(&sd->async_subdev_endpoint_list); in v4l2_subdev_init()
2498 sd->entity.name = sd->name; in v4l2_subdev_init()
2499 sd->entity.obj_type = MEDIA_ENTITY_TYPE_V4L2_SUBDEV; in v4l2_subdev_init()
2500 sd->entity.function = MEDIA_ENT_F_V4L2_SUBDEV_UNKNOWN; in v4l2_subdev_init()
2505 void v4l2_subdev_notify_event(struct v4l2_subdev *sd, in v4l2_subdev_notify_event() argument
2508 v4l2_event_queue(sd->devnode, ev); in v4l2_subdev_notify_event()
2509 v4l2_subdev_notify(sd, V4L2_DEVICE_NOTIFY_EVENT, (void *)ev); in v4l2_subdev_notify_event()
2513 bool v4l2_subdev_is_streaming(struct v4l2_subdev *sd) in v4l2_subdev_is_streaming() argument
2517 if (!v4l2_subdev_has_op(sd, pad, enable_streams)) in v4l2_subdev_is_streaming()
2518 return sd->s_stream_enabled; in v4l2_subdev_is_streaming()
2520 if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS)) in v4l2_subdev_is_streaming()
2521 return !!sd->enabled_pads; in v4l2_subdev_is_streaming()
2523 state = v4l2_subdev_get_locked_active_state(sd); in v4l2_subdev_is_streaming()
2538 int v4l2_subdev_get_privacy_led(struct v4l2_subdev *sd) in v4l2_subdev_get_privacy_led() argument
2541 sd->privacy_led = led_get(sd->dev, "privacy-led"); in v4l2_subdev_get_privacy_led()
2542 if (IS_ERR(sd->privacy_led) && PTR_ERR(sd->privacy_led) != -ENOENT) in v4l2_subdev_get_privacy_led()
2543 return dev_err_probe(sd->dev, PTR_ERR(sd->privacy_led), in v4l2_subdev_get_privacy_led()
2546 if (!IS_ERR_OR_NULL(sd->privacy_led)) { in v4l2_subdev_get_privacy_led()
2547 mutex_lock(&sd->privacy_led->led_access); in v4l2_subdev_get_privacy_led()
2548 led_sysfs_disable(sd->privacy_led); in v4l2_subdev_get_privacy_led()
2549 led_trigger_remove(sd->privacy_led); in v4l2_subdev_get_privacy_led()
2550 led_set_brightness(sd->privacy_led, 0); in v4l2_subdev_get_privacy_led()
2551 mutex_unlock(&sd->privacy_led->led_access); in v4l2_subdev_get_privacy_led()
2558 void v4l2_subdev_put_privacy_led(struct v4l2_subdev *sd) in v4l2_subdev_put_privacy_led() argument
2561 if (!IS_ERR_OR_NULL(sd->privacy_led)) { in v4l2_subdev_put_privacy_led()
2562 mutex_lock(&sd->privacy_led->led_access); in v4l2_subdev_put_privacy_led()
2563 led_sysfs_enable(sd->privacy_led); in v4l2_subdev_put_privacy_led()
2564 mutex_unlock(&sd->privacy_led->led_access); in v4l2_subdev_put_privacy_led()
2565 led_put(sd->privacy_led); in v4l2_subdev_put_privacy_led()