Linux Framebuffer Layer development
 help / color / mirror / Atom feed
* [PATCH 1/2] ARM: omapfb: add coherent dma memory support
From: Tomi Valkeinen @ 2013-12-30 13:19 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1388409550-10720-1-git-send-email-tomi.valkeinen@ti.com>

The omapfb driver uses dma_alloc to reserve memory for the framebuffers.
However, on some use cases, even when CMA is in use, it's quite probable
that omapfb fails to allocate the fb, either due to not enough free dma
memory, fragmented dma memory, or CMA failing to make enough contiguous
space.

This patch adds a kernel cmdline parameter 'omapfb_vram' which can be
used to give the size of a memory area reserved exclusively for omapfb,
and optionally a physical address where the memory area is reserved.

The memory area is reserved with memblock, and assigned to omapfb with
dma_declare_coherent_memory. The dma_alloc function will first try to
allocate the fb from the coherent memory area, and if that fails, it'll
use the normal method of allocation.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Cc: Ivaylo Dimitrov <freemangordon@abv.bg>
---
 arch/arm/mach-omap2/common.c |  1 +
 arch/arm/mach-omap2/common.h |  2 ++
 arch/arm/mach-omap2/fb.c     | 77 +++++++++++++++++++++++++++++++++++++++++++-
 3 files changed, 79 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/common.c b/arch/arm/mach-omap2/common.c
index 2dabb9ecb986..9beecded0380 100644
--- a/arch/arm/mach-omap2/common.c
+++ b/arch/arm/mach-omap2/common.c
@@ -33,4 +33,5 @@ void __init omap_reserve(void)
 	omap_dsp_reserve_sdram_memblock();
 	omap_secure_ram_reserve_memblock();
 	omap_barrier_reserve_memblock();
+	omap_fb_reserve_memblock();
 }
diff --git a/arch/arm/mach-omap2/common.h b/arch/arm/mach-omap2/common.h
index e30ef6797c63..21afdc0fe15e 100644
--- a/arch/arm/mach-omap2/common.h
+++ b/arch/arm/mach-omap2/common.h
@@ -304,6 +304,8 @@ extern void omap_reserve(void);
 struct omap_hwmod;
 extern int omap_dss_reset(struct omap_hwmod *);
 
+extern void omap_fb_reserve_memblock(void);
+
 /* SoC specific clock initializer */
 extern int (*omap_clk_init)(void);
 
diff --git a/arch/arm/mach-omap2/fb.c b/arch/arm/mach-omap2/fb.c
index 26e28e94f625..80630329e508 100644
--- a/arch/arm/mach-omap2/fb.c
+++ b/arch/arm/mach-omap2/fb.c
@@ -30,9 +30,11 @@
 #include <linux/dma-mapping.h>
 
 #include <asm/mach/map.h>
+#include <asm/memblock.h>
 
 #include "soc.h"
 #include "display.h"
+#include "common.h"
 
 #ifdef CONFIG_OMAP2_VRFB
 
@@ -106,10 +108,83 @@ static struct platform_device omap_fb_device = {
 	.num_resources = 0,
 };
 
+static phys_addr_t omapfb_mem_base __initdata;
+static phys_addr_t omapfb_mem_size __initdata;
+
+static int __init early_omapfb_vram(char *p)
+{
+	omapfb_mem_size = memparse(p, &p);
+
+	if (!omapfb_mem_size) {
+		pr_err("omapfb: bad size for 'omapfb_vram' param\n");
+		return 0;
+	}
+
+	if (*p = '@') {
+		omapfb_mem_base = memparse(p + 1, NULL);
+
+		if (!omapfb_mem_base) {
+			pr_err("omapfb: bad addr for 'omapfb_vram' param\n");
+			omapfb_mem_size = 0;
+			return 0;
+		}
+	}
+
+	return 0;
+}
+early_param("omapfb_vram", early_omapfb_vram);
+
+void __init omap_fb_reserve_memblock(void)
+{
+	int r;
+
+	if (!omapfb_mem_size)
+		return;
+
+	if (omapfb_mem_base) {
+		r = memblock_reserve(omapfb_mem_base, omapfb_mem_size);
+
+		if (r) {
+			pr_err("omapfb: memblock_reserve failed: %d\n", r);
+			return;
+		}
+	} else {
+		omapfb_mem_base = memblock_alloc(omapfb_mem_size, SZ_1M);
+
+		if (!omapfb_mem_base) {
+			pr_err("omapfb: memblock_alloc failed\n");
+			return;
+		}
+	}
+
+	memblock_free(omapfb_mem_base, omapfb_mem_size);
+	memblock_remove(omapfb_mem_base, omapfb_mem_size);
+
+	pr_info("omapfb: reserved %pa bytes at %pa\n",
+			&omapfb_mem_size, &omapfb_mem_base);
+}
+
 int __init omap_init_fb(void)
 {
-	return platform_device_register(&omap_fb_device);
+	int r;
+
+	r = platform_device_register(&omap_fb_device);
+
+	if (r)
+		return r;
+
+	if (!omapfb_mem_base)
+		return 0;
+
+	r = dma_declare_coherent_memory(&omap_fb_device.dev,
+					  omapfb_mem_base, omapfb_mem_base,
+					  omapfb_mem_size, DMA_MEMORY_MAP);
+	if (!(r & DMA_MEMORY_MAP))
+		pr_err("omapfb: dma_declare_coherent_memory failed\n");
+
+	return 0;
 }
+
 #else
 int __init omap_init_fb(void) { return 0; }
 #endif
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH 0/2] omapfb: option to use coherent dma mem
From: Tomi Valkeinen @ 2013-12-30 13:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

This is a bit refined version from the patch sent by Ivaylo.

So Ivaylo asked for an exclusive memory area for omapfb, so that the
allocations would not fail, and Vaibhav asked for reserving the fb at a
specified physical address, so that the bootloader can pass the fb to the
kernel. Those are a bit linked issues, and these patches try to accomplish
both.

This series is somewhat experimental, as I'm not so familiar with the dma api,
but, well, this seemed to work for the tests I did.

 Tomi

Tomi Valkeinen (2):
  ARM: omapfb: add coherent dma memory support
  omapfb: add support to reserve fb at specified phys address

 arch/arm/mach-omap2/common.c             |  1 +
 arch/arm/mach-omap2/common.h             |  2 +
 arch/arm/mach-omap2/fb.c                 | 77 +++++++++++++++++++++++++++++++-
 drivers/video/omap2/omapfb/omapfb-main.c | 36 +++++++++++----
 drivers/video/omap2/omapfb/omapfb.h      |  1 +
 5 files changed, 107 insertions(+), 10 deletions(-)

-- 
1.8.3.2


^ permalink raw reply

* Re: [PATCH] fonts:Kconfig: fix default enable FONT_8x8 and FONT_8x16 at the same time
From: Geert Uytterhoeven @ 2013-12-30  8:51 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <20131230065303.GA6640@udknight>

On Mon, Dec 30, 2013 at 7:53 AM, Wang YanQing <udknight@gmail.com> wrote:
> FONT_8x8 and FONT_8x16 have the same default value line:
> "default y if !SPARC && !FONTS"
>
> I test run "make defconfig" for x86 will enable FONT_8x8 and FONT_8x16 at
> the same time.
>
> This patch fix it, because FONT_AUTOSELECT choice FONT_8x16, so
> I decide to disable FONT_8x8, this patch will reduce size of kernel.

... at the expense of losing FONT_8x8...

In another email, you wrote:
| Sorry for confusion, the default behavior enable FONT_8x8 and FONT_8x16,
| FONT_8x8 eat ~50KB memory, but kernel never use it. I think this is not
| good default behavior.

Whether FONT_8x8 or FONT_8x16 is used depends on your screen resolution,
cfr. lib/fonts/font.c:get_default_font().

If you don't want to compile in FONT_8x8, then please enable CONFIG_FONTS,
and disable CONFIG_FONT_8x8.

