From patchwork Fri Sep 13 06:59:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhou Zhu X-Patchwork-Id: 2881901 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 3CC699F1BF for ; Fri, 13 Sep 2013 07:15:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E6EC8203F1 for ; Fri, 13 Sep 2013 07:15:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CD0A42012D for ; Fri, 13 Sep 2013 07:15:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753115Ab3IMHPa (ORCPT ); Fri, 13 Sep 2013 03:15:30 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:55809 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752157Ab3IMHP3 (ORCPT ); Fri, 13 Sep 2013 03:15:29 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.14.5/8.14.5) with SMTP id r8D70QHq005142; Fri, 13 Sep 2013 00:00:26 -0700 Received: from sc-owa02.marvell.com ([199.233.58.137]) by mx0b-0016f401.pphosted.com with ESMTP id 1etwrt00dq-26 (version=TLSv1/SSLv3 cipher=RC4-MD5 bits=128 verify=NOT); Fri, 13 Sep 2013 00:00:26 -0700 Received: from maili.marvell.com (10.93.76.43) by sc-owa02.marvell.com (10.93.76.22) with Microsoft SMTP Server id 8.3.213.0; Fri, 13 Sep 2013 00:00:23 -0700 Received: from localhost (unknown [10.38.36.226]) by maili.marvell.com (Postfix) with ESMTP id 455741CCD9C; Fri, 13 Sep 2013 00:00:23 -0700 (PDT) From: Zhou Zhu To: , Tomi Valkeinen , Jean-Christophe Plagniol-Villard , Haojian Zhuang CC: Jing Xiang , Guoqing Li , Zhou Zhu , "Jett.Zhou" , Zhou Zhu Subject: [PATCH V5 1/5] video: mmp: rb swap setting update for mmp display Date: Fri, 13 Sep 2013 14:59:45 +0800 Message-ID: <1379055589-26132-2-git-send-email-zzhu3@marvell.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1379055589-26132-1-git-send-email-zzhu3@marvell.com> References: <1379055589-26132-1-git-send-email-zzhu3@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.10.8794, 1.0.431, 0.0.0000 definitions=2013-09-13_03:2013-09-13, 2013-09-13, 1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1309120225 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Guoqing Li We could set rb swap in two modules: DMA controler input part and dsi interface output part. DMA input part is based on pix_fmt to set rbswap, dsi output interface part will set rbswap based on platform dsi_rbswap configuration. This patch include below change and enhancement: 1) The input format which support rbswap is based on RGB format, eg. RGB565 indicates the source data in memory is that Red is [15~11], Green is [10~5], Blue is [4:0], Red is MSB, Blue is LSB, but for the display dma input default setting(rbswap = 0), it only support Blue is [15~11], Green is [10~5], Red is [4:0], Red is LSB, Blue is MSB, so for this format(RGB565), display controller need to set rbswap = 1 and it can support the MSB/LSB correctly. BGR/YUV format will not set it in mmp display driver. 2) The dsi output part of rbswap is depend on dsi_rbswap which is defined in specific platfrom. For output dsi interface, it has this feature to do rbswap again if it needs specifc byte sequence of RGB byte for DSI panel. eg. If display content is set RGB565 in memory and DMA input part set rbswap in driver to support Red as MSB , Blue LSB, but dsi panel only support Red as LSB, Blue as MSB, then it can use this feature. If there is no this requirement of panel, this dsi output part is not needed. Signed-off-by: Guoqing Li Signed-off-by: Jett.Zhou Signed-off-by: Zhou Zhu Reviewed-by: Daniel Drake --- drivers/video/mmp/hw/mmp_ctrl.c | 19 +++++++++++-------- drivers/video/mmp/hw/mmp_ctrl.h | 5 +++++ include/video/mmp_disp.h | 1 + 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/drivers/video/mmp/hw/mmp_ctrl.c b/drivers/video/mmp/hw/mmp_ctrl.c index 75dca19..a40d95a 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.c +++ b/drivers/video/mmp/hw/mmp_ctrl.c @@ -60,8 +60,7 @@ static irqreturn_t ctrl_handle_irq(int irq, void *dev_id) static u32 fmt_to_reg(struct mmp_overlay *overlay, int pix_fmt) { - u32 link_config = path_to_path_plat(overlay->path)->link_config; - u32 rbswap, uvswap = 0, yuvswap = 0, + u32 rbswap = 0, uvswap = 0, yuvswap = 0, csc_en = 0, val = 0, vid = overlay_is_vid(overlay); @@ -71,27 +70,23 @@ static u32 fmt_to_reg(struct mmp_overlay *overlay, int pix_fmt) case PIXFMT_RGB888PACK: case PIXFMT_RGB888UNPACK: case PIXFMT_RGBA888: - rbswap = !(link_config & 0x1); + rbswap = 1; break; case PIXFMT_VYUY: case PIXFMT_YVU422P: case PIXFMT_YVU420P: - rbswap = link_config & 0x1; uvswap = 1; break; case PIXFMT_YUYV: - rbswap = link_config & 0x1; yuvswap = 1; break; default: - rbswap = link_config & 0x1; break; } switch (pix_fmt) { case PIXFMT_RGB565: case PIXFMT_BGR565: - val = 0; break; case PIXFMT_RGB1555: case PIXFMT_BGR1555: @@ -248,7 +243,8 @@ static void path_set_mode(struct mmp_path *path, struct mmp_mode *mode) { struct lcd_regs *regs = path_regs(path); u32 total_x, total_y, vsync_ctrl, tmp, sclk_src, sclk_div, - link_config = path_to_path_plat(path)->link_config; + link_config = path_to_path_plat(path)->link_config, + dsi_rbswap = path_to_path_plat(path)->link_config; /* FIXME: assert videomode supported */ memcpy(&path->mode, mode, sizeof(struct mmp_mode)); @@ -263,6 +259,12 @@ static void path_set_mode(struct mmp_path *path, struct mmp_mode *mode) tmp |= CFG_DUMB_ENA(1); writel_relaxed(tmp, ctrl_regs(path) + intf_ctrl(path->id)); + /* interface rb_swap setting */ + tmp = readl_relaxed(ctrl_regs(path) + intf_rbswap_ctrl(path->id)) & + (~(CFG_INTFRBSWAP_MASK)); + tmp |= dsi_rbswap & CFG_INTFRBSWAP_MASK; + writel_relaxed(tmp, ctrl_regs(path) + intf_rbswap_ctrl(path->id)); + writel_relaxed((mode->yres << 16) | mode->xres, ®s->screen_active); writel_relaxed((mode->left_margin << 16) | mode->right_margin, ®s->screen_h_porch); @@ -419,6 +421,7 @@ static int path_init(struct mmphw_path_plat *path_plat, path_plat->path = path; path_plat->path_config = config->path_config; path_plat->link_config = config->link_config; + path_plat->dsi_rbswap = config->dsi_rbswap; path_set_default(path); kfree(path_info); diff --git a/drivers/video/mmp/hw/mmp_ctrl.h b/drivers/video/mmp/hw/mmp_ctrl.h index edd2002..53301cf 100644 --- a/drivers/video/mmp/hw/mmp_ctrl.h +++ b/drivers/video/mmp/hw/mmp_ctrl.h @@ -163,6 +163,8 @@ struct lcd_regs { #define LCD_SCLK(path) ((PATH_PN == path->id) ? LCD_CFG_SCLK_DIV :\ ((PATH_TV == path->id) ? LCD_TCLK_DIV : LCD_PN2_SCLK_DIV)) +#define intf_rbswap_ctrl(id) ((id) ? (((id) & 1) ? LCD_TVIF_CTRL : \ + PN2_IOPAD_CONTROL) : LCD_TOP_CTRL) /* dither configure */ #ifdef CONFIG_CPU_PXA988 @@ -615,6 +617,8 @@ struct lcd_regs { #define LCD_SPU_DUMB_CTRL 0x01B8 #define CFG_DUMBMODE(mode) ((mode)<<28) #define CFG_DUMBMODE_MASK 0xF0000000 +#define CFG_INTFRBSWAP(mode) ((mode)<<24) +#define CFG_INTFRBSWAP_MASK 0x0F000000 #define CFG_LCDGPIO_O(data) ((data)<<20) #define CFG_LCDGPIO_O_MASK 0x0FF00000 #define CFG_LCDGPIO_ENA(gpio) ((gpio)<<12) @@ -1427,6 +1431,7 @@ struct mmphw_path_plat { struct mmp_path *path; u32 path_config; u32 link_config; + u32 dsi_rbswap; }; /* mmp ctrl describes mmp controller related info */ diff --git a/include/video/mmp_disp.h b/include/video/mmp_disp.h index b9dd1fb..32094c0 100644 --- a/include/video/mmp_disp.h +++ b/include/video/mmp_disp.h @@ -334,6 +334,7 @@ struct mmp_mach_path_config { int output_type; u32 path_config; u32 link_config; + u32 dsi_rbswap; }; struct mmp_mach_plat_info {