Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* Re: [PATCHv3 0/6] fb: vt8500: patches for 3.10
From: Tony Prisk @ 2013-04-04  5:27 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

On 03/04/13 07:20, Tony Prisk wrote:
> V3 Changes:
> Tidied up patch 1 as requested by Jean-Christophe - Makes the patch much
> simpler.
>
> V2 Changes:
> Split the SoC and board portions of the binding into their respective files.
> Removed the forced non-interlaced code from wm8505fb.c and vt8500lcdfb.c
>
> Julia Lawall (1):
>    drivers/video/wm8505fb.c: use devm_ functions
>
> Tony Prisk (5):
>    video: vt8500: Make wmt_ge_rops optional
>    video: vt8500: Remove unused platform_data/video-vt8500lcdfb.h
>    video: vt8500: Correct descriptions in video/Kconfig
>    video: vt8500: Adjust contrast in wm8505 framebuffer driver.
>    video: fb: vt8500: Convert framebuffer drivers to standardized
>      binding
>
>   .../devicetree/bindings/video/via,vt8500-fb.txt    |   48 ++-----
>   .../devicetree/bindings/video/wm,wm8505-fb.txt     |   32 +++--
>   arch/arm/boot/dts/vt8500-bv07.dts                  |   34 ++---
>   arch/arm/boot/dts/vt8500.dtsi                      |    4 +-
>   arch/arm/boot/dts/wm8505-ref.dts                   |   34 ++---
>   arch/arm/boot/dts/wm8505.dtsi                      |    4 +-
>   arch/arm/boot/dts/wm8650-mid.dts                   |   36 +++--
>   arch/arm/boot/dts/wm8650.dtsi                      |    4 +-
>   arch/arm/boot/dts/wm8850-w70v2.dts                 |   40 +++---
>   arch/arm/boot/dts/wm8850.dtsi                      |    4 +-
>   drivers/video/Kconfig                              |   37 +++--
>   drivers/video/vt8500lcdfb.c                        |   55 +++-----
>   drivers/video/wm8505fb.c                           |  144 ++++++--------------
>   drivers/video/wmt_ge_rops.h                        |   23 ++++
>   include/linux/platform_data/video-vt8500lcdfb.h    |   31 -----
>   15 files changed, 211 insertions(+), 319 deletions(-)
>   delete mode 100644 include/linux/platform_data/video-vt8500lcdfb.h
>
Tomi,

If no one has any further comments, are you still prepared to take this 
series?
If so, I will send a pull-request.

With regards to the earlier concern about your current patch series, I 
think its easiest if you do take this series then you could do a fixup 
patch if this one is merged first. From what I remember of your series, 
it is basically a rename of of_get_display_timings() to 
of_get_display_timing() and some new code which I don't use. Seems a 
rather trivial patch for a fixup later.

Let me know what you want to do.

Regards
Tony P

^ permalink raw reply

* [PATCH V2] video: implement a simple framebuffer driver
From: Stephen Warren @ 2013-04-04  2:39 UTC (permalink / raw)
  To: linux-arm-kernel

A simple frame-buffer describes a raw memory region that may be rendered
to, with the assumption that the display hardware has already been set
up to scan out from that buffer.

This is useful in cases where a bootloader exists and has set up the
display hardware, but a Linux driver doesn't yet exist for the display
hardware.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
v2: s/dumb/simple/ throughout. Provide more details on pixel format.

I ended up going with a separate FB driver:
* DRM/KMS look much more complex, and don't provide any benefit that I can
  tell for this simple driver.
* Creating a separate driver rather than adjusting offb.c to work allows a
  new clean binding to be defined, and doesn't require removing or ifdefing
  PPC-isms in offb.c.
---
 .../bindings/video/simple-framebuffer.txt          |   25 +++
 drivers/video/Kconfig                              |   17 ++
 drivers/video/Makefile                             |    1 +
 drivers/video/simplefb.c                           |  234 ++++++++++++++++++++
 4 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/simple-framebuffer.txt
 create mode 100644 drivers/video/simplefb.c

diff --git a/Documentation/devicetree/bindings/video/simple-framebuffer.txt b/Documentation/devicetree/bindings/video/simple-framebuffer.txt
new file mode 100644
index 0000000..3ea4605
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/simple-framebuffer.txt
@@ -0,0 +1,25 @@
+Simple Framebuffer
+
+A simple frame-buffer describes a raw memory region that may be rendered to,
+with the assumption that the display hardware has already been set up to scan
+out from that buffer.
+
+Required properties:
+- compatible: "simple-framebuffer"
+- reg: Should contain the location and size of the framebuffer memory.
+- width: The width of the framebuffer in pixels.
+- height: The height of the framebuffer in pixels.
+- stride: The number of bytes in each line of the framebuffer.
+- format: The format of the framebuffer surface. Valid values are:
+  - r5g6b5 (16-bit pixels, d[15:11]=r, d[10:5]=g, d[4:0]=b).
+
+Example:
+
+	framebuffer {
+		compatible = "simple-framebuffer";
+		reg = <0x1d385000 (1600 * 1200 * 2)>;
+		width = <1600>;
+		height = <1200>;
+		stride = <(1600 * 2)>;
+		format = "r5g6b5";
+	};
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0181a87..e946e9c 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2462,6 +2462,23 @@ config FB_HYPERV
 	help
 	  This framebuffer driver supports Microsoft Hyper-V Synthetic Video.
 
+config FB_SIMPLE
+	bool "Simple framebuffer support"
+	depends on (FB = y) && OF
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	help
+	  Say Y if you want support for a simple frame-buffer.
+
+	  This driver assumes that the display hardware has been initialized
+	  before the kernel boots, and the kernel will simply render to the
+	  pre-allocated frame buffer surface.
+
+	  Configuration re: surface address, size, and format must be provided
+	  through device tree, or potentially plain old platform data in the
+	  future.
+
 source "drivers/video/omap/Kconfig"
 source "drivers/video/omap2/Kconfig"
 source "drivers/video/exynos/Kconfig"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 97f7b6d..859f1fa 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -166,6 +166,7 @@ obj-$(CONFIG_FB_MX3)		  += mx3fb.o
 obj-$(CONFIG_FB_DA8XX)		  += da8xx-fb.o
 obj-$(CONFIG_FB_MXS)		  += mxsfb.o
 obj-$(CONFIG_FB_SSD1307)	  += ssd1307fb.o
