devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Kaiser <martin@kaiser.cx>
To: linux-fbdev@vger.kernel.org
Cc: Martin Kaiser <martin@kaiser.cx>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Sascha Hauer <kernel@pengutronix.de>,
	Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>,
	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	[thread overview]
Message-ID: <1488312337-32154-1-git-send-email-martin@kaiser.cx> (raw)
In-Reply-To: <1488193030-13064-1-git-send-email-martin@kaiser.cx>

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 <martin@kaiser.cx>
---
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;
 };
 
-- 
2.1.4

  parent reply	other threads:[~2017-02-28 20:04 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1488193030-13064-1-git-send-email-martin@kaiser.cx>
2017-02-27 10:56 ` [PATCH 2/2] dt-bindings: display: imx: entry for LAUSCR Martin Kaiser
2017-03-02 16:13   ` Rob Herring
2017-03-04  8:52     ` Martin Kaiser
2017-02-28 20:04 ` Martin Kaiser [this message]
2017-03-03  6:21   ` [PATCH v2] video: fbdev: imxfb: support AUS mode Rob Herring
2017-03-03  8:53     ` Bartlomiej Zolnierkiewicz
2017-03-04  8:38       ` Martin Kaiser
     [not found] ` <1488193030-13064-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-03-08 18:22   ` [PATCH 1/2 v3] " Martin Kaiser
     [not found]     ` <1488997376-1564-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-03-08 18:22       ` [PATCH 2/2 v3] dt-bindings: display: imx: entry for " Martin Kaiser
     [not found]         ` <1488997376-1564-2-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-03-15 20:24           ` Rob Herring
2017-04-21  7:45   ` [PATCH 1/2 v3 resend] video: fbdev: imxfb: support " Martin Kaiser
2017-04-21  7:45     ` [PATCH 2/2 v3 resend] dt-bindings: display: imx: entry for " Martin Kaiser
     [not found]     ` <1492760753-8374-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-04-21  9:33       ` [PATCH 1/2 v3 resend] video: fbdev: imxfb: support " Bartlomiej Zolnierkiewicz
2017-04-21 10:31         ` Martin Kaiser
2017-04-21 10:29   ` [PATCH 1/2 v4] " Martin Kaiser
     [not found]     ` <1492770549-7347-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-04-21 10:29       ` [PATCH 2/2] dt-bindings: display: imx: entry for " Martin Kaiser
2017-04-21 12:29       ` [PATCH 2/2 v4] " Martin Kaiser
     [not found]         ` <1492777790-12748-1-git-send-email-martin-XxZfDwE/svGeZLLa646FqQ@public.gmane.org>
2017-04-21 14:50           ` Bartlomiej Zolnierkiewicz
2017-04-21 14:49       ` [PATCH 1/2 v4] video: fbdev: imxfb: support " Bartlomiej Zolnierkiewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488312337-32154-1-git-send-email-martin@kaiser.cx \
    --to=martin@kaiser.cx \
    --cc=b.zolnierkie@samsung.com \
    --cc=devicetree@vger.kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=p.zabel@pengutronix.de \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).