> Signed-off-by: Wang YanQing <udknight@gmail.com>
> ---
>  lib/fonts/Kconfig | 1 -
>  1 file changed, 1 deletion(-)
>
> diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig
> index 34fd931..11d3758 100644
> --- a/lib/fonts/Kconfig
> +++ b/lib/fonts/Kconfig
> @@ -23,7 +23,6 @@ config FONTS
>  config FONT_8x8
>         bool "VGA 8x8 font" if FONTS
>         depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
> -       default y if !SPARC && !FONTS
>         help
>           This is the "high resolution" font for the VGA frame buffer (the one
>           provided by the text console 80x50 (and higher) modes).
> --
> 1.8.3.4.8.g69490f3.dirty

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* [PATCH] fonts:Kconfig: fix default enable FONT_8x8 and FONT_8x16 at the same time
From: Wang YanQing @ 2013-12-30  6:53 UTC (permalink / raw)
  To: linux-fbdev

FONT_8x8 and FONT_8x16 have the same default value line:
"default y if !SPARC && !FONTS"

I test run "make defconfig" for x86 will enable FONT_8x8 and FONT_8x16 at
the same time.

This patch fix it, because FONT_AUTOSELECT choice FONT_8x16, so
I decide to disable FONT_8x8, this patch will reduce size of kernel.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 lib/fonts/Kconfig | 1 -
 1 file changed, 1 deletion(-)

diff --git a/lib/fonts/Kconfig b/lib/fonts/Kconfig
index 34fd931..11d3758 100644
--- a/lib/fonts/Kconfig
+++ b/lib/fonts/Kconfig
@@ -23,7 +23,6 @@ config FONTS
 config FONT_8x8
 	bool "VGA 8x8 font" if FONTS
 	depends on FRAMEBUFFER_CONSOLE || STI_CONSOLE
-	default y if !SPARC && !FONTS
 	help
 	  This is the "high resolution" font for the VGA frame buffer (the one
 	  provided by the text console 80x50 (and higher) modes).
-- 
1.8.3.4.8.g69490f3.dirty

^ permalink raw reply related

* [PATCH 4/4] video: pxa168fb: Cleanup pxa168fb.h file
From: Sachin Kamat @ 2013-12-30  6:34 UTC (permalink / raw)
  To: linux-fbdev

Remove incorrect file reference in comments section.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Cc: Eric Miao <eric.y.miao@gmail.com>
---
 include/video/pxa168fb.h |    2 --
 1 file changed, 2 deletions(-)

diff --git a/include/video/pxa168fb.h b/include/video/pxa168fb.h
index 8c2f385a90ea..84cbb1f69ea6 100644
--- a/include/video/pxa168fb.h
+++ b/include/video/pxa168fb.h
@@ -1,6 +1,4 @@
 /*
- * linux/arch/arm/mach-mmp/include/mach/pxa168fb.h
- *
  *  Copyright (C) 2009 Marvell International Ltd.
  *
  * This program is free software; you can redistribute it and/or modify
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 3/4] video: pxa: Cleanup video-pxafb.h header
From: Sachin Kamat @ 2013-12-30  6:34 UTC (permalink / raw)
  To: linux-fbdev

Commit 293b2da1b611 ("ARM: pxa: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 include/linux/platform_data/video-pxafb.h |    2 --
 1 file changed, 2 deletions(-)

diff --git a/include/linux/platform_data/video-pxafb.h b/include/linux/platform_data/video-pxafb.h
index 486b4c519ae2..07c6c1e153f8 100644
--- a/include/linux/platform_data/video-pxafb.h
+++ b/include/linux/platform_data/video-pxafb.h
@@ -1,6 +1,4 @@
 /*
- *  arch/arm/mach-pxa/include/mach/pxafb.h
- *
  *  Support for the xscale frame buffer.
  *
  *  Author:     Jean-Frederic Clere
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 2/4] video: msm: Cleanup video-msm_fb.h header
From: Sachin Kamat @ 2013-12-30  6:34 UTC (permalink / raw)
  To: linux-fbdev

Commit 1ef21f6343ff ("ARM: msm: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 include/linux/platform_data/video-msm_fb.h |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/include/linux/platform_data/video-msm_fb.h b/include/linux/platform_data/video-msm_fb.h
index 1f4fc81b3d8f..31449be3eadb 100644
--- a/include/linux/platform_data/video-msm_fb.h
+++ b/include/linux/platform_data/video-msm_fb.h
@@ -1,5 +1,4 @@
-/* arch/arm/mach-msm/include/mach/msm_fb.h
- *
+/*
  * Internal shared definitions for various MSM framebuffer parts.
  *
  * Copyright (C) 2007 Google Incorporated
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH 1/4] video: ep93xx: Cleanup video-ep93xx.h header
From: Sachin Kamat @ 2013-12-30  6:34 UTC (permalink / raw)
  To: linux-fbdev

Commit a3b2924547a7 ("ARM: ep93xx: move platform_data definitions")
moved the file to the current location but forgot to remove the pointer
to its previous location. Clean it up. While at it also change the header
file protection macros appropriately.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 include/linux/platform_data/video-ep93xx.h |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/include/linux/platform_data/video-ep93xx.h b/include/linux/platform_data/video-ep93xx.h
index d5ae11d7c453..92fc2b2232e7 100644
--- a/include/linux/platform_data/video-ep93xx.h
+++ b/include/linux/platform_data/video-ep93xx.h
@@ -1,9 +1,5 @@
-/*
- * arch/arm/mach-ep93xx/include/mach/fb.h
- */
-
-#ifndef __ASM_ARCH_EP93XXFB_H
-#define __ASM_ARCH_EP93XXFB_H
+#ifndef __VIDEO_EP93XX_H
+#define __VIDEO_EP93XX_H
 
 struct platform_device;
 struct fb_videomode;
@@ -53,4 +49,4 @@ struct ep93xxfb_mach_info {
 	void	(*blank)(int blank_mode, struct fb_info *info);
 };
 
-#endif /* __ASM_ARCH_EP93XXFB_H */
+#endif /* __VIDEO_EP93XX_H */
-- 
1.7.9.5


^ permalink raw reply related

* [PATCH] fbcon: trivial optimization for fbcon_exit
From: Wang YanQing @ 2013-12-27  2:39 UTC (permalink / raw)
  To: tomi.valkeinen
  Cc: plagnioj, airlied, gregkh, akpm, kamal, linux-fbdev, linux-kernel

Break out as soon as we find a mapped entry con2fb_map.

