Hi Biju, On 2018-08-29 10:41:16 +0000, Biju Das wrote: > Hi All, > > I started testing vin on R-Car Gen3(CVBS input from DVD player connected to R-Car M3-W,kernel:-renesas-devel-20180827-4.19-rc1) > based on the information present in https://elinux.org/R-Car/Tests:rcar-vin. > > Looks like PAL is not supported. > When i execute the command, "media-ctl -d /dev/media1 --get-v4l2 "'adv748x 4-0070 afe':8"" on target > , i get "[fmt:UYVY8_2X8/720x240 field:alternate]" instead of "[fmt:UYVY8_2X8/720x288 field:alternate]" > > root@salvator-x:~# media-ctl -d /dev/media1 --get-v4l2 "'adv748x 4-0070 afe':8" > [ 28.708110] ##########afe->curr_norm=1000 V4L2_STD_525_60=f900 > [fmt:UYVY8_2X8/720x240 field:alternate] > > Q1) Have any one observed this issue? The format from the AFE is based on the video standard set. As v4l2 don't allow a subdevice to autodetect and change the video standard automatically, you need to do this as the first step of the pipeline configuration. The default standard of the adv748x driver is NTSC and that is why this step is not strictly needed when testing a NTSC source. 1. Boot board video source off and check formats $ v4l2-ctl --get-detected-standard -d /dev/v4l-subdev23 Video Standard = 0x00000000 $ media-ctl -d /dev/media2 --get-v4l2 "'adv748x 4-0070 afe':8" [fmt:UYVY8_2X8/720x240 field:alternate colorspace:smpte170m] 2. Turn on video PAL source and check formats $ v4l2-ctl --get-detected-standard -d /dev/v4l-subdev23 Video Standard = 0x000000ff PAL-B/B1/G/H/I/D/D1 $ media-ctl -d /dev/media2 --get-v4l2 "'adv748x 4-0070 afe':8" [fmt:UYVY8_2X8/720x240 field:alternate colorspace:smpte170m] Notice that the resolution is still for NTSC. 3. Set video standard of the AFE and check format $ v4l2-ctl --set-standard=0x000000ff -d /dev/v4l-subdev23 Standard set to 80000000000000ff $ media-ctl -d /dev/media2 --get-v4l2 "'adv748x 4-0070 afe':8" [fmt:UYVY8_2X8/720x288 field:alternate colorspace:smpte170m] You now have a correct standard for the AFE and can configure a correct pipeline to capture PAL. > > So I created a patch[2], based on [1]. With this, I get proper PAL resolution(720x576) > > root@salvator-x:~# media-ctl -d /dev/media1 --get-v4l2 "'adv748x 4-0070 afe':8" > [ 42.472582] ##########afe->curr_norm=ff V4L2_STD_525_60=f900 > [fmt:UYVY8_2X8/720x288 field:alternate] > > Q2) Is there any reason for not upstreaming the patch [1]? As Kieran stated a subdevice is not allowed to change the video standard on it's own. Instead the user is required to ask the subevice which standard it detects and explicitly set that standard when configuring the video pipeline before capturing. > > [1] https://kernel.googlesource.com/pub/scm/linux/kernel/git/horms/renesas-bsp/+/e0740949ae6b964da8bf1e88b504405276652aa7%5E%21/#F0 > > [2] > --- a/drivers/media/i2c/adv748x/adv748x-afe.c > +++ b/drivers/media/i2c/adv748x/adv748x-afe.c > > @ -352,6 +353,7 @@ static int adv748x_afe_get_format(struct v4l2_subdev *sd, > { > struct adv748x_afe *afe = adv748x_sd_to_afe(sd); > struct v4l2_mbus_framefmt *mbusformat; > + v4l2_std_id std = 0; > /* It makes no sense to get the format of the analog sink pads */ > if (sdformat->pad != ADV748X_AFE_SOURCE) > @@ -361,6 +363,9 @@ static int adv748x_afe_get_format(struct v4l2_subdev *sd, > mbusformat = v4l2_subdev_get_try_format(sd, cfg, sdformat->pad); > sdformat->format = *mbusformat; > } else { > + /* Set std_id automatically */ > + adv748x_afe_querystd(sd, &std); > + adv748x_afe_s_std(sd, std); > adv748x_afe_fill_format(afe, &sdformat->format); > adv748x_afe_propagate_pixelrate(afe); > > > Regards, > Biju > > > > > Renesas Electronics Europe Ltd, Dukes Meadow, Millboard Road, Bourne End, Buckinghamshire, SL8 5FH, UK. Registered in England & Wales under Registered No. 04586709. -- Regards, Niklas Söderlund