Skip to content

Commit

Permalink
Merge branch 'fbdev-fixes-for-linus' of git://git.kernel.org/pub/scm/…
Browse files Browse the repository at this point in the history
…linux/kernel/git/lethal/fbdev-2.6

* 'fbdev-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/lethal/fbdev-2.6:
  efifb: Add override for 11" Macbook Air 3,1
  efifb: Support overriding fields FW tells us with the DMI data.
  fb: Reduce priority of resource conflict message
  savagefb: Remove obsolete else clause in savage_setup_i2c_bus
  savagefb: Set up I2C based on chip family instead of card id
  savagefb: Replace magic register address with define
  drivers/video/bfin-lq035q1-fb.c: introduce missing kfree
  video: s3c-fb: fix checkpatch errors and warning
  efifb: support AMD Radeon HD 6490
  s3fb: fix Virge/GX2
  fbcon: Remove unused 'display *p' variable from fb_flashcursor()
  fbdev: sh_mobile_lcdcfb: fix module lock acquisition
  fbdev: sh_mobile_lcdcfb: add blanking support
  viafb: initialize margins correct
  viafb: refresh rate bug collection
  sh: mach-ap325rxa: move backlight control code
  sh: mach-ecovec24: support for main lcd backlight
  • Loading branch information
Linus Torvalds committed Apr 7, 2011
2 parents 1744573 + 97fb850 commit 132452e
Show file tree
Hide file tree
Showing 15 changed files with 280 additions and 150 deletions.
32 changes: 24 additions & 8 deletions arch/sh/boards/mach-ap325rxa/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,34 @@ static struct platform_device nand_flash_device = {
#define PORT_DRVCRA 0xA405018A
#define PORT_DRVCRB 0xA405018C

static int ap320_wvga_set_brightness(void *board_data, int brightness)
{
if (brightness) {
gpio_set_value(GPIO_PTS3, 0);
__raw_writew(0x100, FPGA_BKLREG);
} else {
__raw_writew(0, FPGA_BKLREG);
gpio_set_value(GPIO_PTS3, 1);
}

return 0;
}

static int ap320_wvga_get_brightness(void *board_data)
{
return gpio_get_value(GPIO_PTS3);
}

static void ap320_wvga_power_on(void *board_data, struct fb_info *info)
{
msleep(100);

/* ASD AP-320/325 LCD ON */
__raw_writew(FPGA_LCDREG_VAL, FPGA_LCDREG);

/* backlight */
gpio_set_value(GPIO_PTS3, 0);
__raw_writew(0x100, FPGA_BKLREG);
}

static void ap320_wvga_power_off(void *board_data)
{
/* backlight */
__raw_writew(0, FPGA_BKLREG);
gpio_set_value(GPIO_PTS3, 1);

/* ASD AP-320/325 LCD OFF */
__raw_writew(0, FPGA_LCDREG);
}
Expand Down Expand Up @@ -209,6 +219,12 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.board_cfg = {
.display_on = ap320_wvga_power_on,
.display_off = ap320_wvga_power_off,
.set_brightness = ap320_wvga_set_brightness,
.get_brightness = ap320_wvga_get_brightness,
},
.bl_info = {
.name = "sh_mobile_lcdc_bl",
.max_brightness = 1,
},
}
};
Expand Down
18 changes: 18 additions & 0 deletions arch/sh/boards/mach-ecovec24/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,18 @@ const static struct fb_videomode ecovec_dvi_modes[] = {
},
};

static int ecovec24_set_brightness(void *board_data, int brightness)
{
gpio_set_value(GPIO_PTR1, brightness);

return 0;
}

static int ecovec24_get_brightness(void *board_data)
{
return gpio_get_value(GPIO_PTR1);
}

static struct sh_mobile_lcdc_info lcdc_info = {
.ch[0] = {
.interface_type = RGB18,
Expand All @@ -273,6 +285,12 @@ static struct sh_mobile_lcdc_info lcdc_info = {
.height = 91,
},
.board_cfg = {
.set_brightness = ecovec24_set_brightness,
.get_brightness = ecovec24_get_brightness,
},
.bl_info = {
.name = "sh_mobile_lcdc_bl",
.max_brightness = 1,
},
}
};
Expand Down
4 changes: 3 additions & 1 deletion drivers/video/bfin-lq035q1-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,10 @@ static int __devinit lq035q1_spidev_probe(struct spi_device *spi)