Signed-off-by: Wang YanQing <udknight@gmail.com>
---
 drivers/video/console/fbcon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index cd8a802..f39931f 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3547,8 +3547,10 @@ static void fbcon_exit(void)
 			"no"));
 
 		for (j = first_fb_vc; j <= last_fb_vc; j++) {
-			if (con2fb_map[j] = i)
+			if (con2fb_map[j] = i) {
 				mapped = 1;
+				break;
+			}
 		}
 
 		if (mapped) {
-- 
1.8.3.4.8.g69490f3.dirty

^ permalink raw reply related

* Re: [PATCH] drivers: video: Remove unused function genericbl_limit_intensity() in generic_bl.c
From: Jingoo Han @ 2013-12-27  2:21 UTC (permalink / raw)
  To: 'Rashika Kheria', 'Andrew Morton'
  Cc: 'Josh Triplett', linux-kernel,
	'Jean-Christophe Plagniol-Villard',
	'Tomi Valkeinen', linux-fbdev, 'Jingoo Han',
	'Eric Miao'
In-Reply-To: <20131216142423.GB24172@leaf>

On Monday, December 16, 2013 11:24 PM, Josh Triplett wrote:
> On Mon, Dec 16, 2013 at 04:51:10PM +0530, Rashika Kheria wrote:
> > Removes unused function genericbl_limit_intensity() in
> > backlight/generic_bl.c.
> >
> > This eliminates the following warning in backlight/generic_bl.c:
> > drivers/video/backlight/generic_bl.c:59:6: warning: no previous prototype for
> ‘genericbl_limit_intensity’ [-Wmissing-prototypes]
> >
> > Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> 
> Reviewed-by: Josh Triplett <josh@joshtriplett.org>

(+cc Andrew Morton, Eric Miao)

Acked-by: Jingoo Han <jg1.han@samsung.com>

Best regards,
Jingoo Han

> 
> >  drivers/video/backlight/generic_bl.c |   18 ------------------
> >  1 file changed, 18 deletions(-)
> >
> > diff --git a/drivers/video/backlight/generic_bl.c b/drivers/video/backlight/generic_bl.c
> > index 5d8d652..67dfb93 100644
> > --- a/drivers/video/backlight/generic_bl.c
> > +++ b/drivers/video/backlight/generic_bl.c
> > @@ -52,24 +52,6 @@ static int genericbl_get_intensity(struct backlight_device *bd)
> >  	return genericbl_intensity;
> >  }
> >
> > -/*
> > - * Called when the battery is low to limit the backlight intensity.
> > - * If limit=0 clear any limit, otherwise limit the intensity
> > - */
> > -void genericbl_limit_intensity(int limit)
> > -{
> > -	struct backlight_device *bd = generic_backlight_device;
> > -
> > -	mutex_lock(&bd->ops_lock);
> > -	if (limit)
> > -		bd->props.state |= GENERICBL_BATTLOW;
> > -	else
> > -		bd->props.state &= ~GENERICBL_BATTLOW;
> > -	backlight_update_status(generic_backlight_device);
> > -	mutex_unlock(&bd->ops_lock);
> > -}
> > -EXPORT_SYMBOL(genericbl_limit_intensity);
> > -
> >  static const struct backlight_ops genericbl_ops = {
> >  	.options = BL_CORE_SUSPENDRESUME,
> >  	.get_brightness = genericbl_get_intensity,
> > --
> > 1.7.9.5
> >


^ permalink raw reply

* [PATCH] fbcon: Fix memory leak in fbcon_exit().
From: Masami Ichikawa @ 2013-12-25 14:47 UTC (permalink / raw)
  To: plagnioj, tomi.valkeinen, linux-fbdev
  Cc: airlied, udknight, gregkh, akpm, tiwai, linux-kernel, masami256

kmemleak reported a memory leak as below.

unreferenced object 0xffff880036ca84c0 (size 16):
  comm "swapper/0", pid 1, jiffies 4294877407 (age 4434.633s)
  hex dump (first 16 bytes):
    00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff  ................
  backtrace:
    [<ffffffff814ed01e>] kmemleak_alloc+0x4e/0xb0
    [<ffffffff8118913c>] __kmalloc+0x1fc/0x290
    [<ffffffff81302c9e>] bit_cursor+0x24e/0x6c0
    [<ffffffff812ff2f4>] fbcon_cursor+0x154/0x1d0
    [<ffffffff813675d8>] hide_cursor+0x28/0xa0
    [<ffffffff81368acf>] update_region+0x6f/0x90
    [<ffffffff81300268>] fbcon_switch+0x518/0x550
    [<ffffffff813695b9>] redraw_screen+0x189/0x240
    [<ffffffff8136a0e0>] do_bind_con_driver+0x360/0x380
    [<ffffffff8136a6e4>] do_take_over_console+0x114/0x1c0
    [<ffffffff812fdc83>] do_fbcon_takeover+0x63/0xd0
    [<ffffffff813023e5>] fbcon_event_notify+0x605/0x720
    [<ffffffff81501dcc>] notifier_call_chain+0x4c/0x70
    [<ffffffff81087f8d>] __blocking_notifier_call_chain+0x4d/0x70
    [<ffffffff81087fc6>] blocking_notifier_call_chain+0x16/0x20
    [<ffffffff812f201b>] fb_notifier_call_chain+0x1b/0x20

In this case ops->cursor_state.mask is allocated in bit_cursor() but
not freed in fbcon_exit(). So, fbcon_exit() needs to free buffer in its
process.
In the case, fbcon_exit() was called from fbcon_deinit() when driver
called remove_conflicting_framebuffers().

Signed-off-by: Masami Ichikawa <masami256@gmail.com>
---
 drivers/video/console/fbcon.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/video/console/fbcon.c b/drivers/video/console/fbcon.c
index cd8a802..4f02375 100644
--- a/drivers/video/console/fbcon.c
+++ b/drivers/video/console/fbcon.c
@@ -3561,6 +3561,7 @@ static void fbcon_exit(void)
 
 				fbcon_del_cursor_timer(info);
 				kfree(ops->cursor_src);
+				kfree(ops->cursor_state.mask);
 				kfree(info->fbcon_par);
 				info->fbcon_par = NULL;
 			}
-- 
1.8.4.2


^ permalink raw reply related

* [PATCH] video/imxfb: add more range-checking for right and left margin values
From: Paul Fertser @ 2013-12-24  9:43 UTC (permalink / raw)
  To: linux-fbdev

