From patchwork Tue Feb 28 20:04:16 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 9597079 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C6CEB60429 for ; Tue, 28 Feb 2017 22:36:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B83DE27B81 for ; Tue, 28 Feb 2017 22:36:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC30528588; Tue, 28 Feb 2017 22:36:16 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B5FF727B81 for ; Tue, 28 Feb 2017 22:36:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751720AbdB1Wfz (ORCPT ); Tue, 28 Feb 2017 17:35:55 -0500 Received: from botnar.kaiser.cx ([176.28.20.183]:44186 "EHLO botnar.kaiser.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751543AbdB1Wfg (ORCPT ); Tue, 28 Feb 2017 17:35:36 -0500 Received: from p4fd7805e.dip0.t-ipconnect.de ([79.215.128.94] helo=martin-debian-1.paytec.ch) by botnar.kaiser.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.72) (envelope-from ) id 1cio2Z-0000xH-OD; Tue, 28 Feb 2017 21:06:31 +0100 From: Martin Kaiser To: linux-fbdev@vger.kernel.org Cc: Martin Kaiser , Philipp Zabel , Rob Herring , Mark Rutland , Sascha Hauer , Bartlomiej Zolnierkiewicz , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] video: fbdev: imxfb: support AUS mode Date: Tue, 28 Feb 2017 21:04:16 +0100 Message-Id: <1488312337-32154-1-git-send-email-martin@kaiser.cx> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1488193030-13064-1-git-send-email-martin@kaiser.cx> References: <1488193030-13064-1-git-send-email-martin@kaiser.cx> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some displays require setting AUS mode in the LDCD AUS Mode Control Register to work with the imxfb driver. Like the value of the Panel Configuration Register, the AUS Mode Control Register's value depends on the display mode. Allow setting this register from the device tree. Make the device tree node optional to keep the DT ABI stable. This register is available only on imx21 and compatible chipsets. Update the device tree bindings with this info. Signed-off-by: Martin Kaiser --- v2: re-sending DT bindings and code changes as one patch .../devicetree/bindings/display/imx/fsl,imx-fb.txt | 2 ++ drivers/video/fbdev/imxfb.c | 19 +++++++++++++++++++ include/linux/platform_data/video-imxfb.h | 1 + 3 files changed, 22 insertions(+) diff --git a/Documentation/devicetree/bindings/display/imx/fsl,imx-fb.txt b/Documentation/devicetree/bindings/display/imx/fsl,imx-fb.txt index 7a5c0e2..bd5077f 100644 --- a/Documentation/devicetree/bindings/display/imx/fsl,imx-fb.txt +++ b/Documentation/devicetree/bindings/display/imx/fsl,imx-fb.txt @@ -13,6 +13,8 @@ Required nodes: Additional, the display node has to define properties: - bits-per-pixel: Bits per pixel - fsl,pcr: LCDC PCR value + A display node may optionally define + - fsl,lauscr: LCDC AUS Mode Control Register value (only for imx21) Optional properties: - lcd-supply: Regulator for LCD supply voltage. diff --git a/drivers/video/fbdev/imxfb.c b/drivers/video/fbdev/imxfb.c index 1b0faad..a05cad4 100644 --- a/drivers/video/fbdev/imxfb.c +++ b/drivers/video/fbdev/imxfb.c @@ -117,6 +117,8 @@ #define IMXFB_LSCR1_DEFAULT 0x00120300 +#define LCDC_LAUSCR 0x80 + /* Used fb-mode. Can be set on kernel command line, therefore file-static. */ static const char *fb_mode; @@ -158,6 +160,7 @@ struct imxfb_info { dma_addr_t dbar2; u_int pcr; + u_int lauscr; u_int pwmr; u_int lscr1; u_int dmacr; @@ -422,6 +425,11 @@ static int imxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) pcr |= imxfb_mode->pcr & ~(0x3f | (7 << 25)); fbi->pcr = pcr; + /* + * The LCDC AUS Mode Control Register does not exist on imx1. + */ + if (!is_imx1_fb(fbi)) + fbi->lauscr = imxfb_mode->lauscr; /* * Copy the RGB parameters for this display @@ -638,6 +646,9 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf if (fbi->dmacr) writel(fbi->dmacr, fbi->regs + LCDC_DMACR); + if (fbi->lauscr) + writel(fbi->lauscr, fbi->regs + LCDC_LAUSCR); + return 0; } @@ -707,6 +718,7 @@ static int imxfb_of_read_mode(struct device *dev, struct device_node *np, struct fb_videomode *of_mode = &imxfb_mode->mode; u32 bpp; u32 pcr; + u32 lauscr; ret = of_property_read_string(np, "model", &of_mode->name); if (ret) @@ -734,6 +746,13 @@ static int imxfb_of_read_mode(struct device *dev, struct device_node *np, imxfb_mode->bpp = bpp; imxfb_mode->pcr = pcr; + /* + * fsl,lauscr is optional + */ + ret = of_property_read_u32(np, "fsl,lauscr", &lauscr); + if (ret == 0) + imxfb_mode->lauscr = lauscr; + return 0; } diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h index a5c0a71..fdd2d4c 100644 --- a/include/linux/platform_data/video-imxfb.h +++ b/include/linux/platform_data/video-imxfb.h @@ -50,6 +50,7 @@ struct imx_fb_videomode { struct fb_videomode mode; u32 pcr; + u32 lauscr; unsigned char bpp; };