Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 317b3c21 authored by Antonino A. Daplas's avatar Antonino A. Daplas Committed by Linus Torvalds
Browse files

fbdev: detect primary display device



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: default avatarAntonino Daplas <adaplas@gmail.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 10eb2659
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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)
+1 −0
Original line number Diff line number Diff line
obj-$(CONFIG_FB)               += fbdev.o
+34 −0
Original line number Diff line number Diff line
/*
 * 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);
+6 −0
Original line number Diff line number Diff line
#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_ */
+6 −0
Original line number Diff line number Diff line
#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_ */
Loading