fbdev/intelfb: Remove driver
Subsystems (2)
PATCH 1/1 fbdev/intelfb: Remove driver
From looking at the PCI IDs, every device supported by intelfb is also supported by i915. Anyone still using intelfb should please move on to i915, which does everything intelfb does but better.
Removing intelfb is motivated by the driver's excessive use of the global screen_info state. The state belongs to architecture and firmware code; device drivers should not attempt to access it. But fixing intelfb would require a significant change in the driver's probing logic. As intelfb has been obsolete for nearly 2 decades, it is probably not worth the effort. Let's just remove it. Also remove the related documentation.
--- Documentation/fb/index.rst | 1 - Documentation/fb/intelfb.rst | 155 -- .../userspace-api/ioctl/ioctl-number.rst | 1 - MAINTAINERS | 7 - drivers/Makefile | 3 +- drivers/video/fbdev/Kconfig | 39 - drivers/video/fbdev/intelfb/Makefile | 8 - drivers/video/fbdev/intelfb/intelfb.h | 382 --- drivers/video/fbdev/intelfb/intelfb_i2c.c | 209 -- drivers/video/fbdev/intelfb/intelfbdrv.c | 1680 ------------- drivers/video/fbdev/intelfb/intelfbhw.c | 2115 ----------------- drivers/video/fbdev/intelfb/intelfbhw.h | 609 ----- 12 files changed, 1 insertion(+), 5208 deletions(-) delete mode 100644 Documentation/fb/intelfb.rst delete mode 100644 drivers/video/fbdev/intelfb/Makefile delete mode 100644 drivers/video/fbdev/intelfb/intelfb.h delete mode 100644 drivers/video/fbdev/intelfb/intelfb_i2c.c delete mode 100644 drivers/video/fbdev/intelfb/intelfbdrv.c delete mode 100644 drivers/video/fbdev/intelfb/intelfbhw.c delete mode 100644 drivers/video/fbdev/intelfb/intelfbhw.h
Documentation/fb/index.rst +0 -1
@@ -19,7 +19,6 @@ Frame Buffer framebuffer gxfb intel810 - intelfb internals lxfb matroxfb
Documentation/fb/intelfb.rst deleted +0 -155
155 lines not on this page · raw message
Documentation/userspace-api/ioctl/ioctl-number.rst +0 -1
@@ -128,7 +128,6 @@ Code Seq# Include File Comments 'F' all linux/fb.h conflict! 'F' 01-02 drivers/scsi/pmcraid.h conflict! 'F' 20 drivers/video/fsl-diu-fb.h conflict! -'F' 20 drivers/video/intelfb/intelfb.h conflict! 'F' 20 linux/ivtvfb.h conflict! 'F' 20 linux/matroxfb.h conflict! 'F' 20 drivers/video/aty/atyfb_base.c conflict!
MAINTAINERS +0 -7
@@ -10666,13 +10666,6 @@ S: Supported F: drivers/infiniband/hw/irdma/ F: include/uapi/rdma/irdma-abi.h -INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) -M: Maik Broemme <[email protected]> -L: [email protected] -S: Maintained -F: Documentation/fb/intelfb.rst -F: drivers/video/fbdev/intelfb/ - INTEL GPIO DRIVERS M: Andy Shevchenko <[email protected]> L: [email protected]
drivers/Makefile +1 -2
@@ -71,9 +71,8 @@ obj-y += gpu/ obj-$(CONFIG_CONNECTOR) += connector/ -# i810fb and intelfb depend on char/agp/ +# i810fb depends on char/agp/ obj-$(CONFIG_FB_I810) += video/fbdev/i810/ -obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/ obj-$(CONFIG_PARPORT) += parport/ obj-y += base/ block/ misc/ mfd/ nfc/
drivers/video/fbdev/Kconfig +0 -39
@@ -854,45 +854,6 @@ config FB_CARILLO_RANCH help This driver supports the LE80578 (Carillo Ranch) board -config FB_INTEL - tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" - depends on FB && PCI && X86 && AGP_INTEL && EXPERT - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - select FB_IOMEM_FOPS - select FB_MODE_HELPERS - select BOOT_VESA_SUPPORT if FB_INTEL = y - select VIDEO_NOMODESET - depends on !DRM_I915 - help - This driver supports the on-board graphics built in to the Intel - 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. - Say Y if you have and plan to use such a board. - - To make FB_INTEL=Y work you need to say AGP_INTEL=y too. - - To compile this driver as a module, choose M here: the - module will be called intelfb. - - For more information, please read <file:Documentation/fb/intelfb.rst> - -config FB_INTEL_DEBUG - bool "Intel driver Debug Messages" - depends on FB_INTEL - help - Say Y here if you want the Intel driver to output all sorts - of debugging information to provide to the maintainer when - something goes wrong. - -config FB_INTEL_I2C - bool "DDC/I2C for Intel framebuffer support" - depends on FB_INTEL - select FB_DDC - default y - help - Say Y here if you want DDC/I2C support for your on-board Intel graphics. - config FB_MATROX tristate "Matrox acceleration" depends on FB && PCI
drivers/video/fbdev/intelfb/Makefile deleted +0 -8
@@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_FB_INTEL) += intelfb.o - -intelfb-y := intelfbdrv.o intelfbhw.o -intelfb-$(CONFIG_FB_INTEL_I2C) += intelfb_i2c.o -intelfb-objs := $(intelfb-y) - -ccflags-$(CONFIG_FB_INTEL_DEBUG) := -DDEBUG -DREGDUMP
drivers/video/fbdev/intelfb/intelfb.h deleted +0 -382
382 lines not on this page · raw message
drivers/video/fbdev/intelfb/intelfb_i2c.c deleted +0 -209
209 lines not on this page · raw message
drivers/video/fbdev/intelfb/intelfbdrv.c deleted +0 -1680
1,680 lines not on this page · raw message
drivers/video/fbdev/intelfb/intelfbhw.c deleted +0 -2115
484 lines not on this page · raw message
drivers/video/fbdev/intelfb/intelfbhw.h deleted +0 -609
609 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
Part of the diff is not shown here. View the raw message.
Hi Thomas,
looks good to me and I agree with removing it, no need to maintain such legacy piece of code anymore.
Quoted 5,345 lines · Thomas Zimmermann
From looking at the PCI IDs, every device supported by intelfb is also supported by i915. Anyone still using intelfb should please move on to i915, which does everything intelfb does but better.
Removing intelfb is motivated by the driver's excessive use of the global
screen_infostate. The state belongs to architecture and firmware code; device drivers should not attempt to access it. But fixing intelfb would require a significant change in the driver's probing logic. As intelfb has been obsolete for nearly 2 decades, it is probably not worth the effort. Let's just remove it. Also remove the related documentation.Signed-off-by Thomas Zimmermann <[email protected]>--- Documentation/fb/index.rst | 1 - Documentation/fb/intelfb.rst | 155 -- .../userspace-api/ioctl/ioctl-number.rst | 1 - MAINTAINERS | 7 - drivers/Makefile | 3 +- drivers/video/fbdev/Kconfig | 39 - drivers/video/fbdev/intelfb/Makefile | 8 - drivers/video/fbdev/intelfb/intelfb.h | 382 --- drivers/video/fbdev/intelfb/intelfb_i2c.c | 209 -- drivers/video/fbdev/intelfb/intelfbdrv.c | 1680 ------------- drivers/video/fbdev/intelfb/intelfbhw.c | 2115 ----------------- drivers/video/fbdev/intelfb/intelfbhw.h | 609 ----- 12 files changed, 1 insertion(+), 5208 deletions(-) delete mode 100644 Documentation/fb/intelfb.rst delete mode 100644 drivers/video/fbdev/intelfb/Makefile delete mode 100644 drivers/video/fbdev/intelfb/intelfb.h delete mode 100644 drivers/video/fbdev/intelfb/intelfb_i2c.c delete mode 100644 drivers/video/fbdev/intelfb/intelfbdrv.c delete mode 100644 drivers/video/fbdev/intelfb/intelfbhw.c delete mode 100644 drivers/video/fbdev/intelfb/intelfbhw.hDocumentation/fb/index.rst +0
-1@@ -19,7 +19,6 @@ Frame Buffer framebuffer gxfb intel810 - intelfb internals lxfb matroxfbDocumentation/fb/intelfb.rst deleted +0
-155@@ -1,155 +0,0 @@ -============================================================= -Intel 830M/845G/852GM/855GM/865G/915G/945G Framebuffer driver -============================================================= - -A. Introduction -=============== - -This is a framebuffer driver for various Intel 8xx/9xx compatible -graphics devices. These would include: - - - Intel 830M - - Intel 845G - - Intel 852GM - - Intel 855GM - - Intel 865G - - Intel 915G - - Intel 915GM - - Intel 945G - - Intel 945GM - - Intel 945GME - - Intel 965G - - Intel 965GM - -B. List of available options -============================= - - a. "video=intelfb" - enables the intelfb driver - - Recommendation: required - - b. "mode=<xres>x<yres>[-<bpp>][@<refresh>]" - select mode - - Recommendation: user preference - (default = 1024x768-32@70) - - c. "vram=<value>" - select amount of system RAM in MB to allocate for the video memory - if not enough RAM was already allocated by the BIOS. - - Recommendation: 1 - 4 MB. - (default = 4 MB) - - d. "voffset=<value>" - select at what offset in MB of the logical memory to allocate the - framebuffer memory. The intent is to avoid the memory blocks - used by standard graphics applications (XFree86). Depending on your - usage, adjust the value up or down, (0 for maximum usage, 63/127 MB - for the least amount). Note, an arbitrary setting may conflict - with XFree86. - - Recommendation: do not set - (default = 48 MB) - - e. "accel" - enable text acceleration. This can be enabled/reenabled anytime - by using 'fbset -accel true/false'. - - Recommendation: enable - (default = set) - - f. "hwcursor" - enable cursor acceleration. - - Recommendation: enable - (default = set) - - g. "mtrr" - enable MTRR. This allows data transfers to the framebuffer memory - to occur in bursts which can significantly increase performance. - Not very helpful with the intel chips because of 'shared memory'. - - Recommendation: set - (default = set) - - h. "fixed" - disable mode switching. - - Recommendation: do not set - (default = not set) - - The binary parameters can be unset with a "no" prefix, example "noaccel". - The default parameter (not named) is the mode. - -C. Kernel booting -================= - -Separate each option/option-pair by commas (,) and the option from its value -with an equals sign (=) as in the following:: - - video=intelfb:option1,option2=value2 - -Sample Usage ------------- - -In /etc/lilo.conf, add the line:: - - append="video=intelfb:mode=800x600-32@75,accel,hwcursor,vram=8" - -This will initialize the framebuffer to 800x600 at 32bpp and 75Hz. The -framebuffer will use 8 MB of System RAM. hw acceleration of text and cursor -will be enabled. - -Remarks -------- - -If setting this parameter doesn't work (you stay in a 80x25 text-mode), -you might need to set the "vga=<mode>" parameter too - see vesafb.txt -in this directory. - - -D. Module options -================== - -The module parameters are essentially similar to the kernel -parameters. The main difference is that you need to include a Boolean value -(1 for TRUE, and 0 for FALSE) for those options which don't need a value. - -Example, to enable MTRR, include "mtrr=1". - -Sample Usage ------------- - -Using the same setup as described above, load the module like this:: - - modprobe intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1 - -Or just add the following to a configuration file in /etc/modprobe.d/:: - - options intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1 - -and just do a:: - - modprobe intelfb - - -E. Acknowledgment: -=================== - - 1. Geert Uytterhoeven - his excellent howto and the virtual - framebuffer driver code made this possible. - - 2. Jeff Hartmann for his agpgart code. - - 3. David Dawes for his original kernel 2.4 code. - - 4. The X developers. Insights were provided just by reading the - XFree86 source code. - - 5. Antonino A. Daplas for his inspiring i810fb driver. - - 6. Andrew Morton for his kernel patches maintenance. - -SylvainDocumentation/userspace-api/ioctl/ioctl-number.rst +0
-1@@ -128,7 +128,6 @@ Code Seq# Include File Comments 'F' all linux/fb.h conflict! 'F' 01-02 drivers/scsi/pmcraid.h conflict! 'F' 20 drivers/video/fsl-diu-fb.h conflict! -'F' 20 drivers/video/intelfb/intelfb.h conflict! 'F' 20 linux/ivtvfb.h conflict! 'F' 20 linux/matroxfb.h conflict! 'F' 20 drivers/video/aty/atyfb_base.c conflict!MAINTAINERS +0
-7@@ -10666,13 +10666,6 @@ S: Supported F: drivers/infiniband/hw/irdma/ F: include/uapi/rdma/irdma-abi.h -INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) -M: Maik Broemme <[email protected]> -L: [email protected] -S: Maintained -F: Documentation/fb/intelfb.rst -F: drivers/video/fbdev/intelfb/ - INTEL GPIO DRIVERS M: Andy Shevchenko <[email protected]> L: [email protected]drivers/Makefile +1
-2@@ -71,9 +71,8 @@ obj-y += gpu/ obj-$(CONFIG_CONNECTOR) += connector/ -# i810fb and intelfb depend on char/agp/ +# i810fb depends on char/agp/ obj-$(CONFIG_FB_I810) += video/fbdev/i810/ -obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/ obj-$(CONFIG_PARPORT) += parport/ obj-y += base/ block/ misc/ mfd/ nfc/drivers/video/fbdev/Kconfig +0
-39@@ -854,45 +854,6 @@ config FB_CARILLO_RANCH help This driver supports the LE80578 (Carillo Ranch) board -config FB_INTEL - tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" - depends on FB && PCI && X86 && AGP_INTEL && EXPERT - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - select FB_IOMEM_FOPS - select FB_MODE_HELPERS - select BOOT_VESA_SUPPORT if FB_INTEL = y - select VIDEO_NOMODESET - depends on !DRM_I915 - help - This driver supports the on-board graphics built in to the Intel - 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. - Say Y if you have and plan to use such a board. - - To make FB_INTEL=Y work you need to say AGP_INTEL=y too. - - To compile this driver as a module, choose M here: the - module will be called intelfb. - - For more information, please read <file:Documentation/fb/intelfb.rst> - -config FB_INTEL_DEBUG - bool "Intel driver Debug Messages" - depends on FB_INTEL - help - Say Y here if you want the Intel driver to output all sorts - of debugging information to provide to the maintainer when - something goes wrong. - -config FB_INTEL_I2C - bool "DDC/I2C for Intel framebuffer support" - depends on FB_INTEL - select FB_DDC - default y - help - Say Y here if you want DDC/I2C support for your on-board Intel graphics. - config FB_MATROX tristate "Matrox acceleration" depends on FB && PCIdrivers/video/fbdev/intelfb/Makefile deleted +0
-8@@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_FB_INTEL) += intelfb.o - -intelfb-y := intelfbdrv.o intelfbhw.o -intelfb-$(CONFIG_FB_INTEL_I2C) += intelfb_i2c.o -intelfb-objs := $(intelfb-y) - -ccflags-$(CONFIG_FB_INTEL_DEBUG) := -DDEBUG -DREGDUMPdrivers/video/fbdev/intelfb/intelfb.h deleted +0
-382@@ -1,382 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _INTELFB_H -#define _INTELFB_H - -/* $DHD: intelfb/intelfb.h,v 1.40 2003/06/27 15:06:25 dawes Exp $ */ - -#include <linux/agp_backend.h> -#include <linux/fb.h> - -#ifdef CONFIG_FB_INTEL_I2C -#include <linux/i2c.h> -#include <linux/i2c-algo-bit.h> -#endif - -/*** Version/name ***/ -#define INTELFB_VERSION "0.9.6" -#define INTELFB_MODULE_NAME "intelfb" -#define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/945GME/965G/965GM" - - -/*** Debug/feature defines ***/ - -#ifndef DEBUG -#define DEBUG 0 -#endif - -#ifndef VERBOSE -#define VERBOSE 0 -#endif - -#ifndef REGDUMP -#define REGDUMP 0 -#endif - -#ifndef DETECT_VGA_CLASS_ONLY -#define DETECT_VGA_CLASS_ONLY 1 -#endif - -#ifndef ALLOCATE_FOR_PANNING -#define ALLOCATE_FOR_PANNING 1 -#endif - -#ifndef PREFERRED_MODE -#define PREFERRED_MODE "1024x768-32@70" -#endif - -/*** hw-related values ***/ - -/* Resource Allocation */ -#define INTELFB_FB_ACQUIRED 1 -#define INTELFB_MMIO_ACQUIRED 2 - -/* PCI ids for supported devices */ -#define PCI_DEVICE_ID_INTEL_830M 0x3577 -#define PCI_DEVICE_ID_INTEL_845G 0x2562 -#define PCI_DEVICE_ID_INTEL_85XGM 0x3582 -#define PCI_DEVICE_ID_INTEL_854 0x358E -#define PCI_DEVICE_ID_INTEL_865G 0x2572 -#define PCI_DEVICE_ID_INTEL_915G 0x2582 -#define PCI_DEVICE_ID_INTEL_915GM 0x2592 -#define PCI_DEVICE_ID_INTEL_945G 0x2772 -#define PCI_DEVICE_ID_INTEL_945GM 0x27A2 -#define PCI_DEVICE_ID_INTEL_945GME 0x27AE -#define PCI_DEVICE_ID_INTEL_965G 0x29A2 -#define PCI_DEVICE_ID_INTEL_965GM 0x2A02 - -/* Size of MMIO region */ -#define INTEL_REG_SIZE 0x80000 - -#define STRIDE_ALIGNMENT 16 -#define STRIDE_ALIGNMENT_I9XX 64 - -#define PALETTE_8_ENTRIES 256 - - -/*** Macros ***/ - -/* basic arithmetic */ -#define KB (x) ((x) * 1024) -#define MB (x) ((x) * 1024 * 1024) -#define BtoKB (x) ((x) / 1024) -#define BtoMB (x) ((x) / 1024 / 1024) - -#define GTT_PAGE_SIZE KB(4) - -#define ROUND_UP_TO (x, y) (((x) + (y) - 1) / (y) * (y)) -#define ROUND_DOWN_TO (x, y) ((x) / (y) * (y)) -#define ROUND_UP_TO_PAGE (x) ROUND_UP_TO((x), GTT_PAGE_SIZE) -#define ROUND_DOWN_TO_PAGE (x) ROUND_DOWN_TO((x), GTT_PAGE_SIZE) - -/* messages */ -#define PFX INTELFB_MODULE_NAME ": " - -#define ERR_MSG(fmt, args...) printk(KERN_ERR PFX fmt, ## args) -#define WRN_MSG(fmt, args...) printk(KERN_WARNING PFX fmt, ## args) -#define NOT_MSG(fmt, args...) printk(KERN_NOTICE PFX fmt, ## args) -#define INF_MSG(fmt, args...) printk(KERN_INFO PFX fmt, ## args) -#if DEBUG -#define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args) -#else -#define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args) -#endif - -/* get commonly used pointers */ -#define GET_DINFO (info) (info)->par - -/* misc macros */ -#define ACCEL (d, i) \ - ((d)->accel && !(d)->ring_lockup && \ - ((i)->var.accel_flags & FB_ACCELF_TEXT)) - -/*#define NOACCEL_CHIPSET(d) \ -((d)->chipset != INTEL_865G)*/ -#define NOACCEL_CHIPSET (d) \ - (0) - -#define FIXED_MODE (d) ((d)->fixed_mode) - -/*** Driver parameters ***/ - -#define RINGBUFFER_SIZE KB(64) -#define HW_CURSOR_SIZE KB(4) - -/* Intel agpgart driver */ -#define AGP_PHYSICAL_MEMORY 2 - -/* store information about an Ixxx DVO */ -/* The i830->i865 use multiple DVOs with multiple i2cs */ -/* the i915, i945 have a single sDVO i2c bus - which is different */ -#define MAX_OUTPUTS 6 - -/* these are outputs from the chip - integrated only -external chips are via DVO or SDVO output */ -#define INTELFB_OUTPUT_UNUSED 0 -#define INTELFB_OUTPUT_ANALOG 1 -#define INTELFB_OUTPUT_DVO 2 -#define INTELFB_OUTPUT_SDVO 3 -#define INTELFB_OUTPUT_LVDS 4 -#define INTELFB_OUTPUT_TVOUT 5 - -#define INTELFB_DVO_CHIP_NONE 0 -#define INTELFB_DVO_CHIP_LVDS 1 -#define INTELFB_DVO_CHIP_TMDS 2 -#define INTELFB_DVO_CHIP_TVOUT 4 - -#define INTELFB_OUTPUT_PIPE_NC 0 -#define INTELFB_OUTPUT_PIPE_A 1 -#define INTELFB_OUTPUT_PIPE_B 2 - -/*** Data Types ***/ - -/* supported chipsets */ -enum intel_chips { -INTEL_830M , -INTEL_845G , -INTEL_85XGM , -INTEL_852GM , -INTEL_852GME , -INTEL_854 , -INTEL_855GM , -INTEL_855GME , -INTEL_865G , -INTEL_915G , -INTEL_915GM , -INTEL_945G , -INTEL_945GM , -INTEL_945GME , -INTEL_965G , -INTEL_965GM , -}; - -struct intelfb_hwstate { -u32 vga0_divisor; -u32 vga1_divisor; -u32 vga_pd; -u32 dpll_a; -u32 dpll_b; -u32 fpa0; -u32 fpa1; -u32 fpb0; -u32 fpb1; -u32 palette_a[PALETTE_8_ENTRIES ]; -u32 palette_b[PALETTE_8_ENTRIES ]; -u32 htotal_a; -u32 hblank_a; -u32 hsync_a; -u32 vtotal_a; -u32 vblank_a; -u32 vsync_a; -u32 src_size_a; -u32 bclrpat_a; -u32 htotal_b; -u32 hblank_b; -u32 hsync_b; -u32 vtotal_b; -u32 vblank_b; -u32 vsync_b; -u32 src_size_b; -u32 bclrpat_b; -u32 adpa; -u32 dvoa; -u32 dvob; -u32 dvoc; -u32 dvoa_srcdim; -u32 dvob_srcdim; -u32 dvoc_srcdim; -u32 lvds; -u32 pipe_a_conf; -u32 pipe_b_conf; -u32 disp_arb; -u32 cursor_a_control; -u32 cursor_b_control; -u32 cursor_a_base; -u32 cursor_b_base; -u32 cursor_size; -u32 disp_a_ctrl; -u32 disp_b_ctrl; -u32 disp_a_base; -u32 disp_b_base; -u32 cursor_a_palette[4 ]; -u32 cursor_b_palette[4 ]; -u32 disp_a_stride; -u32 disp_b_stride; -u32 vgacntrl; -u32 add_id; -u32 swf0x[7 ]; -u32 swf1x[7 ]; -u32 swf3x[3 ]; -u32 fence[8 ]; -u32 instpm; -u32 mem_mode; -u32 fw_blc_0; -u32 fw_blc_1; -u16 hwstam; -u16 ier; -u16 iir; -u16 imr; -}; - -struct intelfb_heap_data { -u32 physical; -u8 __iomem *virtual; -u32 offset;/* in GATT pages */ -u32 size;/* in bytes */ -}; - -#ifdef CONFIG_FB_INTEL_I2C -struct intelfb_i2c_chan { -struct intelfb_info *dinfo; -u32 reg; -struct i2c_adapter adapter; -struct i2c_algo_bit_data algo; -}; -#endif - -struct intelfb_output_rec { -int type; -int pipe; -int flags; - -#ifdef CONFIG_FB_INTEL_I2C -struct intelfb_i2c_chan i2c_bus; -struct intelfb_i2c_chan ddc_bus; -#endif -}; - -struct intelfb_vsync { -wait_queue_head_t wait; -unsigned int count; -int pan_display; -u32 pan_offset; -}; - -struct intelfb_info { -struct fb_info *info; -const struct fb_ops *fbops; -struct pci_dev *pdev; - -struct intelfb_hwstate save_state; - -/* agpgart structs */ -struct agp_memory *gtt_fb_mem;/* use all stolen memory or vram */ -struct agp_memory *gtt_ring_mem;/* ring buffer */ -struct agp_memory *gtt_cursor_mem;/* hw cursor */ - -/* use a gart reserved fb mem */ -u8 fbmem_gart; - -int wc_cookie; - -/* heap data */ -struct intelfb_heap_data aperture; -struct intelfb_heap_data fb; -struct intelfb_heap_data ring; -struct intelfb_heap_data cursor; - -/* mmio regs */ -u32 mmio_base_phys; -u8 __iomem *mmio_base; - -/* fb start offset (in bytes) */ -u32 fb_start; - -/* ring buffer */ -u32 ring_head; -u32 ring_tail; -u32 ring_tail_mask; -u32 ring_space; -u32 ring_lockup; - -/* palette */ -u32 pseudo_palette[16 ]; - -/* chip info */ -int pci_chipset; -int chipset; -const char *name; -int mobile; - -/* current mode */ -int bpp, depth; -u32 visual; -int xres, yres, pitch; -int pixclock; - -/* current pipe */ -int pipe; - -/* some flags */ -int accel; -int hwcursor; -int fixed_mode; -int ring_active; -int flag; -unsigned long irq_flags; -int open; - -/* vsync */ -struct intelfb_vsync vsync; -spinlock_t int_lock; - -/* hw cursor */ -int cursor_on; -int cursor_blanked; -u8 cursor_src[64 ]; - -/* initial parameters */ -int initial_vga; -struct fb_var_screeninfo initial_var; -u32 initial_fb_base; -u32 initial_video_ram; -u32 initial_pitch; - -/* driver registered */ -int registered; - -/* index into plls */ -int pll_index; - -/* outputs */ -int num_outputs; -struct intelfb_output_rec output[MAX_OUTPUTS ]; -}; - -#define IS_I9XX (dinfo) (((dinfo)->chipset == INTEL_915G) || \ - ((dinfo)->chipset == INTEL_915GM) || \ - ((dinfo)->chipset == INTEL_945G) || \ - ((dinfo)->chipset == INTEL_945GM) || \ - ((dinfo)->chipset == INTEL_945GME) || \ - ((dinfo)->chipset == INTEL_965G) || \ - ((dinfo)->chipset == INTEL_965GM)) - -/*** function prototypes ***/ - -extern int intelfb_var_to_depth (const struct fb_var_screeninfo *var); - -#ifdef CONFIG_FB_INTEL_I2C -extern void intelfb_create_i2c_busses (struct intelfb_info *dinfo); -extern void intelfb_delete_i2c_busses (struct intelfb_info *dinfo); -#endif - -#endif /* _INTELFB_H */ drivers/video/fbdev/intelfb/intelfb_i2c.c deleted +0
-209@@ -1,209 +0,0 @@ -/************************************************************************** - -Copyright 2006 Dave Airlie <[email protected]> - -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/delay.h> -#include <linux/pci.h> -#include <linux/fb.h> - -#include <linux/i2c.h> -#include <linux/i2c-algo-bit.h> - -#include <asm/io.h> - -#include "intelfb.h" -#include "intelfbhw.h" - -/* bit locations in the registers */ -#define SCL_DIR_MASK 0x0001 -#define SCL_DIR 0x0002 -#define SCL_VAL_MASK 0x0004 -#define SCL_VAL_OUT 0x0008 -#define SCL_VAL_IN 0x0010 -#define SDA_DIR_MASK 0x0100 -#define SDA_DIR 0x0200 -#define SDA_VAL_MASK 0x0400 -#define SDA_VAL_OUT 0x0800 -#define SDA_VAL_IN 0x1000 - -static void intelfb_gpio_setscl (void *data,int state) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg, (state ?SCL_VAL_OUT :0 ) | -SCL_DIR |SCL_DIR_MASK |SCL_VAL_MASK ); - val =INREG (chan->reg); -} - -static void intelfb_gpio_setsda (void *data,int state) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg, (state ?SDA_VAL_OUT :0 ) | -SDA_DIR |SDA_DIR_MASK |SDA_VAL_MASK ); - val =INREG (chan->reg); -} - -static int intelfb_gpio_getscl (void *data) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg,SCL_DIR_MASK ); -OUTREG (chan->reg,0 ); - val =INREG (chan->reg); -return ((val &SCL_VAL_IN ) !=0 ); -} - -static int intelfb_gpio_getsda (void *data) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg,SDA_DIR_MASK ); -OUTREG (chan->reg,0 ); - val =INREG (chan->reg); -return ((val &SDA_VAL_IN ) !=0 ); -} - -static int intelfb_setup_i2c_bus (struct intelfb_info *dinfo, -struct intelfb_i2c_chan *chan, -const u32 reg,const char *name, -int class) -{ -int rc; - - chan->dinfo = dinfo; - chan->reg = reg; -snprintf (chan->adapter.name,sizeof (chan->adapter.name), -"intelfb %s" , name); - chan->adapter.class = class; - chan->adapter.owner =THIS_MODULE ; - chan->adapter.algo_data = &chan->algo; - chan->adapter.dev.parent = &chan->dinfo->pdev->dev; - chan->algo.setsda = intelfb_gpio_setsda; - chan->algo.setscl = intelfb_gpio_setscl; - chan->algo.getsda = intelfb_gpio_getsda; - chan->algo.getscl = intelfb_gpio_getscl; - chan->algo.udelay =40 ; - chan->algo.timeout =20 ; - chan->algo.data = chan; - -i2c_set_adapdata (&chan->adapter, chan); - -/* Raise SCL and SDA */ -intelfb_gpio_setsda (chan,1 ); -intelfb_gpio_setscl (chan,1 ); -udelay (20 ); - - rc =i2c_bit_add_bus (&chan->adapter); -if (rc ==0 ) -DBG_MSG ("I2C bus %s registered.\n" , name); -else -WRN_MSG ("Failed to register I2C bus %s.\n" , name); -return rc; -} - -void intelfb_create_i2c_busses (struct intelfb_info *dinfo) -{ -int i =0 ; - -/* everyone has at least a single analog output */ - dinfo->num_outputs =1 ; - dinfo->output[i].type =INTELFB_OUTPUT_ANALOG ; - -/* setup the DDC bus for analog output */ -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].ddc_bus,GPIOA , -"CRTDDC_A" ,I2C_CLASS_DDC ); - i++; - -/* need to add the output busses for each device -- this function is very incomplete -- i915GM has LVDS and TVOUT for example -*/ -switch (dinfo->chipset) { -case INTEL_830M : -case INTEL_845G : -case INTEL_854 : -case INTEL_855GM : -case INTEL_865G : - dinfo->output[i].type =INTELFB_OUTPUT_DVO ; -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].ddc_bus, -GPIOD ,"DVODDC_D" ,I2C_CLASS_DDC ); -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].i2c_bus, -GPIOE ,"DVOI2C_E" ,0 ); - i++; -break ; -case INTEL_915G : -case INTEL_915GM : -/* has some LVDS + tv-out */ -case INTEL_945G : -case INTEL_945GM : -case INTEL_945GME : -case INTEL_965G : -case INTEL_965GM : -/* SDVO ports have a single control bus - 2 devices */ - dinfo->output[i].type =INTELFB_OUTPUT_SDVO ; -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].i2c_bus, -GPIOE ,"SDVOCTRL_E" ,0 ); -/* TODO: initialize the SDVO */ -/* I830SDVOInit(pScrn, i, DVOB); */ - i++; - -/* set up SDVOC */ - dinfo->output[i].type =INTELFB_OUTPUT_SDVO ; - dinfo->output[i].i2c_bus = dinfo->output[i -1 ].i2c_bus; -/* TODO: initialize the SDVO */ -/* I830SDVOInit(pScrn, i, DVOC); */ - i++; -break ; - } - dinfo->num_outputs = i; -} - -void intelfb_delete_i2c_busses (struct intelfb_info *dinfo) -{ -int i; - -for (i =0 ; i <MAX_OUTPUTS ; i++) { -if (dinfo->output[i].i2c_bus.dinfo) { -i2c_del_adapter (&dinfo->output[i].i2c_bus.adapter); - dinfo->output[i].i2c_bus.dinfo =NULL ; - } -if (dinfo->output[i].ddc_bus.dinfo) { -i2c_del_adapter (&dinfo->output[i].ddc_bus.adapter); - dinfo->output[i].ddc_bus.dinfo =NULL ; - } - } -}drivers/video/fbdev/intelfb/intelfbdrv.c deleted +0
-1680@@ -1,1680 +0,0 @@ -/* -* intelfb -* -* Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/ -* 945G/945GM/945GME/965G/965GM integrated graphics chips. -* -* Copyright © 2002, 2003 David Dawes <[email protected]> -* 2004 Sylvain Meyer -* 2006 David Airlie -* -* This driver consists of two parts. The first part (intelfbdrv.c) provides -* the basic fbdev interfaces, is derived in part from the radeonfb and -* vesafb drivers, and is covered by the GPL. The second part (intelfbhw.c) -* provides the code to program the hardware. Most of it is derived from -* the i810/i830 XFree86 driver. The HW-specific code is covered here -* under a dual license (GPL and MIT/XFree86 license). -* -* Author: David Dawes -* -*/ - -/* $DHD: intelfb/intelfbdrv.c,v 1.20 2003/06/27 15:17:40 dawes Exp $ */ - -/* -* Changes: -* 01/2003 - Initial driver (0.1.0), no mode switching, no acceleration. -* This initial version is a basic core that works a lot like -* the vesafb driver. It must be built-in to the kernel, -* and the initial video mode must be set with vga=XXX at -* boot time. (David Dawes) -* -* 01/2003 - Version 0.2.0: Mode switching added, colormap support -* implemented, Y panning, and soft screen blanking implemented. -* No acceleration yet. (David Dawes) -* -* 01/2003 - Version 0.3.0: fbcon acceleration support added. Module -* option handling added. (David Dawes) -* -* 01/2003 - Version 0.4.0: fbcon HW cursor support added. (David Dawes) -* -* 01/2003 - Version 0.4.1: Add auto-generation of built-in modes. -* (David Dawes) -* -* 02/2003 - Version 0.4.2: Add check for active non-CRT devices, and -* mode validation checks. (David Dawes) -* -* 02/2003 - Version 0.4.3: Check when the VC is in graphics mode so that -* acceleration is disabled while an XFree86 server is running. -* (David Dawes) -* -* 02/2003 - Version 0.4.4: Monitor DPMS support. (David Dawes) -* -* 02/2003 - Version 0.4.5: Basic XFree86 + fbdev working. (David Dawes) -* -* 02/2003 - Version 0.5.0: Modify to work with the 2.5.32 kernel as well -* as 2.4.x kernels. (David Dawes) -* -* 02/2003 - Version 0.6.0: Split out HW-specifics into a separate file. -* (David Dawes) -* -* 02/2003 - Version 0.7.0: Test on 852GM/855GM. Acceleration and HW -* cursor are disabled on this platform. (David Dawes) -* -* 02/2003 - Version 0.7.1: Test on 845G. Acceleration is disabled -* on this platform. (David Dawes) -* -* 02/2003 - Version 0.7.2: Test on 830M. Acceleration and HW -* cursor are disabled on this platform. (David Dawes) -* -* 02/2003 - Version 0.7.3: Fix 8-bit modes for mobile platforms -* (David Dawes) -* -* 02/2003 - Version 0.7.4: Add checks for FB and FBCON_HAS_CFB* configured -* in the kernel, and add mode bpp verification and default -* bpp selection based on which FBCON_HAS_CFB* are configured. -* (David Dawes) -* -* 02/2003 - Version 0.7.5: Add basic package/install scripts based on the -* DRI packaging scripts. (David Dawes) -* -* 04/2003 - Version 0.7.6: Fix typo that affects builds with SMP-enabled -* kernels. (David Dawes, reported by Anupam). -* -* 06/2003 - Version 0.7.7: -* Fix Makefile.kernel build problem (Tsutomu Yasuda). -* Fix mis-placed #endif (2.4.21 kernel). -* -* 09/2004 - Version 0.9.0 - by Sylvain Meyer -* Port to linux 2.6 kernel fbdev -* Fix HW accel and HW cursor on i845G -* Use of agpgart for fb memory reservation -* Add mtrr support -* -* 10/2004 - Version 0.9.1 -* Use module_param instead of old MODULE_PARM -* Some cleanup -* -* 11/2004 - Version 0.9.2 -* Add vram option to reserve more memory than stolen by BIOS -* Fix intelfbhw_pan_display typo -* Add __initdata annotations -* -* 04/2008 - Version 0.9.5 -* Add support for 965G/965GM. (Maik Broemme <[email protected]>) -* -* 08/2008 - Version 0.9.6 -* Add support for 945GME. (Phil Endecott <[email protected]>) -*/ - -#include <linux/aperture.h> -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/mm.h> -#include <linux/slab.h> -#include <linux/delay.h> -#include <linux/fb.h> -#include <linux/ioport.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/vmalloc.h> -#include <linux/pagemap.h> -#include <linux/screen_info.h> - -#include <asm/io.h> - -#include "intelfb.h" -#include "intelfbhw.h" -#include "../edid.h" - -static void get_initial_mode (struct intelfb_info *dinfo); -static void update_dinfo (struct intelfb_info *dinfo, -struct fb_var_screeninfo *var); -static int intelfb_open (struct fb_info *info,int user); -static int intelfb_release (struct fb_info *info,int user); -static int intelfb_check_var (struct fb_var_screeninfo *var, -struct fb_info *info); -static int intelfb_set_par (struct fb_info *info); -static int intelfb_setcolreg (unsigned regno,unsigned red,unsigned green, -unsigned blue,unsigned transp, -struct fb_info *info); - -static int intelfb_blank (int blank,struct fb_info *info); -static int intelfb_pan_display (struct fb_var_screeninfo *var, -struct fb_info *info); - -static void intelfb_fillrect (struct fb_info *info, -const struct fb_fillrect *rect); -static void intelfb_copyarea (struct fb_info *info, -const struct fb_copyarea *region); -static void intelfb_imageblit (struct fb_info *info, -const struct fb_image *image); -static int intelfb_cursor (struct fb_info *info, -struct fb_cursor *cursor); - -static int intelfb_sync (struct fb_info *info); - -static int intelfb_ioctl (struct fb_info *info, -unsigned int cmd,unsigned long arg); - -static int intelfb_pci_register (struct pci_dev *pdev, -const struct pci_device_id *ent); -static void intelfb_pci_unregister (struct pci_dev *pdev); -static int intelfb_set_fbinfo (struct intelfb_info *dinfo); - -/* -* Limiting the class to PCI_CLASS_DISPLAY_VGA prevents function 1 of the -* mobile chipsets from being registered. -*/ -#if DETECT_VGA_CLASS_ONLY -#define INTELFB_CLASS_MASK ~0 << 8 -#else -#define INTELFB_CLASS_MASK 0 -#endif - -static const struct pci_device_id intelfb_pci_table[] = { - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_830M ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_830M }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_845G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_845G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_85XGM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_85XGM }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_865G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_865G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_854 ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_854 }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_915G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_915G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_915GM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_915GM }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_945G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_945G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_945GM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_945GM }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_945GME ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_945GME }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_965G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_965G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_965GM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_965GM }, - {0 , } -}; - -/* Global data */ -static int num_registered =0 ; - -/* fb ops */ -static const struct fb_ops intel_fb_ops = { - .owner =THIS_MODULE , - .fb_open = intelfb_open, - .fb_release = intelfb_release, - __FB_DEFAULT_IOMEM_OPS_RDWR, - .fb_check_var = intelfb_check_var, - .fb_set_par = intelfb_set_par, - .fb_setcolreg = intelfb_setcolreg, - .fb_blank = intelfb_blank, - .fb_pan_display = intelfb_pan_display, - .fb_fillrect = intelfb_fillrect, - .fb_copyarea = intelfb_copyarea, - .fb_imageblit = intelfb_imageblit, - .fb_cursor = intelfb_cursor, - .fb_sync = intelfb_sync, - .fb_ioctl = intelfb_ioctl, - __FB_DEFAULT_IOMEM_OPS_MMAP, -}; - -/* PCI driver module table */ -static struct pci_driver intelfb_driver = { - .name ="intelfb" , - .id_table = intelfb_pci_table, - .probe = intelfb_pci_register, - .remove = intelfb_pci_unregister, -}; - -/* Module description/parameters */ -MODULE_AUTHOR ("David Dawes <[email protected]>, " -"Sylvain Meyer <[email protected]>" ); -MODULE_DESCRIPTION ("Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS -" chipsets" ); -MODULE_LICENSE ("Dual BSD/GPL" ); -MODULE_DEVICE_TABLE (pci, intelfb_pci_table); - -static bool accel =1 ; -static int vram =4 ; -static bool hwcursor =0 ; -static bool mtrr =1 ; -static bool fixed =0 ; -static bool noinit =0 ; -static bool noregister =0 ; -static bool probeonly =0 ; -static bool idonly =0 ; -static int bailearly =0 ; -static int voffset =48 ; -static char *mode =NULL ; - -module_param (accel, bool,S_IRUGO ); -MODULE_PARM_DESC (accel,"Enable hardware acceleration" ); -module_param (vram, int,S_IRUGO ); -MODULE_PARM_DESC (vram,"System RAM to allocate to framebuffer in MiB" ); -module_param (voffset, int,S_IRUGO ); -MODULE_PARM_DESC (voffset,"Offset of framebuffer in MiB" ); -module_param (hwcursor, bool,S_IRUGO ); -MODULE_PARM_DESC (hwcursor,"Enable HW cursor" ); -module_param (mtrr, bool,S_IRUGO ); -MODULE_PARM_DESC (mtrr,"Enable MTRR support" ); -module_param (fixed, bool,S_IRUGO ); -MODULE_PARM_DESC (fixed,"Disable mode switching" ); -module_param (noinit, bool,0 ); -MODULE_PARM_DESC (noinit,"Don't initialise graphics mode when loading" ); -module_param (noregister, bool,0 ); -MODULE_PARM_DESC (noregister,"Don't register, just probe and exit (debug)" ); -module_param (probeonly, bool,0 ); -MODULE_PARM_DESC (probeonly,"Do a minimal probe (debug)" ); -module_param (idonly, bool,0 ); -MODULE_PARM_DESC (idonly,"Just identify without doing anything else (debug)" ); -module_param (bailearly, int,0 ); -MODULE_PARM_DESC (bailearly,"Bail out early, depending on value (debug)" ); -module_param (mode, charp,S_IRUGO ); -MODULE_PARM_DESC (mode, -"Initial video mode \"<xres>x<yres>[-<depth>][@<refresh>]\"" ); - -#ifndef MODULE -#define OPT_EQUAL (opt, name) (!strncmp(opt, name, strlen(name))) -#define OPT_INTVAL (opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0) -#define OPT_STRVAL (opt, name) (opt + strlen(name)) - -static __inline__char *get_opt_string (const char *this_opt,const char *name) -{ -const char *p; -int i; -char *ret; - - p =OPT_STRVAL (this_opt, name); - i =0 ; -while (p[i] && p[i] !=' ' && p[i] !=',' ) - i++; - ret =kmalloc (i +1 ,GFP_KERNEL ); -if (ret) { -strncpy (ret, p, i); - ret[i] ='\0' ; - } -return ret; -} - -static __inline__int get_opt_int (const char *this_opt,const char *name, -int *ret) -{ -if (!ret) -return 0 ; - -if (!OPT_EQUAL (this_opt, name)) -return 0 ; - - *ret =OPT_INTVAL (this_opt, name); -return 1 ; -} - -static __inline__int get_opt_bool (const char *this_opt,const char *name, -bool *ret) -{ -if (!ret) -return 0 ; - -if (OPT_EQUAL (this_opt, name)) { -if (this_opt[strlen (name)] =='=' ) - *ret =simple_strtoul (this_opt +strlen (name) +1 , -NULL ,0 ); -else - *ret =1 ; - }else { -if (OPT_EQUAL (this_opt,"no" ) &&OPT_EQUAL (this_opt +2 , name)) - *ret =0 ; -else -return 0 ; - } -return 1 ; -} - -static int __init intelfb_setup (char *options) -{ -char *this_opt; - -DBG_MSG ("intelfb_setup\n" ); - -if (!options || !*options) { -DBG_MSG ("no options\n" ); -return 0 ; - }else -DBG_MSG ("options: %s\n" , options); - -/* -* These are the built-in options analogous to the module parameters -* defined above. -* -* The syntax is: -* -* video=intelfb:[mode][,<param>=<val>] ... -* -* e.g., -* -* video=intelfb:1024x768-16@75,accel=0 -*/ - -while ((this_opt =strsep (&options,"," ))) { -if (!*this_opt) -continue ; -if (get_opt_bool (this_opt,"accel" , &accel)) - ; -else if (get_opt_int (this_opt,"vram" , &vram)) - ; -else if (get_opt_bool (this_opt,"hwcursor" , &hwcursor)) - ; -else if (get_opt_bool (this_opt,"mtrr" , &mtrr)) - ; -else if (get_opt_bool (this_opt,"fixed" , &fixed)) - ; -else if (get_opt_bool (this_opt,"init" , &noinit)) - noinit = !noinit; -else if (OPT_EQUAL (this_opt,"mode=" )) - mode =get_opt_string (this_opt,"mode=" ); -else - mode = this_opt; - } - -return 0 ; -} - -#endif - -static int __init intelfb_init (void ) -{ -#ifndef MODULE -char *option =NULL ; -#endif - -DBG_MSG ("intelfb_init\n" ); - -INF_MSG ("Framebuffer driver for " -"Intel(R) " SUPPORTED_CHIPSETS " chipsets\n" ); -INF_MSG ("Version " INTELFB_VERSION "\n" ); - -if (idonly) -return -ENODEV ; - -if (fb_modesetting_disabled ("intelfb" )) -return -ENODEV ; - -#ifndef MODULE -if (fb_get_options ("intelfb" , &option)) -return -ENODEV ; -intelfb_setup (option); -#endif - -return pci_register_driver (&intelfb_driver); -} - -static void __exit intelfb_exit(void) -{ -DBG_MSG ("intelfb_exit\n" ); -pci_unregister_driver (&intelfb_driver); -} - -module_init (intelfb_init); -module_exit (intelfb_exit); - -/*************************************************************** -* driver init / cleanup * -***************************************************************/ - -static void cleanup (struct intelfb_info *dinfo) -{ -DBG_MSG ("cleanup\n" ); - -if (!dinfo) -return ; - -intelfbhw_disable_irq (dinfo); - -fb_dealloc_cmap (&dinfo->info->cmap); -kfree (dinfo->info->pixmap.addr); - -if (dinfo->registered) -unregister_framebuffer (dinfo->info); - -arch_phys_wc_del (dinfo->wc_cookie); - -if (dinfo->fbmem_gart && dinfo->gtt_fb_mem) { -agp_unbind_memory (dinfo->gtt_fb_mem); -agp_free_memory (dinfo->gtt_fb_mem); - } -if (dinfo->gtt_cursor_mem) { -agp_unbind_memory (dinfo->gtt_cursor_mem); -agp_free_memory (dinfo->gtt_cursor_mem); - } -if (dinfo->gtt_ring_mem) { -agp_unbind_memory (dinfo->gtt_ring_mem); -agp_free_memory (dinfo->gtt_ring_mem); - } - -#ifdef CONFIG_FB_INTEL_I2C -/* un-register I2C bus */ -intelfb_delete_i2c_busses (dinfo); -#endif - -if (dinfo->mmio_base) -iounmap ((void __iomem *)dinfo->mmio_base); -if (dinfo->aperture.virtual) -iounmap ((void __iomem *)dinfo->aperture.virtual); - -if (dinfo->flag &INTELFB_MMIO_ACQUIRED ) -release_mem_region (dinfo->mmio_base_phys,INTEL_REG_SIZE ); -if (dinfo->flag &INTELFB_FB_ACQUIRED ) -release_mem_region (dinfo->aperture.physical, - dinfo->aperture.size); -framebuffer_release (dinfo->info); -} - -#define bailout (dinfo) do { \ - DBG_MSG("bailout\n"); \ - cleanup(dinfo); \ - INF_MSG("Not going to register framebuffer, exiting...\n"); \ - return -ENODEV; \ -} while (0) - - -static int intelfb_pci_register (struct pci_dev *pdev, -const struct pci_device_id *ent) -{ -struct fb_info *info; -struct intelfb_info *dinfo; -int i, err, dvo; -int aperture_size, stolen_size =0 ; -struct agp_kern_info gtt_info; -int agp_memtype; -const char *s; -struct agp_bridge_data *bridge; -int aperture_bar =0 ; -int mmio_bar =1 ; -int offset; - -DBG_MSG ("intelfb_pci_register\n" ); - - err =aperture_remove_conflicting_pci_devices (pdev,"intelfb" ); -if (err) -return err; - - num_registered++; -if (num_registered !=1 ) { -ERR_MSG ("Attempted to register %d devices " -"(should be only 1).\n" , num_registered); -return -ENODEV ; - } - - info =framebuffer_alloc (sizeof (struct intelfb_info ), &pdev->dev); -if (!info) -return -ENOMEM ; - -if (fb_alloc_cmap (&info->cmap,256 ,1 ) <0 ) { -ERR_MSG ("Could not allocate cmap for intelfb_info.\n" ); - goto err_out_cmap; - } - - dinfo = info->par; - dinfo->info = info; - dinfo->fbops = &intel_fb_ops; - dinfo->pdev = pdev; - -/* Reserve pixmap space. */ - info->pixmap.addr =kzalloc (64 *1024 ,GFP_KERNEL ); -if (info->pixmap.addr ==NULL ) { -ERR_MSG ("Cannot reserve pixmap memory.\n" ); - goto err_out_pixmap; - } - -/* set early this option because it could be changed by tv encoder -driver */ - dinfo->fixed_mode = fixed; - -/* Enable device. */ -if ((err =pci_enable_device (pdev))) { -ERR_MSG ("Cannot enable device.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - -/* Set base addresses. */ -if ((ent->device ==PCI_DEVICE_ID_INTEL_915G ) || - (ent->device ==PCI_DEVICE_ID_INTEL_915GM ) || - (ent->device ==PCI_DEVICE_ID_INTEL_945G ) || - (ent->device ==PCI_DEVICE_ID_INTEL_945GM ) || - (ent->device ==PCI_DEVICE_ID_INTEL_945GME ) || - (ent->device ==PCI_DEVICE_ID_INTEL_965G ) || - (ent->device ==PCI_DEVICE_ID_INTEL_965GM )) { - - aperture_bar =2 ; - mmio_bar =0 ; - } - dinfo->aperture.physical =pci_resource_start (pdev, aperture_bar); - dinfo->aperture.size =pci_resource_len (pdev, aperture_bar); - dinfo->mmio_base_phys =pci_resource_start (pdev, mmio_bar); -DBG_MSG ("fb aperture: 0x%llx/0x%llx, MMIO region: 0x%llx/0x%llx\n" , - (unsigned long long )pci_resource_start (pdev, aperture_bar), - (unsigned long long )pci_resource_len (pdev, aperture_bar), - (unsigned long long )pci_resource_start (pdev, mmio_bar), - (unsigned long long )pci_resource_len (pdev, mmio_bar)); - -/* Reserve the fb and MMIO regions */ -if (!request_mem_region (dinfo->aperture.physical, dinfo->aperture.size, -INTELFB_MODULE_NAME )) { -ERR_MSG ("Cannot reserve FB region.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->flag |=INTELFB_FB_ACQUIRED ; - -if (!request_mem_region (dinfo->mmio_base_phys, -INTEL_REG_SIZE , -INTELFB_MODULE_NAME )) { -ERR_MSG ("Cannot reserve MMIO region.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->flag |=INTELFB_MMIO_ACQUIRED ; - -/* Get the chipset info. */ - dinfo->pci_chipset = pdev->device; - -if (intelfbhw_get_chipset (pdev, dinfo)) { -cleanup (dinfo); -return -ENODEV ; - } - -if (intelfbhw_get_memory (pdev, &aperture_size, &stolen_size)) { -cleanup (dinfo); -return -ENODEV ; - } - -INF_MSG ("%02x:%02x.%d: %s, aperture size %dMB, " -"stolen memory %dkB\n" , - pdev->bus->number,PCI_SLOT (pdev->devfn), -PCI_FUNC (pdev->devfn), dinfo->name, -BtoMB (aperture_size),BtoKB (stolen_size)); - -/* Set these from the options. */ - dinfo->accel = accel; - dinfo->hwcursor = hwcursor; - -if (NOACCEL_CHIPSET (dinfo) && dinfo->accel ==1 ) { -INF_MSG ("Acceleration is not supported for the %s chipset.\n" , - dinfo->name); - dinfo->accel =0 ; - } - -/* Framebuffer parameters - Use all the stolen memory if >= vram */ -if (ROUND_UP_TO_PAGE (stolen_size) >=MB (vram)) { - dinfo->fb.size =ROUND_UP_TO_PAGE (stolen_size); - dinfo->fbmem_gart =0 ; - }else { - dinfo->fb.size =MB (vram); - dinfo->fbmem_gart =1 ; - } - -/* Allocate space for the ring buffer and HW cursor if enabled. */ -if (dinfo->accel) { - dinfo->ring.size =RINGBUFFER_SIZE ; - dinfo->ring_tail_mask = dinfo->ring.size -1 ; - } -if (dinfo->hwcursor) - dinfo->cursor.size =HW_CURSOR_SIZE ; - -/* Use agpgart to manage the GATT */ -if (!(bridge =agp_backend_acquire (pdev))) { -ERR_MSG ("cannot acquire agp\n" ); -cleanup (dinfo); -return -ENODEV ; - } - -/* get the current gatt info */ -if (agp_copy_info (bridge, >t_info)) { -ERR_MSG ("cannot get agp info\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENODEV ; - } - -if (MB (voffset) < stolen_size) - offset = (stolen_size >>12 ); -else - offset =ROUND_UP_TO_PAGE (MB (voffset))/GTT_PAGE_SIZE ; - -/* set the mem offsets - set them after the already used pages */ -if (dinfo->accel) - dinfo->ring.offset = offset + gtt_info.current_memory; -if (dinfo->hwcursor) - dinfo->cursor.offset = offset + - + gtt_info.current_memory + (dinfo->ring.size >>12 ); -if (dinfo->fbmem_gart) - dinfo->fb.offset = offset + - + gtt_info.current_memory + (dinfo->ring.size >>12 ) - + (dinfo->cursor.size >>12 ); - -/* Allocate memories (which aren't stolen) */ -/* Map the fb and MMIO regions */ -/* ioremap only up to the end of used aperture */ - dinfo->aperture.virtual = (u8 __iomem *)ioremap_wc - (dinfo->aperture.physical, ((offset + dinfo->fb.offset) <<12 ) - + dinfo->fb.size); -if (!dinfo->aperture.virtual) { -ERR_MSG ("Cannot remap FB region.\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->mmio_base = - (u8 __iomem *)ioremap (dinfo->mmio_base_phys, -INTEL_REG_SIZE ); -if (!dinfo->mmio_base) { -ERR_MSG ("Cannot remap MMIO region.\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENODEV ; - } - -if (dinfo->accel) { -if (!(dinfo->gtt_ring_mem = -agp_allocate_memory (bridge, dinfo->ring.size >>12 , -AGP_NORMAL_MEMORY ))) { -ERR_MSG ("cannot allocate ring buffer memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENOMEM ; - } -if (agp_bind_memory (dinfo->gtt_ring_mem, - dinfo->ring.offset)) { -ERR_MSG ("cannot bind ring buffer memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -EBUSY ; - } - dinfo->ring.physical = dinfo->aperture.physical - + (dinfo->ring.offset <<12 ); - dinfo->ring.virtual = dinfo->aperture.virtual - + (dinfo->ring.offset <<12 ); - dinfo->ring_head =0 ; - } -if (dinfo->hwcursor) { - agp_memtype = dinfo->mobile ?AGP_PHYSICAL_MEMORY - :AGP_NORMAL_MEMORY ; -if (!(dinfo->gtt_cursor_mem = -agp_allocate_memory (bridge, dinfo->cursor.size >>12 , - agp_memtype))) { -ERR_MSG ("cannot allocate cursor memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENOMEM ; - } -if (agp_bind_memory (dinfo->gtt_cursor_mem, - dinfo->cursor.offset)) { -ERR_MSG ("cannot bind cursor memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -EBUSY ; - } -if (dinfo->mobile) - dinfo->cursor.physical - = dinfo->gtt_cursor_mem->physical; -else - dinfo->cursor.physical = dinfo->aperture.physical - + (dinfo->cursor.offset <<12 ); - dinfo->cursor.virtual = dinfo->aperture.virtual - + (dinfo->cursor.offset <<12 ); - } -if (dinfo->fbmem_gart) { -if (!(dinfo->gtt_fb_mem = -agp_allocate_memory (bridge, dinfo->fb.size >>12 , -AGP_NORMAL_MEMORY ))) { -WRN_MSG ("cannot allocate framebuffer memory - use " -"the stolen one\n" ); - dinfo->fbmem_gart =0 ; - } -if (agp_bind_memory (dinfo->gtt_fb_mem, - dinfo->fb.offset)) { -WRN_MSG ("cannot bind framebuffer memory - use " -"the stolen one\n" ); - dinfo->fbmem_gart =0 ; - } - } - -/* update framebuffer memory parameters */ -if (!dinfo->fbmem_gart) - dinfo->fb.offset =0 ;/* starts at offset 0 */ - dinfo->fb.physical = dinfo->aperture.physical - + (dinfo->fb.offset <<12 ); - dinfo->fb.virtual = dinfo->aperture.virtual + (dinfo->fb.offset <<12 ); - dinfo->fb_start = dinfo->fb.offset <<12 ; - -/* release agpgart */ -agp_backend_release (bridge); - -if (mtrr) - dinfo->wc_cookie =arch_phys_wc_add (dinfo->aperture.physical, - dinfo->aperture.size); - -DBG_MSG ("fb: 0x%x(+ 0x%x)/0x%x (0x%p)\n" , - dinfo->fb.physical, dinfo->fb.offset, dinfo->fb.size, - dinfo->fb.virtual); -DBG_MSG ("MMIO: 0x%x/0x%x (0x%p)\n" , - dinfo->mmio_base_phys,INTEL_REG_SIZE , - dinfo->mmio_base); -DBG_MSG ("ring buffer: 0x%x/0x%x (0x%p)\n" , - dinfo->ring.physical, dinfo->ring.size, - dinfo->ring.virtual); -DBG_MSG ("HW cursor: 0x%x/0x%x (0x%p) (offset 0x%x) (phys 0x%x)\n" , - dinfo->cursor.physical, dinfo->cursor.size, - dinfo->cursor.virtual, dinfo->cursor.offset, - dinfo->cursor.physical); - -DBG_MSG ("options: vram = %d, accel = %d, hwcursor = %d, fixed = %d, " -"noinit = %d\n" , vram, accel, hwcursor, fixed, noinit); -DBG_MSG ("options: mode = \"%s\"\n" , mode ? mode :"" ); - -if (probeonly) -bailout (dinfo); - -/* -* Check if the LVDS port or any DVO ports are enabled. If so, -* don't allow mode switching -*/ - dvo =intelfbhw_check_non_crt (dinfo); -if (dvo) { - dinfo->fixed_mode =1 ; -WRN_MSG ("Non-CRT device is enabled ( " ); - i =0 ; -while (dvo) { -if (dvo &1 ) { - s =intelfbhw_dvo_to_string (1 << i); -if (s) -printk ("%s " , s); - } - dvo >>=1 ; - ++i; - } -printk ("). Disabling mode switching.\n" ); - } - -if (bailearly ==1 ) -bailout (dinfo); - -if (FIXED_MODE (dinfo) && - screen_info.orig_video_isVGA !=VIDEO_TYPE_VLFB ) { -ERR_MSG ("Video mode must be programmed at boot time.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - -if (bailearly ==2 ) -bailout (dinfo); - -/* Initialise dinfo and related data. */ -/* If an initial mode was programmed at boot time, get its details. */ -if (screen_info.orig_video_isVGA ==VIDEO_TYPE_VLFB ) -get_initial_mode (dinfo); - -if (bailearly ==3 ) -bailout (dinfo); - -if (FIXED_MODE (dinfo))/* remap fb address */ -update_dinfo (dinfo, &dinfo->initial_var); - -if (bailearly ==4 ) -bailout (dinfo); - - -if (intelfb_set_fbinfo (dinfo)) { -cleanup (dinfo); -return -ENODEV ; - } - -if (bailearly ==5 ) -bailout (dinfo); - -#ifdef CONFIG_FB_INTEL_I2C -/* register I2C bus */ -intelfb_create_i2c_busses (dinfo); -#endif - -if (bailearly ==6 ) -bailout (dinfo); - -pci_set_drvdata (pdev, dinfo); - -/* Save the initial register state. */ - i =intelfbhw_read_hw_state (dinfo, &dinfo->save_state, - bailearly >6 ? bailearly -6 :0 ); -if (i !=0 ) { -DBG_MSG ("intelfbhw_read_hw_state returned %d\n" , i); -bailout (dinfo); - } - -intelfbhw_print_hw_state (dinfo, &dinfo->save_state); - -if (bailearly ==18 ) -bailout (dinfo); - -/* read active pipe */ - dinfo->pipe =intelfbhw_active_pipe (&dinfo->save_state); - -/* Cursor initialisation */ -if (dinfo->hwcursor) { -intelfbhw_cursor_init (dinfo); -intelfbhw_cursor_reset (dinfo); - } - -if (bailearly ==19 ) -bailout (dinfo); - -/* 2d acceleration init */ -if (dinfo->accel) -intelfbhw_2d_start (dinfo); - -if (bailearly ==20 ) -bailout (dinfo); - -if (noregister) -bailout (dinfo); - -if (register_framebuffer (dinfo->info) <0 ) { -ERR_MSG ("Cannot register framebuffer.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->registered =1 ; - dinfo->open =0 ; - -init_waitqueue_head (&dinfo->vsync.wait); -spin_lock_init (&dinfo->int_lock); - dinfo->irq_flags =0 ; - dinfo->vsync.pan_display =0 ; - dinfo->vsync.pan_offset =0 ; - -return 0 ; - -err_out_pixmap: -fb_dealloc_cmap (&info->cmap); -err_out_cmap: -framebuffer_release (info); -return -ENODEV ; -} - -static void intelfb_pci_unregister (struct pci_dev *pdev) -{ -struct intelfb_info *dinfo =pci_get_drvdata (pdev); - -DBG_MSG ("intelfb_pci_unregister\n" ); - -if (!dinfo) -return ; - -cleanup (dinfo); -} - -/*************************************************************** -* helper functions * -***************************************************************/ - -__inline__int intelfb_var_to_depth (const struct fb_var_screeninfo *var) -{ -DBG_MSG ("intelfb_var_to_depth: bpp: %d, green.length is %d\n" , - var->bits_per_pixel, var->green.length); - -switch (var->bits_per_pixel) { -case 16 : -return (var->green.length ==6 ) ?16 :15 ; -case 32 : -return 24 ; -default : -return var->bits_per_pixel; - } -} - - -static __inline__int var_to_refresh (const struct fb_var_screeninfo *var) -{ -int xtot = var->xres + var->left_margin + var->right_margin + - var->hsync_len; -int ytot = var->yres + var->upper_margin + var->lower_margin + - var->vsync_len; - -return (1000000000 / var->pixclock *1000 +500 ) / xtot / ytot; -} - -/*************************************************************** -* Various initialisation functions * -***************************************************************/ - -static void get_initial_mode (struct intelfb_info *dinfo) -{ -struct fb_var_screeninfo *var; -int xtot, ytot; - -DBG_MSG ("get_initial_mode\n" ); - - dinfo->initial_vga =1 ; - dinfo->initial_fb_base = screen_info.lfb_base; - dinfo->initial_video_ram = screen_info.lfb_size *KB (64 ); - dinfo->initial_pitch = screen_info.lfb_linelength; - - var = &dinfo->initial_var; -memset (var,0 ,sizeof (*var)); - var->xres = screen_info.lfb_width; - var->yres = screen_info.lfb_height; - var->bits_per_pixel = screen_info.lfb_depth; -switch (screen_info.lfb_depth) { -case 15 : - var->bits_per_pixel =16 ; -break ; -case 24 : - var->bits_per_pixel =32 ; -break ; - } - -DBG_MSG ("Initial info: FB is 0x%x/0x%x (%d kByte)\n" , - dinfo->initial_fb_base, dinfo->initial_video_ram, -BtoKB (dinfo->initial_video_ram)); - -DBG_MSG ("Initial info: mode is %dx%d-%d (%d)\n" , - var->xres, var->yres, var->bits_per_pixel, - dinfo->initial_pitch); - -/* Dummy timing values (assume 60Hz) */ - var->left_margin = (var->xres /8 ) &0xf8 ; - var->right_margin =32 ; - var->upper_margin =16 ; - var->lower_margin =4 ; - var->hsync_len = (var->xres /8 ) &0xf8 ; - var->vsync_len =4 ; - - xtot = var->xres + var->left_margin + - var->right_margin + var->hsync_len; - ytot = var->yres + var->upper_margin + - var->lower_margin + var->vsync_len; - var->pixclock =10000000 / xtot *1000 / ytot *100 /60 ; - - var->height =-1 ; - var->width =-1 ; - -if (var->bits_per_pixel >8 ) { - var->red.offset = screen_info.red_pos; - var->red.length = screen_info.red_size; - var->green.offset = screen_info.green_pos; - var->green.length = screen_info.green_size; - var->blue.offset = screen_info.blue_pos; - var->blue.length = screen_info.blue_size; - var->transp.offset = screen_info.rsvd_pos; - var->transp.length = screen_info.rsvd_size; - }else { - var->red.length =8 ; - var->green.length =8 ; - var->blue.length =8 ; - } -} - -static int intelfb_init_var (struct intelfb_info *dinfo) -{ -struct fb_var_screeninfo *var; -int msrc =0 ; - -DBG_MSG ("intelfb_init_var\n" ); - - var = &dinfo->info->var; -if (FIXED_MODE (dinfo)) { -memcpy (var, &dinfo->initial_var, -sizeof (struct fb_var_screeninfo )); - msrc =5 ; - }else { -const u8 *edid_s =fb_firmware_edid (&dinfo->pdev->dev); -u8 *edid_d =NULL ; - -if (edid_s) { - edid_d =kmemdup (edid_s,EDID_LENGTH ,GFP_KERNEL ); - -if (edid_d) { -fb_edid_to_monspecs (edid_d, - &dinfo->info->monspecs); -kfree (edid_d); - } - } - -if (mode) { -printk ("intelfb: Looking for mode in private " -"database\n" ); - msrc =fb_find_mode (var, dinfo->info, mode, - dinfo->info->monspecs.modedb, - dinfo->info->monspecs.modedb_len, -NULL ,0 ); - -if (msrc && msrc >1 ) { -printk ("intelfb: No mode in private database, " -"intelfb: looking for mode in global " -"database " ); - msrc =fb_find_mode (var, dinfo->info, mode, -NULL ,0 ,NULL ,0 ); - -if (msrc) - msrc |=8 ; - } - - } - -if (!msrc) - msrc =fb_find_mode (var, dinfo->info,PREFERRED_MODE , -NULL ,0 ,NULL ,0 ); - } - -if (!msrc) { -ERR_MSG ("Cannot find a suitable video mode.\n" ); -return 1 ; - } - -INF_MSG ("Initial video mode is %dx%d-%d@%d.\n" , var->xres, var->yres, - var->bits_per_pixel,var_to_refresh (var)); - -DBG_MSG ("Initial video mode is from %d.\n" , msrc); - -#if ALLOCATE_FOR_PANNING -/* Allow use of half of the video ram for panning */ - var->xres_virtual = var->xres; - var->yres_virtual = - dinfo->fb.size /2 / (var->bits_per_pixel * var->xres); -if (var->yres_virtual < var->yres) - var->yres_virtual = var->yres; -#else - var->yres_virtual = var->yres; -#endif - -if (dinfo->accel) - var->accel_flags |=FB_ACCELF_TEXT ; -else - var->accel_flags &= ~FB_ACCELF_TEXT ; - -return 0 ; -} - -static int intelfb_set_fbinfo (struct intelfb_info *dinfo) -{ -struct fb_info *info = dinfo->info; - -DBG_MSG ("intelfb_set_fbinfo\n" ); - - info->fbops = &intel_fb_ops; - info->pseudo_palette = dinfo->pseudo_palette; - - info->pixmap.size =64 *1024 ; - info->pixmap.buf_align =8 ; - info->pixmap.access_align =32 ; - info->pixmap.flags =FB_PIXMAP_SYSTEM ; - -if (intelfb_init_var (dinfo)) -return 1 ; - - info->pixmap.scan_align =1 ; -strcpy (info->fix.id, dinfo->name); - info->fix.smem_start = dinfo->fb.physical; - info->fix.smem_len = dinfo->fb.size; - info->fix.type =FB_TYPE_PACKED_PIXELS ; - info->fix.type_aux =0 ; - info->fix.xpanstep =8 ; - info->fix.ypanstep =1 ; - info->fix.ywrapstep =0 ; - info->fix.mmio_start = dinfo->mmio_base_phys; - info->fix.mmio_len =INTEL_REG_SIZE ; - info->fix.accel =FB_ACCEL_I830 ; -update_dinfo (dinfo, &info->var); - -return 0 ; -} - -/* Update dinfo to match the active video mode. */ -static void update_dinfo (struct intelfb_info *dinfo, -struct fb_var_screeninfo *var) -{ -DBG_MSG ("update_dinfo\n" ); - - dinfo->bpp = var->bits_per_pixel; - dinfo->depth =intelfb_var_to_depth (var); - dinfo->xres = var->xres; - dinfo->yres = var->xres; - dinfo->pixclock = var->pixclock; - - dinfo->info->fix.visual = dinfo->visual; - dinfo->info->fix.line_length = dinfo->pitch; - -switch (dinfo->bpp) { -case 8 : - dinfo->visual =FB_VISUAL_PSEUDOCOLOR ; - dinfo->pitch = var->xres_virtual; -break ; -case 16 : - dinfo->visual =FB_VISUAL_TRUECOLOR ; - dinfo->pitch = var->xres_virtual *2 ; -break ; -case 32 : - dinfo->visual =FB_VISUAL_TRUECOLOR ; - dinfo->pitch = var->xres_virtual *4 ; -break ; - } - -/* Make sure the line length is a aligned correctly. */ -if (IS_I9XX (dinfo)) - dinfo->pitch =ROUND_UP_TO (dinfo->pitch,STRIDE_ALIGNMENT_I9XX ); -else - dinfo->pitch =ROUND_UP_TO (dinfo->pitch,STRIDE_ALIGNMENT ); - -if (FIXED_MODE (dinfo)) - dinfo->pitch = dinfo->initial_pitch; - - dinfo->info->screen_base = (char __iomem *)dinfo->fb.virtual; - dinfo->info->fix.line_length = dinfo->pitch; - dinfo->info->fix.visual = dinfo->visual; -} - -/* fbops functions */ - -/*************************************************************** -* fbdev interface * -***************************************************************/ - -static int intelfb_open (struct fb_info *info,int user) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -if (user) - dinfo->open++; - -return 0 ; -} - -static int intelfb_release (struct fb_info *info,int user) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -if (user) { - dinfo->open--; -msleep (1 ); -if (!dinfo->open) -intelfbhw_disable_irq (dinfo); - } - -return 0 ; -} - -static int intelfb_check_var (struct fb_var_screeninfo *var, -struct fb_info *info) -{ -int change_var =0 ; -struct fb_var_screeninfo v; -struct intelfb_info *dinfo; -static int first =1 ; -int i; -/* Good pitches to allow tiling. Don't care about pitches < 1024. */ -static const int pitches[] = { -128 *8 , -128 *16 , -128 *32 , -128 *64 , -0 - }; - -DBG_MSG ("intelfb_check_var: accel_flags is %d\n" , var->accel_flags); - - dinfo =GET_DINFO (info); - -if (!var->pixclock) -return -EINVAL ; - -/* update the pitch */ -if (intelfbhw_validate_mode (dinfo, var) !=0 ) -return -EINVAL ; - - v = *var; - -for (i =0 ; pitches[i] !=0 ; i++) { -if (pitches[i] >= v.xres_virtual) { - v.xres_virtual = pitches[i]; -break ; - } - } - -/* Check for a supported bpp. */ -if (v.bits_per_pixel <=8 ) - v.bits_per_pixel =8 ; -else if (v.bits_per_pixel <=16 ) { -if (v.bits_per_pixel ==16 ) - v.green.length =6 ; - v.bits_per_pixel =16 ; - }else if (v.bits_per_pixel <=32 ) - v.bits_per_pixel =32 ; -else -return -EINVAL ; - - change_var = ((info->var.xres != var->xres) || - (info->var.yres != var->yres) || - (info->var.xres_virtual != var->xres_virtual) || - (info->var.yres_virtual != var->yres_virtual) || - (info->var.bits_per_pixel != var->bits_per_pixel) || -memcmp (&info->var.red, &var->red,sizeof (var->red)) || -memcmp (&info->var.green, &var->green, -sizeof (var->green)) || -memcmp (&info->var.blue, &var->blue,sizeof (var->blue))); - -if (FIXED_MODE (dinfo) && - (change_var || - var->yres_virtual > dinfo->initial_var.yres_virtual || - var->yres_virtual < dinfo->initial_var.yres || - var->xoffset || var->nonstd)) { -if (first) { -ERR_MSG ("Changing the video mode is not supported.\n" ); - first =0 ; - } -return -EINVAL ; - } - -switch (intelfb_var_to_depth (&v)) { -case 8 : - v.red.offset = v.green.offset = v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =8 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 15 : - v.red.offset =10 ; - v.green.offset =5 ; - v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =5 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 16 : - v.red.offset =11 ; - v.green.offset =5 ; - v.blue.offset =0 ; - v.red.length =5 ; - v.green.length =6 ; - v.blue.length =5 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 24 : - v.red.offset =16 ; - v.green.offset =8 ; - v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =8 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 32 : - v.red.offset =16 ; - v.green.offset =8 ; - v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =8 ; - v.transp.offset =24 ; - v.transp.length =8 ; -break ; - } - -if (v.xoffset > v.xres_virtual - v.xres) - v.xoffset = v.xres_virtual - v.xres; -if (v.yoffset > v.yres_virtual - v.yres) - v.yoffset = v.yres_virtual - v.yres; - - v.red.msb_right = v.green.msb_right = v.blue.msb_right = - v.transp.msb_right =0 ; - - *var = v; - -return 0 ; -} - -static int intelfb_set_par (struct fb_info *info) -{ -struct intelfb_hwstate *hw; -struct intelfb_info *dinfo =GET_DINFO (info); - -if (FIXED_MODE (dinfo)) { -ERR_MSG ("Changing the video mode is not supported.\n" ); -return -EINVAL ; - } - - hw =kmalloc (sizeof (*hw),GFP_ATOMIC ); -if (!hw) -return -ENOMEM ; - -DBG_MSG ("intelfb_set_par (%dx%d-%d)\n" , info->var.xres, - info->var.yres, info->var.bits_per_pixel); - -/* -* Disable VCO prior to timing register change. -*/ -OUTREG (DPLL_A ,INREG (DPLL_A ) & ~DPLL_VCO_ENABLE ); - -intelfb_blank (FB_BLANK_POWERDOWN , info); - -if (ACCEL (dinfo, info)) -intelfbhw_2d_stop (dinfo); - -memcpy (hw, &dinfo->save_state,sizeof (*hw)); -if (intelfbhw_mode_to_hw (dinfo, hw, &info->var)) - goto invalid_mode; -if (intelfbhw_program_mode (dinfo, hw,0 )) - goto invalid_mode; - -#if REGDUMP >0 -intelfbhw_read_hw_state (dinfo, hw,0 ); -intelfbhw_print_hw_state (dinfo, hw); -#endif - -update_dinfo (dinfo, &info->var); - -if (ACCEL (dinfo, info)) -intelfbhw_2d_start (dinfo); - -intelfb_pan_display (&info->var, info); - -intelfb_blank (FB_BLANK_UNBLANK , info); - -if (ACCEL (dinfo, info)) { - info->flags =FBINFO_HWACCEL_YPAN | -FBINFO_HWACCEL_COPYAREA |FBINFO_HWACCEL_FILLRECT | -FBINFO_HWACCEL_IMAGEBLIT ; - }else - info->flags =FBINFO_HWACCEL_YPAN ; - -kfree (hw); -return 0 ; -invalid_mode: -kfree (hw); -return -EINVAL ; -} - -static int intelfb_setcolreg (unsigned regno,unsigned red,unsigned green, -unsigned blue,unsigned transp, -struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -#if VERBOSE >0 -DBG_MSG ("intelfb_setcolreg: regno %d, depth %d\n" , regno, dinfo->depth); -#endif - -if (regno >255 ) -return 1 ; - -if (dinfo->depth ==8 ) { - red >>=8 ; - green >>=8 ; - blue >>=8 ; - -intelfbhw_setcolreg (dinfo, regno, red, green, blue, - transp); - } - -if (regno <16 ) { -switch (dinfo->depth) { -case 15 : - dinfo->pseudo_palette[regno] = ((red &0xf800 ) >>1 ) | - ((green &0xf800 ) >>6 ) | - ((blue &0xf800 ) >>11 ); -break ; -case 16 : - dinfo->pseudo_palette[regno] = (red &0xf800 ) | - ((green &0xfc00 ) >>5 ) | - ((blue &0xf800 ) >>11 ); -break ; -case 24 : - dinfo->pseudo_palette[regno] = ((red &0xff00 ) <<8 ) | - (green &0xff00 ) | - ((blue &0xff00 ) >>8 ); -break ; - } - } - -return 0 ; -} - -static int intelfb_blank (int blank,struct fb_info *info) -{ -intelfbhw_do_blank (blank, info); -return 0 ; -} - -static int intelfb_pan_display (struct fb_var_screeninfo *var, -struct fb_info *info) -{ -intelfbhw_pan_display (var, info); -return 0 ; -} - -/* When/if we have our own ioctls. */ -static int intelfb_ioctl (struct fb_info *info,unsigned int cmd, -unsigned long arg) -{ -int retval =0 ; -struct intelfb_info *dinfo =GET_DINFO (info); -u32 pipe =0 ; - -switch (cmd) { -case FBIO_WAITFORVSYNC : -if (get_user (pipe, (__u32 __user *)arg)) -return -EFAULT ; - - retval =intelfbhw_wait_for_vsync (dinfo, pipe); -break ; -default : -break ; - } - -return retval; -} - -static void intelfb_fillrect (struct fb_info *info, -const struct fb_fillrect *rect) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 rop, color; - -#if VERBOSE >0 -DBG_MSG ("intelfb_fillrect\n" ); -#endif - -if (!ACCEL (dinfo, info) || dinfo->depth ==4 ) { -cfb_fillrect (info, rect); -return ; - } - -if (rect->rop ==ROP_COPY ) - rop =PAT_ROP_GXCOPY ; -else /* ROP_XOR */ - rop =PAT_ROP_GXXOR ; - -if (dinfo->depth !=8 ) - color = dinfo->pseudo_palette[rect->color]; -else - color = rect->color; - -intelfbhw_do_fillrect (dinfo, rect->dx, rect->dy, - rect->width, rect->height, color, - dinfo->pitch, info->var.bits_per_pixel, - rop); -} - -static void intelfb_copyarea (struct fb_info *info, -const struct fb_copyarea *region) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -#if VERBOSE >0 -DBG_MSG ("intelfb_copyarea\n" ); -#endif - -if (!ACCEL (dinfo, info) || dinfo->depth ==4 ) { -cfb_copyarea (info, region); -return ; - } - -intelfbhw_do_bitblt (dinfo, region->sx, region->sy, region->dx, - region->dy, region->width, region->height, - dinfo->pitch, info->var.bits_per_pixel); -} - -static void intelfb_imageblit (struct fb_info *info, -const struct fb_image *image) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 fgcolor, bgcolor; - -#if VERBOSE >0 -DBG_MSG ("intelfb_imageblit\n" ); -#endif - -if (!ACCEL (dinfo, info) || dinfo->depth ==4 - || image->depth !=1 ) { -cfb_imageblit (info, image); -return ; - } - -if (dinfo->depth !=8 ) { - fgcolor = dinfo->pseudo_palette[image->fg_color]; - bgcolor = dinfo->pseudo_palette[image->bg_color]; - }else { - fgcolor = image->fg_color; - bgcolor = image->bg_color; - } - -if (!intelfbhw_do_drawglyph (dinfo, fgcolor, bgcolor, image->width, - image->height, image->data, - image->dx, image->dy, - dinfo->pitch, info->var.bits_per_pixel)) { -cfb_imageblit (info, image); -return ; - } -} - -static int intelfb_cursor (struct fb_info *info,struct fb_cursor *cursor) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 physical; -#if VERBOSE >0 -DBG_MSG ("intelfb_cursor\n" ); -#endif - -if (!dinfo->hwcursor) -return -ENODEV ; - -intelfbhw_cursor_hide (dinfo); - -/* If XFree killed the cursor - restore it */ - physical = (dinfo->mobile ||IS_I9XX (dinfo)) ? dinfo->cursor.physical : - (dinfo->cursor.offset <<12 ); - -if (INREG (CURSOR_A_BASEADDR ) != physical) { -u32 fg, bg; - -DBG_MSG ("the cursor was killed - restore it !!\n" ); -DBG_MSG ("size %d, %d pos %d, %d\n" , - cursor->image.width, cursor->image.height, - cursor->image.dx, cursor->image.dy); - -intelfbhw_cursor_init (dinfo); -intelfbhw_cursor_reset (dinfo); -intelfbhw_cursor_setpos (dinfo, cursor->image.dx, - cursor->image.dy); - -if (dinfo->depth !=8 ) { - fg =dinfo->pseudo_palette[cursor->image.fg_color]; - bg =dinfo->pseudo_palette[cursor->image.bg_color]; - }else { - fg = cursor->image.fg_color; - bg = cursor->image.bg_color; - } -intelfbhw_cursor_setcolor (dinfo, bg, fg); -intelfbhw_cursor_load (dinfo, cursor->image.width, - cursor->image.height, - dinfo->cursor_src); - -if (cursor->enable) -intelfbhw_cursor_show (dinfo); -return 0 ; - } - -if (cursor->set &FB_CUR_SETPOS ) { -u32 dx, dy; - - dx = cursor->image.dx - info->var.xoffset; - dy = cursor->image.dy - info->var.yoffset; - -intelfbhw_cursor_setpos (dinfo, dx, dy); - } - -if (cursor->set &FB_CUR_SETSIZE ) { -if (cursor->image.width >64 || cursor->image.height >64 ) -return -ENXIO ; - -intelfbhw_cursor_reset (dinfo); - } - -if (cursor->set &FB_CUR_SETCMAP ) { -u32 fg, bg; - -if (dinfo->depth !=8 ) { - fg = dinfo->pseudo_palette[cursor->image.fg_color]; - bg = dinfo->pseudo_palette[cursor->image.bg_color]; - }else { - fg = cursor->image.fg_color; - bg = cursor->image.bg_color; - } - -intelfbhw_cursor_setcolor (dinfo, bg, fg); - } - -if (cursor->set & (FB_CUR_SETSHAPE |FB_CUR_SETIMAGE )) { -u32 s_pitch = (ROUND_UP_TO (cursor->image.width,8 ) /8 ); -u32 size = s_pitch * cursor->image.height; -u8 *dat = (u8 *) cursor->image.data; -u8 *msk = (u8 *) cursor->mask; -u8 src[64 ]; -u32 i; - -if (cursor->image.depth !=1 ) -return -ENXIO ; - -switch (cursor->rop) { -case ROP_XOR : -for (i =0 ; i < size; i++) - src[i] = dat[i] ^ msk[i]; -break ; -case ROP_COPY : -default : -for (i =0 ; i < size; i++) - src[i] = dat[i] & msk[i]; -break ; - } - -/* save the bitmap to restore it when XFree will -make the cursor dirty */ -memcpy (dinfo->cursor_src, src, size); - -intelfbhw_cursor_load (dinfo, cursor->image.width, - cursor->image.height, src); - } - -if (cursor->enable) -intelfbhw_cursor_show (dinfo); - -return 0 ; -} - -static int intelfb_sync (struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -#if VERBOSE >0 -DBG_MSG ("intelfb_sync\n" ); -#endif - -if (dinfo->ring_lockup) -return 0 ; - -intelfbhw_do_sync (dinfo); -return 0 ; -} -drivers/video/fbdev/intelfb/intelfbhw.c deleted +0
-2115@@ -1,2115 +0,0 @@ -/* -* intelfb -* -* Linux framebuffer driver for Intel(R) 865G integrated graphics chips. -* -* Copyright © 2002, 2003 David Dawes <[email protected]> -* 2004 Sylvain Meyer -* -* This driver consists of two parts. The first part (intelfbdrv.c) provides -* the basic fbdev interfaces, is derived in part from the radeonfb and -* vesafb drivers, and is covered by the GPL. The second part (intelfbhw.c) -* provides the code to program the hardware. Most of it is derived from -* the i810/i830 XFree86 driver. The HW-specific code is covered here -* under a dual license (GPL and MIT/XFree86 license). -* -* Author: David Dawes -* -*/ - -/* $DHD: intelfb/intelfbhw.c,v 1.9 2003/06/27 15:06:25 dawes Exp $ */ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/mm.h> -#include <linux/delay.h> -#include <linux/fb.h> -#include <linux/ioport.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/vmalloc.h> -#include <linux/pagemap.h> -#include <linux/interrupt.h> - -#include <asm/io.h> - -#include "intelfb.h" -#include "intelfbhw.h" - -struct pll_min_max { -int min_m, max_m, min_m1, max_m1; -int min_m2, max_m2, min_n, max_n; -int min_p, max_p, min_p1, max_p1; -int min_vco, max_vco, p_transition_clk, ref_clk; -int p_inc_lo, p_inc_hi; -}; - -#define PLLS_I8xx 0 -#define PLLS_I9xx 1 -#define PLLS_MAX 2 - -static struct pll_min_max plls[PLLS_MAX ] = { - {108 ,140 ,18 ,26 , -6 ,16 ,3 ,16 , -4 ,128 ,0 ,31 , -930000 ,1400000 ,165000 ,48000 , -4 ,2 },/* I8xx */ - - {75 ,120 ,10 ,20 , -5 ,9 ,4 ,7 , -5 ,80 ,1 ,8 , -1400000 ,2800000 ,200000 ,96000 , -10 ,5 }/* I9xx */ -}; - -int intelfbhw_get_chipset (struct pci_dev *pdev,struct intelfb_info *dinfo) -{ -u32 tmp; -if (!pdev || !dinfo) -return 1 ; - -switch (pdev->device) { -case PCI_DEVICE_ID_INTEL_830M : - dinfo->name ="Intel(R) 830M" ; - dinfo->chipset =INTEL_830M ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I8xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_845G : - dinfo->name ="Intel(R) 845G" ; - dinfo->chipset =INTEL_845G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I8xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_854 : - dinfo->mobile =1 ; - dinfo->name ="Intel(R) 854" ; - dinfo->chipset =INTEL_854 ; -return 0 ; -case PCI_DEVICE_ID_INTEL_85XGM : - tmp =0 ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I8xx; -pci_read_config_dword (pdev,INTEL_85X_CAPID , &tmp); -switch ((tmp >>INTEL_85X_VARIANT_SHIFT ) & -INTEL_85X_VARIANT_MASK ) { -case INTEL_VAR_855GME : - dinfo->name ="Intel(R) 855GME" ; - dinfo->chipset =INTEL_855GME ; -return 0 ; -case INTEL_VAR_855GM : - dinfo->name ="Intel(R) 855GM" ; - dinfo->chipset =INTEL_855GM ; -return 0 ; -case INTEL_VAR_852GME : - dinfo->name ="Intel(R) 852GME" ; - dinfo->chipset =INTEL_852GME ; -return 0 ; -case INTEL_VAR_852GM : - dinfo->name ="Intel(R) 852GM" ; - dinfo->chipset =INTEL_852GM ; -return 0 ; -default : - dinfo->name ="Intel(R) 852GM/855GM" ; - dinfo->chipset =INTEL_85XGM ; -return 0 ; - } -break ; -case PCI_DEVICE_ID_INTEL_865G : - dinfo->name ="Intel(R) 865G" ; - dinfo->chipset =INTEL_865G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I8xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_915G : - dinfo->name ="Intel(R) 915G" ; - dinfo->chipset =INTEL_915G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_915GM : - dinfo->name ="Intel(R) 915GM" ; - dinfo->chipset =INTEL_915GM ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_945G : - dinfo->name ="Intel(R) 945G" ; - dinfo->chipset =INTEL_945G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_945GM : - dinfo->name ="Intel(R) 945GM" ; - dinfo->chipset =INTEL_945GM ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_945GME : - dinfo->name ="Intel(R) 945GME" ; - dinfo->chipset =INTEL_945GME ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_965G : - dinfo->name ="Intel(R) 965G" ; - dinfo->chipset =INTEL_965G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_965GM : - dinfo->name ="Intel(R) 965GM" ; - dinfo->chipset =INTEL_965GM ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -default : -return 1 ; - } -} - -int intelfbhw_get_memory (struct pci_dev *pdev,int *aperture_size, -int *stolen_size) -{ -struct pci_dev *bridge_dev; -u16 tmp; -int stolen_overhead; - -if (!pdev || !aperture_size || !stolen_size) -return 1 ; - -/* Find the bridge device. It is always 0:0.0 */ - bridge_dev =pci_get_domain_bus_and_slot (pci_domain_nr (pdev->bus),0 , -PCI_DEVFN (0 ,0 )); -if (!bridge_dev) { -ERR_MSG ("cannot find bridge device\n" ); -return 1 ; - } - -/* Get the fb aperture size and "stolen" memory amount. */ - tmp =0 ; -pci_read_config_word (bridge_dev,INTEL_GMCH_CTRL , &tmp); -pci_dev_put (bridge_dev); - -switch (pdev->device) { -case PCI_DEVICE_ID_INTEL_915G : -case PCI_DEVICE_ID_INTEL_915GM : -case PCI_DEVICE_ID_INTEL_945G : -case PCI_DEVICE_ID_INTEL_945GM : -case PCI_DEVICE_ID_INTEL_945GME : -case PCI_DEVICE_ID_INTEL_965G : -case PCI_DEVICE_ID_INTEL_965GM : -/* -* 915, 945 and 965 chipsets support 64MB, 128MB or 256MB -* aperture. Determine size from PCI resource length. -*/ - *aperture_size =pci_resource_len (pdev,2 ); -break ; -default : -if ((tmp &INTEL_GMCH_MEM_MASK ) ==INTEL_GMCH_MEM_64M ) - *aperture_size =MB (64 ); -else - *aperture_size =MB (128 ); -break ; - } - -/* Stolen memory size is reduced by the GTT and the popup. -GTT is 1K per MB of aperture size, and popup is 4K. */ - stolen_overhead = (*aperture_size /MB (1 )) +4 ; -switch (pdev->device) { -case PCI_DEVICE_ID_INTEL_830M : -case PCI_DEVICE_ID_INTEL_845G : -switch (tmp &INTEL_830_GMCH_GMS_MASK ) { -case INTEL_830_GMCH_GMS_STOLEN_512 : - *stolen_size =KB (512 ) -KB (stolen_overhead); -return 0 ; -case INTEL_830_GMCH_GMS_STOLEN_1024 : - *stolen_size =MB (1 ) -KB (stolen_overhead); -return 0 ; -case INTEL_830_GMCH_GMS_STOLEN_8192 : - *stolen_size =MB (8 ) -KB (stolen_overhead); -return 0 ; -case INTEL_830_GMCH_GMS_LOCAL : -ERR_MSG ("only local memory found\n" ); -return 1 ; -case INTEL_830_GMCH_GMS_DISABLED : -ERR_MSG ("video memory is disabled\n" ); -return 1 ; -default : -ERR_MSG ("unexpected GMCH_GMS value: 0x%02x\n" , - tmp &INTEL_830_GMCH_GMS_MASK ); -return 1 ; - } -break ; -default : -switch (tmp &INTEL_855_GMCH_GMS_MASK ) { -case INTEL_855_GMCH_GMS_STOLEN_1M : - *stolen_size =MB (1 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_4M : - *stolen_size =MB (4 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_8M : - *stolen_size =MB (8 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_16M : - *stolen_size =MB (16 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_32M : - *stolen_size =MB (32 ) -KB (stolen_overhead); -return 0 ; -case INTEL_915G_GMCH_GMS_STOLEN_48M : - *stolen_size =MB (48 ) -KB (stolen_overhead); -return 0 ; -case INTEL_915G_GMCH_GMS_STOLEN_64M : - *stolen_size =MB (64 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_DISABLED : -ERR_MSG ("video memory is disabled\n" ); -return 0 ; -default : -ERR_MSG ("unexpected GMCH_GMS value: 0x%02x\n" , - tmp &INTEL_855_GMCH_GMS_MASK ); -return 1 ; - } - } -} - -int intelfbhw_check_non_crt (struct intelfb_info *dinfo) -{ -int dvo =0 ; - -if (INREG (LVDS ) &PORT_ENABLE ) - dvo |=LVDS_PORT ; -if (INREG (DVOA ) &PORT_ENABLE ) - dvo |=DVOA_PORT ; -if (INREG (DVOB ) &PORT_ENABLE ) - dvo |=DVOB_PORT ; -if (INREG (DVOC ) &PORT_ENABLE ) - dvo |=DVOC_PORT ; - -return dvo; -} - -const char *intelfbhw_dvo_to_string (int dvo) -{ -if (dvo &DVOA_PORT ) -return "DVO port A" ; -else if (dvo &DVOB_PORT ) -return "DVO port B" ; -else if (dvo &DVOC_PORT ) -return "DVO port C" ; -else if (dvo &LVDS_PORT ) -return "LVDS port" ; -else -return NULL ; -} - - -int intelfbhw_validate_mode (struct intelfb_info *dinfo, -struct fb_var_screeninfo *var) -{ -int bytes_per_pixel; -int tmp; - -#if VERBOSE >0 -DBG_MSG ("intelfbhw_validate_mode\n" ); -#endif - - bytes_per_pixel = var->bits_per_pixel /8 ; -if (bytes_per_pixel ==3 ) - bytes_per_pixel =4 ; - -/* Check if enough video memory. */ - tmp = var->yres_virtual * var->xres_virtual * bytes_per_pixel; -if (tmp > dinfo->fb.size) { -WRN_MSG ("Not enough video ram for mode " -"(%d KByte vs %d KByte).\n" , -BtoKB (tmp),BtoKB (dinfo->fb.size)); -return 1 ; - } - -/* Check if x/y limits are OK. */ -if (var->xres -1 >HACTIVE_MASK ) { -WRN_MSG ("X resolution too large (%d vs %d).\n" , - var->xres,HACTIVE_MASK +1 ); -return 1 ; - } -if (var->yres -1 >VACTIVE_MASK ) { -WRN_MSG ("Y resolution too large (%d vs %d).\n" , - var->yres,VACTIVE_MASK +1 ); -return 1 ; - } -if (var->xres <4 ) { -WRN_MSG ("X resolution too small (%d vs 4).\n" , var->xres); -return 1 ; - } -if (var->yres <4 ) { -WRN_MSG ("Y resolution too small (%d vs 4).\n" , var->yres); -return 1 ; - } - -/* Check for doublescan modes. */ -if (var->vmode &FB_VMODE_DOUBLE ) { -WRN_MSG ("Mode is double-scan.\n" ); -return 1 ; - } - -if ((var->vmode &FB_VMODE_INTERLACED ) && (var->yres &1 )) { -WRN_MSG ("Odd number of lines in interlaced mode\n" ); -return 1 ; - } - -/* Check if clock is OK. */ - tmp =1000000000 / var->pixclock; -if (tmp <MIN_CLOCK ) { -WRN_MSG ("Pixel clock is too low (%d MHz vs %d MHz).\n" , - (tmp +500 ) /1000 ,MIN_CLOCK /1000 ); -return 1 ; - } -if (tmp >MAX_CLOCK ) { -WRN_MSG ("Pixel clock is too high (%d MHz vs %d MHz).\n" , - (tmp +500 ) /1000 ,MAX_CLOCK /1000 ); -return 1 ; - } - -return 0 ; -} - -int intelfbhw_pan_display (struct fb_var_screeninfo *var,struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 offset, xoffset, yoffset; - -#if VERBOSE >0 -DBG_MSG ("intelfbhw_pan_display\n" ); -#endif - - xoffset =ROUND_DOWN_TO (var->xoffset,8 ); - yoffset = var->yoffset; - -if ((xoffset + info->var.xres > info->var.xres_virtual) || - (yoffset + info->var.yres > info->var.yres_virtual)) -return -EINVAL ; - - offset = (yoffset * dinfo->pitch) + - (xoffset * info->var.bits_per_pixel) /8 ; - - offset += dinfo->fb.offset <<12 ; - - dinfo->vsync.pan_offset = offset; -if ((var->activate &FB_ACTIVATE_VBL ) && - !intelfbhw_enable_irq (dinfo)) - dinfo->vsync.pan_display =1 ; -else { - dinfo->vsync.pan_display =0 ; -OUTREG (DSPABASE , offset); - } - -return 0 ; -} - -/* Blank the screen. */ -void intelfbhw_do_blank (int blank,struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 tmp; - -#if VERBOSE >0 -DBG_MSG ("intelfbhw_do_blank: blank is %d\n" , blank); -#endif - -/* Turn plane A on or off */ - tmp =INREG (DSPACNTR ); -if (blank) - tmp &= ~DISPPLANE_PLANE_ENABLE ; -else - tmp |=DISPPLANE_PLANE_ENABLE ; -OUTREG (DSPACNTR , tmp); -/* Flush */ - tmp =INREG (DSPABASE ); -OUTREG (DSPABASE , tmp); - -/* Turn off/on the HW cursor */ -#if VERBOSE >0 -DBG_MSG ("cursor_on is %d\n" , dinfo->cursor_on); -#endif -if (dinfo->cursor_on) { -if (blank) -intelfbhw_cursor_hide (dinfo); -else -intelfbhw_cursor_show (dinfo); - dinfo->cursor_on =1 ; - } - dinfo->cursor_blanked = blank; - -/* Set DPMS level */ - tmp =INREG (ADPA ) & ~ADPA_DPMS_CONTROL_MASK ; -switch (blank) { -case FB_BLANK_UNBLANK : -case FB_BLANK_NORMAL : - tmp |=ADPA_DPMS_D0 ; -break ; -case FB_BLANK_VSYNC_SUSPEND : - tmp |=ADPA_DPMS_D1 ; -break ; -case FB_BLANK_HSYNC_SUSPEND : - tmp |=ADPA_DPMS_D2 ; -break ; -case FB_BLANK_POWERDOWN : - tmp |=ADPA_DPMS_D3 ; -break ; - } -OUTREG (ADPA , tmp); - -return ; -} - - -/* Check which pipe is connected to an active display plane. */ -int intelfbhw_active_pipe (const struct intelfb_hwstate *hw) -{ -int pipe =-1 ; - -/* keep old default behaviour - prefer PIPE_A */ -if (hw->disp_b_ctrl &DISPPLANE_PLANE_ENABLE ) { - pipe = (hw->disp_b_ctrl >>DISPPLANE_SEL_PIPE_SHIFT ); - pipe &=PIPE_MASK ; -if (unlikely (pipe ==PIPE_A )) -return PIPE_A ; - } -if (hw->disp_a_ctrl &DISPPLANE_PLANE_ENABLE ) { - pipe = (hw->disp_a_ctrl >>DISPPLANE_SEL_PIPE_SHIFT );Lines of this file are not shown. View the raw message.
drivers/video/fbdev/intelfb/intelfbhw.h deleted +0
-609Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0
--Maik
Part of the diff is not shown here. View the raw message.
Hi
Am 05.01.24 um 11:20 schrieb Maik Broemme:
Quoted 4 lines
Hi Thomas,
looks good to me and I agree with removing it, no need to maintain such legacy piece of code anymore.
Fantastic! Thank you so much.
Best regards
Thomas
Quoted 5,350 lines · Thomas Zimmermann
Quoted 5,345 lines
From looking at the PCI IDs, every device supported by intelfb is
also supported by i915. Anyone still using intelfb should please move on to i915, which does everything intelfb does but better.Removing intelfb is motivated by the driver's excessive use of the global
screen_infostate. The state belongs to architecture and firmware code; device drivers should not attempt to access it. But fixing intelfb would require a significant change in the driver's probing logic. As intelfb has been obsolete for nearly 2 decades, it is probably not worth the effort. Let's just remove it. Also remove the related documentation.Signed-off-by Thomas Zimmermann <[email protected]>--- Documentation/fb/index.rst | 1 - Documentation/fb/intelfb.rst | 155 -- .../userspace-api/ioctl/ioctl-number.rst | 1 - MAINTAINERS | 7 - drivers/Makefile | 3 +- drivers/video/fbdev/Kconfig | 39 - drivers/video/fbdev/intelfb/Makefile | 8 - drivers/video/fbdev/intelfb/intelfb.h | 382 --- drivers/video/fbdev/intelfb/intelfb_i2c.c | 209 -- drivers/video/fbdev/intelfb/intelfbdrv.c | 1680 ------------- drivers/video/fbdev/intelfb/intelfbhw.c | 2115 ----------------- drivers/video/fbdev/intelfb/intelfbhw.h | 609 ----- 12 files changed, 1 insertion(+), 5208 deletions(-)delete mode 100644
Documentation/fb/intelfb.rstdelete mode 100644drivers/video/fbdev/intelfb/Makefiledelete mode 100644drivers/video/fbdev/intelfb/intelfb.hdelete mode 100644drivers/video/fbdev/intelfb/intelfb_i2c.cdelete mode 100644drivers/video/fbdev/intelfb/intelfbdrv.cdelete mode 100644drivers/video/fbdev/intelfb/intelfbhw.cdelete mode 100644drivers/video/fbdev/intelfb/intelfbhw.hDocumentation/fb/index.rst +0
-1@@ -19,7 +19,6 @@ Frame Buffer framebuffer gxfb intel810 - intelfb internals lxfb matroxfbDocumentation/fb/intelfb.rst deleted +0
-155@@ -1,155 +0,0 @@ -============================================================= -Intel 830M/845G/852GM/855GM/865G/915G/945G Framebuffer driver -============================================================= - -A. Introduction -=============== - -This is a framebuffer driver for various Intel 8xx/9xx compatible -graphics devices. These would include: - - - Intel 830M - - Intel 845G - - Intel 852GM - - Intel 855GM - - Intel 865G - - Intel 915G - - Intel 915GM - - Intel 945G - - Intel 945GM - - Intel 945GME - - Intel 965G - - Intel 965GM - -B. List of available options -============================= - - a. "video=intelfb" - enables the intelfb driver - - Recommendation: required - - b. "mode=<xres>x<yres>[-<bpp>][@<refresh>]" - select mode - - Recommendation: user preference - (default = 1024x768-32@70) - - c. "vram=<value>" - select amount of system RAM in MB to allocate for the video memory - if not enough RAM was already allocated by the BIOS. - - Recommendation: 1 - 4 MB. - (default = 4 MB) - - d. "voffset=<value>" - select at what offset in MB of the logical memory to allocate the - framebuffer memory. The intent is to avoid the memory blocks - used by standard graphics applications (XFree86). Depending on your - usage, adjust the value up or down, (0 for maximum usage, 63/127 MB - for the least amount). Note, an arbitrary setting may conflict - with XFree86. - - Recommendation: do not set - (default = 48 MB) - - e. "accel" - enable text acceleration. This can be enabled/reenabled anytime - by using 'fbset -accel true/false'. - - Recommendation: enable - (default = set) - - f. "hwcursor" - enable cursor acceleration. - - Recommendation: enable - (default = set) - - g. "mtrr" - enable MTRR. This allows data transfers to the framebuffer memory - to occur in bursts which can significantly increase performance. - Not very helpful with the intel chips because of 'shared memory'. - - Recommendation: set - (default = set) - - h. "fixed" - disable mode switching. - - Recommendation: do not set - (default = not set) - - The binary parameters can be unset with a "no" prefix, example "noaccel". - The default parameter (not named) is the mode. - -C. Kernel booting -================= - -Separate each option/option-pair by commas (,) and the option from its value -with an equals sign (=) as in the following:: - - video=intelfb:option1,option2=value2 - -Sample Usage ------------- - -In /etc/lilo.conf, add the line:: - - append="video=intelfb:mode=800x600-32@75,accel,hwcursor,vram=8" - -This will initialize the framebuffer to 800x600 at 32bpp and 75Hz. The -framebuffer will use 8 MB of System RAM. hw acceleration of text and cursor -will be enabled. - -Remarks -------- - -If setting this parameter doesn't work (you stay in a 80x25 text-mode), -you might need to set the "vga=<mode>" parameter too - see vesafb.txt -in this directory. - - -D. Module options -================== - -The module parameters are essentially similar to the kernel -parameters. The main difference is that you need to include a Boolean value -(1 for TRUE, and 0 for FALSE) for those options which don't need a value. - -Example, to enable MTRR, include "mtrr=1". - -Sample Usage ------------- - -Using the same setup as described above, load the module like this:: - - modprobe intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1 - -Or just add the following to a configuration file in /etc/modprobe.d/:: - - options intelfb mode=800x600-32@75 vram=8 accel=1 hwcursor=1 - -and just do a:: - - modprobe intelfb - - -E. Acknowledgment: -=================== - - 1. Geert Uytterhoeven - his excellent howto and the virtual - framebuffer driver code made this possible. - - 2. Jeff Hartmann for his agpgart code. - - 3. David Dawes for his original kernel 2.4 code. - - 4. The X developers. Insights were provided just by reading the - XFree86 source code. - - 5. Antonino A. Daplas for his inspiring i810fb driver. - - 6. Andrew Morton for his kernel patches maintenance. - -SylvainDocumentation/userspace-api/ioctl/ioctl-number.rst +0
-1@@ -128,7 +128,6 @@ Code Seq# Include File Comments 'F' all linux/fb.h conflict! 'F' 01-02 drivers/scsi/pmcraid.h conflict! 'F' 20 drivers/video/fsl-diu-fb.h conflict! -'F' 20 drivers/video/intelfb/intelfb.h conflict! 'F' 20 linux/ivtvfb.h conflict! 'F' 20 linux/matroxfb.h conflict! 'F' 20 drivers/video/aty/atyfb_base.c conflict!MAINTAINERS +0
-7@@ -10666,13 +10666,6 @@ S: Supported F: drivers/infiniband/hw/irdma/ F: include/uapi/rdma/irdma-abi.h -INTEL FRAMEBUFFER DRIVER (excluding 810 and 815) -M: Maik Broemme <[email protected]> -L: [email protected] -S: Maintained -F: Documentation/fb/intelfb.rst -F: drivers/video/fbdev/intelfb/ - INTEL GPIO DRIVERS M: Andy Shevchenko <[email protected]> L: [email protected]drivers/Makefile +1
-2@@ -71,9 +71,8 @@ obj-y += gpu/ obj-$(CONFIG_CONNECTOR) += connector/ -# i810fb and intelfb depend on char/agp/ +# i810fb depends on char/agp/ obj-$(CONFIG_FB_I810) += video/fbdev/i810/ -obj-$(CONFIG_FB_INTEL) += video/fbdev/intelfb/ obj-$(CONFIG_PARPORT) += parport/ obj-y += base/ block/ misc/ mfd/ nfc/drivers/video/fbdev/Kconfig +0
-39@@ -854,45 +854,6 @@ config FB_CARILLO_RANCH help This driver supports the LE80578 (Carillo Ranch) board -config FB_INTEL - tristate "Intel 830M/845G/852GM/855GM/865G/915G/945G/945GM/965G/965GM support" - depends on FB && PCI && X86 && AGP_INTEL && EXPERT - select FB_CFB_FILLRECT - select FB_CFB_COPYAREA - select FB_CFB_IMAGEBLIT - select FB_IOMEM_FOPS - select FB_MODE_HELPERS - select BOOT_VESA_SUPPORT if FB_INTEL = y - select VIDEO_NOMODESET - depends on !DRM_I915 - help - This driver supports the on-board graphics built in to the Intel - 830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/965G/965GM chipsets. - Say Y if you have and plan to use such a board. - - To make FB_INTEL=Y work you need to say AGP_INTEL=y too. - - To compile this driver as a module, choose M here: the - module will be called intelfb. - - For more information, please read <file:Documentation/fb/intelfb.rst> - -config FB_INTEL_DEBUG - bool "Intel driver Debug Messages" - depends on FB_INTEL - help - Say Y here if you want the Intel driver to output all sorts - of debugging information to provide to the maintainer when - something goes wrong. - -config FB_INTEL_I2C - bool "DDC/I2C for Intel framebuffer support" - depends on FB_INTEL - select FB_DDC - default y - help - Say Y here if you want DDC/I2C support for your on-board Intel graphics. - config FB_MATROX tristate "Matrox acceleration" depends on FB && PCIdrivers/video/fbdev/intelfb/Makefile deleted +0
-8@@ -1,8 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_FB_INTEL) += intelfb.o - -intelfb-y := intelfbdrv.o intelfbhw.o -intelfb-$(CONFIG_FB_INTEL_I2C) += intelfb_i2c.o -intelfb-objs := $(intelfb-y) - -ccflags-$(CONFIG_FB_INTEL_DEBUG) := -DDEBUG -DREGDUMPdrivers/video/fbdev/intelfb/intelfb.h deleted +0
-382@@ -1,382 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _INTELFB_H -#define _INTELFB_H - -/* $DHD: intelfb/intelfb.h,v 1.40 2003/06/27 15:06:25 dawes Exp $ */ - -#include <linux/agp_backend.h> -#include <linux/fb.h> - -#ifdef CONFIG_FB_INTEL_I2C -#include <linux/i2c.h> -#include <linux/i2c-algo-bit.h> -#endif - -/*** Version/name ***/ -#define INTELFB_VERSION "0.9.6" -#define INTELFB_MODULE_NAME "intelfb" -#define SUPPORTED_CHIPSETS "830M/845G/852GM/855GM/865G/915G/915GM/945G/945GM/945GME/965G/965GM" - - -/*** Debug/feature defines ***/ - -#ifndef DEBUG -#define DEBUG 0 -#endif - -#ifndef VERBOSE -#define VERBOSE 0 -#endif - -#ifndef REGDUMP -#define REGDUMP 0 -#endif - -#ifndef DETECT_VGA_CLASS_ONLY -#define DETECT_VGA_CLASS_ONLY 1 -#endif - -#ifndef ALLOCATE_FOR_PANNING -#define ALLOCATE_FOR_PANNING 1 -#endif - -#ifndef PREFERRED_MODE -#define PREFERRED_MODE "1024x768-32@70" -#endif - -/*** hw-related values ***/ - -/* Resource Allocation */ -#define INTELFB_FB_ACQUIRED 1 -#define INTELFB_MMIO_ACQUIRED 2 - -/* PCI ids for supported devices */ -#define PCI_DEVICE_ID_INTEL_830M 0x3577 -#define PCI_DEVICE_ID_INTEL_845G 0x2562 -#define PCI_DEVICE_ID_INTEL_85XGM 0x3582 -#define PCI_DEVICE_ID_INTEL_854 0x358E -#define PCI_DEVICE_ID_INTEL_865G 0x2572 -#define PCI_DEVICE_ID_INTEL_915G 0x2582 -#define PCI_DEVICE_ID_INTEL_915GM 0x2592 -#define PCI_DEVICE_ID_INTEL_945G 0x2772 -#define PCI_DEVICE_ID_INTEL_945GM 0x27A2 -#define PCI_DEVICE_ID_INTEL_945GME 0x27AE -#define PCI_DEVICE_ID_INTEL_965G 0x29A2 -#define PCI_DEVICE_ID_INTEL_965GM 0x2A02 - -/* Size of MMIO region */ -#define INTEL_REG_SIZE 0x80000 - -#define STRIDE_ALIGNMENT 16 -#define STRIDE_ALIGNMENT_I9XX 64 - -#define PALETTE_8_ENTRIES 256 - - -/*** Macros ***/ - -/* basic arithmetic */ -#define KB (x) ((x) * 1024) -#define MB (x) ((x) * 1024 * 1024) -#define BtoKB (x) ((x) / 1024) -#define BtoMB (x) ((x) / 1024 / 1024) - -#define GTT_PAGE_SIZE KB(4) - -#define ROUND_UP_TO (x, y) (((x) + (y) - 1) / (y) * (y)) -#define ROUND_DOWN_TO (x, y) ((x) / (y) * (y)) -#define ROUND_UP_TO_PAGE (x) ROUND_UP_TO((x), GTT_PAGE_SIZE) -#define ROUND_DOWN_TO_PAGE (x) ROUND_DOWN_TO((x), GTT_PAGE_SIZE) - -/* messages */ -#define PFX INTELFB_MODULE_NAME ": " - -#define ERR_MSG(fmt, args...) printk(KERN_ERR PFX fmt, ## args) -#define WRN_MSG(fmt, args...) printk(KERN_WARNING PFX fmt, ## args) -#define NOT_MSG(fmt, args...) printk(KERN_NOTICE PFX fmt, ## args) -#define INF_MSG(fmt, args...) printk(KERN_INFO PFX fmt, ## args) -#if DEBUG -#define DBG_MSG(fmt, args...) printk(KERN_DEBUG PFX fmt, ## args) -#else -#define DBG_MSG(fmt, args...) while (0) printk(fmt, ## args) -#endif - -/* get commonly used pointers */ -#define GET_DINFO (info) (info)->par - -/* misc macros */ -#define ACCEL (d, i) \ - ((d)->accel && !(d)->ring_lockup && \ - ((i)->var.accel_flags & FB_ACCELF_TEXT)) - -/*#define NOACCEL_CHIPSET(d) \ -((d)->chipset != INTEL_865G)*/ -#define NOACCEL_CHIPSET (d) \ - (0) - -#define FIXED_MODE (d) ((d)->fixed_mode) - -/*** Driver parameters ***/ - -#define RINGBUFFER_SIZE KB(64) -#define HW_CURSOR_SIZE KB(4) - -/* Intel agpgart driver */ -#define AGP_PHYSICAL_MEMORY 2 - -/* store information about an Ixxx DVO */ -/* The i830->i865 use multiple DVOs with multiple i2cs */ -/* the i915, i945 have a single sDVO i2c bus - which is different */ -#define MAX_OUTPUTS 6 - -/* these are outputs from the chip - integrated only -external chips are via DVO or SDVO output */ -#define INTELFB_OUTPUT_UNUSED 0 -#define INTELFB_OUTPUT_ANALOG 1 -#define INTELFB_OUTPUT_DVO 2 -#define INTELFB_OUTPUT_SDVO 3 -#define INTELFB_OUTPUT_LVDS 4 -#define INTELFB_OUTPUT_TVOUT 5 - -#define INTELFB_DVO_CHIP_NONE 0 -#define INTELFB_DVO_CHIP_LVDS 1 -#define INTELFB_DVO_CHIP_TMDS 2 -#define INTELFB_DVO_CHIP_TVOUT 4 - -#define INTELFB_OUTPUT_PIPE_NC 0 -#define INTELFB_OUTPUT_PIPE_A 1 -#define INTELFB_OUTPUT_PIPE_B 2 - -/*** Data Types ***/ - -/* supported chipsets */ -enum intel_chips { -INTEL_830M , -INTEL_845G , -INTEL_85XGM , -INTEL_852GM , -INTEL_852GME , -INTEL_854 , -INTEL_855GM , -INTEL_855GME , -INTEL_865G , -INTEL_915G , -INTEL_915GM , -INTEL_945G , -INTEL_945GM , -INTEL_945GME , -INTEL_965G , -INTEL_965GM , -}; - -struct intelfb_hwstate { -u32 vga0_divisor; -u32 vga1_divisor; -u32 vga_pd; -u32 dpll_a; -u32 dpll_b; -u32 fpa0; -u32 fpa1; -u32 fpb0; -u32 fpb1; -u32 palette_a[PALETTE_8_ENTRIES ]; -u32 palette_b[PALETTE_8_ENTRIES ]; -u32 htotal_a; -u32 hblank_a; -u32 hsync_a; -u32 vtotal_a; -u32 vblank_a; -u32 vsync_a; -u32 src_size_a; -u32 bclrpat_a; -u32 htotal_b; -u32 hblank_b; -u32 hsync_b; -u32 vtotal_b; -u32 vblank_b; -u32 vsync_b; -u32 src_size_b; -u32 bclrpat_b; -u32 adpa; -u32 dvoa; -u32 dvob; -u32 dvoc; -u32 dvoa_srcdim; -u32 dvob_srcdim; -u32 dvoc_srcdim; -u32 lvds; -u32 pipe_a_conf; -u32 pipe_b_conf; -u32 disp_arb; -u32 cursor_a_control; -u32 cursor_b_control; -u32 cursor_a_base; -u32 cursor_b_base; -u32 cursor_size; -u32 disp_a_ctrl; -u32 disp_b_ctrl; -u32 disp_a_base; -u32 disp_b_base; -u32 cursor_a_palette[4 ]; -u32 cursor_b_palette[4 ]; -u32 disp_a_stride; -u32 disp_b_stride; -u32 vgacntrl; -u32 add_id; -u32 swf0x[7 ]; -u32 swf1x[7 ]; -u32 swf3x[3 ]; -u32 fence[8 ]; -u32 instpm; -u32 mem_mode; -u32 fw_blc_0; -u32 fw_blc_1; -u16 hwstam; -u16 ier; -u16 iir; -u16 imr; -}; - -struct intelfb_heap_data { -u32 physical; -u8 __iomem *virtual; -u32 offset;/* in GATT pages */ -u32 size;/* in bytes */ -}; - -#ifdef CONFIG_FB_INTEL_I2C -struct intelfb_i2c_chan { -struct intelfb_info *dinfo; -u32 reg; -struct i2c_adapter adapter; -struct i2c_algo_bit_data algo; -}; -#endif - -struct intelfb_output_rec { -int type; -int pipe; -int flags; - -#ifdef CONFIG_FB_INTEL_I2C -struct intelfb_i2c_chan i2c_bus; -struct intelfb_i2c_chan ddc_bus; -#endif -}; - -struct intelfb_vsync { -wait_queue_head_t wait; -unsigned int count; -int pan_display; -u32 pan_offset; -}; - -struct intelfb_info { -struct fb_info *info; -const struct fb_ops *fbops; -struct pci_dev *pdev; - -struct intelfb_hwstate save_state; - -/* agpgart structs */ -struct agp_memory *gtt_fb_mem;/* use all stolen memory or vram */ -struct agp_memory *gtt_ring_mem;/* ring buffer */ -struct agp_memory *gtt_cursor_mem;/* hw cursor */ - -/* use a gart reserved fb mem */ -u8 fbmem_gart; - -int wc_cookie; - -/* heap data */ -struct intelfb_heap_data aperture; -struct intelfb_heap_data fb; -struct intelfb_heap_data ring; -struct intelfb_heap_data cursor; - -/* mmio regs */ -u32 mmio_base_phys; -u8 __iomem *mmio_base; - -/* fb start offset (in bytes) */ -u32 fb_start; - -/* ring buffer */ -u32 ring_head; -u32 ring_tail; -u32 ring_tail_mask; -u32 ring_space; -u32 ring_lockup; - -/* palette */ -u32 pseudo_palette[16 ]; - -/* chip info */ -int pci_chipset; -int chipset; -const char *name; -int mobile; - -/* current mode */ -int bpp, depth; -u32 visual; -int xres, yres, pitch; -int pixclock; - -/* current pipe */ -int pipe; - -/* some flags */ -int accel; -int hwcursor; -int fixed_mode; -int ring_active; -int flag; -unsigned long irq_flags; -int open; - -/* vsync */ -struct intelfb_vsync vsync; -spinlock_t int_lock; - -/* hw cursor */ -int cursor_on; -int cursor_blanked; -u8 cursor_src[64 ]; - -/* initial parameters */ -int initial_vga; -struct fb_var_screeninfo initial_var; -u32 initial_fb_base; -u32 initial_video_ram; -u32 initial_pitch; - -/* driver registered */ -int registered; - -/* index into plls */ -int pll_index; - -/* outputs */ -int num_outputs; -struct intelfb_output_rec output[MAX_OUTPUTS ]; -}; - -#define IS_I9XX (dinfo) (((dinfo)->chipset == INTEL_915G) || \ - ((dinfo)->chipset == INTEL_915GM) || \ - ((dinfo)->chipset == INTEL_945G) || \ - ((dinfo)->chipset == INTEL_945GM) || \ - ((dinfo)->chipset == INTEL_945GME) || \ - ((dinfo)->chipset == INTEL_965G) || \ - ((dinfo)->chipset == INTEL_965GM)) - -/*** function prototypes ***/ - -extern int intelfb_var_to_depth (const struct fb_var_screeninfo *var); - -#ifdef CONFIG_FB_INTEL_I2C -extern void intelfb_create_i2c_busses (struct intelfb_info *dinfo); -extern void intelfb_delete_i2c_busses (struct intelfb_info *dinfo); -#endif - -#endif /* _INTELFB_H */ drivers/video/fbdev/intelfb/intelfb_i2c.c deleted +0
-209@@ -1,209 +0,0 @@ -/************************************************************************** - -Copyright 2006 Dave Airlie <[email protected]> - -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -on the rights to use, copy, modify, merge, publish, distribute, sub -license, and/or sell copies of the Software, and to permit persons to whom -the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice (including the next -paragraph) shall be included in all copies or substantial portions of the -Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL -THE COPYRIGHT HOLDERS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, -DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/delay.h> -#include <linux/pci.h> -#include <linux/fb.h> - -#include <linux/i2c.h> -#include <linux/i2c-algo-bit.h> - -#include <asm/io.h> - -#include "intelfb.h" -#include "intelfbhw.h" - -/* bit locations in the registers */ -#define SCL_DIR_MASK 0x0001 -#define SCL_DIR 0x0002 -#define SCL_VAL_MASK 0x0004 -#define SCL_VAL_OUT 0x0008 -#define SCL_VAL_IN 0x0010 -#define SDA_DIR_MASK 0x0100 -#define SDA_DIR 0x0200 -#define SDA_VAL_MASK 0x0400 -#define SDA_VAL_OUT 0x0800 -#define SDA_VAL_IN 0x1000 - -static void intelfb_gpio_setscl (void *data,int state) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg, (state ?SCL_VAL_OUT :0 ) | -SCL_DIR |SCL_DIR_MASK |SCL_VAL_MASK ); - val =INREG (chan->reg); -} - -static void intelfb_gpio_setsda (void *data,int state) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg, (state ?SDA_VAL_OUT :0 ) | -SDA_DIR |SDA_DIR_MASK |SDA_VAL_MASK ); - val =INREG (chan->reg); -} - -static int intelfb_gpio_getscl (void *data) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg,SCL_DIR_MASK ); -OUTREG (chan->reg,0 ); - val =INREG (chan->reg); -return ((val &SCL_VAL_IN ) !=0 ); -} - -static int intelfb_gpio_getsda (void *data) -{ -struct intelfb_i2c_chan *chan = data; -struct intelfb_info *dinfo = chan->dinfo; -u32 val; - -OUTREG (chan->reg,SDA_DIR_MASK ); -OUTREG (chan->reg,0 ); - val =INREG (chan->reg); -return ((val &SDA_VAL_IN ) !=0 ); -} - -static int intelfb_setup_i2c_bus (struct intelfb_info *dinfo, -struct intelfb_i2c_chan *chan, -const u32 reg,const char *name, -int class) -{ -int rc; - - chan->dinfo = dinfo; - chan->reg = reg; -snprintf (chan->adapter.name,sizeof (chan->adapter.name), -"intelfb %s" , name); - chan->adapter.class = class; - chan->adapter.owner =THIS_MODULE ; - chan->adapter.algo_data = &chan->algo; - chan->adapter.dev.parent = &chan->dinfo->pdev->dev; - chan->algo.setsda = intelfb_gpio_setsda; - chan->algo.setscl = intelfb_gpio_setscl; - chan->algo.getsda = intelfb_gpio_getsda; - chan->algo.getscl = intelfb_gpio_getscl; - chan->algo.udelay =40 ; - chan->algo.timeout =20 ; - chan->algo.data = chan; - -i2c_set_adapdata (&chan->adapter, chan); - -/* Raise SCL and SDA */ -intelfb_gpio_setsda (chan,1 ); -intelfb_gpio_setscl (chan,1 ); -udelay (20 ); - - rc =i2c_bit_add_bus (&chan->adapter); -if (rc ==0 ) -DBG_MSG ("I2C bus %s registered.\n" , name); -else -WRN_MSG ("Failed to register I2C bus %s.\n" , name); -return rc; -} - -void intelfb_create_i2c_busses (struct intelfb_info *dinfo) -{ -int i =0 ; - -/* everyone has at least a single analog output */ - dinfo->num_outputs =1 ; - dinfo->output[i].type =INTELFB_OUTPUT_ANALOG ; - -/* setup the DDC bus for analog output */ -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].ddc_bus,GPIOA , -"CRTDDC_A" ,I2C_CLASS_DDC ); - i++; - -/* need to add the output busses for each device -- this function is very incomplete -- i915GM has LVDS and TVOUT for example -*/ -switch (dinfo->chipset) { -case INTEL_830M : -case INTEL_845G : -case INTEL_854 : -case INTEL_855GM : -case INTEL_865G : - dinfo->output[i].type =INTELFB_OUTPUT_DVO ; -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].ddc_bus, -GPIOD ,"DVODDC_D" ,I2C_CLASS_DDC ); -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].i2c_bus, -GPIOE ,"DVOI2C_E" ,0 ); - i++; -break ; -case INTEL_915G : -case INTEL_915GM : -/* has some LVDS + tv-out */ -case INTEL_945G : -case INTEL_945GM : -case INTEL_945GME : -case INTEL_965G : -case INTEL_965GM : -/* SDVO ports have a single control bus - 2 devices */ - dinfo->output[i].type =INTELFB_OUTPUT_SDVO ; -intelfb_setup_i2c_bus (dinfo, &dinfo->output[i].i2c_bus, -GPIOE ,"SDVOCTRL_E" ,0 ); -/* TODO: initialize the SDVO */ -/* I830SDVOInit(pScrn, i, DVOB); */ - i++; - -/* set up SDVOC */ - dinfo->output[i].type =INTELFB_OUTPUT_SDVO ; - dinfo->output[i].i2c_bus = dinfo->output[i -1 ].i2c_bus; -/* TODO: initialize the SDVO */ -/* I830SDVOInit(pScrn, i, DVOC); */ - i++; -break ; - } - dinfo->num_outputs = i; -} - -void intelfb_delete_i2c_busses (struct intelfb_info *dinfo) -{ -int i; - -for (i =0 ; i <MAX_OUTPUTS ; i++) { -if (dinfo->output[i].i2c_bus.dinfo) { -i2c_del_adapter (&dinfo->output[i].i2c_bus.adapter); - dinfo->output[i].i2c_bus.dinfo =NULL ; - } -if (dinfo->output[i].ddc_bus.dinfo) { -i2c_del_adapter (&dinfo->output[i].ddc_bus.adapter); - dinfo->output[i].ddc_bus.dinfo =NULL ; - } - } -}drivers/video/fbdev/intelfb/intelfbdrv.c deleted +0
-1680@@ -1,1680 +0,0 @@ -/* -* intelfb -* -* Linux framebuffer driver for Intel(R) 830M/845G/852GM/855GM/865G/915G/915GM/ -* 945G/945GM/945GME/965G/965GM integrated graphics chips. -* -* Copyright © 2002, 2003 David Dawes <[email protected]> -* 2004 Sylvain Meyer -* 2006 David Airlie -* -* This driver consists of two parts. The first part (intelfbdrv.c) provides -* the basic fbdev interfaces, is derived in part from the radeonfb and -* vesafb drivers, and is covered by the GPL. The second part (intelfbhw.c) -* provides the code to program the hardware. Most of it is derived from -* the i810/i830 XFree86 driver. The HW-specific code is covered here -* under a dual license (GPL and MIT/XFree86 license). -* -* Author: David Dawes -* -*/ - -/* $DHD: intelfb/intelfbdrv.c,v 1.20 2003/06/27 15:17:40 dawes Exp $ */ - -/* -* Changes: -* 01/2003 - Initial driver (0.1.0), no mode switching, no acceleration. -* This initial version is a basic core that works a lot like -* the vesafb driver. It must be built-in to the kernel, -* and the initial video mode must be set with vga=XXX at -* boot time. (David Dawes) -* -* 01/2003 - Version 0.2.0: Mode switching added, colormap support -* implemented, Y panning, and soft screen blanking implemented. -* No acceleration yet. (David Dawes) -* -* 01/2003 - Version 0.3.0: fbcon acceleration support added. Module -* option handling added. (David Dawes) -* -* 01/2003 - Version 0.4.0: fbcon HW cursor support added. (David Dawes) -* -* 01/2003 - Version 0.4.1: Add auto-generation of built-in modes. -* (David Dawes) -* -* 02/2003 - Version 0.4.2: Add check for active non-CRT devices, and -* mode validation checks. (David Dawes) -* -* 02/2003 - Version 0.4.3: Check when the VC is in graphics mode so that -* acceleration is disabled while an XFree86 server is running. -* (David Dawes) -* -* 02/2003 - Version 0.4.4: Monitor DPMS support. (David Dawes) -* -* 02/2003 - Version 0.4.5: Basic XFree86 + fbdev working. (David Dawes) -* -* 02/2003 - Version 0.5.0: Modify to work with the 2.5.32 kernel as well -* as 2.4.x kernels. (David Dawes) -* -* 02/2003 - Version 0.6.0: Split out HW-specifics into a separate file. -* (David Dawes) -* -* 02/2003 - Version 0.7.0: Test on 852GM/855GM. Acceleration and HW -* cursor are disabled on this platform. (David Dawes) -* -* 02/2003 - Version 0.7.1: Test on 845G. Acceleration is disabled -* on this platform. (David Dawes) -* -* 02/2003 - Version 0.7.2: Test on 830M. Acceleration and HW -* cursor are disabled on this platform. (David Dawes) -* -* 02/2003 - Version 0.7.3: Fix 8-bit modes for mobile platforms -* (David Dawes) -* -* 02/2003 - Version 0.7.4: Add checks for FB and FBCON_HAS_CFB* configured -* in the kernel, and add mode bpp verification and default -* bpp selection based on which FBCON_HAS_CFB* are configured. -* (David Dawes) -* -* 02/2003 - Version 0.7.5: Add basic package/install scripts based on the -* DRI packaging scripts. (David Dawes) -* -* 04/2003 - Version 0.7.6: Fix typo that affects builds with SMP-enabled -* kernels. (David Dawes, reported by Anupam). -* -* 06/2003 - Version 0.7.7: -* Fix Makefile.kernel build problem (Tsutomu Yasuda). -* Fix mis-placed #endif (2.4.21 kernel). -* -* 09/2004 - Version 0.9.0 - by Sylvain Meyer -* Port to linux 2.6 kernel fbdev -* Fix HW accel and HW cursor on i845G -* Use of agpgart for fb memory reservation -* Add mtrr support -* -* 10/2004 - Version 0.9.1 -* Use module_param instead of old MODULE_PARM -* Some cleanup -* -* 11/2004 - Version 0.9.2 -* Add vram option to reserve more memory than stolen by BIOS -* Fix intelfbhw_pan_display typo -* Add __initdata annotations -* -* 04/2008 - Version 0.9.5 -* Add support for 965G/965GM. (Maik Broemme <[email protected]>) -* -* 08/2008 - Version 0.9.6 -* Add support for 945GME. (Phil Endecott <[email protected]>) -*/ - -#include <linux/aperture.h> -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/mm.h> -#include <linux/slab.h> -#include <linux/delay.h> -#include <linux/fb.h> -#include <linux/ioport.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/vmalloc.h> -#include <linux/pagemap.h> -#include <linux/screen_info.h> - -#include <asm/io.h> - -#include "intelfb.h" -#include "intelfbhw.h" -#include "../edid.h" - -static void get_initial_mode (struct intelfb_info *dinfo); -static void update_dinfo (struct intelfb_info *dinfo, -struct fb_var_screeninfo *var); -static int intelfb_open (struct fb_info *info,int user); -static int intelfb_release (struct fb_info *info,int user); -static int intelfb_check_var (struct fb_var_screeninfo *var, -struct fb_info *info); -static int intelfb_set_par (struct fb_info *info); -static int intelfb_setcolreg (unsigned regno,unsigned red,unsigned green, -unsigned blue,unsigned transp, -struct fb_info *info); - -static int intelfb_blank (int blank,struct fb_info *info); -static int intelfb_pan_display (struct fb_var_screeninfo *var, -struct fb_info *info); - -static void intelfb_fillrect (struct fb_info *info, -const struct fb_fillrect *rect); -static void intelfb_copyarea (struct fb_info *info, -const struct fb_copyarea *region); -static void intelfb_imageblit (struct fb_info *info, -const struct fb_image *image); -static int intelfb_cursor (struct fb_info *info, -struct fb_cursor *cursor); - -static int intelfb_sync (struct fb_info *info); - -static int intelfb_ioctl (struct fb_info *info, -unsigned int cmd,unsigned long arg); - -static int intelfb_pci_register (struct pci_dev *pdev, -const struct pci_device_id *ent); -static void intelfb_pci_unregister (struct pci_dev *pdev); -static int intelfb_set_fbinfo (struct intelfb_info *dinfo); - -/* -* Limiting the class to PCI_CLASS_DISPLAY_VGA prevents function 1 of the -* mobile chipsets from being registered. -*/ -#if DETECT_VGA_CLASS_ONLY -#define INTELFB_CLASS_MASK ~0 << 8 -#else -#define INTELFB_CLASS_MASK 0 -#endif - -static const struct pci_device_id intelfb_pci_table[] = { - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_830M ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_830M }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_845G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_845G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_85XGM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_85XGM }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_865G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_865G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_854 ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_854 }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_915G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_915G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_915GM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_915GM }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_945G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_945G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_945GM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_945GM }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_945GME ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_945GME }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_965G ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_965G }, - {PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_965GM ,PCI_ANY_ID ,PCI_ANY_ID ,PCI_CLASS_DISPLAY_VGA <<8 ,INTELFB_CLASS_MASK ,INTEL_965GM }, - {0 , } -}; - -/* Global data */ -static int num_registered =0 ; - -/* fb ops */ -static const struct fb_ops intel_fb_ops = { - .owner =THIS_MODULE , - .fb_open = intelfb_open, - .fb_release = intelfb_release, - __FB_DEFAULT_IOMEM_OPS_RDWR, - .fb_check_var = intelfb_check_var, - .fb_set_par = intelfb_set_par, - .fb_setcolreg = intelfb_setcolreg, - .fb_blank = intelfb_blank, - .fb_pan_display = intelfb_pan_display, - .fb_fillrect = intelfb_fillrect, - .fb_copyarea = intelfb_copyarea, - .fb_imageblit = intelfb_imageblit, - .fb_cursor = intelfb_cursor, - .fb_sync = intelfb_sync, - .fb_ioctl = intelfb_ioctl, - __FB_DEFAULT_IOMEM_OPS_MMAP, -}; - -/* PCI driver module table */ -static struct pci_driver intelfb_driver = { - .name ="intelfb" , - .id_table = intelfb_pci_table, - .probe = intelfb_pci_register, - .remove = intelfb_pci_unregister, -}; - -/* Module description/parameters */ -MODULE_AUTHOR ("David Dawes <[email protected]>, " -"Sylvain Meyer <[email protected]>" ); -MODULE_DESCRIPTION ("Framebuffer driver for Intel(R) " SUPPORTED_CHIPSETS -" chipsets" ); -MODULE_LICENSE ("Dual BSD/GPL" ); -MODULE_DEVICE_TABLE (pci, intelfb_pci_table); - -static bool accel =1 ; -static int vram =4 ; -static bool hwcursor =0 ; -static bool mtrr =1 ; -static bool fixed =0 ; -static bool noinit =0 ; -static bool noregister =0 ; -static bool probeonly =0 ; -static bool idonly =0 ; -static int bailearly =0 ; -static int voffset =48 ; -static char *mode =NULL ; - -module_param (accel, bool,S_IRUGO ); -MODULE_PARM_DESC (accel,"Enable hardware acceleration" ); -module_param (vram, int,S_IRUGO ); -MODULE_PARM_DESC (vram,"System RAM to allocate to framebuffer in MiB" ); -module_param (voffset, int,S_IRUGO ); -MODULE_PARM_DESC (voffset,"Offset of framebuffer in MiB" ); -module_param (hwcursor, bool,S_IRUGO ); -MODULE_PARM_DESC (hwcursor,"Enable HW cursor" ); -module_param (mtrr, bool,S_IRUGO ); -MODULE_PARM_DESC (mtrr,"Enable MTRR support" ); -module_param (fixed, bool,S_IRUGO ); -MODULE_PARM_DESC (fixed,"Disable mode switching" ); -module_param (noinit, bool,0 ); -MODULE_PARM_DESC (noinit,"Don't initialise graphics mode when loading" ); -module_param (noregister, bool,0 ); -MODULE_PARM_DESC (noregister,"Don't register, just probe and exit (debug)" ); -module_param (probeonly, bool,0 ); -MODULE_PARM_DESC (probeonly,"Do a minimal probe (debug)" ); -module_param (idonly, bool,0 ); -MODULE_PARM_DESC (idonly,"Just identify without doing anything else (debug)" ); -module_param (bailearly, int,0 ); -MODULE_PARM_DESC (bailearly,"Bail out early, depending on value (debug)" ); -module_param (mode, charp,S_IRUGO ); -MODULE_PARM_DESC (mode, -"Initial video mode \"<xres>x<yres>[-<depth>][@<refresh>]\"" ); - -#ifndef MODULE -#define OPT_EQUAL (opt, name) (!strncmp(opt, name, strlen(name))) -#define OPT_INTVAL (opt, name) simple_strtoul(opt + strlen(name) + 1, NULL, 0) -#define OPT_STRVAL (opt, name) (opt + strlen(name)) - -static __inline__char *get_opt_string (const char *this_opt,const char *name) -{ -const char *p; -int i; -char *ret; - - p =OPT_STRVAL (this_opt, name); - i =0 ; -while (p[i] && p[i] !=' ' && p[i] !=',' ) - i++; - ret =kmalloc (i +1 ,GFP_KERNEL ); -if (ret) { -strncpy (ret, p, i); - ret[i] ='\0' ; - } -return ret; -} - -static __inline__int get_opt_int (const char *this_opt,const char *name, -int *ret) -{ -if (!ret) -return 0 ; - -if (!OPT_EQUAL (this_opt, name)) -return 0 ; - - *ret =OPT_INTVAL (this_opt, name); -return 1 ; -} - -static __inline__int get_opt_bool (const char *this_opt,const char *name, -bool *ret) -{ -if (!ret) -return 0 ; - -if (OPT_EQUAL (this_opt, name)) { -if (this_opt[strlen (name)] =='=' ) - *ret =simple_strtoul (this_opt +strlen (name) +1 , -NULL ,0 ); -else - *ret =1 ; - }else { -if (OPT_EQUAL (this_opt,"no" ) &&OPT_EQUAL (this_opt +2 , name)) - *ret =0 ; -else -return 0 ; - } -return 1 ; -} - -static int __init intelfb_setup (char *options) -{ -char *this_opt; - -DBG_MSG ("intelfb_setup\n" ); - -if (!options || !*options) { -DBG_MSG ("no options\n" ); -return 0 ; - }else -DBG_MSG ("options: %s\n" , options); - -/* -* These are the built-in options analogous to the module parameters -* defined above. -* -* The syntax is: -* -* video=intelfb:[mode][,<param>=<val>] ... -* -* e.g., -* -* video=intelfb:1024x768-16@75,accel=0 -*/ - -while ((this_opt =strsep (&options,"," ))) { -if (!*this_opt) -continue ; -if (get_opt_bool (this_opt,"accel" , &accel)) - ; -else if (get_opt_int (this_opt,"vram" , &vram)) - ; -else if (get_opt_bool (this_opt,"hwcursor" , &hwcursor)) - ; -else if (get_opt_bool (this_opt,"mtrr" , &mtrr)) - ; -else if (get_opt_bool (this_opt,"fixed" , &fixed)) - ; -else if (get_opt_bool (this_opt,"init" , &noinit)) - noinit = !noinit; -else if (OPT_EQUAL (this_opt,"mode=" )) - mode =get_opt_string (this_opt,"mode=" ); -else - mode = this_opt; - } - -return 0 ; -} - -#endif - -static int __init intelfb_init (void ) -{ -#ifndef MODULE -char *option =NULL ; -#endif - -DBG_MSG ("intelfb_init\n" ); - -INF_MSG ("Framebuffer driver for " -"Intel(R) " SUPPORTED_CHIPSETS " chipsets\n" ); -INF_MSG ("Version " INTELFB_VERSION "\n" ); - -if (idonly) -return -ENODEV ; - -if (fb_modesetting_disabled ("intelfb" )) -return -ENODEV ; - -#ifndef MODULE -if (fb_get_options ("intelfb" , &option)) -return -ENODEV ; -intelfb_setup (option); -#endif - -return pci_register_driver (&intelfb_driver); -} - -static void __exit intelfb_exit(void) -{ -DBG_MSG ("intelfb_exit\n" ); -pci_unregister_driver (&intelfb_driver); -} - -module_init (intelfb_init); -module_exit (intelfb_exit); - -/*************************************************************** -* driver init / cleanup * -***************************************************************/ - -static void cleanup (struct intelfb_info *dinfo) -{ -DBG_MSG ("cleanup\n" ); - -if (!dinfo) -return ; - -intelfbhw_disable_irq (dinfo); - -fb_dealloc_cmap (&dinfo->info->cmap); -kfree (dinfo->info->pixmap.addr); - -if (dinfo->registered) -unregister_framebuffer (dinfo->info); - -arch_phys_wc_del (dinfo->wc_cookie); - -if (dinfo->fbmem_gart && dinfo->gtt_fb_mem) { -agp_unbind_memory (dinfo->gtt_fb_mem); -agp_free_memory (dinfo->gtt_fb_mem); - } -if (dinfo->gtt_cursor_mem) { -agp_unbind_memory (dinfo->gtt_cursor_mem); -agp_free_memory (dinfo->gtt_cursor_mem); - } -if (dinfo->gtt_ring_mem) { -agp_unbind_memory (dinfo->gtt_ring_mem); -agp_free_memory (dinfo->gtt_ring_mem); - } - -#ifdef CONFIG_FB_INTEL_I2C -/* un-register I2C bus */ -intelfb_delete_i2c_busses (dinfo); -#endif - -if (dinfo->mmio_base) -iounmap ((void __iomem *)dinfo->mmio_base); -if (dinfo->aperture.virtual) -iounmap ((void __iomem *)dinfo->aperture.virtual); - -if (dinfo->flag &INTELFB_MMIO_ACQUIRED ) -release_mem_region (dinfo->mmio_base_phys,INTEL_REG_SIZE ); -if (dinfo->flag &INTELFB_FB_ACQUIRED ) -release_mem_region (dinfo->aperture.physical, - dinfo->aperture.size); -framebuffer_release (dinfo->info); -} - -#define bailout (dinfo) do { \ - DBG_MSG("bailout\n"); \ - cleanup(dinfo); \ - INF_MSG("Not going to register framebuffer, exiting...\n"); \ - return -ENODEV; \ -} while (0) - - -static int intelfb_pci_register (struct pci_dev *pdev, -const struct pci_device_id *ent) -{ -struct fb_info *info; -struct intelfb_info *dinfo; -int i, err, dvo; -int aperture_size, stolen_size =0 ; -struct agp_kern_info gtt_info; -int agp_memtype; -const char *s; -struct agp_bridge_data *bridge; -int aperture_bar =0 ; -int mmio_bar =1 ; -int offset; - -DBG_MSG ("intelfb_pci_register\n" ); - - err =aperture_remove_conflicting_pci_devices (pdev,"intelfb" ); -if (err) -return err; - - num_registered++; -if (num_registered !=1 ) { -ERR_MSG ("Attempted to register %d devices " -"(should be only 1).\n" , num_registered); -return -ENODEV ; - } - - info =framebuffer_alloc (sizeof (struct intelfb_info ), &pdev->dev); -if (!info) -return -ENOMEM ; - -if (fb_alloc_cmap (&info->cmap,256 ,1 ) <0 ) { -ERR_MSG ("Could not allocate cmap for intelfb_info.\n" ); - goto err_out_cmap; - } - - dinfo = info->par; - dinfo->info = info; - dinfo->fbops = &intel_fb_ops; - dinfo->pdev = pdev; - -/* Reserve pixmap space. */ - info->pixmap.addr =kzalloc (64 *1024 ,GFP_KERNEL ); -if (info->pixmap.addr ==NULL ) { -ERR_MSG ("Cannot reserve pixmap memory.\n" ); - goto err_out_pixmap; - } - -/* set early this option because it could be changed by tv encoder -driver */ - dinfo->fixed_mode = fixed; - -/* Enable device. */ -if ((err =pci_enable_device (pdev))) { -ERR_MSG ("Cannot enable device.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - -/* Set base addresses. */ -if ((ent->device ==PCI_DEVICE_ID_INTEL_915G ) || - (ent->device ==PCI_DEVICE_ID_INTEL_915GM ) || - (ent->device ==PCI_DEVICE_ID_INTEL_945G ) || - (ent->device ==PCI_DEVICE_ID_INTEL_945GM ) || - (ent->device ==PCI_DEVICE_ID_INTEL_945GME ) || - (ent->device ==PCI_DEVICE_ID_INTEL_965G ) || - (ent->device ==PCI_DEVICE_ID_INTEL_965GM )) { - - aperture_bar =2 ; - mmio_bar =0 ; - } - dinfo->aperture.physical =pci_resource_start (pdev, aperture_bar); - dinfo->aperture.size =pci_resource_len (pdev, aperture_bar); - dinfo->mmio_base_phys =pci_resource_start (pdev, mmio_bar); -DBG_MSG ("fb aperture: 0x%llx/0x%llx, MMIO region: 0x%llx/0x%llx\n" , - (unsigned long long )pci_resource_start (pdev, aperture_bar), - (unsigned long long )pci_resource_len (pdev, aperture_bar), - (unsigned long long )pci_resource_start (pdev, mmio_bar), - (unsigned long long )pci_resource_len (pdev, mmio_bar)); - -/* Reserve the fb and MMIO regions */ -if (!request_mem_region (dinfo->aperture.physical, dinfo->aperture.size, -INTELFB_MODULE_NAME )) { -ERR_MSG ("Cannot reserve FB region.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->flag |=INTELFB_FB_ACQUIRED ; - -if (!request_mem_region (dinfo->mmio_base_phys, -INTEL_REG_SIZE , -INTELFB_MODULE_NAME )) { -ERR_MSG ("Cannot reserve MMIO region.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->flag |=INTELFB_MMIO_ACQUIRED ; - -/* Get the chipset info. */ - dinfo->pci_chipset = pdev->device; - -if (intelfbhw_get_chipset (pdev, dinfo)) { -cleanup (dinfo); -return -ENODEV ; - } - -if (intelfbhw_get_memory (pdev, &aperture_size, &stolen_size)) { -cleanup (dinfo); -return -ENODEV ; - } - -INF_MSG ("%02x:%02x.%d: %s, aperture size %dMB, " -"stolen memory %dkB\n" , - pdev->bus->number,PCI_SLOT (pdev->devfn), -PCI_FUNC (pdev->devfn), dinfo->name, -BtoMB (aperture_size),BtoKB (stolen_size)); - -/* Set these from the options. */ - dinfo->accel = accel; - dinfo->hwcursor = hwcursor; - -if (NOACCEL_CHIPSET (dinfo) && dinfo->accel ==1 ) { -INF_MSG ("Acceleration is not supported for the %s chipset.\n" , - dinfo->name); - dinfo->accel =0 ; - } - -/* Framebuffer parameters - Use all the stolen memory if >= vram */ -if (ROUND_UP_TO_PAGE (stolen_size) >=MB (vram)) { - dinfo->fb.size =ROUND_UP_TO_PAGE (stolen_size); - dinfo->fbmem_gart =0 ; - }else { - dinfo->fb.size =MB (vram); - dinfo->fbmem_gart =1 ; - } - -/* Allocate space for the ring buffer and HW cursor if enabled. */ -if (dinfo->accel) { - dinfo->ring.size =RINGBUFFER_SIZE ; - dinfo->ring_tail_mask = dinfo->ring.size -1 ; - } -if (dinfo->hwcursor) - dinfo->cursor.size =HW_CURSOR_SIZE ; - -/* Use agpgart to manage the GATT */ -if (!(bridge =agp_backend_acquire (pdev))) { -ERR_MSG ("cannot acquire agp\n" ); -cleanup (dinfo); -return -ENODEV ; - } - -/* get the current gatt info */ -if (agp_copy_info (bridge, >t_info)) { -ERR_MSG ("cannot get agp info\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENODEV ; - } - -if (MB (voffset) < stolen_size) - offset = (stolen_size >>12 ); -else - offset =ROUND_UP_TO_PAGE (MB (voffset))/GTT_PAGE_SIZE ; - -/* set the mem offsets - set them after the already used pages */ -if (dinfo->accel) - dinfo->ring.offset = offset + gtt_info.current_memory; -if (dinfo->hwcursor) - dinfo->cursor.offset = offset + - + gtt_info.current_memory + (dinfo->ring.size >>12 ); -if (dinfo->fbmem_gart) - dinfo->fb.offset = offset + - + gtt_info.current_memory + (dinfo->ring.size >>12 ) - + (dinfo->cursor.size >>12 ); - -/* Allocate memories (which aren't stolen) */ -/* Map the fb and MMIO regions */ -/* ioremap only up to the end of used aperture */ - dinfo->aperture.virtual = (u8 __iomem *)ioremap_wc - (dinfo->aperture.physical, ((offset + dinfo->fb.offset) <<12 ) - + dinfo->fb.size); -if (!dinfo->aperture.virtual) { -ERR_MSG ("Cannot remap FB region.\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->mmio_base = - (u8 __iomem *)ioremap (dinfo->mmio_base_phys, -INTEL_REG_SIZE ); -if (!dinfo->mmio_base) { -ERR_MSG ("Cannot remap MMIO region.\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENODEV ; - } - -if (dinfo->accel) { -if (!(dinfo->gtt_ring_mem = -agp_allocate_memory (bridge, dinfo->ring.size >>12 , -AGP_NORMAL_MEMORY ))) { -ERR_MSG ("cannot allocate ring buffer memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENOMEM ; - } -if (agp_bind_memory (dinfo->gtt_ring_mem, - dinfo->ring.offset)) { -ERR_MSG ("cannot bind ring buffer memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -EBUSY ; - } - dinfo->ring.physical = dinfo->aperture.physical - + (dinfo->ring.offset <<12 ); - dinfo->ring.virtual = dinfo->aperture.virtual - + (dinfo->ring.offset <<12 ); - dinfo->ring_head =0 ; - } -if (dinfo->hwcursor) { - agp_memtype = dinfo->mobile ?AGP_PHYSICAL_MEMORY - :AGP_NORMAL_MEMORY ; -if (!(dinfo->gtt_cursor_mem = -agp_allocate_memory (bridge, dinfo->cursor.size >>12 , - agp_memtype))) { -ERR_MSG ("cannot allocate cursor memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -ENOMEM ; - } -if (agp_bind_memory (dinfo->gtt_cursor_mem, - dinfo->cursor.offset)) { -ERR_MSG ("cannot bind cursor memory\n" ); -agp_backend_release (bridge); -cleanup (dinfo); -return -EBUSY ; - } -if (dinfo->mobile) - dinfo->cursor.physical - = dinfo->gtt_cursor_mem->physical; -else - dinfo->cursor.physical = dinfo->aperture.physical - + (dinfo->cursor.offset <<12 ); - dinfo->cursor.virtual = dinfo->aperture.virtual - + (dinfo->cursor.offset <<12 ); - } -if (dinfo->fbmem_gart) { -if (!(dinfo->gtt_fb_mem = -agp_allocate_memory (bridge, dinfo->fb.size >>12 , -AGP_NORMAL_MEMORY ))) { -WRN_MSG ("cannot allocate framebuffer memory - use " -"the stolen one\n" ); - dinfo->fbmem_gart =0 ; - } -if (agp_bind_memory (dinfo->gtt_fb_mem, - dinfo->fb.offset)) { -WRN_MSG ("cannot bind framebuffer memory - use " -"the stolen one\n" ); - dinfo->fbmem_gart =0 ; - } - } - -/* update framebuffer memory parameters */ -if (!dinfo->fbmem_gart) - dinfo->fb.offset =0 ;/* starts at offset 0 */ - dinfo->fb.physical = dinfo->aperture.physical - + (dinfo->fb.offset <<12 ); - dinfo->fb.virtual = dinfo->aperture.virtual + (dinfo->fb.offset <<12 ); - dinfo->fb_start = dinfo->fb.offset <<12 ; - -/* release agpgart */ -agp_backend_release (bridge); - -if (mtrr) - dinfo->wc_cookie =arch_phys_wc_add (dinfo->aperture.physical, - dinfo->aperture.size); - -DBG_MSG ("fb: 0x%x(+ 0x%x)/0x%x (0x%p)\n" , - dinfo->fb.physical, dinfo->fb.offset, dinfo->fb.size, - dinfo->fb.virtual); -DBG_MSG ("MMIO: 0x%x/0x%x (0x%p)\n" , - dinfo->mmio_base_phys,INTEL_REG_SIZE , - dinfo->mmio_base); -DBG_MSG ("ring buffer: 0x%x/0x%x (0x%p)\n" , - dinfo->ring.physical, dinfo->ring.size, - dinfo->ring.virtual); -DBG_MSG ("HW cursor: 0x%x/0x%x (0x%p) (offset 0x%x) (phys 0x%x)\n" , - dinfo->cursor.physical, dinfo->cursor.size, - dinfo->cursor.virtual, dinfo->cursor.offset, - dinfo->cursor.physical); - -DBG_MSG ("options: vram = %d, accel = %d, hwcursor = %d, fixed = %d, " -"noinit = %d\n" , vram, accel, hwcursor, fixed, noinit); -DBG_MSG ("options: mode = \"%s\"\n" , mode ? mode :"" ); - -if (probeonly) -bailout (dinfo); - -/* -* Check if the LVDS port or any DVO ports are enabled. If so, -* don't allow mode switching -*/ - dvo =intelfbhw_check_non_crt (dinfo); -if (dvo) { - dinfo->fixed_mode =1 ; -WRN_MSG ("Non-CRT device is enabled ( " ); - i =0 ; -while (dvo) { -if (dvo &1 ) { - s =intelfbhw_dvo_to_string (1 << i); -if (s) -printk ("%s " , s); - } - dvo >>=1 ; - ++i; - } -printk ("). Disabling mode switching.\n" ); - } - -if (bailearly ==1 ) -bailout (dinfo); - -if (FIXED_MODE (dinfo) && - screen_info.orig_video_isVGA !=VIDEO_TYPE_VLFB ) { -ERR_MSG ("Video mode must be programmed at boot time.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - -if (bailearly ==2 ) -bailout (dinfo); - -/* Initialise dinfo and related data. */ -/* If an initial mode was programmed at boot time, get its details. */ -if (screen_info.orig_video_isVGA ==VIDEO_TYPE_VLFB ) -get_initial_mode (dinfo); - -if (bailearly ==3 ) -bailout (dinfo); - -if (FIXED_MODE (dinfo))/* remap fb address */ -update_dinfo (dinfo, &dinfo->initial_var); - -if (bailearly ==4 ) -bailout (dinfo); - - -if (intelfb_set_fbinfo (dinfo)) { -cleanup (dinfo); -return -ENODEV ; - } - -if (bailearly ==5 ) -bailout (dinfo); - -#ifdef CONFIG_FB_INTEL_I2C -/* register I2C bus */ -intelfb_create_i2c_busses (dinfo); -#endif - -if (bailearly ==6 ) -bailout (dinfo); - -pci_set_drvdata (pdev, dinfo); - -/* Save the initial register state. */ - i =intelfbhw_read_hw_state (dinfo, &dinfo->save_state, - bailearly >6 ? bailearly -6 :0 ); -if (i !=0 ) { -DBG_MSG ("intelfbhw_read_hw_state returned %d\n" , i); -bailout (dinfo); - } - -intelfbhw_print_hw_state (dinfo, &dinfo->save_state); - -if (bailearly ==18 ) -bailout (dinfo); - -/* read active pipe */ - dinfo->pipe =intelfbhw_active_pipe (&dinfo->save_state); - -/* Cursor initialisation */ -if (dinfo->hwcursor) { -intelfbhw_cursor_init (dinfo); -intelfbhw_cursor_reset (dinfo); - } - -if (bailearly ==19 ) -bailout (dinfo); - -/* 2d acceleration init */ -if (dinfo->accel) -intelfbhw_2d_start (dinfo); - -if (bailearly ==20 ) -bailout (dinfo); - -if (noregister) -bailout (dinfo); - -if (register_framebuffer (dinfo->info) <0 ) { -ERR_MSG ("Cannot register framebuffer.\n" ); -cleanup (dinfo); -return -ENODEV ; - } - - dinfo->registered =1 ; - dinfo->open =0 ; - -init_waitqueue_head (&dinfo->vsync.wait); -spin_lock_init (&dinfo->int_lock); - dinfo->irq_flags =0 ; - dinfo->vsync.pan_display =0 ; - dinfo->vsync.pan_offset =0 ; - -return 0 ; - -err_out_pixmap: -fb_dealloc_cmap (&info->cmap); -err_out_cmap: -framebuffer_release (info); -return -ENODEV ; -} - -static void intelfb_pci_unregister (struct pci_dev *pdev) -{ -struct intelfb_info *dinfo =pci_get_drvdata (pdev); - -DBG_MSG ("intelfb_pci_unregister\n" ); - -if (!dinfo) -return ; - -cleanup (dinfo); -} - -/*************************************************************** -* helper functions * -***************************************************************/ - -__inline__int intelfb_var_to_depth (const struct fb_var_screeninfo *var) -{ -DBG_MSG ("intelfb_var_to_depth: bpp: %d, green.length is %d\n" , - var->bits_per_pixel, var->green.length); - -switch (var->bits_per_pixel) { -case 16 : -return (var->green.length ==6 ) ?16 :15 ; -case 32 : -return 24 ; -default : -return var->bits_per_pixel; - } -} - - -static __inline__int var_to_refresh (const struct fb_var_screeninfo *var) -{ -int xtot = var->xres + var->left_margin + var->right_margin + - var->hsync_len; -int ytot = var->yres + var->upper_margin + var->lower_margin + - var->vsync_len; - -return (1000000000 / var->pixclock *1000 +500 ) / xtot / ytot; -} - -/*************************************************************** -* Various initialisation functions * -***************************************************************/ - -static void get_initial_mode (struct intelfb_info *dinfo) -{ -struct fb_var_screeninfo *var; -int xtot, ytot; - -DBG_MSG ("get_initial_mode\n" ); - - dinfo->initial_vga =1 ; - dinfo->initial_fb_base = screen_info.lfb_base; - dinfo->initial_video_ram = screen_info.lfb_size *KB (64 ); - dinfo->initial_pitch = screen_info.lfb_linelength; - - var = &dinfo->initial_var; -memset (var,0 ,sizeof (*var)); - var->xres = screen_info.lfb_width; - var->yres = screen_info.lfb_height; - var->bits_per_pixel = screen_info.lfb_depth; -switch (screen_info.lfb_depth) { -case 15 : - var->bits_per_pixel =16 ; -break ; -case 24 : - var->bits_per_pixel =32 ; -break ; - } - -DBG_MSG ("Initial info: FB is 0x%x/0x%x (%d kByte)\n" , - dinfo->initial_fb_base, dinfo->initial_video_ram, -BtoKB (dinfo->initial_video_ram)); - -DBG_MSG ("Initial info: mode is %dx%d-%d (%d)\n" , - var->xres, var->yres, var->bits_per_pixel, - dinfo->initial_pitch); - -/* Dummy timing values (assume 60Hz) */ - var->left_margin = (var->xres /8 ) &0xf8 ; - var->right_margin =32 ; - var->upper_margin =16 ; - var->lower_margin =4 ; - var->hsync_len = (var->xres /8 ) &0xf8 ; - var->vsync_len =4 ; - - xtot = var->xres + var->left_margin + - var->right_margin + var->hsync_len; - ytot = var->yres + var->upper_margin + - var->lower_margin + var->vsync_len; - var->pixclock =10000000 / xtot *1000 / ytot *100 /60 ; - - var->height =-1 ; - var->width =-1 ; - -if (var->bits_per_pixel >8 ) { - var->red.offset = screen_info.red_pos; - var->red.length = screen_info.red_size; - var->green.offset = screen_info.green_pos; - var->green.length = screen_info.green_size; - var->blue.offset = screen_info.blue_pos; - var->blue.length = screen_info.blue_size; - var->transp.offset = screen_info.rsvd_pos; - var->transp.length = screen_info.rsvd_size; - }else { - var->red.length =8 ; - var->green.length =8 ; - var->blue.length =8 ; - } -} - -static int intelfb_init_var (struct intelfb_info *dinfo) -{ -struct fb_var_screeninfo *var; -int msrc =0 ; - -DBG_MSG ("intelfb_init_var\n" ); - - var = &dinfo->info->var; -if (FIXED_MODE (dinfo)) { -memcpy (var, &dinfo->initial_var, -sizeof (struct fb_var_screeninfo )); - msrc =5 ; - }else { -const u8 *edid_s =fb_firmware_edid (&dinfo->pdev->dev); -u8 *edid_d =NULL ; - -if (edid_s) { - edid_d =kmemdup (edid_s,EDID_LENGTH ,GFP_KERNEL ); - -if (edid_d) { -fb_edid_to_monspecs (edid_d, - &dinfo->info->monspecs); -kfree (edid_d); - } - } - -if (mode) { -printk ("intelfb: Looking for mode in private " -"database\n" ); - msrc =fb_find_mode (var, dinfo->info, mode, - dinfo->info->monspecs.modedb, - dinfo->info->monspecs.modedb_len, -NULL ,0 ); - -if (msrc && msrc >1 ) { -printk ("intelfb: No mode in private database, " -"intelfb: looking for mode in global " -"database " ); - msrc =fb_find_mode (var, dinfo->info, mode, -NULL ,0 ,NULL ,0 ); - -if (msrc) - msrc |=8 ; - } - - } - -if (!msrc) - msrc =fb_find_mode (var, dinfo->info,PREFERRED_MODE , -NULL ,0 ,NULL ,0 ); - } - -if (!msrc) { -ERR_MSG ("Cannot find a suitable video mode.\n" ); -return 1 ; - } - -INF_MSG ("Initial video mode is %dx%d-%d@%d.\n" , var->xres, var->yres, - var->bits_per_pixel,var_to_refresh (var)); - -DBG_MSG ("Initial video mode is from %d.\n" , msrc); - -#if ALLOCATE_FOR_PANNING -/* Allow use of half of the video ram for panning */ - var->xres_virtual = var->xres; - var->yres_virtual = - dinfo->fb.size /2 / (var->bits_per_pixel * var->xres); -if (var->yres_virtual < var->yres) - var->yres_virtual = var->yres; -#else - var->yres_virtual = var->yres; -#endif - -if (dinfo->accel) - var->accel_flags |=FB_ACCELF_TEXT ; -else - var->accel_flags &= ~FB_ACCELF_TEXT ; - -return 0 ; -} - -static int intelfb_set_fbinfo (struct intelfb_info *dinfo) -{ -struct fb_info *info = dinfo->info; - -DBG_MSG ("intelfb_set_fbinfo\n" ); - - info->fbops = &intel_fb_ops; - info->pseudo_palette = dinfo->pseudo_palette; - - info->pixmap.size =64 *1024 ; - info->pixmap.buf_align =8 ; - info->pixmap.access_align =32 ; - info->pixmap.flags =FB_PIXMAP_SYSTEM ; - -if (intelfb_init_var (dinfo)) -return 1 ; - - info->pixmap.scan_align =1 ; -strcpy (info->fix.id, dinfo->name); - info->fix.smem_start = dinfo->fb.physical; - info->fix.smem_len = dinfo->fb.size; - info->fix.type =FB_TYPE_PACKED_PIXELS ; - info->fix.type_aux =0 ; - info->fix.xpanstep =8 ; - info->fix.ypanstep =1 ; - info->fix.ywrapstep =0 ; - info->fix.mmio_start = dinfo->mmio_base_phys; - info->fix.mmio_len =INTEL_REG_SIZE ; - info->fix.accel =FB_ACCEL_I830 ; -update_dinfo (dinfo, &info->var); - -return 0 ; -} - -/* Update dinfo to match the active video mode. */ -static void update_dinfo (struct intelfb_info *dinfo, -struct fb_var_screeninfo *var) -{ -DBG_MSG ("update_dinfo\n" ); - - dinfo->bpp = var->bits_per_pixel; - dinfo->depth =intelfb_var_to_depth (var); - dinfo->xres = var->xres; - dinfo->yres = var->xres; - dinfo->pixclock = var->pixclock; - - dinfo->info->fix.visual = dinfo->visual; - dinfo->info->fix.line_length = dinfo->pitch; - -switch (dinfo->bpp) { -case 8 : - dinfo->visual =FB_VISUAL_PSEUDOCOLOR ; - dinfo->pitch = var->xres_virtual; -break ; -case 16 : - dinfo->visual =FB_VISUAL_TRUECOLOR ; - dinfo->pitch = var->xres_virtual *2 ; -break ; -case 32 : - dinfo->visual =FB_VISUAL_TRUECOLOR ; - dinfo->pitch = var->xres_virtual *4 ; -break ; - } - -/* Make sure the line length is a aligned correctly. */ -if (IS_I9XX (dinfo)) - dinfo->pitch =ROUND_UP_TO (dinfo->pitch,STRIDE_ALIGNMENT_I9XX ); -else - dinfo->pitch =ROUND_UP_TO (dinfo->pitch,STRIDE_ALIGNMENT ); - -if (FIXED_MODE (dinfo)) - dinfo->pitch = dinfo->initial_pitch; - - dinfo->info->screen_base = (char __iomem *)dinfo->fb.virtual; - dinfo->info->fix.line_length = dinfo->pitch; - dinfo->info->fix.visual = dinfo->visual; -} - -/* fbops functions */ - -/*************************************************************** -* fbdev interface * -***************************************************************/ - -static int intelfb_open (struct fb_info *info,int user) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -if (user) - dinfo->open++; - -return 0 ; -} - -static int intelfb_release (struct fb_info *info,int user) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -if (user) { - dinfo->open--; -msleep (1 ); -if (!dinfo->open) -intelfbhw_disable_irq (dinfo); - } - -return 0 ; -} - -static int intelfb_check_var (struct fb_var_screeninfo *var, -struct fb_info *info) -{ -int change_var =0 ; -struct fb_var_screeninfo v; -struct intelfb_info *dinfo; -static int first =1 ; -int i; -/* Good pitches to allow tiling. Don't care about pitches < 1024. */ -static const int pitches[] = { -128 *8 , -128 *16 , -128 *32 , -128 *64 , -0 - }; - -DBG_MSG ("intelfb_check_var: accel_flags is %d\n" , var->accel_flags); - - dinfo =GET_DINFO (info); - -if (!var->pixclock) -return -EINVAL ; - -/* update the pitch */ -if (intelfbhw_validate_mode (dinfo, var) !=0 ) -return -EINVAL ; - - v = *var; - -for (i =0 ; pitches[i] !=0 ; i++) { -if (pitches[i] >= v.xres_virtual) { - v.xres_virtual = pitches[i]; -break ; - } - } - -/* Check for a supported bpp. */ -if (v.bits_per_pixel <=8 ) - v.bits_per_pixel =8 ; -else if (v.bits_per_pixel <=16 ) { -if (v.bits_per_pixel ==16 ) - v.green.length =6 ; - v.bits_per_pixel =16 ; - }else if (v.bits_per_pixel <=32 ) - v.bits_per_pixel =32 ; -else -return -EINVAL ; - - change_var = ((info->var.xres != var->xres) || - (info->var.yres != var->yres) || - (info->var.xres_virtual != var->xres_virtual) || - (info->var.yres_virtual != var->yres_virtual) || - (info->var.bits_per_pixel != var->bits_per_pixel) || -memcmp (&info->var.red, &var->red,sizeof (var->red)) || -memcmp (&info->var.green, &var->green, -sizeof (var->green)) || -memcmp (&info->var.blue, &var->blue,sizeof (var->blue))); - -if (FIXED_MODE (dinfo) && - (change_var || - var->yres_virtual > dinfo->initial_var.yres_virtual || - var->yres_virtual < dinfo->initial_var.yres || - var->xoffset || var->nonstd)) { -if (first) { -ERR_MSG ("Changing the video mode is not supported.\n" ); - first =0 ; - } -return -EINVAL ; - } - -switch (intelfb_var_to_depth (&v)) { -case 8 : - v.red.offset = v.green.offset = v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =8 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 15 : - v.red.offset =10 ; - v.green.offset =5 ; - v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =5 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 16 : - v.red.offset =11 ; - v.green.offset =5 ; - v.blue.offset =0 ; - v.red.length =5 ; - v.green.length =6 ; - v.blue.length =5 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 24 : - v.red.offset =16 ; - v.green.offset =8 ; - v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =8 ; - v.transp.offset = v.transp.length =0 ; -break ; -case 32 : - v.red.offset =16 ; - v.green.offset =8 ; - v.blue.offset =0 ; - v.red.length = v.green.length = v.blue.length =8 ; - v.transp.offset =24 ; - v.transp.length =8 ; -break ; - } - -if (v.xoffset > v.xres_virtual - v.xres) - v.xoffset = v.xres_virtual - v.xres; -if (v.yoffset > v.yres_virtual - v.yres) - v.yoffset = v.yres_virtual - v.yres; - - v.red.msb_right = v.green.msb_right = v.blue.msb_right = - v.transp.msb_right =0 ; - - *var = v; - -return 0 ; -} - -static int intelfb_set_par (struct fb_info *info) -{ -struct intelfb_hwstate *hw; -struct intelfb_info *dinfo =GET_DINFO (info); - -if (FIXED_MODE (dinfo)) { -ERR_MSG ("Changing the video mode is not supported.\n" ); -return -EINVAL ; - } - - hw =kmalloc (sizeof (*hw),GFP_ATOMIC ); -if (!hw) -return -ENOMEM ; - -DBG_MSG ("intelfb_set_par (%dx%d-%d)\n" , info->var.xres, - info->var.yres, info->var.bits_per_pixel); - -/* -* Disable VCO prior to timing register change. -*/ -OUTREG (DPLL_A ,INREG (DPLL_A ) & ~DPLL_VCO_ENABLE ); - -intelfb_blank (FB_BLANK_POWERDOWN , info); - -if (ACCEL (dinfo, info)) -intelfbhw_2d_stop (dinfo); - -memcpy (hw, &dinfo->save_state,sizeof (*hw)); -if (intelfbhw_mode_to_hw (dinfo, hw, &info->var)) - goto invalid_mode; -if (intelfbhw_program_mode (dinfo, hw,0 )) - goto invalid_mode; - -#if REGDUMP >0 -intelfbhw_read_hw_state (dinfo, hw,0 ); -intelfbhw_print_hw_state (dinfo, hw); -#endif - -update_dinfo (dinfo, &info->var); - -if (ACCEL (dinfo, info)) -intelfbhw_2d_start (dinfo); - -intelfb_pan_display (&info->var, info); - -intelfb_blank (FB_BLANK_UNBLANK , info); - -if (ACCEL (dinfo, info)) { - info->flags =FBINFO_HWACCEL_YPAN | -FBINFO_HWACCEL_COPYAREA |FBINFO_HWACCEL_FILLRECT | -FBINFO_HWACCEL_IMAGEBLIT ; - }else - info->flags =FBINFO_HWACCEL_YPAN ; - -kfree (hw); -return 0 ; -invalid_mode: -kfree (hw); -return -EINVAL ; -} - -static int intelfb_setcolreg (unsigned regno,unsigned red,unsigned green, -unsigned blue,unsigned transp, -struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -#if VERBOSE >0 -DBG_MSG ("intelfb_setcolreg: regno %d, depth %d\n" , regno, dinfo->depth); -#endif - -if (regno >255 ) -return 1 ; - -if (dinfo->depth ==8 ) { - red >>=8 ; - green >>=8 ; - blue >>=8 ; - -intelfbhw_setcolreg (dinfo, regno, red, green, blue, - transp); - } - -if (regno <16 ) { -switch (dinfo->depth) { -case 15 : - dinfo->pseudo_palette[regno] = ((red &0xf800 ) >>1 ) | - ((green &0xf800 ) >>6 ) | - ((blue &0xf800 ) >>11 ); -break ; -case 16 : - dinfo->pseudo_palette[regno] = (red &0xf800 ) | - ((green &0xfc00 ) >>5 ) | - ((blue &0xf800 ) >>11 ); -break ; -case 24 : - dinfo->pseudo_palette[regno] = ((red &0xff00 ) <<8 ) | - (green &0xff00 ) | - ((blue &0xff00 ) >>8 ); -break ; - } - } - -return 0 ; -} - -static int intelfb_blank (int blank,struct fb_info *info) -{ -intelfbhw_do_blank (blank, info); -return 0 ; -} - -static int intelfb_pan_display (struct fb_var_screeninfo *var, -struct fb_info *info) -{ -intelfbhw_pan_display (var, info); -return 0 ; -} - -/* When/if we have our own ioctls. */ -static int intelfb_ioctl (struct fb_info *info,unsigned int cmd, -unsigned long arg) -{ -int retval =0 ; -struct intelfb_info *dinfo =GET_DINFO (info); -u32 pipe =0 ; - -switch (cmd) { -case FBIO_WAITFORVSYNC : -if (get_user (pipe, (__u32 __user *)arg)) -return -EFAULT ; - - retval =intelfbhw_wait_for_vsync (dinfo, pipe); -break ; -default : -break ; - } - -return retval; -} - -static void intelfb_fillrect (struct fb_info *info, -const struct fb_fillrect *rect) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 rop, color; - -#if VERBOSE >0 -DBG_MSG ("intelfb_fillrect\n" ); -#endif - -if (!ACCEL (dinfo, info) || dinfo->depth ==4 ) { -cfb_fillrect (info, rect); -return ; - } - -if (rect->rop ==ROP_COPY ) - rop =PAT_ROP_GXCOPY ; -else /* ROP_XOR */ - rop =PAT_ROP_GXXOR ; - -if (dinfo->depth !=8 ) - color = dinfo->pseudo_palette[rect->color]; -else - color = rect->color; - -intelfbhw_do_fillrect (dinfo, rect->dx, rect->dy, - rect->width, rect->height, color, - dinfo->pitch, info->var.bits_per_pixel, - rop); -} - -static void intelfb_copyarea (struct fb_info *info, -const struct fb_copyarea *region) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -#if VERBOSE >0 -DBG_MSG ("intelfb_copyarea\n" ); -#endif - -if (!ACCEL (dinfo, info) || dinfo->depth ==4 ) { -cfb_copyarea (info, region); -return ; - } - -intelfbhw_do_bitblt (dinfo, region->sx, region->sy, region->dx, - region->dy, region->width, region->height, - dinfo->pitch, info->var.bits_per_pixel); -} - -static void intelfb_imageblit (struct fb_info *info, -const struct fb_image *image) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 fgcolor, bgcolor; - -#if VERBOSE >0 -DBG_MSG ("intelfb_imageblit\n" ); -#endif - -if (!ACCEL (dinfo, info) || dinfo->depth ==4 - || image->depth !=1 ) { -cfb_imageblit (info, image); -return ; - } - -if (dinfo->depth !=8 ) { - fgcolor = dinfo->pseudo_palette[image->fg_color]; - bgcolor = dinfo->pseudo_palette[image->bg_color]; - }else { - fgcolor = image->fg_color; - bgcolor = image->bg_color; - } - -if (!intelfbhw_do_drawglyph (dinfo, fgcolor, bgcolor, image->width, - image->height, image->data, - image->dx, image->dy, - dinfo->pitch, info->var.bits_per_pixel)) { -cfb_imageblit (info, image); -return ; - } -} - -static int intelfb_cursor (struct fb_info *info,struct fb_cursor *cursor) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 physical; -#if VERBOSE >0 -DBG_MSG ("intelfb_cursor\n" ); -#endif - -if (!dinfo->hwcursor) -return -ENODEV ; - -intelfbhw_cursor_hide (dinfo); - -/* If XFree killed the cursor - restore it */ - physical = (dinfo->mobile ||IS_I9XX (dinfo)) ? dinfo->cursor.physical : - (dinfo->cursor.offset <<12 ); - -if (INREG (CURSOR_A_BASEADDR ) != physical) { -u32 fg, bg; - -DBG_MSG ("the cursor was killed - restore it !!\n" ); -DBG_MSG ("size %d, %d pos %d, %d\n" , - cursor->image.width, cursor->image.height, - cursor->image.dx, cursor->image.dy); - -intelfbhw_cursor_init (dinfo); -intelfbhw_cursor_reset (dinfo); -intelfbhw_cursor_setpos (dinfo, cursor->image.dx, - cursor->image.dy); - -if (dinfo->depth !=8 ) { - fg =dinfo->pseudo_palette[cursor->image.fg_color]; - bg =dinfo->pseudo_palette[cursor->image.bg_color]; - }else { - fg = cursor->image.fg_color; - bg = cursor->image.bg_color; - } -intelfbhw_cursor_setcolor (dinfo, bg, fg); -intelfbhw_cursor_load (dinfo, cursor->image.width, - cursor->image.height, - dinfo->cursor_src); - -if (cursor->enable) -intelfbhw_cursor_show (dinfo); -return 0 ; - } - -if (cursor->set &FB_CUR_SETPOS ) { -u32 dx, dy; - - dx = cursor->image.dx - info->var.xoffset; - dy = cursor->image.dy - info->var.yoffset; - -intelfbhw_cursor_setpos (dinfo, dx, dy); - } - -if (cursor->set &FB_CUR_SETSIZE ) { -if (cursor->image.width >64 || cursor->image.height >64 ) -return -ENXIO ; - -intelfbhw_cursor_reset (dinfo); - } - -if (cursor->set &FB_CUR_SETCMAP ) { -u32 fg, bg; - -if (dinfo->depth !=8 ) { - fg = dinfo->pseudo_palette[cursor->image.fg_color]; - bg = dinfo->pseudo_palette[cursor->image.bg_color]; - }else { - fg = cursor->image.fg_color; - bg = cursor->image.bg_color; - } - -intelfbhw_cursor_setcolor (dinfo, bg, fg); - } - -if (cursor->set & (FB_CUR_SETSHAPE |FB_CUR_SETIMAGE )) { -u32 s_pitch = (ROUND_UP_TO (cursor->image.width,8 ) /8 ); -u32 size = s_pitch * cursor->image.height; -u8 *dat = (u8 *) cursor->image.data; -u8 *msk = (u8 *) cursor->mask; -u8 src[64 ]; -u32 i; - -if (cursor->image.depth !=1 ) -return -ENXIO ; - -switch (cursor->rop) { -case ROP_XOR : -for (i =0 ; i < size; i++) - src[i] = dat[i] ^ msk[i]; -break ; -case ROP_COPY : -default : -for (i =0 ; i < size; i++) - src[i] = dat[i] & msk[i]; -break ; - } - -/* save the bitmap to restore it when XFree will -make the cursor dirty */ -memcpy (dinfo->cursor_src, src, size); - -intelfbhw_cursor_load (dinfo, cursor->image.width, - cursor->image.height, src); - } - -if (cursor->enable) -intelfbhw_cursor_show (dinfo); - -return 0 ; -} - -static int intelfb_sync (struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); - -#if VERBOSE >0 -DBG_MSG ("intelfb_sync\n" ); -#endif - -if (dinfo->ring_lockup) -return 0 ; - -intelfbhw_do_sync (dinfo); -return 0 ; -} -drivers/video/fbdev/intelfb/intelfbhw.c deleted +0
-2115@@ -1,2115 +0,0 @@ -/* -* intelfb -* -* Linux framebuffer driver for Intel(R) 865G integrated graphics chips. -* -* Copyright © 2002, 2003 David Dawes <[email protected]> -* 2004 Sylvain Meyer -* -* This driver consists of two parts. The first part (intelfbdrv.c) provides -* the basic fbdev interfaces, is derived in part from the radeonfb and -* vesafb drivers, and is covered by the GPL. The second part (intelfbhw.c) -* provides the code to program the hardware. Most of it is derived from -* the i810/i830 XFree86 driver. The HW-specific code is covered here -* under a dual license (GPL and MIT/XFree86 license). -* -* Author: David Dawes -* -*/ - -/* $DHD: intelfb/intelfbhw.c,v 1.9 2003/06/27 15:06:25 dawes Exp $ */ - -#include <linux/module.h> -#include <linux/kernel.h> -#include <linux/errno.h> -#include <linux/string.h> -#include <linux/mm.h> -#include <linux/delay.h> -#include <linux/fb.h> -#include <linux/ioport.h> -#include <linux/init.h> -#include <linux/pci.h> -#include <linux/vmalloc.h> -#include <linux/pagemap.h> -#include <linux/interrupt.h> - -#include <asm/io.h> - -#include "intelfb.h" -#include "intelfbhw.h" - -struct pll_min_max { -int min_m, max_m, min_m1, max_m1; -int min_m2, max_m2, min_n, max_n; -int min_p, max_p, min_p1, max_p1; -int min_vco, max_vco, p_transition_clk, ref_clk; -int p_inc_lo, p_inc_hi; -}; - -#define PLLS_I8xx 0 -#define PLLS_I9xx 1 -#define PLLS_MAX 2 - -static struct pll_min_max plls[PLLS_MAX ] = { - {108 ,140 ,18 ,26 , -6 ,16 ,3 ,16 , -4 ,128 ,0 ,31 , -930000 ,1400000 ,165000 ,48000 , -4 ,2 },/* I8xx */ - - {75 ,120 ,10 ,20 , -5 ,9 ,4 ,7 , -5 ,80 ,1 ,8 , -1400000 ,2800000 ,200000 ,96000 , -10 ,5 }/* I9xx */ -}; - -int intelfbhw_get_chipset (struct pci_dev *pdev,struct intelfb_info *dinfo) -{ -u32 tmp; -if (!pdev || !dinfo) -return 1 ; - -switch (pdev->device) { -case PCI_DEVICE_ID_INTEL_830M : - dinfo->name ="Intel(R) 830M" ; - dinfo->chipset =INTEL_830M ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I8xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_845G : - dinfo->name ="Intel(R) 845G" ; - dinfo->chipset =INTEL_845G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I8xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_854 : - dinfo->mobile =1 ; - dinfo->name ="Intel(R) 854" ; - dinfo->chipset =INTEL_854 ; -return 0 ; -case PCI_DEVICE_ID_INTEL_85XGM : - tmp =0 ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I8xx; -pci_read_config_dword (pdev,INTEL_85X_CAPID , &tmp); -switch ((tmp >>INTEL_85X_VARIANT_SHIFT ) & -INTEL_85X_VARIANT_MASK ) { -case INTEL_VAR_855GME : - dinfo->name ="Intel(R) 855GME" ; - dinfo->chipset =INTEL_855GME ; -return 0 ; -case INTEL_VAR_855GM : - dinfo->name ="Intel(R) 855GM" ; - dinfo->chipset =INTEL_855GM ; -return 0 ; -case INTEL_VAR_852GME : - dinfo->name ="Intel(R) 852GME" ; - dinfo->chipset =INTEL_852GME ; -return 0 ; -case INTEL_VAR_852GM : - dinfo->name ="Intel(R) 852GM" ; - dinfo->chipset =INTEL_852GM ; -return 0 ; -default : - dinfo->name ="Intel(R) 852GM/855GM" ; - dinfo->chipset =INTEL_85XGM ; -return 0 ; - } -break ; -case PCI_DEVICE_ID_INTEL_865G : - dinfo->name ="Intel(R) 865G" ; - dinfo->chipset =INTEL_865G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I8xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_915G : - dinfo->name ="Intel(R) 915G" ; - dinfo->chipset =INTEL_915G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_915GM : - dinfo->name ="Intel(R) 915GM" ; - dinfo->chipset =INTEL_915GM ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_945G : - dinfo->name ="Intel(R) 945G" ; - dinfo->chipset =INTEL_945G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_945GM : - dinfo->name ="Intel(R) 945GM" ; - dinfo->chipset =INTEL_945GM ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_945GME : - dinfo->name ="Intel(R) 945GME" ; - dinfo->chipset =INTEL_945GME ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_965G : - dinfo->name ="Intel(R) 965G" ; - dinfo->chipset =INTEL_965G ; - dinfo->mobile =0 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -case PCI_DEVICE_ID_INTEL_965GM : - dinfo->name ="Intel(R) 965GM" ; - dinfo->chipset =INTEL_965GM ; - dinfo->mobile =1 ; - dinfo->pll_index = PLLS_I9xx; -return 0 ; -default : -return 1 ; - } -} - -int intelfbhw_get_memory (struct pci_dev *pdev,int *aperture_size, -int *stolen_size) -{ -struct pci_dev *bridge_dev; -u16 tmp; -int stolen_overhead; - -if (!pdev || !aperture_size || !stolen_size) -return 1 ; - -/* Find the bridge device. It is always 0:0.0 */ - bridge_dev =pci_get_domain_bus_and_slot (pci_domain_nr (pdev->bus),0 , -PCI_DEVFN (0 ,0 )); -if (!bridge_dev) { -ERR_MSG ("cannot find bridge device\n" ); -return 1 ; - } - -/* Get the fb aperture size and "stolen" memory amount. */ - tmp =0 ; -pci_read_config_word (bridge_dev,INTEL_GMCH_CTRL , &tmp); -pci_dev_put (bridge_dev); - -switch (pdev->device) { -case PCI_DEVICE_ID_INTEL_915G : -case PCI_DEVICE_ID_INTEL_915GM : -case PCI_DEVICE_ID_INTEL_945G : -case PCI_DEVICE_ID_INTEL_945GM : -case PCI_DEVICE_ID_INTEL_945GME : -case PCI_DEVICE_ID_INTEL_965G : -case PCI_DEVICE_ID_INTEL_965GM : -/* -* 915, 945 and 965 chipsets support 64MB, 128MB or 256MB -* aperture. Determine size from PCI resource length. -*/ - *aperture_size =pci_resource_len (pdev,2 ); -break ; -default : -if ((tmp &INTEL_GMCH_MEM_MASK ) ==INTEL_GMCH_MEM_64M ) - *aperture_size =MB (64 ); -else - *aperture_size =MB (128 ); -break ; - } - -/* Stolen memory size is reduced by the GTT and the popup. -GTT is 1K per MB of aperture size, and popup is 4K. */ - stolen_overhead = (*aperture_size /MB (1 )) +4 ; -switch (pdev->device) { -case PCI_DEVICE_ID_INTEL_830M : -case PCI_DEVICE_ID_INTEL_845G : -switch (tmp &INTEL_830_GMCH_GMS_MASK ) { -case INTEL_830_GMCH_GMS_STOLEN_512 : - *stolen_size =KB (512 ) -KB (stolen_overhead); -return 0 ; -case INTEL_830_GMCH_GMS_STOLEN_1024 : - *stolen_size =MB (1 ) -KB (stolen_overhead); -return 0 ; -case INTEL_830_GMCH_GMS_STOLEN_8192 : - *stolen_size =MB (8 ) -KB (stolen_overhead); -return 0 ; -case INTEL_830_GMCH_GMS_LOCAL : -ERR_MSG ("only local memory found\n" ); -return 1 ; -case INTEL_830_GMCH_GMS_DISABLED : -ERR_MSG ("video memory is disabled\n" ); -return 1 ; -default : -ERR_MSG ("unexpected GMCH_GMS value: 0x%02x\n" , - tmp &INTEL_830_GMCH_GMS_MASK ); -return 1 ; - } -break ; -default : -switch (tmp &INTEL_855_GMCH_GMS_MASK ) { -case INTEL_855_GMCH_GMS_STOLEN_1M : - *stolen_size =MB (1 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_4M : - *stolen_size =MB (4 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_8M : - *stolen_size =MB (8 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_16M : - *stolen_size =MB (16 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_STOLEN_32M : - *stolen_size =MB (32 ) -KB (stolen_overhead); -return 0 ; -case INTEL_915G_GMCH_GMS_STOLEN_48M : - *stolen_size =MB (48 ) -KB (stolen_overhead); -return 0 ; -case INTEL_915G_GMCH_GMS_STOLEN_64M : - *stolen_size =MB (64 ) -KB (stolen_overhead); -return 0 ; -case INTEL_855_GMCH_GMS_DISABLED : -ERR_MSG ("video memory is disabled\n" ); -return 0 ; -default : -ERR_MSG ("unexpected GMCH_GMS value: 0x%02x\n" , - tmp &INTEL_855_GMCH_GMS_MASK ); -return 1 ; - } - } -} - -int intelfbhw_check_non_crt (struct intelfb_info *dinfo) -{ -int dvo =0 ; - -if (INREG (LVDS ) &PORT_ENABLE ) - dvo |=LVDS_PORT ; -if (INREG (DVOA ) &PORT_ENABLE ) - dvo |=DVOA_PORT ; -if (INREG (DVOB ) &PORT_ENABLE ) - dvo |=DVOB_PORT ; -if (INREG (DVOC ) &PORT_ENABLE ) - dvo |=DVOC_PORT ; - -return dvo; -} - -const char *intelfbhw_dvo_to_string (int dvo) -{ -if (dvo &DVOA_PORT ) -return "DVO port A" ; -else if (dvo &DVOB_PORT ) -return "DVO port B" ; -else if (dvo &DVOC_PORT ) -return "DVO port C" ; -else if (dvo &LVDS_PORT ) -return "LVDS port" ; -else -return NULL ; -} - - -int intelfbhw_validate_mode (struct intelfb_info *dinfo, -struct fb_var_screeninfo *var) -{ -int bytes_per_pixel; -int tmp; - -#if VERBOSE >0 -DBG_MSG ("intelfbhw_validate_mode\n" ); -#endif - - bytes_per_pixel = var->bits_per_pixel /8 ; -if (bytes_per_pixel ==3 ) - bytes_per_pixel =4 ; - -/* Check if enough video memory. */ - tmp = var->yres_virtual * var->xres_virtual * bytes_per_pixel; -if (tmp > dinfo->fb.size) { -WRN_MSG ("Not enough video ram for mode " -"(%d KByte vs %d KByte).\n" , -BtoKB (tmp),BtoKB (dinfo->fb.size)); -return 1 ; - } - -/* Check if x/y limits are OK. */ -if (var->xres -1 >HACTIVE_MASK ) { -WRN_MSG ("X resolution too large (%d vs %d).\n" , - var->xres,HACTIVE_MASK +1 ); -return 1 ; - } -if (var->yres -1 >VACTIVE_MASK ) { -WRN_MSG ("Y resolution too large (%d vs %d).\n" , - var->yres,VACTIVE_MASK +1 ); -return 1 ; - } -if (var->xres <4 ) { -WRN_MSG ("X resolution too small (%d vs 4).\n" , var->xres); -return 1 ; - } -if (var->yres <4 ) { -WRN_MSG ("Y resolution too small (%d vs 4).\n" , var->yres); -return 1 ; - } - -/* Check for doublescan modes. */ -if (var->vmode &FB_VMODE_DOUBLE ) { -WRN_MSG ("Mode is double-scan.\n" ); -return 1 ; - } - -if ((var->vmode &FB_VMODE_INTERLACED ) && (var->yres &1 )) { -WRN_MSG ("Odd number of lines in interlaced mode\n" ); -return 1 ; - } - -/* Check if clock is OK. */ - tmp =1000000000 / var->pixclock; -if (tmp <MIN_CLOCK ) { -WRN_MSG ("Pixel clock is too low (%d MHz vs %d MHz).\n" , - (tmp +500 ) /1000 ,MIN_CLOCK /1000 ); -return 1 ; - } -if (tmp >MAX_CLOCK ) { -WRN_MSG ("Pixel clock is too high (%d MHz vs %d MHz).\n" , - (tmp +500 ) /1000 ,MAX_CLOCK /1000 ); -return 1 ; - } - -return 0 ; -} - -int intelfbhw_pan_display (struct fb_var_screeninfo *var,struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 offset, xoffset, yoffset; - -#if VERBOSE >0 -DBG_MSG ("intelfbhw_pan_display\n" ); -#endif - - xoffset =ROUND_DOWN_TO (var->xoffset,8 ); - yoffset = var->yoffset; - -if ((xoffset + info->var.xres > info->var.xres_virtual) || - (yoffset + info->var.yres > info->var.yres_virtual)) -return -EINVAL ; - - offset = (yoffset * dinfo->pitch) + - (xoffset * info->var.bits_per_pixel) /8 ; - - offset += dinfo->fb.offset <<12 ; - - dinfo->vsync.pan_offset = offset; -if ((var->activate &FB_ACTIVATE_VBL ) && - !intelfbhw_enable_irq (dinfo)) - dinfo->vsync.pan_display =1 ; -else { - dinfo->vsync.pan_display =0 ; -OUTREG (DSPABASE , offset); - } - -return 0 ; -} - -/* Blank the screen. */ -void intelfbhw_do_blank (int blank,struct fb_info *info) -{ -struct intelfb_info *dinfo =GET_DINFO (info); -u32 tmp; - -#if VERBOSE >0 -DBG_MSG ("intelfbhw_do_blank: blank is %d\n" , blank); -#endif - -/* Turn plane A on or off */ - tmp =INREG (DSPACNTR ); -if (blank) - tmp &= ~DISPPLANE_PLANE_ENABLE ; -else - tmp |=DISPPLANE_PLANE_ENABLE ; -OUTREG (DSPACNTR , tmp); -/* Flush */ - tmp =INREG (DSPABASE ); -OUTREG (DSPABASE , tmp); - -/* Turn off/on the HW cursor */ -#if VERBOSE >0 -DBG_MSG ("cursor_on is %d\n" , dinfo->cursor_on); -#endif -if (dinfo->cursor_on) { -if (blank) -intelfbhw_cursor_hide (dinfo); -else -intelfbhw_cursor_show (dinfo); - dinfo->cursor_on =1 ; - } - dinfo->cursor_blanked = blank; - -/* Set DPMS level */ - tmp =INREG (ADPA ) & ~ADPA_DPMS_CONTROL_MASK ; -switch (blank) { -case FB_BLANK_UNBLANK : -case FB_BLANK_NORMAL : - tmp |=ADPA_DPMS_D0 ; -break ; -case FB_BLANK_VSYNC_SUSPEND : - tmp |=ADPA_DPMS_D1 ; -break ; -case FB_BLANK_HSYNC_SUSPEND : - tmp |=ADPA_DPMS_D2 ; -break ; -case FB_BLANK_POWERDOWN : - tmp |=ADPA_DPMS_D3 ; -break ; - } -OUTREG (ADPA , tmp); - -return ; -} - - -/* Check which pipe is connected to an active display plane. */ -int intelfbhw_active_pipe (const struct intelfb_hwstate *hw) -{ -int pipe =-1 ; - -/* keep old default behaviour - prefer PIPE_A */ -if (hw->disp_b_ctrl &DISPPLANE_PLANE_ENABLE ) { - pipe = (hw->disp_b_ctrl >>DISPPLANE_SEL_PIPE_SHIFT ); - pipe &=PIPE_MASK ; -if (unlikely (pipe ==PIPE_A )) -return PIPE_A ; - } -if (hw->disp_a_ctrl &DISPPLANE_PLANE_ENABLE ) { - pipe = (hw->disp_a_ctrl >>DISPPLANE_SEL_PIPE_SHIFT );Lines of this file are not shown. View the raw message.
drivers/video/fbdev/intelfb/intelfbhw.h deleted +0
-609Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.43.0--Maik
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg)
Part of the diff is not shown here. View the raw message.
Quoted 27 lines · Thomas Zimmermann
From looking at the PCI IDs, every device supported by intelfb is
also supported by i915. Anyone still using intelfb should please move on to i915, which does everything intelfb does but better.Removing intelfb is motivated by the driver's excessive use of the global
screen_infostate. The state belongs to architecture and firmware code; device drivers should not attempt to access it. But fixing intelfb would require a significant change in the driver's probing logic. As intelfb has been obsolete for nearly 2 decades, it is probably not worth the effort. Let's just remove it. Also remove the related documentation.Signed-off-by Thomas Zimmermann <[email protected]>--- Documentation/fb/index.rst | 1 - Documentation/fb/intelfb.rst | 155 -- .../userspace-api/ioctl/ioctl-number.rst | 1 - MAINTAINERS | 7 - drivers/Makefile | 3 +- drivers/video/fbdev/Kconfig | 39 - drivers/video/fbdev/intelfb/Makefile | 8 - drivers/video/fbdev/intelfb/intelfb.h | 382 --- drivers/video/fbdev/intelfb/intelfb_i2c.c | 209 -- drivers/video/fbdev/intelfb/intelfbdrv.c | 1680 ------------- drivers/video/fbdev/intelfb/intelfbhw.c | 2115 ----------------- drivers/video/fbdev/intelfb/intelfbhw.h | 609 ----- 12 files changed, 1 insertion(+), 5208 deletions(-)
Quoted 7 lines
delete mode 100644
Documentation/fb/intelfb.rstdelete mode 100644drivers/video/fbdev/intelfb/Makefiledelete mode 100644drivers/video/fbdev/intelfb/intelfb.hdelete mode 100644drivers/video/fbdev/intelfb/intelfb_i2c.cdelete mode 100644drivers/video/fbdev/intelfb/intelfbdrv.cdelete mode 100644drivers/video/fbdev/intelfb/intelfbhw.cdelete mode 100644drivers/video/fbdev/intelfb/intelfbhw.h
applied to fbdev git tree.
Thanks!
Helge