ret = lq035q1_control(spi, LQ035_SHUT_CTL, LQ035_ON);
ret |= lq035q1_control(spi, LQ035_DRIVER_OUTPUT_CTL, ctl->mode);
if (ret)
if (ret) {
kfree(ctl);
return ret;
}

spi_set_drvdata(spi, ctl);

Expand Down
2 changes: 0 additions & 2 deletions drivers/video/console/fbcon.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,6 @@ static void fb_flashcursor(struct work_struct *work)
{
struct fb_info *info = container_of(work, struct fb_info, queue);
struct fbcon_ops *ops = info->fbcon_par;
struct display *p;
struct vc_data *vc = NULL;
int c;
int mode;
Expand All @@ -386,7 +385,6 @@ static void fb_flashcursor(struct work_struct *work)
return;
}

p = &fb_display[vc->vc_num];
c = scr_readw((u16 *) vc->vc_pos);
mode = (!ops->cursor_flash || ops->cursor_state.enable) ?
CM_ERASE : CM_DRAW;
Expand Down
154 changes: 94 additions & 60 deletions drivers/video/efifb.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ enum {
M_MB_7_1, /* MacBook, 7th rev. */
M_MB_SR, /* MacBook, 2nd gen, (Santa Rosa) */
M_MBA, /* MacBook Air */
M_MBA_3, /* Macbook Air, 3rd rev */
M_MBP, /* MacBook Pro */
M_MBP_2, /* MacBook Pro 2nd gen */
M_MBP_2_2, /* MacBook Pro 2,2nd gen */
Expand All @@ -64,43 +65,54 @@ enum {
M_MBP_6_1, /* MacBook Pro, 6,1th gen */
M_MBP_6_2, /* MacBook Pro, 6,2th gen */
M_MBP_7_1, /* MacBook Pro, 7,1th gen */
M_MBP_8_2, /* MacBook Pro, 8,2nd gen */
M_UNKNOWN /* placeholder */
};

#define OVERRIDE_NONE 0x0
#define OVERRIDE_BASE 0x1
#define OVERRIDE_STRIDE 0x2
#define OVERRIDE_HEIGHT 0x4
#define OVERRIDE_WIDTH 0x8

static struct efifb_dmi_info {
char *optname;
unsigned long base;
int stride;
int width;
int height;
int flags;
} dmi_list[] __initdata = {
[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900 },
[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050 }, /* guess */
[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050 },
[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200 }, /* guess */
[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200 },
[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080 },
[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440 },
[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768 },
[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768 },
[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200 },
[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800 },
[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800 },
[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800 },
[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800 },
[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800 },
[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900 },
[M_MBP_2] = { "mbp2", 0, 0, 0, 0 }, /* placeholder */
[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900 },
[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900 },
[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200 },
[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900 },
[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200 },
[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900 },
[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200 },
[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050 },
[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800 },
[M_UNKNOWN] = { NULL, 0, 0, 0, 0 }
[M_I17] = { "i17", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_I20] = { "i20", 0x80010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE }, /* guess */
[M_I20_SR] = { "imac7", 0x40010000, 1728 * 4, 1680, 1050, OVERRIDE_NONE },
[M_I24] = { "i24", 0x80010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE }, /* guess */
[M_I24_8_1] = { "imac8", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_I24_10_1] = { "imac10", 0xc0010000, 2048 * 4, 1920, 1080, OVERRIDE_NONE },
[M_I27_11_1] = { "imac11", 0xc0010000, 2560 * 4, 2560, 1440, OVERRIDE_NONE },
[M_MINI]= { "mini", 0x80000000, 2048 * 4, 1024, 768, OVERRIDE_NONE },
[M_MINI_3_1] = { "mini31", 0x40010000, 1024 * 4, 1024, 768, OVERRIDE_NONE },
[M_MINI_4_1] = { "mini41", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MB] = { "macbook", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MB_5_1] = { "macbook51", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MB_6_1] = { "macbook61", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MB_7_1] = { "macbook71", 0x80010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MBA] = { "mba", 0x80000000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
/* 11" Macbook Air 3,1 passes the wrong stride */
[M_MBA_3] = { "mba3", 0, 2048 * 4, 0, 0, OVERRIDE_STRIDE },
[M_MBP] = { "mbp", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_2] = { "mbp2", 0, 0, 0, 0, OVERRIDE_NONE }, /* placeholder */
[M_MBP_2_2] = { "mbp22", 0x80010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_SR] = { "mbp3", 0x80030000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_4] = { "mbp4", 0xc0060000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MBP_5_1] = { "mbp51", 0xc0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_5_2] = { "mbp52", 0xc0010000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MBP_5_3] = { "mbp53", 0xd0010000, 2048 * 4, 1440, 900, OVERRIDE_NONE },
[M_MBP_6_1] = { "mbp61", 0x90030000, 2048 * 4, 1920, 1200, OVERRIDE_NONE },
[M_MBP_6_2] = { "mbp62", 0x90030000, 2048 * 4, 1680, 1050, OVERRIDE_NONE },
[M_MBP_7_1] = { "mbp71", 0xc0010000, 2048 * 4, 1280, 800, OVERRIDE_NONE },
[M_MBP_8_2] = { "mbp82", 0x90010000, 1472 * 4, 1440, 900, OVERRIDE_NONE },
[M_UNKNOWN] = { NULL, 0, 0, 0, 0, OVERRIDE_NONE }
};

static int set_system(const struct dmi_system_id *id);
Expand Down Expand Up @@ -138,6 +150,7 @@ static const struct dmi_system_id dmi_system_table[] __initconst = {
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook6,1", M_MB_6_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBook7,1", M_MB_7_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir1,1", M_MBA),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookAir3,1", M_MBA_3),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro1,1", M_MBP),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,1", M_MBP_2),
EFIFB_DMI_SYSTEM_ID("Apple Computer, Inc.", "MacBookPro2,2", M_MBP_2_2),
Expand All @@ -151,60 +164,74 @@ static const struct dmi_system_id dmi_system_table[] __initconst = {
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,1", M_MBP_6_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro6,2", M_MBP_6_2),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro7,1", M_MBP_7_1),
EFIFB_DMI_SYSTEM_ID("Apple Inc.", "MacBookPro8,2", M_MBP_8_2),
{},
};

