From patchwork Sat May 18 09:15:14 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Prisk X-Patchwork-Id: 2588501 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) by patchwork2.kernel.org (Postfix) with ESMTP id F18D6DF2E5 for ; Sat, 18 May 2013 09:17:17 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UddFS-00062t-Vn; Sat, 18 May 2013 09:16:19 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UddF8-0005WR-Qh; Sat, 18 May 2013 09:15:58 +0000 Received: from server.prisktech.co.nz ([115.188.14.127]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UddEm-0005Tq-80 for linux-arm-kernel@lists.infradead.org; Sat, 18 May 2013 09:15:38 +0000 Received: from localhost.localdomain (unknown [192.168.0.102]) by server.prisktech.co.nz (Postfix) with ESMTP id A2595FC0ECD; Sat, 18 May 2013 21:15:16 +1200 (NZST) From: Tony Prisk To: Florian Tobias Schandinat Subject: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver. Date: Sat, 18 May 2013 21:15:14 +1200 Message-Id: <1368868514-18975-5-git-send-email-linux@prisktech.co.nz> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1368868514-18975-1-git-send-email-linux@prisktech.co.nz> References: <1368868514-18975-1-git-send-email-linux@prisktech.co.nz> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130518_051536_922281_57013FA4 X-CRM114-Status: GOOD ( 17.84 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.6 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-fbdev@vger.kernel.org, linux-kernel@vger.kernel.org, Tony Prisk , tomi.valkeinen@ti.com, vt8500-wm8505-linux-kernel@googlegroups.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org The APC8750 does not support an LCD panel, but provides a VGA connector. This patch adds support for the VGA interface, and defines an optional devicetree property to specify the output interface. The default if not specified is LCD for backward compatibility. Signed-off-by: Tony Prisk --- .../devicetree/bindings/video/wm,wm8505-fb.txt | 5 ++++ drivers/video/wm8505fb.c | 31 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt index 601416c..9f1d648 100644 --- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt @@ -7,6 +7,10 @@ Required properties: - bits-per-pixel : bit depth of framebuffer (16 or 32) - clocks : phandle to DVO clock +Optional properties: +- output-interface : the interface the fb should output on. Valid values are + "lcd" or "vga". If not specified, the default is "lcd". + Required subnodes: - display-timings: see display-timing.txt for information @@ -17,6 +21,7 @@ Example: reg = <0xd8051700 0x200>; bits-per-pixel = <16>; clocks = <&clkdvo>; + output-interface = "vga"; display-timings { native-mode = <&timing0>; diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c index f8bffc2..d1f7f33 100644 --- a/drivers/video/wm8505fb.c +++ b/drivers/video/wm8505fb.c @@ -130,12 +130,17 @@ #define to_wm8505fb_info(__info) container_of(__info, \ struct wm8505fb_info, fb) + +#define INTERFACE_LCD 1 +#define INTERFACE_VGA 2 + struct wm8505fb_info { struct fb_info fb; void __iomem *regbase; unsigned int contrast; struct device *dev; struct clk *clk_dvo; + int interface; }; @@ -158,7 +163,11 @@ static int wm8505fb_init_hw(struct fb_info *info) * 0x31C sets the correct color mode (RGB565) for WM8650 * Bit 8+9 (0x300) are ignored on WM8505 as reserved */ - writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB); + if (fbi->interface == INTERFACE_VGA) + writel(0x338, fbi->regbase + REG_GOVRH_YUVRGB); + else + writel(0x31c, fbi->regbase + REG_GOVRH_YUVRGB); + writel(1, fbi->regbase + REG_GOVRH_DVO_PIX); /* Virtual buffer size */ @@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info) /* black magic ;) */ writel(0xf, fbi->regbase + REG_GOVRH_FHI); - writel(4, fbi->regbase + REG_GOVRH_DVO_SET); + + if (fbi->interface == INTERFACE_VGA) + writel(0xe, fbi->regbase + REG_GOVRH_DVO_SET); + else + writel(4, fbi->regbase + REG_GOVRH_DVO_SET); + writel(1, fbi->regbase + REG_GOVRH_MIF); writel(1, fbi->regbase + REG_GOVRH_REG_STS); @@ -194,11 +208,15 @@ static int wm8505fb_set_timing(struct fb_info *info) writel(h_end, fbi->regbase + REG_GOVRH_ACTPX_END); writel(h_all, fbi->regbase + REG_GOVRH_H_ALLPXL); writel(h_sync, fbi->regbase + REG_GOVRH_HDMI_HSYNW); + if (fbi->interface == INTERFACE_VGA) + writel(h_sync, fbi->regbase + REG_GOVRH_VGA_HSYNW); writel(v_start, fbi->regbase + REG_GOVRH_ACTLN_BG); writel(v_end, fbi->regbase + REG_GOVRH_ACTLN_END); writel(v_all, fbi->regbase + REG_GOVRH_V_ALLLN); writel(v_sync, fbi->regbase + REG_GOVRH_HDMI_VBISW); + if (fbi->interface == INTERFACE_VGA) + writel(info->var.pixclock, fbi->regbase + REG_GOVRH_VGA_VSYNW); writel(1, fbi->regbase + REG_GOVRH_TG_ENABLE); @@ -371,6 +389,7 @@ static int wm8505fb_probe(struct platform_device *pdev) dma_addr_t fb_mem_phys; unsigned long fb_mem_len; void *fb_mem_virt; + const char *intf; fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) + sizeof(u32) * 16, GFP_KERNEL); @@ -428,6 +447,14 @@ static int wm8505fb_probe(struct platform_device *pdev) clk_prepare_enable(fbi->clk_dvo); + fbi->interface = INTERFACE_LCD; + ret = of_property_read_string(pdev->dev.of_node, "output-interface", + &intf); + if (!ret) { + if (!strcmp(intf, "vga")) + fbi->interface = INTERFACE_VGA; + } + fb_videomode_to_var(&fbi->fb.var, &mode); fbi->fb.var.nonstd = 0;