[4/5] ispccdc: Configure CCDC_SYN_MODE register for UYVY8_2X8 and YUYV8_2X8 formats

Message ID 1316530612-23075-5-git-send-email-deepthy.ravi@ti.com (mailing list archive)
State RFC, archived
Headers

Commit Message

Deepthy Ravi Sept. 20, 2011, 2:56 p.m. UTC
Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
register for UYVY8_2X8 and YUYV8_2X8 formats.

Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
---
 drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
  

Comments

Laurent Pinchart Sept. 20, 2011, 11:26 p.m. UTC | #1
Hi Deepthy,

Thanks for the patch.

On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
> register for UYVY8_2X8 and YUYV8_2X8 formats.
> 
> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
> ---
>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
>  1 files changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/media/video/omap3isp/ispccdc.c
> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180 100644
> --- a/drivers/media/video/omap3isp/ispccdc.c
> +++ b/drivers/media/video/omap3isp/ispccdc.c
> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct isp_ccdc_device
> *ccdc,
> 
>  	syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
>  	if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
> -	    format->code == V4L2_MBUS_FMT_UYVY8_2X8)
> -		syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> +	    format->code == V4L2_MBUS_FMT_UYVY8_2X8){
> +		if (pdata && pdata->bt656)
> +			syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> +		else
> +			syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> +	}
>  	else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
>  		 format->code == V4L2_MBUS_FMT_UYVY8_1X16)
>  		syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct isp_ccdc_device
> *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
> 
>  	/* Use PACK8 mode for 1byte per pixel formats. */
> -	if (omap3isp_video_format_info(format->code)->width <= 8)
> +	if ((omap3isp_video_format_info(format->code)->width <= 8) &&
> +			(omap3isp_video_format_info(format->code)->bpp <= 8))

I'm not sure to follow you. This will clear the PACK8 bit for the YUYV8_2X8 
formats. Those formats are 8 bits wide, shouldn't PACK8 be set to store 
samples on 8 bits instead of 16 bits ?

Is this patch intended to support YUYV8_2X8 sensors in non BT.656 mode with 
the bridge enabled ? In that case, what would you think about setting the CCDC 
input format to YUYV8_1X16 instead ? This would better reflect the reality, as 
the bridge converts YUYV8_2X8 to YUYV8_1X16, and the CCDC is then fed with 
YUYV8_1X16.

>  		syn_mode |= ISPCCDC_SYN_MODE_PACK8;
>  	else
>  		syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;
  
