FB updates for 3.11
Subsystems (2)
cover FB updates for 3.11
Patch #1 - Move register defines inside the driver and drop the header. Patch #2 - Convert the register defines to use the vendor preferred names. Patch #3 - Add a device clock to wm8505fb. Without it, only the uboot initialized resolution is supported.
Patch #4 - Add support for the VGA output found on the APC8750 board.
Tony Prisk (4):
fb: vt8500: Move register defines inside driver
fb: vt8500: Convert to use vendor register names
fb: vt8500: Require a device clock for wm8505fb driver
fb: vt8500: Add VGA output support to wm8505fb driver.
.../devicetree/bindings/video/wm,wm8505-fb.txt | 9 +- drivers/video/wm8505fb.c | 195 ++++++++++++-- drivers/video/wm8505fb_regs.h | 76 ------ drivers/video/wmt_ge_rops.c | 280 +++++++++++++++----- 4 files changed, 394 insertions(+), 166 deletions(-) delete mode 100644 drivers/video/wm8505fb_regs.h
Signature · 1 line
1.7.9.5
PATCH 1/4 fb: vt8500: Move register defines inside driver
The #defines in wm8505fb_regs.h are only used in the wm8505fb driver, and don't need to be visible outside.
Move the defines into the driver and remove the header.
--- drivers/video/wm8505fb.c | 25 +++++++++++++- drivers/video/wm8505fb_regs.h | 76 ----------------------------------------- 2 files changed, 24 insertions(+), 77 deletions(-) delete mode 100644 drivers/video/wm8505fb_regs.h
drivers/video/wm8505fb.c +24 -1
@@ -34,11 +34,34 @@#include <linux/wait.h> #include <video/of_display_timing.h> -#include "wm8505fb_regs.h" #include "wmt_ge_rops.h" #define DRIVER_NAME "wm8505-fb" +#define WMT_GOVR_COLORSPACE1 0x030 +#define WMT_GOVR_MIF_ENABLE 0x080 +#define WMT_GOVR_FBADDR 0x090 +#define WMT_GOVR_FBADDR1 0x094 +#define WMT_GOVR_XRES 0x098 +#define WMT_GOVR_XRES_VIRTUAL 0x09c +#define WMT_GOVR_YPAN 0x0a0 +#define WMT_GOVR_XPAN 0x0a4 +#define WMT_GOVR_FHI 0x0a8 +#define WMT_GOVR_REG_UPDATE 0x0e4 +#define WMT_GOVR_TG 0x100 +#define WMT_GOVR_TIMING_H_ALL 0x108 +#define WMT_GOVR_TIMING_V_ALL 0x10c +#define WMT_GOVR_TIMING_V_START 0x110 +#define WMT_GOVR_TIMING_V_END 0x114 +#define WMT_GOVR_TIMING_H_START 0x118 +#define WMT_GOVR_TIMING_H_END 0x11c +#define WMT_GOVR_TIMING_V_SYNC 0x128 +#define WMT_GOVR_TIMING_H_SYNC 0x12c +#define WMT_GOVR_DVO_SET 0x148 +#define WMT_GOVR_CONTRAST 0x1b8 +#define WMT_GOVR_BRGHTNESS 0x1bc +#define WMT_GOVR_COLORSPACE 0x1e4 +#define to_wm8505fb_info (__info) container_of(__info, \ struct wm8505fb_info, fb)struct wm8505fb_info {
drivers/video/wm8505fb_regs.h deleted +0 -76
76 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 2/4 fb: vt8500: Convert to use vendor register names
In reply to Tony PriskChange all the #defines to match the vendor defined names, and change the references in wm8505fb.c and wmt_ge_rops.c.
Add all the missing register offsets as well to prevent churn in the future.
--- drivers/video/wm8505fb.c | 159 ++++++++++++++++-------- drivers/video/wmt_ge_rops.c | 280 +++++++++++++++++++++++++++++++++---------- 2 files changed, 332 insertions(+), 107 deletions(-)
drivers/video/wm8505fb.c +112 -47
@@ -38,29 +38,94 @@#define DRIVER_NAME "wm8505-fb" -#define WMT_GOVR_COLORSPACE1 0x030 -#define WMT_GOVR_MIF_ENABLE 0x080 -#define WMT_GOVR_FBADDR 0x090 -#define WMT_GOVR_FBADDR1 0x094 -#define WMT_GOVR_XRES 0x098 -#define WMT_GOVR_XRES_VIRTUAL 0x09c -#define WMT_GOVR_YPAN 0x0a0 -#define WMT_GOVR_XPAN 0x0a4 -#define WMT_GOVR_FHI 0x0a8 -#define WMT_GOVR_REG_UPDATE 0x0e4 -#define WMT_GOVR_TG 0x100 -#define WMT_GOVR_TIMING_H_ALL 0x108 -#define WMT_GOVR_TIMING_V_ALL 0x10c -#define WMT_GOVR_TIMING_V_START 0x110 -#define WMT_GOVR_TIMING_V_END 0x114 -#define WMT_GOVR_TIMING_H_START 0x118 -#define WMT_GOVR_TIMING_H_END 0x11c -#define WMT_GOVR_TIMING_V_SYNC 0x128 -#define WMT_GOVR_TIMING_H_SYNC 0x12c -#define WMT_GOVR_DVO_SET 0x148 -#define WMT_GOVR_CONTRAST 0x1b8 -#define WMT_GOVR_BRGHTNESS 0x1bc -#define WMT_GOVR_COLORSPACE 0x1e4 +#define REG_GOVRH_CUR_ADDR 0x0000 +#define REG_GOVRH_CUR_WIDTH 0x0004 +#define REG_GOVRH_CUR_FB_WIDTH 0x0008 +#define REG_GOVRH_CUR_VCROP 0x000C +#define REG_GOVRH_CUR_HCROP 0x0010 +#define REG_GOVRH_CUR_HCOORD 0x0014 +#define REG_GOVRH_CUR_VCOORD 0x0018 +#define REG_GOVRH_CUR_STATUS 0x001C +#define REG_GOVRH_CUR_COLOR_KEY 0x0020 +#define REG_GOVRH_DVO_PIX 0x0030 +#define REG_GOVRH_DVO_DLY_SEL 0x0034 +#define REG_GOVRH_INT 0x0038 +#define REG_GOVRH_DVO_BLANK_DATA 0x003C +#define REG_GOVRH_DIRPATH 0x0040/* WM8750+ */ +#define REG_GOVRH_MIF 0x0080 +#define REG_GOVRH_COLFMT 0x0084 +#define REG_GOVRH_SRCFMT 0x0088 +#define REG_GOVRH_DSTFMT 0x008C +#define REG_GOVRH_YSA 0x0090 +#define REG_GOVRH_CSA 0x0094 +#define REG_GOVRH_PIXWID 0x0098 +#define REG_GOVRH_BUFWID 0x009C +#define REG_GOVRH_VCROP 0x00A0 +#define REG_GOVRH_HCROP 0x00A4 +#define REG_GOVRH_FHI 0x00A8 +#define REG_GOVRH_COLFMT2 0x00AC +#define REG_GOVRH_YSA2 0x00B0/* WM8950 */ +#define REG_GOVRH_CSA2 0x00B4/* WM8950 */ +#define REG_GOVRH_MIF_FRAME_MODE 0x00B8/* WM8950 */ +#define REG_GOVRH_REG_STS 0x00E4 +#define REG_GOVRH_SWFLD 0x00E8 +#define REG_GOVRH_TG_ENABLE 0x0100 +#define REG_GOVRH_READ_CYC 0x0104 +#define REG_GOVRH_H_ALLPXL 0x0108 +#define REG_GOVRH_V_ALLLN 0x010C +#define REG_GOVRH_ACTLN_BG 0x0110 +#define REG_GOVRH_ACTLN_END 0x0114 +#define REG_GOVRH_ACTPX_BG 0x0118 +#define REG_GOVRH_ACTPX_END 0x011C +#define REG_GOVRH_VBIE_LINE 0x0120 +#define REG_GOVRH_PVBI_LINE 0x0124 +#define REG_GOVRH_HDMI_VBISW 0x0128 +#define REG_GOVRH_HDMI_HSYNW 0x012C +#define REG_GOVRH_VSYNC_OFFSET 0x0130 +#define REG_GOVRH_FIELD_STATUS 0x0134 +#define REG_GOVRH_HDMI_3D 0x013C/* WM8950 */ +#define REG_GOVRH_DVO_SET 0x0148 +#define REG_GOVRH_CB_ENABLE 0x0150 +#define REG_GOVRH_H_ALLPXL2 0x0158 +#define REG_GOVRH_V_ALLLN2 0x015C +#define REG_GOVRH_ACTLN_BG2 0x0160 +#define REG_GOVRH_ACTLN_END2 0x0164 +#define REG_GOVRH_ACTPX_BG2 0x0168 +#define REG_GOVRH_ACTPX_END2 0x016C +#define REG_GOVRH_VBIE_LINE2 0x0170 +#define REG_GOVRH_PVBI_LINE2 0x0174 +#define REG_GOVRH_HDMI_VBISW2 0x0178 +#define REG_GOVRH_HDMI_HSYNW2 0x017C +#define REG_GOVRH_LVDS_CTRL 0x0180/* WM8750+ */ +#define REG_GOVRH_LVDS_CTRL2 0x0184/* WM8750+ */ +#define REG_GOVRH_DAC_LP_SENSE_VAL 0x0188/* WM8750 */ +#define REG_GOVRH_DAC_TEST_MODE 0x018C/* WM8750 */ +#define REG_GOVRH_VGA_HSYNW 0x0190/* WM8750 */ +#define REG_GOVRH_VGA_VSYNW 0x0194/* WM8750 */ +#define REG_GOVRH_VGA_SYNPOLAR 0x0198/* WM8750 */ +#define REG_GOVRH_DAC_MOD 0x019C/* WM8750 */ +#define REG_GOVRH_DAC_VAL 0x01A0/* WM8750 */ +#define REG_GOVRH_DAC_CON 0x01A4/* WM8750 */ +#define REG_GOVRH_DAC_TEST 0x01A8/* WM8750 */ +#define REG_GOVRH_DAC_BTEST 0x01AC/* WM8750 */ +#define REG_GOVRH_DAC_CTEST 0x01B0/* WM8750 */ +#define REG_GOVRH_DAC_DBG 0x01B4/* WM8750 */ +#define REG_GOVRH_CONTRAST 0x01B8 +#define REG_GOVRH_BRIGHTNESS 0x01BC +#define REG_GOVRH_DMACSC_COEF0 0x01C0 +#define REG_GOVRH_DMACSC_COEF1 0x01C4 +#define REG_GOVRH_DMACSC_COEF2 0x01C8 +#define REG_GOVRH_DMACSC_COEF3 0x01CC +#define REG_GOVRH_DMACSC_COEF4 0x01D0 +#define REG_GOVRH_DMACSC_COEF5 0x01D8 +#define REG_GOVRH_DMACSC_COEF6 0x01DC +#define REG_GOVRH_CSC_MODE 0x01E0 +#define REG_GOVRH_YUVRGB 0x01E4 +#define REG_GOVRH_H264_INPUT_EN 0x01E8 +#define REG_GOVRH_DISP_EN 0x01EC/* WM8750 */ +#define REG_GOVRH_HSCALE_UP 0x01F4 +#define REG_GOVRH_IGS_MODE 0x01F8 +#define REG_GOVRH_IGS_MODE2 0x01FC#define to_wm8505fb_info (__info) container_of(__info, \ struct wm8505fb_info, fb)
@@ -82,26 +147,26 @@ static int wm8505fb_init_hw(struct fb_info *info)writel (0 , fbi->regbase + i);/* Set frame buffer address */ -writel (fbi->fb.fix.smem_start, fbi->regbase +WMT_GOVR_FBADDR ); -writel (fbi->fb.fix.smem_start, fbi->regbase +WMT_GOVR_FBADDR1 ); +writel (fbi->fb.fix.smem_start, fbi->regbase +REG_GOVRH_YSA ); +writel (fbi->fb.fix.smem_start, fbi->regbase +REG_GOVRH_CSA );/* * Set in-memory picture format to RGB * 0x31C sets the correct color mode (RGB565) for WM8650 * Bit 8+9 (0x300) are ignored on WM8505 as reserved */ -writel (0x31c , fbi->regbase +WMT_GOVR_COLORSPACE ); -writel (1 , fbi->regbase +WMT_GOVR_COLORSPACE1 ); +writel (0x31c , fbi->regbase +REG_GOVRH_YUVRGB ); +writel (1 , fbi->regbase +REG_GOVRH_DVO_PIX );/* Virtual buffer size */ -writel (info->var.xres, fbi->regbase +WMT_GOVR_XRES ); -writel (info->var.xres_virtual, fbi->regbase +WMT_GOVR_XRES_VIRTUAL ); +writel (info->var.xres, fbi->regbase +REG_GOVRH_PIXWID ); +writel (info->var.xres_virtual, fbi->regbase +REG_GOVRH_BUFWID );/* black magic ;) */ -writel (0xf , fbi->regbase +WMT_GOVR_FHI ); -writel (4 , fbi->regbase +WMT_GOVR_DVO_SET ); -writel (1 , fbi->regbase +WMT_GOVR_MIF_ENABLE ); -writel (1 , fbi->regbase +WMT_GOVR_REG_UPDATE ); +writel (0xf , fbi->regbase +REG_GOVRH_FHI ); +writel (4 , fbi->regbase +REG_GOVRH_DVO_SET ); +writel (1 , fbi->regbase +REG_GOVRH_MIF ); +writel (1 , fbi->regbase +REG_GOVRH_REG_STS );return 0 ; }
@@ -120,19 +185,19 @@ static int wm8505fb_set_timing(struct fb_info *info)int v_all = v_end + info->var.lower_margin;int v_sync = info->var.vsync_len; -writel (0 , fbi->regbase +WMT_GOVR_TG ); +writel (0 , fbi->regbase +REG_GOVRH_TG_ENABLE ); -writel (h_start, fbi->regbase +WMT_GOVR_TIMING_H_START ); -writel (h_end, fbi->regbase +WMT_GOVR_TIMING_H_END ); -writel (h_all, fbi->regbase +WMT_GOVR_TIMING_H_ALL ); -writel (h_sync, fbi->regbase +WMT_GOVR_TIMING_H_SYNC ); +writel (h_start, fbi->regbase +REG_GOVRH_ACTPX_BG ); +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 ); -writel (v_start, fbi->regbase +WMT_GOVR_TIMING_V_START ); -writel (v_end, fbi->regbase +WMT_GOVR_TIMING_V_END ); -writel (v_all, fbi->regbase +WMT_GOVR_TIMING_V_ALL ); -writel (v_sync, fbi->regbase +WMT_GOVR_TIMING_V_SYNC ); +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 ); -writel (1 , fbi->regbase +WMT_GOVR_TG ); +writel (1 , fbi->regbase +REG_GOVRH_TG_ENABLE );return 0 ; }
@@ -174,7 +239,7 @@ static int wm8505fb_set_par(struct fb_info *info)wm8505fb_set_timing (info);writel (fbi->contrast<<16 | fbi->contrast<<8 | fbi->contrast, - fbi->regbase +WMT_GOVR_CONTRAST ); + fbi->regbase +REG_GOVRH_CONTRAST );return 0 ; }
@@ -250,8 +315,8 @@ static int wm8505fb_pan_display(struct fb_var_screeninfo *var, {struct wm8505fb_info *fbi =to_wm8505fb_info (info); -writel (var->xoffset, fbi->regbase +WMT_GOVR_XPAN ); -writel (var->yoffset, fbi->regbase +WMT_GOVR_YPAN ); +writel (var->xoffset, fbi->regbase +REG_GOVRH_VCROP ); +writel (var->yoffset, fbi->regbase +REG_GOVRH_HCROP );return 0 ; }
@@ -264,7 +329,7 @@ static int wm8505fb_blank(int blank, struct fb_info *info)wm8505fb_set_timing (info);break ;default : -writel (0 , fbi->regbase +WMT_GOVR_TIMING_V_SYNC ); +writel (0 , fbi->regbase +REG_GOVRH_HDMI_VBISW );break ; }
drivers/video/wmt_ge_rops.c +220 -60
310 lines not on this page · raw message
Signature · 1 line
1.7.9.5
PATCH 3/4 fb: vt8500: Require a device clock for wm8505fb driver
In reply to Tony PriskThe wm8505fb driver requires a clock to work properly. Without a clock, the driver can only initialize the display resolution that was set in uboot.
This patch updates the driver to get and use a clock, and updates the devicetree documentation to indicate the requirement for a clock.
--- .../devicetree/bindings/video/wm,wm8505-fb.txt | 4 ++- drivers/video/wm8505fb.c | 30 +++++++++++++++++--- 2 files changed, 29 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +3 -1
@@ -5,6 +5,7 @@ Required properties: - compatible : "wm,wm8505-fb" - reg : Should contain 1 register ranges(address and length) - bits-per-pixel : bit depth of framebuffer (16 or 32) +- clocks : phandle to DVO clock Required subnodes: - display-timings: see display-timing.txt for information
@@ -15,11 +16,12 @@ Example: compatible = "wm,wm8505-fb"; reg = <0xd8051700 0x200>; bits-per-pixel = <16>; + clocks = <&clkdvo>; display-timings { native-mode = <&timing0>; timing0: 800x480 { - clock-frequency = <0>; /* unused but required */ + clock-frequency = <30000000>; hactive = <800>; vactive = <480>; hfront-porch = <40>;
drivers/video/wm8505fb.c +26 -4
@@ -14,6 +14,7 @@* GNU General Public License for more details. */ +#include <linux/clk.h> #include <linux/delay.h> #include <linux/dma-mapping.h> #include <linux/fb.h>
@@ -130,9 +131,11 @@#define to_wm8505fb_info (__info) container_of(__info, \ struct wm8505fb_info, fb)struct wm8505fb_info { -struct fb_info fb; -void __iomem *regbase; -unsigned int contrast; +struct fb_info fb; +void __iomem *regbase; +unsigned int contrast; +struct device *dev; +struct clk *clk_dvo; };
@@ -210,6 +213,13 @@ static int wm8505fb_set_par(struct fb_info *info)if (!fbi)return -EINVAL ; +if (info->var.pixclock ==0 ) { +dev_err (fbi->dev,"requested pixclock = 0\n" ); +return -EINVAL ; + } + +clk_set_rate (fbi->clk_dvo,PICOS2KHZ (info->var.pixclock)*1000 ); +if (info->var.bits_per_pixel ==32 ) { info->var.red.offset =16 ; info->var.red.length =8 ;
@@ -369,6 +379,8 @@ static int wm8505fb_probe(struct platform_device *pdev)return -ENOMEM ; } + fbi->dev = &pdev->dev; +strcpy (fbi->fb.fix.id,DRIVER_NAME ); fbi->fb.fix.type =FB_TYPE_PACKED_PIXELS ;
@@ -408,6 +420,14 @@ static int wm8505fb_probe(struct platform_device *pdev)if (ret)return ret; + fbi->clk_dvo =of_clk_get (pdev->dev.of_node,0 ); +if (IS_ERR (fbi->clk_dvo)) { +dev_err (&pdev->dev,"Error retrieving clock\n" ); +return PTR_ERR (fbi->clk_dvo); + } + +clk_prepare_enable (fbi->clk_dvo); +fb_videomode_to_var (&fbi->fb.var, &mode); fbi->fb.var.nonstd =0 ;
@@ -421,7 +441,7 @@ static int wm8505fb_probe(struct platform_device *pdev) fb_mem_virt =dmam_alloc_coherent (&pdev->dev, fb_mem_len, &fb_mem_phys,GFP_KERNEL );if (!fb_mem_virt) { -pr_err ("%s: Failed to allocate framebuffer\n" , __func__); +dev_err (&pdev->dev,"Failed to allocate framebuffer\n" );return -ENOMEM ; }
@@ -480,6 +500,8 @@ static int wm8505fb_remove(struct platform_device *pdev)unregister_framebuffer (&fbi->fb); +clk_disable_unprepare (fbi->clk_dvo); +writel (0 , fbi->regbase);if (fbi->fb.cmap.len)
Signature · 1 line
1.7.9.5
PATCH 4/4 fb: vt8500: Add VGA output support to wm8505fb driver.
In reply to Tony PriskThe 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.
--- .../devicetree/bindings/video/wm,wm8505-fb.txt | 5 ++++ drivers/video/wm8505fb.c | 31 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +5 -0
@@ -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>;
drivers/video/wm8505fb.c +29 -2
@@ -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 ;
Signature · 1 line
1.7.9.5
Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.
2013/5/18 Tony Prisk <[email protected]>:
Quoted 57 lines
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 <[email protected]>--- .../devicetree/bindings/video/wm,wm8505-fb.txt | 5 ++++ drivers/video/wm8505fb.c | 31 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +5
-0@@ -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>;drivers/video/wm8505fb.c +5
-0@@ -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; };
drivers/video/wm8505fb.c static int wm8505fb_init_hw(struct fb_info *info) · line 171
Quoted 10 lines
drivers/video/wm8505fb.c +5
-1@@ -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 );
Tony,
Would it be possible to also define known bit offsets for those registers, while you are at this? It would probably reduce the black magic quite a bit :)
drivers/video/wm8505fb.c static int wm8505fb_init_hw(struct fb_info *info) · line 183
Quoted 11 lines
drivers/video/wm8505fb.c +5
-1/* 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 );
I don't remember if HDMI is yet another option for this register or not... If it is, it would probably warrant defining fbi->interface as an enum and changing this if-else into a switch statement to let the compiler add its checks/warnings.
drivers/video/wm8505fb.c static int wm8505fb_set_timing(struct fb_info *info) · line 212
Quoted 9 lines
drivers/video/wm8505fb.c +2
-0writel (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 );
Will it misbehave on LCD if you write to the VGA register unconditionally?
drivers/video/wm8505fb.c static int wm8505fb_set_timing(struct fb_info *info) · line 219
Quoted 6 lines
drivers/video/wm8505fb.c +2
-0writel (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 );
Same here. I would assume that setting the pixclock should not hurt LCD, which would then simplify the code a little.
Thanks,
Alexey
Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.
Quoted 5 lines · Alexey Charkov
2013/5/18 Tony Prisk <[email protected]>:
Quoted 3 lines
/* Virtual buffer size */(quoted diff) +0
-0@@ -167,7 +176,12 @@ static int wm8505fb_init_hw(struct fb_info *info)
Quoted 12 lines
drivers/video/wm8505fb.c static int wm8505fb_init_hw(struct fb_info *info) · line 183
Quoted 8 lines
drivers/video/wm8505fb.c +5
-1/* 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 );I don't remember if HDMI is yet another option for this register or not... If it is, it would probably warrant defining
fbi->interfaceas an enum and changing this if-else into a switch statement to let the compiler add its checks/warnings.
HDMI output can work simultaneously with LCD (on 8850 at least), which fbi->interface in its current form would not allow to express.
Quoted 4 lines
drivers/video/wm8505fb.c +2
-0+if (fbi->interface ==INTERFACE_VGA ) +writel (h_sync, fbi->regbase +REG_GOVRH_VGA_HSYNW );Will it misbehave on LCD if you write to the VGA register unconditionally?
Can we have 3 flags, something like LCD_ON, VGA_ON, HDMI_ON instead of enum for video interface selection?
Regards,
Andy.
Re: [PATCH 4/4] fb: vt8500: Add VGA output support to wm8505fb driver.
In reply to Alexey CharkovQuoted 70 lines · Alexey Charkov
2013/5/18 Tony Prisk <[email protected]>:
Quoted 57 lines
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 <[email protected]>--- .../devicetree/bindings/video/wm,wm8505-fb.txt | 5 ++++ drivers/video/wm8505fb.c | 31 ++++++++++++++++++-- 2 files changed, 34 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/video/wm,wm8505-fb.txt +5
-0@@ -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>;drivers/video/wm8505fb.c +5
-0@@ -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; };drivers/video/wm8505fb.c static int wm8505fb_init_hw(struct fb_info *info) · line 171
Quoted 10 lines
drivers/video/wm8505fb.c +5
-1@@ -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 );Tony,
Quoted 3 lines
Would it be possible to also define known bit offsets for those registers, while you are at this? It would probably reduce the black magic quite a bit :)
On my list of things to do :)
Quoted 15 lines
drivers/video/wm8505fb.c static int wm8505fb_init_hw(struct fb_info *info) · line 183
Quoted 11 lines
drivers/video/wm8505fb.c +5
-1/* 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 );I don't remember if HDMI is yet another option for this register or not... If it is, it would probably warrant defining
fbi->interfaceas an enum and changing this if-else into a switch statement to let the compiler add its checks/warnings.
This register defines the h/v syncpolarity and enable/disable for DVO.
Quoted 11 lines
drivers/video/wm8505fb.c static int wm8505fb_set_timing(struct fb_info *info) · line 212
Quoted 10 lines
drivers/video/wm8505fb.c +2
-0writel (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 );Will it misbehave on LCD if you write to the VGA register unconditionally?
Don't know - wouldn't imagine so. I will test it and see.
Quoted 7 lines
drivers/video/wm8505fb.c static int wm8505fb_set_timing(struct fb_info *info) · line 219
Quoted 7 lines
drivers/video/wm8505fb.c +2
-0writel (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 );
Quoted 5 lines
Same here. I would assume that setting the pixclock should not hurt LCD, which would then simplify the code a little.
Thanks,
Alexey
Regards
Tony Prisk
Quoted 12 lines · Tony Prisk
Patch #1 - Move register defines inside the driver and drop the header. Patch #2 - Convert the register defines to use the vendor preferred names. Patch #3 - Add a device clock to wm8505fb. Without it, only the uboot initialized resolution is supported.
Patch #4 - Add support for the VGA output found on the APC8750 board.Tony Prisk (4):
fb: vt8500: Move register defines inside driver
fb: vt8500: Convert to use vendor register names
fb: vt8500: Require a device clock for wm8505fb driver
fb: vt8500: Add VGA output support to wm8505fb driver.
Quoted 7 lines
.../devicetree/bindings/video/wm,wm8505-fb.txt | 9 +- drivers/video/wm8505fb.c | 195 ++++++++++++-- drivers/video/wm8505fb_regs.h | 76 ------ drivers/video/wmt_ge_rops.c | 280 +++++++++++++++----- 4 files changed, 394 insertions(+), 166 deletions(-)delete mode 100644
drivers/video/wm8505fb_regs.h
Florian/Tomi,
Please ignore these patches. This driver needs a bit more work, so I will do a
more thorough series and resubmit.
Regards
Tony Prisk