From patchwork Mon Feb 27 10:56:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Kaiser X-Patchwork-Id: 9592987 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 5704E601D7 for ; Mon, 27 Feb 2017 11:36:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F32D2807B for ; Mon, 27 Feb 2017 11:36:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33C8C283E1; Mon, 27 Feb 2017 11:36:47 +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=ham 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 95AA42807B for ; Mon, 27 Feb 2017 11:36:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751809AbdB0Lgn (ORCPT ); Mon, 27 Feb 2017 06:36:43 -0500 Received: from botnar.kaiser.cx ([176.28.20.183]:44754 "EHLO botnar.kaiser.cx" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbdB0Lgl (ORCPT ); Mon, 27 Feb 2017 06:36:41 -0500 X-Greylist: delayed 2200 seconds by postgrey-1.27 at vger.kernel.org; Mon, 27 Feb 2017 06:35:43 EST Received: from pd956d63d.dip0.t-ipconnect.de ([217.86.214.61] helo=martin-debian-1.paytec.ch) by botnar.kaiser.cx with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.72) (envelope-from ) id 1ciIzh-0001HQ-7t; Mon, 27 Feb 2017 11:57:29 +0100 From: Martin Kaiser To: linux-fbdev@vger.kernel.org Cc: Martin Kaiser , Sascha Hauer , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] video: fbdev: imxfb: support AUS mode Date: Mon, 27 Feb 2017 11:56:41 +0100 Message-Id: <1488193030-13064-1-git-send-email-martin@kaiser.cx> X-Mailer: git-send-email 2.1.4 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. Signed-off-by: Martin Kaiser --- drivers/video/fbdev/imxfb.c | 19 +++++++++++++++++++ include/linux/platform_data/video-imxfb.h | 1 + 2 files changed, 20 insertions(+) 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; };