+obj-$(CONFIG_FB_SIMPLE)           += simplefb.o
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)          += vfb.o
diff --git a/drivers/video/simplefb.c b/drivers/video/simplefb.c
new file mode 100644
index 0000000..8105c3d
--- /dev/null
+++ b/drivers/video/simplefb.c
@@ -0,0 +1,234 @@
+/*
+ * Simplest possible simple frame-buffer driver, as a platform device
+ *
+ * Copyright (c) 2013, Stephen Warren
+ *
+ * Based on q40fb.c, which was:
+ * Copyright (C) 2001 Richard Zidlicky <rz@linux-m68k.org>
+ *
+ * Also based on offb.c, which was:
+ * Copyright (C) 1997 Geert Uytterhoeven
+ * Copyright (C) 1996 Paul Mackerras
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/errno.h>
+#include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+static struct fb_fix_screeninfo simplefb_fix = {
+	.id		= "simple",
+	.type		= FB_TYPE_PACKED_PIXELS,
+	.visual		= FB_VISUAL_TRUECOLOR,
+	.accel		= FB_ACCEL_NONE,
+};
+
+static struct fb_var_screeninfo simplefb_var = {
+	.height		= -1,
+	.width		= -1,
+	.activate	= FB_ACTIVATE_NOW,
+	.vmode		= FB_VMODE_NONINTERLACED,
+};
+
+static int simplefb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+			      u_int transp, struct fb_info *info)
+{
+	u32 *pal = info->pseudo_palette;
+	u32 cr = red >> (16 - info->var.red.length);
+	u32 cg = green >> (16 - info->var.green.length);
+	u32 cb = blue >> (16 - info->var.blue.length);
+	u32 value;
+
+	if (regno >= 16)
+		return -EINVAL;
+
+	value = (cr << info->var.red.offset) |
+		(cg << info->var.green.offset) |
+		(cb << info->var.blue.offset);
+	if (info->var.transp.length > 0) {
+		u32 mask = (1 << info->var.transp.length) - 1;
+		mask <<= info->var.transp.offset;
+		value |= mask;
+	}
+	pal[regno] = value;
+
+	return 0;
+}
+
+static struct fb_ops simplefb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_setcolreg	= simplefb_setcolreg,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+};
+
+struct simplefb_format {
+	const char *name;
+	u32 bits_per_pixel;
+	struct fb_bitfield red;
+	struct fb_bitfield green;
+	struct fb_bitfield blue;
+	struct fb_bitfield transp;
+};
+
+struct simplefb_format simplefb_formats[] = {
+	{ "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} },
+};
+
+struct simplefb_params {
+	u32 width;
+	u32 height;
+	u32 stride;
+	struct simplefb_format *format;
+};
+
+static int simplefb_parse_dt(struct platform_device *pdev,
+			   struct simplefb_params *params)
+{
+	struct device_node *np = pdev->dev.of_node;
+	int ret;
+	const char *format;
+	int i;
+
+	ret = of_property_read_u32(np, "width", &params->width);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse width property\n");
+		return ret;
+	}
+
+	ret = of_property_read_u32(np, "height", &params->height);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse height property\n");
+		return ret;
+	}
+
+	ret = of_property_read_u32(np, "stride", &params->stride);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse stride property\n");
+		return ret;
+	}
+
+	ret = of_property_read_string(np, "format", &format);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse format property\n");
+		return ret;
+	}
+	params->format = NULL;
+	for (i = 0; i < ARRAY_SIZE(simplefb_formats); i++) {
+		if (strcmp(format, simplefb_formats[i].name))
+			continue;
+		params->format = &simplefb_formats[i];
+		break;
+	}
+	if (!params->format) {
+		dev_err(&pdev->dev, "Invalid format value\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int simplefb_probe(struct platform_device *pdev)
+{
+	int ret;
+	struct simplefb_params params;
+	struct fb_info *info;
+	struct resource *mem;
+
+	if (fb_get_options("simplefb", NULL))
+		return -ENODEV;
+
+	ret = simplefb_parse_dt(pdev, &params);
+	if (ret)
+		return ret;
+
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!mem) {
+		dev_err(&pdev->dev, "No memory resource\n");
+		return -EINVAL;
+	}
+
+	info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev);
+	if (!info)
+		return -ENOMEM;
+	platform_set_drvdata(pdev, info);
+
+	info->fix = simplefb_fix;
+	info->fix.smem_start = mem->start;
+	info->fix.smem_len = resource_size(mem);
+	info->fix.line_length = params.stride;
+
+	info->var = simplefb_var;
+	info->var.xres = params.width;
+	info->var.yres = params.height;
+	info->var.xres_virtual = params.width;
+	info->var.yres_virtual = params.height;
+	info->var.bits_per_pixel = params.format->bits_per_pixel;
+	info->var.red = params.format->red;
+	info->var.green = params.format->green;
+	info->var.blue = params.format->blue;
+	info->var.transp = params.format->transp;
+
+	info->fbops = &simplefb_ops;
+	info->flags = FBINFO_DEFAULT;
+	info->screen_base = devm_ioremap(&pdev->dev, info->fix.smem_start,
+					 info->fix.smem_len);
+	if (!info->screen_base) {
+		framebuffer_release(info);
+		return -ENODEV;
+	}
+	info->pseudo_palette = (void *)(info + 1);
+
+	ret = register_framebuffer(info);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Unable to register simplefb: %d\n", ret);
+		framebuffer_release(info);
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "fb%d: simplefb registered!\n", info->node);
+
+	return 0;
+}
+
+static int simplefb_remove(struct platform_device *pdev)
+{
+	struct fb_info *info = platform_get_drvdata(pdev);
+
+	unregister_framebuffer(info);
+	framebuffer_release(info);
+
+	return 0;
+}
+
+static const struct of_device_id simplefb_of_match[] = {
+	{ .compatible = "simple-framebuffer", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, simplefb_of_match);
+
+static struct platform_driver simplefb_driver = {
+	.driver = {
+		.name = "simple-framebuffer",
+		.owner = THIS_MODULE,
+		.of_match_table = simplefb_of_match,
+	},
+	.probe = simplefb_probe,
+	.remove = simplefb_remove,
+};
+module_platform_driver(simplefb_driver);
+
+MODULE_AUTHOR("Stephen Warren <swarren@wwwdotorg.org>");
+MODULE_DESCRIPTION("Simple framebuffer driver");
+MODULE_LICENSE("GPL v2");
-- 
1.7.10.4


^ permalink raw reply related

* Re: [PATCH] video: implement a dumb framebuffer driver
From: Stephen Warren @ 2013-04-04  2:25 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20130403064653.GA6263@quad.lixom.net>

On 04/03/2013 12:46 AM, Olof Johansson wrote:
> On Wed, Apr 03, 2013 at 12:17:10AM -0600, Stephen Warren wrote:
>> A dumb frame-buffer describes a raw memory region that may be rendered
>> to, with the assumption that the display hardware has already been set
>> up to scan out from that buffer.
>>
>> This is useful in cases where a bootloader exists and has set up the
>> display hardware, but a Linux driver doesn't yet exist for the display
>> hardware.
...
>> diff --git a/Documentation/devicetree/bindings/video/dumb-framebuffer.txt b/Documentation/devicetree/bindings/video/dumb-framebuffer.txt
...
>> +Required properties:
...
>> +- format: The format of the framebuffer surface. Valid values are:
>> +  r5g6b5: A 16bpp format.
> 
> Hm, I'm used to this being written as "rgb565", which is also the format
> string that the fsl-imx-drm binding seems to use.
> 
> I guess actual depth can easily be derived from format.

I'd prefer the bit-widths be interleaved with the component names; doing
so is a little more precise if you end up with 2-digit component widths,
e.g. 10-bit r/g/b plus 2-bit alpha, where the multi-digit numbers would
run together otherwise and hence aren't easily algorithmically parsable.
I believe this interleaved style is more common in the graphics world
too. The IMX binding doesn't seem like a good example; the other option
besides "rgb565" is "rgb24", which could be one one many different formats.

I'll address the dumb/simple naming issue and repost.

^ permalink raw reply

* Re: [PATCH 1/2] video: Add a helper for enabling a panel via GPIO from dt
From: Fabio Estevam @ 2013-04-03 17:57 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1364952653-7567-1-git-send-email-festevam@gmail.com>

On Tue, Apr 2, 2013 at 10:30 PM, Fabio Estevam <festevam@gmail.com> wrote:
> From: Fabio Estevam <fabio.estevam@freescale.com>
>
> Introduce a helper that can be used to retrieve the GPIO via devicetree that is
> used to turn on a display.
>
> Tested on a mx28evk board.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Please discard this series. I will use gpio-reset bindings instead.

^ permalink raw reply

* Re: [PATCH 00/33] OMAPDSS: platform_enable/disable callback removal from panel drivers
From: Tony Lindgren @ 2013-04-03 15:46 UTC (permalink / raw)
  To: Tomi Valkeinen; +Cc: Archit Taneja, linux-omap, linux-fbdev
In-Reply-To: <515C2058.8030402@ti.com>

* Tomi Valkeinen <tomi.valkeinen@ti.com> [130403 05:32]:
> Hi Tony,
> 
> On 2013-02-13 18:46, Tony Lindgren wrote:
> > * Archit Taneja <archit@ti.com> [130213 06:26]:
> >> init functions in omap board files request panel specific gpios, and provide
> >> functions which omapdss panel drivers call to enable or disable them.
> >>
> >> Instead of the board files requesting these gpios, they should just pass the
> >> platform specific data(like the gpio numbers), the panel should retrieve the
> >> platform data and request the gpios. Doing this prevents the need of the panel
> >> driver calling platform functions in board files.
> >>
> >> Panel drivers have their own platform data struct, and the board files populate
> >> these structs and pass the pointer to the 'data' field of omap_dss_device. This
> >> work will make it easier for the panel drivers be more adaptable to the
> >> DT model.
> >>
> >> There is also removal of passing panel reset_gpio numbers through
> >> omap_dss_device struct directly, reset gpios are passed through platform data
> >> only.
> > 
> > To avoid merge conflicts and dependencies between drivers and core
> > Soc code, please break thes kind of patches into following parts:
> > 
> > 1. Any platform_data header changes needed so both I and Tomi
> >    can pull it in as needed.
> > 
> > 2. Changes to DSS drivers. Please keep stubs around for the
> >    board specific callback functions so omap2plus_defconfig
> >    won't break with just #1 merged into arm soc tree.
> > 
> > 3. All the arch/arm/*omap* changes based on #1 above to
> >    drop obsolete callback functions and add new pdata if still
> >    needed. This needs to build and boot on #1 so I can merge
> >    this in via arm soc tree.
> > 
> > 4. Any .dts changes needed.
> 
> Tony, I've split these patches as follows:
> 
> Platform data header file changes:
> git://gitorious.org/linux-omap-dss2/linux.git 3.10/0-dss-headers
> 
> Board file changes (based on header changes):
> git://gitorious.org/linux-omap-dss2/linux.git 3.10-lo/board-cleanup
> 
> DSS panel changes (based on header changes):
> git://gitorious.org/linux-omap-dss2/linux.git 3.10/1-panel-cleanup
> 
> Removing unused fields from header files (based on panel changes):
> git://gitorious.org/linux-omap-dss2/linux.git 3.10/2-late-panel-cleanup
> 
> The 2-late-panel-cleanup breaks compilation if the arch changes are not
> merged, so I'll leave that until they have been merged.
> 
> Do you mind if I add the board-cleanup branch temporarily to omapdss's
> for-next, to simplify testing? When everything looks ok, I'll remove it
> and pass the branch to you to be handled through l-o.

Sure please go ahead. There are still some board-*.c related patches
that I have not merged, but we'll see those merge conflicts before
next as I usually do a merge with next before sending out pull reqs.

Regards,

Tony

^ permalink raw reply

* Re: [PATCH 00/33] OMAPDSS: platform_enable/disable callback removal from panel drivers
From: Tomi Valkeinen @ 2013-04-03 12:28 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Archit Taneja, linux-omap, linux-fbdev
In-Reply-To: <20130213164647.GF7144@atomide.com>

[-- Attachment #1: Type: text/plain, Size: 2557 bytes --]

Hi Tony,

On 2013-02-13 18:46, Tony Lindgren wrote:
> * Archit Taneja <archit@ti.com> [130213 06:26]:
>> init functions in omap board files request panel specific gpios, and provide
>> functions which omapdss panel drivers call to enable or disable them.
>>
>> Instead of the board files requesting these gpios, they should just pass the
>> platform specific data(like the gpio numbers), the panel should retrieve the
>> platform data and request the gpios. Doing this prevents the need of the panel
>> driver calling platform functions in board files.
>>
>> Panel drivers have their own platform data struct, and the board files populate
>> these structs and pass the pointer to the 'data' field of omap_dss_device. This
>> work will make it easier for the panel drivers be more adaptable to the
>> DT model.
>>
>> There is also removal of passing panel reset_gpio numbers through
>> omap_dss_device struct directly, reset gpios are passed through platform data
>> only.
> 
> To avoid merge conflicts and dependencies between drivers and core
> Soc code, please break thes kind of patches into following parts:
> 
> 1. Any platform_data header changes needed so both I and Tomi
>    can pull it in as needed.
> 
> 2. Changes to DSS drivers. Please keep stubs around for the
>    board specific callback functions so omap2plus_defconfig
>    won't break with just #1 merged into arm soc tree.
> 
> 3. All the arch/arm/*omap* changes based on #1 above to
>    drop obsolete callback functions and add new pdata if still
>    needed. This needs to build and boot on #1 so I can merge
>    this in via arm soc tree.
> 
> 4. Any .dts changes needed.

Tony, I've split these patches as follows:

Platform data header file changes:
git://gitorious.org/linux-omap-dss2/linux.git 3.10/0-dss-headers

Board file changes (based on header changes):
git://gitorious.org/linux-omap-dss2/linux.git 3.10-lo/board-cleanup

DSS panel changes (based on header changes):
git://gitorious.org/linux-omap-dss2/linux.git 3.10/1-panel-cleanup

Removing unused fields from header files (based on panel changes):
git://gitorious.org/linux-omap-dss2/linux.git 3.10/2-late-panel-cleanup

The 2-late-panel-cleanup breaks compilation if the arch changes are not
merged, so I'll leave that until they have been merged.

Do you mind if I add the board-cleanup branch temporarily to omapdss's
for-next, to simplify testing? When everything looks ok, I'll remove it
and pass the branch to you to be handled through l-o.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

^ permalink raw reply

* Re: [PATCH 05/33] arm: omap: board-cm-t35: use generic dpi panel's gpio handling
From: Tomi Valkeinen @ 2013-04-03 12:02 UTC (permalink / raw)
  To: Igor Grinberg; +Cc: Archit Taneja, linux-omap, linux-fbdev, Tony Lindgren
In-Reply-To: <511CEBC4.6050400@compulab.co.il>

[-- Attachment #1: Type: text/plain, Size: 5700 bytes --]

On 2013-02-14 15:51, Igor Grinberg wrote:
> On 02/14/13 14:52, Tomi Valkeinen wrote:
>> On 2013-02-14 14:37, Igor Grinberg wrote:
>>> On 02/14/13 12:59, Tomi Valkeinen wrote:
>>>> On 2013-02-14 11:43, Igor Grinberg wrote:
>>>
>>>>>> True, it's generic, but does it work reliably? The panel hardware is now
>>>>>> partly handled in the backlight driver, and partly in the omap's panel
>>>>>> driver (and wherever on other platforms).
>>>>>
>>>>> It works reliably on other platforms, but not on OMAP - because
>>>>> we need to cope with the OMAP specific framework...
>>>
>>>> How do you handle the gpios on other platform? Those are the ones
>>>> causing the issues here, right?
>>>
>>> Well, I'm also talking about something that is a history already.
>>> Remember, we had multiple panel drivers inside the
>>> video/omap2/displays and then they were consolidated into the
>>> "generic dpi/dsi/whatever".
> 
>> Sorry, I miss the point. Was that a bad thing? Didn't it simplify the
>> task for you with simple panels? It could've been taken even further,
>> though (see below).
> 
> Yes it was a good thing (I have already told this below).
> 
> 
>>> And yes you are right, on the platforms I'm aware of, the GPIO is not
>>> handled. Apparently its hardware default (pull resistor) is always on...
> 
>> Ok, so the simple fix of setting the GPIOs only in the board file is
>> acceptable for now.
> 
> Yep. I also told this already in one of the previous emails.
> 
> 
>> Can the LCD_BL_GPIO be handled by the omap panel driver? Otherwise the
>> backlight will supposedly be always on. Is it just a simple switch for
>> the BL power, which does not affect the SPI in any way?
> 
> Yes, it can for now.
> Also, I think we should also take into account the backlight framework,
> including PMW.

I've updated this patch to set the LCD EN gpio once at boot time, and pass the
LCD BL gpio to the panel driver. Updated patch below.

---

commit a58a72363aa4359cdb75878de1517bd50faf9eb4
Author: Tomi Valkeinen <tomi.valkeinen@ti.com>
Date:   Mon Dec 3 16:05:06 2012 +0530

    arm: omap: board-cm-t35: use generic dpi panel's gpio handling
    
    The cm-t35 board file currently requests gpios required to configure the tdo35s
    panel, and provides platform_enable/disable callbacks to configure them.
    
    These tasks have been moved to the generic dpi panel driver itself and shouldn't
    be done in the board files.
    
    Remove the gpio requests and the platform callbacks from the board file.
    Add the gpio information to generic dpi panel's platform data so that it's
    passed to the panel driver.
    
    Note: Only BL enable gpio is handled in the panel driver. The LCD enable
    GPIO is handled in the board file at init time, as there's a 50 ms delay
    required when using the GPIO, and the panel driver doesn't know about
    that.
    
    Cc: Tony Lindgren <tony@atomide.com>
    Cc: Igor Grinberg <grinberg@compulab.co.il>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>

diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index bccd3e5..cccbfea 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -190,32 +190,6 @@ static inline void cm_t35_init_nand(void) {}
 #define CM_T35_LCD_BL_GPIO 58
 #define CM_T35_DVI_EN_GPIO 54
 
-static int lcd_enabled;
-static int dvi_enabled;
-
-static int cm_t35_panel_enable_lcd(struct omap_dss_device *dssdev)
-{
-	if (dvi_enabled) {
-		printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
-		return -EINVAL;
-	}
-
-	gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
-	gpio_set_value(CM_T35_LCD_BL_GPIO, 1);
-
-	lcd_enabled = 1;
-
-	return 0;
-}
-
-static void cm_t35_panel_disable_lcd(struct omap_dss_device *dssdev)
-{
-	lcd_enabled = 0;
-
-	gpio_set_value(CM_T35_LCD_BL_GPIO, 0);
-	gpio_set_value(CM_T35_LCD_EN_GPIO, 0);
-}
-
 static int cm_t35_panel_enable_tv(struct omap_dss_device *dssdev)
 {
 	return 0;
@@ -227,8 +201,10 @@ static void cm_t35_panel_disable_tv(struct omap_dss_device *dssdev)
 
 static struct panel_generic_dpi_data lcd_panel = {
 	.name			= "toppoly_tdo35s",
-	.platform_enable	= cm_t35_panel_enable_lcd,
-	.platform_disable	= cm_t35_panel_disable_lcd,
+	.num_gpios		= 1,
+	.gpios			= {
+		CM_T35_LCD_BL_GPIO,
+	},
 };
 
 static struct omap_dss_device cm_t35_lcd_device = {
@@ -292,11 +268,6 @@ static struct spi_board_info cm_t35_lcd_spi_board_info[] __initdata = {
 	},
 };
 
-static struct gpio cm_t35_dss_gpios[] __initdata = {
-	{ CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW,  "lcd enable"    },
-	{ CM_T35_LCD_BL_GPIO, GPIOF_OUT_INIT_LOW,  "lcd bl enable" },
-};
-
 static void __init cm_t35_init_display(void)
 {
 	int err;
@@ -304,23 +275,21 @@ static void __init cm_t35_init_display(void)
 	spi_register_board_info(cm_t35_lcd_spi_board_info,
 				ARRAY_SIZE(cm_t35_lcd_spi_board_info));
 
-	err = gpio_request_array(cm_t35_dss_gpios,
-				 ARRAY_SIZE(cm_t35_dss_gpios));
+
+	err = gpio_request_one(CM_T35_LCD_EN_GPIO, GPIOF_OUT_INIT_LOW,
+			"lcd bl enable");
 	if (err) {
-		pr_err("CM-T35: failed to request DSS control GPIOs\n");
+		pr_err("CM-T35: failed to request LCD EN GPIO\n");
 		return;
 	}
 
-	gpio_export(CM_T35_LCD_EN_GPIO, 0);
-	gpio_export(CM_T35_LCD_BL_GPIO, 0);
-
 	msleep(50);
 	gpio_set_value(CM_T35_LCD_EN_GPIO, 1);
 
 	err = omap_display_init(&cm_t35_dss_data);
 	if (err) {
 		pr_err("CM-T35: failed to register DSS device\n");
-		gpio_free_array(cm_t35_dss_gpios, ARRAY_SIZE(cm_t35_dss_gpios));
+		gpio_free(CM_T35_LCD_EN_GPIO);
 	}
 }
 



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

^ permalink raw reply related

* Re: [PATCH] video: implement a dumb framebuffer driver
From: Olof Johansson @ 2013-04-03  6:46 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364969830-6481-1-git-send-email-swarren@wwwdotorg.org>

On Wed, Apr 03, 2013 at 12:17:10AM -0600, Stephen Warren wrote:
> A dumb frame-buffer describes a raw memory region that may be rendered
> to, with the assumption that the display hardware has already been set
> up to scan out from that buffer.
> 
> This is useful in cases where a bootloader exists and has set up the
> display hardware, but a Linux driver doesn't yet exist for the display
> hardware.
> 
> Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
> ---
> Should this be merged through akpm's tree (I think many fb drivers are
> these days), or if not, I could take it through the bcm2835 tree.

Yes, through akpm is the way to go (with ack from Rob/Grant for bindings).

> I ended up going with a separate FB driver:
> * DRM/KMS look much more complex, and don't provide any benefit that I can
>   tell for this simple driver.
> * Creating a separate driver rather than adjusting offb.c to work allows a
>   new clean binding to be defined, and doesn't require removing or ifdefing
>   PPC-isms in offb.c.

Sounds reasonable.

I've got some opinions on the color of this shed below. I don't have strong
opinions on the matter though.

> 
>  .../devicetree/bindings/video/dumb-framebuffer.txt |   25 +++
>  drivers/video/Kconfig                              |   17 ++
>  drivers/video/Makefile                             |    1 +
>  drivers/video/dumbfb.c                             |  234 ++++++++++++++++++++
>  4 files changed, 277 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/video/dumb-framebuffer.txt
>  create mode 100644 drivers/video/dumbfb.c
> 
> diff --git a/Documentation/devicetree/bindings/video/dumb-framebuffer.txt b/Documentation/devicetree/bindings/video/dumb-framebuffer.txt
> new file mode 100644
> index 0000000..ba6676b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/video/dumb-framebuffer.txt
> @@ -0,0 +1,25 @@
> +Dumb Framebuffer
> +
> +A dumb frame-buffer describes a raw memory region that may be rendered to,
> +with the assumption that the display hardware has already been set up to scan
> +out from that buffer.

I think we have preferred "simple" over "dumb" in the past in other context.

> +
> +Required properties:
> +- compatible: "dumb-framebuffer"
> +- reg: Should contain the location and size of the framebuffer memory.
> +- width: The width of the framebuffer in pixels.
> +- height: The height of the framebuffer in pixels.
> +- stride: The number of bytes in each line of the framebuffer.
> +- format: The format of the framebuffer surface. Valid values are:
> +  r5g6b5: A 16bpp format.

Hm, I'm used to this being written as "rgb565", which is also the format
string that the fsl-imx-drm binding seems to use.

I guess actual depth can easily be derived from format.

> +Example:
> +
> +	framebuffer {
> +		compatible = "dumb-framebuffer";
> +		reg = <0x1d385000 (1600 * 1200 * 2)>;
> +		width = <1600>;
> +		height = <1200>;
> +		stride = <(1600 * 2)>;
> +		format = "r5g6b5";
> +	};


-Olof

^ permalink raw reply

* [PATCH] video: implement a dumb framebuffer driver
From: Stephen Warren @ 2013-04-03  6:17 UTC (permalink / raw)
  To: linux-arm-kernel

A dumb frame-buffer describes a raw memory region that may be rendered
to, with the assumption that the display hardware has already been set
up to scan out from that buffer.

This is useful in cases where a bootloader exists and has set up the
display hardware, but a Linux driver doesn't yet exist for the display
hardware.

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
---
Should this be merged through akpm's tree (I think many fb drivers are
these days), or if not, I could take it through the bcm2835 tree.

I ended up going with a separate FB driver:
* DRM/KMS look much more complex, and don't provide any benefit that I can
  tell for this simple driver.
* Creating a separate driver rather than adjusting offb.c to work allows a
  new clean binding to be defined, and doesn't require removing or ifdefing
  PPC-isms in offb.c.

 .../devicetree/bindings/video/dumb-framebuffer.txt |   25 +++
 drivers/video/Kconfig                              |   17 ++
 drivers/video/Makefile                             |    1 +
 drivers/video/dumbfb.c                             |  234 ++++++++++++++++++++
 4 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/video/dumb-framebuffer.txt
 create mode 100644 drivers/video/dumbfb.c

diff --git a/Documentation/devicetree/bindings/video/dumb-framebuffer.txt b/Documentation/devicetree/bindings/video/dumb-framebuffer.txt
new file mode 100644
index 0000000..ba6676b
--- /dev/null
+++ b/Documentation/devicetree/bindings/video/dumb-framebuffer.txt
@@ -0,0 +1,25 @@
+Dumb Framebuffer
+
+A dumb frame-buffer describes a raw memory region that may be rendered to,
+with the assumption that the display hardware has already been set up to scan
+out from that buffer.
+
+Required properties:
+- compatible: "dumb-framebuffer"
+- reg: Should contain the location and size of the framebuffer memory.
+- width: The width of the framebuffer in pixels.
+- height: The height of the framebuffer in pixels.
+- stride: The number of bytes in each line of the framebuffer.
+- format: The format of the framebuffer surface. Valid values are:
+  r5g6b5: A 16bpp format.
+
+Example:
+
+	framebuffer {
+		compatible = "dumb-framebuffer";
+		reg = <0x1d385000 (1600 * 1200 * 2)>;
+		width = <1600>;
+		height = <1200>;
+		stride = <(1600 * 2)>;
+		format = "r5g6b5";
+	};
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4c1546f..0ebc143 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2451,6 +2451,23 @@ config FB_PUV3_UNIGFX
 	  Choose this option if you want to use the Unigfx device as a
 	  framebuffer device. Without the support of PCI & AGP.
 
+config FB_DUMB
+	bool "Dumb framebuffer support"
+	depends on (FB = y) && OF
+	select FB_CFB_FILLRECT
+	select FB_CFB_COPYAREA
+	select FB_CFB_IMAGEBLIT
+	help
+	  Say Y if you want support for a dumb frame-buffer.
+
+	  This driver assumes that the display hardware has been initialized
+	  before the kernel boots, and the kernel will simply render to the
+	  pre-allocated frame buffer surface.
+
+	  Configuration re: surface address, size, and format must be provided
+	  through device tree, or potentially plain old platform data in the
+	  future.
+
 source "drivers/video/omap/Kconfig"
 source "drivers/video/omap2/Kconfig"
 source "drivers/video/exynos/Kconfig"
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 9df3873..c8facd4 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -165,6 +165,7 @@ obj-$(CONFIG_FB_MX3)		  += mx3fb.o
 obj-$(CONFIG_FB_DA8XX)		  += da8xx-fb.o
 obj-$(CONFIG_FB_MXS)		  += mxsfb.o
 obj-$(CONFIG_FB_SSD1307)	  += ssd1307fb.o
+obj-$(CONFIG_FB_DUMB)             += dumbfb.o
 
 # the test framebuffer is last
 obj-$(CONFIG_FB_VIRTUAL)          += vfb.o
diff --git a/drivers/video/dumbfb.c b/drivers/video/dumbfb.c
new file mode 100644
index 0000000..96afffb
--- /dev/null
+++ b/drivers/video/dumbfb.c
@@ -0,0 +1,234 @@
+/*
+ * Simplest possible dumb frame-buffer driver, as a platform device
+ *
+ * Copyright (c) 2013, Stephen Warren
+ *
+ * Based on q40fb.c, which was:
+ * Copyright (C) 2001 Richard Zidlicky <rz@linux-m68k.org>
+ *
+ * Also based on offb.c, which was:
+ * Copyright (C) 1997 Geert Uytterhoeven
+ * Copyright (C) 1996 Paul Mackerras
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms and conditions of the GNU General Public License,
+ * version 2, as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <linux/errno.h>
+#include <linux/fb.h>
+#include <linux/io.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+
+static struct fb_fix_screeninfo dumbfb_fix = {
+	.id		= "dumb",
+	.type		= FB_TYPE_PACKED_PIXELS,
+	.visual		= FB_VISUAL_TRUECOLOR,
+	.accel		= FB_ACCEL_NONE,
+};
+
+static struct fb_var_screeninfo dumbfb_var = {
+	.height		= -1,
+	.width		= -1,
+	.activate	= FB_ACTIVATE_NOW,
+	.vmode		= FB_VMODE_NONINTERLACED,
+};
+
+static int dumbfb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
+			    u_int transp, struct fb_info *info)
+{
+	u32 *pal = info->pseudo_palette;
+	u32 cr = red >> (16 - info->var.red.length);
+	u32 cg = green >> (16 - info->var.green.length);
+	u32 cb = blue >> (16 - info->var.blue.length);
+	u32 value;
+
+	if (regno >= 16)
+		return -EINVAL;
+
+	value = (cr << info->var.red.offset) |
+		(cg << info->var.green.offset) |
+		(cb << info->var.blue.offset);
+	if (info->var.transp.length > 0) {
+		u32 mask = (1 << info->var.transp.length) - 1;
+		mask <<= info->var.transp.offset;
+		value |= mask;
+	}
+	pal[regno] = value;
+
+	return 0;
+}
+
+static struct fb_ops dumbfb_ops = {
+	.owner		= THIS_MODULE,
+	.fb_setcolreg	= dumbfb_setcolreg,
+	.fb_fillrect	= cfb_fillrect,
+	.fb_copyarea	= cfb_copyarea,
+	.fb_imageblit	= cfb_imageblit,
+};
+
+struct dumbfb_format {
+	const char *name;
+	u32 bits_per_pixel;
+	struct fb_bitfield red;
+	struct fb_bitfield green;
+	struct fb_bitfield blue;
+	struct fb_bitfield transp;
+};
+
+struct dumbfb_format dumbfb_formats[] = {
+	{ "r5g6b5", 16, {11, 5}, {5, 6}, {0, 5}, {0, 0} },
+};
+
+struct dumbfb_params {
+	u32 width;
+	u32 height;
+	u32 stride;
+	struct dumbfb_format *format;
+};
+
+static int dumbfb_parse_dt(struct platform_device *pdev,
+			   struct dumbfb_params *params)
+{
+	struct device_node *np = pdev->dev.of_node;
+	int ret;
+	const char *format;
+	int i;
+
+	ret = of_property_read_u32(np, "width", &params->width);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse width property\n");
+		return ret;
+	}
+
+	ret = of_property_read_u32(np, "height", &params->height);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse height property\n");
+		return ret;
+	}
+
+	ret = of_property_read_u32(np, "stride", &params->stride);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse stride property\n");
+		return ret;
+	}
+
+	ret = of_property_read_string(np, "format", &format);
+	if (ret) {
+		dev_err(&pdev->dev, "Can't parse format property\n");
+		return ret;
+	}
+	params->format = NULL;
+	for (i = 0; i < ARRAY_SIZE(dumbfb_formats); i++) {
+		if (strcmp(format, dumbfb_formats[i].name))
+			continue;
+		params->format = &dumbfb_formats[i];
+		break;
+	}
+	if (!params->format) {
+		dev_err(&pdev->dev, "Invalid format value\n");
+		return -EINVAL;
+	}
+
+	return 0;
+}
+
+static int dumbfb_probe(struct platform_device *pdev)
+{
+	int ret;
+	struct dumbfb_params params;
+	struct fb_info *info;
+	struct resource *mem;
+
+	if (fb_get_options("dumbfb", NULL))
+		return -ENODEV;
+
+	ret = dumbfb_parse_dt(pdev, &params);
+	if (ret)
+		return ret;
+
+	mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+	if (!mem) {
+		dev_err(&pdev->dev, "No memory resource\n");
+		return -EINVAL;
+	}
+
+	info = framebuffer_alloc(sizeof(u32) * 16, &pdev->dev);
+	if (!info)
+		return -ENOMEM;
+	platform_set_drvdata(pdev, info);
+
+	info->fix = dumbfb_fix;
+	info->fix.smem_start = mem->start;
+	info->fix.smem_len = resource_size(mem);
+	info->fix.line_length = params.stride;
+
+	info->var = dumbfb_var;
+	info->var.xres = params.width;
+	info->var.yres = params.height;
+	info->var.xres_virtual = params.width;
+	info->var.yres_virtual = params.height;
+	info->var.bits_per_pixel = params.format->bits_per_pixel;
+	info->var.red = params.format->red;
+	info->var.green = params.format->green;
+	info->var.blue = params.format->blue;
+	info->var.transp = params.format->transp;
+
+	info->fbops = &dumbfb_ops;
+	info->flags = FBINFO_DEFAULT;
+	info->screen_base = devm_ioremap(&pdev->dev, info->fix.smem_start,
+					 info->fix.smem_len);
+	if (!info->screen_base) {
+		framebuffer_release(info);
+		return -ENODEV;
+	}
+	info->pseudo_palette = (void *)(info + 1);
+
+	ret = register_framebuffer(info);
+	if (ret < 0) {
+		dev_err(&pdev->dev, "Unable to register dumbfb: %d\n", ret);
+		framebuffer_release(info);
+		return ret;
+	}
+
+	dev_info(&pdev->dev, "fb%d: dumbfb registered!\n", info->node);
+
+	return 0;
+}
+
+static int dumbfb_remove(struct platform_device *pdev)
+{
+	struct fb_info *info = platform_get_drvdata(pdev);
+
+	unregister_framebuffer(info);
+	framebuffer_release(info);
+
+	return 0;
+}
+
+static const struct of_device_id dumbfb_of_match[] = {
+	{ .compatible = "dumb-framebuffer", },
+	{ },
+};
+MODULE_DEVICE_TABLE(of, dumbfb_of_match);
+
+static struct platform_driver dumbfb_driver = {
+	.driver = {
+		.name = "dumb-framebuffer",
+		.owner = THIS_MODULE,
+		.of_match_table = dumbfb_of_match,
+	},
+	.probe = dumbfb_probe,
+	.remove = dumbfb_remove,
+};
+module_platform_driver(dumbfb_driver);
+
+MODULE_AUTHOR("Stephen Warren <swarren@wwwdotorg.org>");
+MODULE_DESCRIPTION("Dumb framebuffer driver");
+MODULE_LICENSE("GPL v2");
-- 
1.7.10.4


^ permalink raw reply related

* Re: [PATCH 1/1] OMAPDSS: DSI: Use devm_clk_get()
From: Tomi Valkeinen @ 2013-04-03  5:53 UTC (permalink / raw)
  To: Sachin Kamat; +Cc: linux-omap, linux-fbdev, FlorianSchandinat, akpm
In-Reply-To: <1364902403-9980-1-git-send-email-sachin.kamat@linaro.org>

[-- Attachment #1: Type: text/plain, Size: 375 bytes --]

On 2013-04-02 14:33, Sachin Kamat wrote:
> Using devm_clk_get cleans up some code.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> Compile tested on linux-next tree (20130402).
> ---
>  drivers/video/omap2/dss/dsi.c |   19 ++-----------------
>  1 file changed, 2 insertions(+), 17 deletions(-)

Thanks, applied to omapdss patches.

 Tomi



[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 899 bytes --]

^ permalink raw reply

* Re: [PATCHv3 0/6] fb: vt8500: patches for 3.10
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-04-03  4:33 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

On 07:20 Wed 03 Apr     , Tony Prisk wrote:
Acked-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
on the whole serie

Best Regards,
J.
> V3 Changes:
> Tidied up patch 1 as requested by Jean-Christophe - Makes the patch much
> simpler.
> 
> V2 Changes:
> Split the SoC and board portions of the binding into their respective files.
> Removed the forced non-interlaced code from wm8505fb.c and vt8500lcdfb.c
> 
> Julia Lawall (1):
>   drivers/video/wm8505fb.c: use devm_ functions
> 
> Tony Prisk (5):
>   video: vt8500: Make wmt_ge_rops optional
>   video: vt8500: Remove unused platform_data/video-vt8500lcdfb.h
>   video: vt8500: Correct descriptions in video/Kconfig
>   video: vt8500: Adjust contrast in wm8505 framebuffer driver.
>   video: fb: vt8500: Convert framebuffer drivers to standardized
>     binding
> 
>  .../devicetree/bindings/video/via,vt8500-fb.txt    |   48 ++-----
>  .../devicetree/bindings/video/wm,wm8505-fb.txt     |   32 +++--
>  arch/arm/boot/dts/vt8500-bv07.dts                  |   34 ++---
>  arch/arm/boot/dts/vt8500.dtsi                      |    4 +-
>  arch/arm/boot/dts/wm8505-ref.dts                   |   34 ++---
>  arch/arm/boot/dts/wm8505.dtsi                      |    4 +-
>  arch/arm/boot/dts/wm8650-mid.dts                   |   36 +++--
>  arch/arm/boot/dts/wm8650.dtsi                      |    4 +-
>  arch/arm/boot/dts/wm8850-w70v2.dts                 |   40 +++---
>  arch/arm/boot/dts/wm8850.dtsi                      |    4 +-
>  drivers/video/Kconfig                              |   37 +++--
>  drivers/video/vt8500lcdfb.c                        |   55 +++-----
>  drivers/video/wm8505fb.c                           |  144 ++++++--------------
>  drivers/video/wmt_ge_rops.h                        |   23 ++++
>  include/linux/platform_data/video-vt8500lcdfb.h    |   31 -----
>  15 files changed, 211 insertions(+), 319 deletions(-)
>  delete mode 100644 include/linux/platform_data/video-vt8500lcdfb.h
> 
> -- 
> 1.7.9.5
> 

^ permalink raw reply

* Re: [PATCH v2 1/2] video: Add a helper for enabling a panel via GPIO from dt
From: Marek Vasut @ 2013-04-03  2:26 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1364953516-7664-1-git-send-email-festevam@gmail.com>

Dear Fabio Estevam,

> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Introduce a helper that can be used to retrieve the GPIO via devicetree
> that is used to turn on a display.
> 
> Tested on a mx28evk board.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Looks ok,

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply

* Re: [PATCH v2 2/2] video: mxsfb: Use of_get_display_gpio_enable()
From: Marek Vasut @ 2013-04-03  2:26 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1364953516-7664-2-git-send-email-festevam@gmail.com>

Dear Fabio Estevam,

> From: Fabio Estevam <fabio.estevam@freescale.com>
> 
> Use of_get_display_gpio_enable() helper to retrieve the GPIO from
> devicetree that turns on the display.
> 
> This lets the code smaller and cleaner.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>

Looks ok,

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

^ permalink raw reply

* [PATCH v2 2/2] video: mxsfb: Use of_get_display_gpio_enable()
From: Fabio Estevam @ 2013-04-03  1:45 UTC (permalink / raw)
  To: linux-fbdev

From: Fabio Estevam <fabio.estevam@freescale.com>

Use of_get_display_gpio_enable() helper to retrieve the GPIO from devicetree 
that turns on the display.

This lets the code smaller and cleaner.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- No changes
 drivers/video/Kconfig |    1 +
 drivers/video/mxsfb.c |   21 ++++-----------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7607f42..810f990 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2445,6 +2445,7 @@ config FB_MXS
 	select FB_CFB_IMAGEBLIT
 	select FB_MODE_HELPERS
 	select OF_VIDEOMODE
+	select OF_DISPLAY_ENABLE_GPIO
 	help
 	  Framebuffer support for the MXS SoC.
 
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index eac7c1a..50b041a9 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -51,6 +51,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/fb.h>
 #include <video/videomode.h>
+#include <video/of_display_gpio.h>
 
 #define REG_SET	4
 #define REG_CLR	8
@@ -859,8 +860,6 @@ static int mxsfb_probe(struct platform_device *pdev)
 	struct fb_info *fb_info;
 	struct fb_modelist *modelist;
 	struct pinctrl *pinctrl;
-	int panel_enable;
-	enum of_gpio_flags flags;
 	int ret;
 
 	if (of_id)
@@ -904,21 +903,9 @@ static int mxsfb_probe(struct platform_device *pdev)
 		goto fb_release;
 	}
 
-	panel_enable = of_get_named_gpio_flags(pdev->dev.of_node,
-					       "panel-enable-gpios", 0, &flags);
-	if (gpio_is_valid(panel_enable)) {
-		unsigned long f = GPIOF_OUT_INIT_HIGH;
-		if (flags = OF_GPIO_ACTIVE_LOW)
-			f = GPIOF_OUT_INIT_LOW;
-		ret = devm_gpio_request_one(&pdev->dev, panel_enable,
-					    f, "panel-enable");
-		if (ret) {
-			dev_err(&pdev->dev,
-				"failed to request gpio %d: %d\n",
-				panel_enable, ret);
-			goto fb_release;
-		}
-	}
+	ret = of_get_display_gpio_enable(pdev);
+	if (ret)
+		goto fb_release;
 
 	fb_info->pseudo_palette = devm_kzalloc(&pdev->dev, sizeof(u32) * 16,
 					       GFP_KERNEL);
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH v2 1/2] video: Add a helper for enabling a panel via GPIO from dt
From: Fabio Estevam @ 2013-04-03  1:45 UTC (permalink / raw)
  To: linux-fbdev

From: Fabio Estevam <fabio.estevam@freescale.com>

Introduce a helper that can be used to retrieve the GPIO via devicetree that is 
used to turn on a display.

Tested on a mx28evk board.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
Changes since v1:
- Fix return value

 drivers/video/Kconfig                  |    6 +++++
 drivers/video/Makefile                 |    1 +
 drivers/video/of_display_enable_gpio.c |   43 ++++++++++++++++++++++++++++++++
 include/video/of_display_gpio.h        |   17 +++++++++++++
 4 files changed, 67 insertions(+)
 create mode 100644 drivers/video/of_display_enable_gpio.c
 create mode 100644 include/video/of_display_gpio.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0181a87..7607f42 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -52,6 +52,12 @@ config OF_VIDEOMODE
 	help
 	  helper to get videomodes from the devicetree
 
+config OF_DISPLAY_ENABLE_GPIO
+	bool "Support for enabling a panel via GPIO from the devicetree"
+	depends on OF
+	help
+	  helper to turning on a panel via gpio from the devicetree
+
 config HDMI
 	bool
 
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 97f7b6d..4d3ec70 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -176,3 +176,4 @@ obj-$(CONFIG_DISPLAY_TIMING) += display_timing.o
 obj-$(CONFIG_OF_DISPLAY_TIMING) += of_display_timing.o
 obj-$(CONFIG_VIDEOMODE) += videomode.o
 obj-$(CONFIG_OF_VIDEOMODE) += of_videomode.o
+obj-$(CONFIG_OF_DISPLAY_ENABLE_GPIO) += of_display_enable_gpio.o
diff --git a/drivers/video/of_display_enable_gpio.c b/drivers/video/of_display_enable_gpio.c
new file mode 100644
index 0000000..d556854
--- /dev/null
+++ b/drivers/video/of_display_enable_gpio.c
@@ -0,0 +1,43 @@
+/*
+ * generic helper for enabling a panel via GPIO from the devicetree
+ *
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/export.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+
+int of_get_display_gpio_enable(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	int panel_enable, ret;
+	enum of_gpio_flags flags;
+
+	panel_enable = of_get_named_gpio_flags(np, "panel-enable-gpios", 0,
+					       &flags);
+
+	if (gpio_is_valid(panel_enable)) {
+		unsigned long f = GPIOF_OUT_INIT_HIGH;
+		if (flags = OF_GPIO_ACTIVE_LOW)
+			f = GPIOF_OUT_INIT_LOW;
+		ret = devm_gpio_request_one(&pdev->dev, panel_enable, f,
+					    "panel-enable");
+		if (ret) {
+			dev_err(&pdev->dev, "failed to request gpio %d: %d\n",
+				panel_enable, ret);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_get_display_gpio_enable);
diff --git a/include/video/of_display_gpio.h b/include/video/of_display_gpio.h
new file mode 100644
index 0000000..a56b6a1
--- /dev/null
+++ b/include/video/of_display_gpio.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __LINUX_OF_DISPLAY_GPIO_H
+#define __LINUX_OF_DISPLAY_GPIO_H
+
+int of_get_display_gpio_enable(struct platform_device *pdev);
+
+#endif
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/2] video: mxsfb: Use of_get_display_gpio_enable()
From: Fabio Estevam @ 2013-04-03  1:30 UTC (permalink / raw)
  To: linux-fbdev

From: Fabio Estevam <fabio.estevam@freescale.com>

Use of_get_display_gpio_enable() helper to retrieve the GPIO from devicetree 
that turns on the display.

This lets the code smaller and cleaner.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/video/Kconfig |    1 +
 drivers/video/mxsfb.c |   21 ++++-----------------
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 7607f42..810f990 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -2445,6 +2445,7 @@ config FB_MXS
 	select FB_CFB_IMAGEBLIT
 	select FB_MODE_HELPERS
 	select OF_VIDEOMODE
+	select OF_DISPLAY_ENABLE_GPIO
 	help
 	  Framebuffer support for the MXS SoC.
 
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index eac7c1a..50b041a9 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -51,6 +51,7 @@
 #include <linux/pinctrl/consumer.h>
 #include <linux/fb.h>
 #include <video/videomode.h>
+#include <video/of_display_gpio.h>
 
 #define REG_SET	4
 #define REG_CLR	8
@@ -859,8 +860,6 @@ static int mxsfb_probe(struct platform_device *pdev)
 	struct fb_info *fb_info;
 	struct fb_modelist *modelist;
 	struct pinctrl *pinctrl;
-	int panel_enable;
-	enum of_gpio_flags flags;
 	int ret;
 
 	if (of_id)
@@ -904,21 +903,9 @@ static int mxsfb_probe(struct platform_device *pdev)
 		goto fb_release;
 	}
 
-	panel_enable = of_get_named_gpio_flags(pdev->dev.of_node,
-					       "panel-enable-gpios", 0, &flags);
-	if (gpio_is_valid(panel_enable)) {
-		unsigned long f = GPIOF_OUT_INIT_HIGH;
-		if (flags = OF_GPIO_ACTIVE_LOW)
-			f = GPIOF_OUT_INIT_LOW;
-		ret = devm_gpio_request_one(&pdev->dev, panel_enable,
-					    f, "panel-enable");
-		if (ret) {
-			dev_err(&pdev->dev,
-				"failed to request gpio %d: %d\n",
-				panel_enable, ret);
-			goto fb_release;
-		}
-	}
+	ret = of_get_display_gpio_enable(pdev);
+	if (ret)
+		goto fb_release;
 
 	fb_info->pseudo_palette = devm_kzalloc(&pdev->dev, sizeof(u32) * 16,
 					       GFP_KERNEL);
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 1/2] video: Add a helper for enabling a panel via GPIO from dt
From: Fabio Estevam @ 2013-04-03  1:30 UTC (permalink / raw)
  To: linux-fbdev

From: Fabio Estevam <fabio.estevam@freescale.com>

Introduce a helper that can be used to retrieve the GPIO via devicetree that is 
used to turn on a display.

Tested on a mx28evk board.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/video/Kconfig                  |    6 +++++
 drivers/video/Makefile                 |    1 +
 drivers/video/of_display_enable_gpio.c |   43 ++++++++++++++++++++++++++++++++
 include/video/of_display_gpio.h        |   17 +++++++++++++
 4 files changed, 67 insertions(+)
 create mode 100644 drivers/video/of_display_enable_gpio.c
 create mode 100644 include/video/of_display_gpio.h

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 0181a87..7607f42 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -52,6 +52,12 @@ config OF_VIDEOMODE
 	help
 	  helper to get videomodes from the devicetree
 
+config OF_DISPLAY_ENABLE_GPIO
+	bool "Support for enabling a panel via GPIO from the devicetree"
+	depends on OF
+	help
+	  helper to turning on a panel via gpio from the devicetree
+
 config HDMI
 	bool
 
diff --git a/drivers/video/Makefile b/drivers/video/Makefile
index 97f7b6d..4d3ec70 100644
--- a/drivers/video/Makefile
+++ b/drivers/video/Makefile
@@ -176,3 +176,4 @@ obj-$(CONFIG_DISPLAY_TIMING) += display_timing.o
 obj-$(CONFIG_OF_DISPLAY_TIMING) += of_display_timing.o
 obj-$(CONFIG_VIDEOMODE) += videomode.o
 obj-$(CONFIG_OF_VIDEOMODE) += of_videomode.o
+obj-$(CONFIG_OF_DISPLAY_ENABLE_GPIO) += of_display_enable_gpio.o
diff --git a/drivers/video/of_display_enable_gpio.c b/drivers/video/of_display_enable_gpio.c
new file mode 100644
index 0000000..d556854
--- /dev/null
+++ b/drivers/video/of_display_enable_gpio.c
@@ -0,0 +1,43 @@
+/*
+ * generic helper for enabling a panel via GPIO from the devicetree
+ *
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#include <linux/export.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_gpio.h>
+
+int of_get_display_gpio_enable(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+	int panel_enable, ret;
+	enum of_gpio_flags flags;
+
+	panel_enable = of_get_named_gpio_flags(np, "panel-enable-gpios", 0,
+					       &flags);
+
+	if (gpio_is_valid(panel_enable)) {
+		unsigned long f = GPIOF_OUT_INIT_HIGH;
+		if (flags = OF_GPIO_ACTIVE_LOW)
+			f = GPIOF_OUT_INIT_LOW;
+		ret = devm_gpio_request_one(&pdev->dev, panel_enable, f,
+					    "panel-enable");
+		if (ret) {
+			dev_err(&pdev->dev, "failed to request gpio %d: %d\n",
+				panel_enable, ret);
+			return -EINVAL;
+		}
+	}
+
+	return 0;
+}
+EXPORT_SYMBOL_GPL(of_get_display_gpio_enable);
diff --git a/include/video/of_display_gpio.h b/include/video/of_display_gpio.h
new file mode 100644
index 0000000..a56b6a1
--- /dev/null
+++ b/include/video/of_display_gpio.h
@@ -0,0 +1,17 @@
+/*
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * The code contained herein is licensed under the GNU General Public
+ * License. You may obtain a copy of the GNU General Public License
+ * Version 2 or later at the following locations:
+ *
+ * http://www.opensource.org/licenses/gpl-license.html
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+
+#ifndef __LINUX_OF_DISPLAY_GPIO_H
+#define __LINUX_OF_DISPLAY_GPIO_H
+
+int of_get_display_gpio_enable(struct platform_device *pdev);
+
+#endif
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 6/6] video: fb: vt8500: Convert framebuffer drivers to standardized binding
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

Now that a display timing binding is available, convert our almost identical
binding to use the standard binding.

This patch converts the vt8500 and wm8505 framebuffer drivers and
associated dts/dtsi files to use the standard binding as defined in
bindings/video/display-timing.txt.

There are two side-effects of making this conversion:

1) The fb node should now be in the board file, rather than the soc file as
the display-timing node is a child of the fb node.

2) We still require a bits per pixel property to initialize the framebuffer
for the different lcd panels. Rather than including this as part of the
display timing, it is moved into the framebuffer node.

I have also taken the opportunity to alphabetise the includes of each
driver to avoid double-ups.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
---
 .../devicetree/bindings/video/via,vt8500-fb.txt    |   48 ++++----------
 .../devicetree/bindings/video/wm,wm8505-fb.txt     |   32 ++++++----
 arch/arm/boot/dts/vt8500-bv07.dts                  |   34 +++++-----
 arch/arm/boot/dts/vt8500.dtsi                      |    4 +-
 arch/arm/boot/dts/wm8505-ref.dts                   |   34 +++++-----
 arch/arm/boot/dts/wm8505.dtsi                      |    4 +-
 arch/arm/boot/dts/wm8650-mid.dts                   |   36 +++++------
 arch/arm/boot/dts/wm8650.dtsi                      |    4 +-
 arch/arm/boot/dts/wm8850-w70v2.dts                 |   40 ++++++------
 arch/arm/boot/dts/wm8850.dtsi                      |    4 +-
 drivers/video/Kconfig                              |    6 ++
 drivers/video/vt8500lcdfb.c                        |   53 ++++++----------
 drivers/video/wm8505fb.c                           |   67 ++++++++------------
 13 files changed, 154 insertions(+), 212 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/via,vt8500-fb.txt b/Documentation/devicetree/bindings/video/via,vt8500-fb.txt
index c870b64..2871e21 100644
--- a/Documentation/devicetree/bindings/video/via,vt8500-fb.txt
+++ b/Documentation/devicetree/bindings/video/via,vt8500-fb.txt
@@ -5,58 +5,32 @@ Required properties:
 - compatible : "via,vt8500-fb"
 - reg : Should contain 1 register ranges(address and length)
 - interrupts : framebuffer controller interrupt
-- display: a phandle pointing to the display node
+- bits-per-pixel : bit depth of framebuffer (16 or 32)
 
-Required nodes:
-- display: a display node is required to initialize the lcd panel
-	This should be in the board dts.
-- default-mode: a videomode within the display with timing parameters
-	as specified below.
+Required subnodes:
+- display-timings: see display-timing.txt for information
 
 Example:
 
-	fb@d800e400 {
+	fb@d8050800 {
 		compatible = "via,vt8500-fb";
 		reg = <0xd800e400 0x400>;
 		interrupts = <12>;
-		display = <&display>;
-		default-mode = <&mode0>;
-	};
-
-VIA VT8500 Display
------------------------------------------------------
-Required properties (as per of_videomode_helper):
-
- - hactive, vactive: Display resolution
- - hfront-porch, hback-porch, hsync-len: Horizontal Display timing parameters
-   in pixels
-   vfront-porch, vback-porch, vsync-len: Vertical display timing parameters in
-   lines
- - clock: displayclock in Hz
- - bpp: lcd panel bit-depth.
-	<16> for RGB565, <32> for RGB888
-
-Optional properties (as per of_videomode_helper):
- - width-mm, height-mm: Display dimensions in mm
- - hsync-active-high (bool): Hsync pulse is active high
- - vsync-active-high (bool): Vsync pulse is active high
- - interlaced (bool): This is an interlaced mode
- - doublescan (bool): This is a doublescan mode
+		bits-per-pixel = <16>;
 
-Example:
-	display: display@0 {
-		modes {
-			mode0: mode@0 {
+		display-timings {
+			native-mode = <&timing0>;
+			timing0: 800x480 {
+				clock-frequency = <0>; /* unused but required */
 				hactive = <800>;
 				vactive = <480>;
-				hback-porch = <88>;
 				hfront-porch = <40>;
+				hback-porch = <88>;
 				hsync-len = <0>;
 				vback-porch = <32>;
 				vfront-porch = <11>;
 				vsync-len = <1>;
-				clock = <0>;	/* unused but required */
-				bpp = <16>;	/* non-standard but required */
 			};
 		};
 	};
+
diff --git a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
index 3d325e1..0bcadb2 100644
--- a/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
+++ b/Documentation/devicetree/bindings/video/wm,wm8505-fb.txt
@@ -4,20 +4,30 @@ Wondermedia WM8505 Framebuffer
 Required properties:
 - compatible : "wm,wm8505-fb"
 - reg : Should contain 1 register ranges(address and length)
-- via,display: a phandle pointing to the display node
+- bits-per-pixel : bit depth of framebuffer (16 or 32)
 
-Required nodes:
-- display: a display node is required to initialize the lcd panel
-	This should be in the board dts. See definition in
-	Documentation/devicetree/bindings/video/via,vt8500-fb.txt
-- default-mode: a videomode node as specified in
-	Documentation/devicetree/bindings/video/via,vt8500-fb.txt
+Required subnodes:
+- display-timings: see display-timing.txt for information
 
 Example:
 
-	fb@d8050800 {
+	fb@d8051700 {
 		compatible = "wm,wm8505-fb";
-		reg = <0xd8050800 0x200>;
-		display = <&display>;
-		default-mode = <&mode0>;
+		reg = <0xd8051700 0x200>;
+		bits-per-pixel = <16>;
+
+		display-timings {
+			native-mode = <&timing0>;
+			timing0: 800x480 {
+				clock-frequency = <0>; /* unused but required */
+				hactive = <800>;
+				vactive = <480>;
+				hfront-porch = <40>;
+				hback-porch = <88>;
+				hsync-len = <0>;
+				vback-porch = <32>;
+				vfront-porch = <11>;
+				vsync-len = <1>;
+			};
+		};
 	};
diff --git a/arch/arm/boot/dts/vt8500-bv07.dts b/arch/arm/boot/dts/vt8500-bv07.dts
index 567cf4e..877b33a 100644
--- a/arch/arm/boot/dts/vt8500-bv07.dts
+++ b/arch/arm/boot/dts/vt8500-bv07.dts
@@ -11,26 +11,22 @@
 
 / {
 	model = "Benign BV07 Netbook";
+};
 
-	/*
-	 * Display node is based on Sascha Hauer's patch on dri-devel.
-	 * Added a bpp property to calculate the size of the framebuffer
-	 * until the binding is formalized.
-	 */
-	display: display@0 {
-		modes {
-			mode0: mode@0 {
-				hactive = <800>;
-				vactive = <480>;
-				hback-porch = <88>;
-				hfront-porch = <40>;
-				hsync-len = <0>;
-				vback-porch = <32>;
-				vfront-porch = <11>;
-				vsync-len = <1>;
-				clock = <0>;	/* unused but required */
-				bpp = <16>;	/* non-standard but required */
-			};
+&fb {
+	bits-per-pixel = <16>;
+	display-timings {
+		native-mode = <&timing0>;
+		timing0: 800x480 {
+			clock-frequency = <0>; /* unused but required */
+			hactive = <800>;
+			vactive = <480>;
+			hfront-porch = <40>;
+			hback-porch = <88>;
+			hsync-len = <0>;
+			vback-porch = <32>;
+			vfront-porch = <11>;
+			vsync-len = <1>;
 		};
 	};
 };
diff --git a/arch/arm/boot/dts/vt8500.dtsi b/arch/arm/boot/dts/vt8500.dtsi
index cf31ced..68c8dc6 100644
--- a/arch/arm/boot/dts/vt8500.dtsi
+++ b/arch/arm/boot/dts/vt8500.dtsi
@@ -98,12 +98,10 @@
 			interrupts = <43>;
 		};
 
-		fb@d800e400 {
+		fb: fb@d8050800 {
 			compatible = "via,vt8500-fb";
 			reg = <0xd800e400 0x400>;
 			interrupts = <12>;
-			display = <&display>;
-			default-mode = <&mode0>;
 		};
 
 		ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8505-ref.dts b/arch/arm/boot/dts/wm8505-ref.dts
index fd4e248..edd2cec 100644
--- a/arch/arm/boot/dts/wm8505-ref.dts
+++ b/arch/arm/boot/dts/wm8505-ref.dts
@@ -11,26 +11,22 @@
 
 / {
 	model = "Wondermedia WM8505 Netbook";
+};
 
-	/*
-	 * Display node is based on Sascha Hauer's patch on dri-devel.
-	 * Added a bpp property to calculate the size of the framebuffer
-	 * until the binding is formalized.
-	 */
-	display: display@0 {
-		modes {
-			mode0: mode@0 {
-				hactive = <800>;
-				vactive = <480>;
-				hback-porch = <88>;
-				hfront-porch = <40>;
-				hsync-len = <0>;
-				vback-porch = <32>;
-				vfront-porch = <11>;
-				vsync-len = <1>;
-				clock = <0>;	/* unused but required */
-				bpp = <32>;	/* non-standard but required */
-			};
+&fb {
+	bits-per-pixel = <32>;
+	display-timings {
+		native-mode = <&timing0>;
+		timing0: 800x480 {
+			clock-frequency = <0>; /* unused but required */
+			hactive = <800>;
+			vactive = <480>;
+			hfront-porch = <40>;
+			hback-porch = <88>;
+			hsync-len = <0>;
+			vback-porch = <32>;
+			vfront-porch = <11>;
+			vsync-len = <1>;
 		};
 	};
 };
diff --git a/arch/arm/boot/dts/wm8505.dtsi b/arch/arm/boot/dts/wm8505.dtsi
index e74a1c0..bcf668d 100644
--- a/arch/arm/boot/dts/wm8505.dtsi
+++ b/arch/arm/boot/dts/wm8505.dtsi
@@ -128,11 +128,9 @@
 			interrupts = <0>;
 		};
 
-		fb@d8050800 {
+		fb: fb@d8050800 {
 			compatible = "wm,wm8505-fb";
 			reg = <0xd8050800 0x200>;
-			display = <&display>;
-			default-mode = <&mode0>;
 		};
 
 		ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8650-mid.dts b/arch/arm/boot/dts/wm8650-mid.dts
index cefd938..61671a0 100644
--- a/arch/arm/boot/dts/wm8650-mid.dts
+++ b/arch/arm/boot/dts/wm8650-mid.dts
@@ -11,26 +11,24 @@
 
 / {
 	model = "Wondermedia WM8650-MID Tablet";
+};
+
+&fb {
+	bits-per-pixel = <16>;
 
-	/*
-	 * Display node is based on Sascha Hauer's patch on dri-devel.
-	 * Added a bpp property to calculate the size of the framebuffer
-	 * until the binding is formalized.
-	 */
-	display: display@0 {
-		modes {
-			mode0: mode@0 {
-				hactive = <800>;
-				vactive = <480>;
-				hback-porch = <88>;
-				hfront-porch = <40>;
-				hsync-len = <0>;
-				vback-porch = <32>;
-				vfront-porch = <11>;
-				vsync-len = <1>;
-				clock = <0>;	/* unused but required */
-				bpp = <16>;	/* non-standard but required */
-			};
+	display-timings {
+		native-mode = <&timing0>;
+		timing0: 800x480 {
+			clock-frequency = <0>; /* unused but required */
+			hactive = <800>;
+			vactive = <480>;
+			hfront-porch = <40>;
+			hback-porch = <88>;
+			hsync-len = <0>;
+			vback-porch = <32>;
+			vfront-porch = <11>;
+			vsync-len = <1>;
 		};
 	};
 };
+
diff --git a/arch/arm/boot/dts/wm8650.dtsi b/arch/arm/boot/dts/wm8650.dtsi
index db3c0a1..9313407 100644
--- a/arch/arm/boot/dts/wm8650.dtsi
+++ b/arch/arm/boot/dts/wm8650.dtsi
@@ -128,11 +128,9 @@
 			interrupts = <43>;
 		};
 
-		fb@d8050800 {
+		fb: fb@d8050800 {
 			compatible = "wm,wm8505-fb";
 			reg = <0xd8050800 0x200>;
-			display = <&display>;
-			default-mode = <&mode0>;
 		};
 
 		ge_rops@d8050400 {
diff --git a/arch/arm/boot/dts/wm8850-w70v2.dts b/arch/arm/boot/dts/wm8850-w70v2.dts
index fcc660c..32d2253 100644
--- a/arch/arm/boot/dts/wm8850-w70v2.dts
+++ b/arch/arm/boot/dts/wm8850-w70v2.dts
@@ -15,28 +15,6 @@
 / {
 	model = "Wondermedia WM8850-W70v2 Tablet";
 
-	/*
-	 * Display node is based on Sascha Hauer's patch on dri-devel.
-	 * Added a bpp property to calculate the size of the framebuffer
-	 * until the binding is formalized.
-	 */
-	display: display@0 {
-		modes {
-			mode0: mode@0 {
-				hactive = <800>;
-				vactive = <480>;
-				hback-porch = <88>;
-				hfront-porch = <40>;
-				hsync-len = <0>;
-				vback-porch = <32>;
-				vfront-porch = <11>;
-				vsync-len = <1>;
-				clock = <0>;	/* unused but required */
-				bpp = <16>;	/* non-standard but required */
-			};
-		};
-	};
-
 	backlight {
 		compatible = "pwm-backlight";
 		pwms = <&pwm 0 50000 1>;	/* duty inverted */
@@ -45,3 +23,21 @@
 		default-brightness-level = <5>;
 	};
 };
+
+&fb {
+	bits-per-pixel = <16>;
+	display-timings {
+		native-mode = <&timing0>;
+		timing0: 800x480 {
+			clock-frequency = <0>; /* unused but required */
+			hactive = <800>;
+			vactive = <480>;
+			hfront-porch = <40>;
+			hback-porch = <88>;
+			hsync-len = <0>;
+			vback-porch = <32>;
+			vfront-porch = <11>;
+			vsync-len = <1>;
+		};
+	};
+};
diff --git a/arch/arm/boot/dts/wm8850.dtsi b/arch/arm/boot/dts/wm8850.dtsi
index e8cbfdc..7149cd1 100644
--- a/arch/arm/boot/dts/wm8850.dtsi
+++ b/arch/arm/boot/dts/wm8850.dtsi
@@ -135,11 +135,9 @@
 			};
 		};
 
-		fb@d8051700 {
+		fb: fb@d8051700 {
 			compatible = "wm,wm8505-fb";
 			reg = <0xd8051700 0x200>;
-			display = <&display>;
-			default-mode = <&mode0>;
 		};
 
 		ge_rops@d8050400 {
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index ad762ed..d0c932a 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1794,6 +1794,9 @@ config FB_VT8500
 	select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS)
 	select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS)
 	select FB_SYS_IMAGEBLIT
+	select FB_MODE_HELPERS
+	select OF_DISPLAY_TIMING
+	select OF_VIDEOMODE
 	help
 	  This is the framebuffer driver for VIA VT8500 integrated LCD
 	  controller.
@@ -1804,6 +1807,9 @@ config FB_WM8505
 	select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS)
 	select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS)
 	select FB_SYS_IMAGEBLIT
+	select FB_MODE_HELPERS
+	select OF_DISPLAY_TIMING
+	select OF_VIDEOMODE
 	help
 	  This is the framebuffer driver for WonderMedia WM8xxx-series
 	  integrated LCD controller. This driver covers the WM8505, WM8650
diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index 2ff2312..9547e18 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -15,20 +15,21 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
+#include <linux/errno.h>
 #include <linux/fb.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <linux/dma-mapping.h>
+#include <linux/kernel.h>
+#include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/wait.h>
+#include <video/of_display_timing.h>
 
 #include "vt8500lcdfb.h"
 #include "wmt_ge_rops.h"
@@ -275,11 +276,11 @@ static int vt8500lcd_probe(struct platform_device *pdev)
 {
 	struct vt8500lcd_info *fbi;
 	struct resource *res;
+	struct display_timings *disp_timing;
 	void *addr;
 	int irq, ret;
 
 	struct fb_videomode	of_mode;
-	struct device_node	*np;
 	u32			bpp;
 	dma_addr_t fb_mem_phys;
 	unsigned long fb_mem_len;
@@ -344,32 +345,18 @@ static int vt8500lcd_probe(struct platform_device *pdev)
 		goto failed_free_res;
 	}
 
-	np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0);
-	if (!np) {
-		pr_err("%s: No display description in Device Tree\n", __func__);
-		ret = -EINVAL;
-		goto failed_free_res;
-	}
+	disp_timing = of_get_display_timings(pdev->dev.of_node);
+	if (!disp_timing)
+		return -EINVAL;
 
-	/*
-	 * This code is copied from Sascha Hauer's of_videomode helper
-	 * and can be replaced with a call to the helper once mainlined
-	 */
-	ret = 0;
-	ret |= of_property_read_u32(np, "hactive", &of_mode.xres);
-	ret |= of_property_read_u32(np, "vactive", &of_mode.yres);
-	ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin);
-	ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin);
-	ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len);
-	ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin);
-	ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin);
-	ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len);
-	ret |= of_property_read_u32(np, "bpp", &bpp);
-	if (ret) {
-		pr_err("%s: Unable to read display properties\n", __func__);
-		goto failed_free_res;
-	}
-	of_mode.vmode = FB_VMODE_NONINTERLACED;
+	ret = of_get_fb_videomode(pdev->dev.of_node, &of_mode,
+							OF_USE_NATIVE_MODE);
+	if (ret)
+		return ret;
+
+	ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp);
+	if (ret)
+		return ret;
 
 	/* try allocating the framebuffer */
 	fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8);
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index e3be1e3..19e2e7f 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -14,23 +14,24 @@
  * GNU General Public License for more details.
  */
 
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/dma-mapping.h>
 #include <linux/fb.h>
