* [PATCH 00/10] ARM: OMAP1: ams-delta: replace custom I/O with GPIO
From: Janusz Krzysztofik @ 2011-12-11 20:11 UTC (permalink / raw)
To: Tony Lindgren, Grant Likely, Dmitry Torokhov, Richard Purdie,
David Woodhouse, Tomi Valkeinen, Jarkko Nikula
Cc: linux-omap, linux-arm-kernel, linux-kernel, Janusz Krzysztofik,
linux-input, linux-mtd, linux-fbdev, alsa-devel, Liam Girdwood,
Mark Brown
The Amstrad Delta board has two extra output ports used for driving
input lines of different on-board devices. Those ports are now
controlled with custom functions, provided by the board arch code and
used by several device drivers.
The idea behind the series is to replace those custom I/O functions
with gpiolib API. This way, existing drivers can be made less platform
dependent, and some of them perhaps even superseded with generic GPIO
based drivers after the board platform device descriptions are
converted. Moreover, should a new driver for the on-board Smart Card
controller ever be created, it could be designed as a generic GPIO
based driver, not a custom one.
Janusz Krzysztofik (10):
GPIO: gpio-generic: Move initialization up to postcore
ARM: OMAP1: ams-delta: convert latches to basic_mmio_gpio
ARM: OMAP1: ams-delta: supersede custom led device by leds-gpio
LED: drop leds-ams-delta driver
MTD: NAND: ams-delta: use GPIO instead of custom I/O
ARM: OMAP1: ams-delta: Use GPIO API in modem setup
ASoC: OMAP: ams-delta: Drive modem/codec pins over GPIO API
omapfb: lcd_ams_delta: Drive control lines over GPIO
input: serio: ams-delta: toggle keyboard power over GPIO
ARM: OMAP1: ams-delta: drop custom I/O functions
arch/arm/mach-omap1/Kconfig | 2 +
arch/arm/mach-omap1/board-ams-delta.c | 220 +++++++++++++++++----
arch/arm/plat-omap/include/plat/board-ams-delta.h | 50 ++---
drivers/gpio/gpio-generic.c | 2 +-
drivers/input/serio/ams_delta_serio.c | 45 +++--
drivers/leds/Kconfig | 7 -
drivers/leds/Makefile | 1 -
drivers/leds/leds-ams-delta.c | 137 -------------
drivers/mtd/nand/ams-delta.c | 74 +++++--
drivers/video/omap/lcd_ams_delta.c | 27 ++-
sound/soc/omap/ams-delta.c | 21 ++-
11 files changed, 309 insertions(+), 277 deletions(-)
delete mode 100644 drivers/leds/leds-ams-delta.c
--
1.7.3.4
^ permalink raw reply
* [PATCH 02/16] macfb: fix black and white modes
From: Finn Thain @ 2011-12-10 5:23 UTC (permalink / raw)
To: Florian Tobias Schandinat; +Cc: linux-fbdev, linux-m68k, Geert Uytterhoeven
In-Reply-To: <20111023141119.848736612@telegraphics.com.au>
macfb won't init in black & white modes since fb_alloc_cmap() no longer
works for zero cmap length. Fix this and also clean up a few printk's
and some stylistic inconsistencies.
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
Re-sending unchanged. Still needs the right ack.
Index: linux-m68k/drivers/video/macfb.c
=================================--- linux-m68k.orig/drivers/video/macfb.c 2011-10-22 23:02:22.000000000 +1100
+++ linux-m68k/drivers/video/macfb.c 2011-10-23 00:50:51.000000000 +1100
@@ -592,12 +592,12 @@ static int __init macfb_init(void)
if (!fb_info.screen_base)
return -ENODEV;
- printk("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
- macfb_fix.smem_start, fb_info.screen_base,
- macfb_fix.smem_len / 1024);
- printk("macfb: mode is %dx%dx%d, linelength=%d\n",
- macfb_defined.xres, macfb_defined.yres,
- macfb_defined.bits_per_pixel, macfb_fix.line_length);
+ pr_info("macfb: framebuffer at 0x%08lx, mapped to 0x%p, size %dk\n",
+ macfb_fix.smem_start, fb_info.screen_base,
+ macfb_fix.smem_len / 1024);
+ pr_info("macfb: mode is %dx%dx%d, linelength=%d\n",
+ macfb_defined.xres, macfb_defined.yres,
+ macfb_defined.bits_per_pixel, macfb_fix.line_length);
/* Fill in the available video resolution */
macfb_defined.xres_virtual = macfb_defined.xres;
@@ -613,14 +613,10 @@ static int __init macfb_init(void)
switch (macfb_defined.bits_per_pixel) {
case 1:
- /*
- * XXX: I think this will catch any program that tries
- * to do FBIO_PUTCMAP when the visual is monochrome.
- */
macfb_defined.red.length = macfb_defined.bits_per_pixel;
macfb_defined.green.length = macfb_defined.bits_per_pixel;
macfb_defined.blue.length = macfb_defined.bits_per_pixel;
- video_cmap_len = 0;
+ video_cmap_len = 2;
macfb_fix.visual = FB_VISUAL_MONO01;
break;
case 2:
@@ -660,11 +656,10 @@ static int __init macfb_init(void)
macfb_fix.visual = FB_VISUAL_TRUECOLOR;
break;
default:
- video_cmap_len = 0;
- macfb_fix.visual = FB_VISUAL_MONO01;
- printk("macfb: unknown or unsupported bit depth: %d\n",
+ pr_err("macfb: unknown or unsupported bit depth: %d\n",
macfb_defined.bits_per_pixel);
- break;
+ err = -EINVAL;
+ goto fail_unmap;
}
/*
@@ -734,8 +729,8 @@ static int __init macfb_init(void)
case MAC_MODEL_Q950:
strcpy(macfb_fix.id, "DAFB");
macfb_setpalette = dafb_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
dafb_cmap_regs = ioremap(DAFB_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
/*
@@ -744,8 +739,8 @@ static int __init macfb_init(void)
case MAC_MODEL_LCII:
strcpy(macfb_fix.id, "V8");
macfb_setpalette = v8_brazil_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
/*
@@ -758,8 +753,8 @@ static int __init macfb_init(void)
case MAC_MODEL_P600:
strcpy(macfb_fix.id, "Brazil");
macfb_setpalette = v8_brazil_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
/*
@@ -773,10 +768,10 @@ static int __init macfb_init(void)
case MAC_MODEL_P520:
case MAC_MODEL_P550:
case MAC_MODEL_P460:
- macfb_setpalette = v8_brazil_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy(macfb_fix.id, "Sonora");
+ macfb_setpalette = v8_brazil_setpalette;
v8_brazil_cmap_regs = ioremap(DAC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
/*
@@ -786,10 +781,10 @@ static int __init macfb_init(void)
*/
case MAC_MODEL_IICI:
case MAC_MODEL_IISI:
- macfb_setpalette = rbv_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy(macfb_fix.id, "RBV");
+ macfb_setpalette = rbv_setpalette;
rbv_cmap_regs = ioremap(DAC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
/*
@@ -797,10 +792,10 @@ static int __init macfb_init(void)
*/
case MAC_MODEL_Q840:
case MAC_MODEL_C660:
- macfb_setpalette = civic_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy(macfb_fix.id, "Civic");
+ macfb_setpalette = civic_setpalette;
civic_cmap_regs = ioremap(CIVIC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
@@ -809,26 +804,26 @@ static int __init macfb_init(void)
* We think this may be like the LC II
*/
case MAC_MODEL_LC:
+ strcpy(macfb_fix.id, "LC");
if (vidtest) {
macfb_setpalette = v8_brazil_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
v8_brazil_cmap_regs ioremap(DAC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
}
- strcpy(macfb_fix.id, "LC");
break;
/*
* We think this may be like the LC II
*/
case MAC_MODEL_CCL:
+ strcpy(macfb_fix.id, "Color Classic");
if (vidtest) {
macfb_setpalette = v8_brazil_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
v8_brazil_cmap_regs ioremap(DAC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
}
- strcpy(macfb_fix.id, "Color Classic");
break;
/*
@@ -893,10 +888,10 @@ static int __init macfb_init(void)
case MAC_MODEL_PB270C:
case MAC_MODEL_PB280:
case MAC_MODEL_PB280C:
- macfb_setpalette = csc_setpalette;
- macfb_defined.activate = FB_ACTIVATE_NOW;
strcpy(macfb_fix.id, "CSC");
+ macfb_setpalette = csc_setpalette;
csc_cmap_regs = ioremap(CSC_BASE, 0x1000);
+ macfb_defined.activate = FB_ACTIVATE_NOW;
break;
default:
@@ -918,8 +913,9 @@ static int __init macfb_init(void)
if (err)
goto fail_dealloc;
- printk("fb%d: %s frame buffer device\n",
- fb_info.node, fb_info.fix.id);
+ pr_info("fb%d: %s frame buffer device\n",
+ fb_info.node, fb_info.fix.id);
+
return 0;
fail_dealloc:
^ permalink raw reply
* Re: [PATCH 2/3] video: omap: convert drivers/video/omap/* to use
From: Jonathan McDowell @ 2011-12-09 22:00 UTC (permalink / raw)
To: Marek Vasut
Cc: Axel Lin, linux-kernel, Cory Maccarrone, Laurent Gonzalez,
Tomi Valkeinen, Florian Tobias Schandinat, linux-fbdev,
linux-omap
In-Reply-To: <201112090924.29551.marek.vasut@gmail.com>
On Fri, Dec 09, 2011 at 09:24:29AM +0100, Marek Vasut wrote:
> > This patch converts the drivers in drivers/video/omap/* to use the
> > module_platform_driver() macro which makes the code smaller and a bit
> > simpler.
> >
> > Cc: Jonathan McDowell <noodles@earth.li>
> > Cc: Cory Maccarrone <darkstar6262@gmail.com>
> > Cc: Laurent Gonzalez <palmte.linux@free.fr>
> > Cc: Marek Vasut <marek.vasut@gmail.com>
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> > ---
> > drivers/video/omap/lcd_ams_delta.c | 13 +------------
> > drivers/video/omap/lcd_h3.c | 14 +-------------
> > drivers/video/omap/lcd_htcherald.c | 14 +-------------
> > drivers/video/omap/lcd_inn1510.c | 14 +-------------
> > drivers/video/omap/lcd_inn1610.c | 14 +-------------
> > drivers/video/omap/lcd_osk.c | 14 +-------------
> > drivers/video/omap/lcd_palmte.c | 14 +-------------
> > drivers/video/omap/lcd_palmtt.c | 13 +------------
> > drivers/video/omap/lcd_palmz71.c | 13 +------------
> > 9 files changed, 9 insertions(+), 114 deletions(-)
> >
> > diff --git a/drivers/video/omap/lcd_ams_delta.c
> > b/drivers/video/omap/lcd_ams_delta.c index eb50a95..0fdd6f6 100644
> > --- a/drivers/video/omap/lcd_ams_delta.c
> > +++ b/drivers/video/omap/lcd_ams_delta.c
> > @@ -209,15 +209,4 @@ static struct platform_driver ams_delta_panel_driver > > { },
> > };
> >
> > -static int __init ams_delta_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&ams_delta_panel_driver);
> > -}
> > -
> > -static void __exit ams_delta_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&ams_delta_panel_driver);
> > -}
> > -
> > -module_init(ams_delta_panel_drv_init);
> > -module_exit(ams_delta_panel_drv_cleanup);
> > +module_platform_driver(ams_delta_panel_driver);
> > diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
> > index baec34e..49bdeca 100644
> > --- a/drivers/video/omap/lcd_h3.c
> > +++ b/drivers/video/omap/lcd_h3.c
> > @@ -124,16 +124,4 @@ static struct platform_driver h3_panel_driver = {
> > },
> > };
> >
> > -static int __init h3_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&h3_panel_driver);
> > -}
> > -
> > -static void __exit h3_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&h3_panel_driver);
> > -}
> > -
> > -module_init(h3_panel_drv_init);
> > -module_exit(h3_panel_drv_cleanup);
> > -
> > +module_platform_driver(h3_panel_driver);
> > diff --git a/drivers/video/omap/lcd_htcherald.c
> > b/drivers/video/omap/lcd_htcherald.c index b1a022f..20f4778 100644
> > --- a/drivers/video/omap/lcd_htcherald.c
> > +++ b/drivers/video/omap/lcd_htcherald.c
> > @@ -115,16 +115,4 @@ static struct platform_driver htcherald_panel_driver > > { },
> > };
> >
> > -static int __init htcherald_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&htcherald_panel_driver);
> > -}
> > -
> > -static void __exit htcherald_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&htcherald_panel_driver);
> > -}
> > -
> > -module_init(htcherald_panel_drv_init);
> > -module_exit(htcherald_panel_drv_cleanup);
> > -
> > +module_platform_driver(htcherald_panel_driver);
> > diff --git a/drivers/video/omap/lcd_inn1510.c
> > b/drivers/video/omap/lcd_inn1510.c index d129946..b38b1dd 100644
> > --- a/drivers/video/omap/lcd_inn1510.c
> > +++ b/drivers/video/omap/lcd_inn1510.c
> > @@ -109,16 +109,4 @@ static struct platform_driver
> > innovator1510_panel_driver = { },
> > };
> >
> > -static int __init innovator1510_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&innovator1510_panel_driver);
> > -}
> > -
> > -static void __exit innovator1510_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&innovator1510_panel_driver);
> > -}
> > -
> > -module_init(innovator1510_panel_drv_init);
> > -module_exit(innovator1510_panel_drv_cleanup);
> > -
> > +module_platform_driver(innovator1510_panel_driver);
> > diff --git a/drivers/video/omap/lcd_inn1610.c
> > b/drivers/video/omap/lcd_inn1610.c index a95756b..7e8bd8e 100644
> > --- a/drivers/video/omap/lcd_inn1610.c
> > +++ b/drivers/video/omap/lcd_inn1610.c
> > @@ -133,16 +133,4 @@ static struct platform_driver
> > innovator1610_panel_driver = { },
> > };
> >
> > -static int __init innovator1610_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&innovator1610_panel_driver);
> > -}
> > -
> > -static void __exit innovator1610_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&innovator1610_panel_driver);
> > -}
> > -
> > -module_init(innovator1610_panel_drv_init);
> > -module_exit(innovator1610_panel_drv_cleanup);
> > -
> > +module_platform_driver(innovator1610_panel_driver);
> > diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
> > index b985997..5914220 100644
> > --- a/drivers/video/omap/lcd_osk.c
> > +++ b/drivers/video/omap/lcd_osk.c
> > @@ -127,16 +127,4 @@ static struct platform_driver osk_panel_driver = {
> > },
> > };
> >
> > -static int __init osk_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&osk_panel_driver);
> > -}
> > -
> > -static void __exit osk_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&osk_panel_driver);
> > -}
> > -
> > -module_init(osk_panel_drv_init);
> > -module_exit(osk_panel_drv_cleanup);
> > -
> > +module_platform_driver(osk_panel_driver);
> > diff --git a/drivers/video/omap/lcd_palmte.c
> > b/drivers/video/omap/lcd_palmte.c index d79f436..88c31eb 100644
> > --- a/drivers/video/omap/lcd_palmte.c
> > +++ b/drivers/video/omap/lcd_palmte.c
> > @@ -108,16 +108,4 @@ static struct platform_driver palmte_panel_driver = {
> > },
> > };
> >
> > -static int __init palmte_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&palmte_panel_driver);
> > -}
> > -
> > -static void __exit palmte_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&palmte_panel_driver);
> > -}
> > -
> > -module_init(palmte_panel_drv_init);
> > -module_exit(palmte_panel_drv_cleanup);
> > -
> > +module_platform_driver(palmte_panel_driver);
> > diff --git a/drivers/video/omap/lcd_palmtt.c
> > b/drivers/video/omap/lcd_palmtt.c index c2e96a7..aaf3c8b 100644
> > --- a/drivers/video/omap/lcd_palmtt.c
> > +++ b/drivers/video/omap/lcd_palmtt.c
> > @@ -113,15 +113,4 @@ static struct platform_driver palmtt_panel_driver = {
> > },
> > };
> >
> > -static int __init palmtt_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&palmtt_panel_driver);
> > -}
> > -
> > -static void __exit palmtt_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&palmtt_panel_driver);
> > -}
> > -
> > -module_init(palmtt_panel_drv_init);
> > -module_exit(palmtt_panel_drv_cleanup);
> > +module_platform_driver(palmtt_panel_driver);
> > diff --git a/drivers/video/omap/lcd_palmz71.c
> > b/drivers/video/omap/lcd_palmz71.c index 1ab4847..3b7d8aa 100644
> > --- a/drivers/video/omap/lcd_palmz71.c
> > +++ b/drivers/video/omap/lcd_palmz71.c
> > @@ -109,15 +109,4 @@ static struct platform_driver palmz71_panel_driver = {
> > },
> > };
> >
> > -static int __init palmz71_panel_drv_init(void)
> > -{
> > - return platform_driver_register(&palmz71_panel_driver);
> > -}
> > -
> > -static void __exit palmz71_panel_drv_cleanup(void)
> > -{
> > - platform_driver_unregister(&palmz71_panel_driver);
> > -}
> > -
> > -module_init(palmz71_panel_drv_init);
> > -module_exit(palmz71_panel_drv_cleanup);
> > +module_platform_driver(palmz71_panel_driver);
>
> PalmTT and PalmZ71, please add my
> Acked-by: Marek Vasut <marek.vasut@gmail.com>
For ams-delta,
Acked-By: Jonathan McDowell <noodles@earth.li>
J.
--
xmpp:noodles@earth.li
Time is an illusion. Lunchtime doubly so.
^ permalink raw reply
* Re: [PATCH 1/2] video: omap: Staticise non-exported symbols
From: Jonathan McDowell @ 2011-12-09 21:59 UTC (permalink / raw)
To: Marek Vasut
Cc: Axel Lin, linux-kernel, Imre Deak, Cory Maccarrone,
Laurent Gonzalez, Tomi Valkeinen, Florian Tobias Schandinat,
linux-fbdev, linux-omap
In-Reply-To: <201112090923.46643.marek.vasut@gmail.com>
On Fri, Dec 09, 2011 at 09:23:46AM +0100, Marek Vasut wrote:
> > These symbols are not used outside it's driver so no need to
> > make the symbol global.
> >
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> > ---
> > drivers/video/omap/lcd_ams_delta.c | 2 +-
> > drivers/video/omap/lcd_h3.c | 2 +-
> > drivers/video/omap/lcd_htcherald.c | 2 +-
> > drivers/video/omap/lcd_inn1510.c | 2 +-
> > drivers/video/omap/lcd_inn1610.c | 2 +-
> > drivers/video/omap/lcd_osk.c | 2 +-
> > drivers/video/omap/lcd_palmte.c | 2 +-
> > drivers/video/omap/lcd_palmtt.c | 2 +-
> > drivers/video/omap/lcd_palmz71.c | 2 +-
> > 9 files changed, 9 insertions(+), 9 deletions(-)
> >
> > diff --git a/drivers/video/omap/lcd_ams_delta.c
> > b/drivers/video/omap/lcd_ams_delta.c index 6978ae4..eb50a95 100644
> > --- a/drivers/video/omap/lcd_ams_delta.c
> > +++ b/drivers/video/omap/lcd_ams_delta.c
> > @@ -198,7 +198,7 @@ static int ams_delta_panel_resume(struct
> > platform_device *pdev) return 0;
> > }
> >
> > -struct platform_driver ams_delta_panel_driver = {
> > +static struct platform_driver ams_delta_panel_driver = {
> > .probe = ams_delta_panel_probe,
> > .remove = ams_delta_panel_remove,
> > .suspend = ams_delta_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
> > index 622ad83..baec34e 100644
> > --- a/drivers/video/omap/lcd_h3.c
> > +++ b/drivers/video/omap/lcd_h3.c
> > @@ -113,7 +113,7 @@ static int h3_panel_resume(struct platform_device
> > *pdev) return 0;
> > }
> >
> > -struct platform_driver h3_panel_driver = {
> > +static struct platform_driver h3_panel_driver = {
> > .probe = h3_panel_probe,
> > .remove = h3_panel_remove,
> > .suspend = h3_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_htcherald.c
> > b/drivers/video/omap/lcd_htcherald.c index 4802419..b1a022f 100644
> > --- a/drivers/video/omap/lcd_htcherald.c
> > +++ b/drivers/video/omap/lcd_htcherald.c
> > @@ -104,7 +104,7 @@ static int htcherald_panel_resume(struct
> > platform_device *pdev) return 0;
> > }
> >
> > -struct platform_driver htcherald_panel_driver = {
> > +static struct platform_driver htcherald_panel_driver = {
> > .probe = htcherald_panel_probe,
> > .remove = htcherald_panel_remove,
> > .suspend = htcherald_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_inn1510.c
> > b/drivers/video/omap/lcd_inn1510.c index 3271f16..d129946 100644
> > --- a/drivers/video/omap/lcd_inn1510.c
> > +++ b/drivers/video/omap/lcd_inn1510.c
> > @@ -98,7 +98,7 @@ static int innovator1510_panel_resume(struct
> > platform_device *pdev) return 0;
> > }
> >
> > -struct platform_driver innovator1510_panel_driver = {
> > +static struct platform_driver innovator1510_panel_driver = {
> > .probe = innovator1510_panel_probe,
> > .remove = innovator1510_panel_remove,
> > .suspend = innovator1510_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_inn1610.c
> > b/drivers/video/omap/lcd_inn1610.c index 12cc52a..a95756b 100644
> > --- a/drivers/video/omap/lcd_inn1610.c
> > +++ b/drivers/video/omap/lcd_inn1610.c
> > @@ -122,7 +122,7 @@ static int innovator1610_panel_resume(struct
> > platform_device *pdev) return 0;
> > }
> >
> > -struct platform_driver innovator1610_panel_driver = {
> > +static struct platform_driver innovator1610_panel_driver = {
> > .probe = innovator1610_panel_probe,
> > .remove = innovator1610_panel_remove,
> > .suspend = innovator1610_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
> > index 6f8d13c..b985997 100644
> > --- a/drivers/video/omap/lcd_osk.c
> > +++ b/drivers/video/omap/lcd_osk.c
> > @@ -116,7 +116,7 @@ static int osk_panel_resume(struct platform_device
> > *pdev) return 0;
> > }
> >
> > -struct platform_driver osk_panel_driver = {
> > +static struct platform_driver osk_panel_driver = {
> > .probe = osk_panel_probe,
> > .remove = osk_panel_remove,
> > .suspend = osk_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_palmte.c
> > b/drivers/video/omap/lcd_palmte.c index 4cb3017..d79f436 100644
> > --- a/drivers/video/omap/lcd_palmte.c
> > +++ b/drivers/video/omap/lcd_palmte.c
> > @@ -97,7 +97,7 @@ static int palmte_panel_resume(struct platform_device
> > *pdev) return 0;
> > }
> >
> > -struct platform_driver palmte_panel_driver = {
> > +static struct platform_driver palmte_panel_driver = {
> > .probe = palmte_panel_probe,
> > .remove = palmte_panel_remove,
> > .suspend = palmte_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_palmtt.c
> > b/drivers/video/omap/lcd_palmtt.c index b51b332..c2e96a7 100644
> > --- a/drivers/video/omap/lcd_palmtt.c
> > +++ b/drivers/video/omap/lcd_palmtt.c
> > @@ -102,7 +102,7 @@ static int palmtt_panel_resume(struct platform_device
> > *pdev) return 0;
> > }
> >
> > -struct platform_driver palmtt_panel_driver = {
> > +static struct platform_driver palmtt_panel_driver = {
> > .probe = palmtt_panel_probe,
> > .remove = palmtt_panel_remove,
> > .suspend = palmtt_panel_suspend,
> > diff --git a/drivers/video/omap/lcd_palmz71.c
> > b/drivers/video/omap/lcd_palmz71.c index 2334e56..1ab4847 100644
> > --- a/drivers/video/omap/lcd_palmz71.c
> > +++ b/drivers/video/omap/lcd_palmz71.c
> > @@ -98,7 +98,7 @@ static int palmz71_panel_resume(struct platform_device
> > *pdev) return 0;
> > }
> >
> > -struct platform_driver palmz71_panel_driver = {
> > +static struct platform_driver palmz71_panel_driver = {
> > .probe = palmz71_panel_probe,
> > .remove = palmz71_panel_remove,
> > .suspend = palmz71_panel_suspend,
>
> I can speak for palmtt and palmz71,
>
> Acked-by: Marek Vasut <marek.vasut@gmail.com>
Likewise, for ams-delta,
Acked-By: Jonathan McDowell <noodles@earth.li>
J.
--
Generally, all generalizations are false..
This .sig brought to you by the letter Z and the number 26
Product of the Republic of HuggieTag
^ permalink raw reply
* Re: [PATCH] drivers/video: fsl-diu-fb: rename "machine_data_" to
From: Tabi Timur-B04825 @ 2011-12-09 19:54 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <1323386851-3480-1-git-send-email-timur@freescale.com>
On Thu, Dec 8, 2011 at 5:27 PM, Timur Tabi <timur@freescale.com> wrote:
> "machine_data" is too long and clunky, and the "machine" part doesn't make
> much sense, anyway.
>
> Signed-off-by: Timur Tabi <timur@freescale.com>
Oops... I see an extra underscore in the git subject. Florian, would
you be so kind as to remove it if/when you apply this patch?
--
Timur Tabi
Linux kernel developer at Freescale
^ permalink raw reply
* Re: [PATCH 2/3] video: omap: convert drivers/video/omap/* to use module_platform_driver()
From: Marek Vasut @ 2011-12-09 8:24 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Jonathan McDowell, Cory Maccarrone,
Laurent Gonzalez, Tomi Valkeinen, Florian Tobias Schandinat,
linux-fbdev, linux-omap
In-Reply-To: <1323395996.3740.6.camel@phoenix>
> This patch converts the drivers in drivers/video/omap/* to use the
> module_platform_driver() macro which makes the code smaller and a bit
> simpler.
>
> Cc: Jonathan McDowell <noodles@earth.li>
> Cc: Cory Maccarrone <darkstar6262@gmail.com>
> Cc: Laurent Gonzalez <palmte.linux@free.fr>
> Cc: Marek Vasut <marek.vasut@gmail.com>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/video/omap/lcd_ams_delta.c | 13 +------------
> drivers/video/omap/lcd_h3.c | 14 +-------------
> drivers/video/omap/lcd_htcherald.c | 14 +-------------
> drivers/video/omap/lcd_inn1510.c | 14 +-------------
> drivers/video/omap/lcd_inn1610.c | 14 +-------------
> drivers/video/omap/lcd_osk.c | 14 +-------------
> drivers/video/omap/lcd_palmte.c | 14 +-------------
> drivers/video/omap/lcd_palmtt.c | 13 +------------
> drivers/video/omap/lcd_palmz71.c | 13 +------------
> 9 files changed, 9 insertions(+), 114 deletions(-)
>
> diff --git a/drivers/video/omap/lcd_ams_delta.c
> b/drivers/video/omap/lcd_ams_delta.c index eb50a95..0fdd6f6 100644
> --- a/drivers/video/omap/lcd_ams_delta.c
> +++ b/drivers/video/omap/lcd_ams_delta.c
> @@ -209,15 +209,4 @@ static struct platform_driver ams_delta_panel_driver > { },
> };
>
> -static int __init ams_delta_panel_drv_init(void)
> -{
> - return platform_driver_register(&ams_delta_panel_driver);
> -}
> -
> -static void __exit ams_delta_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&ams_delta_panel_driver);
> -}
> -
> -module_init(ams_delta_panel_drv_init);
> -module_exit(ams_delta_panel_drv_cleanup);
> +module_platform_driver(ams_delta_panel_driver);
> diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
> index baec34e..49bdeca 100644
> --- a/drivers/video/omap/lcd_h3.c
> +++ b/drivers/video/omap/lcd_h3.c
> @@ -124,16 +124,4 @@ static struct platform_driver h3_panel_driver = {
> },
> };
>
> -static int __init h3_panel_drv_init(void)
> -{
> - return platform_driver_register(&h3_panel_driver);
> -}
> -
> -static void __exit h3_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&h3_panel_driver);
> -}
> -
> -module_init(h3_panel_drv_init);
> -module_exit(h3_panel_drv_cleanup);
> -
> +module_platform_driver(h3_panel_driver);
> diff --git a/drivers/video/omap/lcd_htcherald.c
> b/drivers/video/omap/lcd_htcherald.c index b1a022f..20f4778 100644
> --- a/drivers/video/omap/lcd_htcherald.c
> +++ b/drivers/video/omap/lcd_htcherald.c
> @@ -115,16 +115,4 @@ static struct platform_driver htcherald_panel_driver > { },
> };
>
> -static int __init htcherald_panel_drv_init(void)
> -{
> - return platform_driver_register(&htcherald_panel_driver);
> -}
> -
> -static void __exit htcherald_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&htcherald_panel_driver);
> -}
> -
> -module_init(htcherald_panel_drv_init);
> -module_exit(htcherald_panel_drv_cleanup);
> -
> +module_platform_driver(htcherald_panel_driver);
> diff --git a/drivers/video/omap/lcd_inn1510.c
> b/drivers/video/omap/lcd_inn1510.c index d129946..b38b1dd 100644
> --- a/drivers/video/omap/lcd_inn1510.c
> +++ b/drivers/video/omap/lcd_inn1510.c
> @@ -109,16 +109,4 @@ static struct platform_driver
> innovator1510_panel_driver = { },
> };
>
> -static int __init innovator1510_panel_drv_init(void)
> -{
> - return platform_driver_register(&innovator1510_panel_driver);
> -}
> -
> -static void __exit innovator1510_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&innovator1510_panel_driver);
> -}
> -
> -module_init(innovator1510_panel_drv_init);
> -module_exit(innovator1510_panel_drv_cleanup);
> -
> +module_platform_driver(innovator1510_panel_driver);
> diff --git a/drivers/video/omap/lcd_inn1610.c
> b/drivers/video/omap/lcd_inn1610.c index a95756b..7e8bd8e 100644
> --- a/drivers/video/omap/lcd_inn1610.c
> +++ b/drivers/video/omap/lcd_inn1610.c
> @@ -133,16 +133,4 @@ static struct platform_driver
> innovator1610_panel_driver = { },
> };
>
> -static int __init innovator1610_panel_drv_init(void)
> -{
> - return platform_driver_register(&innovator1610_panel_driver);
> -}
> -
> -static void __exit innovator1610_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&innovator1610_panel_driver);
> -}
> -
> -module_init(innovator1610_panel_drv_init);
> -module_exit(innovator1610_panel_drv_cleanup);
> -
> +module_platform_driver(innovator1610_panel_driver);
> diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
> index b985997..5914220 100644
> --- a/drivers/video/omap/lcd_osk.c
> +++ b/drivers/video/omap/lcd_osk.c
> @@ -127,16 +127,4 @@ static struct platform_driver osk_panel_driver = {
> },
> };
>
> -static int __init osk_panel_drv_init(void)
> -{
> - return platform_driver_register(&osk_panel_driver);
> -}
> -
> -static void __exit osk_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&osk_panel_driver);
> -}
> -
> -module_init(osk_panel_drv_init);
> -module_exit(osk_panel_drv_cleanup);
> -
> +module_platform_driver(osk_panel_driver);
> diff --git a/drivers/video/omap/lcd_palmte.c
> b/drivers/video/omap/lcd_palmte.c index d79f436..88c31eb 100644
> --- a/drivers/video/omap/lcd_palmte.c
> +++ b/drivers/video/omap/lcd_palmte.c
> @@ -108,16 +108,4 @@ static struct platform_driver palmte_panel_driver = {
> },
> };
>
> -static int __init palmte_panel_drv_init(void)
> -{
> - return platform_driver_register(&palmte_panel_driver);
> -}
> -
> -static void __exit palmte_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&palmte_panel_driver);
> -}
> -
> -module_init(palmte_panel_drv_init);
> -module_exit(palmte_panel_drv_cleanup);
> -
> +module_platform_driver(palmte_panel_driver);
> diff --git a/drivers/video/omap/lcd_palmtt.c
> b/drivers/video/omap/lcd_palmtt.c index c2e96a7..aaf3c8b 100644
> --- a/drivers/video/omap/lcd_palmtt.c
> +++ b/drivers/video/omap/lcd_palmtt.c
> @@ -113,15 +113,4 @@ static struct platform_driver palmtt_panel_driver = {
> },
> };
>
> -static int __init palmtt_panel_drv_init(void)
> -{
> - return platform_driver_register(&palmtt_panel_driver);
> -}
> -
> -static void __exit palmtt_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&palmtt_panel_driver);
> -}
> -
> -module_init(palmtt_panel_drv_init);
> -module_exit(palmtt_panel_drv_cleanup);
> +module_platform_driver(palmtt_panel_driver);
> diff --git a/drivers/video/omap/lcd_palmz71.c
> b/drivers/video/omap/lcd_palmz71.c index 1ab4847..3b7d8aa 100644
> --- a/drivers/video/omap/lcd_palmz71.c
> +++ b/drivers/video/omap/lcd_palmz71.c
> @@ -109,15 +109,4 @@ static struct platform_driver palmz71_panel_driver = {
> },
> };
>
> -static int __init palmz71_panel_drv_init(void)
> -{
> - return platform_driver_register(&palmz71_panel_driver);
> -}
> -
> -static void __exit palmz71_panel_drv_cleanup(void)
> -{
> - platform_driver_unregister(&palmz71_panel_driver);
> -}
> -
> -module_init(palmz71_panel_drv_init);
> -module_exit(palmz71_panel_drv_cleanup);
> +module_platform_driver(palmz71_panel_driver);
PalmTT and PalmZ71, please add my
Acked-by: Marek Vasut <marek.vasut@gmail.com>
^ permalink raw reply
* Re: [PATCH 1/2] video: omap: Staticise non-exported symbols
From: Marek Vasut @ 2011-12-09 8:23 UTC (permalink / raw)
To: Axel Lin
Cc: linux-kernel, Jonathan McDowell, Imre Deak, Cory Maccarrone,
Laurent Gonzalez, Tomi Valkeinen, Florian Tobias Schandinat,
linux-fbdev, linux-omap
In-Reply-To: <1323394677.3740.2.camel@phoenix>
> These symbols are not used outside it's driver so no need to
> make the symbol global.
>
> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
> drivers/video/omap/lcd_ams_delta.c | 2 +-
> drivers/video/omap/lcd_h3.c | 2 +-
> drivers/video/omap/lcd_htcherald.c | 2 +-
> drivers/video/omap/lcd_inn1510.c | 2 +-
> drivers/video/omap/lcd_inn1610.c | 2 +-
> drivers/video/omap/lcd_osk.c | 2 +-
> drivers/video/omap/lcd_palmte.c | 2 +-
> drivers/video/omap/lcd_palmtt.c | 2 +-
> drivers/video/omap/lcd_palmz71.c | 2 +-
> 9 files changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/video/omap/lcd_ams_delta.c
> b/drivers/video/omap/lcd_ams_delta.c index 6978ae4..eb50a95 100644
> --- a/drivers/video/omap/lcd_ams_delta.c
> +++ b/drivers/video/omap/lcd_ams_delta.c
> @@ -198,7 +198,7 @@ static int ams_delta_panel_resume(struct
> platform_device *pdev) return 0;
> }
>
> -struct platform_driver ams_delta_panel_driver = {
> +static struct platform_driver ams_delta_panel_driver = {
> .probe = ams_delta_panel_probe,
> .remove = ams_delta_panel_remove,
> .suspend = ams_delta_panel_suspend,
> diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
> index 622ad83..baec34e 100644
> --- a/drivers/video/omap/lcd_h3.c
> +++ b/drivers/video/omap/lcd_h3.c
> @@ -113,7 +113,7 @@ static int h3_panel_resume(struct platform_device
> *pdev) return 0;
> }
>
> -struct platform_driver h3_panel_driver = {
> +static struct platform_driver h3_panel_driver = {
> .probe = h3_panel_probe,
> .remove = h3_panel_remove,
> .suspend = h3_panel_suspend,
> diff --git a/drivers/video/omap/lcd_htcherald.c
> b/drivers/video/omap/lcd_htcherald.c index 4802419..b1a022f 100644
> --- a/drivers/video/omap/lcd_htcherald.c
> +++ b/drivers/video/omap/lcd_htcherald.c
> @@ -104,7 +104,7 @@ static int htcherald_panel_resume(struct
> platform_device *pdev) return 0;
> }
>
> -struct platform_driver htcherald_panel_driver = {
> +static struct platform_driver htcherald_panel_driver = {
> .probe = htcherald_panel_probe,
> .remove = htcherald_panel_remove,
> .suspend = htcherald_panel_suspend,
> diff --git a/drivers/video/omap/lcd_inn1510.c
> b/drivers/video/omap/lcd_inn1510.c index 3271f16..d129946 100644
> --- a/drivers/video/omap/lcd_inn1510.c
> +++ b/drivers/video/omap/lcd_inn1510.c
> @@ -98,7 +98,7 @@ static int innovator1510_panel_resume(struct
> platform_device *pdev) return 0;
> }
>
> -struct platform_driver innovator1510_panel_driver = {
> +static struct platform_driver innovator1510_panel_driver = {
> .probe = innovator1510_panel_probe,
> .remove = innovator1510_panel_remove,
> .suspend = innovator1510_panel_suspend,
> diff --git a/drivers/video/omap/lcd_inn1610.c
> b/drivers/video/omap/lcd_inn1610.c index 12cc52a..a95756b 100644
> --- a/drivers/video/omap/lcd_inn1610.c
> +++ b/drivers/video/omap/lcd_inn1610.c
> @@ -122,7 +122,7 @@ static int innovator1610_panel_resume(struct
> platform_device *pdev) return 0;
> }
>
> -struct platform_driver innovator1610_panel_driver = {
> +static struct platform_driver innovator1610_panel_driver = {
> .probe = innovator1610_panel_probe,
> .remove = innovator1610_panel_remove,
> .suspend = innovator1610_panel_suspend,
> diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
> index 6f8d13c..b985997 100644
> --- a/drivers/video/omap/lcd_osk.c
> +++ b/drivers/video/omap/lcd_osk.c
> @@ -116,7 +116,7 @@ static int osk_panel_resume(struct platform_device
> *pdev) return 0;
> }
>
> -struct platform_driver osk_panel_driver = {
> +static struct platform_driver osk_panel_driver = {
> .probe = osk_panel_probe,
> .remove = osk_panel_remove,
> .suspend = osk_panel_suspend,
> diff --git a/drivers/video/omap/lcd_palmte.c
> b/drivers/video/omap/lcd_palmte.c index 4cb3017..d79f436 100644
> --- a/drivers/video/omap/lcd_palmte.c
> +++ b/drivers/video/omap/lcd_palmte.c
> @@ -97,7 +97,7 @@ static int palmte_panel_resume(struct platform_device
> *pdev) return 0;
> }
>
> -struct platform_driver palmte_panel_driver = {
> +static struct platform_driver palmte_panel_driver = {
> .probe = palmte_panel_probe,
> .remove = palmte_panel_remove,
> .suspend = palmte_panel_suspend,
> diff --git a/drivers/video/omap/lcd_palmtt.c
> b/drivers/video/omap/lcd_palmtt.c index b51b332..c2e96a7 100644
> --- a/drivers/video/omap/lcd_palmtt.c
> +++ b/drivers/video/omap/lcd_palmtt.c
> @@ -102,7 +102,7 @@ static int palmtt_panel_resume(struct platform_device
> *pdev) return 0;
> }
>
> -struct platform_driver palmtt_panel_driver = {
> +static struct platform_driver palmtt_panel_driver = {
> .probe = palmtt_panel_probe,
> .remove = palmtt_panel_remove,
> .suspend = palmtt_panel_suspend,
> diff --git a/drivers/video/omap/lcd_palmz71.c
> b/drivers/video/omap/lcd_palmz71.c index 2334e56..1ab4847 100644
> --- a/drivers/video/omap/lcd_palmz71.c
> +++ b/drivers/video/omap/lcd_palmz71.c
> @@ -98,7 +98,7 @@ static int palmz71_panel_resume(struct platform_device
> *pdev) return 0;
> }
>
> -struct platform_driver palmz71_panel_driver = {
> +static struct platform_driver palmz71_panel_driver = {
> .probe = palmz71_panel_probe,
> .remove = palmz71_panel_remove,
> .suspend = palmz71_panel_suspend,
I can speak for palmtt and palmz71,
Acked-by: Marek Vasut <marek.vasut@gmail.com>
^ permalink raw reply
* [PATCH v3] backlight/ld9040.c: regulator control in the driver
From: Donghwa Lee @ 2011-12-09 5:38 UTC (permalink / raw)
To: linux-arm-kernel
This patch supports regulator power control in the driver.
Current ld9040 driver was controlled power on/off sequence by callback function
in the board file. But, by doing this, there's no need to register lcd power
on/off callback function in the board file.
changes since v2:
- bind regulators as bulk data
- in case of failure to get regulator, free regulator bulk data
Signed-off-by: Donghwa Lee <dh09.lee@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Inki Dae <inki.dae@samsung.com>
---
drivers/video/backlight/ld9040.c | 71
+++++++++++++++++++++++++++++++------
1 files changed, 59 insertions(+), 12 deletions(-)
diff --git a/drivers/video/backlight/ld9040.c
b/drivers/video/backlight/ld9040.c
index da9a5ce..133ddff 100644
--- a/drivers/video/backlight/ld9040.c
+++ b/drivers/video/backlight/ld9040.c
@@ -31,6 +31,7 @@
#include <linux/lcd.h>
#include <linux/backlight.h>
#include <linux/module.h>
+#include <linux/regulator/consumer.h>
#include "ld9040_gamma.h"
@@ -53,8 +54,51 @@ struct ld9040 {
struct lcd_device *ld;
struct backlight_device *bd;
struct lcd_platform_data *lcd_pd;
+
+ struct mutex lock;
+ bool enabled;
+};
+
+static struct regulator_bulk_data supplies[] = {
+ { .supply = "vdd3", },
+ { .supply = "vci", },
};
+static void ld9040_regulator_enable(struct ld9040 *lcd)
+{
+ int ret = 0;
+ struct lcd_platform_data *pd = NULL;
+
+ pd = lcd->lcd_pd;
+ mutex_lock(&lcd->lock);
+ if (!lcd->enabled) {
+ ret = regulator_bulk_enable(ARRAY_SIZE(supplies), supplies);
+ if (ret)
+ goto out;
+
+ lcd->enabled = true;
+ }
+ mdelay(pd->power_on_delay);
+out:
+ mutex_unlock(&lcd->lock);
+}
+
+static void ld9040_regulator_disable(struct ld9040 *lcd)
+{
+ int ret = 0;
+
+ mutex_lock(&lcd->lock);
+ if (lcd->enabled) {
+ ret = regulator_bulk_disable(ARRAY_SIZE(supplies), supplies);
+ if (ret)
+ goto out;
+
+ lcd->enabled = false;
+ }
+out:
+ mutex_unlock(&lcd->lock);
+}
+
static const unsigned short seq_swreset[] = {
0x01, COMMAND_ONLY,
ENDDEF, 0x00
@@ -532,13 +576,8 @@ static int ld9040_power_on(struct ld9040 *lcd)
return -EFAULT;
}
- if (!pd->power_on) {
- dev_err(lcd->dev, "power_on is NULL.\n");
- return -EFAULT;
- } else {
- pd->power_on(lcd->ld, 1);
- mdelay(pd->power_on_delay);
- }
+ /* lcd power on */
+ ld9040_regulator_enable(lcd);
if (!pd->reset) {
dev_err(lcd->dev, "reset is NULL.\n");
@@ -582,11 +621,8 @@ static int ld9040_power_off(struct ld9040 *lcd)
mdelay(pd->power_off_delay);
- if (!pd->power_on) {
- dev_err(lcd->dev, "power_on is NULL.\n");
- return -EFAULT;
- } else
- pd->power_on(lcd->ld, 0);
+ /* lcd power off */
+ ld9040_regulator_disable(lcd);
return 0;
}
@@ -693,6 +729,14 @@ static int ld9040_probe(struct spi_device *spi)
goto out_free_lcd;
}
+ mutex_init(&lcd->lock);
+
+ ret = regulator_bulk_get(lcd->dev, ARRAY_SIZE(supplies), supplies);
+ if (ret) {
+ dev_err(lcd->dev, "Failed to get regulators: %d\n", ret);
+ goto out_free_lcd;
+ }
+
ld = lcd_device_register("ld9040", &spi->dev, lcd, &ld9040_lcd_ops);
if (IS_ERR(ld)) {
ret = PTR_ERR(ld);
@@ -739,6 +783,8 @@ static int ld9040_probe(struct spi_device *spi)
out_unregister_lcd:
lcd_device_unregister(lcd->ld);
out_free_lcd:
+ regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
+
kfree(lcd);
return ret;
}
@@ -750,6 +796,7 @@ static int __devexit ld9040_remove(struct spi_device
*spi)
ld9040_power(lcd, FB_BLANK_POWERDOWN);
backlight_device_unregister(lcd->bd);
lcd_device_unregister(lcd->ld);
+ regulator_bulk_free(ARRAY_SIZE(supplies), supplies);
kfree(lcd);
return 0;
--
1.7.4.1
^ permalink raw reply related
* [PATCH 3/3] video: pnx4008: convert drivers/video/pnx4008/* to use
From: Axel Lin @ 2011-12-09 2:01 UTC (permalink / raw)
To: linux-kernel; +Cc: Grigory Tolstolytkin, Florian Tobias Schandinat, linux-fbdev
In-Reply-To: <1323395873.3740.4.camel@phoenix>
This patch converts the drivers in drivers/video/pnx4008/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.
Cc: Grigory Tolstolytkin <gtolstolytkin@ru.mvista.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/pnx4008/pnxrgbfb.c | 13 +------------
drivers/video/pnx4008/sdum.c | 13 +------------
2 files changed, 2 insertions(+), 24 deletions(-)
diff --git a/drivers/video/pnx4008/pnxrgbfb.c b/drivers/video/pnx4008/pnxrgbfb.c
index b2252fe..6d30428 100644
--- a/drivers/video/pnx4008/pnxrgbfb.c
+++ b/drivers/video/pnx4008/pnxrgbfb.c
@@ -193,17 +193,6 @@ static struct platform_driver rgbfb_driver = {
.remove = rgbfb_remove,
};
-static int __init rgbfb_init(void)
-{
- return platform_driver_register(&rgbfb_driver);
-}
-
-static void __exit rgbfb_exit(void)
-{
- platform_driver_unregister(&rgbfb_driver);
-}
-
-module_init(rgbfb_init);
-module_exit(rgbfb_exit);
+module_platform_driver(rgbfb_driver);
MODULE_LICENSE("GPL");
diff --git a/drivers/video/pnx4008/sdum.c b/drivers/video/pnx4008/sdum.c
index 50e0039..c5c7414 100644
--- a/drivers/video/pnx4008/sdum.c
+++ b/drivers/video/pnx4008/sdum.c
@@ -856,17 +856,6 @@ static struct platform_driver sdum_driver = {
.resume = sdum_resume,
};
-int __init sdum_init(void)
-{
- return platform_driver_register(&sdum_driver);
-}
-
-static void __exit sdum_exit(void)
-{
- platform_driver_unregister(&sdum_driver);
-};
-
-module_init(sdum_init);
-module_exit(sdum_exit);
+module_platform_driver(sdum_driver);
MODULE_LICENSE("GPL");
--
1.7.5.4
^ permalink raw reply related
* [PATCH 2/3] video: omap: convert drivers/video/omap/* to use
From: Axel Lin @ 2011-12-09 1:59 UTC (permalink / raw)
To: linux-kernel
Cc: Jonathan McDowell, Cory Maccarrone, Laurent Gonzalez, Marek Vasut,
Tomi Valkeinen, Florian Tobias Schandinat, linux-fbdev,
linux-omap
In-Reply-To: <1323395873.3740.4.camel@phoenix>
This patch converts the drivers in drivers/video/omap/* to use the
module_platform_driver() macro which makes the code smaller and a bit
simpler.
Cc: Jonathan McDowell <noodles@earth.li>
Cc: Cory Maccarrone <darkstar6262@gmail.com>
Cc: Laurent Gonzalez <palmte.linux@free.fr>
Cc: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/omap/lcd_ams_delta.c | 13 +------------
drivers/video/omap/lcd_h3.c | 14 +-------------
drivers/video/omap/lcd_htcherald.c | 14 +-------------
drivers/video/omap/lcd_inn1510.c | 14 +-------------
drivers/video/omap/lcd_inn1610.c | 14 +-------------
drivers/video/omap/lcd_osk.c | 14 +-------------
drivers/video/omap/lcd_palmte.c | 14 +-------------
drivers/video/omap/lcd_palmtt.c | 13 +------------
drivers/video/omap/lcd_palmz71.c | 13 +------------
9 files changed, 9 insertions(+), 114 deletions(-)
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c
index eb50a95..0fdd6f6 100644
--- a/drivers/video/omap/lcd_ams_delta.c
+++ b/drivers/video/omap/lcd_ams_delta.c
@@ -209,15 +209,4 @@ static struct platform_driver ams_delta_panel_driver = {
},
};
-static int __init ams_delta_panel_drv_init(void)
-{
- return platform_driver_register(&ams_delta_panel_driver);
-}
-
-static void __exit ams_delta_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&ams_delta_panel_driver);
-}
-
-module_init(ams_delta_panel_drv_init);
-module_exit(ams_delta_panel_drv_cleanup);
+module_platform_driver(ams_delta_panel_driver);
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
index baec34e..49bdeca 100644
--- a/drivers/video/omap/lcd_h3.c
+++ b/drivers/video/omap/lcd_h3.c
@@ -124,16 +124,4 @@ static struct platform_driver h3_panel_driver = {
},
};
-static int __init h3_panel_drv_init(void)
-{
- return platform_driver_register(&h3_panel_driver);
-}
-
-static void __exit h3_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&h3_panel_driver);
-}
-
-module_init(h3_panel_drv_init);
-module_exit(h3_panel_drv_cleanup);
-
+module_platform_driver(h3_panel_driver);
diff --git a/drivers/video/omap/lcd_htcherald.c b/drivers/video/omap/lcd_htcherald.c
index b1a022f..20f4778 100644
--- a/drivers/video/omap/lcd_htcherald.c
+++ b/drivers/video/omap/lcd_htcherald.c
@@ -115,16 +115,4 @@ static struct platform_driver htcherald_panel_driver = {
},
};
-static int __init htcherald_panel_drv_init(void)
-{
- return platform_driver_register(&htcherald_panel_driver);
-}
-
-static void __exit htcherald_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&htcherald_panel_driver);
-}
-
-module_init(htcherald_panel_drv_init);
-module_exit(htcherald_panel_drv_cleanup);
-
+module_platform_driver(htcherald_panel_driver);
diff --git a/drivers/video/omap/lcd_inn1510.c b/drivers/video/omap/lcd_inn1510.c
index d129946..b38b1dd 100644
--- a/drivers/video/omap/lcd_inn1510.c
+++ b/drivers/video/omap/lcd_inn1510.c
@@ -109,16 +109,4 @@ static struct platform_driver innovator1510_panel_driver = {
},
};
-static int __init innovator1510_panel_drv_init(void)
-{
- return platform_driver_register(&innovator1510_panel_driver);
-}
-
-static void __exit innovator1510_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&innovator1510_panel_driver);
-}
-
-module_init(innovator1510_panel_drv_init);
-module_exit(innovator1510_panel_drv_cleanup);
-
+module_platform_driver(innovator1510_panel_driver);
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index a95756b..7e8bd8e 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -133,16 +133,4 @@ static struct platform_driver innovator1610_panel_driver = {
},
};
-static int __init innovator1610_panel_drv_init(void)
-{
- return platform_driver_register(&innovator1610_panel_driver);
-}
-
-static void __exit innovator1610_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&innovator1610_panel_driver);
-}
-
-module_init(innovator1610_panel_drv_init);
-module_exit(innovator1610_panel_drv_cleanup);
-
+module_platform_driver(innovator1610_panel_driver);
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
index b985997..5914220 100644
--- a/drivers/video/omap/lcd_osk.c
+++ b/drivers/video/omap/lcd_osk.c
@@ -127,16 +127,4 @@ static struct platform_driver osk_panel_driver = {
},
};
-static int __init osk_panel_drv_init(void)
-{
- return platform_driver_register(&osk_panel_driver);
-}
-
-static void __exit osk_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&osk_panel_driver);
-}
-
-module_init(osk_panel_drv_init);
-module_exit(osk_panel_drv_cleanup);
-
+module_platform_driver(osk_panel_driver);
diff --git a/drivers/video/omap/lcd_palmte.c b/drivers/video/omap/lcd_palmte.c
index d79f436..88c31eb 100644
--- a/drivers/video/omap/lcd_palmte.c
+++ b/drivers/video/omap/lcd_palmte.c
@@ -108,16 +108,4 @@ static struct platform_driver palmte_panel_driver = {
},
};
-static int __init palmte_panel_drv_init(void)
-{
- return platform_driver_register(&palmte_panel_driver);
-}
-
-static void __exit palmte_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&palmte_panel_driver);
-}
-
-module_init(palmte_panel_drv_init);
-module_exit(palmte_panel_drv_cleanup);
-
+module_platform_driver(palmte_panel_driver);
diff --git a/drivers/video/omap/lcd_palmtt.c b/drivers/video/omap/lcd_palmtt.c
index c2e96a7..aaf3c8b 100644
--- a/drivers/video/omap/lcd_palmtt.c
+++ b/drivers/video/omap/lcd_palmtt.c
@@ -113,15 +113,4 @@ static struct platform_driver palmtt_panel_driver = {
},
};
-static int __init palmtt_panel_drv_init(void)
-{
- return platform_driver_register(&palmtt_panel_driver);
-}
-
-static void __exit palmtt_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&palmtt_panel_driver);
-}
-
-module_init(palmtt_panel_drv_init);
-module_exit(palmtt_panel_drv_cleanup);
+module_platform_driver(palmtt_panel_driver);
diff --git a/drivers/video/omap/lcd_palmz71.c b/drivers/video/omap/lcd_palmz71.c
index 1ab4847..3b7d8aa 100644
--- a/drivers/video/omap/lcd_palmz71.c
+++ b/drivers/video/omap/lcd_palmz71.c
@@ -109,15 +109,4 @@ static struct platform_driver palmz71_panel_driver = {
},
};
-static int __init palmz71_panel_drv_init(void)
-{
- return platform_driver_register(&palmz71_panel_driver);
-}
-
-static void __exit palmz71_panel_drv_cleanup(void)
-{
- platform_driver_unregister(&palmz71_panel_driver);
-}
-
-module_init(palmz71_panel_drv_init);
-module_exit(palmz71_panel_drv_cleanup);
+module_platform_driver(palmz71_panel_driver);
--
1.7.5.4
^ permalink raw reply related
* [PATCH 1/3] video: convert mbxfb to use module_platform_driver()
From: Axel Lin @ 2011-12-09 1:57 UTC (permalink / raw)
To: linux-kernel; +Cc: Mike Rapoport, Florian Tobias Schandinat, linux-fbdev
This patch converts mbxfb to use the module_platform_driver() macro
which makes the code smaller and a bit simpler.
Cc: Mike Rapoport <mike@compulab.co.il>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/mbx/mbxfb.c | 13 +------------
1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/drivers/video/mbx/mbxfb.c b/drivers/video/mbx/mbxfb.c
index 6ce3416..55bf619 100644
--- a/drivers/video/mbx/mbxfb.c
+++ b/drivers/video/mbx/mbxfb.c
@@ -1053,18 +1053,7 @@ static struct platform_driver mbxfb_driver = {
},
};
-int __devinit mbxfb_init(void)
-{
- return platform_driver_register(&mbxfb_driver);
-}
-
-static void __devexit mbxfb_exit(void)
-{
- platform_driver_unregister(&mbxfb_driver);
-}
-
-module_init(mbxfb_init);
-module_exit(mbxfb_exit);
+module_platform_driver(mbxfb_driver);
MODULE_DESCRIPTION("loadable framebuffer driver for Marathon device");
MODULE_AUTHOR("Mike Rapoport, Compulab");
--
1.7.5.4
^ permalink raw reply related
* [PATCH 1/2] video: omap: Staticise non-exported symbols
From: Axel Lin @ 2011-12-09 1:37 UTC (permalink / raw)
To: linux-kernel
Cc: Jonathan McDowell, Imre Deak, Cory Maccarrone, Laurent Gonzalez,
Marek Vasut, Tomi Valkeinen, Florian Tobias Schandinat,
linux-fbdev, linux-omap
These symbols are not used outside it's driver so no need to
make the symbol global.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
drivers/video/omap/lcd_ams_delta.c | 2 +-
drivers/video/omap/lcd_h3.c | 2 +-
drivers/video/omap/lcd_htcherald.c | 2 +-
drivers/video/omap/lcd_inn1510.c | 2 +-
drivers/video/omap/lcd_inn1610.c | 2 +-
drivers/video/omap/lcd_osk.c | 2 +-
drivers/video/omap/lcd_palmte.c | 2 +-
drivers/video/omap/lcd_palmtt.c | 2 +-
drivers/video/omap/lcd_palmz71.c | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/video/omap/lcd_ams_delta.c b/drivers/video/omap/lcd_ams_delta.c
index 6978ae4..eb50a95 100644
--- a/drivers/video/omap/lcd_ams_delta.c
+++ b/drivers/video/omap/lcd_ams_delta.c
@@ -198,7 +198,7 @@ static int ams_delta_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver ams_delta_panel_driver = {
+static struct platform_driver ams_delta_panel_driver = {
.probe = ams_delta_panel_probe,
.remove = ams_delta_panel_remove,
.suspend = ams_delta_panel_suspend,
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
index 622ad83..baec34e 100644
--- a/drivers/video/omap/lcd_h3.c
+++ b/drivers/video/omap/lcd_h3.c
@@ -113,7 +113,7 @@ static int h3_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver h3_panel_driver = {
+static struct platform_driver h3_panel_driver = {
.probe = h3_panel_probe,
.remove = h3_panel_remove,
.suspend = h3_panel_suspend,
diff --git a/drivers/video/omap/lcd_htcherald.c b/drivers/video/omap/lcd_htcherald.c
index 4802419..b1a022f 100644
--- a/drivers/video/omap/lcd_htcherald.c
+++ b/drivers/video/omap/lcd_htcherald.c
@@ -104,7 +104,7 @@ static int htcherald_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver htcherald_panel_driver = {
+static struct platform_driver htcherald_panel_driver = {
.probe = htcherald_panel_probe,
.remove = htcherald_panel_remove,
.suspend = htcherald_panel_suspend,
diff --git a/drivers/video/omap/lcd_inn1510.c b/drivers/video/omap/lcd_inn1510.c
index 3271f16..d129946 100644
--- a/drivers/video/omap/lcd_inn1510.c
+++ b/drivers/video/omap/lcd_inn1510.c
@@ -98,7 +98,7 @@ static int innovator1510_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver innovator1510_panel_driver = {
+static struct platform_driver innovator1510_panel_driver = {
.probe = innovator1510_panel_probe,
.remove = innovator1510_panel_remove,
.suspend = innovator1510_panel_suspend,
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index 12cc52a..a95756b 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -122,7 +122,7 @@ static int innovator1610_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver innovator1610_panel_driver = {
+static struct platform_driver innovator1610_panel_driver = {
.probe = innovator1610_panel_probe,
.remove = innovator1610_panel_remove,
.suspend = innovator1610_panel_suspend,
diff --git a/drivers/video/omap/lcd_osk.c b/drivers/video/omap/lcd_osk.c
index 6f8d13c..b985997 100644
--- a/drivers/video/omap/lcd_osk.c
+++ b/drivers/video/omap/lcd_osk.c
@@ -116,7 +116,7 @@ static int osk_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver osk_panel_driver = {
+static struct platform_driver osk_panel_driver = {
.probe = osk_panel_probe,
.remove = osk_panel_remove,
.suspend = osk_panel_suspend,
diff --git a/drivers/video/omap/lcd_palmte.c b/drivers/video/omap/lcd_palmte.c
index 4cb3017..d79f436 100644
--- a/drivers/video/omap/lcd_palmte.c
+++ b/drivers/video/omap/lcd_palmte.c
@@ -97,7 +97,7 @@ static int palmte_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver palmte_panel_driver = {
+static struct platform_driver palmte_panel_driver = {
.probe = palmte_panel_probe,
.remove = palmte_panel_remove,
.suspend = palmte_panel_suspend,
diff --git a/drivers/video/omap/lcd_palmtt.c b/drivers/video/omap/lcd_palmtt.c
index b51b332..c2e96a7 100644
--- a/drivers/video/omap/lcd_palmtt.c
+++ b/drivers/video/omap/lcd_palmtt.c
@@ -102,7 +102,7 @@ static int palmtt_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver palmtt_panel_driver = {
+static struct platform_driver palmtt_panel_driver = {
.probe = palmtt_panel_probe,
.remove = palmtt_panel_remove,
.suspend = palmtt_panel_suspend,
diff --git a/drivers/video/omap/lcd_palmz71.c b/drivers/video/omap/lcd_palmz71.c
index 2334e56..1ab4847 100644
--- a/drivers/video/omap/lcd_palmz71.c
+++ b/drivers/video/omap/lcd_palmz71.c
@@ -98,7 +98,7 @@ static int palmz71_panel_resume(struct platform_device *pdev)
return 0;
}
-struct platform_driver palmz71_panel_driver = {
+static struct platform_driver palmz71_panel_driver = {
.probe = palmz71_panel_probe,
.remove = palmz71_panel_remove,
.suspend = palmz71_panel_suspend,
--
1.7.5.4
^ permalink raw reply related
* [PATCH] drivers/video: fsl-diu-fb: rename "machine_data_" to "data"
From: Timur Tabi @ 2011-12-08 23:27 UTC (permalink / raw)
To: linux-fbdev
"machine_data" is too long and clunky, and the "machine" part doesn't make
much sense, anyway.
Signed-off-by: Timur Tabi <timur@freescale.com>
---
drivers/video/fsl-diu-fb.c | 236 ++++++++++++++++++++++----------------------
1 files changed, 116 insertions(+), 120 deletions(-)
diff --git a/drivers/video/fsl-diu-fb.c b/drivers/video/fsl-diu-fb.c
index 4d54188..408272c 100644
--- a/drivers/video/fsl-diu-fb.c
+++ b/drivers/video/fsl-diu-fb.c
@@ -509,8 +509,8 @@ static void fsl_diu_enable_panel(struct fb_info *info)
{
struct mfb_info *pmfbi, *cmfbi, *mfbi = info->par;
struct diu_ad *ad = mfbi->ad;
- struct fsl_diu_data *machine_data = mfbi->parent;
- struct diu __iomem *hw = machine_data->diu_reg;
+ struct fsl_diu_data *data = mfbi->parent;
+ struct diu __iomem *hw = data->diu_reg;
switch (mfbi->index) {
case PLANE0:
@@ -518,7 +518,7 @@ static void fsl_diu_enable_panel(struct fb_info *info)
wr_reg_wa(&hw->desc[0], ad->paddr);
break;
case PLANE1_AOI0:
- cmfbi = &machine_data->mfb[2];
+ cmfbi = &data->mfb[2];
if (hw->desc[1] != ad->paddr) { /* AOI0 closed */
if (cmfbi->count > 0) /* AOI1 open */
ad->next_ad @@ -529,7 +529,7 @@ static void fsl_diu_enable_panel(struct fb_info *info)
}
break;
case PLANE2_AOI0:
- cmfbi = &machine_data->mfb[4];
+ cmfbi = &data->mfb[4];
if (hw->desc[2] != ad->paddr) { /* AOI0 closed */
if (cmfbi->count > 0) /* AOI1 open */
ad->next_ad @@ -540,17 +540,17 @@ static void fsl_diu_enable_panel(struct fb_info *info)
}
break;
case PLANE1_AOI1:
- pmfbi = &machine_data->mfb[1];
+ pmfbi = &data->mfb[1];
ad->next_ad = 0;
- if (hw->desc[1] = machine_data->dummy_ad.paddr)
+ if (hw->desc[1] = data->dummy_ad.paddr)
wr_reg_wa(&hw->desc[1], ad->paddr);
else /* AOI0 open */
pmfbi->ad->next_ad = cpu_to_le32(ad->paddr);
break;
case PLANE2_AOI1:
- pmfbi = &machine_data->mfb[3];
+ pmfbi = &data->mfb[3];
ad->next_ad = 0;
- if (hw->desc[2] = machine_data->dummy_ad.paddr)
+ if (hw->desc[2] = data->dummy_ad.paddr)
wr_reg_wa(&hw->desc[2], ad->paddr);
else /* AOI0 was open */
pmfbi->ad->next_ad = cpu_to_le32(ad->paddr);
@@ -562,52 +562,52 @@ static void fsl_diu_disable_panel(struct fb_info *info)
{
struct mfb_info *pmfbi, *cmfbi, *mfbi = info->par;
struct diu_ad *ad = mfbi->ad;
- struct fsl_diu_data *machine_data = mfbi->parent;
- struct diu __iomem *hw = machine_data->diu_reg;
+ struct fsl_diu_data *data = mfbi->parent;
+ struct diu __iomem *hw = data->diu_reg;
switch (mfbi->index) {
case PLANE0:
- if (hw->desc[0] != machine_data->dummy_ad.paddr)
- wr_reg_wa(&hw->desc[0], machine_data->dummy_ad.paddr);
+ if (hw->desc[0] != data->dummy_ad.paddr)
+ wr_reg_wa(&hw->desc[0], data->dummy_ad.paddr);
break;
case PLANE1_AOI0:
- cmfbi = &machine_data->mfb[2];
+ cmfbi = &data->mfb[2];
if (cmfbi->count > 0) /* AOI1 is open */
wr_reg_wa(&hw->desc[1], cmfbi->ad->paddr);
/* move AOI1 to the first */
else /* AOI1 was closed */
- wr_reg_wa(&hw->desc[1], machine_data->dummy_ad.paddr);
+ wr_reg_wa(&hw->desc[1], data->dummy_ad.paddr);
/* close AOI 0 */
break;
case PLANE2_AOI0:
- cmfbi = &machine_data->mfb[4];
+ cmfbi = &data->mfb[4];
if (cmfbi->count > 0) /* AOI1 is open */
wr_reg_wa(&hw->desc[2], cmfbi->ad->paddr);
/* move AOI1 to the first */
else /* AOI1 was closed */
- wr_reg_wa(&hw->desc[2], machine_data->dummy_ad.paddr);
+ wr_reg_wa(&hw->desc[2], data->dummy_ad.paddr);
/* close AOI 0 */
break;
case PLANE1_AOI1:
- pmfbi = &machine_data->mfb[1];
+ pmfbi = &data->mfb[1];
if (hw->desc[1] != ad->paddr) {
/* AOI1 is not the first in the chain */
if (pmfbi->count > 0)
/* AOI0 is open, must be the first */
pmfbi->ad->next_ad = 0;
} else /* AOI1 is the first in the chain */
- wr_reg_wa(&hw->desc[1], machine_data->dummy_ad.paddr);
+ wr_reg_wa(&hw->desc[1], data->dummy_ad.paddr);
/* close AOI 1 */
break;
case PLANE2_AOI1:
- pmfbi = &machine_data->mfb[3];
+ pmfbi = &data->mfb[3];
if (hw->desc[2] != ad->paddr) {
/* AOI1 is not the first in the chain */
if (pmfbi->count > 0)
/* AOI0 is open, must be the first */
pmfbi->ad->next_ad = 0;
} else /* AOI1 is the first in the chain */
- wr_reg_wa(&hw->desc[2], machine_data->dummy_ad.paddr);
+ wr_reg_wa(&hw->desc[2], data->dummy_ad.paddr);
/* close AOI 1 */
break;
}
@@ -616,24 +616,24 @@ static void fsl_diu_disable_panel(struct fb_info *info)
static void enable_lcdc(struct fb_info *info)
{
struct mfb_info *mfbi = info->par;
- struct fsl_diu_data *machine_data = mfbi->parent;
- struct diu __iomem *hw = machine_data->diu_reg;
+ struct fsl_diu_data *data = mfbi->parent;
+ struct diu __iomem *hw = data->diu_reg;
- if (!machine_data->fb_enabled) {
+ if (!data->fb_enabled) {
out_be32(&hw->diu_mode, MFB_MODE1);
- machine_data->fb_enabled++;
+ data->fb_enabled++;
}
}
static void disable_lcdc(struct fb_info *info)
{
struct mfb_info *mfbi = info->par;
- struct fsl_diu_data *machine_data = mfbi->parent;
- struct diu __iomem *hw = machine_data->diu_reg;
+ struct fsl_diu_data *data = mfbi->parent;
+ struct diu __iomem *hw = data->diu_reg;
- if (machine_data->fb_enabled) {
+ if (data->fb_enabled) {
out_be32(&hw->diu_mode, 0);
- machine_data->fb_enabled = 0;
+ data->fb_enabled = 0;
}
}
@@ -641,14 +641,14 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var,
struct fb_info *info)
{
struct mfb_info *lower_aoi_mfbi, *upper_aoi_mfbi, *mfbi = info->par;
- struct fsl_diu_data *machine_data = mfbi->parent;
+ struct fsl_diu_data *data = mfbi->parent;
int available_height, upper_aoi_bottom;
enum mfb_index index = mfbi->index;
int lower_aoi_is_open, upper_aoi_is_open;
__u32 base_plane_width, base_plane_height, upper_aoi_height;
- base_plane_width = machine_data->fsl_diu_info[0].var.xres;
- base_plane_height = machine_data->fsl_diu_info[0].var.yres;
+ base_plane_width = data->fsl_diu_info[0].var.xres;
+ base_plane_height = data->fsl_diu_info[0].var.yres;
if (mfbi->x_aoi_d < 0)
mfbi->x_aoi_d = 0;
@@ -663,7 +663,7 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var,
break;
case PLANE1_AOI0:
case PLANE2_AOI0:
- lower_aoi_mfbi = machine_data->fsl_diu_info[index+1].par;
+ lower_aoi_mfbi = data->fsl_diu_info[index+1].par;
lower_aoi_is_open = lower_aoi_mfbi->count > 0 ? 1 : 0;
if (var->xres > base_plane_width)
var->xres = base_plane_width;
@@ -681,9 +681,8 @@ static void adjust_aoi_size_position(struct fb_var_screeninfo *var,
break;
case PLANE1_AOI1:
case PLANE2_AOI1:
- upper_aoi_mfbi = machine_data->fsl_diu_info[index-1].par;
- upper_aoi_height - machine_data->fsl_diu_info[index-1].var.yres;
+ upper_aoi_mfbi = data->fsl_diu_info[index-1].par;
+ upper_aoi_height = data->fsl_diu_info[index-1].var.yres;
upper_aoi_bottom = upper_aoi_mfbi->y_aoi_d + upper_aoi_height;
upper_aoi_is_open = upper_aoi_mfbi->count > 0 ? 1 : 0;
if (var->xres > base_plane_width)
@@ -823,17 +822,17 @@ static void update_lcdc(struct fb_info *info)
{
struct fb_var_screeninfo *var = &info->var;
struct mfb_info *mfbi = info->par;
- struct fsl_diu_data *machine_data = mfbi->parent;
+ struct fsl_diu_data *data = mfbi->parent;
struct diu __iomem *hw;
int i, j;
u8 *gamma_table_base;
u32 temp;
- hw = machine_data->diu_reg;
+ hw = data->diu_reg;
- diu_ops.set_monitor_port(machine_data->monitor_port);
- gamma_table_base = machine_data->gamma;
+ diu_ops.set_monitor_port(data->monitor_port);
+ gamma_table_base = data->gamma;
/* Prep for DIU init - gamma table, cursor table */
@@ -841,15 +840,14 @@ static void update_lcdc(struct fb_info *info)
for (j = 0; j <= 255; j++)
*gamma_table_base++ = j;
- diu_ops.set_gamma_table(machine_data->monitor_port,
- machine_data->gamma);
+ diu_ops.set_gamma_table(data->monitor_port, data->gamma);
disable_lcdc(info);
/* Program DIU registers */
- out_be32(&hw->gamma, DMA_ADDR(machine_data, gamma));
- out_be32(&hw->cursor, DMA_ADDR(machine_data, cursor));
+ out_be32(&hw->gamma, DMA_ADDR(data, gamma));
+ out_be32(&hw->cursor, DMA_ADDR(data, cursor));
out_be32(&hw->bgnd, 0x007F7F7F); /* BGND */
out_be32(&hw->bgnd_wb, 0); /* BGND_WB */
@@ -940,11 +938,11 @@ static int fsl_diu_set_par(struct fb_info *info)
unsigned long len;
struct fb_var_screeninfo *var = &info->var;
struct mfb_info *mfbi = info->par;
- struct fsl_diu_data *machine_data = mfbi->parent;
+ struct fsl_diu_data *data = mfbi->parent;
struct diu_ad *ad = mfbi->ad;
struct diu __iomem *hw;
- hw = machine_data->diu_reg;
+ hw = data->diu_reg;
set_fix(info);
mfbi->cursor_reset = 1;
@@ -962,7 +960,7 @@ static int fsl_diu_set_par(struct fb_info *info)
}
}
- ad->pix_fmt = diu_ops.get_pixel_format(machine_data->monitor_port,
+ ad->pix_fmt = diu_ops.get_pixel_format(data->monitor_port,
var->bits_per_pixel);
ad->addr = cpu_to_le32(info->fix.smem_start);
ad->src_size_g_alpha = cpu_to_le32((var->yres_virtual << 12) |
@@ -1373,16 +1371,16 @@ static irqreturn_t fsl_diu_isr(int irq, void *dev_id)
return IRQ_NONE;
}
-static int request_irq_local(struct fsl_diu_data *machine_data)
+static int request_irq_local(struct fsl_diu_data *data)
{
- struct diu __iomem *hw = machine_data->diu_reg;
+ struct diu __iomem *hw = data->diu_reg;
u32 ints;
int ret;
/* Read to clear the status */
in_be32(&hw->int_status);
- ret = request_irq(machine_data->irq, fsl_diu_isr, 0, "fsl-diu-fb", hw);
+ ret = request_irq(data->irq, fsl_diu_isr, 0, "fsl-diu-fb", hw);
if (!ret) {
ints = INT_PARERR | INT_LS_BF_VS;
#if !defined(CONFIG_NOT_COHERENT_CACHE)
@@ -1397,14 +1395,14 @@ static int request_irq_local(struct fsl_diu_data *machine_data)
return ret;
}
-static void free_irq_local(struct fsl_diu_data *machine_data)
+static void free_irq_local(struct fsl_diu_data *data)
{
- struct diu __iomem *hw = machine_data->diu_reg;
+ struct diu __iomem *hw = data->diu_reg;
/* Disable all LCDC interrupt */
out_be32(&hw->int_mask, 0x1f);
- free_irq(machine_data->irq, NULL);
+ free_irq(data->irq, NULL);
}
#ifdef CONFIG_PM
@@ -1414,20 +1412,20 @@ static void free_irq_local(struct fsl_diu_data *machine_data)
*/
static int fsl_diu_suspend(struct platform_device *ofdev, pm_message_t state)
{
- struct fsl_diu_data *machine_data;
+ struct fsl_diu_data *data;
- machine_data = dev_get_drvdata(&ofdev->dev);
- disable_lcdc(machine_data->fsl_diu_info[0]);
+ data = dev_get_drvdata(&ofdev->dev);
+ disable_lcdc(data->fsl_diu_info[0]);
return 0;
}
static int fsl_diu_resume(struct platform_device *ofdev)
{
- struct fsl_diu_data *machine_data;
+ struct fsl_diu_data *data;
- machine_data = dev_get_drvdata(&ofdev->dev);
- enable_lcdc(machine_data->fsl_diu_info[0]);
+ data = dev_get_drvdata(&ofdev->dev);
+ enable_lcdc(data->fsl_diu_info[0]);
return 0;
}
@@ -1441,20 +1439,20 @@ static ssize_t store_monitor(struct device *device,
struct device_attribute *attr, const char *buf, size_t count)
{
enum fsl_diu_monitor_port old_monitor_port;
- struct fsl_diu_data *machine_data + struct fsl_diu_data *data container_of(attr, struct fsl_diu_data, dev_attr);
- old_monitor_port = machine_data->monitor_port;
- machine_data->monitor_port = fsl_diu_name_to_port(buf);
+ old_monitor_port = data->monitor_port;
+ data->monitor_port = fsl_diu_name_to_port(buf);
- if (old_monitor_port != machine_data->monitor_port) {
+ if (old_monitor_port != data->monitor_port) {
/* All AOIs need adjust pixel format
* fsl_diu_set_par only change the pixsel format here
* unlikely to fail. */
unsigned int i;
for (i=0; i < NUM_AOIS; i++)
- fsl_diu_set_par(&machine_data->fsl_diu_info[i]);
+ fsl_diu_set_par(&data->fsl_diu_info[i]);
}
return count;
}
@@ -1462,10 +1460,10 @@ static ssize_t store_monitor(struct device *device,
static ssize_t show_monitor(struct device *device,
struct device_attribute *attr, char *buf)
{
- struct fsl_diu_data *machine_data + struct fsl_diu_data *data container_of(attr, struct fsl_diu_data, dev_attr);
- switch (machine_data->monitor_port) {
+ switch (data->monitor_port) {
case FSL_DIU_PORT_DVI:
return sprintf(buf, "DVI\n");
case FSL_DIU_PORT_LVDS:
@@ -1481,17 +1479,17 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
{
struct device_node *np = pdev->dev.of_node;
struct mfb_info *mfbi;
- struct fsl_diu_data *machine_data;
+ struct fsl_diu_data *data;
int diu_mode;
- dma_addr_t dma_addr; /* DMA addr of machine_data struct */
+ dma_addr_t dma_addr; /* DMA addr of fsl_diu_data struct */
unsigned int i;
int ret;
- machine_data = dma_alloc_coherent(&pdev->dev,
- sizeof(struct fsl_diu_data), &dma_addr, GFP_DMA | __GFP_ZERO);
- if (!machine_data)
+ data = dma_alloc_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
+ &dma_addr, GFP_DMA | __GFP_ZERO);
+ if (!data)
return -ENOMEM;
- machine_data->dma_addr = dma_addr;
+ data->dma_addr = dma_addr;
/*
* dma_alloc_coherent() uses a page allocator, so the address is
@@ -1500,33 +1498,33 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
* need to catch that. It's not worth the effort to handle unaligned
* alloctions now because it's highly unlikely to ever be a problem.
*/
- if ((unsigned long)machine_data & 31) {
+ if ((unsigned long)data & 31) {
dev_err(&pdev->dev, "misaligned allocation");
ret = -ENOMEM;
goto error;
}
- spin_lock_init(&machine_data->reg_lock);
+ spin_lock_init(&data->reg_lock);
for (i = 0; i < NUM_AOIS; i++) {
- struct fb_info *info = &machine_data->fsl_diu_info[i];
+ struct fb_info *info = &data->fsl_diu_info[i];
info->device = &pdev->dev;
- info->par = &machine_data->mfb[i];
+ info->par = &data->mfb[i];
/*
* We store the physical address of the AD in the reserved
* 'paddr' field of the AD itself.
*/
- machine_data->ad[i].paddr = DMA_ADDR(machine_data, ad[i]);
+ data->ad[i].paddr = DMA_ADDR(data, ad[i]);
info->fix.smem_start = 0;
/* Initialize the AOI data structure */
mfbi = info->par;
memcpy(mfbi, &mfb_template[i], sizeof(struct mfb_info));
- mfbi->parent = machine_data;
- mfbi->ad = &machine_data->ad[i];
+ mfbi->parent = data;
+ mfbi->ad = &data->ad[i];
if (mfbi->index = PLANE0) {
const u8 *prop;
@@ -1540,104 +1538,102 @@ static int __devinit fsl_diu_probe(struct platform_device *pdev)
}
}
- machine_data->diu_reg = of_iomap(np, 0);
- if (!machine_data->diu_reg) {
+ data->diu_reg = of_iomap(np, 0);
+ if (!data->diu_reg) {
dev_err(&pdev->dev, "cannot map DIU registers\n");
ret = -EFAULT;
goto error;
}
- diu_mode = in_be32(&machine_data->diu_reg->diu_mode);
+ diu_mode = in_be32(&data->diu_reg->diu_mode);
if (diu_mode = MFB_MODE0)
- out_be32(&machine_data->diu_reg->diu_mode, 0); /* disable DIU */
+ out_be32(&data->diu_reg->diu_mode, 0); /* disable DIU */
/* Get the IRQ of the DIU */
- machine_data->irq = irq_of_parse_and_map(np, 0);
+ data->irq = irq_of_parse_and_map(np, 0);
- if (!machine_data->irq) {
+ if (!data->irq) {
dev_err(&pdev->dev, "could not get DIU IRQ\n");
ret = -EINVAL;
goto error;
}
- machine_data->monitor_port = monitor_port;
+ data->monitor_port = monitor_port;
/* Initialize the dummy Area Descriptor */
- machine_data->dummy_ad.addr - cpu_to_le32(DMA_ADDR(machine_data, dummy_aoi));
- machine_data->dummy_ad.pix_fmt = 0x88882317;
- machine_data->dummy_ad.src_size_g_alpha = cpu_to_le32((4 << 12) | 4);
- machine_data->dummy_ad.aoi_size = cpu_to_le32((4 << 16) | 2);
- machine_data->dummy_ad.offset_xyi = 0;
- machine_data->dummy_ad.offset_xyd = 0;
- machine_data->dummy_ad.next_ad = 0;
- machine_data->dummy_ad.paddr = DMA_ADDR(machine_data, dummy_ad);
+ data->dummy_ad.addr = cpu_to_le32(DMA_ADDR(data, dummy_aoi));
+ data->dummy_ad.pix_fmt = 0x88882317;
+ data->dummy_ad.src_size_g_alpha = cpu_to_le32((4 << 12) | 4);
+ data->dummy_ad.aoi_size = cpu_to_le32((4 << 16) | 2);
+ data->dummy_ad.offset_xyi = 0;
+ data->dummy_ad.offset_xyd = 0;
+ data->dummy_ad.next_ad = 0;
+ data->dummy_ad.paddr = DMA_ADDR(data, dummy_ad);
/*
* Let DIU display splash screen if it was pre-initialized
* by the bootloader, set dummy area descriptor otherwise.
*/
if (diu_mode = MFB_MODE0)
- out_be32(&machine_data->diu_reg->desc[0],
- machine_data->dummy_ad.paddr);
+ out_be32(&data->diu_reg->desc[0], data->dummy_ad.paddr);
- out_be32(&machine_data->diu_reg->desc[1], machine_data->dummy_ad.paddr);
- out_be32(&machine_data->diu_reg->desc[2], machine_data->dummy_ad.paddr);
+ out_be32(&data->diu_reg->desc[1], data->dummy_ad.paddr);
+ out_be32(&data->diu_reg->desc[2], data->dummy_ad.paddr);
for (i = 0; i < NUM_AOIS; i++) {
- ret = install_fb(&machine_data->fsl_diu_info[i]);
+ ret = install_fb(&data->fsl_diu_info[i]);
if (ret) {
dev_err(&pdev->dev, "could not register fb %d\n", i);
goto error;
}
}
- if (request_irq_local(machine_data)) {
+ if (request_irq_local(data)) {
dev_err(&pdev->dev, "could not claim irq\n");
goto error;
}
- sysfs_attr_init(&machine_data->dev_attr.attr);
- machine_data->dev_attr.attr.name = "monitor";
- machine_data->dev_attr.attr.mode = S_IRUGO|S_IWUSR;
- machine_data->dev_attr.show = show_monitor;
- machine_data->dev_attr.store = store_monitor;
- ret = device_create_file(&pdev->dev, &machine_data->dev_attr);
+ sysfs_attr_init(&data->dev_attr.attr);
+ data->dev_attr.attr.name = "monitor";
+ data->dev_attr.attr.mode = S_IRUGO|S_IWUSR;
+ data->dev_attr.show = show_monitor;
+ data->dev_attr.store = store_monitor;
+ ret = device_create_file(&pdev->dev, &data->dev_attr);
if (ret) {
dev_err(&pdev->dev, "could not create sysfs file %s\n",
- machine_data->dev_attr.attr.name);
+ data->dev_attr.attr.name);
}
- dev_set_drvdata(&pdev->dev, machine_data);
+ dev_set_drvdata(&pdev->dev, data);
return 0;
error:
for (i = 0; i < NUM_AOIS; i++)
- uninstall_fb(&machine_data->fsl_diu_info[i]);
+ uninstall_fb(&data->fsl_diu_info[i]);
- iounmap(machine_data->diu_reg);
+ iounmap(data->diu_reg);
- dma_free_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
- machine_data, machine_data->dma_addr);
+ dma_free_coherent(&pdev->dev, sizeof(struct fsl_diu_data), data,
+ data->dma_addr);
return ret;
}
static int fsl_diu_remove(struct platform_device *pdev)
{
- struct fsl_diu_data *machine_data;
+ struct fsl_diu_data *data;
int i;
- machine_data = dev_get_drvdata(&pdev->dev);
- disable_lcdc(&machine_data->fsl_diu_info[0]);
- free_irq_local(machine_data);
+ data = dev_get_drvdata(&pdev->dev);
+ disable_lcdc(&data->fsl_diu_info[0]);
+ free_irq_local(data);
for (i = 0; i < NUM_AOIS; i++)
- uninstall_fb(&machine_data->fsl_diu_info[i]);
+ uninstall_fb(&data->fsl_diu_info[i]);
- iounmap(machine_data->diu_reg);
+ iounmap(data->diu_reg);
- dma_free_coherent(&pdev->dev, sizeof(struct fsl_diu_data),
- machine_data, machine_data->dma_addr);
+ dma_free_coherent(&pdev->dev, sizeof(struct fsl_diu_data), data,
+ data->dma_addr);
return 0;
}
--
1.7.3.4
^ permalink raw reply related
* Final Notice
From: Y/Msn @ 2011-12-08 16:54 UTC (permalink / raw)
To: linux-fbdev
Dear Internet User!
Congratulations! you and your family have won 500,000 GBP from the
Microsoft Family Benefit 2011 for being a regular web user.Your winnings
has been
submitted to BARCLAYS BANK OF SCOTLAND. Contact the Bank with your full
info for claims.:
Send mail to the Transfer Manager:
Transfer Manager: Robert Williams
Email: barclays_transfer_group_dept@hotmail.com
Bank Name: Barclays Bank Of Scotland
1.Name:
2.Address:
3.Telephone Number:
4.Sex:
Account Name:
Account Number:
Bank Name:
Please use this as a subject of contact : TRANSFER/NUM/1090.
Congratulations!!!
Microsoft Window
^ permalink raw reply
* [PATCH] video: s3c-fb: add shadow register protect
From: Jingoo Han @ 2011-12-08 9:08 UTC (permalink / raw)
To: linux-fbdev
Shadow registers should be protectd whenever the registers are
updated. Shadow registers are updated after SHADOWCON shadow
register is cleared.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
---
drivers/video/s3c-fb.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c
index e84677e..e04c2ab 100644
--- a/drivers/video/s3c-fb.c
+++ b/drivers/video/s3c-fb.c
@@ -811,12 +811,16 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
case FB_BLANK_NORMAL:
/* disable the DMA and display 0x0 (black) */
+ shadow_protect_win(win, 1);
writel(WINxMAP_MAP | WINxMAP_MAP_COLOUR(0x0),
sfb->regs + sfb->variant.winmap + (index * 4));
+ shadow_protect_win(win, 0);
break;
case FB_BLANK_UNBLANK:
+ shadow_protect_win(win, 1);
writel(0x0, sfb->regs + sfb->variant.winmap + (index * 4));
+ shadow_protect_win(win, 0);
wincon |= WINCONx_ENWIN;
sfb->enabled |= (1 << index);
break;
@@ -827,7 +831,9 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
return 1;
}
+ shadow_protect_win(win, 1);
writel(wincon, sfb->regs + sfb->variant.wincon + (index * 4));
+ shadow_protect_win(win, 0);
/* Check the enabled state to see if we need to be running the
* main LCD interface, as if there are no active windows then
@@ -846,8 +852,11 @@ static int s3c_fb_blank(int blank_mode, struct fb_info *info)
/* we're stuck with this until we can do something about overriding
* the power control using the blanking event for a single fb.
*/
- if (index = sfb->pdata->default_win)
+ if (index = sfb->pdata->default_win) {
+ shadow_protect_win(win, 1);
s3c_fb_enable(sfb, blank_mode != FB_BLANK_POWERDOWN ? 1 : 0);
+ shadow_protect_win(win, 0);
+ }
return 0;
}
@@ -1572,10 +1581,15 @@ static int s3c_fb_resume(struct device *dev)
for (win_no = 0; win_no < sfb->variant.nr_windows - 1; win_no++) {
void __iomem *regs = sfb->regs + sfb->variant.keycon;
+ win = sfb->windows[win_no];
+ if (!win)
+ continue;
+ shadow_protect_win(win, 1);
regs += (win_no * 8);
writel(0xffffff, regs + WKEYCON0);
writel(0xffffff, regs + WKEYCON1);
+ shadow_protect_win(win, 0);
}
/* restore framebuffers */
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 63/65] OMAPDSS: APPLY: add checking of ovls/mgrs
From: Tomi Valkeinen @ 2011-12-08 8:29 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-fbdev, linux-omap, archit
In-Reply-To: <4EDF64AF.6040008@ti.com>
[-- Attachment #1: Type: text/plain, Size: 984 bytes --]
On Wed, 2011-12-07 at 18:35 +0530, Archit Taneja wrote:
> Hi,
>
> On Tuesday 22 November 2011 02:52 PM, Tomi Valkeinen wrote:
> > Add checks for overlay and manager settings. The checks are a bit
> > complex, as we need to observe the bigger picture instead of overlays
> > and managers independently. Things like the used display and the zorder
> > of other overlays affect the validity of the settings.
>
> Minor comment:
>
> dss_ovl_check, dss_mgr_check and dss_mgr_check_zorder don't really
> qualify as functions which do actual applying of configurations, they
> could be moved from apply.c to manager.c and overlay.c.
I had the check functions in apply.c because they used apply.c's
internal datastructures.
However, looking the functions now, only dss_mgr_check_zorder() used the
internal datas, and the function doesn't even use those variables for
anything =).
So you're right, they can be moved to manager.c and overlay.c, thanks.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* [PATCH v4] Resurrect Intel740 driver: i740fb
From: Ondrej Zary @ 2011-12-07 23:24 UTC (permalink / raw)
To: linux-fbdev
Cc: Florian Tobias Schandinat, Paul Mundt, Kernel development list
This is a resurrection of an old (like 2.4.19) out-of-tree driver for
Intel740 graphics cards and modify it for recent kernels. The old driver is
located at: http://sourceforge.net/projects/i740fbdev/files/
This is a new driver based on skeletonfb, using most of the low level HW code
from the old driver. The DDC code is completely new.
The driver was tested on two 8MB cards: Protac AG240D and Diamond Stealth II
G460.
Signed-off-by: Ondrej Zary <linux@rainbow-software.org>
---
Changes in v4:
- shortened many lines to fit 80-char limit
- removed useless inb_p and outb_p functions
- converted DDC (and some other) code to i740outreg_mask
- removed useless wm initialization in i740_calc_fifo()
- ALIGN macro is used instead of manual alignment
- removed inactive code
- simplified i740_setcolreg()
- info->var used for panning
- fixed out-of-video-memory checking
--- linux-3.1-orig/drivers/video/Kconfig 2011-10-24 09:10:05.000000000 +0200
+++ linux-3.1/drivers/video/Kconfig 2011-10-28 20:42:33.000000000 +0200
@@ -1114,6 +1114,17 @@ config FB_RIVA_BACKLIGHT
help
Say Y here if you want to control the backlight of your display.
+config FB_I740
+ tristate "Intel740 support (EXPERIMENTAL)"
+ depends on EXPERIMENTAL && FB && PCI
+ select FB_MODE_HELPERS
+ select FB_CFB_FILLRECT
+ select FB_CFB_COPYAREA
+ select FB_CFB_IMAGEBLIT
+ select VGASTATE
+ help
+ This driver supports graphics cards based on Intel740 chip.
+
config FB_I810
tristate "Intel 810/815 support (EXPERIMENTAL)"
depends on EXPERIMENTAL && FB && PCI && X86_32 && AGP_INTEL
--- linux-3.1-orig/drivers/video/Makefile 2011-10-24 09:10:05.000000000 +0200
+++ linux-3.1/drivers/video/Makefile 2011-10-28 22:43:32.000000000 +0200
@@ -36,6 +36,7 @@ obj-$(CONFIG_FB_CYBER2000) += cyb
obj-$(CONFIG_FB_PM2) += pm2fb.o
obj-$(CONFIG_FB_PM3) += pm3fb.o
+obj-$(CONFIG_FB_I740) += i740fb.o
obj-$(CONFIG_FB_MATROX) += matrox/
obj-$(CONFIG_FB_RIVA) += riva/
obj-$(CONFIG_FB_NVIDIA) += nvidia/
--- /dev/null 2011-12-08 00:02:00.479903436 +0100
+++ linux-3.1/drivers/video/i740fb.c 2011-12-07 23:57:43.000000000 +0100
@@ -0,0 +1,1283 @@
+/*
+ * i740fb - framebuffer driver for Intel740
+ * Copyright (c) 2011 Ondrej Zary
+ *
+ * Based on old i740fb driver (c) 2001-2002 Andrey Ulanov <drey@rt.mipt.ru>
+ * which was partially based on:
+ * VGA 16-color framebuffer driver (c) 1999 Ben Pfaff <pfaffben@debian.org>
+ * and Petr Vandrovec <VANDROVE@vc.cvut.cz>
+ * i740 driver from XFree86 (c) 1998-1999 Precision Insight, Inc., Cedar Park,
+ * Texas.
+ * i740fb by Patrick LERDA, v0.9
+ */
+
+#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/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/pci_ids.h>
+#include <linux/i2c.h>
+#include <linux/i2c-algo-bit.h>
+#include <linux/console.h>
+#include <video/vga.h>
+
+#ifdef CONFIG_MTRR
+#include <asm/mtrr.h>
+#endif
+
+#include "i740_reg.h"
+
+static char *mode_option __devinitdata;
+
+#ifdef CONFIG_MTRR
+static int mtrr __devinitdata = 1;
+#endif
+
+struct i740fb_par {
+ unsigned char __iomem *regs;
+ bool has_sgram;
+#ifdef CONFIG_MTRR
+ int mtrr_reg;
+#endif
+ bool ddc_registered;
+ struct i2c_adapter ddc_adapter;
+ struct i2c_algo_bit_data ddc_algo;
+ u32 pseudo_palette[16];
+ struct mutex open_lock;
+ unsigned int ref_count;
+
+ u8 crtc[VGA_CRT_C];
+ u8 atc[VGA_ATT_C];
+ u8 gdc[VGA_GFX_C];
+ u8 seq[VGA_SEQ_C];
+ u8 misc;
+ u8 vss;
+
+ /* i740 specific registers */
+ u8 display_cntl;
+ u8 pixelpipe_cfg0;
+ u8 pixelpipe_cfg1;
+ u8 pixelpipe_cfg2;
+ u8 video_clk2_m;
+ u8 video_clk2_n;
+ u8 video_clk2_mn_msbs;
+ u8 video_clk2_div_sel;
+ u8 pll_cntl;
+ u8 address_mapping;
+ u8 io_cntl;
+ u8 bitblt_cntl;
+ u8 ext_vert_total;
+ u8 ext_vert_disp_end;
+ u8 ext_vert_sync_start;
+ u8 ext_vert_blank_start;
+ u8 ext_horiz_total;
+ u8 ext_horiz_blank;
+ u8 ext_offset;
+ u8 interlace_cntl;
+ u32 lmi_fifo_watermark;
+ u8 ext_start_addr;
+ u8 ext_start_addr_hi;
+};
+
+#define DACSPEED8 203
+#define DACSPEED16 163
+#define DACSPEED24_SG 136
+#define DACSPEED24_SD 128
+#define DACSPEED32 86
+
+static struct fb_fix_screeninfo i740fb_fix __devinitdata = {
+ .id = "i740fb",
+ .type = FB_TYPE_PACKED_PIXELS,
+ .visual = FB_VISUAL_TRUECOLOR,
+ .xpanstep = 8,
+ .ypanstep = 1,
+ .accel = FB_ACCEL_NONE,
+};
+
+static inline void i740outb(struct i740fb_par *par, u16 port, u8 val)
+{
+ vga_mm_w(par->regs, port, val);
+}
+static inline u8 i740inb(struct i740fb_par *par, u16 port)
+{
+ return vga_mm_r(par->regs, port);
+}
+static inline void i740outreg(struct i740fb_par *par, u16 port, u8 reg, u8 val)
+{
+ vga_mm_w_fast(par->regs, port, reg, val);
+}
+static inline u8 i740inreg(struct i740fb_par *par, u16 port, u8 reg)
+{
+ vga_mm_w(par->regs, port, reg);
+ return vga_mm_r(par->regs, port+1);
+}
+static inline void i740outreg_mask(struct i740fb_par *par, u16 port, u8 reg,
+ u8 val, u8 mask)
+{
+ vga_mm_w_fast(par->regs, port, reg, (val & mask)
+ | (i740inreg(par, port, reg) & ~mask));
+}
+
+#define REG_DDC_DRIVE 0x62
+#define REG_DDC_STATE 0x63
+#define DDC_SCL (1 << 3)
+#define DDC_SDA (1 << 2)
+
+static void i740fb_ddc_setscl(void *data, int val)
+{
+ struct i740fb_par *par = data;
+
+ i740outreg_mask(par, XRX, REG_DDC_DRIVE, DDC_SCL, DDC_SCL);
+ i740outreg_mask(par, XRX, REG_DDC_STATE, val ? DDC_SCL : 0, DDC_SCL);
+}
+
+static void i740fb_ddc_setsda(void *data, int val)
+{
+ struct i740fb_par *par = data;
+
+ i740outreg_mask(par, XRX, REG_DDC_DRIVE, DDC_SDA, DDC_SDA);
+ i740outreg_mask(par, XRX, REG_DDC_STATE, val ? DDC_SDA : 0, DDC_SDA);
+}
+
+static int i740fb_ddc_getscl(void *data)
+{
+ struct i740fb_par *par = data;
+
+ i740outreg_mask(par, XRX, REG_DDC_DRIVE, 0, DDC_SCL);
+
+ return !!(i740inreg(par, XRX, REG_DDC_STATE) & DDC_SCL);
+}
+
+static int i740fb_ddc_getsda(void *data)
+{
+ struct i740fb_par *par = data;
+
+ i740outreg_mask(par, XRX, REG_DDC_DRIVE, 0, DDC_SDA);
+
+ return !!(i740inreg(par, XRX, REG_DDC_STATE) & DDC_SDA);
+}
+
+static int __devinit i740fb_setup_ddc_bus(struct fb_info *info)
+{
+ struct i740fb_par *par = info->par;
+
+ strlcpy(par->ddc_adapter.name, info->fix.id,
+ sizeof(par->ddc_adapter.name));
+ par->ddc_adapter.owner = THIS_MODULE;
+ par->ddc_adapter.class = I2C_CLASS_DDC;
+ par->ddc_adapter.algo_data = &par->ddc_algo;
+ par->ddc_adapter.dev.parent = info->device;
+ par->ddc_algo.setsda = i740fb_ddc_setsda;
+ par->ddc_algo.setscl = i740fb_ddc_setscl;
+ par->ddc_algo.getsda = i740fb_ddc_getsda;
+ par->ddc_algo.getscl = i740fb_ddc_getscl;
+ par->ddc_algo.udelay = 10;
+ par->ddc_algo.timeout = 20;
+ par->ddc_algo.data = par;
+
+ i2c_set_adapdata(&par->ddc_adapter, par);
+
+ return i2c_bit_add_bus(&par->ddc_adapter);
+}
+
+static int i740fb_open(struct fb_info *info, int user)
+{
+ struct i740fb_par *par = info->par;
+
+ mutex_lock(&(par->open_lock));
+ par->ref_count++;
+ mutex_unlock(&(par->open_lock));
+
+ return 0;
+}
+
+static int i740fb_release(struct fb_info *info, int user)
+{
+ struct i740fb_par *par = info->par;
+
+ mutex_lock(&(par->open_lock));
+ if (par->ref_count = 0) {
+ printk(KERN_ERR "fb%d: release called with zero refcount\n",
+ info->node);
+ mutex_unlock(&(par->open_lock));
+ return -EINVAL;
+ }
+
+ par->ref_count--;
+ mutex_unlock(&(par->open_lock));
+
+ return 0;
+}
+
+static u32 i740_calc_fifo(struct i740fb_par *par, u32 freq, int bpp)
+{
+ /*
+ * Would like to calculate these values automatically, but a generic
+ * algorithm does not seem possible. Note: These FIFO water mark
+ * values were tested on several cards and seem to eliminate the
+ * all of the snow and vertical banding, but fine adjustments will
+ * probably be required for other cards.
+ */
+
+ u32 wm;
+
+ switch (bpp) {
+ case 8:
+ if (freq > 200) wm = 0x18120000;
+ else if (freq > 175) wm = 0x16110000;
+ else if (freq > 135) wm = 0x120E0000;
+ else wm = 0x100D0000;
+ break;
+ case 15:
+ case 16:
+ if (par->has_sgram) {
+ if (freq > 140) wm = 0x2C1D0000;
+ else if (freq > 120) wm = 0x2C180000;
+ else if (freq > 100) wm = 0x24160000;
+ else if (freq > 90) wm = 0x18120000;
+ else if (freq > 50) wm = 0x16110000;
+ else if (freq > 32) wm = 0x13100000;
+ else wm = 0x120E0000;
+ } else {
+ if (freq > 160) wm = 0x28200000;
+ else if (freq > 140) wm = 0x2A1E0000;
+ else if (freq > 130) wm = 0x2B1A0000;
+ else if (freq > 120) wm = 0x2C180000;
+ else if (freq > 100) wm = 0x24180000;
+ else if (freq > 90) wm = 0x18120000;
+ else if (freq > 50) wm = 0x16110000;
+ else if (freq > 32) wm = 0x13100000;
+ else wm = 0x120E0000;
+ }
+ break;
+ case 24:
+ if (par->has_sgram) {
+ if (freq > 130) wm = 0x31200000;
+ else if (freq > 120) wm = 0x2E200000;
+ else if (freq > 100) wm = 0x2C1D0000;
+ else if (freq > 80) wm = 0x25180000;
+ else if (freq > 64) wm = 0x24160000;
+ else if (freq > 49) wm = 0x18120000;
+ else if (freq > 32) wm = 0x16110000;
+ else wm = 0x13100000;
+ } else {
+ if (freq > 120) wm = 0x311F0000;
+ else if (freq > 100) wm = 0x2C1D0000;
+ else if (freq > 80) wm = 0x25180000;
+ else if (freq > 64) wm = 0x24160000;
+ else if (freq > 49) wm = 0x18120000;
+ else if (freq > 32) wm = 0x16110000;
+ else wm = 0x13100000;
+ }
+ break;
+ case 32:
+ if (par->has_sgram) {
+ if (freq > 80) wm = 0x2A200000;
+ else if (freq > 60) wm = 0x281A0000;
+ else if (freq > 49) wm = 0x25180000;
+ else if (freq > 32) wm = 0x18120000;
+ else wm = 0x16110000;
+ } else {
+ if (freq > 80) wm = 0x29200000;
+ else if (freq > 60) wm = 0x281A0000;
+ else if (freq > 49) wm = 0x25180000;
+ else if (freq > 32) wm = 0x18120000;
+ else wm = 0x16110000;
+ }
+ break;
+ }
+
+ return wm;
+}
+
+/* clock calculation from i740fb by Patrick LERDA */
+
+#define I740_RFREQ (1e6)
+#define TARGET_MAX_N 30
+
+#define I740_FFIX 8
+#define I740_REF_FREQ (u32) (66.66666666667 * (1 << I740_FFIX) + 0.5)
+#define I740_MAX_VCO_FREQ (u32)(450.00000000000 * (1 << I740_FFIX) + 0.5)
+
+#define I740_CALC_VCLKfix(m, n, p, d) ((((((m) * I740_REF_FREQ * (4 << ((d) << 1)))) / (n)) + ((1 << (p)) / 2)) / (1 << (p)))
+
+static void i740_calc_vclk(u32 freq_hz, struct i740fb_par *par)
+{
+ u32 freq = freq_hz / (u32)(1e6 / I740_RFREQ);
+ const u32 err_max + freq / (u32)(I740_RFREQ / 0.005 / (1 << I740_FFIX) + 0.5);
+ const u32 err_target + freq / (u32)(I740_RFREQ / 0.001 / (1 << I740_FFIX) + 0.5);
+ u32 err_best = (u32)(512.0 * (1 << I740_FFIX));
+ u32 f_err, f_vco;
+ int m_best = 0, n_best = 0, p_best = 0, d_best = 0;
+ int m, n, i;
+
+ /* find log2(MAX_VCO_FREQ/f_target) */
+ for (i = 0; i < 16; i++)
+ if ((I740_MAX_VCO_FREQ) / (1 << i) < freq / (u32)(I740_RFREQ / (1 << I740_FFIX)))
+ break;
+ i--;
+ p_best = i;
+
+ d_best = 0;
+ f_vco = (freq * (1 << p_best)) / (u32)(I740_RFREQ / (1 << I740_FFIX));
+ freq = freq / (u32)(I740_RFREQ / (1 << I740_FFIX));
+
+ n = 2;
+ do {
+ n++;
+ m = ((f_vco * n) / I740_REF_FREQ + 2) / 4;
+
+ if (m < 3)
+ m = 3;
+
+ {
+ u32 f_out = I740_CALC_VCLKfix(m, n, p_best, d_best);
+
+ f_err = (freq - f_out);
+
+ if (abs(f_err) < err_max) {
+ m_best = m;
+ n_best = n;
+ err_best = f_err;
+ }
+ }
+ } while ((abs(f_err) >= err_target) &&
+ ((n <= TARGET_MAX_N) || (abs(err_best) > err_max)));
+
+ if (abs(f_err) < err_target) {
+ m_best = m;
+ n_best = n;
+ }
+
+ par->video_clk2_m = (m_best-2) & 0xFF;
+ par->video_clk2_n = (n_best-2) & 0xFF;
+ par->video_clk2_mn_msbs = ((((n_best-2) >> 4) & VCO_N_MSBS)
+ | (((m_best-2) >> 8) & VCO_M_MSBS));
+ par->video_clk2_div_sel + ((p_best << 4) | (d_best ? 4 : 0) | REF_DIV_1);
+}
+
+static int i740fb_decode_var(const struct fb_var_screeninfo *var,
+ struct i740fb_par *par, struct fb_info *info)
+{
+ /*
+ * Get the video params out of 'var'.
+ * If a value doesn't fit, round it up, if it's too big, return -EINVAL.
+ */
+
+ u32 xres, right, hslen, left, xtotal;
+ u32 yres, lower, vslen, upper, ytotal;
+ u32 vxres, xoffset, vyres, yoffset;
+ u32 bpp, base, dacspeed24, mem;
+ u8 r7;
+ int i;
+
+ dev_dbg(info->device, "decode_var: xres: %i, yres: %i, xres_v: %i, xres_v: %i\n",
+ var->xres, var->yres, var->xres_virtual, var->xres_virtual);
+ dev_dbg(info->device, " xoff: %i, yoff: %i, bpp: %i, graysc: %i\n",
+ var->xoffset, var->yoffset, var->bits_per_pixel,
+ var->grayscale);
+ dev_dbg(info->device, " activate: %i, nonstd: %i, vmode: %i\n",
+ var->activate, var->nonstd, var->vmode);
+ dev_dbg(info->device, " pixclock: %i, hsynclen:%i, vsynclen:%i\n",
+ var->pixclock, var->hsync_len, var->vsync_len);
+ dev_dbg(info->device, " left: %i, right: %i, up:%i, lower:%i\n",
+ var->left_margin, var->right_margin, var->upper_margin,
+ var->lower_margin);
+
+
+ bpp = var->bits_per_pixel;
+ switch (bpp) {
+ case 1 ... 8:
+ bpp = 8;
+ if ((((u32)1e6) / var->pixclock) > DACSPEED8) {
+ dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 8bpp)\n",
+ 1000000 / var->pixclock, DACSPEED8);
+ return -EINVAL;
+ }
+ break;
+ case 9 ... 15:
+ bpp = 15;
+ case 16:
+ if ((((u32)1e6) / var->pixclock) > DACSPEED16) {
+ dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 15/16bpp)\n",
+ 1000000 / var->pixclock, DACSPEED16);
+ return -EINVAL;
+ }
+ break;
+ case 17 ... 24:
+ bpp = 24;
+ dacspeed24 = par->has_sgram ? DACSPEED24_SG : DACSPEED24_SD;
+ if ((((u32)1e6) / var->pixclock) > dacspeed24) {
+ dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 24bpp)\n",
+ 1000000 / var->pixclock, dacspeed24);
+ return -EINVAL;
+ }
+ break;
+ case 25 ... 32:
+ bpp = 32;
+ if ((((u32)1e6) / var->pixclock) > DACSPEED32) {
+ dev_err(info->device, "requested pixclock %i MHz out of range (max. %i MHz at 32bpp)\n",
+ 1000000 / var->pixclock, DACSPEED32);
+ return -EINVAL;
+ }
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ xres = ALIGN(var->xres, 8);
+ vxres = ALIGN(var->xres_virtual, 16);
+ if (vxres < xres)
+ vxres = xres;
+
+ xoffset = ALIGN(var->xoffset, 8);
+ if (xres + xoffset > vxres)
+ xoffset = vxres - xres;
+
+ left = ALIGN(var->left_margin, 8);
+ right = ALIGN(var->right_margin, 8);
+ hslen = ALIGN(var->hsync_len, 8);
+
+ yres = var->yres;
+ vyres = var->yres_virtual;
+ if (yres > vyres)
+ vyres = yres;
+
+ yoffset = var->yoffset;
+ if (yres + yoffset > vyres)
+ yoffset = vyres - yres;
+
+ lower = var->lower_margin;
+ vslen = var->vsync_len;
+ upper = var->upper_margin;
+
+ mem = vxres * vyres * ((bpp + 1) / 8);
+ if (mem > info->screen_size) {
+ dev_err(info->device, "not enough video memory (%d KB requested, %ld KB avaliable)\n",
+ mem >> 10, info->screen_size >> 10);
+ return -ENOMEM;
+ }
+
+ if (yoffset + yres > vyres)
+ yoffset = vyres - yres;
+
+ xtotal = xres + right + hslen + left;
+ ytotal = yres + lower + vslen + upper;
+
+ par->crtc[VGA_CRTC_H_TOTAL] = (xtotal >> 3) - 5;
+ par->crtc[VGA_CRTC_H_DISP] = (xres >> 3) - 1;
+ par->crtc[VGA_CRTC_H_BLANK_START] = ((xres + right) >> 3) - 1;
+ par->crtc[VGA_CRTC_H_SYNC_START] = (xres + right) >> 3;
+ par->crtc[VGA_CRTC_H_SYNC_END] = (((xres + right + hslen) >> 3) & 0x1F)
+ | ((((xres + right + hslen) >> 3) & 0x20) << 2);
+ par->crtc[VGA_CRTC_H_BLANK_END] = ((xres + right + hslen) >> 3 & 0x1F)
+ | 0x80;
+
+ par->crtc[VGA_CRTC_V_TOTAL] = ytotal - 2;
+
+ r7 = 0x10; /* disable linecompare */
+ if (ytotal & 0x100)
+ r7 |= 0x01;
+ if (ytotal & 0x200)
+ r7 |= 0x20;
+
+ par->crtc[VGA_CRTC_PRESET_ROW] = 0;
+ par->crtc[VGA_CRTC_MAX_SCAN] = 0x40; /* 1 scanline, no linecmp */
+ if (var->vmode & FB_VMODE_DOUBLE)
+ par->crtc[VGA_CRTC_MAX_SCAN] |= 0x80;
+ par->crtc[VGA_CRTC_CURSOR_START] = 0x00;
+ par->crtc[VGA_CRTC_CURSOR_END] = 0x00;
+ par->crtc[VGA_CRTC_CURSOR_HI] = 0x00;
+ par->crtc[VGA_CRTC_CURSOR_LO] = 0x00;
+ par->crtc[VGA_CRTC_V_DISP_END] = yres-1;
+ if ((yres-1) & 0x100)
+ r7 |= 0x02;
+ if ((yres-1) & 0x200)
+ r7 |= 0x40;
+
+ par->crtc[VGA_CRTC_V_BLANK_START] = yres + lower - 1;
+ par->crtc[VGA_CRTC_V_SYNC_START] = yres + lower - 1;
+ if ((yres + lower - 1) & 0x100)
+ r7 |= 0x0C;
+ if ((yres + lower - 1) & 0x200) {
+ par->crtc[VGA_CRTC_MAX_SCAN] |= 0x20;
+ r7 |= 0x80;
+ }
+
+ /* disabled IRQ */
+ par->crtc[VGA_CRTC_V_SYNC_END] = ((yres + lower - 1 + vslen) & 0x0F) & ~0x10;
+ /* 0x7F for VGA, but some SVGA chips require all 8 bits to be set */
+ par->crtc[VGA_CRTC_V_BLANK_END] = (yres + lower - 1 + vslen) & 0xFF;
+
+ par->crtc[VGA_CRTC_UNDERLINE] = 0x00;
+ par->crtc[VGA_CRTC_MODE] = 0xC3 ;
+ par->crtc[VGA_CRTC_LINE_COMPARE] = 0xFF;
+ par->crtc[VGA_CRTC_OVERFLOW] = r7;
+
+ par->vss = 0x00; /* 3DA */
+
+ for (i = 0x00; i < 0x10; i++)
+ par->atc[i] = i;
+ par->atc[VGA_ATC_MODE] = 0x81;
+ par->atc[VGA_ATC_OVERSCAN] = 0x00; /* 0 for EGA, 0xFF for VGA */
+ par->atc[VGA_ATC_PLANE_ENABLE] = 0x0F;
+ par->atc[VGA_ATC_COLOR_PAGE] = 0x00;
+
+ par->misc = 0xC3;
+ if (var->sync & FB_SYNC_HOR_HIGH_ACT)
+ par->misc &= ~0x40;
+ if (var->sync & FB_SYNC_VERT_HIGH_ACT)
+ par->misc &= ~0x80;
+
+ par->seq[VGA_SEQ_CLOCK_MODE] = 0x01;
+ par->seq[VGA_SEQ_PLANE_WRITE] = 0x0F;
+ par->seq[VGA_SEQ_CHARACTER_MAP] = 0x00;
+ par->seq[VGA_SEQ_MEMORY_MODE] = 0x06;
+
+ par->gdc[VGA_GFX_SR_VALUE] = 0x00;
+ par->gdc[VGA_GFX_SR_ENABLE] = 0x00;
+ par->gdc[VGA_GFX_COMPARE_VALUE] = 0x00;
+ par->gdc[VGA_GFX_DATA_ROTATE] = 0x00;
+ par->gdc[VGA_GFX_PLANE_READ] = 0;
+ par->gdc[VGA_GFX_MODE] = 0x02;
+ par->gdc[VGA_GFX_MISC] = 0x05;
+ par->gdc[VGA_GFX_COMPARE_MASK] = 0x0F;
+ par->gdc[VGA_GFX_BIT_MASK] = 0xFF;
+
+ base = (yoffset * vxres + (xoffset & ~7)) >> 2;
+ switch (bpp) {
+ case 8:
+ par->crtc[VGA_CRTC_OFFSET] = vxres >> 3;
+ par->ext_offset = vxres >> 11;
+ par->pixelpipe_cfg1 = DISPLAY_8BPP_MODE;
+ par->bitblt_cntl = COLEXP_8BPP;
+ break;
+ case 15: /* 0rrrrrgg gggbbbbb */
+ case 16: /* rrrrrggg gggbbbbb */
+ par->pixelpipe_cfg1 = (var->green.length = 6) ?
+ DISPLAY_16BPP_MODE : DISPLAY_15BPP_MODE;
+ par->crtc[VGA_CRTC_OFFSET] = vxres >> 2;
+ par->ext_offset = vxres >> 10;
+ par->bitblt_cntl = COLEXP_16BPP;
+ base *= 2;
+ break;
+ case 24:
+ par->crtc[VGA_CRTC_OFFSET] = (vxres * 3) >> 3;
+ par->ext_offset = (vxres * 3) >> 11;
+ par->pixelpipe_cfg1 = DISPLAY_24BPP_MODE;
+ par->bitblt_cntl = COLEXP_24BPP;
+ base &= 0xFFFFFFFE; /* ...ignore the last bit. */
+ base *= 3;
+ break;
+ case 32:
+ par->crtc[VGA_CRTC_OFFSET] = vxres >> 1;
+ par->ext_offset = vxres >> 9;
+ par->pixelpipe_cfg1 = DISPLAY_32BPP_MODE;
+ par->bitblt_cntl = COLEXP_RESERVED; /* Not implemented on i740 */
+ base *= 4;
+ break;
+ }
+
+ par->crtc[VGA_CRTC_START_LO] = base & 0x000000FF;
+ par->crtc[VGA_CRTC_START_HI] = (base & 0x0000FF00) >> 8;
+ par->ext_start_addr + ((base & 0x003F0000) >> 16) | EXT_START_ADDR_ENABLE;
+ par->ext_start_addr_hi = (base & 0x3FC00000) >> 22;
+
+ par->pixelpipe_cfg0 = DAC_8_BIT;
+
+ par->pixelpipe_cfg2 = DISPLAY_GAMMA_ENABLE | OVERLAY_GAMMA_ENABLE;
+ par->io_cntl = EXTENDED_CRTC_CNTL;
+ par->address_mapping = LINEAR_MODE_ENABLE | PAGE_MAPPING_ENABLE;
+ par->display_cntl = HIRES_MODE;
+
+ /* Set the MCLK freq */
+ par->pll_cntl = PLL_MEMCLK_100000KHZ; /* 100 MHz -- use as default */
+
+ /* Calculate the extended CRTC regs */
+ par->ext_vert_total = (ytotal - 2) >> 8;
+ par->ext_vert_disp_end = (yres - 1) >> 8;
+ par->ext_vert_sync_start = (yres + lower) >> 8;
+ par->ext_vert_blank_start = (yres + lower) >> 8;
+ par->ext_horiz_total = ((xtotal >> 3) - 5) >> 8;
+ par->ext_horiz_blank = (((xres + right) >> 3) & 0x40) >> 6;
+
+ par->interlace_cntl = INTERLACE_DISABLE;
+
+ /* Set the overscan color to 0. (NOTE: This only affects >8bpp mode) */
+ par->atc[VGA_ATC_OVERSCAN] = 0;
+
+ /* Calculate VCLK that most closely matches the requested dot clock */
+ i740_calc_vclk((((u32)1e9) / var->pixclock) * (u32)(1e3), par);
+
+ /* Since we program the clocks ourselves, always use VCLK2. */
+ par->misc |= 0x0C;
+
+ /* Calculate the FIFO Watermark and Burst Length. */
+ par->lmi_fifo_watermark + i740_calc_fifo(par, ((int)1e6) / var->pixclock, bpp);
+
+ return 0;
+}
+
+static int i740fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+ switch (var->bits_per_pixel) {
+ case 8:
+ var->red.offset = var->green.offset = var->blue.offset = 0;
+ var->red.length = var->green.length = var->blue.length = 8;
+ break;
+ case 16:
+ switch (var->green.length) {
+ default:
+ case 5:
+ var->red.offset = 10;
+ var->green.offset = 5;
+ var->blue.offset = 0;
+ var->red.length = var->blue.length = 5;
+ break;
+ case 6:
+ var->red.offset = 11;
+ var->green.offset = 5;
+ var->blue.offset = 0;
+ var->red.length = var->blue.length = 5;
+ break;
+ }
+ break;
+ case 24:
+ var->red.offset = 16;
+ var->green.offset = 8;
+ var->blue.offset = 0;
+ var->red.length = var->green.length = var->blue.length = 8;
+ break;
+ case 32:
+ var->transp.offset = 24;
+ var->red.offset = 16;
+ var->green.offset = 8;
+ var->blue.offset = 0;
+ var->transp.length = 8;
+ var->red.length = var->green.length = var->blue.length = 8;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ if (var->xres > var->xres_virtual)
+ var->xres_virtual = var->xres;
+
+ if (var->yres > var->yres_virtual)
+ var->yres_virtual = var->yres;
+
+ if (info->monspecs.hfmax && info->monspecs.vfmax &&
+ info->monspecs.dclkmax && fb_validate_mode(var, info) < 0)
+ return -EINVAL;
+
+ return 0;
+}
+
+static void vga_protect(struct i740fb_par *par)
+{
+ /* disable the display */
+ i740outreg_mask(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, 0x20, 0x20);
+
+ i740inb(par, 0x3DA);
+ i740outb(par, VGA_ATT_W, 0x00); /* enable pallete access */
+}
+
+static void vga_unprotect(struct i740fb_par *par)
+{
+ /* reenable display */
+ i740outreg_mask(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, 0, 0x20);
+
+ i740inb(par, 0x3DA);
+ i740outb(par, VGA_ATT_W, 0x20); /* disable pallete access */
+}
+
+static int i740fb_set_par(struct fb_info *info)
+{
+ struct i740fb_par *par = info->par;
+ u32 itemp;
+ int i;
+
+ i = i740fb_decode_var(&info->var, par, info);
+ if (i)
+ return i;
+
+ memset(info->screen_base, 0, info->screen_size);
+
+ vga_protect(par);
+
+ i740outreg(par, XRX, DRAM_EXT_CNTL, DRAM_REFRESH_DISABLE);
+
+ mdelay(1);
+
+ i740outreg(par, XRX, VCLK2_VCO_M, par->video_clk2_m);
+ i740outreg(par, XRX, VCLK2_VCO_N, par->video_clk2_n);
+ i740outreg(par, XRX, VCLK2_VCO_MN_MSBS, par->video_clk2_mn_msbs);
+ i740outreg(par, XRX, VCLK2_VCO_DIV_SEL, par->video_clk2_div_sel);
+
+ i740outreg_mask(par, XRX, PIXPIPE_CONFIG_0, par->pixelpipe_cfg0 & DAC_8_BIT, 0x80);
+
+ i740inb(par, 0x3DA);
+ i740outb(par, 0x3C0, 0x00);
+
+ /* update misc output register */
+ i740outb(par, VGA_MIS_W, par->misc | 0x01);
+
+ /* synchronous reset on */
+ i740outreg(par, VGA_SEQ_I, VGA_SEQ_RESET, 0x01);
+ /* write sequencer registers */
+ i740outreg(par, VGA_SEQ_I, VGA_SEQ_CLOCK_MODE, par->seq[VGA_SEQ_CLOCK_MODE] | 0x20);
+ for (i = 2; i < VGA_SEQ_C; i++)
+ i740outreg(par, VGA_SEQ_I, i, par->seq[i]);
+
+ /* synchronous reset off */
+ i740outreg(par, VGA_SEQ_I, VGA_SEQ_RESET, 0x03);
+
+ /* deprotect CRT registers 0-7 */
+ i740outreg(par, VGA_CRT_IC, VGA_CRTC_V_SYNC_END, par->crtc[VGA_CRTC_V_SYNC_END]);
+
+ /* write CRT registers */
+ for (i = 0; i < VGA_CRT_C; i++)
+ i740outreg(par, VGA_CRT_IC, i, par->crtc[i]);
+
+ /* write graphics controller registers */
+ for (i = 0; i < VGA_GFX_C; i++)
+ i740outreg(par, VGA_GFX_I, i, par->gdc[i]);
+
+ /* write attribute controller registers */
+ for (i = 0; i < VGA_ATT_C; i++) {
+ i740inb(par, VGA_IS1_RC); /* reset flip-flop */
+ i740outb(par, VGA_ATT_IW, i);
+ i740outb(par, VGA_ATT_IW, par->atc[i]);
+ }
+
+ i740inb(par, VGA_IS1_RC);
+ i740outb(par, VGA_ATT_IW, 0x20);
+
+ i740outreg(par, VGA_CRT_IC, EXT_VERT_TOTAL, par->ext_vert_total);
+ i740outreg(par, VGA_CRT_IC, EXT_VERT_DISPLAY, par->ext_vert_disp_end);
+ i740outreg(par, VGA_CRT_IC, EXT_VERT_SYNC_START, par->ext_vert_sync_start);
+ i740outreg(par, VGA_CRT_IC, EXT_VERT_BLANK_START, par->ext_vert_blank_start);
+ i740outreg(par, VGA_CRT_IC, EXT_HORIZ_TOTAL, par->ext_horiz_total);
+ i740outreg(par, VGA_CRT_IC, EXT_HORIZ_BLANK, par->ext_horiz_blank);
+ i740outreg(par, VGA_CRT_IC, EXT_OFFSET, par->ext_offset);
+ i740outreg(par, VGA_CRT_IC, EXT_START_ADDR_HI, par->ext_start_addr_hi);
+ i740outreg(par, VGA_CRT_IC, EXT_START_ADDR, par->ext_start_addr);
+
+ i740outreg_mask(par, VGA_CRT_IC, INTERLACE_CNTL, par->interlace_cntl, INTERLACE_ENABLE);
+ i740outreg_mask(par, XRX, ADDRESS_MAPPING, par->address_mapping, 0x1F);
+ i740outreg_mask(par, XRX, BITBLT_CNTL, par->bitblt_cntl, COLEXP_MODE);
+ i740outreg_mask(par, XRX, DISPLAY_CNTL, par->display_cntl, VGA_WRAP_MODE | GUI_MODE);
+ i740outreg_mask(par, XRX, PIXPIPE_CONFIG_0, par->pixelpipe_cfg0, 0x9B);
+ i740outreg_mask(par, XRX, PIXPIPE_CONFIG_2, par->pixelpipe_cfg2, 0x0C);
+
+ i740outreg(par, XRX, PLL_CNTL, par->pll_cntl);
+
+ i740outreg_mask(par, XRX, PIXPIPE_CONFIG_1, par->pixelpipe_cfg1, DISPLAY_COLOR_MODE);
+
+ itemp = readl(par->regs + FWATER_BLC);
+ itemp &= ~(LMI_BURST_LENGTH | LMI_FIFO_WATERMARK);
+ itemp |= par->lmi_fifo_watermark;
+ writel(itemp, par->regs + FWATER_BLC);
+
+ i740outreg(par, XRX, DRAM_EXT_CNTL, DRAM_REFRESH_60HZ);
+
+ i740outreg_mask(par, MRX, COL_KEY_CNTL_1, 0, BLANK_DISP_OVERLAY);
+ i740outreg_mask(par, XRX, IO_CTNL, par->io_cntl, EXTENDED_ATTR_CNTL | EXTENDED_CRTC_CNTL);
+
+ if (par->pixelpipe_cfg1 != DISPLAY_8BPP_MODE) {
+ i740outb(par, VGA_PEL_MSK, 0xFF);
+ i740outb(par, VGA_PEL_IW, 0x00);
+ for (i = 0; i < 256; i++) {
+ i740outb(par, VGA_PEL_D, (par->pixelpipe_cfg0 & DAC_8_BIT) ? i : i >> 2);
+ i740outb(par, VGA_PEL_D, (par->pixelpipe_cfg0 & DAC_8_BIT) ? i : i >> 2);
+ i740outb(par, VGA_PEL_D, (par->pixelpipe_cfg0 & DAC_8_BIT) ? i : i >> 2);
+ }
+ }
+
+ /* Wait for screen to stabilize. */
+ mdelay(50);
+ vga_unprotect(par);
+
+ info->fix.line_length + info->var.xres_virtual * info->var.bits_per_pixel / 8;
+ if (info->var.bits_per_pixel = 8)
+ info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
+ else
+ info->fix.visual = FB_VISUAL_TRUECOLOR;
+
+ return 0;
+}
+
+static int i740fb_setcolreg(unsigned regno, unsigned red, unsigned green,
+ unsigned blue, unsigned transp,
+ struct fb_info *info)
+{
+ u32 r, g, b;
+
+ dev_dbg(info->device, "setcolreg: regno: %i, red=%d, green=%d, blue=%d, transp=%d, bpp=%d\n",
+ regno, red, green, blue, transp, info->var.bits_per_pixel);
+
+ switch (info->fix.visual) {
+ case FB_VISUAL_PSEUDOCOLOR:
+ if (regno >= 256)
+ return -EINVAL;
+ i740outb(info->par, VGA_PEL_IW, regno);
+ i740outb(info->par, VGA_PEL_D, red >> 8);
+ i740outb(info->par, VGA_PEL_D, green >> 8);
+ i740outb(info->par, VGA_PEL_D, blue >> 8);
+ break;
+ case FB_VISUAL_TRUECOLOR:
+ if (regno >= 16)
+ return -EINVAL;
+ r = (red >> (16 - info->var.red.length))
+ << info->var.red.offset;
+ b = (blue >> (16 - info->var.blue.length))
+ << info->var.blue.offset;
+ g = (green >> (16 - info->var.green.length))
+ << info->var.green.offset;
+ ((u32 *) info->pseudo_palette)[regno] = r | g | b;
+ break;
+ default:
+ return -EINVAL;
+ }
+
+ return 0;
+}
+
+static int i740fb_pan_display(struct fb_var_screeninfo *var,
+ struct fb_info *info)
+{
+ struct i740fb_par *par = info->par;
+ u32 base = (var->yoffset * info->var.xres_virtual + (var->xoffset & ~7)) >> 2;
+
+ dev_dbg(info->device, "pan_display: xoffset: %i yoffset: %i base: %i\n",
+ var->xoffset, var->yoffset, base);
+
+ switch (info->var.bits_per_pixel) {
+ case 8:
+ break;
+ case 15:
+ case 16:
+ base *= 2;
+ break;
+ case 24:
+ /*
+ * The last bit does not seem to have any effect on the start
+ * address register in 24bpp mode, so...
+ */
+ base &= 0xFFFFFFFE; /* ...ignore the last bit. */
+ base *= 3;
+ break;
+ case 32:
+ base *= 4;
+ break;
+ }
+
+ par->crtc[VGA_CRTC_START_LO] = base & 0x000000FF;
+ par->crtc[VGA_CRTC_START_HI] = (base & 0x0000FF00) >> 8;
+ par->ext_start_addr_hi = (base & 0x3FC00000) >> 22;
+ par->ext_start_addr = ((base & 0x003F0000) >> 16) | EXT_START_ADDR_ENABLE;
+
+ i740outreg(par, VGA_CRT_IC, VGA_CRTC_START_LO, base & 0x000000FF);
+ i740outreg(par, VGA_CRT_IC, VGA_CRTC_START_HI, (base & 0x0000FF00) >> 8);
+ i740outreg(par, VGA_CRT_IC, EXT_START_ADDR_HI, (base & 0x3FC00000) >> 22);
+ i740outreg(par, VGA_CRT_IC, EXT_START_ADDR, ((base & 0x003F0000) >> 16) | EXT_START_ADDR_ENABLE);
+
+ return 0;
+}
+
+static int i740fb_blank(int blank_mode, struct fb_info *info)
+{
+ struct i740fb_par *par = info->par;
+
+ unsigned char SEQ01;
+ int DPMSSyncSelect;
+
+ switch (blank_mode) {
+ case FB_BLANK_UNBLANK:
+ case FB_BLANK_NORMAL:
+ SEQ01 = 0x00;
+ DPMSSyncSelect = HSYNC_ON | VSYNC_ON;
+ break;
+ case FB_BLANK_VSYNC_SUSPEND:
+ SEQ01 = 0x20;
+ DPMSSyncSelect = HSYNC_ON | VSYNC_OFF;
+ break;
+ case FB_BLANK_HSYNC_SUSPEND:
+ SEQ01 = 0x20;
+ DPMSSyncSelect = HSYNC_OFF | VSYNC_ON;
+ break;
+ case FB_BLANK_POWERDOWN:
+ SEQ01 = 0x20;
+ DPMSSyncSelect = HSYNC_OFF | VSYNC_OFF;
+ break;
+ default:
+ return -EINVAL;
+ }
+ /* Turn the screen on/off */
+ i740outb(par, SRX, 0x01);
+ SEQ01 |= i740inb(par, SRX + 1) & ~0x20;
+ i740outb(par, SRX, 0x01);
+ i740outb(par, SRX + 1, SEQ01);
+
+ /* Set the DPMS mode */
+ i740outreg(par, XRX, DPMS_SYNC_SELECT, DPMSSyncSelect);
+
+ /* Let fbcon do a soft blank for us */
+ return (blank_mode = FB_BLANK_NORMAL) ? 1 : 0;
+}
+
+static struct fb_ops i740fb_ops = {
+ .owner = THIS_MODULE,
+ .fb_open = i740fb_open,
+ .fb_release = i740fb_release,
+ .fb_check_var = i740fb_check_var,
+ .fb_set_par = i740fb_set_par,
+ .fb_setcolreg = i740fb_setcolreg,
+ .fb_blank = i740fb_blank,
+ .fb_pan_display = i740fb_pan_display,
+ .fb_fillrect = cfb_fillrect,
+ .fb_copyarea = cfb_copyarea,
+ .fb_imageblit = cfb_imageblit,
+};
+
+/* ------------------------------------------------------------------------- */
+
+static int __devinit i740fb_probe(struct pci_dev *dev,
+ const struct pci_device_id *ent)
+{
+ struct fb_info *info;
+ struct i740fb_par *par;
+ int ret;
+ bool found = false;
+ u8 *edid;
+
+ info = framebuffer_alloc(sizeof(struct i740fb_par), &(dev->dev));
+ if (!info) {
+ dev_err(&(dev->dev), "cannot allocate framebuffer\n");
+ return -ENOMEM;
+ }
+
+ par = info->par;
+ mutex_init(&par->open_lock);
+
+ info->var.activate = FB_ACTIVATE_NOW;
+ info->var.bits_per_pixel = 8;
+ info->fbops = &i740fb_ops;
+ info->pseudo_palette = par->pseudo_palette;
+
+ ret = pci_enable_device(dev);
+ if (ret) {
+ dev_err(info->device, "cannot enable PCI device\n");
+ goto err_enable_device;
+ }
+
+ ret = pci_request_regions(dev, info->fix.id);
+ if (ret) {
+ dev_err(info->device, "error requesting regions\n");
+ goto err_request_regions;
+ }
+
+ info->screen_base = pci_ioremap_bar(dev, 0);
+ if (!info->screen_base) {
+ dev_err(info->device, "error remapping base\n");
+ ret = -ENOMEM;
+ goto err_ioremap_1;
+ }
+
+ par->regs = pci_ioremap_bar(dev, 1);
+ if (!par->regs) {
+ dev_err(info->device, "error remapping MMIO\n");
+ ret = -ENOMEM;
+ goto err_ioremap_2;
+ }
+
+ /* detect memory size */
+ if ((i740inreg(par, XRX, DRAM_ROW_TYPE) & DRAM_ROW_1) = DRAM_ROW_1_SDRAM)
+ i740outb(par, XRX, DRAM_ROW_BNDRY_1);
+ else
+ i740outb(par, XRX, DRAM_ROW_BNDRY_0);
+ info->screen_size = i740inb(par, XRX + 1) * 1024 * 1024;
+ /* detect memory type */
+ par->has_sgram = i740inreg(par, XRX, DRAM_ROW_CNTL_LO);
+ par->has_sgram = !((par->has_sgram & DRAM_RAS_TIMING) ||
+ (par->has_sgram & DRAM_RAS_PRECHARGE));
+
+ printk(KERN_INFO "fb%d: Intel740 on %s, %ld KB %s\n", info->node,
+ pci_name(dev), info->screen_size >> 10,
+ par->has_sgram ? "SGRAM" : "SDRAM");
+
+ info->fix = i740fb_fix;
+ info->fix.mmio_start = pci_resource_start(dev, 1);
+ info->fix.mmio_len = pci_resource_len(dev, 1);
+ info->fix.smem_start = pci_resource_start(dev, 0);
+ info->fix.smem_len = info->screen_size;
+ info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+
+ if (i740fb_setup_ddc_bus(info) = 0) {
+ par->ddc_registered = true;
+ edid = fb_ddc_read(&par->ddc_adapter);
+ if (edid) {
+ fb_edid_to_monspecs(edid, &info->monspecs);
+ kfree(edid);
+ if (!info->monspecs.modedb)
+ dev_err(info->device,
+ "error getting mode database\n");
+ else {
+ const struct fb_videomode *m;
+
+ fb_videomode_to_modelist(
+ info->monspecs.modedb,
+ info->monspecs.modedb_len,
+ &info->modelist);
+ m = fb_find_best_display(&info->monspecs,
+ &info->modelist);
+ if (m) {
+ fb_videomode_to_var(&info->var, m);
+ /* fill all other info->var's fields */
+ if (i740fb_check_var(&info->var, info) = 0)
+ found = true;
+ }
+ }
+ }
+ }
+
+ if (!mode_option && !found)
+ mode_option = "640x480-8@60";
+
+ if (mode_option) {
+ ret = fb_find_mode(&info->var, info, mode_option,
+ info->monspecs.modedb,
+ info->monspecs.modedb_len,
+ NULL, info->var.bits_per_pixel);
+ if (!ret || ret = 4) {
+ dev_err(info->device, "mode %s not found\n",
+ mode_option);
+ ret = -EINVAL;
+ }
+ }
+
+ fb_destroy_modedb(info->monspecs.modedb);
+ info->monspecs.modedb = NULL;
+
+ /* maximize virtual vertical size for fast scrolling */
+ info->var.yres_virtual = info->fix.smem_len * 8 /
+ (info->var.bits_per_pixel * info->var.xres_virtual);
+
+ if (ret = -EINVAL)
+ goto err_find_mode;
+
+ ret = fb_alloc_cmap(&info->cmap, 256, 0);
+ if (ret) {
+ dev_err(info->device, "cannot allocate colormap\n");
+ goto err_alloc_cmap;
+ }
+
+ ret = register_framebuffer(info);
+ if (ret) {
+ dev_err(info->device, "error registering framebuffer\n");
+ goto err_reg_framebuffer;
+ }
+
+ printk(KERN_INFO "fb%d: %s frame buffer device\n",
+ info->node, info->fix.id);
+ pci_set_drvdata(dev, info);
+#ifdef CONFIG_MTRR
+ if (mtrr) {
+ par->mtrr_reg = -1;
+ par->mtrr_reg = mtrr_add(info->fix.smem_start,
+ info->fix.smem_len, MTRR_TYPE_WRCOMB, 1);
+ }
+#endif
+ return 0;
+
+err_reg_framebuffer:
+ fb_dealloc_cmap(&info->cmap);
+err_alloc_cmap:
+err_find_mode:
+ if (par->ddc_registered)
+ i2c_del_adapter(&par->ddc_adapter);
+ pci_iounmap(dev, par->regs);
+err_ioremap_2:
+ pci_iounmap(dev, info->screen_base);
+err_ioremap_1:
+ pci_release_regions(dev);
+err_request_regions:
+/* pci_disable_device(dev); */
+err_enable_device:
+ framebuffer_release(info);
+ return ret;
+}
+
+static void __devexit i740fb_remove(struct pci_dev *dev)
+{
+ struct fb_info *info = pci_get_drvdata(dev);
+
+ if (info) {
+#ifdef CONFIG_MTRR
+ struct i740fb_par *par = info->par;
+
+ if (par->mtrr_reg >= 0) {
+ mtrr_del(par->mtrr_reg, 0, 0);
+ par->mtrr_reg = -1;
+ }
+#endif
+ unregister_framebuffer(info);
+ fb_dealloc_cmap(&info->cmap);
+ if (par->ddc_registered)
+ i2c_del_adapter(&par->ddc_adapter);
+ pci_iounmap(dev, par->regs);
+ pci_iounmap(dev, info->screen_base);
+ pci_release_regions(dev);
+/* pci_disable_device(dev); */
+ pci_set_drvdata(dev, NULL);
+ framebuffer_release(info);
+ }
+}
+
+#ifdef CONFIG_PM
+static int i740fb_suspend(struct pci_dev *dev, pm_message_t state)
+{
+ struct fb_info *info = pci_get_drvdata(dev);
+ struct i740fb_par *par = info->par;
+
+ /* don't disable console during hibernation and wakeup from it */
+ if (state.event = PM_EVENT_FREEZE || state.event = PM_EVENT_PRETHAW)
+ return 0;
+
+ console_lock();
+ mutex_lock(&(par->open_lock));
+
+ /* do nothing if framebuffer is not active */
+ if (par->ref_count = 0) {
+ mutex_unlock(&(par->open_lock));
+ console_unlock();
+ return 0;
+ }
+
+ fb_set_suspend(info, 1);
+
+ pci_save_state(dev);
+ pci_disable_device(dev);
+ pci_set_power_state(dev, pci_choose_state(dev, state));
+
+ mutex_unlock(&(par->open_lock));
+ console_unlock();
+
+ return 0;
+}
+
+static int i740fb_resume(struct pci_dev *dev)
+{
+ struct fb_info *info = pci_get_drvdata(dev);
+ struct i740fb_par *par = info->par;
+
+ console_lock();
+ mutex_lock(&(par->open_lock));
+
+ if (par->ref_count = 0)
+ goto fail;
+
+ pci_set_power_state(dev, PCI_D0);
+ pci_restore_state(dev);
+ if (pci_enable_device(dev))
+ goto fail;
+
+ i740fb_set_par(info);
+ fb_set_suspend(info, 0);
+
+fail:
+ mutex_unlock(&(par->open_lock));
+ console_unlock();
+ return 0;
+}
+#else
+#define i740fb_suspend NULL
+#define i740fb_resume NULL
+#endif /* CONFIG_PM */
+
+#define I740_ID_PCI 0x00d1
+#define I740_ID_AGP 0x7800
+
+static DEFINE_PCI_DEVICE_TABLE(i740fb_id_table) = {
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, I740_ID_PCI) },
+ { PCI_DEVICE(PCI_VENDOR_ID_INTEL, I740_ID_AGP) },
+ { 0 }
+};
+MODULE_DEVICE_TABLE(pci, i740fb_id_table);
+
+static struct pci_driver i740fb_driver = {
+ .name = "i740fb",
+ .id_table = i740fb_id_table,
+ .probe = i740fb_probe,
+ .remove = __devexit_p(i740fb_remove),
+ .suspend = i740fb_suspend,
+ .resume = i740fb_resume,
+};
+
+#ifndef MODULE
+static int __init i740fb_setup(char *options)
+{
+ char *opt;
+
+ if (!options || !*options)
+ return 0;
+
+ while ((opt = strsep(&options, ",")) != NULL) {
+ if (!*opt)
+ continue;
+#ifdef CONFIG_MTRR
+ else if (!strncmp(opt, "mtrr:", 5))
+ mtrr = simple_strtoul(opt + 5, NULL, 0);
+#endif
+ else
+ mode_option = opt;
+ }
+
+ return 0;
+}
+#endif
+
+int __init i740fb_init(void)
+{
+#ifndef MODULE
+ char *option = NULL;
+
+ if (fb_get_options("i740fb", &option))
+ return -ENODEV;
+ i740fb_setup(option);
+#endif
+
+ return pci_register_driver(&i740fb_driver);
+}
+
+static void __exit i740fb_exit(void)
+{
+ pci_unregister_driver(&i740fb_driver);
+}
+
+module_init(i740fb_init);
+module_exit(i740fb_exit);
+
+MODULE_AUTHOR("(c) 2011 Ondrej Zary <linux@rainbow-software.org>");
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("fbdev driver for Intel740");
+
+module_param(mode_option, charp, 0444);
+MODULE_PARM_DESC(mode_option, "Default video mode ('640x480-8@60', etc)");
+
+#ifdef CONFIG_MTRR
+module_param(mtrr, int, 0444);
+MODULE_PARM_DESC(mtrr, "Enable write-combining with MTRR (1=enable, 0=disable, default=1)");
+#endif
--- /dev/null 2011-12-08 00:02:00.479903436 +0100
+++ linux-3.1/drivers/video/i740_reg.h 2011-10-28 20:42:33.000000000 +0200
@@ -0,0 +1,309 @@
+/**************************************************************************
+
+Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
+All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sub license, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice (including the
+next paragraph) shall be included in all copies or substantial portions
+of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
+ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+**************************************************************************/
+
+/*
+ * Authors:
+ * Kevin E. Martin <kevin@precisioninsight.com>
+ */
+
+/* I/O register offsets */
+#define SRX VGA_SEQ_I
+#define GRX VGA_GFX_I
+#define ARX VGA_ATT_IW
+#define XRX 0x3D6
+#define MRX 0x3D2
+
+/* VGA Color Palette Registers */
+#define DACMASK 0x3C6
+#define DACSTATE 0x3C7
+#define DACRX 0x3C7
+#define DACWX 0x3C8
+#define DACDATA 0x3C9
+
+/* CRT Controller Registers (CRX) */
+#define START_ADDR_HI 0x0C
+#define START_ADDR_LO 0x0D
+#define VERT_SYNC_END 0x11
+#define EXT_VERT_TOTAL 0x30
+#define EXT_VERT_DISPLAY 0x31
+#define EXT_VERT_SYNC_START 0x32
+#define EXT_VERT_BLANK_START 0x33
+#define EXT_HORIZ_TOTAL 0x35
+#define EXT_HORIZ_BLANK 0x39
+#define EXT_START_ADDR 0x40
+#define EXT_START_ADDR_ENABLE 0x80
+#define EXT_OFFSET 0x41
+#define EXT_START_ADDR_HI 0x42
+#define INTERLACE_CNTL 0x70
+#define INTERLACE_ENABLE 0x80
+#define INTERLACE_DISABLE 0x00
+
+/* Miscellaneous Output Register */
+#define MSR_R 0x3CC
+#define MSR_W 0x3C2
+#define IO_ADDR_SELECT 0x01
+
+#define MDA_BASE 0x3B0
+#define CGA_BASE 0x3D0
+
+/* System Configuration Extension Registers (XRX) */
+#define IO_CTNL 0x09
+#define EXTENDED_ATTR_CNTL 0x02
+#define EXTENDED_CRTC_CNTL 0x01
+
+#define ADDRESS_MAPPING 0x0A
+#define PACKED_MODE_ENABLE 0x04
+#define LINEAR_MODE_ENABLE 0x02
+#define PAGE_MAPPING_ENABLE 0x01
+
+#define BITBLT_CNTL 0x20
+#define COLEXP_MODE 0x30
+#define COLEXP_8BPP 0x00
+#define COLEXP_16BPP 0x10
+#define COLEXP_24BPP 0x20
+#define COLEXP_RESERVED 0x30
+#define CHIP_RESET 0x02
+#define BITBLT_STATUS 0x01
+
+#define DISPLAY_CNTL 0x40
+#define VGA_WRAP_MODE 0x02
+#define VGA_WRAP_AT_256KB 0x00
+#define VGA_NO_WRAP 0x02
+#define GUI_MODE 0x01
+#define STANDARD_VGA_MODE 0x00
+#define HIRES_MODE 0x01
+
+#define DRAM_ROW_TYPE 0x50
+#define DRAM_ROW_0 0x07
+#define DRAM_ROW_0_SDRAM 0x00
+#define DRAM_ROW_0_EMPTY 0x07
+#define DRAM_ROW_1 0x38
+#define DRAM_ROW_1_SDRAM 0x00
+#define DRAM_ROW_1_EMPTY 0x38
+#define DRAM_ROW_CNTL_LO 0x51
+#define DRAM_CAS_LATENCY 0x10
+#define DRAM_RAS_TIMING 0x08
+#define DRAM_RAS_PRECHARGE 0x04
+#define DRAM_ROW_CNTL_HI 0x52
+#define DRAM_EXT_CNTL 0x53
+#define DRAM_REFRESH_RATE 0x03
+#define DRAM_REFRESH_DISABLE 0x00
+#define DRAM_REFRESH_60HZ 0x01
+#define DRAM_REFRESH_FAST_TEST 0x02
+#define DRAM_REFRESH_RESERVED 0x03
+#define DRAM_TIMING 0x54
+#define DRAM_ROW_BNDRY_0 0x55
+#define DRAM_ROW_BNDRY_1 0x56
+
+#define DPMS_SYNC_SELECT 0x61
+#define VSYNC_CNTL 0x08
+#define VSYNC_ON 0x00
+#define VSYNC_OFF 0x08
+#define HSYNC_CNTL 0x02
+#define HSYNC_ON 0x00
+#define HSYNC_OFF 0x02
+
+#define PIXPIPE_CONFIG_0 0x80
+#define DAC_8_BIT 0x80
+#define DAC_6_BIT 0x00
+#define HW_CURSOR_ENABLE 0x10
+#define EXTENDED_PALETTE 0x01
+
+#define PIXPIPE_CONFIG_1 0x81
+#define DISPLAY_COLOR_MODE 0x0F
+#define DISPLAY_VGA_MODE 0x00
+#define DISPLAY_8BPP_MODE 0x02
+#define DISPLAY_15BPP_MODE 0x04
+#define DISPLAY_16BPP_MODE 0x05
+#define DISPLAY_24BPP_MODE 0x06
+#define DISPLAY_32BPP_MODE 0x07
+
+#define PIXPIPE_CONFIG_2 0x82
+#define DISPLAY_GAMMA_ENABLE 0x08
+#define DISPLAY_GAMMA_DISABLE 0x00
+#define OVERLAY_GAMMA_ENABLE 0x04
+#define OVERLAY_GAMMA_DISABLE 0x00
+
+#define CURSOR_CONTROL 0xA0
+#define CURSOR_ORIGIN_SCREEN 0x00
+#define CURSOR_ORIGIN_DISPLAY 0x10
+#define CURSOR_MODE 0x07
+#define CURSOR_MODE_DISABLE 0x00
+#define CURSOR_MODE_32_4C_AX 0x01
+#define CURSOR_MODE_128_2C 0x02
+#define CURSOR_MODE_128_1C 0x03
+#define CURSOR_MODE_64_3C 0x04
+#define CURSOR_MODE_64_4C_AX 0x05
+#define CURSOR_MODE_64_4C 0x06
+#define CURSOR_MODE_RESERVED 0x07
+#define CURSOR_BASEADDR_LO 0xA2
+#define CURSOR_BASEADDR_HI 0xA3
+#define CURSOR_X_LO 0xA4
+#define CURSOR_X_HI 0xA5
+#define CURSOR_X_POS 0x00
+#define CURSOR_X_NEG 0x80
+#define CURSOR_Y_LO 0xA6
+#define CURSOR_Y_HI 0xA7
+#define CURSOR_Y_POS 0x00
+#define CURSOR_Y_NEG 0x80
+
+#define VCLK2_VCO_M 0xC8
+#define VCLK2_VCO_N 0xC9
+#define VCLK2_VCO_MN_MSBS 0xCA
+#define VCO_N_MSBS 0x30
+#define VCO_M_MSBS 0x03
+#define VCLK2_VCO_DIV_SEL 0xCB
+#define POST_DIV_SELECT 0x70
+#define POST_DIV_1 0x00
+#define POST_DIV_2 0x10
+#define POST_DIV_4 0x20
+#define POST_DIV_8 0x30
+#define POST_DIV_16 0x40
+#define POST_DIV_32 0x50
+#define VCO_LOOP_DIV_BY_4M 0x00
+#define VCO_LOOP_DIV_BY_16M 0x04
+#define REF_CLK_DIV_BY_5 0x02
+#define REF_DIV_4 0x00
+#define REF_DIV_1 0x01
+
+#define PLL_CNTL 0xCE
+#define PLL_MEMCLK_SEL 0x03
+#define PLL_MEMCLK__66667KHZ 0x00
+#define PLL_MEMCLK__75000KHZ 0x01
+#define PLL_MEMCLK__88889KHZ 0x02
+#define PLL_MEMCLK_100000KHZ 0x03
+
+/* Multimedia Extension Registers (MRX) */
+#define ACQ_CNTL_1 0x02
+#define ACQ_CNTL_2 0x03
+#define FRAME_CAP_MODE 0x01
+#define CONT_CAP_MODE 0x00
+#define SINGLE_CAP_MODE 0x01
+#define ACQ_CNTL_3 0x04
+#define COL_KEY_CNTL_1 0x3C
+#define BLANK_DISP_OVERLAY 0x20
+
+/* FIFOs */
+#define LP_FIFO 0x1000
+#define HP_FIFO 0x2000
+#define INSTPNT 0x3040
+#define LP_FIFO_COUNT 0x3040
+#define HP_FIFO_COUNT 0x3041
+
+/* FIFO Commands */
+#define CLIENT 0xE0000000
+#define CLIENT_2D 0x60000000
+
+/* Command Parser Mode Register */
+#define COMPARS 0x3038
+#define TWO_D_INST_DISABLE 0x08
+#define THREE_D_INST_DISABLE 0x04
+#define STATE_VAR_UPDATE_DISABLE 0x02
+#define PAL_STIP_DISABLE 0x01
+
+/* Interrupt Control Registers */
+#define IER 0x3030
+#define IIR 0x3032
+#define IMR 0x3034
+#define ISR 0x3036
+#define VMIINTB_EVENT 0x2000
+#define GPIO4_INT 0x1000
+#define DISP_FLIP_EVENT 0x0800
+#define DVD_PORT_DMA 0x0400
+#define DISP_VBLANK 0x0200
+#define FIFO_EMPTY_DMA_DONE 0x0100
+#define INST_PARSER_ERROR 0x0080
+#define USER_DEFINED 0x0040
+#define BREAKPOINT 0x0020
+#define DISP_HORIZ_COUNT 0x0010
+#define DISP_VSYNC 0x0008
+#define CAPTURE_HORIZ_COUNT 0x0004
+#define CAPTURE_VSYNC 0x0002
+#define THREE_D_PIPE_FLUSHED 0x0001
+
+/* FIFO Watermark and Burst Length Control Register */
+#define FWATER_BLC 0x00006000
+#define LMI_BURST_LENGTH 0x7F000000
+#define LMI_FIFO_WATERMARK 0x003F0000
+#define AGP_BURST_LENGTH 0x00007F00
+#define AGP_FIFO_WATERMARK 0x0000003F
+
+/* BitBLT Registers */
+#define SRC_DST_PITCH 0x00040000
+#define DST_PITCH 0x1FFF0000
+#define SRC_PITCH 0x00001FFF
+#define COLEXP_BG_COLOR 0x00040004
+#define COLEXP_FG_COLOR 0x00040008
+#define MONO_SRC_CNTL 0x0004000C
+#define MONO_USE_COLEXP 0x00000000
+#define MONO_USE_SRCEXP 0x08000000
+#define MONO_DATA_ALIGN 0x07000000
+#define MONO_BIT_ALIGN 0x01000000
+#define MONO_BYTE_ALIGN 0x02000000
+#define MONO_WORD_ALIGN 0x03000000
+#define MONO_DWORD_ALIGN 0x04000000
+#define MONO_QWORD_ALIGN 0x05000000
+#define MONO_SRC_INIT_DSCRD 0x003F0000
+#define MONO_SRC_RIGHT_CLIP 0x00003F00
+#define MONO_SRC_LEFT_CLIP 0x0000003F
+#define BITBLT_CONTROL 0x00040010
+#define BLTR_STATUS 0x80000000
+#define DYN_DEPTH 0x03000000
+#define DYN_DEPTH_8BPP 0x00000000
+#define DYN_DEPTH_16BPP 0x01000000
+#define DYN_DEPTH_24BPP 0x02000000
+#define DYN_DEPTH_32BPP 0x03000000 /* Not implemented on the i740 */
+#define DYN_DEPTH_ENABLE 0x00800000
+#define PAT_VERT_ALIGN 0x00700000
+#define SOLID_PAT_SELECT 0x00080000
+#define PAT_IS_IN_COLOR 0x00000000
+#define PAT_IS_MONO 0x00040000
+#define MONO_PAT_TRANSP 0x00020000
+#define COLOR_TRANSP_ROP 0x00000000
+#define COLOR_TRANSP_DST 0x00008000
+#define COLOR_TRANSP_EQ 0x00000000
+#define COLOR_TRANSP_NOT_EQ 0x00010000
+#define COLOR_TRANSP_ENABLE 0x00004000
+#define MONO_SRC_TRANSP 0x00002000
+#define SRC_IS_IN_COLOR 0x00000000
+#define SRC_IS_MONO 0x00001000
+#define SRC_USE_SRC_ADDR 0x00000000
+#define SRC_USE_BLTDATA 0x00000400
+#define BLT_TOP_TO_BOT 0x00000000
+#define BLT_BOT_TO_TOP 0x00000200
+#define BLT_LEFT_TO_RIGHT 0x00000000
+#define BLT_RIGHT_TO_LEFT 0x00000100
+#define BLT_ROP 0x000000FF
+#define BLT_PAT_ADDR 0x00040014
+#define BLT_SRC_ADDR 0x00040018
+#define BLT_DST_ADDR 0x0004001C
+#define BLT_DST_H_W 0x00040020
+#define BLT_DST_HEIGHT 0x1FFF0000
+#define BLT_DST_WIDTH 0x00001FFF
+#define SRCEXP_BG_COLOR 0x00040024
+#define SRCEXP_FG_COLOR 0x00040028
+#define BLTDATA 0x00050000
--
Ondrej Zary
^ permalink raw reply
* Re: [PATCH 58/65] OMAPDSS: APPLY: add wait_pending_extra_info_updates()
From: Archit Taneja @ 2011-12-07 13:19 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-fbdev, linux-omap
In-Reply-To: <1321953724-6350-59-git-send-email-tomi.valkeinen@ti.com>
On Tuesday 22 November 2011 02:51 PM, Tomi Valkeinen wrote:
> Add wait_pending_extra_info_updates() function which can be used to wait
> until any extra_info changes have been taken into use by the hardware.
> This can be only called when holding the apply mutex, so that other
> threads cannot insert new extra_info changes.
>
> This will be used to handle fifo-configurations.
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/dss/apply.c | 70 +++++++++++++++++++++++++++++++++++++++
> 1 files changed, 70 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
> index 76b5b02..75db522 100644
> --- a/drivers/video/omap2/dss/apply.c
> +++ b/drivers/video/omap2/dss/apply.c
> @@ -106,6 +106,7 @@ static struct {
> static spinlock_t data_lock;
> /* lock for blocking functions */
> static DEFINE_MUTEX(apply_lock);
> +static DECLARE_COMPLETION(extra_updated_completion);
>
> static void dss_register_vsync_isr(void);
>
> @@ -232,6 +233,70 @@ static bool need_go(struct omap_overlay_manager *mgr)
> return false;
> }
>
> +/* returns true if an extra_info field is currently being updated */
> +static bool extra_info_update_ongoing(void)
> +{
> + const int num_ovls = omap_dss_get_num_overlays();
> + struct ovl_priv_data *op;
> + struct omap_overlay *ovl;
> + struct mgr_priv_data *mp;
> + int i;
> + bool eid;
> +
> + for (i = 0; i< num_ovls; ++i) {
> + ovl = omap_dss_get_overlay(i);
> + op = get_ovl_priv(ovl);
> +
> + if (!op->enabled)
> + continue;
> +
> + mp = get_mgr_priv(ovl->manager);
> +
> + if (!mp->enabled)
> + continue;
> +
> + eid = op->extra_info_dirty || op->shadow_extra_info_dirty;
> +
> + if (!eid)
> + continue;
> +
> + if (ovl_manual_update(ovl)&& !mp->updating)
> + continue;
> +
> + return true;
> + }
> +
> + return false;
> +}
> +
> +/* wait until no extra_info updates are pending */
> +static void wait_pending_extra_info_updates(void)
> +{
> + bool updating;
> + unsigned long flags;
> + unsigned long t;
> +
> + spin_lock_irqsave(&data_lock, flags);
> +
> + updating = extra_info_update_ongoing();
> +
> + if (!updating) {
> + spin_unlock_irqrestore(&data_lock, flags);
> + return;
> + }
> +
> + init_completion(&extra_updated_completion);
> +
> + spin_unlock_irqrestore(&data_lock, flags);
> +
> + t = msecs_to_jiffies(500);
> + wait_for_completion_timeout(&extra_updated_completion, t);
> +
> + updating = extra_info_update_ongoing();
> +
> + WARN_ON(updating);
> +}
This function isn't used, are you planning to use it later?
Archit
> +
> int dss_mgr_wait_for_go(struct omap_overlay_manager *mgr)
> {
> unsigned long timeout = msecs_to_jiffies(500);
> @@ -553,6 +618,7 @@ static void dss_apply_irq_handler(void *data, u32 mask)
> {
> const int num_mgrs = dss_feat_get_num_mgrs();
> int i;
> + bool extra_updating;
>
> spin_lock(&data_lock);
>
> @@ -582,6 +648,10 @@ static void dss_apply_irq_handler(void *data, u32 mask)
>
> dss_write_regs();
>
> + extra_updating = extra_info_update_ongoing();
> + if (!extra_updating)
> + complete_all(&extra_updated_completion);
> +
> if (!need_isr())
> dss_unregister_vsync_isr();
>
^ permalink raw reply
* Re: [PATCH 63/65] OMAPDSS: APPLY: add checking of ovls/mgrs settings
From: Archit Taneja @ 2011-12-07 13:17 UTC (permalink / raw)
To: Tomi Valkeinen; +Cc: linux-fbdev, linux-omap, archit
In-Reply-To: <1321953724-6350-64-git-send-email-tomi.valkeinen@ti.com>
Hi,
On Tuesday 22 November 2011 02:52 PM, Tomi Valkeinen wrote:
> Add checks for overlay and manager settings. The checks are a bit
> complex, as we need to observe the bigger picture instead of overlays
> and managers independently. Things like the used display and the zorder
> of other overlays affect the validity of the settings.
Minor comment:
dss_ovl_check, dss_mgr_check and dss_mgr_check_zorder don't really
qualify as functions which do actual applying of configurations, they
could be moved from apply.c to manager.c and overlay.c.
Archit
>
> Signed-off-by: Tomi Valkeinen<tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/dss/apply.c | 215 ++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 212 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/video/omap2/dss/apply.c b/drivers/video/omap2/dss/apply.c
> index 5d933b9..72afa85 100644
> --- a/drivers/video/omap2/dss/apply.c
> +++ b/drivers/video/omap2/dss/apply.c
> @@ -166,6 +166,169 @@ static bool mgr_manual_update(struct omap_overlay_manager *mgr)
> return mgr->device->caps& OMAP_DSS_DISPLAY_CAP_MANUAL_UPDATE;
> }
>
> +/* Check if overlay parameters are compatible with display */
> +static int dss_ovl_check(struct omap_overlay *ovl,
> + struct omap_overlay_info *info, struct omap_dss_device *dssdev)
> +{
> + u16 outw, outh;
> + u16 dw, dh;
> +
> + if (dssdev = NULL)
> + return 0;
> +
> + dssdev->driver->get_resolution(dssdev,&dw,&dh);
> +
> + if ((ovl->caps& OMAP_DSS_OVL_CAP_SCALE) = 0) {
> + outw = info->width;
> + outh = info->height;
> + } else {
> + if (info->out_width = 0)
> + outw = info->width;
> + else
> + outw = info->out_width;
> +
> + if (info->out_height = 0)
> + outh = info->height;
> + else
> + outh = info->out_height;
> + }
> +
> + if (dw< info->pos_x + outw) {
> + DSSERR("overlay %d horizontally not inside the display area "
> + "(%d + %d>= %d)\n",
> + ovl->id, info->pos_x, outw, dw);
> + return -EINVAL;
> + }
> +
> + if (dh< info->pos_y + outh) {
> + DSSERR("overlay %d vertically not inside the display area "
> + "(%d + %d>= %d)\n",
> + ovl->id, info->pos_y, outh, dh);
> + return -EINVAL;
> + }
> +
> + return 0;
> +}
> +
> +static int dss_mgr_check_zorder(struct omap_overlay_manager *mgr,
> + struct omap_overlay_info **overlay_infos)
> +{
> + struct omap_overlay *ovl1, *ovl2;
> + struct ovl_priv_data *op1, *op2;
> + struct omap_overlay_info *info1, *info2;
> +
> + list_for_each_entry(ovl1,&mgr->overlays, list) {
> + op1 = get_ovl_priv(ovl1);
> + info1 = overlay_infos[ovl1->id];
> +
> + if (info1 = NULL)
> + continue;
> +
> + list_for_each_entry(ovl2,&mgr->overlays, list) {
> + if (ovl1 = ovl2)
> + continue;
> +
> + op2 = get_ovl_priv(ovl2);
> + info2 = overlay_infos[ovl2->id];
> +
> + if (info2 = NULL)
> + continue;
> +
> + if (info1->zorder = info2->zorder) {
> + DSSERR("overlays %d and %d have the same "
> + "zorder %d\n",
> + ovl1->id, ovl2->id, info1->zorder);
> + return -EINVAL;
> + }
> + }
> + }
> +
> + return 0;
> +}
> +
> +static int dss_mgr_check(struct omap_overlay_manager *mgr,
> + struct omap_dss_device *dssdev,
> + struct omap_overlay_manager_info *info,
> + struct omap_overlay_info **overlay_infos)
> +{
> + struct omap_overlay *ovl;
> + int r;
> +
> + if (dss_has_feature(FEAT_ALPHA_FREE_ZORDER)) {
> + r = dss_mgr_check_zorder(mgr, overlay_infos);
> + if (r)
> + return r;
> + }
> +
> + list_for_each_entry(ovl,&mgr->overlays, list) {
> + struct omap_overlay_info *oi;
> + int r;
> +
> + oi = overlay_infos[ovl->id];
> +
> + if (oi = NULL)
> + continue;
> +
> + r = dss_ovl_check(ovl, oi, dssdev);
> + if (r)
> + return r;
> + }
> +
> + return 0;
> +}
> +static int dss_check_settings_low(struct omap_overlay_manager *mgr,
> + struct omap_dss_device *dssdev, bool applying)
> +{
> + struct omap_overlay_info *oi;
> + struct omap_overlay_manager_info *mi;
> + struct omap_overlay *ovl;
> + struct omap_overlay_info *ois[MAX_DSS_OVERLAYS];
> + struct ovl_priv_data *op;
> + struct mgr_priv_data *mp;
> +
> + mp = get_mgr_priv(mgr);
> +
> + if (applying&& mp->user_info_dirty)
> + mi =&mp->user_info;
> + else
> + mi =&mp->info;
> +
> + /* collect the infos to be tested into the array */
> + list_for_each_entry(ovl,&mgr->overlays, list) {
> + op = get_ovl_priv(ovl);
> +
> + if (!op->enabled)
> + oi = NULL;
> + else if (applying&& op->user_info_dirty)
> + oi =&op->user_info;
> + else
> + oi =&op->info;
> +
> + ois[ovl->id] = oi;
> + }
> +
> + return dss_mgr_check(mgr, dssdev, mi, ois);
> +}
> +
> +/*
> + * check manager and overlay settings using overlay_info from data->info
> + */
> +static int dss_check_settings(struct omap_overlay_manager *mgr,
> + struct omap_dss_device *dssdev)
> +{
> + return dss_check_settings_low(mgr, dssdev, false);
> +}
> +
> +/*
> + * check manager and overlay settings using overlay_info from ovl->info if
> + * dirty and from data->info otherwise
> + */
> +static int dss_check_settings_apply(struct omap_overlay_manager *mgr,
> + struct omap_dss_device *dssdev)
> +{
> + return dss_check_settings_low(mgr, dssdev, true);
> +}
> +
> static bool need_isr(void)
> {
> const int num_mgrs = dss_feat_get_num_mgrs();
> @@ -517,6 +680,7 @@ static void dss_write_regs(void)
> for (i = 0; i< num_mgrs; ++i) {
> struct omap_overlay_manager *mgr;
> struct mgr_priv_data *mp;
> + int r;
>
> mgr = omap_dss_get_overlay_manager(i);
> mp = get_mgr_priv(mgr);
> @@ -524,6 +688,13 @@ static void dss_write_regs(void)
> if (!mp->enabled || mgr_manual_update(mgr) || mp->busy)
> continue;
>
> + r = dss_check_settings(mgr, mgr->device);
> + if (r) {
> + DSSERR("cannot write registers for manager %s: "
> + "illegal configuration\n", mgr->name);
> + continue;
> + }
> +
> dss_mgr_write_regs(mgr);
>
> if (need_go(mgr)) {
> @@ -541,11 +712,19 @@ void dss_start_update(struct omap_overlay_manager *mgr)
> {
> struct mgr_priv_data *mp = get_mgr_priv(mgr);
> unsigned long flags;
> + int r;
>
> spin_lock_irqsave(&data_lock, flags);
>
> WARN_ON(mp->updating);
>
> + r = dss_check_settings(mgr, mgr->device);
> + if (r) {
> + DSSERR("cannot start manual update: illegal configuration\n");
> + spin_unlock_irqrestore(&data_lock, flags);
> + return;
> + }
> +
> dss_mgr_write_regs(mgr);
>
> mp->updating = true;
> @@ -690,11 +869,19 @@ int omap_dss_mgr_apply(struct omap_overlay_manager *mgr)
> {
> unsigned long flags;
> struct omap_overlay *ovl;
> + int r;
>
> DSSDBG("omap_dss_mgr_apply(%s)\n", mgr->name);
>
> spin_lock_irqsave(&data_lock, flags);
>
> + r = dss_check_settings_apply(mgr, mgr->device);
> + if (r) {
> + spin_unlock_irqrestore(&data_lock, flags);
> + DSSERR("failed to apply settings: illegal configuration.\n");
> + return r;
> + }
> +
> /* Configure overlays */
> list_for_each_entry(ovl,&mgr->overlays, list)
> omap_dss_mgr_apply_ovl(ovl);
> @@ -784,6 +971,7 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
> {
> struct mgr_priv_data *mp = get_mgr_priv(mgr);
> unsigned long flags;
> + int r;
>
> mutex_lock(&apply_lock);
>
> @@ -793,6 +981,16 @@ void dss_mgr_enable(struct omap_overlay_manager *mgr)
> spin_lock_irqsave(&data_lock, flags);
>
> mp->enabled = true;
> + r = dss_check_settings(mgr, mgr->device);
> + mp->enabled = false;
> + if (r) {
> + DSSERR("failed to enable manager %d: check_settings failed\n",
> + mgr->id);
> + spin_unlock_irqrestore(&data_lock, flags);
> + goto out;
> + }
> +
> + mp->enabled = true;
>
> dss_mgr_setup_fifos(mgr);
>
> @@ -1142,16 +1340,25 @@ int dss_ovl_enable(struct omap_overlay *ovl)
>
> if (op->enabled) {
> r = 0;
> - goto err;
> + goto err1;
> }
>
> if (ovl->manager = NULL || ovl->manager->device = NULL) {
> r = -EINVAL;
> - goto err;
> + goto err1;
> }
>
> spin_lock_irqsave(&data_lock, flags);
>
> + op->enabled = true;
> + r = dss_check_settings(ovl->manager, ovl->manager->device);
> + op->enabled = false;
> + if (r) {
> + DSSERR("failed to enable overlay %d: check_settings failed\n",
> + ovl->id);
> + goto err2;
> + }
> +
> dss_apply_ovl_enable(ovl, true);
>
> dss_ovl_setup_fifo(ovl);
> @@ -1163,7 +1370,9 @@ int dss_ovl_enable(struct omap_overlay *ovl)
> mutex_unlock(&apply_lock);
>
> return 0;
> -err:
> +err2:
> + spin_unlock_irqrestore(&data_lock, flags);
> +err1:
> mutex_unlock(&apply_lock);
> return r;
> }
^ permalink raw reply
* Re: [PATCH 58/65] OMAPDSS: APPLY: add
From: Tomi Valkeinen @ 2011-12-07 13:15 UTC (permalink / raw)
To: Archit Taneja; +Cc: linux-fbdev, linux-omap
In-Reply-To: <4EDF651E.3060703@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1103 bytes --]
On Wed, 2011-12-07 at 18:37 +0530, Archit Taneja wrote:
> On Tuesday 22 November 2011 02:51 PM, Tomi Valkeinen wrote:
> > +/* wait until no extra_info updates are pending */
> > +static void wait_pending_extra_info_updates(void)
> > +{
> > + bool updating;
> > + unsigned long flags;
> > + unsigned long t;
> > +
> > + spin_lock_irqsave(&data_lock, flags);
> > +
> > + updating = extra_info_update_ongoing();
> > +
> > + if (!updating) {
> > + spin_unlock_irqrestore(&data_lock, flags);
> > + return;
> > + }
> > +
> > + init_completion(&extra_updated_completion);
> > +
> > + spin_unlock_irqrestore(&data_lock, flags);
> > +
> > + t = msecs_to_jiffies(500);
> > + wait_for_completion_timeout(&extra_updated_completion, t);
> > +
> > + updating = extra_info_update_ongoing();
> > +
> > + WARN_ON(updating);
> > +}
>
> This function isn't used, are you planning to use it later?
Yes, it's used with the fifo-merge stuff. It could be added later, but
as it's related to the extra_info stuff, I think it fits better here
than with the fifo merge series.
Tomi
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [GIT PULL] ARM: amba: Enable module alias autogeneration for
From: Dave Martin @ 2011-12-06 16:18 UTC (permalink / raw)
To: Alessandro Rubini
Cc: linux, patches, linux-kernel, linux-arm-kernel, alan, a.zummo,
alsa-devel, cjb, dan.j.williams, dmitry.torokhov, grant.likely,
perex, jassisinghbrar, julia, linus.walleij, linux-fbdev,
linux-input, linux-mmc, linux-serial, linux-watchdog, lethal,
Pawel.Moll, rtc-linux, spi-devel-general, tiwai, vinod.koul, wim
In-Reply-To: <20111206155911.GA11902@mail.gnudd.com>
On Tue, Dec 06, 2011 at 04:59:11PM +0100, Alessandro Rubini wrote:
> > ... it looks like Alessandro's proposed change to tidy up scripts/mod/
> > ile2alias.c may get merged soon
>
> No, I don't think it will happen. Rusty disagrees, and his own
> suggestion is in the queue. I'm waiting a while to understand
> what is happening.
>
> Anyways, I think it's better for me to wait for amba to come in, and
> work on scripts/mod later on. After all, it's meant to ease adding new
> buses later, not to make it more difficult for already scheduled ones.
OK -- thanks for the clarification.
Russell, it sounds like you shouldn't get a merge conflict with the
original version of the series after all.
For reference, the original pull request is here:
http://lists.infradead.org/pipermail/linux-arm-kernel/2011-November/073619.html
Cheers
---Dave
^ permalink raw reply
* Re: [GIT PULL] ARM: amba: Enable module alias autogeneration for
From: Alessandro Rubini @ 2011-12-06 15:59 UTC (permalink / raw)
To: dave.martin-QSEj5FYQhm4dnm+yROfE0A
Cc: alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw, Pawel.Moll-5wv7dgnIgG8,
tiwai-l3A5Bk7waGM, linus.walleij-QSEj5FYQhm4dnm+yROfE0A,
linux-fbdev-u79uwXL29TY76Z2rM5mHXA, perex-/Fr2/VpizcU,
wim-IQzOog9fTRqzQB+pC5nmwQ, julia-dAYI7NvHqcQ,
linux-lFZ/pmaqli7XmaaqVzeoHQ, vinod.koul-ral2JQCrhuEAvxtiuMwx3w,
linux-serial-u79uwXL29TY76Z2rM5mHXA,
linux-input-u79uwXL29TY76Z2rM5mHXA, cjb-2X9k7bc8m7Mdnm+yROfE0A,
linux-watchdog-u79uwXL29TY76Z2rM5mHXA,
rtc-linux-/JYPxA39Uh5TLH3MbocFFw, patches-QSEj5FYQhm4dnm+yROfE0A,
dan.j.williams-ral2JQCrhuEAvxtiuMwx3w,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
alan-VuQAYsv1563Yd54FQh9/CA, a.zummo-BfzFCNDTiLLj+vYz1yj4TQ,
dmitry.torokhov-Re5JQEeQqe8AvxtiuMwx3w,
linux-mmc-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA,
lethal-M7jkjyW5wf5g9hUCZPvPmw,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f
In-Reply-To: <20111206151541.GA13774-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
> ... it looks like Alessandro's proposed change to tidy up scripts/mod/
> ile2alias.c may get merged soon
No, I don't think it will happen. Rusty disagrees, and his own
suggestion is in the queue. I'm waiting a while to understand
what is happening.
Anyways, I think it's better for me to wait for amba to come in, and
work on scripts/mod later on. After all, it's meant to ease adding new
buses later, not to make it more difficult for already scheduled ones.
/alessandro
^ permalink raw reply
* [GIT PULL] ARM: amba: Enable module alias autogeneration for AMBA
From: Dave Martin @ 2011-12-06 15:15 UTC (permalink / raw)
To: Russell King - ARM Linux
Cc: patches, linux-kernel, linux-arm-kernel, Alan Cox,
Alessandro Rubini, Alessandro Zummo, alsa-devel, Chris Ball,
Dan Williams, Dmitry Torokhov, Grant Likely, Jaroslav Kysela,
Jassi Brar, Julia Lawall, Linus Walleij, linux-fbdev, linux-input,
linux-mmc, linux-serial, linux-watchdog, Paul Mundt,
Paweł Moll, rtc-linux, spi-devel-general, Takashi Iwai
In-Reply-To: <1321961573-4562-1-git-send-email-dave.martin@linaro.org>
Hi Russell,
Further to my previous pull request:
> The following changes since commit cfcfc9eca2bcbd26a8e206baeb005b055dbf8e37:
>
> Linux 3.2-rc2 (2011-11-15 15:02:59 -0200)
>
> are available in the git repository at:
> git://git.linaro.org/people/dmart/linux-2.6-arm.git arm/amba-modalias+for-rmk
>
> Dave Martin (16):
> ARM: amba: Move definition of struct amba_id to mod_devicetable.h
> ARM: amba: Auto-generate AMBA driver module aliases during modpost
[...]
... it looks like Alessandro's proposed change to tidy up scripts/mod/
ile2alias.c may get merged soon -- if that happens, you will get a
conflict with the second patch of the series referenced by the previous
pull request. Fixing it up is straightforward -- if you prefer to
resolve the conflict yourself, that's fine by me. Alternatively, you
can pull the following modified series instead.
The only difference is in the second patch
("ARM: amba: Auto-generate AMBA driver module aliases during modpost").
Cheers
---Dave
The following changes since commit 114339d31aa813995461866c659bbf07e1cf2267:
modpost: use table-lookup to build module aliases (2011-12-02 15:18:08 +0000)
are available in the git repository at:
git://git.linaro.org/people/dmart/linux-2.6-arm.git arm/amba-modalias+alessandro-modalias-v2+for-rmk
Dave Martin (16):
ARM: amba: Move definition of struct amba_id to mod_devicetable.h
ARM: amba: Auto-generate AMBA driver module aliases during modpost
hwrng: nomadik: Enable module alias autogeneration for AMBA drivers
dmaengine: pl08x: Enable module alias autogeneration for AMBA drivers
dmaengine: pl330: Enable module alias autogeneration for AMBA drivers
gpio: pl061: Enable module alias autogeneration for AMBA drivers
input: ambakmi: Enable module alias autogeneration for AMBA drivers
mmc: mmci: Enable module alias autogeneration for AMBA drivers
rtc: pl030: Enable module alias autogeneration for AMBA drivers
rtc: pl031: Enable module alias autogeneration for AMBA drivers
spi: pl022: Enable module alias autogeneration for AMBA drivers
serial: pl010: Enable module alias autogeneration for AMBA drivers
serial: pl011: Enable module alias autogeneration for AMBA drivers
fbdev: amba: Enable module alias autogeneration for AMBA drivers
watchdog: sp805: Enable module alias autogeneration for AMBA drivers
sound: aaci: Enable module alias autogeneration for AMBA drivers
drivers/amba/bus.c | 4 ++
drivers/char/hw_random/nomadik-rng.c | 2 +
drivers/dma/amba-pl08x.c | 2 +
drivers/dma/pl330.c | 2 +
drivers/gpio/gpio-pl061.c | 2 +
drivers/input/serio/ambakmi.c | 2 +
drivers/mmc/host/mmci.c | 2 +
drivers/rtc/rtc-pl030.c | 2 +
drivers/rtc/rtc-pl031.c | 2 +
drivers/spi/spi-pl022.c | 2 +
drivers/tty/serial/amba-pl010.c | 2 +
drivers/tty/serial/amba-pl011.c | 2 +
drivers/video/amba-clcd.c | 2 +
drivers/watchdog/sp805_wdt.c | 2 +
include/linux/amba/bus.h | 7 +---
include/linux/mod_devicetable.h | 18 +++++++++
scripts/mod/file2alias.c | 71 +++++++++++++++++++++++++++++++++-
sound/arm/aaci.c | 2 +
18 files changed, 121 insertions(+), 7 deletions(-)
^ permalink raw reply
* Re: [PATCH 2/2] video: s3c-fb: Convert to devm style allocation
From: Mark Brown @ 2011-12-06 14:37 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <1322434268-25525-2-git-send-email-broonie@opensource.wolfsonmicro.com>
On Tue, Dec 06, 2011 at 09:04:43PM +0900, Kukjin Kim wrote:
> > - sfb->regs = ioremap(res->start, resource_size(res));
> > + sfb->regs = devm_request_and_ioremap(dev, res);
> > if (!sfb->regs) {
> > dev_err(dev, "failed to map registers\n");
> Don't we need dev_err here because the devm_request_and_ioremap() includes
> dev_err() for each error case?
Oh, if it already logs we can just drop that. I was just doing the
transformation based on the API, I didn't actually look at the
implementation.
> And don't we need devm_release_mem_region() or devm_iounmap() in error
> handling?
My expectation was that this was only if you needed to release at
runtime, if the driver fails to bind then devm_ ought to clean up after
you otherwise there's little win from using it. Unless there's a reason
I can't think of right now I'd expect that if we need those we should
fix the core rather than the driver.
> > err_sfb:
> > - kfree(sfb);
> Maybe we need devm_kfree here?
Similarly here, I'd expect us to only need that if we need to free at
runtime for some reason.
^ permalink raw reply
* [BUGFIX] video/mxsfb: fix crash when unblanking the display
From: Lothar Waßmann @ 2011-12-06 12:27 UTC (permalink / raw)
To: linux-arm-kernel
The VDCTRL4 register does not provide the MXS SET/CLR/TOGGLE feature.
The write in mxsfb_disable_controller() sets the data_cnt for the LCD
DMA to 0 which obviously means the max. count for the LCD DMA and
leads to overwriting arbitrary memory when the display is unblanked.
Signed-off-by: Lothar Waßmann <LW@KARO-electronics.de>
---
drivers/video/mxsfb.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/video/mxsfb.c b/drivers/video/mxsfb.c
index d837d63..03cb95a 100644
--- a/drivers/video/mxsfb.c
+++ b/drivers/video/mxsfb.c
@@ -366,7 +366,8 @@ static void mxsfb_disable_controller(struct fb_info *fb_info)
loop--;
}
- writel(VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4 + REG_CLR);
+ reg = readl(host->base + LCDC_VDCTRL4);
+ writel(reg & ~VDCTRL4_SYNC_SIGNALS_ON, host->base + LCDC_VDCTRL4);
clk_disable(host->clk);
--
1.5.6.5
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox