mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-21 18:25:26 -04:00
media: ipu6: Remove source_entity from struct ipu6_isys_stream
Remove source_entity from struct ipu6_isys_stream and instead pass it on in function arguments. Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com> Tested-by: Mehdi Djait <mehdi.djait@linux.intel.com> # Dell XPS 9315 Reviewed-by: Mehdi Djait <mehdi.djait@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
This commit is contained in:
committed by
Hans Verkuil
parent
7c30585091
commit
e660207a1d
@@ -532,14 +532,28 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
ipu6_isys_get_isys_format(ipu6_isys_get_format(av), 0);
|
||||
struct ipu6_isys_buffer_list __bl, *bl = NULL;
|
||||
struct ipu6_isys_stream *stream;
|
||||
struct media_entity *source_entity = NULL;
|
||||
struct media_pad *source_pad, *remote_pad;
|
||||
int nr_queues, ret;
|
||||
|
||||
dev_dbg(dev, "stream: %s: width %u, height %u, css pixelformat %u\n",
|
||||
av->vdev.name, ipu6_isys_get_frame_width(av),
|
||||
ipu6_isys_get_frame_height(av), pfmt->css_pixelformat);
|
||||
|
||||
ret = ipu6_isys_setup_video(av, &source_entity, &nr_queues);
|
||||
remote_pad = media_pad_remote_pad_unique(&av->pad);
|
||||
if (IS_ERR(remote_pad)) {
|
||||
dev_dbg(dev, "failed to get remote pad\n");
|
||||
ret = PTR_ERR(remote_pad);
|
||||
goto out_return_buffers;
|
||||
}
|
||||
|
||||
source_pad = media_pad_remote_pad_unique(&remote_pad->entity->pads[0]);
|
||||
if (IS_ERR(source_pad)) {
|
||||
dev_dbg(dev, "No external source entity\n");
|
||||
ret = PTR_ERR(source_pad);
|
||||
goto out_return_buffers;
|
||||
}
|
||||
|
||||
ret = ipu6_isys_setup_video(av, remote_pad, source_pad, &nr_queues);
|
||||
if (ret < 0) {
|
||||
dev_dbg(dev, "failed to setup video\n");
|
||||
goto out_return_buffers;
|
||||
@@ -560,7 +574,7 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
stream = av->stream;
|
||||
mutex_lock(&stream->mutex);
|
||||
if (!stream->nr_streaming) {
|
||||
ret = ipu6_isys_video_prepare_stream(av, source_entity,
|
||||
ret = ipu6_isys_video_prepare_stream(av, source_pad->entity,
|
||||
nr_queues);
|
||||
if (ret)
|
||||
goto out_fw_close;
|
||||
@@ -571,7 +585,7 @@ static int start_streaming(struct vb2_queue *q, unsigned int count)
|
||||
stream->nr_queues);
|
||||
|
||||
list_add(&aq->node, &stream->queues);
|
||||
ipu6_isys_configure_stream_watermark(av, true);
|
||||
ipu6_isys_configure_stream_watermark(av, source_pad->entity);
|
||||
ipu6_isys_update_stream_watermark(av, true);
|
||||
|
||||
if (stream->nr_streaming != stream->nr_queues)
|
||||
|
||||
@@ -745,17 +745,16 @@ int ipu6_isys_video_prepare_stream(struct ipu6_isys_video *av,
|
||||
stream->stream_source = stream->asd->source;
|
||||
csi2 = ipu6_isys_subdev_to_csi2(stream->asd);
|
||||
csi2->receiver_errors = 0;
|
||||
stream->source_entity = source_entity;
|
||||
|
||||
dev_dbg(&av->isys->adev->auxdev.dev,
|
||||
"prepare stream: external entity %s\n",
|
||||
stream->source_entity->name);
|
||||
source_entity->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ipu6_isys_configure_stream_watermark(struct ipu6_isys_video *av,
|
||||
bool state)
|
||||
struct media_entity *source)
|
||||
{
|
||||
struct ipu6_isys *isys = av->isys;
|
||||
struct ipu6_isys_csi2 *csi2 = NULL;
|
||||
@@ -769,10 +768,7 @@ void ipu6_isys_configure_stream_watermark(struct ipu6_isys_video *av,
|
||||
u64 pixel_rate = 0;
|
||||
int ret;
|
||||
|
||||
if (!state)
|
||||
return;
|
||||
|
||||
esd = media_entity_to_v4l2_subdev(av->stream->source_entity);
|
||||
esd = media_entity_to_v4l2_subdev(source);
|
||||
|
||||
av->watermark.width = ipu6_isys_get_frame_width(av);
|
||||
av->watermark.height = ipu6_isys_get_frame_height(av);
|
||||
@@ -804,7 +800,7 @@ void ipu6_isys_configure_stream_watermark(struct ipu6_isys_video *av,
|
||||
iwake_watermark->force_iwake_disable = true;
|
||||
mutex_unlock(&iwake_watermark->mutex);
|
||||
dev_warn(dev, "unexpected pixel_rate from %s, disable iwake.\n",
|
||||
av->stream->source_entity->name);
|
||||
source->name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1011,9 +1007,6 @@ int ipu6_isys_video_set_streaming(struct ipu6_isys_video *av, int state,
|
||||
|
||||
dev_dbg(dev, "set stream: %d\n", state);
|
||||
|
||||
if (WARN(!stream->source_entity, "No source entity for stream\n"))
|
||||
return -ENODEV;
|
||||
|
||||
sd = &stream->asd->sd;
|
||||
r_pad = media_pad_remote_pad_first(&av->pad);
|
||||
r_stream = ipu6_isys_get_src_stream_by_src_pad(sd, r_pad->index);
|
||||
@@ -1179,7 +1172,8 @@ void ipu6_isys_fw_close(struct ipu6_isys *isys)
|
||||
}
|
||||
|
||||
int ipu6_isys_setup_video(struct ipu6_isys_video *av,
|
||||
struct media_entity **source_entity, int *nr_queues)
|
||||
struct media_pad *remote_pad,
|
||||
struct media_pad *source_pad, int *nr_queues)
|
||||
{
|
||||
const struct ipu6_isys_pixelformat *pfmt =
|
||||
ipu6_isys_get_isys_format(ipu6_isys_get_format(av), 0);
|
||||
@@ -1188,30 +1182,14 @@ int ipu6_isys_setup_video(struct ipu6_isys_video *av,
|
||||
struct v4l2_subdev_route *route = NULL;
|
||||
struct v4l2_subdev_route *r;
|
||||
struct v4l2_subdev_state *state;
|
||||
struct ipu6_isys_subdev *asd;
|
||||
struct v4l2_subdev *remote_sd;
|
||||
struct v4l2_subdev *remote_sd =
|
||||
media_entity_to_v4l2_subdev(remote_pad->entity);
|
||||
struct ipu6_isys_subdev *asd = to_ipu6_isys_subdev(remote_sd);
|
||||
struct media_pipeline *pipeline;
|
||||
struct media_pad *source_pad, *remote_pad;
|
||||
int ret = -EINVAL;
|
||||
|
||||
*nr_queues = 0;
|
||||
|
||||
remote_pad = media_pad_remote_pad_unique(&av->pad);
|
||||
if (IS_ERR(remote_pad)) {
|
||||
dev_dbg(dev, "failed to get remote pad\n");
|
||||
return PTR_ERR(remote_pad);
|
||||
}
|
||||
|
||||
remote_sd = media_entity_to_v4l2_subdev(remote_pad->entity);
|
||||
asd = to_ipu6_isys_subdev(remote_sd);
|
||||
source_pad = media_pad_remote_pad_unique(&remote_pad->entity->pads[0]);
|
||||
if (IS_ERR(source_pad)) {
|
||||
dev_dbg(dev, "No external source entity\n");
|
||||
return PTR_ERR(source_pad);
|
||||
}
|
||||
|
||||
*source_entity = source_pad->entity;
|
||||
|
||||
/* Find the root */
|
||||
state = v4l2_subdev_lock_and_get_active_state(remote_sd);
|
||||
for_each_active_route(&state->routing, r) {
|
||||
@@ -1231,7 +1209,7 @@ int ipu6_isys_setup_video(struct ipu6_isys_video *av,
|
||||
|
||||
ret = ipu6_isys_csi2_get_remote_desc(av->source_stream,
|
||||
to_ipu6_isys_csi2(asd),
|
||||
*source_entity, &entry);
|
||||
source_pad->entity, &entry);
|
||||
if (ret == -ENOIOCTLCMD) {
|
||||
av->vc = 0;
|
||||
av->dt = ipu6_isys_mbus_code_to_mipi(pfmt->code);
|
||||
|
||||
@@ -43,7 +43,6 @@ struct sequence_info {
|
||||
*/
|
||||
struct ipu6_isys_stream {
|
||||
struct mutex mutex;
|
||||
struct media_entity *source_entity;
|
||||
atomic_t sequence;
|
||||
unsigned int seq_index;
|
||||
struct sequence_info seq[IPU6_ISYS_MAX_PARALLEL_SOF];
|
||||
@@ -113,7 +112,8 @@ int ipu6_isys_video_set_streaming(struct ipu6_isys_video *av, int state,
|
||||
int ipu6_isys_fw_open(struct ipu6_isys *isys);
|
||||
void ipu6_isys_fw_close(struct ipu6_isys *isys);
|
||||
int ipu6_isys_setup_video(struct ipu6_isys_video *av,
|
||||
struct media_entity **source_entity, int *nr_queues);
|
||||
struct media_pad *remote_pad,
|
||||
struct media_pad *source_pad, int *nr_queues);
|
||||
int ipu6_isys_video_init(struct ipu6_isys_video *av);
|
||||
void ipu6_isys_video_cleanup(struct ipu6_isys_video *av);
|
||||
void ipu6_isys_put_stream(struct ipu6_isys_stream *stream);
|
||||
@@ -123,7 +123,7 @@ struct ipu6_isys_stream *
|
||||
ipu6_isys_query_stream_by_source(struct ipu6_isys *isys, int source, u8 vc);
|
||||
|
||||
void ipu6_isys_configure_stream_watermark(struct ipu6_isys_video *av,
|
||||
bool state);
|
||||
struct media_entity *source);
|
||||
void ipu6_isys_update_stream_watermark(struct ipu6_isys_video *av, bool state);
|
||||
|
||||
u32 ipu6_isys_get_format(struct ipu6_isys_video *av);
|
||||
|
||||
Reference in New Issue
Block a user