A user not familiar with this LCD controller might assume it's
possible to use arbitrary short horizontal margins if the display
allows that. Make it clear it's not.

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 drivers/video/imxfb.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 44ee678..103e175 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -671,10 +671,10 @@ static int imxfb_activate_var(struct fb_var_screeninfo *var, struct fb_info *inf
 	if (var->hsync_len < 1    || var->hsync_len > 64)
 		printk(KERN_ERR "%s: invalid hsync_len %d\n",
 			info->fix.id, var->hsync_len);
-	if (var->left_margin > 255)
+	if (var->left_margin > 255 || var->left_margin < 3)
 		printk(KERN_ERR "%s: invalid left_margin %d\n",
 			info->fix.id, var->left_margin);
-	if (var->right_margin > 255)
+	if (var->right_margin > 255 || var->right_margin < 1)
 		printk(KERN_ERR "%s: invalid right_margin %d\n",
 			info->fix.id, var->right_margin);
 	if (var->yres < 1 || var->yres > ymax_mask)
-- 
1.7.3.4


^ permalink raw reply related

* Re: [PATCH] video: imxfb: Use regulator API with LCD class for powering
From: Shawn Guo @ 2013-12-23  8:28 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1387787053.605757144@f413.i.mail.ru>

On Mon, Dec 23, 2013 at 12:24:13PM +0400, Alexander Shiyan wrote:
> > On Sat, Dec 21, 2013 at 03:08:00PM +0400, Alexander Shiyan wrote:
> > > This patch replaces custom lcd_power() callback with
> > > regulator API over LCD class.
> > 
> > FYI.  Denis' effort on this already goes to v13.
> > 
> > http://thread.gmane.org/gmane.linux.ports.arm.kernel/285326
> 
> Hmm, OK, but having LCD class could resolve our problems with contrast control.
> https://www.mail-archive.com/devicetree@vger.kernel.org/msg07660.html

I just want to make sure you two are aware of each other's work.

Shawn


^ permalink raw reply

* Re: [PATCH] video: imxfb: Use regulator API w =?UTF-8?B?aXRoIExDRCBjbGFzc
From: Alexander Shiyan @ 2013-12-23  8:24 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20131223082107.GF26070@S2101-09.ap.freescale.net>

PiBPbiBTYXQsIERlYyAyMSwgMjAxMyBhdCAwMzowODowMFBNICswNDAwLCBBbGV4YW5kZXIgU2hp
eWFuIHdyb3RlOgo+ID4gVGhpcyBwYXRjaCByZXBsYWNlcyBjdXN0b20gbGNkX3Bvd2VyKCkgY2Fs
bGJhY2sgd2l0aAo+ID4gcmVndWxhdG9yIEFQSSBvdmVyIExDRCBjbGFzcy4KPiAKPiBGWUkuICBE
ZW5pcycgZWZmb3J0IG9uIHRoaXMgYWxyZWFkeSBnb2VzIHRvIHYxMy4KPiAKPiBodHRwOi8vdGhy
ZWFkLmdtYW5lLm9yZy9nbWFuZS5saW51eC5wb3J0cy5hcm0ua2VybmVsLzI4NTMyNgoKSG1tLCBP
SywgYnV0IGhhdmluZyBMQ0QgY2xhc3MgY291bGQgcmVzb2x2ZSBvdXIgcHJvYmxlbXMgd2l0aCBj
b250cmFzdCBjb250cm9sLgpodHRwczovL3d3dy5tYWlsLWFyY2hpdmUuY29tL2RldmljZXRyZWVA
dmdlci5rZXJuZWwub3JnL21zZzA3NjYwLmh0bWwKCi0tLQo

^ permalink raw reply

* Re: [PATCH] video: imxfb: Use regulator API with LCD class for powering
From: Shawn Guo @ 2013-12-23  8:21 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1387624080-15312-1-git-send-email-shc_work@mail.ru>

On Sat, Dec 21, 2013 at 03:08:00PM +0400, Alexander Shiyan wrote:
> This patch replaces custom lcd_power() callback with
> regulator API over LCD class.

FYI.  Denis' effort on this already goes to v13.

http://thread.gmane.org/gmane.linux.ports.arm.kernel/285326

Shawn

> 
> Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
> ---
>  .../devicetree/bindings/video/fsl,imx-fb.txt       |  1 +
>  arch/arm/mach-imx/mach-mx27ads.c                   | 55 +++++++++++++++--
>  drivers/video/imxfb.c                              | 71 +++++++++++++++++++---
>  include/linux/platform_data/video-imxfb.h          |  1 -
>  4 files changed, 114 insertions(+), 14 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> index 46da08d..e6b1ee9 100644
> --- a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> +++ b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
> @@ -15,6 +15,7 @@ Required nodes:
>  	- fsl,pcr: LCDC PCR value
>  
>  Optional properties:
> +- lcd-supply: Regulator for LCD supply voltage.
>  - fsl,dmacr: DMA Control Register value. This is optional. By default, the
>  	register is not modified as recommended by the datasheet.
>  - fsl,lscr1: LCDC Sharp Configuration Register value.
> diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
> index 9821b824..a7a4a9c 100644
> --- a/arch/arm/mach-imx/mach-mx27ads.c
> +++ b/arch/arm/mach-imx/mach-mx27ads.c
> @@ -21,6 +21,10 @@
>  #include <linux/mtd/physmap.h>
>  #include <linux/i2c.h>
>  #include <linux/irq.h>
> +
> +#include <linux/regulator/fixed.h>
> +#include <linux/regulator/machine.h>
> +
>  #include <asm/mach-types.h>
>  #include <asm/mach/arch.h>
>  #include <asm/mach/time.h>
> @@ -195,14 +199,58 @@ static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
>  static struct i2c_board_info mx27ads_i2c_devices[] = {
>  };
>  
> -void lcd_power(int on)
> +static void vgpio_set(struct gpio_chip *chip, unsigned offset, int value)
>  {
> -	if (on)
> +	if (value)
>  		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_SET_REG);
>  	else
>  		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG);
>  }
>  
> +static int vgpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
> +{
> +	return 0;
> +}
> +
> +#define MX27ADS_LCD_GPIO	(6 * 32)
> +
> +static struct regulator_consumer_supply mx27ads_lcd_regulator_consumer > +	REGULATOR_SUPPLY("lcd", "imx-fb.0");
> +
> +static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
> +	.constraints	= {
> +		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
> +},
> +	.consumer_supplies	= &mx27ads_lcd_regulator_consumer,
> +	.num_consumer_supplies	= 1,
> +};
> +
> +static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = {
> +	.supply_name	= "LCD",
> +	.microvolts	= 3300000,
> +	.gpio		= MX27ADS_LCD_GPIO,
> +	.init_data	= &mx27ads_lcd_regulator_init_data,
> +};
> +
> +static void __init mx27ads_regulator_init(void)
> +{
> +	struct gpio_chip *vchip;
> +
> +	vchip = kzalloc(sizeof(*vchip), GFP_KERNEL);
> +	vchip->owner		= THIS_MODULE;
> +	vchip->label		= "LCD";
> +	vchip->base		= MX27ADS_LCD_GPIO;
> +	vchip->ngpio		= 1;
> +	vchip->direction_output	= vgpio_dir_out;
> +	vchip->set		= vgpio_set;
> +	gpiochip_add(vchip);
> +
> +	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
> +				      PLATFORM_DEVID_AUTO,
> +				      &mx27ads_lcd_regulator_pdata,
> +				      sizeof(mx27ads_lcd_regulator_pdata));
> +}
> +
>  static struct imx_fb_videomode mx27ads_modes[] = {
>  	{
>  		.mode = {
> @@ -239,8 +287,6 @@ static const struct imx_fb_platform_data mx27ads_fb_data __initconst = {
>  	.pwmr		= 0x00A903FF,
>  	.lscr1		= 0x00120300,
>  	.dmacr		= 0x00020010,
> -
> -	.lcd_power	= lcd_power,
>  };
>  
>  static int mx27ads_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
> @@ -304,6 +350,7 @@ static void __init mx27ads_board_init(void)
>  	i2c_register_board_info(1, mx27ads_i2c_devices,
>  				ARRAY_SIZE(mx27ads_i2c_devices));
>  	imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
> +	mx27ads_regulator_init();
>  	imx27_add_imx_fb(&mx27ads_fb_data);
>  	imx27_add_mxc_mmc(0, &sdhc1_pdata);
>  	imx27_add_mxc_mmc(1, &sdhc2_pdata);
> diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
> index 44ee678..e50b67f 100644
> --- a/drivers/video/imxfb.c
> +++ b/drivers/video/imxfb.c
> @@ -30,10 +30,13 @@
>  #include <linux/platform_device.h>
>  #include <linux/dma-mapping.h>
>  #include <linux/io.h>
> +#include <linux/lcd.h>
>  #include <linux/math64.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
>  
> +#include <linux/regulator/consumer.h>
> +
>  #include <video/of_display_timing.h>
>  #include <video/of_videomode.h>
>  #include <video/videomode.h>
> @@ -177,8 +180,9 @@ struct imxfb_info {
>  	struct backlight_device *bl;
>  #endif
>  
> -	void (*lcd_power)(int);
>  	void (*backlight_power)(int);
> +
> +	struct regulator	*lcd_pwr;
>  };
>  
>  static struct platform_device_id imxfb_devtype[] = {
> @@ -591,8 +595,6 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
>  
>  	if (fbi->backlight_power)
>  		fbi->backlight_power(1);
> -	if (fbi->lcd_power)
> -		fbi->lcd_power(1);
>  }
>  
>  static void imxfb_disable_controller(struct imxfb_info *fbi)
> @@ -604,8 +606,6 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
>  
>  	if (fbi->backlight_power)
>  		fbi->backlight_power(0);
> -	if (fbi->lcd_power)
> -		fbi->lcd_power(0);
>  
>  	clk_disable_unprepare(fbi->clk_per);
>  	clk_disable_unprepare(fbi->clk_ipg);
> @@ -796,7 +796,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
>  		fbi->lscr1			= pdata->lscr1;
>  		fbi->dmacr			= pdata->dmacr;
>  		fbi->pwmr			= pdata->pwmr;
> -		fbi->lcd_power			= pdata->lcd_power;
>  		fbi->backlight_power		= pdata->backlight_power;
>  	} else {
>  		np = pdev->dev.of_node;
> @@ -810,9 +809,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
>  
>  		of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
>  
> -		/* These two function pointers could be used by some specific
> -		 * platforms. */
> -		fbi->lcd_power = NULL;
>  		fbi->backlight_power = NULL;
>  	}
>  
> @@ -856,9 +852,50 @@ static int imxfb_of_read_mode(struct device *dev, struct device_node *np,
>  	return 0;
>  }
>  
> +static int imxfb_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi)
> +{
> +	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
> +
> +	if (!fi || fi->par = fbi)
> +		return 1;
> +
> +	return 0;
> +}
> +
> +static int imxfb_lcd_get_power(struct lcd_device *lcddev)
> +{
> +	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
> +
> +	if (!IS_ERR(fbi->lcd_pwr))
> +		return regulator_is_enabled(fbi->lcd_pwr);
> +
> +	return 1;
> +}
> +
> +static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
> +{
> +	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
> +
> +	if (!IS_ERR(fbi->lcd_pwr)) {
> +		if (power)
> +			return regulator_enable(fbi->lcd_pwr);
> +		else
> +			return regulator_disable(fbi->lcd_pwr);
> +	}
> +
> +	return 0;
> +}
> +
> +static struct lcd_ops imxfb_lcd_ops = {
> +	.check_fb	= imxfb_lcd_check_fb,
> +	.get_power	= imxfb_lcd_get_power,
> +	.set_power	= imxfb_lcd_set_power,
> +};
> +
>  static int imxfb_probe(struct platform_device *pdev)
>  {
>  	struct imxfb_info *fbi;
> +	struct lcd_device *lcd;
>  	struct fb_info *info;
>  	struct imx_fb_platform_data *pdata;
>  	struct resource *res;
> @@ -1020,6 +1057,19 @@ static int imxfb_probe(struct platform_device *pdev)
>  		goto failed_register;
>  	}
>  
> +	fbi->lcd_pwr = devm_regulator_get(&pdev->dev, "lcd");
> +	if (IS_ERR(fbi->lcd_pwr) && (PTR_ERR(fbi->lcd_pwr) = -EPROBE_DEFER)) {
> +		ret = -EPROBE_DEFER;
> +		goto failed_lcd;
> +	}
> +
> +	lcd = devm_lcd_device_register(&pdev->dev, "imxfb-lcd", &pdev->dev, fbi,
> +				       &imxfb_lcd_ops);
> +	if (IS_ERR(lcd)) {
> +		ret = PTR_ERR(lcd);
> +		goto failed_lcd;
> +	}
> +
>  	imxfb_enable_controller(fbi);
>  	fbi->pdev = pdev;
>  #ifdef PWMR_BACKLIGHT_AVAILABLE
> @@ -1028,6 +1078,9 @@ static int imxfb_probe(struct platform_device *pdev)
>  
>  	return 0;
>  
> +failed_lcd:
> +	unregister_framebuffer(info);
> +
>  failed_register:
>  	fb_dealloc_cmap(&info->cmap);
>  failed_cmap:
> diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
> index 9de8f06..8902706 100644
> --- a/include/linux/platform_data/video-imxfb.h
> +++ b/include/linux/platform_data/video-imxfb.h
> @@ -76,7 +76,6 @@ struct imx_fb_platform_data {
>  	int (*init)(struct platform_device *);
>  	void (*exit)(struct platform_device *);
>  
> -	void (*lcd_power)(int);
>  	void (*backlight_power)(int);
>  };
>  
> -- 
> 1.8.3.2
> 


^ permalink raw reply

* Re: [PATCH] ARM: i.MX: Remove IMX_HAVE_PLATFORM_IMX_FB symbol
From: Shawn Guo @ 2013-12-23  8:15 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <1387612703-18512-1-git-send-email-shc_work@mail.ru>

On Sat, Dec 21, 2013 at 11:58:23AM +0400, Alexander Shiyan wrote:
<snip>
> @@ -9,8 +9,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
> -obj-y += platform-imx-dma.o
> -obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
> +obj-y += platform-imx-dma.o platform-imx-fb.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
>  obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o
> diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
> index 4f2e1b3..e7d8d88 100644
> --- a/drivers/video/Kconfig
> +++ b/drivers/video/Kconfig
> @@ -363,7 +363,7 @@ config FB_SA1100
>  
>  config FB_IMX
>  	tristate "Freescale i.MX1/21/25/27 LCD support"
> -	depends on FB && IMX_HAVE_PLATFORM_IMX_FB
> +	depends on FB && (SOC_IMX1 || SOC_IMX21 || SOC_IMX25 || SOC_IMX27)

Denis had a patch below to address the same problem.

http://thread.gmane.org/gmane.linux.drivers.devicetree/49472

In this way, we can still have IMX_HAVE_PLATFORM_IMX_FB to control the
build of platform-imx-fb.o.

Shawn 

>  	select FB_CFB_FILLRECT
>  	select FB_CFB_COPYAREA
>  	select FB_CFB_IMAGEBLIT
> -- 
> 1.8.3.2
> 


^ permalink raw reply

* [PATCH 1/2] drm/panel: Add support for Samsung LTN101NT05 panel
From: Marc Dietrich @ 2013-12-21 20:38 UTC (permalink / raw)
  To: linux-fbdev
  Cc: Thierry Reding, linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, Marc Dietrich,
	linux-fbdev-u79uwXL29TY76Z2rM5mHXA,
	dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW, David Airlie

The Samsung LNT101NT05 10.1" WXVGA panel can be supported by the simple panel
driver.

Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: David Airlie <airlied@linux.ie>
Signed-off-by: Marc Dietrich <marvin24@gmx.de>
---
This isn't strickly required to get the panel up, but Thierry suggested on IRC to
include it anyway, in case someone else has some use for it.

 .../bindings/panel/samsung,ltn101nt05.txt          |    7 +++++
 drivers/gpu/drm/panel/panel-simple.c               |   27 +++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt

diff --git a/Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt b/Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt
new file mode 100644
index 0000000..ef522c6
--- /dev/null
+++ b/Documentation/devicetree/bindings/panel/samsung,ltn101nt05.txt
@@ -0,0 +1,7 @@
+Samsung Electronics 10.1" WSVGA TFT LCD panel
+
+Required properties:
+- compatible: should be "samsung,ltn101nt05"
+
+This binding is compatible with the simple-panel binding, which is specified
+in simple-panel.txt in this directory.
diff --git a/drivers/gpu/drm/panel/panel-simple.c b/drivers/gpu/drm/panel/panel-simple.c
index 3e611af..7f9ddb5 100644
--- a/drivers/gpu/drm/panel/panel-simple.c
+++ b/drivers/gpu/drm/panel/panel-simple.c
@@ -338,6 +338,28 @@ static const struct panel_desc chunghwa_claa101wb01 = {
 	},
 };
 
