You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
(1) |
Apr
(104) |
May
(81) |
Jun
(248) |
Jul
(133) |
Aug
(33) |
Sep
(53) |
Oct
(82) |
Nov
(166) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(121) |
Feb
(42) |
Mar
(39) |
Apr
(84) |
May
(87) |
Jun
(58) |
Jul
(97) |
Aug
(130) |
Sep
(32) |
Oct
(139) |
Nov
(108) |
Dec
(216) |
2003 |
Jan
(299) |
Feb
(136) |
Mar
(392) |
Apr
(141) |
May
(137) |
Jun
(107) |
Jul
(94) |
Aug
(262) |
Sep
(300) |
Oct
(216) |
Nov
(72) |
Dec
(94) |
2004 |
Jan
(174) |
Feb
(192) |
Mar
(215) |
Apr
(314) |
May
(319) |
Jun
(293) |
Jul
(205) |
Aug
(161) |
Sep
(192) |
Oct
(226) |
Nov
(308) |
Dec
(89) |
2005 |
Jan
(127) |
Feb
(269) |
Mar
(588) |
Apr
(106) |
May
(77) |
Jun
(77) |
Jul
(161) |
Aug
(239) |
Sep
(86) |
Oct
(112) |
Nov
(153) |
Dec
(145) |
2006 |
Jan
(87) |
Feb
(57) |
Mar
(129) |
Apr
(109) |
May
(102) |
Jun
(232) |
Jul
(97) |
Aug
(69) |
Sep
(67) |
Oct
(69) |
Nov
(214) |
Dec
(82) |
2007 |
Jan
(133) |
Feb
(307) |
Mar
(121) |
Apr
(171) |
May
(229) |
Jun
(156) |
Jul
(185) |
Aug
(160) |
Sep
(122) |
Oct
(130) |
Nov
(78) |
Dec
(27) |
2008 |
Jan
(105) |
Feb
(137) |
Mar
(146) |
Apr
(148) |
May
(239) |
Jun
(208) |
Jul
(157) |
Aug
(244) |
Sep
(119) |
Oct
(125) |
Nov
(189) |
Dec
(225) |
2009 |
Jan
(157) |
Feb
(139) |
Mar
(106) |
Apr
(130) |
May
(246) |
Jun
(189) |
Jul
(128) |
Aug
(127) |
Sep
(88) |
Oct
(86) |
Nov
(216) |
Dec
(9) |
2010 |
Jan
(5) |
Feb
|
Mar
(11) |
Apr
(31) |
May
(3) |
Jun
|
Jul
(7) |
Aug
|
Sep
(1) |
Oct
|
Nov
(1) |
Dec
|
2012 |
Jan
|
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Harald W. <Har...@vi...> - 2009-05-20 20:48:08
|
From: Harald Welte <la...@gn...> Rather than using our own private structure members for MMIO base and length, we use the fb_info->fix ones. Signed-off-by: Harald Welte <Har...@vi...> --- drivers/video/via/viafbdev.c | 11 ++++------- drivers/video/via/viafbdev.h | 2 -- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index c420623..00f58c8 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -122,9 +122,6 @@ static void viafb_setup_fixinfo(struct fb_fix_screeninfo *fix, strcpy(fix->id, viafb_name); fix->smem_len = viaparinfo->fbmem_free; - fix->mmio_start = viaparinfo->mmio_base; - fix->mmio_len = viaparinfo->mmio_len; - fix->type = FB_TYPE_PACKED_PIXELS; fix->type_aux = 0; @@ -2175,10 +2172,10 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, goto out_delete_i2c; } - viaparinfo->mmio_base = pci_resource_start(pdev, 1); - viaparinfo->mmio_len = pci_resource_len(pdev, 1); - viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base, - viaparinfo->mmio_len); + viafbinfo->fix.mmio_start = pci_resource_start(pdev, 1); + viafbinfo->fix.mmio_len = pci_resource_len(pdev, 1); + viaparinfo->io_virt = ioremap_nocache(viafbinfo->fix.mmio_start, + viafbinfo->fix.mmio_len); if (!viaparinfo->io_virt) { printk(KERN_ERR "ioremap of MMIO failed\n"); rc = -EIO; diff --git a/drivers/video/via/viafbdev.h b/drivers/video/via/viafbdev.h index ed4129e..0c1d734 100644 --- a/drivers/video/via/viafbdev.h +++ b/drivers/video/via/viafbdev.h @@ -47,8 +47,6 @@ struct viafb_par { void __iomem *io_virt; /*iospace virtual memory address */ unsigned int io; /*io space address */ - unsigned long mmio_base; /*mmio base address */ - unsigned long mmio_len; /*mmio base length */ u32 fbmem_free; /* Free FB memory */ u32 fbmem_used; /* Use FB memory size */ u32 cursor_start; /* Cursor Start Address */ -- 1.6.2.4 |
From: Krzysztof H. <krz...@po...> - 2009-05-20 12:38:53
|
From: Krzysztof Helt <krz...@wp...> Does not allow to accept VESA modes by the "vga=" kernel parameter if there is no frame buffer driver compiled-in to handle it. Bug was reported by Werner Lemberg as kernel bug #13249 "Intel 945GM: Boot option`vga=0x31a' breaks display of TTYs". Signed-off-by: Krzysztof Helt <krz...@wp...> --- Werner, please test it. It should produce a correct display with intelfb compiled in (=y) and as a module (=m). diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 0048f11..c787357 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -1122,7 +1122,7 @@ config FB_INTEL select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select FB_BOOT_VESA_SUPPORT + select FB_BOOT_VESA_SUPPORT if FB_INTEL = y 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. @@ -1460,7 +1460,7 @@ config FB_SIS select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select FB_BOOT_VESA_SUPPORT + select FB_BOOT_VESA_SUPPORT if FB_SIS = y help This is the frame buffer device driver for the SiS 300, 315, 330 and 340 series as well as XGI V3XT, V5, V8, Z7 graphics chipsets. ---------------------------------------------------------------------- Studencie - zrób zdjêcie! i Wygraj! Kliknij >>> http://link.interia.pl/f2179 |
From: Krzysztof H. <krz...@po...> - 2009-05-20 12:10:11
|
From: Krzysztof Helt <krz...@wp...> The driver's fb_mmap function is essentially the same as a generic fb_mmap function. Delete driver's function and use the generic one. A difference is that generic function marks frame buffer memory as VM_IO | VM_RESERVED. The driver's function marks it as VM_IO only. Signed-off-by: Krzysztof Helt <krz...@wp...> --- This patch is for the next kernel version (2.6.31). drivers/video/acornfb.c | 38 -------------------------------------- 1 files changed, 0 insertions(+), 38 deletions(-) diff --git a/drivers/video/acornfb.c b/drivers/video/acornfb.c index 6995fe1..0bcc59e 100644 --- a/drivers/video/acornfb.c +++ b/drivers/video/acornfb.c @@ -859,43 +859,6 @@ acornfb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) return 0; } -/* - * Note that we are entered with the kernel locked. - */ -static int -acornfb_mmap(struct fb_info *info, struct vm_area_struct *vma) -{ - unsigned long off, start; - u32 len; - - off = vma->vm_pgoff << PAGE_SHIFT; - - start = info->fix.smem_start; - len = PAGE_ALIGN(start & ~PAGE_MASK) + info->fix.smem_len; - start &= PAGE_MASK; - if ((vma->vm_end - vma->vm_start + off) > len) - return -EINVAL; - off += start; - vma->vm_pgoff = off >> PAGE_SHIFT; - - /* This is an IO map - tell maydump to skip this VMA */ - vma->vm_flags |= VM_IO; - - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); - - /* - * Don't alter the page protection flags; we want to keep the area - * cached for better performance. This does mean that we may miss - * some updates to the screen occasionally, but process switches - * should cause the caches and buffers to be flushed often enough. - */ - if (io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) - return -EAGAIN; - return 0; -} - static struct fb_ops acornfb_ops = { .owner = THIS_MODULE, .fb_check_var = acornfb_check_var, @@ -905,7 +868,6 @@ static struct fb_ops acornfb_ops = { .fb_fillrect = cfb_fillrect, .fb_copyarea = cfb_copyarea, .fb_imageblit = cfb_imageblit, - .fb_mmap = acornfb_mmap, }; /* -- 1.6.0.3 ---------------------------------------------------------------------- Zrob sobie prezent. Wygraj nagrode! Sprawdz >> http://link.interia.pl/f2176 |
From: Krzysztof H. <krz...@po...> - 2009-05-20 12:08:25
|
From: Krzysztof Helt <krz...@wp...> All resources are released in s3c_fb_win_release so remove other places of resources releasing. Add releasing of an allocated fb_info structure as well. Signed-off-by: Krzysztof Helt <krz...@wp...> --- drivers/video/s3c-fb.c | 22 +++++++++------------- 1 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/video/s3c-fb.c b/drivers/video/s3c-fb.c index 5e9c630..195cc27 100644 --- a/drivers/video/s3c-fb.c +++ b/drivers/video/s3c-fb.c @@ -700,9 +700,12 @@ static void s3c_fb_free_memory(struct s3c_fb *sfb, struct s3c_fb_win *win) */ static void s3c_fb_release_win(struct s3c_fb *sfb, struct s3c_fb_win *win) { - fb_dealloc_cmap(&win->fbinfo->cmap); - unregister_framebuffer(win->fbinfo); - s3c_fb_free_memory(sfb, win); + if (win->fbinfo) { + unregister_framebuffer(win->fbinfo); + fb_dealloc_cmap(&win->fbinfo->cmap); + s3c_fb_free_memory(sfb, win); + framebuffer_release(win->fbinfo); + } } /** @@ -753,7 +756,7 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, ret = s3c_fb_alloc_memory(sfb, win); if (ret) { dev_err(sfb->dev, "failed to allocate display memory\n"); - goto err_framebuffer; + return ret; } /* setup the r/b/g positions for the window's palette */ @@ -776,7 +779,7 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, ret = s3c_fb_check_var(&fbinfo->var, fbinfo); if (ret < 0) { dev_err(sfb->dev, "check_var failed on initial video params\n"); - goto err_alloc_mem; + return ret; } /* create initial colour map */ @@ -796,20 +799,13 @@ static int __devinit s3c_fb_probe_win(struct s3c_fb *sfb, unsigned int win_no, ret = register_framebuffer(fbinfo); if (ret < 0) { dev_err(sfb->dev, "failed to register framebuffer\n"); - goto err_alloc_mem; + return ret; } *res = win; dev_info(sfb->dev, "window %d: fb %s\n", win_no, fbinfo->fix.id); return 0; - -err_alloc_mem: - s3c_fb_free_memory(sfb, win); - -err_framebuffer: - unregister_framebuffer(fbinfo); - return ret; } /** -- 1.6.0.3 ---------------------------------------------------------------------- Zrob sobie prezent. Wygraj nagrode! Sprawdz >> http://link.interia.pl/f2176 |
From: Werner L. <wl...@gn...> - 2009-05-20 09:27:56
|
>> Well, I use the intelfb driver (CONFIG_FB_INTEL=m), but I get a black >> screen for any VESA mode... > > You have to compile it into the kernel image (CONFIG_FB_INTEL=y) > otherwise no VESA mode is used. Aaah. Will try soon, thanks. Werner |
From: Krzysztof H. <krz...@po...> - 2009-05-20 08:43:51
|
On Wed, 20 May 2009 08:25:48 +0200 (CEST) Werner LEMBERG <wl...@gn...> wrote: > >> I'm doing a git bisect right now to find out why > >> CONFIG_FB_BOOT_VESA_SUPPORT doesn't work as advertised. > > > > Probably, it does work as supposed to. The > > CONFIG_FB_BOOT_VESA_SUPPORT tells Linux to allow VESA modes values > > for the "vga=" switch. It also switches on the VESA graphics modes. > > However, without a framebuffer which makes use of the graphics > > display (vesafb, intelfb, sisfb) it only garbles screen. > > Well, I use the intelfb driver (CONFIG_FB_INTEL=m), but I get a black > screen for any VESA mode... > > I see a problem here. If the intelfb is selected as a module the CONFIG_FB_BOOT_VESA_SUPPORT should not be selected. I'll prepare a patch for it. Regards, Krzysztof ---------------------------------------------------------------------- Fantastyczne nagrody do zgarniecia! Zagraj >> http://link.interia.pl/f2177 |
From: Krzysztof H. <krz...@po...> - 2009-05-20 08:38:30
|
On Wed, 20 May 2009 08:25:48 +0200 (CEST) Werner LEMBERG <wl...@gn...> wrote: > >> I'm doing a git bisect right now to find out why > >> CONFIG_FB_BOOT_VESA_SUPPORT doesn't work as advertised. > > > > Probably, it does work as supposed to. The > > CONFIG_FB_BOOT_VESA_SUPPORT tells Linux to allow VESA modes values > > for the "vga=" switch. It also switches on the VESA graphics modes. > > However, without a framebuffer which makes use of the graphics > > display (vesafb, intelfb, sisfb) it only garbles screen. > > Well, I use the intelfb driver (CONFIG_FB_INTEL=m), but I get a black > screen for any VESA mode... > You have to compile it into the kernel image (CONFIG_FB_INTEL=y) otherwise no VESA mode is used. Regards, Krzysztof ---------------------------------------------------------------------- Zrob sobie prezent. Wygraj nagrode! Sprawdz >> http://link.interia.pl/f2176 |
From: Werner L. <wl...@gn...> - 2009-05-20 06:26:04
|
>> I'm doing a git bisect right now to find out why >> CONFIG_FB_BOOT_VESA_SUPPORT doesn't work as advertised. > > Probably, it does work as supposed to. The > CONFIG_FB_BOOT_VESA_SUPPORT tells Linux to allow VESA modes values > for the "vga=" switch. It also switches on the VESA graphics modes. > However, without a framebuffer which makes use of the graphics > display (vesafb, intelfb, sisfb) it only garbles screen. Well, I use the intelfb driver (CONFIG_FB_INTEL=m), but I get a black screen for any VESA mode... Werner |
From: Krzysztof H. <krz...@po...> - 2009-05-20 05:45:30
|
On Mon, 18 May 2009 15:29:03 +0200 (CEST) Werner LEMBERG <wl...@gn...> wrote: > > > What I see here is that for 2.6.27 you use the VESA framebuffer > > while you do not use it for the 2.6.28 > > > > Compare your configs: > > 2.6.27 : CONFIG_FB_VESA=y > > 2.6.28: # CONFIG_FB_VESA is not set > > This is intentional. Reason is that in 2.6.28 option > `CONFIG_FB_BOOT_VESA_SUPPORT' has been added, and it seems that this > change introduced a bug. > > > My advice is try using the Intel framebuffer (change it to Y not 'M' > > like module). It should be faster than VESA on your hardware. > > Unselect VESA. > > I'm doing a git bisect right now to find out why > CONFIG_FB_BOOT_VESA_SUPPORT doesn't work as advertised. > > Probably, it does work as supposed to. The CONFIG_FB_BOOT_VESA_SUPPORT tells Linux to allow VESA modes values for the "vga=" switch. It also switches on the VESA graphics modes. However, without a framebuffer which makes use of the graphics display (vesafb, intelfb, sisfb) it only garbles screen. Regards, Krzysztof ---------------------------------------------------------------------- Fantastyczne nagrody do zgarniecia! Zagraj >> http://link.interia.pl/f2177 |
From: Harald W. <Har...@vi...> - 2009-05-20 02:28:08
|
On Tue, May 19, 2009 at 11:16:28PM +0200, Krzysztof Helt wrote: > Acked-by: Krzysztof Helt <krz...@wp...> Thanks. > > - viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); > > + viaparinfo->mmio_base = pci_resource_start(pdev, 1); > > + viaparinfo->mmio_len = pci_resource_len(pdev, 1); > > Again, there are standard fields which have the same meaning: > viafbinfo->mmio_start and viafbinfo->mmio_len. I know, and I have some patches coming up for that, they're already in my tree. I'm still doing some testing and will resubmit an entire series of about 10 patches today or tomorrow. Regards, -- - Harald Welte <Har...@vi...> http://linux.via.com.tw/ ============================================================================ VIA Open Source Liaison |
From: Harald W. <Har...@vi...> - 2009-05-20 02:28:05
|
On Tue, May 19, 2009 at 11:24:27PM +0200, Krzysztof Helt wrote: > On Tue, 19 May 2009 16:35:34 +0800 > Harald Welte <Har...@vi...> wrote: > > > This patch alters viafb to use the proper Linux in-kernel API to access > > PCI configuration space, rather than poking at I/O ports by itself. > > > > It also removes a minor inconsistency with naming of constants for the > > PCI device ID of the FUNCTION3 devices. > > > > Signed-off-by: Harald Welte <Har...@vi...> > > Can you pass the pdev pointer from the probe function > here and skip the whole searching of the PCI device? No. The FUNCTION3 device that we're searching is the SDRAM controller function integrated in the north bridge, not the integrated graphics. Only the PCI config space of the SDRAM controller contains the information about the size of the graphics memory. I was thinking of a 1:1 mapping between <pci device id for the graphics> : <pci device id for FUNCTION3>, but I'm not entirely sure if this is always correct or if there is some hardware that has the ID of one SDRAM controller and a different integrated graphics chipet, especially in legacy products. So for that reason I decided not to change the logic for searching the FUNCTION3, merely altering the pci config space access function. Regards, -- - Harald Welte <Har...@vi...> http://linux.via.com.tw/ ============================================================================ VIA Open Source Liaison |
From: Tony L. <to...@at...> - 2009-05-19 23:44:14
|
From: Imre Deak <imr...@no...> Based on an earlier patch by Hunyue Yau <hy...@mv...> with board-*.c changes split to avoid conflicts with other device updates. Cc: lin...@li... Signed-off-by: Hunyue Yau <hy...@mv...> Signed-off-by: Kevin Hilman <kh...@de...> Signed-off-by: Imre Deak <imr...@no...> Signed-off-by: Tony Lindgren <to...@at...> --- arch/arm/mach-omap2/board-2430sdp.c | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c index 788cfce..d1d467d 100644 --- a/arch/arm/mach-omap2/board-2430sdp.c +++ b/arch/arm/mach-omap2/board-2430sdp.c @@ -41,6 +41,7 @@ #include "mmc-twl4030.h" #define SDP2430_CS0_BASE 0x04000000 +#define SECONDARY_LCD_GPIO 147 static struct mtd_partition sdp2430_partitions[] = { /* bootloader (U-Boot, etc) in first sector */ @@ -96,8 +97,18 @@ static struct platform_device sdp2430_flash_device = { .resource = &sdp2430_flash_resource, }; +static struct platform_device sdp2430_lcd_device = { + .name = "sdp2430_lcd", + .id = -1, +}; + static struct platform_device *sdp2430_devices[] __initdata = { &sdp2430_flash_device, + &sdp2430_lcd_device, +}; + +static struct omap_lcd_config sdp2430_lcd_config __initdata = { + .ctrl_name = "internal", }; #if defined(CONFIG_SMC91X) || defined(CONFIG_SMC91x_MODULE) @@ -135,6 +146,7 @@ static struct omap_uart_config sdp2430_uart_config __initdata = { static struct omap_board_config_kernel sdp2430_config[] = { {OMAP_TAG_UART, &sdp2430_uart_config}, + {OMAP_TAG_LCD, &sdp2430_lcd_config}, }; @@ -182,6 +194,8 @@ static struct twl4030_hsmmc_info mmc[] __initdata = { static void __init omap_2430sdp_init(void) { + int ret; + omap2430_i2c_init(); platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); @@ -191,6 +205,11 @@ static void __init omap_2430sdp_init(void) twl4030_mmc_init(mmc); usb_musb_init(); board_smc91x_init(); + + /* Turn off secondary LCD backlight */ + ret = gpio_request(SECONDARY_LCD_GPIO, "Secondary LCD backlight"); + if (ret == 0) + gpio_direction_output(SECONDARY_LCD_GPIO, 0); } static void __init omap_2430sdp_map_io(void) |
From: Tony L. <to...@at...> - 2009-05-19 23:37:44
|
Make 770 LCD work by passing the clock from platform data. Also remove the old unused functions. Cc: lin...@li... Signed-off-by: Andrew de Quincey <ad...@li...> Signed-off-by: Imre Deak <imr...@no...> Signed-off-by: Tony Lindgren <to...@at...> --- arch/arm/mach-omap1/board-nokia770.c | 16 ++++++++++++++++ arch/arm/plat-omap/include/mach/hwa742.h | 5 +---- drivers/video/omap/hwa742.c | 26 ++++++++++---------------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c index 8780ca6..2c4785e 100644 --- a/arch/arm/mach-omap1/board-nokia770.c +++ b/arch/arm/mach-omap1/board-nokia770.c @@ -33,6 +33,7 @@ #include <mach/common.h> #include <mach/dsp_common.h> #include <mach/omapfb.h> +#include <mach/hwa742.h> #include <mach/lcd_mipid.h> #include <mach/mmc.h> #include <mach/usb.h> @@ -163,6 +164,20 @@ static struct spi_board_info nokia770_spi_board_info[] __initdata = { }, }; +static struct hwa742_platform_data nokia770_hwa742_platform_data = { + .sys_ck = NULL, + .te_connected = 1, +}; + +static void hwa742_dev_init(void) +{ + nokia770_hwa742_platform_data.sys_ck = clk_get(NULL, "bclk"); + if (IS_ERR(nokia770_hwa742_platform_data.sys_ck)) { + printk(KERN_ERR "can't get HWA742 clock\n"); + } else { + omapfb_set_ctrl_platform_data(&nokia770_hwa742_platform_data); + } +} /* assume no Mini-AB port */ @@ -371,6 +386,7 @@ static void __init omap_nokia770_init(void) omap_serial_init(); omap_register_i2c_bus(1, 100, NULL, 0); omap_dsp_init(); + hwa742_dev_init(); ads7846_dev_init(); mipid_dev_init(); omap_usb_init(&nokia770_usb_config); diff --git a/arch/arm/plat-omap/include/mach/hwa742.h b/arch/arm/plat-omap/include/mach/hwa742.h index 577f492..c00e05d 100644 --- a/arch/arm/plat-omap/include/mach/hwa742.h +++ b/arch/arm/plat-omap/include/mach/hwa742.h @@ -2,10 +2,7 @@ #define _HWA742_H struct hwa742_platform_data { - void (*power_up)(struct device *dev); - void (*power_down)(struct device *dev); - unsigned long (*get_clock_rate)(struct device *dev); - + struct clk *sys_ck; unsigned te_connected:1; }; diff --git a/drivers/video/omap/hwa742.c b/drivers/video/omap/hwa742.c index 8aa6e47..1230476 100644 --- a/drivers/video/omap/hwa742.c +++ b/drivers/video/omap/hwa742.c @@ -133,8 +133,7 @@ struct { struct lcd_ctrl_extif *extif; struct lcd_ctrl *int_ctrl; - void (*power_up)(struct device *dev); - void (*power_down)(struct device *dev); + struct clk *sys_ck; } hwa742; struct lcd_ctrl hwa742_ctrl; @@ -915,14 +914,13 @@ static void hwa742_suspend(void) hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED); /* Enable sleep mode */ hwa742_write_reg(HWA742_POWER_SAVE, 1 << 1); - if (hwa742.power_down != NULL) - hwa742.power_down(hwa742.fbdev->dev); + clk_disable(hwa742.sys_ck); } static void hwa742_resume(void) { - if (hwa742.power_up != NULL) - hwa742.power_up(hwa742.fbdev->dev); + clk_enable(hwa742.sys_ck); + /* Disable sleep mode */ hwa742_write_reg(HWA742_POWER_SAVE, 0); while (1) { @@ -955,14 +953,13 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, omapfb_conf = fbdev->dev->platform_data; ctrl_conf = omapfb_conf->ctrl_platform_data; - if (ctrl_conf == NULL || ctrl_conf->get_clock_rate == NULL) { + if (ctrl_conf == NULL || ctrl_conf->sys_ck == NULL) { dev_err(fbdev->dev, "HWA742: missing platform data\n"); r = -ENOENT; goto err1; } - hwa742.power_down = ctrl_conf->power_down; - hwa742.power_up = ctrl_conf->power_up; + hwa742.sys_ck = ctrl_conf->sys_ck; spin_lock_init(&hwa742.req_lock); @@ -972,12 +969,11 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, if ((r = hwa742.extif->init(fbdev)) < 0) goto err2; - ext_clk = ctrl_conf->get_clock_rate(fbdev->dev); + ext_clk = clk_get_rate(hwa742.sys_ck); if ((r = calc_extif_timings(ext_clk, &extif_mem_div)) < 0) goto err3; hwa742.extif->set_timings(&hwa742.reg_timings); - if (hwa742.power_up != NULL) - hwa742.power_up(fbdev->dev); + clk_enable(hwa742.sys_ck); calc_hwa742_clk_rates(ext_clk, &sys_clk, &pix_clk); if ((r = calc_extif_timings(sys_clk, &extif_mem_div)) < 0) @@ -1040,8 +1036,7 @@ static int hwa742_init(struct omapfb_device *fbdev, int ext_mode, return 0; err4: - if (hwa742.power_down != NULL) - hwa742.power_down(fbdev->dev); + clk_disable(hwa742.sys_ck); err3: hwa742.extif->cleanup(); err2: @@ -1055,8 +1050,7 @@ static void hwa742_cleanup(void) hwa742_set_update_mode(OMAPFB_UPDATE_DISABLED); hwa742.extif->cleanup(); hwa742.int_ctrl->cleanup(); - if (hwa742.power_down != NULL) - hwa742.power_down(hwa742.fbdev->dev); + clk_disable(hwa742.sys_ck); } struct lcd_ctrl hwa742_ctrl = { |
From: Krzysztof H. <krz...@po...> - 2009-05-19 21:18:28
|
On Tue, 19 May 2009 16:35:34 +0800 Harald Welte <Har...@vi...> wrote: > This patch alters viafb to use the proper Linux in-kernel API to access > PCI configuration space, rather than poking at I/O ports by itself. > > It also removes a minor inconsistency with naming of constants for the > PCI device ID of the FUNCTION3 devices. > > Signed-off-by: Harald Welte <Har...@vi...> > --- > drivers/video/via/hw.c | 64 +++++++++++++++++++++++++++++------------------ > drivers/video/via/hw.h | 4 +- > 2 files changed, 41 insertions(+), 27 deletions(-) > > diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c > index 6306c88..40b7c0c 100644 > --- a/drivers/video/via/hw.c > +++ b/drivers/video/via/hw.c > @@ -2599,24 +2599,37 @@ static void disable_second_display_channel(void) > viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6); > } > > +static u_int16_t via_function3[] = { > + CLE266_FUNCTION3, KM400_FUNCTION3, CN400_FUNCTION3, CN700_FUNCTION3, > + CX700_FUNCTION3, KM800_FUNCTION3, KM890_FUNCTION3, P4M890_FUNCTION3, > + P4M900_FUNCTION3, VX800_FUNCTION3, VX855_FUNCTION3, > +}; > + > +/* Get the BIOS-configured framebuffer size from PCI configuration space > + * of function 3 in the respective chipset */ > int viafb_get_fb_size_from_pci(void) > { > - unsigned long configid, deviceid, FBSize = 0; > - int VideoMemSize; > - int DeviceFound = false; > - > - for (configid = 0x80000000; configid < 0x80010800; configid += 0x100) { > - outl(configid, (unsigned long)0xCF8); > - deviceid = (inl((unsigned long)0xCFC) >> 16) & 0xffff; > - > - switch (deviceid) { > - case CLE266: > - case KM400: > - outl(configid + 0xE0, (unsigned long)0xCF8); > - FBSize = inl((unsigned long)0xCFC); > - DeviceFound = true; /* Found device id */ > - break; > + int i; > + u_int8_t offset = 0; > + u_int32_t FBSize; > + u_int32_t VideoMemSize; > + > + /* search for the "FUNCTION3" device in this chipset */ > + for (i = 0; i < ARRAY_SIZE(via_function3); i++) { > + struct pci_dev *pdev; > + > + pdev = pci_get_device(PCI_VENDOR_ID_VIA, via_function3[i], > + NULL); Can you pass the pdev pointer from the probe function here and skip the whole searching of the PCI device? Regards, Krzysztof ---------------------------------------------------------------------- Audi kilka tysiecy zlotych taniej? Przebieraj wsrod tysiecy ogloszen! Sprawdz: http://link.interia.pl/f216f |
From: Krzysztof H. <krz...@po...> - 2009-05-19 21:10:37
|
On Tue, 19 May 2009 16:34:18 +0800 Harald Welte <Har...@vi...> wrote: > This patch modifies the viafb driver to use the normal 'struct pci_driver' > method for registering a PCI driver with the Linux kernel. > > --- Acked-by: Krzysztof Helt <krz...@wp...> One comment below. > drivers/video/via/hw.c | 116 +++-------------------------------------- > drivers/video/via/hw.h | 7 +-- > drivers/video/via/viafbdev.c | 65 ++++++++++++++++++++--- > 3 files changed, 68 insertions(+), 120 deletions(-) > > diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c > index b111b6c..6306c88 100644 > --- a/drivers/video/via/hw.c > +++ b/drivers/video/via/hw.c > @@ -21,22 +21,6 @@ > > #include "global.h" > > -static const struct pci_device_id_info pciidlist[] = { > - {PCI_VIA_VENDOR_ID, UNICHROME_CLE266_DID, UNICHROME_CLE266}, > - {PCI_VIA_VENDOR_ID, UNICHROME_PM800_DID, UNICHROME_PM800}, > - {PCI_VIA_VENDOR_ID, UNICHROME_K400_DID, UNICHROME_K400}, > - {PCI_VIA_VENDOR_ID, UNICHROME_K800_DID, UNICHROME_K800}, > - {PCI_VIA_VENDOR_ID, UNICHROME_CN700_DID, UNICHROME_CN700}, > - {PCI_VIA_VENDOR_ID, UNICHROME_P4M890_DID, UNICHROME_P4M890}, > - {PCI_VIA_VENDOR_ID, UNICHROME_K8M890_DID, UNICHROME_K8M890}, > - {PCI_VIA_VENDOR_ID, UNICHROME_CX700_DID, UNICHROME_CX700}, > - {PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900}, > - {PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750}, > - {PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800}, > - {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855}, > - {0, 0, 0} > -}; > - > struct offset offset_reg = { > /* IGA1 Offset Register */ > {IGA1_OFFSET_REG_NUM, {{CR13, 0, 7}, {CR35, 5, 7} } }, > @@ -549,7 +533,8 @@ static void set_dvi_output_path(int set_iga, int output_interface); > static void set_lcd_output_path(int set_iga, int output_interface); > static int search_mode_setting(int ModeInfoIndex); > static void load_fix_bit_crtc_reg(void); > -static void init_gfx_chip_info(void); > +static void init_gfx_chip_info(struct pci_dev *pdev, > + const struct pci_device_id *pdi); > static void init_tmds_chip_info(void); > static void init_lvds_chip_info(void); > static void device_screen_off(void); > @@ -559,7 +544,6 @@ static void device_off(void); > static void device_on(void); > static void enable_second_display_channel(void); > static void disable_second_display_channel(void); > -static int get_fb_size_from_pci(void); > > void viafb_write_reg(u8 index, u16 io_port, u8 data) > { > @@ -1996,9 +1980,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table, > > } > > -void viafb_init_chip_info(void) > +void viafb_init_chip_info(struct pci_dev *pdev, > + const struct pci_device_id *pdi) > { > - init_gfx_chip_info(); > + init_gfx_chip_info(pdev, pdi); > init_tmds_chip_info(); > init_lvds_chip_info(); > > @@ -2071,24 +2056,12 @@ void viafb_update_device_setting(int hres, int vres, > } > } > > -static void init_gfx_chip_info(void) > +static void init_gfx_chip_info(struct pci_dev *pdev, > + const struct pci_device_id *pdi) > { > - struct pci_dev *pdev = NULL; > - u32 i; > u8 tmp; > > - /* Indentify GFX Chip Name */ > - for (i = 0; pciidlist[i].vendor != 0; i++) { > - pdev = pci_get_device(pciidlist[i].vendor, > - pciidlist[i].device, 0); > - if (pdev) > - break; > - } > - > - if (!pciidlist[i].vendor) > - return ; > - > - viaparinfo->chip_info->gfx_chip_name = pciidlist[i].chip_index; > + viaparinfo->chip_info->gfx_chip_name = pdi->driver_data; > > /* Check revision of CLE266 Chip */ > if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) { > @@ -2119,8 +2092,6 @@ static void init_gfx_chip_info(void) > CX700_REVISION_700; > } > } > - > - pci_dev_put(pdev); > } > > static void init_tmds_chip_info(void) > @@ -2612,38 +2583,6 @@ void viafb_crt_enable(void) > viafb_write_reg_mask(CR36, VIACR, 0x0, BIT5 + BIT4); > } > > -void viafb_get_mmio_info(unsigned long *mmio_base, > - unsigned long *mmio_len) > -{ > - struct pci_dev *pdev = NULL; > - u32 vendor, device; > - u32 i; > - > - for (i = 0; pciidlist[i].vendor != 0; i++) > - if (viaparinfo->chip_info->gfx_chip_name == > - pciidlist[i].chip_index) > - break; > - > - if (!pciidlist[i].vendor) > - return ; > - > - vendor = pciidlist[i].vendor; > - device = pciidlist[i].device; > - > - pdev = pci_get_device(vendor, device, NULL); > - > - if (!pdev) { > - *mmio_base = 0; > - *mmio_len = 0; > - return ; > - } > - > - *mmio_base = pci_resource_start(pdev, 1); > - *mmio_len = pci_resource_len(pdev, 1); > - > - pci_dev_put(pdev); > -} > - > static void enable_second_display_channel(void) > { > /* to enable second display channel. */ > @@ -2660,44 +2599,7 @@ static void disable_second_display_channel(void) > viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6); > } > > -void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len) > -{ > - struct pci_dev *pdev = NULL; > - u32 vendor, device; > - u32 i; > - > - for (i = 0; pciidlist[i].vendor != 0; i++) > - if (viaparinfo->chip_info->gfx_chip_name == > - pciidlist[i].chip_index) > - break; > - > - if (!pciidlist[i].vendor) > - return ; > - > - vendor = pciidlist[i].vendor; > - device = pciidlist[i].device; > - > - pdev = pci_get_device(vendor, device, NULL); > - > - if (!pdev) { > - *fb_base = viafb_read_reg(VIASR, SR30) << 24; > - *fb_len = viafb_get_memsize(); > - DEBUG_MSG(KERN_INFO "Get FB info from SR30!\n"); > - DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base); > - DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len); > - return ; > - } > - > - *fb_base = (unsigned int)pci_resource_start(pdev, 0); > - *fb_len = get_fb_size_from_pci(); > - DEBUG_MSG(KERN_INFO "Get FB info from PCI system!\n"); > - DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base); > - DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len); > - > - pci_dev_put(pdev); > -} > - > -static int get_fb_size_from_pci(void) > +int viafb_get_fb_size_from_pci(void) > { > unsigned long configid, deviceid, FBSize = 0; > int VideoMemSize; > diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h > index 22786a5..1cd0648 100644 > --- a/drivers/video/via/hw.h > +++ b/drivers/video/via/hw.h > @@ -931,17 +931,16 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\ > int viafb_setmode(int vmode_index, int hor_res, int ver_res, > int video_bpp, int vmode_index1, int hor_res1, > int ver_res1, int video_bpp1); > -void viafb_init_chip_info(void); > +void viafb_init_chip_info(struct pci_dev *pdev, > + const struct pci_device_id *pdi); > void viafb_init_dac(int set_iga); > int viafb_get_pixclock(int hres, int vres, int vmode_refresh); > int viafb_get_refresh(int hres, int vres, u32 float_refresh); > void viafb_update_device_setting(int hres, int vres, int bpp, > int vmode_refresh, int flag); > -void viafb_get_mmio_info(unsigned long *mmio_base, > - unsigned long *mmio_len); > > +int viafb_get_fb_size_from_pci(void); > void viafb_set_iga_path(void); > void viafb_set_start_addr(void); > -void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len); > > #endif /* __HW_H__ */ > diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c > index 055d67d..32c26cc 100644 > --- a/drivers/video/via/viafbdev.c > +++ b/drivers/video/via/viafbdev.c > @@ -2104,7 +2104,8 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry) > remove_proc_entry("viafb", NULL); > } > > -static int __devinit via_pci_probe(void) > +static int __devinit via_pci_probe(struct pci_dev *pdev, > + const struct pci_device_id *ent) > { > unsigned long default_xres, default_yres; > char *tmpc, *tmpm; > @@ -2128,7 +2128,8 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, > * variables > */ > viafbinfo = framebuffer_alloc(viafb_par_length + 2 * lvds_length + > - tmds_length + crt_length + chip_length, NULL); > + tmds_length + crt_length + chip_length, > + &pdev->dev); > if (!viafbinfo) { > printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); > return -ENOMEM; > @@ -2161,8 +2162,9 @@ static int __devinit via_pci_probe(void) > if (rc) > goto out_fb_release; > > - viafb_init_chip_info(); > - viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize); > + viafb_init_chip_info(pdev, ent); > + viaparinfo->fbmem = pci_resource_start(pdev, 0); > + viaparinfo->memsize = viafb_get_fb_size_from_pci(); > viaparinfo->fbmem_free = viaparinfo->memsize; > viaparinfo->fbmem_used = 0; > viaparinfo->fbmem_virt = ioremap_nocache(viaparinfo->fbmem, > @@ -2170,14 +2172,20 @@ static int __devinit via_pci_probe(void) > viafbinfo->screen_base = (char *)viaparinfo->fbmem_virt; > > if (!viaparinfo->fbmem_virt) { > - printk(KERN_INFO "ioremap failed\n"); > + printk(KERN_ERR "ioremap of fbmem failed\n"); > rc = -EIO; > goto out_delete_i2c; > } > > - viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); > + viaparinfo->mmio_base = pci_resource_start(pdev, 1); > + viaparinfo->mmio_len = pci_resource_len(pdev, 1); Again, there are standard fields which have the same meaning: viafbinfo->mmio_start and viafbinfo->mmio_len. > viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base, > viaparinfo->mmio_len); > + if (!viaparinfo->io_virt) { > + printk(KERN_ERR "ioremap of MMIO failed\n"); > + rc = -EIO; > + goto out_unmap_fbmem; > + } > > viafbinfo->node = 0; > viafbinfo->fbops = &viafb_ops; > @@ -2285,7 +2293,8 @@ static int __devinit via_pci_probe(void) > printk(KERN_ERR > "allocate the second framebuffer struct error\n"); > framebuffer_release(viafbinfo); > - goto out_delete_i2c; > + rc = -ENOMEM; > + goto out_unmap_mmio; > } > viaparinfo1 = viafbinfo1->par; > memcpy(viaparinfo1, viaparinfo, viafb_par_length); > @@ -2386,6 +2395,10 @@ out_dealloc_cmap: > out_fb1_release: > if (viafbinfo1) > framebuffer_release(viafbinfo1); > +out_unmap_mmio: > + iounmap(viaparinfo->io_virt); > +out_unmap_fbmem: > + iounmap((void *)viaparinfo->fbmem_virt); > out_delete_i2c: > viafb_delete_i2c_buss(viaparinfo); > out_fb_release: > @@ -2393,7 +2406,7 @@ out_fb_release: > return rc; > } > > -static void __devexit via_pci_remove(void) > +static void __devexit via_pci_remove(struct pci_dev *pdev) > { > DEBUG_MSG(KERN_INFO "via_pci_remove!\n"); > fb_dealloc_cmap(&viafbinfo->cmap); > @@ -2487,6 +2500,40 @@ static int __init viafb_setup(char *options) > } > #endif > > +static struct pci_device_id viafb_pci_table[] __devinitdata = { > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CLE266_DID), > + .driver_data = UNICHROME_CLE266 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_PM800_DID), > + .driver_data = UNICHROME_PM800 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K400_DID), > + .driver_data = UNICHROME_K400 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K800_DID), > + .driver_data = UNICHROME_K800 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M890_DID), > + .driver_data = UNICHROME_CN700 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K8M890_DID), > + .driver_data = UNICHROME_K8M890 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CX700_DID), > + .driver_data = UNICHROME_CX700 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M900_DID), > + .driver_data = UNICHROME_P4M900 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CN750_DID), > + .driver_data = UNICHROME_CN750 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX800_DID), > + .driver_data = UNICHROME_VX800 }, > + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX855_DID), > + .driver_data = UNICHROME_VX855 }, > + { } > +}; > +MODULE_DEVICE_TABLE(pci, viafb_pci_table); > + > +static struct pci_driver viafb_driver = { > + .name = "viafb", > + .id_table = viafb_pci_table, > + .probe = via_pci_probe, > + .remove = __devexit_p(via_pci_remove), > +}; > + > static int __init viafb_init(void) > { > #ifndef MODULE > @@ -2498,13 +2545,13 @@ static int __init viafb_init(void) > printk(KERN_INFO > "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n", > VERSION_MAJOR, VERSION_MINOR); > - return via_pci_probe(); > + return pci_register_driver(&viafb_driver); > } > > static void __exit viafb_exit(void) > { > DEBUG_MSG(KERN_INFO "viafb_exit!\n"); > - via_pci_remove(); > + pci_unregister_driver(&viafb_driver); > } > > static struct fb_ops viafb_ops = { > > -- > 1.6.2.4 > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables > unlimited royalty-free distribution of the report engine > for externally facing server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Linux-fbdev-devel mailing list > Lin...@li... > https://lists.sourceforge.net/lists/listinfo/linux-fbdev-devel > ---------------------------------------------------------------------- Zrob sobie prezent. Wygraj nagrode! Sprawdz >> http://link.interia.pl/f2176 |
From: Harald W. <Har...@vi...> - 2009-05-19 09:30:31
|
Hi Krysztof, thanks for your feedback. On Tue, May 19, 2009 at 10:00:43AM +0200, Krzysztof Helt wrote: > I strongly recommend not to duplicate standard fields: fb_info.fix.smem_base and > fb_info.fix.smem_len (and fb_info.screen_base and fb_info.screen_size). of course. I have just started to dig into viafb, and there is a long list of issues that I'd like to improve over time. getting rid of a lot of global variables, duplicated fields, bringing it more in line with the kernel infrastructure as well as improving the overall code structure... > I would like to see conversion: > viainfo->fbmem => viaifbnfo->screen_base (physical address) > ? => viafbinfo->screen_size (physical size) > viaparinfo->fbmem_virt => viafbinfo->fix.smem_start (virtual address) > viaparinfo->memsize => viafbinfo->fix.smem_len (virtual size) > > You may try dropping the global viaparinfo pointer as well (and just get it > as viafbinfo->par if needed). > > These changes should be sent as a separate patch. yes, I will do this as a cleanup patch on top of my current work. > > viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); > > @@ -2279,7 +2282,7 @@ static int __devinit via_pci_probe(void) > > printk(KERN_ERR > > "allocate the second framebuffer struct error\n"); > > framebuffer_release(viafbinfo); > > - return -ENOMEM; > > + goto out_delete_i2c; > > } > > The framebuffer_release(viafbinfo) will be called twice now. good catch, fixed in my tree now. > > + > > +out_fb_unreg: > > + unregister_framebuffer(viafbinfo); > > +out_fb1_unreg_lcd_cle266: > > + if (viafbinfo1 && (viafb_primary_dev == LCD_Device) > > + && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) > > + unregister_framebuffer(viafbinfo1); > > The condition here differs from the condition used during viafbinfo1 register > (viafb_dual_fb vs. viafbinfo1). thanks. This was actually intentional, since it only makes sense to unregister viafbinfo1 if it actually exists. But in any case, it doesn't make a practical difference, so I have altered it to check for viafb_dual_info -- - Harald Welte <Har...@vi...> http://linux.via.com.tw/ ============================================================================ VIA Open Source Liaison |
From: Harald W. <Har...@vi...> - 2009-05-19 09:30:31
|
On Tue, May 19, 2009 at 10:07:48AM +0200, Krzysztof Helt wrote: > I believe it is correct. I have no chance to test. > Acked-by: Krzysztof Helt <krz...@wp...> Thanks for your review. Right now, nobody but VIA and OLPC has hardware to test, as far as I know. This is why I'm pushing for this code to get included now, i.e. the kernel works on the hardware once it ships in quantity. > > +/* For VT3409 */ > > +#define VX855_IGA1_FIFO_MAX_DEPTH 400 > > +#define VX855_IGA1_FIFO_THRESHOLD 320 > > +#define VX855_IGA1_FIFO_HIGH_THRESHOLD 320 > > Are these two values above always the same? If so you can use > a single symbol. Well, as you can see, they are not the same on other chips than the VX855, so I left the two separate #defines to be orthogonal. I hope I find enough time to clean this up and have all those values in a structure, indexed by the chip variant at some point. -- - Harald Welte <Har...@vi...> http://linux.via.com.tw/ ============================================================================ VIA Open Source Liaison |
From: Haavard S. <haa...@at...> - 2009-05-19 08:46:53
|
Nicolas Ferre wrote: > Remove wrong fifo size definition for some AT91 products. > > Due to a misunderstanding of some AT91 datasheets, a fifo size of 2048 (words) > has been introduced by mistake. In fact, all products (AT91/AT32) are sharing > the same fifo size of 512 words. > > Signed-off-by: Nicolas Ferre <nic...@at...> > --- > Can we consider this fix for .30-final ? Fine by me as it doesn't affect AVR32 in any way. Haavard |
From: Harald W. <Har...@vi...> - 2009-05-19 08:36:05
|
This patch modifies the viafb driver to use the normal 'struct pci_driver' method for registering a PCI driver with the Linux kernel. --- drivers/video/via/hw.c | 116 +++-------------------------------------- drivers/video/via/hw.h | 7 +-- drivers/video/via/viafbdev.c | 65 ++++++++++++++++++++--- 3 files changed, 68 insertions(+), 120 deletions(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index b111b6c..6306c88 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -21,22 +21,6 @@ #include "global.h" -static const struct pci_device_id_info pciidlist[] = { - {PCI_VIA_VENDOR_ID, UNICHROME_CLE266_DID, UNICHROME_CLE266}, - {PCI_VIA_VENDOR_ID, UNICHROME_PM800_DID, UNICHROME_PM800}, - {PCI_VIA_VENDOR_ID, UNICHROME_K400_DID, UNICHROME_K400}, - {PCI_VIA_VENDOR_ID, UNICHROME_K800_DID, UNICHROME_K800}, - {PCI_VIA_VENDOR_ID, UNICHROME_CN700_DID, UNICHROME_CN700}, - {PCI_VIA_VENDOR_ID, UNICHROME_P4M890_DID, UNICHROME_P4M890}, - {PCI_VIA_VENDOR_ID, UNICHROME_K8M890_DID, UNICHROME_K8M890}, - {PCI_VIA_VENDOR_ID, UNICHROME_CX700_DID, UNICHROME_CX700}, - {PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900}, - {PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750}, - {PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800}, - {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855}, - {0, 0, 0} -}; - struct offset offset_reg = { /* IGA1 Offset Register */ {IGA1_OFFSET_REG_NUM, {{CR13, 0, 7}, {CR35, 5, 7} } }, @@ -549,7 +533,8 @@ static void set_dvi_output_path(int set_iga, int output_interface); static void set_lcd_output_path(int set_iga, int output_interface); static int search_mode_setting(int ModeInfoIndex); static void load_fix_bit_crtc_reg(void); -static void init_gfx_chip_info(void); +static void init_gfx_chip_info(struct pci_dev *pdev, + const struct pci_device_id *pdi); static void init_tmds_chip_info(void); static void init_lvds_chip_info(void); static void device_screen_off(void); @@ -559,7 +544,6 @@ static void device_off(void); static void device_on(void); static void enable_second_display_channel(void); static void disable_second_display_channel(void); -static int get_fb_size_from_pci(void); void viafb_write_reg(u8 index, u16 io_port, u8 data) { @@ -1996,9 +1980,10 @@ void viafb_fill_crtc_timing(struct crt_mode_table *crt_table, } -void viafb_init_chip_info(void) +void viafb_init_chip_info(struct pci_dev *pdev, + const struct pci_device_id *pdi) { - init_gfx_chip_info(); + init_gfx_chip_info(pdev, pdi); init_tmds_chip_info(); init_lvds_chip_info(); @@ -2071,24 +2056,12 @@ void viafb_update_device_setting(int hres, int vres, } } -static void init_gfx_chip_info(void) +static void init_gfx_chip_info(struct pci_dev *pdev, + const struct pci_device_id *pdi) { - struct pci_dev *pdev = NULL; - u32 i; u8 tmp; - /* Indentify GFX Chip Name */ - for (i = 0; pciidlist[i].vendor != 0; i++) { - pdev = pci_get_device(pciidlist[i].vendor, - pciidlist[i].device, 0); - if (pdev) - break; - } - - if (!pciidlist[i].vendor) - return ; - - viaparinfo->chip_info->gfx_chip_name = pciidlist[i].chip_index; + viaparinfo->chip_info->gfx_chip_name = pdi->driver_data; /* Check revision of CLE266 Chip */ if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266) { @@ -2119,8 +2092,6 @@ static void init_gfx_chip_info(void) CX700_REVISION_700; } } - - pci_dev_put(pdev); } static void init_tmds_chip_info(void) @@ -2612,38 +2583,6 @@ void viafb_crt_enable(void) viafb_write_reg_mask(CR36, VIACR, 0x0, BIT5 + BIT4); } -void viafb_get_mmio_info(unsigned long *mmio_base, - unsigned long *mmio_len) -{ - struct pci_dev *pdev = NULL; - u32 vendor, device; - u32 i; - - for (i = 0; pciidlist[i].vendor != 0; i++) - if (viaparinfo->chip_info->gfx_chip_name == - pciidlist[i].chip_index) - break; - - if (!pciidlist[i].vendor) - return ; - - vendor = pciidlist[i].vendor; - device = pciidlist[i].device; - - pdev = pci_get_device(vendor, device, NULL); - - if (!pdev) { - *mmio_base = 0; - *mmio_len = 0; - return ; - } - - *mmio_base = pci_resource_start(pdev, 1); - *mmio_len = pci_resource_len(pdev, 1); - - pci_dev_put(pdev); -} - static void enable_second_display_channel(void) { /* to enable second display channel. */ @@ -2660,44 +2599,7 @@ static void disable_second_display_channel(void) viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6); } -void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len) -{ - struct pci_dev *pdev = NULL; - u32 vendor, device; - u32 i; - - for (i = 0; pciidlist[i].vendor != 0; i++) - if (viaparinfo->chip_info->gfx_chip_name == - pciidlist[i].chip_index) - break; - - if (!pciidlist[i].vendor) - return ; - - vendor = pciidlist[i].vendor; - device = pciidlist[i].device; - - pdev = pci_get_device(vendor, device, NULL); - - if (!pdev) { - *fb_base = viafb_read_reg(VIASR, SR30) << 24; - *fb_len = viafb_get_memsize(); - DEBUG_MSG(KERN_INFO "Get FB info from SR30!\n"); - DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base); - DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len); - return ; - } - - *fb_base = (unsigned int)pci_resource_start(pdev, 0); - *fb_len = get_fb_size_from_pci(); - DEBUG_MSG(KERN_INFO "Get FB info from PCI system!\n"); - DEBUG_MSG(KERN_INFO "fb_base = %08x\n", *fb_base); - DEBUG_MSG(KERN_INFO "fb_len = %08x\n", *fb_len); - - pci_dev_put(pdev); -} - -static int get_fb_size_from_pci(void) +int viafb_get_fb_size_from_pci(void) { unsigned long configid, deviceid, FBSize = 0; int VideoMemSize; diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h index 22786a5..1cd0648 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/via/hw.h @@ -931,17 +931,16 @@ void viafb_set_dpa_gfx(int output_interface, struct GFX_DPA_SETTING\ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp, int vmode_index1, int hor_res1, int ver_res1, int video_bpp1); -void viafb_init_chip_info(void); +void viafb_init_chip_info(struct pci_dev *pdev, + const struct pci_device_id *pdi); void viafb_init_dac(int set_iga); int viafb_get_pixclock(int hres, int vres, int vmode_refresh); int viafb_get_refresh(int hres, int vres, u32 float_refresh); void viafb_update_device_setting(int hres, int vres, int bpp, int vmode_refresh, int flag); -void viafb_get_mmio_info(unsigned long *mmio_base, - unsigned long *mmio_len); +int viafb_get_fb_size_from_pci(void); void viafb_set_iga_path(void); void viafb_set_start_addr(void); -void viafb_get_fb_info(unsigned int *fb_base, unsigned int *fb_len); #endif /* __HW_H__ */ diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 055d67d..32c26cc 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -2104,7 +2104,8 @@ static void viafb_remove_proc(struct proc_dir_entry *viafb_entry) remove_proc_entry("viafb", NULL); } -static int __devinit via_pci_probe(void) +static int __devinit via_pci_probe(struct pci_dev *pdev, + const struct pci_device_id *ent) { unsigned long default_xres, default_yres; char *tmpc, *tmpm; @@ -2128,7 +2128,8 @@ static int __devinit via_pci_probe(struct pci_dev *pdev, * variables */ viafbinfo = framebuffer_alloc(viafb_par_length + 2 * lvds_length + - tmds_length + crt_length + chip_length, NULL); + tmds_length + crt_length + chip_length, + &pdev->dev); if (!viafbinfo) { printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); return -ENOMEM; @@ -2161,8 +2162,9 @@ static int __devinit via_pci_probe(void) if (rc) goto out_fb_release; - viafb_init_chip_info(); - viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize); + viafb_init_chip_info(pdev, ent); + viaparinfo->fbmem = pci_resource_start(pdev, 0); + viaparinfo->memsize = viafb_get_fb_size_from_pci(); viaparinfo->fbmem_free = viaparinfo->memsize; viaparinfo->fbmem_used = 0; viaparinfo->fbmem_virt = ioremap_nocache(viaparinfo->fbmem, @@ -2170,14 +2172,20 @@ static int __devinit via_pci_probe(void) viafbinfo->screen_base = (char *)viaparinfo->fbmem_virt; if (!viaparinfo->fbmem_virt) { - printk(KERN_INFO "ioremap failed\n"); + printk(KERN_ERR "ioremap of fbmem failed\n"); rc = -EIO; goto out_delete_i2c; } - viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); + viaparinfo->mmio_base = pci_resource_start(pdev, 1); + viaparinfo->mmio_len = pci_resource_len(pdev, 1); viaparinfo->io_virt = ioremap_nocache(viaparinfo->mmio_base, viaparinfo->mmio_len); + if (!viaparinfo->io_virt) { + printk(KERN_ERR "ioremap of MMIO failed\n"); + rc = -EIO; + goto out_unmap_fbmem; + } viafbinfo->node = 0; viafbinfo->fbops = &viafb_ops; @@ -2285,7 +2293,8 @@ static int __devinit via_pci_probe(void) printk(KERN_ERR "allocate the second framebuffer struct error\n"); framebuffer_release(viafbinfo); - goto out_delete_i2c; + rc = -ENOMEM; + goto out_unmap_mmio; } viaparinfo1 = viafbinfo1->par; memcpy(viaparinfo1, viaparinfo, viafb_par_length); @@ -2386,6 +2395,10 @@ out_dealloc_cmap: out_fb1_release: if (viafbinfo1) framebuffer_release(viafbinfo1); +out_unmap_mmio: + iounmap(viaparinfo->io_virt); +out_unmap_fbmem: + iounmap((void *)viaparinfo->fbmem_virt); out_delete_i2c: viafb_delete_i2c_buss(viaparinfo); out_fb_release: @@ -2393,7 +2406,7 @@ out_fb_release: return rc; } -static void __devexit via_pci_remove(void) +static void __devexit via_pci_remove(struct pci_dev *pdev) { DEBUG_MSG(KERN_INFO "via_pci_remove!\n"); fb_dealloc_cmap(&viafbinfo->cmap); @@ -2487,6 +2500,40 @@ static int __init viafb_setup(char *options) } #endif +static struct pci_device_id viafb_pci_table[] __devinitdata = { + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CLE266_DID), + .driver_data = UNICHROME_CLE266 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_PM800_DID), + .driver_data = UNICHROME_PM800 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K400_DID), + .driver_data = UNICHROME_K400 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K800_DID), + .driver_data = UNICHROME_K800 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M890_DID), + .driver_data = UNICHROME_CN700 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_K8M890_DID), + .driver_data = UNICHROME_K8M890 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CX700_DID), + .driver_data = UNICHROME_CX700 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_P4M900_DID), + .driver_data = UNICHROME_P4M900 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_CN750_DID), + .driver_data = UNICHROME_CN750 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX800_DID), + .driver_data = UNICHROME_VX800 }, + { PCI_DEVICE(PCI_VENDOR_ID_VIA, UNICHROME_VX855_DID), + .driver_data = UNICHROME_VX855 }, + { } +}; +MODULE_DEVICE_TABLE(pci, viafb_pci_table); + +static struct pci_driver viafb_driver = { + .name = "viafb", + .id_table = viafb_pci_table, + .probe = via_pci_probe, + .remove = __devexit_p(via_pci_remove), +}; + static int __init viafb_init(void) { #ifndef MODULE @@ -2498,13 +2545,13 @@ static int __init viafb_init(void) printk(KERN_INFO "VIA Graphics Intergration Chipset framebuffer %d.%d initializing\n", VERSION_MAJOR, VERSION_MINOR); - return via_pci_probe(); + return pci_register_driver(&viafb_driver); } static void __exit viafb_exit(void) { DEBUG_MSG(KERN_INFO "viafb_exit!\n"); - via_pci_remove(); + pci_unregister_driver(&viafb_driver); } static struct fb_ops viafb_ops = { -- 1.6.2.4 |
From: Harald W. <Har...@vi...> - 2009-05-19 08:36:02
|
This patch alters viafb to use the proper Linux in-kernel API to access PCI configuration space, rather than poking at I/O ports by itself. It also removes a minor inconsistency with naming of constants for the PCI device ID of the FUNCTION3 devices. Signed-off-by: Harald Welte <Har...@vi...> --- drivers/video/via/hw.c | 64 +++++++++++++++++++++++++++++------------------ drivers/video/via/hw.h | 4 +- 2 files changed, 41 insertions(+), 27 deletions(-) diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 6306c88..40b7c0c 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -2599,24 +2599,37 @@ static void disable_second_display_channel(void) viafb_write_reg_mask(CR6A, VIACR, BIT6, BIT6); } +static u_int16_t via_function3[] = { + CLE266_FUNCTION3, KM400_FUNCTION3, CN400_FUNCTION3, CN700_FUNCTION3, + CX700_FUNCTION3, KM800_FUNCTION3, KM890_FUNCTION3, P4M890_FUNCTION3, + P4M900_FUNCTION3, VX800_FUNCTION3, VX855_FUNCTION3, +}; + +/* Get the BIOS-configured framebuffer size from PCI configuration space + * of function 3 in the respective chipset */ int viafb_get_fb_size_from_pci(void) { - unsigned long configid, deviceid, FBSize = 0; - int VideoMemSize; - int DeviceFound = false; - - for (configid = 0x80000000; configid < 0x80010800; configid += 0x100) { - outl(configid, (unsigned long)0xCF8); - deviceid = (inl((unsigned long)0xCFC) >> 16) & 0xffff; - - switch (deviceid) { - case CLE266: - case KM400: - outl(configid + 0xE0, (unsigned long)0xCF8); - FBSize = inl((unsigned long)0xCFC); - DeviceFound = true; /* Found device id */ - break; + int i; + u_int8_t offset = 0; + u_int32_t FBSize; + u_int32_t VideoMemSize; + + /* search for the "FUNCTION3" device in this chipset */ + for (i = 0; i < ARRAY_SIZE(via_function3); i++) { + struct pci_dev *pdev; + + pdev = pci_get_device(PCI_VENDOR_ID_VIA, via_function3[i], + NULL); + if (!pdev) + continue; + + DEBUG_MSG(KERN_INFO "Device ID = %x\n", pdev->device); + switch (pdev->device) { + case CLE266_FUNCTION3: + case KM400_FUNCTION3: + offset = 0xE0; + break; case CN400_FUNCTION3: case CN700_FUNCTION3: case CX700_FUNCTION3: @@ -2626,21 +2639,22 @@ int viafb_get_fb_size_from_pci(void) case P4M900_FUNCTION3: case VX800_FUNCTION3: case VX855_FUNCTION3: - /*case CN750_FUNCTION3: */ - outl(configid + 0xA0, (unsigned long)0xCF8); - FBSize = inl((unsigned long)0xCFC); - DeviceFound = true; /* Found device id */ - break; - - default: + /*case CN750_FUNCTION3: */ + offset = 0xA0; break; } - - if (DeviceFound) + + if (!offset) break; + + pci_read_config_dword(pdev, offset, &FBSize); + pci_dev_put(pdev); } - DEBUG_MSG(KERN_INFO "Device ID = %lx\n", deviceid); + if (!offset) { + printk(KERN_ERR "cannot determine framebuffer size\n"); + return -EIO; + } FBSize = FBSize & 0x00007000; DEBUG_MSG(KERN_INFO "FB Size = %x\n", FBSize); diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h index 1cd0648..a69e907 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/via/hw.h @@ -850,8 +850,8 @@ struct iga2_crtc_timing { }; /* device ID */ -#define CLE266 0x3123 -#define KM400 0x3205 +#define CLE266_FUNCTION3 0x3123 +#define KM400_FUNCTION3 0x3205 #define CN400_FUNCTION2 0x2259 #define CN400_FUNCTION3 0x3259 /* support VT3314 chipset */ -- 1.6.2.4 |
From: Krzysztof H. <krz...@po...> - 2009-05-19 08:01:46
|
On Tue, 19 May 2009 11:52:54 +0800 Harald Welte <Har...@vi...> wrote: > This patch adds support for a new VIA integrated graphics chipset, the VX855. > > Signed-off-by: HaraldWelte <Har...@vi...> > --- I believe it is correct. I have no chance to test. Acked-by: Krzysztof Helt <krz...@wp...> Only one small comment below. Kind regards, Krzysztof > drivers/video/via/chip.h | 3 + > drivers/video/via/hw.c | 203 ++++++++++++++++++++++++++++-------------- > drivers/video/via/hw.h | 14 +++ > drivers/video/via/share.h | 98 ++++++++++++++++++++ > drivers/video/via/viafbdev.c | 7 +- > drivers/video/via/viamode.c | 55 +++++++++++ > drivers/video/via/viamode.h | 2 + > 7 files changed, 312 insertions(+), 70 deletions(-) > (...) > diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h > index 6ff38fa..22786a5 100644 > --- a/drivers/video/via/hw.h > +++ b/drivers/video/via/hw.h > @@ -335,6 +335,17 @@ is reserved, so it may have problem to set 1600x1200 on IGA2. */ > /* location: {CR94,0,6} */ > #define VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 128 > > +/* For VT3409 */ > +#define VX855_IGA1_FIFO_MAX_DEPTH 400 > +#define VX855_IGA1_FIFO_THRESHOLD 320 > +#define VX855_IGA1_FIFO_HIGH_THRESHOLD 320 Are these two values above always the same? If so you can use a single symbol. > +#define VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM 160 > + > +#define VX855_IGA2_FIFO_MAX_DEPTH 200 > +#define VX855_IGA2_FIFO_THRESHOLD 160 > +#define VX855_IGA2_FIFO_HIGH_THRESHOLD 160 > +#define VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 320 > + > #define IGA1_FIFO_DEPTH_SELECT_REG_NUM 1 > #define IGA1_FIFO_THRESHOLD_REG_NUM 2 > #define IGA1_FIFO_HIGH_THRESHOLD_REG_NUM 2 > @@ -716,6 +727,7 @@ struct pll_map { > u32 cle266_pll; > u32 k800_pll; > u32 cx700_pll; > + u32 vx855_pll; > }; > > struct rgbLUT { > @@ -860,6 +872,8 @@ struct iga2_crtc_timing { > #define P4M900_FUNCTION3 0x3364 > /* VT3353 chipset*/ > #define VX800_FUNCTION3 0x3353 > +/* VT3409 chipset*/ > +#define VX855_FUNCTION3 0x3409 > > #define NUM_TOTAL_PLL_TABLE ARRAY_SIZE(pll_value) > ---------------------------------------------------------------------- Audi kilka tysiecy zlotych taniej? Przebieraj wsrod tysiecy ogloszen! Sprawdz: http://link.interia.pl/f216f |
From: Krzysztof H. <krz...@po...> - 2009-05-19 07:55:44
|
On Tue, 19 May 2009 11:52:01 +0800 Harald Welte <Har...@vi...> wrote: > Signed-off-by: Harald Welte <Har...@vi...> > --- Acked-by: Krzysztof Helt <krz...@wp...> > drivers/video/via/hw.c | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c > index fcd53ce..59ddf09 100644 > --- a/drivers/video/via/hw.c > +++ b/drivers/video/via/hw.c > @@ -2272,6 +2272,7 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp, > > case UNICHROME_CX700: > viafb_write_regx(CX700_ModeXregs, NUM_TOTAL_CX700_ModeXregs); > + break; > > case UNICHROME_VX800: > viafb_write_regx(VX800_ModeXregs, NUM_TOTAL_VX800_ModeXregs); > -- > 1.6.2.4 > ---------------------------------------------------------------------- Sprawdz pogode na dzis! Kliknij >>> http://link.interia.pl/f217d |
From: Krzysztof H. <krz...@po...> - 2009-05-19 07:54:43
|
Hi Harald, On Tue, 19 May 2009 11:51:05 +0800 Harald Welte <Har...@vi...> wrote: > The current code executed from module_init() in viafb does not have > proper error checking and [partial] resoure release paths in case > an error happens half way through driver initialization. > > This patch adresses the most obvious of those issues, such as a > leftover i2c bus if module_init (and thus module load) fails. > > Signed-off-by: Harald Welte <Har...@vi...> > --- > drivers/video/via/viafbdev.c | 51 +++++++++++++++++++++++++++++++---------- > 1 files changed, 38 insertions(+), 13 deletions(-) > > diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c > index a0fec29..61dcb13 100644 > --- a/drivers/video/via/viafbdev.c > +++ b/drivers/video/via/viafbdev.c > @@ -1,5 +1,5 @@ > /* > - * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved. > + * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved. > * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. > > * This program is free software; you can redistribute it and/or > @@ -2106,7 +2106,7 @@ static int __devinit via_pci_probe(void) > unsigned long default_xres, default_yres; > char *tmpc, *tmpm; > char *tmpc_sec, *tmpm_sec; > - int vmode_index; > + int rc, vmode_index; > u32 tmds_length, lvds_length, crt_length, chip_length, viafb_par_length; > > DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n"); > @@ -2127,7 +2127,7 @@ static int __devinit via_pci_probe(void) > tmds_length + crt_length + chip_length, NULL); > if (!viafbinfo) { > printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); > - return -ENODEV; > + return -ENOMEM; > } > > viaparinfo = (struct viafb_par *)viafbinfo->par; > @@ -2154,7 +2154,9 @@ static int __devinit via_pci_probe(void) > viafb_dual_fb = 0; > > /* Set up I2C bus stuff */ > - viafb_create_i2c_bus(viaparinfo); > + rc = viafb_create_i2c_bus(viaparinfo); > + if (rc) > + goto out_fb_release; > > viafb_init_chip_info(); > viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize); > @@ -2166,7 +2168,8 @@ static int __devinit via_pci_probe(void) > > if (!viaparinfo->fbmem_virt) { I strongly recommend not to duplicate standard fields: fb_info.fix.smem_base and fb_info.fix.smem_len (and fb_info.screen_base and fb_info.screen_size). I would like to see conversion: viainfo->fbmem => viaifbnfo->screen_base (physical address) ? => viafbinfo->screen_size (physical size) viaparinfo->fbmem_virt => viafbinfo->fix.smem_start (virtual address) viaparinfo->memsize => viafbinfo->fix.smem_len (virtual size) You may try dropping the global viaparinfo pointer as well (and just get it as viafbinfo->par if needed). These changes should be sent as a separate patch. > printk(KERN_INFO "ioremap failed\n"); > - return -1; > + rc = -EIO; > + goto out_delete_i2c; > } > > viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); > @@ -2279,7 +2282,7 @@ static int __devinit via_pci_probe(void) > printk(KERN_ERR > "allocate the second framebuffer struct error\n"); > framebuffer_release(viafbinfo); > - return -ENOMEM; > + goto out_delete_i2c; > } The framebuffer_release(viafbinfo) will be called twice now. > viaparinfo1 = viafbinfo1->par; > memcpy(viaparinfo1, viaparinfo, viafb_par_length); > @@ -2340,21 +2343,26 @@ static int __devinit via_pci_probe(void) > viafb_update_viafb_par(viafbinfo); > viafb_update_fix(&viafbinfo->fix, viafbinfo); > default_var.activate = FB_ACTIVATE_NOW; > - fb_alloc_cmap(&viafbinfo->cmap, 256, 0); > + rc = fb_alloc_cmap(&viafbinfo->cmap, 256, 0); > + if (rc) > + goto out_fb1_release; > > if (viafb_dual_fb && (viafb_primary_dev == LCD_Device) > && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) { > - if (register_framebuffer(viafbinfo1) < 0) > - return -EINVAL; > + rc = register_framebuffer(viafbinfo1); > + if (rc) > + goto out_dealloc_cmap; > } > - if (register_framebuffer(viafbinfo) < 0) > - return -EINVAL; > + rc = register_framebuffer(viafbinfo); > + if (rc) > + goto out_fb1_unreg_lcd_cle266; > > if (viafb_dual_fb && ((viafb_primary_dev != LCD_Device) > || (viaparinfo->chip_info->gfx_chip_name != > UNICHROME_CLE266))) { > - if (register_framebuffer(viafbinfo1) < 0) > - return -EINVAL; > + rc = register_framebuffer(viafbinfo1); > + if (rc) > + goto out_fb_unreg; > } > DEBUG_MSG(KERN_INFO "fb%d: %s frame buffer device %dx%d-%dbpp\n", > viafbinfo->node, viafbinfo->fix.id, default_var.xres, > @@ -2363,6 +2371,23 @@ static int __devinit via_pci_probe(void) > viafb_init_proc(&viaparinfo->proc_entry); > viafb_init_dac(IGA2); > return 0; > + > +out_fb_unreg: > + unregister_framebuffer(viafbinfo); > +out_fb1_unreg_lcd_cle266: > + if (viafbinfo1 && (viafb_primary_dev == LCD_Device) > + && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) > + unregister_framebuffer(viafbinfo1); The condition here differs from the condition used during viafbinfo1 register (viafb_dual_fb vs. viafbinfo1). > +out_dealloc_cmap: > + fb_dealloc_cmap(&viafbinfo->cmap); > +out_fb1_release: > + if (viafbinfo1) > + framebuffer_release(viafbinfo1); > +out_delete_i2c: > + viafb_delete_i2c_buss(viaparinfo); > +out_fb_release: > + framebuffer_release(viafbinfo); > + return rc; > } > > static void __devexit via_pci_remove(void) > -- > 1.6.2.4 > Kind regards, Krzysztof ---------------------------------------------------------------------- Fantastyczne nagrody do zgarniecia! Zagraj >> http://link.interia.pl/f2177 |
From: Harald W. <Har...@vi...> - 2009-05-19 03:55:49
|
This patch adds support for a new VIA integrated graphics chipset, the VX855. Signed-off-by: HaraldWelte <Har...@vi...> --- drivers/video/via/chip.h | 3 + drivers/video/via/hw.c | 203 ++++++++++++++++++++++++++++-------------- drivers/video/via/hw.h | 14 +++ drivers/video/via/share.h | 98 ++++++++++++++++++++ drivers/video/via/viafbdev.c | 7 +- drivers/video/via/viamode.c | 55 +++++++++++ drivers/video/via/viamode.h | 2 + 7 files changed, 312 insertions(+), 70 deletions(-) diff --git a/drivers/video/via/chip.h b/drivers/video/via/chip.h index dde95ed..03e90cf 100644 --- a/drivers/video/via/chip.h +++ b/drivers/video/via/chip.h @@ -68,6 +68,9 @@ #define UNICHROME_VX800 11 #define UNICHROME_VX800_DID 0x1122 +#define UNICHROME_VX855 12 +#define UNICHROME_VX855_DID 0x5122 + /**************************************************/ /* Definition TMDS Trasmitter Information */ /**************************************************/ diff --git a/drivers/video/via/hw.c b/drivers/video/via/hw.c index 59ddf09..ec899e8 100644 --- a/drivers/video/via/hw.c +++ b/drivers/video/via/hw.c @@ -33,6 +33,7 @@ static const struct pci_device_id_info pciidlist[] = { {PCI_VIA_VENDOR_ID, UNICHROME_P4M900_DID, UNICHROME_P4M900}, {PCI_VIA_VENDOR_ID, UNICHROME_CN750_DID, UNICHROME_CN750}, {PCI_VIA_VENDOR_ID, UNICHROME_VX800_DID, UNICHROME_VX800}, + {PCI_VIA_VENDOR_ID, UNICHROME_VX855_DID, UNICHROME_VX855}, {0, 0, 0} }; @@ -44,102 +45,142 @@ struct offset offset_reg = { }; static struct pll_map pll_value[] = { - {CLK_25_175M, CLE266_PLL_25_175M, K800_PLL_25_175M, CX700_25_175M}, - {CLK_29_581M, CLE266_PLL_29_581M, K800_PLL_29_581M, CX700_29_581M}, - {CLK_26_880M, CLE266_PLL_26_880M, K800_PLL_26_880M, CX700_26_880M}, - {CLK_31_490M, CLE266_PLL_31_490M, K800_PLL_31_490M, CX700_31_490M}, - {CLK_31_500M, CLE266_PLL_31_500M, K800_PLL_31_500M, CX700_31_500M}, - {CLK_31_728M, CLE266_PLL_31_728M, K800_PLL_31_728M, CX700_31_728M}, - {CLK_32_668M, CLE266_PLL_32_668M, K800_PLL_32_668M, CX700_32_668M}, - {CLK_36_000M, CLE266_PLL_36_000M, K800_PLL_36_000M, CX700_36_000M}, - {CLK_40_000M, CLE266_PLL_40_000M, K800_PLL_40_000M, CX700_40_000M}, - {CLK_41_291M, CLE266_PLL_41_291M, K800_PLL_41_291M, CX700_41_291M}, - {CLK_43_163M, CLE266_PLL_43_163M, K800_PLL_43_163M, CX700_43_163M}, - {CLK_45_250M, CLE266_PLL_45_250M, K800_PLL_45_250M, CX700_45_250M}, - {CLK_46_000M, CLE266_PLL_46_000M, K800_PLL_46_000M, CX700_46_000M}, - {CLK_46_996M, CLE266_PLL_46_996M, K800_PLL_46_996M, CX700_46_996M}, - {CLK_48_000M, CLE266_PLL_48_000M, K800_PLL_48_000M, CX700_48_000M}, - {CLK_48_875M, CLE266_PLL_48_875M, K800_PLL_48_875M, CX700_48_875M}, - {CLK_49_500M, CLE266_PLL_49_500M, K800_PLL_49_500M, CX700_49_500M}, - {CLK_52_406M, CLE266_PLL_52_406M, K800_PLL_52_406M, CX700_52_406M}, - {CLK_52_977M, CLE266_PLL_52_977M, K800_PLL_52_977M, CX700_52_977M}, - {CLK_56_250M, CLE266_PLL_56_250M, K800_PLL_56_250M, CX700_56_250M}, - {CLK_60_466M, CLE266_PLL_60_466M, K800_PLL_60_466M, CX700_60_466M}, - {CLK_61_500M, CLE266_PLL_61_500M, K800_PLL_61_500M, CX700_61_500M}, - {CLK_65_000M, CLE266_PLL_65_000M, K800_PLL_65_000M, CX700_65_000M}, - {CLK_65_178M, CLE266_PLL_65_178M, K800_PLL_65_178M, CX700_65_178M}, - {CLK_66_750M, CLE266_PLL_66_750M, K800_PLL_66_750M, CX700_66_750M}, - {CLK_68_179M, CLE266_PLL_68_179M, K800_PLL_68_179M, CX700_68_179M}, - {CLK_69_924M, CLE266_PLL_69_924M, K800_PLL_69_924M, CX700_69_924M}, - {CLK_70_159M, CLE266_PLL_70_159M, K800_PLL_70_159M, CX700_70_159M}, - {CLK_72_000M, CLE266_PLL_72_000M, K800_PLL_72_000M, CX700_72_000M}, - {CLK_78_750M, CLE266_PLL_78_750M, K800_PLL_78_750M, CX700_78_750M}, - {CLK_80_136M, CLE266_PLL_80_136M, K800_PLL_80_136M, CX700_80_136M}, - {CLK_83_375M, CLE266_PLL_83_375M, K800_PLL_83_375M, CX700_83_375M}, - {CLK_83_950M, CLE266_PLL_83_950M, K800_PLL_83_950M, CX700_83_950M}, - {CLK_84_750M, CLE266_PLL_84_750M, K800_PLL_84_750M, CX700_84_750M}, - {CLK_85_860M, CLE266_PLL_85_860M, K800_PLL_85_860M, CX700_85_860M}, - {CLK_88_750M, CLE266_PLL_88_750M, K800_PLL_88_750M, CX700_88_750M}, - {CLK_94_500M, CLE266_PLL_94_500M, K800_PLL_94_500M, CX700_94_500M}, - {CLK_97_750M, CLE266_PLL_97_750M, K800_PLL_97_750M, CX700_97_750M}, + {CLK_25_175M, CLE266_PLL_25_175M, K800_PLL_25_175M, + CX700_25_175M, VX855_25_175M}, + {CLK_29_581M, CLE266_PLL_29_581M, K800_PLL_29_581M, + CX700_29_581M, VX855_29_581M}, + {CLK_26_880M, CLE266_PLL_26_880M, K800_PLL_26_880M, + CX700_26_880M, VX855_26_880M}, + {CLK_31_490M, CLE266_PLL_31_490M, K800_PLL_31_490M, + CX700_31_490M, VX855_31_490M}, + {CLK_31_500M, CLE266_PLL_31_500M, K800_PLL_31_500M, + CX700_31_500M, VX855_31_500M}, + {CLK_31_728M, CLE266_PLL_31_728M, K800_PLL_31_728M, + CX700_31_728M, VX855_31_728M}, + {CLK_32_668M, CLE266_PLL_32_668M, K800_PLL_32_668M, + CX700_32_668M, VX855_32_668M}, + {CLK_36_000M, CLE266_PLL_36_000M, K800_PLL_36_000M, + CX700_36_000M, VX855_36_000M}, + {CLK_40_000M, CLE266_PLL_40_000M, K800_PLL_40_000M, + CX700_40_000M, VX855_40_000M}, + {CLK_41_291M, CLE266_PLL_41_291M, K800_PLL_41_291M, + CX700_41_291M, VX855_41_291M}, + {CLK_43_163M, CLE266_PLL_43_163M, K800_PLL_43_163M, + CX700_43_163M, VX855_43_163M}, + {CLK_45_250M, CLE266_PLL_45_250M, K800_PLL_45_250M, + CX700_45_250M, VX855_45_250M}, + {CLK_46_000M, CLE266_PLL_46_000M, K800_PLL_46_000M, + CX700_46_000M, VX855_46_000M}, + {CLK_46_996M, CLE266_PLL_46_996M, K800_PLL_46_996M, + CX700_46_996M, VX855_46_996M}, + {CLK_48_000M, CLE266_PLL_48_000M, K800_PLL_48_000M, + CX700_48_000M, VX855_48_000M}, + {CLK_48_875M, CLE266_PLL_48_875M, K800_PLL_48_875M, + CX700_48_875M, VX855_48_875M}, + {CLK_49_500M, CLE266_PLL_49_500M, K800_PLL_49_500M, + CX700_49_500M, VX855_49_500M}, + {CLK_52_406M, CLE266_PLL_52_406M, K800_PLL_52_406M, + CX700_52_406M, VX855_52_406M}, + {CLK_52_977M, CLE266_PLL_52_977M, K800_PLL_52_977M, + CX700_52_977M, VX855_52_977M}, + {CLK_56_250M, CLE266_PLL_56_250M, K800_PLL_56_250M, + CX700_56_250M, VX855_56_250M}, + {CLK_60_466M, CLE266_PLL_60_466M, K800_PLL_60_466M, + CX700_60_466M, VX855_60_466M}, + {CLK_61_500M, CLE266_PLL_61_500M, K800_PLL_61_500M, + CX700_61_500M, VX855_61_500M}, + {CLK_65_000M, CLE266_PLL_65_000M, K800_PLL_65_000M, + CX700_65_000M, VX855_65_000M}, + {CLK_65_178M, CLE266_PLL_65_178M, K800_PLL_65_178M, + CX700_65_178M, VX855_65_178M}, + {CLK_66_750M, CLE266_PLL_66_750M, K800_PLL_66_750M, + CX700_66_750M, VX855_66_750M}, + {CLK_68_179M, CLE266_PLL_68_179M, K800_PLL_68_179M, + CX700_68_179M, VX855_68_179M}, + {CLK_69_924M, CLE266_PLL_69_924M, K800_PLL_69_924M, + CX700_69_924M, VX855_69_924M}, + {CLK_70_159M, CLE266_PLL_70_159M, K800_PLL_70_159M, + CX700_70_159M, VX855_70_159M}, + {CLK_72_000M, CLE266_PLL_72_000M, K800_PLL_72_000M, + CX700_72_000M, VX855_72_000M}, + {CLK_78_750M, CLE266_PLL_78_750M, K800_PLL_78_750M, + CX700_78_750M, VX855_78_750M}, + {CLK_80_136M, CLE266_PLL_80_136M, K800_PLL_80_136M, + CX700_80_136M, VX855_80_136M}, + {CLK_83_375M, CLE266_PLL_83_375M, K800_PLL_83_375M, + CX700_83_375M, VX855_83_375M}, + {CLK_83_950M, CLE266_PLL_83_950M, K800_PLL_83_950M, + CX700_83_950M, VX855_83_950M}, + {CLK_84_750M, CLE266_PLL_84_750M, K800_PLL_84_750M, + CX700_84_750M, VX855_84_750M}, + {CLK_85_860M, CLE266_PLL_85_860M, K800_PLL_85_860M, + CX700_85_860M, VX855_85_860M}, + {CLK_88_750M, CLE266_PLL_88_750M, K800_PLL_88_750M, + CX700_88_750M, VX855_88_750M}, + {CLK_94_500M, CLE266_PLL_94_500M, K800_PLL_94_500M, + CX700_94_500M, VX855_94_500M}, + {CLK_97_750M, CLE266_PLL_97_750M, K800_PLL_97_750M, + CX700_97_750M, VX855_97_750M}, {CLK_101_000M, CLE266_PLL_101_000M, K800_PLL_101_000M, - CX700_101_000M}, + CX700_101_000M, VX855_101_000M}, {CLK_106_500M, CLE266_PLL_106_500M, K800_PLL_106_500M, - CX700_106_500M}, + CX700_106_500M, VX855_106_500M}, {CLK_108_000M, CLE266_PLL_108_000M, K800_PLL_108_000M, - CX700_108_000M}, + CX700_108_000M, VX855_108_000M}, {CLK_113_309M, CLE266_PLL_113_309M, K800_PLL_113_309M, - CX700_113_309M}, + CX700_113_309M, VX855_113_309M}, {CLK_118_840M, CLE266_PLL_118_840M, K800_PLL_118_840M, - CX700_118_840M}, + CX700_118_840M, VX855_118_840M}, {CLK_119_000M, CLE266_PLL_119_000M, K800_PLL_119_000M, - CX700_119_000M}, + CX700_119_000M, VX855_119_000M}, {CLK_121_750M, CLE266_PLL_121_750M, K800_PLL_121_750M, - CX700_121_750M}, + CX700_121_750M, 0}, {CLK_125_104M, CLE266_PLL_125_104M, K800_PLL_125_104M, - CX700_125_104M}, + CX700_125_104M, 0}, {CLK_133_308M, CLE266_PLL_133_308M, K800_PLL_133_308M, - CX700_133_308M}, + CX700_133_308M, 0}, {CLK_135_000M, CLE266_PLL_135_000M, K800_PLL_135_000M, - CX700_135_000M}, + CX700_135_000M, VX855_135_000M}, {CLK_136_700M, CLE266_PLL_136_700M, K800_PLL_136_700M, - CX700_136_700M}, + CX700_136_700M, VX855_136_700M}, {CLK_138_400M, CLE266_PLL_138_400M, K800_PLL_138_400M, - CX700_138_400M}, + CX700_138_400M, VX855_138_400M}, {CLK_146_760M, CLE266_PLL_146_760M, K800_PLL_146_760M, - CX700_146_760M}, + CX700_146_760M, VX855_146_760M}, {CLK_153_920M, CLE266_PLL_153_920M, K800_PLL_153_920M, - CX700_153_920M}, + CX700_153_920M, VX855_153_920M}, {CLK_156_000M, CLE266_PLL_156_000M, K800_PLL_156_000M, - CX700_156_000M}, + CX700_156_000M, VX855_156_000M}, {CLK_157_500M, CLE266_PLL_157_500M, K800_PLL_157_500M, - CX700_157_500M}, + CX700_157_500M, VX855_157_500M}, {CLK_162_000M, CLE266_PLL_162_000M, K800_PLL_162_000M, - CX700_162_000M}, + CX700_162_000M, VX855_162_000M}, {CLK_187_000M, CLE266_PLL_187_000M, K800_PLL_187_000M, - CX700_187_000M}, + CX700_187_000M, VX855_187_000M}, {CLK_193_295M, CLE266_PLL_193_295M, K800_PLL_193_295M, - CX700_193_295M}, + CX700_193_295M, VX855_193_295M}, {CLK_202_500M, CLE266_PLL_202_500M, K800_PLL_202_500M, - CX700_202_500M}, + CX700_202_500M, VX855_202_500M}, {CLK_204_000M, CLE266_PLL_204_000M, K800_PLL_204_000M, - CX700_204_000M}, + CX700_204_000M, VX855_204_000M}, {CLK_218_500M, CLE266_PLL_218_500M, K800_PLL_218_500M, - CX700_218_500M}, + CX700_218_500M, VX855_218_500M}, {CLK_234_000M, CLE266_PLL_234_000M, K800_PLL_234_000M, - CX700_234_000M}, + CX700_234_000M, VX855_234_000M}, {CLK_267_250M, CLE266_PLL_267_250M, K800_PLL_267_250M, - CX700_267_250M}, + CX700_267_250M, VX855_267_250M}, {CLK_297_500M, CLE266_PLL_297_500M, K800_PLL_297_500M, - CX700_297_500M}, - {CLK_74_481M, CLE266_PLL_74_481M, K800_PLL_74_481M, CX700_74_481M}, + CX700_297_500M, VX855_297_500M}, + {CLK_74_481M, CLE266_PLL_74_481M, K800_PLL_74_481M, + CX700_74_481M, VX855_74_481M}, {CLK_172_798M, CLE266_PLL_172_798M, K800_PLL_172_798M, - CX700_172_798M}, + CX700_172_798M, VX855_172_798M}, {CLK_122_614M, CLE266_PLL_122_614M, K800_PLL_122_614M, - CX700_122_614M}, - {CLK_74_270M, CLE266_PLL_74_270M, K800_PLL_74_270M, CX700_74_270M}, + CX700_122_614M, VX855_122_614M}, + {CLK_74_270M, CLE266_PLL_74_270M, K800_PLL_74_270M, + CX700_74_270M, 0}, {CLK_148_500M, CLE266_PLL_148_500M, K800_PLL_148_500M, - CX700_148_500M} + CX700_148_500M, VX855_148_500M} }; static struct fifo_depth_select display_fifo_depth_reg = { @@ -1277,6 +1318,15 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active) VX800_IGA1_DISPLAY_QUEUE_EXPIRE_NUM; } + if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_VX855) { + iga1_fifo_max_depth = VX855_IGA1_FIFO_MAX_DEPTH; + iga1_fifo_threshold = VX855_IGA1_FIFO_THRESHOLD; + iga1_fifo_high_threshold = + VX855_IGA1_FIFO_HIGH_THRESHOLD; + iga1_display_queue_expire_num = + VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM; + } + /* Set Display FIFO Depath Select */ reg_value = IGA1_FIFO_DEPTH_SELECT_FORMULA(iga1_fifo_max_depth); viafb_load_reg_num = @@ -1408,6 +1458,15 @@ void viafb_load_FIFO_reg(int set_iga, int hor_active, int ver_active) VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM; } + if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_VX855) { + iga2_fifo_max_depth = VX855_IGA2_FIFO_MAX_DEPTH; + iga2_fifo_threshold = VX855_IGA2_FIFO_THRESHOLD; + iga2_fifo_high_threshold = + VX855_IGA2_FIFO_HIGH_THRESHOLD; + iga2_display_queue_expire_num = + VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM; + } + if (viaparinfo->chip_info->gfx_chip_name == UNICHROME_K800) { /* Set Display FIFO Depath Select */ reg_value = @@ -1496,6 +1555,8 @@ u32 viafb_get_clk_value(int clk) case UNICHROME_P4M900: case UNICHROME_VX800: return pll_value[i].cx700_pll; + case UNICHROME_VX855: + return pll_value[i].vx855_pll; } } } @@ -1529,6 +1590,7 @@ void viafb_set_vclock(u32 CLK, int set_iga) case UNICHROME_P4M890: case UNICHROME_P4M900: case UNICHROME_VX800: + case UNICHROME_VX855: viafb_write_reg(SR44, VIASR, CLK / 0x10000); DEBUG_MSG(KERN_INFO "\nSR44=%x", CLK / 0x10000); viafb_write_reg(SR45, VIASR, (CLK & 0xFFFF) / 0x100); @@ -1557,6 +1619,7 @@ void viafb_set_vclock(u32 CLK, int set_iga) case UNICHROME_P4M890: case UNICHROME_P4M900: case UNICHROME_VX800: + case UNICHROME_VX855: viafb_write_reg(SR4A, VIASR, CLK / 0x10000); viafb_write_reg(SR4B, VIASR, (CLK & 0xFFFF) / 0x100); viafb_write_reg(SR4C, VIASR, CLK % 0x100); @@ -2276,7 +2339,10 @@ int viafb_setmode(int vmode_index, int hor_res, int ver_res, int video_bpp, case UNICHROME_VX800: viafb_write_regx(VX800_ModeXregs, NUM_TOTAL_VX800_ModeXregs); + break; + case UNICHROME_VX855: + viafb_write_regx(VX855_ModeXregs, NUM_TOTAL_VX855_ModeXregs); break; } @@ -2657,6 +2723,7 @@ static int get_fb_size_from_pci(void) case P4M890_FUNCTION3: case P4M900_FUNCTION3: case VX800_FUNCTION3: + case VX855_FUNCTION3: /*case CN750_FUNCTION3: */ outl(configid + 0xA0, (unsigned long)0xCF8); FBSize = inl((unsigned long)0xCFC); @@ -2787,6 +2787,10 @@ static int get_fb_size_from_pci(void) VideoMemSize = (256 << 20); /*256M */ break; + case 0x00007000: /* Only on VX855/875 */ + VideoMemSize = (512 << 20); /*512M */ + break; + default: VideoMemSize = (32 << 20); /*32M */ break; diff --git a/drivers/video/via/hw.h b/drivers/video/via/hw.h index 6ff38fa..22786a5 100644 --- a/drivers/video/via/hw.h +++ b/drivers/video/via/hw.h @@ -335,6 +335,17 @@ is reserved, so it may have problem to set 1600x1200 on IGA2. */ /* location: {CR94,0,6} */ #define VX800_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 128 +/* For VT3409 */ +#define VX855_IGA1_FIFO_MAX_DEPTH 400 +#define VX855_IGA1_FIFO_THRESHOLD 320 +#define VX855_IGA1_FIFO_HIGH_THRESHOLD 320 +#define VX855_IGA1_DISPLAY_QUEUE_EXPIRE_NUM 160 + +#define VX855_IGA2_FIFO_MAX_DEPTH 200 +#define VX855_IGA2_FIFO_THRESHOLD 160 +#define VX855_IGA2_FIFO_HIGH_THRESHOLD 160 +#define VX855_IGA2_DISPLAY_QUEUE_EXPIRE_NUM 320 + #define IGA1_FIFO_DEPTH_SELECT_REG_NUM 1 #define IGA1_FIFO_THRESHOLD_REG_NUM 2 #define IGA1_FIFO_HIGH_THRESHOLD_REG_NUM 2 @@ -716,6 +727,7 @@ struct pll_map { u32 cle266_pll; u32 k800_pll; u32 cx700_pll; + u32 vx855_pll; }; struct rgbLUT { @@ -860,6 +872,8 @@ struct iga2_crtc_timing { #define P4M900_FUNCTION3 0x3364 /* VT3353 chipset*/ #define VX800_FUNCTION3 0x3353 +/* VT3409 chipset*/ +#define VX855_FUNCTION3 0x3409 #define NUM_TOTAL_PLL_TABLE ARRAY_SIZE(pll_value) diff --git a/drivers/video/via/share.h b/drivers/video/via/share.h index 2e1254d..1eacd1c 100644 --- a/drivers/video/via/share.h +++ b/drivers/video/via/share.h @@ -167,6 +167,10 @@ #define SR4B 0x4B #define SR4C 0x4C #define SR52 0x52 +#define SR57 0x57 +#define SR58 0x58 +#define SR59 0x59 +#define SR5D 0x5D #define SR5E 0x5E #define SR65 0x65 @@ -966,6 +970,100 @@ #define CX700_297_500M 0x00CE0403 #define CX700_122_614M 0x00870802 +/* PLL for VX855 */ +#define VX855_22_000M 0x007B1005 +#define VX855_25_175M 0x008D1005 +#define VX855_26_719M 0x00961005 +#define VX855_26_880M 0x00961005 +#define VX855_27_000M 0x00971005 +#define VX855_29_581M 0x00A51005 +#define VX855_29_829M 0x00641003 +#define VX855_31_490M 0x00B01005 +#define VX855_31_500M 0x00B01005 +#define VX855_31_728M 0x008E1004 +#define VX855_32_668M 0x00921004 +#define VX855_36_000M 0x00A11004 +#define VX855_40_000M 0x00700C05 +#define VX855_41_291M 0x00730C05 +#define VX855_43_163M 0x00790C05 +#define VX855_45_250M 0x007F0C05 /* 45.46MHz */ +#define VX855_46_000M 0x00670C04 +#define VX855_46_996M 0x00690C04 +#define VX855_48_000M 0x00860C05 +#define VX855_48_875M 0x00890C05 +#define VX855_49_500M 0x00530C03 +#define VX855_52_406M 0x00580C03 +#define VX855_52_977M 0x00940C05 +#define VX855_56_250M 0x009D0C05 +#define VX855_60_466M 0x00A90C05 +#define VX855_61_500M 0x00AC0C05 +#define VX855_65_000M 0x006D0C03 +#define VX855_65_178M 0x00B60C05 +#define VX855_66_750M 0x00700C03 /*67.116MHz */ +#define VX855_67_295M 0x00BC0C05 +#define VX855_68_179M 0x00BF0C05 +#define VX855_68_369M 0x00BF0C05 +#define VX855_69_924M 0x00C30C05 +#define VX855_70_159M 0x00C30C05 +#define VX855_72_000M 0x00A10C04 +#define VX855_73_023M 0x00CC0C05 +#define VX855_74_481M 0x00D10C05 +#define VX855_78_750M 0x006E0805 +#define VX855_79_466M 0x006F0805 +#define VX855_80_136M 0x00700805 +#define VX855_81_627M 0x00720805 +#define VX855_83_375M 0x00750805 +#define VX855_83_527M 0x00750805 +#define VX855_83_950M 0x00750805 +#define VX855_84_537M 0x00760805 +#define VX855_84_750M 0x00760805 /* 84.537Mhz */ +#define VX855_85_500M 0x00760805 /* 85.909080 MHz*/ +#define VX855_85_860M 0x00760805 +#define VX855_85_909M 0x00760805 +#define VX855_88_750M 0x007C0805 +#define VX855_89_489M 0x007D0805 +#define VX855_94_500M 0x00840805 +#define VX855_96_648M 0x00870805 +#define VX855_97_750M 0x00890805 +#define VX855_101_000M 0x008D0805 +#define VX855_106_500M 0x00950805 +#define VX855_108_000M 0x00970805 +#define VX855_110_125M 0x00990805 +#define VX855_112_000M 0x009D0805 +#define VX855_113_309M 0x009F0805 +#define VX855_115_000M 0x00A10805 +#define VX855_118_840M 0x00A60805 +#define VX855_119_000M 0x00A70805 +#define VX855_121_750M 0x00AA0805 /* 121.704MHz */ +#define VX855_122_614M 0x00AC0805 +#define VX855_126_266M 0x00B10805 +#define VX855_130_250M 0x00B60805 /* 130.250 */ +#define VX855_135_000M 0x00BD0805 +#define VX855_136_700M 0x00BF0805 +#define VX855_137_750M 0x00C10805 +#define VX855_138_400M 0x00C20805 +#define VX855_144_300M 0x00CA0805 +#define VX855_146_760M 0x00CE0805 +#define VX855_148_500M 0x00D00805 +#define VX855_153_920M 0x00540402 +#define VX855_156_000M 0x006C0405 +#define VX855_156_867M 0x006E0405 +#define VX855_157_500M 0x006E0405 +#define VX855_162_000M 0x00710405 +#define VX855_172_798M 0x00790405 +#define VX855_187_000M 0x00830405 +#define VX855_193_295M 0x00870405 +#define VX855_202_500M 0x008E0405 +#define VX855_204_000M 0x008F0405 +#define VX855_218_500M 0x00990405 +#define VX855_229_500M 0x00A10405 +#define VX855_234_000M 0x00A40405 +#define VX855_267_250M 0x00BB0405 +#define VX855_297_500M 0x00D00405 +#define VX855_339_500M 0x00770005 +#define VX855_340_772M 0x00770005 + + /* Definition CRTC Timing Index */ #define H_TOTAL_INDEX 0 #define H_ADDR_INDEX 1 diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index 61dcb13..055d67d 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -218,7 +218,8 @@ static int viafb_check_var(struct fb_var_screeninfo *var, if (!info->par) return -1; p_viafb_par = (struct viafb_par *)info->par; - if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800) + if (p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX800 || + p_viafb_par->chip_info->gfx_chip_name == UNICHROME_VX855) var->accel_flags = 0; return 0; @@ -1162,8 +1163,10 @@ static int viafb_cursor(struct fb_info *info, struct fb_cursor *cursor) if ((p_viafb_par->chip_info->gfx_chip_name == UNICHROME_CX700) || + (p_viafb_par->chip_info->gfx_chip_name == + UNICHROME_VX800) || ((p_viafb_par->chip_info->gfx_chip_name == - UNICHROME_VX800))) { + UNICHROME_VX855))) { bg_col = (((info->cmap.red)[viacursor.image.bg_color] & 0xFFC0) << 14) | diff --git a/drivers/video/via/viamode.c b/drivers/video/via/viamode.c index 6dcf583..209c3af 100644 --- a/drivers/video/via/viamode.c +++ b/drivers/video/via/viamode.c @@ -390,6 +390,61 @@ struct io_reg VX800_ModeXregs[] = { {VIASR, SR10, 0xFF, 0x01}, {VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */ }; +struct io_reg VX855_ModeXregs[] = { +{VIASR, SR10, 0xFF, 0x01}, +{VIASR, SR15, 0x02, 0x02}, +{VIASR, SR16, 0xBF, 0x08}, +{VIASR, SR17, 0xFF, 0x1F}, +{VIASR, SR18, 0xFF, 0x4E}, +{VIASR, SR1A, 0xFB, 0x08}, +{VIASR, SR1B, 0xFF, 0xF0}, +{VIASR, SR1E, 0x07, 0x01}, +{VIASR, SR2A, 0xF0, 0x00}, +{VIASR, SR58, 0xFF, 0x00}, +{VIASR, SR59, 0xFF, 0x00}, +{VIASR, SR2D, 0xFF, 0xFF}, /* VCK and LCK PLL power on. */ +{VIACR, CR09, 0xFF, 0x00}, /* Initial CR09=0*/ +{VIACR, CR11, 0x8F, 0x00}, /* IGA1 initial Vertical end */ +{VIACR, CR17, 0x7F, 0x00}, /* IGA1 CRT Mode control init */ +{VIACR, CR0A, 0xFF, 0x1E}, /* Cursor Start */ +{VIACR, CR0B, 0xFF, 0x00}, /* Cursor End */ +{VIACR, CR0E, 0xFF, 0x00}, /* Cursor Location High */ +{VIACR, CR0F, 0xFF, 0x00}, /* Cursor Localtion Low */ +{VIACR, CR32, 0xFF, 0x00}, +{VIACR, CR33, 0x7F, 0x00}, +{VIACR, CR34, 0xFF, 0x00}, +{VIACR, CR35, 0xFF, 0x00}, +{VIACR, CR36, 0x08, 0x00}, +{VIACR, CR69, 0xFF, 0x00}, +{VIACR, CR6A, 0xFD, 0x60}, +{VIACR, CR6B, 0xFF, 0x00}, +{VIACR, CR6C, 0xFF, 0x00}, +{VIACR, CR7A, 0xFF, 0x01}, /* LCD Scaling Parameter 1 */ +{VIACR, CR7B, 0xFF, 0x02}, /* LCD Scaling Parameter 2 */ +{VIACR, CR7C, 0xFF, 0x03}, /* LCD Scaling Parameter 3 */ +{VIACR, CR7D, 0xFF, 0x04}, /* LCD Scaling Parameter 4 */ +{VIACR, CR7E, 0xFF, 0x07}, /* LCD Scaling Parameter 5 */ +{VIACR, CR7F, 0xFF, 0x0A}, /* LCD Scaling Parameter 6 */ +{VIACR, CR80, 0xFF, 0x0D}, /* LCD Scaling Parameter 7 */ +{VIACR, CR81, 0xFF, 0x13}, /* LCD Scaling Parameter 8 */ +{VIACR, CR82, 0xFF, 0x16}, /* LCD Scaling Parameter 9 */ +{VIACR, CR83, 0xFF, 0x19}, /* LCD Scaling Parameter 10 */ +{VIACR, CR84, 0xFF, 0x1C}, /* LCD Scaling Parameter 11 */ +{VIACR, CR85, 0xFF, 0x1D}, /* LCD Scaling Parameter 12 */ +{VIACR, CR86, 0xFF, 0x1E}, /* LCD Scaling Parameter 13 */ +{VIACR, CR87, 0xFF, 0x1F}, /* LCD Scaling Parameter 14 */ +{VIACR, CR88, 0xFF, 0x40}, /* LCD Panel Type */ +{VIACR, CR89, 0xFF, 0x00}, /* LCD Timing Control 0 */ +{VIACR, CR8A, 0xFF, 0x88}, /* LCD Timing Control 1 */ +{VIACR, CRD4, 0xFF, 0x81}, /* Second power sequence control */ +{VIACR, CR91, 0xFF, 0x80}, /* 24/12 bit LVDS Data off */ +{VIACR, CR96, 0xFF, 0x00}, +{VIACR, CR97, 0xFF, 0x00}, +{VIACR, CR99, 0xFF, 0x00}, +{VIACR, CR9B, 0xFF, 0x00}, +{VIACR, CRD2, 0xFF, 0xFF} /* TMDS/LVDS control register. */ +}; + /* Video Mode Table */ /* Common Setting for Video Mode */ struct io_reg CLE266_ModeXregs[] = { {VIASR, SR1E, 0xF0, 0x00}, diff --git a/drivers/video/via/viamode.h b/drivers/video/via/viamode.h index 1a5de50..3636694 100644 --- a/drivers/video/via/viamode.h +++ b/drivers/video/via/viamode.h @@ -57,6 +57,7 @@ struct res_map_refresh { #define NUM_TOTAL_KM400_ModeXregs ARRAY_SIZE(KM400_ModeXregs) #define NUM_TOTAL_CX700_ModeXregs ARRAY_SIZE(CX700_ModeXregs) #define NUM_TOTAL_VX800_ModeXregs ARRAY_SIZE(VX800_ModeXregs) +#define NUM_TOTAL_VX855_ModeXregs ARRAY_SIZE(VX855_ModeXregs) #define NUM_TOTAL_CLE266_ModeXregs ARRAY_SIZE(CLE266_ModeXregs) #define NUM_TOTAL_PATCH_MODE ARRAY_SIZE(res_patch_table) #define NUM_TOTAL_MODETABLE ARRAY_SIZE(CLE266Modes) @@ -170,6 +171,7 @@ extern struct io_reg CN700_ModeXregs[66]; extern struct io_reg KM400_ModeXregs[55]; extern struct io_reg CX700_ModeXregs[58]; extern struct io_reg VX800_ModeXregs[58]; +extern struct io_reg VX855_ModeXregs[52]; extern struct io_reg CLE266_ModeXregs[32]; extern struct io_reg PM1024x768[2]; extern struct patch_table res_patch_table[1]; -- 1.6.2.4 |
From: Harald W. <Har...@vi...> - 2009-05-19 03:55:46
|
The current code executed from module_init() in viafb does not have proper error checking and [partial] resoure release paths in case an error happens half way through driver initialization. This patch adresses the most obvious of those issues, such as a leftover i2c bus if module_init (and thus module load) fails. Signed-off-by: Harald Welte <Har...@vi...> --- drivers/video/via/viafbdev.c | 51 +++++++++++++++++++++++++++++++---------- 1 files changed, 38 insertions(+), 13 deletions(-) diff --git a/drivers/video/via/viafbdev.c b/drivers/video/via/viafbdev.c index a0fec29..61dcb13 100644 --- a/drivers/video/via/viafbdev.c +++ b/drivers/video/via/viafbdev.c @@ -1,5 +1,5 @@ /* - * Copyright 1998-2008 VIA Technologies, Inc. All Rights Reserved. + * Copyright 1998-2009 VIA Technologies, Inc. All Rights Reserved. * Copyright 2001-2008 S3 Graphics, Inc. All Rights Reserved. * This program is free software; you can redistribute it and/or @@ -2106,7 +2106,7 @@ static int __devinit via_pci_probe(void) unsigned long default_xres, default_yres; char *tmpc, *tmpm; char *tmpc_sec, *tmpm_sec; - int vmode_index; + int rc, vmode_index; u32 tmds_length, lvds_length, crt_length, chip_length, viafb_par_length; DEBUG_MSG(KERN_INFO "VIAFB PCI Probe!!\n"); @@ -2127,7 +2127,7 @@ static int __devinit via_pci_probe(void) tmds_length + crt_length + chip_length, NULL); if (!viafbinfo) { printk(KERN_ERR"Could not allocate memory for viafb_info.\n"); - return -ENODEV; + return -ENOMEM; } viaparinfo = (struct viafb_par *)viafbinfo->par; @@ -2154,7 +2154,9 @@ static int __devinit via_pci_probe(void) viafb_dual_fb = 0; /* Set up I2C bus stuff */ - viafb_create_i2c_bus(viaparinfo); + rc = viafb_create_i2c_bus(viaparinfo); + if (rc) + goto out_fb_release; viafb_init_chip_info(); viafb_get_fb_info(&viaparinfo->fbmem, &viaparinfo->memsize); @@ -2166,7 +2168,8 @@ static int __devinit via_pci_probe(void) if (!viaparinfo->fbmem_virt) { printk(KERN_INFO "ioremap failed\n"); - return -1; + rc = -EIO; + goto out_delete_i2c; } viafb_get_mmio_info(&viaparinfo->mmio_base, &viaparinfo->mmio_len); @@ -2279,7 +2282,7 @@ static int __devinit via_pci_probe(void) printk(KERN_ERR "allocate the second framebuffer struct error\n"); framebuffer_release(viafbinfo); - return -ENOMEM; + goto out_delete_i2c; } viaparinfo1 = viafbinfo1->par; memcpy(viaparinfo1, viaparinfo, viafb_par_length); @@ -2340,21 +2343,26 @@ static int __devinit via_pci_probe(void) viafb_update_viafb_par(viafbinfo); viafb_update_fix(&viafbinfo->fix, viafbinfo); default_var.activate = FB_ACTIVATE_NOW; - fb_alloc_cmap(&viafbinfo->cmap, 256, 0); + rc = fb_alloc_cmap(&viafbinfo->cmap, 256, 0); + if (rc) + goto out_fb1_release; if (viafb_dual_fb && (viafb_primary_dev == LCD_Device) && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) { - if (register_framebuffer(viafbinfo1) < 0) - return -EINVAL; + rc = register_framebuffer(viafbinfo1); + if (rc) + goto out_dealloc_cmap; } - if (register_framebuffer(viafbinfo) < 0) - return -EINVAL; + rc = register_framebuffer(viafbinfo); + if (rc) + goto out_fb1_unreg_lcd_cle266; if (viafb_dual_fb && ((viafb_primary_dev != LCD_Device) || (viaparinfo->chip_info->gfx_chip_name != UNICHROME_CLE266))) { - if (register_framebuffer(viafbinfo1) < 0) - return -EINVAL; + rc = register_framebuffer(viafbinfo1); + if (rc) + goto out_fb_unreg; } DEBUG_MSG(KERN_INFO "fb%d: %s frame buffer device %dx%d-%dbpp\n", viafbinfo->node, viafbinfo->fix.id, default_var.xres, @@ -2363,6 +2371,23 @@ static int __devinit via_pci_probe(void) viafb_init_proc(&viaparinfo->proc_entry); viafb_init_dac(IGA2); return 0; + +out_fb_unreg: + unregister_framebuffer(viafbinfo); +out_fb1_unreg_lcd_cle266: + if (viafbinfo1 && (viafb_primary_dev == LCD_Device) + && (viaparinfo->chip_info->gfx_chip_name == UNICHROME_CLE266)) + unregister_framebuffer(viafbinfo1); +out_dealloc_cmap: + fb_dealloc_cmap(&viafbinfo->cmap); +out_fb1_release: + if (viafbinfo1) + framebuffer_release(viafbinfo1); +out_delete_i2c: + viafb_delete_i2c_buss(viaparinfo); +out_fb_release: + framebuffer_release(viafbinfo); + return rc; } static void __devexit via_pci_remove(void) -- 1.6.2.4 |