On Thu, 2018-05-31 at 17:30 -0700, Steve Longerbeam wrote: > The logic for setting field type in try_fmt at CSI and PRPENCVF > entities wasn't quite right. The behavior should be: > > - No restrictions on field type at sink pads (except ANY, which is filled > with current sink pad field by imx_media_fill_default_mbus_fields()). > > - At IDMAC output pads, if the caller asks for an interlaced output, and > the input is sequential fields, the IDMAC output channel can accommodate > by interweaving. The CSI can also interweave if input is alternate > fields. > > - If final source pad field type is alternate, translate to seq_bt or > seq_tb. But the field order translation was backwards, SD NTSC is BT > order, SD PAL is TB. > > Move this logic to new functions csi_try_field() and prp_try_field(). > > Signed-off-by: Steve Longerbeam <steve_longerbeam@xxxxxxxxxx> > --- > drivers/staging/media/imx/imx-ic-prpencvf.c | 22 +++++++++++-- > drivers/staging/media/imx/imx-media-csi.c | 50 +++++++++++++++++++++-------- > 2 files changed, 56 insertions(+), 16 deletions(-) > > diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c > index 7e1e0c3..1002eb1 100644 > --- a/drivers/staging/media/imx/imx-ic-prpencvf.c > +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c > @@ -833,6 +833,21 @@ static int prp_get_fmt(struct v4l2_subdev *sd, > return ret; > } > > +static void prp_try_field(struct prp_priv *priv, > + struct v4l2_subdev_pad_config *cfg, > + struct v4l2_subdev_format *sdformat) > +{ > + struct v4l2_mbus_framefmt *infmt = > + __prp_get_fmt(priv, cfg, PRPENCVF_SINK_PAD, sdformat->which); > + > + /* no restrictions on sink pad field type */ > + if (sdformat->pad == PRPENCVF_SINK_PAD) > + return; > + > + if (!idmac_interweave(sdformat->format.field, infmt->field)) > + sdformat->format.field = infmt->field; This is not strict enough. As I wrote in reply to patch 4, we can only do SEQ_TB -> INTERLACED_TB and SEQ_BT -> INTERLACED_BT interweaving. regards Philipp