+static const struct drm_display_mode samsung_ltn101nt05_mode = {
+	.clock = 54030,
+	.hdisplay = 1024,
+	.hsync_start = 1024 + 24,
+	.hsync_end = 1024 + 24 + 136,
+	.htotal = 1024 + 24 + 136 + 160,
+	.vdisplay = 600,
+	.vsync_start = 600 + 3,
+	.vsync_end = 600 + 3 + 6,
+	.vtotal = 600 + 3 + 6 + 61,
+	.vrefresh = 60,
+};
+
+static const struct panel_desc samsung_ltn101nt05 = {
+	.modes = &samsung_ltn101nt05_mode,
+	.num_modes = 1,
+	.size = {
+		.width = 1024,
+		.height = 600,
+	},
+};
+
 static const struct of_device_id platform_of_match[] = {
 	{
 		.compatible = "auo,b101aw03",
@@ -346,6 +368,9 @@ static const struct of_device_id platform_of_match[] = {
 		.compatible = "chunghwa,claa101wb01",
 		.data = &chunghwa_claa101wb01
 	}, {
+		.compatible = "samsung,ltn101nt05",
+		.data = &samsung_ltn101nt05,
+	}, {
 		.compatible = "simple-panel",
 	}, {
 		/* sentinel */
-- 
1.7.9.5


^ permalink raw reply related

* Re: [RFC PATCH 1/5] gpu: ipu-v3: Move i.MX IPUv3 core driver out of staging
From: Geert Uytterhoeven @ 2013-12-21 19:09 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1387561966-31758-2-git-send-email-p.zabel@pengutronix.de>

On Fri, Dec 20, 2013 at 6:52 PM, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> The i.MX Image Processing Unit (IPU) contains a number of image processing
> blocks that sit right in the middle between DRM and V4L2. Some of the modules,
> such as Display Controller, Processor, and Interface (DC, DP, DI) or CMOS
> Sensor Interface (CSI) and their FIFOs could be assigned to either framework,
> but others, such as the dma controller (IDMAC) and image converter (IC) can
> be used by both.
> The IPUv3 core driver provides an internal API to access the modules, to be
> used by both DRM and V4L2 IPUv3 drivers.
>
> Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/gpu/Makefile                                          |  1 +
>  drivers/gpu/ipu-v3/Kconfig                                    |  7 +++++++
>  drivers/{staging/imx-drm => gpu}/ipu-v3/Makefile              |  2 +-
>  drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-common.c          |  3 ++-
>  drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dc.c              |  3 +--
>  drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-di.c              |  2 +-
>  drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dmfc.c            |  2 +-
>  drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-dp.c              |  2 +-
>  drivers/{staging/imx-drm => gpu}/ipu-v3/ipu-prv.h             |  2 +-

The posted diff only shows the changes made during the move.

Has the actual code been reviewed here?
If not, please post it here (e.g. diff against /dev/null).
If yes, please ignore my comments.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply

* How are you doing today
From: adena ouattara @ 2013-12-21 15:03 UTC (permalink / raw)
  To: linux-fbdev

Hello
How are you doing today ,my name is miss Adena, to be brief i am seeking for
long-team relationship / business partnership and after reading your profile i became 
interested in you and i will like to know more about you if you don't mine,please 
contact me back through my email address so that i will tell you more about 
my self and send you some of my picture,thanks as i wait to hear from you soonest 
Yours new friends
Miss Adena.
adenaouattara2@hotmail.com

^ permalink raw reply

* [PATCH] video: imxfb: Use regulator API with LCD class for powering
From: Alexander Shiyan @ 2013-12-21 11:08 UTC (permalink / raw)
  To: linux-arm-kernel

This patch replaces custom lcd_power() callback with
regulator API over LCD class.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 .../devicetree/bindings/video/fsl,imx-fb.txt       |  1 +
 arch/arm/mach-imx/mach-mx27ads.c                   | 55 +++++++++++++++--
 drivers/video/imxfb.c                              | 71 +++++++++++++++++++---
 include/linux/platform_data/video-imxfb.h          |  1 -
 4 files changed, 114 insertions(+), 14 deletions(-)

diff --git a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
index 46da08d..e6b1ee9 100644
--- a/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
+++ b/Documentation/devicetree/bindings/video/fsl,imx-fb.txt
@@ -15,6 +15,7 @@ Required nodes:
 	- fsl,pcr: LCDC PCR value
 
 Optional properties:
+- lcd-supply: Regulator for LCD supply voltage.
 - fsl,dmacr: DMA Control Register value. This is optional. By default, the
 	register is not modified as recommended by the datasheet.
 - fsl,lscr1: LCDC Sharp Configuration Register value.
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 9821b824..a7a4a9c 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -21,6 +21,10 @@
 #include <linux/mtd/physmap.h>
 #include <linux/i2c.h>
 #include <linux/irq.h>
+
+#include <linux/regulator/fixed.h>
+#include <linux/regulator/machine.h>
+
 #include <asm/mach-types.h>
 #include <asm/mach/arch.h>
 #include <asm/mach/time.h>
@@ -195,14 +199,58 @@ static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
 static struct i2c_board_info mx27ads_i2c_devices[] = {
 };
 
-void lcd_power(int on)
+static void vgpio_set(struct gpio_chip *chip, unsigned offset, int value)
 {
-	if (on)
+	if (value)
 		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_SET_REG);
 	else
 		__raw_writew(PBC_BCTRL1_LCDON, PBC_BCTRL1_CLEAR_REG);
 }
 
+static int vgpio_dir_out(struct gpio_chip *chip, unsigned offset, int value)
+{
+	return 0;
+}
+
+#define MX27ADS_LCD_GPIO	(6 * 32)
+
+static struct regulator_consumer_supply mx27ads_lcd_regulator_consumer +	REGULATOR_SUPPLY("lcd", "imx-fb.0");
+
+static struct regulator_init_data mx27ads_lcd_regulator_init_data = {
+	.constraints	= {
+		.valid_ops_mask	= REGULATOR_CHANGE_STATUS,
+},
+	.consumer_supplies	= &mx27ads_lcd_regulator_consumer,
+	.num_consumer_supplies	= 1,
+};
+
+static struct fixed_voltage_config mx27ads_lcd_regulator_pdata = {
+	.supply_name	= "LCD",
+	.microvolts	= 3300000,
+	.gpio		= MX27ADS_LCD_GPIO,
+	.init_data	= &mx27ads_lcd_regulator_init_data,
+};
+
+static void __init mx27ads_regulator_init(void)
+{
+	struct gpio_chip *vchip;
+
+	vchip = kzalloc(sizeof(*vchip), GFP_KERNEL);
+	vchip->owner		= THIS_MODULE;
+	vchip->label		= "LCD";
+	vchip->base		= MX27ADS_LCD_GPIO;
+	vchip->ngpio		= 1;
+	vchip->direction_output	= vgpio_dir_out;
+	vchip->set		= vgpio_set;
+	gpiochip_add(vchip);
+
+	platform_device_register_data(&platform_bus, "reg-fixed-voltage",
+				      PLATFORM_DEVID_AUTO,
+				      &mx27ads_lcd_regulator_pdata,
+				      sizeof(mx27ads_lcd_regulator_pdata));
+}
+
 static struct imx_fb_videomode mx27ads_modes[] = {
 	{
 		.mode = {
@@ -239,8 +287,6 @@ static const struct imx_fb_platform_data mx27ads_fb_data __initconst = {
 	.pwmr		= 0x00A903FF,
 	.lscr1		= 0x00120300,
 	.dmacr		= 0x00020010,
-
-	.lcd_power	= lcd_power,
 };
 
 static int mx27ads_sdhc1_init(struct device *dev, irq_handler_t detect_irq,
@@ -304,6 +350,7 @@ static void __init mx27ads_board_init(void)
 	i2c_register_board_info(1, mx27ads_i2c_devices,
 				ARRAY_SIZE(mx27ads_i2c_devices));
 	imx27_add_imx_i2c(1, &mx27ads_i2c1_data);
+	mx27ads_regulator_init();
 	imx27_add_imx_fb(&mx27ads_fb_data);
 	imx27_add_mxc_mmc(0, &sdhc1_pdata);
 	imx27_add_mxc_mmc(1, &sdhc2_pdata);
diff --git a/drivers/video/imxfb.c b/drivers/video/imxfb.c
index 44ee678..e50b67f 100644
--- a/drivers/video/imxfb.c
+++ b/drivers/video/imxfb.c
@@ -30,10 +30,13 @@
 #include <linux/platform_device.h>
 #include <linux/dma-mapping.h>
 #include <linux/io.h>
+#include <linux/lcd.h>
 #include <linux/math64.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
 
+#include <linux/regulator/consumer.h>
+
 #include <video/of_display_timing.h>
 #include <video/of_videomode.h>
 #include <video/videomode.h>
@@ -177,8 +180,9 @@ struct imxfb_info {
 	struct backlight_device *bl;
 #endif
 
-	void (*lcd_power)(int);
 	void (*backlight_power)(int);
+
+	struct regulator	*lcd_pwr;
 };
 
 static struct platform_device_id imxfb_devtype[] = {
@@ -591,8 +595,6 @@ static void imxfb_enable_controller(struct imxfb_info *fbi)
 
 	if (fbi->backlight_power)
 		fbi->backlight_power(1);
-	if (fbi->lcd_power)
-		fbi->lcd_power(1);
 }
 
 static void imxfb_disable_controller(struct imxfb_info *fbi)
@@ -604,8 +606,6 @@ static void imxfb_disable_controller(struct imxfb_info *fbi)
 
 	if (fbi->backlight_power)
 		fbi->backlight_power(0);
-	if (fbi->lcd_power)
-		fbi->lcd_power(0);
 
 	clk_disable_unprepare(fbi->clk_per);
 	clk_disable_unprepare(fbi->clk_ipg);
@@ -796,7 +796,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
 		fbi->lscr1			= pdata->lscr1;
 		fbi->dmacr			= pdata->dmacr;
 		fbi->pwmr			= pdata->pwmr;
-		fbi->lcd_power			= pdata->lcd_power;
 		fbi->backlight_power		= pdata->backlight_power;
 	} else {
 		np = pdev->dev.of_node;
@@ -810,9 +809,6 @@ static int imxfb_init_fbinfo(struct platform_device *pdev)
 
 		of_property_read_u32(np, "fsl,dmacr", &fbi->dmacr);
 
-		/* These two function pointers could be used by some specific
-		 * platforms. */
-		fbi->lcd_power = NULL;
 		fbi->backlight_power = NULL;
 	}
 
@@ -856,9 +852,50 @@ static int imxfb_of_read_mode(struct device *dev, struct device_node *np,
 	return 0;
 }
 
+static int imxfb_lcd_check_fb(struct lcd_device *lcddev, struct fb_info *fi)
+{
+	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
+
+	if (!fi || fi->par = fbi)
+		return 1;
+
+	return 0;
+}
+
+static int imxfb_lcd_get_power(struct lcd_device *lcddev)
+{
+	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
+
+	if (!IS_ERR(fbi->lcd_pwr))
+		return regulator_is_enabled(fbi->lcd_pwr);
+
+	return 1;
+}
+
+static int imxfb_lcd_set_power(struct lcd_device *lcddev, int power)
+{
+	struct imxfb_info *fbi = dev_get_drvdata(&lcddev->dev);
+
+	if (!IS_ERR(fbi->lcd_pwr)) {
+		if (power)
+			return regulator_enable(fbi->lcd_pwr);
+		else
+			return regulator_disable(fbi->lcd_pwr);
+	}
+
+	return 0;
+}
+
+static struct lcd_ops imxfb_lcd_ops = {
+	.check_fb	= imxfb_lcd_check_fb,
+	.get_power	= imxfb_lcd_get_power,
+	.set_power	= imxfb_lcd_set_power,
+};
+
 static int imxfb_probe(struct platform_device *pdev)
 {
 	struct imxfb_info *fbi;
+	struct lcd_device *lcd;
 	struct fb_info *info;
 	struct imx_fb_platform_data *pdata;
 	struct resource *res;
@@ -1020,6 +1057,19 @@ static int imxfb_probe(struct platform_device *pdev)
 		goto failed_register;
 	}
 
+	fbi->lcd_pwr = devm_regulator_get(&pdev->dev, "lcd");
+	if (IS_ERR(fbi->lcd_pwr) && (PTR_ERR(fbi->lcd_pwr) = -EPROBE_DEFER)) {
+		ret = -EPROBE_DEFER;
+		goto failed_lcd;
+	}
+
+	lcd = devm_lcd_device_register(&pdev->dev, "imxfb-lcd", &pdev->dev, fbi,
+				       &imxfb_lcd_ops);
+	if (IS_ERR(lcd)) {
+		ret = PTR_ERR(lcd);
+		goto failed_lcd;
+	}
+
 	imxfb_enable_controller(fbi);
 	fbi->pdev = pdev;
 #ifdef PWMR_BACKLIGHT_AVAILABLE
@@ -1028,6 +1078,9 @@ static int imxfb_probe(struct platform_device *pdev)
 
 	return 0;
 
+failed_lcd:
+	unregister_framebuffer(info);
+
 failed_register:
 	fb_dealloc_cmap(&info->cmap);
 failed_cmap:
diff --git a/include/linux/platform_data/video-imxfb.h b/include/linux/platform_data/video-imxfb.h
index 9de8f06..8902706 100644
--- a/include/linux/platform_data/video-imxfb.h
+++ b/include/linux/platform_data/video-imxfb.h
@@ -76,7 +76,6 @@ struct imx_fb_platform_data {
 	int (*init)(struct platform_device *);
 	void (*exit)(struct platform_device *);
 
-	void (*lcd_power)(int);
 	void (*backlight_power)(int);
 };
 
-- 
1.8.3.2


^ permalink raw reply related

* [PATCH] ARM: i.MX: Remove IMX_HAVE_PLATFORM_IMX_FB symbol
From: Alexander Shiyan @ 2013-12-21  7:58 UTC (permalink / raw)
  To: linux-arm-kernel

Symbol IMX_HAVE_PLATFORM_IMX_FB is selected by boards which
use it, so there is no way to compile the FB driver only with
DT configuration. This patch removes this dependency completely.

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
---
 arch/arm/mach-imx/Kconfig          | 10 ----------
 arch/arm/mach-imx/devices/Kconfig  |  3 ---
 arch/arm/mach-imx/devices/Makefile |  3 +--
 drivers/video/Kconfig              |  2 +-
 4 files changed, 2 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig
index d511e054..9498878 100644
--- a/arch/arm/mach-imx/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -179,7 +179,6 @@ comment "MX21 platforms:"
 
 config MACH_MX21ADS
 	bool "MX21ADS platform"
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	select IMX_HAVE_PLATFORM_MXC_NAND
@@ -196,7 +195,6 @@ config MACH_MX25_3DS
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMXDI_RTC
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -211,7 +209,6 @@ config MACH_EUKREA_CPUIMX25SD
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
 	select IMX_HAVE_PLATFORM_IMXDI_RTC
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_EHCI
@@ -248,7 +245,6 @@ comment "MX27 platforms:"
 
 config MACH_MX27ADS
 	bool "MX27ADS platform"
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -281,7 +277,6 @@ choice
 
 config MACH_PCM970_BASEBOARD
 	bool "PHYTEC PCM970 development board"
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_MXC_MMC
 	help
 	  This adds board specific devices that can be found on Phytec's
@@ -326,7 +321,6 @@ choice
 
 config MACH_EUKREA_MBIMX27_BASEBOARD
 	bool "Eukrea MBIMX27 development board"
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -343,7 +337,6 @@ config MACH_MX27_3DS
 	bool "MX27PDK platform"
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_KEYPAD
 	select IMX_HAVE_PLATFORM_IMX_SSI
@@ -389,7 +382,6 @@ config MACH_PCA100
 	bool "Phytec phyCARD-s (pca100)"
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_SSI
 	select IMX_HAVE_PLATFORM_IMX_UART
@@ -406,7 +398,6 @@ config MACH_PCA100
 
 config MACH_MXT_TD60
 	bool "Maxtrack i-MXT TD60"
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_MXC_MMC
@@ -633,7 +624,6 @@ config MACH_MX35_3DS
 	bool "Support MX35PDK platform"
 	select IMX_HAVE_PLATFORM_FSL_USB2_UDC
 	select IMX_HAVE_PLATFORM_IMX2_WDT
-	select IMX_HAVE_PLATFORM_IMX_FB
 	select IMX_HAVE_PLATFORM_IMX_I2C
 	select IMX_HAVE_PLATFORM_IMX_UART
 	select IMX_HAVE_PLATFORM_IPU_CORE
diff --git a/arch/arm/mach-imx/devices/Kconfig b/arch/arm/mach-imx/devices/Kconfig
index 68c74fb..99951a6 100644
--- a/arch/arm/mach-imx/devices/Kconfig
+++ b/arch/arm/mach-imx/devices/Kconfig
@@ -25,9 +25,6 @@ config IMX_HAVE_PLATFORM_IMX2_WDT
 config IMX_HAVE_PLATFORM_IMXDI_RTC
 	bool
 
-config IMX_HAVE_PLATFORM_IMX_FB
-	bool
-
 config IMX_HAVE_PLATFORM_IMX_I2C
 	bool
 
diff --git a/arch/arm/mach-imx/devices/Makefile b/arch/arm/mach-imx/devices/Makefile
index 67416fb..ba2642d 100644
--- a/arch/arm/mach-imx/devices/Makefile
+++ b/arch/arm/mach-imx/devices/Makefile
@@ -9,8 +9,7 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX21_HCD) += platform-imx21-hcd.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX27_CODA) += platform-imx27-coda.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX2_WDT) += platform-imx2-wdt.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMXDI_RTC) += platform-imxdi_rtc.o
-obj-y += platform-imx-dma.o
-obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o
+obj-y += platform-imx-dma.o platform-imx-fb.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o
 obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig
index 4f2e1b3..e7d8d88 100644
--- a/drivers/video/Kconfig
+++ b/drivers/video/Kconfig
@@ -363,7 +363,7 @@ config FB_SA1100
 
 config FB_IMX
 	tristate "Freescale i.MX1/21/25/27 LCD support"
-	depends on FB && IMX_HAVE_PLATFORM_IMX_FB
+	depends on FB && (SOC_IMX1 || SOC_IMX21 || SOC_IMX25 || SOC_IMX27)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
-- 
1.8.3.2


^ permalink raw reply related

* Re: [RFC PATCH 0/5] Move IPUv3 core out of staging, add CSI support
From: Greg Kroah-Hartman @ 2013-12-20 19:12 UTC (permalink / raw)
  To: linux-fbdev
In-Reply-To: <1387561966-31758-1-git-send-email-p.zabel@pengutronix.de>

On Fri, Dec 20, 2013 at 06:52:41PM +0100, Philipp Zabel wrote:
> Hi,
> 
> this is mostly about the first patch, which moves the IPUv3 core code
> (drivers/staging/imx-drm/ipu-v3) to drivers/gpu. host1x, which
> serves a similar purpose, already sits there.
> The other four patches add the necessary code for CSI and SMFC handling,
> which is used by the V4L2 CSI capture driver.
> 
> Currently this is based on Russell's patch
>     [PATCH 62/64] imx-drm: pass an IPU ID to crtc and core
> 
> I am aware that there are now quite a few other patches in the pipeline
> that touch drivers/staging/imx-drm/ipu-v3/*, so I am happy to rebase this
> (or them) as needed. I'd like to move the core code out of staging so that
> we can start submitting V4L2 code for video capture and scaling / colorspace
> conversion in parallel.

I'd recommend doing the move (if the gpu/drm maintainer agrees) after
3.14-rc1 as then all of my pending patches would be applied and we would
be synced up with everything.

Once this "core" is moved, what is keeping the rest in staging and why
isn't it moving out as well?

thanks,

greg k-h

^ permalink raw reply

* [RFC PATCH 5/5] gpu: ipu-v3: Register the CSI modules
From: Philipp Zabel @ 2013-12-20 17:52 UTC (permalink / raw)
  To: linux-fbdev

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-common.c | 35 +++++++++++++++++++++++++++++++----
 include/video/imx-ipu-v3.h      |  1 +
 2 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index ad2639c..7535e7a 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -1016,6 +1016,7 @@ static void platform_device_unregister_children(struct platform_device *pdev)
 struct ipu_platform_reg {
 	struct ipu_client_platformdata pdata;
 	const char *name;
+	int reg_offset;
 };
 
 static const struct ipu_platform_reg client_reg[] = {
@@ -1037,13 +1038,29 @@ static const struct ipu_platform_reg client_reg[] = {
 			.dma[1] = -EINVAL,
 		},
 		.name = "imx-ipuv3-crtc",
+	}, {
+		.pdata = {
+			.csi = 0,
+			.dma[0] = IPUV3_CHANNEL_CSI0,
+			.dma[1] = -EINVAL,
+		},
+		.reg_offset = IPU_CM_CSI0_REG_OFS,
+		.name = "imx-ipuv3-camera",
+	}, {
+		.pdata = {
+			.csi = 1,
+			.dma[0] = IPUV3_CHANNEL_CSI1,
+			.dma[1] = -EINVAL,
+		},
+		.reg_offset = IPU_CM_CSI1_REG_OFS,
+		.name = "imx-ipuv3-camera",
 	},
 };
 
 static DEFINE_MUTEX(ipu_client_id_mutex);
 static int ipu_client_id;
 
-static int ipu_add_client_devices(struct ipu_soc *ipu)
+static int ipu_add_client_devices(struct ipu_soc *ipu, unsigned long ipu_base)
 {
 	struct device *dev = ipu->dev;
 	unsigned i;
@@ -1062,11 +1079,21 @@ static int ipu_add_client_devices(struct ipu_soc *ipu)
 		const struct ipu_platform_reg *reg = &client_reg[i];
 		struct ipu_client_platformdata pdata = reg->pdata;
 		struct platform_device *pdev;
+		struct resource res;
 
 		pdata.ipu = ipu_id;
 
-		pdev = platform_device_register_data(dev, reg->name,
-			id++, &pdata, sizeof(pdata));
+		if (reg->reg_offset) {
+			memset(&res, 0, sizeof(res));
+			res.flags = IORESOURCE_MEM;
+			res.start = ipu_base + ipu->devtype->cm_ofs + reg->reg_offset;
+			res.end = res.start + PAGE_SIZE - 1;
+			pdev = platform_device_register_resndata(dev, reg->name,
+				id++, &res, 1, &pdata, sizeof(pdata));
+		} else {
+			pdev = platform_device_register_data(dev, reg->name,
+					id++, &pdata, sizeof(pdata));
+		}
 
 		if (IS_ERR(pdev))
 			goto err_register;
@@ -1262,7 +1289,7 @@ static int ipu_probe(struct platform_device *pdev)
 	if (ret)
 		goto failed_submodules_init;
 
-	ret = ipu_add_client_devices(ipu);
+	ret = ipu_add_client_devices(ipu, ipu_base);
 	if (ret) {
 		dev_err(&pdev->dev, "adding client devices failed with %d\n",
 				ret);
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 767302d..f5448d4 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -331,6 +331,7 @@ static inline void ipu_cpmem_set_burstsize(struct ipu_ch_param __iomem *p,
 };
 
 struct ipu_client_platformdata {
+	int csi;
 	int di;
 	int dc;
 	int dp;
-- 
1.8.5.1


^ permalink raw reply related

* [RFC PATCH 4/5] gpu: ipu-v3: Add CSI and SMFC module enable wrappers
From: Philipp Zabel @ 2013-12-20 17:52 UTC (permalink / raw)
  To: linux-fbdev

IPU_CONF_..._EN bits are implementation details, not to be made public.
Add wrappers around ipu_module_enable/disable, so the CSI V4L2 driver
can enable/disable the CSI and SMFC modules.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-common.c | 24 ++++++++++++++++++++++++
 include/video/imx-ipu-v3.h      |  8 ++++++++
 2 files changed, 32 insertions(+)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 29c89f2..ad2639c 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -663,6 +663,30 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
 }
 EXPORT_SYMBOL_GPL(ipu_module_disable);
 
+int ipu_csi_enable(struct ipu_soc *ipu, int csi)
+{
+	return ipu_module_enable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_csi_enable);
+
+int ipu_csi_disable(struct ipu_soc *ipu, int csi)
+{
+	return ipu_module_disable(ipu, csi ? IPU_CONF_CSI1_EN : IPU_CONF_CSI0_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_csi_disable);
+
+int ipu_smfc_enable(struct ipu_soc *ipu)
+{
+	return ipu_module_enable(ipu, IPU_CONF_SMFC_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_smfc_enable);
+
+int ipu_smfc_disable(struct ipu_soc *ipu)
+{
+	return ipu_module_disable(ipu, IPU_CONF_SMFC_EN);
+}
+EXPORT_SYMBOL_GPL(ipu_smfc_disable);
+
 int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
 {
 	struct ipu_soc *ipu = channel->ipu;
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 78ea31b..767302d 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -162,8 +162,16 @@ int ipu_dp_set_global_alpha(struct ipu_dp *dp, bool enable, u8 alpha,
 		bool bg_chan);
 
 /*
+ * IPU CMOS Sensor Interface (csi) functions
+ */
+int ipu_csi_enable(struct ipu_soc *ipu, int csi);
+int ipu_csi_disable(struct ipu_soc *ipu, int csi);
+
+/*
  * IPU Sensor Multiple FIFO Controller (SMFC) functions
  */
+int ipu_smfc_enable(struct ipu_soc *ipu);
+int ipu_smfc_disable(struct ipu_soc *ipu);
 int ipu_smfc_map_channel(struct ipu_soc *ipu, int channel, int csi_id, int mipi_id);
 int ipu_smfc_set_burstsize(struct ipu_soc *ipu, int channel, int burstsize);
 
-- 
1.8.5.1


^ permalink raw reply related

* [RFC PATCH 3/5] gpu: ipu-v3: Add ipu_idmac_get_current_buffer function
From: Philipp Zabel @ 2013-12-20 17:52 UTC (permalink / raw)
  To: linux-fbdev

This function returns the currently active buffer (0 or 1)
of a double buffered IDMAC channel. It is to be used by the
CSI driver.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/ipu-v3/ipu-common.c | 9 +++++++++
 include/video/imx-ipu-v3.h      | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/gpu/ipu-v3/ipu-common.c b/drivers/gpu/ipu-v3/ipu-common.c
index 8f98719..29c89f2 100644
--- a/drivers/gpu/ipu-v3/ipu-common.c
+++ b/drivers/gpu/ipu-v3/ipu-common.c
@@ -663,6 +663,15 @@ int ipu_module_disable(struct ipu_soc *ipu, u32 mask)
 }
 EXPORT_SYMBOL_GPL(ipu_module_disable);
 
+int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel)
+{
+	struct ipu_soc *ipu = channel->ipu;
+	unsigned int chno = channel->num;
+
+	return (ipu_cm_read(ipu, IPU_CHA_CUR_BUF(chno)) & idma_mask(chno)) ? 1 : 0;
+}
+EXPORT_SYMBOL_GPL(ipu_idmac_get_current_buffer);
+
 void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num)
 {
 	struct ipu_soc *ipu = channel->ipu;
diff --git a/include/video/imx-ipu-v3.h b/include/video/imx-ipu-v3.h
index 274da71..78ea31b 100644
--- a/include/video/imx-ipu-v3.h
+++ b/include/video/imx-ipu-v3.h
@@ -103,6 +103,7 @@ int ipu_idmac_wait_busy(struct ipuv3_channel *channel, int ms);
 
 void ipu_idmac_set_double_buffer(struct ipuv3_channel *channel,
 		bool doublebuffer);
+int ipu_idmac_get_current_buffer(struct ipuv3_channel *channel);
 void ipu_idmac_select_buffer(struct ipuv3_channel *channel, u32 buf_num);
 
 /*
-- 
1.8.5.1


^ permalink raw reply related


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