]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
fbdev: detect primary display device
authorAntonino A. Daplas <adaplas@gmail.com>
Tue, 17 Jul 2007 11:05:28 +0000 (04:05 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Tue, 17 Jul 2007 17:23:11 +0000 (10:23 -0700)
Add function helper, fb_is_primary_device().  Given struct fb_info, it will
return a nonzero value if the device is the primary display.

Currently, only the i386 is supported where the function checks for the
IORESOURCE_ROM_SHADOW flag.

Signed-off-by: Antonino Daplas <adaplas@gmail.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
27 files changed:
arch/i386/Makefile
arch/i386/video/Makefile [new file with mode: 0644]
arch/i386/video/fbdev.c [new file with mode: 0644]
include/asm-alpha/fb.h
include/asm-arm/fb.h
include/asm-arm26/fb.h
include/asm-avr32/fb.h
include/asm-blackfin/fb.h
include/asm-cris/fb.h
include/asm-frv/fb.h
include/asm-h8300/fb.h
include/asm-i386/fb.h
include/asm-ia64/fb.h
include/asm-m32r/fb.h
include/asm-m68k/fb.h
include/asm-m68knommu/fb.h
include/asm-mips/fb.h
include/asm-parisc/fb.h
include/asm-powerpc/fb.h
include/asm-s390/fb.h
include/asm-sh/fb.h
include/asm-sh64/fb.h
include/asm-sparc/fb.h
include/asm-sparc64/fb.h
include/asm-v850/fb.h
include/asm-x86_64/fb.h
include/asm-xtensa/fb.h

index bd28f9f9b4b7bfa020a2bb364561abb14db1a03e..181cc29a7c4fcf9cf9472f4b21c2534c07ff4e11 100644 (file)
@@ -108,6 +108,7 @@ drivers-$(CONFIG_PCI)                       += arch/i386/pci/
 # must be linked after kernel/
 drivers-$(CONFIG_OPROFILE)             += arch/i386/oprofile/
 drivers-$(CONFIG_PM)                   += arch/i386/power/
+drivers-$(CONFIG_FB)                    += arch/i386/video/
 
 CFLAGS += $(mflags-y)
 AFLAGS += $(mflags-y)
diff --git a/arch/i386/video/Makefile b/arch/i386/video/Makefile
new file mode 100644 (file)
index 0000000..2c447c9
--- /dev/null
@@ -0,0 +1 @@
+obj-$(CONFIG_FB)               += fbdev.o
diff --git a/arch/i386/video/fbdev.c b/arch/i386/video/fbdev.c
new file mode 100644 (file)
index 0000000..7fc712c
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * arch/i386/video/fbdev.c - i386 Framebuffer
+ *
+ * Copyright (C) 2007 Antonino Daplas <adaplas@gmail.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file COPYING in the main directory of this archive
+ * for more details.
+ *
+ */
+#include <linux/fb.h>
+#include <linux/pci.h>
+
+int fb_is_primary_device(struct fb_info *info)
+{
+       struct device *device;
+       struct pci_dev *pci_dev = NULL;
+       struct resource *res = NULL;
+       int retval = 0;
+
+       device = info->device;
+
+       if (device)
+               pci_dev = to_pci_dev(device);
+
+       if (pci_dev)
+               res = &pci_dev->resource[PCI_ROM_RESOURCE];
+
+       if (res && res->flags & IORESOURCE_ROM_SHADOW)
+               retval = 1;
+
+       return retval;
+}
+EXPORT_SYMBOL(fb_is_primary_device);
index ca714a4e355738b1956832c8944d52bd297d1fee..fa9bbb96b2b3d49f6a16ae41dddf95c5add8cb66 100644 (file)
@@ -1,7 +1,13 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/device.h>
 
 /* Caching is off in the I/O space quadrant by design.  */
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 4bf5b88d90bf31d383c7240502c531001a1f2f06..d92e99cd8c8aba17b2e80a33beb1ed466af3cea7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -10,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index d22a4a876694bf6a12928ce07a2b76f4ca717b54..41baf84ad402417a7a50c93f5c1a71fa005b0f0d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -12,4 +13,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
                                     | (_PAGE_BUFFER | _PAGE_DIRTY));
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index d30073c755866c4f7b0b8782c93b624047f107b9..d1c6297d4a619296e2bf8ddc42944503397fb2e4 100644 (file)
@@ -1,9 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
+extern int fb_is_primary_device(struct fb_info *info);
+
 static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
                                unsigned long off)
 {
index 9d4577f9fe0e433bc6eb5b1c11a0b00898381c41..89a397cee90aebe402f408cf46cc8c171cec628f 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <linux/efi.h>
 #include <asm/page.h>
@@ -14,4 +15,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
                vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 4bf5b88d90bf31d383c7240502c531001a1f2f06..d92e99cd8c8aba17b2e80a33beb1ed466af3cea7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -10,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index f78bad476b089f9cbf3f804821c034ef26abc50f..380b97ae8157fa2d7762db1cf99dceda2f59cf4d 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 #include <asm/setup.h>
@@ -25,4 +26,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
 }
 #endif /* CONFIG_SUN3 */
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index ac23d96e261a39ccc62ab8961cffaaaffe385dd2..bd3f68c9ddfcaa25c6320dcc3eb0c8f3afcb0fa1 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -10,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index d5e47edf5321249acc1a67ed5a19a6a81c24b4ad..4d503a023ab2b150566211ac931e3b3360d1a001 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -10,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index e13d6ebc116db2aaf0617ac9d551b05b0a81bf04..411af8d17a69a7caa1dedff19777470b14c853b4 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -12,4 +13,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
                                                 vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 4bf5b88d90bf31d383c7240502c531001a1f2f06..d92e99cd8c8aba17b2e80a33beb1ed466af3cea7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -10,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 4bf5b88d90bf31d383c7240502c531001a1f2f06..d92e99cd8c8aba17b2e80a33beb1ed466af3cea7 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
 
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -10,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 8703c707e142bf6d8591ab65ec84659c9efc0435..d6cd3a175fc34b8fbcec6f034905b4c7f588621a 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -9,4 +10,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
        vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index d30073c755866c4f7b0b8782c93b624047f107b9..60548e651d12325a7017312c08fa18ccbe4fd6da 100644 (file)
@@ -1,6 +1,6 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
-
+#include <linux/fb.h>
 #include <linux/fs.h>
 #include <asm/page.h>
 
@@ -11,4 +11,9 @@ static inline void fb_pgprotect(struct file *file, struct vm_area_struct *vma,
                pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
 }
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */
index 9f8c88d05df47c11da8faafc437785cad90299c6..c7df3803099200c9e3a9a6721138d0fe8b26ae92 100644 (file)
@@ -1,6 +1,12 @@
 #ifndef _ASM_FB_H_
 #define _ASM_FB_H_
+#include <linux/fb.h>
 
 #define fb_pgprotect(...) do {} while (0)
 
+static inline int fb_is_primary_device(struct fb_info *info)
+{
+       return 0;
+}
+
 #endif /* _ASM_FB_H_ */