* [PATCH v2] viafb: Automatic OLPC XO-1.5 configuration
From: Daniel Drake @ 2011-05-10 19:55 UTC (permalink / raw)
To: linux-fbdev
Currently, a long set of viafb options are needed to get the XO-1.5
laptop to output video (there is only 1 configuration that works, that
can't really be autodetected).
This patch automatically detects and configures viafb for the XO-1.5
laptop, meaning all that is required for working display is that
viafb is loaded.
Signed-off-by: Daniel Drake <dsd@laptop.org>
---
drivers/video/via/viafbdev.c | 41 ++++++++++++++++++++++++++++++++---------
1 files changed, 32 insertions(+), 9 deletions(-)
v2: incorporates all feedback from Florian
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 7b4390e..7a4dd0e 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/via-core.h>
+#include <asm/olpc.h>
#define _MASTER_FILE
#include "global.h"
@@ -1011,8 +1012,13 @@ static int __init parse_active_dev(void)
/* Note: The previous of active_dev is primary device,
and the following is secondary device. */
if (!viafb_active_dev) {
- viafb_CRT_ON = STATE_ON;
- viafb_SAMM_ON = STATE_OFF;
+ if (machine_is_olpc()) { /* LCD only */
+ viafb_LCD_ON = STATE_ON;
+ viafb_SAMM_ON = STATE_OFF;
+ } else {
+ viafb_CRT_ON = STATE_ON;
+ viafb_SAMM_ON = STATE_OFF;
+ }
} else if (!strcmp(viafb_active_dev, "CRT+DVI")) {
/* CRT+DVI */
viafb_CRT_ON = STATE_ON;
@@ -1665,8 +1671,13 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
char *ptr;
if (!str) {
- *xres = 640;
- *yres = 480;
+ if (machine_is_olpc()) {
+ *xres = 1200;
+ *yres = 900;
+ } else {
+ *xres = 640;
+ *yres = 480;
+ }
return 0;
}
@@ -1922,11 +1933,16 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev)
}
#ifndef MODULE
-static int __init viafb_setup(char *options)
+static int __init viafb_setup(void)
{
char *this_opt;
+ char *options;
+
DEBUG_MSG(KERN_INFO "viafb_setup!\n");
+ if (fb_get_options("viafb", &options))
+ return -ENODEV;
+
if (!options || !*options)
return 0;
@@ -2000,11 +2016,18 @@ static int __init viafb_setup(char *options)
int __init viafb_init(void)
{
u32 dummy_x, dummy_y;
+ int r;
+
+ if (machine_is_olpc()) {
+ /* Apply XO-1.5-specific configuration. */
+ viafb_lcd_panel_id = 23;
+ viafb_bpp = 24;
+ }
+
#ifndef MODULE
- char *option = NULL;
- if (fb_get_options("viafb", &option))
- return -ENODEV;
- viafb_setup(option);
+ r = viafb_setup();
+ if (r < 0)
+ return r;
#endif
if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
|| !viafb_get_mode(dummy_x, dummy_y)
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH V2] fbcon -- fix race between open and removal of framebuffers
From: Jack Stone @ 2011-05-10 21:06 UTC (permalink / raw)
To: Tim Gardner
Cc: linux-fbdev, lethal, linux-kernel, Andy Whitcroft,
Leann Ogasawara
In-Reply-To: <4DC933EE.70409@canonical.com>
Hi Tim,
One more quick question:
On 10/05/2011 13:47, Tim Gardner wrote:
+static struct fb_info *get_framebuffer_info(int idx)
+__acquires(®istered_lock)
+__releases(®istered_lock)
+{
+ struct fb_info *fb_info;
+
+ spin_lock(®istered_lock);
+ fb_info = registered_fb[idx];
+ fb_info->ref_count++;
+ spin_unlock(®istered_lock);
+
+ return fb_info;
+}
[snip]
static int
fb_open(struct inode *inode, struct file *file)
__acquires(&info->lock)
@@ -1363,13 +1421,18 @@ __releases(&info->lock)
if (fbidx >= FB_MAX)
return -ENODEV;
- info = registered_fb[fbidx];
- if (!info)
+ info = get_framebuffer_info(fbidx);
+ if (!info) {
request_module("fb%d", fbidx);
- info = registered_fb[fbidx];
+ info = get_framebuffer_info(fbidx);
+ }
if (!info)
return -ENODEV;
This section of code implies that get_framebuffer_info can return NULL
but in that case wouldn't the fb_info->ref_count++ have oopsed?
You could add the simple case of
if(fb_info)
fb_info->ref_count++
to get_framebuffer_info. That should cover it.
Thanks,
Jack
^ permalink raw reply
* Re: [PATCH V2] fbcon -- fix race between open and removal of framebuffers
From: Jack Stone @ 2011-05-10 21:08 UTC (permalink / raw)
To: Tim Gardner
Cc: linux-fbdev, lethal, linux-kernel, Andy Whitcroft,
Leann Ogasawara
In-Reply-To: <4DC9A8C0.9070502@fastmail.fm>
On 10/05/2011 22:06, Jack Stone wrote:
> Hi Tim,
>
> One more quick question:
>
> On 10/05/2011 13:47, Tim Gardner wrote:
> +static struct fb_info *get_framebuffer_info(int idx)
> +__acquires(®istered_lock)
> +__releases(®istered_lock)
> +{
> + struct fb_info *fb_info;
> +
> + spin_lock(®istered_lock);
> + fb_info = registered_fb[idx];
> + fb_info->ref_count++;
> + spin_unlock(®istered_lock);
> +
> + return fb_info;
> +}
>
> [snip]
>
> static int
> fb_open(struct inode *inode, struct file *file)
> __acquires(&info->lock)
> @@ -1363,13 +1421,18 @@ __releases(&info->lock)
>
> if (fbidx >= FB_MAX)
> return -ENODEV;
> - info = registered_fb[fbidx];
> - if (!info)
> + info = get_framebuffer_info(fbidx);
> + if (!info) {
> request_module("fb%d", fbidx);
> - info = registered_fb[fbidx];
> + info = get_framebuffer_info(fbidx);
> + }
> if (!info)
> return -ENODEV;
>
> This section of code implies that get_framebuffer_info can return NULL
> but in that case wouldn't the fb_info->ref_count++ have oopsed?
>
> You could add the simple case of
>
> if(fb_info)
> fb_info->ref_count++
>
> to get_framebuffer_info. That should cover it.
>
Just read your later patch. Sorry for the extra email.
Thanks,
Jack
^ permalink raw reply
* Re: [PATCH v2] viafb: Automatic OLPC XO-1.5 configuration
From: Florian Tobias Schandinat @ 2011-05-10 21:11 UTC (permalink / raw)
To: linux-fbdev
In-Reply-To: <20110510195546.728739D401C@zog.reactivated.net>
Hi Daniel,
On 05/10/2011 07:55 PM, Daniel Drake wrote:
> Currently, a long set of viafb options are needed to get the XO-1.5
> laptop to output video (there is only 1 configuration that works, that
> can't really be autodetected).
>
> This patch automatically detects and configures viafb for the XO-1.5
> laptop, meaning all that is required for working display is that
> viafb is loaded.
>
> Signed-off-by: Daniel Drake<dsd@laptop.org>
> ---
> drivers/video/via/viafbdev.c | 41 ++++++++++++++++++++++++++++++++---------
> 1 files changed, 32 insertions(+), 9 deletions(-)
>
> v2: incorporates all feedback from Florian
Thanks, this looks much saner, just one little thing (see below)
>
> diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
> index 7b4390e..7a4dd0e 100644
> --- a/drivers/video/via/viafbdev.c
> +++ b/drivers/video/via/viafbdev.c
> @@ -24,6 +24,7 @@
> #include<linux/slab.h>
> #include<linux/stat.h>
> #include<linux/via-core.h>
> +#include<asm/olpc.h>
>
> #define _MASTER_FILE
> #include "global.h"
> @@ -1011,8 +1012,13 @@ static int __init parse_active_dev(void)
> /* Note: The previous of active_dev is primary device,
> and the following is secondary device. */
> if (!viafb_active_dev) {
> - viafb_CRT_ON = STATE_ON;
> - viafb_SAMM_ON = STATE_OFF;
> + if (machine_is_olpc()) { /* LCD only */
> + viafb_LCD_ON = STATE_ON;
> + viafb_SAMM_ON = STATE_OFF;
> + } else {
> + viafb_CRT_ON = STATE_ON;
> + viafb_SAMM_ON = STATE_OFF;
> + }
> } else if (!strcmp(viafb_active_dev, "CRT+DVI")) {
> /* CRT+DVI */
> viafb_CRT_ON = STATE_ON;
> @@ -1665,8 +1671,13 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
> char *ptr;
>
> if (!str) {
> - *xres = 640;
> - *yres = 480;
> + if (machine_is_olpc()) {
> + *xres = 1200;
> + *yres = 900;
> + } else {
> + *xres = 640;
> + *yres = 480;
> + }
> return 0;
> }
>
> @@ -1922,11 +1933,16 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev)
> }
>
> #ifndef MODULE
> -static int __init viafb_setup(char *options)
> +static int __init viafb_setup(void)
> {
> char *this_opt;
> + char *options;
> +
> DEBUG_MSG(KERN_INFO "viafb_setup!\n");
>
> + if (fb_get_options("viafb",&options))
> + return -ENODEV;
> +
> if (!options || !*options)
> return 0;
>
> @@ -2000,11 +2016,18 @@ static int __init viafb_setup(char *options)
> int __init viafb_init(void)
> {
> u32 dummy_x, dummy_y;
> + int r;
> +
> + if (machine_is_olpc()) {
> + /* Apply XO-1.5-specific configuration. */
> + viafb_lcd_panel_id = 23;
> + viafb_bpp = 24;
Can we just drop the viafb_bpp bit?
32$ (they are the same) is the default anyway and other color depths should
also work on the OLPC.
> + }
> +
> #ifndef MODULE
> - char *option = NULL;
> - if (fb_get_options("viafb",&option))
> - return -ENODEV;
> - viafb_setup(option);
> + r = viafb_setup();
> + if (r< 0)
> + return r;
> #endif
> if (parse_mode(viafb_mode,&dummy_x,&dummy_y)
> || !viafb_get_mode(dummy_x, dummy_y)
Thank you very much,
Florian Tobias Schandinat
^ permalink raw reply
* [PATCH v3] viafb: Automatic OLPC XO-1.5 configuration
From: Daniel Drake @ 2011-05-10 21:34 UTC (permalink / raw)
To: linux-fbdev
Currently, a long set of viafb options are needed to get the XO-1.5
laptop to output video (there is only 1 configuration that works, that
can't really be autodetected).
This patch automatically detects and configures viafb for the XO-1.5
laptop, meaning all that is required for working display is that
viafb is loaded.
Signed-off-by: Daniel Drake <dsd@laptop.org>
---
drivers/video/via/viafbdev.c | 39 ++++++++++++++++++++++++++++++---------
1 files changed, 30 insertions(+), 9 deletions(-)
v2: incorporates all feedback from Florian
v3: drop unnecessary viafb_bpp override
diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c
index 7b4390e..cf43c80 100644
--- a/drivers/video/via/viafbdev.c
+++ b/drivers/video/via/viafbdev.c
@@ -24,6 +24,7 @@
#include <linux/slab.h>
#include <linux/stat.h>
#include <linux/via-core.h>
+#include <asm/olpc.h>
#define _MASTER_FILE
#include "global.h"
@@ -1011,8 +1012,13 @@ static int __init parse_active_dev(void)
/* Note: The previous of active_dev is primary device,
and the following is secondary device. */
if (!viafb_active_dev) {
- viafb_CRT_ON = STATE_ON;
- viafb_SAMM_ON = STATE_OFF;
+ if (machine_is_olpc()) { /* LCD only */
+ viafb_LCD_ON = STATE_ON;
+ viafb_SAMM_ON = STATE_OFF;
+ } else {
+ viafb_CRT_ON = STATE_ON;
+ viafb_SAMM_ON = STATE_OFF;
+ }
} else if (!strcmp(viafb_active_dev, "CRT+DVI")) {
/* CRT+DVI */
viafb_CRT_ON = STATE_ON;
@@ -1665,8 +1671,13 @@ static int parse_mode(const char *str, u32 *xres, u32 *yres)
char *ptr;
if (!str) {
- *xres = 640;
- *yres = 480;
+ if (machine_is_olpc()) {
+ *xres = 1200;
+ *yres = 900;
+ } else {
+ *xres = 640;
+ *yres = 480;
+ }
return 0;
}
@@ -1922,11 +1933,16 @@ void __devexit via_fb_pci_remove(struct pci_dev *pdev)
}
#ifndef MODULE
-static int __init viafb_setup(char *options)
+static int __init viafb_setup(void)
{
char *this_opt;
+ char *options;
+
DEBUG_MSG(KERN_INFO "viafb_setup!\n");
+ if (fb_get_options("viafb", &options))
+ return -ENODEV;
+
if (!options || !*options)
return 0;
@@ -2000,11 +2016,16 @@ static int __init viafb_setup(char *options)
int __init viafb_init(void)
{
u32 dummy_x, dummy_y;
+ int r;
+
+ if (machine_is_olpc())
+ /* Apply XO-1.5-specific configuration. */
+ viafb_lcd_panel_id = 23;
+
#ifndef MODULE
- char *option = NULL;
- if (fb_get_options("viafb", &option))
- return -ENODEV;
- viafb_setup(option);
+ r = viafb_setup();
+ if (r < 0)
+ return r;
#endif
if (parse_mode(viafb_mode, &dummy_x, &dummy_y)
|| !viafb_get_mode(dummy_x, dummy_y)
--
1.7.4.4
^ permalink raw reply related
* Re: [PATCH V3] fbcon -- fix race between open and removal of
From: Bruno Prémont @ 2011-05-10 21:44 UTC (permalink / raw)
To: Tim Gardner; +Cc: linux-fbdev, lethal, linux-kernel
In-Reply-To: <4DC94314.8050701@canonical.com>
On Tue, 10 May 2011 Tim Gardner <tim.gardner@canonical.com> wrote:
> From ca3ef33e2235c88856a6257c0be63192ab56c678 Mon Sep 17 00:00:00 2001
> From: Andy Whitcroft <apw@canonical.com>
> Date: Thu, 29 Jul 2010 16:48:20 +0100
> Subject: [PATCH] fbcon -- fix race between open and removal of framebuffers
>
> Currently there is no locking for updates to the registered_fb list.
> This allows an open through /dev/fbN to pick up a registered framebuffer
> pointer in parallel with it being released, as happens when a conflicting
> framebuffer is ejected or on module unload. There is also no reference
> counting on the framebuffer descriptor which is referenced from all open
> files, leading to references to released or reused memory to persist on
> these open files.
>
> This patch adds a reference count to the framebuffer descriptor to prevent
> it from being released until after all pending opens are closed. This
> allows the pending opens to detect the closed status and unmap themselves.
> It also adds locking to the framebuffer lookup path, locking it against
> the removal path such that it is possible to atomically lookup and take a
> reference to the descriptor. It also adds locking to the read and write
> paths which currently could access the framebuffer descriptor after it
> has been freed. Finally it moves the device to FBINFO_STATE_REMOVED to
> indicate that all access should be errored for this device.
What framebuffer drivers was this patch tested with? Just x86 with
mainstream GPU (intel/amd/nvidia KMS) in compination with vgafb/vesafb or
did it see some testing with other framebuffers like those from embedded
world?
Otherwise a much smaller (memory leaking) patch would be to just change
vesafb/vgafb to not free their fb_info after unregistration as was suggested
by Alan Cox.
> Signed-off-by: Andy Whitcroft <apw@canonical.com>
> Acked-by: Stefan Bader <stefan.bader@canonical.com>
> Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
> drivers/video/fbmem.c | 136 ++++++++++++++++++++++++++++++++++++++-----------
> include/linux/fb.h | 2 +
> 2 files changed, 108 insertions(+), 30 deletions(-)
>
> diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c
> index e0c2284..1afe435 100644
> --- a/drivers/video/fbmem.c
> +++ b/drivers/video/fbmem.c
> @@ -42,6 +42,8 @@
>
> #define FBPIXMAPSIZE (1024 * 8)
>
> +/* Protects the registered framebuffer list and count. */
> +static DEFINE_SPINLOCK(registered_lock);
This only partially protects the list and count as two concurrent
framebuffer registrations do still race against each other.
For the issue addressed by this patch I don't think it makes sense to
have this spinlock at all as it's only used in get_framebuffer_info()
and in put_framebuffer_info() and put_framebuffer_info() doesn't even
look at registered_fb or num_registered_fb.
Such a spinlock makes sense in a separate patch that really protects
all access to registered_fb or num_registered_fb, be it during framebuffer
(un)registration or during access from fbcon.
I'm working on a more complete set of patches to get proper locking,
refcount (using kref) and release for struct fb_info but auditing the
various framebuffer drivers will take some time (some of the
open/release counting of drivers can probably get removed once fb_info
is ref-counted). Hopefully I can get some of it out for review on
Thursday evening so others can also look at their respective drivers.
> struct fb_info *registered_fb[FB_MAX] __read_mostly;
> int num_registered_fb __read_mostly;
>
> @@ -694,9 +696,7 @@ static ssize_t
> fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
> {
> unsigned long p = *ppos;
> - struct inode *inode = file->f_path.dentry->d_inode;
> - int fbidx = iminor(inode);
> - struct fb_info *info = registered_fb[fbidx];
> + struct fb_info *info = file->private_data;
> u8 *buffer, *dst;
> u8 __iomem *src;
> int c, cnt = 0, err = 0;
> @@ -705,19 +705,28 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
> if (!info || ! info->screen_base)
> return -ENODEV;
>
> - if (info->state != FBINFO_STATE_RUNNING)
> - return -EPERM;
> + if (!lock_fb_info(info))
> + return -ENODEV;
> +
> + if (info->state != FBINFO_STATE_RUNNING) {
> + err = -EPERM;
> + goto out_fb_info;
> + }
>
> - if (info->fbops->fb_read)
> - return info->fbops->fb_read(info, buf, count, ppos);
> + if (info->fbops->fb_read) {
> + err = info->fbops->fb_read(info, buf, count, ppos);
> + goto out_fb_info;
> + }
>
> total_size = info->screen_size;
>
> if (total_size = 0)
> total_size = info->fix.smem_len;
>
> - if (p >= total_size)
> - return 0;
> + if (p >= total_size) {
> + err = 0;
> + goto out_fb_info;
> + }
>
> if (count >= total_size)
> count = total_size;
> @@ -727,8 +736,10 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
>
> buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
> GFP_KERNEL);
> - if (!buffer)
> - return -ENOMEM;
> + if (!buffer) {
> + err = -ENOMEM;
> + goto out_fb_info;
> + }
>
> src = (u8 __iomem *) (info->screen_base + p);
>
> @@ -751,19 +762,21 @@ fb_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
> cnt += c;
> count -= c;
> }
> + if (!err)
> + err = cnt;
>
> kfree(buffer);
> +out_fb_info:
> + unlock_fb_info(info);
>
> - return (err) ? err : cnt;
> + return err;
> }
>
> static ssize_t
> fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> {
> unsigned long p = *ppos;
> - struct inode *inode = file->f_path.dentry->d_inode;
> - int fbidx = iminor(inode);
> - struct fb_info *info = registered_fb[fbidx];
> + struct fb_info *info = file->private_data;
> u8 *buffer, *src;
> u8 __iomem *dst;
> int c, cnt = 0, err = 0;
> @@ -772,8 +785,13 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> if (!info || !info->screen_base)
> return -ENODEV;
>
> - if (info->state != FBINFO_STATE_RUNNING)
> - return -EPERM;
> + if (!lock_fb_info(info))
> + return -ENODEV;
> +
> + if (info->state != FBINFO_STATE_RUNNING) {
> + err = -EPERM;
> + goto out_fb_info;
> + }
>
> if (info->fbops->fb_write)
> return info->fbops->fb_write(info, buf, count, ppos);
> @@ -783,8 +801,10 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> if (total_size = 0)
> total_size = info->fix.smem_len;
>
> - if (p > total_size)
> - return -EFBIG;
> + if (p > total_size) {
> + err = -EFBIG;
> + goto out_fb_info;
> + }
>
> if (count > total_size) {
> err = -EFBIG;
> @@ -800,8 +820,10 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
>
> buffer = kmalloc((count > PAGE_SIZE) ? PAGE_SIZE : count,
> GFP_KERNEL);
> - if (!buffer)
> - return -ENOMEM;
> + if (!buffer) {
> + err = -ENOMEM;
> + goto out_fb_info;
> + }
>
> dst = (u8 __iomem *) (info->screen_base + p);
>
> @@ -825,10 +847,14 @@ fb_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
> cnt += c;
> count -= c;
> }
> + if (cnt)
> + err = cnt;
>
> kfree(buffer);
> +out_fb_info:
> + unlock_fb_info(info);
>
> - return (cnt) ? cnt : err;
> + return err;
> }
>
> int
> @@ -1303,8 +1329,7 @@ static long fb_compat_ioctl(struct file *file, unsigned int cmd,
> static int
> fb_mmap(struct file *file, struct vm_area_struct * vma)
> {
> - int fbidx = iminor(file->f_path.dentry->d_inode);
> - struct fb_info *info = registered_fb[fbidx];
> + struct fb_info * const info = file->private_data;
> struct fb_ops *fb = info->fbops;
> unsigned long off;
> unsigned long start;
> @@ -1316,6 +1341,11 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
> if (!fb)
> return -ENODEV;
> mutex_lock(&info->mm_lock);
> + if (info->state = FBINFO_STATE_REMOVED) {
> + mutex_unlock(&info->mm_lock);
> + return -ENODEV;
> + }
> +
> if (fb->fb_mmap) {
> int res;
> res = fb->fb_mmap(info, vma);
> @@ -1352,6 +1382,35 @@ fb_mmap(struct file *file, struct vm_area_struct * vma)
> return 0;
> }
>
> +static struct fb_info *get_framebuffer_info(int idx)
> +__acquires(®istered_lock)
> +__releases(®istered_lock)
> +{
> + struct fb_info *fb_info;
> +
> + spin_lock(®istered_lock);
> + fb_info = registered_fb[idx];
> + if (fb_info)
> + fb_info->ref_count++;
> + spin_unlock(®istered_lock);
> +
> + return fb_info;
> +}
> +
> +static void put_framebuffer_info(struct fb_info *fb_info)
> +__acquires(®istered_lock)
> +__releases(®istered_lock)
> +{
> + int keep;
> +
> + spin_lock(®istered_lock);
> + keep = --fb_info->ref_count;
> + spin_unlock(®istered_lock);
> +
> + if (!keep && fb_info->fbops->fb_destroy)
> + fb_info->fbops->fb_destroy(fb_info);
What happens in case fbops->fb_destroy is NULL, we just leak
the framebuffer struct? (I didn't audit frambuffer drivers yet)
Maybe calling framebuffer_release(fb_info) would be a first step.
> +}
> +
> static int
> fb_open(struct inode *inode, struct file *file)
> __acquires(&info->lock)
> @@ -1363,13 +1422,18 @@ __releases(&info->lock)
>
> if (fbidx >= FB_MAX)
> return -ENODEV;
> - info = registered_fb[fbidx];
> - if (!info)
> + info = get_framebuffer_info(fbidx);
> + if (!info) {
> request_module("fb%d", fbidx);
> - info = registered_fb[fbidx];
> + info = get_framebuffer_info(fbidx);
> + }
> if (!info)
> return -ENODEV;
> mutex_lock(&info->lock);
> + if (info->state = FBINFO_STATE_REMOVED) {
> + res = -ENODEV;
> + goto out;
> + }
> if (!try_module_get(info->fbops->owner)) {
> res = -ENODEV;
> goto out;
> @@ -1386,6 +1450,8 @@ __releases(&info->lock)
> #endif
> out:
> mutex_unlock(&info->lock);
> + if (res)
> + put_framebuffer_info(info);
> return res;
> }
>
> @@ -1401,6 +1467,7 @@ __releases(&info->lock)
> info->fbops->fb_release(info,1);
> module_put(info->fbops->owner);
> mutex_unlock(&info->lock);
> + put_framebuffer_info(info);
> return 0;
> }
>
> @@ -1549,6 +1616,7 @@ register_framebuffer(struct fb_info *fb_info)
> fb_info->node = i;
> mutex_init(&fb_info->lock);
> mutex_init(&fb_info->mm_lock);
> + fb_info->ref_count = 1;
>
> fb_info->dev = device_create(fb_class, fb_info->device,
> MKDEV(FB_MAJOR, i), NULL, "fb%d", i);
> @@ -1592,7 +1660,6 @@ register_framebuffer(struct fb_info *fb_info)
> return 0;
> }
>
> -
> /**
> * unregister_framebuffer - releases a frame buffer device
> * @fb_info: frame buffer info structure
> @@ -1627,6 +1694,16 @@ unregister_framebuffer(struct fb_info *fb_info)
> return -ENODEV;
> event.info = fb_info;
> ret = fb_notifier_call_chain(FB_EVENT_FB_UNBIND, &event);
> + if (!ret) {
> + mutex_lock(&fb_info->mm_lock);
> + /*
> + * We must prevent any operations for this transition, we
> + * already have info->lock so grab the info->mm_lock to hold
> + * the remainder.
> + */
> + fb_info->state = FBINFO_STATE_REMOVED;
> + mutex_unlock(&fb_info->mm_lock);
> + }
> unlock_fb_info(fb_info);
>
> if (ret) {
> @@ -1646,8 +1723,7 @@ unregister_framebuffer(struct fb_info *fb_info)
> fb_notifier_call_chain(FB_EVENT_FB_UNREGISTERED, &event);
>
> /* this may free fb info */
> - if (fb_info->fbops->fb_destroy)
> - fb_info->fbops->fb_destroy(fb_info);
> + put_framebuffer_info(fb_info);
> done:
> return ret;
> }
> diff --git a/include/linux/fb.h b/include/linux/fb.h
> index df728c1..60de3fa 100644
> --- a/include/linux/fb.h
> +++ b/include/linux/fb.h
> @@ -834,6 +834,7 @@ struct fb_tile_ops {
> struct fb_info {
> int node;
> int flags;
> + int ref_count;
> struct mutex lock; /* Lock for open/release/ioctl funcs */
> struct mutex mm_lock; /* Lock for fb_mmap and smem_* fields */
> struct fb_var_screeninfo var; /* Current var */
> @@ -873,6 +874,7 @@ struct fb_info {
> void *pseudo_palette; /* Fake palette of 16 colors */
> #define FBINFO_STATE_RUNNING 0
> #define FBINFO_STATE_SUSPENDED 1
> +#define FBINFO_STATE_REMOVED 2
> u32 state; /* Hardware state i.e suspend */
> void *fbcon_par; /* fbcon use-only private area */
> /* From here on everything is device dependent */
^ permalink raw reply
* RE: [PATCH 8/8] OMAP: DSS2: OMAPFB: Reduce stack usage
From: Janorkar, Mayuresh @ 2011-05-11 3:50 UTC (permalink / raw)
To: Valkeinen, Tomi, linux-omap@vger.kernel.org,
linux-fbdev@vger.kernel.org
In-Reply-To: <1305044656-31512-9-git-send-email-tomi.valkeinen@ti.com>
> -----Original Message-----
> From: linux-fbdev-owner@vger.kernel.org [mailto:linux-fbdev-
> owner@vger.kernel.org] On Behalf Of Valkeinen, Tomi
> Sent: Tuesday, May 10, 2011 9:54 PM
> To: linux-omap@vger.kernel.org; linux-fbdev@vger.kernel.org
> Cc: Valkeinen, Tomi
> Subject: [PATCH 8/8] OMAP: DSS2: OMAPFB: Reduce stack usage
>
> omapfb_mode_to_timings() had struct fb_info, struct fb_var and struct
> fb_ops allocated from stack. This caused the stack usage grow quite
> high.
>
> Use kzalloc to allocate the structs instead.
>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
> drivers/video/omap2/omapfb/omapfb-main.c | 49 +++++++++++++++++--------
> -----
> 1 files changed, 28 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/video/omap2/omapfb/omapfb-main.c
> b/drivers/video/omap2/omapfb/omapfb-main.c
> index 30c958b..ae3e2be 100644
> --- a/drivers/video/omap2/omapfb/omapfb-main.c
> +++ b/drivers/video/omap2/omapfb/omapfb-main.c
> @@ -1996,9 +1996,9 @@ static int omapfb_create_framebuffers(struct
> omapfb2_device *fbdev)
> static int omapfb_mode_to_timings(const char *mode_str,
> struct omap_video_timings *timings, u8 *bpp)
> {
> - struct fb_info fbi;
> - struct fb_var_screeninfo var;
> - struct fb_ops fbops;
> + struct fb_info *fbi;
> + struct fb_var_screeninfo *var;
> + struct fb_ops *fbops;
> int r;
>
> #ifdef CONFIG_OMAP2_DSS_VENC
> @@ -2016,25 +2016,25 @@ static int omapfb_mode_to_timings(const char
> *mode_str,
> /* this is quite a hack, but I wanted to use the modedb and for
> * that we need fb_info and var, so we create dummy ones */
>
> - memset(&fbi, 0, sizeof(fbi));
> - memset(&var, 0, sizeof(var));
> - memset(&fbops, 0, sizeof(fbops));
> - fbi.fbops = &fbops;
> + fbi = kzalloc(sizeof(*fbi), GFP_KERNEL);
If memory allocation fails, kzalloc would return NULL,
It is good to check for this condition
> + var = kzalloc(sizeof(*var), GFP_KERNEL);
> + fbops = kzalloc(sizeof(*fbops), GFP_KERNEL);
Same at these two places
> + fbi->fbops = fbops;
>
> - r = fb_find_mode(&var, &fbi, mode_str, NULL, 0, NULL, 24);
> + r = fb_find_mode(var, fbi, mode_str, NULL, 0, NULL, 24);
>
> if (r != 0) {
> - timings->pixel_clock = PICOS2KHZ(var.pixclock);
> - timings->hbp = var.left_margin;
> - timings->hfp = var.right_margin;
> - timings->vbp = var.upper_margin;
> - timings->vfp = var.lower_margin;
> - timings->hsw = var.hsync_len;
> - timings->vsw = var.vsync_len;
> - timings->x_res = var.xres;
> - timings->y_res = var.yres;
> -
> - switch (var.bits_per_pixel) {
> + timings->pixel_clock = PICOS2KHZ(var->pixclock);
> + timings->hbp = var->left_margin;
> + timings->hfp = var->right_margin;
> + timings->vbp = var->upper_margin;
> + timings->vfp = var->lower_margin;
> + timings->hsw = var->hsync_len;
> + timings->vsw = var->vsync_len;
> + timings->x_res = var->xres;
> + timings->y_res = var->yres;
> +
> + switch (var->bits_per_pixel) {
> case 16:
> *bpp = 16;
> break;
> @@ -2045,10 +2045,17 @@ static int omapfb_mode_to_timings(const char
> *mode_str,
> break;
> }
>
> - return 0;
> + r = 0;
> } else {
> - return -EINVAL;
> + *bpp = 0;
> + r = -EINVAL;
> }
> +
> + kfree(fbi);
> + kfree(var);
> + kfree(fbops);
> +
> + return r;
> }
>
> static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [PATCH 0/8] OMAP: DSS2: Miscellaneous patches
From: Janorkar, Mayuresh @ 2011-05-11 3:57 UTC (permalink / raw)
To: Valkeinen, Tomi, linux-omap@vger.kernel.org,
linux-fbdev@vger.kernel.org
In-Reply-To: <1305044656-31512-1-git-send-email-tomi.valkeinen@ti.com>
> -----Original Message-----
> From: linux-fbdev-owner@vger.kernel.org [mailto:linux-fbdev-
> owner@vger.kernel.org] On Behalf Of Valkeinen, Tomi
> Sent: Tuesday, May 10, 2011 9:54 PM
> To: linux-omap@vger.kernel.org; linux-fbdev@vger.kernel.org
> Cc: Valkeinen, Tomi
> Subject: [PATCH 0/8] OMAP: DSS2: Miscellaneous patches
>
> Here are some smallish fixes and cleanups I made while porting N800's
> display
> driver to DSS2.
>
> Tomi
>
> Tomi Valkeinen (8):
> OMAP: DSS2: Add missing dummy functions
> OMAPFB: fix wrong clock aliases and device name
> OMAP: DSS2: RFBI: add rfbi_bus_lock
> OMAP: DSS2: RFIB: clock enable/disable changes
RFIB a typo?
> OMAP: DSS2: RFBI: add omap_rfbi_configure
> OMAP: DSS2: RFIB: cleanup
Same here
> OMAP: DSS2: OMAPFB: remove dead code
> OMAP: DSS2: OMAPFB: Reduce stack usage
>
> arch/arm/plat-omap/include/plat/display.h | 4 +
> drivers/video/omap/dispc.c | 4 +-
> drivers/video/omap/omapfb_main.c | 2 +-
> drivers/video/omap/rfbi.c | 2 +-
If the series touches drivers/video/omap then the title should be "DSS and DSS2" using only DSS2 is misleading.
> drivers/video/omap2/dss/dss.h | 28 ++++-
> drivers/video/omap2/dss/rfbi.c | 174 +++++-------------------
> -----
> drivers/video/omap2/omapfb/omapfb-main.c | 78 +++++--------
> 7 files changed, 86 insertions(+), 206 deletions(-)
>
> --
> 1.7.4.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* RE: [PATCH 8/8] OMAP: DSS2: OMAPFB: Reduce stack usage
From: Tomi Valkeinen @ 2011-05-11 6:11 UTC (permalink / raw)
To: aaro.koskinen; +Cc: linux-omap, linux-fbdev
In-Reply-To: <CA1B555B4D79E3448D96A7C9847C7D9805EFB4C7@008-AM1MPN1-031.mgdnok.nokia.com>
On Tue, 2011-05-10 at 19:08 +0000, aaro.koskinen@nokia.com wrote:
> Hi,
>
> Tomi Valkeinen [tomi.valkeinen@ti.com]:
> > omapfb_mode_to_timings() had struct fb_info, struct fb_var and struct
> > fb_ops allocated from stack. This caused the stack usage grow quite
> > high.
> >
> > Use kzalloc to allocate the structs instead.
>
> [...]
>
> > + fbi = kzalloc(sizeof(*fbi), GFP_KERNEL);
> > + var = kzalloc(sizeof(*var), GFP_KERNEL);
> > + fbops = kzalloc(sizeof(*fbops), GFP_KERNEL);
> > + fbi->fbops = fbops;
>
> You should check and prepare for allocation failures.
So I should. Thanks!
Tomi
^ permalink raw reply
* RE: [PATCH 0/8] OMAP: DSS2: Miscellaneous patches
From: Tomi Valkeinen @ 2011-05-11 6:12 UTC (permalink / raw)
To: Janorkar, Mayuresh
Cc: linux-omap@vger.kernel.org, linux-fbdev@vger.kernel.org
In-Reply-To: <EAF47CD23C76F840A9E7FCE10091EFAB033DBC0B9D@dbde02.ent.ti.com>
On Wed, 2011-05-11 at 09:15 +0530, Janorkar, Mayuresh wrote:
>
> > -----Original Message-----
> > From: linux-fbdev-owner@vger.kernel.org [mailto:linux-fbdev-
> > owner@vger.kernel.org] On Behalf Of Valkeinen, Tomi
> > Sent: Tuesday, May 10, 2011 9:54 PM
> > To: linux-omap@vger.kernel.org; linux-fbdev@vger.kernel.org
> > Cc: Valkeinen, Tomi
> > Subject: [PATCH 0/8] OMAP: DSS2: Miscellaneous patches
> >
> > Here are some smallish fixes and cleanups I made while porting N800's
> > display
> > driver to DSS2.
> >
> > Tomi
> >
> > Tomi Valkeinen (8):
> > OMAP: DSS2: Add missing dummy functions
> > OMAPFB: fix wrong clock aliases and device name
> > OMAP: DSS2: RFBI: add rfbi_bus_lock
> > OMAP: DSS2: RFIB: clock enable/disable changes
> RFIB a typo?
>
> > OMAP: DSS2: RFBI: add omap_rfbi_configure
> > OMAP: DSS2: RFIB: cleanup
> Same here
>
> > OMAP: DSS2: OMAPFB: remove dead code
> > OMAP: DSS2: OMAPFB: Reduce stack usage
> >
> > arch/arm/plat-omap/include/plat/display.h | 4 +
> > drivers/video/omap/dispc.c | 4 +-
> > drivers/video/omap/omapfb_main.c | 2 +-
> > drivers/video/omap/rfbi.c | 2 +-
>
> If the series touches drivers/video/omap then the title should be "DSS and DSS2" using only DSS2 is misleading.
Right you are. Although the old driver was never called "DSS", but I'll
improve the subject. Thanks!
Tomi
^ permalink raw reply
* [PATCH 0/3] OMAP: DSS2: Move header files to include/video/
From: Tomi Valkeinen @ 2011-05-11 12:26 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: tony, Tomi Valkeinen
OMAP Display Subsystem driver header files are currently located in
arch/arm/plat-omap/include/plat/ which is not a good place for driver headers.
This patch set moves the headers to a more suitable location at include/video/
and renaming the files as follows:
display.h -> omapdss.h
panel-generic-dpi.h -> omap-panel-generic-dpi.h
nokia-dsi-panel.h -> omap-panel-nokia-dsi.h
Tomi
Tomi Valkeinen (3):
OMAP: DSS2: Move display.h to include/video/
OMAP: DSS2: Move panel-generic-dpi.h to include/video/
OMAP: DSS2: Move nokia-dsi-panel.h to include/video/
arch/arm/mach-omap2/board-3430sdp.c | 4 ++--
arch/arm/mach-omap2/board-4430sdp.c | 2 +-
arch/arm/mach-omap2/board-am3517evm.c | 4 ++--
arch/arm/mach-omap2/board-cm-t35.c | 4 ++--
arch/arm/mach-omap2/board-devkit8000.c | 4 ++--
arch/arm/mach-omap2/board-igep0020.c | 4 ++--
arch/arm/mach-omap2/board-omap3beagle.c | 4 ++--
arch/arm/mach-omap2/board-omap3evm.c | 4 ++--
arch/arm/mach-omap2/board-omap3pandora.c | 2 +-
arch/arm/mach-omap2/board-omap3stalker.c | 4 ++--
arch/arm/mach-omap2/board-omap4panda.c | 4 ++--
arch/arm/mach-omap2/board-overo.c | 4 ++--
arch/arm/mach-omap2/board-rx51-video.c | 2 +-
arch/arm/mach-omap2/board-zoom-display.c | 2 +-
arch/arm/mach-omap2/display.c | 2 +-
arch/arm/mach-omap2/include/mach/board-zoom.h | 2 +-
drivers/media/video/omap/omap_vout.c | 2 +-
drivers/media/video/omap/omap_voutdef.h | 2 +-
drivers/video/omap2/displays/panel-acx565akm.c | 2 +-
drivers/video/omap2/displays/panel-generic-dpi.c | 3 ++-
.../omap2/displays/panel-lgphilips-lb035q02.c | 2 +-
.../omap2/displays/panel-nec-nl8048hl11-01b.c | 2 +-
.../video/omap2/displays/panel-sharp-ls037v7dw01.c | 2 +-
drivers/video/omap2/displays/panel-taal.c | 4 ++--
.../video/omap2/displays/panel-tpo-td043mtea1.c | 2 +-
drivers/video/omap2/dss/core.c | 2 +-
drivers/video/omap2/dss/dispc.c | 2 +-
drivers/video/omap2/dss/display.c | 2 +-
drivers/video/omap2/dss/dpi.c | 2 +-
drivers/video/omap2/dss/dsi.c | 2 +-
drivers/video/omap2/dss/dss.c | 2 +-
drivers/video/omap2/dss/dss_features.c | 2 +-
drivers/video/omap2/dss/hdmi.c | 2 +-
drivers/video/omap2/dss/hdmi.h | 2 +-
drivers/video/omap2/dss/hdmi_omap4_panel.c | 2 +-
drivers/video/omap2/dss/manager.c | 2 +-
drivers/video/omap2/dss/overlay.c | 2 +-
drivers/video/omap2/dss/rfbi.c | 2 +-
drivers/video/omap2/dss/sdi.c | 2 +-
drivers/video/omap2/dss/venc.c | 2 +-
drivers/video/omap2/omapfb/omapfb-ioctl.c | 2 +-
drivers/video/omap2/omapfb/omapfb-main.c | 2 +-
drivers/video/omap2/omapfb/omapfb-sysfs.c | 2 +-
drivers/video/omap2/omapfb/omapfb.h | 2 +-
.../video/omap-panel-generic-dpi.h | 8 ++++----
.../video/omap-panel-nokia-dsi.h | 8 ++++----
.../plat/display.h => include/video/omapdss.h | 6 ++----
47 files changed, 66 insertions(+), 67 deletions(-)
rename arch/arm/plat-omap/include/plat/panel-generic-dpi.h => include/video/omap-panel-generic-dpi.h (86%)
rename arch/arm/plat-omap/include/plat/nokia-dsi-panel.h => include/video/omap-panel-nokia-dsi.h (79%)
rename arch/arm/plat-omap/include/plat/display.h => include/video/omapdss.h (99%)
--
1.7.4.1
^ permalink raw reply
* [PATCH 1/3] OMAP: DSS2: Move display.h to include/video/
From: Tomi Valkeinen @ 2011-05-11 12:26 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: tony, Tomi Valkeinen
In-Reply-To: <1305116790-24067-1-git-send-email-tomi.valkeinen@ti.com>
arch/arm/plat-omap/include/plat/display.h is an include for the OMAP DSS
driver. A more logical place for it is in include/video.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-4430sdp.c | 2 +-
arch/arm/mach-omap2/board-am3517evm.c | 2 +-
arch/arm/mach-omap2/board-cm-t35.c | 2 +-
arch/arm/mach-omap2/board-devkit8000.c | 2 +-
arch/arm/mach-omap2/board-igep0020.c | 2 +-
arch/arm/mach-omap2/board-omap3beagle.c | 2 +-
arch/arm/mach-omap2/board-omap3evm.c | 2 +-
arch/arm/mach-omap2/board-omap3pandora.c | 2 +-
arch/arm/mach-omap2/board-omap3stalker.c | 2 +-
arch/arm/mach-omap2/board-omap4panda.c | 2 +-
arch/arm/mach-omap2/board-overo.c | 2 +-
arch/arm/mach-omap2/board-rx51-video.c | 2 +-
arch/arm/mach-omap2/board-zoom-display.c | 2 +-
arch/arm/mach-omap2/display.c | 2 +-
arch/arm/mach-omap2/include/mach/board-zoom.h | 2 +-
arch/arm/plat-omap/include/plat/nokia-dsi-panel.h | 2 +-
.../arm/plat-omap/include/plat/panel-generic-dpi.h | 2 +-
drivers/media/video/omap/omap_vout.c | 2 +-
drivers/media/video/omap/omap_voutdef.h | 2 +-
drivers/video/omap2/displays/panel-acx565akm.c | 2 +-
drivers/video/omap2/displays/panel-generic-dpi.c | 1 +
.../omap2/displays/panel-lgphilips-lb035q02.c | 2 +-
.../omap2/displays/panel-nec-nl8048hl11-01b.c | 2 +-
.../video/omap2/displays/panel-sharp-ls037v7dw01.c | 2 +-
drivers/video/omap2/displays/panel-taal.c | 2 +-
.../video/omap2/displays/panel-tpo-td043mtea1.c | 2 +-
drivers/video/omap2/dss/core.c | 2 +-
drivers/video/omap2/dss/dispc.c | 2 +-
drivers/video/omap2/dss/display.c | 2 +-
drivers/video/omap2/dss/dpi.c | 2 +-
drivers/video/omap2/dss/dsi.c | 2 +-
drivers/video/omap2/dss/dss.c | 2 +-
drivers/video/omap2/dss/dss_features.c | 2 +-
drivers/video/omap2/dss/hdmi.c | 2 +-
drivers/video/omap2/dss/hdmi.h | 2 +-
drivers/video/omap2/dss/hdmi_omap4_panel.c | 2 +-
drivers/video/omap2/dss/manager.c | 2 +-
drivers/video/omap2/dss/overlay.c | 2 +-
drivers/video/omap2/dss/rfbi.c | 2 +-
drivers/video/omap2/dss/sdi.c | 2 +-
drivers/video/omap2/dss/venc.c | 2 +-
drivers/video/omap2/omapfb/omapfb-ioctl.c | 2 +-
drivers/video/omap2/omapfb/omapfb-main.c | 2 +-
drivers/video/omap2/omapfb/omapfb-sysfs.c | 2 +-
drivers/video/omap2/omapfb/omapfb.h | 2 +-
.../plat/display.h => include/video/omapdss.h | 6 ++----
47 files changed, 48 insertions(+), 49 deletions(-)
rename arch/arm/plat-omap/include/plat/display.h => include/video/omapdss.h (99%)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 9afd087..80bc0d3 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -37,7 +37,7 @@
#include <plat/common.h>
#include <plat/dma.h>
#include <plat/gpmc.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <plat/gpmc-smc91x.h>
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 56702c5..309bdad 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -36,7 +36,7 @@
#include <plat/usb.h>
#include <plat/mmc.h>
#include <plat/omap4-keypad.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "mux.h"
#include "hsmmc.h"
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index ce7d5e6..7e634c8 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -34,7 +34,7 @@
#include <plat/board.h>
#include <plat/common.h>
#include <plat/usb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index 02a12b4..a98de28 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -45,7 +45,7 @@
#include <plat/nand.h>
#include <plat/gpmc.h>
#include <plat/usb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <plat/mcspi.h>
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 65f9fde..2bdfd58 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -45,7 +45,7 @@
#include <plat/gpmc.h>
#include <plat/nand.h>
#include <plat/usb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <plat/mcspi.h>
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 34cf982..183db91 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -31,7 +31,7 @@
#include <plat/common.h>
#include <plat/gpmc.h>
#include <plat/usb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <plat/onenand.h>
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 33007fd..74d6b7b 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -41,7 +41,7 @@
#include <plat/board.h>
#include <plat/common.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <plat/gpmc.h>
#include <plat/nand.h>
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index 5a1a916..f75015b 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -44,7 +44,7 @@
#include <plat/usb.h>
#include <plat/common.h>
#include <plat/mcspi.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index 07dba88..1db1549 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -46,7 +46,7 @@
#include <mach/hardware.h>
#include <plat/mcspi.h>
#include <plat/usb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/nand.h>
#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index a6e0b91..e5fdfe8 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -39,7 +39,7 @@
#include <plat/gpmc.h>
#include <plat/nand.h>
#include <plat/usb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <plat/mcspi.h>
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index f3a7b10..9ec9a17 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -34,7 +34,7 @@
#include <asm/mach-types.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/board.h>
#include <plat/common.h>
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 59ca333..ff28880 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -43,7 +43,7 @@
#include <plat/board.h>
#include <plat/common.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
#include <mach/gpio.h>
#include <plat/gpmc.h>
diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c
index 89a66db..2df10b6 100644
--- a/arch/arm/mach-omap2/board-rx51-video.c
+++ b/arch/arm/mach-omap2/board-rx51-video.c
@@ -15,7 +15,7 @@
#include <linux/spi/spi.h>
#include <linux/mm.h>
#include <asm/mach-types.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/vram.h>
#include <plat/mcspi.h>
diff --git a/arch/arm/mach-omap2/board-zoom-display.c b/arch/arm/mach-omap2/board-zoom-display.c
index 37b84c2..60e8645 100644
--- a/arch/arm/mach-omap2/board-zoom-display.c
+++ b/arch/arm/mach-omap2/board-zoom-display.c
@@ -15,7 +15,7 @@
#include <linux/i2c/twl.h>
#include <linux/spi/spi.h>
#include <plat/mcspi.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#define LCD_PANEL_RESET_GPIO_PROD 96
#define LCD_PANEL_RESET_GPIO_PILOT 55
diff --git a/arch/arm/mach-omap2/display.c b/arch/arm/mach-omap2/display.c
index 256d23f..faebcbc 100644
--- a/arch/arm/mach-omap2/display.c
+++ b/arch/arm/mach-omap2/display.c
@@ -22,7 +22,7 @@
#include <linux/clk.h>
#include <linux/err.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/omap_hwmod.h>
#include <plat/omap_device.h>
diff --git a/arch/arm/mach-omap2/include/mach/board-zoom.h b/arch/arm/mach-omap2/include/mach/board-zoom.h
index d20bd9c..775fdc3 100644
--- a/arch/arm/mach-omap2/include/mach/board-zoom.h
+++ b/arch/arm/mach-omap2/include/mach/board-zoom.h
@@ -1,7 +1,7 @@
/*
* Defines for zoom boards
*/
-#include <plat/display.h>
+#include <video/omapdss.h>
#define ZOOM_NAND_CS 0
diff --git a/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h b/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
index 01ab657..4d1e794 100644
--- a/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
+++ b/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
@@ -1,7 +1,7 @@
#ifndef __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H
#define __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H
-#include "display.h"
+struct omap_dss_device;
/**
* struct nokia_dsi_panel_data - Nokia DSI panel driver configuration
diff --git a/arch/arm/plat-omap/include/plat/panel-generic-dpi.h b/arch/arm/plat-omap/include/plat/panel-generic-dpi.h
index 7906197..b037030 100644
--- a/arch/arm/plat-omap/include/plat/panel-generic-dpi.h
+++ b/arch/arm/plat-omap/include/plat/panel-generic-dpi.h
@@ -20,7 +20,7 @@
#ifndef __ARCH_ARM_PLAT_OMAP_PANEL_GENERIC_DPI_H
#define __ARCH_ARM_PLAT_OMAP_PANEL_GENERIC_DPI_H
-#include "display.h"
+struct omap_dss_device;
/**
* struct panel_generic_dpi_data - panel driver configuration data
diff --git a/drivers/media/video/omap/omap_vout.c b/drivers/media/video/omap/omap_vout.c
index d4fe7bc..4ada9be 100644
--- a/drivers/media/video/omap/omap_vout.c
+++ b/drivers/media/video/omap/omap_vout.c
@@ -47,7 +47,7 @@
#include <plat/dma.h>
#include <plat/vram.h>
#include <plat/vrfb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "omap_voutlib.h"
#include "omap_voutdef.h"
diff --git a/drivers/media/video/omap/omap_voutdef.h b/drivers/media/video/omap/omap_voutdef.h
index ea3a047..659497b 100644
--- a/drivers/media/video/omap/omap_voutdef.h
+++ b/drivers/media/video/omap/omap_voutdef.h
@@ -11,7 +11,7 @@
#ifndef OMAP_VOUTDEF_H
#define OMAP_VOUTDEF_H
-#include <plat/display.h>
+#include <video/omapdss.h>
#define YUYV_BPP 2
#define RGB565_BPP 2
diff --git a/drivers/video/omap2/displays/panel-acx565akm.c b/drivers/video/omap2/displays/panel-acx565akm.c
index 7e04c92..dbd59b8 100644
--- a/drivers/video/omap2/displays/panel-acx565akm.c
+++ b/drivers/video/omap2/displays/panel-acx565akm.c
@@ -30,7 +30,7 @@
#include <linux/backlight.h>
#include <linux/fb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#define MIPID_CMD_READ_DISP_ID 0x04
#define MIPID_CMD_READ_RED 0x06
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index 4a9b9ff..cc9dc70 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -33,6 +33,7 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/slab.h>
+#include <video/omapdss.h>
#include <plat/panel-generic-dpi.h>
diff --git a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
index 271324d..e0eb35b 100644
--- a/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
+++ b/drivers/video/omap2/displays/panel-lgphilips-lb035q02.c
@@ -21,7 +21,7 @@
#include <linux/spi/spi.h>
#include <linux/mutex.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
struct lb035q02_data {
struct mutex lock;
diff --git a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
index 925e0fa..2ba9d0c 100644
--- a/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
+++ b/drivers/video/omap2/displays/panel-nec-nl8048hl11-01b.c
@@ -22,7 +22,7 @@
#include <linux/backlight.h>
#include <linux/fb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#define LCD_XRES 800
#define LCD_YRES 480
diff --git a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
index d2b35d2..bc142a0 100644
--- a/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
+++ b/drivers/video/omap2/displays/panel-sharp-ls037v7dw01.c
@@ -25,7 +25,7 @@
#include <linux/err.h>
#include <linux/slab.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
struct sharp_data {
struct backlight_device *bl;
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index adc9900..4673517 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -33,7 +33,7 @@
#include <linux/regulator/consumer.h>
#include <linux/mutex.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/nokia-dsi-panel.h>
/* DSI Virtual channel. Hardcoded for now. */
diff --git a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
index dbe9d43..62bff58 100644
--- a/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
+++ b/drivers/video/omap2/displays/panel-tpo-td043mtea1.c
@@ -17,7 +17,7 @@
#include <linux/err.h>
#include <linux/slab.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#define TPO_R02_MODE(x) ((x) & 7)
#define TPO_R02_MODE_800x480 7
diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 1aa2ed1..3a8047a 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -33,7 +33,7 @@
#include <linux/device.h>
#include <linux/regulator/consumer.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "dss.h"
#include "dss_features.h"
diff --git a/drivers/video/omap2/dss/dispc.c b/drivers/video/omap2/dss/dispc.c
index 7804779..21de352 100644
--- a/drivers/video/omap2/dss/dispc.c
+++ b/drivers/video/omap2/dss/dispc.c
@@ -37,7 +37,7 @@
#include <plat/sram.h>
#include <plat/clock.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "dss.h"
#include "dss_features.h"
diff --git a/drivers/video/omap2/dss/display.c b/drivers/video/omap2/dss/display.c
index a85a6f3..696369c 100644
--- a/drivers/video/omap2/dss/display.c
+++ b/drivers/video/omap2/dss/display.c
@@ -27,7 +27,7 @@
#include <linux/jiffies.h>
#include <linux/platform_device.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "dss.h"
static ssize_t display_enabled_show(struct device *dev,
diff --git a/drivers/video/omap2/dss/dpi.c b/drivers/video/omap2/dss/dpi.c
index 2d3ca4c..8ed86f8 100644
--- a/drivers/video/omap2/dss/dpi.c
+++ b/drivers/video/omap2/dss/dpi.c
@@ -30,7 +30,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/cpu.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/dsi.c b/drivers/video/omap2/dss/dsi.c
index 0a7f1a4..5c95770 100644
--- a/drivers/video/omap2/dss/dsi.c
+++ b/drivers/video/omap2/dss/dsi.c
@@ -34,7 +34,7 @@
#include <linux/wait.h>
#include <linux/workqueue.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/clock.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/dss.c b/drivers/video/omap2/dss/dss.c
index 3f1fee6..606a182 100644
--- a/drivers/video/omap2/dss/dss.c
+++ b/drivers/video/omap2/dss/dss.c
@@ -29,7 +29,7 @@
#include <linux/seq_file.h>
#include <linux/clk.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/clock.h>
#include "dss.h"
#include "dss_features.h"
diff --git a/drivers/video/omap2/dss/dss_features.c b/drivers/video/omap2/dss/dss_features.c
index aa16222..9ed2033 100644
--- a/drivers/video/omap2/dss/dss_features.c
+++ b/drivers/video/omap2/dss/dss_features.c
@@ -22,7 +22,7 @@
#include <linux/err.h>
#include <linux/slab.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/cpu.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/hdmi.c b/drivers/video/omap2/dss/hdmi.c
index a981def..86e32bd 100644
--- a/drivers/video/omap2/dss/hdmi.c
+++ b/drivers/video/omap2/dss/hdmi.c
@@ -29,7 +29,7 @@
#include <linux/mutex.h>
#include <linux/delay.h>
#include <linux/string.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "dss.h"
#include "hdmi.h"
diff --git a/drivers/video/omap2/dss/hdmi.h b/drivers/video/omap2/dss/hdmi.h
index 9887ab9..4d385f6 100644
--- a/drivers/video/omap2/dss/hdmi.h
+++ b/drivers/video/omap2/dss/hdmi.h
@@ -22,7 +22,7 @@
#define _OMAP4_DSS_HDMI_H_
#include <linux/string.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#define HDMI_WP 0x0
#define HDMI_CORE_SYS 0x400
diff --git a/drivers/video/omap2/dss/hdmi_omap4_panel.c b/drivers/video/omap2/dss/hdmi_omap4_panel.c
index ffb5de9..7d4f2bd 100644
--- a/drivers/video/omap2/dss/hdmi_omap4_panel.c
+++ b/drivers/video/omap2/dss/hdmi_omap4_panel.c
@@ -24,7 +24,7 @@
#include <linux/io.h>
#include <linux/mutex.h>
#include <linux/module.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/manager.c b/drivers/video/omap2/dss/manager.c
index bcd37ec..ee38ca2 100644
--- a/drivers/video/omap2/dss/manager.c
+++ b/drivers/video/omap2/dss/manager.c
@@ -29,7 +29,7 @@
#include <linux/spinlock.h>
#include <linux/jiffies.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/cpu.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/overlay.c b/drivers/video/omap2/dss/overlay.c
index f1aca6d..35ef7d1 100644
--- a/drivers/video/omap2/dss/overlay.c
+++ b/drivers/video/omap2/dss/overlay.c
@@ -31,7 +31,7 @@
#include <linux/delay.h>
#include <linux/slab.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/cpu.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 5ea17f4..0985f2f 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -33,7 +33,7 @@
#include <linux/hrtimer.h>
#include <linux/seq_file.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include "dss.h"
struct rfbi_reg { u16 idx; };
diff --git a/drivers/video/omap2/dss/sdi.c b/drivers/video/omap2/dss/sdi.c
index 54a53e6..0bd4b03 100644
--- a/drivers/video/omap2/dss/sdi.c
+++ b/drivers/video/omap2/dss/sdi.c
@@ -25,7 +25,7 @@
#include <linux/err.h>
#include <linux/regulator/consumer.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/cpu.h>
#include "dss.h"
diff --git a/drivers/video/omap2/dss/venc.c b/drivers/video/omap2/dss/venc.c
index 8e35a5b..3269301 100644
--- a/drivers/video/omap2/dss/venc.c
+++ b/drivers/video/omap2/dss/venc.c
@@ -34,7 +34,7 @@
#include <linux/platform_device.h>
#include <linux/regulator/consumer.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/cpu.h>
#include "dss.h"
diff --git a/drivers/video/omap2/omapfb/omapfb-ioctl.c b/drivers/video/omap2/omapfb/omapfb-ioctl.c
index 6f43545..3e4ee4d 100644
--- a/drivers/video/omap2/omapfb/omapfb-ioctl.c
+++ b/drivers/video/omap2/omapfb/omapfb-ioctl.c
@@ -28,7 +28,7 @@
#include <linux/omapfb.h>
#include <linux/vmalloc.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/vrfb.h>
#include <plat/vram.h>
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 505ec66..606f6ee 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -30,7 +30,7 @@
#include <linux/platform_device.h>
#include <linux/omapfb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/vram.h>
#include <plat/vrfb.h>
diff --git a/drivers/video/omap2/omapfb/omapfb-sysfs.c b/drivers/video/omap2/omapfb/omapfb-sysfs.c
index 6f9c72c..3be7646 100644
--- a/drivers/video/omap2/omapfb/omapfb-sysfs.c
+++ b/drivers/video/omap2/omapfb/omapfb-sysfs.c
@@ -29,7 +29,7 @@
#include <linux/mm.h>
#include <linux/omapfb.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#include <plat/vrfb.h>
#include "omapfb.h"
diff --git a/drivers/video/omap2/omapfb/omapfb.h b/drivers/video/omap2/omapfb/omapfb.h
index 1305fc9..4d1cff9 100644
--- a/drivers/video/omap2/omapfb/omapfb.h
+++ b/drivers/video/omap2/omapfb/omapfb.h
@@ -29,7 +29,7 @@
#include <linux/rwsem.h>
-#include <plat/display.h>
+#include <video/omapdss.h>
#ifdef DEBUG
extern unsigned int omapfb_debug;
diff --git a/arch/arm/plat-omap/include/plat/display.h b/include/video/omapdss.h
similarity index 99%
rename from arch/arm/plat-omap/include/plat/display.h
rename to include/video/omapdss.h
index 5e04ddc..3973868 100644
--- a/arch/arm/plat-omap/include/plat/display.h
+++ b/include/video/omapdss.h
@@ -1,6 +1,4 @@
/*
- * linux/include/asm-arm/arch-omap/display.h
- *
* Copyright (C) 2008 Nokia Corporation
* Author: Tomi Valkeinen <tomi.valkeinen@nokia.com>
*
@@ -17,8 +15,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ASM_ARCH_OMAP_DISPLAY_H
-#define __ASM_ARCH_OMAP_DISPLAY_H
+#ifndef __OMAP_OMAPDSS_H
+#define __OMAP_OMAPDSS_H
#include <linux/list.h>
#include <linux/kobject.h>
--
1.7.4.1
^ permalink raw reply related
* [PATCH 2/3] OMAP: DSS2: Move panel-generic-dpi.h to include/video/
From: Tomi Valkeinen @ 2011-05-11 12:26 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: tony, Tomi Valkeinen
In-Reply-To: <1305116790-24067-1-git-send-email-tomi.valkeinen@ti.com>
arch/arm/plat-omap/include/plat/panel-generic-dpi.h is an include for
the OMAP DSS panel driver for generic DPI displays. A more logical place
for it is in include/video.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
arch/arm/mach-omap2/board-3430sdp.c | 2 +-
arch/arm/mach-omap2/board-am3517evm.c | 2 +-
arch/arm/mach-omap2/board-cm-t35.c | 2 +-
arch/arm/mach-omap2/board-devkit8000.c | 2 +-
arch/arm/mach-omap2/board-igep0020.c | 2 +-
arch/arm/mach-omap2/board-omap3beagle.c | 2 +-
arch/arm/mach-omap2/board-omap3evm.c | 2 +-
arch/arm/mach-omap2/board-omap3stalker.c | 2 +-
arch/arm/mach-omap2/board-omap4panda.c | 2 +-
arch/arm/mach-omap2/board-overo.c | 2 +-
drivers/video/omap2/displays/panel-generic-dpi.c | 2 +-
.../video/omap-panel-generic-dpi.h | 6 +++---
12 files changed, 14 insertions(+), 14 deletions(-)
rename arch/arm/plat-omap/include/plat/panel-generic-dpi.h => include/video/omap-panel-generic-dpi.h (88%)
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index 80bc0d3..23244cd 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -38,7 +38,7 @@
#include <plat/dma.h>
#include <plat/gpmc.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <plat/gpmc-smc91x.h>
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index 7e634c8..ff8c59b 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -35,7 +35,7 @@
#include <plat/common.h>
#include <plat/usb.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include "mux.h"
#include "control.h"
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index a98de28..9340f6a 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -46,7 +46,7 @@
#include <plat/gpmc.h>
#include <plat/usb.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <plat/mcspi.h>
#include <mach/hardware.h>
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 2bdfd58..1d1b56a 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -46,7 +46,7 @@
#include <plat/nand.h>
#include <plat/usb.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <plat/mcspi.h>
#include <linux/input/matrix_keypad.h>
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index 183db91..3da64d3 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -32,7 +32,7 @@
#include <plat/gpmc.h>
#include <plat/usb.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <plat/onenand.h>
#include "mux.h"
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 74d6b7b..97750d4 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -42,7 +42,7 @@
#include <plat/board.h>
#include <plat/common.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <plat/gpmc.h>
#include <plat/nand.h>
#include <plat/usb.h>
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index f75015b..7f94ccc 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -45,7 +45,7 @@
#include <plat/common.h>
#include <plat/mcspi.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include "mux.h"
#include "sdram-micron-mt46h32m32lf-6.h"
diff --git a/arch/arm/mach-omap2/board-omap3stalker.c b/arch/arm/mach-omap2/board-omap3stalker.c
index e5fdfe8..a72c90a 100644
--- a/arch/arm/mach-omap2/board-omap3stalker.c
+++ b/arch/arm/mach-omap2/board-omap3stalker.c
@@ -40,7 +40,7 @@
#include <plat/nand.h>
#include <plat/usb.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <plat/mcspi.h>
#include <linux/input/matrix_keypad.h>
diff --git a/arch/arm/mach-omap2/board-omap4panda.c b/arch/arm/mach-omap2/board-omap4panda.c
index 9ec9a17..e4973ac 100644
--- a/arch/arm/mach-omap2/board-omap4panda.c
+++ b/arch/arm/mach-omap2/board-omap4panda.c
@@ -40,7 +40,7 @@
#include <plat/common.h>
#include <plat/usb.h>
#include <plat/mmc.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include "timer-gp.h"
#include "hsmmc.h"
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index ff28880..9d192ff 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -44,7 +44,7 @@
#include <plat/board.h>
#include <plat/common.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
#include <mach/gpio.h>
#include <plat/gpmc.h>
#include <mach/hardware.h>
diff --git a/drivers/video/omap2/displays/panel-generic-dpi.c b/drivers/video/omap2/displays/panel-generic-dpi.c
index cc9dc70..2251f73 100644
--- a/drivers/video/omap2/displays/panel-generic-dpi.c
+++ b/drivers/video/omap2/displays/panel-generic-dpi.c
@@ -35,7 +35,7 @@
#include <linux/slab.h>
#include <video/omapdss.h>
-#include <plat/panel-generic-dpi.h>
+#include <video/omap-panel-generic-dpi.h>
struct panel_config {
struct omap_video_timings timings;
diff --git a/arch/arm/plat-omap/include/plat/panel-generic-dpi.h b/include/video/omap-panel-generic-dpi.h
similarity index 88%
rename from arch/arm/plat-omap/include/plat/panel-generic-dpi.h
rename to include/video/omap-panel-generic-dpi.h
index b037030..127e3f2 100644
--- a/arch/arm/plat-omap/include/plat/panel-generic-dpi.h
+++ b/include/video/omap-panel-generic-dpi.h
@@ -17,8 +17,8 @@
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __ARCH_ARM_PLAT_OMAP_PANEL_GENERIC_DPI_H
-#define __ARCH_ARM_PLAT_OMAP_PANEL_GENERIC_DPI_H
+#ifndef __OMAP_PANEL_GENERIC_DPI_H
+#define __OMAP_PANEL_GENERIC_DPI_H
struct omap_dss_device;
@@ -34,4 +34,4 @@ struct panel_generic_dpi_data {
void (*platform_disable)(struct omap_dss_device *dssdev);
};
-#endif /* __ARCH_ARM_PLAT_OMAP_PANEL_GENERIC_DPI_H */
+#endif /* __OMAP_PANEL_GENERIC_DPI_H */
--
1.7.4.1
^ permalink raw reply related
* [PATCH 3/3] OMAP: DSS2: Move nokia-dsi-panel.h to include/video/
From: Tomi Valkeinen @ 2011-05-11 12:26 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: tony, Tomi Valkeinen
In-Reply-To: <1305116790-24067-1-git-send-email-tomi.valkeinen@ti.com>
arch/arm/plat-omap/include/plat/nokia-dsi-panel.h is an include for the
OMAP DSS panel driver for Nokia's DSI displays. A more logical place for
it is in include/video.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/displays/panel-taal.c | 2 +-
.../video/omap-panel-nokia-dsi.h | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
rename arch/arm/plat-omap/include/plat/nokia-dsi-panel.h => include/video/omap-panel-nokia-dsi.h (81%)
diff --git a/drivers/video/omap2/displays/panel-taal.c b/drivers/video/omap2/displays/panel-taal.c
index 4673517..ed46a1e 100644
--- a/drivers/video/omap2/displays/panel-taal.c
+++ b/drivers/video/omap2/displays/panel-taal.c
@@ -34,7 +34,7 @@
#include <linux/mutex.h>
#include <video/omapdss.h>
-#include <plat/nokia-dsi-panel.h>
+#include <video/omap-panel-nokia-dsi.h>
/* DSI Virtual channel. Hardcoded for now. */
#define TCH 0
diff --git a/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h b/include/video/omap-panel-nokia-dsi.h
similarity index 81%
rename from arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
rename to include/video/omap-panel-nokia-dsi.h
index 4d1e794..e109b21 100644
--- a/arch/arm/plat-omap/include/plat/nokia-dsi-panel.h
+++ b/include/video/omap-panel-nokia-dsi.h
@@ -1,5 +1,5 @@
-#ifndef __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H
-#define __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H
+#ifndef __OMAP_NOKIA_DSI_PANEL_H
+#define __OMAP_NOKIA_DSI_PANEL_H
struct omap_dss_device;
@@ -28,4 +28,4 @@ struct nokia_dsi_panel_data {
int (*get_backlight)(struct omap_dss_device *dssdev);
};
-#endif /* __ARCH_ARM_PLAT_OMAP_NOKIA_DSI_PANEL_H */
+#endif /* __OMAP_NOKIA_DSI_PANEL_H */
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH V3] fbcon -- fix race between open and removal of framebuffers
From: Tim Gardner @ 2011-05-11 14:09 UTC (permalink / raw)
To: Bruno Prémont; +Cc: linux-fbdev, lethal, linux-kernel, Andy Whitcroft
In-Reply-To: <20110510234424.5a5b7a08@neptune.home>
On 05/10/2011 11:44 PM, Bruno Prémont wrote:
> On Tue, 10 May 2011 Tim Gardner<tim.gardner@canonical.com> wrote:
>> From ca3ef33e2235c88856a6257c0be63192ab56c678 Mon Sep 17 00:00:00 2001
>> From: Andy Whitcroft<apw@canonical.com>
>> Date: Thu, 29 Jul 2010 16:48:20 +0100
>> Subject: [PATCH] fbcon -- fix race between open and removal of framebuffers
>>
>> Currently there is no locking for updates to the registered_fb list.
>> This allows an open through /dev/fbN to pick up a registered framebuffer
>> pointer in parallel with it being released, as happens when a conflicting
>> framebuffer is ejected or on module unload. There is also no reference
>> counting on the framebuffer descriptor which is referenced from all open
>> files, leading to references to released or reused memory to persist on
>> these open files.
>>
>> This patch adds a reference count to the framebuffer descriptor to prevent
>> it from being released until after all pending opens are closed. This
>> allows the pending opens to detect the closed status and unmap themselves.
>> It also adds locking to the framebuffer lookup path, locking it against
>> the removal path such that it is possible to atomically lookup and take a
>> reference to the descriptor. It also adds locking to the read and write
>> paths which currently could access the framebuffer descriptor after it
>> has been freed. Finally it moves the device to FBINFO_STATE_REMOVED to
>> indicate that all access should be errored for this device.
>
> What framebuffer drivers was this patch tested with? Just x86 with
> mainstream GPU (intel/amd/nvidia KMS) in compination with vgafb/vesafb or
> did it see some testing with other framebuffers like those from embedded
> world?
>
This patch is also in all of the armel (OMAP3/OMAP4) kernels.
> Otherwise a much smaller (memory leaking) patch would be to just change
> vesafb/vgafb to not free their fb_info after unregistration as was suggested
> by Alan Cox.
>
Sure, I suppose thats possible, but this is the patch that I have working.
<snip>
>
> This only partially protects the list and count as two concurrent
> framebuffer registrations do still race against each other.
> For the issue addressed by this patch I don't think it makes sense to
> have this spinlock at all as it's only used in get_framebuffer_info()
> and in put_framebuffer_info() and put_framebuffer_info() doesn't even
> look at registered_fb or num_registered_fb.
> Such a spinlock makes sense in a separate patch that really protects
> all access to registered_fb or num_registered_fb, be it during framebuffer
> (un)registration or during access from fbcon.
>
Our goal was merely to stop the user space open/close races. I agree
that the framebuffer registration list needs more orthogonal protection,
but that is going to be a much larger patch.
rtg
--
Tim Gardner tim.gardner@canonical.com
^ permalink raw reply
* Re: [PATCH V3] fbcon -- fix race between open and removal of
From: Bruno Prémont @ 2011-05-11 14:27 UTC (permalink / raw)
To: Tim Gardner; +Cc: linux-fbdev, lethal, linux-kernel, Andy Whitcroft
In-Reply-To: <4DCA9899.6070403@canonical.com>
On Wed, 11 May 2011 16:09:29 Tim Gardner wrote:
> On 05/10/2011 11:44 PM, Bruno Prémont wrote:
> > On Tue, 10 May 2011 Tim Gardner<tim.gardner@canonical.com> wrote:
> > This only partially protects the list and count as two concurrent
> > framebuffer registrations do still race against each other.
> > For the issue addressed by this patch I don't think it makes sense to
> > have this spinlock at all as it's only used in get_framebuffer_info()
> > and in put_framebuffer_info() and put_framebuffer_info() doesn't even
> > look at registered_fb or num_registered_fb.
> > Such a spinlock makes sense in a separate patch that really protects
> > all access to registered_fb or num_registered_fb, be it during framebuffer
> > (un)registration or during access from fbcon.
> >
>
> Our goal was merely to stop the user space open/close races. I agree
> that the framebuffer registration list needs more orthogonal protection,
> but that is going to be a much larger patch.
I know that such a protection needs a much larger patch. (that would be
for 2.6.40 or 2.6.41, I have preparing patches for that cooking)
My main issue for tis patch is that the comment reads as if spinlock was
protecting registered_fb[] and num_registered_fb. So changing the
comment would be a good thing (say it protects fb_info->ref_count).
Later patch can then protect registered_fb against concurrent
framebuffer registrations.
Bruno
^ permalink raw reply
* [PATCHv2 0/8] OMAP: DSS: Miscellaneous patches
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
Here are some smallish fixes and cleanups I made while porting N800's display
driver to DSS2.
Changes in v2:
* Fix typos in commit messages
* Properly check kzalloc return value and fail if allocation failed
* Rebased on DSS master
Tomi
Tomi Valkeinen (8):
OMAP: DSS2: Add missing dummy functions
OMAPFB: fix wrong clock aliases and device name
OMAP: DSS2: RFBI: add rfbi_bus_lock
OMAP: DSS2: RFBI: clock enable/disable changes
OMAP: DSS2: RFBI: add omap_rfbi_configure
OMAP: DSS2: RFBI: cleanup
OMAP: DSS2: OMAPFB: remove dead code
OMAP: DSS2: OMAPFB: Reduce stack usage
drivers/video/omap/dispc.c | 4 +-
drivers/video/omap/omapfb_main.c | 2 +-
drivers/video/omap/rfbi.c | 2 +-
drivers/video/omap2/dss/dss.h | 28 ++++--
drivers/video/omap2/dss/rfbi.c | 174 +++++-------------------------
drivers/video/omap2/omapfb/omapfb-main.c | 124 +++++++++++-----------
include/video/omapdss.h | 4 +
7 files changed, 119 insertions(+), 219 deletions(-)
--
1.7.4.1
^ permalink raw reply
* [PATCHv2 1/8] OMAP: DSS2: Add missing dummy functions
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
dpi.c does not compile if DSI is not compiled in. Add the missing dummy
functions so that dpi.c compiles.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dss.h | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index eea5c7d..f659cfb 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -313,6 +313,27 @@ static inline unsigned long dsi_get_pll_hsdiv_dispc_rate(void)
WARN("%s: DSI not compiled in, returning rate as 0\n", __func__);
return 0;
}
+static inline int dsi_pll_set_clock_div(struct dsi_clock_info *cinfo)
+{
+ WARN("%s: DSI not compiled in\n", __func__);
+ return -ENODEV;
+}
+static inline int dsi_pll_calc_clock_div_pck(bool is_tft, unsigned long req_pck,
+ struct dsi_clock_info *cinfo,
+ struct dispc_clock_info *dispc_cinfo)
+{
+ WARN("%s: DSI not compiled in\n", __func__);
+ return -ENODEV;
+}
+static inline int dsi_pll_init(struct omap_dss_device *dssdev,
+ bool enable_hsclk, bool enable_hsdiv)
+{
+ WARN("%s: DSI not compiled in\n", __func__);
+ return -ENODEV;
+}
+static inline void dsi_pll_uninit(bool disconnect_lanes)
+{
+}
static inline void dsi_wait_pll_hsdiv_dispc_active(void)
{
}
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 2/8] OMAPFB: fix wrong clock aliases and device name
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
The clock aliases and the dss platform device name have changed, and
omapfb fails to initialize. Update the names to correct ones.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap/dispc.c | 4 ++--
drivers/video/omap/omapfb_main.c | 2 +-
drivers/video/omap/rfbi.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/video/omap/dispc.c b/drivers/video/omap/dispc.c
index 5294834..0ccd7ad 100644
--- a/drivers/video/omap/dispc.c
+++ b/drivers/video/omap/dispc.c
@@ -922,14 +922,14 @@ static int get_dss_clocks(void)
return PTR_ERR(dispc.dss_ick);
}
- dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "dss1_fck");
+ dispc.dss1_fck = clk_get(&dispc.fbdev->dssdev->dev, "fck");
if (IS_ERR(dispc.dss1_fck)) {
dev_err(dispc.fbdev->dev, "can't get dss1_fck\n");
clk_put(dispc.dss_ick);
return PTR_ERR(dispc.dss1_fck);
}
- dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "tv_fck");
+ dispc.dss_54m_fck = clk_get(&dispc.fbdev->dssdev->dev, "tv_clk");
if (IS_ERR(dispc.dss_54m_fck)) {
dev_err(dispc.fbdev->dev, "can't get tv_fck\n");
clk_put(dispc.dss_ick);
diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c
index e264efd..b3ddd74 100644
--- a/drivers/video/omap/omapfb_main.c
+++ b/drivers/video/omap/omapfb_main.c
@@ -90,7 +90,7 @@ static void omapdss_release(struct device *dev)
/* dummy device for clocks */
static struct platform_device omapdss_device = {
- .name = "omapdss",
+ .name = "omapdss_dss",
.id = -1,
.dev = {
.release = omapdss_release,
diff --git a/drivers/video/omap/rfbi.c b/drivers/video/omap/rfbi.c
index eada9f1..0c6981f 100644
--- a/drivers/video/omap/rfbi.c
+++ b/drivers/video/omap/rfbi.c
@@ -90,7 +90,7 @@ static int rfbi_get_clocks(void)
return PTR_ERR(rfbi.dss_ick);
}
- rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "dss1_fck");
+ rfbi.dss1_fck = clk_get(&rfbi.fbdev->dssdev->dev, "fck");
if (IS_ERR(rfbi.dss1_fck)) {
dev_err(rfbi.fbdev->dev, "can't get dss1_fck\n");
clk_put(rfbi.dss_ick);
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 3/8] OMAP: DSS2: RFBI: add rfbi_bus_lock
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
Add similar bus lock to RFBI as is in DSI. The panel driver can use the
bus lock to mark that the RFBI bus is currently in use.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/rfbi.c | 16 ++++++++++++++++
include/video/omapdss.h | 2 ++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 0985f2f..46817e7 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -32,6 +32,7 @@
#include <linux/ktime.h>
#include <linux/hrtimer.h>
#include <linux/seq_file.h>
+#include <linux/semaphore.h>
#include <video/omapdss.h>
#include "dss.h"
@@ -119,6 +120,8 @@ static struct {
struct completion cmd_done;
atomic_t cmd_fifo_full;
atomic_t cmd_pending;
+
+ struct semaphore bus_lock;
} rfbi;
struct update_region {
@@ -146,6 +149,18 @@ static void rfbi_enable_clocks(bool enable)
dss_clk_disable(DSS_CLK_ICK | DSS_CLK_FCK);
}
+void rfbi_bus_lock(void)
+{
+ down(&rfbi.bus_lock);
+}
+EXPORT_SYMBOL(rfbi_bus_lock);
+
+void rfbi_bus_unlock(void)
+{
+ up(&rfbi.bus_lock);
+}
+EXPORT_SYMBOL(rfbi_bus_unlock);
+
void omap_rfbi_write_command(const void *buf, u32 len)
{
rfbi_enable_clocks(1);
@@ -1022,6 +1037,7 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
rfbi.pdev = pdev;
spin_lock_init(&rfbi.cmd_lock);
+ sema_init(&rfbi.bus_lock, 1);
init_completion(&rfbi.cmd_done);
atomic_set(&rfbi.cmd_fifo_full, 0);
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index ab7d656..1ea151e 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -212,6 +212,8 @@ int omap_rfbi_enable_te(bool enable, unsigned line);
int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
unsigned hs_pulse_time, unsigned vs_pulse_time,
int hs_pol_inv, int vs_pol_inv, int extif_div);
+void rfbi_bus_lock(void);
+void rfbi_bus_unlock(void);
/* DSI */
void dsi_bus_lock(void);
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 4/8] OMAP: DSS2: RFBI: clock enable/disable changes
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
RFBI enables and disables clocks inside almost every function to get a
finegrained control to the clocks. However, the current understanding is
that this is not necessary power-management-wise.
Change the clocking scheme so that RFBI clocks are enabled when the
omapdss_rfbi_display_enable is called, and disabled when
omapdss_rfbi_display_disable is called.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/rfbi.c | 28 ++++------------------------
1 files changed, 4 insertions(+), 24 deletions(-)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 46817e7..1c19d17 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -163,7 +163,6 @@ EXPORT_SYMBOL(rfbi_bus_unlock);
void omap_rfbi_write_command(const void *buf, u32 len)
{
- rfbi_enable_clocks(1);
switch (rfbi.parallelmode) {
case OMAP_DSS_RFBI_PARALLELMODE_8:
{
@@ -187,13 +186,11 @@ void omap_rfbi_write_command(const void *buf, u32 len)
default:
BUG();
}
- rfbi_enable_clocks(0);
}
EXPORT_SYMBOL(omap_rfbi_write_command);
void omap_rfbi_read_data(void *buf, u32 len)
{
- rfbi_enable_clocks(1);
switch (rfbi.parallelmode) {
case OMAP_DSS_RFBI_PARALLELMODE_8:
{
@@ -221,13 +218,11 @@ void omap_rfbi_read_data(void *buf, u32 len)
default:
BUG();
}
- rfbi_enable_clocks(0);
}
EXPORT_SYMBOL(omap_rfbi_read_data);
void omap_rfbi_write_data(const void *buf, u32 len)
{
- rfbi_enable_clocks(1);
switch (rfbi.parallelmode) {
case OMAP_DSS_RFBI_PARALLELMODE_8:
{
@@ -252,7 +247,6 @@ void omap_rfbi_write_data(const void *buf, u32 len)
BUG();
}
- rfbi_enable_clocks(0);
}
EXPORT_SYMBOL(omap_rfbi_write_data);
@@ -264,8 +258,6 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
int horiz_offset = scr_width - w;
int i;
- rfbi_enable_clocks(1);
-
if (rfbi.datatype = OMAP_DSS_RFBI_DATATYPE_16 &&
rfbi.parallelmode = OMAP_DSS_RFBI_PARALLELMODE_8) {
const u16 __iomem *pd = buf;
@@ -310,8 +302,6 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
} else {
BUG();
}
-
- rfbi_enable_clocks(0);
}
EXPORT_SYMBOL(omap_rfbi_write_pixels);
@@ -332,8 +322,6 @@ void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width,
rfbi.framedone_callback = callback;
rfbi.framedone_callback_data = data;
- rfbi_enable_clocks(1);
-
rfbi_write_reg(RFBI_PIXEL_CNT, width * height);
l = rfbi_read_reg(RFBI_CONTROL);
@@ -352,8 +340,6 @@ static void framedone_callback(void *data, u32 mask)
REG_FLD_MOD(RFBI_CONTROL, 0, 0, 0);
- rfbi_enable_clocks(0);
-
callback = rfbi.framedone_callback;
rfbi.framedone_callback = NULL;
@@ -462,7 +448,6 @@ void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t)
BUG_ON(!t->converted);
- rfbi_enable_clocks(1);
rfbi_write_reg(RFBI_ONOFF_TIME(rfbi_module), t->tim[0]);
rfbi_write_reg(RFBI_CYCLE_TIME(rfbi_module), t->tim[1]);
@@ -471,7 +456,6 @@ void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t)
(t->tim[2] ? 1 : 0), 4, 4);
rfbi_print_timings();
- rfbi_enable_clocks(0);
}
static int ps_to_rfbi_ticks(int time, int div)
@@ -659,7 +643,6 @@ int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
DSSDBG("setup_te: mode %d hs %d vs %d hs_inv %d vs_inv %d\n",
mode, hs, vs, hs_pol_inv, vs_pol_inv);
- rfbi_enable_clocks(1);
rfbi_write_reg(RFBI_HSYNC_WIDTH, hs);
rfbi_write_reg(RFBI_VSYNC_WIDTH, vs);
@@ -672,7 +655,6 @@ int omap_rfbi_setup_te(enum omap_rfbi_te_mode mode,
l &= ~(1 << 20);
else
l |= 1 << 20;
- rfbi_enable_clocks(0);
return 0;
}
@@ -687,7 +669,6 @@ int omap_rfbi_enable_te(bool enable, unsigned line)
if (line > (1 << 11) - 1)
return -EINVAL;
- rfbi_enable_clocks(1);
l = rfbi_read_reg(RFBI_CONFIG(0));
l &= ~(0x3 << 2);
if (enable) {
@@ -697,7 +678,6 @@ int omap_rfbi_enable_te(bool enable, unsigned line)
rfbi.te_enabled = 0;
rfbi_write_reg(RFBI_CONFIG(0), l);
rfbi_write_reg(RFBI_LINE_NUMBER, line);
- rfbi_enable_clocks(0);
return 0;
}
@@ -836,8 +816,6 @@ int rfbi_configure(int rfbi_module, int bpp, int lines)
break;
}
- rfbi_enable_clocks(1);
-
REG_FLD_MOD(RFBI_CONTROL, 0, 3, 2); /* clear CS */
l = 0;
@@ -871,8 +849,6 @@ int rfbi_configure(int rfbi_module, int bpp, int lines)
DSSDBG("RFBI config: bpp %d, lines %d, cycles: 0x%x 0x%x 0x%x\n",
bpp, lines, cycle1, cycle2, cycle3);
- rfbi_enable_clocks(0);
-
return 0;
}
EXPORT_SYMBOL(rfbi_configure);
@@ -975,6 +951,8 @@ int omapdss_rfbi_display_enable(struct omap_dss_device *dssdev)
{
int r;
+ rfbi_enable_clocks(1);
+
r = omap_dss_start_device(dssdev);
if (r) {
DSSERR("failed to start device\n");
@@ -1017,6 +995,8 @@ void omapdss_rfbi_display_disable(struct omap_dss_device *dssdev)
omap_dispc_unregister_isr(framedone_callback, NULL,
DISPC_IRQ_FRAMEDONE);
omap_dss_stop_device(dssdev);
+
+ rfbi_enable_clocks(0);
}
EXPORT_SYMBOL(omapdss_rfbi_display_disable);
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 5/8] OMAP: DSS2: RFBI: add omap_rfbi_configure
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
Add omap_rfbi_configure() which the panel driver can use to reconfigure
the data element size and the number of data lines in the RFBI bus.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/rfbi.c | 8 +++++++-
include/video/omapdss.h | 2 ++
2 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 1c19d17..155caf0 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -851,7 +851,13 @@ int rfbi_configure(int rfbi_module, int bpp, int lines)
return 0;
}
-EXPORT_SYMBOL(rfbi_configure);
+
+int omap_rfbi_configure(struct omap_dss_device *dssdev, int pixel_size,
+ int data_lines)
+{
+ return rfbi_configure(dssdev->phy.rfbi.channel, pixel_size, data_lines);
+}
+EXPORT_SYMBOL(omap_rfbi_configure);
int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
u16 *x, u16 *y, u16 *w, u16 *h)
diff --git a/include/video/omapdss.h b/include/video/omapdss.h
index 1ea151e..9b00748 100644
--- a/include/video/omapdss.h
+++ b/include/video/omapdss.h
@@ -612,5 +612,7 @@ int omap_rfbi_prepare_update(struct omap_dss_device *dssdev,
int omap_rfbi_update(struct omap_dss_device *dssdev,
u16 x, u16 y, u16 w, u16 h,
void (*callback)(void *), void *data);
+int omap_rfbi_configure(struct omap_dss_device *dssdev, int pixel_size,
+ int data_lines);
#endif
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 6/8] OMAP: DSS2: RFBI: cleanup
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
The RFBI driver is quite messy. Remove dead and unneeded code and add
statics to functions.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/dss/dss.h | 7 --
drivers/video/omap2/dss/rfbi.c | 124 +---------------------------------------
2 files changed, 3 insertions(+), 128 deletions(-)
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index f659cfb..6cc56a1 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -497,13 +497,6 @@ void hdmi_panel_exit(void);
int rfbi_init_platform_driver(void);
void rfbi_uninit_platform_driver(void);
void rfbi_dump_regs(struct seq_file *s);
-
-int rfbi_configure(int rfbi_module, int bpp, int lines);
-void rfbi_enable_rfbi(bool enable);
-void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width,
- u16 height, void (callback)(void *data), void *data);
-void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t);
-unsigned long rfbi_get_max_tx_rate(void);
int rfbi_init_display(struct omap_dss_device *display);
#else
static inline int rfbi_init_platform_driver(void)
diff --git a/drivers/video/omap2/dss/rfbi.c b/drivers/video/omap2/dss/rfbi.c
index 155caf0..c06fbe0 100644
--- a/drivers/video/omap2/dss/rfbi.c
+++ b/drivers/video/omap2/dss/rfbi.c
@@ -66,9 +66,6 @@ struct rfbi_reg { u16 idx; };
#define REG_FLD_MOD(idx, val, start, end) \
rfbi_write_reg(idx, FLD_MOD(rfbi_read_reg(idx), val, start, end))
-/* To work around an RFBI transfer rate limitation */
-#define OMAP_RFBI_RATE_LIMIT 1
-
enum omap_rfbi_cycleformat {
OMAP_DSS_RFBI_CYCLEFORMAT_1_1 = 0,
OMAP_DSS_RFBI_CYCLEFORMAT_2_1 = 1,
@@ -90,11 +87,6 @@ enum omap_rfbi_parallelmode {
OMAP_DSS_RFBI_PARALLELMODE_16 = 3,
};
-enum update_cmd {
- RFBI_CMD_UPDATE = 0,
- RFBI_CMD_SYNC = 1,
-};
-
static int rfbi_convert_timings(struct rfbi_timings *t);
static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div);
@@ -115,22 +107,9 @@ static struct {
struct omap_dss_device *dssdev[2];
- struct kfifo cmd_fifo;
- spinlock_t cmd_lock;
- struct completion cmd_done;
- atomic_t cmd_fifo_full;
- atomic_t cmd_pending;
-
struct semaphore bus_lock;
} rfbi;
-struct update_region {
- u16 x;
- u16 y;
- u16 w;
- u16 h;
-};
-
static inline void rfbi_write_reg(const struct rfbi_reg idx, u32 val)
{
__raw_writel(val, rfbi.base + idx.idx);
@@ -305,7 +284,7 @@ void omap_rfbi_write_pixels(const void __iomem *buf, int scr_width,
}
EXPORT_SYMBOL(omap_rfbi_write_pixels);
-void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width,
+static void rfbi_transfer_area(struct omap_dss_device *dssdev, u16 width,
u16 height, void (*callback)(void *data), void *data)
{
u32 l;
@@ -345,8 +324,6 @@ static void framedone_callback(void *data, u32 mask)
if (callback != NULL)
callback(rfbi.framedone_callback_data);
-
- atomic_set(&rfbi.cmd_pending, 0);
}
#if 1 /* VERBOSE */
@@ -436,7 +413,7 @@ static int calc_extif_timings(struct rfbi_timings *t)
}
-void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t)
+static void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t)
{
int r;
@@ -471,59 +448,6 @@ static int ps_to_rfbi_ticks(int time, int div)
return ret;
}
-#ifdef OMAP_RFBI_RATE_LIMIT
-unsigned long rfbi_get_max_tx_rate(void)
-{
- unsigned long l4_rate, dss1_rate;
- int min_l4_ticks = 0;
- int i;
-
- /* According to TI this can't be calculated so make the
- * adjustments for a couple of known frequencies and warn for
- * others.
- */
- static const struct {
- unsigned long l4_clk; /* HZ */
- unsigned long dss1_clk; /* HZ */
- unsigned long min_l4_ticks;
- } ftab[] = {
- { 55, 132, 7, }, /* 7.86 MPix/s */
- { 110, 110, 12, }, /* 9.16 MPix/s */
- { 110, 132, 10, }, /* 11 Mpix/s */
- { 120, 120, 10, }, /* 12 Mpix/s */
- { 133, 133, 10, }, /* 13.3 Mpix/s */
- };
-
- l4_rate = rfbi.l4_khz / 1000;
- dss1_rate = dss_clk_get_rate(DSS_CLK_FCK) / 1000000;
-
- for (i = 0; i < ARRAY_SIZE(ftab); i++) {
- /* Use a window instead of an exact match, to account
- * for different DPLL multiplier / divider pairs.
- */
- if (abs(ftab[i].l4_clk - l4_rate) < 3 &&
- abs(ftab[i].dss1_clk - dss1_rate) < 3) {
- min_l4_ticks = ftab[i].min_l4_ticks;
- break;
- }
- }
- if (i = ARRAY_SIZE(ftab)) {
- /* Can't be sure, return anyway the maximum not
- * rate-limited. This might cause a problem only for the
- * tearing synchronisation.
- */
- DSSERR("can't determine maximum RFBI transfer rate\n");
- return rfbi.l4_khz * 1000;
- }
- return rfbi.l4_khz * 1000 / min_l4_ticks;
-}
-#else
-int rfbi_get_max_tx_rate(void)
-{
- return rfbi.l4_khz * 1000;
-}
-#endif
-
static void rfbi_get_clk_info(u32 *clk_period, u32 *max_clk_div)
{
*clk_period = 1000000000 / rfbi.l4_khz;
@@ -683,44 +607,7 @@ int omap_rfbi_enable_te(bool enable, unsigned line)
}
EXPORT_SYMBOL(omap_rfbi_enable_te);
-#if 0
-static void rfbi_enable_config(int enable1, int enable2)
-{
- u32 l;
- int cs = 0;
-
- if (enable1)
- cs |= 1<<0;
- if (enable2)
- cs |= 1<<1;
-
- rfbi_enable_clocks(1);
-
- l = rfbi_read_reg(RFBI_CONTROL);
-
- l = FLD_MOD(l, cs, 3, 2);
- l = FLD_MOD(l, 0, 1, 1);
-
- rfbi_write_reg(RFBI_CONTROL, l);
-
-
- l = rfbi_read_reg(RFBI_CONFIG(0));
- l = FLD_MOD(l, 0, 3, 2); /* TRIGGERMODE: ITE */
- /*l |= FLD_VAL(2, 8, 7); */ /* L4FORMAT, 2pix/L4 */
- /*l |= FLD_VAL(0, 8, 7); */ /* L4FORMAT, 1pix/L4 */
-
- l = FLD_MOD(l, 0, 16, 16); /* A0POLARITY */
- l = FLD_MOD(l, 1, 20, 20); /* TE_VSYNC_POLARITY */
- l = FLD_MOD(l, 1, 21, 21); /* HSYNCPOLARITY */
-
- l = FLD_MOD(l, OMAP_DSS_RFBI_PARALLELMODE_8, 1, 0);
- rfbi_write_reg(RFBI_CONFIG(0), l);
-
- rfbi_enable_clocks(0);
-}
-#endif
-
-int rfbi_configure(int rfbi_module, int bpp, int lines)
+static int rfbi_configure(int rfbi_module, int bpp, int lines)
{
u32 l;
int cycle1 = 0, cycle2 = 0, cycle3 = 0;
@@ -1022,13 +909,8 @@ static int omap_rfbihw_probe(struct platform_device *pdev)
rfbi.pdev = pdev;
- spin_lock_init(&rfbi.cmd_lock);
sema_init(&rfbi.bus_lock, 1);
- init_completion(&rfbi.cmd_done);
- atomic_set(&rfbi.cmd_fifo_full, 0);
- atomic_set(&rfbi.cmd_pending, 0);
-
rfbi_mem = platform_get_resource(rfbi.pdev, IORESOURCE_MEM, 0);
if (!rfbi_mem) {
DSSERR("can't get IORESOURCE_MEM RFBI\n");
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 7/8] OMAP: DSS2: OMAPFB: remove dead code
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
Remove old unused code lying inside #if 0.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/omapfb/omapfb-main.c | 29 -----------------------------
1 files changed, 0 insertions(+), 29 deletions(-)
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index eba90b3..9a5b4bc 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -757,35 +757,6 @@ static int omapfb_open(struct fb_info *fbi, int user)
static int omapfb_release(struct fb_info *fbi, int user)
{
-#if 0
- struct omapfb_info *ofbi = FB2OFB(fbi);
- struct omapfb2_device *fbdev = ofbi->fbdev;
- struct omap_dss_device *display = fb2display(fbi);
-
- DBG("Closing fb with plane index %d\n", ofbi->id);
-
- omapfb_lock(fbdev);
-
- if (display && display->get_update_mode && display->update) {
- /* XXX this update should be removed, I think. But it's
- * good for debugging */
- if (display->get_update_mode(display) =
- OMAP_DSS_UPDATE_MANUAL) {
- u16 w, h;
-
- if (display->sync)
- display->sync(display);
-
- display->get_resolution(display, &w, &h);
- display->update(display, 0, 0, w, h);
- }
- }
-
- if (display && display->sync)
- display->sync(display);
-
- omapfb_unlock(fbdev);
-#endif
return 0;
}
--
1.7.4.1
^ permalink raw reply related
* [PATCHv2 8/8] OMAP: DSS2: OMAPFB: Reduce stack usage
From: Tomi Valkeinen @ 2011-05-12 11:40 UTC (permalink / raw)
To: linux-omap, linux-fbdev; +Cc: Tomi Valkeinen
In-Reply-To: <1305200413-23697-1-git-send-email-tomi.valkeinen@ti.com>
omapfb_mode_to_timings() had struct fb_info, struct fb_var and struct
fb_ops allocated from stack. This caused the stack usage grow quite
high.
Use kzalloc to allocate the structs instead.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
drivers/video/omap2/omapfb/omapfb-main.c | 95 +++++++++++++++++++-----------
1 files changed, 61 insertions(+), 34 deletions(-)
diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index 9a5b4bc..505bc12 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -1996,9 +1996,9 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
static int omapfb_mode_to_timings(const char *mode_str,
struct omap_video_timings *timings, u8 *bpp)
{
- struct fb_info fbi;
- struct fb_var_screeninfo var;
- struct fb_ops fbops;
+ struct fb_info *fbi;
+ struct fb_var_screeninfo *var;
+ struct fb_ops *fbops;
int r;
#ifdef CONFIG_OMAP2_DSS_VENC
@@ -2016,39 +2016,66 @@ static int omapfb_mode_to_timings(const char *mode_str,
/* this is quite a hack, but I wanted to use the modedb and for
* that we need fb_info and var, so we create dummy ones */
- memset(&fbi, 0, sizeof(fbi));
- memset(&var, 0, sizeof(var));
- memset(&fbops, 0, sizeof(fbops));
- fbi.fbops = &fbops;
-
- r = fb_find_mode(&var, &fbi, mode_str, NULL, 0, NULL, 24);
-
- if (r != 0) {
- timings->pixel_clock = PICOS2KHZ(var.pixclock);
- timings->hbp = var.left_margin;
- timings->hfp = var.right_margin;
- timings->vbp = var.upper_margin;
- timings->vfp = var.lower_margin;
- timings->hsw = var.hsync_len;
- timings->vsw = var.vsync_len;
- timings->x_res = var.xres;
- timings->y_res = var.yres;
-
- switch (var.bits_per_pixel) {
- case 16:
- *bpp = 16;
- break;
- case 24:
- case 32:
- default:
- *bpp = 24;
- break;
- }
+ *bpp = 0;
+ fbi = NULL;
+ var = NULL;
+ fbops = NULL;
- return 0;
- } else {
- return -EINVAL;
+ fbi = kzalloc(sizeof(*fbi), GFP_KERNEL);
+ if (fbi = NULL) {
+ r = -ENOMEM;
+ goto err;
+ }
+
+ var = kzalloc(sizeof(*var), GFP_KERNEL);
+ if (var = NULL) {
+ r = -ENOMEM;
+ goto err;
+ }
+
+ fbops = kzalloc(sizeof(*fbops), GFP_KERNEL);
+ if (fbops = NULL) {
+ r = -ENOMEM;
+ goto err;
+ }
+
+ fbi->fbops = fbops;
+
+ r = fb_find_mode(var, fbi, mode_str, NULL, 0, NULL, 24);
+ if (r = 0) {
+ r = -EINVAL;
+ goto err;
}
+
+ timings->pixel_clock = PICOS2KHZ(var->pixclock);
+ timings->hbp = var->left_margin;
+ timings->hfp = var->right_margin;
+ timings->vbp = var->upper_margin;
+ timings->vfp = var->lower_margin;
+ timings->hsw = var->hsync_len;
+ timings->vsw = var->vsync_len;
+ timings->x_res = var->xres;
+ timings->y_res = var->yres;
+
+ switch (var->bits_per_pixel) {
+ case 16:
+ *bpp = 16;
+ break;
+ case 24:
+ case 32:
+ default:
+ *bpp = 24;
+ break;
+ }
+
+ r = 0;
+
+err:
+ kfree(fbi);
+ kfree(var);
+ kfree(fbops);
+
+ return r;
}
static int omapfb_set_def_mode(struct omapfb2_device *fbdev,
--
1.7.4.1
^ 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