#define choose_value(dmivalue, fwvalue, field, flags) ({ \
typeof(fwvalue) _ret_ = fwvalue; \
if ((flags) & (field)) \
_ret_ = dmivalue; \
else if ((fwvalue) == 0) \
_ret_ = dmivalue; \
_ret_; \
})

static int set_system(const struct dmi_system_id *id)
{
struct efifb_dmi_info *info = id->driver_data;
if (info->base == 0)
return 0;

printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p "
"(%dx%d, stride %d)\n", id->ident,
(void *)info->base, info->width, info->height,
info->stride);
if (info->base == 0 && info->height == 0 && info->width == 0
&& info->stride == 0)
return 0;

/* Trust the bootloader over the DMI tables */
if (screen_info.lfb_base == 0) {
#if defined(CONFIG_PCI)
struct pci_dev *dev = NULL;
int found_bar = 0;
#endif
screen_info.lfb_base = info->base;
if (info->base) {
screen_info.lfb_base = choose_value(info->base,
screen_info.lfb_base, OVERRIDE_BASE,
info->flags);

#if defined(CONFIG_PCI)
/* make sure that the address in the table is actually on a
* VGA device's PCI BAR */

for_each_pci_dev(dev) {
int i;
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
continue;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
resource_size_t start, end;

start = pci_resource_start(dev, i);
if (start == 0)
break;
end = pci_resource_end(dev, i);
if (screen_info.lfb_base >= start &&
screen_info.lfb_base < end) {
found_bar = 1;
/* make sure that the address in the table is actually
* on a VGA device's PCI BAR */

for_each_pci_dev(dev) {
int i;
if ((dev->class >> 8) != PCI_CLASS_DISPLAY_VGA)
continue;
for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
resource_size_t start, end;

start = pci_resource_start(dev, i);
if (start == 0)
break;
end = pci_resource_end(dev, i);
if (screen_info.lfb_base >= start &&
screen_info.lfb_base < end) {
found_bar = 1;
}
}
}
}
if (!found_bar)
screen_info.lfb_base = 0;
if (!found_bar)
screen_info.lfb_base = 0;
#endif
}
}
if (screen_info.lfb_base) {
if (screen_info.lfb_linelength == 0)
screen_info.lfb_linelength = info->stride;
if (screen_info.lfb_width == 0)
screen_info.lfb_width = info->width;
if (screen_info.lfb_height == 0)
screen_info.lfb_height = info->height;
screen_info.lfb_linelength = choose_value(info->stride,
screen_info.lfb_linelength, OVERRIDE_STRIDE,
info->flags);
screen_info.lfb_width = choose_value(info->width,
screen_info.lfb_width, OVERRIDE_WIDTH,
info->flags);
screen_info.lfb_height = choose_value(info->height,
screen_info.lfb_height, OVERRIDE_HEIGHT,
info->flags);
if (screen_info.orig_video_isVGA == 0)
screen_info.orig_video_isVGA = VIDEO_TYPE_EFI;
} else {
Expand All @@ -214,6 +241,13 @@ static int set_system(const struct dmi_system_id *id)
screen_info.orig_video_isVGA = 0;
return 0;
}