+#include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <linux/dma-mapping.h>
-#include <linux/platform_device.h>
-#include <linux/wait.h>
+#include <linux/kernel.h>
+#include <linux/memblock.h>
+#include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_fdt.h>
-#include <linux/memblock.h>
+#include <linux/platform_device.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+#include <linux/wait.h>
+#include <video/of_display_timing.h>
 
 #include "wm8505fb_regs.h"
 #include "wmt_ge_rops.h"
@@ -261,12 +262,12 @@ static struct fb_ops wm8505fb_ops = {
 static int wm8505fb_probe(struct platform_device *pdev)
 {
 	struct wm8505fb_info	*fbi;
-	struct resource		*res;
+	struct resource	*res;
+	struct display_timings *disp_timing;
 	void			*addr;
 	int ret;
 
-	struct fb_videomode	of_mode;
-	struct device_node	*np;
+	struct fb_videomode	mode;
 	u32			bpp;
 	dma_addr_t fb_mem_phys;
 	unsigned long fb_mem_len;
@@ -306,33 +307,19 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	if (fbi->regbase = NULL)
 		return -EBUSY;
 
-	np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0);
-	if (!np) {
-		pr_err("%s: No display description in Device Tree\n", __func__);
+	disp_timing = of_get_display_timings(pdev->dev.of_node);
+	if (!disp_timing)
 		return -EINVAL;
-	}
 
-	/*
-	 * This code is copied from Sascha Hauer's of_videomode helper
-	 * and can be replaced with a call to the helper once mainlined
-	 */
-	ret = 0;
-	ret |= of_property_read_u32(np, "hactive", &of_mode.xres);
-	ret |= of_property_read_u32(np, "vactive", &of_mode.yres);
-	ret |= of_property_read_u32(np, "hback-porch", &of_mode.left_margin);
-	ret |= of_property_read_u32(np, "hfront-porch", &of_mode.right_margin);
-	ret |= of_property_read_u32(np, "hsync-len", &of_mode.hsync_len);
-	ret |= of_property_read_u32(np, "vback-porch", &of_mode.upper_margin);
-	ret |= of_property_read_u32(np, "vfront-porch", &of_mode.lower_margin);
-	ret |= of_property_read_u32(np, "vsync-len", &of_mode.vsync_len);
-	ret |= of_property_read_u32(np, "bpp", &bpp);
-	if (ret) {
-		pr_err("%s: Unable to read display properties\n", __func__);
-		return -EINVAL;
-	}
+	ret = of_get_fb_videomode(pdev->dev.of_node, &mode, OF_USE_NATIVE_MODE);
+	if (ret)
+		return ret;
+
+	ret = of_property_read_u32(pdev->dev.of_node, "bits-per-pixel", &bpp);
+	if (ret)
+		return ret;
 
-	of_mode.vmode = FB_VMODE_NONINTERLACED;
-	fb_videomode_to_var(&fbi->fb.var, &of_mode);
+	fb_videomode_to_var(&fbi->fb.var, &mode);
 
 	fbi->fb.var.nonstd		= 0;
 	fbi->fb.var.activate		= FB_ACTIVATE_NOW;
@@ -341,7 +328,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	fbi->fb.var.width		= -1;
 
 	/* try allocating the framebuffer */
-	fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8);
+	fb_mem_len = mode.xres * mode.yres * 2 * (bpp / 8);
 	fb_mem_virt = dmam_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys,
 				GFP_KERNEL);
 	if (!fb_mem_virt) {
@@ -349,8 +336,8 @@ static int wm8505fb_probe(struct platform_device *pdev)
 		return -ENOMEM;
 	}
 