Deepthy Ravi Sept. 21, 2011, 5:32 a.m. UTC | #2
Hi Laurent,
> ________________________________________
> From: Laurent Pinchart [laurent.pinchart@ideasonboard.com]
> Sent: Wednesday, September 21, 2011 4:56 AM
> To: Ravi, Deepthy
> Cc: mchehab@infradead.org; tony@atomide.com; Hiremath, Vaibhav;
> linux-media@vger.kernel.org; linux@arm.linux.org.uk;
> linux-arm-kernel@lists.infradead.org; kyungmin.park@samsung.com;
> hverkuil@xs4all.nl; m.szyprowski@samsung.com; g.liakhovetski@gmx.de;
> Shilimkar, Santosh; khilman@deeprootsystems.com; david.woodhouse@intel.com;
> akpm@linux-foundation.org; linux-kernel@vger.kernel.org;
> linux-omap@vger.kernel.org; Sakari Ailus
> Subject: Re: [PATCH 4/5] ispccdc: Configure CCDC_SYN_MODE register for
> UYVY8_2X8 and YUYV8_2X8 formats
>
> Hi Deepthy,
>
> Thanks for the patch.
>
> On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
>> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
>> register for UYVY8_2X8 and YUYV8_2X8 formats.
>>
>> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
>> ---
>>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
>>  1 files changed, 8 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/media/video/omap3isp/ispccdc.c
>> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180 100644
>> --- a/drivers/media/video/omap3isp/ispccdc.c
>> +++ b/drivers/media/video/omap3isp/ispccdc.c
>> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct
>> isp_ccdc_device
>> *ccdc,
>>
>>       syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
>>       if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
>> -         format->code == V4L2_MBUS_FMT_UYVY8_2X8)
>> -             syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
>> +         format->code == V4L2_MBUS_FMT_UYVY8_2X8){
>> +             if (pdata && pdata->bt656)
>> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
>> +             else
>> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
>> +     }
>>       else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
>>                format->code == V4L2_MBUS_FMT_UYVY8_1X16)
>>               syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
>> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct isp_ccdc_device
>> *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
>>
>>       /* Use PACK8 mode for 1byte per pixel formats. */
>> -     if (omap3isp_video_format_info(format->code)->width <= 8)
>> +     if ((omap3isp_video_format_info(format->code)->width <= 8) &&
>> +                     (omap3isp_video_format_info(format->code)->bpp <=
>> 8))
>
> I'm not sure to follow you. This will clear the PACK8 bit for the YUYV8_2X8
> formats. Those formats are 8 bits wide, shouldn't PACK8 be set to store
> samples on 8 bits instead of 16 bits ?
>
> Is this patch intended to support YUYV8_2X8 sensors in non BT.656 mode with
> the bridge enabled ? In that case, what would you think about setting the
> CCDC
> input format to YUYV8_1X16 instead ? This would better reflect the reality,
> as
> the bridge converts YUYV8_2X8 to YUYV8_1X16, and the CCDC is then fed with
> YUYV8_1X16.
>
[Deepthy Ravi] Yes this is intended for  YUYV8_2X8 sensors in non BT.656 with 8 to 16 bit bridge enabled. So the data has to be stored as 16 bits per sample. Thats why PACK8 is cleared . I am not sure about using YUYV8_1X16. 

>>               syn_mode |= ISPCCDC_SYN_MODE_PACK8;
>>       else
>>               syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;
>
> --
> Regards,
>
> Laurent Pinchart
>
  
Laurent Pinchart Sept. 21, 2011, 9:06 a.m. UTC | #3
Hi Deepthy,

On Wednesday 21 September 2011 07:32:44 Ravi, Deepthy wrote:
> On Wednesday, September 21, 2011 4:56 AM Laurent Pinchart wrote:
> > On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
> >> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
> >> register for UYVY8_2X8 and YUYV8_2X8 formats.
> >> 
> >> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
> >> ---
> >> 
> >>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
> >>  1 files changed, 8 insertions(+), 3 deletions(-)
> >> 
> >> diff --git a/drivers/media/video/omap3isp/ispccdc.c
> >> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180 100644
> >> --- a/drivers/media/video/omap3isp/ispccdc.c
> >> +++ b/drivers/media/video/omap3isp/ispccdc.c
> >> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct
> >> isp_ccdc_device
> >> *ccdc,
> >> 
> >>       syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
> >>       if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
> >> 
> >> -         format->code == V4L2_MBUS_FMT_UYVY8_2X8)
> >> -             syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> >> +         format->code == V4L2_MBUS_FMT_UYVY8_2X8){
> >> +             if (pdata && pdata->bt656)
> >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> >> +             else
> >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> >> +     }
> >> 
> >>       else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
> >>       
> >>                format->code == V4L2_MBUS_FMT_UYVY8_1X16)
> >>               
> >>               syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> >> 
> >> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct isp_ccdc_device
> >> *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
> >> 
> >>       /* Use PACK8 mode for 1byte per pixel formats. */
> >> 
> >> -     if (omap3isp_video_format_info(format->code)->width <= 8)
> >> +     if ((omap3isp_video_format_info(format->code)->width <= 8) &&
> >> +                     (omap3isp_video_format_info(format->code)->bpp <=
> >> 8))
> > 
> > I'm not sure to follow you. This will clear the PACK8 bit for the
> > YUYV8_2X8 formats. Those formats are 8 bits wide, shouldn't PACK8 be set
> > to store samples on 8 bits instead of 16 bits ?
> > 
> > Is this patch intended to support YUYV8_2X8 sensors in non BT.656 mode
> > with the bridge enabled ? In that case, what would you think about setting
> > the CCDC input format to YUYV8_1X16 instead ? This would better reflect
> > the reality, as the bridge converts YUYV8_2X8 to YUYV8_1X16, and the CCDC
> > is then fed with YUYV8_1X16.
> 
> Yes this is intended for  YUYV8_2X8 sensors in non BT.656 with 8 to 16 bit
> bridge enabled. So the data has to be stored as 16 bits per sample. Thats
> why PACK8 is cleared . I am not sure about using YUYV8_1X16.

