From 453080039f91ed96d6ab1a8cf912f178a858ee01 Mon Sep 17 00:00:00 2001 From: Fugang Duan Date: Wed, 16 May 2012 19:50:14 +0800 Subject: [PATCH] ENGR00209570 - PxP : Add Y4 output format. - Add Y4 output format for SPDC. Signed-off-by: Fugang Duan --- drivers/dma/pxp/pxp_dma.c | 17 ++++++++++++++++- drivers/dma/pxp/pxp_dma_v2.c | 11 ++++++++++- include/linux/pxp_dma.h | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/dma/pxp/pxp_dma.c b/drivers/dma/pxp/pxp_dma.c index eb5b4fb60306..ddd1c0cd192d 100644 --- a/drivers/dma/pxp/pxp_dma.c +++ b/drivers/dma/pxp/pxp_dma.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc. + * Copyright (C) 2010-2012 Freescale Semiconductor, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -180,6 +180,7 @@ static bool is_yuv(u32 pix_fmt) (pix_fmt == PXP_PIX_FMT_YUV444) | (pix_fmt == PXP_PIX_FMT_NV12) | (pix_fmt == PXP_PIX_FMT_GREY) | + (pix_fmt == PXP_PIX_FMT_GY04) | (pix_fmt == PXP_PIX_FMT_YVU410P) | (pix_fmt == PXP_PIX_FMT_YUV410P) | (pix_fmt == PXP_PIX_FMT_YVU420P) | @@ -215,6 +216,9 @@ static void pxp_set_ctrl(struct pxps *pxp) case PXP_PIX_FMT_GREY: fmt_ctrl = BV_PXP_CTRL_S0_FORMAT__YUV420; break; + case PXP_PIX_FMT_GY04: + fmt_ctrl = BV_PXP_CTRL_S0_FORMAT__YUV420; + break; case PXP_PIX_FMT_YUV422P: fmt_ctrl = BV_PXP_CTRL_S0_FORMAT__YUV422; break; @@ -243,6 +247,9 @@ static void pxp_set_ctrl(struct pxps *pxp) case PXP_PIX_FMT_GREY: fmt_ctrl = BV_PXP_CTRL_OUTBUF_FORMAT__MONOC8; break; + case PXP_PIX_FMT_GY04: + fmt_ctrl = BV_PXP_CTRL_OUTBUF_FORMAT__MONOC4; + break; default: fmt_ctrl = 0; } @@ -620,6 +627,14 @@ static void pxp_set_s0buf(struct pxps *pxp) __raw_writel(U, pxp->base + HW_PXP_S0UBUF); __raw_writel(V, pxp->base + HW_PXP_S0VBUF); } + + /* TODO: only support RGB565, Y8 , Y4 */ + if (s0_params->pixel_fmt == PXP_PIX_FMT_GREY) + __raw_writel(s0_params->width, pxp->base + HW_PXP_PS_PITCH); + else if (s0_params->pixel_fmt == PXP_PIX_FMT_GY04) + __raw_writel(s0_params->width >> 1, pxp->base + HW_PXP_PS_PITCH); + else + __raw_writel(s0_params->width * 2, pxp->base + HW_PXP_PS_PITCH); } /** diff --git a/drivers/dma/pxp/pxp_dma_v2.c b/drivers/dma/pxp/pxp_dma_v2.c index 3fadd9a5f762..ceb72edbd39e 100644 --- a/drivers/dma/pxp/pxp_dma_v2.c +++ b/drivers/dma/pxp/pxp_dma_v2.c @@ -220,6 +220,7 @@ static bool is_yuv(u32 pix_fmt) (pix_fmt == PXP_PIX_FMT_YUV444) | (pix_fmt == PXP_PIX_FMT_NV12) | (pix_fmt == PXP_PIX_FMT_GREY) | + (pix_fmt == PXP_PIX_FMT_GY04) | (pix_fmt == PXP_PIX_FMT_YVU410P) | (pix_fmt == PXP_PIX_FMT_YUV410P) | (pix_fmt == PXP_PIX_FMT_YVU420P) | @@ -257,6 +258,9 @@ static void pxp_set_ctrl(struct pxps *pxp) case PXP_PIX_FMT_GREY: fmt_ctrl = BV_PXP_PS_CTRL_FORMAT__Y8; break; + case PXP_PIX_FMT_GY04: + fmt_ctrl = BV_PXP_PS_CTRL_FORMAT__Y4; + break; case PXP_PIX_FMT_YUV422P: fmt_ctrl = BV_PXP_PS_CTRL_FORMAT__YUV422; break; @@ -287,6 +291,9 @@ static void pxp_set_ctrl(struct pxps *pxp) case PXP_PIX_FMT_GREY: fmt_ctrl = BV_PXP_OUT_CTRL_FORMAT__Y8; break; + case PXP_PIX_FMT_GY04: + fmt_ctrl = BV_PXP_OUT_CTRL_FORMAT__Y4; + break; default: fmt_ctrl = 0; } @@ -697,9 +704,11 @@ static void pxp_set_s0buf(struct pxps *pxp) __raw_writel(V, pxp->base + HW_PXP_PS_VBUF); } - /* TODO: only support RGB565, Y8 */ + /* TODO: only support RGB565, Y8, Y4 */ if (s0_params->pixel_fmt == PXP_PIX_FMT_GREY) __raw_writel(s0_params->width, pxp->base + HW_PXP_PS_PITCH); + else if (s0_params->pixel_fmt == PXP_PIX_FMT_GY04) + __raw_writel(s0_params->width >> 1, pxp->base + HW_PXP_PS_PITCH); else __raw_writel(s0_params->width * 2, pxp->base + HW_PXP_PS_PITCH); } diff --git a/include/linux/pxp_dma.h b/include/linux/pxp_dma.h index bf63bf3570e5..1be6e395ec55 100644 --- a/include/linux/pxp_dma.h +++ b/include/linux/pxp_dma.h @@ -66,6 +66,7 @@ typedef unsigned char bool; /*! @name YUV Planar Formats */ /*! @{ */ #define PXP_PIX_FMT_GREY fourcc('G', 'R', 'E', 'Y') /*!< 8 Greyscale */ +#define PXP_PIX_FMT_GY04 fourcc('G', 'Y', '0', '4') /*!< 4 Greyscale */ #define PXP_PIX_FMT_YVU410P fourcc('Y', 'V', 'U', '9') /*!< 9 YVU 4:1:0 */ #define PXP_PIX_FMT_YUV410P fourcc('Y', 'U', 'V', '9') /*!< 9 YUV 4:1:0 */ #define PXP_PIX_FMT_YVU420P fourcc('Y', 'V', '1', '2') /*!< 12 YVU 4:2:0 */ -- 2.39.5