-	fbi->fb.var.xres_virtual	= of_mode.xres;
-	fbi->fb.var.yres_virtual	= of_mode.yres * 2;
+	fbi->fb.var.xres_virtual	= mode.xres;
+	fbi->fb.var.yres_virtual	= mode.yres * 2;
 	fbi->fb.var.bits_per_pixel	= bpp;
 
 	fbi->fb.fix.smem_start		= fb_mem_phys;
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 5/6] video: vt8500: Adjust contrast in wm8505 framebuffer driver.
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

The contrast value was typo'd on the original commit (0x80 instead of
0x08). Following feedback from an enduser, a value of 0x10 seems more
suitable due to the default backlight being <100%.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
Reviewed-by: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 drivers/video/wm8505fb.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index 020df1d..e3be1e3 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -358,7 +358,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	fbi->fb.screen_base		= fb_mem_virt;
 	fbi->fb.screen_size		= fb_mem_len;
 
-	fbi->contrast = 0x80;
+	fbi->contrast = 0x10;
 	ret = wm8505fb_set_par(&fbi->fb);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to set parameters\n");
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 4/6] drivers/video/wm8505fb.c: use devm_ functions
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

From: Julia Lawall <Julia.Lawall@lip6.fr>

The various devm_ functions allocate memory that is released when a driver
detaches.  This patch uses these functions for data that is allocated in
the probe function of a platform device and is only freed in the remove
function.