My original idea when I wrote the YV support patches was to implement this use 
case with YUYV8_2X8 at the sensor output and YUYV8_1X16 at the CCDC input. The 
ISP driver could then enable the bridge automatically. I'm not sure if that's 
the best solution though, it might be confusing for the users. What I would 
like to keep, however, is the idea of enabling the bridge automatically.

Sakari, any opinion on this ?

> >>               syn_mode |= ISPCCDC_SYN_MODE_PACK8;
> >>       else
> >>               syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;
  
Deepthy Ravi Sept. 23, 2011, 11:53 a.m. UTC | #4
> ________________________________________
> From: Laurent Pinchart [laurent.pinchart@ideasonboard.com]
> Sent: Wednesday, September 21, 2011 2:36 PM
> To: Ravi, Deepthy
> Cc: mchehab@infradead.org; tony@atomide.com; Hiremath, Vaibhav; linux-media@vger.kernel.org; linux@arm.linux.org.uk; linux-arm-kernel@lists.infradead.org; kyungmin.park@samsung.com; hverkuil@xs4all.nl; m.szyprowski@samsung.com; g.liakhovetski@gmx.de; Shilimkar, Santosh; khilman@deeprootsystems.com; david.woodhouse@intel.com; akpm@linux-foundation.org; linux-kernel@vger.kernel.org; linux-omap@vger.kernel.org; Sakari Ailus
> Subject: Re: [PATCH 4/5] ispccdc: Configure CCDC_SYN_MODE register for UYVY8_2X8 and YUYV8_2X8 formats
>
> Hi Deepthy,
>
> On Wednesday 21 September 2011 07:32:44 Ravi, Deepthy wrote:
>> On Wednesday, September 21, 2011 4:56 AM Laurent Pinchart wrote:
>> > On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
>> >> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
>> >> register for UYVY8_2X8 and YUYV8_2X8 formats.
>> >>
>> >> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
>> >> ---
>> >>
>> >>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
>> >>  1 files changed, 8 insertions(+), 3 deletions(-)
>> >>
>> >> diff --git a/drivers/media/video/omap3isp/ispccdc.c
>> >> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180 100644
>> >> --- a/drivers/media/video/omap3isp/ispccdc.c
>> >> +++ b/drivers/media/video/omap3isp/ispccdc.c
>> >> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct
>> >> isp_ccdc_device
>> >> *ccdc,
>> >>
>> >>       syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
>> >>       if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
>> >>
>> >> -         format->code == V4L2_MBUS_FMT_UYVY8_2X8)
>> >> -             syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
>> >> +         format->code == V4L2_MBUS_FMT_UYVY8_2X8){
>> >> +             if (pdata && pdata->bt656)
>> >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
>> >> +             else
>> >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
>> >> +     }
>> >>
>> >>       else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
>> >>
>> >>                format->code == V4L2_MBUS_FMT_UYVY8_1X16)
>> >>
>> >>               syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
>> >>
>> >> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct isp_ccdc_device
>> >> *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
>> >>
>> >>       /* Use PACK8 mode for 1byte per pixel formats. */
>> >>
>> >> -     if (omap3isp_video_format_info(format->code)->width <= 8)
>> >> +     if ((omap3isp_video_format_info(format->code)->width <= 8) &&
>> >> +                     (omap3isp_video_format_info(format->code)->bpp <=
>> >> 8))
>> >
>> > I'm not sure to follow you. This will clear the PACK8 bit for the
>> > YUYV8_2X8 formats. Those formats are 8 bits wide, shouldn't PACK8 be set
>> > to store samples on 8 bits instead of 16 bits ?
>> >
>> > Is this patch intended to support YUYV8_2X8 sensors in non BT.656 mode
>> > with the bridge enabled ? In that case, what would you think about setting
>> > the CCDC input format to YUYV8_1X16 instead ? This would better reflect
>> > the reality, as the bridge converts YUYV8_2X8 to YUYV8_1X16, and the CCDC
>> > is then fed with YUYV8_1X16.
>>
>> Yes this is intended for  YUYV8_2X8 sensors in non BT.656 with 8 to 16 bit
>> bridge enabled. So the data has to be stored as 16 bits per sample. Thats
>> why PACK8 is cleared . I am not sure about using YUYV8_1X16.
>
> My original idea when I wrote the YV support patches was to implement this use
> case with YUYV8_2X8 at the sensor output and YUYV8_1X16 at the CCDC input. The
> ISP driver could then enable the bridge automatically. I'm not sure if that's
> the best solution though, it might be confusing for the users. What I would
> like to keep, however, is the idea of enabling the bridge automatically.
>
[Deepthy Ravi] But for streaming to start, the formats on both ends of the link should match. I believe setting different formats at sensor output and ccdc input will give a broken pipe error. Is my understanding correct ? If so, how do you propose to handle the situation ? 