printk(KERN_INFO "efifb: dmi detected %s - framebuffer at %p "
"(%dx%d, stride %d)\n", id->ident,
(void *)screen_info.lfb_base, screen_info.lfb_width,
screen_info.lfb_height, screen_info.lfb_linelength);


return 1;
}

Expand Down
2 changes: 1 addition & 1 deletion drivers/video/fbmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -1507,7 +1507,7 @@ void remove_conflicting_framebuffers(struct apertures_struct *a,
(primary && gen_aper && gen_aper->count &&
gen_aper->ranges[0].base == VGA_FB_PHYS)) {

printk(KERN_ERR "fb: conflicting fb hw usage "
printk(KERN_INFO "fb: conflicting fb hw usage "
"%s vs %s - removing generic driver\n",
name, registered_fb[i]->fix.id);
unregister_framebuffer(registered_fb[i]);
Expand Down
8 changes: 5 additions & 3 deletions drivers/video/s3c-fb.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
#undef writel
#define writel(v, r) do { \
printk(KERN_DEBUG "%s: %08x => %p\n", __func__, (unsigned int)v, r); \
__raw_writel(v, r); } while(0)
__raw_writel(v, r); } while (0)
#endif /* FB_S3C_DEBUG_REGWRITE */

/* irq_flags bits */
Expand Down Expand Up @@ -518,7 +518,7 @@ static int s3c_fb_set_par(struct fb_info *info)

data = VIDTCON2_LINEVAL(var->yres - 1) |
VIDTCON2_HOZVAL(var->xres - 1);
writel(data, regs +sfb->variant.vidtcon + 8 );
writel(data, regs + sfb->variant.vidtcon + 8);
}

/* write the buffer address */
Expand Down Expand Up @@ -1304,6 +1304,7 @@ static void s3c_fb_clear_win(struct s3c_fb *sfb, int win)

static int __devinit s3c_fb_probe(struct platform_device *pdev)
{
const struct platform_device_id *platid;
struct s3c_fb_driverdata *fbdrv;
struct device *dev = &pdev->dev;
struct s3c_fb_platdata *pd;
Expand All @@ -1312,7 +1313,8 @@ static int __devinit s3c_fb_probe(struct platform_device *pdev)
int win;
int ret = 0;

fbdrv = (struct s3c_fb_driverdata *)platform_get_device_id(pdev)->driver_data;
platid = platform_get_device_id(pdev);
fbdrv = (struct s3c_fb_driverdata *)platid->driver_data;

if (fbdrv->variant.nr_windows > S3C_FB_MAX_WIN) {
dev_err(dev, "too many windows, cannot attach\n");
Expand Down
Loading

0 comments on commit 132452e

Please sign in to comment.