The patch makes some other cleanups.  First, the original code used
devm_kzalloc, but kfree.  This would lead to a double free.  The problem
was found using the following semantic match (http://coccinelle.lip6.fr/):

// <smpl>
@@
expression x,e;
@@
x = devm_kzalloc(...)
... when != x = e
?-kfree(x,...);
// </smpl>

The error-handing code of devm_request_and_ioremap does not print any
warning message, because devm_request_and_ioremap does this.

The call to dma_alloc_coherent is converted to its devm equivalent,
dmam_alloc_coherent.  This implicitly introduces a call to
dmam_free_coherent, which was completly missing in the original code.

A semicolon is removed at the end of the error-handling code for the call
to dma_alloc_coherent.

The block of code calling fb_alloc_cmap is moved below the block of code
calling wm8505fb_set_par, so that the error-handing code of the call to
wm8505fb_set_par can just return ret.  This way there is only one block of
error-handling code that needs to call fb_dealloc_cmap, and so this is
moved up to the place where it is needed, eliminating the need for all
gotos and labels in the function.  This was suggested by Tony Prisk.

The initializations of fbi and ret at the beginning of the function are not
necessary and are removed.  The call platform_set_drvdata(pdev, NULL); at
the end of the function is also removed.

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
---
 drivers/video/wm8505fb.c |   79 +++++++++++-----------------------------------
 1 file changed, 19 insertions(+), 60 deletions(-)

diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index fe9afd6..020df1d 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -272,15 +272,11 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	unsigned long fb_mem_len;
 	void *fb_mem_virt;
 
-	ret = -ENOMEM;
-	fbi = NULL;
-
 	fbi = devm_kzalloc(&pdev->dev, sizeof(struct wm8505fb_info) +
 			sizeof(u32) * 16, GFP_KERNEL);
 	if (!fbi) {
 		dev_err(&pdev->dev, "Failed to initialize framebuffer device\n");
-		ret = -ENOMEM;
-		goto failed;
+		return -ENOMEM;
 	}
 
 	strcpy(fbi->fb.fix.id, DRIVER_NAME);
@@ -306,31 +302,14 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	fbi->fb.pseudo_palette	= addr;
 
 	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	if (res = NULL) {
-		dev_err(&pdev->dev, "no I/O memory resource defined\n");
-		ret = -ENODEV;
-		goto failed_fbi;
-	}
-
-	res = request_mem_region(res->start, resource_size(res), DRIVER_NAME);
-	if (res = NULL) {
-		dev_err(&pdev->dev, "failed to request I/O memory\n");
-		ret = -EBUSY;
-		goto failed_fbi;
-	}
-
-	fbi->regbase = ioremap(res->start, resource_size(res));
-	if (fbi->regbase = NULL) {
-		dev_err(&pdev->dev, "failed to map I/O memory\n");
-		ret = -EBUSY;
-		goto failed_free_res;
-	}
+	fbi->regbase = devm_request_and_ioremap(&pdev->dev, res);
+	if (fbi->regbase = NULL)
+		return -EBUSY;
 
 	np = of_parse_phandle(pdev->dev.of_node, "default-mode", 0);
 	if (!np) {
 		pr_err("%s: No display description in Device Tree\n", __func__);
-		ret = -EINVAL;
-		goto failed_free_res;
+		return -EINVAL;
 	}
 
 	/*
@@ -349,7 +328,7 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	ret |= of_property_read_u32(np, "bpp", &bpp);
 	if (ret) {
 		pr_err("%s: Unable to read display properties\n", __func__);
-		goto failed_free_res;
+		return -EINVAL;
 	}
 
 	of_mode.vmode = FB_VMODE_NONINTERLACED;
@@ -363,12 +342,12 @@ static int wm8505fb_probe(struct platform_device *pdev)
 
 	/* try allocating the framebuffer */
 	fb_mem_len = of_mode.xres * of_mode.yres * 2 * (bpp / 8);
-	fb_mem_virt = dma_alloc_coherent(&pdev->dev, fb_mem_len, &fb_mem_phys,
+	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__);
 		return -ENOMEM;
-	};
+	}
 
 	fbi->fb.var.xres_virtual	= of_mode.xres;
 	fbi->fb.var.yres_virtual	= of_mode.yres * 2;
