Message ID | 20220926142505.1827-3-quic_mmitkov@quicinc.com |
---|---|
State | Superseded |
Headers | show |
Series | media: camss: sm8250: Virtual channels support for SM8250 | expand |
On Mon, 26 Sept 2022 at 16:25, <quic_mmitkov@quicinc.com> wrote: > > From: Milen Mitkov <quic_mmitkov@quicinc.com> > > For multiple virtual channels support, each VFE line can be in either > ON, RESERVED or OFF states. This allows the starting and stopping > of a VFE line independently of other active VFE lines. > > Also, link the CSID entity's source ports to corresponding VFE lines. > > Signed-off-by: Milen Mitkov <quic_mmitkov@quicinc.com> > --- > drivers/media/platform/qcom/camss/camss-vfe.c | 7 +++++++ > drivers/media/platform/qcom/camss/camss.c | 2 +- > 2 files changed, 8 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c > index a26e4a5d87b6..cd8ac0478cf1 100644 > --- a/drivers/media/platform/qcom/camss/camss-vfe.c > +++ b/drivers/media/platform/qcom/camss/camss-vfe.c > @@ -738,8 +738,10 @@ static int vfe_set_stream(struct v4l2_subdev *sd, int enable) > struct vfe_line *line = v4l2_get_subdevdata(sd); > struct vfe_device *vfe = to_vfe(line); > int ret; > + int i; > > if (enable) { > + line->output.state = VFE_OUTPUT_RESERVED; > ret = vfe->ops->vfe_enable(line); > if (ret < 0) > dev_err(vfe->camss->dev, > @@ -749,6 +751,11 @@ static int vfe_set_stream(struct v4l2_subdev *sd, int enable) > if (ret < 0) > dev_err(vfe->camss->dev, > "Failed to disable vfe outputs\n"); > + > + /* At least one VFE line remains, return -EBUSY to avoid premature pipeline stop */ > + for (i = 0; i < vfe->line_num; i++) > + if (vfe->line[i].output.state != VFE_OUTPUT_OFF) > + return -EBUSY; > } > > return ret; > diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c > index 1118c40886d5..63653ac3e056 100644 > --- a/drivers/media/platform/qcom/camss/camss.c > +++ b/drivers/media/platform/qcom/camss/camss.c > @@ -1320,7 +1320,7 @@ static int camss_register_entities(struct camss *camss) > struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; > > ret = media_create_pad_link(&csid->entity, > - MSM_CSID_PAD_SRC, > + MSM_CSID_PAD_FIRST_SRC + j, > &vfe->entity, > MSM_VFE_PAD_SINK, > 0); > -- > 2.37.3 > Reviewed-by: Robert Foss <robert.foss@linaro.org>
diff --git a/drivers/media/platform/qcom/camss/camss-vfe.c b/drivers/media/platform/qcom/camss/camss-vfe.c index a26e4a5d87b6..cd8ac0478cf1 100644 --- a/drivers/media/platform/qcom/camss/camss-vfe.c +++ b/drivers/media/platform/qcom/camss/camss-vfe.c @@ -738,8 +738,10 @@ static int vfe_set_stream(struct v4l2_subdev *sd, int enable) struct vfe_line *line = v4l2_get_subdevdata(sd); struct vfe_device *vfe = to_vfe(line); int ret; + int i; if (enable) { + line->output.state = VFE_OUTPUT_RESERVED; ret = vfe->ops->vfe_enable(line); if (ret < 0) dev_err(vfe->camss->dev, @@ -749,6 +751,11 @@ static int vfe_set_stream(struct v4l2_subdev *sd, int enable) if (ret < 0) dev_err(vfe->camss->dev, "Failed to disable vfe outputs\n"); + + /* At least one VFE line remains, return -EBUSY to avoid premature pipeline stop */ + for (i = 0; i < vfe->line_num; i++) + if (vfe->line[i].output.state != VFE_OUTPUT_OFF) + return -EBUSY; } return ret; diff --git a/drivers/media/platform/qcom/camss/camss.c b/drivers/media/platform/qcom/camss/camss.c index 1118c40886d5..63653ac3e056 100644 --- a/drivers/media/platform/qcom/camss/camss.c +++ b/drivers/media/platform/qcom/camss/camss.c @@ -1320,7 +1320,7 @@ static int camss_register_entities(struct camss *camss) struct v4l2_subdev *vfe = &camss->vfe[k].line[j].subdev; ret = media_create_pad_link(&csid->entity, - MSM_CSID_PAD_SRC, + MSM_CSID_PAD_FIRST_SRC + j, &vfe->entity, MSM_VFE_PAD_SINK, 0);