> Sakari, any opinion on this ?
>
>> >>               syn_mode |= ISPCCDC_SYN_MODE_PACK8;
>> >>       else
>> >>               syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;
>
> --
> Regards,
>
> Laurent Pinchart
>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Sakari Ailus Sept. 25, 2011, 11:17 a.m. UTC | #5
On Wed, Sep 21, 2011 at 11:06:41AM +0200, Laurent Pinchart wrote:
> Hi Deepthy,

Hi,

(Dropped most of people and lists from cc. I don't think Andrew Morton, for
example, has immediate interest towards this topic. Feel free to prome me
wrong.)

> On Wednesday 21 September 2011 07:32:44 Ravi, Deepthy wrote:
> > On Wednesday, September 21, 2011 4:56 AM Laurent Pinchart wrote:
> > > On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
> > >> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
> > >> register for UYVY8_2X8 and YUYV8_2X8 formats.
> > >> 
> > >> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
> > >> ---
> > >> 
> > >>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
> > >>  1 files changed, 8 insertions(+), 3 deletions(-)
> > >> 
> > >> diff --git a/drivers/media/video/omap3isp/ispccdc.c
> > >> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180 100644
> > >> --- a/drivers/media/video/omap3isp/ispccdc.c
> > >> +++ b/drivers/media/video/omap3isp/ispccdc.c
> > >> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct
> > >> isp_ccdc_device
> > >> *ccdc,
> > >> 
> > >>       syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
> > >>       if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
> > >> 
> > >> -         format->code == V4L2_MBUS_FMT_UYVY8_2X8)
> > >> -             syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> > >> +         format->code == V4L2_MBUS_FMT_UYVY8_2X8){
> > >> +             if (pdata && pdata->bt656)
> > >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> > >> +             else
> > >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> > >> +     }
> > >> 
> > >>       else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
> > >>       
> > >>                format->code == V4L2_MBUS_FMT_UYVY8_1X16)
> > >>               
> > >>               syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> > >> 
> > >> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct isp_ccdc_device
> > >> *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
> > >> 
> > >>       /* Use PACK8 mode for 1byte per pixel formats. */
> > >> 
> > >> -     if (omap3isp_video_format_info(format->code)->width <= 8)
> > >> +     if ((omap3isp_video_format_info(format->code)->width <= 8) &&
> > >> +                     (omap3isp_video_format_info(format->code)->bpp <=
> > >> 8))
> > > 
> > > I'm not sure to follow you. This will clear the PACK8 bit for the
> > > YUYV8_2X8 formats. Those formats are 8 bits wide, shouldn't PACK8 be set
> > > to store samples on 8 bits instead of 16 bits ?
> > > 
> > > Is this patch intended to support YUYV8_2X8 sensors in non BT.656 mode
> > > with the bridge enabled ? In that case, what would you think about setting
> > > the CCDC input format to YUYV8_1X16 instead ? This would better reflect
> > > the reality, as the bridge converts YUYV8_2X8 to YUYV8_1X16, and the CCDC
> > > is then fed with YUYV8_1X16.
> > 
> > Yes this is intended for  YUYV8_2X8 sensors in non BT.656 with 8 to 16 bit
> > bridge enabled. So the data has to be stored as 16 bits per sample. Thats
> > why PACK8 is cleared . I am not sure about using YUYV8_1X16.
> 
> My original idea when I wrote the YV support patches was to implement this use 
> case with YUYV8_2X8 at the sensor output and YUYV8_1X16 at the CCDC input. The 
> ISP driver could then enable the bridge automatically. I'm not sure if that's 
> the best solution though, it might be confusing for the users. What I would 
> like to keep, however, is the idea of enabling the bridge automatically.
> 
> Sakari, any opinion on this ?

Are there any complications from the CCDC also listing the 2X8 formats as
supported in its sink pad? I'd rather support them since doing it the other
way might be somewhat confusing to the users. This would also mean media-ctl
users would have to set both sink and source formats rather than just the
source format when configuring the format for the link.

> > >>               syn_mode |= ISPCCDC_SYN_MODE_PACK8;
> > >>       else
> > >>               syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;
> 
> -- 
> Regards,
> 
> Laurent Pinchart
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
  
Laurent Pinchart Sept. 27, 2011, 12:22 p.m. UTC | #6
Hi Sakari,

On Sunday 25 September 2011 13:17:17 Sakari Ailus wrote:
> On Wed, Sep 21, 2011 at 11:06:41AM +0200, Laurent Pinchart wrote:
> > On Wednesday 21 September 2011 07:32:44 Ravi, Deepthy wrote:
> > > On Wednesday, September 21, 2011 4:56 AM Laurent Pinchart wrote:
> > > > On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
> > > >> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
> > > >> register for UYVY8_2X8 and YUYV8_2X8 formats.
> > > >> 
> > > >> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
> > > >> ---
> > > >> 
> > > >>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
> > > >>  1 files changed, 8 insertions(+), 3 deletions(-)
> > > >> 
> > > >> diff --git a/drivers/media/video/omap3isp/ispccdc.c
> > > >> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180
> > > >> 100644 --- a/drivers/media/video/omap3isp/ispccdc.c
> > > >> +++ b/drivers/media/video/omap3isp/ispccdc.c
> > > >> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct
> > > >> isp_ccdc_device
> > > >> *ccdc,
> > > >> 
> > > >>       syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
> > > >>       if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
> > > >> 
> > > >> -         format->code == V4L2_MBUS_FMT_UYVY8_2X8)
> > > >> -             syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> > > >> +         format->code == V4L2_MBUS_FMT_UYVY8_2X8){
> > > >> +             if (pdata && pdata->bt656)
> > > >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> > > >> +             else
> > > >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> > > >> +     }
> > > >> 
> > > >>       else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
> > > >>       
> > > >>                format->code == V4L2_MBUS_FMT_UYVY8_1X16)
> > > >>               
> > > >>               syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> > > >> 
> > > >> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct
> > > >> isp_ccdc_device *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
> > > >> 
> > > >>       /* Use PACK8 mode for 1byte per pixel formats. */
> > > >> 
> > > >> -     if (omap3isp_video_format_info(format->code)->width <= 8)
> > > >> +     if ((omap3isp_video_format_info(format->code)->width <= 8) &&
> > > >> +                     (omap3isp_video_format_info(format->code)->bpp
> > > >> <= 8))
> > > > 
> > > > I'm not sure to follow you. This will clear the PACK8 bit for the
> > > > YUYV8_2X8 formats. Those formats are 8 bits wide, shouldn't PACK8 be
> > > > set to store samples on 8 bits instead of 16 bits ?
> > > > 
> > > > Is this patch intended to support YUYV8_2X8 sensors in non BT.656
> > > > mode with the bridge enabled ? In that case, what would you think
> > > > about setting the CCDC input format to YUYV8_1X16 instead ? This
> > > > would better reflect the reality, as the bridge converts YUYV8_2X8
> > > > to YUYV8_1X16, and the CCDC is then fed with YUYV8_1X16.
> > > 
> > > Yes this is intended for  YUYV8_2X8 sensors in non BT.656 with 8 to 16
> > > bit bridge enabled. So the data has to be stored as 16 bits per
> > > sample. Thats why PACK8 is cleared . I am not sure about using
> > > YUYV8_1X16.
> > 
> > My original idea when I wrote the YV support patches was to implement
> > this use case with YUYV8_2X8 at the sensor output and YUYV8_1X16 at the
> > CCDC input. The ISP driver could then enable the bridge automatically.
> > I'm not sure if that's the best solution though, it might be confusing
> > for the users. What I would like to keep, however, is the idea of
> > enabling the bridge automatically.
> > 
> > Sakari, any opinion on this ?
> 
> Are there any complications from the CCDC also listing the 2X8 formats as
> supported in its sink pad?