@@ -379,28 +358,29 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	fbi->fb.screen_base		= fb_mem_virt;
 	fbi->fb.screen_size		= fb_mem_len;
 
-	if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) {
-		dev_err(&pdev->dev, "Failed to allocate color map\n");
-		ret = -ENOMEM;
-		goto failed_free_io;
-	}
-
-	wm8505fb_init_hw(&fbi->fb);
-
 	fbi->contrast = 0x80;
 	ret = wm8505fb_set_par(&fbi->fb);
 	if (ret) {
 		dev_err(&pdev->dev, "Failed to set parameters\n");
-		goto failed_free_cmap;
+		return ret;
 	}
 
+	if (fb_alloc_cmap(&fbi->fb.cmap, 256, 0) < 0) {
+		dev_err(&pdev->dev, "Failed to allocate color map\n");
+		return -ENOMEM;
+	}
+
+	wm8505fb_init_hw(&fbi->fb);
+
 	platform_set_drvdata(pdev, fbi);
 
 	ret = register_framebuffer(&fbi->fb);
 	if (ret < 0) {
 		dev_err(&pdev->dev,
 			"Failed to register framebuffer device: %d\n", ret);
-		goto failed_free_cmap;
+		if (fbi->fb.cmap.len)
+			fb_dealloc_cmap(&fbi->fb.cmap);
+		return ret;
 	}
 
 	ret = device_create_file(&pdev->dev, &dev_attr_contrast);
@@ -414,25 +394,11 @@ static int wm8505fb_probe(struct platform_device *pdev)
 	       fbi->fb.fix.smem_start + fbi->fb.fix.smem_len - 1);
 
 	return 0;
-
-failed_free_cmap:
-	if (fbi->fb.cmap.len)
-		fb_dealloc_cmap(&fbi->fb.cmap);
-failed_free_io:
-	iounmap(fbi->regbase);
-failed_free_res:
-	release_mem_region(res->start, resource_size(res));
-failed_fbi:
-	platform_set_drvdata(pdev, NULL);
-	kfree(fbi);
-failed:
-	return ret;
 }
 
 static int wm8505fb_remove(struct platform_device *pdev)
 {
 	struct wm8505fb_info *fbi = platform_get_drvdata(pdev);
-	struct resource *res;
 
 	device_remove_file(&pdev->dev, &dev_attr_contrast);
 
@@ -443,13 +409,6 @@ static int wm8505fb_remove(struct platform_device *pdev)
 	if (fbi->fb.cmap.len)
 		fb_dealloc_cmap(&fbi->fb.cmap);
 
-	iounmap(fbi->regbase);
-
-	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-	release_mem_region(res->start, resource_size(res));
-
-	kfree(fbi);
-
 	return 0;
 }
 
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 3/6] video: vt8500: Correct descriptions in video/Kconfig
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

