[4/5] media: atmel-isi: setup YCC_SWAP correctly when using preview path
Commit Message
The preview path only can convert UYVY format to RGB data.
To make preview path work correctly, we need to set up YCC_SWAP
according to sensor output and convert them to UYVY.
Signed-off-by: Josh Wu <josh.wu@atmel.com>
---
drivers/media/platform/soc_camera/atmel-isi.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Comments
On Tue, 22 Sep 2015, Josh Wu wrote:
> The preview path only can convert UYVY format to RGB data.
>
> To make preview path work correctly, we need to set up YCC_SWAP
> according to sensor output and convert them to UYVY.
>
> Signed-off-by: Josh Wu <josh.wu@atmel.com>
> ---
>
> drivers/media/platform/soc_camera/atmel-isi.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
> index bbf6449..e87d354 100644
> --- a/drivers/media/platform/soc_camera/atmel-isi.c
> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
> @@ -127,6 +127,22 @@ static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi,
> cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_1;
> break;
> }
> + } else if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_RGB565) {
> + /* Preview path is enabled, it will convert UYVY to RGB format.
> + * But if sensor output format is not UYVY, we need to set
> + * YCC_SWAP_MODE to convert it as UYVY.
> + */
Please, fix multiline comment style:
/*
* ...
* ...
*/
> + switch (xlate->code) {
> + case MEDIA_BUS_FMT_VYUY8_2X8:
> + cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_1;
> + break;
> + case MEDIA_BUS_FMT_YUYV8_2X8:
> + cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_2;
> + break;
> + case MEDIA_BUS_FMT_YVYU8_2X8:
> + cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_3;
> + break;
> + }
> }
>
> return cfg2_yuv_swap;
> --
> 1.9.1
>
--
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
Hi, Dear Guennadi
On 10/5/2015 12:50 AM, Guennadi Liakhovetski wrote:
> On Tue, 22 Sep 2015, Josh Wu wrote:
>
>> The preview path only can convert UYVY format to RGB data.
>>
>> To make preview path work correctly, we need to set up YCC_SWAP
>> according to sensor output and convert them to UYVY.
>>
>> Signed-off-by: Josh Wu <josh.wu@atmel.com>
>> ---
>>
>> drivers/media/platform/soc_camera/atmel-isi.c | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c
>> index bbf6449..e87d354 100644
>> --- a/drivers/media/platform/soc_camera/atmel-isi.c
>> +++ b/drivers/media/platform/soc_camera/atmel-isi.c
>> @@ -127,6 +127,22 @@ static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi,
>> cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_1;
>> break;
>> }
>> + } else if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_RGB565) {
>> + /* Preview path is enabled, it will convert UYVY to RGB format.
>> + * But if sensor output format is not UYVY, we need to set
>> + * YCC_SWAP_MODE to convert it as UYVY.
>> + */
> Please, fix multiline comment style:
>
> /*
> * ...
> * ...
> */
oh, yes, Sure. I'll fix this. Thanks.
Best Regards,
Josh Wu
>> + switch (xlate->code) {
>> + case MEDIA_BUS_FMT_VYUY8_2X8:
>> + cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_1;
>> + break;
>> + case MEDIA_BUS_FMT_YUYV8_2X8:
>> + cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_2;
>> + break;
>> + case MEDIA_BUS_FMT_YVYU8_2X8:
>> + cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_3;
>> + break;
>> + }
>> }
>>
>> return cfg2_yuv_swap;
>> --
>> 1.9.1
>>
--
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
@@ -127,6 +127,22 @@ static u32 setup_cfg2_yuv_swap(struct atmel_isi *isi,
cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_1;
break;
}
+ } else if (xlate->host_fmt->fourcc == V4L2_PIX_FMT_RGB565) {
+ /* Preview path is enabled, it will convert UYVY to RGB format.
+ * But if sensor output format is not UYVY, we need to set
+ * YCC_SWAP_MODE to convert it as UYVY.
+ */
+ switch (xlate->code) {
+ case MEDIA_BUS_FMT_VYUY8_2X8:
+ cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_1;
+ break;
+ case MEDIA_BUS_FMT_YUYV8_2X8:
+ cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_2;
+ break;
+ case MEDIA_BUS_FMT_YVYU8_2X8:
+ cfg2_yuv_swap = ISI_CFG2_YCC_SWAP_MODE_3;
+ break;
+ }
}
return cfg2_yuv_swap;