mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-15 16:24:13 +08:00
9f68e3655a
uapi: - dma-buf heaps added (and fixed) - command line add support for panel oreientation - command line allow overriding penguin count drm: - mipi dsi definition updates - lockdep annotations for dma_resv - remove dma-buf kmap/kunmap support - constify fb_ops in all fbdev drivers - MST fix for daisy chained hotplug- - CTA-861-G modes with VIC >= 193 added - fix drm_panel_of_backlight export - LVDS decoder support - more device based logging support - scanline alighment for dumb buffers - MST DSC helpers scheduler: - documentation fixes - job distribution improvements panel: - Logic PD type 28 panel support - Jimax8729d MIPI-DSI - igenic JZ4770 - generic DSI devicetree bindings - sony acx424AKP panel - Leadtek LTK500HD1829 - xinpeng XPP055C272 - AUO B116XAK01 - GiantPlus GPM940B0 - BOE NV140FHM-N49 - Satoz SAT050AT40H12R2 - Sharp LS020B1DD01D panels. ttm: - use blocking WW lock i915: - hw/uapi state separation - Lock annotation improvements - selftest improvements - ICL/TGL DSI VDSC support - VBT parsing improvments - Display refactoring - DSI updates + fixes - HDCP 2.2 for CFL - CML PCI ID fixes - GLK+ fbc fix - PSR fixes - GEN/GT refactor improvments - DP MST fixes - switch context id alloc to xarray - workaround updates - LMEM debugfs support - tiled monitor fixes - ICL+ clock gating programming removed - DP MST disable sequence fixed - LMEM discontiguous object maps - prefaulting for discontiguous objects - use LMEM for dumb buffers if possible - add LMEM mmap support amdgpu: - enable sync object timelines for vulkan - MST atomic routines - enable MST DSC support - add DMCUB display microengine support - DC OEM i2c support - Renoir DC fixes - Initial HDCP 2.x support - BACO support for Arcturus - Use BACO for runtime PM power save - gfxoff on navi10 - gfx10 golden updates and fixes - DCN support on POWER - GFXOFF for raven1 refresh - MM engine idle handlers cleanup - 10bpc EDP panel fixes - renoir watermark fixes - SR-IOV fixes - Arcturus VCN fixes - GDDR6 training fixes - freesync fixes - Pollock support amdkfd: - unify more codepath with amdgpu - use KIQ to setup HIQ rather than MMIO radeon: - fix vma fault handler race - PPC DMA fix - register check fixes for r100/r200 nouveau: - mmap_sem vs dma_resv fix - rewrite the ACR secure boot code for Turing - TU10x graphics engine support (TU11x pending) - Page kind mapping for turing - 10-bit LUT support - GP10B Tegra fixes - HD audio regression fix hisilicon/hibmc: - use generic fbdev code and helpers rockchip: - dsi/px30 support virtio: - fb damage support - static some functions vc4: - use dma_resv lock wrappers msm: - use dma_resv lock wrappers - sc7180 display + DSI support - a618 support - UBWC support improvements vmwgfx: - updates + new logging uapi exynos: - enable/disable callback cleanups etnaviv: - use dma_resv lock wrappers atmel-hlcdc: - clock fixes mediatek: - cmdq support - non-smooth cursor fixes - ctm property support sun4i: - suspend support - A64 mipi dsi support rcar-du: - Color management module support - LVDS encoder dual-link support - R8A77980 support analogic: - add support for an6345 ast: - atomic modeset support - primary plane garbage fix arcgpu: - fixes for fourcc handling tegra: - minor fixes and improvments mcde: - vblank support meson: - OSD1 plane AFBC commit gma500: - add pageflip support - reomve global drm_dev komeda: - tweak debugfs output - d32 support - runtime PM suppotr udl: - use generic shmem helpers - cleanup and fixes -----BEGIN PGP SIGNATURE----- iQIcBAABAgAGBQJeMm6RAAoJEAx081l5xIa+vN8P/0j4jEOv+KIinAhoH+LG3EpD m2TUuu5OQIoBrcCoWOgFBk3wqYpw6PdMBdkXh+5sE5lfeBynp8oC3Bin+QsHJE05 eGBpZtHe+70MQb0Eha+Aic0hchvBKzRnq6i0MYSIHn6afs76dLmF8knTjycxrvV5 Xu1Z3WDmjzqgWF9ja5JCD6fby11seP5RrwObYKVikO35QQyJJwGSGKgu5rq/pByK /n0PCnCOINuL0Lz6J9qexdh/0/XYFQilRC31GJNlKbDSFuECF0GOEzEE/xUBW/pI dLh2YwIIygm18Gar9PgvMwXJn3BfzQ0qEJsf+HlQeNw9iLgbHpp2AsTxHTE87OGe R/y85taW3jGjPsNOKZOeLpvg/Ro8l8ZipLApvDCG2O22DThg/cd6NDjZxl1FJfRH acDG/JdgPo5MbdRAH/cM1WuFS9gEM+0BeSQ5gCjtPakF+X4Vz+ABFDLMRJoaejkJ q8DG32TQXELQx0RMghsqK7YCWGfl+2alA1u9w6TgJh9Rq4iVckvpDeqAZnK1Adkc 87g957Tl0n6FA4wJj/t5jrceiLRMJAm/rBK+R3GZNfWrgx4bHbCmb4fZDZsrFzph nbAjNJ5kOchrFCaRR47ULby6+Q14MAFbkWq4Crfu4YDdzUkTPpep6pi2GIe8w0rV P0hdYOYJf6LUda0utuQX =oFrI -----END PGP SIGNATURE----- Merge tag 'drm-next-2020-01-30' of git://anongit.freedesktop.org/drm/drm Pull drm updates from Davbe Airlie: "This is the main pull request for graphics for 5.6. Usual selection of changes all over. I've got one outstanding vmwgfx pull that touches mm so kept it separate until after all of this lands. I'll try and get it to you soon after this, but it might be early next week (nothing wrong with code, just my schedule is messy) This also hits a lot of fbdev drivers with some cleanups. Other notables: - vulkan timeline semaphore support added to syncobjs - nouveau turing secureboot/graphics support - Displayport MST display stream compression support Detailed summary: uapi: - dma-buf heaps added (and fixed) - command line add support for panel oreientation - command line allow overriding penguin count drm: - mipi dsi definition updates - lockdep annotations for dma_resv - remove dma-buf kmap/kunmap support - constify fb_ops in all fbdev drivers - MST fix for daisy chained hotplug- - CTA-861-G modes with VIC >= 193 added - fix drm_panel_of_backlight export - LVDS decoder support - more device based logging support - scanline alighment for dumb buffers - MST DSC helpers scheduler: - documentation fixes - job distribution improvements panel: - Logic PD type 28 panel support - Jimax8729d MIPI-DSI - igenic JZ4770 - generic DSI devicetree bindings - sony acx424AKP panel - Leadtek LTK500HD1829 - xinpeng XPP055C272 - AUO B116XAK01 - GiantPlus GPM940B0 - BOE NV140FHM-N49 - Satoz SAT050AT40H12R2 - Sharp LS020B1DD01D panels. ttm: - use blocking WW lock i915: - hw/uapi state separation - Lock annotation improvements - selftest improvements - ICL/TGL DSI VDSC support - VBT parsing improvments - Display refactoring - DSI updates + fixes - HDCP 2.2 for CFL - CML PCI ID fixes - GLK+ fbc fix - PSR fixes - GEN/GT refactor improvments - DP MST fixes - switch context id alloc to xarray - workaround updates - LMEM debugfs support - tiled monitor fixes - ICL+ clock gating programming removed - DP MST disable sequence fixed - LMEM discontiguous object maps - prefaulting for discontiguous objects - use LMEM for dumb buffers if possible - add LMEM mmap support amdgpu: - enable sync object timelines for vulkan - MST atomic routines - enable MST DSC support - add DMCUB display microengine support - DC OEM i2c support - Renoir DC fixes - Initial HDCP 2.x support - BACO support for Arcturus - Use BACO for runtime PM power save - gfxoff on navi10 - gfx10 golden updates and fixes - DCN support on POWER - GFXOFF for raven1 refresh - MM engine idle handlers cleanup - 10bpc EDP panel fixes - renoir watermark fixes - SR-IOV fixes - Arcturus VCN fixes - GDDR6 training fixes - freesync fixes - Pollock support amdkfd: - unify more codepath with amdgpu - use KIQ to setup HIQ rather than MMIO radeon: - fix vma fault handler race - PPC DMA fix - register check fixes for r100/r200 nouveau: - mmap_sem vs dma_resv fix - rewrite the ACR secure boot code for Turing - TU10x graphics engine support (TU11x pending) - Page kind mapping for turing - 10-bit LUT support - GP10B Tegra fixes - HD audio regression fix hisilicon/hibmc: - use generic fbdev code and helpers rockchip: - dsi/px30 support virtio: - fb damage support - static some functions vc4: - use dma_resv lock wrappers msm: - use dma_resv lock wrappers - sc7180 display + DSI support - a618 support - UBWC support improvements vmwgfx: - updates + new logging uapi exynos: - enable/disable callback cleanups etnaviv: - use dma_resv lock wrappers atmel-hlcdc: - clock fixes mediatek: - cmdq support - non-smooth cursor fixes - ctm property support sun4i: - suspend support - A64 mipi dsi support rcar-du: - Color management module support - LVDS encoder dual-link support - R8A77980 support analogic: - add support for an6345 ast: - atomic modeset support - primary plane garbage fix arcgpu: - fixes for fourcc handling tegra: - minor fixes and improvments mcde: - vblank support meson: - OSD1 plane AFBC commit gma500: - add pageflip support - reomve global drm_dev komeda: - tweak debugfs output - d32 support - runtime PM suppotr udl: - use generic shmem helpers - cleanup and fixes" * tag 'drm-next-2020-01-30' of git://anongit.freedesktop.org/drm/drm: (1998 commits) drm/nouveau/fb/gp102-: allow module to load even when scrubber binary is missing drm/nouveau/acr: return error when registering LSF if ACR not supported drm/nouveau/disp/gv100-: not all channel types support reporting error codes drm/nouveau/disp/nv50-: prevent oops when no channel method map provided drm/nouveau: support synchronous pushbuf submission drm/nouveau: signal pending fences when channel has been killed drm/nouveau: reject attempts to submit to dead channels drm/nouveau: zero vma pointer even if we only unreference it rather than free drm/nouveau: Add HD-audio component notifier support drm/nouveau: fix build error without CONFIG_IOMMU_API drm/nouveau/kms/nv04: remove set but not used variable 'width' drm/nouveau/kms/nv50: remove set but not unused variable 'nv_connector' drm/nouveau/mmu: fix comptag memory leak drm/nouveau/gr/gp10b: Use gp100_grctx and gp100_gr_zbc drm/nouveau/pmu/gm20b,gp10b: Fix Falcon bootstrapping drm/exynos: Rename Exynos to lowercase drm/exynos: change callback names drm/mst: Don't do atomic checks over disabled managers drm/amdgpu: add the lost mutex_init back drm/amd/display: skip opp blank or unblank if test pattern enabled ...
412 lines
10 KiB
C
412 lines
10 KiB
C
/*
|
|
* linux/drivers/video/pmagb-b-fb.c
|
|
*
|
|
* PMAGB-B TURBOchannel Smart Frame Buffer (SFB) card support,
|
|
* derived from:
|
|
* "HP300 Topcat framebuffer support (derived from macfb of all things)
|
|
* Phil Blundell <philb@gnu.org> 1998", the original code can be
|
|
* found in the file hpfb.c in the same directory.
|
|
*
|
|
* DECstation related code Copyright (C) 1999, 2000, 2001 by
|
|
* Michael Engel <engel@unix-ag.org>,
|
|
* Karsten Merker <merker@linuxtag.org> and
|
|
* Harald Koerfgen.
|
|
* Copyright (c) 2005, 2006 Maciej W. Rozycki
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU General
|
|
* Public License. See the file COPYING in the main directory of this
|
|
* archive for more details.
|
|
*/
|
|
|
|
#include <linux/compiler.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/errno.h>
|
|
#include <linux/fb.h>
|
|
#include <linux/init.h>
|
|
#include <linux/kernel.h>
|
|
#include <linux/module.h>
|
|
#include <linux/tc.h>
|
|
#include <linux/types.h>
|
|
|
|
#include <asm/io.h>
|
|
|
|
#include <video/pmagb-b-fb.h>
|
|
|
|
|
|
struct pmagbbfb_par {
|
|
volatile void __iomem *mmio;
|
|
volatile void __iomem *smem;
|
|
volatile u32 __iomem *sfb;
|
|
volatile u32 __iomem *dac;
|
|
unsigned int osc0;
|
|
unsigned int osc1;
|
|
int slot;
|
|
};
|
|
|
|
|
|
static const struct fb_var_screeninfo pmagbbfb_defined = {
|
|
.bits_per_pixel = 8,
|
|
.red.length = 8,
|
|
.green.length = 8,
|
|
.blue.length = 8,
|
|
.activate = FB_ACTIVATE_NOW,
|
|
.height = -1,
|
|
.width = -1,
|
|
.accel_flags = FB_ACCEL_NONE,
|
|
.sync = FB_SYNC_ON_GREEN,
|
|
.vmode = FB_VMODE_NONINTERLACED,
|
|
};
|
|
|
|
static const struct fb_fix_screeninfo pmagbbfb_fix = {
|
|
.id = "PMAGB-BA",
|
|
.smem_len = (2048 * 1024),
|
|
.type = FB_TYPE_PACKED_PIXELS,
|
|
.visual = FB_VISUAL_PSEUDOCOLOR,
|
|
.mmio_len = PMAGB_B_FBMEM,
|
|
};
|
|
|
|
|
|
static inline void sfb_write(struct pmagbbfb_par *par, unsigned int reg, u32 v)
|
|
{
|
|
writel(v, par->sfb + reg / 4);
|
|
}
|
|
|
|
static inline u32 sfb_read(struct pmagbbfb_par *par, unsigned int reg)
|
|
{
|
|
return readl(par->sfb + reg / 4);
|
|
}
|
|
|
|
static inline void dac_write(struct pmagbbfb_par *par, unsigned int reg, u8 v)
|
|
{
|
|
writeb(v, par->dac + reg / 4);
|
|
}
|
|
|
|
static inline u8 dac_read(struct pmagbbfb_par *par, unsigned int reg)
|
|
{
|
|
return readb(par->dac + reg / 4);
|
|
}
|
|
|
|
static inline void gp0_write(struct pmagbbfb_par *par, u32 v)
|
|
{
|
|
writel(v, par->mmio + PMAGB_B_GP0);
|
|
}
|
|
|
|
|
|
/*
|
|
* Set the palette.
|
|
*/
|
|
static int pmagbbfb_setcolreg(unsigned int regno, unsigned int red,
|
|
unsigned int green, unsigned int blue,
|
|
unsigned int transp, struct fb_info *info)
|
|
{
|
|
struct pmagbbfb_par *par = info->par;
|
|
|
|
if (regno >= info->cmap.len)
|
|
return 1;
|
|
|
|
red >>= 8; /* The cmap fields are 16 bits */
|
|
green >>= 8; /* wide, but the hardware colormap */
|
|
blue >>= 8; /* registers are only 8 bits wide */
|
|
|
|
mb();
|
|
dac_write(par, BT459_ADDR_LO, regno);
|
|
dac_write(par, BT459_ADDR_HI, 0x00);
|
|
wmb();
|
|
dac_write(par, BT459_CMAP, red);
|
|
wmb();
|
|
dac_write(par, BT459_CMAP, green);
|
|
wmb();
|
|
dac_write(par, BT459_CMAP, blue);
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct fb_ops pmagbbfb_ops = {
|
|
.owner = THIS_MODULE,
|
|
.fb_setcolreg = pmagbbfb_setcolreg,
|
|
.fb_fillrect = cfb_fillrect,
|
|
.fb_copyarea = cfb_copyarea,
|
|
.fb_imageblit = cfb_imageblit,
|
|
};
|
|
|
|
|
|
/*
|
|
* Turn the hardware cursor off.
|
|
*/
|
|
static void pmagbbfb_erase_cursor(struct fb_info *info)
|
|
{
|
|
struct pmagbbfb_par *par = info->par;
|
|
|
|
mb();
|
|
dac_write(par, BT459_ADDR_LO, 0x00);
|
|
dac_write(par, BT459_ADDR_HI, 0x03);
|
|
wmb();
|
|
dac_write(par, BT459_DATA, 0x00);
|
|
}
|
|
|
|
/*
|
|
* Set up screen parameters.
|
|
*/
|
|
static void pmagbbfb_screen_setup(struct fb_info *info)
|
|
{
|
|
struct pmagbbfb_par *par = info->par;
|
|
|
|
info->var.xres = ((sfb_read(par, SFB_REG_VID_HOR) >>
|
|
SFB_VID_HOR_PIX_SHIFT) & SFB_VID_HOR_PIX_MASK) * 4;
|
|
info->var.xres_virtual = info->var.xres;
|
|
info->var.yres = (sfb_read(par, SFB_REG_VID_VER) >>
|
|
SFB_VID_VER_SL_SHIFT) & SFB_VID_VER_SL_MASK;
|
|
info->var.yres_virtual = info->var.yres;
|
|
info->var.left_margin = ((sfb_read(par, SFB_REG_VID_HOR) >>
|
|
SFB_VID_HOR_BP_SHIFT) &
|
|
SFB_VID_HOR_BP_MASK) * 4;
|
|
info->var.right_margin = ((sfb_read(par, SFB_REG_VID_HOR) >>
|
|
SFB_VID_HOR_FP_SHIFT) &
|
|
SFB_VID_HOR_FP_MASK) * 4;
|
|
info->var.upper_margin = (sfb_read(par, SFB_REG_VID_VER) >>
|
|
SFB_VID_VER_BP_SHIFT) & SFB_VID_VER_BP_MASK;
|
|
info->var.lower_margin = (sfb_read(par, SFB_REG_VID_VER) >>
|
|
SFB_VID_VER_FP_SHIFT) & SFB_VID_VER_FP_MASK;
|
|
info->var.hsync_len = ((sfb_read(par, SFB_REG_VID_HOR) >>
|
|
SFB_VID_HOR_SYN_SHIFT) &
|
|
SFB_VID_HOR_SYN_MASK) * 4;
|
|
info->var.vsync_len = (sfb_read(par, SFB_REG_VID_VER) >>
|
|
SFB_VID_VER_SYN_SHIFT) & SFB_VID_VER_SYN_MASK;
|
|
|
|
info->fix.line_length = info->var.xres;
|
|
};
|
|
|
|
/*
|
|
* Determine oscillator configuration.
|
|
*/
|
|
static void pmagbbfb_osc_setup(struct fb_info *info)
|
|
{
|
|
static unsigned int pmagbbfb_freqs[] = {
|
|
130808, 119843, 104000, 92980, 74370, 72800,
|
|
69197, 66000, 65000, 50350, 36000, 32000, 25175
|
|
};
|
|
struct pmagbbfb_par *par = info->par;
|
|
struct tc_bus *tbus = to_tc_dev(info->device)->bus;
|
|
u32 count0 = 8, count1 = 8, counttc = 16 * 256 + 8;
|
|
u32 freq0, freq1, freqtc = tc_get_speed(tbus) / 250;
|
|
int i, j;
|
|
|
|
gp0_write(par, 0); /* select Osc0 */
|
|
for (j = 0; j < 16; j++) {
|
|
mb();
|
|
sfb_write(par, SFB_REG_TCCLK_COUNT, 0);
|
|
mb();
|
|
for (i = 0; i < 100; i++) { /* nominally max. 20.5us */
|
|
if (sfb_read(par, SFB_REG_TCCLK_COUNT) == 0)
|
|
break;
|
|
udelay(1);
|
|
}
|
|
count0 += sfb_read(par, SFB_REG_VIDCLK_COUNT);
|
|
}
|
|
|
|
gp0_write(par, 1); /* select Osc1 */
|
|
for (j = 0; j < 16; j++) {
|
|
mb();
|
|
sfb_write(par, SFB_REG_TCCLK_COUNT, 0);
|
|
|
|
for (i = 0; i < 100; i++) { /* nominally max. 20.5us */
|
|
if (sfb_read(par, SFB_REG_TCCLK_COUNT) == 0)
|
|
break;
|
|
udelay(1);
|
|
}
|
|
count1 += sfb_read(par, SFB_REG_VIDCLK_COUNT);
|
|
}
|
|
|
|
freq0 = (freqtc * count0 + counttc / 2) / counttc;
|
|
par->osc0 = freq0;
|
|
if (freq0 >= pmagbbfb_freqs[0] - (pmagbbfb_freqs[0] + 32) / 64 &&
|
|
freq0 <= pmagbbfb_freqs[0] + (pmagbbfb_freqs[0] + 32) / 64)
|
|
par->osc0 = pmagbbfb_freqs[0];
|
|
|
|
freq1 = (par->osc0 * count1 + count0 / 2) / count0;
|
|
par->osc1 = freq1;
|
|
for (i = 0; i < ARRAY_SIZE(pmagbbfb_freqs); i++)
|
|
if (freq1 >= pmagbbfb_freqs[i] -
|
|
(pmagbbfb_freqs[i] + 128) / 256 &&
|
|
freq1 <= pmagbbfb_freqs[i] +
|
|
(pmagbbfb_freqs[i] + 128) / 256) {
|
|
par->osc1 = pmagbbfb_freqs[i];
|
|
break;
|
|
}
|
|
|
|
if (par->osc0 - par->osc1 <= (par->osc0 + par->osc1 + 256) / 512 ||
|
|
par->osc1 - par->osc0 <= (par->osc0 + par->osc1 + 256) / 512)
|
|
par->osc1 = 0;
|
|
|
|
gp0_write(par, par->osc1 != 0); /* reselect OscX */
|
|
|
|
info->var.pixclock = par->osc1 ?
|
|
(1000000000 + par->osc1 / 2) / par->osc1 :
|
|
(1000000000 + par->osc0 / 2) / par->osc0;
|
|
};
|
|
|
|
|
|
static int pmagbbfb_probe(struct device *dev)
|
|
{
|
|
struct tc_dev *tdev = to_tc_dev(dev);
|
|
resource_size_t start, len;
|
|
struct fb_info *info;
|
|
struct pmagbbfb_par *par;
|
|
char freq0[12], freq1[12];
|
|
u32 vid_base;
|
|
int err;
|
|
|
|
info = framebuffer_alloc(sizeof(struct pmagbbfb_par), dev);
|
|
if (!info)
|
|
return -ENOMEM;
|
|
|
|
par = info->par;
|
|
dev_set_drvdata(dev, info);
|
|
|
|
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
|
printk(KERN_ERR "%s: Cannot allocate color map\n",
|
|
dev_name(dev));
|
|
err = -ENOMEM;
|
|
goto err_alloc;
|
|
}
|
|
|
|
info->fbops = &pmagbbfb_ops;
|
|
info->fix = pmagbbfb_fix;
|
|
info->var = pmagbbfb_defined;
|
|
info->flags = FBINFO_DEFAULT;
|
|
|
|
/* Request the I/O MEM resource. */
|
|
start = tdev->resource.start;
|
|
len = tdev->resource.end - start + 1;
|
|
if (!request_mem_region(start, len, dev_name(dev))) {
|
|
printk(KERN_ERR "%s: Cannot reserve FB region\n",
|
|
dev_name(dev));
|
|
err = -EBUSY;
|
|
goto err_cmap;
|
|
}
|
|
|
|
/* MMIO mapping setup. */
|
|
info->fix.mmio_start = start;
|
|
par->mmio = ioremap(info->fix.mmio_start, info->fix.mmio_len);
|
|
if (!par->mmio) {
|
|
printk(KERN_ERR "%s: Cannot map MMIO\n", dev_name(dev));
|
|
err = -ENOMEM;
|
|
goto err_resource;
|
|
}
|
|
par->sfb = par->mmio + PMAGB_B_SFB;
|
|
par->dac = par->mmio + PMAGB_B_BT459;
|
|
|
|
/* Frame buffer mapping setup. */
|
|
info->fix.smem_start = start + PMAGB_B_FBMEM;
|
|
par->smem = ioremap(info->fix.smem_start, info->fix.smem_len);
|
|
if (!par->smem) {
|
|
printk(KERN_ERR "%s: Cannot map FB\n", dev_name(dev));
|
|
err = -ENOMEM;
|
|
goto err_mmio_map;
|
|
}
|
|
vid_base = sfb_read(par, SFB_REG_VID_BASE);
|
|
info->screen_base = (void __iomem *)par->smem + vid_base * 0x1000;
|
|
info->screen_size = info->fix.smem_len - 2 * vid_base * 0x1000;
|
|
|
|
pmagbbfb_erase_cursor(info);
|
|
pmagbbfb_screen_setup(info);
|
|
pmagbbfb_osc_setup(info);
|
|
|
|
err = register_framebuffer(info);
|
|
if (err < 0) {
|
|
printk(KERN_ERR "%s: Cannot register framebuffer\n",
|
|
dev_name(dev));
|
|
goto err_smem_map;
|
|
}
|
|
|
|
get_device(dev);
|
|
|
|
snprintf(freq0, sizeof(freq0), "%u.%03uMHz",
|
|
par->osc0 / 1000, par->osc0 % 1000);
|
|
snprintf(freq1, sizeof(freq1), "%u.%03uMHz",
|
|
par->osc1 / 1000, par->osc1 % 1000);
|
|
|
|
fb_info(info, "%s frame buffer device at %s\n",
|
|
info->fix.id, dev_name(dev));
|
|
fb_info(info, "Osc0: %s, Osc1: %s, Osc%u selected\n",
|
|
freq0, par->osc1 ? freq1 : "disabled", par->osc1 != 0);
|
|
|
|
return 0;
|
|
|
|
|
|
err_smem_map:
|
|
iounmap(par->smem);
|
|
|
|
err_mmio_map:
|
|
iounmap(par->mmio);
|
|
|
|
err_resource:
|
|
release_mem_region(start, len);
|
|
|
|
err_cmap:
|
|
fb_dealloc_cmap(&info->cmap);
|
|
|
|
err_alloc:
|
|
framebuffer_release(info);
|
|
return err;
|
|
}
|
|
|
|
static int pmagbbfb_remove(struct device *dev)
|
|
{
|
|
struct tc_dev *tdev = to_tc_dev(dev);
|
|
struct fb_info *info = dev_get_drvdata(dev);
|
|
struct pmagbbfb_par *par = info->par;
|
|
resource_size_t start, len;
|
|
|
|
put_device(dev);
|
|
unregister_framebuffer(info);
|
|
iounmap(par->smem);
|
|
iounmap(par->mmio);
|
|
start = tdev->resource.start;
|
|
len = tdev->resource.end - start + 1;
|
|
release_mem_region(start, len);
|
|
fb_dealloc_cmap(&info->cmap);
|
|
framebuffer_release(info);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/*
|
|
* Initialize the framebuffer.
|
|
*/
|
|
static const struct tc_device_id pmagbbfb_tc_table[] = {
|
|
{ "DEC ", "PMAGB-BA" },
|
|
{ }
|
|
};
|
|
MODULE_DEVICE_TABLE(tc, pmagbbfb_tc_table);
|
|
|
|
static struct tc_driver pmagbbfb_driver = {
|
|
.id_table = pmagbbfb_tc_table,
|
|
.driver = {
|
|
.name = "pmagbbfb",
|
|
.bus = &tc_bus_type,
|
|
.probe = pmagbbfb_probe,
|
|
.remove = pmagbbfb_remove,
|
|
},
|
|
};
|
|
|
|
static int __init pmagbbfb_init(void)
|
|
{
|
|
#ifndef MODULE
|
|
if (fb_get_options("pmagbbfb", NULL))
|
|
return -ENXIO;
|
|
#endif
|
|
return tc_register_driver(&pmagbbfb_driver);
|
|
}
|
|
|
|
static void __exit pmagbbfb_exit(void)
|
|
{
|
|
tc_unregister_driver(&pmagbbfb_driver);
|
|
}
|
|
|
|
|
|
module_init(pmagbbfb_init);
|
|
module_exit(pmagbbfb_exit);
|
|
|
|
MODULE_LICENSE("GPL");
|