No, and the 2X8 formats need to be supported at the CCDC input, as BT.656 mode 
is not compatible with the bridge.

> I'd rather support them since doing it the other way might be somewhat
> confusing to the users.

It can be confusing indeed, but it reflects reality :-) It's also how we 
currently handle the lane shifter.

If we incorporate the bridge inside the CCDC, only YUV 2X8 formats will be 
supported at the CCDC input. Whether to enable the bridge will then be a 
platform decision and hardcoded in board code instead of being configurable by 
the user. Couldn't that be an issue ?

> This would also mean media-ctl users would have to set both sink and source
> formats rather than just the source format when configuring the format for
> the link.
> 
> > > >>               syn_mode |= ISPCCDC_SYN_MODE_PACK8;
> > > >>       
> > > >>       else
> > > >>       
> > > >>               syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;
  
Laurent Pinchart Sept. 27, 2011, 12:27 p.m. UTC | #7
Hi Deepthy,

On Friday 23 September 2011 13:53:39 Ravi, Deepthy wrote:
> On Wednesday, September 21, 2011 2:36 PM Laurent Pinchart wrote:
> > On Wednesday 21 September 2011 07:32:44 Ravi, Deepthy wrote:
> >> On Wednesday, September 21, 2011 4:56 AM Laurent Pinchart wrote:
> >> > On Tuesday 20 September 2011 16:56:51 Deepthy Ravi wrote:
> >> >> Configure INPMOD and PACK8 fileds of CCDC_SYN_MODE
> >> >> register for UYVY8_2X8 and YUYV8_2X8 formats.
> >> >> 
> >> >> Signed-off-by: Deepthy Ravi <deepthy.ravi@ti.com>
> >> >> ---
> >> >> 
> >> >>  drivers/media/video/omap3isp/ispccdc.c |   11 ++++++++---
> >> >>  1 files changed, 8 insertions(+), 3 deletions(-)
> >> >> 
> >> >> diff --git a/drivers/media/video/omap3isp/ispccdc.c
> >> >> b/drivers/media/video/omap3isp/ispccdc.c index 418ba65..1dcf180
> >> >> 100644 --- a/drivers/media/video/omap3isp/ispccdc.c
> >> >> +++ b/drivers/media/video/omap3isp/ispccdc.c
> >> >> @@ -985,8 +985,12 @@ static void ccdc_config_sync_if(struct
> >> >> isp_ccdc_device
> >> >> *ccdc,
> >> >> 
> >> >>       syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
> >> >>       if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
> >> >> 
> >> >> -         format->code == V4L2_MBUS_FMT_UYVY8_2X8)
> >> >> -             syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> >> >> +         format->code == V4L2_MBUS_FMT_UYVY8_2X8){
> >> >> +             if (pdata && pdata->bt656)
> >> >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
> >> >> +             else
> >> >> +                     syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> >> >> +     }
> >> >> 
> >> >>       else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
> >> >>       
> >> >>                format->code == V4L2_MBUS_FMT_UYVY8_1X16)
> >> >>               
> >> >>               syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
> >> >> 
> >> >> @@ -1172,7 +1176,8 @@ static void ccdc_configure(struct
> >> >> isp_ccdc_device *ccdc) syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
> >> >> 
> >> >>       /* Use PACK8 mode for 1byte per pixel formats. */
> >> >> 
> >> >> -     if (omap3isp_video_format_info(format->code)->width <= 8)
> >> >> +     if ((omap3isp_video_format_info(format->code)->width <= 8) &&
> >> >> +                     (omap3isp_video_format_info(format->code)->bpp
> >> >> <= 8))
> >> > 
> >> > I'm not sure to follow you. This will clear the PACK8 bit for the
> >> > YUYV8_2X8 formats. Those formats are 8 bits wide, shouldn't PACK8 be
> >> > set to store samples on 8 bits instead of 16 bits ?
> >> > 
> >> > Is this patch intended to support YUYV8_2X8 sensors in non BT.656 mode
> >> > with the bridge enabled ? In that case, what would you think about
> >> > setting the CCDC input format to YUYV8_1X16 instead ? This would
> >> > better reflect the reality, as the bridge converts YUYV8_2X8 to
> >> > YUYV8_1X16, and the CCDC is then fed with YUYV8_1X16.
> >> 
> >> Yes this is intended for  YUYV8_2X8 sensors in non BT.656 with 8 to 16
> >> bit bridge enabled. So the data has to be stored as 16 bits per sample.
> >> Thats why PACK8 is cleared . I am not sure about using YUYV8_1X16.
> > 
> > My original idea when I wrote the YV support patches was to implement
> > this use case with YUYV8_2X8 at the sensor output and YUYV8_1X16 at the
> > CCDC input. The ISP driver could then enable the bridge automatically.
> > I'm not sure if that's the best solution though, it might be confusing
> > for the users. What I would like to keep, however, is the idea of
> > enabling the bridge automatically.
> 
> But for streaming to start, the formats on both ends of the link should
> match. I believe setting different formats at sensor output and ccdc input
> will give a broken pipe error. Is my understanding correct ? If so, how do
> you propose to handle the situation ?

We already handle that situation for the lane shifter in ispvideo.c. The code 
could be extended.
  

Patch

diff --git a/drivers/media/video/omap3isp/ispccdc.c b/drivers/media/video/omap3isp/ispccdc.c
index 418ba65..1dcf180 100644
--- a/drivers/media/video/omap3isp/ispccdc.c
+++ b/drivers/media/video/omap3isp/ispccdc.c
@@ -985,8 +985,12 @@  static void ccdc_config_sync_if(struct isp_ccdc_device *ccdc,
 
 	syn_mode &= ~ISPCCDC_SYN_MODE_INPMOD_MASK;
 	if (format->code == V4L2_MBUS_FMT_YUYV8_2X8 ||
-	    format->code == V4L2_MBUS_FMT_UYVY8_2X8)
-		syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
+	    format->code == V4L2_MBUS_FMT_UYVY8_2X8){
+		if (pdata && pdata->bt656)
+			syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR8;
+		else
+			syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
+	}
 	else if (format->code == V4L2_MBUS_FMT_YUYV8_1X16 ||
 		 format->code == V4L2_MBUS_FMT_UYVY8_1X16)
 		syn_mode |= ISPCCDC_SYN_MODE_INPMOD_YCBCR16;
@@ -1172,7 +1176,8 @@  static void ccdc_configure(struct isp_ccdc_device *ccdc)
 		syn_mode &= ~ISPCCDC_SYN_MODE_SDR2RSZ;
 
 	/* Use PACK8 mode for 1byte per pixel formats. */
-	if (omap3isp_video_format_info(format->code)->width <= 8)
+	if ((omap3isp_video_format_info(format->code)->width <= 8) &&
+			(omap3isp_video_format_info(format->code)->bpp <= 8))
 		syn_mode |= ISPCCDC_SYN_MODE_PACK8;
 	else
 		syn_mode &= ~ISPCCDC_SYN_MODE_PACK8;