This patch corrects the descriptions for the VIA VT8500 and
Wondermedia WM8xxx-series framebuffer drivers to correctly reflect
which hardware they support.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
Reviewed-by: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 drivers/video/Kconfig |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 661aa54..ad762ed 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -1789,7 +1789,7 @@ config FB_AU1200
 	  option au1200fb:panel=<name>.
 
 config FB_VT8500
-	bool "VT8500 LCD Driver"
+	bool "VIA VT8500 framebuffer support"
 	depends on (FB = y) && ARM && ARCH_VT8500
 	select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS)
 	select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS)
@@ -1799,17 +1799,18 @@ config FB_VT8500
 	  controller.
 
 config FB_WM8505
-	bool "WM8505 frame buffer support"
+	bool "Wondermedia WM8xxx-series frame buffer support"
 	depends on (FB = y) && ARM && ARCH_VT8500
 	select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS)
 	select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS)
 	select FB_SYS_IMAGEBLIT
 	help
-	  This is the framebuffer driver for WonderMedia WM8505/WM8650
-	  integrated LCD controller.
+	  This is the framebuffer driver for WonderMedia WM8xxx-series
+	  integrated LCD controller. This driver covers the WM8505, WM8650
+	  and WM8850 SoCs.
 
 config FB_WMT_GE_ROPS
-	bool "VT8500/WM85xx accelerated raster ops support"
+	bool "VT8500/WM8xxx accelerated raster ops support"
 	depends on (FB = y) && (FB_VT8500 || FB_WM8505)
 	default n
 	help
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 2/6] video: vt8500: Remove unused platform_data/video-vt8500lcdfb.h
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

With the conversion to devicetree only for arch-vt8500, this
header is no longer required. This patch removes the #include
from the two framebuffer drivers that used it, and the header file.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
Reviewed-by: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 drivers/video/vt8500lcdfb.c                     |    2 --
 drivers/video/wm8505fb.c                        |    2 --
 include/linux/platform_data/video-vt8500lcdfb.h |   31 -----------------------
 3 files changed, 35 deletions(-)
 delete mode 100644 include/linux/platform_data/video-vt8500lcdfb.h

diff --git a/drivers/video/vt8500lcdfb.c b/drivers/video/vt8500lcdfb.c
index aa2579c..2ff2312 100644
--- a/drivers/video/vt8500lcdfb.c
+++ b/drivers/video/vt8500lcdfb.c
@@ -30,8 +30,6 @@
 #include <linux/platform_device.h>
 #include <linux/wait.h>
 
-#include <linux/platform_data/video-vt8500lcdfb.h>
-
 #include "vt8500lcdfb.h"
 #include "wmt_ge_rops.h"
 
diff --git a/drivers/video/wm8505fb.c b/drivers/video/wm8505fb.c
index 4dd0580..fe9afd6 100644
--- a/drivers/video/wm8505fb.c
+++ b/drivers/video/wm8505fb.c
@@ -32,8 +32,6 @@
 #include <linux/of_fdt.h>
 #include <linux/memblock.h>
 
-#include <linux/platform_data/video-vt8500lcdfb.h>
-
 #include "wm8505fb_regs.h"
 #include "wmt_ge_rops.h"
 
diff --git a/include/linux/platform_data/video-vt8500lcdfb.h b/include/linux/platform_data/video-vt8500lcdfb.h
deleted file mode 100644
index 7f399c3..0000000
--- a/include/linux/platform_data/video-vt8500lcdfb.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  VT8500/WM8505 Frame Buffer platform data definitions
- *
- *  Copyright (C) 2010 Ed Spiridonov <edo.rus@gmail.com>
- *
- * This software is licensed under the terms of the GNU General Public
- * License version 2, as published by the Free Software Foundation, and
- * may be copied, distributed, and modified under those terms.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- */
-
-#ifndef _VT8500FB_H
-#define _VT8500FB_H
-
-#include <linux/fb.h>
-
-struct vt8500fb_platform_data {
-	struct fb_videomode	mode;
-	u32			xres_virtual;
-	u32			yres_virtual;
-	u32			bpp;
-	unsigned long		video_mem_phys;
-	void			*video_mem_virt;
-	unsigned long		video_mem_len;
-};
-
-#endif /* _VT8500FB_H */
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 1/6] video: vt8500: Make wmt_ge_rops optional
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1364926838-6721-1-git-send-email-linux@prisktech.co.nz>

wmt_ge_rops is a seperate driver to vt8500/wm8505 framebuffer
driver but is currently a required option. This patch makes
accelerated raster ops optional.

Signed-off-by: Tony Prisk <linux@prisktech.co.nz>
Reviewed-by: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
---
 drivers/video/Kconfig       |   22 ++++++++++++----------
 drivers/video/wmt_ge_rops.h |   23 +++++++++++++++++++++++
 2 files changed, 35 insertions(+), 10 deletions(-)

diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4c1546f..661aa54 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -212,14 +212,6 @@ config FB_SYS_FOPS
        depends on FB
        default n
 
-config FB_WMT_GE_ROPS
-	tristate
-	depends on FB
-	default n
-	---help---
-	  Include functions for accelerated rectangle filling and area
-	  copying using WonderMedia Graphics Engine operations.
-
 config FB_DEFERRED_IO
 	bool
 	depends on FB
@@ -1799,7 +1791,8 @@ config FB_AU1200
 config FB_VT8500
 	bool "VT8500 LCD Driver"
 	depends on (FB = y) && ARM && ARCH_VT8500
-	select FB_WMT_GE_ROPS
+	select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS)
+	select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS)
 	select FB_SYS_IMAGEBLIT
 	help
 	  This is the framebuffer driver for VIA VT8500 integrated LCD
@@ -1808,12 +1801,21 @@ config FB_VT8500
 config FB_WM8505
 	bool "WM8505 frame buffer support"
 	depends on (FB = y) && ARM && ARCH_VT8500
-	select FB_WMT_GE_ROPS
+	select FB_SYS_FILLRECT if (!FB_WMT_GE_ROPS)
+	select FB_SYS_COPYAREA if (!FB_WMT_GE_ROPS)
 	select FB_SYS_IMAGEBLIT
 	help
 	  This is the framebuffer driver for WonderMedia WM8505/WM8650
 	  integrated LCD controller.
 
+config FB_WMT_GE_ROPS
+	bool "VT8500/WM85xx accelerated raster ops support"
+	depends on (FB = y) && (FB_VT8500 || FB_WM8505)
+	default n
+	help
+	  This adds support for accelerated raster operations on the
+	  VIA VT8500 and Wondermedia 85xx series SoCs.
+
 source "drivers/video/geode/Kconfig"
 
 config FB_HIT
diff --git a/drivers/video/wmt_ge_rops.h b/drivers/video/wmt_ge_rops.h
index 8738075..f73ec63 100644
--- a/drivers/video/wmt_ge_rops.h
+++ b/drivers/video/wmt_ge_rops.h
@@ -1,5 +1,28 @@
+#ifdef CONFIG_FB_WMT_GE_ROPS
+
 extern void wmt_ge_fillrect(struct fb_info *info,
 			    const struct fb_fillrect *rect);
 extern void wmt_ge_copyarea(struct fb_info *info,
 			    const struct fb_copyarea *area);
 extern int wmt_ge_sync(struct fb_info *info);
+
+#else
+
+static inline int wmt_ge_sync(struct fb_info *p)
+{
+	return 0;
+}
+
+static inline void wmt_ge_fillrect(struct fb_info *p,
+				    const struct fb_fillrect *rect)
+{
+	sys_fillrect(p, rect);
+}
+
+static inline void wmt_ge_copyarea(struct fb_info *p,
+				     const struct fb_copyarea *area)
+{
+	sys_copyarea(p, area);
+}
+
+#endif
-- 
1.7.9.5


^ permalink raw reply related

* [PATCHv3 0/6] fb: vt8500: patches for 3.10
From: Tony Prisk @ 2013-04-02 18:20 UTC (permalink / raw)
  To: linux-arm-kernel

V3 Changes:
Tidied up patch 1 as requested by Jean-Christophe - Makes the patch much
simpler.

V2 Changes:
Split the SoC and board portions of the binding into their respective files.
Removed the forced non-interlaced code from wm8505fb.c and vt8500lcdfb.c

Julia Lawall (1):
  drivers/video/wm8505fb.c: use devm_ functions

Tony Prisk (5):
  video: vt8500: Make wmt_ge_rops optional
  video: vt8500: Remove unused platform_data/video-vt8500lcdfb.h
  video: vt8500: Correct descriptions in video/Kconfig
  video: vt8500: Adjust contrast in wm8505 framebuffer driver.
  video: fb: vt8500: Convert framebuffer drivers to standardized
    binding

 .../devicetree/bindings/video/via,vt8500-fb.txt    |   48 ++-----
 .../devicetree/bindings/video/wm,wm8505-fb.txt     |   32 +++--
 arch/arm/boot/dts/vt8500-bv07.dts                  |   34 ++---
 arch/arm/boot/dts/vt8500.dtsi                      |    4 +-
 arch/arm/boot/dts/wm8505-ref.dts                   |   34 ++---
 arch/arm/boot/dts/wm8505.dtsi                      |    4 +-
 arch/arm/boot/dts/wm8650-mid.dts                   |   36 +++--
 arch/arm/boot/dts/wm8650.dtsi                      |    4 +-
 arch/arm/boot/dts/wm8850-w70v2.dts                 |   40 +++---
 arch/arm/boot/dts/wm8850.dtsi                      |    4 +-
 drivers/video/Kconfig                              |   37 +++--
 drivers/video/vt8500lcdfb.c                        |   55 +++-----
 drivers/video/wm8505fb.c                           |  144 ++++++--------------
 drivers/video/wmt_ge_rops.h                        |   23 ++++
 include/linux/platform_data/video-vt8500lcdfb.h    |   31 -----
 15 files changed, 211 insertions(+), 319 deletions(-)
 delete mode 100644 include/linux/platform_data/video-vt8500lcdfb.h

-- 
1.7.9.5


^ permalink raw reply

* Re: [PATCHv2 6/6] video: fb: vt8500: Convert framebuffer drivers to standardized binding
From: Tony Prisk @ 2013-04-02 18:18 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20130402115014.GL20693@game.jcrosoft.org>

On 03/04/13 00:50, Jean-Christophe PLAGNIOL-VILLARD wrote:
> On 14:41 Tue 02 Apr     , Alexey Charkov wrote:
>> 2013/4/2 Tomi Valkeinen <tomi.valkeinen@ti.com>:
>>> On 2013-04-02 07:50, Tony Prisk wrote:
>>>> Now that a display timing binding is available, convert our almost identical
>>>> binding to use the standard binding.
>>>>
>>>> This patch converts the vt8500 and wm8505 framebuffer drivers and
>>>> associated dts/dtsi files to use the standard binding as defined in
>>>> bindings/video/display-timing.txt.
>>>>
>>>> There are two side-effects of making this conversion:
>>>>
>>>> 1) The fb node should now be in the board file, rather than the soc file as
>>>> the display-timing node is a child of the fb node.
>>>>
>>>> 2) We still require a bits per pixel property to initialize the framebuffer
>>>> for the different lcd panels. Rather than including this as part of the
>>>> display timing, it is moved into the framebuffer node.
>>> This means that the boards using the current DT bindings won't work with
>>> a kernel with these patches, right? Is that ok?
>> There are no known products shipping any DT-enabled firmware with
>> these chips in the wild. The only way to run modern kernels on
>> VIA/WonderMedia chips so far is by using the "appended DTB"
>> workaround, and the instructions that have been posted to Wiki's and
>> mailing list discussions imply that a fresh DTB is compiled from
>> current kernel sources to produce a bootable image.
>>
>> Thus, it seems that this change should not really break anything
>> major, as the user base is quite small and those who use new code are
>> most likely to use new DTB as well.
> I usually disagree but ok
>
> Best Regards,
> J.
The original binding was only ever meant to be a stop-gap as it was 
required for us to make the conversion to multiplatform/devicetree, and
was only agreed upon because without it all the other code was pointless 
and arch-vt8500 was suffering from bitrot at the time. It was always the 
intention to update to the standardized binding once it was mainlined.I 
haven't been able to find the original thread where it was discussed, 
but it was around Aug 2012.

Regards
Tony P

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox